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).
This commit is contained in:
parent
1ccc5e6c4e
commit
24ffe931b9
@ -44,6 +44,7 @@ Revision History
|
||||
#include "efinet.h"
|
||||
#include "efiapi.h"
|
||||
#include "efifs.h"
|
||||
#include "efifpswa.h"
|
||||
#include "efierr.h"
|
||||
|
||||
#endif
|
||||
|
40
sys/boot/efi/include/efifpswa.h
Normal file
40
sys/boot/efi/include/efifpswa.h
Normal file
@ -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
|
@ -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}
|
||||
|
@ -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) {
|
||||
|
@ -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 *,
|
||||
|
59
sys/boot/efi/libefi/efifpswa.c
Normal file
59
sys/boot/efi/libefi/efifpswa.c
Normal file
@ -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;
|
||||
}
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user