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>

@@ -22,12 +22,10 @@
 /*
  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 /*
  * Generic keyboard support: translation
  *
  * This module is project private.  Please see PSARC/1998/176 and
  * PSARC/1998/026 for references to the kbtrans module.

@@ -61,15 +59,15 @@
 #include "kbtrans_lower.h"
 
 /*
  * Internal Function Prototypes
  */
-static boolean_t        kbtrans_do_compose(struct kbtrans_lower *, ushort_t,
-                            ushort_t, ushort_t *);
+static boolean_t kbtrans_do_compose(struct kbtrans_lower *, keymap_entry_t,
+    keymap_entry_t, keymap_entry_t *);
 static void             kbtrans_translate(struct kbtrans_lower *,
-                                struct keyboard_callback *, kbtrans_key_t,
-                                enum keystate);
+    struct keyboard_callback *, kbtrans_key_t, enum keystate);
+
 /*
  * kbtrans_processkey:
  *
  *      lower   - state information used by the calling driver
  *                this parameter is passed back to the callback routines.

@@ -81,13 +79,11 @@
  * The raw callback allows the driver that called the translation module
  * to be passed untranslated scancodes.
  */
 void
 kbtrans_processkey(struct kbtrans_lower *lower,
-        struct keyboard_callback        *cb,
-        kbtrans_key_t                   key,
-        enum keystate                   state)
+    struct keyboard_callback *cb, kbtrans_key_t key, enum keystate state)
 {
         DPRINTF(PRINT_L0, PRINT_MASK_ALL, (lower, "kbtrans_processkey: "
                 "newstate=%d key=%d", state, key));
 
         /*

@@ -124,20 +120,18 @@
  * Called to process key events if we are in TR_ASCII or TR_EVENT
  * (sunview) mode.  This routine will call the appropriate translation_callback
  * for the character when it is done translating it.
  */
 static void
-kbtrans_translate(struct kbtrans_lower  *lower,
-        struct keyboard_callback        *cb,
-        kbtrans_key_t                   key,
-        enum keystate                   newstate)
+kbtrans_translate(struct kbtrans_lower *lower, struct keyboard_callback *cb,
+    kbtrans_key_t key, enum keystate newstate)
 {
         unsigned                shiftmask;
-        register ushort_t       entry;
-        register ushort_t       entrytype;
-        ushort_t                result_iso;
-        unsigned short          *ke;
+        register keymap_entry_t entry;
+        register unsigned       entrytype;
+        keymap_entry_t          result;
+        keymap_entry_t          *ke;
         int                     i;
         boolean_t               good_compose;
 
         DPRINTF(PRINT_L0, PRINT_MASK_ALL, (lower, "KEY TRANSLATE "
                 "newstate=0x%x key=0x%x\n", newstate, key));

@@ -186,12 +180,11 @@
                  * NONL appears only in the Num Lock table, and indicates that
                  * this key is not affected by Num Lock.  This means we should
                  * ask for the table we would have gotten had Num Lock not been
                  * down, and translate using that table.
                  */
-                ke = kbtrans_find_entry(lower, shiftmask & ~NUMLOCKMASK,
-                        key);
+                ke = kbtrans_find_entry(lower, shiftmask & ~NUMLOCKMASK, key);
 
                 if (ke == NULL) {
                         /*
                          * This is a gross error.  Cancel the repeat key and
                          * exit, we can not translate this scancode.

@@ -210,22 +203,21 @@
         /*
          * The entrytype indicates what category of key we are processing.
          * Categories include shift keys, function keys, and numeric keypad
          * keys.
          */
-        entrytype = (ushort_t)(entry & 0xFF00);
+        entrytype = KEYFLAGS(entry);
 
         if (entrytype == SHIFTKEYS) {
                 /*
                  * Handle the state of toggle shifts specially.
                  * Ups should be ignored, and downs should be mapped to ups if
                  * that shift is currently on.
                  */
                 if ((1 << (entry & 0x0F)) &
                     lower->kbtrans_keyboard->k_toggleshifts) {
-                        if ((1 << (entry & 0x0F)) &
-                                lower->kbtrans_togglemask) {
+                        if ((1 << (entry & 0x0F)) & lower->kbtrans_togglemask) {
                                 newstate = KEY_RELEASED; /* toggling off */
                         } else {
                                 newstate = KEY_PRESSED; /* toggling on */
                         }
                 }

@@ -234,11 +226,10 @@
                  * Handle Compose and floating accent key sequences
                  */
                 switch (lower->kbtrans_state) {
                 case COMPOSE1:
                         if (newstate == KEY_RELEASED)
-
                                 return;
 
                         if (entry < ASCII_SET_SIZE) {
                                 if (lower->kbtrans_compose_map[entry] >= 0) {
                                         lower->kbtrans_compose_key = entry;

@@ -263,32 +254,26 @@
                         lower->kbtrans_led_state &= ~LED_COMPOSE;
 
                         cb->kc_setled(lower->kbtrans_upper);
 
                         good_compose = kbtrans_do_compose(lower,
-                                lower->kbtrans_compose_key, entry,
-                                &result_iso);
+                            lower->kbtrans_compose_key, entry, &result);
                         if (good_compose) {
-                                if (lower->kbtrans_compat)
-                                        result_iso += ISO_FIRST;
-                                else
-                                        result_iso += EUC_FIRST;
                                 cb->kc_keypressed(lower->kbtrans_upper,
-                                    entrytype, key, result_iso);
+                                    entrytype, key, result);
                         }
                         return;
 
                 case FLTACCENT:
                         if (newstate == KEY_RELEASED)
-
                                 return;
 
                         /* next state is "normal" */
                         lower->kbtrans_state = NORMAL;
                         for (i = 0;
-                            (lower->kbtrans_fltaccent_table[i].fa_entry
-                                != lower->kbtrans_fltaccent_entry) ||
+                            (lower->kbtrans_fltaccent_table[i].fa_entry !=
+                            lower->kbtrans_fltaccent_entry) ||
                             (lower->kbtrans_fltaccent_table[i].ascii != entry);
                             i++) {
                                 if (lower->kbtrans_fltaccent_table[i].fa_entry
                                     == 0) {
                                         /* Invalid second key: ignore key */

@@ -295,14 +280,12 @@
 
                                         return;
                                 }
                         }
 
-                        cb->kc_keypressed(lower->kbtrans_upper, entrytype,
-                                        key, (lower->kbtrans_compat ?
-                                                ISO_FIRST : EUC_FIRST) +
-                                        lower->kbtrans_fltaccent_table[i].iso);
+                        cb->kc_keypressed(lower->kbtrans_upper, entrytype, key,
+                            lower->kbtrans_fltaccent_table[i].utf8);
 
                         return;
                 }
         }
 

@@ -340,11 +323,11 @@
          */
         switch (entrytype) {
 
         case 0x0:               /* regular key */
                 cb->kc_keypressed(lower->kbtrans_upper, entrytype, key,
-                        entry | lower->kbtrans_buckybits);
+                    SPECIAL(lower->kbtrans_buckybits, entry));
                 break;
 
         case SHIFTKEYS: {
                 uint_t shiftbit = 1 << (entry & 0x0F);
 

@@ -392,11 +375,11 @@
 
                 break;
                 }
 
         case BUCKYBITS:
-                lower->kbtrans_buckybits ^= 1 << (7 + (entry & 0x0F));
+                lower->kbtrans_buckybits ^= 1 << (entry & 0x0F);
 
                 if (newstate == KEY_PRESSED) {
                         cb->kc_keypressed(lower->kbtrans_upper, entrytype, key,
                                 entry);
                 }

@@ -478,20 +461,18 @@
 }
 
 /*
  * kbtrans_do_compose:
  *      Given a two key compose sequence, lookup the iso equivalent and put
- *      the result in the result_iso_ptr.
+ *      the result in the result_ptr.
  */
 static boolean_t
-kbtrans_do_compose(struct kbtrans_lower *lower,
-                ushort_t        first_entry,
-                ushort_t        second_entry,
-                ushort_t        *result_iso_ptr)
+kbtrans_do_compose(struct kbtrans_lower *lower, keymap_entry_t first_entry,
+    keymap_entry_t second_entry, keymap_entry_t *result_ptr)
 {
         struct compose_sequence_t *ptr;
-        ushort_t        tmp;
+        keymap_entry_t tmp;
 
         /*
          * Validate the second keystroke.
          */
         if (second_entry >= ASCII_SET_SIZE)

@@ -512,11 +493,11 @@
         ptr = lower->kbtrans_compose_table +
                     lower->kbtrans_compose_map[first_entry];
 
         while (ptr->first == first_entry) {
                 if (ptr->second == second_entry) {
-                        *result_iso_ptr = ptr->iso;
+                        *result_ptr = ptr->utf8;
 
                         return (B_TRUE);
                 }
                 ptr++;
         }

@@ -527,13 +508,12 @@
 /*
  * kbtrans_find_entry:
  *      This routine finds the entry corresponding to the current shift
  *      state and keycode.
  */
-unsigned short *
-kbtrans_find_entry(struct kbtrans_lower *lower,
-        register uint_t                 mask,
+keymap_entry_t *
+kbtrans_find_entry(struct kbtrans_lower *lower, uint_t mask,
         kbtrans_key_t                   key_station)
 {
         register struct keyboard *kp;
         keymap_entry_t *km;
         struct exception_map *ex;