1 1.4 skrll /* $NetBSD: efiboot.h,v 1.4 2020/01/26 10:12:29 skrll Exp $ */ 2 1.1 cherry 3 1.1 cherry /*- 4 1.1 cherry * Copyright (c) 1996 5 1.1 cherry * Matthias Drochner. All rights reserved. 6 1.1 cherry * 7 1.1 cherry * Redistribution and use in source and binary forms, with or without 8 1.1 cherry * modification, are permitted provided that the following conditions 9 1.1 cherry * are met: 10 1.1 cherry * 1. Redistributions of source code must retain the above copyright 11 1.1 cherry * notice, this list of conditions and the following disclaimer. 12 1.1 cherry * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 cherry * notice, this list of conditions and the following disclaimer in the 14 1.1 cherry * documentation and/or other materials provided with the distribution. 15 1.1 cherry * 3. All advertising materials mentioning features or use of this software 16 1.1 cherry * must display the following acknowledgement: 17 1.1 cherry * This product includes software developed for the NetBSD Project 18 1.1 cherry * by Matthias Drochner. 19 1.1 cherry * 4. The name of the author may not be used to endorse or promote products 20 1.1 cherry * derived from this software without specific prior written permission. 21 1.1 cherry * 22 1.1 cherry * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 1.1 cherry * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 1.1 cherry * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 1.1 cherry * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 1.1 cherry * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 1.1 cherry * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 1.1 cherry * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 1.1 cherry * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 1.1 cherry * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 1.1 cherry * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 1.1 cherry * 33 1.2 cherry * $FreeBSD$: src/sys/boot/efi/libefi/efiboot.h,v 1.8 2003/08/02 08:22:03 marcel Exp $ 34 1.1 cherry */ 35 1.1 cherry 36 1.1 cherry /* 37 1.1 cherry * EFI fully-qualified device descriptor 38 1.1 cherry */ 39 1.1 cherry struct efi_devdesc { 40 1.1 cherry struct devsw *d_dev; 41 1.1 cherry int d_type; 42 1.1 cherry #define DEVT_NONE 0 43 1.1 cherry #define DEVT_DISK 1 44 1.1 cherry #define DEVT_NET 2 45 1.1 cherry EFI_HANDLE d_handle; 46 1.1 cherry union { 47 1.1 cherry struct { 48 1.1 cherry int unit; 49 1.1 cherry int slice; 50 1.1 cherry int partition; 51 1.1 cherry } efidisk; 52 1.1 cherry struct { 53 1.1 cherry int unit; /* XXX net layer lives over these? */ 54 1.1 cherry } netif; 55 1.1 cherry } d_kind; 56 1.1 cherry }; 57 1.1 cherry 58 1.1 cherry extern int efi_getdev(void **vdev, const char *devspec, const char **path); 59 1.1 cherry extern char *efi_fmtdev(void *vdev); 60 1.1 cherry extern int efi_setcurrdev(struct env_var *ev, int flags, void *value); 61 1.1 cherry 62 1.1 cherry #define MAXDEV 31 /* maximum number of distinct devices */ 63 1.1 cherry 64 1.1 cherry typedef unsigned long physaddr_t; 65 1.1 cherry 66 1.1 cherry /* exported devices XXX rename? */ 67 1.1 cherry extern struct devsw devsw[]; 68 1.4 skrll extern struct netif_driver efi_net; 69 1.1 cherry 70 1.1 cherry /* Find EFI network resources */ 71 1.3 scole extern void efinet_init_driver(void); 72 1.1 cherry 73 1.1 cherry /* Map handles to units */ 74 1.1 cherry int efifs_get_unit(EFI_HANDLE); 75 1.1 cherry 76 1.1 cherry /* Wrapper over EFI filesystems. */ 77 1.1 cherry extern struct fs_ops efi_fsops; 78 1.1 cherry 79 1.1 cherry /* this is in startup code */ 80 1.1 cherry extern void delay(int); 81 1.1 cherry extern void reboot(void); 82 1.1 cherry 83 1.1 cherry extern ssize_t efi_copyin(const void *src, vaddr_t dest, size_t len); 84 1.1 cherry extern ssize_t efi_copyout(const vaddr_t src, void *dest, size_t len); 85 1.1 cherry extern ssize_t efi_readin(const int fd, vaddr_t dest, size_t len); 86 1.1 cherry 87 1.1 cherry extern int efi_boot(void); 88 1.1 cherry extern int efi_autoload(void); 89 1.1 cherry 90 1.1 cherry extern int fpswa_init(u_int64_t *fpswa_interface); 91 1.1 cherry 92 1.1 cherry struct bootinfo; 93 1.1 cherry struct preloaded_file; 94 1.1 cherry extern int bi_load(struct bootinfo *, struct preloaded_file *, 95 1.1 cherry UINTN *mapkey, UINTN pages); 96 1.1 cherry 97