Print this page
NEX-16819 loader UEFI support
Includes work by Toomas Soome <tsoome@me.com>
Upstream commits:
    loader: pxe receive cleanup
    9475 libefi: Do not return only if ReceiveFilter
    installboot: should support efi system partition
    8931 boot1.efi: scan all display modes rather than
    loader: spinconsole updates
    loader: gfx experiment to try GOP Blt() function.
    sha1 build test
    loader: add sha1 hash calculation
    common/sha1: update for loader build
    loader: biosdisk rework
    uts: 32-bit kernel FB needs mapping in low memory
    uts: add diag-device
    uts: boot console mirror with diag-device
    uts: enable very early console on ttya
    kmdb: add diag-device as input/output device
    uts: test VGA memory exclusion from mapping
    uts: clear boot mapping and protect boot pages test
    uts: add dboot map debug printf
    uts: need to release FB pages in release_bootstrap()
    uts: add screenmap ioctl
    uts: update sys/queue.h
    loader: add illumos uts/common to include path
    loader: tem/gfx font cleanup
    loader: vbe checks
    uts: gfx_private set KD_TEXT when KD_RESETTEXT is
    uts: gfx 8-bit update
    loader: gfx 8-bit fix
    loader: always set media size from partition.
    uts: MB2 support for 32-bit kernel
    loader: x86 should have tem 80x25
    uts: x86 should have tem 80x25
    uts: font update
    loader: font update
    uts: tem attributes
    loader: tem.c comment added
    uts: use font module
    loader: add font module
    loader: build rules for new font setup
    uts: gfx_private update for new font structure
    uts: early boot update for new font structure
    uts: font update
    uts: font build rules update for new fonts
    uts: tem update to new font structure
    loader: module.c needs to include tem_impl.h
    uts: gfx_private 8x16 font rework
    uts: make font_lookup public
    loader: font rework
    uts: font rework
    9259 libefi: efi_alloc_and_read should check for PMBR
    uts: tem utf-8 support
    loader: implement tem utf-8 support
    loader: tem should be able to display UTF-8
    7784 uts: console input should support utf-8
    7796 uts: ldterm default to utf-8
    uts: do not reset serial console
    uts: set up colors even if tem is not console
    uts: add type for early boot properties
    uts: gfx_private experiment with drm and vga
    uts: gfx_private should use setmode drm callback.
    uts: identify FB types and set up gfx_private based
    loader: replace gop and vesa with framebuffer
    uts: boot needs simple tem to support mdb
    uts: boot_keyboard should emit esc sequences for
    uts: gfx_private FB showuld be written by line
    kmdb: set terminal window size
    uts: gfx_private needs to keep track of early boot FB
    pnglite: move pnglite to usr/src/common
    loader: gfx_fb
    ficl-sys: add gfx primitives
    loader: add illumos.png logo
    ficl: add fb-putimage
    loader: add png support
    loader: add alpha blending for gfx_fb
    loader: use term-drawrect for menu frame
    ficl: add simple gfx words
    uts: provide fb_info via fbgattr dev_specific array.
    uts: gfx_private add alpha blending
    uts: update sys/ascii.h
    uts: tem OSC support (incomplete)
    uts: implement env module support and use data from
    uts: tem get colors from early boot data
    loader: use crc32 from libstand (libz)
    loader: optimize for size
    loader: pass tem info to the environment
    loader: import tem for loader console
    loader: UEFI loader needs to set ISADIR based on
    loader: need UEFI32 support
    8918 loader.efi: add vesa edid support
    uts: tem_safe_pix_clear_prom_output() should only
    uts: tem_safe_pix_clear_entire_screen() should use
    uts: tem_safe_check_first_time() should query cursor
    uts: tem implement cls callback & visual_io v4
    uts: gfx_vgatext use block cursor for vgatext
    uts: gfx_private implement cls callback & visual_io
    uts: gfx_private bitmap framebuffer implementation
    uts: early start frame buffer console support
    uts: font functions should check the input char
    uts: font rendering should support 16/24/32bit depths
    uts: use smallest font as fallback default.
    uts: update terminal dimensions based on selected
    7834 uts: vgatext should use gfx_private
    uts: add spacing property to 8859-1.bdf
    terminfo: add underline for sun-color
    terminfo: sun-color has 16 colors
    uts: add font load callback type
    loader: do not repeat int13 calls with error 0x20 and
    8905 loader: add skein/edonr support
    8904 common/crypto: make skein and edonr loader
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Revert "NEX-16819 loader UEFI support"
This reverts commit ec06b9fc617b99234e538bf2e7e4d02a24993e0c.
Reverting due to failures in the zfs-tests and the sharefs-tests
NEX-16819 loader UEFI support
Includes work by Toomas Soome <tsoome@me.com>
Upstream commits:
    loader: pxe receive cleanup
    9475 libefi: Do not return only if ReceiveFilter
    installboot: should support efi system partition
    8931 boot1.efi: scan all display modes rather than
    loader: spinconsole updates
    loader: gfx experiment to try GOP Blt() function.
    sha1 build test
    loader: add sha1 hash calculation
    common/sha1: update for loader build
    loader: biosdisk rework
    uts: 32-bit kernel FB needs mapping in low memory
    uts: add diag-device
    uts: boot console mirror with diag-device
    uts: enable very early console on ttya
    kmdb: add diag-device as input/output device
    uts: test VGA memory exclusion from mapping
    uts: clear boot mapping and protect boot pages test
    uts: add dboot map debug printf
    uts: need to release FB pages in release_bootstrap()
    uts: add screenmap ioctl
    uts: update sys/queue.h
    loader: add illumos uts/common to include path
    loader: tem/gfx font cleanup
    loader: vbe checks
    uts: gfx_private set KD_TEXT when KD_RESETTEXT is
    uts: gfx 8-bit update
    loader: gfx 8-bit fix
    loader: always set media size from partition.
    uts: MB2 support for 32-bit kernel
    loader: x86 should have tem 80x25
    uts: x86 should have tem 80x25
    uts: font update
    loader: font update
    uts: tem attributes
    loader: tem.c comment added
    uts: use font module
    loader: add font module
    loader: build rules for new font setup
    uts: gfx_private update for new font structure
    uts: early boot update for new font structure
    uts: font update
    uts: font build rules update for new fonts
    uts: tem update to new font structure
    loader: module.c needs to include tem_impl.h
    uts: gfx_private 8x16 font rework
    uts: make font_lookup public
    loader: font rework
    uts: font rework
    libefi: efi_alloc_and_read should check for PMBR
    uts: tem utf-8 support
    loader: implement tem utf-8 support
    loader: tem should be able to display UTF-8
    7784 uts: console input should support utf-8
    7796 uts: ldterm default to utf-8
    uts: do not reset serial console
    uts: set up colors even if tem is not console
    uts: add type for early boot properties
    uts: gfx_private experiment with drm and vga
    uts: gfx_private should use setmode drm callback.
    uts: identify FB types and set up gfx_private based
    loader: replace gop and vesa with framebuffer
    uts: boot needs simple tem to support mdb
    uts: boot_keyboard should emit esc sequences for
    uts: gfx_private FB showuld be written by line
    kmdb: set terminal window size
    uts: gfx_private needs to keep track of early boot FB
    pnglite: move pnglite to usr/src/common
    loader: gfx_fb
    ficl-sys: add gfx primitives
    loader: add illumos.png logo
    ficl: add fb-putimage
    loader: add png support
    loader: add alpha blending for gfx_fb
    loader: use term-drawrect for menu frame
    ficl: add simple gfx words
    uts: provide fb_info via fbgattr dev_specific array.
    uts: gfx_private add alpha blending
    uts: update sys/ascii.h
    uts: tem OSC support (incomplete)
    uts: implement env module support and use data from
    uts: tem get colors from early boot data
    loader: use crc32 from libstand (libz)
    loader: optimize for size
    loader: pass tem info to the environment
    loader: import tem for loader console
    loader: UEFI loader needs to set ISADIR based on
    loader: need UEFI32 support
    8918 loader.efi: add vesa edid support
    uts: tem_safe_pix_clear_prom_output() should only
    uts: tem_safe_pix_clear_entire_screen() should use
    uts: tem_safe_check_first_time() should query cursor
    uts: tem implement cls callback & visual_io v4
    uts: gfx_vgatext use block cursor for vgatext
    uts: gfx_private implement cls callback & visual_io
    uts: gfx_private bitmap framebuffer implementation
    uts: early start frame buffer console support
    uts: font functions should check the input char
    uts: font rendering should support 16/24/32bit depths
    uts: use smallest font as fallback default.
    uts: update terminal dimensions based on selected
    7834 uts: vgatext should use gfx_private
    uts: add spacing property to 8859-1.bdf
    terminfo: add underline for sun-color
    terminfo: sun-color has 16 colors
    uts: add font load callback type
    loader: do not repeat int13 calls with error 0x20 and
    8905 loader: add skein/edonr support
    8904 common/crypto: make skein and edonr loader
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/os/fakebop.c
          +++ new/usr/src/uts/i86pc/os/fakebop.c
↓ open down ↓ 42 lines elided ↑ open up ↑
  43   43  #include <sys/multiboot2.h>
  44   44  #include <sys/multiboot2_impl.h>
  45   45  #include <sys/bootvfs.h>
  46   46  #include <sys/bootprops.h>
  47   47  #include <sys/varargs.h>
  48   48  #include <sys/param.h>
  49   49  #include <sys/machparam.h>
  50   50  #include <sys/machsystm.h>
  51   51  #include <sys/archsystm.h>
  52   52  #include <sys/boot_console.h>
       53 +#include <sys/framebuffer.h>
  53   54  #include <sys/cmn_err.h>
  54   55  #include <sys/systm.h>
  55   56  #include <sys/promif.h>
  56   57  #include <sys/archsystm.h>
  57   58  #include <sys/x86_archext.h>
  58   59  #include <sys/kobj.h>
  59   60  #include <sys/privregs.h>
  60   61  #include <sys/sysmacros.h>
  61   62  #include <sys/ctype.h>
  62   63  #include <sys/fastboot.h>
↓ open down ↓ 2 lines elided ↑ open up ↑
  65   66  #include <net/if.h>
  66   67  #endif
  67   68  #include <vm/kboot_mmu.h>
  68   69  #include <vm/hat_pte.h>
  69   70  #include <sys/kobj.h>
  70   71  #include <sys/kobj_lex.h>
  71   72  #include <sys/pci_cfgspace_impl.h>
  72   73  #include <sys/fastboot_impl.h>
  73   74  #include <sys/acpi/acconfig.h>
  74   75  #include <sys/acpi/acpi.h>
       76 +#include <sys/ddipropdefs.h>    /* For DDI prop types */
  75   77  
  76   78  static int have_console = 0;    /* set once primitive console is initialized */
  77   79  static char *boot_args = "";
  78   80  
  79   81  /*
  80   82   * Debugging macros
  81   83   */
  82   84  static uint_t kbm_debug = 0;
  83   85  #define DBG_MSG(s)      { if (kbm_debug) bop_printf(NULL, "%s", s); }
  84   86  #define DBG(x)          { if (kbm_debug)                        \
  85   87          bop_printf(NULL, "%s is %" PRIx64 "\n", #x, (uint64_t)(x));     \
  86   88          }
  87   89  
  88   90  #define PUT_STRING(s) {                         \
  89   91          char *cp;                               \
  90   92          for (cp = (s); *cp; ++cp)               \
  91   93                  bcons_putchar(*cp);             \
  92   94          }
  93   95  
       96 +/* callback to boot_fb to set shadow frame buffer */
       97 +extern void boot_fb_shadow_init(bootops_t *);
       98 +
  94   99  bootops_t bootop;       /* simple bootops we'll pass on to kernel */
  95  100  struct bsys_mem bm;
  96  101  
  97  102  /*
  98  103   * Boot info from "glue" code in low memory. xbootp is used by:
  99  104   *      do_bop_phys_alloc(), do_bsys_alloc() and boot_prop_finish().
 100  105   */
 101  106  static struct xboot_info *xbootp;
 102  107  static uintptr_t next_virt;     /* next available virtual address */
 103  108  static paddr_t next_phys;       /* next available physical address from dboot */
↓ open down ↓ 4 lines elided ↑ open up ↑
 108  113   */
 109  114  #define BUFFERSIZE      512
 110  115  static char buffer[BUFFERSIZE];
 111  116  
 112  117  /*
 113  118   * stuff to store/report/manipulate boot property settings.
 114  119   */
 115  120  typedef struct bootprop {
 116  121          struct bootprop *bp_next;
 117  122          char *bp_name;
 118      -        uint_t bp_vlen;
      123 +        int bp_flags;                   /* DDI prop type */
      124 +        uint_t bp_vlen;                 /* 0 for boolean */
 119  125          char *bp_value;
 120  126  } bootprop_t;
 121  127  
 122  128  static bootprop_t *bprops = NULL;
 123  129  static char *curr_page = NULL;          /* ptr to avail bprop memory */
 124  130  static int curr_space = 0;              /* amount of memory at curr_page */
 125  131  
 126  132  #ifdef __xpv
 127  133  start_info_t *xen_info;
 128  134  shared_info_t *HYPERVISOR_shared_info;
↓ open down ↓ 216 lines elided ↑ open up ↑
 345  351  static caddr_t
 346  352  do_bsys_ealloc(bootops_t *bop, caddr_t virthint, size_t size,
 347  353      int align, int flags)
 348  354  {
 349  355          prom_panic("unsupported call to BOP_EALLOC()\n");
 350  356          return (0);
 351  357  }
 352  358  
 353  359  
 354  360  static void
 355      -bsetprop(char *name, int nlen, void *value, int vlen)
      361 +bsetprop(int flags, char *name, int nlen, void *value, int vlen)
 356  362  {
 357  363          uint_t size;
 358  364          uint_t need_size;
 359  365          bootprop_t *b;
 360  366  
 361  367          /*
 362  368           * align the size to 16 byte boundary
 363  369           */
 364  370          size = sizeof (bootprop_t) + nlen + 1 + vlen;
 365  371          size = (size + 0xf) & ~0xf;
↓ open down ↓ 15 lines elided ↑ open up ↑
 381  387          /*
 382  388           * follow by name and ending zero byte
 383  389           */
 384  390          b->bp_name = curr_page;
 385  391          bcopy(name, curr_page, nlen);
 386  392          curr_page += nlen;
 387  393          *curr_page++ = 0;
 388  394          curr_space -= nlen + 1;
 389  395  
 390  396          /*
      397 +         * set the property type
      398 +         */
      399 +        b->bp_flags = flags & DDI_PROP_TYPE_MASK;
      400 +
      401 +        /*
 391  402           * copy in value, but no ending zero byte
 392  403           */
 393  404          b->bp_value = curr_page;
 394  405          b->bp_vlen = vlen;
 395  406          if (vlen > 0) {
 396  407                  bcopy(value, curr_page, vlen);
 397  408                  curr_page += vlen;
 398  409                  curr_space -= vlen;
 399  410          }
 400  411  
↓ open down ↓ 2 lines elided ↑ open up ↑
 403  414           */
 404  415          while (curr_space & 0xf) {
 405  416                  ++curr_page;
 406  417                  --curr_space;
 407  418          }
 408  419  }
 409  420  
 410  421  static void
 411  422  bsetprops(char *name, char *value)
 412  423  {
 413      -        bsetprop(name, strlen(name), value, strlen(value) + 1);
      424 +        bsetprop(DDI_PROP_TYPE_STRING, name, strlen(name),
      425 +            value, strlen(value) + 1);
 414  426  }
 415  427  
 416  428  static void
      429 +bsetprop32(char *name, uint32_t value)
      430 +{
      431 +        bsetprop(DDI_PROP_TYPE_INT, name, strlen(name),
      432 +            (void *)&value, sizeof (value));
      433 +}
      434 +
      435 +static void
 417  436  bsetprop64(char *name, uint64_t value)
 418  437  {
 419      -        bsetprop(name, strlen(name), (void *)&value, sizeof (value));
      438 +        bsetprop(DDI_PROP_TYPE_INT64, name, strlen(name),
      439 +            (void *)&value, sizeof (value));
 420  440  }
 421  441  
 422  442  static void
 423  443  bsetpropsi(char *name, int value)
 424  444  {
 425  445          char prop_val[32];
 426  446  
 427  447          (void) snprintf(prop_val, sizeof (prop_val), "%d", value);
 428  448          bsetprops(name, prop_val);
 429  449  }
 430  450  
 431  451  /*
      452 + * to find the type of the value associated with this name
      453 + */
      454 +/*ARGSUSED*/
      455 +int
      456 +do_bsys_getproptype(bootops_t *bop, const char *name)
      457 +{
      458 +        bootprop_t *b;
      459 +
      460 +        for (b = bprops; b; b = b->bp_next) {
      461 +                if (strcmp(name, b->bp_name) != 0)
      462 +                        continue;
      463 +                return (b->bp_flags);
      464 +        }
      465 +        return (-1);
      466 +}
      467 +
      468 +/*
 432  469   * to find the size of the buffer to allocate
 433  470   */
 434  471  /*ARGSUSED*/
 435  472  int
 436  473  do_bsys_getproplen(bootops_t *bop, const char *name)
 437  474  {
 438  475          bootprop_t *b;
 439  476  
 440  477          for (b = bprops; b; b = b->bp_next) {
 441  478                  if (strcmp(name, b->bp_name) != 0)
↓ open down ↓ 119 lines elided ↑ open up ↑
 561  598  
 562  599  /*
 563  600   * Print out information about all boot properties.
 564  601   * buffer is pointer to pre-allocated space to be used as temporary
 565  602   * space for property values.
 566  603   */
 567  604  static void
 568  605  boot_prop_display(char *buffer)
 569  606  {
 570  607          char *name = "";
 571      -        int i, len;
      608 +        int i, len, flags, *buf32;
      609 +        uint64_t *buf64;
 572  610  
 573  611          bop_printf(NULL, "\nBoot properties:\n");
 574  612  
 575  613          while ((name = do_bsys_nextprop(NULL, name)) != NULL) {
 576  614                  bop_printf(NULL, "\t0x%p %s = ", (void *)name, name);
 577  615                  (void) do_bsys_getprop(NULL, name, buffer);
 578  616                  len = do_bsys_getproplen(NULL, name);
      617 +                flags = do_bsys_getproptype(NULL, name);
 579  618                  bop_printf(NULL, "len=%d ", len);
 580      -                if (!unprintable(buffer, len)) {
 581      -                        buffer[len] = 0;
 582      -                        bop_printf(NULL, "%s\n", buffer);
 583      -                        continue;
      619 +
      620 +                switch (flags) {
      621 +                case DDI_PROP_TYPE_INT:
      622 +                        len = len / sizeof (int);
      623 +                        buf32 = (int *)buffer;
      624 +                        for (i = 0; i < len; i++) {
      625 +                                bop_printf(NULL, "%08x", buf32[i]);
      626 +                                if (i < len - 1)
      627 +                                        bop_printf(NULL, ".");
      628 +                        }
      629 +                        break;
      630 +                case DDI_PROP_TYPE_STRING:
      631 +                        bop_printf(NULL, buffer);
      632 +                        break;
      633 +                case DDI_PROP_TYPE_INT64:
      634 +                        len = len / sizeof (uint64_t);
      635 +                        buf64 = (uint64_t *)buffer;
      636 +                        for (i = 0; i < len; i++) {
      637 +                                bop_printf(NULL, "%016" PRIx64, buf64[i]);
      638 +                                if (i < len - 1)
      639 +                                        bop_printf(NULL, ".");
      640 +                        }
      641 +                        break;
      642 +                default:
      643 +                        if (!unprintable(buffer, len)) {
      644 +                                buffer[len] = 0;
      645 +                                bop_printf(NULL, "%s", buffer);
      646 +                                break;
      647 +                        }
      648 +                        for (i = 0; i < len; i++) {
      649 +                                bop_printf(NULL, "%02x", buffer[i] & 0xff);
      650 +                                if (i < len - 1)
      651 +                                        bop_printf(NULL, ".");
      652 +                        }
      653 +                        break;
 584  654                  }
 585      -                for (i = 0; i < len; i++) {
 586      -                        bop_printf(NULL, "%02x", buffer[i] & 0xff);
 587      -                        if (i < len - 1)
 588      -                                bop_printf(NULL, ".");
 589      -                }
 590  655                  bop_printf(NULL, "\n");
 591  656          }
 592  657  }
 593  658  
 594  659  /*
 595  660   * 2nd part of building the table of boot properties. This includes:
 596  661   * - values from /boot/solaris/bootenv.rc (ie. eeprom(1m) values)
 597  662   *
 598  663   * lines look like one of:
 599  664   * ^$
↓ open down ↓ 107 lines elided ↑ open up ↑
 707  772                  if (strcmp(name, "boot-file") == 0)
 708  773                          continue;
 709  774                  if (strcmp(name, "boot-args") == 0 &&
 710  775                      strlen(boot_args) > 0)
 711  776                          continue;
 712  777  
 713  778                  /*
 714  779                   * If a property was explicitly set on the command line
 715  780                   * it will override a setting in bootenv.rc
 716  781                   */
 717      -                if (do_bsys_getproplen(NULL, name) > 0)
      782 +                if (do_bsys_getproplen(NULL, name) >= 0)
 718  783                          continue;
 719  784  
 720      -                bsetprop(name, n_len, value, v_len + 1);
      785 +                bsetprops(name, value);
 721  786          }
 722  787  done:
 723  788          if (fd >= 0)
 724  789                  (void) BRD_CLOSE(bfs_ops, fd);
 725  790  
 726  791          /*
 727  792           * Check if we have to limit the boot time allocator
 728  793           */
 729  794          if (do_bsys_getproplen(NULL, "physmem") != -1 &&
 730  795              do_bsys_getprop(NULL, "physmem", line) >= 0 &&
↓ open down ↓ 253 lines elided ↑ open up ↑
 984 1049  static void
 985 1050  xen_nfsroot_props(char *s)
 986 1051  {
 987 1052          char *prop_map[] = {
 988 1053                  BP_SERVER_IP,   /* server IP address */
 989 1054                  BP_SERVER_NAME, /* server hostname */
 990 1055                  BP_SERVER_PATH, /* root path */
 991 1056          };
 992 1057          int n_prop = sizeof (prop_map) / sizeof (prop_map[0]);
 993 1058  
 994      -        bsetprop("fstype", 6, "nfs", 4);
     1059 +        bsetprops("fstype", "nfs");
 995 1060  
 996 1061          xen_parse_props(s, prop_map, n_prop);
 997 1062  
 998 1063          /*
 999 1064           * If a server name wasn't specified, use a default.
1000 1065           */
1001 1066          if (do_bsys_getproplen(NULL, BP_SERVER_NAME) == -1)
1002 1067                  bsetprops(BP_SERVER_NAME, "unknown");
1003 1068  }
1004 1069  
↓ open down ↓ 345 lines elided ↑ open up ↑
1350 1415          propbuf = do_bsys_alloc(NULL, NULL, MMU_PAGESIZE, 0);
1351 1416          DBG((uintptr_t)propbuf);
1352 1417          if (xbp->bi_module_cnt > 0) {
1353 1418                  bm = xbp->bi_modules;
1354 1419                  rdbm = NULL;
1355 1420                  for (midx = i = 0; i < xbp->bi_module_cnt; i++) {
1356 1421                          if (bm[i].bm_type == BMT_ROOTFS) {
1357 1422                                  rdbm = &bm[i];
1358 1423                                  continue;
1359 1424                          }
1360      -                        if (bm[i].bm_type == BMT_HASH || bm[i].bm_name == NULL)
     1425 +                        if (bm[i].bm_type == BMT_HASH ||
     1426 +                            bm[i].bm_type == BMT_FONT ||
     1427 +                            bm[i].bm_name == NULL)
1361 1428                                  continue;
1362 1429  
1363 1430                          if (bm[i].bm_type == BMT_ENV) {
1364 1431                                  if (benv == NULL)
1365 1432                                          benv = &bm[i];
1366 1433                                  else
1367 1434                                          continue;
1368 1435                          }
1369 1436  
1370 1437                          (void) snprintf(modid, sizeof (modid),
↓ open down ↓ 194 lines elided ↑ open up ↑
1565 1632  
1566 1633                                  /*
1567 1634                                   * a comma or white space ends the value
1568 1635                                   */
1569 1636                                  if (value[value_len] == ',' ||
1570 1637                                      ISSPACE(value[value_len]))
1571 1638                                          break;
1572 1639                          }
1573 1640  
1574 1641                          if (value_len == 0) {
1575      -                                bsetprop(name, name_len, "true", 5);
     1642 +                                bsetprop(DDI_PROP_TYPE_ANY, name, name_len,
     1643 +                                    NULL, 0);
1576 1644                          } else {
1577 1645                                  char *v = value;
1578 1646                                  int l = value_len;
1579 1647                                  if (v[0] == v[l - 1] &&
1580 1648                                      (v[0] == '\'' || v[0] == '"')) {
1581 1649                                          ++v;
1582 1650                                          l -= 2;
1583 1651                                  }
1584 1652                                  bcopy(v, propbuf, l);
1585 1653                                  propbuf[l] = '\0';
1586      -                                bsetprop(name, name_len, propbuf,
1587      -                                    l + 1);
     1654 +                                bsetprop(DDI_PROP_TYPE_STRING, name, name_len,
     1655 +                                    propbuf, l + 1);
1588 1656                          }
1589 1657                          name = value + value_len;
1590 1658                          while (*name == ',')
1591 1659                                  ++name;
1592 1660                  }
1593 1661          }
1594 1662  
1595 1663          /*
1596 1664           * set boot-args property
1597 1665           * 1275 name is bootargs, so set
↓ open down ↓ 38 lines elided ↑ open up ↑
1636 1704                  }
1637 1705  
1638 1706                  /*
1639 1707                   * In the netboot case, drives_info is overloaded with the
1640 1708                   * dhcp ack. This is not multiboot compliant and requires
1641 1709                   * special pxegrub!
1642 1710                   */
1643 1711                  if (netboot && mbi->drives_length != 0) {
1644 1712                          sip = (struct sol_netinfo *)(uintptr_t)mbi->drives_addr;
1645 1713                          if (sip->sn_infotype == SN_TYPE_BOOTP)
1646      -                                bsetprop("bootp-response",
     1714 +                                bsetprop(DDI_PROP_TYPE_BYTE,
     1715 +                                    "bootp-response",
1647 1716                                      sizeof ("bootp-response"),
1648 1717                                      (void *)(uintptr_t)mbi->drives_addr,
1649 1718                                      mbi->drives_length);
1650 1719                          else if (sip->sn_infotype == SN_TYPE_RARP)
1651 1720                                  setup_rarp_props(sip);
1652 1721                  }
1653 1722          } else {
1654 1723                  multiboot2_info_header_t *mbi = xbp->bi_mb_info;
1655 1724                  multiboot_tag_bootdev_t *bootdev = NULL;
1656 1725                  multiboot_tag_network_t *netdev = NULL;
↓ open down ↓ 6 lines elided ↑ open up ↑
1663 1732                  }
1664 1733                  if (bootdev != NULL) {
1665 1734                          DBG(bootdev->mb_biosdev);
1666 1735                          boot_device = bootdev->mb_biosdev;
1667 1736                          str[0] = (boot_device >> 4) + '0';
1668 1737                          str[1] = (boot_device & 0xf) + '0';
1669 1738                          str[2] = 0;
1670 1739                          bsetprops("bios-boot-device", str);
1671 1740                  }
1672 1741                  if (netdev != NULL) {
1673      -                        bsetprop("bootp-response", sizeof ("bootp-response"),
     1742 +                        bsetprop(DDI_PROP_TYPE_BYTE,
     1743 +                            "bootp-response", sizeof ("bootp-response"),
1674 1744                              (void *)(uintptr_t)netdev->mb_dhcpack,
1675 1745                              netdev->mb_size -
1676 1746                              sizeof (multiboot_tag_network_t));
1677 1747                  }
1678 1748          }
1679 1749  
1680      -        bsetprop("stdout", strlen("stdout"),
1681      -            &stdout_val, sizeof (stdout_val));
     1750 +        bsetprop32("stdout", stdout_val);
1682 1751  #endif /* __xpv */
1683 1752  
1684 1753          /*
1685 1754           * more conjured up values for made up things....
1686 1755           */
1687 1756  #if defined(__xpv)
1688 1757          bsetprops("mfg-name", "i86xpv");
1689 1758          bsetprops("impl-arch-name", "i86xpv");
1690 1759  #else
1691 1760          bsetprops("mfg-name", "i86pc");
↓ open down ↓ 330 lines elided ↑ open up ↑
2022 2091                  relocate_boot_archive(xbp);
2023 2092  #endif
2024 2093  
2025 2094  #ifndef __xpv
2026 2095          /*
2027 2096           * Install an IDT to catch early pagefaults (shouldn't have any).
2028 2097           * Also needed for kmdb.
2029 2098           */
2030 2099          bop_idt_init();
2031 2100  #endif
     2101 +        /* Set up the shadow fb for framebuffer console */
     2102 +        boot_fb_shadow_init(bops);
2032 2103  
2033 2104          /*
2034 2105           * Start building the boot properties from the command line
2035 2106           */
2036 2107          DBG_MSG("Initializing boot properties:\n");
2037 2108          build_boot_properties(xbp);
2038 2109  
2039 2110          if (find_boot_prop("prom_debug") || kbm_debug) {
2040 2111                  char *value;
2041 2112  
↓ open down ↓ 259 lines elided ↑ open up ↑
2301 2372          int64_t ecfginfo[4];
2302 2373  
2303 2374          cfg_baap = (ACPI_MCFG_ALLOCATION *)((uintptr_t)tp + sizeof (*tp));
2304 2375          cfg_baa_endp = ((char *)tp) + tp->Header.Length;
2305 2376          while ((char *)cfg_baap < cfg_baa_endp) {
2306 2377                  if (cfg_baap->Address != 0 && cfg_baap->PciSegment == 0) {
2307 2378                          ecfginfo[0] = cfg_baap->Address;
2308 2379                          ecfginfo[1] = cfg_baap->PciSegment;
2309 2380                          ecfginfo[2] = cfg_baap->StartBusNumber;
2310 2381                          ecfginfo[3] = cfg_baap->EndBusNumber;
2311      -                        bsetprop(MCFG_PROPNAME, strlen(MCFG_PROPNAME),
     2382 +                        bsetprop(DDI_PROP_TYPE_INT64,
     2383 +                            MCFG_PROPNAME, strlen(MCFG_PROPNAME),
2312 2384                              ecfginfo, sizeof (ecfginfo));
2313 2385                          break;
2314 2386                  }
2315 2387                  cfg_baap++;
2316 2388          }
2317 2389  }
2318 2390  
2319 2391  #ifndef __xpv
2320 2392  static void
2321 2393  process_madt_entries(ACPI_TABLE_MADT *tp, uint32_t *cpu_countp,
↓ open down ↓ 67 lines elided ↑ open up ↑
2389 2461                  if (cpu_apicid_array == NULL)
2390 2462                          bop_panic("Not enough memory for APIC ID array");
2391 2463  
2392 2464                  /* copy IDs */
2393 2465                  process_madt_entries(tp, NULL, NULL, cpu_apicid_array);
2394 2466  
2395 2467                  /*
2396 2468                   * Make boot property for array of "final" APIC IDs for each
2397 2469                   * CPU
2398 2470                   */
2399      -                bsetprop(BP_CPU_APICID_ARRAY, strlen(BP_CPU_APICID_ARRAY),
     2471 +                bsetprop(DDI_PROP_TYPE_INT,
     2472 +                    BP_CPU_APICID_ARRAY, strlen(BP_CPU_APICID_ARRAY),
2400 2473                      cpu_apicid_array, cpu_count * sizeof (*cpu_apicid_array));
2401 2474          }
2402 2475  
2403 2476          /*
2404 2477           * Check whether property plat-max-ncpus is already set.
2405 2478           */
2406 2479          if (do_bsys_getproplen(NULL, PLAT_MAX_NCPUS_NAME) < 0) {
2407 2480                  /*
2408 2481                   * Set plat-max-ncpus to number of maximum possible CPUs given
2409 2482                   * in MADT if it hasn't been set.
↓ open down ↓ 72 lines elided ↑ open up ↑
2482 2555                          if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED))
2483 2556                                  break;
2484 2557                          processor.domain = cpu->ProximityDomainLo;
2485 2558                          for (i = 0; i < 3; i++)
2486 2559                                  processor.domain +=
2487 2560                                      cpu->ProximityDomainHi[i] << ((i + 1) * 8);
2488 2561                          processor.apic_id = cpu->ApicId;
2489 2562                          processor.sapic_id = cpu->LocalSapicEid;
2490 2563                          (void) snprintf(prop_name, 30, "acpi-srat-processor-%d",
2491 2564                              proc_num);
2492      -                        bsetprop(prop_name, strlen(prop_name), &processor,
     2565 +                        bsetprop(DDI_PROP_TYPE_INT,
     2566 +                            prop_name, strlen(prop_name), &processor,
2493 2567                              sizeof (processor));
2494 2568                          proc_num++;
2495 2569                          break;
2496 2570                  }
2497 2571                  case ACPI_SRAT_TYPE_MEMORY_AFFINITY: {
2498 2572                          ACPI_SRAT_MEM_AFFINITY *mem =
2499 2573                              (ACPI_SRAT_MEM_AFFINITY *)item;
2500 2574  
2501 2575                          if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED))
2502 2576                                  break;
2503 2577                          memory.domain = mem->ProximityDomain;
2504 2578                          memory.addr = mem->BaseAddress;
2505 2579                          memory.length = mem->Length;
2506 2580                          memory.flags = mem->Flags;
2507 2581                          (void) snprintf(prop_name, 30, "acpi-srat-memory-%d",
2508 2582                              mem_num);
2509      -                        bsetprop(prop_name, strlen(prop_name), &memory,
     2583 +                        bsetprop(DDI_PROP_TYPE_INT,
     2584 +                            prop_name, strlen(prop_name), &memory,
2510 2585                              sizeof (memory));
2511 2586                          if ((mem->Flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) &&
2512 2587                              (memory.addr + memory.length > maxmem)) {
2513 2588                                  maxmem = memory.addr + memory.length;
2514 2589                          }
2515 2590                          mem_num++;
2516 2591                          break;
2517 2592                  }
2518 2593                  case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: {
2519 2594                          ACPI_SRAT_X2APIC_CPU_AFFINITY *x2cpu =
2520 2595                              (ACPI_SRAT_X2APIC_CPU_AFFINITY *) item;
2521 2596  
2522 2597                          if (!(x2cpu->Flags & ACPI_SRAT_CPU_ENABLED))
2523 2598                                  break;
2524 2599                          x2apic.domain = x2cpu->ProximityDomain;
2525 2600                          x2apic.x2apic_id = x2cpu->ApicId;
2526 2601                          (void) snprintf(prop_name, 30, "acpi-srat-processor-%d",
2527 2602                              proc_num);
2528      -                        bsetprop(prop_name, strlen(prop_name), &x2apic,
     2603 +                        bsetprop(DDI_PROP_TYPE_INT,
     2604 +                            prop_name, strlen(prop_name), &x2apic,
2529 2605                              sizeof (x2apic));
2530 2606                          proc_num++;
2531 2607                          break;
2532 2608                  }
2533 2609                  default:
2534 2610                          if (kbm_debug)
2535 2611                                  bop_printf(NULL, "SRAT type %d\n", item->Type);
2536 2612                          break;
2537 2613                  }
2538 2614  
↓ open down ↓ 20 lines elided ↑ open up ↑
2559 2635           * if possible.
2560 2636           *
2561 2637           * Note that the size of the table is the square of the
2562 2638           * number of localities; if the number of localities exceeds
2563 2639           * UINT16_MAX, the table size may overflow an int when being
2564 2640           * passed to bsetprop() below.
2565 2641           */
2566 2642          if (tp->LocalityCount >= SLIT_LOCALITIES_MAX)
2567 2643                  return;
2568 2644  
2569      -        bsetprop(SLIT_NUM_PROPNAME, strlen(SLIT_NUM_PROPNAME),
2570      -            &tp->LocalityCount, sizeof (tp->LocalityCount));
2571      -        bsetprop(SLIT_PROPNAME, strlen(SLIT_PROPNAME), &tp->Entry,
     2645 +        bsetprop64(SLIT_NUM_PROPNAME, tp->LocalityCount);
     2646 +        bsetprop(DDI_PROP_TYPE_BYTE,
     2647 +            SLIT_PROPNAME, strlen(SLIT_PROPNAME), &tp->Entry,
2572 2648              tp->LocalityCount * tp->LocalityCount);
2573 2649  }
2574 2650  
2575 2651  static ACPI_TABLE_MSCT *
2576 2652  process_msct(ACPI_TABLE_MSCT *tp)
2577 2653  {
2578 2654          int last_seen = 0;
2579 2655          int proc_num = 0;
2580 2656          ACPI_MSCT_PROXIMITY *item, *end;
2581 2657          extern uint64_t plat_dr_options;
↓ open down ↓ 171 lines elided ↑ open up ↑
2753 2829   * this is used by both graphical boot and the (developer only)
2754 2830   * USB serial console
2755 2831   */
2756 2832  void *
2757 2833  defcons_init(size_t size)
2758 2834  {
2759 2835          static char *p = NULL;
2760 2836  
2761 2837          p = do_bsys_alloc(NULL, NULL, size, MMU_PAGESIZE);
2762 2838          *p = 0;
2763      -        bsetprop("deferred-console-buf", strlen("deferred-console-buf") + 1,
2764      -            &p, sizeof (p));
     2839 +        bsetprop32("deferred-console-buf", (uint32_t)((uintptr_t)&p));
2765 2840          return (p);
2766 2841  }
2767 2842  
2768 2843  /*ARGSUSED*/
2769 2844  int
2770 2845  boot_compinfo(int fd, struct compinfo *cbp)
2771 2846  {
2772 2847          cbp->iscmp = 0;
2773 2848          cbp->blksize = MAXBSIZE;
2774 2849          return (0);
↓ open down ↓ 25 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX