Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/puc/puc.c
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | |||||
SYSCTL_NODE(_hw, OID_AUTO, puc, CTLFLAG_RD, 0, "puc(9) driver configuration"); | SYSCTL_NODE(_hw, OID_AUTO, puc, CTLFLAG_RD, 0, "puc(9) driver configuration"); | ||||
struct puc_bar * | struct puc_bar * | ||||
puc_get_bar(struct puc_softc *sc, int rid) | puc_get_bar(struct puc_softc *sc, int rid) | ||||
{ | { | ||||
struct puc_bar *bar; | struct puc_bar *bar; | ||||
struct rman *rm; | struct rman *rm; | ||||
u_long end, start; | rman_res_t end, start; | ||||
int error, i; | int error, i; | ||||
/* Find the BAR entry with the given RID. */ | /* Find the BAR entry with the given RID. */ | ||||
i = 0; | i = 0; | ||||
while (i < PUC_PCI_BARS && sc->sc_bar[i].b_rid != rid) | while (i < PUC_PCI_BARS && sc->sc_bar[i].b_rid != rid) | ||||
i++; | i++; | ||||
if (i < PUC_PCI_BARS) | if (i < PUC_PCI_BARS) | ||||
return (&sc->sc_bar[i]); | return (&sc->sc_bar[i]); | ||||
▲ Show 20 Lines • Show All 379 Lines • ▼ Show 20 Lines | if (error) | ||||
return (error); | return (error); | ||||
if (res != 0) | if (res != 0) | ||||
device_set_desc(dev, (const char *)res); | device_set_desc(dev, (const char *)res); | ||||
return (BUS_PROBE_DEFAULT); | return (BUS_PROBE_DEFAULT); | ||||
} | } | ||||
struct resource * | struct resource * | ||||
puc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, | puc_bus_alloc_resource(device_t dev, 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 puc_port *port; | struct puc_port *port; | ||||
struct resource *res; | struct resource *res; | ||||
device_t assigned, originator; | device_t assigned, originator; | ||||
int error; | int error; | ||||
/* Get our immediate child. */ | /* Get our immediate child. */ | ||||
originator = child; | originator = child; | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | puc_bus_release_resource(device_t dev, device_t child, int type, int rid, | ||||
if (rman_get_flags(res) & RF_ACTIVE) | if (rman_get_flags(res) & RF_ACTIVE) | ||||
rman_deactivate_resource(res); | rman_deactivate_resource(res); | ||||
rman_set_device(res, NULL); | rman_set_device(res, NULL); | ||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
puc_bus_get_resource(device_t dev, device_t child, int type, int rid, | puc_bus_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 puc_port *port; | struct puc_port *port; | ||||
struct resource *res; | struct resource *res; | ||||
u_long start; | rman_res_t start; | ||||
/* Get our immediate child. */ | /* Get our immediate child. */ | ||||
while (child != NULL && device_get_parent(child) != dev) | while (child != NULL && device_get_parent(child) != dev) | ||||
child = device_get_parent(child); | child = device_get_parent(child); | ||||
if (child == NULL) | if (child == NULL) | ||||
return (EINVAL); | return (EINVAL); | ||||
port = device_get_ivars(child); | port = device_get_ivars(child); | ||||
▲ Show 20 Lines • Show All 186 Lines • Show Last 20 Lines |