sync with OpenBSD -current

This commit is contained in:
purplerain 2025-01-10 03:18:05 +00:00
parent df306e9b72
commit 6dadaa4a5d
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
44 changed files with 503 additions and 207 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: dt_prov_static.c,v 1.23 2024/04/06 11:18:02 mpi Exp $ */
/* $OpenBSD: dt_prov_static.c,v 1.24 2025/01/09 17:43:33 mvs Exp $ */
/*
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
@ -100,6 +100,7 @@ DT_STATIC_PROBE3(refcnt, ifaddr, "void *", "int", "int");
DT_STATIC_PROBE3(refcnt, ifmaddr, "void *", "int", "int");
DT_STATIC_PROBE3(refcnt, inpcb, "void *", "int", "int");
DT_STATIC_PROBE3(refcnt, rtentry, "void *", "int", "int");
DT_STATIC_PROBE3(refcnt, socket, "void *", "int", "int");
DT_STATIC_PROBE3(refcnt, syncache, "void *", "int", "int");
DT_STATIC_PROBE3(refcnt, tdb, "void *", "int", "int");
@ -153,6 +154,7 @@ struct dt_probe *const dtps_static[] = {
&_DT_STATIC_P(refcnt, ifmaddr),
&_DT_STATIC_P(refcnt, inpcb),
&_DT_STATIC_P(refcnt, rtentry),
&_DT_STATIC_P(refcnt, socket),
&_DT_STATIC_P(refcnt, syncache),
&_DT_STATIC_P(refcnt, tdb),
};

View file

@ -1,4 +1,4 @@
/* $OpenBSD: gpiokeys.c,v 1.3 2023/03/31 12:07:54 kn Exp $ */
/* $OpenBSD: gpiokeys.c,v 1.5 2025/01/09 22:03:38 kettenis Exp $ */
/*
* Copyright (c) 2021 Klemens Nanni <kn@openbsd.org>
*
@ -54,12 +54,13 @@ struct gpiokeys_key {
uint32_t key_input_type;
uint32_t key_code;
struct ksensor key_sensor;
SLIST_ENTRY(gpiokeys_key) entries;
SLIST_ENTRY(gpiokeys_key) key_next;
void (*key_func)(void *);
void *key_ih;
};
struct gpiokeys_softc {
struct device sc_dev;
int sc_node;
struct ksensordev sc_sensordev;
SLIST_HEAD(, gpiokeys_key) sc_keys;
};
@ -76,6 +77,7 @@ struct cfdriver gpiokeys_cd = {
};
void gpiokeys_update_key(void *);
int gpiokeys_intr(void *);
int
gpiokeys_match(struct device *parent, void *match, void *aux)
@ -131,8 +133,9 @@ gpiokeys_attach(struct device *parent, struct device *self, void *aux)
strlcpy(key->key_sensor.desc, "lid open",
sizeof(key->key_sensor.desc));
key->key_sensor.type = SENSOR_INDICATOR;
sensor_attach(&sc->sc_sensordev, &key->key_sensor);
sensor_task_register(key, gpiokeys_update_key, 1);
sensor_attach(&sc->sc_sensordev,
&key->key_sensor);
key->key_func = gpiokeys_update_key;
have_sensors = 1;
break;
}
@ -145,7 +148,21 @@ gpiokeys_attach(struct device *parent, struct device *self, void *aux)
have_labels = 1;
}
SLIST_INSERT_HEAD(&sc->sc_keys, key, entries);
SLIST_INSERT_HEAD(&sc->sc_keys, key, key_next);
}
SLIST_FOREACH(key, &sc->sc_keys, key_next) {
if (!key->key_func)
continue;
if (OF_is_compatible(faa->fa_node, "gpio-keys")) {
key->key_ih = gpio_controller_intr_establish(key->key_pin,
IPL_BIO, NULL, gpiokeys_intr, key, DEVNAME(sc));
}
if (key->key_ih == NULL)
sensor_task_register(key, gpiokeys_update_key, 1);
else
gpiokeys_update_key(key);
}
if (have_sensors) {
@ -181,3 +198,12 @@ gpiokeys_update_key(void *arg)
break;
}
}
int
gpiokeys_intr(void *arg)
{
struct gpiokeys_key *key = arg;
key->key_func(key);
return 1;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: qcgpio_fdt.c,v 1.4 2024/07/02 19:43:52 patrick Exp $ */
/* $OpenBSD: qcgpio_fdt.c,v 1.5 2025/01/09 21:52:25 kettenis Exp $ */
/*
* Copyright (c) 2022 Mark Kettenis <kettenis@openbsd.org>
*
@ -86,6 +86,8 @@ const struct cfattach qcgpio_fdt_ca = {
void qcgpio_fdt_config_pin(void *, uint32_t *, int);
int qcgpio_fdt_get_pin(void *, uint32_t *);
void qcgpio_fdt_set_pin(void *, uint32_t *, int);
void *qcgpio_fdt_intr_establish_pin(void *, uint32_t *, int,
struct cpu_info *, int (*)(void *), void *, char *);
void *qcgpio_fdt_intr_establish(void *, int *, int, struct cpu_info *,
int (*)(void *), void *, char *);
@ -136,6 +138,7 @@ qcgpio_fdt_attach(struct device *parent, struct device *self, void *aux)
sc->sc_gc.gc_config_pin = qcgpio_fdt_config_pin;
sc->sc_gc.gc_get_pin = qcgpio_fdt_get_pin;
sc->sc_gc.gc_set_pin = qcgpio_fdt_set_pin;
sc->sc_gc.gc_intr_establish = qcgpio_fdt_intr_establish_pin;
gpio_controller_register(&sc->sc_gc);
sc->sc_ic.ic_node = faa->fa_node;
@ -213,6 +216,19 @@ qcgpio_fdt_set_pin(void *cookie, uint32_t *cells, int val)
}
}
void *
qcgpio_fdt_intr_establish_pin(void *cookie, uint32_t *cells, int ipl,
struct cpu_info *ci, int (*func)(void *), void *arg, char *name)
{
struct qcgpio_softc *sc = cookie;
uint32_t icells[2];
icells[0] = cells[0];
icells[1] = 3; /* both edges */
return qcgpio_fdt_intr_establish(sc, icells, ipl, ci, func, arg, name);
}
void *
qcgpio_fdt_intr_establish(void *cookie, int *cells, int ipl,
struct cpu_info *ci, int (*func)(void *), void *arg, char *name)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ofw_gpio.c,v 1.3 2019/08/26 09:22:27 kettenis Exp $ */
/* $OpenBSD: ofw_gpio.c,v 1.4 2025/01/09 19:38:13 kettenis Exp $ */
/*
* Copyright (c) 2016, 2019 Mark Kettenis
*
@ -19,6 +19,8 @@
#include <sys/systm.h>
#include <sys/malloc.h>
#include <machine/fdt.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_gpio.h>
@ -141,3 +143,29 @@ gpio_controller_next_pin(uint32_t *cells)
return NULL;
}
void *
gpio_controller_intr_establish(uint32_t *cells, int ipl, struct cpu_info *ci,
int (*func)(void *), void *arg, char *name)
{
struct gpio_controller *gc;
uint32_t phandle = cells[0];
LIST_FOREACH(gc, &gpio_controllers, gc_list) {
if (gc->gc_phandle == phandle)
break;
}
if (gc && gc->gc_intr_establish) {
return gc->gc_intr_establish(gc->gc_cookie, &cells[1], ipl,
ci, func, arg, name);
}
return NULL;
}
void
gpio_controller_intr_disestablish(void *ih)
{
fdt_intr_disestablish(ih);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ofw_gpio.h,v 1.5 2020/12/18 22:14:13 kettenis Exp $ */
/* $OpenBSD: ofw_gpio.h,v 1.6 2025/01/09 19:38:13 kettenis Exp $ */
/*
* Copyright (c) 2016 Mark Kettenis
*
@ -34,6 +34,8 @@ struct gpio_controller {
void (*gc_config_pin)(void *, uint32_t *, int);
int (*gc_get_pin)(void *, uint32_t *);
void (*gc_set_pin)(void *, uint32_t *, int);
void *(*gc_intr_establish)(void *, uint32_t *, int,
struct cpu_info *, int (*)(void *), void *, char *);
LIST_ENTRY(gpio_controller) gc_list;
uint32_t gc_phandle;
@ -56,4 +58,8 @@ int gpio_controller_get_pin(uint32_t *);
void gpio_controller_set_pin(uint32_t *, int);
uint32_t *gpio_controller_next_pin(uint32_t *);
void *gpio_controller_intr_establish(uint32_t *, int, struct cpu_info *,
int (*)(void *), void *, char *);
void gpio_controller_intr_disestablish(void *);
#endif /* _DEV_OFW_GPIO_H_ */

View file

@ -3255,8 +3255,12 @@ static int amdgpu_device_ip_resume_phase3(struct amdgpu_device *adev)
continue;
if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_DCE) {
r = adev->ip_blocks[i].version->funcs->resume(adev);
if (r)
if (r) {
DRM_ERROR("resume of IP block <%s> failed %d\n",
adev->ip_blocks[i].version->funcs->name, r);
return r;
}
adev->ip_blocks[i].status.hw = true;
}
}

View file

@ -1,4 +1,4 @@
$OpenBSD: pcidevs,v 1.2094 2024/11/09 10:23:06 miod Exp $
$OpenBSD: pcidevs,v 1.2095 2025/01/08 02:12:24 jsg Exp $
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
/*
@ -6460,9 +6460,13 @@ product INTEL MTL_U_HB_1 0x7d16 Core Ultra Host
product INTEL MTL_IPU 0x7d19 Core Ultra IPU
product INTEL MTL_NPU 0x7d1d Core Ultra NPU
product INTEL MTL_U4_GT_1 0x7d40 Graphics
product INTEL ARL_U_GT_1 0x7d41 Graphics
product INTEL MTL_U_GT_1 0x7d45 Graphics
product INTEL ARL_H_GT_1 0x7d51 Graphics
product INTEL MTL_H_GT_1 0x7d55 Arc Graphics
product INTEL MTL_U_GT_2 0x7d60 Graphics
product INTEL ARL_S_GT_1 0x7d67 Graphics
product INTEL ARL_H_GT_2 0x7dd1 Graphics
product INTEL MTL_H_GT_2 0x7dd5 Graphics
product INTEL MTL_H_ESPI 0x7e02 Core Ultra eSPI
product INTEL MTL_U_ESPI 0x7e03 Core Ultra eSPI
@ -7349,6 +7353,7 @@ product INTEL LNL_XHCI 0xa87d Core Ultra xHCI
product INTEL LNL_SRAM 0xa87f Core Ultra SRAM
product INTEL 21152 0xb152 S21152BB
product INTEL 21154 0xb154 21154AE/BE
product INTEL ARL_S_GT_2 0xb640 Graphics
product INTEL CORE_DMI_0 0xd130 Core DMI
product INTEL CORE_DMI_1 0xd131 Core DMI
product INTEL CORE_DMI_2 0xd132 Core DMI

View file

@ -2,7 +2,7 @@
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: pcidevs,v 1.2094 2024/11/09 10:23:06 miod Exp
* OpenBSD: pcidevs,v 1.2095 2025/01/08 02:12:24 jsg Exp
*/
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
@ -6465,9 +6465,13 @@
#define PCI_PRODUCT_INTEL_MTL_IPU 0x7d19 /* Core Ultra IPU */
#define PCI_PRODUCT_INTEL_MTL_NPU 0x7d1d /* Core Ultra NPU */
#define PCI_PRODUCT_INTEL_MTL_U4_GT_1 0x7d40 /* Graphics */
#define PCI_PRODUCT_INTEL_ARL_U_GT_1 0x7d41 /* Graphics */
#define PCI_PRODUCT_INTEL_MTL_U_GT_1 0x7d45 /* Graphics */
#define PCI_PRODUCT_INTEL_ARL_H_GT_1 0x7d51 /* Graphics */
#define PCI_PRODUCT_INTEL_MTL_H_GT_1 0x7d55 /* Arc Graphics */
#define PCI_PRODUCT_INTEL_MTL_U_GT_2 0x7d60 /* Graphics */
#define PCI_PRODUCT_INTEL_ARL_S_GT_1 0x7d67 /* Graphics */
#define PCI_PRODUCT_INTEL_ARL_H_GT_2 0x7dd1 /* Graphics */
#define PCI_PRODUCT_INTEL_MTL_H_GT_2 0x7dd5 /* Graphics */
#define PCI_PRODUCT_INTEL_MTL_H_ESPI 0x7e02 /* Core Ultra eSPI */
#define PCI_PRODUCT_INTEL_MTL_U_ESPI 0x7e03 /* Core Ultra eSPI */
@ -7354,6 +7358,7 @@
#define PCI_PRODUCT_INTEL_LNL_SRAM 0xa87f /* Core Ultra SRAM */
#define PCI_PRODUCT_INTEL_21152 0xb152 /* S21152BB */
#define PCI_PRODUCT_INTEL_21154 0xb154 /* 21154AE/BE */
#define PCI_PRODUCT_INTEL_ARL_S_GT_2 0xb640 /* Graphics */
#define PCI_PRODUCT_INTEL_CORE_DMI_0 0xd130 /* Core DMI */
#define PCI_PRODUCT_INTEL_CORE_DMI_1 0xd131 /* Core DMI */
#define PCI_PRODUCT_INTEL_CORE_DMI_2 0xd132 /* Core DMI */

View file

@ -2,7 +2,7 @@
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
*
* generated from:
* OpenBSD: pcidevs,v 1.2094 2024/11/09 10:23:06 miod Exp
* OpenBSD: pcidevs,v 1.2095 2025/01/08 02:12:24 jsg Exp
*/
/* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */
@ -23187,10 +23187,18 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MTL_U4_GT_1,
"Graphics",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ARL_U_GT_1,
"Graphics",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MTL_U_GT_1,
"Graphics",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ARL_H_GT_1,
"Graphics",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MTL_H_GT_1,
"Arc Graphics",
@ -23199,6 +23207,14 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MTL_U_GT_2,
"Graphics",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ARL_S_GT_1,
"Graphics",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ARL_H_GT_2,
"Graphics",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MTL_H_GT_2,
"Graphics",
@ -26743,6 +26759,10 @@ static const struct pci_known_product pci_known_products[] = {
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_21154,
"21154AE/BE",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ARL_S_GT_2,
"Graphics",
},
{
PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE_DMI_0,
"Core DMI",

View file

@ -1,4 +1,4 @@
/* $OpenBSD: virtio.c,v 1.36 2024/12/20 22:18:27 sf Exp $ */
/* $OpenBSD: virtio.c,v 1.37 2025/01/09 10:55:22 sf Exp $ */
/* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */
/*
@ -167,6 +167,8 @@ virtio_attach_finish(struct virtio_softc *sc, struct virtio_attach_args *va)
for (i = 0; i < sc->sc_nvqs; i++) {
struct virtqueue *vq = &sc->sc_vqs[i];
if (vq->vq_num == 0)
continue;
virtio_setup_queue(sc, vq, vq->vq_dmamap->dm_segs[0].ds_addr);
}
virtio_set_status(sc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK);
@ -185,9 +187,9 @@ virtio_reinit_start(struct virtio_softc *sc)
for (i = 0; i < sc->sc_nvqs; i++) {
int n;
struct virtqueue *vq = &sc->sc_vqs[i];
n = virtio_read_queue_size(sc, vq->vq_index);
if (n == 0) /* vq disappeared */
if (vq->vq_num == 0) /* not used */
continue;
n = virtio_read_queue_size(sc, vq->vq_index);
if (n != vq->vq_num) {
panic("%s: virtqueue size changed, vq index %d",
sc->sc_dev.dv_xname, vq->vq_index);
@ -274,8 +276,11 @@ virtio_check_vqs(struct virtio_softc *sc)
int i, r = 0;
/* going backwards is better for if_vio */
for (i = sc->sc_nvqs - 1; i >= 0; i--)
for (i = sc->sc_nvqs - 1; i >= 0; i--) {
if (sc->sc_vqs[i].vq_num == 0) /* not used */
continue;
r |= virtio_check_vq(sc, &sc->sc_vqs[i]);
}
return r;
}
@ -305,6 +310,7 @@ virtio_init_vq(struct virtio_softc *sc, struct virtqueue *vq)
int i, j;
int vq_size = vq->vq_num;
VIRTIO_ASSERT(vq_size > 0);
memset(vq->vq_vaddr, 0, vq->vq_bytesize);
/* build the indirect descriptor chain */
@ -468,6 +474,11 @@ virtio_free_vq(struct virtio_softc *sc, struct virtqueue *vq)
struct vq_entry *qe;
int i = 0;
if (vq->vq_num == 0) {
/* virtio_alloc_vq() was never called */
return 0;
}
/* device must be already deactivated */
/* confirm the vq is empty */
SLIST_FOREACH(qe, &vq->vq_freelist, qe_list) {
@ -1017,6 +1028,10 @@ virtio_vq_dump(struct virtqueue *vq)
#endif
/* Common fields */
printf(" + addr: %p\n", vq);
if (vq->vq_num == 0) {
printf(" + vq is unused\n");
return;
}
printf(" + vq num: %d\n", vq->vq_num);
printf(" + vq mask: 0x%X\n", vq->vq_mask);
printf(" + vq index: %d\n", vq->vq_index);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: virtiovar.h,v 1.26 2024/12/20 22:18:27 sf Exp $ */
/* $OpenBSD: virtiovar.h,v 1.27 2025/01/09 10:55:22 sf Exp $ */
/* $NetBSD: virtiovar.h,v 1.1 2011/10/30 12:12:21 hannken Exp $ */
/*
@ -103,7 +103,8 @@ struct vq_entry {
struct virtqueue {
struct virtio_softc *vq_owner;
unsigned int vq_num; /* queue size (# of entries) */
unsigned int vq_num; /* queue size (# of entries),
* 0 if unused/non-existant */
unsigned int vq_mask; /* (1 << vq_num - 1) */
int vq_index; /* queue number (0, 1, ...) */
@ -180,7 +181,7 @@ struct virtio_softc {
int sc_indirect;
int sc_version_1;
int sc_nvqs; /* set by child */
int sc_nvqs; /* size of sc_vqs, set by child */
struct virtqueue *sc_vqs; /* set by child */
struct device *sc_child; /* set by child,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: softraid.c,v 1.432 2024/12/24 19:19:18 krw Exp $ */
/* $OpenBSD: softraid.c,v 1.433 2025/01/08 23:40:40 lucas Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@ -5148,7 +5148,8 @@ sr_hibernate_io(dev_t dev, daddr_t blkno, vaddr_t addr, size_t size, int op, voi
/* Initialize the sub-device */
return my->subfn(my->subdev, sub_raidoff + blkno,
addr, size, op, page);
}
} else if (op == HIB_DONE)
return my->subfn(my->subdev, blkno, addr, size, op, page);
/* Hibernate only uses (and we only support) writes */
if (op != HIB_W)