Home | History | Annotate | Line # | Download | only in efiboot
efiboot.h revision 1.7
      1 /*	$NetBSD: efiboot.h,v 1.7 2018/09/15 17:06:32 jmcneill Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2016 Kimihiro Nonaka <nonaka (at) 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 <loadfile.h>
     36 
     37 #include "efiboot_machdep.h"
     38 
     39 struct boot_command {
     40 	const char *c_name;
     41 	void (*c_fn)(char *);
     42 	const char *c_help;
     43 };
     44 
     45 /* conf.c */
     46 extern struct fs_ops null_fs_ops;
     47 extern struct fs_ops tftp_fs_ops;
     48 
     49 /* boot.c */
     50 void boot(void);
     51 void clearit(void);
     52 void print_banner(void);
     53 extern const struct boot_command commands[];
     54 void command_help(char *);
     55 int set_default_device(char *);
     56 char *get_default_device(void);
     57 int set_initrd_path(char *);
     58 char *get_initrd_path(void);
     59 int set_dtb_path(char *);
     60 char *get_dtb_path(void);
     61 extern int howto;
     62 
     63 /* console.c */
     64 int ischar(void);
     65 
     66 /* efiboot.c */
     67 extern EFI_HANDLE IH;
     68 extern EFI_DEVICE_PATH *efi_bootdp;
     69 extern EFI_LOADED_IMAGE *efi_li;
     70 void efi_cleanup(void);
     71 void efi_exit(void);
     72 void efi_delay(int);
     73 void efi_reboot(void);
     74 
     75 /* efichar.c */
     76 size_t ucs2len(const CHAR16 *);
     77 int ucs2_to_utf8(const CHAR16 *, char **);
     78 int utf8_to_ucs2(const char *, CHAR16 **, size_t *);
     79 
     80 /* efidev.c */
     81 int efi_device_path_depth(EFI_DEVICE_PATH *dp, int);
     82 int efi_device_path_ncmp(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *, int);
     83 
     84 /* efinet.c */
     85 int efi_net_open(struct open_file *, ...);
     86 void efi_net_probe(void);
     87 void efi_net_show(void);
     88 int efi_net_get_booted_interface_unit(void);
     89 extern struct netif_driver efinetif;
     90 
     91 /* efipxe.c */
     92 void efi_pxe_probe(void);
     93 void efi_pxe_show(void);
     94 bool efi_pxe_match_booted_interface(const EFI_MAC_ADDRESS *, UINT32);
     95 
     96 /* exec.c */
     97 int exec_netbsd(const char *, const char *);
     98 
     99 /* panic.c */
    100 __dead VOID Panic(IN CHAR16 *, ...);
    101 __dead void reboot(void);
    102 
    103 /* prompt.c */
    104 char *gettrailer(char *);
    105 void docommand(char *);
    106 char awaitkey(int, int);
    107 __dead void bootprompt(void);
    108