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>
7 * This file is part of the ELILO, the EFI Linux boot loader.
9 * ELILO is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
14 * ELILO is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with ELILO; see the file COPYING. If not, write to the Free
21 * Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 * Please check out the elilo.txt for complete documentation on how
25 * to use this program.
29 * This file contains all the IA-32 specific code expected by generic loader
38 extern loader_ops_t bzimage_loader, plain_loader, gzip_loader;
41 * Descriptor table base addresses & limits for Linux startup.
44 dt_addr_t gdt_addr = { 0x800, 0x94000 };
45 dt_addr_t idt_addr = { 0, 0 };
48 * Initial GDT layout for Linux startup.
59 0xFFFF, /* 4Gb - (0x100000*0x1000 = 4Gb) */
60 0x0000, /* base address=0 */
61 0x9A00, /* code read/exec */
62 0x00CF, /* granularity=4096, 386 (+5th nibble of limit) */
65 0xFFFF, /* 4Gb - (0x100000*0x1000 = 4Gb) */
66 0x0000, /* base address=0 */
67 0x9200, /* data read/write */
68 0x00CF, /* granularity=4096, 386 (+5th nibble of limit) */
71 UINTN sizeof_init_gdt = sizeof init_gdt;
74 * Highest available base memory address.
76 * For traditional kernels and loaders this is always at 0x90000.
77 * For updated kernels and loaders this is computed by taking the
78 * highest available base memory address and rounding down to the
79 * nearest 64 kB boundary and then subtracting 64 kB.
81 * A non-compressed kernel is automatically assumed to be an updated
82 * kernel. A compressed kernel that has bit 6 (0x40) set in the
83 * loader_flags field is also assumed to be an updated kernel.
86 UINTN high_base_mem = 0x90000;
89 * Highest available extended memory address.
91 * This is computed by taking the highest available extended memory
92 * address and rounding down to the nearest EFI_PAGE_SIZE (usually
94 * This is only used for backward compatibility.
97 UINTN high_ext_mem = 32 * 1024 * 1024;
99 /* This starting address will hold true for all of the loader types for now */
100 VOID *kernel_start = (VOID *)0x100000; /* 1M */
102 VOID *initrd_start = NULL;
103 UINTN initrd_size = 0;
106 sysdeps_init(EFI_HANDLE dev)
108 DBG_PRT((L"sysdeps_init()\n"));
111 * Register our loader(s)...
114 loader_register(&bzimage_loader);
115 loader_register(&plain_loader);
116 loader_register(&gzip_loader);
122 * Compute a starting address for the initial RAMdisk image.
123 * For now, this image is placed immediately after the end of
124 * the kernel memory. Inside the start_kernel() code, the
125 * RAMdisk image will be relocated to the top of available
129 sysdeps_initrd_get_addr(kdesc_t *kd, memdesc_t *imem)
131 DBG_PRT((L"initrd_get_addr()\n"));
134 ERR_PRT((L"kd=0x%x imem=0x%x", kd, imem));
138 VERB_PRT(3, Print(L"kstart=0x%x kentry=0x%x kend=0x%x\n",
139 kd->kstart, kd->kentry, kd->kend));
141 imem->start_addr = kd->kend;
143 VERB_PRT(3, Print(L"initrd start_addr=0x%x pgcnt=%d\n",
144 imem->start_addr, imem->pgcnt));
150 sysdeps_free_boot_params(boot_params_t *bp)
154 ZeroMem(&md, sizeof md);
155 md.md = (VOID *)bp->s.efi_mem_map;
160 * Get video information.
162 static INTN get_video_info(boot_params_t * bp) {
163 EFI_GUID GopProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
164 EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop_interface;
165 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Gop_info;
166 EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Gop_mode;
167 EFI_HANDLE *Gop_handle;
168 EFI_STATUS efi_status;
172 efi_status = uefi_call_wrapper(
179 (VOID **)Gop_handle);
181 if (EFI_ERROR(efi_status) && efi_status != EFI_BUFFER_TOO_SMALL) {
182 ERR_PRT((L"LocateHandle GopProtocol failed."));
185 Gop_handle = alloc(size, 0);
186 efi_status = uefi_call_wrapper(
193 (VOID **)Gop_handle);
194 if (EFI_ERROR(efi_status)) {
195 ERR_PRT((L"LocateHandle GopProtocol failed."));
200 for (i=0; i < size/sizeof(EFI_HANDLE); i++) {
202 efi_status = uefi_call_wrapper(
209 if (EFI_ERROR(efi_status)) {
212 Gop_mode = Gop_interface->Mode;
213 efi_status = uefi_call_wrapper(
214 Gop_interface->QueryMode,
220 if (!EFI_ERROR(efi_status))
222 if (EFI_ERROR(efi_status)) {
226 if (EFI_ERROR(efi_status) || i > (size/sizeof(EFI_HANDLE))) {
227 ERR_PRT((L"HandleProtocol GopProtocol failed."));
233 bp->s.orig_cursor_col = 0;
234 bp->s.orig_cursor_row = 0;
235 bp->s.orig_video_page = 0;
236 bp->s.orig_video_mode = 0;
237 bp->s.orig_video_cols = 0;
238 bp->s.orig_video_rows = 0;
239 bp->s.orig_ega_bx = 0;
240 bp->s.orig_video_points = 0;
242 bp->s.lfb_width = Gop_info->HorizontalResolution;
243 bp->s.lfb_height = Gop_info->VerticalResolution;
244 bp->s.lfb_base = Gop_mode->FrameBufferBase;
245 bp->s.lfb_size = Gop_mode->FrameBufferSize;
249 if (Gop_info->PixelFormat == PixelRedGreenBlueReserved8BitPerColor) {
250 bp->s.lfb_depth = 32;
251 bp->s.lfb_red_size = 8;
252 bp->s.lfb_red_pos = 0;
253 bp->s.lfb_green_size = 8;
254 bp->s.lfb_green_pos = 8;
255 bp->s.lfb_blue_size = 8;
256 bp->s.lfb_blue_pos = 16;
257 bp->s.lfb_rsvd_size = 8;
258 bp->s.lfb_rsvd_pos = 24;
259 bp->s.lfb_line_len = Gop_info->PixelsPerScanLine * 4;
261 } else if (Gop_info->PixelFormat == PixelBlueGreenRedReserved8BitPerColor) {
262 bp->s.lfb_depth = 32;
263 bp->s.lfb_red_size = 8;
264 bp->s.lfb_red_pos = 16;
265 bp->s.lfb_green_size = 8;
266 bp->s.lfb_green_pos = 8;
267 bp->s.lfb_blue_size = 8;
268 bp->s.lfb_blue_pos = 0;
269 bp->s.lfb_rsvd_size = 8;
270 bp->s.lfb_rsvd_pos = 24;
271 bp->s.lfb_line_len = Gop_info->PixelsPerScanLine * 4;
272 } else if (Gop_info->PixelFormat == PixelBitMask) {
273 find_bits(Gop_info->PixelInformation.RedMask,
274 &bp->s.lfb_red_pos, &bp->s.lfb_red_size);
275 find_bits(Gop_info->PixelInformation.GreenMask,
276 &bp->s.lfb_green_pos, &bp->s.lfb_green_size);
277 find_bits(Gop_info->PixelInformation.BlueMask,
278 &bp->s.lfb_blue_pos, &bp->s.lfb_blue_size);
279 find_bits(Gop_info->PixelInformation.ReservedMask,
280 &bp->s.lfb_rsvd_pos, &bp->s.lfb_rsvd_size);
281 bp->s.lfb_depth = bp->s.lfb_red_size + bp->s.lfb_green_size +
282 bp->s.lfb_blue_size + bp->s.lfb_rsvd_size;
283 bp->s.lfb_line_len = (Gop_info->PixelsPerScanLine * bp->s.lfb_depth) / 8;
286 bp->s.lfb_red_size = 0;
287 bp->s.lfb_red_pos = 0;
288 bp->s.lfb_green_size = 0;
289 bp->s.lfb_green_pos = 0;
290 bp->s.lfb_blue_size = 0;
291 bp->s.lfb_blue_pos = 0;
292 bp->s.lfb_rsvd_size = 0;
293 bp->s.lfb_rsvd_pos = 0;
294 bp->s.lfb_line_len = bp->s.lfb_width / 2;
299 /* Convert EFI memory map to E820 map for the operating system
300 * This code is based on a Linux kernel patch submitted by Edgar Hucek
303 /* Add a memory region to the e820 map */
304 static void add_memory_region (struct e820entry *e820_map,
310 int x = *e820_nr_map;
313 Print(L"Too many entries in the memory map!\n");
317 if ((x > 0) && e820_map[x-1].addr + e820_map[x-1].size == start
318 && e820_map[x-1].type == type)
319 e820_map[x-1].size += size;
321 e820_map[x].addr = start;
322 e820_map[x].size = size;
323 e820_map[x].type = type;
328 void fill_e820map(boot_params_t *bp, mmap_desc_t *mdesc)
330 int nr_map, e820_nr_map = 0, i;
331 UINT64 start, end, size;
332 EFI_MEMORY_DESCRIPTOR *md, *p;
333 struct e820entry *e820_map;
335 nr_map = mdesc->map_size/mdesc->desc_size;
336 e820_map = (struct e820entry *)bp->s.e820_map;
338 for (i = 0, p = mdesc->md; i < nr_map; i++)
342 case EfiACPIReclaimMemory:
343 add_memory_region(e820_map, &e820_nr_map,
345 md->NumberOfPages << EFI_PAGE_SHIFT,
348 case EfiRuntimeServicesCode:
349 case EfiRuntimeServicesData:
350 case EfiReservedMemoryType:
351 case EfiMemoryMappedIO:
352 case EfiMemoryMappedIOPortSpace:
353 case EfiUnusableMemory:
355 add_memory_region(e820_map, &e820_nr_map,
357 md->NumberOfPages << EFI_PAGE_SHIFT,
362 case EfiBootServicesCode:
363 case EfiBootServicesData:
364 case EfiConventionalMemory:
365 start = md->PhysicalStart;
366 size = md->NumberOfPages << EFI_PAGE_SHIFT;
368 /* Fix up for BIOS that claims RAM in 640K-1MB region */
369 if (start < 0x100000ULL && end > 0xA0000ULL) {
370 if (start < 0xA0000ULL) {
372 * set memory map from start to 640K
374 add_memory_region(e820_map,
380 if (end <= 0x100000ULL)
383 * set memory map avoiding 640K to 1MB hole
388 add_memory_region(e820_map, &e820_nr_map,
389 start, size, E820_RAM);
391 case EfiACPIMemoryNVS:
392 add_memory_region(e820_map, &e820_nr_map,
394 md->NumberOfPages << EFI_PAGE_SHIFT,
398 /* We should not hit this case */
399 add_memory_region(e820_map, &e820_nr_map,
401 md->NumberOfPages << EFI_PAGE_SHIFT,
405 p = NextMemoryDescriptor(p, mdesc->desc_size);
407 bp->s.e820_nrmap = e820_nr_map;
411 * IA-32 specific boot parameters initialization routine
414 sysdeps_create_boot_params(
418 memdesc_t *vmcode, /* no use for ia32 now*/
422 EFI_STATUS efi_status;
428 DBG_PRT((L"fill_boot_params()\n"));
430 if (!bp || !cmdline || !initrd || !cookie) {
431 ERR_PRT((L"bp=0x%x cmdline=0x%x initrd=0x%x cookie=0x%x",
432 bp, cmdline, initrd, cookie));
434 if (param_start != NULL) {
444 * Copy temporary boot sector and setup data storage to
445 * elilo allocated boot parameter storage. We only need
446 * the first two sectors (1K). The rest of the storage
447 * can be used by the command line.
449 if (param_start != NULL) {
450 CopyMem(bp, param_start, 0x2000);
456 * Save off our header revision information.
458 hdr_version = (bp->s.hdr_major << 8) | bp->s.hdr_minor;
461 * Clear out unused memory in boot sector image.
465 ZeroMem(bp->s.unused_3, sizeof bp->s.unused_3);
466 ZeroMem(bp->s.unused_4, sizeof bp->s.unused_4);
467 ZeroMem(&bp->s.unused_51, sizeof bp->s.unused_51);
468 ZeroMem(bp->s.unused_52, sizeof bp->s.unused_52);
471 ZeroMem(bp->s.unused_8, sizeof bp->s.unused_8);
474 * Tell kernel this was loaded by an advanced loader type.
475 * If this field is zero, the initrd_start and initrd_size
476 * fields are ignored by the kernel.
479 bp->s.loader_type = LDRTYPE_ELILO;
482 * Setup command line information.
485 bp->s.cmdline_magik = CMDLINE_MAGIK;
486 bp->s.cmdline_offset = (UINT8 *)cmdline - (UINT8 *)bp;
489 * Clear out the cmdline_addr field so the kernel can find
492 bp->s.cmdline_addr = 0x0;
495 * Setup hard drive parameters.
496 * %%TBD - It should be okay to zero fill the hard drive
497 * info buffers. The kernel should do its own detection.
500 ZeroMem(bp->s.hd0_info, sizeof bp->s.hd0_info);
501 ZeroMem(bp->s.hd1_info, sizeof bp->s.hd1_info);
507 bp->s.alt_mem_k = high_ext_mem / 1024;
509 if (bp->s.alt_mem_k <= 65535)
510 bp->s.ext_mem_k = (UINT16)bp->s.alt_mem_k;
512 bp->s.ext_mem_k = 65535;
515 * Initial RAMdisk and root device stuff.
518 DBG_PRT((L"initrd->start_addr=0x%x initrd->pgcnt=%d\n",
519 initrd->start_addr, initrd->pgcnt));
521 /* These RAMdisk flags are not needed, just zero them. */
522 bp->s.ramdisk_flags = 0;
524 if (initrd->start_addr && initrd->pgcnt) {
525 /* %%TBD - This will probably have to be changed. */
526 bp->s.initrd_start = (UINT32)initrd->start_addr;
527 bp->s.initrd_size = (UINT32)(initrd->size);
530 * This is the RAMdisk root device for RedHat 2.2.x
531 * kernels (major 0x01, minor 0x00).
534 bp->s.orig_root_dev = 0x0100;
536 bp->s.initrd_start = 0;
537 bp->s.initrd_size = 0;
543 bp->s.apm_bios_ver = NO_APM_BIOS;
544 bp->s.bios_code_seg = 0;
545 bp->s.bios_entry_point = 0;
546 bp->s.bios_code_seg16 = 0;
547 bp->s.bios_data_seg = 0;
548 bp->s.apm_bios_flags = 0;
549 bp->s.bios_code_len = 0;
550 bp->s.bios_data_len = 0;
553 * MCA BIOS info (misnomer).
555 bp->s.mca_info_len = 0;
556 ZeroMem(bp->s.mca_info_buf, sizeof bp->s.mca_info_buf);
559 * Pointing device presence. The kernel will detect this.
561 bp->s.aux_dev_info = NO_MOUSE;
564 * EFI loader signature
566 CopyMem(bp->s.efi_loader_sig, EFI_LOADER_SIG_IA32, 4);
569 * Kernel entry point.
571 bp->s.kernel_start = (UINT32)kernel_start;
574 * When changing stuff in the parameter structure compare
575 * the offsets of the fields with the offsets used in the
576 * boot sector and setup source files.
577 * arch/i386/boot/bootsect.S
578 * arch/i386/boot/setup.S
579 * arch/i386/kernel/setup.c
580 * include/asm-i386/setup.h (2.5/2.6)
583 #define CHECK_OFFSET(n, o, f) \
585 UINTN p = (UINT8 *)&bp->s.n - (UINT8 *)bp; \
586 UINTN q = (UINTN)(o); \
589 Print(L"%20a: %3xh %3xh ", #n, p, q); \
597 #define WAIT_FOR_KEY() \
600 while (ST->ConIn->ReadKeyStroke(ST->ConIn, &key) != EFI_SUCCESS) { \
607 CHECK_OFFSET(orig_cursor_col, 0x00, L"%xh");
608 CHECK_OFFSET(orig_cursor_row, 0x01, L"%xh");
609 CHECK_OFFSET(ext_mem_k, 0x02, L"%xh");
610 CHECK_OFFSET(orig_video_page, 0x04, L"%xh");
611 CHECK_OFFSET(orig_video_mode, 0x06, L"%xh");
612 CHECK_OFFSET(orig_video_cols, 0x07, L"%xh");
613 CHECK_OFFSET(orig_ega_bx, 0x0A, L"%xh");
614 CHECK_OFFSET(orig_video_rows, 0x0E, L"%xh");
615 CHECK_OFFSET(is_vga, 0x0F, L"%xh");
616 CHECK_OFFSET(orig_video_points, 0x10, L"%xh");
617 CHECK_OFFSET(lfb_width, 0x12, L"%xh");
618 CHECK_OFFSET(lfb_height, 0x14, L"%xh");
619 CHECK_OFFSET(lfb_depth, 0x16, L"%xh");
620 CHECK_OFFSET(lfb_base, 0x18, L"%xh");
621 CHECK_OFFSET(lfb_size, 0x1C, L"%xh");
622 CHECK_OFFSET(cmdline_magik, 0x20, L"%xh");
623 CHECK_OFFSET(cmdline_offset, 0x22, L"%xh");
624 CHECK_OFFSET(lfb_line_len, 0x24, L"%xh");
625 CHECK_OFFSET(lfb_red_size, 0x26, L"%xh");
626 CHECK_OFFSET(lfb_red_pos, 0x27, L"%xh");
627 CHECK_OFFSET(lfb_green_size, 0x28, L"%xh");
628 CHECK_OFFSET(lfb_green_pos, 0x29, L"%xh");
629 CHECK_OFFSET(lfb_blue_size, 0x2A, L"%xh");
630 CHECK_OFFSET(lfb_blue_pos, 0x2B, L"%xh");
631 CHECK_OFFSET(lfb_rsvd_size, 0x2C, L"%xh");
632 CHECK_OFFSET(lfb_rsvd_pos, 0x2D, L"%xh");
633 CHECK_OFFSET(vesa_seg, 0x2E, L"%xh");
634 CHECK_OFFSET(vesa_off, 0x30, L"%xh");
635 CHECK_OFFSET(lfb_pages, 0x32, L"%xh");
636 CHECK_OFFSET(lfb_reserved, 0x34, L"");
637 CHECK_OFFSET(apm_bios_ver, 0x40, L"%xh");
638 CHECK_OFFSET(bios_code_seg, 0x42, L"%xh");
639 CHECK_OFFSET(bios_entry_point, 0x44, L"%xh");
640 CHECK_OFFSET(bios_code_seg16, 0x48, L"%xh");
641 CHECK_OFFSET(bios_data_seg, 0x4A, L"%xh");
642 CHECK_OFFSET(apm_bios_flags, 0x4C, L"%xh");
643 CHECK_OFFSET(bios_code_len, 0x4E, L"%xh");
644 CHECK_OFFSET(bios_data_len, 0x52, L"%xh");
645 CHECK_OFFSET(hd0_info, 0x80, L"");
646 CHECK_OFFSET(hd1_info, 0x90, L"");
647 CHECK_OFFSET(mca_info_len, 0xA0, L"%xh");
648 CHECK_OFFSET(mca_info_buf, 0xA2, L"");
649 CHECK_OFFSET(efi_loader_sig, 0x1C0, L"'%-4.4a'");
650 CHECK_OFFSET(efi_sys_tbl, 0x1C4, L"%xh");
651 CHECK_OFFSET(efi_mem_desc_size, 0x1C8, L"%xh");
652 CHECK_OFFSET(efi_mem_desc_ver, 0x1CC, L"%xh");
653 CHECK_OFFSET(efi_mem_map, 0x1D0, L"%xh");
654 CHECK_OFFSET(efi_mem_map_size, 0x1D4, L"%xh");
655 CHECK_OFFSET(loader_start, 0x1D8, L"%xh");
656 CHECK_OFFSET(loader_size, 0x1DC, L"%xh");
657 CHECK_OFFSET(alt_mem_k, 0x1E0, L"%xh");
658 CHECK_OFFSET(e820_nrmap, 0x1E8, L"%xh");
659 CHECK_OFFSET(setup_sectors, 0x1F1, L"%xh");
660 CHECK_OFFSET(mount_root_rdonly, 0x1F2, L"%xh");
661 CHECK_OFFSET(sys_size, 0x1F4, L"%xh");
662 CHECK_OFFSET(swap_dev, 0x1F6, L"%xh");
663 CHECK_OFFSET(ramdisk_flags, 0x1F8, L"%xh");
664 CHECK_OFFSET(video_mode_flag, 0x1FA, L"%xh");
665 CHECK_OFFSET(orig_root_dev, 0x1FC, L"%xh");
666 CHECK_OFFSET(aux_dev_info, 0x1FF, L"%xh");
667 CHECK_OFFSET(jump, 0x200, L"%xh");
668 CHECK_OFFSET(setup_sig, 0x202, L"'%-4.4a'");
669 CHECK_OFFSET(hdr_minor, 0x206, L"%xh");
670 CHECK_OFFSET(hdr_major, 0x207, L"%xh");
671 CHECK_OFFSET(rm_switch, 0x208, L"%xh");
672 CHECK_OFFSET(start_sys_seg, 0x20C, L"%xh");
673 CHECK_OFFSET(kernel_verstr_offset, 0x20E, L"%xh");
674 CHECK_OFFSET(loader_type, 0x210, L"%xh");
675 CHECK_OFFSET(loader_flags, 0x211, L"%xh");
676 CHECK_OFFSET(setup_move_size, 0x212, L"%xh");
677 CHECK_OFFSET(kernel_start, 0x214, L"%xh");
678 CHECK_OFFSET(initrd_start, 0x218, L"%xh");
679 CHECK_OFFSET(initrd_size, 0x21C, L"%xh");
680 CHECK_OFFSET(bootsect_helper, 0x220, L"%xh");
681 CHECK_OFFSET(heap_end_ptr, 0x224, L"%xh");
682 CHECK_OFFSET(cmdline_addr, 0x228, L"%xh");
683 CHECK_OFFSET(e820_map, 0x2D0, L"'%-2560.2560a'");
686 ERR_PRT((L"Boot sector and/or setup parameter alignment error."));
693 * Get video information.
694 * Do this last so that any other cursor positioning done
695 * in the fill routine gets accounted for.
698 if (!get_video_info(bp)) goto do_memmap;
700 efi_status = ST->ConOut->QueryMode(
702 ST->ConOut->Mode->Mode,
706 if (EFI_ERROR(efi_status)) {
707 ERR_PRT((L"QueryMode failed. Fake it."));
714 mode = (UINT8)ST->ConOut->Mode->Mode;
715 col = (UINT8)ST->ConOut->Mode->CursorColumn;
716 row = (UINT8)ST->ConOut->Mode->CursorRow;
719 bp->s.orig_cursor_col = col;
720 bp->s.orig_cursor_row = row;
721 bp->s.orig_video_page = 0;
722 bp->s.orig_video_mode = mode;
723 bp->s.orig_video_cols = (UINT8)cols;
724 bp->s.orig_video_rows = (UINT8)rows;
726 bp->s.orig_ega_bx = 0;
728 bp->s.orig_video_points = 16;
731 bp->s.lfb_height = 0;
735 bp->s.lfb_line_len = 0;
736 bp->s.lfb_red_size = 0;
737 bp->s.lfb_red_pos = 0;
738 bp->s.lfb_green_size = 0;
739 bp->s.lfb_green_pos = 0;
740 bp->s.lfb_blue_size = 0;
741 bp->s.lfb_blue_pos = 0;
742 bp->s.lfb_rsvd_size = 0;
743 bp->s.lfb_rsvd_pos = 0;
750 * Get memory map description and cookie for ExitBootServices()
753 if (get_memmap(&mdesc)) {
754 ERR_PRT((L"Could not get memory map."));
758 *cookie = mdesc.cookie;
759 bp->s.efi_mem_map = (UINTN)mdesc.md;
760 bp->s.efi_mem_map_size = mdesc.map_size;
761 bp->s.efi_mem_desc_size = mdesc.desc_size;
762 bp->s.efi_mem_desc_ver = mdesc.desc_version;
763 bp->s.efi_sys_tbl = (UINTN)systab;
764 /* Now that we have EFI memory map, convert it to E820 map
765 * and update the bootparam accordingly
767 fill_e820map(bp, &mdesc);