wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2001 |
| 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 | |
| 24 | #include <common.h> |
| 25 | #include <command.h> |
| 26 | #include <ide.h> |
Grant Likely | 735dd97 | 2007-02-20 09:04:34 +0100 | [diff] [blame] | 27 | #include <part.h> |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 28 | |
| 29 | #undef PART_DEBUG |
| 30 | |
| 31 | #ifdef PART_DEBUG |
| 32 | #define PRINTF(fmt,args...) printf (fmt ,##args) |
| 33 | #else |
| 34 | #define PRINTF(fmt,args...) |
| 35 | #endif |
| 36 | |
Jon Loeliger | cde5c64 | 2007-07-09 17:22:37 -0500 | [diff] [blame] | 37 | #if (defined(CONFIG_CMD_IDE) || \ |
unsik Kim | 75eb82e | 2009-02-25 11:31:24 +0900 | [diff] [blame] | 38 | defined(CONFIG_CMD_MG_DISK) || \ |
Dave Liu | c7057b5 | 2008-03-26 22:49:44 +0800 | [diff] [blame] | 39 | defined(CONFIG_CMD_SATA) || \ |
Jon Loeliger | cde5c64 | 2007-07-09 17:22:37 -0500 | [diff] [blame] | 40 | defined(CONFIG_CMD_SCSI) || \ |
| 41 | defined(CONFIG_CMD_USB) || \ |
wdenk | 1968e61 | 2005-02-24 23:23:29 +0000 | [diff] [blame] | 42 | defined(CONFIG_MMC) || \ |
| 43 | defined(CONFIG_SYSTEMACE) ) |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 44 | |
Grant Likely | 735dd97 | 2007-02-20 09:04:34 +0100 | [diff] [blame] | 45 | struct block_drvr { |
| 46 | char *name; |
| 47 | block_dev_desc_t* (*get_dev)(int dev); |
| 48 | }; |
| 49 | |
| 50 | static const struct block_drvr block_drvr[] = { |
Jon Loeliger | cde5c64 | 2007-07-09 17:22:37 -0500 | [diff] [blame] | 51 | #if defined(CONFIG_CMD_IDE) |
Grant Likely | 735dd97 | 2007-02-20 09:04:34 +0100 | [diff] [blame] | 52 | { .name = "ide", .get_dev = ide_get_dev, }, |
| 53 | #endif |
Dave Liu | c7057b5 | 2008-03-26 22:49:44 +0800 | [diff] [blame] | 54 | #if defined(CONFIG_CMD_SATA) |
| 55 | {.name = "sata", .get_dev = sata_get_dev, }, |
| 56 | #endif |
Jon Loeliger | cde5c64 | 2007-07-09 17:22:37 -0500 | [diff] [blame] | 57 | #if defined(CONFIG_CMD_SCSI) |
Grant Likely | 735dd97 | 2007-02-20 09:04:34 +0100 | [diff] [blame] | 58 | { .name = "scsi", .get_dev = scsi_get_dev, }, |
| 59 | #endif |
Jon Loeliger | cde5c64 | 2007-07-09 17:22:37 -0500 | [diff] [blame] | 60 | #if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE) |
Grant Likely | 735dd97 | 2007-02-20 09:04:34 +0100 | [diff] [blame] | 61 | { .name = "usb", .get_dev = usb_stor_get_dev, }, |
| 62 | #endif |
| 63 | #if defined(CONFIG_MMC) |
| 64 | { .name = "mmc", .get_dev = mmc_get_dev, }, |
| 65 | #endif |
| 66 | #if defined(CONFIG_SYSTEMACE) |
| 67 | { .name = "ace", .get_dev = systemace_get_dev, }, |
| 68 | #endif |
unsik Kim | 75eb82e | 2009-02-25 11:31:24 +0900 | [diff] [blame] | 69 | #if defined(CONFIG_CMD_MG_DISK) |
| 70 | { .name = "mgd", .get_dev = mg_disk_get_dev, }, |
| 71 | #endif |
Grant Likely | 735dd97 | 2007-02-20 09:04:34 +0100 | [diff] [blame] | 72 | { }, |
| 73 | }; |
| 74 | |
Stefan Roese | 751bb57 | 2007-02-20 13:21:57 +0100 | [diff] [blame] | 75 | DECLARE_GLOBAL_DATA_PTR; |
Stefan Roese | 751bb57 | 2007-02-20 13:21:57 +0100 | [diff] [blame] | 76 | |
Grant Likely | 735dd97 | 2007-02-20 09:04:34 +0100 | [diff] [blame] | 77 | block_dev_desc_t *get_dev(char* ifname, int dev) |
| 78 | { |
| 79 | const struct block_drvr *drvr = block_drvr; |
Stefan Roese | 6c7cac8 | 2007-02-22 07:43:34 +0100 | [diff] [blame] | 80 | block_dev_desc_t* (*reloc_get_dev)(int dev); |
Grant Likely | 735dd97 | 2007-02-20 09:04:34 +0100 | [diff] [blame] | 81 | |
| 82 | while (drvr->name) { |
Stefan Roese | 751bb57 | 2007-02-20 13:21:57 +0100 | [diff] [blame] | 83 | reloc_get_dev = drvr->get_dev + gd->reloc_off; |
| 84 | if (strncmp(ifname, drvr->name, strlen(drvr->name)) == 0) |
| 85 | return reloc_get_dev(dev); |
Grant Likely | 735dd97 | 2007-02-20 09:04:34 +0100 | [diff] [blame] | 86 | drvr++; |
| 87 | } |
| 88 | return NULL; |
| 89 | } |
| 90 | #else |
| 91 | block_dev_desc_t *get_dev(char* ifname, int dev) |
| 92 | { |
| 93 | return NULL; |
| 94 | } |
| 95 | #endif |
| 96 | |
Jon Loeliger | cde5c64 | 2007-07-09 17:22:37 -0500 | [diff] [blame] | 97 | #if (defined(CONFIG_CMD_IDE) || \ |
unsik Kim | 75eb82e | 2009-02-25 11:31:24 +0900 | [diff] [blame] | 98 | defined(CONFIG_CMD_MG_DISK) || \ |
Dave Liu | c7057b5 | 2008-03-26 22:49:44 +0800 | [diff] [blame] | 99 | defined(CONFIG_CMD_SATA) || \ |
Jon Loeliger | cde5c64 | 2007-07-09 17:22:37 -0500 | [diff] [blame] | 100 | defined(CONFIG_CMD_SCSI) || \ |
| 101 | defined(CONFIG_CMD_USB) || \ |
Grant Likely | 735dd97 | 2007-02-20 09:04:34 +0100 | [diff] [blame] | 102 | defined(CONFIG_MMC) || \ |
| 103 | defined(CONFIG_SYSTEMACE) ) |
| 104 | |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 105 | /* ------------------------------------------------------------------------- */ |
| 106 | /* |
| 107 | * reports device info to the user |
| 108 | */ |
| 109 | void dev_print (block_dev_desc_t *dev_desc) |
| 110 | { |
wdenk | 42dfe7a | 2004-03-14 22:25:36 +0000 | [diff] [blame] | 111 | #ifdef CONFIG_LBA48 |
wdenk | c40b295 | 2004-03-13 23:29:43 +0000 | [diff] [blame] | 112 | uint64_t lba512; /* number of blocks if 512bytes block size */ |
| 113 | #else |
| 114 | lbaint_t lba512; |
| 115 | #endif |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 116 | |
Wolfgang Denk | af75a45 | 2009-05-15 09:27:58 +0200 | [diff] [blame] | 117 | if (dev_desc->type == DEV_TYPE_UNKNOWN) { |
| 118 | puts ("not available\n"); |
| 119 | return; |
| 120 | } |
| 121 | |
Tor Krill | 8ec6e33 | 2008-05-29 11:10:30 +0200 | [diff] [blame] | 122 | switch (dev_desc->if_type) { |
Detlev Zundel | 574b319 | 2008-05-05 16:11:21 +0200 | [diff] [blame] | 123 | case IF_TYPE_SCSI: |
| 124 | printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n", |
| 125 | dev_desc->target,dev_desc->lun, |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 126 | dev_desc->vendor, |
| 127 | dev_desc->product, |
| 128 | dev_desc->revision); |
Detlev Zundel | 574b319 | 2008-05-05 16:11:21 +0200 | [diff] [blame] | 129 | break; |
Remy Bohmer | 6e24a1e | 2008-09-19 13:30:06 +0200 | [diff] [blame] | 130 | case IF_TYPE_ATAPI: |
Detlev Zundel | 574b319 | 2008-05-05 16:11:21 +0200 | [diff] [blame] | 131 | case IF_TYPE_IDE: |
| 132 | case IF_TYPE_SATA: |
| 133 | printf ("Model: %s Firm: %s Ser#: %s\n", |
| 134 | dev_desc->vendor, |
| 135 | dev_desc->revision, |
| 136 | dev_desc->product); |
| 137 | break; |
Remy Bohmer | 6e24a1e | 2008-09-19 13:30:06 +0200 | [diff] [blame] | 138 | case IF_TYPE_SD: |
| 139 | case IF_TYPE_MMC: |
NÃcolas Carneiro Lebedenco | 47bebe3 | 2008-09-04 15:35:46 -0300 | [diff] [blame] | 140 | case IF_TYPE_USB: |
| 141 | printf ("Vendor: %s Rev: %s Prod: %s\n", |
| 142 | dev_desc->vendor, |
| 143 | dev_desc->revision, |
| 144 | dev_desc->product); |
| 145 | break; |
Remy Bohmer | 6e24a1e | 2008-09-19 13:30:06 +0200 | [diff] [blame] | 146 | case IF_TYPE_DOC: |
| 147 | puts("device type DOC\n"); |
| 148 | return; |
Tor Krill | 8ec6e33 | 2008-05-29 11:10:30 +0200 | [diff] [blame] | 149 | case IF_TYPE_UNKNOWN: |
Remy Bohmer | 6e24a1e | 2008-09-19 13:30:06 +0200 | [diff] [blame] | 150 | puts("device type unknown\n"); |
| 151 | return; |
Detlev Zundel | 574b319 | 2008-05-05 16:11:21 +0200 | [diff] [blame] | 152 | default: |
Remy Bohmer | 6e24a1e | 2008-09-19 13:30:06 +0200 | [diff] [blame] | 153 | printf("Unhandled device type: %i\n", dev_desc->if_type); |
Detlev Zundel | 574b319 | 2008-05-05 16:11:21 +0200 | [diff] [blame] | 154 | return; |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 155 | } |
| 156 | puts (" Type: "); |
| 157 | if (dev_desc->removable) |
| 158 | puts ("Removable "); |
| 159 | switch (dev_desc->type & 0x1F) { |
Detlev Zundel | 726c0f1 | 2008-05-05 16:11:22 +0200 | [diff] [blame] | 160 | case DEV_TYPE_HARDDISK: |
| 161 | puts ("Hard Disk"); |
| 162 | break; |
| 163 | case DEV_TYPE_CDROM: |
| 164 | puts ("CD ROM"); |
| 165 | break; |
| 166 | case DEV_TYPE_OPDISK: |
| 167 | puts ("Optical Device"); |
| 168 | break; |
| 169 | case DEV_TYPE_TAPE: |
| 170 | puts ("Tape"); |
| 171 | break; |
| 172 | default: |
| 173 | printf ("# %02X #", dev_desc->type & 0x1F); |
| 174 | break; |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 175 | } |
| 176 | puts ("\n"); |
| 177 | if ((dev_desc->lba * dev_desc->blksz)>0L) { |
| 178 | ulong mb, mb_quot, mb_rem, gb, gb_quot, gb_rem; |
wdenk | c40b295 | 2004-03-13 23:29:43 +0000 | [diff] [blame] | 179 | lbaint_t lba; |
wdenk | 6e59238 | 2004-04-18 17:39:38 +0000 | [diff] [blame] | 180 | |
| 181 | lba = dev_desc->lba; |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 182 | |
wdenk | c40b295 | 2004-03-13 23:29:43 +0000 | [diff] [blame] | 183 | lba512 = (lba * (dev_desc->blksz/512)); |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 184 | mb = (10 * lba512) / 2048; /* 2048 = (1024 * 1024) / 512 MB */ |
| 185 | /* round to 1 digit */ |
| 186 | mb_quot = mb / 10; |
| 187 | mb_rem = mb - (10 * mb_quot); |
| 188 | |
| 189 | gb = mb / 1024; |
| 190 | gb_quot = gb / 10; |
| 191 | gb_rem = gb - (10 * gb_quot); |
wdenk | 42dfe7a | 2004-03-14 22:25:36 +0000 | [diff] [blame] | 192 | #ifdef CONFIG_LBA48 |
wdenk | 6e59238 | 2004-04-18 17:39:38 +0000 | [diff] [blame] | 193 | if (dev_desc->lba48) |
wdenk | c40b295 | 2004-03-13 23:29:43 +0000 | [diff] [blame] | 194 | printf (" Supports 48-bit addressing\n"); |
| 195 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 196 | #if defined(CONFIG_SYS_64BIT_LBA) && defined(CONFIG_SYS_64BIT_VSPRINTF) |
Mike Frysinger | 6c6166f | 2009-02-16 23:21:36 -0500 | [diff] [blame] | 197 | printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%Ld x %ld)\n", |
wdenk | c40b295 | 2004-03-13 23:29:43 +0000 | [diff] [blame] | 198 | mb_quot, mb_rem, |
| 199 | gb_quot, gb_rem, |
| 200 | lba, |
| 201 | dev_desc->blksz); |
| 202 | #else |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 203 | printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%ld x %ld)\n", |
| 204 | mb_quot, mb_rem, |
| 205 | gb_quot, gb_rem, |
wdenk | c40b295 | 2004-03-13 23:29:43 +0000 | [diff] [blame] | 206 | (ulong)lba, |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 207 | dev_desc->blksz); |
wdenk | c40b295 | 2004-03-13 23:29:43 +0000 | [diff] [blame] | 208 | #endif |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 209 | } else { |
| 210 | puts (" Capacity: not available\n"); |
| 211 | } |
| 212 | } |
Jon Loeliger | b3aff0c | 2007-07-10 11:19:50 -0500 | [diff] [blame] | 213 | #endif |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 214 | |
Jon Loeliger | cde5c64 | 2007-07-09 17:22:37 -0500 | [diff] [blame] | 215 | #if (defined(CONFIG_CMD_IDE) || \ |
unsik Kim | 75eb82e | 2009-02-25 11:31:24 +0900 | [diff] [blame] | 216 | defined(CONFIG_CMD_MG_DISK) || \ |
Dave Liu | c7057b5 | 2008-03-26 22:49:44 +0800 | [diff] [blame] | 217 | defined(CONFIG_CMD_SATA) || \ |
Jon Loeliger | cde5c64 | 2007-07-09 17:22:37 -0500 | [diff] [blame] | 218 | defined(CONFIG_CMD_SCSI) || \ |
| 219 | defined(CONFIG_CMD_USB) || \ |
Haavard Skinnemoen | 7fac3f6 | 2006-12-17 18:53:56 +0100 | [diff] [blame] | 220 | defined(CONFIG_MMC) || \ |
unsik Kim | 75eb82e | 2009-02-25 11:31:24 +0900 | [diff] [blame] | 221 | defined(CONFIG_SYSTEMACE) ) |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 222 | |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 223 | #if defined(CONFIG_MAC_PARTITION) || \ |
| 224 | defined(CONFIG_DOS_PARTITION) || \ |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 225 | defined(CONFIG_ISO_PARTITION) || \ |
richardretanubun | 07f3d78 | 2008-09-26 11:13:22 -0400 | [diff] [blame] | 226 | defined(CONFIG_AMIGA_PARTITION) || \ |
| 227 | defined(CONFIG_EFI_PARTITION) |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 228 | |
| 229 | void init_part (block_dev_desc_t * dev_desc) |
| 230 | { |
| 231 | #ifdef CONFIG_ISO_PARTITION |
| 232 | if (test_part_iso(dev_desc) == 0) { |
| 233 | dev_desc->part_type = PART_TYPE_ISO; |
| 234 | return; |
| 235 | } |
| 236 | #endif |
| 237 | |
| 238 | #ifdef CONFIG_MAC_PARTITION |
| 239 | if (test_part_mac(dev_desc) == 0) { |
| 240 | dev_desc->part_type = PART_TYPE_MAC; |
| 241 | return; |
| 242 | } |
| 243 | #endif |
| 244 | |
richardretanubun | 07f3d78 | 2008-09-26 11:13:22 -0400 | [diff] [blame] | 245 | /* must be placed before DOS partition detection */ |
| 246 | #ifdef CONFIG_EFI_PARTITION |
| 247 | if (test_part_efi(dev_desc) == 0) { |
| 248 | dev_desc->part_type = PART_TYPE_EFI; |
| 249 | return; |
| 250 | } |
| 251 | #endif |
| 252 | |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 253 | #ifdef CONFIG_DOS_PARTITION |
| 254 | if (test_part_dos(dev_desc) == 0) { |
| 255 | dev_desc->part_type = PART_TYPE_DOS; |
| 256 | return; |
| 257 | } |
| 258 | #endif |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 259 | |
| 260 | #ifdef CONFIG_AMIGA_PARTITION |
| 261 | if (test_part_amiga(dev_desc) == 0) { |
| 262 | dev_desc->part_type = PART_TYPE_AMIGA; |
| 263 | return; |
| 264 | } |
| 265 | #endif |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | |
Peter Pearse | 3e3b956 | 2007-05-18 16:47:03 +0100 | [diff] [blame] | 269 | int get_partition_info (block_dev_desc_t *dev_desc, int part |
| 270 | , disk_partition_t *info) |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 271 | { |
Heiko Schocher | 566a494 | 2007-06-22 19:11:54 +0200 | [diff] [blame] | 272 | switch (dev_desc->part_type) { |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 273 | #ifdef CONFIG_MAC_PARTITION |
| 274 | case PART_TYPE_MAC: |
| 275 | if (get_partition_info_mac(dev_desc,part,info) == 0) { |
| 276 | PRINTF ("## Valid MAC partition found ##\n"); |
| 277 | return (0); |
| 278 | } |
| 279 | break; |
| 280 | #endif |
| 281 | |
| 282 | #ifdef CONFIG_DOS_PARTITION |
| 283 | case PART_TYPE_DOS: |
| 284 | if (get_partition_info_dos(dev_desc,part,info) == 0) { |
| 285 | PRINTF ("## Valid DOS partition found ##\n"); |
| 286 | return (0); |
| 287 | } |
| 288 | break; |
| 289 | #endif |
| 290 | |
| 291 | #ifdef CONFIG_ISO_PARTITION |
| 292 | case PART_TYPE_ISO: |
| 293 | if (get_partition_info_iso(dev_desc,part,info) == 0) { |
| 294 | PRINTF ("## Valid ISO boot partition found ##\n"); |
| 295 | return (0); |
| 296 | } |
| 297 | break; |
| 298 | #endif |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 299 | |
| 300 | #ifdef CONFIG_AMIGA_PARTITION |
| 301 | case PART_TYPE_AMIGA: |
| 302 | if (get_partition_info_amiga(dev_desc, part, info) == 0) |
| 303 | { |
| 304 | PRINTF ("## Valid Amiga partition found ##\n"); |
| 305 | return (0); |
| 306 | } |
| 307 | break; |
| 308 | #endif |
richardretanubun | 07f3d78 | 2008-09-26 11:13:22 -0400 | [diff] [blame] | 309 | |
| 310 | #ifdef CONFIG_EFI_PARTITION |
| 311 | case PART_TYPE_EFI: |
| 312 | if (get_partition_info_efi(dev_desc,part,info) == 0) { |
| 313 | PRINTF ("## Valid EFI partition found ##\n"); |
| 314 | return (0); |
| 315 | } |
| 316 | break; |
| 317 | #endif |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 318 | default: |
| 319 | break; |
| 320 | } |
| 321 | return (-1); |
| 322 | } |
| 323 | |
| 324 | static void print_part_header (const char *type, block_dev_desc_t * dev_desc) |
| 325 | { |
| 326 | puts ("\nPartition Map for "); |
| 327 | switch (dev_desc->if_type) { |
Detlev Zundel | 726c0f1 | 2008-05-05 16:11:22 +0200 | [diff] [blame] | 328 | case IF_TYPE_IDE: |
| 329 | puts ("IDE"); |
| 330 | break; |
| 331 | case IF_TYPE_SATA: |
| 332 | puts ("SATA"); |
| 333 | break; |
| 334 | case IF_TYPE_SCSI: |
| 335 | puts ("SCSI"); |
| 336 | break; |
| 337 | case IF_TYPE_ATAPI: |
| 338 | puts ("ATAPI"); |
| 339 | break; |
| 340 | case IF_TYPE_USB: |
| 341 | puts ("USB"); |
| 342 | break; |
| 343 | case IF_TYPE_DOC: |
| 344 | puts ("DOC"); |
| 345 | break; |
| 346 | default: |
| 347 | puts ("UNKNOWN"); |
| 348 | break; |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 349 | } |
| 350 | printf (" device %d -- Partition Type: %s\n\n", |
| 351 | dev_desc->dev, type); |
| 352 | } |
| 353 | |
| 354 | void print_part (block_dev_desc_t * dev_desc) |
| 355 | { |
| 356 | |
| 357 | switch (dev_desc->part_type) { |
| 358 | #ifdef CONFIG_MAC_PARTITION |
| 359 | case PART_TYPE_MAC: |
| 360 | PRINTF ("## Testing for valid MAC partition ##\n"); |
| 361 | print_part_header ("MAC", dev_desc); |
| 362 | print_part_mac (dev_desc); |
| 363 | return; |
| 364 | #endif |
| 365 | #ifdef CONFIG_DOS_PARTITION |
| 366 | case PART_TYPE_DOS: |
| 367 | PRINTF ("## Testing for valid DOS partition ##\n"); |
| 368 | print_part_header ("DOS", dev_desc); |
| 369 | print_part_dos (dev_desc); |
| 370 | return; |
| 371 | #endif |
| 372 | |
| 373 | #ifdef CONFIG_ISO_PARTITION |
| 374 | case PART_TYPE_ISO: |
| 375 | PRINTF ("## Testing for valid ISO Boot partition ##\n"); |
| 376 | print_part_header ("ISO", dev_desc); |
| 377 | print_part_iso (dev_desc); |
| 378 | return; |
| 379 | #endif |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 380 | |
| 381 | #ifdef CONFIG_AMIGA_PARTITION |
| 382 | case PART_TYPE_AMIGA: |
| 383 | PRINTF ("## Testing for a valid Amiga partition ##\n"); |
| 384 | print_part_header ("AMIGA", dev_desc); |
| 385 | print_part_amiga (dev_desc); |
| 386 | return; |
| 387 | #endif |
richardretanubun | 07f3d78 | 2008-09-26 11:13:22 -0400 | [diff] [blame] | 388 | |
| 389 | #ifdef CONFIG_EFI_PARTITION |
| 390 | case PART_TYPE_EFI: |
| 391 | PRINTF ("## Testing for valid EFI partition ##\n"); |
| 392 | print_part_header ("EFI", dev_desc); |
| 393 | print_part_efi (dev_desc); |
| 394 | return; |
| 395 | #endif |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 396 | } |
| 397 | puts ("## Unknown partition table\n"); |
| 398 | } |
| 399 | |
| 400 | |
richardretanubun | 07f3d78 | 2008-09-26 11:13:22 -0400 | [diff] [blame] | 401 | #else /* neither MAC nor DOS nor ISO nor AMIGA nor EFI partition configured */ |
Wolfgang Denk | 725671c | 2007-06-06 16:26:56 +0200 | [diff] [blame] | 402 | # error neither CONFIG_MAC_PARTITION nor CONFIG_DOS_PARTITION |
richardretanubun | 07f3d78 | 2008-09-26 11:13:22 -0400 | [diff] [blame] | 403 | # error nor CONFIG_ISO_PARTITION nor CONFIG_AMIGA_PARTITION |
| 404 | # error nor CONFIG_EFI_PARTITION configured! |
wdenk | affae2b | 2002-08-17 09:36:01 +0000 | [diff] [blame] | 405 | #endif |
| 406 | |
Jon Loeliger | cde5c64 | 2007-07-09 17:22:37 -0500 | [diff] [blame] | 407 | #endif |