block_device.h 862 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. #include "../../common/glib.h"
  3. #include "stdint.h"
  4. struct block_device_operation
  5. {
  6. long (*open)();
  7. long (*close)();
  8. long (*ioctl)(long cmd, long arg);
  9. long (*transfer)(long cmd, ul LBA_start, ul count, uint64_t buffer, uint8_t arg0, uint8_t arg1);
  10. };
  11. /**
  12. * @brief 块设备请求队列内的packet
  13. *
  14. */
  15. struct block_device_request_packet
  16. {
  17. uchar cmd;
  18. uint64_t LBA_start;
  19. uint32_t count;
  20. uint64_t buffer_vaddr;
  21. uint8_t ahci_ctrl_num; // ahci控制器号, 默认应为0
  22. uint8_t port_num; // ahci的设备端口号
  23. void (*end_handler)(ul num, ul arg);
  24. struct List list;
  25. };
  26. /**
  27. * @brief 块设备的请求队列
  28. *
  29. */
  30. struct block_device_request_queue
  31. {
  32. struct List queue_list;
  33. struct block_device_request_packet * in_service; // 正在请求的结点
  34. ul request_count;
  35. };