summaryrefslogtreecommitdiffstats
path: root/sys/boot/uboot/lib
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/uboot/lib')
-rw-r--r--sys/boot/uboot/lib/api_public.h2
-rw-r--r--sys/boot/uboot/lib/disk.c23
-rw-r--r--sys/boot/uboot/lib/glue.c4
-rw-r--r--sys/boot/uboot/lib/libuboot.h4
4 files changed, 29 insertions, 4 deletions
diff --git a/sys/boot/uboot/lib/api_public.h b/sys/boot/uboot/lib/api_public.h
index 9537479..f393de8 100644
--- a/sys/boot/uboot/lib/api_public.h
+++ b/sys/boot/uboot/lib/api_public.h
@@ -132,7 +132,7 @@ typedef unsigned long lbastart_t;
#define DT_STOR_SCSI 0x0020
#define DT_STOR_USB 0x0040
#define DT_STOR_MMC 0x0080
-#define DT_STOR_NAND 0x0100
+#define DT_STOR_SATA 0x0100
#define DEV_STA_CLOSED 0x0000 /* invalid, closed */
#define DEV_STA_OPEN 0x0001 /* open i.e. active */
diff --git a/sys/boot/uboot/lib/disk.c b/sys/boot/uboot/lib/disk.c
index 62b3132..4681e1b 100644
--- a/sys/boot/uboot/lib/disk.c
+++ b/sys/boot/uboot/lib/disk.c
@@ -278,3 +278,26 @@ stor_ioctl(struct open_file *f, u_long cmd, void *data)
return (0);
}
+
+/*
+ * Return the device unit number for the given type and type-relative unit
+ * number.
+ */
+int
+uboot_diskgetunit(int type, int type_unit)
+{
+ int local_type_unit;
+ int i;
+
+ local_type_unit = 0;
+ for (i = 0; i < stor_info_no; i++) {
+ if ((stor_info[i].type & type) == type) {
+ if (local_type_unit == type_unit) {
+ return (i);
+ }
+ local_type_unit++;
+ }
+ }
+
+ return (-1);
+}
diff --git a/sys/boot/uboot/lib/glue.c b/sys/boot/uboot/lib/glue.c
index f389f11..d01e33b 100644
--- a/sys/boot/uboot/lib/glue.c
+++ b/sys/boot/uboot/lib/glue.c
@@ -404,8 +404,8 @@ ub_stor_type(int type)
if (type & DT_STOR_MMC)
return ("MMC");
- if (type & DT_STOR_NAND)
- return ("NAND");
+ if (type & DT_STOR_SATA)
+ return ("SATA");
return ("Unknown");
}
diff --git a/sys/boot/uboot/lib/libuboot.h b/sys/boot/uboot/lib/libuboot.h
index bf07ad3..82410a0 100644
--- a/sys/boot/uboot/lib/libuboot.h
+++ b/sys/boot/uboot/lib/libuboot.h
@@ -32,9 +32,9 @@ struct uboot_devdesc
struct devsw *d_dev;
int d_type;
int d_unit;
+ void *d_opendata;
union {
struct {
- void *data;
int slice;
int partition;
off_t offset;
@@ -70,6 +70,8 @@ extern struct file_format uboot_elf;
void reboot(void);
+int uboot_diskgetunit(int type, int type_unit);
+
#if defined(LOADER_FDT_SUPPORT)
extern int fdt_setup_fdtp();
extern int fdt_copy(vm_offset_t);
OpenPOWER on IntegriCloud