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_grub.s
+++ new/usr/src/uts/i86pc/dboot/dboot_grub.s
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 #if defined(__lint)
28 28
29 29 int silence_lint_warnings = 0;
30 30
31 31 #else /* __lint */
32 32
33 33 #include <sys/multiboot.h>
34 34 #include <sys/multiboot2.h>
35 35 #include <sys/asm_linkage.h>
36 36 #include <sys/segments.h>
37 37 #include <sys/controlregs.h>
38 38
39 39 #include "dboot_xboot.h"
40 40
41 41 .text
42 42 .globl _start
43 43 _start:
44 44 jmp code_start
45 45
46 46 /*
47 47 * The multiboot header has to be at the start of the file
48 48 *
49 49 * The 32 bit kernel is ELF32, so the MB header is mostly ignored.
50 50 *
51 51 * The 64 bit kernel is ELF64, so we get grub to load the entire
52 52 * ELF file into memory and trick it into jumping into this code.
53 53 * The trick is done by a binary utility run after unix is linked,
54 54 * that rewrites the mb_header.
55 55 */
56 56 .align 4
57 57 .globl mb_header
58 58 mb_header:
59 59 .long MB_HEADER_MAGIC /* magic number */
60 60 #if defined(_BOOT_TARGET_i386)
61 61 .long MB_HEADER_FLAGS_32 /* flags */
62 62 .long MB_HEADER_CHECKSUM_32 /* checksum */
63 63 #elif defined (_BOOT_TARGET_amd64)
64 64 .long MB_HEADER_FLAGS_64 /* flags */
65 65 .long MB_HEADER_CHECKSUM_64 /* checksum */
66 66 #else
67 67 #error No architecture defined
68 68 #endif
69 69 .long 0x11111111 /* header_addr: patched by mbh_patch */
70 70 .long 0x100000 /* load_addr: patched by mbh_patch */
71 71 .long 0 /* load_end_addr - 0 means entire file */
72 72 .long 0 /* bss_end_addr */
73 73 .long 0x2222222 /* entry_addr: patched by mbh_patch */
74 74 .long 0 /* video mode.. */
75 75 .long 0 /* width 0 == don't care */
76 76 .long 0 /* height 0 == don't care */
77 77 .long 0 /* depth 0 == don't care */
78 78
79 79 #if defined(_BOOT_TARGET_i386)
80 80 /*
81 81 * The MB2 header must be 8 byte aligned relative to the beginning of
82 82 * the in-memory ELF object. The 32-bit kernel ELF file has sections
83 83 * which are 4-byte aligned, and as .align family directives only do
84 84 * control the alignment inside the section, we need to construct the
85 85 * image manually, by inserting the padding where needed. The alignment
86 86 * setup here depends on the first PT_LOAD section of the ELF file, if
87 87 * this section offset will change, this code must be reviewed.
88 88 * Similarily, if we add extra tag types into the information request
89 89 * or add tags into the tag list.
90 90 */
91 91 .long 0 /* padding */
92 92 #else
93 93 .balign MULTIBOOT_HEADER_ALIGN
94 94 #endif
95 95 mb2_header:
96 96 .long MULTIBOOT2_HEADER_MAGIC
97 97 .long MULTIBOOT_ARCHITECTURE_I386
98 98 .long mb2_header_end - mb2_header
99 99 .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + (mb2_header_end - mb2_header))
100 100
101 101 /*
102 102 * Multiboot 2 tags follow. Note, the first tag immediately follows
103 103 * the header. Subsequent tags must be aligned by MULTIBOOT_TAG_ALIGN.
104 104 *
|
↓ open down ↓ |
104 lines elided |
↑ open up ↑ |
105 105 * MB information request tag.
106 106 */
107 107 information_request_tag_start:
108 108 .word MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST
109 109 .word 0
110 110 .long information_request_tag_end - information_request_tag_start
111 111 .long MULTIBOOT_TAG_TYPE_CMDLINE
112 112 .long MULTIBOOT_TAG_TYPE_MODULE
113 113 .long MULTIBOOT_TAG_TYPE_BOOTDEV
114 114 .long MULTIBOOT_TAG_TYPE_MMAP
115 + .long MULTIBOOT_TAG_TYPE_FRAMEBUFFER
115 116 .long MULTIBOOT_TAG_TYPE_BASIC_MEMINFO
116 117 information_request_tag_end:
117 - .long 0 /* padding */
118 118
119 119 #if defined (_BOOT_TARGET_amd64)
120 120 /*
121 121 * The following values are patched by mbh_patch for the 64-bit kernel,
122 122 * so we only provide this tag for the 64-bit kernel.
123 123 */
124 124 .balign MULTIBOOT_TAG_ALIGN
125 125 address_tag_start:
126 126 .word MULTIBOOT_HEADER_TAG_ADDRESS
127 127 .word 0
128 128 .long address_tag_end - address_tag_start
129 129 .long mb2_header
130 130 .globl mb2_load_addr
131 131 mb2_load_addr:
132 132 .long 0 /* load addr */
133 133 .long 0 /* load_end_addr */
134 134 .long 0 /* bss_end_addr */
135 135 address_tag_end:
136 136 /*
137 137 * entry address tag
138 138 */
139 139 .balign MULTIBOOT_TAG_ALIGN
140 140 entry_address_tag_start:
141 141 .word MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS
142 142 .word 0
143 143 .long entry_address_tag_end - entry_address_tag_start
144 144 .long 0 /* entry addr */
145 145 entry_address_tag_end:
146 146
147 147 .balign MULTIBOOT_TAG_ALIGN /* Alignment for the next tag */
148 148 #endif
149 149 /*
150 150 * MB console flags tag
|
↓ open down ↓ |
23 lines elided |
↑ open up ↑ |
151 151 */
152 152 console_tag_start:
153 153 .word MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS
154 154 .word 0
155 155 .long console_tag_end - console_tag_start
156 156 .long MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED
157 157 console_tag_end:
158 158 .long 0 /* padding */
159 159
160 160 /*
161 + * MB header framebuffer tag
162 + */
163 +framebuffer_tag_start:
164 + .word MULTIBOOT_HEADER_TAG_FRAMEBUFFER
165 + .word 0
166 + .long framebuffer_tag_end - framebuffer_tag_start
167 + .long 0 /* width - no preference */
168 + .long 0 /* height - no preference */
169 + .long 0 /* depth - no preference */
170 +framebuffer_tag_end:
171 + .long 0 /* padding */
172 +
173 + /*
161 174 * Tell the bootloader to load the modules page aligned to
162 175 * the specified alignment.
163 176 */
164 177 .word MULTIBOOT_HEADER_TAG_MODULE_ALIGN
165 178 .word 0
166 179 .long 8
167 180
168 181 /*
169 182 * Termination tag.
170 183 */
171 184 .word MULTIBOOT_HEADER_TAG_END
172 185 .word 0
173 186 .long 8
174 187 mb2_header_end:
175 188
176 189 /*
177 190 * At entry we are in protected mode, 32 bit execution, paging and
178 191 * interrupts are disabled.
179 192 *
180 193 * EAX == MB_BOOTLOADER_MAGIC
181 194 * EBX points to multiboot information
182 195 * segment registers all have segments with base 0, limit == 0xffffffff
183 196 */
184 197 code_start:
185 198 movl %eax, mb_magic
186 199 movl %ebx, mb_addr
187 200
188 201 movl $stack_space, %esp /* load my stack pointer */
189 202 addl $STACK_SIZE, %esp
190 203
191 204 pushl $0x0 /* push a dead-end frame */
192 205 pushl $0x0
193 206 movl %esp, %ebp
194 207
195 208 pushl $0x0 /* clear all processor flags */
196 209 popf
197 210
198 211 /*
199 212 * setup a global descriptor table with known contents
200 213 */
201 214 lgdt gdt_info
202 215 movw $B32DATA_SEL, %ax
203 216 movw %ax, %ds
204 217 movw %ax, %es
205 218 movw %ax, %fs
206 219 movw %ax, %gs
207 220 movw %ax, %ss
208 221 ljmp $B32CODE_SEL, $newgdt
209 222 newgdt:
210 223 nop
211 224
212 225 /*
213 226 * go off and determine memory config, build page tables, etc.
214 227 */
215 228 call startup_kernel
216 229
217 230
218 231 /*
219 232 * On amd64 we'll want the stack pointer to be 16 byte aligned.
220 233 */
221 234 andl $0xfffffff0, %esp
222 235
223 236 /*
224 237 * Enable PGE, PAE and large pages
225 238 */
226 239 movl %cr4, %eax
227 240 testl $1, pge_support
228 241 jz 1f
229 242 orl $CR4_PGE, %eax
230 243 1:
231 244 testl $1, pae_support
232 245 jz 1f
233 246 orl $CR4_PAE, %eax
234 247 1:
235 248 testl $1, largepage_support
236 249 jz 1f
237 250 orl $CR4_PSE, %eax
238 251 1:
239 252 movl %eax, %cr4
240 253
241 254 /*
242 255 * enable NX protection if processor supports it
243 256 */
244 257 testl $1, NX_support
245 258 jz 1f
246 259 movl $MSR_AMD_EFER, %ecx
247 260 rdmsr
248 261 orl $AMD_EFER_NXE, %eax
249 262 wrmsr
250 263 1:
251 264
252 265
253 266 /*
254 267 * load the pagetable base address into cr3
255 268 */
256 269 movl top_page_table, %eax
257 270 movl %eax, %cr3
258 271
259 272 #if defined(_BOOT_TARGET_amd64)
260 273 /*
261 274 * enable long mode
262 275 */
263 276 movl $MSR_AMD_EFER, %ecx
264 277 rdmsr
265 278 orl $AMD_EFER_LME, %eax
266 279 wrmsr
267 280 #endif
268 281
269 282 /*
270 283 * enable paging, write protection, alignment masking, but disable
271 284 * the cache disable and write through only bits.
272 285 */
273 286 movl %cr0, %eax
274 287 orl $_CONST(CR0_PG | CR0_WP | CR0_AM), %eax
275 288 andl $_BITNOT(CR0_NW | CR0_CD), %eax
276 289 movl %eax, %cr0
277 290 jmp paging_on
278 291 paging_on:
279 292
280 293 /*
281 294 * The xboot_info ptr gets passed to the kernel as its argument
282 295 */
283 296 movl bi, %edi
284 297 movl entry_addr_low, %esi
285 298
286 299 #if defined(_BOOT_TARGET_i386)
287 300
288 301 pushl %edi
289 302 call *%esi
290 303
291 304 #elif defined(_BOOT_TARGET_amd64)
292 305
293 306 /*
294 307 * We're still in compatibility mode with 32 bit execution.
295 308 * Switch to 64 bit mode now by switching to a 64 bit code segment.
296 309 * then set up and do a lret to get into 64 bit execution.
297 310 */
298 311 pushl $B64CODE_SEL
299 312 pushl $longmode
300 313 lret
301 314 longmode:
302 315 .code64
303 316 movq $0xffffffff00000000,%rdx
304 317 orq %rdx, %rsi /* set upper bits of entry addr */
305 318 notq %rdx
306 319 andq %rdx, %rdi /* clean %rdi for passing arg */
307 320 call *%rsi
308 321
309 322 #else
310 323 #error "undefined target"
311 324 #endif
312 325
313 326 .code32
314 327
315 328 /*
316 329 * if reset fails halt the system
317 330 */
318 331 ENTRY_NP(dboot_halt)
319 332 hlt
320 333 SET_SIZE(dboot_halt)
321 334
322 335 /*
323 336 * flush the TLB
324 337 */
325 338 ENTRY_NP(reload_cr3)
326 339 movl %cr3, %eax
327 340 movl %eax, %cr3
328 341 ret
329 342 SET_SIZE(reload_cr3)
330 343
331 344 /*
332 345 * Detect if we can do cpuid, see if we can change bit 21 of eflags.
333 346 * Note we don't do the bizarre tests for Cyrix CPUs in ml/locore.s.
334 347 * If you're on such a CPU, you're stuck with non-PAE 32 bit kernels.
335 348 */
336 349 ENTRY_NP(have_cpuid)
337 350 pushf
338 351 pushf
339 352 xorl %eax, %eax
340 353 popl %ecx
341 354 movl %ecx, %edx
342 355 xorl $0x200000, %ecx
343 356 pushl %ecx
344 357 popf
345 358 pushf
346 359 popl %ecx
347 360 cmpl %ecx, %edx
348 361 setne %al
349 362 popf
350 363 ret
351 364 SET_SIZE(have_cpuid)
352 365
353 366 /*
354 367 * We want the GDT to be on its own page for better performance
355 368 * running under hypervisors.
356 369 */
357 370 .skip 4096
358 371 #include "../boot/boot_gdt.s"
359 372 .skip 4096
360 373 .long 0
361 374
362 375 #endif /* __lint */
|
↓ open down ↓ |
192 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX