sync with OpenBSD -current
This commit is contained in:
parent
492219ffd1
commit
087a435dae
17 changed files with 98 additions and 184 deletions
|
@ -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);
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue