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/crypto/sha1/sha1.c
          +++ new/usr/src/common/crypto/sha1/sha1.c
↓ open down ↓ 24 lines elided ↑ open up ↑
  25   25   *
  26   26   * These notices must be retained in any copies of any part of this
  27   27   * documentation and/or software.
  28   28   *
  29   29   * NOTE: Cleaned-up and optimized, version of SHA1, based on the FIPS 180-1
  30   30   * standard, available at http://www.itl.nist.gov/fipspubs/fip180-1.htm
  31   31   * Not as fast as one would like -- further optimizations are encouraged
  32   32   * and appreciated.
  33   33   */
  34   34  
       35 +#if defined(_STANDALONE)
       36 +#include <sys/cdefs.h>
       37 +#define _RESTRICT_KYWD  restrict
       38 +#else
  35   39  #if !defined(_KERNEL) && !defined(_BOOT)
  36   40  #include <stdint.h>
  37   41  #include <strings.h>
  38   42  #include <stdlib.h>
  39   43  #include <errno.h>
  40   44  #include <sys/systeminfo.h>
  41   45  #endif  /* !_KERNEL && !_BOOT */
       46 +#endif  /* _STANDALONE */
  42   47  
  43   48  #include <sys/types.h>
  44   49  #include <sys/param.h>
  45   50  #include <sys/systm.h>
  46   51  #include <sys/sysmacros.h>
  47   52  #include <sys/sha1.h>
  48   53  #include <sys/sha1_consts.h>
  49   54  
       55 +#if defined(_STANDALONE)
       56 +#include <sys/endian.h>
       57 +#define HAVE_HTONL
       58 +#if _BYTE_ORDER == _LITTLE_ENDIAN
       59 +#undef _BIG_ENDIAN
       60 +#else
       61 +#undef _LITTLE_ENDIAN
       62 +#endif
       63 +#else
  50   64  #ifdef _LITTLE_ENDIAN
  51   65  #include <sys/byteorder.h>
  52   66  #define HAVE_HTONL
  53   67  #endif
       68 +#endif
  54   69  
  55   70  #ifdef  _BOOT
  56   71  #define bcopy(_s, _d, _l)       ((void) memcpy((_d), (_s), (_l)))
  57   72  #define bzero(_m, _l)           ((void) memset((_m), 0, (_l)))
  58   73  #endif
  59   74  
  60   75  static void Encode(uint8_t *, const uint32_t *, size_t);
  61   76  
  62   77  #if     defined(__sparc)
  63   78  
  64   79  #define SHA1_TRANSFORM(ctx, in) \
  65   80          SHA1Transform((ctx)->state[0], (ctx)->state[1], (ctx)->state[2], \
  66   81                  (ctx)->state[3], (ctx)->state[4], (ctx), (in))
  67   82  
  68   83  static void SHA1Transform(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,
  69   84      SHA1_CTX *, const uint8_t *);
  70   85  
  71      -#elif   defined(__amd64)
       86 +#elif   defined(__amd64) && !defined(_STANDALONE)
  72   87  
  73   88  #define SHA1_TRANSFORM(ctx, in) sha1_block_data_order((ctx), (in), 1)
  74   89  #define SHA1_TRANSFORM_BLOCKS(ctx, in, num) sha1_block_data_order((ctx), \
  75   90                  (in), (num))
  76   91  
  77   92  void sha1_block_data_order(SHA1_CTX *ctx, const void *inpp, size_t num_blocks);
  78   93  
  79   94  #else
  80   95  
  81   96  #define SHA1_TRANSFORM(ctx, in) SHA1Transform((ctx), (in))
↓ open down ↓ 245 lines elided ↑ open up ↑
 327  342          bcopy(&input[i], &ctx->buf_un.buf8[buf_index], input_len - i);
 328  343  }
 329  344  
 330  345  #else /* VIS_SHA1 */
 331  346  
 332  347  void
 333  348  SHA1Update(SHA1_CTX *ctx, const void *inptr, size_t input_len)
 334  349  {
 335  350          uint32_t i, buf_index, buf_len;
 336  351          const uint8_t *input = inptr;
 337      -#if defined(__amd64)
      352 +#if defined(__amd64) && !defined(_STANDALONE)
 338  353          uint32_t        block_count;
 339  354  #endif  /* __amd64 */
 340  355  
 341  356          /* check for noop */
 342  357          if (input_len == 0)
 343  358                  return;
 344  359  
 345  360          /* compute number of bytes mod 64 */
 346  361          buf_index = (ctx->count[1] >> 3) & 0x3F;
 347  362  
↓ open down ↓ 18 lines elided ↑ open up ↑
 366  381                   * wasn't any data left over from a previous call to
 367  382                   * SHA1Update().
 368  383                   */
 369  384  
 370  385                  if (buf_index) {
 371  386                          bcopy(input, &ctx->buf_un.buf8[buf_index], buf_len);
 372  387                          SHA1_TRANSFORM(ctx, ctx->buf_un.buf8);
 373  388                          i = buf_len;
 374  389                  }
 375  390  
 376      -#if !defined(__amd64)
      391 +#if !defined(__amd64) || defined(_STANDALONE)
 377  392                  for (; i + 63 < input_len; i += 64)
 378  393                          SHA1_TRANSFORM(ctx, &input[i]);
 379  394  #else
 380  395                  block_count = (input_len - i) >> 6;
 381  396                  if (block_count > 0) {
 382  397                          SHA1_TRANSFORM_BLOCKS(ctx, &input[i], block_count);
 383  398                          i += block_count << 6;
 384  399                  }
 385  400  #endif  /* !__amd64 */
 386  401  
↓ open down ↓ 45 lines elided ↑ open up ↑
 432  447          SHA1Update(ctx, bitcount_be, sizeof (bitcount_be));
 433  448  
 434  449          /* store state in digest */
 435  450          Encode(digest, ctx->state, sizeof (ctx->state));
 436  451  
 437  452          /* zeroize sensitive information */
 438  453          bzero(ctx, sizeof (*ctx));
 439  454  }
 440  455  
 441  456  
 442      -#if !defined(__amd64)
      457 +#if !defined(__amd64) || defined(_STANDALONE)
 443  458  
 444  459  typedef uint32_t sha1word;
 445  460  
 446  461  /*
 447  462   * sparc optimization:
 448  463   *
 449  464   * on the sparc, we can load big endian 32-bit data easily.  note that
 450  465   * special care must be taken to ensure the address is 32-bit aligned.
 451  466   * in the interest of speed, we don't check to make sure, since
 452  467   * careful programming can guarantee this for us.
↓ open down ↓ 583 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX