summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-05-26 23:42:50 -0400
committerIan Moffett <ian@osmora.org>2024-05-26 23:44:35 -0400
commitc3e50e6a2101afeadca9568481b6ed4395ae560b (patch)
tree96cd08853bdde8a77a6d89511502f2a72ec4ea61 /sys/dev
parenta59842033c0a29f774f895278597c8fc8141f7ac (diff)
kernel: Fixup logging to work with syslog changes
This commit removes the KINFO(), KERR(), ... macros Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/nvme.c25
-rw-r--r--sys/dev/pci/pci.c4
-rw-r--r--sys/dev/usb/xhci.c21
3 files changed, 29 insertions, 21 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index 729abe8..df533a3 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -43,6 +43,9 @@ __MODULE_NAME("nvme");
__KERNEL_META("$Hyra$: nvme.c, Ian Marco Moffett, "
"NVMe driver");
+#define pr_trace(fmt, ...) kprintf("nvme: " fmt, ##__VA_ARGS__)
+#define pr_error(...) pr_trace(__VA_ARGS__)
+
static struct pci_device *nvme_dev;
static struct timer driver_tmr;
static TAILQ_HEAD(,nvme_ns) namespaces;
@@ -168,12 +171,12 @@ nvme_poll_submit_cmd(struct nvme_queue *queue, struct nvme_cmd cmd)
break;
}
if ((status & ~1) != 0) {
- KDEBUG("NVMe cmd error (bits=0x%x)\n", status >> 1);
+ pr_trace("NVMe cmd error (bits=0x%x)\n", status >> 1);
break;
}
if (spins > 5) {
/* Attempts exhausted */
- KERR("Hang on phase bit poll, giving up (cmd error)\n");
+ pr_error("Hang on phase bit poll, giving up (cmd error)\n");
break;
}
@@ -422,7 +425,7 @@ nvme_init_ns(struct nvme_state *state, uint16_t nsid)
snprintf(devname, sizeof(devname), "nvme0n%d", nsid);
if (devfs_add_dev(devname, dev) != 0) {
- KERR("Failed to create /dev/%s\n", devname);
+ pr_error("Failed to create /dev/%s\n", devname);
}
TAILQ_INSERT_TAIL(&namespaces, ns, link);
@@ -443,7 +446,7 @@ nvme_disable_controller(struct nvme_state *state)
}
if (nvme_poll_ready(bar, 0) < 0) {
- KERR("Failed to disable controller\n");
+ pr_error("Failed to disable controller\n");
return -1;
}
@@ -467,8 +470,8 @@ nvme_log_ctrl_id(struct nvme_id *id)
fr[i] = id->fr[i];
}
- KDEBUG("NVMe model: %s\n", mn);
- KDEBUG("NVMe firmware revision: %s\n", fr);
+ pr_trace("NVMe model: %s\n", mn);
+ pr_trace("NVMe firmware revision: %s\n", fr);
}
/*
@@ -508,7 +511,7 @@ nvme_enable_controller(struct nvme_state *state)
}
if (nvme_poll_ready(bar, 1) < 0) {
- KERR("Failed to enable controller\n");
+ pr_error("Failed to enable controller\n");
return -1;
}
@@ -539,7 +542,7 @@ nvme_enable_controller(struct nvme_state *state)
/* Init NVMe namespaces */
for (size_t i = 0; i < id->nn; ++i) {
if (nsids[i] != 0) {
- KINFO("Found NVMe namespace (id=%d)\n", nsids[i]);
+ pr_trace("Found NVMe namespace (id=%d)\n", nsids[i]);
nvme_init_ns(state, nsids[i]);
}
}
@@ -583,12 +586,12 @@ nvme_init(void)
};
if (req_timer(TIMER_GP, &driver_tmr) != 0) {
- KERR("Failed to fetch general purpose timer\n");
+ pr_error("Failed to fetch general purpose timer\n");
return -1;
}
if (driver_tmr.msleep == NULL) {
- KERR("Timer does not have msleep()\n");
+ pr_error("Timer does not have msleep()\n");
return -1;
}
@@ -598,7 +601,7 @@ nvme_init(void)
}
bar = PCI_BAR_MEMBASE(nvme_dev->bar[0]);
- KINFO("NVMe BAR0 @ 0x%p\n", bar);
+ pr_trace("NVMe BAR0 @ 0x%p\n", bar);
TAILQ_INIT(&namespaces);
if (nvme_init_controller(bar) < 0) {
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 4985dd8..006b428 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -43,6 +43,8 @@ __MODULE_NAME("pci");
__KERNEL_META("$Hyra$: pci.c, Ian Marco Moffett, "
"PCI driver core");
+#define pr_trace(fmt, ...) kprintf("pci: " fmt, ##__VA_ARGS__)
+
static TAILQ_HEAD(, pci_device) device_list;
static int access_method = PCI_ACCESS_CAM;
@@ -276,7 +278,7 @@ pci_init(void)
{
TAILQ_INIT(&device_list);
- KINFO("Scanning each bus...\n");
+ pr_trace("Scanning each bus...\n");
for (uint16_t i = 0; i < 256; ++i) {
pci_scan_bus(i);
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c
index 61e9b8b..f221843 100644
--- a/sys/dev/usb/xhci.c
+++ b/sys/dev/usb/xhci.c
@@ -43,6 +43,9 @@ __MODULE_NAME("xhci");
__KERNEL_META("$Hyra$: xhci.c, Ian Marco Moffett, "
"xHCI driver");
+#define pr_trace(fmt, ...) kprintf("xhci: " fmt, ##__VA_ARGS__)
+#define pr_error(...) pr_trace(__VA_ARGS__)
+
static struct pci_device *hci_dev;
static struct timer driver_tmr;
@@ -188,12 +191,12 @@ xhci_init_scratchpads(struct xhci_hc *hc)
return 0;
}
- KINFO("Need %d scratchpad buffers\n", max_bufs);
+ pr_trace("Need %d scratchpad buffers\n", max_bufs);
/* Allocate buffer array */
buffer_array = dynalloc_memalign(sizeof(uintptr_t)*max_bufs, 0x1000);
if (buffer_array == NULL) {
- KERR("Failed to allocate scratchpad buffer array\n");
+ pr_error("Failed to allocate scratchpad buffer array\n");
return -1;
}
@@ -205,7 +208,7 @@ xhci_init_scratchpads(struct xhci_hc *hc)
if (tmp == 0) {
/* TODO: Shutdown, free memory */
- KERR("Failed to fill scratchpad buffer array\n");
+ pr_error("Failed to fill scratchpad buffer array\n");
return -1;
}
@@ -229,7 +232,7 @@ xhci_init_ports(struct xhci_hc *hc)
for (size_t i = 1; i < maxports; ++i) {
portsc = xhci_get_portsc(hc, i);
if (__TEST(*portsc, XHCI_PORTSC_CCS)) {
- KINFO("Device connected on port %d, resetting...\n", i);
+ pr_trace("Device connected on port %d, resetting...\n", i);
*portsc |= XHCI_PORTSC_PR;
}
}
@@ -287,7 +290,7 @@ xhci_reset_hc(struct xhci_hc *hc)
struct xhci_opregs *opregs = hc->opregs;
size_t time_waiting = 0; /* In ms */
- KINFO("Resetting host controller...\n");
+ pr_trace("Resetting host controller...\n");
/*
* Set USBCMD.HCRST to reset the controller and
@@ -300,7 +303,7 @@ xhci_reset_hc(struct xhci_hc *hc)
break;
}
if (time_waiting >= XHCI_TIMEOUT) {
- KERR("Hang while polling USBCMD.HCRST to be zero\n");
+ pr_error("Hang while polling USBCMD.HCRST to be zero\n");
return -1;
}
driver_tmr.msleep(50);
@@ -443,14 +446,14 @@ xhci_init(void)
bar1 = hci_dev->bar[1] & ~7;
base = __COMBINE32(bar1, bar0);
hc.base = PHYS_TO_VIRT(base);
- KINFO("xHCI HC base @ 0x%p\n", base);
+ pr_trace("xHCI HC base @ 0x%p\n", base);
if (req_timer(TIMER_GP, &driver_tmr) != 0) {
- KERR("Failed to fetch general purpose timer\n");
+ pr_error("Failed to fetch general purpose timer\n");
return -1;
}
if (driver_tmr.msleep == NULL) {
- KERR("Timer does not have msleep()\n");
+ pr_error("Timer does not have msleep()\n");
return -1;
}