Lines Matching refs:resource
48 static struct vme_bridge *find_bridge(struct vme_resource *resource) in find_bridge() argument
51 switch (resource->type) { in find_bridge()
53 return list_entry(resource->entry, struct vme_master_resource, in find_bridge()
56 return list_entry(resource->entry, struct vme_slave_resource, in find_bridge()
59 return list_entry(resource->entry, struct vme_dma_resource, in find_bridge()
62 return list_entry(resource->entry, struct vme_lm_resource, in find_bridge()
81 void *vme_alloc_consistent(struct vme_resource *resource, size_t size, in vme_alloc_consistent() argument
86 if (!resource) { in vme_alloc_consistent()
91 bridge = find_bridge(resource); in vme_alloc_consistent()
121 void vme_free_consistent(struct vme_resource *resource, size_t size, in vme_free_consistent() argument
126 if (!resource) { in vme_free_consistent()
131 bridge = find_bridge(resource); in vme_free_consistent()
162 size_t vme_get_size(struct vme_resource *resource) in vme_get_size() argument
169 switch (resource->type) { in vme_get_size()
171 retval = vme_master_get(resource, &enabled, &base, &size, in vme_get_size()
178 retval = vme_slave_get(resource, &enabled, &base, &size, in vme_get_size()
288 struct vme_resource *resource = NULL; in vme_slave_request() local
324 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_slave_request()
325 if (!resource) in vme_slave_request()
328 resource->type = VME_SLAVE; in vme_slave_request()
329 resource->entry = &allocated_image->list; in vme_slave_request()
331 return resource; in vme_slave_request()
361 int vme_slave_set(struct vme_resource *resource, int enabled, in vme_slave_set() argument
365 struct vme_bridge *bridge = find_bridge(resource); in vme_slave_set()
369 if (resource->type != VME_SLAVE) { in vme_slave_set()
374 image = list_entry(resource->entry, struct vme_slave_resource, list); in vme_slave_set()
411 int vme_slave_get(struct vme_resource *resource, int *enabled, in vme_slave_get() argument
415 struct vme_bridge *bridge = find_bridge(resource); in vme_slave_get()
418 if (resource->type != VME_SLAVE) { in vme_slave_get()
423 image = list_entry(resource->entry, struct vme_slave_resource, list); in vme_slave_get()
441 void vme_slave_free(struct vme_resource *resource) in vme_slave_free() argument
445 if (resource->type != VME_SLAVE) { in vme_slave_free()
450 slave_image = list_entry(resource->entry, struct vme_slave_resource, in vme_slave_free()
466 kfree(resource); in vme_slave_free()
489 struct vme_resource *resource = NULL; in vme_master_request() local
528 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_master_request()
529 if (!resource) in vme_master_request()
532 resource->type = VME_MASTER; in vme_master_request()
533 resource->entry = &allocated_image->list; in vme_master_request()
535 return resource; in vme_master_request()
565 int vme_master_set(struct vme_resource *resource, int enabled, in vme_master_set() argument
569 struct vme_bridge *bridge = find_bridge(resource); in vme_master_set()
573 if (resource->type != VME_MASTER) { in vme_master_set()
578 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_set()
616 int vme_master_get(struct vme_resource *resource, int *enabled, in vme_master_get() argument
620 struct vme_bridge *bridge = find_bridge(resource); in vme_master_get()
623 if (resource->type != VME_MASTER) { in vme_master_get()
628 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_get()
655 ssize_t vme_master_read(struct vme_resource *resource, void *buf, size_t count, in vme_master_read() argument
658 struct vme_bridge *bridge = find_bridge(resource); in vme_master_read()
667 if (resource->type != VME_MASTER) { in vme_master_read()
672 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_read()
674 length = vme_get_size(resource); in vme_master_read()
704 ssize_t vme_master_write(struct vme_resource *resource, void *buf, in vme_master_write() argument
707 struct vme_bridge *bridge = find_bridge(resource); in vme_master_write()
716 if (resource->type != VME_MASTER) { in vme_master_write()
721 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_write()
723 length = vme_get_size(resource); in vme_master_write()
756 unsigned int vme_master_rmw(struct vme_resource *resource, unsigned int mask, in vme_master_rmw() argument
759 struct vme_bridge *bridge = find_bridge(resource); in vme_master_rmw()
767 if (resource->type != VME_MASTER) { in vme_master_rmw()
772 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_rmw()
789 int vme_master_mmap(struct vme_resource *resource, struct vm_area_struct *vma) in vme_master_mmap() argument
795 if (resource->type != VME_MASTER) { in vme_master_mmap()
800 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_mmap()
821 void vme_master_free(struct vme_resource *resource) in vme_master_free() argument
825 if (resource->type != VME_MASTER) { in vme_master_free()
830 master_image = list_entry(resource->entry, struct vme_master_resource, in vme_master_free()
846 kfree(resource); in vme_master_free()
866 struct vme_resource *resource = NULL; in vme_dma_request() local
903 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_dma_request()
904 if (!resource) in vme_dma_request()
907 resource->type = VME_DMA; in vme_dma_request()
908 resource->entry = &allocated_ctrlr->list; in vme_dma_request()
910 return resource; in vme_dma_request()
933 struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource) in vme_new_dma_list() argument
937 if (resource->type != VME_DMA) { in vme_new_dma_list()
947 dma_list->parent = list_entry(resource->entry, in vme_new_dma_list()
1213 int vme_dma_free(struct vme_resource *resource) in vme_dma_free() argument
1217 if (resource->type != VME_DMA) { in vme_dma_free()
1222 ctrlr = list_entry(resource->entry, struct vme_dma_resource, list); in vme_dma_free()
1239 kfree(resource); in vme_dma_free()
1471 struct vme_resource *resource = NULL; in vme_lm_request() local
1503 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_lm_request()
1504 if (!resource) in vme_lm_request()
1507 resource->type = VME_LM; in vme_lm_request()
1508 resource->entry = &allocated_lm->list; in vme_lm_request()
1510 return resource; in vme_lm_request()
1534 int vme_lm_count(struct vme_resource *resource) in vme_lm_count() argument
1538 if (resource->type != VME_LM) { in vme_lm_count()
1543 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_count()
1563 int vme_lm_set(struct vme_resource *resource, unsigned long long lm_base, in vme_lm_set() argument
1566 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_set()
1569 if (resource->type != VME_LM) { in vme_lm_set()
1574 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_set()
1599 int vme_lm_get(struct vme_resource *resource, unsigned long long *lm_base, in vme_lm_get() argument
1602 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_get()
1605 if (resource->type != VME_LM) { in vme_lm_get()
1610 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_get()
1636 int vme_lm_attach(struct vme_resource *resource, int monitor, in vme_lm_attach() argument
1639 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_attach()
1642 if (resource->type != VME_LM) { in vme_lm_attach()
1647 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_attach()
1670 int vme_lm_detach(struct vme_resource *resource, int monitor) in vme_lm_detach() argument
1672 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_detach()
1675 if (resource->type != VME_LM) { in vme_lm_detach()
1680 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_detach()
1703 void vme_lm_free(struct vme_resource *resource) in vme_lm_free() argument
1707 if (resource->type != VME_LM) { in vme_lm_free()
1712 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_free()
1725 kfree(resource); in vme_lm_free()