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/common/ficl/loader.c
          +++ new/usr/src/common/ficl/loader.c
↓ open down ↓ 43 lines elided ↑ open up ↑
  44   44  #else
  45   45  #include <stand.h>
  46   46  #include "bootstrap.h"
  47   47  #endif
  48   48  #ifdef _STANDALONE
  49   49  #include <uuid.h>
  50   50  #else
  51   51  #include <uuid/uuid.h>
  52   52  #endif
  53   53  #include <string.h>
       54 +#include <gfx_fb.h>
  54   55  #include "ficl.h"
  55   56  
  56   57  /*
  57   58   *              FreeBSD's loader interaction words and extras
  58   59   *
  59   60   *              setenv      ( value n name n' -- )
  60   61   *              setenv?     ( value n name n' flag -- )
  61   62   *              getenv      ( addr n -- addr' n' | -1 )
  62   63   *              unsetenv    ( addr n -- )
  63   64   *              copyin      ( addr addr' len -- )
  64   65   *              copyout     ( addr addr' len -- )
  65   66   *              findfile    ( name len type len' -- addr )
  66   67   *              ccall       ( [[...[p10] p9] ... p1] n addr -- result )
  67   68   *              uuid-from-string ( addr n -- addr' )
  68   69   *              uuid-to-string ( addr' -- addr n | -1 )
  69   70   *              .#          ( value -- )
  70   71   */
  71   72  
  72   73  void
       74 +ficl_fb_putimage(ficlVm *pVM)
       75 +{
       76 +        char *namep, *name;
       77 +        int names, ret = 0;
       78 +        png_t png;
       79 +
       80 +        FICL_STACK_CHECK(ficlVmGetDataStack(pVM), 2, 1);
       81 +
       82 +        names = ficlStackPopInteger(ficlVmGetDataStack(pVM));
       83 +        namep = (char *)ficlStackPopPointer(ficlVmGetDataStack(pVM));
       84 +
       85 +        name = ficlMalloc(names+1);
       86 +        if (!name)
       87 +                ficlVmThrowError(pVM, "Error: out of memory");
       88 +        strncpy(name, namep, names);
       89 +        name[names] = '\0';
       90 +
       91 +        if ((ret = png_open(&png, name)) != PNG_NO_ERROR) {
       92 +                ret = 0;
       93 +                ficlFree(name);
       94 +                ficlStackPushInteger(ficlVmGetDataStack(pVM), ret);
       95 +                return;
       96 +        }
       97 +
       98 +        if (gfx_fb_putimage(&png) == 0)
       99 +                ret = -1;       /* success */
      100 +        png_close(&png);
      101 +        ficlFree(name);
      102 +        ficlStackPushInteger(ficlVmGetDataStack(pVM), ret);
      103 +}
      104 +
      105 +void
      106 +ficl_fb_setpixel(ficlVm *pVM)
      107 +{
      108 +        uint32_t x, y;
      109 +
      110 +        FICL_STACK_CHECK(ficlVmGetDataStack(pVM), 2, 0);
      111 +
      112 +        y = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      113 +        x = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      114 +        gfx_fb_setpixel(x, y);
      115 +}
      116 +
      117 +void
      118 +ficl_fb_line(ficlVm *pVM)
      119 +{
      120 +        uint32_t x0, y0, x1, y1, wd;
      121 +
      122 +        FICL_STACK_CHECK(ficlVmGetDataStack(pVM), 5, 0);
      123 +
      124 +        wd = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      125 +        y1 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      126 +        x1 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      127 +        y0 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      128 +        x0 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      129 +        gfx_fb_line(x0, y0, x1, y1, wd);
      130 +}
      131 +
      132 +void
      133 +ficl_fb_bezier(ficlVm *pVM)
      134 +{
      135 +        uint32_t x0, y0, x1, y1, x2, y2, width;
      136 +
      137 +        FICL_STACK_CHECK(ficlVmGetDataStack(pVM), 7, 0);
      138 +
      139 +        width = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      140 +        y2 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      141 +        x2 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      142 +        y1 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      143 +        x1 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      144 +        y0 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      145 +        x0 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      146 +        gfx_fb_bezier(x0, y0, x1, y1, x2, y2, width);
      147 +}
      148 +
      149 +void
      150 +ficl_fb_drawrect(ficlVm *pVM)
      151 +{
      152 +        uint32_t x1, x2, y1, y2, fill;
      153 +
      154 +        FICL_STACK_CHECK(ficlVmGetDataStack(pVM), 5, 0);
      155 +
      156 +        fill = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      157 +        y2 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      158 +        x2 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      159 +        y1 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      160 +        x1 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      161 +        gfx_fb_drawrect(x1, y1, x2, y2, fill);
      162 +}
      163 +
      164 +void
      165 +ficl_term_drawrect(ficlVm *pVM)
      166 +{
      167 +        uint32_t x1, x2, y1, y2;
      168 +
      169 +        FICL_STACK_CHECK(ficlVmGetDataStack(pVM), 4, 0);
      170 +
      171 +        y2 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      172 +        x2 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      173 +        y1 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      174 +        x1 = ficlStackPopInteger(ficlVmGetDataStack(pVM));
      175 +        gfx_term_drawrect(x1, y1, x2, y2);
      176 +}
      177 +
      178 +void
  73  179  ficlSetenv(ficlVm *pVM)
  74  180  {
  75  181          char *name, *value;
  76  182          char *namep, *valuep;
  77  183          int names, values;
  78  184  
  79  185          FICL_STACK_CHECK(ficlVmGetDataStack(pVM), 4, 0);
  80  186  
  81  187          names = ficlStackPopInteger(ficlVmGetDataStack(pVM));
  82  188          namep = (char *)ficlStackPopPointer(ficlVmGetDataStack(pVM));
↓ open down ↓ 824 lines elided ↑ open up ↑
 907 1013          ficlDictionarySetPrimitive(dp, "copyin", ficlCopyin, FICL_WORD_DEFAULT);
 908 1014          ficlDictionarySetPrimitive(dp, "copyout", ficlCopyout,
 909 1015              FICL_WORD_DEFAULT);
 910 1016          ficlDictionarySetPrimitive(dp, "findfile", ficlFindfile,
 911 1017              FICL_WORD_DEFAULT);
 912 1018          ficlDictionarySetPrimitive(dp, "ccall", ficlCcall, FICL_WORD_DEFAULT);
 913 1019          ficlDictionarySetPrimitive(dp, "uuid-from-string", ficlUuidFromString,
 914 1020              FICL_WORD_DEFAULT);
 915 1021          ficlDictionarySetPrimitive(dp, "uuid-to-string", ficlUuidToString,
 916 1022              FICL_WORD_DEFAULT);
     1023 +        ficlDictionarySetPrimitive(dp, "fb-setpixel", ficl_fb_setpixel,
     1024 +            FICL_WORD_DEFAULT);
     1025 +        ficlDictionarySetPrimitive(dp, "fb-line", ficl_fb_line,
     1026 +            FICL_WORD_DEFAULT);
     1027 +        ficlDictionarySetPrimitive(dp, "fb-bezier", ficl_fb_bezier,
     1028 +            FICL_WORD_DEFAULT);
     1029 +        ficlDictionarySetPrimitive(dp, "fb-drawrect", ficl_fb_drawrect,
     1030 +            FICL_WORD_DEFAULT);
     1031 +        ficlDictionarySetPrimitive(dp, "fb-putimage", ficl_fb_putimage,
     1032 +            FICL_WORD_DEFAULT);
     1033 +        ficlDictionarySetPrimitive(dp, "term-drawrect", ficl_term_drawrect,
     1034 +            FICL_WORD_DEFAULT);
 917 1035  #ifdef _STANDALONE
 918 1036          /* Register words from linker set. */
 919 1037          SET_FOREACH(fnpp, Xficl_compile_set)
 920 1038                  (*fnpp)(pSys);
 921 1039  #endif
 922 1040  
 923 1041  #if defined(__i386__) || defined(__amd64__)
 924 1042          ficlDictionarySetConstant(env, "arch-i386", FICL_TRUE);
 925 1043          ficlDictionarySetConstant(env, "arch-sparc", FICL_FALSE);
 926 1044  #endif
 927 1045  #ifdef __sparc
 928 1046          ficlDictionarySetConstant(env, "arch-i386", FICL_FALSE);
 929 1047          ficlDictionarySetConstant(env, "arch-sparc", FICL_TRUE);
 930 1048  #endif
 931 1049  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX