Lines Matching full:resource
46 * Find the bridge that the resource is associated with.
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()
57 return list_entry(resource->entry, struct vme_slave_resource, in find_bridge()
61 return list_entry(resource->entry, struct vme_dma_resource, in find_bridge()
65 return list_entry(resource->entry, struct vme_lm_resource, in find_bridge()
69 printk(KERN_ERR "Unknown resource type\n"); in find_bridge()
77 * @resource: Pointer to VME resource.
86 void *vme_alloc_consistent(struct vme_resource *resource, size_t size, in vme_alloc_consistent() argument
91 if (!resource) { in vme_alloc_consistent()
92 printk(KERN_ERR "No resource\n"); in vme_alloc_consistent()
96 bridge = find_bridge(resource); in vme_alloc_consistent()
119 * @resource: Pointer to VME resource.
126 void vme_free_consistent(struct vme_resource *resource, size_t size, in vme_free_consistent() argument
131 if (!resource) { in vme_free_consistent()
132 printk(KERN_ERR "No resource\n"); in vme_free_consistent()
136 bridge = find_bridge(resource); in vme_free_consistent()
159 * @resource: Pointer to VME slave or master resource.
163 * depending on the type of window resource handed to it.
167 size_t vme_get_size(struct vme_resource *resource) in vme_get_size() argument
174 switch (resource->type) { in vme_get_size()
176 retval = vme_master_get(resource, &enabled, &base, &size, in vme_get_size()
184 retval = vme_slave_get(resource, &enabled, &base, &size, in vme_get_size()
195 printk(KERN_ERR "Unknown resource type\n"); in vme_get_size()
280 * vme_slave_request - Request a VME slave window resource.
285 * Request use of a VME window resource capable of being set for the requested
288 * Return: Pointer to VME resource on success, NULL on failure.
297 struct vme_resource *resource = NULL; in vme_slave_request() local
311 printk(KERN_ERR "Registered NULL Slave resource\n"); in vme_slave_request()
333 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_slave_request()
334 if (!resource) in vme_slave_request()
337 resource->type = VME_SLAVE; in vme_slave_request()
338 resource->entry = &allocated_image->list; in vme_slave_request()
340 return resource; in vme_slave_request()
355 * @resource: Pointer to VME slave resource.
366 * device, if an invalid resource has been provided or invalid
370 int vme_slave_set(struct vme_resource *resource, int enabled, in vme_slave_set() argument
374 struct vme_bridge *bridge = find_bridge(resource); in vme_slave_set()
378 if (resource->type != VME_SLAVE) { in vme_slave_set()
379 printk(KERN_ERR "Not a slave resource\n"); in vme_slave_set()
383 image = list_entry(resource->entry, struct vme_slave_resource, list); in vme_slave_set()
407 * @resource: Pointer to VME slave resource.
418 * device or if an invalid resource has been provided.
420 int vme_slave_get(struct vme_resource *resource, int *enabled, in vme_slave_get() argument
424 struct vme_bridge *bridge = find_bridge(resource); in vme_slave_get()
427 if (resource->type != VME_SLAVE) { in vme_slave_get()
428 printk(KERN_ERR "Not a slave resource\n"); in vme_slave_get()
432 image = list_entry(resource->entry, struct vme_slave_resource, list); in vme_slave_get()
446 * @resource: Pointer to VME slave resource.
448 * Free the provided slave resource so that it may be reallocated.
450 void vme_slave_free(struct vme_resource *resource) in vme_slave_free() argument
454 if (resource->type != VME_SLAVE) { in vme_slave_free()
455 printk(KERN_ERR "Not a slave resource\n"); in vme_slave_free()
459 slave_image = list_entry(resource->entry, struct vme_slave_resource, in vme_slave_free()
462 printk(KERN_ERR "Can't find slave resource\n"); in vme_slave_free()
474 /* Free up resource memory */ in vme_slave_free()
475 kfree(resource); in vme_slave_free()
480 * vme_master_request - Request a VME master window resource.
486 * Request use of a VME window resource capable of being set for the requested
489 * Return: Pointer to VME resource on success, NULL on failure.
498 struct vme_resource *resource = NULL; in vme_master_request() local
512 printk(KERN_WARNING "Registered NULL master resource\n"); in vme_master_request()
531 /* Check to see if we found a resource */ in vme_master_request()
533 printk(KERN_ERR "Can't find a suitable resource\n"); in vme_master_request()
537 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_master_request()
538 if (!resource) in vme_master_request()
541 resource->type = VME_MASTER; in vme_master_request()
542 resource->entry = &allocated_image->list; in vme_master_request()
544 return resource; in vme_master_request()
559 * @resource: Pointer to VME master resource.
570 * device, if an invalid resource has been provided or invalid
574 int vme_master_set(struct vme_resource *resource, int enabled, in vme_master_set() argument
578 struct vme_bridge *bridge = find_bridge(resource); in vme_master_set()
582 if (resource->type != VME_MASTER) { in vme_master_set()
583 printk(KERN_ERR "Not a master resource\n"); in vme_master_set()
587 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_set()
612 * @resource: Pointer to VME master resource.
623 * device or if an invalid resource has been provided.
625 int vme_master_get(struct vme_resource *resource, int *enabled, in vme_master_get() argument
629 struct vme_bridge *bridge = find_bridge(resource); in vme_master_get()
632 if (resource->type != VME_MASTER) { in vme_master_get()
633 printk(KERN_ERR "Not a master resource\n"); in vme_master_get()
637 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_get()
651 * @resource: Pointer to VME master resource.
659 * Return: Number of bytes read, -EINVAL if resource is not a VME master
660 * resource or read operation is not supported. -EFAULT returned if
664 ssize_t vme_master_read(struct vme_resource *resource, void *buf, size_t count, in vme_master_read() argument
667 struct vme_bridge *bridge = find_bridge(resource); in vme_master_read()
672 printk(KERN_WARNING "Reading from resource not supported\n"); in vme_master_read()
676 if (resource->type != VME_MASTER) { in vme_master_read()
677 printk(KERN_ERR "Not a master resource\n"); in vme_master_read()
681 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_read()
683 length = vme_get_size(resource); in vme_master_read()
700 * @resource: Pointer to VME master resource.
708 * Return: Number of bytes written, -EINVAL if resource is not a VME master
709 * resource or write operation is not supported. -EFAULT returned if
713 ssize_t vme_master_write(struct vme_resource *resource, void *buf, in vme_master_write() argument
716 struct vme_bridge *bridge = find_bridge(resource); in vme_master_write()
721 printk(KERN_WARNING "Writing to resource not supported\n"); in vme_master_write()
725 if (resource->type != VME_MASTER) { in vme_master_write()
726 printk(KERN_ERR "Not a master resource\n"); in vme_master_write()
730 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_write()
732 length = vme_get_size(resource); in vme_master_write()
748 * @resource: Pointer to VME master resource.
761 * Return: Bytes written on success, -EINVAL if resource is not a VME master
762 * resource or RMW operation is not supported. Hardware specific
765 unsigned int vme_master_rmw(struct vme_resource *resource, unsigned int mask, in vme_master_rmw() argument
768 struct vme_bridge *bridge = find_bridge(resource); in vme_master_rmw()
772 printk(KERN_WARNING "Writing to resource not supported\n"); in vme_master_rmw()
776 if (resource->type != VME_MASTER) { in vme_master_rmw()
777 printk(KERN_ERR "Not a master resource\n"); in vme_master_rmw()
781 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_rmw()
789 * @resource: Pointer to VME master resource.
794 * Return: Zero on success, -EINVAL if resource is not a VME master
795 * resource or -EFAULT if map exceeds window size. Other generic mmap
798 int vme_master_mmap(struct vme_resource *resource, struct vm_area_struct *vma) in vme_master_mmap() argument
804 if (resource->type != VME_MASTER) { in vme_master_mmap()
805 pr_err("Not a master resource\n"); in vme_master_mmap()
809 image = list_entry(resource->entry, struct vme_master_resource, list); in vme_master_mmap()
826 * @resource: Pointer to VME master resource.
828 * Free the provided master resource so that it may be reallocated.
830 void vme_master_free(struct vme_resource *resource) in vme_master_free() argument
834 if (resource->type != VME_MASTER) { in vme_master_free()
835 printk(KERN_ERR "Not a master resource\n"); in vme_master_free()
839 master_image = list_entry(resource->entry, struct vme_master_resource, in vme_master_free()
842 printk(KERN_ERR "Can't find master resource\n"); in vme_master_free()
854 /* Free up resource memory */ in vme_master_free()
855 kfree(resource); in vme_master_free()
867 * Return: Pointer to VME DMA resource on success, NULL on failure.
875 struct vme_resource *resource = NULL; in vme_dma_request() local
877 /* XXX Not checking resource attributes */ in vme_dma_request()
878 printk(KERN_ERR "No VME resource Attribute tests done\n"); in vme_dma_request()
891 printk(KERN_ERR "Registered NULL DMA resource\n"); in vme_dma_request()
908 /* Check to see if we found a resource */ in vme_dma_request()
912 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_dma_request()
913 if (!resource) in vme_dma_request()
916 resource->type = VME_DMA; in vme_dma_request()
917 resource->entry = &allocated_ctrlr->list; in vme_dma_request()
919 return resource; in vme_dma_request()
934 * @resource: Pointer to VME DMA resource.
940 * VME DMA resource.
942 struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource) in vme_new_dma_list() argument
946 if (resource->type != VME_DMA) { in vme_new_dma_list()
947 printk(KERN_ERR "Not a DMA resource\n"); in vme_new_dma_list()
956 dma_list->parent = list_entry(resource->entry, in vme_new_dma_list()
1178 * Return: Zero on success, -EINVAL on invalid VME resource, -EBUSY if resource
1214 * vme_dma_free - Free a VME DMA resource.
1215 * @resource: Pointer to VME DMA resource.
1217 * Free the provided DMA resource so that it may be reallocated.
1219 * Return: Zero on success, -EINVAL on invalid VME resource, -EBUSY if resource
1222 int vme_dma_free(struct vme_resource *resource) in vme_dma_free() argument
1226 if (resource->type != VME_DMA) { in vme_dma_free()
1227 printk(KERN_ERR "Not a DMA resource\n"); in vme_dma_free()
1231 ctrlr = list_entry(resource->entry, struct vme_dma_resource, list); in vme_dma_free()
1234 printk(KERN_ERR "Resource busy, can't free\n"); in vme_dma_free()
1239 printk(KERN_WARNING "Resource still processing transfers\n"); in vme_dma_free()
1248 kfree(resource); in vme_dma_free()
1468 * Allocate a location monitor resource to the driver. A location monitor
1472 * Return: Pointer to a VME resource on success or NULL on failure.
1480 struct vme_resource *resource = NULL; in vme_lm_request() local
1493 printk(KERN_ERR "Registered NULL Location Monitor resource\n"); in vme_lm_request()
1508 /* Check to see if we found a resource */ in vme_lm_request()
1512 resource = kmalloc(sizeof(*resource), GFP_KERNEL); in vme_lm_request()
1513 if (!resource) in vme_lm_request()
1516 resource->type = VME_LM; in vme_lm_request()
1517 resource->entry = &allocated_lm->list; in vme_lm_request()
1519 return resource; in vme_lm_request()
1534 * @resource: Pointer to VME location monitor resource.
1541 * invalid location monitor resource.
1543 int vme_lm_count(struct vme_resource *resource) in vme_lm_count() argument
1547 if (resource->type != VME_LM) { in vme_lm_count()
1548 printk(KERN_ERR "Not a Location Monitor resource\n"); in vme_lm_count()
1552 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_count()
1560 * @resource: Pointer to VME location monitor resource.
1569 * monitor resource or function is not supported. Hardware specific
1572 int vme_lm_set(struct vme_resource *resource, unsigned long long lm_base, in vme_lm_set() argument
1575 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_set()
1578 if (resource->type != VME_LM) { in vme_lm_set()
1579 printk(KERN_ERR "Not a Location Monitor resource\n"); in vme_lm_set()
1583 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_set()
1596 * @resource: Pointer to VME location monitor resource.
1605 * monitor resource or function is not supported. Hardware specific
1608 int vme_lm_get(struct vme_resource *resource, unsigned long long *lm_base, in vme_lm_get() argument
1611 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_get()
1614 if (resource->type != VME_LM) { in vme_lm_get()
1615 printk(KERN_ERR "Not a Location Monitor resource\n"); in vme_lm_get()
1619 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_get()
1632 * @resource: Pointer to VME location monitor resource.
1642 * monitor resource or function is not supported. Hardware specific
1645 int vme_lm_attach(struct vme_resource *resource, int monitor, in vme_lm_attach() argument
1648 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_attach()
1651 if (resource->type != VME_LM) { in vme_lm_attach()
1652 printk(KERN_ERR "Not a Location Monitor resource\n"); in vme_lm_attach()
1656 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_attach()
1669 * @resource: Pointer to VME location monitor resource.
1676 * monitor resource or function is not supported. Hardware specific
1679 int vme_lm_detach(struct vme_resource *resource, int monitor) in vme_lm_detach() argument
1681 struct vme_bridge *bridge = find_bridge(resource); in vme_lm_detach()
1684 if (resource->type != VME_LM) { in vme_lm_detach()
1685 printk(KERN_ERR "Not a Location Monitor resource\n"); in vme_lm_detach()
1689 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_detach()
1702 * @resource: Pointer to VME location monitor resource.
1710 * monitor resource.
1712 void vme_lm_free(struct vme_resource *resource) in vme_lm_free() argument
1716 if (resource->type != VME_LM) { in vme_lm_free()
1717 printk(KERN_ERR "Not a Location Monitor resource\n"); in vme_lm_free()
1721 lm = list_entry(resource->entry, struct vme_lm_resource, list); in vme_lm_free()
1734 kfree(resource); in vme_lm_free()