You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

blockdev.h 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef _IPXE_BLOCKDEV_H
  2. #define _IPXE_BLOCKDEV_H
  3. /**
  4. * @file
  5. *
  6. * Block devices
  7. *
  8. */
  9. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  10. #include <stdint.h>
  11. #include <ipxe/uaccess.h>
  12. #include <ipxe/interface.h>
  13. /** Block device capacity */
  14. struct block_device_capacity {
  15. /** Total number of blocks */
  16. uint64_t blocks;
  17. /** Block size */
  18. size_t blksize;
  19. /** Maximum number of blocks per single transfer */
  20. unsigned int max_count;
  21. };
  22. extern int block_read ( struct interface *control, struct interface *data,
  23. uint64_t lba, unsigned int count,
  24. userptr_t buffer, size_t len );
  25. #define block_read_TYPE( object_type ) \
  26. typeof ( int ( object_type, struct interface *data, \
  27. uint64_t lba, unsigned int count, \
  28. userptr_t buffer, size_t len ) )
  29. extern int block_write ( struct interface *control, struct interface *data,
  30. uint64_t lba, unsigned int count,
  31. userptr_t buffer, size_t len );
  32. #define block_write_TYPE( object_type ) \
  33. typeof ( int ( object_type, struct interface *data, \
  34. uint64_t lba, unsigned int count, \
  35. userptr_t buffer, size_t len ) )
  36. extern int block_read_capacity ( struct interface *control,
  37. struct interface *data );
  38. #define block_read_capacity_TYPE( object_type ) \
  39. typeof ( int ( object_type, struct interface *data ) )
  40. extern void block_capacity ( struct interface *intf,
  41. struct block_device_capacity *capacity );
  42. #define block_capacity_TYPE( object_type ) \
  43. typeof ( void ( object_type, \
  44. struct block_device_capacity *capacity ) )
  45. #endif /* _IPXE_BLOCKDEV_H */