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/cmd/loadkeys/loadkeys.y
          +++ new/usr/src/cmd/loadkeys/loadkeys.y
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   *
  15   15   * When distributing Covered Code, include this CDDL HEADER in each
  16   16   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  17   17   * If applicable, add the following below this CDDL HEADER, with the
  18   18   * fields enclosed by brackets "[]" replaced with your own identifying
  19   19   * information: Portions Copyright [yyyy] [name of copyright owner]
  20   20   *
  21   21   * CDDL HEADER END
  22   22   */
  23   23  
  24      -#ifndef lint
  25      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  26      -#endif
  27      -
  28   24  /*
  29   25   * Copyright (c) 1999 by Sun Microsystems, Inc.
  30   26   * All rights reserved.
  31   27   */
  32   28  
  33   29  #include <sys/param.h>
  34   30  #include <ctype.h>
  35   31  #include <stdio.h>
  36   32  #include <search.h>
  37   33  #include <string.h>
  38   34  #include <malloc.h>
  39   35  #include <fcntl.h>
  40   36  #include <stdlib.h>
  41   37  #include <errno.h>
  42   38  #include <unistd.h>
  43   39  #include <sys/kbd.h>
  44   40  #include <sys/kbio.h>
  45   41  
  46   42  #define ALL     -1      /* special symbol for all tables */
  47   43  
  48      -/*
  49      - * SunOS 4.x and Solaris 2.[1234] put Type 4 key tables into
  50      - * the keytables directory with no type qualification.
  51      - * If we're a SPARC, we might be using an NFS server that
  52      - * doesn't have the new type-qualified directories.
  53      - * (loadkeys wasn't used on non-SPARCs in 2.[1234].)
  54      - */
  55      -#ifdef  sparc
  56      -#define COMPATIBILITY_DIR
  57      -#endif
  58      -
  59   44  static char     keytable_dir[] = "/usr/share/lib/keytables/type_%d/";
  60      -#ifdef  COMPATIBILITY_DIR
  61      -static char     keytable_dir2[] = "/usr/share/lib/keytables/";
  62      -#endif
  63   45  static char     layout_prefix[] = "layout_";
  64   46  
  65   47  struct keyentry {
  66   48          struct keyentry *ke_next;
  67   49          struct kiockeymap ke_entry;
  68   50  };
  69   51  
  70   52  typedef struct keyentry keyentry;
  71   53  
  72   54  static keyentry *firstentry;
↓ open down ↓ 52 lines elided ↑ open up ↑
 125  107  
 126  108  
 127  109  #define NSHIFTS (sizeof (shiftmasks) / sizeof (shiftmasks[0]))
 128  110  
 129  111  static void     enter_mapentry(int station, keyentry *entrylistp);
 130  112  static keyentry *makeentry(int tablemask, int entry);
 131  113  static int      loadkey(int kbdfd, keyentry *kep);
 132  114  static int      dupkey(int kbdfd, dupentry *dep, int shiftmask);
 133  115  static int      swapkey(int kbdfd, dupentry *dep, int shiftmask);
 134  116  static int      yylex();
      117 +extern int      yyparse(void);
 135  118  static int      readesc(FILE *stream, int delim, int single_char);
 136  119  static int      wordcmp(const void *w1, const void *w2);
 137  120  static int      yyerror(char *msg);
 138  121  static void     usage(void);
 139  122  static void     set_layout(char *arg);
 140  123  static FILE     *open_mapping_file(char *pathbuf, char *name,
 141  124                          boolean_t explicit_name, int type);
 142  125  
 143  126  int
 144      -main(argc, argv)
 145      -        int argc;
 146      -        char **argv;
      127 +main(int argc, char **argv)
 147  128  {
 148      -        register int kbdfd;
      129 +        int kbdfd;
 149  130          int type;
 150  131          int layout;
 151  132          /* maxint is 8 hex digits. */
 152  133          char layout_filename[sizeof(layout_prefix)+8];
 153  134          char pathbuf[MAXPATHLEN];
 154      -        register int shift;
      135 +        int shift;
 155  136          struct kiockeymap mapentry;
 156      -        register keyentry *kep;
 157      -        register dupentry *dep;
      137 +        keyentry *kep;
      138 +        dupentry *dep;
 158  139          boolean_t explicit_name;
 159  140  
 160  141          while(++argv, --argc) {
 161  142                  if(argv[0][0] != '-') break;
 162  143                  switch(argv[0][1]) {
 163  144                  case 'e':
 164  145                          /* -e obsolete, silently ignore */
 165  146                          break;
 166  147                  case 's':
 167  148                          if (argc != 2) {
↓ open down ↓ 158 lines elided ↑ open up ↑
 326  307          }
 327  308  
 328  309          close(kbdfd);
 329  310  }
 330  311  
 331  312  /*
 332  313   * Attempt to find the specified mapping file.  Return a FILE * if found,
 333  314   * else print a message on stderr and return NULL.
 334  315   */
 335  316  FILE *
 336      -open_mapping_file(
 337      -        char *pathbuf,
 338      -        char *name,
 339      -        boolean_t explicit_name,
 340      -        int type
 341      -) {
      317 +open_mapping_file(char *pathbuf, char *name, boolean_t explicit_name, int type)
      318 +{
 342  319          /* If the user specified the name, try it "raw". */
 343  320          if (explicit_name) {
 344  321                  strcpy(pathbuf, name);
 345  322                  infile = fopen(pathbuf, "r");
 346  323                  if (infile) return (infile);
 347  324                  if (errno != ENOENT) goto fopen_fail;
 348  325          }
 349  326  
 350  327          /* Everything after this point applies only to relative names. */
 351  328          if (*name == '/') goto fopen_fail;
 352  329  
 353  330          /* Try the type-qualified directory name. */
 354  331          sprintf(pathbuf, keytable_dir, type);
 355  332          if ((int)(strlen(pathbuf) + strlen(name) + 1) >= MAXPATHLEN) {
 356  333                  (void) fprintf(stderr, "loadkeys: Name %s is too long\n",
 357  334                                  name);
 358  335                  return (NULL);
 359  336          }
 360  337          (void) strcat(pathbuf, name);
 361      -        infile = fopen(pathbuf, "r");
 362      -        if (infile) return (infile);
 363      -        if (errno != ENOENT) goto fopen_fail;
      338 +        if ((infile = fopen(pathbuf, "r")) != NULL)
      339 +                return (infile);
 364  340  
 365      -#ifdef  COMPATIBILITY_DIR
 366      -        /* If not, and either the name was specified explicitly */
 367      -        /*     or this is a type 4... */
 368      -        if (explicit_name || type == KB_SUN4) {
 369      -                /* Try the compatibility name. */
 370      -                /* No need to check len here, it's shorter. */
 371      -                (void) strcpy(pathbuf, keytable_dir2);
 372      -                (void) strcat(pathbuf, infilename);
 373      -                infile = fopen(pathbuf, "r");
 374      -                if (infile) return (infile);
 375      -                if (errno != ENOENT) goto fopen_fail;
 376      -        }
 377      -#endif
 378      -
 379  341  fopen_fail:
 380  342          (void) fprintf(stderr, "loadkeys: ");
 381  343          perror(name);
 382  344          return (NULL);
 383  345  }
 384  346  
 385  347  /*
 386  348   * We have a list of entries for a given keystation, and the keystation number
 387  349   * for that keystation; put that keystation number into all the entries in that
 388  350   * list, and chain that list to the end of the main list of entries.
↓ open down ↓ 29 lines elided ↑ open up ↑
 418  380          int entry;
 419  381  {
 420  382          register keyentry *kep;
 421  383          register int index;
 422  384  
 423  385          if ((kep = (keyentry *) malloc((unsigned)sizeof (keyentry))) == NULL)
 424  386                  yyerror("out of memory for entries");
 425  387          kep->ke_next = NULL;
 426  388          kep->ke_entry.kio_tablemask = tablemask;
 427  389          kep->ke_entry.kio_station = 0;
 428      -        kep->ke_entry.kio_entry = (u_short)entry;
      390 +        kep->ke_entry.kio_entry = entry;
 429  391          index = entry - STRING;
 430  392          if (index >= 0 && index <= 15)
 431  393                  (void) strncpy(kep->ke_entry.kio_string, strings[index],
 432  394                      KTAB_STRLEN);
 433  395          return (kep);
 434  396  }
 435  397  
 436  398  /*
 437  399   * Make a set of entries for a keystation that indicate that that keystation's
 438  400   * settings should be copied from another keystation's settings.
↓ open down ↓ 178 lines elided ↑ open up ↑
 617  579  
 618  580  code:
 619  581          CHARSTRING
 620  582                  {
 621  583                  $$ = $1;
 622  584                  }
 623  585  |       CHAR
 624  586                  {
 625  587                  $$ = $1;
 626  588                  }
      589 +|       INT
      590 +                {
      591 +                $$ = $1;
      592 +                }
 627  593  |       '('
 628  594                  {
 629  595                  $$ = '(';
 630  596                  }
 631  597  |       ')'
 632  598                  {
 633  599                  $$ = ')';
 634  600                  }
 635  601  |       '+'
 636  602                  {
↓ open down ↓ 63 lines elided ↑ open up ↑
 700  666          { "base",       TABLENAME,      0 },
 701  667          { "bf",         FKEY,           BOTTOMFUNC },
 702  668          { "buckybits",  CONSTANT,       BUCKYBITS },
 703  669          { "caps",       TABLENAME,      CAPSMASK },
 704  670          { "capslock",   CONSTANT,       CAPSLOCK },
 705  671          { "compose",    CONSTANT,       COMPOSE },
 706  672          { "ctrl",       TABLENAME,      CTRLMASK },
 707  673          { "downarrow",  CONSTANT,       DOWNARROW },
 708  674          { "error",      CONSTANT,       ERROR },
 709  675          { "fa_acute",   CONSTANT,       FA_ACUTE },
      676 +        { "fa_apostrophe", CONSTANT,    FA_APOSTROPHE },
      677 +        { "fa_breve",   CONSTANT,       FA_BREVE },
      678 +        { "fa_caron",   CONSTANT,       FA_CARON },
 710  679          { "fa_cedilla", CONSTANT,       FA_CEDILLA },
 711  680          { "fa_cflex",   CONSTANT,       FA_CFLEX },
      681 +        { "fa_dacute",  CONSTANT,       FA_DACUTE },
      682 +        { "fa_dot",     CONSTANT,       FA_DOT },
 712  683          { "fa_grave",   CONSTANT,       FA_GRAVE },
      684 +        { "fa_macron",  CONSTANT,       FA_MACRON },
      685 +        { "fa_ogonek",  CONSTANT,       FA_OGONEK },
      686 +        { "fa_ring",    CONSTANT,       FA_RING },
      687 +        { "fa_slash",   CONSTANT,       FA_SLASH },
 713  688          { "fa_tilde",   CONSTANT,       FA_TILDE },
 714  689          { "fa_umlaut",  CONSTANT,       FA_UMLAUT },
 715  690          { "hole",       CONSTANT,       HOLE },
 716  691          { "homearrow",  CONSTANT,       HOMEARROW },
 717  692          { "idle",       CONSTANT,       IDLE },
 718  693          { "key",        KEY,            0 },
 719  694          { "leftarrow",  CONSTANT,       LEFTARROW },
 720  695          { "leftctrl",   CONSTANT,       LEFTCTRL },
 721  696          { "leftshift",  CONSTANT,       LEFTSHIFT },
 722  697          { "lf",         FKEY,           LEFTFUNC },
↓ open down ↓ 180 lines elided ↑ open up ↑
 903  878                                          *cp = tolower(c);
 904  879                          }
 905  880                          word.w_string = tokbuf;
 906  881                          wptr = (word_t *)bsearch((char *)&word,
 907  882                              (char *)wordtab, NWORDS, sizeof (word_t),
 908  883                              wordcmp);
 909  884                          if (wptr != NULL) {
 910  885                                  yylval.number = wptr->w_lval;
 911  886                                  tokentype = wptr->w_type;
 912  887                          } else {
 913      -                                yylval.number = strtol(tokbuf, &ptr, 10);
      888 +                                yylval.number = strtol(tokbuf, &ptr, 0);
 914  889                                  if (ptr == tokbuf)
 915  890                                          yyerror("syntax error");
 916  891                                  else
 917  892                                          tokentype = INT;
 918  893                          }
 919  894                          break;
 920  895                  }
 921  896          }
 922  897  
 923  898          return (tokentype);
↓ open down ↓ 91 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX