diff options
author | peter <peter@FreeBSD.org> | 2001-11-19 07:09:47 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2001-11-19 07:09:47 +0000 |
commit | b866d91337d910a5e4c9bca541e45cdf536c9f86 (patch) | |
tree | 3f99748b80f843310be539b08923f86a3f25de87 /sys | |
parent | e5a267af198afb5695f7d201d9228e863d0355b7 (diff) | |
download | FreeBSD-src-b866d91337d910a5e4c9bca541e45cdf536c9f86.zip FreeBSD-src-b866d91337d910a5e4c9bca541e45cdf536c9f86.tar.gz |
Lookup the EFI_FPSWA driver and pass the interface pointer through to the
kernel before we call ExitBootServices(). I've typed the definitions
in efifpswa.h from the Intel FPSWA manual (urk).
Diffstat (limited to 'sys')
-rw-r--r-- | sys/boot/efi/include/efi.h | 1 | ||||
-rw-r--r-- | sys/boot/efi/include/efifpswa.h | 40 | ||||
-rw-r--r-- | sys/boot/efi/libefi/Makefile | 4 | ||||
-rw-r--r-- | sys/boot/efi/libefi/bootinfo.c | 2 | ||||
-rw-r--r-- | sys/boot/efi/libefi/efiboot.h | 2 | ||||
-rw-r--r-- | sys/boot/efi/libefi/efifpswa.c | 59 | ||||
-rw-r--r-- | sys/boot/ia64/common/bootinfo.c | 2 |
7 files changed, 110 insertions, 0 deletions
diff --git a/sys/boot/efi/include/efi.h b/sys/boot/efi/include/efi.h index ef63d82..c2e2906 100644 --- a/sys/boot/efi/include/efi.h +++ b/sys/boot/efi/include/efi.h @@ -44,6 +44,7 @@ Revision History #include "efinet.h" #include "efiapi.h" #include "efifs.h" +#include "efifpswa.h" #include "efierr.h" #endif diff --git a/sys/boot/efi/include/efifpswa.h b/sys/boot/efi/include/efifpswa.h new file mode 100644 index 0000000..5de9bb6 --- /dev/null +++ b/sys/boot/efi/include/efifpswa.h @@ -0,0 +1,40 @@ +/* $FreeBSD$ */ +#ifndef _EFI_FPSWA_H +#define _EFI_FPSWA_H + +// +// EFI FP SWA Driver (Floating Point Software Assist) +// + +#define EFI_INTEL_FPSWA \ + { 0xc41b6531, 0x97b9, 0x11d3, 0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } + +INTERFACE_DECL(_FPSWA_INTERFACE); + +typedef struct _FPSWA_RET { + UINT64 status; + UINT64 err1; + UINT64 err2; + UINT64 err3; +} FPSWA_RET; + +typedef +FPSWA_RET +(EFIAPI *EFI_FPSWA) ( + IN UINTN TrapType, + IN OUT VOID *Bundle, + IN OUT UINT64 *pipsr, + IN OUT UINT64 *pfsr, + IN OUT UINT64 *pisr, + IN OUT UINT64 *ppreds, + IN OUT UINT64 *pifs, + IN OUT VOID *fp_state + ); + +typedef struct _FPSWA_INTERFACE { + UINT32 Revision; + UINT32 Reserved; + EFI_FPSWA Fpswa; +} FPSWA_INTERFACE; + +#endif 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; +} diff --git a/sys/boot/ia64/common/bootinfo.c b/sys/boot/ia64/common/bootinfo.c index 5fdbebf..e6ba8f2 100644 --- a/sys/boot/ia64/common/bootinfo.c +++ b/sys/boot/ia64/common/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) { |