summaryrefslogtreecommitdiffstats
path: root/sys/boot/efi/libefi
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/efi/libefi')
-rw-r--r--sys/boot/efi/libefi/Makefile4
-rw-r--r--sys/boot/efi/libefi/bootinfo.c2
-rw-r--r--sys/boot/efi/libefi/efiboot.h2
-rw-r--r--sys/boot/efi/libefi/efifpswa.c59
4 files changed, 67 insertions, 0 deletions
diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile
index eb4eac4..2e7bff2 100644
--- a/sys/boot/efi/libefi/Makefile
+++ b/sys/boot/efi/libefi/Makefile
@@ -11,6 +11,10 @@ INTERNALSTATICLIB= true
SRCS= libefi.c efi_console.c time.c copy.c devicename.c module.c exit.c
SRCS+= delay.c efifs.c efinet.c elf_freebsd.c bootinfo.c pal.s
+.if ${MACHINE_ARCH} == "ia64"
+SRCS+= efifpswa.c
+.endif
+
CFLAGS+= -fpic
CFLAGS+= -I${.CURDIR}/../include
CFLAGS+= -I${.CURDIR}/../include/${MACHINE_ARCH}
diff --git a/sys/boot/efi/libefi/bootinfo.c b/sys/boot/efi/libefi/bootinfo.c
index 5fdbebf..e6ba8f2 100644
--- a/sys/boot/efi/libefi/bootinfo.c
+++ b/sys/boot/efi/libefi/bootinfo.c
@@ -297,6 +297,8 @@ bi_load(struct bootinfo *bi, struct preloaded_file *fp, UINTN *mapkey)
bi->bi_symtab = ssym;
bi->bi_esymtab = esym;
+ fpswa_init(&bi->bi_fpswa); /* find FPSWA interface */
+
/* find the last module in the chain */
addr = 0;
for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
diff --git a/sys/boot/efi/libefi/efiboot.h b/sys/boot/efi/libefi/efiboot.h
index c8d6da7..780554e 100644
--- a/sys/boot/efi/libefi/efiboot.h
+++ b/sys/boot/efi/libefi/efiboot.h
@@ -83,6 +83,8 @@ extern ssize_t efi_readin(int fd, vm_offset_t dest, size_t len);
extern int efi_boot(void);
extern int efi_autoload(void);
+extern int fpswa_init(u_int64_t *fpswa_interface);
+
struct bootinfo;
struct preloaded_file;
extern int bi_load(struct bootinfo *, struct preloaded_file *,
diff --git a/sys/boot/efi/libefi/efifpswa.c b/sys/boot/efi/libefi/efifpswa.c
new file mode 100644
index 0000000..b3bff92
--- /dev/null
+++ b/sys/boot/efi/libefi/efifpswa.c
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2001 Peter Wemm <peter@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <stddef.h>
+#include <stand.h>
+#include <stdarg.h>
+
+#include <efi.h>
+#include <efilib.h>
+#include "efiboot.h"
+
+int
+fpswa_init(u_int64_t *fpswa_interface)
+{
+ EFI_STATUS status;
+ static EFI_GUID fpswaid = EFI_INTEL_FPSWA;
+ UINTN sz;
+ EFI_HANDLE fpswa_handle;
+ FPSWA_INTERFACE *fpswa;
+
+ *fpswa_interface = 0;
+ sz = sizeof(EFI_HANDLE);
+ status = BS->LocateHandle(ByProtocol, &fpswaid, 0, &sz, &fpswa_handle);
+ if (EFI_ERROR(status))
+ return ENOENT;
+
+ status = BS->HandleProtocol(fpswa_handle, &fpswaid, (VOID **)&fpswa);
+ if (EFI_ERROR(status))
+ return ENOENT;
+ *fpswa_interface = (u_int64_t)fpswa;
+ return 0;
+}
OpenPOWER on IntegriCloud