svn commit: r223091 - head/sys/dev/puc
John Baldwin
jhb at FreeBSD.org
Tue Jun 14 18:19:48 UTC 2011
Author: jhb
Date: Tue Jun 14 18:19:48 2011
New Revision: 223091
URL: http://svn.freebsd.org/changeset/base/223091
Log:
Add location and pnpinfo strings for puc device ports. The location is
announced during boot and contains the port number. The pnpinfo string
lists the port type (PUC_TYPE_* constants).
Tested by: Boris Samorodov bsam ipt ru
MFC after: 1 week
Modified:
head/sys/dev/puc/puc.c
head/sys/dev/puc/puc_bfe.h
head/sys/dev/puc/puc_pccard.c
head/sys/dev/puc/puc_pci.c
Modified: head/sys/dev/puc/puc.c
==============================================================================
--- head/sys/dev/puc/puc.c Tue Jun 14 17:51:46 2011 (r223090)
+++ head/sys/dev/puc/puc.c Tue Jun 14 18:19:48 2011 (r223091)
@@ -726,3 +726,41 @@ puc_bus_read_ivar(device_t dev, device_t
}
return (0);
}
+
+int
+puc_bus_print_child(device_t dev, device_t child)
+{
+ struct puc_port *port;
+ int retval;
+
+ port = device_get_ivars(child);
+ retval = 0;
+
+ retval += bus_print_child_header(dev, child);
+ retval += printf(" at port %d", port->p_nr);
+ retval += bus_print_child_footer(dev, child);
+
+ return (retval);
+}
+
+int
+puc_bus_child_location_str(device_t dev, device_t child, char *buf,
+ size_t buflen)
+{
+ struct puc_port *port;
+
+ port = device_get_ivars(child);
+ snprintf(buf, buflen, "port=%d", port->p_nr);
+ return (0);
+}
+
+int
+puc_bus_child_pnpinfo_str(device_t dev, device_t child, char *buf,
+ size_t buflen)
+{
+ struct puc_port *port;
+
+ port = device_get_ivars(child);
+ snprintf(buf, buflen, "type=%d", port->p_type);
+ return (0);
+}
Modified: head/sys/dev/puc/puc_bfe.h
==============================================================================
--- head/sys/dev/puc/puc_bfe.h Tue Jun 14 17:51:46 2011 (r223090)
+++ head/sys/dev/puc/puc_bfe.h Tue Jun 14 18:19:48 2011 (r223091)
@@ -82,9 +82,12 @@ int puc_bfe_attach(device_t);
int puc_bfe_detach(device_t);
int puc_bfe_probe(device_t, const struct puc_cfg *);
+int puc_bus_child_location_str(device_t, device_t, char *, size_t);
+int puc_bus_child_pnpinfo_str(device_t, device_t, char *, size_t);
struct resource *puc_bus_alloc_resource(device_t, device_t, int, int *, u_long,
u_long, u_long, u_int);
int puc_bus_get_resource(device_t, device_t, int, int, u_long *, u_long *);
+int puc_bus_print_child(device_t, device_t);
int puc_bus_read_ivar(device_t, device_t, int, uintptr_t *);
int puc_bus_release_resource(device_t, device_t, int, int, struct resource *);
int puc_bus_setup_intr(device_t, device_t, struct resource *, int,
Modified: head/sys/dev/puc/puc_pccard.c
==============================================================================
--- head/sys/dev/puc/puc_pccard.c Tue Jun 14 17:51:46 2011 (r223090)
+++ head/sys/dev/puc/puc_pccard.c Tue Jun 14 18:19:48 2011 (r223091)
@@ -82,7 +82,9 @@ static device_method_t puc_pccard_method
DEVMETHOD(bus_read_ivar, puc_bus_read_ivar),
DEVMETHOD(bus_setup_intr, puc_bus_setup_intr),
DEVMETHOD(bus_teardown_intr, puc_bus_teardown_intr),
- DEVMETHOD(bus_print_child, bus_generic_print_child),
+ DEVMETHOD(bus_print_child, puc_bus_print_child),
+ DEVMETHOD(bus_child_pnpinfo_str, puc_bus_child_pnpinfo_str),
+ DEVMETHOD(bus_child_location_str, puc_bus_child_location_str),
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
{ 0, 0 }
};
Modified: head/sys/dev/puc/puc_pci.c
==============================================================================
--- head/sys/dev/puc/puc_pci.c Tue Jun 14 17:51:46 2011 (r223090)
+++ head/sys/dev/puc/puc_pci.c Tue Jun 14 18:19:48 2011 (r223091)
@@ -132,7 +132,9 @@ static device_method_t puc_pci_methods[]
DEVMETHOD(bus_read_ivar, puc_bus_read_ivar),
DEVMETHOD(bus_setup_intr, puc_bus_setup_intr),
DEVMETHOD(bus_teardown_intr, puc_bus_teardown_intr),
- DEVMETHOD(bus_print_child, bus_generic_print_child),
+ DEVMETHOD(bus_print_child, puc_bus_print_child),
+ DEVMETHOD(bus_child_pnpinfo_str, puc_bus_child_pnpinfo_str),
+ DEVMETHOD(bus_child_location_str, puc_bus_child_location_str),
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
{ 0, 0 }
};
More information about the svn-src-head
mailing list