summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-04-29 00:13:25 +0000
committerian <ian@FreeBSD.org>2014-04-29 00:13:25 +0000
commitd388ba01efb9e58cfeba4acc2950aa50b25a40f5 (patch)
treee8e7d5202bd521e65a33a130ab27a23713261f49
parenta021bcb6d43a549fe2b5173956251d84a05aa5ce (diff)
downloadFreeBSD-src-d388ba01efb9e58cfeba4acc2950aa50b25a40f5.zip
FreeBSD-src-d388ba01efb9e58cfeba4acc2950aa50b25a40f5.tar.gz
MFC r262326 (white space) and r262327 (fdt_addr).
This change was supposed to be whitespace only, but a functional change snuck in, as follows: Look for both fdtaddr and fdt_addr env var names. Grepping the u-boot source shows that board vendors seem to be about evenly split on this. The added lines were: /* Board vendors use both fdtaddr and fdt_addr names. Grrrr. */ if (s == NULL) s = ub_env_get("fdt_addr");
-rw-r--r--sys/boot/fdt/fdt_loader_cmd.c69
1 files changed, 36 insertions, 33 deletions
diff --git a/sys/boot/fdt/fdt_loader_cmd.c b/sys/boot/fdt/fdt_loader_cmd.c
index a5613ae..d8ad942 100644
--- a/sys/boot/fdt/fdt_loader_cmd.c
+++ b/sys/boot/fdt/fdt_loader_cmd.c
@@ -250,39 +250,42 @@ fdt_load_dtb_addr(struct fdt_header *header)
static int
fdt_setup_fdtp()
{
- struct preloaded_file *bfp;
- struct fdt_header *hdr;
- const char *s;
- char *p;
- vm_offset_t va;
-
- if ((bfp = file_findfile(NULL, "dtb")) != NULL) {
- printf("Using DTB from loaded file.\n");
- return fdt_load_dtb(bfp->f_addr);
- }
-
- if (fdt_to_load != NULL) {
- printf("Using DTB from memory address 0x%08X.\n",
- (unsigned int)fdt_to_load);
- return fdt_load_dtb_addr(fdt_to_load);
- }
-
- s = ub_env_get("fdtaddr");
- if (s != NULL && *s != '\0') {
- hdr = (struct fdt_header *)strtoul(s, &p, 16);
- if (*p == '\0') {
- printf("Using DTB provided by U-Boot.\n");
- return fdt_load_dtb_addr(hdr);
- }
- }
-
- if ((va = fdt_find_static_dtb()) != 0) {
- printf("Using DTB compiled into kernel.\n");
- return (fdt_load_dtb(va));
- }
-
- command_errmsg = "no device tree blob found!";
- return (1);
+ struct preloaded_file *bfp;
+ struct fdt_header *hdr;
+ const char *s;
+ char *p;
+ vm_offset_t va;
+
+ if ((bfp = file_findfile(NULL, "dtb")) != NULL) {
+ printf("Using DTB from loaded file.\n");
+ return fdt_load_dtb(bfp->f_addr);
+ }
+
+ if (fdt_to_load != NULL) {
+ printf("Using DTB from memory address 0x%08X.\n",
+ (unsigned int)fdt_to_load);
+ return fdt_load_dtb_addr(fdt_to_load);
+ }
+
+ /* Board vendors use both fdtaddr and fdt_addr names. Grrrr. */
+ s = ub_env_get("fdtaddr");
+ if (s == NULL)
+ s = ub_env_get("fdt_addr");
+ if (s != NULL && *s != '\0') {
+ hdr = (struct fdt_header *)strtoul(s, &p, 16);
+ if (*p == '\0') {
+ printf("Using DTB provided by U-Boot.\n");
+ return fdt_load_dtb_addr(hdr);
+ }
+ }
+
+ if ((va = fdt_find_static_dtb()) != 0) {
+ printf("Using DTB compiled into kernel.\n");
+ return (fdt_load_dtb(va));
+ }
+
+ command_errmsg = "no device tree blob found!";
+ return (1);
}
#define fdt_strtovect(str, cellbuf, lim, cellsize) _fdt_strtovect((str), \
OpenPOWER on IntegriCloud