sync with OpenBSD -current

This commit is contained in:
purplerain 2024-05-11 00:55:56 +00:00
parent 492219ffd1
commit 087a435dae
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
17 changed files with 98 additions and 184 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: hid.c,v 1.6 2023/08/12 20:47:06 miod Exp $ */
/* $OpenBSD: hid.c,v 1.7 2024/05/10 10:49:10 mglocker Exp $ */
/* $NetBSD: hid.c,v 1.23 2002/07/11 21:14:25 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */
@ -691,7 +691,7 @@ hid_get_id_of_collection(const void *desc, int size, int32_t usage,
hd = hid_start_parse(desc, size, hid_all);
DPRINTF("%s: id=%d usage=0x%x\n", __func__, id, usage);
DPRINTF("%s: usage=0x%x\n", __func__, usage);
while (hid_get_item(hd, &hi)) {
DPRINTF("%s: kind=%d id=%d usage=0x%x(0x%x)\n", __func__,
hi.kind, hi.report_ID, hi.usage, usage);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: hidms.c,v 1.10 2023/08/12 20:47:06 miod Exp $ */
/* $OpenBSD: hidms.c,v 1.11 2024/05/10 10:49:10 mglocker Exp $ */
/* $NetBSD: ums.c,v 1.60 2003/03/11 16:44:00 augustss Exp $ */
/*
@ -79,14 +79,14 @@ hidms_stylus_hid_parse(struct hidms *ms, struct hid_data *d,
switch (h.usage) {
/* Buttons */
case HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_TIP_SWITCH):
DPRINTF("Stylus usage tip set\n");
DPRINTF(("Stylus usage tip set\n"));
if (ms->sc_num_stylus_buttons >= MAX_BUTTONS)
break;
loc_stylus_btn[ms->sc_num_stylus_buttons++] = h.loc;
ms->sc_flags |= HIDMS_TIP;
break;
case HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_BARREL_SWITCH):
DPRINTF("Stylus usage barrel set\n");
DPRINTF(("Stylus usage barrel set\n"));
if (ms->sc_num_stylus_buttons >= MAX_BUTTONS)
break;
loc_stylus_btn[ms->sc_num_stylus_buttons++] = h.loc;
@ -94,48 +94,48 @@ hidms_stylus_hid_parse(struct hidms *ms, struct hid_data *d,
break;
case HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS,
HUD_SECONDARY_BARREL_SWITCH):
DPRINTF("Stylus usage secondary barrel set\n");
DPRINTF(("Stylus usage secondary barrel set\n"));
if (ms->sc_num_stylus_buttons >= MAX_BUTTONS)
break;
loc_stylus_btn[ms->sc_num_stylus_buttons++] = h.loc;
ms->sc_flags |= HIDMS_SEC_BARREL;
break;
case HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_IN_RANGE):
DPRINTF("Stylus usage in range set\n");
DPRINTF(("Stylus usage in range set\n"));
if (ms->sc_num_stylus_buttons >= MAX_BUTTONS)
break;
loc_stylus_btn[ms->sc_num_stylus_buttons++] = h.loc;
break;
case HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_QUALITY):
DPRINTF("Stylus usage quality set\n");
DPRINTF(("Stylus usage quality set\n"));
if (ms->sc_num_stylus_buttons >= MAX_BUTTONS)
break;
loc_stylus_btn[ms->sc_num_stylus_buttons++] = h.loc;
break;
/* Axes */
case HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_WACOM_X):
DPRINTF("Stylus usage x set\n");
DPRINTF(("Stylus usage x set\n"));
ms->sc_loc_x = h.loc;
ms->sc_tsscale.minx = h.logical_minimum;
ms->sc_tsscale.maxx = h.logical_maximum;
ms->sc_flags |= HIDMS_ABSX;
break;
case HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_WACOM_Y):
DPRINTF("Stylus usage y set\n");
DPRINTF(("Stylus usage y set\n"));
ms->sc_loc_y = h.loc;
ms->sc_tsscale.miny = h.logical_minimum;
ms->sc_tsscale.maxy = h.logical_maximum;
ms->sc_flags |= HIDMS_ABSY;
break;
case HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_TIP_PRESSURE):
DPRINTF("Stylus usage pressure set\n");
DPRINTF(("Stylus usage pressure set\n"));
ms->sc_loc_z = h.loc;
ms->sc_tsscale.minz = h.logical_minimum;
ms->sc_tsscale.maxz = h.logical_maximum;
ms->sc_flags |= HIDMS_Z;
break;
case HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_WACOM_DISTANCE):
DPRINTF("Stylus usage distance set\n");
DPRINTF(("Stylus usage distance set\n"));
ms->sc_loc_w = h.loc;
ms->sc_tsscale.minw = h.logical_minimum;
ms->sc_tsscale.maxw = h.logical_maximum;
@ -189,19 +189,19 @@ hidms_wacom_setup(struct device *self, struct hidms *ms, void *desc, int dlen)
if ((hd = hid_get_collection_data(desc, dlen,
HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_DIGITIZER),
HCOLL_APPLICATION))) {
DPRINTF("found the global collection\n");
DPRINTF(("found the global collection\n"));
hid_end_parse(hd);
if ((hd = hid_get_collection_data(desc, dlen,
HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_STYLUS),
HCOLL_PHYSICAL))) {
DPRINTF("found stylus collection\n");
DPRINTF(("found stylus collection\n"));
hidms_stylus_hid_parse(ms, hd, loc_stylus_btn);
hid_end_parse(hd);
}
if ((hd = hid_get_collection_data(desc, dlen,
HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_TABLET_FKEYS),
HCOLL_PHYSICAL))) {
DPRINTF("found tablet keys collection\n");
DPRINTF(("found tablet keys collection\n"));
hidms_pad_buttons_hid_parse(ms, hd, loc_pad_btn);
hid_end_parse(hd);
}
@ -209,7 +209,7 @@ hidms_wacom_setup(struct device *self, struct hidms *ms, void *desc, int dlen)
if ((hd = hid_get_collection_data(desc, dlen,
HID_USAGE2(HUP_WACOM | HUP_DIGITIZERS, HUD_WACOM_BATTERY),
HCOLL_PHYSICAL))) {
DPRINTF("found battery collection\n");
DPRINTF(("found battery collection\n"));
/* parse and set the battery info */
/* not yet used */
hid_end_parse(hd);
@ -233,7 +233,7 @@ hidms_wacom_setup(struct device *self, struct hidms *ms, void *desc, int dlen)
memcpy(&ms->sc_loc_btn[i], &loc_pad_btn[i],
sizeof(struct hid_location));
ms->sc_num_buttons = i;
DPRINTF("Button information\n");
DPRINTF(("Button information\n"));
#ifdef HIDMS_DEBUG
for (i = 0; i < ms->sc_num_buttons; i++)
printf("size: 0x%x, pos: 0x%x, count: 0x%x\n",

View file

@ -1,4 +1,4 @@
/* $OpenBSD: nvme.c,v 1.109 2024/04/15 14:25:10 krw Exp $ */
/* $OpenBSD: nvme.c,v 1.110 2024/05/10 21:23:32 krw Exp $ */
/*
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
@ -201,46 +201,28 @@ nvme_dumpregs(struct nvme_softc *sc)
int
nvme_ready(struct nvme_softc *sc, u_int32_t rdy)
{
u_int32_t csts;
u_int i;
u_int i = 0;
for (i = 0; i <= sc->sc_rdy_to; i++) {
csts = nvme_read4(sc, NVME_CSTS);
/* enable fails if fatal error, disable succeeds. */
if (csts == 0xffffffff || ISSET(csts, NVME_CSTS_CFS))
return (rdy == NVME_CSTS_RDY);
if ((csts & NVME_CSTS_RDY) == rdy)
return (0);
while ((nvme_read4(sc, NVME_CSTS) & NVME_CSTS_RDY) != rdy) {
if (i++ > sc->sc_rdy_to)
return (1);
delay(1000);
nvme_barrier(sc, NVME_CSTS, 4, BUS_SPACE_BARRIER_READ);
}
return (1);
return (0);
}
int
nvme_enable(struct nvme_softc *sc)
{
u_int32_t cc, csts;
u_int32_t cc;
cc = nvme_read4(sc, NVME_CC);
if (cc != 0xffffffff && ISSET(cc, NVME_CC_EN))
if (ISSET(cc, NVME_CC_EN))
return (nvme_ready(sc, NVME_CSTS_RDY));
csts = nvme_read4(sc, NVME_CSTS);
if (csts != 0xffffffff && ISSET(csts, NVME_CSTS_RDY)) {
/*
* Ensure CSTS.RDY is 0.
*
* Transitioning CC.EN from 0 to 1 when CSTS.RDY is 1
* "has undefined results" says NVMe.
*/
if (nvme_ready(sc, 0))
return (1);
}
if (sc->sc_ops->op_enable != NULL)
sc->sc_ops->op_enable(sc);
@ -276,18 +258,10 @@ nvme_disable(struct nvme_softc *sc)
u_int32_t cc, csts;
cc = nvme_read4(sc, NVME_CC);
if (!ISSET(cc, NVME_CC_EN))
return (nvme_ready(sc, 0));
csts = nvme_read4(sc, NVME_CSTS);
if (!ISSET(csts, NVME_CSTS_RDY)) {
/*
* Ensure CSTS.RDY is 1.
*
* Transitioning CC.EN from 1 to 0 when CSTS.RDY is 0
* "has undefined results" says NVMe.
*/
if (nvme_ready(sc, NVME_CSTS_RDY))
if (ISSET(cc, NVME_CC_EN)) {
csts = nvme_read4(sc, NVME_CSTS);
if (!ISSET(csts, NVME_CSTS_CFS) &&
nvme_ready(sc, NVME_CSTS_RDY) != 0)
return (1);
}
@ -539,8 +513,6 @@ nvme_shutdown(struct nvme_softc *sc)
nvme_barrier(sc, 0, sc->sc_ios,
BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
csts = nvme_read4(sc, NVME_CSTS);
if (csts == 0xffffffff)
break;
if ((csts & NVME_CSTS_SHST_MASK) == NVME_CSTS_SHST_DONE)
return (0);
@ -1001,7 +973,6 @@ nvme_poll(struct nvme_softc *sc, struct nvme_queue *q, struct nvme_ccb *ccb,
void (*done)(struct nvme_softc *, struct nvme_ccb *, struct nvme_cqe *);
void *cookie;
int64_t us;
u_int32_t csts;
u_int16_t flags;
memset(&state, 0, sizeof(state));
@ -1017,11 +988,6 @@ nvme_poll(struct nvme_softc *sc, struct nvme_queue *q, struct nvme_ccb *ccb,
for (us = ms * 1000; ms == 0 || us > 0; us -= NVME_TIMO_DELAYNS) {
if (ISSET(state.c.flags, htole16(NVME_CQE_PHASE)))
break;
csts = nvme_read4(sc, NVME_CSTS);
if (csts == 0xffffffff || ISSET(csts, NVME_CSTS_CFS)) {
SET(state.c.flags, htole16(NVME_CQE_SC_INTERNAL_DEV_ERR));
break;
}
if (nvme_q_complete(sc, q) == 0)
delay(NVME_TIMO_DELAYNS);
nvme_barrier(sc, NVME_CSTS, 4, BUS_SPACE_BARRIER_READ);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ufshci.c,v 1.19 2024/05/09 08:24:09 mglocker Exp $ */
/* $OpenBSD: ufshci.c,v 1.20 2024/05/10 06:14:10 mglocker Exp $ */
/*
* Copyright (c) 2022 Marcus Glocker <mglocker@openbsd.org>
@ -42,8 +42,7 @@
#include <dev/ic/ufshcivar.h>
#include <dev/ic/ufshcireg.h>
//#define UFSHCI_DEBUG 1
//#define UFSHCI_DEBUG
#ifdef UFSHCI_DEBUG
int ufshci_dbglvl = 1;
#define DPRINTF(x...) do { printf(x); } while (0)
@ -174,7 +173,7 @@ ufshci_attach(struct ufshci_softc *sc)
/* XXX: Using more than one slot currently causes OCS errors */
sc->sc_nutrs = 1;
#if UFSHCI_DEBUG
#ifdef UFSHCI_DEBUG
printf("Capabilities (0x%08x):\n", sc->sc_cap);
printf(" CS=%d\n", sc->sc_cap & UFSHCI_REG_CAP_CS ? 1 : 0);
printf(" UICDMETMS=%d\n",
@ -1653,10 +1652,8 @@ ufshci_scsi_io(struct scsi_xfer *xs, int dir)
if ((xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) != dir)
goto error1;
DPRINTF("%s: %s, lba=%llu, blocks=%u, datalen=%d (%s)\n",
__func__,
ISSET(xs->flags, SCSI_DATA_IN) ? "READ" : "WRITE",
lba, blocks, xs->datalen,
DPRINTF("%s: %s, datalen=%d (%s)\n", __func__,
ISSET(xs->flags, SCSI_DATA_IN) ? "READ" : "WRITE", xs->datalen,
ISSET(xs->flags, SCSI_POLL) ? "poll" : "no poll");
error = bus_dmamap_load(sc->sc_dmat, dmap, xs->data, xs->datalen, NULL,

View file

@ -1,10 +1,10 @@
/* $OpenBSD: init_sysent.c,v 1.279 2024/04/24 19:10:11 claudio Exp $ */
/* $OpenBSD: init_sysent.c,v 1.280 2024/05/10 09:21:41 claudio Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.262 2024/04/24 19:09:14 claudio Exp
* created from; OpenBSD: syscalls.master,v 1.263 2024/05/10 09:21:01 claudio Exp
*/
#include <sys/param.h>
@ -254,7 +254,7 @@ const struct sysent sysent[] = {
sys_ppoll }, /* 109 = ppoll */
{ 6, s(struct sys_pselect_args), SY_NOLOCK | 0,
sys_pselect }, /* 110 = pselect */
{ 1, s(struct sys_sigsuspend_args), 0,
{ 1, s(struct sys_sigsuspend_args), SY_NOLOCK | 0,
sys_sigsuspend }, /* 111 = sigsuspend */
{ 3, s(struct sys_sendsyslog_args), SY_NOLOCK | 0,
sys_sendsyslog }, /* 112 = sendsyslog */
@ -695,7 +695,7 @@ const struct sysent sysent[] = {
sys___thrwakeup }, /* 301 = __thrwakeup */
{ 1, s(struct sys___threxit_args), 0,
sys___threxit }, /* 302 = __threxit */
{ 3, s(struct sys___thrsigdivert_args), 0,
{ 3, s(struct sys___thrsigdivert_args), SY_NOLOCK | 0,
sys___thrsigdivert }, /* 303 = __thrsigdivert */
{ 2, s(struct sys___getcwd_args), 0,
sys___getcwd }, /* 304 = __getcwd */

View file

@ -1,10 +1,10 @@
/* $OpenBSD: syscalls.c,v 1.277 2024/04/24 19:10:11 claudio Exp $ */
/* $OpenBSD: syscalls.c,v 1.278 2024/05/10 09:21:41 claudio Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.262 2024/04/24 19:09:14 claudio Exp
* created from; OpenBSD: syscalls.master,v 1.263 2024/05/10 09:21:01 claudio Exp
*/
const char *const syscallnames[] = {

View file

@ -1,4 +1,4 @@
; $OpenBSD: syscalls.master,v 1.262 2024/04/24 19:09:14 claudio Exp $
; $OpenBSD: syscalls.master,v 1.263 2024/05/10 09:21:01 claudio Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@ -234,7 +234,7 @@
110 STD NOLOCK { int sys_pselect(int nd, fd_set *in, fd_set *ou, \
fd_set *ex, const struct timespec *ts, \
const sigset_t *mask); }
111 STD { int sys_sigsuspend(int mask); }
111 STD NOLOCK { int sys_sigsuspend(int mask); }
112 STD NOLOCK { int sys_sendsyslog(const char *buf, size_t nbyte, \
int flags); }
113 UNIMPL fktrace
@ -525,7 +525,7 @@
301 STD NOLOCK { int sys___thrwakeup(const volatile void *ident, \
int n); }
302 STD { void sys___threxit(pid_t *notdead); }
303 STD { int sys___thrsigdivert(sigset_t sigmask, \
303 STD NOLOCK { int sys___thrsigdivert(sigset_t sigmask, \
siginfo_t *info, const struct timespec *timeout); }
304 STD { int sys___getcwd(char *buf, size_t len); }
305 STD NOLOCK { int sys_adjfreq(const int64_t *freq, \

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pf.c,v 1.1194 2024/04/12 16:07:09 bluhm Exp $ */
/* $OpenBSD: pf.c,v 1.1195 2024/05/10 03:50:12 jsg Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@ -239,7 +239,7 @@ int pf_src_connlimit(struct pf_state **);
int pf_match_rcvif(struct mbuf *, struct pf_rule *);
int pf_step_into_anchor(struct pf_test_ctx *,
struct pf_rule *);
int pf_match_rule(struct pf_test_ctx *,
enum pf_test_status pf_match_rule(struct pf_test_ctx *,
struct pf_ruleset *);
void pf_counters_inc(int, struct pf_pdesc *,
struct pf_state *, struct pf_rule *,

View file

@ -1,10 +1,10 @@
/* $OpenBSD: syscall.h,v 1.276 2024/04/24 19:10:11 claudio Exp $ */
/* $OpenBSD: syscall.h,v 1.277 2024/05/10 09:21:41 claudio Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.262 2024/04/24 19:09:14 claudio Exp
* created from; OpenBSD: syscalls.master,v 1.263 2024/05/10 09:21:01 claudio Exp
*/
/* syscall: "exit" ret: "void" args: "int" */

View file

@ -1,10 +1,10 @@
/* $OpenBSD: syscallargs.h,v 1.279 2024/04/24 19:10:11 claudio Exp $ */
/* $OpenBSD: syscallargs.h,v 1.280 2024/05/10 09:21:41 claudio Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.262 2024/04/24 19:09:14 claudio Exp
* created from; OpenBSD: syscalls.master,v 1.263 2024/05/10 09:21:01 claudio Exp
*/
#ifdef syscallarg