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/uts/i86pc/dboot/dboot_startkern.c
          +++ new/usr/src/uts/i86pc/dboot/dboot_startkern.c
↓ open down ↓ 28 lines elided ↑ open up ↑
  29   29  
  30   30  #include <sys/types.h>
  31   31  #include <sys/machparam.h>
  32   32  #include <sys/x86_archext.h>
  33   33  #include <sys/systm.h>
  34   34  #include <sys/mach_mmu.h>
  35   35  #include <sys/multiboot.h>
  36   36  #include <sys/multiboot2.h>
  37   37  #include <sys/multiboot2_impl.h>
  38   38  #include <sys/sysmacros.h>
       39 +#include <sys/framebuffer.h>
  39   40  #include <sys/sha1.h>
  40   41  #include <util/string.h>
  41   42  #include <util/strtolctype.h>
  42   43  #include <sys/efi.h>
  43   44  
  44   45  #if defined(__xpv)
  45   46  
  46   47  #include <sys/hypervisor.h>
  47   48  uintptr_t xen_virt_start;
  48   49  pfn_t *mfn_to_pfn_mapping;
↓ open down ↓ 81 lines elided ↑ open up ↑
 130  131   */
 131  132  uint32_t mb_magic;                      /* magic from boot loader */
 132  133  uint32_t mb_addr;                       /* multiboot info package from loader */
 133  134  int multiboot_version;
 134  135  multiboot_info_t *mb_info;
 135  136  multiboot2_info_header_t *mb2_info;
 136  137  multiboot_tag_mmap_t *mb2_mmap_tagp;
 137  138  int num_entries;                        /* mmap entry count */
 138  139  boolean_t num_entries_set;              /* is mmap entry count set */
 139  140  uintptr_t load_addr;
      141 +static boot_framebuffer_t framebuffer[2];
      142 +static boot_framebuffer_t *fb;
 140  143  
 141  144  /* can not be automatic variables because of alignment */
 142  145  static efi_guid_t smbios3 = SMBIOS3_TABLE_GUID;
 143  146  static efi_guid_t smbios = SMBIOS_TABLE_GUID;
 144  147  static efi_guid_t acpi2 = EFI_ACPI_TABLE_GUID;
 145  148  static efi_guid_t acpi1 = ACPI_10_TABLE_GUID;
 146  149  #endif  /* __xpv */
 147  150  
 148  151  /*
 149  152   * This contains information passed to the kernel
↓ open down ↓ 7 lines elided ↑ open up ↑
 157  160  static paddr_t max_mem;                 /* maximum memory address */
 158  161  
 159  162  /*
 160  163   * Information about processor MMU
 161  164   */
 162  165  int amd64_support = 0;
 163  166  int largepage_support = 0;
 164  167  int pae_support = 0;
 165  168  int pge_support = 0;
 166  169  int NX_support = 0;
      170 +int PAT_support = 0;
 167  171  
 168  172  /*
 169  173   * Low 32 bits of kernel entry address passed back to assembler.
 170  174   * When running a 64 bit kernel, the high 32 bits are 0xffffffff.
 171  175   */
 172  176  uint32_t entry_addr_low;
 173  177  
 174  178  /*
 175  179   * Memlists for the kernel. We shouldn't need a lot of these.
 176  180   */
↓ open down ↓ 789 lines elided ↑ open up ↑
 966  970                          dboot_panic("getting XENMEM_machine_memory_map failed");
 967  971                  build_pcimemlists();
 968  972          }
 969  973  }
 970  974  
 971  975  #else   /* !__xpv */
 972  976  
 973  977  static void
 974  978  dboot_multiboot1_xboot_consinfo(void)
 975  979  {
 976      -        bi->bi_framebuffer = NULL;
      980 +        fb->framebuffer = 0;
 977  981  }
 978  982  
 979  983  static void
 980  984  dboot_multiboot2_xboot_consinfo(void)
 981  985  {
 982      -        multiboot_tag_framebuffer_t *fb;
 983      -        fb = dboot_multiboot2_find_tag(mb2_info,
      986 +        multiboot_tag_framebuffer_t *fbtag;
      987 +        fbtag = dboot_multiboot2_find_tag(mb2_info,
 984  988              MULTIBOOT_TAG_TYPE_FRAMEBUFFER);
 985      -        bi->bi_framebuffer = (native_ptr_t)(uintptr_t)fb;
      989 +        fb->framebuffer = (uint64_t)(uintptr_t)fbtag;
      990 +        fb->boot_fb_virt = 0;
 986  991  }
 987  992  
 988  993  static int
 989  994  dboot_multiboot_modcount(void)
 990  995  {
 991  996          switch (multiboot_version) {
 992  997          case 1:
 993  998                  return (mb_info->mods_count);
 994  999  
 995 1000          case 2:
↓ open down ↓ 56 lines elided ↑ open up ↑
1052 1057  
1053 1058          default:
1054 1059                  dboot_panic("Unknown multiboot version: %d\n",
1055 1060                      multiboot_version);
1056 1061                  break;
1057 1062          }
1058 1063          return (0);
1059 1064  }
1060 1065  
1061 1066  /*
1062      - * Find the environment module for console setup.
     1067 + * Find the modules used by console setup.
1063 1068   * Since we need the console to print early boot messages, the console is set up
1064      - * before anything else and therefore we need to pick up the environment module
1065      - * early too.
     1069 + * before anything else and therefore we need to pick up the needed modules.
1066 1070   *
1067      - * Note, we just will search for and if found, will pass the env
1068      - * module to console setup, the proper module list processing will happen later.
     1071 + * Note, we just will search for and if found, will pass the modules
     1072 + * to console setup, the proper module list processing will happen later.
     1073 + * Currenly used modules are boot environment and consoler font.
1069 1074   */
1070 1075  static void
1071      -dboot_find_env(void)
     1076 +dboot_find_console_modules(void)
1072 1077  {
1073 1078          int i, modcount;
1074 1079          uint32_t mod_start, mod_end;
1075 1080          char *cmdline;
1076 1081  
1077 1082          modcount = dboot_multiboot_modcount();
1078      -
     1083 +        bi->bi_module_cnt = 0;
1079 1084          for (i = 0; i < modcount; ++i) {
1080 1085                  cmdline = dboot_multiboot_modcmdline(i);
1081 1086                  if (cmdline == NULL)
1082 1087                          continue;
1083 1088  
1084      -                if (strstr(cmdline, "type=environment") == NULL)
     1089 +                if (strstr(cmdline, "type=console-font") != NULL)
     1090 +                        modules[bi->bi_module_cnt].bm_type = BMT_FONT;
     1091 +                else if (strstr(cmdline, "type=environment") != NULL)
     1092 +                        modules[bi->bi_module_cnt].bm_type = BMT_ENV;
     1093 +                else
1085 1094                          continue;
1086 1095  
1087 1096                  mod_start = dboot_multiboot_modstart(i);
1088 1097                  mod_end = dboot_multiboot_modend(i);
1089      -                modules[0].bm_addr = (native_ptr_t)(uintptr_t)mod_start;
1090      -                modules[0].bm_size = mod_end - mod_start;
1091      -                modules[0].bm_name = (native_ptr_t)(uintptr_t)NULL;
1092      -                modules[0].bm_hash = (native_ptr_t)(uintptr_t)NULL;
1093      -                modules[0].bm_type = BMT_ENV;
1094      -                bi->bi_modules = (native_ptr_t)(uintptr_t)modules;
1095      -                bi->bi_module_cnt = 1;
1096      -                return;
     1098 +                modules[bi->bi_module_cnt].bm_addr =
     1099 +                    (native_ptr_t)(uintptr_t)mod_start;
     1100 +                modules[bi->bi_module_cnt].bm_size = mod_end - mod_start;
     1101 +                modules[bi->bi_module_cnt].bm_name =
     1102 +                    (native_ptr_t)(uintptr_t)NULL;
     1103 +                modules[bi->bi_module_cnt].bm_hash =
     1104 +                    (native_ptr_t)(uintptr_t)NULL;
     1105 +                bi->bi_module_cnt++;
1097 1106          }
     1107 +        if (bi->bi_module_cnt != 0)
     1108 +                bi->bi_modules = (native_ptr_t)(uintptr_t)modules;
1098 1109  }
1099 1110  
1100 1111  static boolean_t
1101 1112  dboot_multiboot_basicmeminfo(uint32_t *lower, uint32_t *upper)
1102 1113  {
1103 1114          boolean_t rv = B_FALSE;
1104 1115  
1105 1116          switch (multiboot_version) {
1106 1117          case 1:
1107 1118                  if (mb_info->flags & 0x01) {
↓ open down ↓ 80 lines elided ↑ open up ↑
1188 1199  {
1189 1200          switch (type) {
1190 1201          case BMT_ROOTFS:
1191 1202                  return ("rootfs");
1192 1203          case BMT_FILE:
1193 1204                  return ("file");
1194 1205          case BMT_HASH:
1195 1206                  return ("hash");
1196 1207          case BMT_ENV:
1197 1208                  return ("environment");
     1209 +        case BMT_FONT:
     1210 +                return ("console-font");
1198 1211          default:
1199 1212                  return ("unknown");
1200 1213          }
1201 1214  }
1202 1215  
1203 1216  static void
1204 1217  check_images(void)
1205 1218  {
1206 1219          uint_t i;
1207 1220          char displayhash[SHA1_ASCII_LENGTH + 1];
↓ open down ↓ 100 lines elided ↑ open up ↑
1308 1321                  if (strncmp(q, "type=", 5) == 0) {
1309 1322                          if (q[5] == '\0' || isspace(q[5]))
1310 1323                                  continue;
1311 1324                          q += 5;
1312 1325                          if (strcmp(q, "rootfs") == 0) {
1313 1326                                  modules[midx].bm_type = BMT_ROOTFS;
1314 1327                          } else if (strcmp(q, "hash") == 0) {
1315 1328                                  modules[midx].bm_type = BMT_HASH;
1316 1329                          } else if (strcmp(q, "environment") == 0) {
1317 1330                                  modules[midx].bm_type = BMT_ENV;
     1331 +                        } else if (strcmp(q, "console-font") == 0) {
     1332 +                                modules[midx].bm_type = BMT_FONT;
1318 1333                          } else if (strcmp(q, "file") != 0) {
1319 1334                                  dboot_printf("\tmodule #%d: unknown module "
1320 1335                                      "type '%s'; defaulting to 'file'",
1321 1336                                      midx, q);
1322 1337                          }
1323 1338                          continue;
1324 1339                  }
1325 1340  
1326 1341                  if (strncmp(q, "hash=", 5) == 0) {
1327 1342                          if (q[5] != '\0' && !isspace(q[5])) {
↓ open down ↓ 687 lines elided ↑ open up ↑
2015 2030                          start += MMU_PAGESIZE;
2016 2031                  }
2017 2032                  if (start >= next_avail_addr)
2018 2033                          break;
2019 2034          }
2020 2035  
2021 2036          /*
2022 2037           * Map framebuffer memory as PT_NOCACHE as this is memory from a
2023 2038           * device and therefore must not be cached.
2024 2039           */
2025      -        if (bi->bi_framebuffer != NULL) {
2026      -                multiboot_tag_framebuffer_t *fb;
2027      -                fb = (multiboot_tag_framebuffer_t *)(uintptr_t)
2028      -                    bi->bi_framebuffer;
     2040 +        if (fb != NULL && fb->framebuffer != 0) {
     2041 +                multiboot_tag_framebuffer_t *fb_tagp;
     2042 +                fb_tagp = (multiboot_tag_framebuffer_t *)(uintptr_t)
     2043 +                    fb->framebuffer;
2029 2044  
2030      -                start = fb->framebuffer_common.framebuffer_addr;
2031      -                end = start + fb->framebuffer_common.framebuffer_height *
2032      -                    fb->framebuffer_common.framebuffer_pitch;
     2045 +                start = fb_tagp->framebuffer_common.framebuffer_addr;
     2046 +                end = start + fb_tagp->framebuffer_common.framebuffer_height *
     2047 +                    fb_tagp->framebuffer_common.framebuffer_pitch;
2033 2048  
2034      -                pte_bits |= PT_NOCACHE;
2035      -                while (start < end) {
2036      -                        map_pa_at_va(start, start, 0);
2037      -                        start += MMU_PAGESIZE;
     2049 +                /* VGA text memory is already mapped. */
     2050 +                if (fb_tagp->framebuffer_common.framebuffer_type !=
     2051 +                    MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT) {
     2052 +                        uint64_t vaddr;
     2053 +
     2054 +#if defined(_BOOT_TARGET_amd64)
     2055 +                        vaddr = start;
     2056 +#else
     2057 +                        vaddr = (uintptr_t)mem_alloc(end - start);
     2058 +#endif
     2059 +                        fb->boot_fb_virt = vaddr;
     2060 +                        if (map_debug) {
     2061 +                                dboot_printf("FB map pa=%" PRIx64 "..%"
     2062 +                                    PRIx64 "\n", start, end);
     2063 +                        }
     2064 +
     2065 +                        pte_bits |= PT_NOCACHE;
     2066 +                        if (PAT_support != 0)
     2067 +                                pte_bits |= PT_PAT_4K;
     2068 +
     2069 +                        while (start < end) {
     2070 +                                map_pa_at_va(start, vaddr, 0);
     2071 +                                start += MMU_PAGESIZE;
     2072 +                                vaddr += MMU_PAGESIZE;
     2073 +                        }
     2074 +                        pte_bits &= ~PT_NOCACHE;
     2075 +                        if (PAT_support != 0)
     2076 +                                pte_bits &= ~PT_PAT_4K;
2038 2077                  }
2039      -                pte_bits &= ~PT_NOCACHE;
2040 2078          }
2041 2079  #endif /* !__xpv */
2042 2080  
2043 2081          DBG_MSG("\nPage tables constructed\n");
2044 2082  }
2045 2083  
2046 2084  #define NO_MULTIBOOT    \
2047 2085  "multiboot is no longer used to boot the Solaris Operating System.\n\
2048 2086  The grub entry should be changed to:\n\
2049 2087  kernel$ /platform/i86pc/kernel/$ISADIR/unix\n\
↓ open down ↓ 5 lines elided ↑ open up ↑
2055 2093  {
2056 2094          uintptr_t addr;
2057 2095          /*
2058 2096           * boot info must be 16 byte aligned for 64 bit kernel ABI
2059 2097           */
2060 2098          addr = (uintptr_t)boot_info;
2061 2099          addr = (addr + 0xf) & ~0xf;
2062 2100          bi = (struct xboot_info *)addr;
2063 2101  
2064 2102  #if !defined(__xpv)
     2103 +        /*
     2104 +         * fb info must be 16 byte aligned for 64 bit kernel ABI
     2105 +         */
     2106 +        addr = (uintptr_t)framebuffer;
     2107 +        addr = (addr + 0xf) & ~0xf;
     2108 +        fb = (boot_framebuffer_t *)addr;
     2109 +        bi->bi_framebuffer = (native_ptr_t)(uintptr_t)fb;
     2110 +
2065 2111          switch (multiboot_version) {
2066 2112          case 1:
2067 2113                  dboot_multiboot1_xboot_consinfo();
2068 2114                  break;
2069 2115          case 2:
2070 2116                  dboot_multiboot2_xboot_consinfo();
2071 2117                  break;
2072 2118          default:
2073 2119                  dboot_panic("Unknown multiboot version: %d\n",
2074 2120                      multiboot_version);
2075 2121                  break;
2076 2122          }
2077 2123          /*
2078 2124           * Lookup environment module for the console. Complete module list
2079 2125           * will be built after console setup.
2080 2126           */
2081      -        dboot_find_env();
     2127 +        dboot_find_console_modules();
2082 2128  #endif
2083 2129  }
2084 2130  
2085 2131  /*
2086 2132   * Set up basic data from the boot loader.
2087 2133   * The load_addr is part of AOUT kludge setup in dboot_grub.s, to support
2088 2134   * 32-bit dboot code setup used to set up and start 64-bit kernel.
2089 2135   * AOUT kludge does allow 32-bit boot loader, such as grub1, to load and
2090 2136   * start 64-bit illumos kernel.
2091 2137   */
↓ open down ↓ 103 lines elided ↑ open up ↑
2195 2241  /*ARGSUSED*/
2196 2242  void
2197 2243  startup_kernel(void)
2198 2244  {
2199 2245          char *cmdline;
2200 2246          char *bootloader;
2201 2247  #if defined(__xpv)
2202 2248          physdev_set_iopl_t set_iopl;
2203 2249  #endif /* __xpv */
2204 2250  
     2251 +        bcons_init(NULL);       /* Set very early console to ttya. */
2205 2252          dboot_loader_init();
2206 2253          /*
2207 2254           * At this point we are executing in a 32 bit real mode.
2208 2255           */
2209 2256  
2210 2257          bootloader = dboot_loader_name();
2211 2258          cmdline = dboot_loader_cmdline();
2212 2259  
2213 2260  #if defined(__xpv)
2214 2261          /*
↓ open down ↓ 1 lines elided ↑ open up ↑
2216 2263           * need to enable io operations, so set I/O priveldge level to 1.
2217 2264           */
2218 2265          if (DOMAIN_IS_INITDOMAIN(xen_info)) {
2219 2266                  set_iopl.iopl = 1;
2220 2267                  (void) HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
2221 2268          }
2222 2269  #endif /* __xpv */
2223 2270  
2224 2271          dboot_init_xboot_consinfo();
2225 2272          bi->bi_cmdline = (native_ptr_t)(uintptr_t)cmdline;
2226      -        bcons_init(bi);
     2273 +        bcons_init(bi);         /* Now we can set the real console. */
2227 2274  
2228 2275          prom_debug = (find_boot_prop("prom_debug") != NULL);
2229 2276          map_debug = (find_boot_prop("map_debug") != NULL);
2230 2277  
2231 2278  #if !defined(__xpv)
2232 2279          dboot_multiboot_get_fwtables();
2233 2280  #endif
2234 2281          DBG_MSG("\n\nillumos prekernel set: ");
2235 2282          DBG_MSG(cmdline);
2236 2283          DBG_MSG("\n");
↓ open down ↓ 105 lines elided ↑ open up ↑
2342 2389                  uint32_t edx = get_cpuid_edx(&eax);
2343 2390  
2344 2391                  if (eax >= 0x80000001) {
2345 2392                          eax = 0x80000001;
2346 2393                          edx = get_cpuid_edx(&eax);
2347 2394                          if (edx & CPUID_AMD_EDX_NX)
2348 2395                                  NX_support = 1;
2349 2396                  }
2350 2397          }
2351 2398  
     2399 +        /*
     2400 +         * check for PAT support
     2401 +         */
     2402 +        {
     2403 +                uint32_t eax = 1;
     2404 +                uint32_t edx = get_cpuid_edx(&eax);
     2405 +
     2406 +                if (edx & CPUID_INTC_EDX_PAT)
     2407 +                        PAT_support = 1;
     2408 +        }
2352 2409  #if !defined(_BOOT_TARGET_amd64)
2353 2410  
2354 2411          /*
2355 2412           * The 32-bit hypervisor uses segmentation to protect itself from
2356 2413           * guests. This means when a guest attempts to install a flat 4GB
2357 2414           * code or data descriptor the 32-bit hypervisor will protect itself
2358 2415           * by silently shrinking the segment such that if the guest attempts
2359 2416           * any access where the hypervisor lives a #gp fault is generated.
2360 2417           * The problem is that some applications expect a full 4GB flat
2361 2418           * segment for their current thread pointer and will use negative
↓ open down ↓ 21 lines elided ↑ open up ↑
2383 2440                  uint32_t eax, edx;
2384 2441  
2385 2442                  eax = 1;
2386 2443                  edx = get_cpuid_edx(&eax);
2387 2444                  if (edx & CPUID_INTC_EDX_PSE)
2388 2445                          largepage_support = 1;
2389 2446                  if (edx & CPUID_INTC_EDX_PGE)
2390 2447                          pge_support = 1;
2391 2448                  if (edx & CPUID_INTC_EDX_PAE)
2392 2449                          pae_support = 1;
     2450 +                if (edx & CPUID_INTC_EDX_PAT)
     2451 +                        PAT_support = 1;
2393 2452  
2394 2453                  eax = 0x80000000;
2395 2454                  edx = get_cpuid_edx(&eax);
2396 2455                  if (eax >= 0x80000001) {
2397 2456                          eax = 0x80000001;
2398 2457                          edx = get_cpuid_edx(&eax);
2399 2458                          if (edx & CPUID_AMD_EDX_LM)
2400 2459                                  amd64_support = 1;
2401 2460                          if (edx & CPUID_AMD_EDX_NX)
2402 2461                                  NX_support = 1;
↓ open down ↓ 49 lines elided ↑ open up ↑
2452 2511          } else {
2453 2512                  pae_support = 0;
2454 2513                  NX_support = 0;
2455 2514                  shift_amt = shift_amt_nopae;
2456 2515                  ptes_per_table = 1024;
2457 2516                  pte_size = 4;
2458 2517                  lpagesize = FOUR_MEG;
2459 2518                  top_level = 1;
2460 2519          }
2461 2520  
     2521 +        DBG(PAT_support);
2462 2522          DBG(pge_support);
2463 2523          DBG(NX_support);
2464 2524          DBG(largepage_support);
2465 2525          DBG(amd64_support);
2466 2526          DBG(top_level);
2467 2527          DBG(pte_size);
2468 2528          DBG(ptes_per_table);
2469 2529          DBG(lpagesize);
2470 2530  
2471 2531  #if defined(__xpv)
↓ open down ↓ 79 lines elided ↑ open up ↑
2551 2611  #endif /* __xpv */
2552 2612  
2553 2613          bi->bi_kseg_size = FOUR_MEG;
2554 2614          DBG(bi->bi_kseg_size);
2555 2615  
2556 2616  #ifndef __xpv
2557 2617          if (map_debug)
2558 2618                  dump_tables();
2559 2619  #endif
2560 2620  
     2621 +#ifndef __xpv
     2622 +        /* Update boot info with FB data */
     2623 +        fb->cursor.origin.x = fb_info.cursor.origin.x;
     2624 +        fb->cursor.origin.y = fb_info.cursor.origin.y;
     2625 +        fb->cursor.pos.x = fb_info.cursor.pos.x;
     2626 +        fb->cursor.pos.y = fb_info.cursor.pos.y;
     2627 +        fb->cursor.visible = fb_info.cursor.visible;
     2628 +#endif
     2629 +
2561 2630          DBG_MSG("\n\n*** DBOOT DONE -- back to asm to jump to kernel\n\n");
2562 2631  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX