Lines Matching +full:ref +full:-

27 #include <xen/xen-os.h>
68 int ref, error; in get_free_entries() local
73 ((error = gnttab_expand(count - gnttab_free_count)) != 0)) { in get_free_entries()
77 ref = head = gnttab_free_head; in get_free_entries()
78 gnttab_free_count -= count; in get_free_entries()
79 while (count-- > 1) in get_free_entries()
85 *entries = ref; in get_free_entries()
98 next = callback->next; in do_free_callbacks()
99 if (gnttab_free_count >= callback->count) { in do_free_callbacks()
100 callback->next = NULL; in do_free_callbacks()
101 callback->fn(callback->arg); in do_free_callbacks()
103 callback->next = gnttab_free_callback_list; in do_free_callbacks()
118 put_free_entry(grant_ref_t ref) in put_free_entry() argument
122 gnttab_entry(ref) = gnttab_free_head; in put_free_entry()
123 gnttab_free_head = ref; in put_free_entry()
130 * Public grant-issuing interface functions
137 int error, ref; in gnttab_grant_foreign_access() local
139 error = get_free_entries(1, &ref); in gnttab_grant_foreign_access()
144 shared[ref].frame = frame; in gnttab_grant_foreign_access()
145 shared[ref].domid = domid; in gnttab_grant_foreign_access()
147 shared[ref].flags = GTF_permit_access | (readonly ? GTF_readonly : 0); in gnttab_grant_foreign_access()
150 *result = ref; in gnttab_grant_foreign_access()
156 gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, in gnttab_grant_foreign_access_ref() argument
160 shared[ref].frame = frame; in gnttab_grant_foreign_access_ref()
161 shared[ref].domid = domid; in gnttab_grant_foreign_access_ref()
163 shared[ref].flags = GTF_permit_access | (readonly ? GTF_readonly : 0); in gnttab_grant_foreign_access_ref()
167 gnttab_query_foreign_access(grant_ref_t ref) in gnttab_query_foreign_access() argument
171 nflags = shared[ref].flags; in gnttab_query_foreign_access()
177 gnttab_end_foreign_access_ref(grant_ref_t ref) in gnttab_end_foreign_access_ref() argument
181 while (!((flags = atomic_load_16(&shared[ref].flags)) & in gnttab_end_foreign_access_ref()
183 if (atomic_cmpset_16(&shared[ref].flags, flags, 0)) in gnttab_end_foreign_access_ref()
191 gnttab_end_foreign_access(grant_ref_t ref, void *page) in gnttab_end_foreign_access() argument
193 if (gnttab_end_foreign_access_ref(ref)) { in gnttab_end_foreign_access()
194 put_free_entry(ref); in gnttab_end_foreign_access()
200 /* XXX This needs to be fixed so that the ref and page are in gnttab_end_foreign_access()
223 * XXX This needs to be fixed so that the ref in gnttab_end_foreign_access_references()
228 count--; in gnttab_end_foreign_access_references()
247 int error, ref; in gnttab_grant_foreign_transfer() local
249 error = get_free_entries(1, &ref); in gnttab_grant_foreign_transfer()
253 gnttab_grant_foreign_transfer_ref(ref, domid, pfn); in gnttab_grant_foreign_transfer()
255 *result = ref; in gnttab_grant_foreign_transfer()
260 gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid, in gnttab_grant_foreign_transfer_ref() argument
263 shared[ref].frame = pfn; in gnttab_grant_foreign_transfer_ref()
264 shared[ref].domid = domid; in gnttab_grant_foreign_transfer_ref()
266 shared[ref].flags = GTF_accept_transfer; in gnttab_grant_foreign_transfer_ref()
270 gnttab_end_foreign_transfer_ref(grant_ref_t ref) in gnttab_end_foreign_transfer_ref() argument
284 while (!((flags = atomic_load_16(&shared[ref].flags)) & in gnttab_end_foreign_transfer_ref()
286 if (atomic_cmpset_16(&shared[ref].flags, flags, 0)) in gnttab_end_foreign_transfer_ref()
292 flags = atomic_load_16(&shared[ref].flags); in gnttab_end_foreign_transfer_ref()
297 frame = shared[ref].frame; in gnttab_end_foreign_transfer_ref()
304 gnttab_end_foreign_transfer(grant_ref_t ref) in gnttab_end_foreign_transfer() argument
306 unsigned long frame = gnttab_end_foreign_transfer_ref(ref); in gnttab_end_foreign_transfer()
308 put_free_entry(ref); in gnttab_end_foreign_transfer()
313 gnttab_free_grant_reference(grant_ref_t ref) in gnttab_free_grant_reference() argument
316 put_free_entry(ref); in gnttab_free_grant_reference()
322 grant_ref_t ref; in gnttab_free_grant_references() local
328 ref = head; in gnttab_free_grant_references()
329 while (gnttab_entry(ref) != GNTTAB_LIST_END) { in gnttab_free_grant_references()
330 ref = gnttab_entry(ref); in gnttab_free_grant_references()
334 gnttab_entry(ref) = gnttab_free_head; in gnttab_free_grant_references()
344 int ref, error; in gnttab_alloc_grant_references() local
346 error = get_free_entries(count, &ref); in gnttab_alloc_grant_references()
350 *head = ref; in gnttab_alloc_grant_references()
386 if (callback->next) in gnttab_request_free_callback()
388 callback->fn = fn; in gnttab_request_free_callback()
389 callback->arg = arg; in gnttab_request_free_callback()
390 callback->count = count; in gnttab_request_free_callback()
391 callback->next = gnttab_free_callback_list; in gnttab_request_free_callback()
405 for (pcb = &gnttab_free_callback_list; *pcb; pcb = &(*pcb)->next) { in gnttab_cancel_free_callback()
407 *pcb = callback->next; in gnttab_cancel_free_callback()
432 i < GREFS_PER_GRANT_FRAME * new_nr_grant_frames - 1; i++) in grow_gnttab_list()
446 for ( ; i >= nr_grant_frames; i--) in grow_gnttab_list()
518 } while (i-- > start_idx); in gnttab_map()
542 gnttab_map(0, nr_gframes - 1); in gnttab_resume()
557 gnttab_map(cur, cur + extra - 1); in gnttab_expand()
564 /*------------------ Private Device Attachment Functions --------------------*/
576 ("Trying to attach grant-table device on non Xen domain")); in granttable_identify()
581 if (BUS_ADD_CHILD(parent, 0, driver->name, 0) == NULL) in granttable_identify()
582 panic("unable to attach Xen Grant-table device"); in granttable_identify()
586 * \brief Probe for the existence of the Xen Grant-table device
596 device_set_desc(dev, "Xen Grant-table Device"); in granttable_probe()
601 * \brief Attach the Xen Grant-table device.
635 for (i = NR_RESERVED_ENTRIES; i < nr_init_grefs - 1; i++) in granttable_attach()
638 gnttab_entry(nr_init_grefs - 1) = GNTTAB_LIST_END; in granttable_attach()
639 gnttab_free_count = nr_init_grefs - NR_RESERVED_ENTRIES; in granttable_attach()
648 for (i--; i >= 0; i--) in granttable_attach()
654 /*-------------------- Private Device Attachment Data -----------------------*/