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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/os/fakebop.c
          +++ new/usr/src/uts/i86pc/os/fakebop.c
↓ open down ↓ 93 lines elided ↑ open up ↑
  94   94          }
  95   95  
  96   96  /* callback to boot_fb to set shadow frame buffer */
  97   97  extern void boot_fb_shadow_init(bootops_t *);
  98   98  
  99   99  bootops_t bootop;       /* simple bootops we'll pass on to kernel */
 100  100  struct bsys_mem bm;
 101  101  
 102  102  /*
 103  103   * Boot info from "glue" code in low memory. xbootp is used by:
 104      - *      do_bop_phys_alloc(), do_bsys_alloc() and boot_prop_finish().
      104 + *      do_bop_phys_alloc(), do_bsys_alloc() and read_bootenvrc().
 105  105   */
 106  106  static struct xboot_info *xbootp;
 107  107  static uintptr_t next_virt;     /* next available virtual address */
 108  108  static paddr_t next_phys;       /* next available physical address from dboot */
 109  109  static paddr_t high_phys = -(paddr_t)1; /* last used physical address */
 110  110  
 111  111  /*
 112  112   * buffer for vsnprintf for console I/O
 113  113   */
 114  114  #define BUFFERSIZE      512
↓ open down ↓ 548 lines elided ↑ open up ↑
 663  663   * lines look like one of:
 664  664   * ^$
 665  665   * ^# comment till end of line
 666  666   * setprop name 'value'
 667  667   * setprop name value
 668  668   * setprop name "value"
 669  669   *
 670  670   * we do single character I/O since this is really just looking at memory
 671  671   */
 672  672  void
 673      -boot_prop_finish(void)
      673 +read_bootenvrc(void)
 674  674  {
 675  675          int fd;
 676  676          char *line;
 677  677          int c;
 678  678          int bytes_read;
 679  679          char *name;
 680  680          int n_len;
 681  681          char *value;
 682  682          int v_len;
 683  683          char *inputdev; /* these override the command line if serial ports */
↓ open down ↓ 87 lines elided ↑ open up ↑
 771  771                   * ignore "boot-file" property, it's now meaningless
 772  772                   */
 773  773                  if (strcmp(name, "boot-file") == 0)
 774  774                          continue;
 775  775                  if (strcmp(name, "boot-args") == 0 &&
 776  776                      strlen(boot_args) > 0)
 777  777                          continue;
 778  778  
 779  779                  /*
 780  780                   * If a property was explicitly set on the command line
 781      -                 * it will override a setting in bootenv.rc
      781 +                 * it will override a setting in bootenv.rc. We make an
      782 +                 * exception for a property from the bootloader such as:
      783 +                 *
      784 +                 * console="text,ttya,ttyb,ttyc,ttyd"
      785 +                 *
      786 +                 * In such a case, picking the first value here (as
      787 +                 * lookup_console_devices() does) is at best a guess; if
      788 +                 * bootenv.rc has a value, it's probably better.
 782  789                   */
 783      -                if (do_bsys_getproplen(NULL, name) >= 0)
      790 +                if (strcmp(name, "console") == 0) {
      791 +                        char propval[BP_MAX_STRLEN] = "";
      792 +
      793 +                        if (do_bsys_getprop(NULL, name, propval) == -1 ||
      794 +                            strchr(propval, ',') != NULL)
      795 +                                bsetprops(name, value);
 784  796                          continue;
      797 +                }
 785  798  
 786      -                bsetprops(name, value);
      799 +                if (do_bsys_getproplen(NULL, name) == -1)
      800 +                        bsetprops(name, value);
 787  801          }
 788  802  done:
 789  803          if (fd >= 0)
 790  804                  (void) BRD_CLOSE(bfs_ops, fd);
 791  805  
      806 +
 792  807          /*
 793  808           * Check if we have to limit the boot time allocator
 794  809           */
 795  810          if (do_bsys_getproplen(NULL, "physmem") != -1 &&
 796  811              do_bsys_getprop(NULL, "physmem", line) >= 0 &&
 797  812              parse_value(line, &lvalue) != -1) {
 798  813                  if (0 < lvalue && (lvalue < physmem || physmem == 0)) {
 799  814                          physmem = (pgcnt_t)lvalue;
 800  815                          DBG(physmem);
 801  816                  }
↓ open down ↓ 34 lines elided ↑ open up ↑
 836  851                          if (post_fastreboot &&
 837  852                              strcmp(consoledev, "graphics") == 0) {
 838  853                                  bsetprops("console", "text");
 839  854                                  v_len = strlen("text");
 840  855                                  bcopy("text", consoledev, v_len);
 841  856                          }
 842  857                  } else {
 843  858                          v_len = 0;
 844  859                  }
 845  860                  consoledev[v_len] = 0;
 846      -                bcons_init2(inputdev, outputdev, consoledev);
      861 +                bcons_post_bootenvrc(inputdev, outputdev, consoledev);
 847  862          } else {
 848  863                  /*
 849  864                   * Ensure console property exists
 850  865                   * If not create it as "hypervisor"
 851  866                   */
 852  867                  v_len = do_bsys_getproplen(NULL, "console");
 853  868                  if (v_len < 0)
 854  869                          bsetprops("console", "hypervisor");
 855  870                  inputdev = outputdev = consoledev = "hypervisor";
 856      -                bcons_init2(inputdev, outputdev, consoledev);
      871 +                bcons_post_bootenvrc(inputdev, outputdev, consoledev);
 857  872          }
 858  873  
 859  874          if (find_boot_prop("prom_debug") || kbm_debug)
 860  875                  boot_prop_display(line);
 861  876  }
 862  877  
 863  878  /*
 864  879   * print formatted output
 865  880   */
 866  881  /*ARGSUSED*/
↓ open down ↓ 2112 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX