part.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. #include <ide.h>
  26. typedef struct block_dev_desc {
  27. int if_type; /* type of the interface */
  28. int dev; /* device number */
  29. unsigned char part_type; /* partition type */
  30. unsigned char target; /* target SCSI ID */
  31. unsigned char lun; /* target LUN */
  32. unsigned char type; /* device type */
  33. unsigned char removable; /* removable device */
  34. #ifdef CONFIG_LBA48
  35. unsigned char lba48; /* device can use 48bit addr (ATA/ATAPI v7) */
  36. #endif
  37. lbaint_t lba; /* number of blocks */
  38. unsigned long blksz; /* block size */
  39. char vendor [40+1]; /* IDE model, SCSI Vendor */
  40. char product[20+1]; /* IDE Serial no, SCSI product */
  41. char revision[8+1]; /* firmware revision */
  42. unsigned long (*block_read)(int dev,
  43. unsigned long start,
  44. lbaint_t blkcnt,
  45. void *buffer);
  46. unsigned long (*block_write)(int dev,
  47. unsigned long start,
  48. lbaint_t blkcnt,
  49. const void *buffer);
  50. void *priv; /* driver private struct pointer */
  51. }block_dev_desc_t;
  52. /* Interface types: */
  53. #define IF_TYPE_UNKNOWN 0
  54. #define IF_TYPE_IDE 1
  55. #define IF_TYPE_SCSI 2
  56. #define IF_TYPE_ATAPI 3
  57. #define IF_TYPE_USB 4
  58. #define IF_TYPE_DOC 5
  59. #define IF_TYPE_MMC 6
  60. #define IF_TYPE_SD 7
  61. #define IF_TYPE_SATA 8
  62. /* Part types */
  63. #define PART_TYPE_UNKNOWN 0x00
  64. #define PART_TYPE_MAC 0x01
  65. #define PART_TYPE_DOS 0x02
  66. #define PART_TYPE_ISO 0x03
  67. #define PART_TYPE_AMIGA 0x04
  68. #define PART_TYPE_EFI 0x05
  69. /*
  70. * Type string for U-Boot bootable partitions
  71. */
  72. #define BOOT_PART_TYPE "U-Boot" /* primary boot partition type */
  73. #define BOOT_PART_COMP "PPCBoot" /* PPCBoot compatibility type */
  74. /* device types */
  75. #define DEV_TYPE_UNKNOWN 0xff /* not connected */
  76. #define DEV_TYPE_HARDDISK 0x00 /* harddisk */
  77. #define DEV_TYPE_TAPE 0x01 /* Tape */
  78. #define DEV_TYPE_CDROM 0x05 /* CD-ROM */
  79. #define DEV_TYPE_OPDISK 0x07 /* optical disk */
  80. typedef struct disk_partition {
  81. ulong start; /* # of first block in partition */
  82. ulong size; /* number of blocks in partition */
  83. ulong blksz; /* block size in bytes */
  84. uchar name[32]; /* partition name */
  85. uchar type[32]; /* string type description */
  86. } disk_partition_t;
  87. /* Misc _get_dev functions */
  88. block_dev_desc_t* get_dev(char* ifname, int dev);
  89. block_dev_desc_t* ide_get_dev(int dev);
  90. block_dev_desc_t* sata_get_dev(int dev);
  91. block_dev_desc_t* scsi_get_dev(int dev);
  92. block_dev_desc_t* usb_stor_get_dev(int dev);
  93. block_dev_desc_t* mmc_get_dev(int dev);
  94. block_dev_desc_t* systemace_get_dev(int dev);
  95. block_dev_desc_t* mg_disk_get_dev(int dev);
  96. /* disk/part.c */
  97. int get_partition_info (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  98. void print_part (block_dev_desc_t *dev_desc);
  99. void init_part (block_dev_desc_t *dev_desc);
  100. void dev_print(block_dev_desc_t *dev_desc);
  101. #ifdef CONFIG_MAC_PARTITION
  102. /* disk/part_mac.c */
  103. int get_partition_info_mac (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  104. void print_part_mac (block_dev_desc_t *dev_desc);
  105. int test_part_mac (block_dev_desc_t *dev_desc);
  106. #endif
  107. #ifdef CONFIG_DOS_PARTITION
  108. /* disk/part_dos.c */
  109. int get_partition_info_dos (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  110. void print_part_dos (block_dev_desc_t *dev_desc);
  111. int test_part_dos (block_dev_desc_t *dev_desc);
  112. #endif
  113. #ifdef CONFIG_ISO_PARTITION
  114. /* disk/part_iso.c */
  115. int get_partition_info_iso (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  116. void print_part_iso (block_dev_desc_t *dev_desc);
  117. int test_part_iso (block_dev_desc_t *dev_desc);
  118. #endif
  119. #ifdef CONFIG_AMIGA_PARTITION
  120. /* disk/part_amiga.c */
  121. int get_partition_info_amiga (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  122. void print_part_amiga (block_dev_desc_t *dev_desc);
  123. int test_part_amiga (block_dev_desc_t *dev_desc);
  124. #endif
  125. #ifdef CONFIG_EFI_PARTITION
  126. /* disk/part_efi.c */
  127. int get_partition_info_efi (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);
  128. void print_part_efi (block_dev_desc_t *dev_desc);
  129. int test_part_efi (block_dev_desc_t *dev_desc);
  130. #endif
  131. #endif /* _PART_H */