Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/bhnd.c
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
* use bcma(4); the programming model is almost entirely independent | * use bcma(4); the programming model is almost entirely independent | ||||
* of the actual underlying interconect. | * of the actual underlying interconect. | ||||
*/ | */ | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/sbuf.h> | |||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <machine/bus.h> | #include <machine/bus.h> | ||||
#include <sys/rman.h> | #include <sys/rman.h> | ||||
#include <machine/resource.h> | #include <machine/resource.h> | ||||
#include <dev/bhnd/cores/pmu/bhnd_pmu.h> | #include <dev/bhnd/cores/pmu/bhnd_pmu.h> | ||||
▲ Show 20 Lines • Show All 831 Lines • ▼ Show 20 Lines | if (rl != NULL) { | ||||
resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%#jd"); | resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%#jd"); | ||||
} | } | ||||
printf(" at core %u (no driver attached)\n", | printf(" at core %u (no driver attached)\n", | ||||
bhnd_get_core_index(child)); | bhnd_get_core_index(child)); | ||||
} | } | ||||
/** | /** | ||||
* Default implementation of BUS_CHILD_PNPINFO_STR(). | * Default implementation of BUS_CHILD_PNPINFO(). | ||||
rpokala: Since you're here: "Default implementation" is seems wrong; this is the `bhnd(4)`-specific… | |||||
Done Inline ActionsWell, it's no worse then before, but you're right that it reads weird. imp: Well, it's no worse then before, but you're right that it reads weird.
| |||||
Not Done Inline ActionsMaybe fix it to match what is done below for BUS_CHILD_DELETED() and use: * Default bhnd(4) bus driver implementation of BUS_CHILD_PNPINFO(). But these comments actually add no useful value and I'd be happy to see them be axed instead. jhb: Maybe fix it to match what is done below for BUS_CHILD_DELETED() and use:
```
* Default bhnd… | |||||
*/ | */ | ||||
static int | static int | ||||
bhnd_child_pnpinfo_str(device_t dev, device_t child, char *buf, | bhnd_child_pnpinfo(device_t dev, device_t child, struct sbuf *sb) | ||||
size_t buflen) | |||||
{ | { | ||||
if (device_get_parent(child) != dev) { | if (device_get_parent(child) != dev) | ||||
return (BUS_CHILD_PNPINFO_STR(device_get_parent(dev), child, | return (BUS_CHILD_PNPINFO(device_get_parent(dev), child, sb)); | ||||
buf, buflen)); | |||||
} | |||||
snprintf(buf, buflen, "vendor=0x%hx device=0x%hx rev=0x%hhx", | sbuf_printf(sb, "vendor=0x%hx device=0x%hx rev=0x%hhx", | ||||
bhnd_get_vendor(child), bhnd_get_device(child), | bhnd_get_vendor(child), bhnd_get_device(child), | ||||
bhnd_get_hwrev(child)); | bhnd_get_hwrev(child)); | ||||
return (0); | return (0); | ||||
} | } | ||||
/** | /** | ||||
* Default implementation of BUS_CHILD_LOCATION_STR(). | * Default implementation of BUS_CHILD_LOCATION(). | ||||
*/ | */ | ||||
static int | static int | ||||
bhnd_child_location_str(device_t dev, device_t child, char *buf, | bhnd_child_location(device_t dev, device_t child, struct sbuf *sb) | ||||
size_t buflen) | |||||
{ | { | ||||
bhnd_addr_t addr; | bhnd_addr_t addr; | ||||
bhnd_size_t size; | bhnd_size_t size; | ||||
if (device_get_parent(child) != dev) { | if (device_get_parent(child) != dev) | ||||
return (BUS_CHILD_LOCATION_STR(device_get_parent(dev), child, | return (BUS_CHILD_LOCATION(device_get_parent(dev), child, sb)); | ||||
buf, buflen)); | |||||
} | |||||
if (bhnd_get_region_addr(child, BHND_PORT_DEVICE, 0, 0, &addr, &size)) { | if (bhnd_get_region_addr(child, BHND_PORT_DEVICE, 0, 0, &addr, &size)) | ||||
/* No device default port/region */ | |||||
if (buflen > 0) | |||||
*buf = '\0'; | |||||
return (0); | return (0); | ||||
} | |||||
snprintf(buf, buflen, "port0.0=0x%llx", (unsigned long long) addr); | sbuf_printf(sb, "port0.0=0x%llx", (unsigned long long) addr); | ||||
return (0); | return (0); | ||||
} | } | ||||
/** | /** | ||||
* Default bhnd(4) bus driver implementation of BUS_CHILD_DELETED(). | * Default bhnd(4) bus driver implementation of BUS_CHILD_DELETED(). | ||||
* | * | ||||
* This implementation manages internal bhnd(4) state, and must be called | * This implementation manages internal bhnd(4) state, and must be called | ||||
* by subclassing drivers. | * by subclassing drivers. | ||||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | static device_method_t bhnd_methods[] = { | ||||
DEVMETHOD(device_shutdown, bhnd_generic_shutdown), | DEVMETHOD(device_shutdown, bhnd_generic_shutdown), | ||||
DEVMETHOD(device_suspend, bhnd_generic_suspend), | DEVMETHOD(device_suspend, bhnd_generic_suspend), | ||||
DEVMETHOD(device_resume, bhnd_generic_resume), | DEVMETHOD(device_resume, bhnd_generic_resume), | ||||
/* Bus interface */ | /* Bus interface */ | ||||
DEVMETHOD(bus_child_deleted, bhnd_generic_child_deleted), | DEVMETHOD(bus_child_deleted, bhnd_generic_child_deleted), | ||||
DEVMETHOD(bus_probe_nomatch, bhnd_generic_probe_nomatch), | DEVMETHOD(bus_probe_nomatch, bhnd_generic_probe_nomatch), | ||||
DEVMETHOD(bus_print_child, bhnd_generic_print_child), | DEVMETHOD(bus_print_child, bhnd_generic_print_child), | ||||
DEVMETHOD(bus_child_pnpinfo_str, bhnd_child_pnpinfo_str), | DEVMETHOD(bus_child_pnpinfo, bhnd_child_pnpinfo), | ||||
DEVMETHOD(bus_child_location_str, bhnd_child_location_str), | DEVMETHOD(bus_child_location, bhnd_child_location), | ||||
DEVMETHOD(bus_suspend_child, bhnd_generic_suspend_child), | DEVMETHOD(bus_suspend_child, bhnd_generic_suspend_child), | ||||
DEVMETHOD(bus_resume_child, bhnd_generic_resume_child), | DEVMETHOD(bus_resume_child, bhnd_generic_resume_child), | ||||
DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), | DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), | ||||
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), | DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), | ||||
DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource), | DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource), | ||||
DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource), | DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource), | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |
Since you're here: "Default implementation" is seems wrong; this is the bhnd(4)-specific implementation, right? The "Default implementation" would be the one in subr_bus.c, right?