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>


 267 #define SCAN_UP                         0x0001
 268 #define SCAN_DOWN                       0x0002
 269 #define SCAN_RIGHT                      0x0003
 270 #define SCAN_LEFT                       0x0004
 271 #define SCAN_HOME                       0x0005
 272 #define SCAN_END                        0x0006
 273 #define SCAN_INSERT                     0x0007
 274 #define SCAN_DELETE                     0x0008
 275 #define SCAN_PAGE_UP                    0x0009
 276 #define SCAN_PAGE_DOWN                  0x000A
 277 #define SCAN_F1                         0x000B
 278 #define SCAN_F2                         0x000C
 279 #define SCAN_F3                         0x000D
 280 #define SCAN_F4                         0x000E
 281 #define SCAN_F5                         0x000F
 282 #define SCAN_F6                         0x0010
 283 #define SCAN_F7                         0x0011
 284 #define SCAN_F8                         0x0012
 285 #define SCAN_F9                         0x0013
 286 #define SCAN_F10                        0x0014


 287 #define SCAN_ESC                        0x0017
 288 
 289 typedef
 290 EFI_STATUS
 291 (EFIAPI *EFI_INPUT_RESET) (
 292     IN struct _SIMPLE_INPUT_INTERFACE   *This,
 293     IN BOOLEAN                          ExtendedVerification
 294     );
 295 
 296 typedef
 297 EFI_STATUS
 298 (EFIAPI *EFI_INPUT_READ_KEY) (
 299     IN struct _SIMPLE_INPUT_INTERFACE   *This,
 300     OUT EFI_INPUT_KEY                   *Key
 301     );
 302 
 303 typedef struct _SIMPLE_INPUT_INTERFACE {
 304     EFI_INPUT_RESET                     Reset;
 305     EFI_INPUT_READ_KEY                  ReadKeyStroke;
 306     EFI_EVENT                           WaitForKey;
 307 } SIMPLE_INPUT_INTERFACE;
 308 
 309 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
 310   {0xdd9e7534, 0x7762, 0x4698, {0x8c, 0x14, 0xf5, 0x85, \
 311   0x17, 0xa6, 0x25, 0xaa} }
 312 




















































































































































































































 313 #endif


 267 #define SCAN_UP                         0x0001
 268 #define SCAN_DOWN                       0x0002
 269 #define SCAN_RIGHT                      0x0003
 270 #define SCAN_LEFT                       0x0004
 271 #define SCAN_HOME                       0x0005
 272 #define SCAN_END                        0x0006
 273 #define SCAN_INSERT                     0x0007
 274 #define SCAN_DELETE                     0x0008
 275 #define SCAN_PAGE_UP                    0x0009
 276 #define SCAN_PAGE_DOWN                  0x000A
 277 #define SCAN_F1                         0x000B
 278 #define SCAN_F2                         0x000C
 279 #define SCAN_F3                         0x000D
 280 #define SCAN_F4                         0x000E
 281 #define SCAN_F5                         0x000F
 282 #define SCAN_F6                         0x0010
 283 #define SCAN_F7                         0x0011
 284 #define SCAN_F8                         0x0012
 285 #define SCAN_F9                         0x0013
 286 #define SCAN_F10                        0x0014
 287 #define SCAN_F11                        0x0015
 288 #define SCAN_F12                        0x0016
 289 #define SCAN_ESC                        0x0017
 290 
 291 typedef
 292 EFI_STATUS
 293 (EFIAPI *EFI_INPUT_RESET) (
 294     IN struct _SIMPLE_INPUT_INTERFACE   *This,
 295     IN BOOLEAN                          ExtendedVerification
 296     );
 297 
 298 typedef
 299 EFI_STATUS
 300 (EFIAPI *EFI_INPUT_READ_KEY) (
 301     IN struct _SIMPLE_INPUT_INTERFACE   *This,
 302     OUT EFI_INPUT_KEY                   *Key
 303     );
 304 
 305 typedef struct _SIMPLE_INPUT_INTERFACE {
 306     EFI_INPUT_RESET                     Reset;
 307     EFI_INPUT_READ_KEY                  ReadKeyStroke;
 308     EFI_EVENT                           WaitForKey;
 309 } SIMPLE_INPUT_INTERFACE;
 310 
 311 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
 312   {0xdd9e7534, 0x7762, 0x4698, {0x8c, 0x14, 0xf5, 0x85, \
 313   0x17, 0xa6, 0x25, 0xaa} }
 314 
 315 INTERFACE_DECL(_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL);
 316 
 317 typedef UINT8          EFI_KEY_TOGGLE_STATE;
 318 //
 319 // Any Shift or Toggle State that is valid should have
 320 // high order bit set.
 321 //
 322 typedef struct EFI_KEY_STATE {
 323   UINT32               KeyShiftState;
 324   EFI_KEY_TOGGLE_STATE KeyToggleState;
 325 } EFI_KEY_STATE;
 326 
 327 typedef struct {
 328   EFI_INPUT_KEY        Key;
 329   EFI_KEY_STATE        KeyState;
 330 } EFI_KEY_DATA;
 331 
 332 //
 333 // Shift state
 334 //
 335 #define EFI_SHIFT_STATE_VALID     0x80000000
 336 #define EFI_RIGHT_SHIFT_PRESSED   0x00000001
 337 #define EFI_LEFT_SHIFT_PRESSED    0x00000002
 338 #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
 339 #define EFI_LEFT_CONTROL_PRESSED  0x00000008
 340 #define EFI_RIGHT_ALT_PRESSED     0x00000010
 341 #define EFI_LEFT_ALT_PRESSED      0x00000020
 342 #define EFI_RIGHT_LOGO_PRESSED    0x00000040
 343 #define EFI_LEFT_LOGO_PRESSED     0x00000080
 344 #define EFI_MENU_KEY_PRESSED      0x00000100
 345 #define EFI_SYS_REQ_PRESSED       0x00000200
 346 
 347 //
 348 // Toggle state
 349 //
 350 #define EFI_TOGGLE_STATE_VALID    0x80
 351 #define EFI_KEY_STATE_EXPOSED     0x40
 352 #define EFI_SCROLL_LOCK_ACTIVE    0x01
 353 #define EFI_NUM_LOCK_ACTIVE       0x02
 354 #define EFI_CAPS_LOCK_ACTIVE      0x04
 355 
 356 //
 357 // EFI Scan codes
 358 //
 359 #define SCAN_F13                  0x0068
 360 #define SCAN_F14                  0x0069
 361 #define SCAN_F15                  0x006A
 362 #define SCAN_F16                  0x006B
 363 #define SCAN_F17                  0x006C
 364 #define SCAN_F18                  0x006D
 365 #define SCAN_F19                  0x006E
 366 #define SCAN_F20                  0x006F
 367 #define SCAN_F21                  0x0070
 368 #define SCAN_F22                  0x0071
 369 #define SCAN_F23                  0x0072
 370 #define SCAN_F24                  0x0073
 371 #define SCAN_MUTE                 0x007F
 372 #define SCAN_VOLUME_UP            0x0080
 373 #define SCAN_VOLUME_DOWN          0x0081
 374 #define SCAN_BRIGHTNESS_UP        0x0100
 375 #define SCAN_BRIGHTNESS_DOWN      0x0101
 376 #define SCAN_SUSPEND              0x0102
 377 #define SCAN_HIBERNATE            0x0103
 378 #define SCAN_TOGGLE_DISPLAY       0x0104
 379 #define SCAN_RECOVERY             0x0105
 380 #define SCAN_EJECT                0x0106
 381 
 382 //
 383 // EFI Key Notfication Function
 384 //
 385 typedef
 386 EFI_STATUS
 387 (EFIAPI *EFI_KEY_NOTIFY_FUNCTION) (
 388   IN  EFI_KEY_DATA                      *KeyData
 389   );
 390 
 391 typedef
 392 EFI_STATUS
 393 (EFIAPI *EFI_INPUT_RESET_EX) (
 394   IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,
 395   IN BOOLEAN                            ExtendedVerification
 396   )
 397 /*++
 398 
 399   Routine Description:
 400     Reset the input device and optionaly run diagnostics
 401 
 402   Arguments:
 403     This                  - Protocol instance pointer.
 404     ExtendedVerification  - Driver may perform diagnostics on reset.
 405 
 406   Returns:
 407     EFI_SUCCESS           - The device was reset.
 408     EFI_DEVICE_ERROR      - The device is not functioning properly and could
 409                             not be reset.
 410 
 411 --*/
 412 ;
 413 
 414 typedef
 415 EFI_STATUS
 416 (EFIAPI *EFI_INPUT_READ_KEY_EX) (
 417   IN  struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
 418   OUT EFI_KEY_DATA                      *KeyData
 419   )
 420 /*++
 421 
 422   Routine Description:
 423     Reads the next keystroke from the input device. The WaitForKey Event can
 424     be used to test for existance of a keystroke via WaitForEvent () call.
 425 
 426   Arguments:
 427     This       - Protocol instance pointer.
 428     KeyData    - A pointer to a buffer that is filled in with the keystroke
 429                  state data for the key that was pressed.
 430 
 431   Returns:
 432     EFI_SUCCESS           - The keystroke information was returned.
 433     EFI_NOT_READY         - There was no keystroke data availiable.
 434     EFI_DEVICE_ERROR      - The keystroke information was not returned due to
 435                             hardware errors.
 436     EFI_INVALID_PARAMETER - KeyData is NULL.
 437 --*/
 438 ;
 439 
 440 typedef
 441 EFI_STATUS
 442 (EFIAPI *EFI_SET_STATE) (
 443   IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,
 444   IN EFI_KEY_TOGGLE_STATE               *KeyToggleState
 445   )
 446 /*++
 447 
 448   Routine Description:
 449     Set certain state for the input device.
 450 
 451   Arguments:
 452     This              - Protocol instance pointer.
 453     KeyToggleState    - A pointer to the EFI_KEY_TOGGLE_STATE to set the
 454                         state for the input device.
 455 
 456   Returns:
 457     EFI_SUCCESS           - The device state was set successfully.
 458     EFI_DEVICE_ERROR      - The device is not functioning correctly and could
 459                             not have the setting adjusted.
 460     EFI_UNSUPPORTED       - The device does not have the ability to set its state.
 461     EFI_INVALID_PARAMETER - KeyToggleState is NULL.
 462 
 463 --*/
 464 ;
 465 
 466 typedef
 467 EFI_STATUS
 468 (EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) (
 469   IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,
 470   IN EFI_KEY_DATA                       *KeyData,
 471   IN EFI_KEY_NOTIFY_FUNCTION            KeyNotificationFunction,
 472   OUT EFI_HANDLE                        *NotifyHandle
 473   )
 474 /*++
 475 
 476   Routine Description:
 477     Register a notification function for a particular keystroke for the input device.
 478 
 479   Arguments:
 480     This                    - Protocol instance pointer.
 481     KeyData                 - A pointer to a buffer that is filled in with the keystroke
 482                               information data for the key that was pressed.
 483     KeyNotificationFunction - Points to the function to be called when the key
 484                               sequence is typed specified by KeyData.
 485     NotifyHandle            - Points to the unique handle assigned to the registered notification.
 486 
 487   Returns:
 488     EFI_SUCCESS             - The notification function was registered successfully.
 489     EFI_OUT_OF_RESOURCES    - Unable to allocate resources for necesssary data structures.
 490     EFI_INVALID_PARAMETER   - KeyData or NotifyHandle is NULL.
 491 
 492 --*/
 493 ;
 494 
 495 typedef
 496 EFI_STATUS
 497 (EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) (
 498   IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,
 499   IN EFI_HANDLE                         NotificationHandle
 500   )
 501 /*++
 502 
 503   Routine Description:
 504     Remove a registered notification function from a particular keystroke.
 505 
 506   Arguments:
 507     This                    - Protocol instance pointer.
 508     NotificationHandle      - The handle of the notification function being unregistered.
 509 
 510   Returns:
 511     EFI_SUCCESS             - The notification function was unregistered successfully.
 512     EFI_INVALID_PARAMETER   - The NotificationHandle is invalid.
 513     EFI_NOT_FOUND           - Can not find the matching entry in database.
 514 
 515 --*/
 516 ;
 517 
 518 typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL {
 519   EFI_INPUT_RESET_EX                    Reset;
 520   EFI_INPUT_READ_KEY_EX                 ReadKeyStrokeEx;
 521   EFI_EVENT                             WaitForKeyEx;
 522   EFI_SET_STATE                         SetState;
 523   EFI_REGISTER_KEYSTROKE_NOTIFY         RegisterKeyNotify;
 524   EFI_UNREGISTER_KEYSTROKE_NOTIFY       UnregisterKeyNotify;
 525 } EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;
 526 
 527 #endif