efiboot.h revision 1.10.2.2 1 1.10.2.2 christos /* $NetBSD: efiboot.h,v 1.10.2.2 2019/06/10 22:09:56 christos Exp $ */
2 1.10.2.2 christos
3 1.10.2.2 christos /*-
4 1.10.2.2 christos * Copyright (c) 2016 Kimihiro Nonaka <nonaka (at) netbsd.org>
5 1.10.2.2 christos * All rights reserved.
6 1.10.2.2 christos *
7 1.10.2.2 christos * Redistribution and use in source and binary forms, with or without
8 1.10.2.2 christos * modification, are permitted provided that the following conditions
9 1.10.2.2 christos * are met:
10 1.10.2.2 christos * 1. Redistributions of source code must retain the above copyright
11 1.10.2.2 christos * notice, this list of conditions and the following disclaimer.
12 1.10.2.2 christos * 2. Redistributions in binary form must reproduce the above copyright
13 1.10.2.2 christos * notice, this list of conditions and the following disclaimer in the
14 1.10.2.2 christos * documentation and/or other materials provided with the distribution.
15 1.10.2.2 christos *
16 1.10.2.2 christos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 1.10.2.2 christos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 1.10.2.2 christos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 1.10.2.2 christos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 1.10.2.2 christos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 1.10.2.2 christos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 1.10.2.2 christos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 1.10.2.2 christos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 1.10.2.2 christos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.10.2.2 christos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.10.2.2 christos * SUCH DAMAGE.
27 1.10.2.2 christos */
28 1.10.2.2 christos
29 1.10.2.2 christos #include <efi.h>
30 1.10.2.2 christos #include <efilib.h>
31 1.10.2.2 christos
32 1.10.2.2 christos #include <lib/libsa/stand.h>
33 1.10.2.2 christos #include <lib/libkern/libkern.h>
34 1.10.2.2 christos
35 1.10.2.2 christos #include <loadfile.h>
36 1.10.2.2 christos #include <net.h>
37 1.10.2.2 christos
38 1.10.2.2 christos #include <prop/proplib.h>
39 1.10.2.2 christos
40 1.10.2.2 christos #include "efiboot_machdep.h"
41 1.10.2.2 christos
42 1.10.2.2 christos struct boot_command {
43 1.10.2.2 christos const char *c_name;
44 1.10.2.2 christos void (*c_fn)(char *);
45 1.10.2.2 christos const char *c_help;
46 1.10.2.2 christos };
47 1.10.2.2 christos
48 1.10.2.2 christos /* conf.c */
49 1.10.2.2 christos extern struct fs_ops null_fs_ops;
50 1.10.2.2 christos extern struct fs_ops tftp_fs_ops;
51 1.10.2.2 christos extern struct fs_ops nfs_fs_ops;
52 1.10.2.2 christos
53 1.10.2.2 christos /* boot.c */
54 1.10.2.2 christos void boot(void);
55 1.10.2.2 christos void clearit(void);
56 1.10.2.2 christos void print_banner(void);
57 1.10.2.2 christos extern const struct boot_command commands[];
58 1.10.2.2 christos void command_help(char *);
59 1.10.2.2 christos int set_default_device(const char *);
60 1.10.2.2 christos char *get_default_device(void);
61 1.10.2.2 christos int set_initrd_path(const char *);
62 1.10.2.2 christos char *get_initrd_path(void);
63 1.10.2.2 christos int set_dtb_path(const char *);
64 1.10.2.2 christos char *get_dtb_path(void);
65 1.10.2.2 christos int set_efibootplist_path(const char *);
66 1.10.2.2 christos char *get_efibootplist_path(void);
67 1.10.2.2 christos
68 1.10.2.2 christos /* console.c */
69 1.10.2.2 christos int ischar(void);
70 1.10.2.2 christos
71 1.10.2.2 christos /* efiboot.c */
72 1.10.2.2 christos extern EFI_HANDLE IH;
73 1.10.2.2 christos extern EFI_DEVICE_PATH *efi_bootdp;
74 1.10.2.2 christos extern EFI_LOADED_IMAGE *efi_li;
75 1.10.2.2 christos void efi_cleanup(void);
76 1.10.2.2 christos void efi_exit(void);
77 1.10.2.2 christos void efi_delay(int);
78 1.10.2.2 christos void efi_reboot(void);
79 1.10.2.2 christos extern int howto;
80 1.10.2.2 christos extern prop_dictionary_t efibootplist;
81 1.10.2.2 christos
82 1.10.2.2 christos /* efichar.c */
83 1.10.2.2 christos size_t ucs2len(const CHAR16 *);
84 1.10.2.2 christos int ucs2_to_utf8(const CHAR16 *, char **);
85 1.10.2.2 christos int utf8_to_ucs2(const char *, CHAR16 **, size_t *);
86 1.10.2.2 christos
87 1.10.2.2 christos /* efidev.c */
88 1.10.2.2 christos int efi_device_path_depth(EFI_DEVICE_PATH *dp, int);
89 1.10.2.2 christos int efi_device_path_ncmp(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *, int);
90 1.10.2.2 christos
91 1.10.2.2 christos /* efinet.c */
92 1.10.2.2 christos struct efi_net_if {
93 1.10.2.2 christos const char *if_name;
94 1.10.2.2 christos uint8_t if_mac[6];
95 1.10.2.2 christos };
96 1.10.2.2 christos int efi_net_open(struct open_file *, ...);
97 1.10.2.2 christos void efi_net_probe(void);
98 1.10.2.2 christos void efi_net_show(void);
99 1.10.2.2 christos int efi_net_get_booted_interface_unit(void);
100 1.10.2.2 christos int efi_net_get_booted_macaddr(uint8_t *);
101 1.10.2.2 christos extern struct netif_driver efinetif;
102 1.10.2.2 christos
103 1.10.2.2 christos /* efipxe.c */
104 1.10.2.2 christos void efi_pxe_probe(void);
105 1.10.2.2 christos bool efi_pxe_match_booted_interface(const EFI_MAC_ADDRESS *, UINT32);
106 1.10.2.2 christos
107 1.10.2.2 christos /* exec.c */
108 1.10.2.2 christos int exec_netbsd(const char *, const char *);
109 1.10.2.2 christos void load_efibootplist(bool);
110 1.10.2.2 christos
111 1.10.2.2 christos /* panic.c */
112 1.10.2.2 christos __dead VOID Panic(IN CHAR16 *, ...);
113 1.10.2.2 christos __dead void reboot(void);
114 1.10.2.2 christos
115 1.10.2.2 christos /* prompt.c */
116 1.10.2.2 christos char *gettrailer(char *);
117 1.10.2.2 christos void docommand(char *);
118 1.10.2.2 christos char awaitkey(int, int);
119 1.10.2.2 christos __dead void bootprompt(void);
120