aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ntb/ntb_transport.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2017-09-02 11:56:16 +0000
committerAlexander Motin <mav@FreeBSD.org>2017-09-02 11:56:16 +0000
commitb7dd3fbedee199e37d7f8011f9e405716aa7781c (patch)
treecc9ef783f0de0795b45bc2e35d081e0fe961ae84 /sys/dev/ntb/ntb_transport.c
parenta905e3962c8d061d3c03c622196db00db3bf7716 (diff)
downloadsrc-b7dd3fbedee199e37d7f8011f9e405716aa7781c.tar.gz
src-b7dd3fbedee199e37d7f8011f9e405716aa7781c.zip
Make NTB drivers report more info via NewBus methods.
MFC after: 12 days
Notes
Notes: svn path=/head/; revision=323126
Diffstat (limited to 'sys/dev/ntb/ntb_transport.c')
-rw-r--r--sys/dev/ntb/ntb_transport.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/sys/dev/ntb/ntb_transport.c b/sys/dev/ntb/ntb_transport.c
index bb3287d5f058..869b53476882 100644
--- a/sys/dev/ntb/ntb_transport.c
+++ b/sys/dev/ntb/ntb_transport.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2016 Alexander Motin <mav@FreeBSD.org>
+ * Copyright (c) 2016-2017 Alexander Motin <mav@FreeBSD.org>
* Copyright (C) 2013 Intel Corporation
* Copyright (C) 2015 EMC Corporation
* All rights reserved.
@@ -188,6 +188,7 @@ struct ntb_transport_mw {
struct ntb_transport_child {
device_t dev;
+ int consumer;
int qpoff;
int qpcnt;
struct ntb_transport_child *next;
@@ -343,9 +344,6 @@ ntb_transport_attach(device_t dev)
KASSERT(db_bitmap == (1 << db_count) - 1,
("Doorbells are not sequential (%jx).\n", db_bitmap));
- device_printf(dev, "%d memory windows, %d scratchpads, "
- "%d doorbells\n", nt->mw_count, spad_count, db_count);
-
if (nt->mw_count == 0) {
device_printf(dev, "At least 1 memory window required.\n");
return (ENXIO);
@@ -409,6 +407,7 @@ ntb_transport_attach(device_t dev)
}
nc = malloc(sizeof(*nc), M_DEVBUF, M_WAITOK | M_ZERO);
+ nc->consumer = i;
nc->qpoff = qpu;
nc->qpcnt = qp;
nc->dev = device_add_child(dev, name, -1);
@@ -496,6 +495,35 @@ ntb_transport_detach(device_t dev)
return (0);
}
+static int
+ntb_transport_print_child(device_t dev, device_t child)
+{
+ struct ntb_transport_child *nc = device_get_ivars(child);
+ int retval;
+
+ retval = bus_print_child_header(dev, child);
+ if (nc->qpcnt > 0) {
+ printf(" queue %d", nc->qpoff);
+ if (nc->qpcnt > 1)
+ printf("-%d", nc->qpoff + nc->qpcnt - 1);
+ }
+ retval += printf(" at consumer %d", nc->consumer);
+ retval += bus_print_child_domain(dev, child);
+ retval += bus_print_child_footer(dev, child);
+
+ return (retval);
+}
+
+static int
+ntb_transport_child_location_str(device_t dev, device_t child, char *buf,
+ size_t buflen)
+{
+ struct ntb_transport_child *nc = device_get_ivars(child);
+
+ snprintf(buf, buflen, "consumer=%d", nc->consumer);
+ return (0);
+}
+
int
ntb_transport_queue_count(device_t dev)
{
@@ -1552,6 +1580,9 @@ static device_method_t ntb_transport_methods[] = {
DEVMETHOD(device_probe, ntb_transport_probe),
DEVMETHOD(device_attach, ntb_transport_attach),
DEVMETHOD(device_detach, ntb_transport_detach),
+ /* Bus interface */
+ DEVMETHOD(bus_child_location_str, ntb_transport_child_location_str),
+ DEVMETHOD(bus_print_child, ntb_transport_print_child),
DEVMETHOD_END
};