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.

part.h 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /*
  2. * (C) Copyright 2000-2004
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #ifndef _PART_H
  24. #define _PART_H
  25. #ifdef CONFIG_SYS_64BIT_LBA
  26. typedef uint64_t lbaint_t;
  27. #else
  28. typedef unsigned long lbaint_t;
  29. #endif
  30. typedef struct block_dev_desc {
  31. int if_type; /* type of the interface */
  32. int dev; /* device number */
  33. unsigned char part_type; /* partition type */
  34. unsigned char target; /* target SCSI ID */
  35. unsigned char lun; /* target LUN */
  36. unsigned char type; /* device type */
  37. unsigned char removable; /* removable device */
  38. #ifdef CONFIG_LBA48
  39. unsigned char lba48; /* device can use 48bit addr (ATA/ATAPI v7) */
  40. #endif
  41. lbaint_t lba; /* number of blocks */
  42. unsigned long blksz; /* block size */
  43. char vendor [40+1]; /* IDE model, SCSI Vendor */
  44. char product[20+1]; /* IDE Serial no, SCSI product */
  45. char revision[8+1]; /* firmware revision */
  46. unsigned long (*block_read)(int dev,
  47. unsigned long start,
  48. lbaint_t blkcnt,
  49. void *buffer);
  50. unsigned long (*block_write)(int dev,
  51. unsigned long start,
  52. lbaint_t blkcnt,
  53. const void *buffer);
  54. unsigned long (*block_erase)(int dev,
  55. unsigned long start,
  56. lbaint_t blkcnt);
  57. void *priv; /* driver private struct pointer */
  58. } block_dev_desc_t;
  59. /* Interface types: */
  60. /*#define IF_TYPE_UNKNOWN 0
  61. #define IF_TYPE_IDE 1
  62. #define IF_TYPE_SCSI 2
  63. #define IF_TYPE_ATAPI 3
  64. #define IF_TYPE_USB 4
  65. #define IF_TYPE_DOC 5
  66. #define IF_TYPE_MMC 6
  67. #define IF_TYPE_SD 7
  68. #define IF_TYPE_SATA 8*/
  69. /* Part types */
  70. #define PART_TYPE_UNKNOWN 0x00
  71. #define PART_TYPE_MAC 0x01
  72. #define PART_TYPE_DOS 0x02
  73. #define PART_TYPE_ISO 0x03
  74. #define PART_TYPE_AMIGA 0x04
  75. #define PART_TYPE_EFI 0x05
  76. /*
  77. * Type string for U-Boot bootable partitions
  78. */
  79. #define BOOT_PART_TYPE "U-Boot" /* primary boot partition type */
  80. #define BOOT_PART_COMP "PPCBoot" /* PPCBoot compatibility type */
  81. /* device types */
  82. #define DEV_TYPE_UNKNOWN 0xff /* not connected */
  83. #define DEV_TYPE_HARDDISK 0x00 /* harddisk */
  84. #define DEV_TYPE_TAPE 0x01 /* Tape */
  85. #define DEV_TYPE_CDROM 0x05 /* CD-ROM */
  86. #define DEV_TYPE_OPDISK 0x07 /* optical disk */
  87. typedef struct disk_partition {
  88. unsigned long start; /* # of first block in partition */
  89. unsigned long size; /* number of blocks in partition */
  90. unsigned long blksz; /* block size in bytes */
  91. unsigned char name[32]; /* partition name */
  92. unsigned char type[32]; /* string type description */
  93. } disk_partition_t;
  94. /* Misc _get_dev functions */
  95. #ifdef CONFIG_PARTITIONS
  96. block_dev_desc_t* get_dev(char* ifname, int dev);
  97. block_dev_desc_t* ide_get_dev(int dev);
  98. block_dev_desc_t* sata_get_dev(int dev);
  99. block_dev_desc_t* scsi_get_dev(int dev);
  100. block_dev_desc_t* usb_stor_get_dev(int dev);
  101. block_dev_desc_t* mmc_get_dev(int dev);
  102. block_dev_desc_t* systemace_get_dev(int dev);
  103. block_dev_desc_t* mg_disk_get_dev(int dev);
  104. /* disk/part.c */
  105. int get_partition_info (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  106. void print_part (block_dev_desc_t *dev_desc);
  107. void init_part (block_dev_desc_t *dev_desc);
  108. void dev_print(block_dev_desc_t *dev_desc);
  109. #else
  110. static inline block_dev_desc_t* get_dev(char* ifname, int dev) { return NULL; }
  111. static inline block_dev_desc_t* ide_get_dev(int dev) { return NULL; }
  112. static inline block_dev_desc_t* sata_get_dev(int dev) { return NULL; }
  113. static inline block_dev_desc_t* scsi_get_dev(int dev) { return NULL; }
  114. static inline block_dev_desc_t* usb_stor_get_dev(int dev) { return NULL; }
  115. static inline block_dev_desc_t* mmc_get_dev(int dev) { return NULL; }
  116. static inline block_dev_desc_t* systemace_get_dev(int dev) { return NULL; }
  117. static inline block_dev_desc_t* mg_disk_get_dev(int dev) { return NULL; }
  118. static inline int get_partition_info (block_dev_desc_t * dev_desc, int part,
  119. disk_partition_t *info) { return -1; }
  120. static inline void print_part (block_dev_desc_t *dev_desc) {}
  121. static inline void init_part (block_dev_desc_t *dev_desc) {}
  122. static inline void dev_print(block_dev_desc_t *dev_desc) {}
  123. #endif
  124. #ifdef CONFIG_MAC_PARTITION
  125. /* disk/part_mac.c */
  126. int get_partition_info_mac (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  127. void print_part_mac (block_dev_desc_t *dev_desc);
  128. int test_part_mac (block_dev_desc_t *dev_desc);
  129. #endif
  130. #ifdef CONFIG_DOS_PARTITION
  131. /* disk/part_dos.c */
  132. int get_partition_info_dos (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  133. void print_part_dos (block_dev_desc_t *dev_desc);
  134. int test_part_dos (block_dev_desc_t *dev_desc);
  135. #endif
  136. #ifdef CONFIG_ISO_PARTITION
  137. /* disk/part_iso.c */
  138. int get_partition_info_iso (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  139. void print_part_iso (block_dev_desc_t *dev_desc);
  140. int test_part_iso (block_dev_desc_t *dev_desc);
  141. #endif
  142. #ifdef CONFIG_AMIGA_PARTITION
  143. /* disk/part_amiga.c */
  144. int get_partition_info_amiga (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  145. void print_part_amiga (block_dev_desc_t *dev_desc);
  146. int test_part_amiga (block_dev_desc_t *dev_desc);
  147. #endif
  148. #ifdef CONFIG_EFI_PARTITION
  149. /* disk/part_efi.c */
  150. int get_partition_info_efi (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  151. void print_part_efi (block_dev_desc_t *dev_desc);
  152. int test_part_efi (block_dev_desc_t *dev_desc);
  153. #endif
  154. #define LOG2(x) (((x & 0xaaaaaaaa) ? 1 : 0) + ((x & 0xcccccccc) ? 2 : 0) + \
  155. ((x & 0xf0f0f0f0) ? 4 : 0) + ((x & 0xff00ff00) ? 8 : 0) + \
  156. ((x & 0xffff0000) ? 16 : 0))
  157. #endif /* _PART_H */