1212049Spjd/*	$NetBSD: efiboot.h,v 1.1 2006/04/07 14:21:32 cherry Exp $	*/
2212049Spjd
3212049Spjd/*-
4212049Spjd * Copyright (c) 1996
5212049Spjd *	Matthias Drochner.  All rights reserved.
6212049Spjd *
7212049Spjd * Redistribution and use in source and binary forms, with or without
8212049Spjd * modification, are permitted provided that the following conditions
9212049Spjd * are met:
10212049Spjd * 1. Redistributions of source code must retain the above copyright
11212049Spjd *    notice, this list of conditions and the following disclaimer.
12212049Spjd * 2. Redistributions in binary form must reproduce the above copyright
13212049Spjd *    notice, this list of conditions and the following disclaimer in the
14212049Spjd *    documentation and/or other materials provided with the distribution.
15212049Spjd * 3. All advertising materials mentioning features or use of this software
16212049Spjd *    must display the following acknowledgement:
17212049Spjd *	This product includes software developed for the NetBSD Project
18212049Spjd *	by Matthias Drochner.
19212049Spjd * 4. The name of the author may not be used to endorse or promote products
20212049Spjd *    derived from this software without specific prior written permission.
21212049Spjd *
22212049Spjd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23212049Spjd * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24212049Spjd * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25212049Spjd * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26212049Spjd * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27212049Spjd * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28212049Spjd * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29212049Spjd * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30212049Spjd * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31212049Spjd * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32212049Spjd *
33212049Spjd * $FreeBSD$: src/sys/boot/efi/libefi/efiboot.h,v 1.8 2003/08/02 08:22:03 marcel Exp $
34212049Spjd */
35212049Spjd
36212049Spjd/*
37212049Spjd * EFI fully-qualified device descriptor
38212049Spjd */
39212049Spjdstruct efi_devdesc {
40212049Spjd	struct	devsw	*d_dev;
41212049Spjd	int		d_type;
42212049Spjd#define	DEVT_NONE	0
43212049Spjd#define	DEVT_DISK	1
44212049Spjd#define	DEVT_NET	2
45212049Spjd	EFI_HANDLE	d_handle;
46212049Spjd	union {
47212049Spjd		struct {
48225787Spjd			int	unit;
49225787Spjd			int	slice;
50212049Spjd			int	partition;
51212049Spjd		} efidisk;
52212049Spjd		struct {
53212049Spjd			int	unit;	/* XXX net layer lives over these? */
54212049Spjd		} netif;
55212049Spjd	} d_kind;
56212049Spjd};
57212049Spjd
58212049Spjdextern int	efi_getdev(void **vdev, const char *devspec, const char **path);
59212049Spjdextern char	*efi_fmtdev(void *vdev);
60212049Spjdextern int	efi_setcurrdev(struct env_var *ev, int flags, void *value);
61212049Spjd
62212049Spjd#define	MAXDEV	31	/* maximum number of distinct devices */
63212049Spjd
64229945Spjdtypedef unsigned long physaddr_t;
65212049Spjd
66212049Spjd/* exported devices XXX rename? */
67212049Spjdextern struct devsw devsw[];
68229945Spjdextern struct netif_driver efi_net;
69212049Spjd
70212049Spjd/* Find EFI network resources */
71212049Spjd/*extern void efinet_init_driver(void); XXX should get this running once we're off the mark */
72212049Spjd
73212049Spjd/* Map handles to units */
74212049Spjdint efifs_get_unit(EFI_HANDLE);
75212049Spjd
76212049Spjd/* Wrapper over EFI filesystems. */
77212049Spjdextern struct fs_ops efi_fsops;
78212049Spjd
79212049Spjd/* this is in startup code */
80212049Spjdextern void		delay(int);
81212049Spjdextern void		reboot(void);
82212049Spjd
83212049Spjdextern ssize_t		efi_copyin(const void *src, vaddr_t dest, size_t len);
84212049Spjdextern ssize_t		efi_copyout(const vaddr_t src, void *dest, size_t len);
85212049Spjdextern ssize_t		efi_readin(const int fd, vaddr_t dest, size_t len);
86212049Spjd
87212049Spjdextern int		efi_boot(void);
88212049Spjdextern int		efi_autoload(void);
89212049Spjd
90212049Spjdextern int		fpswa_init(u_int64_t *fpswa_interface);
91225787Spjd
92212049Spjdstruct bootinfo;
93212049Spjdstruct preloaded_file;
94212049Spjdextern int		bi_load(struct bootinfo *, struct preloaded_file *,
95229945Spjd				UINTN *mapkey, UINTN pages);
96212049Spjd
97212049Spjd