sync with OpenBSD -current

This commit is contained in:
purplerain 2024-08-19 17:15:41 +00:00
parent c78abe7784
commit eb9d621948
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
270 changed files with 666 additions and 538 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpi.c,v 1.437 2024/08/10 23:28:17 deraadt Exp $ */
/* $OpenBSD: acpi.c,v 1.438 2024/08/18 02:53:08 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@ -2502,16 +2502,19 @@ acpi_init_states(struct acpi_softc *sc)
snprintf(name, sizeof(name), "_S%d_", i);
sc->sc_sleeptype[i].slp_typa = -1;
sc->sc_sleeptype[i].slp_typb = -1;
if (aml_evalname(sc, sc->sc_root, name, 0, NULL, &res) == 0) {
if (res.type == AML_OBJTYPE_PACKAGE) {
sc->sc_sleeptype[i].slp_typa =
aml_val2int(res.v_package[0]);
sc->sc_sleeptype[i].slp_typb =
aml_val2int(res.v_package[1]);
printf(" S%d", i);
}
if (aml_evalname(sc, sc->sc_root, name, 0, NULL, &res) != 0)
continue;
if (res.type != AML_OBJTYPE_PACKAGE) {
aml_freevalue(&res);
continue;
}
sc->sc_sleeptype[i].slp_typa = aml_val2int(res.v_package[0]);
sc->sc_sleeptype[i].slp_typb = aml_val2int(res.v_package[1]);
aml_freevalue(&res);
printf(" S%d", i);
if (i == 0 && (sc->sc_fadt->flags & FADT_POWER_S0_IDLE_CAPABLE))
printf("ix");
}
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pchgpio.c,v 1.15 2023/11/27 00:39:42 jsg Exp $ */
/* $OpenBSD: pchgpio.c,v 1.16 2024/08/18 11:10:10 kettenis Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis
* Copyright (c) 2020 James Hastings
@ -117,6 +117,8 @@ const char *pchgpio_hids[] = {
"INTC1055",
"INTC1056",
"INTC1057",
"INTC1082",
"INTC1083",
"INTC1085",
NULL
};
@ -386,6 +388,63 @@ const struct pchgpio_device adl_n_device =
.npins = 384,
};
/* Meteor Lake-P */
const struct pchgpio_group mtl_p_groups[] =
{
/* Community 0 */
{ 0, 1, 5, 28, 32 }, /* GPP_V */
{ 0, 2, 29, 52, 64 }, /* GPP_C */
/* Community 1 */
{ 1, 0, 53, 77, 96 }, /* GPP_A */
{ 1, 1, 78, 102, 128 }, /* GPP_E */
/* Community 3 */
{ 2, 0, 103, 128, 160 }, /* GPP_H */
{ 2, 1, 129, 154, 192 }, /* GPP_F */
/* Community 4 */
{ 3, 0, 184, 191, 288 }, /* GPP_S */
/* Community 5 */
{ 4, 0, 204, 228, 352 }, /* GPP_B */
{ 4, 1, 229, 253, 384 }, /* GPP_D */
};
const struct pchgpio_device mtl_p_device =
{
.pad_size = 16,
.gpi_is = 0x200,
.gpi_ie = 0x210,
.groups = mtl_p_groups,
.ngroups = nitems(mtl_p_groups),
.npins = 416,
};
/* Meteor Lake-S */
const struct pchgpio_group mtl_s_groups[] =
{
/* Community 0 */
{ 0, 0, 0, 27, 0 }, /* GPP_A */
{ 0, 2, 47, 73, 64 }, /* GPP_C */
/* Community 1 */
{ 1, 0, 74, 93, 96 }, /* GPP_B */
{ 1, 2, 96, 119, 160 }, /* GPP_D */
};
const struct pchgpio_device mtl_s_device =
{
.pad_size = 16,
.gpi_is = 0x200,
.gpi_ie = 0x210,
.groups = mtl_s_groups,
.ngroups = nitems(mtl_s_groups),
.npins = 192,
};
struct pchgpio_match pchgpio_devices[] = {
{ "INT344B", &spt_lp_device },
{ "INT3450", &cnl_h_device },
@ -398,6 +457,8 @@ struct pchgpio_match pchgpio_devices[] = {
{ "INTC1056", &adl_s_device },
{ "INTC1057", &adl_n_device },
{ "INTC1085", &adl_s_device },
{ "INTC1082", &mtl_s_device },
{ "INTC1083", &mtl_p_device },
};
int pchgpio_read_pin(void *, int);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: dt_dev.c,v 1.33 2024/04/06 11:18:02 mpi Exp $ */
/* $OpenBSD: dt_dev.c,v 1.34 2024/08/18 08:23:58 mpi Exp $ */
/*
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
@ -99,8 +99,6 @@ struct dt_softc {
struct mutex ds_mtx;
struct dt_pcb_list ds_pcbs; /* [K] list of enabled PCBs */
struct dt_evt *ds_bufqueue; /* [K] copy evts to userland */
size_t ds_bufqlen; /* [K] length of the queue */
int ds_recording; /* [K] currently recording? */
int ds_evtcnt; /* [m] # of readable evts */
@ -140,7 +138,8 @@ int dt_ioctl_probe_enable(struct dt_softc *, struct dtioc_req *);
int dt_ioctl_probe_disable(struct dt_softc *, struct dtioc_req *);
int dt_ioctl_get_auxbase(struct dt_softc *, struct dtioc_getaux *);
int dt_pcb_ring_copy(struct dt_pcb *, struct dt_evt *, size_t, uint64_t *);
int dt_pcb_ring_copy(struct dt_pcb *, struct uio *, size_t, size_t *,
uint64_t *);
void
dtattach(struct device *parent, struct device *self, void *aux)
@ -161,8 +160,6 @@ int
dtopen(dev_t dev, int flags, int mode, struct proc *p)
{
struct dt_softc *sc;
struct dt_evt *queue;
size_t qlen;
int unit = minor(dev);
if (!allowdt)
@ -172,19 +169,8 @@ dtopen(dev_t dev, int flags, int mode, struct proc *p)
if (sc == NULL)
return ENOMEM;
/*
* Enough space to empty 2 full rings of events in a single read.
*/
qlen = 2 * DT_EVTRING_SIZE;
queue = mallocarray(qlen, sizeof(*queue), M_DEVBUF, M_WAITOK|M_CANFAIL);
if (queue == NULL) {
free(sc, M_DEVBUF, sizeof(*sc));
return ENOMEM;
}
/* no sleep after this point */
if (dtlookup(unit) != NULL) {
free(queue, M_DEVBUF, qlen * sizeof(*queue));
free(sc, M_DEVBUF, sizeof(*sc));
return EBUSY;
}
@ -193,8 +179,6 @@ dtopen(dev_t dev, int flags, int mode, struct proc *p)
sc->ds_pid = p->p_p->ps_pid;
TAILQ_INIT(&sc->ds_pcbs);
mtx_init(&sc->ds_mtx, IPL_HIGH);
sc->ds_bufqlen = qlen;
sc->ds_bufqueue = queue;
sc->ds_evtcnt = 0;
sc->ds_readevt = 0;
sc->ds_dropevt = 0;
@ -221,8 +205,6 @@ dtclose(dev_t dev, int flags, int mode, struct proc *p)
dt_ioctl_record_stop(sc);
dt_pcb_purge(&sc->ds_pcbs);
free(sc->ds_bufqueue, M_DEVBUF,
sc->ds_bufqlen * sizeof(*sc->ds_bufqueue));
free(sc, M_DEVBUF, sizeof(*sc));
return 0;
@ -232,17 +214,16 @@ int
dtread(dev_t dev, struct uio *uio, int flags)
{
struct dt_softc *sc;
struct dt_evt *estq;
struct dt_pcb *dp;
int error = 0, unit = minor(dev);
size_t qlen, count, read = 0;
size_t count, max, read = 0;
uint64_t dropped = 0;
sc = dtlookup(unit);
KASSERT(sc != NULL);
count = howmany(uio->uio_resid, sizeof(struct dt_evt));
if (count < 1)
max = howmany(uio->uio_resid, sizeof(struct dt_evt));
if (max < 1)
return (EMSGSIZE);
while (!sc->ds_evtcnt) {
@ -254,20 +235,18 @@ dtread(dev_t dev, struct uio *uio, int flags)
if (error)
return error;
estq = sc->ds_bufqueue;
qlen = MIN(sc->ds_bufqlen, count);
KERNEL_ASSERT_LOCKED();
TAILQ_FOREACH(dp, &sc->ds_pcbs, dp_snext) {
count = dt_pcb_ring_copy(dp, estq, qlen, &dropped);
count = 0;
error = dt_pcb_ring_copy(dp, uio, max, &count, &dropped);
if (error || count == 0)
break;
read += count;
estq += count; /* pointer arithmetic */
qlen -= count;
if (qlen == 0)
max -= count;
if (max == 0)
break;
}
if (read > 0)
uiomove(sc->ds_bufqueue, read * sizeof(struct dt_evt), uio);
mtx_enter(&sc->ds_mtx);
sc->ds_evtcnt -= read;
@ -275,7 +254,7 @@ dtread(dev_t dev, struct uio *uio, int flags)
sc->ds_dropevt += dropped;
mtx_leave(&sc->ds_mtx);
return 0;
return error;
}
int
@ -743,21 +722,25 @@ dt_pcb_ring_consume(struct dt_pcb *dp, struct dt_evt *dtev)
}
/*
* Copy at most `qlen' events from `dp', producing the same amount
* Copy at most `max' events from `dp', producing the same amount
* of free slots.
*/
int
dt_pcb_ring_copy(struct dt_pcb *dp, struct dt_evt *estq, size_t qlen,
uint64_t *dropped)
dt_pcb_ring_copy(struct dt_pcb *dp, struct uio *uio, size_t max,
size_t *rcvd, uint64_t *dropped)
{
size_t count, copied = 0;
unsigned int cons, prod;
int error = 0;
KASSERT(qlen > 0);
KASSERT(max > 0);
mtx_enter(&dp->dp_mtx);
cons = dp->dp_cons;
prod = dp->dp_prod;
*dropped += dp->dp_dropevt;
dp->dp_dropevt = 0;
mtx_leave(&dp->dp_mtx);
if (cons < prod)
count = DT_EVTRING_SIZE - prod;
@ -765,30 +748,34 @@ dt_pcb_ring_copy(struct dt_pcb *dp, struct dt_evt *estq, size_t qlen,
count = cons - prod;
if (count == 0)
goto out;
return 0;
*dropped += dp->dp_dropevt;
dp->dp_dropevt = 0;
count = MIN(count, qlen);
memcpy(&estq[0], &dp->dp_ring[prod], count * sizeof(*estq));
count = MIN(count, max);
error = uiomove(&dp->dp_ring[prod], count * sizeof(struct dt_evt), uio);
if (error)
return error;
copied += count;
/* Produce */
prod = (prod + count) % DT_EVTRING_SIZE;
/* If the queue is full or the ring didn't wrap, stop here. */
if (qlen == copied || prod != 0 || cons == 0)
/* If the ring didn't wrap, stop here. */
if (max == copied || prod != 0 || cons == 0)
goto out;
count = MIN(cons, (max - copied));
error = uiomove(&dp->dp_ring[0], count * sizeof(struct dt_evt), uio);
if (error)
goto out;
count = MIN(cons, (qlen - copied));
memcpy(&estq[copied], &dp->dp_ring[0], count * sizeof(*estq));
copied += count;
prod += count;
out:
mtx_enter(&dp->dp_mtx);
dp->dp_prod = prod;
mtx_leave(&dp->dp_mtx);
return copied;
*rcvd = copied;
return error;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: iatp.c,v 1.9 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: iatp.c,v 1.11 2024/08/19 14:24:24 deraadt Exp $ */
/*
* Atmel maXTouch i2c touchscreen/touchpad driver
* Copyright (c) 2016 joshua stein <jcs@openbsd.org>
@ -295,24 +295,24 @@ int
iatp_activate(struct device *self, int act)
{
struct iatp_softc *sc = (struct iatp_softc *)self;
int rv;
switch (act) {
case DVACT_QUIESCE:
#if 0
/* XXX: causes dwiic troubles */
rv = config_activate_children(self, act);
iatp_t7_set_power_mode(sc, MXT_T7_POWER_MODE_DEEP_SLEEP);
#endif
break;
case DVACT_WAKEUP:
sc->sc_busy = 1;
iatp_init(sc);
sc->sc_busy = 0;
rv = config_activate_children(self, act);
break;
default:
rv = config_activate_children(self, act);
break;
}
config_activate_children(self, act);
return 0;
return rv;
}
int

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ietp.c,v 1.2 2023/07/21 02:19:49 jcs Exp $ */
/* $OpenBSD: ietp.c,v 1.3 2024/08/18 03:25:04 deraadt Exp $ */
/*
* Elan I2C Touchpad driver
*
@ -304,11 +304,13 @@ int
ietp_activate(struct device *self, int act)
{
struct ietp_softc *sc = (struct ietp_softc *)self;
int rv;
DPRINTF(("%s(%d)\n", __func__, act));
switch (act) {
case DVACT_QUIESCE:
rv = config_activate_children(self, act);
sc->sc_dying = 1;
if (ietp_set_power(sc, I2C_HID_POWER_OFF))
printf("%s: failed to power down\n",
@ -317,12 +319,13 @@ ietp_activate(struct device *self, int act)
case DVACT_WAKEUP:
ietp_reset(sc);
sc->sc_dying = 0;
rv = config_activate_children(self, act);
break;
default:
rv = config_activate_children(self, act);
break;
}
config_activate_children(self, act);
return 0;
return rv;
}
void

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ihidev.c,v 1.29 2023/08/12 10:03:05 kettenis Exp $ */
/* $OpenBSD: ihidev.c,v 1.32 2024/08/19 09:26:58 kettenis Exp $ */
/*
* HID-over-i2c driver
*
@ -145,11 +145,7 @@ ihidev_attach(struct device *parent, struct device *self, void *aux)
sc->sc_nrepid++;
sc->sc_subdevs = mallocarray(sc->sc_nrepid, sizeof(struct ihidev *),
M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->sc_subdevs == NULL) {
printf("%s: failed allocating memory\n", sc->sc_dev.dv_xname);
return;
}
M_DEVBUF, M_WAITOK | M_ZERO);
/* find largest report size and allocate memory for input buffer */
sc->sc_isize = letoh16(sc->hid_desc.wMaxInputLength);
@ -163,7 +159,7 @@ ihidev_attach(struct device *parent, struct device *self, void *aux)
DPRINTF(("%s: repid %d size %d\n", sc->sc_dev.dv_xname,
repid, repsz));
}
sc->sc_ibuf = malloc(sc->sc_isize, M_DEVBUF, M_NOWAIT | M_ZERO);
sc->sc_ibuf = malloc(sc->sc_isize, M_DEVBUF, M_WAITOK | M_ZERO);
iha.iaa = ia;
iha.parent = sc;
@ -233,11 +229,13 @@ int
ihidev_activate(struct device *self, int act)
{
struct ihidev_softc *sc = (struct ihidev_softc *)self;
int rv;
DPRINTF(("%s(%d)\n", __func__, act));
switch (act) {
case DVACT_QUIESCE:
rv = config_activate_children(self, act);
sc->sc_dying = 1;
if (sc->sc_poll && timeout_initialized(&sc->sc_timer)) {
DPRINTF(("%s: cancelling polling\n",
@ -254,12 +252,13 @@ ihidev_activate(struct device *self, int act)
sc->sc_dying = 0;
if (sc->sc_poll && timeout_initialized(&sc->sc_timer))
timeout_add(&sc->sc_timer, 2000);
rv = config_activate_children(self, act);
break;
default:
rv = config_activate_children(self, act);
break;
}
config_activate_children(self, act);
return 0;
return rv;
}
void
@ -371,7 +370,7 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg)
* rreq->data.
*/
report_len += report_id_len;
tmprep = malloc(report_len, M_DEVBUF, M_NOWAIT | M_ZERO);
tmprep = malloc(report_len, M_DEVBUF, M_WAITOK | M_ZERO);
/* type 3 id 8: 22 00 38 02 23 00 */
res = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr,
@ -462,7 +461,7 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg)
cmd[dataoff] = rreq->id;
finalcmd = malloc(cmdlen + rreq->len, M_DEVBUF,
M_NOWAIT | M_ZERO);
M_WAITOK | M_ZERO);
memcpy(finalcmd, cmd, cmdlen);
memcpy(finalcmd + cmdlen, rreq->data, rreq->len);
@ -599,7 +598,7 @@ ihidev_hid_desc_parse(struct ihidev_softc *sc)
}
sc->sc_reportlen = letoh16(sc->hid_desc.wReportDescLength);
sc->sc_report = malloc(sc->sc_reportlen, M_DEVBUF, M_NOWAIT | M_ZERO);
sc->sc_report = malloc(sc->sc_reportlen, M_DEVBUF, M_WAITOK | M_ZERO);
if (ihidev_hid_command(sc, I2C_HID_REPORT_DESCR, 0)) {
printf("%s: failed fetching HID report\n",
@ -629,9 +628,6 @@ ihidev_intr(void *arg)
u_char *p;
u_int rep = 0;
if (sc->sc_dying)
return 1;
if (sc->sc_poll && !sc->sc_frompoll) {
DPRINTF(("%s: received interrupt while polling, disabling "
"polling\n", sc->sc_dev.dv_xname));
@ -708,7 +704,8 @@ ihidev_intr(void *arg)
return (1);
}
scd->sc_intr(scd, p, psize);
if (!sc->sc_dying)
scd->sc_intr(scd, p, psize);
if (sc->sc_poll && (fast != sc->sc_fastpoll)) {
DPRINTF(("%s: %s->%s polling\n", sc->sc_dev.dv_xname,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: qwx.c,v 1.64 2024/08/17 08:12:46 stsp Exp $ */
/* $OpenBSD: qwx.c,v 1.66 2024/08/19 08:22:30 jsg Exp $ */
/*
* Copyright 2023 Stefan Sperling <stsp@openbsd.org>
@ -158,6 +158,7 @@ int qwx_wmi_vdev_install_key(struct qwx_softc *,
int qwx_dp_peer_rx_pn_replay_config(struct qwx_softc *, struct qwx_vif *,
struct ieee80211_node *, struct ieee80211_key *, int);
void qwx_setkey_clear(struct qwx_softc *);
void qwx_vif_free_all(struct qwx_softc *);
int qwx_scan(struct qwx_softc *);
void qwx_scan_abort(struct qwx_softc *);
@ -172,7 +173,8 @@ qwx_node_alloc(struct ieee80211com *ic)
struct qwx_node *nq;
nq = malloc(sizeof(struct qwx_node), M_DEVBUF, M_NOWAIT | M_ZERO);
nq->peer.peer_id = HAL_INVALID_PEERID;
if (nq != NULL)
nq->peer.peer_id = HAL_INVALID_PEERID;
return (struct ieee80211_node *)nq;
}
@ -348,6 +350,8 @@ qwx_stop(struct ifnet *ifp)
/* power off hardware */
qwx_core_deinit(sc);
qwx_vif_free_all(sc);
splx(s);
}
@ -22815,6 +22819,18 @@ qwx_vif_free(struct qwx_softc *sc, struct qwx_vif *arvif)
free(arvif, M_DEVBUF, sizeof(*arvif));
}
void
qwx_vif_free_all(struct qwx_softc *sc)
{
struct qwx_vif *arvif;
while (!TAILQ_EMPTY(&sc->vif_list)) {
arvif = TAILQ_FIRST(&sc->vif_list);
TAILQ_REMOVE(&sc->vif_list, arvif, entry);
qwx_vif_free(sc, arvif);
}
}
struct qwx_vif *
qwx_vif_alloc(struct qwx_softc *sc)
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: qwz.c,v 1.4 2024/08/16 00:26:54 patrick Exp $ */
/* $OpenBSD: qwz.c,v 1.5 2024/08/19 08:22:30 jsg Exp $ */
/*
* Copyright 2023 Stefan Sperling <stsp@openbsd.org>
@ -172,7 +172,8 @@ qwz_node_alloc(struct ieee80211com *ic)
struct qwz_node *nq;
nq = malloc(sizeof(struct qwz_node), M_DEVBUF, M_NOWAIT | M_ZERO);
nq->peer.peer_id = HAL_INVALID_PEERID;
if (nq != NULL)
nq->peer.peer_id = HAL_INVALID_PEERID;
return (struct ieee80211_node *)nq;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_eg.c,v 1.52 2023/09/11 08:41:26 mvs Exp $ */
/* $OpenBSD: if_eg.c,v 1.53 2024/08/19 03:08:27 jsg Exp $ */
/* $NetBSD: if_eg.c,v 1.26 1996/05/12 23:52:27 mycroft Exp $ */
/*
@ -442,11 +442,11 @@ eginit(register struct eg_softc *sc)
printf("%s: configure card command failed\n",
sc->sc_dev.dv_xname);
if (sc->eg_inbuf == 0)
if (sc->eg_inbuf == NULL)
sc->eg_inbuf = malloc(EG_BUFLEN, M_TEMP, M_NOWAIT);
sc->eg_incount = 0;
if (sc->eg_outbuf == 0)
if (sc->eg_outbuf == NULL)
sc->eg_outbuf = malloc(EG_BUFLEN, M_TEMP, M_NOWAIT);
bus_space_write_1(bst, bsh, EG_CONTROL, EG_CTL_CMDE);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_le_isapnp.c,v 1.15 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: if_le_isapnp.c,v 1.16 2024/08/19 03:08:27 jsg Exp $ */
/* $NetBSD: if_le_isa.c,v 1.2 1996/05/12 23:52:56 mycroft Exp $ */
/*-
@ -102,7 +102,7 @@ le_isapnp_attach(struct device *parent, struct device *self, void *aux)
sc->sc_arpcom.ac_enaddr[i] = bus_space_read_1(iot, ioh, i);
sc->sc_mem = malloc(16384, M_DEVBUF, M_NOWAIT);
if (sc->sc_mem == 0) {
if (sc->sc_mem == NULL) {
printf(": couldn't allocate memory for card\n");
return;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: auixp.c,v 1.53 2024/05/24 06:02:53 jsg Exp $ */
/* $OpenBSD: auixp.c,v 1.54 2024/08/18 14:42:56 deraadt Exp $ */
/* $NetBSD: auixp.c,v 1.9 2005/06/27 21:13:09 thorpej Exp $ */
/*
@ -911,6 +911,7 @@ auixp_activate(struct device *self, int act)
switch (act) {
case DVACT_SUSPEND:
rv = config_activate_children(self, act);
auixp_disable_interrupts(sc);
break;
case DVACT_RESUME:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: azalia.c,v 1.288 2024/08/13 22:32:58 deraadt Exp $ */
/* $OpenBSD: azalia.c,v 1.290 2024/08/18 14:42:56 deraadt Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
@ -598,13 +598,12 @@ azalia_pci_activate(struct device *self, int act)
azalia_t *sc = (azalia_t*)self;
int rv = 0;
if (sc->detached)
return (0);
switch (act) {
case DVACT_QUIESCE:
rv = config_activate_children(self, act);
if (sc->detached)
break;
/* stop interrupts and clear status registers */
AZ_WRITE_4(sc, INTCTL, 0);
AZ_WRITE_2(sc, STATESTS, HDA_STATESTS_SDIWAKE);
@ -612,15 +611,17 @@ azalia_pci_activate(struct device *self, int act)
(void) AZ_READ_4(sc, INTSTS);
break;
case DVACT_SUSPEND:
rv = config_activate_children(self, act);
azalia_suspend(sc);
break;
case DVACT_POWERDOWN:
azalia_shutdown(sc);
break;
case DVACT_RESUME:
azalia_resume(sc);
rv = config_activate_children(self, act);
break;
case DVACT_POWERDOWN:
rv = config_activate_children(self, act);
azalia_shutdown(sc);
break;
default:
rv = config_activate_children(self, act);
break;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cs4280.c,v 1.61 2024/05/24 06:02:53 jsg Exp $ */
/* $OpenBSD: cs4280.c,v 1.62 2024/08/18 14:42:56 deraadt Exp $ */
/* $NetBSD: cs4280.c,v 1.5 2000/06/26 04:56:23 simonb Exp $ */
/*
@ -1571,6 +1571,7 @@ cs4280_activate(struct device *self, int act)
switch (act) {
case DVACT_SUSPEND:
rv = config_activate_children(self, act);
/* should I powerdown here ? */
cs4280_write_codec(sc, AC97_REG_POWER, CS4280_POWER_DOWN_ALL);
break;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cs4281.c,v 1.46 2024/05/24 06:02:53 jsg Exp $ */
/* $OpenBSD: cs4281.c,v 1.47 2024/08/18 14:42:56 deraadt Exp $ */
/* $Tera: cs4281.c,v 1.18 2000/12/27 14:24:45 tacha Exp $ */
/*
@ -960,6 +960,7 @@ cs4281_activate(struct device *self, int act)
switch (act) {
case DVACT_SUSPEND:
rv = config_activate_children(self, act);
/* should I powerdown here ? */
cs4281_write_codec(sc, AC97_REG_POWER, CS4281_POWER_DOWN_ALL);
break;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: apldcp.c,v 1.2 2024/07/12 10:01:28 tobhe Exp $ */
/* $OpenBSD: apldcp.c,v 1.3 2024/08/18 10:50:22 kettenis Exp $ */
/*
* Copyright (c) 2023 Mark Kettenis <kettenis@openbsd.org>
*
@ -115,14 +115,13 @@ struct apple_rtkit_ep {
uint8_t ep;
};
static struct pool rtktask_pool;
struct apple_rtkit {
struct rtkit_state *state;
struct apple_rtkit_ep ep[64];
void *cookie;
struct platform_device *pdev;
const struct apple_rtkit_ops *ops;
struct pool task_pool;
struct taskq *tq;
};
@ -181,7 +180,7 @@ apple_rtkit_do_recv(void *arg)
struct apple_rtkit *rtk = rtkep->rtk;
rtk->ops->recv_message(rtk->cookie, rtkep->ep, rtktask->msg);
pool_put(&rtktask_pool, rtktask);
pool_put(&rtk->task_pool, rtktask);
}
void
@ -191,7 +190,7 @@ apple_rtkit_recv(void *cookie, uint64_t msg)
struct apple_rtkit *rtk = rtkep->rtk;
struct apple_rtkit_task *rtktask;
rtktask = pool_get(&rtktask_pool, PR_NOWAIT | PR_ZERO);
rtktask = pool_get(&rtk->task_pool, PR_NOWAIT | PR_ZERO);
KASSERT(rtktask != NULL);
rtktask->rtkep = rtkep;
@ -251,7 +250,7 @@ devm_apple_rtkit_init(struct device *dev, void *cookie,
return ERR_PTR(ENOMEM);
}
pool_init(&rtktask_pool, sizeof(struct apple_rtkit_task), 0, IPL_TTY,
pool_init(&rtk->task_pool, sizeof(struct apple_rtkit_task), 0, IPL_TTY,
0, "apldcp_rtkit", NULL);
rk = malloc(sizeof(*rk), M_DEVBUF, M_WAITOK | M_ZERO);

View file

@ -753,8 +753,9 @@ vm_fault_gtt(struct i915_mmap_offset *mmo, struct uvm_faultinfo *ufi,
int srcu;
int ret;
obj_offset = entry->offset - drm_vma_node_start(&mmo->vma_node);
obj_offset = (entry->offset >> PAGE_SHIFT) - drm_vma_node_start(&mmo->vma_node);
page_offset = (vaddr - entry->start) >> PAGE_SHIFT;
page_offset += obj_offset;
trace_i915_gem_object_fault(obj, page_offset, true, write);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: esa.c,v 1.43 2024/05/24 06:02:53 jsg Exp $ */
/* $OpenBSD: esa.c,v 1.44 2024/08/18 14:42:56 deraadt Exp $ */
/* $NetBSD: esa.c,v 1.12 2002/03/24 14:17:35 jmcneill Exp $ */
/*
@ -1489,16 +1489,22 @@ int
esa_activate(struct device *self, int act)
{
struct esa_softc *sc = (struct esa_softc *)self;
int rv;
switch (act) {
case DVACT_SUSPEND:
rv = config_activate_children(self, act);
esa_suspend(sc);
break;
case DVACT_RESUME:
esa_resume(sc);
rv = config_activate_children(self, act);
break;
default:
rv = config_activate_children(self, act);
break;
}
return 0;
return rv;
}
void

View file

@ -1,4 +1,4 @@
/* $OpenBSD: eso.c,v 1.55 2024/05/24 06:02:53 jsg Exp $ */
/* $OpenBSD: eso.c,v 1.56 2024/08/18 14:42:56 deraadt Exp $ */
/* $NetBSD: eso.c,v 1.48 2006/12/18 23:13:39 kleink Exp $ */
/*
@ -1966,6 +1966,7 @@ eso_activate(struct device *self, int act)
bus_space_write_1(sc->sc_iot, sc->sc_ioh, ESO_IO_IRQCTL, tmp);
break;
case DVACT_SUSPEND:
rv = config_activate_children(self, act);
bus_space_write_1(sc->sc_iot, sc->sc_ioh, ESO_IO_A2DMAM, 0);
bus_space_write_1(sc->sc_dmac_iot, sc->sc_dmac_ioh,
ESO_DMAC_CLEAR, 0);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: glxpcib.c,v 1.16 2022/03/11 18:00:45 mpi Exp $ */
/* $OpenBSD: glxpcib.c,v 1.17 2024/08/19 00:01:40 deraadt Exp $ */
/*
* Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org>
@ -431,6 +431,7 @@ glxpcib_activate(struct device *self, int act)
switch (act) {
case DVACT_SUSPEND:
rv = config_activate_children(self, act);
#ifndef SMALL_KERNEL
if (sc->sc_wdog) {
sc->sc_wdog_period = bus_space_read_2(sc->sc_iot,
@ -438,7 +439,6 @@ glxpcib_activate(struct device *self, int act)
glxpcib_wdogctl_cb(sc, 0);
}
#endif
rv = config_activate_children(self, act);
#ifndef SMALL_KERNEL
for (i = 0; i < nitems(glxpcib_msrlist); i++)
sc->sc_msrsave[i] = rdmsr(glxpcib_msrlist[i]);
@ -455,11 +455,11 @@ glxpcib_activate(struct device *self, int act)
rv = config_activate_children(self, act);
break;
case DVACT_POWERDOWN:
rv = config_activate_children(self, act);
#ifndef SMALL_KERNEL
if (sc->sc_wdog)
wdog_shutdown(self);
#endif
rv = config_activate_children(self, act);
break;
default:
rv = config_activate_children(self, act);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_bnx.c,v 1.133 2023/11/10 15:51:20 bluhm Exp $ */
/* $OpenBSD: if_bnx.c,v 1.134 2024/08/19 03:08:27 jsg Exp $ */
/*-
* Copyright (c) 2006 Broadcom Corporation
@ -1950,7 +1950,7 @@ bnx_nvram_write(struct bnx_softc *sc, u_int32_t offset, u_int8_t *data_buf,
if (align_start || align_end) {
buf = malloc(len32, M_DEVBUF, M_NOWAIT);
if (buf == 0)
if (buf == NULL)
return (ENOMEM);
if (align_start)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: maestro.c,v 1.52 2024/05/24 06:02:58 jsg Exp $ */
/* $OpenBSD: maestro.c,v 1.54 2024/08/18 20:28:41 deraadt Exp $ */
/* $FreeBSD: /c/ncvs/src/sys/dev/sound/pci/maestro.c,v 1.3 2000/11/21 12:22:11 julian Exp $ */
/*
* FreeBSD's ESS Agogo/Maestro driver
@ -1349,9 +1349,11 @@ int
maestro_activate(struct device *self, int act)
{
struct maestro_softc *sc = (struct maestro_softc *)self;
int rv;
switch (act) {
case DVACT_SUSPEND:
rv = config_activate_children(self, act);
/* Power down device on shutdown. */
DPRINTF(("maestro: power down\n"));
if (sc->record.mode & MAESTRO_RUNNING) {
@ -1382,9 +1384,13 @@ maestro_activate(struct device *self, int act)
if (sc->record.mode & MAESTRO_RUNNING)
maestro_channel_start(&sc->record);
maestro_update_timer(sc);
rv = config_activate_children(self, act);
break;
default:
rv = config_activate_children(self, act);
break;
}
return 0;
return rv;
}
void

View file

@ -1,4 +1,4 @@
/* $OpenBSD: yds.c,v 1.65 2024/06/26 01:40:49 jsg Exp $ */
/* $OpenBSD: yds.c,v 1.66 2024/08/18 14:42:56 deraadt Exp $ */
/* $NetBSD: yds.c,v 1.5 2001/05/21 23:55:04 minoura Exp $ */
/*
@ -1571,11 +1571,11 @@ yds_activate(struct device *self, int act)
switch (act) {
case DVACT_QUIESCE:
rv = config_activate_children(self, act);
if (sc->sc_play.intr || sc->sc_rec.intr)
sc->sc_resume_active = 1;
else
sc->sc_resume_active = 0;
rv = config_activate_children(self, act);
if (sc->sc_resume_active)
yds_close(sc);
break;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pms.c,v 1.98 2023/08/16 20:53:47 bru Exp $ */
/* $OpenBSD: pms.c,v 1.99 2024/08/18 15:09:49 deraadt Exp $ */
/* $NetBSD: psm.c,v 1.11 2000/06/05 22:20:57 sommerfeld Exp $ */
/*-
@ -778,9 +778,11 @@ int
pmsactivate(struct device *self, int act)
{
struct pms_softc *sc = (struct pms_softc *)self;
int rv;
switch (act) {
case DVACT_SUSPEND:
rv = config_activate_children(self, act);
if (sc->sc_state == PMS_STATE_ENABLED)
pms_change_state(sc, PMS_STATE_SUSPENDED,
PMS_DEV_IGNORE);
@ -789,9 +791,13 @@ pmsactivate(struct device *self, int act)
if (sc->sc_state == PMS_STATE_SUSPENDED)
pms_change_state(sc, PMS_STATE_ENABLED,
PMS_DEV_IGNORE);
rv = config_activate_children(self, act);
break;
default:
rv = config_activate_children(self, act);
break;
}
return (0);
return (rv);
}
int

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pvbus.c,v 1.28 2024/05/24 10:05:55 jsg Exp $ */
/* $OpenBSD: pvbus.c,v 1.29 2024/08/19 00:03:12 deraadt Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@ -45,7 +45,6 @@ int has_hv_cpuid = 0;
extern void rdrand(void *);
int pvbus_activate(struct device *, int);
int pvbus_match(struct device *, void *, void *);
void pvbus_attach(struct device *, struct device *, void *);
int pvbus_print(void *, const char *);
@ -64,8 +63,6 @@ const struct cfattach pvbus_ca = {
sizeof(struct pvbus_softc),
pvbus_match,
pvbus_attach,
NULL,
pvbus_activate
};
struct cfdriver pvbus_cd = {
@ -218,29 +215,6 @@ pvbus_init_cpu(void)
}
}
int
pvbus_activate(struct device *self, int act)
{
int rv = 0;
switch (act) {
case DVACT_SUSPEND:
rv = config_activate_children(self, act);
break;
case DVACT_RESUME:
rv = config_activate_children(self, act);
break;
case DVACT_POWERDOWN:
rv = config_activate_children(self, act);
break;
default:
rv = config_activate_children(self, act);
break;
}
return (rv);
}
int
pvbus_search(struct device *parent, void *arg, void *aux)
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: sdmmc.c,v 1.61 2023/04/19 02:01:02 dlg Exp $ */
/* $OpenBSD: sdmmc.c,v 1.62 2024/08/18 15:03:01 deraadt Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@ -202,8 +202,8 @@ sdmmc_activate(struct device *self, int act)
sc->sc_dying = -1;
break;
case DVACT_RESUME:
rv = config_activate_children(self, act);
wakeup(&sc->sc_tskq);
rv = config_activate_children(self, act);
break;
default:
rv = config_activate_children(self, act);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: softraid.c,v 1.430 2024/02/03 18:51:58 beck Exp $ */
/* $OpenBSD: softraid.c,v 1.431 2024/08/18 19:44:10 phessler Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@ -4862,10 +4862,25 @@ bad:
void
sr_sensors_delete(struct sr_discipline *sd)
{
struct sr_softc *sc = sd->sd_sc;
DNPRINTF(SR_D_STATE, "%s: sr_sensors_delete\n", DEVNAME(sd->sd_sc));
if (sd->sd_vol.sv_sensor_attached)
if (sd->sd_vol.sv_sensor_attached) {
sensor_detach(&sd->sd_sc->sc_sensordev, &sd->sd_vol.sv_sensor);
sd->sd_vol.sv_sensor_attached = 0;
}
/*
* Unregister the refresh task if we detached our last sensor.
*/
TAILQ_FOREACH(sd, &sc->sc_dis_list, sd_link)
if (sd->sd_vol.sv_sensor_attached)
return;
if (sc->sc_sensor_task != NULL) {
sensor_task_unregister(sc->sc_sensor_task);
sc->sc_sensor_task = NULL;
}
}
void

View file

@ -1,4 +1,4 @@
/* $OpenBSD: usb.c,v 1.131 2024/05/23 03:21:09 jsg Exp $ */
/* $OpenBSD: usb.c,v 1.132 2024/08/18 02:59:51 deraadt Exp $ */
/* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */
/*
@ -901,13 +901,8 @@ usb_activate(struct device *self, int act)
break;
case DVACT_RESUME:
sc->sc_bus->dying = 0;
/*
* Make sure the root hub is present before interrupts
* get enabled. As long as the bus is in polling mode
* it is safe to call usbd_new_device() now since root
* hub transfers do not need to sleep.
*/
break;
case DVACT_WAKEUP:
sc->sc_bus->use_polling++;
if (!usb_attach_roothub(sc))
usb_needs_explore(sc->sc_bus->root_hub, 0);