aboutsummaryrefslogtreecommitdiffstats
path: root/disk
diff options
context:
space:
mode:
authorGabe Black2012-10-12 09:26:08 -0500
committerTom Rini2012-10-22 10:29:55 -0500
commit0c9c8fb5ec9c2ec20670dce0c5ff0752371893da (patch)
treea9f2baf01138067133e57bd2a1d2766f7f88f467 /disk
parent24a3fdd64d449c1acd4ccc3636f8bf02e903b6f8 (diff)
downloadu-boot-0c9c8fb5ec9c2ec20670dce0c5ff0752371893da.tar.gz
u-boot-0c9c8fb5ec9c2ec20670dce0c5ff0752371893da.tar.xz
u-boot-0c9c8fb5ec9c2ec20670dce0c5ff0752371893da.zip
disk: Make the disk partition code work with no specific partition types
Currently, if the disk partition code is compiled with all of the parition types compiled out, it hits an #error which stops the build. This change adjusts that file so that those functions will fall through to their defaults in those cases instead of breaking the build. These functions are needed because other code calls them, and that code is needed because other config options are overly broad and bring in support we don't need along with support we do. Also reduce repetition of the 6-term #ifdef throughout the file. Signed-off-by: Gabe Black <gabeblack@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'disk')
-rw-r--r--disk/part.c50
1 files changed, 17 insertions, 33 deletions
diff --git a/disk/part.c b/disk/part.c
index 8ba3cdeaa0..4646f682d2 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -35,12 +35,15 @@
35#define PRINTF(fmt,args...) 35#define PRINTF(fmt,args...)
36#endif 36#endif
37 37
38/* Rather than repeat this expression each time, add a define for it */
38#if (defined(CONFIG_CMD_IDE) || \ 39#if (defined(CONFIG_CMD_IDE) || \
39 defined(CONFIG_CMD_SATA) || \ 40 defined(CONFIG_CMD_SATA) || \
40 defined(CONFIG_CMD_SCSI) || \ 41 defined(CONFIG_CMD_SCSI) || \
41 defined(CONFIG_CMD_USB) || \ 42 defined(CONFIG_CMD_USB) || \
42 defined(CONFIG_MMC) || \ 43 defined(CONFIG_MMC) || \
43 defined(CONFIG_SYSTEMACE) ) 44 defined(CONFIG_SYSTEMACE) )
45#define HAVE_BLOCK_DEVICE
46#endif
44 47
45struct block_drvr { 48struct block_drvr {
46 char *name; 49 char *name;
@@ -71,6 +74,7 @@ static const struct block_drvr block_drvr[] = {
71 74
72DECLARE_GLOBAL_DATA_PTR; 75DECLARE_GLOBAL_DATA_PTR;
73 76
77#ifdef HAVE_BLOCK_DEVICE
74block_dev_desc_t *get_dev(const char *ifname, int dev) 78block_dev_desc_t *get_dev(const char *ifname, int dev)
75{ 79{
76 const struct block_drvr *drvr = block_drvr; 80 const struct block_drvr *drvr = block_drvr;
@@ -104,12 +108,7 @@ block_dev_desc_t *get_dev(const char *ifname, int dev)
104} 108}
105#endif 109#endif
106 110
107#if (defined(CONFIG_CMD_IDE) || \ 111#ifdef HAVE_BLOCK_DEVICE
108 defined(CONFIG_CMD_SATA) || \
109 defined(CONFIG_CMD_SCSI) || \
110 defined(CONFIG_CMD_USB) || \
111 defined(CONFIG_MMC) || \
112 defined(CONFIG_SYSTEMACE) )
113 112
114/* ------------------------------------------------------------------------- */ 113/* ------------------------------------------------------------------------- */
115/* 114/*
@@ -239,18 +238,7 @@ void dev_print (block_dev_desc_t *dev_desc)
239} 238}
240#endif 239#endif
241 240
242#if (defined(CONFIG_CMD_IDE) || \ 241#ifdef HAVE_BLOCK_DEVICE
243 defined(CONFIG_CMD_SATA) || \
244 defined(CONFIG_CMD_SCSI) || \
245 defined(CONFIG_CMD_USB) || \
246 defined(CONFIG_MMC) || \
247 defined(CONFIG_SYSTEMACE) )
248
249#if defined(CONFIG_MAC_PARTITION) || \
250 defined(CONFIG_DOS_PARTITION) || \
251 defined(CONFIG_ISO_PARTITION) || \
252 defined(CONFIG_AMIGA_PARTITION) || \
253 defined(CONFIG_EFI_PARTITION)
254 242
255void init_part (block_dev_desc_t * dev_desc) 243void init_part (block_dev_desc_t * dev_desc)
256{ 244{
@@ -293,6 +281,12 @@ void init_part (block_dev_desc_t * dev_desc)
293} 281}
294 282
295 283
284#if defined(CONFIG_MAC_PARTITION) || \
285 defined(CONFIG_DOS_PARTITION) || \
286 defined(CONFIG_ISO_PARTITION) || \
287 defined(CONFIG_AMIGA_PARTITION) || \
288 defined(CONFIG_EFI_PARTITION)
289
296static void print_part_header (const char *type, block_dev_desc_t * dev_desc) 290static void print_part_header (const char *type, block_dev_desc_t * dev_desc)
297{ 291{
298 puts ("\nPartition Map for "); 292 puts ("\nPartition Map for ");
@@ -326,6 +320,8 @@ static void print_part_header (const char *type, block_dev_desc_t * dev_desc)
326 dev_desc->dev, type); 320 dev_desc->dev, type);
327} 321}
328 322
323#endif /* any CONFIG_..._PARTITION */
324
329void print_part (block_dev_desc_t * dev_desc) 325void print_part (block_dev_desc_t * dev_desc)
330{ 326{
331 327
@@ -372,24 +368,12 @@ void print_part (block_dev_desc_t * dev_desc)
372 puts ("## Unknown partition table\n"); 368 puts ("## Unknown partition table\n");
373} 369}
374 370
375 371#endif /* HAVE_BLOCK_DEVICE */
376#else /* neither MAC nor DOS nor ISO nor AMIGA nor EFI partition configured */
377# error neither CONFIG_MAC_PARTITION nor CONFIG_DOS_PARTITION
378# error nor CONFIG_ISO_PARTITION nor CONFIG_AMIGA_PARTITION
379# error nor CONFIG_EFI_PARTITION configured!
380#endif
381
382#endif
383 372
384int get_partition_info(block_dev_desc_t *dev_desc, int part 373int get_partition_info(block_dev_desc_t *dev_desc, int part
385 , disk_partition_t *info) 374 , disk_partition_t *info)
386{ 375{
387#if defined(CONFIG_CMD_IDE) || \ 376#ifdef HAVE_BLOCK_DEVICE
388 defined(CONFIG_CMD_SATA) || \
389 defined(CONFIG_CMD_SCSI) || \
390 defined(CONFIG_CMD_USB) || \
391 defined(CONFIG_MMC) || \
392 defined(CONFIG_SYSTEMACE)
393 377
394#ifdef CONFIG_PARTITION_UUIDS 378#ifdef CONFIG_PARTITION_UUIDS
395 /* The common case is no UUID support */ 379 /* The common case is no UUID support */
@@ -444,7 +428,7 @@ int get_partition_info(block_dev_desc_t *dev_desc, int part
444 default: 428 default:
445 break; 429 break;
446 } 430 }
447#endif 431#endif /* HAVE_BLOCK_DEVICE */
448 432
449 return -1; 433 return -1;
450} 434}