umem.h 1.2 KB

1234567891011121314151617181920212223242526
  1. #ifndef _PCIDRIVER_UMEM_H
  2. #define _PCIDRIVER_UMEM_H
  3. #include <linux/sysfs.h>
  4. #include "ioctl.h"
  5. /* Define an entry in the umem list (this list is per device) */
  6. /* This list keeps references to the SG lists for each mapped userspace region */
  7. typedef struct {
  8. int id;
  9. struct list_head list;
  10. unsigned int nr_pages; /* number of pages for this user memeory area */
  11. struct page **pages; /* list of pointers to the pages */
  12. unsigned int nents; /* actual entries in the scatter/gatter list (NOT nents for the map function, but the result) */
  13. struct scatterlist *sg; /* list of sg entries */
  14. struct device_attribute sysfs_attr; /* initialized when adding the entry */
  15. } pcidriver_umem_entry_t;
  16. int pcidriver_umem_sgmap( pcidriver_privdata_t *privdata, umem_handle_t *umem_handle );
  17. int pcidriver_umem_sgunmap( pcidriver_privdata_t *privdata, pcidriver_umem_entry_t *umem_entry );
  18. int pcidriver_umem_sgget( pcidriver_privdata_t *privdata, umem_sglist_t *umem_sglist );
  19. int pcidriver_umem_sync( pcidriver_privdata_t *privdata, umem_handle_t *umem_handle );
  20. pcidriver_umem_entry_t *pcidriver_umem_find_entry_id( pcidriver_privdata_t *privdata, int id );
  21. #endif /* _PCIDRIVER_UMEM_H */