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>
426 path = NULL;
427 if (consconfig_usb_ms_path != NULL)
428 path = consconfig_usb_ms_path;
429 else if (usb_ms_path != NULL)
430 path = usb_ms_path;
431 if (path != NULL)
432 DPRINTF(DPRINT_L0, "usb mouse path = %s\n", path);
433
434 path = plat_mousepath();
435 if (path != NULL)
436 DPRINTF(DPRINT_L0, "mouse path = %s\n", path);
437
438 path = plat_stdinpath();
439 if (path != NULL)
440 DPRINTF(DPRINT_L0, "stdin path = %s\n", path);
441
442 path = plat_stdoutpath();
443 if (path != NULL)
444 DPRINTF(DPRINT_L0, "stdout path = %s\n", path);
445
446 path = plat_fbpath();
447 if (path != NULL)
448 DPRINTF(DPRINT_L0, "fb path = %s\n", path);
449 }
450
451 /*
452 * consconfig_kbd_abort_enable:
453 * Send the CONSSETABORTENABLE ioctl to the lower layers. This ioctl
454 * will only be sent to the device if it is the console device.
455 * This ioctl tells the device to pay attention to abort sequences.
456 * In the case of kbtrans, this would tell the driver to pay attention
457 * to the two key abort sequences like STOP-A. In the case of the
458 * serial keyboard, it would be an abort sequence like a break.
459 */
460 static int
461 consconfig_kbd_abort_enable(ldi_handle_t lh)
462 {
463 int err, rval;
464
465 DPRINTF(DPRINT_L0, "consconfig_kbd_abort_enable\n");
643 sp = kmem_zalloc(sizeof (cons_state_t), KM_SLEEP);
644 sp->cons_keyboard_problem = B_FALSE;
645
646 mutex_init(&sp->cons_lock, NULL, MUTEX_DRIVER, NULL);
647
648 /* check if consconfig:usb_kb_path is set in /etc/system */
649 consconfig_usb_kb_path = consconfig_get_usb_kb_path();
650
651 /* check if consconfig:usb_ms_path is set in /etc/system */
652 consconfig_usb_ms_path = consconfig_get_usb_ms_path();
653
654 consconfig_print_paths();
655
656 /* init external globals */
657 stdoutdev = NODEV;
658
659 /*
660 * Find keyboard, mouse, stdin and stdout devices, if they
661 * exist on this platform.
662 */
663
664 if (consconfig_usb_kb_path != NULL) {
665 sp->cons_keyboard_path = consconfig_usb_kb_path;
666 } else if (usb_kb_path != NULL) {
667 sp->cons_keyboard_path = usb_kb_path;
668 } else {
669 sp->cons_keyboard_path = plat_kbdpath();
670 }
671
672 if (consconfig_usb_ms_path != NULL) {
673 sp->cons_mouse_path = consconfig_usb_ms_path;
674 } else if (usb_ms_path != NULL) {
675 sp->cons_mouse_path = usb_ms_path;
676 } else {
677 sp->cons_mouse_path = plat_mousepath();
678 }
679
680 /* Identify the stdout driver */
681 sp->cons_stdout_path = plat_stdoutpath();
682 sp->cons_stdout_is_fb = plat_stdout_is_framebuffer();
977 * framework.
978 *
979 * on sparc, when the console is ttya, zs0 is stdin/stdout, and zs1
980 * is kb/mouse. zs0 must be attached before zs1. The zs driver
981 * is written this way and the hardware may depend on this, too.
982 * It would be better to enforce this by attaching zs in sibling
983 * order with a driver property, such as ddi-attachall.
984 */
985 if (sp->cons_stdin_path != NULL)
986 stdindev = ddi_pathname_to_dev_t(sp->cons_stdin_path);
987 if (stdindev == NODEV) {
988 DPRINTF(DPRINT_L0,
989 "!fail to attach stdin: %s\n", sp->cons_stdin_path);
990 }
991 if (sp->cons_stdout_path != NULL)
992 stdoutdev = ddi_pathname_to_dev_t(sp->cons_stdout_path);
993 if (sp->cons_keyboard_path != NULL)
994 kbddev = ddi_pathname_to_dev_t(sp->cons_keyboard_path);
995 if (sp->cons_mouse_path != NULL)
996 mousedev = ddi_pathname_to_dev_t(sp->cons_mouse_path);
997
998 /*
999 * On x86, make sure the fb driver is loaded even if we don't use it
1000 * for the console. This will ensure that we create a /dev/fb link
1001 * which is required to start Xorg.
1002 */
1003 #if defined(__x86)
1004 if (sp->cons_fb_path != NULL)
1005 fbdev = ddi_pathname_to_dev_t(sp->cons_fb_path);
1006 #endif
1007
1008 DPRINTF(DPRINT_L0, "stdindev %lx, stdoutdev %lx, kbddev %lx, "
1009 "mousedev %lx\n", stdindev, stdoutdev, kbddev, mousedev);
1010 }
1011
1012 #if !defined(__x86)
1013 void
1014 consconfig_virtual_console_vp(cons_state_t *sp)
1015 {
1016 char *virtual_cons_path;
1017
1018 if (plat_virtual_console_path(&virtual_cons_path) < 0)
1019 return;
1020
1021 DPRINTF(DPRINT_L0, "consconfig_virtual_console_vp: "
1022 "virtual console device path %s\n", virtual_cons_path);
1023
1024 ASSERT(sp->cons_stdout_path != NULL);
1025 if (strcmp(virtual_cons_path, sp->cons_stdout_path) == 0) {
1026 /* virtual console already in use */
1027 return;
1028 }
1029
1460 panic("consconfig_init_input: "
1461 "unable to open console device");
1462 /*NOTREACHED*/
1463 }
1464
1465 /* Enable abort on the console */
1466 (void) consconfig_kbd_abort_enable(new_lh);
1467
1468 /* Now we must close it to make console logins happy */
1469 (void) ldi_close(new_lh, FREAD|FWRITE, kcred);
1470
1471 /* Set up polled input if it is supported by the console device */
1472 if (plat_use_polled_debug()) {
1473 /*
1474 * In the debug case, register the keyboard polled entry
1475 * points, but don't throw the switch in the debugger. This
1476 * allows the polled entry points to be checked by hand
1477 */
1478 consconfig_setup_polledio(sp, sp->cons_wc_vp->v_rdev);
1479 } else {
1480 consconfig_setup_polledio(sp, cons_final_dev);
1481 }
1482
1483 kadb_uses_kernel();
1484 }
1485
1486 /*
1487 * This function kicks off the console configuration.
1488 * Configure keyboard and mouse. Main entry here.
1489 */
1490 void
1491 dynamic_console_config(void)
1492 {
1493 /* initialize space.c globals */
1494 stdindev = NODEV;
1495 mousedev = NODEV;
1496 kbddev = NODEV;
1497 fbdev = NODEV;
1498 fbvp = NULL;
1499 fbdip = NULL;
1500 wsconsvp = NULL;
1501 rwsconsvp = NULL;
1502 rwsconsdev = NODEV;
1503 rconsvp = NULL;
1504 rconsdev = NODEV;
1505
1506 /* Initialize cons_state_t structure and console device paths */
1507 consconfig_sp = consconfig_state_init();
1508 ASSERT(consconfig_sp);
1509
1510 /* Build upper layer of console stream */
1511 cons_build_upper_layer(consconfig_sp);
1512
1513 /*
1514 * Load keyboard/mouse drivers. The dacf routines will
1515 * plumb the devices into the console stream
1516 *
1517 * At the conclusion of the ddi_pathname_to_dev_t calls, the keyboard
| 426 path = NULL; 427 if (consconfig_usb_ms_path != NULL) 428 path = consconfig_usb_ms_path; 429 else if (usb_ms_path != NULL) 430 path = usb_ms_path; 431 if (path != NULL) 432 DPRINTF(DPRINT_L0, "usb mouse path = %s\n", path); 433 434 path = plat_mousepath(); 435 if (path != NULL) 436 DPRINTF(DPRINT_L0, "mouse path = %s\n", path); 437 438 path = plat_stdinpath(); 439 if (path != NULL) 440 DPRINTF(DPRINT_L0, "stdin path = %s\n", path); 441 442 path = plat_stdoutpath(); 443 if (path != NULL) 444 DPRINTF(DPRINT_L0, "stdout path = %s\n", path); 445 446 path = plat_diagpath(); 447 if (path != NULL) 448 DPRINTF(DPRINT_L0, "diag path = %s\n", path); 449 450 path = plat_fbpath(); 451 if (path != NULL) 452 DPRINTF(DPRINT_L0, "fb path = %s\n", path); 453 } 454 455 /* 456 * consconfig_kbd_abort_enable: 457 * Send the CONSSETABORTENABLE ioctl to the lower layers. This ioctl 458 * will only be sent to the device if it is the console device. 459 * This ioctl tells the device to pay attention to abort sequences. 460 * In the case of kbtrans, this would tell the driver to pay attention 461 * to the two key abort sequences like STOP-A. In the case of the 462 * serial keyboard, it would be an abort sequence like a break. 463 */ 464 static int 465 consconfig_kbd_abort_enable(ldi_handle_t lh) 466 { 467 int err, rval; 468 469 DPRINTF(DPRINT_L0, "consconfig_kbd_abort_enable\n");
647 sp = kmem_zalloc(sizeof (cons_state_t), KM_SLEEP);
648 sp->cons_keyboard_problem = B_FALSE;
649
650 mutex_init(&sp->cons_lock, NULL, MUTEX_DRIVER, NULL);
651
652 /* check if consconfig:usb_kb_path is set in /etc/system */
653 consconfig_usb_kb_path = consconfig_get_usb_kb_path();
654
655 /* check if consconfig:usb_ms_path is set in /etc/system */
656 consconfig_usb_ms_path = consconfig_get_usb_ms_path();
657
658 consconfig_print_paths();
659
660 /* init external globals */
661 stdoutdev = NODEV;
662
663 /*
664 * Find keyboard, mouse, stdin and stdout devices, if they
665 * exist on this platform.
666 */
667 sp->cons_diag_path = plat_diagpath();
668
669 if (consconfig_usb_kb_path != NULL) {
670 sp->cons_keyboard_path = consconfig_usb_kb_path;
671 } else if (usb_kb_path != NULL) {
672 sp->cons_keyboard_path = usb_kb_path;
673 } else {
674 sp->cons_keyboard_path = plat_kbdpath();
675 }
676
677 if (consconfig_usb_ms_path != NULL) {
678 sp->cons_mouse_path = consconfig_usb_ms_path;
679 } else if (usb_ms_path != NULL) {
680 sp->cons_mouse_path = usb_ms_path;
681 } else {
682 sp->cons_mouse_path = plat_mousepath();
683 }
684
685 /* Identify the stdout driver */
686 sp->cons_stdout_path = plat_stdoutpath();
687 sp->cons_stdout_is_fb = plat_stdout_is_framebuffer();
982 * framework.
983 *
984 * on sparc, when the console is ttya, zs0 is stdin/stdout, and zs1
985 * is kb/mouse. zs0 must be attached before zs1. The zs driver
986 * is written this way and the hardware may depend on this, too.
987 * It would be better to enforce this by attaching zs in sibling
988 * order with a driver property, such as ddi-attachall.
989 */
990 if (sp->cons_stdin_path != NULL)
991 stdindev = ddi_pathname_to_dev_t(sp->cons_stdin_path);
992 if (stdindev == NODEV) {
993 DPRINTF(DPRINT_L0,
994 "!fail to attach stdin: %s\n", sp->cons_stdin_path);
995 }
996 if (sp->cons_stdout_path != NULL)
997 stdoutdev = ddi_pathname_to_dev_t(sp->cons_stdout_path);
998 if (sp->cons_keyboard_path != NULL)
999 kbddev = ddi_pathname_to_dev_t(sp->cons_keyboard_path);
1000 if (sp->cons_mouse_path != NULL)
1001 mousedev = ddi_pathname_to_dev_t(sp->cons_mouse_path);
1002 if (sp->cons_diag_path != NULL)
1003 diagdev = ddi_pathname_to_dev_t(sp->cons_diag_path);
1004
1005 /*
1006 * On x86, make sure the fb driver is loaded even if we don't use it
1007 * for the console. This will ensure that we create a /dev/fb link
1008 * which is required to start Xorg.
1009 */
1010 #if defined(__x86)
1011 if (sp->cons_fb_path != NULL)
1012 fbdev = ddi_pathname_to_dev_t(sp->cons_fb_path);
1013 #endif
1014
1015 DPRINTF(DPRINT_L0, "stdindev %lx, stdoutdev %lx, kbddev %lx, "
1016 "mousedev %lx diagdev %lx\n", stdindev, stdoutdev, kbddev,
1017 mousedev, diagdev);
1018 }
1019
1020 #if !defined(__x86)
1021 void
1022 consconfig_virtual_console_vp(cons_state_t *sp)
1023 {
1024 char *virtual_cons_path;
1025
1026 if (plat_virtual_console_path(&virtual_cons_path) < 0)
1027 return;
1028
1029 DPRINTF(DPRINT_L0, "consconfig_virtual_console_vp: "
1030 "virtual console device path %s\n", virtual_cons_path);
1031
1032 ASSERT(sp->cons_stdout_path != NULL);
1033 if (strcmp(virtual_cons_path, sp->cons_stdout_path) == 0) {
1034 /* virtual console already in use */
1035 return;
1036 }
1037
1468 panic("consconfig_init_input: "
1469 "unable to open console device");
1470 /*NOTREACHED*/
1471 }
1472
1473 /* Enable abort on the console */
1474 (void) consconfig_kbd_abort_enable(new_lh);
1475
1476 /* Now we must close it to make console logins happy */
1477 (void) ldi_close(new_lh, FREAD|FWRITE, kcred);
1478
1479 /* Set up polled input if it is supported by the console device */
1480 if (plat_use_polled_debug()) {
1481 /*
1482 * In the debug case, register the keyboard polled entry
1483 * points, but don't throw the switch in the debugger. This
1484 * allows the polled entry points to be checked by hand
1485 */
1486 consconfig_setup_polledio(sp, sp->cons_wc_vp->v_rdev);
1487 } else {
1488 if (diagdev != NODEV)
1489 consconfig_setup_polledio(sp, diagdev);
1490 else
1491 consconfig_setup_polledio(sp, cons_final_dev);
1492 }
1493
1494 kadb_uses_kernel();
1495 }
1496
1497 /*
1498 * This function kicks off the console configuration.
1499 * Configure keyboard and mouse. Main entry here.
1500 */
1501 void
1502 dynamic_console_config(void)
1503 {
1504 /* initialize space.c globals */
1505 stdindev = NODEV;
1506 mousedev = NODEV;
1507 kbddev = NODEV;
1508 fbdev = NODEV;
1509 diagdev = NODEV;
1510 fbvp = NULL;
1511 fbdip = NULL;
1512 wsconsvp = NULL;
1513 rwsconsvp = NULL;
1514 rwsconsdev = NODEV;
1515 rconsvp = NULL;
1516 rconsdev = NODEV;
1517
1518 /* Initialize cons_state_t structure and console device paths */
1519 consconfig_sp = consconfig_state_init();
1520 ASSERT(consconfig_sp);
1521
1522 /* Build upper layer of console stream */
1523 cons_build_upper_layer(consconfig_sp);
1524
1525 /*
1526 * Load keyboard/mouse drivers. The dacf routines will
1527 * plumb the devices into the console stream
1528 *
1529 * At the conclusion of the ddi_pathname_to_dev_t calls, the keyboard
|