sync with OpenBSD -current

This commit is contained in:
purplerain 2024-01-26 22:08:02 +00:00
parent 25f7188861
commit 8ff00f10fc
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
2137 changed files with 177389 additions and 104447 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pmap.c,v 1.100 2023/12/11 22:12:53 kettenis Exp $ */
/* $OpenBSD: pmap.c,v 1.101 2024/01/26 19:23:03 kettenis Exp $ */
/*
* Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com>
*
@ -792,7 +792,7 @@ pmap_fill_pte(pmap_t pm, vaddr_t va, paddr_t pa, struct pte_desc *pted,
case PMAP_CACHE_DEV_NGNRE:
break;
default:
panic("pmap_fill_pte:invalid cache mode");
panic("%s: invalid cache mode", __func__);
}
pted->pted_va |= cache;
@ -1682,7 +1682,7 @@ pmap_pte_update(struct pte_desc *pted, uint64_t *pl3)
attr |= ATTR_SH(SH_INNER);
break;
default:
panic("pmap_pte_insert: invalid cache mode");
panic("%s: invalid cache mode", __func__);
}
if (pm->pm_privileged)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ehci_fdt.c,v 1.10 2023/04/03 01:57:41 dlg Exp $ */
/* $OpenBSD: ehci_fdt.c,v 1.11 2024/01/26 17:11:50 kettenis Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@ -205,6 +205,7 @@ struct ehci_phy ehci_phys[] = {
{ "allwinner,sun8i-h3-usb-phy", sun4i_phy_init },
{ "allwinner,sun8i-r40-usb-phy", sun4i_phy_init },
{ "allwinner,sun8i-v3s-usb-phy", sun4i_phy_init },
{ "allwinner,sun20i-d1-usb-phy", sun4i_phy_init },
{ "allwinner,sun50i-h6-usb-phy", sun4i_phy_init },
{ "allwinner,sun50i-a64-usb-phy", sun4i_phy_init },
{ "allwinner,sun9i-a80-usb-phy", sun9i_phy_init },
@ -305,7 +306,7 @@ sun4i_phy_init(struct ehci_fdt_softc *sc, uint32_t *cells)
/*
* We need to poke an undocumented register to make the PHY
* work on Allwinner A64/H3/H5/R40.
* work on Allwinner A64/D1/H3/H5/R40.
*/
if (OF_is_compatible(node, "allwinner,sun8i-h3-usb-phy") ||
OF_is_compatible(node, "allwinner,sun8i-r40-usb-phy") ||
@ -314,6 +315,10 @@ sun4i_phy_init(struct ehci_fdt_softc *sc, uint32_t *cells)
val = bus_space_read_4(sc->sc.iot, sc->sc.ioh, 0x810);
val &= ~(1 << 1);
bus_space_write_4(sc->sc.iot, sc->sc.ioh, 0x810, val);
} else if (OF_is_compatible(node, "allwinner,sun20i-d1-usb-phy")) {
val = bus_space_read_4(sc->sc.iot, sc->sc.ioh, 0x810);
val &= ~(1 << 3);
bus_space_write_4(sc->sc.iot, sc->sc.ioh, 0x810, val);
}
pinctrl_byname(node, "default");

View file

@ -1,4 +1,4 @@
/* $OpenBSD: sxiccmu.c,v 1.32 2023/08/15 08:27:30 miod Exp $ */
/* $OpenBSD: sxiccmu.c,v 1.33 2024/01/26 17:50:00 kettenis Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Artturi Alm
@ -98,6 +98,8 @@ uint32_t sxiccmu_a64_get_frequency(struct sxiccmu_softc *, uint32_t);
int sxiccmu_a64_set_frequency(struct sxiccmu_softc *, uint32_t, uint32_t);
uint32_t sxiccmu_a80_get_frequency(struct sxiccmu_softc *, uint32_t);
int sxiccmu_a80_set_frequency(struct sxiccmu_softc *, uint32_t, uint32_t);
uint32_t sxiccmu_d1_get_frequency(struct sxiccmu_softc *, uint32_t);
int sxiccmu_d1_set_frequency(struct sxiccmu_softc *, uint32_t, uint32_t);
uint32_t sxiccmu_h3_get_frequency(struct sxiccmu_softc *, uint32_t);
int sxiccmu_h3_set_frequency(struct sxiccmu_softc *, uint32_t, uint32_t);
uint32_t sxiccmu_h3_r_get_frequency(struct sxiccmu_softc *, uint32_t);
@ -145,6 +147,7 @@ sxiccmu_match(struct device *parent, void *match, void *aux)
OF_is_compatible(node, "allwinner,sun9i-a80-ccu") ||
OF_is_compatible(node, "allwinner,sun9i-a80-usb-clks") ||
OF_is_compatible(node, "allwinner,sun9i-a80-mmc-config-clk") ||
OF_is_compatible(node, "allwinner,sun20i-d1-ccu") ||
OF_is_compatible(node, "allwinner,sun50i-a64-ccu") ||
OF_is_compatible(node, "allwinner,sun50i-a64-r-ccu") ||
OF_is_compatible(node, "allwinner,sun50i-h5-ccu") ||
@ -252,6 +255,14 @@ sxiccmu_attach(struct device *parent, struct device *self, void *aux)
sc->sc_nresets = nitems(sun9i_a80_mmc_resets);
sc->sc_get_frequency = sxiccmu_nop_get_frequency;
sc->sc_set_frequency = sxiccmu_nop_set_frequency;
} else if (OF_is_compatible(node, "allwinner,sun20i-d1-ccu")) {
KASSERT(faa->fa_nreg > 0);
sc->sc_gates = sun20i_d1_gates;
sc->sc_ngates = nitems(sun20i_d1_gates);
sc->sc_resets = sun20i_d1_resets;
sc->sc_nresets = nitems(sun20i_d1_resets);
sc->sc_get_frequency = sxiccmu_d1_get_frequency;
sc->sc_set_frequency = sxiccmu_d1_set_frequency;
} else if (OF_is_compatible(node, "allwinner,sun50i-a64-ccu")) {
KASSERT(faa->fa_nreg > 0);
sc->sc_gates = sun50i_a64_gates;
@ -1156,6 +1167,21 @@ sxiccmu_a80_get_frequency(struct sxiccmu_softc *sc, uint32_t idx)
return 0;
}
/* Allwinner D1 */
uint32_t
sxiccmu_d1_get_frequency(struct sxiccmu_softc *sc, uint32_t idx)
{
switch (idx) {
case D1_CLK_APB1:
/* XXX Controlled by a MUX. */
return 24000000;
}
printf("%s: 0x%08x\n", __func__, idx);
return 0;
}
/* Allwinner H3/H5 */
#define H3_PLL_CPUX_CTRL_REG 0x0000
#define H3_PLL_CPUX_ENABLE (1U << 31)
@ -1645,6 +1671,13 @@ sxiccmu_a80_set_frequency(struct sxiccmu_softc *sc, uint32_t idx, uint32_t freq)
return -1;
}
int
sxiccmu_d1_set_frequency(struct sxiccmu_softc *sc, uint32_t idx, uint32_t freq)
{
printf("%s: 0x%08x\n", __func__, idx);
return -1;
}
int
sxiccmu_h3_set_frequency(struct sxiccmu_softc *sc, uint32_t idx, uint32_t freq)
{

View file

@ -302,6 +302,37 @@ const struct sxiccmu_ccu_bit sun9i_a80_mmc_gates[] = {
{ 0x000c, 16 },
};
/* D1 */
#define D1_CLK_APB1 25
#define D1_CLK_BUS_UART0 62
#define D1_CLK_BUS_UART1 63
#define D1_CLK_BUS_UART2 64
#define D1_CLK_BUS_UART3 65
#define D1_CLK_BUS_UART4 66
#define D1_CLK_BUS_UART5 67
#define D1_CLK_USB_OHCI0 97
#define D1_CLK_USB_OHCI1 98
#define D1_CLK_BUS_OHCI0 99
#define D1_CLK_BUS_OHCI1 100
#define D1_CLK_BUS_EHCI0 101
#define D1_CLK_BUS_EHCI1 102
const struct sxiccmu_ccu_bit sun20i_d1_gates[] = {
[D1_CLK_BUS_UART0] = { 0x090c, 0, D1_CLK_APB1 },
[D1_CLK_BUS_UART1] = { 0x090c, 1, D1_CLK_APB1 },
[D1_CLK_BUS_UART2] = { 0x090c, 2, D1_CLK_APB1 },
[D1_CLK_BUS_UART3] = { 0x090c, 3, D1_CLK_APB1 },
[D1_CLK_BUS_UART4] = { 0x090c, 4, D1_CLK_APB1 },
[D1_CLK_BUS_UART5] = { 0x090c, 5, D1_CLK_APB1 },
[D1_CLK_USB_OHCI0] = { 0x0a70, 31 },
[D1_CLK_USB_OHCI1] = { 0x0a74, 31 },
[D1_CLK_BUS_OHCI0] = { 0x0a8c, 0 },
[D1_CLK_BUS_OHCI1] = { 0x0a8c, 1 },
[D1_CLK_BUS_EHCI0] = { 0x0a8c, 4 },
[D1_CLK_BUS_EHCI1] = { 0x0a8c, 5 },
};
/* H3/H5 */
#define H3_CLK_PLL_CPUX 0
@ -768,6 +799,36 @@ const struct sxiccmu_ccu_bit sun9i_a80_mmc_resets[] = {
{ 0x000c, 18 },
};
/* D1 */
#define D1_RST_BUS_UART0 18
#define D1_RST_BUS_UART1 19
#define D1_RST_BUS_UART2 20
#define D1_RST_BUS_UART3 21
#define D1_RST_BUS_UART4 22
#define D1_RST_BUS_UART5 23
#define D1_RST_USB_PHY0 40
#define D1_RST_USB_PHY1 41
#define D1_RST_BUS_OHCI0 42
#define D1_RST_BUS_OHCI1 43
#define D1_RST_BUS_EHCI0 44
#define D1_RST_BUS_EHCI1 45
const struct sxiccmu_ccu_bit sun20i_d1_resets[] = {
[D1_RST_BUS_UART0] = { 0x090c, 16 },
[D1_RST_BUS_UART1] = { 0x090c, 17 },
[D1_RST_BUS_UART2] = { 0x090c, 18 },
[D1_RST_BUS_UART3] = { 0x090c, 19 },
[D1_RST_BUS_UART4] = { 0x090c, 20 },
[D1_RST_BUS_UART5] = { 0x090c, 21 },
[D1_RST_USB_PHY0] = { 0x0a70, 30 },
[D1_RST_USB_PHY1] = { 0x0a74, 30 },
[D1_RST_BUS_OHCI0] = { 0x0a8c, 16 },
[D1_RST_BUS_OHCI1] = { 0x0a8c, 17 },
[D1_RST_BUS_EHCI0] = { 0x0a8c, 20 },
[D1_RST_BUS_EHCI1] = { 0x0a8c, 21 },
};
/* H3/H5 */
#define H3_RST_USB_PHY0 0

View file

@ -1,4 +1,4 @@
/* $OpenBSD: sxidog.c,v 1.3 2021/10/24 17:52:27 mpi Exp $ */
/* $OpenBSD: sxidog.c,v 1.4 2024/01/26 17:03:45 kettenis Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@ -55,6 +55,7 @@ struct sxidog_softc {
int sc_type;
#define SXIDOG_A10 0
#define SXIDOG_A31 1
uint32_t sc_key;
};
struct sxidog_softc *sxidog_sc = NULL; /* for sxidog_reset() */
@ -80,7 +81,8 @@ sxidog_match(struct device *parent, void *match, void *aux)
struct fdt_attach_args *faa = aux;
return (OF_is_compatible(faa->fa_node, "allwinner,sun4i-a10-wdt") ||
OF_is_compatible(faa->fa_node, "allwinner,sun6i-a31-wdt"));
OF_is_compatible(faa->fa_node, "allwinner,sun6i-a31-wdt") ||
OF_is_compatible(faa->fa_node, "allwinner,sun20i-d1-wdt"));
}
void
@ -97,11 +99,18 @@ sxidog_attach(struct device *parent, struct device *self, void *aux)
faa->fa_reg[0].size, 0, &sc->sc_ioh))
panic("sxidog_attach: bus_space_map failed!");
if (OF_is_compatible(faa->fa_node, "allwinner,sun6i-a31-wdt")) {
SXIWRITE4(sc, WDOG0_CFG_REG, WDOG0_RST_EN);
if (OF_is_compatible(faa->fa_node, "allwinner,sun20i-d1-wdt"))
sc->sc_key = 0x16aa0000;
if (OF_is_compatible(faa->fa_node, "allwinner,sun6i-a31-wdt") ||
OF_is_compatible(faa->fa_node, "allwinner,sun20i-d1-wdt")) {
SXIWRITE4(sc, WDOG0_MODE_REG, sc->sc_key);
SXIWRITE4(sc, WDOG0_CFG_REG, WDOG0_RST_EN | sc->sc_key);
sc->sc_type = SXIDOG_A31;
} else
} else {
SXIWRITE4(sc, WDOG_MODE_REG, 0);
sc->sc_type = SXIDOG_A10;
}
sxidog_sc = sc;
cpuresetfn = sxidog_reset;
@ -152,7 +161,7 @@ sxidog_callback(void *arg, int period)
case SXIDOG_A31:
enable = (period > 0) ? WDOG0_EN : 0;
SXIWRITE4(sc, WDOG0_MODE_REG,
enable | WDOG0_INTV_VALUE(period));
enable | WDOG0_INTV_VALUE(period) | sc->sc_key);
SXIWRITE4(sc, WDOG0_CTRL_REG, WDOG0_KEY | WDOG0_RSTART);
break;
}

View file

@ -1085,9 +1085,6 @@ out:
static int amdgpu_acpi_enumerate_xcc(void)
{
STUB();
return -ENOSYS;
#ifdef notyet
struct amdgpu_acpi_dev_info *dev_info = NULL;
struct amdgpu_acpi_xcc_info *xcc_info;
struct acpi_device *acpi_dev;
@ -1098,6 +1095,7 @@ static int amdgpu_acpi_enumerate_xcc(void)
INIT_LIST_HEAD(&amdgpu_acpi_dev_list);
xa_init(&numa_info_xa);
#ifdef notyet
for (id = 0; id < AMD_XCC_MAX_HID; id++) {
snprintf(hid, sizeof(hid), "%s%d", "AMD", AMD_XCC_HID_START + id);
acpi_dev = acpi_dev_get_first_match_dev(hid, NULL, -1);
@ -1142,9 +1140,9 @@ static int amdgpu_acpi_enumerate_xcc(void)
list_add_tail(&xcc_info->list, &dev_info->xcc_list);
}
#endif
return 0;
#endif
}
int amdgpu_acpi_get_tmr_info(struct amdgpu_device *adev, u64 *tmr_offset,

View file

@ -51,4 +51,6 @@ struct pci_device_id {
unsigned long driver_data;
};
#define ACPI_ID_LEN 16
#endif

View file

@ -176,4 +176,10 @@ xa_empty(const struct xarray *xa)
return SPLAY_EMPTY(&xa->xa_tree);
}
static inline void
xa_init(struct xarray *xa)
{
xa_init_flags(xa, 0);
}
#endif

View file

@ -1,10 +1,10 @@
/* $OpenBSD: init_sysent.c,v 1.273 2023/12/19 06:59:17 deraadt Exp $ */
/* $OpenBSD: init_sysent.c,v 1.274 2024/01/26 18:24:58 mvs Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.255 2023/12/19 06:58:36 deraadt Exp
* created from; OpenBSD: syscalls.master,v 1.257 2024/01/26 18:24:23 mvs Exp
*/
#include <sys/param.h>
@ -244,7 +244,7 @@ const struct sysent sysent[] = {
sys_bind }, /* 104 = bind */
{ 5, s(struct sys_setsockopt_args), SY_NOLOCK | 0,
sys_setsockopt }, /* 105 = setsockopt */
{ 2, s(struct sys_listen_args), 0,
{ 2, s(struct sys_listen_args), SY_NOLOCK | 0,
sys_listen }, /* 106 = listen */
{ 4, s(struct sys_chflagsat_args), 0,
sys_chflagsat }, /* 107 = chflagsat */

View file

@ -1,10 +1,10 @@
/* $OpenBSD: syscalls.c,v 1.271 2023/12/19 06:59:17 deraadt Exp $ */
/* $OpenBSD: syscalls.c,v 1.272 2024/01/26 18:24:58 mvs Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.255 2023/12/19 06:58:36 deraadt Exp
* created from; OpenBSD: syscalls.master,v 1.257 2024/01/26 18:24:23 mvs Exp
*/
const char *const syscallnames[] = {

View file

@ -1,4 +1,4 @@
; $OpenBSD: syscalls.master,v 1.256 2023/12/21 19:34:07 miod Exp $
; $OpenBSD: syscalls.master,v 1.257 2024/01/26 18:24:23 mvs Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@ -223,7 +223,7 @@
socklen_t namelen); }
105 STD NOLOCK { int sys_setsockopt(int s, int level, int name, \
const void *val, socklen_t valsize); }
106 STD { int sys_listen(int s, int backlog); }
106 STD NOLOCK { int sys_listen(int s, int backlog); }
107 STD { int sys_chflagsat(int fd, const char *path, \
u_int flags, int atflags); }
108 STD NOLOCK { int sys_pledge(const char *promises, \

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_socket.c,v 1.314 2024/01/12 10:48:03 bluhm Exp $ */
/* $OpenBSD: uipc_socket.c,v 1.315 2024/01/26 18:24:23 mvs Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@ -226,6 +226,8 @@ sobind(struct socket *so, struct mbuf *nam, struct proc *p)
int
solisten(struct socket *so, int backlog)
{
int somaxconn_local = READ_ONCE(somaxconn);
int sominconn_local = READ_ONCE(sominconn);
int error;
soassertlocked(so);
@ -241,10 +243,10 @@ solisten(struct socket *so, int backlog)
return (error);
if (TAILQ_FIRST(&so->so_q) == NULL)
so->so_options |= SO_ACCEPTCONN;
if (backlog < 0 || backlog > somaxconn)
backlog = somaxconn;
if (backlog < sominconn)
backlog = sominconn;
if (backlog < 0 || backlog > somaxconn_local)
backlog = somaxconn_local;
if (backlog < sominconn_local)
backlog = sominconn_local;
so->so_qlimit = backlog;
return (0);
}

View file

@ -1,10 +1,10 @@
/* $OpenBSD: syscall.h,v 1.270 2023/12/19 06:59:17 deraadt Exp $ */
/* $OpenBSD: syscall.h,v 1.271 2024/01/26 18:24:58 mvs Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.255 2023/12/19 06:58:36 deraadt Exp
* created from; OpenBSD: syscalls.master,v 1.257 2024/01/26 18:24:23 mvs Exp
*/
/* syscall: "exit" ret: "void" args: "int" */

View file

@ -1,10 +1,10 @@
/* $OpenBSD: syscallargs.h,v 1.273 2023/12/19 06:59:17 deraadt Exp $ */
/* $OpenBSD: syscallargs.h,v 1.274 2024/01/26 18:24:58 mvs Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.255 2023/12/19 06:58:36 deraadt Exp
* created from; OpenBSD: syscalls.master,v 1.257 2024/01/26 18:24:23 mvs Exp
*/
#ifdef syscallarg