Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pccbb/pccbb.c
| Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | |||||
| static int cbb_cardbus_activate_resource(device_t brdev, device_t child, | static int cbb_cardbus_activate_resource(device_t brdev, device_t child, | ||||
| struct resource *res); | struct resource *res); | ||||
| static int cbb_cardbus_deactivate_resource(device_t brdev, | static int cbb_cardbus_deactivate_resource(device_t brdev, | ||||
| device_t child, struct resource *res); | device_t child, struct resource *res); | ||||
| static struct resource *cbb_cardbus_alloc_resource(device_t brdev, | static struct resource *cbb_cardbus_alloc_resource(device_t brdev, | ||||
| device_t child, int type, int *rid, rman_res_t start, | device_t child, int type, int *rid, rman_res_t start, | ||||
| rman_res_t end, rman_res_t count, u_int flags); | rman_res_t end, rman_res_t count, u_int flags); | ||||
| static int cbb_cardbus_release_resource(device_t brdev, device_t child, | static int cbb_cardbus_release_resource(device_t brdev, device_t child, | ||||
| int type, int rid, struct resource *res); | struct resource *res); | ||||
| static int cbb_cardbus_power_enable_socket(device_t brdev, | static int cbb_cardbus_power_enable_socket(device_t brdev, | ||||
| device_t child); | device_t child); | ||||
| static int cbb_cardbus_power_disable_socket(device_t brdev, | static int cbb_cardbus_power_disable_socket(device_t brdev, | ||||
| device_t child); | device_t child); | ||||
| static int cbb_func_filt(void *arg); | static int cbb_func_filt(void *arg); | ||||
| static void cbb_func_intr(void *arg); | static void cbb_func_intr(void *arg); | ||||
| static void | static void | ||||
| ▲ Show 20 Lines • Show All 1,084 Lines • ▼ Show 20 Lines | if (bus_activate_resource(child, type, *rid, res) != 0) { | ||||
| bus_release_resource(child, type, *rid, res); | bus_release_resource(child, type, *rid, res); | ||||
| return (NULL); | return (NULL); | ||||
| } | } | ||||
| return (res); | return (res); | ||||
| } | } | ||||
| static int | static int | ||||
| cbb_cardbus_release_resource(device_t brdev, device_t child, int type, | cbb_cardbus_release_resource(device_t brdev, device_t child, | ||||
| int rid, struct resource *res) | struct resource *res) | ||||
| { | { | ||||
| struct cbb_softc *sc = device_get_softc(brdev); | struct cbb_softc *sc = device_get_softc(brdev); | ||||
| int error; | int error; | ||||
| if (rman_get_flags(res) & RF_ACTIVE) { | if (rman_get_flags(res) & RF_ACTIVE) { | ||||
| error = bus_deactivate_resource(child, type, rid, res); | error = bus_deactivate_resource(child, res); | ||||
| if (error != 0) | if (error != 0) | ||||
| return (error); | return (error); | ||||
| } | } | ||||
| cbb_remove_res(sc, res); | cbb_remove_res(sc, res); | ||||
| return (BUS_RELEASE_RESOURCE(device_get_parent(brdev), child, | return (BUS_RELEASE_RESOURCE(device_get_parent(brdev), child, | ||||
| type, rid, res)); | res)); | ||||
| } | } | ||||
| /************************************************************************/ | /************************************************************************/ | ||||
| /* PC Card Power Functions */ | /* PC Card Power Functions */ | ||||
| /************************************************************************/ | /************************************************************************/ | ||||
| static int | static int | ||||
| cbb_pcic_power_enable_socket(device_t brdev, device_t child) | cbb_pcic_power_enable_socket(device_t brdev, device_t child) | ||||
| ▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | if (bus_activate_resource(child, type, *rid, res) != 0) { | ||||
| return (NULL); | return (NULL); | ||||
| } | } | ||||
| } | } | ||||
| return (res); | return (res); | ||||
| } | } | ||||
| static int | static int | ||||
| cbb_pcic_release_resource(device_t brdev, device_t child, int type, | cbb_pcic_release_resource(device_t brdev, device_t child, | ||||
| int rid, struct resource *res) | struct resource *res) | ||||
| { | { | ||||
| struct cbb_softc *sc = device_get_softc(brdev); | struct cbb_softc *sc = device_get_softc(brdev); | ||||
| int error; | int error; | ||||
| if (rman_get_flags(res) & RF_ACTIVE) { | if (rman_get_flags(res) & RF_ACTIVE) { | ||||
| error = bus_deactivate_resource(child, type, rid, res); | error = bus_deactivate_resource(child, res); | ||||
| if (error != 0) | if (error != 0) | ||||
| return (error); | return (error); | ||||
| } | } | ||||
| cbb_remove_res(sc, res); | cbb_remove_res(sc, res); | ||||
| return (BUS_RELEASE_RESOURCE(device_get_parent(brdev), child, | return (BUS_RELEASE_RESOURCE(device_get_parent(brdev), child, | ||||
| type, rid, res)); | res)); | ||||
| } | } | ||||
| /************************************************************************/ | /************************************************************************/ | ||||
| /* PC Card methods */ | /* PC Card methods */ | ||||
| /************************************************************************/ | /************************************************************************/ | ||||
| int | int | ||||
| cbb_pcic_set_res_flags(device_t brdev, device_t child, int type, int rid, | cbb_pcic_set_res_flags(device_t brdev, device_t child, int type, int rid, | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | if (sc->flags & CBB_16BIT_CARD) | ||||
| return (cbb_pcic_alloc_resource(brdev, child, type, rid, | return (cbb_pcic_alloc_resource(brdev, child, type, rid, | ||||
| start, end, count, flags)); | start, end, count, flags)); | ||||
| else | else | ||||
| return (cbb_cardbus_alloc_resource(brdev, child, type, rid, | return (cbb_cardbus_alloc_resource(brdev, child, type, rid, | ||||
| start, end, count, flags)); | start, end, count, flags)); | ||||
| } | } | ||||
| int | int | ||||
| cbb_release_resource(device_t brdev, device_t child, int type, int rid, | cbb_release_resource(device_t brdev, device_t child, struct resource *r) | ||||
| struct resource *r) | |||||
| { | { | ||||
| struct cbb_softc *sc = device_get_softc(brdev); | struct cbb_softc *sc = device_get_softc(brdev); | ||||
| if (sc->flags & CBB_16BIT_CARD) | if (sc->flags & CBB_16BIT_CARD) | ||||
| return (cbb_pcic_release_resource(brdev, child, type, | return (cbb_pcic_release_resource(brdev, child, r)); | ||||
| rid, r)); | |||||
| else | else | ||||
| return (cbb_cardbus_release_resource(brdev, child, type, | return (cbb_cardbus_release_resource(brdev, child, r)); | ||||
| rid, r)); | |||||
| } | } | ||||
| int | int | ||||
| cbb_read_ivar(device_t brdev, device_t child, int which, uintptr_t *result) | cbb_read_ivar(device_t brdev, device_t child, int which, uintptr_t *result) | ||||
| { | { | ||||
| struct cbb_softc *sc = device_get_softc(brdev); | struct cbb_softc *sc = device_get_softc(brdev); | ||||
| switch (which) { | switch (which) { | ||||
| Show All 37 Lines | |||||