Changeset View
Changeset View
Standalone View
Standalone View
sys/riscv/riscv/nexus.c
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | |||||
static int nexus_attach(device_t); | static int nexus_attach(device_t); | ||||
static int nexus_print_child(device_t, device_t); | static int nexus_print_child(device_t, device_t); | ||||
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 struct resource *nexus_alloc_resource(device_t, device_t, int, int *, | static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, | ||||
rman_res_t, rman_res_t, rman_res_t, u_int); | rman_res_t, rman_res_t, rman_res_t, u_int); | ||||
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_adjust_resource(device_t, device_t, int, struct resource *, | |||||
rman_res_t, rman_res_t); | |||||
static int nexus_map_resource(device_t, device_t, int, struct resource *, | static int nexus_map_resource(device_t, device_t, int, struct resource *, | ||||
struct resource_map_request *, struct resource_map *); | struct resource_map_request *, struct resource_map *); | ||||
static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, | static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, | ||||
enum intr_polarity pol); | enum intr_polarity pol); | ||||
static struct resource_list *nexus_get_reslist(device_t, device_t); | static struct resource_list *nexus_get_reslist(device_t, device_t); | ||||
static int nexus_set_resource(device_t, device_t, int, int, | static int nexus_set_resource(device_t, device_t, int, int, | ||||
rman_res_t, rman_res_t); | rman_res_t, rman_res_t); | ||||
static int nexus_deactivate_resource(device_t, device_t, int, int, | static int nexus_deactivate_resource(device_t, device_t, int, int, | ||||
Show All 17 Lines | static device_method_t nexus_methods[] = { | ||||
/* OFW interface */ | /* OFW interface */ | ||||
DEVMETHOD(ofw_bus_map_intr, nexus_ofw_map_intr), | DEVMETHOD(ofw_bus_map_intr, nexus_ofw_map_intr), | ||||
/* Bus interface */ | /* Bus interface */ | ||||
DEVMETHOD(bus_print_child, nexus_print_child), | DEVMETHOD(bus_print_child, nexus_print_child), | ||||
DEVMETHOD(bus_add_child, nexus_add_child), | DEVMETHOD(bus_add_child, nexus_add_child), | ||||
DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), | DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), | ||||
DEVMETHOD(bus_activate_resource, nexus_activate_resource), | DEVMETHOD(bus_activate_resource, nexus_activate_resource), | ||||
DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), | |||||
DEVMETHOD(bus_map_resource, nexus_map_resource), | DEVMETHOD(bus_map_resource, nexus_map_resource), | ||||
DEVMETHOD(bus_config_intr, nexus_config_intr), | DEVMETHOD(bus_config_intr, nexus_config_intr), | ||||
DEVMETHOD(bus_get_resource_list, nexus_get_reslist), | DEVMETHOD(bus_get_resource_list, nexus_get_reslist), | ||||
DEVMETHOD(bus_set_resource, nexus_set_resource), | DEVMETHOD(bus_set_resource, nexus_set_resource), | ||||
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), | DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), | ||||
DEVMETHOD(bus_release_resource, nexus_release_resource), | DEVMETHOD(bus_release_resource, nexus_release_resource), | ||||
DEVMETHOD(bus_setup_intr, nexus_setup_intr), | DEVMETHOD(bus_setup_intr, nexus_setup_intr), | ||||
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), | DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), | ||||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, | ||||
if (needactivate) { | if (needactivate) { | ||||
if (bus_activate_resource(child, type, *rid, rv)) { | if (bus_activate_resource(child, type, *rid, rv)) { | ||||
rman_release_resource(rv); | rman_release_resource(rv); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
} | } | ||||
return (rv); | return (rv); | ||||
} | |||||
static int | |||||
nexus_adjust_resource(device_t bus __unused, device_t child __unused, int type, | |||||
struct resource *r, rman_res_t start, rman_res_t end) | |||||
{ | |||||
struct rman *rm; | |||||
switch (type) { | |||||
case SYS_RES_IRQ: | |||||
rm = &irq_rman; | |||||
break; | |||||
case SYS_RES_MEMORY: | |||||
rm = &mem_rman; | |||||
break; | |||||
default: | |||||
return (EINVAL); | |||||
} | |||||
if (rman_is_region_manager(r, rm) == 0) | |||||
return (EINVAL); | |||||
return (rman_adjust_resource(r, start, end)); | |||||
} | } | ||||
static int | static int | ||||
nexus_release_resource(device_t bus, device_t child, int type, int rid, | nexus_release_resource(device_t bus, device_t child, int type, int rid, | ||||
struct resource *res) | struct resource *res) | ||||
{ | { | ||||
int error; | int error; | ||||
▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines |