Report ATA/SATA channel number to NewBus at location string.

This commit is contained in:
mav 2010-05-22 07:32:47 +00:00
parent d785fc2581
commit 810a32455d
6 changed files with 59 additions and 0 deletions

View File

@ -778,6 +778,16 @@ ahci_print_child(device_t dev, device_t child)
return (retval);
}
static int
ahci_child_location_str(device_t dev, device_t child, char *buf,
size_t buflen)
{
snprintf(buf, buflen, "channel=%d",
(int)(intptr_t)device_get_ivars(child));
return (0);
}
devclass_t ahci_devclass;
static device_method_t ahci_methods[] = {
DEVMETHOD(device_probe, ahci_probe),
@ -790,6 +800,7 @@ static device_method_t ahci_methods[] = {
DEVMETHOD(bus_release_resource, ahci_release_resource),
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
DEVMETHOD(bus_child_location_str, ahci_child_location_str),
{ 0, 0 }
};
static driver_t ahci_driver = {
@ -809,6 +820,7 @@ static device_method_t ahci_ata_methods[] = {
DEVMETHOD(bus_release_resource, ahci_release_resource),
DEVMETHOD(bus_setup_intr, ahci_setup_intr),
DEVMETHOD(bus_teardown_intr,ahci_teardown_intr),
DEVMETHOD(bus_child_location_str, ahci_child_location_str),
{ 0, 0 }
};
static driver_t ahci_ata_driver = {

View File

@ -544,6 +544,16 @@ ata_pci_dmafini(device_t dev)
ata_dmafini(dev);
}
int
ata_pci_child_location_str(device_t dev, device_t child, char *buf,
size_t buflen)
{
snprintf(buf, buflen, "channel=%d",
(int)(intptr_t)device_get_ivars(child));
return (0);
}
static device_method_t ata_pci_methods[] = {
/* device interface */
DEVMETHOD(device_probe, ata_pci_probe),
@ -564,6 +574,7 @@ static device_method_t ata_pci_methods[] = {
DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr),
DEVMETHOD(pci_read_config, ata_pci_read_config),
DEVMETHOD(pci_write_config, ata_pci_write_config),
DEVMETHOD(bus_child_location_str, ata_pci_child_location_str),
{ 0, 0 }
};

View File

@ -502,6 +502,8 @@ int ata_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value)
uint32_t ata_pci_read_config(device_t dev, device_t child, int reg, int width);
void ata_pci_write_config(device_t dev, device_t child, int reg,
uint32_t val, int width);
int ata_pci_child_location_str(device_t dev, device_t child, char *buf,
size_t buflen);
struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags);
int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r);
int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep);
@ -550,6 +552,7 @@ static device_method_t __CONCAT(dname,_methods)[] = { \
DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), \
DEVMETHOD(pci_read_config, ata_pci_read_config), \
DEVMETHOD(pci_write_config, ata_pci_write_config), \
DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), \
{ 0, 0 } \
}; \
static driver_t __CONCAT(dname,_driver) = { \

View File

@ -482,6 +482,16 @@ mvs_print_child(device_t dev, device_t child)
return (retval);
}
static int
mvs_child_location_str(device_t dev, device_t child, char *buf,
size_t buflen)
{
snprintf(buf, buflen, "channel=%d",
(int)(intptr_t)device_get_ivars(child));
return (0);
}
static device_method_t mvs_methods[] = {
DEVMETHOD(device_probe, mvs_probe),
DEVMETHOD(device_attach, mvs_attach),
@ -493,6 +503,7 @@ static device_method_t mvs_methods[] = {
DEVMETHOD(bus_release_resource, mvs_release_resource),
DEVMETHOD(bus_setup_intr, mvs_setup_intr),
DEVMETHOD(bus_teardown_intr,mvs_teardown_intr),
DEVMETHOD(bus_child_location_str, mvs_child_location_str),
DEVMETHOD(mvs_edma, mvs_edma),
{ 0, 0 }
};

View File

@ -413,6 +413,16 @@ mvs_print_child(device_t dev, device_t child)
return (retval);
}
static int
mvs_child_location_str(device_t dev, device_t child, char *buf,
size_t buflen)
{
snprintf(buf, buflen, "channel=%d",
(int)(intptr_t)device_get_ivars(child));
return (0);
}
static device_method_t mvs_methods[] = {
DEVMETHOD(device_probe, mvs_probe),
DEVMETHOD(device_attach, mvs_attach),
@ -425,6 +435,7 @@ static device_method_t mvs_methods[] = {
DEVMETHOD(bus_setup_intr, mvs_setup_intr),
DEVMETHOD(bus_teardown_intr,mvs_teardown_intr),
DEVMETHOD(mvs_edma, mvs_edma),
DEVMETHOD(bus_child_location_str, mvs_child_location_str),
{ 0, 0 }
};
static driver_t mvs_driver = {

View File

@ -398,6 +398,16 @@ siis_print_child(device_t dev, device_t child)
return (retval);
}
static int
siis_child_location_str(device_t dev, device_t child, char *buf,
size_t buflen)
{
snprintf(buf, buflen, "channel=%d",
(int)(intptr_t)device_get_ivars(child));
return (0);
}
devclass_t siis_devclass;
static device_method_t siis_methods[] = {
DEVMETHOD(device_probe, siis_probe),
@ -410,6 +420,7 @@ static device_method_t siis_methods[] = {
DEVMETHOD(bus_release_resource, siis_release_resource),
DEVMETHOD(bus_setup_intr, siis_setup_intr),
DEVMETHOD(bus_teardown_intr,siis_teardown_intr),
DEVMETHOD(bus_child_location_str, siis_child_location_str),
{ 0, 0 }
};
static driver_t siis_driver = {