]> git.sur5r.net Git - u-boot/blobdiff - common/fdt_support.c
x86: acpi: Return table length in acpi_create_madt_lapics()
[u-boot] / common / fdt_support.c
index 48faba9fefbbb33e63f7617846a6001376c00f2e..42e5d8a1d2f697ae9509d1767fce7a7a28a00a2b 100644 (file)
@@ -131,18 +131,6 @@ static int fdt_fixup_stdout(void *fdt, int chosenoff)
                              OF_STDOUT_PATH, strlen(OF_STDOUT_PATH) + 1);
 }
 #elif defined(CONFIG_OF_STDOUT_VIA_ALIAS) && defined(CONFIG_CONS_INDEX)
-static void fdt_fill_multisername(char *sername, size_t maxlen)
-{
-       const char *outname = stdio_devices[stdout]->name;
-
-       if (strcmp(outname, "serial") > 0)
-               strncpy(sername, outname, maxlen);
-
-       /* eserial? */
-       if (strcmp(outname + 1, "serial") > 0)
-               strncpy(sername, outname + 1, maxlen);
-}
-
 static int fdt_fixup_stdout(void *fdt, int chosenoff)
 {
        int err;
@@ -152,9 +140,7 @@ static int fdt_fixup_stdout(void *fdt, int chosenoff)
        int len;
        char tmp[256]; /* long enough */
 
-       fdt_fill_multisername(sername, sizeof(sername) - 1);
-       if (!sername[0])
-               sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1);
+       sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1);
 
        aliasoff = fdt_path_offset(fdt, "/aliases");
        if (aliasoff < 0) {
@@ -481,23 +467,31 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)
 
 void fdt_fixup_ethernet(void *fdt)
 {
-       int node, i, j;
+       int i, j, prop;
        char *tmp, *end;
        char mac[16];
        const char *path;
        unsigned char mac_addr[6];
        int offset;
 
-       node = fdt_path_offset(fdt, "/aliases");
-       if (node < 0)
+       if (fdt_path_offset(fdt, "/aliases") < 0)
                return;
 
-       for (offset = fdt_first_property_offset(fdt, node);
-            offset > 0;
-            offset = fdt_next_property_offset(fdt, offset)) {
+       /* Cycle through all aliases */
+       for (prop = 0; ; prop++) {
                const char *name;
                int len = strlen("ethernet");
 
+               /* FDT might have been edited, recompute the offset */
+               offset = fdt_first_property_offset(fdt,
+                       fdt_path_offset(fdt, "/aliases"));
+               /* Select property number 'prop' */
+               for (i = 0; i < prop; i++)
+                       offset = fdt_next_property_offset(fdt, offset);
+
+               if (offset < 0)
+                       break;
+
                path = fdt_getprop_by_offset(fdt, offset, &name, NULL);
                if (!strncmp(name, "ethernet", len)) {
                        i = trailing_strtol(name);