freebsd-ports/sysutils/u-boot-cubieboard/files/patch-api_api__storage.c
Luiz Otavio O Souza ae95160278 Adds the U-Boot loader for Banana pi, Cubieboard and Cubieboard2.
This version is patched so that:
 * ELF and API features are enabled.
 * The default environment is trimmed to just what's needed to boot.
 * The saveenv command writes to the file u-boot.env on the FAT partition.
 * The DTB file name is chosen based on the board model and passed to ubldr
   using the fdtfile env variable. ubldr loads the DTB from /boot/dtb/ on
   the FreeBSD partition.
 * By default, it loads ELF ubldr from file ubldr on the FAT partition to
   address 0x42000000, and launches it.

For information about running FreeBSD on Allwinner SoCs, see
 https://wiki.freebsd.org/FreeBSD/arm/Allwinner

Differential Revision:	https://reviews.freebsd.org/D2874
Reviewed by:	garga
Approved by:	garga
2015-07-06 19:50:03 +00:00

28 lines
803 B
C

--- api/api_storage.c.orig 2015-04-13 14:53:03 UTC
+++ api/api_storage.c
@@ -107,10 +107,13 @@ static int dev_stor_get(int type, int fi
if (first) {
di->cookie = (void *)get_dev(specs[type].name, 0);
- if (di->cookie == NULL)
+ if (di->cookie == NULL) {
return 0;
- else
+ } else {
found = 1;
+ if (specs[type].max_dev > 1)
+ *more = 1;
+ }
} else {
for (i = 0; i < specs[type].max_dev; i++)
@@ -146,7 +149,8 @@ static int dev_stor_get(int type, int fi
dd = (block_dev_desc_t *)di->cookie;
if (dd->type == DEV_TYPE_UNKNOWN) {
debugf("device instance exists, but is not active..");
- found = 0;
+ di->di_stor.block_count = 0;
+ di->di_stor.block_size = 0;
} else {
di->di_stor.block_count = dd->lba;
di->di_stor.block_size = dd->blksz;