aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorStefan Roese2008-08-06 07:05:38 -0500
committerStefan Roese2008-08-06 07:05:38 -0500
commitf2302d4430e7f3f48308d6a585320fe96af8afbd (patch)
treeeec529fa883a32b0bd44f65aa46a454dc5c69688 /api
parent9246f5ecfd353ae297a02ffd5328402acf16c9dd (diff)
downloadu-boot-f2302d4430e7f3f48308d6a585320fe96af8afbd.tar.gz
u-boot-f2302d4430e7f3f48308d6a585320fe96af8afbd.tar.xz
u-boot-f2302d4430e7f3f48308d6a585320fe96af8afbd.zip
Fix merge problems
Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'api')
-rw-r--r--api/api_storage.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/api/api_storage.c b/api/api_storage.c
index 7e6324044d..74391a59d0 100644
--- a/api/api_storage.c
+++ b/api/api_storage.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * (C) Copyright 2007 Semihalf 2 * (C) Copyright 2007-2008 Semihalf
3 * 3 *
4 * Written by: Rafal Jaworowski <raj@semihalf.com> 4 * Written by: Rafal Jaworowski <raj@semihalf.com>
5 * 5 *
@@ -46,14 +46,15 @@
46#define ENUM_USB 1 46#define ENUM_USB 1
47#define ENUM_SCSI 2 47#define ENUM_SCSI 2
48#define ENUM_MMC 3 48#define ENUM_MMC 3
49#define ENUM_MAX 4 49#define ENUM_SATA 4
50#define ENUM_MAX 5
50 51
51struct stor_spec { 52struct stor_spec {
52 int max_dev; 53 int max_dev;
53 int enum_started; 54 int enum_started;
54 int enum_ended; 55 int enum_ended;
55 int type; /* "external" type: DT_STOR_{IDE,USB,etc} */ 56 int type; /* "external" type: DT_STOR_{IDE,USB,etc} */
56 char name[4]; 57 char *name;
57}; 58};
58 59
59static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, "" }, }; 60static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, "" }, };
@@ -68,12 +69,19 @@ void dev_stor_init(void)
68 specs[ENUM_IDE].type = DEV_TYP_STOR | DT_STOR_IDE; 69 specs[ENUM_IDE].type = DEV_TYP_STOR | DT_STOR_IDE;
69 specs[ENUM_IDE].name = "ide"; 70 specs[ENUM_IDE].name = "ide";
70#endif 71#endif
71#if defined(CONFIG_CMD_USB) 72#if defined(CONFIG_CMD_MMC)
72 specs[ENUM_USB].max_dev = USB_MAX_STOR_DEV; 73 specs[ENUM_MMC].max_dev = CFG_MMC_MAX_DEVICE;
73 specs[ENUM_USB].enum_started = 0; 74 specs[ENUM_MMC].enum_started = 0;
74 specs[ENUM_USB].enum_ended = 0; 75 specs[ENUM_MMC].enum_ended = 0;
75 specs[ENUM_USB].type = DEV_TYP_STOR | DT_STOR_USB; 76 specs[ENUM_MMC].type = DEV_TYP_STOR | DT_STOR_MMC;
76 specs[ENUM_USB].name = "usb"; 77 specs[ENUM_MMC].name = "mmc";
78#endif
79#if defined(CONFIG_CMD_SATA)
80 specs[ENUM_SATA].max_dev = CFG_SATA_MAX_DEVICE;
81 specs[ENUM_SATA].enum_started = 0;
82 specs[ENUM_SATA].enum_ended = 0;
83 specs[ENUM_SATA].type = DEV_TYP_STOR | DT_STOR_SATA;
84 specs[ENUM_SATA].name = "sata";
77#endif 85#endif
78#if defined(CONFIG_CMD_SCSI) 86#if defined(CONFIG_CMD_SCSI)
79 specs[ENUM_SCSI].max_dev = CFG_SCSI_MAX_DEVICE; 87 specs[ENUM_SCSI].max_dev = CFG_SCSI_MAX_DEVICE;
@@ -82,6 +90,13 @@ void dev_stor_init(void)
82 specs[ENUM_SCSI].type = DEV_TYP_STOR | DT_STOR_SCSI; 90 specs[ENUM_SCSI].type = DEV_TYP_STOR | DT_STOR_SCSI;
83 specs[ENUM_SCSI].name = "scsi"; 91 specs[ENUM_SCSI].name = "scsi";
84#endif 92#endif
93#if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE)
94 specs[ENUM_USB].max_dev = USB_MAX_STOR_DEV;
95 specs[ENUM_USB].enum_started = 0;
96 specs[ENUM_USB].enum_ended = 0;
97 specs[ENUM_USB].type = DEV_TYP_STOR | DT_STOR_USB;
98 specs[ENUM_USB].name = "usb";
99#endif
85} 100}
86 101
87/* 102/*
@@ -108,7 +123,10 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
108 123
109 if (first) { 124 if (first) {
110 di->cookie = (void *)get_dev(specs[type].name, 0); 125 di->cookie = (void *)get_dev(specs[type].name, 0);
111 found = 1; 126 if (di->cookie == NULL)
127 return 0;
128 else
129 found = 1;
112 130
113 } else { 131 } else {
114 for (i = 0; i < specs[type].max_dev; i++) 132 for (i = 0; i < specs[type].max_dev; i++)
@@ -123,7 +141,10 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
123 } 141 }
124 142
125 di->cookie = (void *)get_dev(specs[type].name, i); 143 di->cookie = (void *)get_dev(specs[type].name, i);
126 found = 1; 144 if (di->cookie == NULL)
145 return 0;
146 else
147 found = 1;
127 148
128 /* provide hint if there are more devices in 149 /* provide hint if there are more devices in
129 * this group to enumerate */ 150 * this group to enumerate */
@@ -360,7 +381,7 @@ lbasize_t dev_read_stor(void *cookie, void *buf, lbasize_t len, lbastart_t start
360 return 0; 381 return 0;
361 382
362 if ((dd->block_read) == NULL) { 383 if ((dd->block_read) == NULL) {
363 debugf("no block_read() for device 0x%08x\n"); 384 debugf("no block_read() for device 0x%08x\n", cookie);
364 return 0; 385 return 0;
365 } 386 }
366 387