Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pccard/pccard.c
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
static void pccard_function_disable(struct pccard_function *pf); | static void pccard_function_disable(struct pccard_function *pf); | ||||
static int pccard_probe(device_t dev); | static int pccard_probe(device_t dev); | ||||
static int pccard_attach(device_t dev); | static int pccard_attach(device_t dev); | ||||
static int pccard_detach(device_t dev); | static int pccard_detach(device_t dev); | ||||
static void pccard_print_resources(struct resource_list *rl, | static void pccard_print_resources(struct resource_list *rl, | ||||
const char *name, int type, int count, const char *format); | const char *name, int type, int count, const char *format); | ||||
static int pccard_print_child(device_t dev, device_t child); | static int pccard_print_child(device_t dev, device_t child); | ||||
static int pccard_set_resource(device_t dev, device_t child, int type, | static int pccard_set_resource(device_t dev, device_t child, int type, | ||||
int rid, u_long start, u_long count); | int rid, rman_res_t start, rman_res_t count); | ||||
static int pccard_get_resource(device_t dev, device_t child, int type, | static int pccard_get_resource(device_t dev, device_t child, int type, | ||||
int rid, u_long *startp, u_long *countp); | int rid, rman_res_t *startp, rman_res_t *countp); | ||||
static void pccard_delete_resource(device_t dev, device_t child, int type, | static void pccard_delete_resource(device_t dev, device_t child, int type, | ||||
int rid); | int rid); | ||||
static int pccard_set_res_flags(device_t dev, device_t child, int type, | static int pccard_set_res_flags(device_t dev, device_t child, int type, | ||||
int rid, u_long flags); | int rid, u_long flags); | ||||
static int pccard_set_memory_offset(device_t dev, device_t child, int rid, | static int pccard_set_memory_offset(device_t dev, device_t child, int rid, | ||||
uint32_t offset, uint32_t *deltap); | uint32_t offset, uint32_t *deltap); | ||||
static int pccard_probe_and_attach_child(device_t dev, device_t child, | static int pccard_probe_and_attach_child(device_t dev, device_t child, | ||||
struct pccard_function *pf); | struct pccard_function *pf); | ||||
static void pccard_probe_nomatch(device_t cbdev, device_t child); | static void pccard_probe_nomatch(device_t cbdev, device_t child); | ||||
static int pccard_read_ivar(device_t bus, device_t child, int which, | static int pccard_read_ivar(device_t bus, device_t child, int which, | ||||
uintptr_t *result); | uintptr_t *result); | ||||
static void pccard_driver_added(device_t dev, driver_t *driver); | static void pccard_driver_added(device_t dev, driver_t *driver); | ||||
static struct resource *pccard_alloc_resource(device_t dev, | static struct resource *pccard_alloc_resource(device_t dev, | ||||
device_t child, int type, int *rid, u_long start, | device_t child, int type, int *rid, rman_res_t start, | ||||
u_long end, u_long count, u_int flags); | rman_res_t end, rman_res_t count, u_int flags); | ||||
static int pccard_release_resource(device_t dev, device_t child, int type, | static int pccard_release_resource(device_t dev, device_t child, int type, | ||||
int rid, struct resource *r); | int rid, struct resource *r); | ||||
static void pccard_child_detached(device_t parent, device_t dev); | static void pccard_child_detached(device_t parent, device_t dev); | ||||
static int pccard_filter(void *arg); | static int pccard_filter(void *arg); | ||||
static void pccard_intr(void *arg); | static void pccard_intr(void *arg); | ||||
static int pccard_setup_intr(device_t dev, device_t child, | static int pccard_setup_intr(device_t dev, device_t child, | ||||
struct resource *irq, int flags, driver_filter_t *filt, | struct resource *irq, 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 343 Lines • ▼ Show 20 Lines | pccard_function_init(struct pccard_function *pf, int entry) | ||||
struct pccard_config_entry *cfe; | struct pccard_config_entry *cfe; | ||||
struct pccard_ivar *devi = PCCARD_IVAR(pf->dev); | struct pccard_ivar *devi = PCCARD_IVAR(pf->dev); | ||||
struct resource_list *rl = &devi->resources; | struct resource_list *rl = &devi->resources; | ||||
struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
struct resource *r = 0; | struct resource *r = 0; | ||||
struct pccard_ce_iospace *ios; | struct pccard_ce_iospace *ios; | ||||
struct pccard_ce_memspace *mems; | struct pccard_ce_memspace *mems; | ||||
device_t bus; | device_t bus; | ||||
u_long start, end, len; | rman_res_t start, end, len; | ||||
int i, rid, spaces; | int i, rid, spaces; | ||||
if (pf->pf_flags & PFF_ENABLED) { | if (pf->pf_flags & PFF_ENABLED) { | ||||
printf("pccard_function_init: function is enabled"); | printf("pccard_function_init: function is enabled"); | ||||
return; | return; | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | if (rle->res) { | ||||
pf->sc->dev, rle->type, rle->rid, rle->res); | pf->sc->dev, rle->type, rle->rid, rle->res); | ||||
rle->res = NULL; | rle->res = NULL; | ||||
} | } | ||||
} | } | ||||
resource_list_free(&devi->resources); | resource_list_free(&devi->resources); | ||||
} | } | ||||
static void | static void | ||||
pccard_mfc_adjust_iobase(struct pccard_function *pf, bus_addr_t addr, | pccard_mfc_adjust_iobase(struct pccard_function *pf, rman_res_t addr, | ||||
bus_addr_t offset, bus_size_t size) | rman_res_t offset, rman_res_t size) | ||||
{ | { | ||||
bus_size_t iosize, tmp; | bus_size_t iosize, tmp; | ||||
if (addr != 0) { | if (addr != 0) { | ||||
if (pf->pf_mfc_iomax == 0) { | if (pf->pf_mfc_iomax == 0) { | ||||
pf->pf_mfc_iobase = addr + offset; | pf->pf_mfc_iobase = addr + offset; | ||||
pf->pf_mfc_iomax = pf->pf_mfc_iobase + size; | pf->pf_mfc_iomax = pf->pf_mfc_iobase + size; | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | pccard_print_child(device_t dev, device_t child) | ||||
retval += bus_print_child_footer(dev, child); | retval += bus_print_child_footer(dev, child); | ||||
return (retval); | return (retval); | ||||
} | } | ||||
static int | static int | ||||
pccard_set_resource(device_t dev, device_t child, int type, int rid, | pccard_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 pccard_ivar *devi = PCCARD_IVAR(child); | struct pccard_ivar *devi = PCCARD_IVAR(child); | ||||
struct resource_list *rl = &devi->resources; | struct resource_list *rl = &devi->resources; | ||||
if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY | if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY | ||||
&& type != SYS_RES_IRQ && type != SYS_RES_DRQ) | && type != SYS_RES_IRQ && type != SYS_RES_DRQ) | ||||
return (EINVAL); | return (EINVAL); | ||||
if (rid < 0) | if (rid < 0) | ||||
Show All 12 Lines | if (NULL != resource_list_alloc(rl, device_get_parent(dev), dev, | ||||
type, &rid, start, start + count - 1, count, 0)) | type, &rid, start, start + count - 1, count, 0)) | ||||
return 0; | return 0; | ||||
else | else | ||||
return ENOMEM; | return ENOMEM; | ||||
} | } | ||||
static int | static int | ||||
pccard_get_resource(device_t dev, device_t child, int type, int rid, | pccard_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 pccard_ivar *devi = PCCARD_IVAR(child); | struct pccard_ivar *devi = PCCARD_IVAR(child); | ||||
struct resource_list *rl = &devi->resources; | struct resource_list *rl = &devi->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 == NULL) | if (rle == NULL) | ||||
return (ENOENT); | return (ENOENT); | ||||
▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | if (device_get_state(child) != DS_NOTPRESENT) | ||||
continue; | continue; | ||||
pccard_probe_and_attach_child(dev, child, pf); | pccard_probe_and_attach_child(dev, child, pf); | ||||
} | } | ||||
return; | return; | ||||
} | } | ||||
static struct resource * | static struct resource * | ||||
pccard_alloc_resource(device_t dev, device_t child, int type, int *rid, | pccard_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 pccard_ivar *dinfo; | struct pccard_ivar *dinfo; | ||||
struct resource_list_entry *rle = 0; | struct resource_list_entry *rle = 0; | ||||
int passthrough = (device_get_parent(child) != dev); | int passthrough = (device_get_parent(child) != dev); | ||||
int isdefault = (start == 0 && end == ~0UL && count == 1); | int isdefault = (start == 0 && end == ~0UL && count == 1); | ||||
struct resource *r = NULL; | struct resource *r = NULL; | ||||
/* XXX I'm no longer sure this is right */ | /* XXX I'm no longer sure this is right */ | ||||
▲ Show 20 Lines • Show All 350 Lines • Show Last 20 Lines |