Firmware for MNT ZZ9000 graphics and ARM coprocessor card for Amiga computers.
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.

blk.h 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2000-2004
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. */
  6. #ifndef BLK_H
  7. #define BLK_H
  8. #ifdef CONFIG_SYS_64BIT_LBA
  9. typedef uint64_t lbaint_t;
  10. #define LBAFlength "ll"
  11. #else
  12. typedef ulong lbaint_t;
  13. #define LBAFlength "l"
  14. #endif
  15. #define LBAF "%" LBAFlength "x"
  16. #define LBAFU "%" LBAFlength "u"
  17. /* Interface types: */
  18. enum if_type {
  19. IF_TYPE_UNKNOWN = 0,
  20. IF_TYPE_IDE,
  21. IF_TYPE_SCSI,
  22. IF_TYPE_ATAPI,
  23. IF_TYPE_USB,
  24. IF_TYPE_DOC,
  25. IF_TYPE_MMC,
  26. IF_TYPE_SD,
  27. IF_TYPE_SATA,
  28. IF_TYPE_HOST,
  29. IF_TYPE_NVME,
  30. IF_TYPE_EFI,
  31. IF_TYPE_VIRTIO,
  32. IF_TYPE_COUNT, /* Number of interface types */
  33. };
  34. #define BLK_VEN_SIZE 40
  35. #define BLK_PRD_SIZE 20
  36. #define BLK_REV_SIZE 8
  37. /*
  38. * Identifies the partition table type (ie. MBR vs GPT GUID) signature
  39. */
  40. enum sig_type {
  41. SIG_TYPE_NONE,
  42. SIG_TYPE_MBR,
  43. SIG_TYPE_GUID,
  44. SIG_TYPE_COUNT /* Number of signature types */
  45. };
  46. typedef struct {
  47. u8 b[16];
  48. } efi_guid_t __attribute__((aligned(8)));
  49. /*
  50. * With driver model (CONFIG_BLK) this is uclass platform data, accessible
  51. * with dev_get_uclass_platdata(dev)
  52. */
  53. struct blk_desc {
  54. /*
  55. * TODO: With driver model we should be able to use the parent
  56. * device's uclass instead.
  57. */
  58. enum if_type if_type; /* type of the interface */
  59. int devnum; /* device number */
  60. unsigned char part_type; /* partition type */
  61. unsigned char target; /* target SCSI ID */
  62. unsigned char lun; /* target LUN */
  63. unsigned char hwpart; /* HW partition, e.g. for eMMC */
  64. unsigned char type; /* device type */
  65. unsigned char removable; /* removable device */
  66. #ifdef CONFIG_LBA48
  67. /* device can use 48bit addr (ATA/ATAPI v7) */
  68. unsigned char lba48;
  69. #endif
  70. lbaint_t lba; /* number of blocks */
  71. unsigned long blksz; /* block size */
  72. int log2blksz; /* for convenience: log2(blksz) */
  73. char vendor[BLK_VEN_SIZE + 1]; /* device vendor string */
  74. char product[BLK_PRD_SIZE + 1]; /* device product number */
  75. char revision[BLK_REV_SIZE + 1]; /* firmware revision */
  76. enum sig_type sig_type; /* Partition table signature type */
  77. union {
  78. uint32_t mbr_sig; /* MBR integer signature */
  79. efi_guid_t guid_sig; /* GPT GUID Signature */
  80. };
  81. unsigned long (*block_read)(struct blk_desc *block_dev,
  82. lbaint_t start,
  83. lbaint_t blkcnt,
  84. void *buffer);
  85. unsigned long (*block_write)(struct blk_desc *block_dev,
  86. lbaint_t start,
  87. lbaint_t blkcnt,
  88. const void *buffer);
  89. unsigned long (*block_erase)(struct blk_desc *block_dev,
  90. lbaint_t start,
  91. lbaint_t blkcnt);
  92. void *priv; /* driver private struct pointer */
  93. };
  94. #endif