projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sunxi: Add default zq value for sun9i (A80)
[oweals/u-boot.git]
/
api
/
api_storage.c
diff --git
a/api/api_storage.c
b/api/api_storage.c
index bc2b4d6b8cc76de796d98ecb69e1f581212df6b9..b5aaba1091e6d875eadb8bc5289f27e9bf14a5aa 100644
(file)
--- a/
api/api_storage.c
+++ b/
api/api_storage.c
@@
-41,7
+41,7
@@
struct stor_spec {
char *name;
};
char *name;
};
-static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0,
""
}, };
+static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0,
NULL
}, };
void dev_stor_init(void)
void dev_stor_init(void)
@@
-67,7
+67,7
@@
void dev_stor_init(void)
specs[ENUM_SATA].type = DEV_TYP_STOR | DT_STOR_SATA;
specs[ENUM_SATA].name = "sata";
#endif
specs[ENUM_SATA].type = DEV_TYP_STOR | DT_STOR_SATA;
specs[ENUM_SATA].name = "sata";
#endif
-#if defined(CONFIG_
CMD_
SCSI)
+#if defined(CONFIG_SCSI)
specs[ENUM_SCSI].max_dev = CONFIG_SYS_SCSI_MAX_DEVICE;
specs[ENUM_SCSI].enum_started = 0;
specs[ENUM_SCSI].enum_ended = 0;
specs[ENUM_SCSI].max_dev = CONFIG_SYS_SCSI_MAX_DEVICE;
specs[ENUM_SCSI].enum_started = 0;
specs[ENUM_SCSI].enum_ended = 0;
@@
-103,10
+103,14
@@
static int dev_stor_get(int type, int first, int *more, struct device_info *di)
int i;
int i;
- block_dev_desc_t *dd;
+ struct blk_desc *dd;
+
+ /* Wasn't configured for this type, return 0 directly */
+ if (specs[type].name == NULL)
+ return 0;
if (first) {
if (first) {
- di->cookie = (void *)get_dev(specs[type].name, 0);
+ di->cookie = (void *)
blk_
get_dev(specs[type].name, 0);
if (di->cookie == NULL)
return 0;
else
if (di->cookie == NULL)
return 0;
else
@@
-119,7
+123,8
@@
static int dev_stor_get(int type, int first, int *more, struct device_info *di)
} else {
for (i = 0; i < specs[type].max_dev; i++)
} else {
for (i = 0; i < specs[type].max_dev; i++)
- if (di->cookie == (void *)get_dev(specs[type].name, i)) {
+ if (di->cookie ==
+ (void *)blk_get_dev(specs[type].name, i)) {
/* previous cookie found -- advance to the
* next device, if possible */
/* previous cookie found -- advance to the
* next device, if possible */
@@
-129,7
+134,8
@@
static int dev_stor_get(int type, int first, int *more, struct device_info *di)
break;
}
break;
}
- di->cookie = (void *)get_dev(specs[type].name, i);
+ di->cookie = (void *)blk_get_dev(
+ specs[type].name, i);
if (di->cookie == NULL)
return 0;
else
if (di->cookie == NULL)
return 0;
else
@@
-148,7
+154,7
@@
static int dev_stor_get(int type, int first, int *more, struct device_info *di)
di->type = specs[type].type;
if (di->cookie != NULL) {
di->type = specs[type].type;
if (di->cookie != NULL) {
- dd = (
block_dev_desc_t
*)di->cookie;
+ dd = (
struct blk_desc
*)di->cookie;
if (dd->type == DEV_TYPE_UNKNOWN) {
debugf("device instance exists, but is not active..");
found = 0;
if (dd->type == DEV_TYPE_UNKNOWN) {
debugf("device instance exists, but is not active..");
found = 0;
@@
-166,15
+172,15
@@
static int dev_stor_get(int type, int first, int *more, struct device_info *di)
/*
/*
- * returns: ENUM_IDE, ENUM_USB etc. based on
block_dev_desc_t
+ * returns: ENUM_IDE, ENUM_USB etc. based on
struct blk_desc
*/
*/
-static int dev_stor_type(
block_dev_desc_t
*dd)
+static int dev_stor_type(
struct blk_desc
*dd)
{
int i, j;
for (i = ENUM_IDE; i < ENUM_MAX; i++)
for (j = 0; j < specs[i].max_dev; j++)
{
int i, j;
for (i = ENUM_IDE; i < ENUM_MAX; i++)
for (j = 0; j < specs[i].max_dev; j++)
- if (dd == get_dev(specs[i].name, j))
+ if (dd ==
blk_
get_dev(specs[i].name, j))
return i;
return ENUM_MAX;
return i;
return ENUM_MAX;
@@
-308,12
+314,12
@@
int dev_enum_storage(struct device_info *di)
return 0;
}
return 0;
}
-static int dev_stor_is_valid(int type,
block_dev_desc_t
*dd)
+static int dev_stor_is_valid(int type,
struct blk_desc
*dd)
{
int i;
for (i = 0; i < specs[type].max_dev; i++)
{
int i;
for (i = 0; i < specs[type].max_dev; i++)
- if (dd == get_dev(specs[type].name, i))
+ if (dd ==
blk_
get_dev(specs[type].name, i))
if (dd->type != DEV_TYPE_UNKNOWN)
return 1;
if (dd->type != DEV_TYPE_UNKNOWN)
return 1;
@@
-328,7
+334,7
@@
int dev_open_stor(void *cookie)
if (type == ENUM_MAX)
return API_ENODEV;
if (type == ENUM_MAX)
return API_ENODEV;
- if (dev_stor_is_valid(type, (
block_dev_desc_t
*)cookie))
+ if (dev_stor_is_valid(type, (
struct blk_desc
*)cookie))
return 0;
return API_ENODEV;
return 0;
return API_ENODEV;
@@
-348,7
+354,7
@@
int dev_close_stor(void *cookie)
lbasize_t dev_read_stor(void *cookie, void *buf, lbasize_t len, lbastart_t start)
{
int type;
lbasize_t dev_read_stor(void *cookie, void *buf, lbasize_t len, lbastart_t start)
{
int type;
-
block_dev_desc_t *dd = (block_dev_desc_t
*)cookie;
+
struct blk_desc *dd = (struct blk_desc
*)cookie;
if ((type = dev_stor_type(dd)) == ENUM_MAX)
return 0;
if ((type = dev_stor_type(dd)) == ENUM_MAX)
return 0;