1 /* $NetBSD: efiboot.h,v 1.12 2023/04/20 00:42:24 manu Exp $ */ 2 3 /*- 4 * Copyright (c) 2016 Kimihiro Nonaka <nonaka@netbsd.org> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29 #include <efi.h> 30 #include <efilib.h> 31 32 #include <lib/libsa/stand.h> 33 #include <lib/libkern/libkern.h> 34 35 #include "libi386.h" 36 37 #include "efiboot_machdep.h" 38 39 extern EFI_GUID GraphicsOutputProtocol; 40 41 /* boot.c */ 42 void boot(void); 43 void clearit(void); 44 45 /* efiboot.c */ 46 extern EFI_HANDLE IH; 47 extern EFI_DEVICE_PATH *efi_bootdp; 48 extern enum efi_boot_device_type { 49 BOOT_DEVICE_TYPE_HD, 50 BOOT_DEVICE_TYPE_CD, 51 BOOT_DEVICE_TYPE_NET 52 } efi_bootdp_type; 53 extern EFI_LOADED_IMAGE *efi_li; 54 extern uintptr_t efi_main_sp; 55 extern physaddr_t efi_loadaddr, efi_kernel_start, efi_load_start; 56 extern physaddr_t efi_kernel_reloc; 57 extern enum efi_reloc_type { 58 RELOC_DEFAULT, 59 RELOC_NONE, 60 RELOC_ADDR, 61 } efi_reloc_type; 62 extern u_long efi_kernel_size; 63 extern bool efi_cleanuped; 64 void efi_cleanup(void); 65 66 /* efichar.c */ 67 size_t ucs2len(const CHAR16 *); 68 int ucs2_to_utf8(const CHAR16 *, char **); 69 int utf8_to_ucs2(const char *, CHAR16 **, size_t *); 70 71 /* eficons.c */ 72 int cninit(void); 73 void efi_consinit(int, int, int); 74 void efi_cons_show(void); 75 void command_text(char *); 76 void command_gop(char *); 77 78 /* efidev.c */ 79 int efi_device_path_depth(EFI_DEVICE_PATH *dp, int); 80 int efi_device_path_ncmp(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *, int); 81 82 /* efidisk.c */ 83 void efi_disk_probe(void); 84 void efi_disk_show(void); 85 86 /* efimemory.c */ 87 void efi_memory_probe(void); 88 void efi_memory_probe_reloc(EFI_PHYSICAL_ADDRESS, EFI_PHYSICAL_ADDRESS, bool); 89 void efi_memory_show_map(bool, bool); 90 EFI_MEMORY_DESCRIPTOR *efi_memory_get_map(UINTN *, UINTN *, UINTN *, UINT32 *, 91 bool); 92 EFI_MEMORY_DESCRIPTOR *efi_memory_compact_map(EFI_MEMORY_DESCRIPTOR *, UINTN *, 93 UINTN); 94 struct bi_memmap_entry; 95 int efi_memory_get_memmap(struct bi_memmap_entry **memmap, size_t *num); 96 97 /* efinet.c */ 98 void efi_net_probe(void); 99 void efi_net_show(void); 100 int efi_net_get_booted_interface_unit(void); 101 102 /* efipxe.c */ 103 void efi_pxe_probe(void); 104 void efi_pxe_show(void); 105 bool efi_pxe_match_booted_interface(const EFI_MAC_ADDRESS *, UINT32); 106 107 /* panic.c */ 108 __dead VOID Panic(IN CHAR16 *, ...); 109