Changeset View
Changeset View
Standalone View
Standalone View
head/sys/mips/mips/nexus.c
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
#define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) | #define DEVTONX(dev) ((struct nexus_device *)device_get_ivars(dev)) | ||||
static struct rman irq_rman; | static struct rman irq_rman; | ||||
static struct rman mem_rman; | static struct rman mem_rman; | ||||
static struct resource * | static struct resource * | ||||
nexus_alloc_resource(device_t, device_t, int, int *, u_long, | nexus_alloc_resource(device_t, device_t, int, int *, rman_res_t, | ||||
u_long, u_long, u_int); | rman_res_t, rman_res_t, u_int); | ||||
static device_t nexus_add_child(device_t, u_int, const char *, int); | static device_t nexus_add_child(device_t, u_int, const char *, int); | ||||
static int nexus_attach(device_t); | static int nexus_attach(device_t); | ||||
static void nexus_delete_resource(device_t, device_t, int, int); | static void nexus_delete_resource(device_t, device_t, int, int); | ||||
static struct resource_list * | static struct resource_list * | ||||
nexus_get_reslist(device_t, device_t); | nexus_get_reslist(device_t, device_t); | ||||
static int nexus_get_resource(device_t, device_t, int, int, u_long *, | static int nexus_get_resource(device_t, device_t, int, int, rman_res_t *, | ||||
u_long *); | rman_res_t *); | ||||
static int nexus_print_child(device_t, device_t); | static int nexus_print_child(device_t, device_t); | ||||
static int nexus_print_all_resources(device_t dev); | static int nexus_print_all_resources(device_t dev); | ||||
static int nexus_probe(device_t); | static int nexus_probe(device_t); | ||||
static int nexus_release_resource(device_t, device_t, int, int, | static int nexus_release_resource(device_t, device_t, int, int, | ||||
struct resource *); | struct resource *); | ||||
static int nexus_set_resource(device_t, device_t, int, int, u_long, | static int nexus_set_resource(device_t, device_t, int, int, rman_res_t, | ||||
u_long); | rman_res_t); | ||||
static int nexus_activate_resource(device_t, device_t, int, int, | static int nexus_activate_resource(device_t, device_t, int, int, | ||||
struct resource *); | struct resource *); | ||||
static int nexus_deactivate_resource(device_t, device_t, int, int, | static int nexus_deactivate_resource(device_t, device_t, int, int, | ||||
struct resource *); | struct resource *); | ||||
static void nexus_hinted_child(device_t, const char *, int); | static void nexus_hinted_child(device_t, const char *, int); | ||||
static int nexus_setup_intr(device_t dev, device_t child, | static int nexus_setup_intr(device_t dev, device_t child, | ||||
struct resource *res, int flags, driver_filter_t *filt, | struct resource *res, int flags, driver_filter_t *filt, | ||||
driver_intr_t *intr, void *arg, void **cookiep); | driver_intr_t *intr, void *arg, void **cookiep); | ||||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Allocate a resource on behalf of child. NB: child is usually going to be a | * Allocate a resource on behalf of child. NB: child is usually going to be a | ||||
* child of one of our descendants, not a direct child of nexus0. | * child of one of our descendants, not a direct child of nexus0. | ||||
* (Exceptions include footbridge.) | * (Exceptions include footbridge.) | ||||
*/ | */ | ||||
static struct resource * | static struct resource * | ||||
nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, | nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
struct nexus_device *ndev = DEVTONX(child); | struct nexus_device *ndev = DEVTONX(child); | ||||
struct resource *rv; | struct resource *rv; | ||||
struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
struct rman *rm; | struct rman *rm; | ||||
int isdefault, needactivate, passthrough; | int isdefault, needactivate, passthrough; | ||||
dprintf("%s: entry (%p, %p, %d, %p, %p, %p, %ld, %d)\n", | dprintf("%s: entry (%p, %p, %d, %p, %p, %p, %ld, %d)\n", | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct nexus_device *ndev = DEVTONX(child); | struct nexus_device *ndev = DEVTONX(child); | ||||
return (&ndev->nx_resources); | return (&ndev->nx_resources); | ||||
} | } | ||||
static int | static int | ||||
nexus_set_resource(device_t dev, device_t child, int type, int rid, | nexus_set_resource(device_t dev, device_t child, int type, int rid, | ||||
u_long start, u_long count) | rman_res_t start, rman_res_t count) | ||||
{ | { | ||||
struct nexus_device *ndev = DEVTONX(child); | struct nexus_device *ndev = DEVTONX(child); | ||||
struct resource_list *rl = &ndev->nx_resources; | struct resource_list *rl = &ndev->nx_resources; | ||||
struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
dprintf("%s: entry (%p, %p, %d, %d, %p, %ld)\n", | dprintf("%s: entry (%p, %p, %d, %d, %p, %ld)\n", | ||||
__func__, dev, child, type, rid, (void *)(intptr_t)start, count); | __func__, dev, child, type, rid, (void *)(intptr_t)start, count); | ||||
rle = resource_list_add(rl, type, rid, start, start + count - 1, | rle = resource_list_add(rl, type, rid, start, start + count - 1, | ||||
count); | count); | ||||
if (rle == NULL) | if (rle == NULL) | ||||
return (ENXIO); | return (ENXIO); | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
nexus_get_resource(device_t dev, device_t child, int type, int rid, | nexus_get_resource(device_t dev, device_t child, int type, int rid, | ||||
u_long *startp, u_long *countp) | rman_res_t *startp, rman_res_t *countp) | ||||
{ | { | ||||
struct nexus_device *ndev = DEVTONX(child); | struct nexus_device *ndev = DEVTONX(child); | ||||
struct resource_list *rl = &ndev->nx_resources; | struct resource_list *rl = &ndev->nx_resources; | ||||
struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
rle = resource_list_find(rl, type, rid); | rle = resource_list_find(rl, type, rid); | ||||
if (!rle) | if (!rle) | ||||
return(ENOENT); | return(ENOENT); | ||||
▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines |