Changeset View
Changeset View
Standalone View
Standalone View
head/sys/arm64/arm64/nexus.c
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | static int nexus_activate_resource(device_t, device_t, int, int, | ||||
struct resource *); | struct resource *); | ||||
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, | ||||
struct resource *); | struct resource *); | ||||
static int nexus_release_resource(device_t, device_t, int, int, | |||||
struct resource *); | |||||
static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, | static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, | ||||
int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); | int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); | ||||
static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); | static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); | ||||
static bus_space_tag_t nexus_get_bus_tag(device_t, device_t); | static bus_space_tag_t nexus_get_bus_tag(device_t, device_t); | ||||
#ifdef SMP | #ifdef SMP | ||||
static int nexus_bind_intr(device_t, device_t, struct resource *, int); | static int nexus_bind_intr(device_t, device_t, struct resource *, int); | ||||
#endif | #endif | ||||
#ifdef FDT | #ifdef FDT | ||||
static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, | static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, | ||||
int icells, pcell_t *intr); | int icells, pcell_t *intr); | ||||
#endif | #endif | ||||
static device_method_t nexus_methods[] = { | static device_method_t nexus_methods[] = { | ||||
/* 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_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_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), | ||||
DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), | DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), | ||||
#ifdef SMP | #ifdef SMP | ||||
DEVMETHOD(bus_bind_intr, nexus_bind_intr), | DEVMETHOD(bus_bind_intr, nexus_bind_intr), | ||||
#endif | #endif | ||||
{ 0, 0 } | { 0, 0 } | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 115 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_release_resource(device_t bus, device_t child, int type, int rid, | |||||
struct resource *res) | |||||
{ | |||||
int error; | |||||
if (rman_get_flags(res) & RF_ACTIVE) { | |||||
error = bus_deactivate_resource(child, type, rid, res); | |||||
if (error) | |||||
return (error); | |||||
} | |||||
return (rman_release_resource(res)); | |||||
} | } | ||||
static int | static int | ||||
nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, | nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, | ||||
enum intr_polarity pol) | enum intr_polarity pol) | ||||
{ | { | ||||
/* TODO: This is wrong, it's needed for ACPI */ | /* TODO: This is wrong, it's needed for ACPI */ | ||||
▲ Show 20 Lines • Show All 254 Lines • Show Last 20 Lines |