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