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>
2362 gettext("mkfs: close failed on read disk: %s\n"),
2363 strerror(saverr));
2364 /* we're just cleaning up, so keep going */
2365 }
2366 if (close(fso) == -1) {
2367 saverr = errno;
2368 (void) fprintf(stderr,
2369 gettext("mkfs: close failed on write disk: %s\n"),
2370 strerror(saverr));
2371 /* we're just cleaning up, so keep going */
2372 }
2373 fsi = fso = -1;
2374
2375 #ifndef STANDALONE
2376 lockexit(0);
2377 #endif
2378
2379 return (0);
2380 }
2381
2382 /*
2383 * Figure out how big the partition we're dealing with is.
2384 * The value returned is in disk blocks (sectors);
2385 */
2386 static diskaddr_t
2387 get_max_size(int fd)
2388 {
2389 struct extvtoc vtoc;
2390 dk_gpt_t *efi_vtoc;
2391 diskaddr_t slicesize;
2392
2393 int index = read_extvtoc(fd, &vtoc);
2394
2395 if (index >= 0) {
2396 label_type = LABEL_TYPE_VTOC;
2397 } else {
2398 if (index == VT_ENOTSUP || index == VT_ERROR) {
2399 /* it might be an EFI label */
2400 index = efi_alloc_and_read(fd, &efi_vtoc);
2401 label_type = LABEL_TYPE_EFI;
2402 }
2403 }
2404
2405 if (index < 0) {
2406 switch (index) {
2407 case VT_ERROR:
2408 break;
2409 case VT_EIO:
2410 errno = EIO;
2411 break;
2412 case VT_EINVAL:
2413 errno = EINVAL;
2414 }
2415 perror(gettext("Can not determine partition size"));
2416 lockexit(32);
2417 }
2418
2419 if (label_type == LABEL_TYPE_EFI) {
2420 slicesize = efi_vtoc->efi_parts[index].p_size;
2421 efi_free(efi_vtoc);
2422 } else {
2423 /*
2424 * In the vtoc struct, p_size is a 32-bit signed quantity.
2425 * In the dk_gpt struct (efi's version of the vtoc), p_size
2426 * is an unsigned 64-bit quantity. By casting the vtoc's
2427 * psize to an unsigned 32-bit quantity, it will be copied
2428 * to 'slicesize' (an unsigned 64-bit diskaddr_t) without
2429 * sign extension.
2430 */
2431
2432 slicesize = (uint32_t)vtoc.v_part[index].p_size;
2433 }
2434
2435 dprintf(("DeBuG get_max_size index = %d, p_size = %lld, dolimit = %d\n",
2436 index, slicesize, (slicesize > FS_MAX)));
2437
2438 /*
2439 * The next line limits a UFS file system to the maximum
2440 * supported size.
2441 */
2442
|
2362 gettext("mkfs: close failed on read disk: %s\n"),
2363 strerror(saverr));
2364 /* we're just cleaning up, so keep going */
2365 }
2366 if (close(fso) == -1) {
2367 saverr = errno;
2368 (void) fprintf(stderr,
2369 gettext("mkfs: close failed on write disk: %s\n"),
2370 strerror(saverr));
2371 /* we're just cleaning up, so keep going */
2372 }
2373 fsi = fso = -1;
2374
2375 #ifndef STANDALONE
2376 lockexit(0);
2377 #endif
2378
2379 return (0);
2380 }
2381
2382 static diskaddr_t
2383 get_device_size(int fd)
2384 {
2385 struct dk_minfo disk_info;
2386
2387 if ((ioctl(fd, DKIOCGMEDIAINFO, (caddr_t)&disk_info)) == -1)
2388 return (0);
2389
2390 return (disk_info.dki_capacity);
2391 }
2392
2393 /*
2394 * Figure out how big the partition we're dealing with is.
2395 * The value returned is in disk blocks (sectors);
2396 */
2397 static diskaddr_t
2398 get_max_size(int fd)
2399 {
2400 struct extvtoc vtoc;
2401 dk_gpt_t *efi_vtoc;
2402 diskaddr_t slicesize;
2403
2404 int index = read_extvtoc(fd, &vtoc);
2405
2406 if (index >= 0) {
2407 label_type = LABEL_TYPE_VTOC;
2408 } else {
2409 if (index == VT_ENOTSUP || index == VT_ERROR) {
2410 /* it might be an EFI label */
2411 index = efi_alloc_and_read(fd, &efi_vtoc);
2412 label_type = LABEL_TYPE_EFI;
2413 }
2414 }
2415
2416 if (index < 0) {
2417 /*
2418 * Since both attempts to read the label failed, we're
2419 * going to use DKIOCGMEDIAINFO to get device size.
2420 */
2421
2422 label_type = LABEL_TYPE_OTHER;
2423 slicesize = get_device_size(fd);
2424 if (slicesize == 0) {
2425 switch (index) {
2426 case VT_ERROR:
2427 break;
2428 case VT_EIO:
2429 errno = EIO;
2430 break;
2431 case VT_EINVAL:
2432 errno = EINVAL;
2433 }
2434 perror(gettext("Can not determine partition size"));
2435 lockexit(32);
2436 }
2437 }
2438
2439 if (label_type == LABEL_TYPE_EFI) {
2440 slicesize = efi_vtoc->efi_parts[index].p_size;
2441 efi_free(efi_vtoc);
2442 } else if (label_type == LABEL_TYPE_VTOC) {
2443 /*
2444 * In the vtoc struct, p_size is a 32-bit signed quantity.
2445 * In the dk_gpt struct (efi's version of the vtoc), p_size
2446 * is an unsigned 64-bit quantity. By casting the vtoc's
2447 * psize to an unsigned 32-bit quantity, it will be copied
2448 * to 'slicesize' (an unsigned 64-bit diskaddr_t) without
2449 * sign extension.
2450 */
2451
2452 slicesize = (uint32_t)vtoc.v_part[index].p_size;
2453 }
2454
2455 dprintf(("DeBuG get_max_size index = %d, p_size = %lld, dolimit = %d\n",
2456 index, slicesize, (slicesize > FS_MAX)));
2457
2458 /*
2459 * The next line limits a UFS file system to the maximum
2460 * supported size.
2461 */
2462
|