Print this page
12220 loader multi-console shouldn't override bootenv.rc

@@ -99,11 +99,11 @@
 bootops_t bootop;       /* simple bootops we'll pass on to kernel */
 struct bsys_mem bm;
 
 /*
  * Boot info from "glue" code in low memory. xbootp is used by:
- *      do_bop_phys_alloc(), do_bsys_alloc() and boot_prop_finish().
+ *      do_bop_phys_alloc(), do_bsys_alloc() and read_bootenvrc().
  */
 static struct xboot_info *xbootp;
 static uintptr_t next_virt;     /* next available virtual address */
 static paddr_t next_phys;       /* next available physical address from dboot */
 static paddr_t high_phys = -(paddr_t)1; /* last used physical address */

@@ -668,11 +668,11 @@
  * setprop name "value"
  *
  * we do single character I/O since this is really just looking at memory
  */
 void
-boot_prop_finish(void)
+read_bootenvrc(void)
 {
         int fd;
         char *line;
         int c;
         int bytes_read;

@@ -776,21 +776,36 @@
                     strlen(boot_args) > 0)
                         continue;
 
                 /*
                  * If a property was explicitly set on the command line
-                 * it will override a setting in bootenv.rc
+                 * it will override a setting in bootenv.rc. We make an
+                 * exception for a property from the bootloader such as:
+                 *
+                 * console="text,ttya,ttyb,ttyc,ttyd"
+                 *
+                 * In such a case, picking the first value here (as
+                 * lookup_console_devices() does) is at best a guess; if
+                 * bootenv.rc has a value, it's probably better.
                  */
-                if (do_bsys_getproplen(NULL, name) >= 0)
+                if (strcmp(name, "console") == 0) {
+                        char propval[BP_MAX_STRLEN] = "";
+
+                        if (do_bsys_getprop(NULL, name, propval) == -1 ||
+                            strchr(propval, ',') != NULL)
+                                bsetprops(name, value);
                         continue;
+                }
 
+                if (do_bsys_getproplen(NULL, name) == -1)
                 bsetprops(name, value);
         }
 done:
         if (fd >= 0)
                 (void) BRD_CLOSE(bfs_ops, fd);
 
+
         /*
          * Check if we have to limit the boot time allocator
          */
         if (do_bsys_getproplen(NULL, "physmem") != -1 &&
             do_bsys_getprop(NULL, "physmem", line) >= 0 &&

@@ -841,21 +856,21 @@
                         }
                 } else {
                         v_len = 0;
                 }
                 consoledev[v_len] = 0;
-                bcons_init2(inputdev, outputdev, consoledev);
+                bcons_post_bootenvrc(inputdev, outputdev, consoledev);
         } else {
                 /*
                  * Ensure console property exists
                  * If not create it as "hypervisor"
                  */
                 v_len = do_bsys_getproplen(NULL, "console");
                 if (v_len < 0)
                         bsetprops("console", "hypervisor");
                 inputdev = outputdev = consoledev = "hypervisor";
-                bcons_init2(inputdev, outputdev, consoledev);
+                bcons_post_bootenvrc(inputdev, outputdev, consoledev);
         }
 
         if (find_boot_prop("prom_debug") || kbm_debug)
                 boot_prop_display(line);
 }