Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/dev/usb Adapt USBHIST based debug output from -cur...
details: https://anonhg.NetBSD.org/src-all/rev/d634d5b1c83d
branches: trunk
changeset: 368065:d634d5b1c83d
user: Martin Husemann <martin%NetBSD.org@localhost>
date: Tue Jan 18 19:30:49 2022 +0100
description:
Adapt USBHIST based debug output from -current
diffstat:
sys/dev/usb/if_urtwn.c | 362 +++++++++++++++++++++++++-----------------------
1 files changed, 188 insertions(+), 174 deletions(-)
diffs (truncated from 1109 to 300 lines):
diff -r 68fa664b5937 -r d634d5b1c83d sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c Sat Jan 15 20:30:15 2022 +0100
+++ b/sys/dev/usb/if_urtwn.c Tue Jan 18 19:30:49 2022 +0100
@@ -85,6 +85,7 @@
#include <dev/firmload.h>
#include <dev/usb/usbwifi.h>
+#include <dev/usb/usbhist.h>
#include <dev/ic/rtwnreg.h>
#include <dev/ic/rtwn_data.h>
@@ -101,10 +102,27 @@
#define DBG_REG __BIT(6)
#define DBG_ALL 0xffffffffU
u_int urtwn_debug = 0;
-#define DPRINTFN(n, s) \
- do { if (urtwn_debug & (n)) printf s; } while (/*CONSTCOND*/0)
+#define DPRINTFN(n, fmt, a, b, c, d) do { \
+ if (urtwn_debug & (n)) { \
+ KERNHIST_LOG(usbhist, fmt, a, b, c, d); \
+ } \
+} while (/*CONSTCOND*/0)
+#define URTWNHIST_FUNC() USBHIST_FUNC()
+#define URTWNHIST_CALLED() do { \
+ if (urtwn_debug & DBG_FN) { \
+ KERNHIST_CALLED(usbhist); \
+ } \
+} while(/*CONSTCOND*/0)
+#define URTWNHIST_CALLARGS(fmt, a, b, c, d) do { \
+ if (urtwn_debug & DBG_FN) { \
+ KERNHIST_CALLARGS(usbhist, fmt, a, b, c, d); \
+ } \
+} while(/*CONSTCOND*/0)
#else
-#define DPRINTFN(n, s)
+#define DPRINTFN(n, fmt, a, b, c, d)
+#define URTWNHIST_FUNC()
+#define URTWNHIST_CALLED()
+#define URTWNHIST_CALLARGS(fmt, a, b, c, d)
#endif
#define URTWN_DEV(v,p) { { USB_VENDOR_##v, USB_PRODUCT_##v##_##p }, 0 }
@@ -376,6 +394,8 @@
// NNN loop below size_t i;
int error, num_rx, num_tx;
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
+
/*
* Generic usbwifi(9) setup
*/
@@ -401,9 +421,6 @@
aprint_naive("\n");
aprint_normal("\n");
- DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_uw.uw_dev),
- __func__));
-
devinfop = usbd_devinfo_alloc(sc->sc_uw.uw_udev, 0);
aprint_normal_dev(self, "%s\n", devinfop);
usbd_devinfo_free(devinfop);
@@ -568,7 +585,7 @@
{
struct urtwn_softc *sc = device_private(self);
- DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_uw.uw_dev), __func__));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
usbwifi_set_dying(&sc->sc_uw, true);
@@ -598,7 +615,7 @@
usb_endpoint_descriptor_t *ed;
size_t i, ntx = 0, nrx = 0;
- DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_uw.uw_dev), __func__));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
/* Determine the number of bulk-out pipes. */
id = usbd_get_interface_descriptor(sc->sc_uw.uw_iface);
@@ -635,8 +652,8 @@
return EIO;
}
- DPRINTFN(DBG_INIT, ("%s: %s: found %zd/%zd bulk-in/out pipes\n",
- device_xname(sc->sc_uw.uw_dev), __func__, nrx, ntx));
+ DPRINTFN(DBG_INIT, "found %jd/%jd bulk-in/out pipes",
+ nrx, ntx, 0, 0);
*num_rx = nrx;
*num_tx = ntx;
memcpy(&sc->sc_uw.uw_ed[0], epaddr, sizeof(epaddr[0])*ntx);
@@ -667,7 +684,8 @@
struct urtwn_host_cmd *cmd;
int s;
- DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_uw.uw_dev), __func__));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
+
if (vap->iv_state == IEEE80211_S_RUN &&
(ic->ic_opmode == IEEE80211_M_HOSTAP ||
ic->ic_opmode == IEEE80211_M_IBSS)) {
@@ -718,8 +736,9 @@
struct urtwn_host_cmd *cmd;
int s;
- DPRINTFN(DBG_FN, ("%s: %s: cb=%p, arg=%p, len=%d\n",
- device_xname(sc->sc_uw.uw_dev), __func__, cb, arg, len));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
+ DPRINTFN(DBG_FN, "cb=%jd, arg=%jd, len=%jd", (intptr_t)cb,
+ (intptr_t)arg, len, 0);
s = splusb();
mutex_spin_enter(&sc->sc_task_mtx);
@@ -742,7 +761,7 @@
urtwn_wait_async(struct urtwn_softc *sc)
{
- DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_uw.uw_dev), __func__));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
/* Wait for all queued asynchronous commands to complete. */
while (sc->cmdq.queued > 0)
@@ -756,6 +775,7 @@
usb_device_request_t req;
usbd_status error;
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
usbwifi_isowned_core(&sc->sc_uw);
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
@@ -765,8 +785,8 @@
USETW(req.wLength, len);
error = usbd_do_request(sc->sc_uw.uw_udev, &req, buf);
if (error != USBD_NORMAL_COMPLETION) {
- DPRINTFN(DBG_REG, ("%s: %s: error=%d: addr=%#x, len=%d\n",
- device_xname(sc->sc_uw.uw_dev), __func__, error, addr, len));
+ DPRINTFN(DBG_REG, "error=%jd: addr=%#jx, len=%jd",
+ error, (intptr_t)addr, len, 0);
}
return error;
}
@@ -775,8 +795,8 @@
urtwn_write_1(struct urtwn_softc *sc, uint16_t addr, uint8_t val)
{
- DPRINTFN(DBG_REG, ("%s: %s: addr=%#x, val=%#x\n",
- device_xname(sc->sc_uw.uw_dev), __func__, addr, val));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
+ DPRINTFN(DBG_REG, "addr=%#jx, val=%#jx", (intptr_t)addr, val, 0, 0);
urtwn_write_region_1(sc, addr, &val, 1);
}
@@ -786,8 +806,8 @@
{
uint8_t buf[2];
- DPRINTFN(DBG_REG, ("%s: %s: addr=%#x, val=%#x\n",
- device_xname(sc->sc_uw.uw_dev), __func__, addr, val));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
+ DPRINTFN(DBG_REG, "addr=%#jx, val=%#jx", (intptr_t)addr, val, 0, 0);
buf[0] = (uint8_t)val;
buf[1] = (uint8_t)(val >> 8);
@@ -799,8 +819,8 @@
{
uint8_t buf[4];
- DPRINTFN(DBG_REG, ("%s: %s: addr=%#x, val=%#x\n",
- device_xname(sc->sc_uw.uw_dev), __func__, addr, val));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
+ DPRINTFN(DBG_REG, "addr=%#jx, val=%#jx", (intptr_t)addr, val, 0, 0);
buf[0] = (uint8_t)val;
buf[1] = (uint8_t)(val >> 8);
@@ -814,8 +834,8 @@
int len)
{
- DPRINTFN(DBG_REG, ("%s: %s: addr=%#x, len=%#x\n",
- device_xname(sc->sc_uw.uw_dev), __func__, addr, len));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
+ DPRINTFN(DBG_REG, "addr=%#jx, len=%#jx", (intptr_t)addr, len, 0, 0);
return urtwn_write_region_1(sc, addr, buf, len);
}
@@ -827,6 +847,7 @@
usb_device_request_t req;
usbd_status error;
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
usbwifi_isowned_core(&sc->sc_uw);
req.bmRequestType = UT_READ_VENDOR_DEVICE;
@@ -836,8 +857,8 @@
USETW(req.wLength, len);
error = usbd_do_request(sc->sc_uw.uw_udev, &req, buf);
if (error != USBD_NORMAL_COMPLETION) {
- DPRINTFN(DBG_REG, ("%s: %s: error=%d: addr=%#x, len=%d\n",
- device_xname(sc->sc_uw.uw_dev), __func__, error, addr, len));
+ DPRINTFN(DBG_REG, "error=%jd: addr=%#jx, len=%jd",
+ error, (intptr_t)addr, len, 0);
}
return error;
}
@@ -847,11 +868,13 @@
{
uint8_t val;
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
+
if (urtwn_read_region_1(sc, addr, &val, 1) != USBD_NORMAL_COMPLETION)
return 0xff;
- DPRINTFN(DBG_REG, ("%s: %s: addr=%#x, val=%#x\n",
- device_xname(sc->sc_uw.uw_dev), __func__, addr, val));
+ DPRINTFN(DBG_REG, "addr=%#jx, val=%#jx",
+ (intptr_t)addr, val, 0, 0);
return val;
}
@@ -861,12 +884,13 @@
uint8_t buf[2];
uint16_t val;
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
+
if (urtwn_read_region_1(sc, addr, buf, 2) != USBD_NORMAL_COMPLETION)
return 0xffff;
val = LE_READ_2(&buf[0]);
- DPRINTFN(DBG_REG, ("%s: %s: addr=%#x, val=%#x\n",
- device_xname(sc->sc_uw.uw_dev), __func__, addr, val));
+ DPRINTFN(DBG_REG, "addr=%#jx, val=%#jx", (intptr_t)addr, val, 0, 0);
return val;
}
@@ -876,12 +900,13 @@
uint8_t buf[4];
uint32_t val;
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
+
if (urtwn_read_region_1(sc, addr, buf, 4) != USBD_NORMAL_COMPLETION)
return 0xffffffff;
val = LE_READ_4(&buf[0]);
- DPRINTFN(DBG_REG, ("%s: %s: addr=%#x, val=%#x\n",
- device_xname(sc->sc_uw.uw_dev), __func__, addr, val));
+ DPRINTFN(DBG_REG, "addr=%#jx, val=%#jx", (intptr_t)addr, val, 0, 0);
return val;
}
@@ -893,8 +918,9 @@
int fwcur;
int ntries;
- DPRINTFN(DBG_REG, ("%s: %s: id=%d, buf=%p, len=%d\n",
- device_xname(sc->sc_uw.uw_dev), __func__, id, buf, len));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
+ DPRINTFN(DBG_REG, "id=%jd, buf=%#jx, len=%jd", id, (intptr_t)buf,
+ len, 0);
usbwifi_isowned_core(&sc->sc_uw);
@@ -1066,7 +1092,7 @@
uint8_t off, msk;
size_t i;
- DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_uw.uw_dev), __func__));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
usbwifi_isowned_core(&sc->sc_uw);
@@ -1129,7 +1155,7 @@
{
uint32_t reg;
- DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_uw.uw_dev), __func__));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
if (ISSET(sc->chip, URTWN_CHIP_88E) ||
ISSET(sc->chip, URTWN_CHIP_92EU))
@@ -1248,7 +1274,7 @@
struct ieee80211com *ic = &sc->sc_uw.uw_ic;
struct r92c_rom *rom = &sc->rom;
- DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_uw.uw_dev), __func__));
+ URTWNHIST_FUNC(); URTWNHIST_CALLED();
usbwifi_isowned_core(&sc->sc_uw);
@@ -1265,15 +1291,13 @@
sc->regulatory = MS(rom->rf_opt1, R92C_ROM_RF1_REGULATORY);
DPRINTFN(DBG_INIT,
- ("%s: %s: PA setting=%#x, board=%#x, regulatory=%d\n",
- device_xname(sc->sc_uw.uw_dev), __func__, sc->pa_setting,
- sc->board_type, sc->regulatory));
+ "PA setting=%#jx, board=%#jx, regulatory=%jd",
+ sc->pa_setting, sc->board_type, sc->regulatory, 0);
Home |
Main Index |
Thread Index |
Old Index