2 * Copyright (C) 2001-2003 Hewlett-Packard Co.
3 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
4 * Contributed by Mike Johnston <johnston@intel.com>
5 * Contributed by Chris Ahna <christopher.j.ahna@intel.com>
6 * Contributed by Fenghua Yu <fenghua.yu@intel.com>
7 * Contributed by Bibo Mao <bibo.mao@intel.com>
8 * Contributed by chandramouli narayanan <mouli@linux.intel.com>
9 * Edgar Hucek <hostmaster@ed-soft.at>
11 * Updated with code to fill bootparam converting EFI memory map to E820
12 * based on a Linux kernel patch provided by Edgar Hucek
15 * This file is part of the ELILO, the EFI Linux boot loader.
17 * ELILO is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2, or (at your option)
22 * ELILO is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with ELILO; see the file COPYING. If not, write to the Free
29 * Software Foundation, 59 Temple Place - Suite 330, Boston, MA
32 * Please check out the elilo.txt for complete documentation on how
33 * to use this program.
37 * This file contains all the x86_64 specific code expected by generic loader
46 extern loader_ops_t bzimage_loader, plain_loader, gzip_loader;
49 * Descriptor table base addresses & limits for Linux startup.
52 dt_addr_t gdt_addr = { 0x800, 0x94000 };
53 dt_addr_t idt_addr = { 0, 0 };
56 * Initial GDT layout for Linux startup.
67 0xFFFF, /* 4Gb - (0x100000*0x1000 = 4Gb) */
68 0x0000, /* base address=0 */
69 0x9A00, /* code read/exec */
70 0x00CF, /* granularity=4096, 386 (+5th nibble of limit) */
73 0xFFFF, /* 4Gb - (0x100000*0x1000 = 4Gb) */
74 0x0000, /* base address=0 */
75 0x9200, /* data read/write */
76 0x00CF, /* granularity=4096, 386 (+5th nibble of limit) */
79 UINTN sizeof_init_gdt = sizeof init_gdt;
82 * Highest available base memory address.
84 * For traditional kernels and loaders this is always at 0x90000.
85 * For updated kernels and loaders this is computed by taking the
86 * highest available base memory address and rounding down to the
87 * nearest 64 kB boundary and then subtracting 64 kB.
89 * A non-compressed kernel is automatically assumed to be an updated
90 * kernel. A compressed kernel that has bit 6 (0x40) set in the
91 * loader_flags field is also assumed to be an updated kernel.
94 UINTN high_base_mem = 0x90000;
97 * Highest available extended memory address.
99 * This is computed by taking the highest available extended memory
100 * address and rounding down to the nearest EFI_PAGE_SIZE (usually
102 * This is only used for backward compatibility.
105 UINTN high_ext_mem = 32 * 1024 * 1024;
107 /* This starting address will hold true for all of the loader types for now */
108 VOID *kernel_start = (void *)DEFAULT_KERNEL_START;
110 /* The kernel may load elsewhere if EFI firmware reserves kernel_start */
111 VOID *kernel_load_address = DEFAULT_KERNEL_START;
113 VOID *initrd_start = NULL;
114 UINTN initrd_size = 0;
117 sysdeps_init(EFI_HANDLE dev)
119 DBG_PRT((L"sysdeps_init()\n"));
122 * Register our loader(s)...
125 loader_register(&bzimage_loader);
126 loader_register(&plain_loader);
127 loader_register(&gzip_loader);
133 * Compute a starting address for the initial RAMdisk image.
134 * For now, this image is placed immediately after the end of
135 * the kernel memory. Inside the start_kernel() code, the
136 * RAMdisk image will be relocated to the top of available
140 sysdeps_initrd_get_addr(kdesc_t *kd, memdesc_t *imem)
142 DBG_PRT((L"initrd_get_addr()\n"));
145 ERR_PRT((L"kd="PTR_FMT" imem="PTR_FMT"", kd, imem));
149 VERB_PRT(3, Print(L"kstart="PTR_FMT" kentry="PTR_FMT" kend="PTR_FMT"\n",
150 kd->kstart, kd->kentry, kd->kend));
152 imem->start_addr = kd->kend;
154 VERB_PRT(3, Print(L"initrd start_addr="PTR_FMT" pgcnt=%d\n",
155 imem->start_addr, imem->pgcnt));
161 sysdeps_free_boot_params(boot_params_t *bp)
165 ZeroMem(&md, sizeof md);
166 md.md = (VOID *)(UINT64)bp->s.efi_mem_map;
170 static VOID find_bits(unsigned long mask, UINT8 *first, UINT8* len) {
171 unsigned char bit_pos = 0, bit_len = 0;
176 while (!(mask & 0x1)) {
189 * Get video information.
191 static INTN get_video_info(boot_params_t * bp) {
192 EFI_GUID GopProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
193 EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop_interface;
194 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Gop_info;
195 EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Gop_mode = NULL;
196 EFI_HANDLE *Gop_handle = NULL;
197 EFI_STATUS efi_status;
202 efi_status = uefi_call_wrapper(
209 (VOID **)Gop_handle);
211 if (EFI_ERROR(efi_status) && efi_status != EFI_BUFFER_TOO_SMALL) {
212 ERR_PRT((L"LocateHandle GopProtocol failed."));
215 Gop_handle = alloc(size, 0);
216 efi_status = uefi_call_wrapper(
223 (VOID **)Gop_handle);
224 if (EFI_ERROR(efi_status)) {
225 ERR_PRT((L"LocateHandle GopProtocol failed."));
230 for (i=0; i < size/sizeof(EFI_HANDLE); i++) {
232 efi_status = uefi_call_wrapper(
239 if (EFI_ERROR(efi_status)) {
242 Gop_mode = Gop_interface->Mode;
243 efi_status = uefi_call_wrapper(
244 Gop_interface->QueryMode,
250 if (!EFI_ERROR(efi_status))
252 if (EFI_ERROR(efi_status)) {
256 if (EFI_ERROR(efi_status) || i > (size/sizeof(EFI_HANDLE))) {
257 ERR_PRT((L"HandleProtocol GopProtocol failed."));
263 bp->s.orig_cursor_col = 0;
264 bp->s.orig_cursor_row = 0;
265 bp->s.orig_video_page = 0;
266 bp->s.orig_video_mode = 0;
267 bp->s.orig_video_cols = 0;
268 bp->s.orig_video_rows = 0;
269 bp->s.orig_ega_bx = 0;
270 bp->s.orig_video_points = 0;
272 bp->s.lfb_width = Gop_info->HorizontalResolution;
273 bp->s.lfb_height = Gop_info->VerticalResolution;
274 bp->s.lfb_base = Gop_mode->FrameBufferBase;
275 bp->s.lfb_size = Gop_mode->FrameBufferSize;
279 if (Gop_info->PixelFormat == PixelRedGreenBlueReserved8BitPerColor) {
280 bp->s.lfb_depth = 32;
281 bp->s.lfb_red_size = 8;
282 bp->s.lfb_red_pos = 0;
283 bp->s.lfb_green_size = 8;
284 bp->s.lfb_green_pos = 8;
285 bp->s.lfb_blue_size = 8;
286 bp->s.lfb_blue_pos = 16;
287 bp->s.lfb_rsvd_size = 8;
288 bp->s.lfb_rsvd_pos = 24;
289 bp->s.lfb_line_len = Gop_info->PixelsPerScanLine * 4;
291 } else if (Gop_info->PixelFormat == PixelBlueGreenRedReserved8BitPerColor) {
292 bp->s.lfb_depth = 32;
293 bp->s.lfb_red_size = 8;
294 bp->s.lfb_red_pos = 16;
295 bp->s.lfb_green_size = 8;
296 bp->s.lfb_green_pos = 8;
297 bp->s.lfb_blue_size = 8;
298 bp->s.lfb_blue_pos = 0;
299 bp->s.lfb_rsvd_size = 8;
300 bp->s.lfb_rsvd_pos = 24;
301 bp->s.lfb_line_len = Gop_info->PixelsPerScanLine * 4;
302 } else if (Gop_info->PixelFormat == PixelBitMask) {
303 find_bits(Gop_info->PixelInformation.RedMask,
304 &bp->s.lfb_red_pos, &bp->s.lfb_red_size);
305 find_bits(Gop_info->PixelInformation.GreenMask,
306 &bp->s.lfb_green_pos, &bp->s.lfb_green_size);
307 find_bits(Gop_info->PixelInformation.BlueMask,
308 &bp->s.lfb_blue_pos, &bp->s.lfb_blue_size);
309 find_bits(Gop_info->PixelInformation.ReservedMask,
310 &bp->s.lfb_rsvd_pos, &bp->s.lfb_rsvd_size);
311 bp->s.lfb_depth = bp->s.lfb_red_size + bp->s.lfb_green_size +
312 bp->s.lfb_blue_size + bp->s.lfb_rsvd_size;
313 bp->s.lfb_line_len = (Gop_info->PixelsPerScanLine * bp->s.lfb_depth) / 8;
316 bp->s.lfb_red_size = 0;
317 bp->s.lfb_red_pos = 0;
318 bp->s.lfb_green_size = 0;
319 bp->s.lfb_green_pos = 0;
320 bp->s.lfb_blue_size = 0;
321 bp->s.lfb_blue_pos = 0;
322 bp->s.lfb_rsvd_size = 0;
323 bp->s.lfb_rsvd_pos = 0;
324 bp->s.lfb_line_len = bp->s.lfb_width / 2;
329 /* Convert EFI memory map to E820 map for the operating system
330 * This code is based on a Linux kernel patch submitted by Edgar Hucek
333 /* Add a memory region to the e820 map */
334 static void add_memory_region (struct e820entry *e820_map,
336 unsigned long long start,
340 int x = *e820_nr_map;
343 Print(L"Too many entries in the memory map!\n");
347 if ((x > 0) && e820_map[x-1].addr + e820_map[x-1].size == start
348 && e820_map[x-1].type == type)
349 e820_map[x-1].size += size;
351 e820_map[x].addr = start;
352 e820_map[x].size = size;
353 e820_map[x].type = type;
358 void fill_e820map(boot_params_t *bp, mmap_desc_t *mdesc)
360 int nr_map, e820_nr_map = 0, i;
361 UINT64 start, end, size;
362 EFI_MEMORY_DESCRIPTOR *md, *p;
363 struct e820entry *e820_map;
365 nr_map = mdesc->map_size/mdesc->desc_size;
366 e820_map = (struct e820entry *)bp->s.e820_map;
368 for (i = 0, p = mdesc->md; i < nr_map; i++)
372 case EfiACPIReclaimMemory:
373 add_memory_region(e820_map, &e820_nr_map,
375 md->NumberOfPages << EFI_PAGE_SHIFT,
378 case EfiRuntimeServicesCode:
379 add_memory_region(e820_map, &e820_nr_map,
381 md->NumberOfPages << EFI_PAGE_SHIFT,
384 case EfiRuntimeServicesData:
385 case EfiReservedMemoryType:
386 case EfiMemoryMappedIO:
387 case EfiMemoryMappedIOPortSpace:
388 case EfiUnusableMemory:
390 add_memory_region(e820_map, &e820_nr_map,
392 md->NumberOfPages << EFI_PAGE_SHIFT,
397 case EfiBootServicesCode:
398 case EfiBootServicesData:
399 case EfiConventionalMemory:
400 start = md->PhysicalStart;
401 size = md->NumberOfPages << EFI_PAGE_SHIFT;
403 /* Fix up for BIOS that claims RAM in 640K-1MB region */
404 if (start < 0x100000ULL && end > 0xA0000ULL) {
405 if (start < 0xA0000ULL) {
407 * set memory map from start to 640K
409 add_memory_region(e820_map,
415 if (end <= 0x100000ULL)
418 * set memory map avoiding 640K to 1MB hole
423 add_memory_region(e820_map, &e820_nr_map,
424 start, size, E820_RAM);
426 case EfiACPIMemoryNVS:
427 add_memory_region(e820_map, &e820_nr_map,
429 md->NumberOfPages << EFI_PAGE_SHIFT,
433 /* We should not hit this case */
434 add_memory_region(e820_map, &e820_nr_map,
436 md->NumberOfPages << EFI_PAGE_SHIFT,
440 p = NextMemoryDescriptor(p, mdesc->desc_size);
442 bp->s.e820_nrmap = e820_nr_map;
446 * x86_64 specific boot parameters initialization routine
449 sysdeps_create_boot_params(
457 EFI_STATUS efi_status;
463 DBG_PRT((L"fill_boot_params()\n"));
465 if (!bp || !cmdline || !initrd || !cookie) {
466 ERR_PRT((L"bp="PTR_FMT" cmdline="PTR_FMT" initrd="PTR_FMT" cookie="PTR_FMT"",
467 bp, cmdline, initrd, cookie));
469 if (param_start != NULL) {
479 * Copy temporary boot sector and setup data storage to
480 * elilo allocated boot parameter storage. We only need
481 * the first two sectors (1K). The rest of the storage
482 * can be used by the command line.
484 if (param_start != NULL) {
485 CopyMem(bp, param_start, 0x2000);
491 * Save off our header revision information.
493 hdr_version = (bp->s.hdr_major << 8) | bp->s.hdr_minor;
496 * Clear out unused memory in boot sector image.
500 ZeroMem(&bp->s.unused_3, sizeof bp->s.unused_3);
501 ZeroMem(&bp->s.unused_4, sizeof bp->s.unused_4);
502 ZeroMem(&bp->s.unused_51, sizeof bp->s.unused_51);
503 ZeroMem(&bp->s.unused_52, sizeof bp->s.unused_52);
506 ZeroMem(bp->s.unused_8, sizeof bp->s.unused_8);
509 * Tell kernel this was loaded by an advanced loader type.
510 * If this field is zero, the initrd_start and initrd_size
511 * fields are ignored by the kernel.
514 bp->s.loader_type = LDRTYPE_ELILO;
517 * Setup command line information.
520 bp->s.cmdline_magik = CMDLINE_MAGIK;
521 bp->s.cmdline_offset = (UINT8 *)cmdline - (UINT8 *)bp;
524 * Clear out the cmdline_addr field so the kernel can find
527 bp->s.cmdline_addr = 0x0;
530 * Setup hard drive parameters.
531 * %%TBD - It should be okay to zero fill the hard drive
532 * info buffers. The kernel should do its own detection.
535 ZeroMem(bp->s.hd0_info, sizeof bp->s.hd0_info);
536 ZeroMem(bp->s.hd1_info, sizeof bp->s.hd1_info);
542 bp->s.alt_mem_k = high_ext_mem / 1024;
544 if (bp->s.alt_mem_k <= 65535)
545 bp->s.ext_mem_k = (UINT16)bp->s.alt_mem_k;
547 bp->s.ext_mem_k = 65535;
550 * Initial RAMdisk and root device stuff.
553 DBG_PRT((L"initrd->start_addr="PTR_FMT" initrd->pgcnt=%d\n",
554 initrd->start_addr, initrd->pgcnt));
556 /* These RAMdisk flags are not needed, just zero them. */
557 bp->s.ramdisk_flags = 0;
559 if (initrd->start_addr && initrd->pgcnt) {
560 /* %%TBD - This will probably have to be changed. */
561 bp->s.initrd_start = (UINT32)(UINT64)initrd->start_addr;
562 bp->s.initrd_size = (UINT32)(initrd->size);
564 * This is the RAMdisk root device for RedHat 2.2.x
565 * kernels (major 0x01, minor 0x00).
568 bp->s.orig_root_dev = 0x0100;
570 bp->s.initrd_start = 0;
571 bp->s.initrd_size = 0;
577 bp->s.apm_bios_ver = NO_APM_BIOS;
578 bp->s.bios_code_seg = 0;
579 bp->s.bios_entry_point = 0;
580 bp->s.bios_code_seg16 = 0;
581 bp->s.bios_data_seg = 0;
582 bp->s.apm_bios_flags = 0;
583 bp->s.bios_code_len = 0;
584 bp->s.bios_data_len = 0;
587 * MCA BIOS info (misnomer).
589 bp->s.mca_info_len = 0;
590 ZeroMem(bp->s.mca_info_buf, sizeof bp->s.mca_info_buf);
593 * Pointing device presence. The kernel will detect this.
595 bp->s.aux_dev_info = NO_MOUSE;
598 * EFI loader signature
600 CopyMem(bp->s.efi_loader_sig, EFI_LOADER_SIG_X64, 4);
603 * Kernel entry point.
605 bp->s.kernel_start = (UINT32)(UINT64)kernel_start;
608 * When changing stuff in the parameter structure compare
609 * the offsets of the fields with the offsets used in the
610 * boot sector and setup source files.
611 * arch/x86_64/boot/bootsect.S
612 * arch/x86_64/boot/setup.S
613 * arch/x86_64/kernel/setup.c
614 * include/asm-x86_64/setup.h (2.5/2.6)
617 #define CHECK_OFFSET(n, o, f) \
619 UINTN p = (UINT8 *)&bp->s.n - (UINT8 *)bp; \
620 UINTN q = (UINTN)(o); \
623 Print(L"%20a: %3xh %3xh ", #n, p, q); \
631 #define WAIT_FOR_KEY() \
634 while (uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, &key) != EFI_SUCCESS) { \
641 CHECK_OFFSET(orig_cursor_col, 0x00, L"%xh");
642 CHECK_OFFSET(orig_cursor_row, 0x01, L"%xh");
643 CHECK_OFFSET(ext_mem_k, 0x02, L"%xh");
644 CHECK_OFFSET(orig_video_page, 0x04, L"%xh");
645 CHECK_OFFSET(orig_video_mode, 0x06, L"%xh");
646 CHECK_OFFSET(orig_video_cols, 0x07, L"%xh");
647 CHECK_OFFSET(orig_ega_bx, 0x0A, L"%xh");
648 CHECK_OFFSET(orig_video_rows, 0x0E, L"%xh");
649 CHECK_OFFSET(is_vga, 0x0F, L"%xh");
650 CHECK_OFFSET(orig_video_points, 0x10, L"%xh");
651 CHECK_OFFSET(lfb_width, 0x12, L"%xh");
652 CHECK_OFFSET(lfb_height, 0x14, L"%xh");
653 CHECK_OFFSET(lfb_depth, 0x16, L"%xh");
654 CHECK_OFFSET(lfb_base, 0x18, L"%xh");
655 CHECK_OFFSET(lfb_size, 0x1C, L"%xh");
656 CHECK_OFFSET(cmdline_magik, 0x20, L"%xh");
657 CHECK_OFFSET(cmdline_offset, 0x22, L"%xh");
658 CHECK_OFFSET(lfb_line_len, 0x24, L"%xh");
659 CHECK_OFFSET(lfb_red_size, 0x26, L"%xh");
660 CHECK_OFFSET(lfb_red_pos, 0x27, L"%xh");
661 CHECK_OFFSET(lfb_green_size, 0x28, L"%xh");
662 CHECK_OFFSET(lfb_green_pos, 0x29, L"%xh");
663 CHECK_OFFSET(lfb_blue_size, 0x2A, L"%xh");
664 CHECK_OFFSET(lfb_blue_pos, 0x2B, L"%xh");
665 CHECK_OFFSET(lfb_rsvd_size, 0x2C, L"%xh");
666 CHECK_OFFSET(lfb_rsvd_pos, 0x2D, L"%xh");
667 CHECK_OFFSET(vesa_seg, 0x2E, L"%xh");
668 CHECK_OFFSET(vesa_off, 0x30, L"%xh");
669 CHECK_OFFSET(lfb_pages, 0x32, L"%xh");
670 CHECK_OFFSET(lfb_reserved, 0x34, L"");
671 CHECK_OFFSET(apm_bios_ver, 0x40, L"%xh");
672 CHECK_OFFSET(bios_code_seg, 0x42, L"%xh");
673 CHECK_OFFSET(bios_entry_point, 0x44, L"%xh");
674 CHECK_OFFSET(bios_code_seg16, 0x48, L"%xh");
675 CHECK_OFFSET(bios_data_seg, 0x4A, L"%xh");
676 CHECK_OFFSET(apm_bios_flags, 0x4C, L"%xh");
677 CHECK_OFFSET(bios_code_len, 0x4E, L"%xh");
678 CHECK_OFFSET(bios_data_len, 0x52, L"%xh");
679 CHECK_OFFSET(hd0_info, 0x80, L"");
680 CHECK_OFFSET(hd1_info, 0x90, L"");
681 CHECK_OFFSET(mca_info_len, 0xA0, L"%xh");
682 CHECK_OFFSET(mca_info_buf, 0xA2, L"");
683 CHECK_OFFSET(efi_loader_sig, 0x1C0, L"'%-4.4a'");
684 CHECK_OFFSET(efi_sys_tbl, 0x1C4, L"%xh");
685 CHECK_OFFSET(efi_mem_desc_size, 0x1C8, L"%xh");
686 CHECK_OFFSET(efi_mem_desc_ver, 0x1CC, L"%xh");
687 CHECK_OFFSET(efi_mem_map, 0x1D0, L"%xh");
688 CHECK_OFFSET(efi_mem_map_size, 0x1D4, L"%xh");
689 CHECK_OFFSET(efi_sys_tbl_hi, 0x1D8, L"%xh");
690 CHECK_OFFSET(efi_mem_map_hi, 0x1DC, L"%xh");
691 CHECK_OFFSET(alt_mem_k, 0x1E0, L"%xh");
692 CHECK_OFFSET(setup_sectors, 0x1F1, L"%xh");
693 CHECK_OFFSET(mount_root_rdonly, 0x1F2, L"%xh");
694 CHECK_OFFSET(sys_size, 0x1F4, L"%xh");
695 CHECK_OFFSET(swap_dev, 0x1F6, L"%xh");
696 CHECK_OFFSET(ramdisk_flags, 0x1F8, L"%xh");
697 CHECK_OFFSET(video_mode_flag, 0x1FA, L"%xh");
698 CHECK_OFFSET(orig_root_dev, 0x1FC, L"%xh");
699 CHECK_OFFSET(aux_dev_info, 0x1FF, L"%xh");
700 CHECK_OFFSET(jump, 0x200, L"%xh");
701 CHECK_OFFSET(setup_sig, 0x202, L"'%-4.4a'");
702 CHECK_OFFSET(hdr_minor, 0x206, L"%xh");
703 CHECK_OFFSET(hdr_major, 0x207, L"%xh");
704 CHECK_OFFSET(rm_switch, 0x208, L"%xh");
705 CHECK_OFFSET(start_sys_seg, 0x20C, L"%xh");
706 CHECK_OFFSET(kernel_verstr_offset, 0x20E, L"%xh");
707 CHECK_OFFSET(loader_type, 0x210, L"%xh");
708 CHECK_OFFSET(loader_flags, 0x211, L"%xh");
709 CHECK_OFFSET(setup_move_size, 0x212, L"%xh");
710 CHECK_OFFSET(kernel_start, 0x214, L"%xh");
711 CHECK_OFFSET(initrd_start, 0x218, L"%xh");
712 CHECK_OFFSET(initrd_size, 0x21C, L"%xh");
713 CHECK_OFFSET(bootsect_helper, 0x220, L"%xh");
714 CHECK_OFFSET(heap_end_ptr, 0x224, L"%xh");
715 CHECK_OFFSET(cmdline_addr, 0x228, L"%xh");
718 ERR_PRT((L"Boot sector and/or setup parameter alignment error."));
725 * Get video information.
726 * Do this last so that any other cursor positioning done
727 * in the fill routine gets accounted for.
730 if (!get_video_info(bp)) goto do_memmap;
732 /* Do the old text mode */
733 efi_status = uefi_call_wrapper(
734 ST->ConOut->QueryMode,
737 ST->ConOut->Mode->Mode,
741 if (EFI_ERROR(efi_status)) {
742 ERR_PRT((L"QueryMode failed. Fake it."));
749 mode = (UINT8)ST->ConOut->Mode->Mode;
750 col = (UINT8)ST->ConOut->Mode->CursorColumn;
751 row = (UINT8)ST->ConOut->Mode->CursorRow;
754 bp->s.orig_cursor_col = col;
755 bp->s.orig_cursor_row = row;
756 bp->s.orig_video_page = 0;
757 bp->s.orig_video_mode = mode;
758 bp->s.orig_video_cols = (UINT8)cols;
759 bp->s.orig_video_rows = (UINT8)rows;
761 bp->s.orig_ega_bx = 0;
763 bp->s.orig_video_points = 16;
766 bp->s.lfb_height = 0;
770 bp->s.lfb_line_len = 0;
771 bp->s.lfb_red_size = 0;
772 bp->s.lfb_red_pos = 0;
773 bp->s.lfb_green_size = 0;
774 bp->s.lfb_green_pos = 0;
775 bp->s.lfb_blue_size = 0;
776 bp->s.lfb_blue_pos = 0;
777 bp->s.lfb_rsvd_size = 0;
778 bp->s.lfb_rsvd_pos = 0;
785 * Get memory map description and cookie for ExitBootServices()
788 if (get_memmap(&mdesc)) {
789 ERR_PRT((L"Could not get memory map."));
793 *cookie = mdesc.cookie;
794 bp->s.efi_mem_map = (UINT32)(unsigned long)mdesc.md;
795 bp->s.efi_mem_map_size = mdesc.map_size;
796 bp->s.efi_mem_desc_size = mdesc.desc_size;
797 bp->s.efi_mem_desc_ver = mdesc.desc_version;
798 bp->s.efi_sys_tbl = (UINT32)(unsigned long)systab;
799 bp->s.efi_mem_map_hi = (unsigned long)mdesc.md >> 32;
800 bp->s.efi_sys_tbl_hi = (unsigned long)systab >> 32;
801 /* Now that we have EFI memory map, convert it to E820 map
802 * and update the bootparam accordingly
804 fill_e820map(bp, &mdesc);