mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-26 06:08:20 +00:00
bsps/shared: import FreeBSD libefi library
The library is imported in minimalist version just to support future amd64efi BSP. The FreeBSD tree commit id with imported libefi version is: ce7b20e5129cf0f269951b313d336a9c7d54d790
This commit is contained in:
36
bsps/shared/freebsd/stand/efi/include/README
Normal file
36
bsps/shared/freebsd/stand/efi/include/README
Normal file
@@ -0,0 +1,36 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
|
||||
Files in this directory and subdirectories are subject to the following
|
||||
copyright unless superceded or supplemented by additional specific license
|
||||
terms found in the file headers of individual files.
|
||||
|
||||
Copyright (c) 1998-2000 Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
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 ``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 INTEL 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. THE EFI SPECIFICATION AND ALL
|
||||
OTHER INFORMATION ON THIS WEB SITE ARE PROVIDED "AS IS" WITH NO
|
||||
WARRANTIES, AND ARE SUBJECT TO CHANGE WITHOUT NOTICE.
|
||||
|
||||
*/
|
||||
275
bsps/shared/freebsd/stand/efi/include/amd64/efibind.h
Normal file
275
bsps/shared/freebsd/stand/efi/include/amd64/efibind.h
Normal file
@@ -0,0 +1,275 @@
|
||||
/* $FreeBSD$ */
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
Module Name:
|
||||
|
||||
efefind.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI to compile bindings
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/stdint.h>
|
||||
#elif __rtems__
|
||||
#include <stdint.h>
|
||||
#else
|
||||
//
|
||||
// Basic int types of various widths
|
||||
//
|
||||
|
||||
#if (__STDC_VERSION__ < 199901L )
|
||||
|
||||
// No ANSI C 1999/2000 stdint.h integer width declarations
|
||||
|
||||
#ifdef _MSC_EXTENSIONS
|
||||
|
||||
// Use Microsoft C compiler integer width declarations
|
||||
|
||||
typedef unsigned __int64 uint64_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#else
|
||||
#ifdef UNIX_LP64
|
||||
|
||||
// Use LP64 programming model from C_FLAGS for integer width declarations
|
||||
|
||||
typedef unsigned long uint64_t;
|
||||
typedef long int64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#else
|
||||
|
||||
// Assume P64 programming model from C_FLAGS for integer width declarations
|
||||
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef long long int64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
//
|
||||
// Basic EFI types of various widths
|
||||
//
|
||||
|
||||
#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */
|
||||
#define ACPI_USE_SYSTEM_INTTYPES 1 /* Tell ACPI we've defined types */
|
||||
|
||||
typedef uint64_t UINT64;
|
||||
typedef int64_t INT64;
|
||||
|
||||
#ifndef _BASETSD_H_
|
||||
typedef uint32_t UINT32;
|
||||
typedef int32_t INT32;
|
||||
#endif
|
||||
|
||||
typedef uint16_t UINT16;
|
||||
typedef int16_t INT16;
|
||||
typedef uint8_t UINT8;
|
||||
typedef int8_t INT8;
|
||||
|
||||
#endif
|
||||
|
||||
#undef VOID
|
||||
#define VOID void
|
||||
|
||||
|
||||
typedef int64_t INTN;
|
||||
typedef uint64_t UINTN;
|
||||
|
||||
#ifdef EFI_NT_EMULATOR
|
||||
#define POST_CODE(_Data)
|
||||
#else
|
||||
#ifdef EFI_DEBUG
|
||||
#define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al
|
||||
#else
|
||||
#define POST_CODE(_Data)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define EFIERR(a) (0x8000000000000000 | a)
|
||||
#define EFI_ERROR_MASK 0x8000000000000000
|
||||
#define EFIERR_OEM(a) (0xc000000000000000 | a)
|
||||
|
||||
|
||||
#define BAD_POINTER 0xFBFBFBFBFBFBFBFB
|
||||
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
|
||||
|
||||
#define BREAKPOINT() __asm { int 3 }
|
||||
|
||||
//
|
||||
// Pointers must be aligned to these address to function
|
||||
//
|
||||
|
||||
#define MIN_ALIGNMENT_SIZE 4
|
||||
|
||||
#define ALIGN_VARIABLE(Value ,Adjustment) \
|
||||
(UINTN)Adjustment = 0; \
|
||||
if((UINTN)Value % MIN_ALIGNMENT_SIZE) \
|
||||
(UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \
|
||||
Value = (UINTN)Value + (UINTN)Adjustment
|
||||
|
||||
|
||||
//
|
||||
// Define macros to build data structure signatures from characters.
|
||||
//
|
||||
|
||||
#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
|
||||
#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))
|
||||
#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))
|
||||
|
||||
//
|
||||
// EFIAPI - prototype calling convention for EFI function pointers
|
||||
// BOOTSERVICE - prototype for implementation of a boot service interface
|
||||
// RUNTIMESERVICE - prototype for implementation of a runtime service interface
|
||||
// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service
|
||||
// RUNTIME_CODE - pragma macro for declaring runtime code
|
||||
//
|
||||
|
||||
#ifdef __amd64__
|
||||
#define EFIAPI __attribute__((ms_abi))
|
||||
#endif
|
||||
|
||||
#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options
|
||||
#ifdef _MSC_EXTENSIONS
|
||||
#define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler
|
||||
#else
|
||||
#define EFIAPI // Substitute expresion to force C calling convention
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BOOTSERVICE
|
||||
//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a
|
||||
//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a
|
||||
#define RUNTIMESERVICE
|
||||
#define RUNTIMEFUNCTION
|
||||
|
||||
|
||||
#define RUNTIME_CODE(a) alloc_text("rtcode", a)
|
||||
#define BEGIN_RUNTIME_DATA() data_seg("rtdata")
|
||||
#define END_RUNTIME_DATA() data_seg("")
|
||||
|
||||
#define VOLATILE volatile
|
||||
|
||||
#define MEMORY_FENCE()
|
||||
|
||||
#ifdef EFI_NO_INTERFACE_DECL
|
||||
#define EFI_FORWARD_DECLARATION(x)
|
||||
#define EFI_INTERFACE_DECL(x)
|
||||
#else
|
||||
#define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
|
||||
#define EFI_INTERFACE_DECL(x) typedef struct x
|
||||
#endif
|
||||
|
||||
#ifdef EFI_NT_EMULATOR
|
||||
|
||||
//
|
||||
// To help ensure proper coding of integrated drivers, they are
|
||||
// compiled as DLLs. In NT they require a dll init entry pointer.
|
||||
// The macro puts a stub entry point into the DLL so it will load.
|
||||
//
|
||||
|
||||
#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
|
||||
EFI_STATUS \
|
||||
InitFunction ( \
|
||||
EFI_HANDLE ImageHandle, \
|
||||
EFI_SYSTEM_TABLE *SystemTable \
|
||||
); \
|
||||
\
|
||||
UINTN \
|
||||
__stdcall \
|
||||
_DllMainCRTStartup ( \
|
||||
UINTN Inst, \
|
||||
UINTN reason_for_call, \
|
||||
VOID *rserved \
|
||||
) \
|
||||
{ \
|
||||
return 1; \
|
||||
} \
|
||||
\
|
||||
int \
|
||||
__declspec( dllexport ) \
|
||||
__cdecl \
|
||||
InitializeDriver ( \
|
||||
void *ImageHandle, \
|
||||
void *SystemTable \
|
||||
) \
|
||||
{ \
|
||||
return InitFunction(ImageHandle, SystemTable); \
|
||||
}
|
||||
|
||||
|
||||
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
|
||||
(_if)->LoadInternal(type, name, NULL)
|
||||
|
||||
#else // EFI_NT_EMULATOR
|
||||
|
||||
//
|
||||
// When building similar to FW, link everything together as
|
||||
// one big module.
|
||||
//
|
||||
|
||||
#define EFI_DRIVER_ENTRY_POINT(InitFunction)
|
||||
|
||||
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
|
||||
(_if)->LoadInternal(type, name, entry)
|
||||
|
||||
#endif // EFI_FW_NT
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define INTERFACE_DECL(x) struct x
|
||||
#elif __rtems__
|
||||
#define INTERFACE_DECL(x) struct x
|
||||
#else
|
||||
//
|
||||
// Some compilers don't support the forward reference construct:
|
||||
// typedef struct XXXXX
|
||||
//
|
||||
// The following macro provide a workaround for such cases.
|
||||
//
|
||||
#ifdef NO_INTERFACE_DECL
|
||||
#define INTERFACE_DECL(x)
|
||||
#else
|
||||
#define INTERFACE_DECL(x) typedef struct x
|
||||
#endif
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#ifdef _MSC_EXTENSIONS
|
||||
#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP
|
||||
#endif
|
||||
|
||||
87
bsps/shared/freebsd/stand/efi/include/efi.h
Normal file
87
bsps/shared/freebsd/stand/efi/include/efi.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/* $FreeBSD$ */
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
Module Name:
|
||||
|
||||
efi.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Public EFI header files
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Build flags on input
|
||||
// EFI32
|
||||
// EFI_DEBUG - Enable debugging code
|
||||
// EFI_NT_EMULATOR - Building for running under NT
|
||||
//
|
||||
|
||||
|
||||
#ifndef _EFI_INCLUDE_
|
||||
#define _EFI_INCLUDE_
|
||||
|
||||
#define EFI_FIRMWARE_VENDOR L"INTEL"
|
||||
#define EFI_FIRMWARE_MAJOR_REVISION 14
|
||||
#define EFI_FIRMWARE_MINOR_REVISION 62
|
||||
#define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) | (EFI_FIRMWARE_MINOR_REVISION))
|
||||
|
||||
#include "efibind.h"
|
||||
#include "efidef.h"
|
||||
#include "efidevp.h"
|
||||
#ifndef __rtems__
|
||||
#include "efipciio.h"
|
||||
#include "efiprot.h"
|
||||
#endif /* __rtems__ */
|
||||
#include "eficon.h"
|
||||
#include "eficonsctl.h"
|
||||
#ifndef __rtems__
|
||||
#include "efiser.h"
|
||||
#include "efi_nii.h"
|
||||
#include "efipxebc.h"
|
||||
#include "efinet.h"
|
||||
#endif /* __rtems__ */
|
||||
#include "efiapi.h"
|
||||
#ifndef __rtems__
|
||||
#include "efifs.h"
|
||||
#endif /* __rtems__ */
|
||||
#include "efierr.h"
|
||||
#include "efigop.h"
|
||||
#ifndef __rtems__
|
||||
#include "efiip.h"
|
||||
#include "efiudp.h"
|
||||
#include "efitcp.h"
|
||||
#include "efipoint.h"
|
||||
#include "efiuga.h"
|
||||
#endif /* __rtems__ */
|
||||
#include <sys/types.h>
|
||||
#ifdef __rtems__
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
extern EFI_LOADED_IMAGE *boot_img;
|
||||
extern bool boot_services_active;
|
||||
|
||||
/*
|
||||
* FreeBSD UUID
|
||||
*/
|
||||
#define FREEBSD_BOOT_VAR_GUID \
|
||||
{ 0xCFEE69AD, 0xA0DE, 0x47A9, {0x93, 0xA8, 0xF6, 0x31, 0x06, 0xF8, 0xAE, 0x99} }
|
||||
|
||||
#endif
|
||||
1204
bsps/shared/freebsd/stand/efi/include/efiapi.h
Normal file
1204
bsps/shared/freebsd/stand/efi/include/efiapi.h
Normal file
File diff suppressed because it is too large
Load Diff
527
bsps/shared/freebsd/stand/efi/include/eficon.h
Normal file
527
bsps/shared/freebsd/stand/efi/include/eficon.h
Normal file
@@ -0,0 +1,527 @@
|
||||
/* $FreeBSD$ */
|
||||
#ifndef _EFI_CON_H
|
||||
#define _EFI_CON_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
Module Name:
|
||||
|
||||
eficon.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI console protocols
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Text output protocol
|
||||
//
|
||||
|
||||
#define SIMPLE_TEXT_OUTPUT_PROTOCOL \
|
||||
{ 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
INTERFACE_DECL(_SIMPLE_TEXT_OUTPUT_INTERFACE);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_RESET) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_OUTPUT_STRING) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN CHAR16 *String
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_TEST_STRING) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN CHAR16 *String
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_QUERY_MODE) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN UINTN ModeNumber,
|
||||
OUT UINTN *Columns,
|
||||
OUT UINTN *Rows
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_SET_MODE) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN UINTN ModeNumber
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN UINTN Attribute
|
||||
);
|
||||
|
||||
#define EFI_BLACK 0x00
|
||||
#define EFI_BLUE 0x01
|
||||
#define EFI_GREEN 0x02
|
||||
#define EFI_CYAN (EFI_BLUE | EFI_GREEN)
|
||||
#define EFI_RED 0x04
|
||||
#define EFI_MAGENTA (EFI_BLUE | EFI_RED)
|
||||
#define EFI_BROWN (EFI_GREEN | EFI_RED)
|
||||
#define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED)
|
||||
#define EFI_BRIGHT 0x08
|
||||
#define EFI_DARKGRAY (EFI_BRIGHT)
|
||||
#define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT)
|
||||
#define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT)
|
||||
#define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT)
|
||||
#define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT)
|
||||
#define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT)
|
||||
#define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT)
|
||||
#define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)
|
||||
|
||||
#define EFI_TEXT_ATTR(f,b) ((f) | ((b) << 4))
|
||||
|
||||
#define EFI_BACKGROUND_BLACK 0x00
|
||||
#define EFI_BACKGROUND_BLUE 0x10
|
||||
#define EFI_BACKGROUND_GREEN 0x20
|
||||
#define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)
|
||||
#define EFI_BACKGROUND_RED 0x40
|
||||
#define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)
|
||||
#define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
|
||||
#define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_CLEAR_SCREEN) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN UINTN Column,
|
||||
IN UINTN Row
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_ENABLE_CURSOR) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN BOOLEAN Enable
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
INT32 MaxMode;
|
||||
// current settings
|
||||
INT32 Mode;
|
||||
INT32 Attribute;
|
||||
INT32 CursorColumn;
|
||||
INT32 CursorRow;
|
||||
BOOLEAN CursorVisible;
|
||||
} SIMPLE_TEXT_OUTPUT_MODE;
|
||||
|
||||
typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE {
|
||||
EFI_TEXT_RESET Reset;
|
||||
|
||||
EFI_TEXT_OUTPUT_STRING OutputString;
|
||||
EFI_TEXT_TEST_STRING TestString;
|
||||
|
||||
EFI_TEXT_QUERY_MODE QueryMode;
|
||||
EFI_TEXT_SET_MODE SetMode;
|
||||
EFI_TEXT_SET_ATTRIBUTE SetAttribute;
|
||||
|
||||
EFI_TEXT_CLEAR_SCREEN ClearScreen;
|
||||
EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;
|
||||
EFI_TEXT_ENABLE_CURSOR EnableCursor;
|
||||
|
||||
// Current mode
|
||||
SIMPLE_TEXT_OUTPUT_MODE *Mode;
|
||||
} SIMPLE_TEXT_OUTPUT_INTERFACE;
|
||||
|
||||
//
|
||||
// Define's for required EFI Unicode Box Draw character
|
||||
//
|
||||
|
||||
#define BOXDRAW_HORIZONTAL 0x2500
|
||||
#define BOXDRAW_VERTICAL 0x2502
|
||||
#define BOXDRAW_DOWN_RIGHT 0x250c
|
||||
#define BOXDRAW_DOWN_LEFT 0x2510
|
||||
#define BOXDRAW_UP_RIGHT 0x2514
|
||||
#define BOXDRAW_UP_LEFT 0x2518
|
||||
#define BOXDRAW_VERTICAL_RIGHT 0x251c
|
||||
#define BOXDRAW_VERTICAL_LEFT 0x2524
|
||||
#define BOXDRAW_DOWN_HORIZONTAL 0x252c
|
||||
#define BOXDRAW_UP_HORIZONTAL 0x2534
|
||||
#define BOXDRAW_VERTICAL_HORIZONTAL 0x253c
|
||||
|
||||
#define BOXDRAW_DOUBLE_HORIZONTAL 0x2550
|
||||
#define BOXDRAW_DOUBLE_VERTICAL 0x2551
|
||||
#define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552
|
||||
#define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553
|
||||
#define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554
|
||||
|
||||
#define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555
|
||||
#define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556
|
||||
#define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557
|
||||
|
||||
#define BOXDRAW_UP_RIGHT_DOUBLE 0x2558
|
||||
#define BOXDRAW_UP_DOUBLE_RIGHT 0x2559
|
||||
#define BOXDRAW_DOUBLE_UP_RIGHT 0x255a
|
||||
|
||||
#define BOXDRAW_UP_LEFT_DOUBLE 0x255b
|
||||
#define BOXDRAW_UP_DOUBLE_LEFT 0x255c
|
||||
#define BOXDRAW_DOUBLE_UP_LEFT 0x255d
|
||||
|
||||
#define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e
|
||||
#define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f
|
||||
#define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560
|
||||
|
||||
#define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561
|
||||
#define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562
|
||||
#define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563
|
||||
|
||||
#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564
|
||||
#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565
|
||||
#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566
|
||||
|
||||
#define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567
|
||||
#define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568
|
||||
#define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569
|
||||
|
||||
#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a
|
||||
#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b
|
||||
#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c
|
||||
|
||||
//
|
||||
// EFI Required Block Elements Code Chart
|
||||
//
|
||||
|
||||
#define BLOCKELEMENT_FULL_BLOCK 0x2588
|
||||
#define BLOCKELEMENT_LIGHT_SHADE 0x2591
|
||||
//
|
||||
// EFI Required Geometric Shapes Code Chart
|
||||
//
|
||||
|
||||
#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2
|
||||
#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba
|
||||
#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc
|
||||
#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4
|
||||
|
||||
//
|
||||
// EFI Required Arrow shapes
|
||||
//
|
||||
|
||||
#define ARROW_UP 0x2191
|
||||
#define ARROW_DOWN 0x2193
|
||||
|
||||
//
|
||||
// Text input protocol
|
||||
//
|
||||
|
||||
#define SIMPLE_TEXT_INPUT_PROTOCOL \
|
||||
{ 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
INTERFACE_DECL(_SIMPLE_INPUT_INTERFACE);
|
||||
|
||||
typedef struct {
|
||||
UINT16 ScanCode;
|
||||
CHAR16 UnicodeChar;
|
||||
} EFI_INPUT_KEY;
|
||||
|
||||
//
|
||||
// Baseline unicode control chars
|
||||
//
|
||||
|
||||
#define CHAR_NULL 0x0000
|
||||
#define CHAR_BACKSPACE 0x0008
|
||||
#define CHAR_TAB 0x0009
|
||||
#define CHAR_LINEFEED 0x000A
|
||||
#define CHAR_CARRIAGE_RETURN 0x000D
|
||||
|
||||
//
|
||||
// Scan codes for base line keys
|
||||
//
|
||||
|
||||
#define SCAN_NULL 0x0000
|
||||
#define SCAN_UP 0x0001
|
||||
#define SCAN_DOWN 0x0002
|
||||
#define SCAN_RIGHT 0x0003
|
||||
#define SCAN_LEFT 0x0004
|
||||
#define SCAN_HOME 0x0005
|
||||
#define SCAN_END 0x0006
|
||||
#define SCAN_INSERT 0x0007
|
||||
#define SCAN_DELETE 0x0008
|
||||
#define SCAN_PAGE_UP 0x0009
|
||||
#define SCAN_PAGE_DOWN 0x000A
|
||||
#define SCAN_F1 0x000B
|
||||
#define SCAN_F2 0x000C
|
||||
#define SCAN_F3 0x000D
|
||||
#define SCAN_F4 0x000E
|
||||
#define SCAN_F5 0x000F
|
||||
#define SCAN_F6 0x0010
|
||||
#define SCAN_F7 0x0011
|
||||
#define SCAN_F8 0x0012
|
||||
#define SCAN_F9 0x0013
|
||||
#define SCAN_F10 0x0014
|
||||
#define SCAN_ESC 0x0017
|
||||
|
||||
//
|
||||
// EFI Scan code Ex
|
||||
//
|
||||
#define SCAN_F11 0x0015
|
||||
#define SCAN_F12 0x0016
|
||||
#define SCAN_F13 0x0068
|
||||
#define SCAN_F14 0x0069
|
||||
#define SCAN_F15 0x006A
|
||||
#define SCAN_F16 0x006B
|
||||
#define SCAN_F17 0x006C
|
||||
#define SCAN_F18 0x006D
|
||||
#define SCAN_F19 0x006E
|
||||
#define SCAN_F20 0x006F
|
||||
#define SCAN_F21 0x0070
|
||||
#define SCAN_F22 0x0071
|
||||
#define SCAN_F23 0x0072
|
||||
#define SCAN_F24 0x0073
|
||||
#define SCAN_MUTE 0x007F
|
||||
#define SCAN_VOLUME_UP 0x0080
|
||||
#define SCAN_VOLUME_DOWN 0x0081
|
||||
#define SCAN_BRIGHTNESS_UP 0x0100
|
||||
#define SCAN_BRIGHTNESS_DOWN 0x0101
|
||||
#define SCAN_SUSPEND 0x0102
|
||||
#define SCAN_HIBERNATE 0x0103
|
||||
#define SCAN_TOGGLE_DISPLAY 0x0104
|
||||
#define SCAN_RECOVERY 0x0105
|
||||
#define SCAN_EJECT 0x0106
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_INPUT_RESET) (
|
||||
IN struct _SIMPLE_INPUT_INTERFACE *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_INPUT_READ_KEY) (
|
||||
IN struct _SIMPLE_INPUT_INTERFACE *This,
|
||||
OUT EFI_INPUT_KEY *Key
|
||||
);
|
||||
|
||||
typedef struct _SIMPLE_INPUT_INTERFACE {
|
||||
EFI_INPUT_RESET Reset;
|
||||
EFI_INPUT_READ_KEY ReadKeyStroke;
|
||||
EFI_EVENT WaitForKey;
|
||||
} SIMPLE_INPUT_INTERFACE;
|
||||
|
||||
#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
|
||||
{0xdd9e7534, 0x7762, 0x4698, {0x8c, 0x14, 0xf5, 0x85, \
|
||||
0x17, 0xa6, 0x25, 0xaa} }
|
||||
|
||||
INTERFACE_DECL(_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL);
|
||||
|
||||
typedef UINT8 EFI_KEY_TOGGLE_STATE;
|
||||
//
|
||||
// Any Shift or Toggle State that is valid should have
|
||||
// high order bit set.
|
||||
//
|
||||
typedef struct EFI_KEY_STATE {
|
||||
UINT32 KeyShiftState;
|
||||
EFI_KEY_TOGGLE_STATE KeyToggleState;
|
||||
} EFI_KEY_STATE;
|
||||
|
||||
typedef struct {
|
||||
EFI_INPUT_KEY Key;
|
||||
EFI_KEY_STATE KeyState;
|
||||
} EFI_KEY_DATA;
|
||||
|
||||
//
|
||||
// Shift state
|
||||
//
|
||||
#define EFI_SHIFT_STATE_VALID 0x80000000
|
||||
#define EFI_RIGHT_SHIFT_PRESSED 0x00000001
|
||||
#define EFI_LEFT_SHIFT_PRESSED 0x00000002
|
||||
#define EFI_RIGHT_CONTROL_PRESSED 0x00000004
|
||||
#define EFI_LEFT_CONTROL_PRESSED 0x00000008
|
||||
#define EFI_RIGHT_ALT_PRESSED 0x00000010
|
||||
#define EFI_LEFT_ALT_PRESSED 0x00000020
|
||||
#define EFI_RIGHT_LOGO_PRESSED 0x00000040
|
||||
#define EFI_LEFT_LOGO_PRESSED 0x00000080
|
||||
#define EFI_MENU_KEY_PRESSED 0x00000100
|
||||
#define EFI_SYS_REQ_PRESSED 0x00000200
|
||||
|
||||
//
|
||||
// Toggle state
|
||||
//
|
||||
#define EFI_TOGGLE_STATE_VALID 0x80
|
||||
#define EFI_KEY_STATE_EXPOSED 0x40
|
||||
#define EFI_SCROLL_LOCK_ACTIVE 0x01
|
||||
#define EFI_NUM_LOCK_ACTIVE 0x02
|
||||
#define EFI_CAPS_LOCK_ACTIVE 0x04
|
||||
|
||||
//
|
||||
// EFI Key Notfication Function
|
||||
//
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_KEY_NOTIFY_FUNCTION) (
|
||||
IN EFI_KEY_DATA *KeyData
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_INPUT_RESET_EX) (
|
||||
IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Reset the input device and optionaly run diagnostics
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
ExtendedVerification - Driver may perform diagnostics on reset.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The device was reset.
|
||||
EFI_DEVICE_ERROR - The device is not functioning properly and could
|
||||
not be reset.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_INPUT_READ_KEY_EX) (
|
||||
IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
OUT EFI_KEY_DATA *KeyData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Reads the next keystroke from the input device. The WaitForKey Event can
|
||||
be used to test for existence of a keystroke via WaitForEvent () call.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
KeyData - A pointer to a buffer that is filled in with the keystroke
|
||||
state data for the key that was pressed.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The keystroke information was returned.
|
||||
EFI_NOT_READY - There was no keystroke data availiable.
|
||||
EFI_DEVICE_ERROR - The keystroke information was not returned due to
|
||||
hardware errors.
|
||||
EFI_INVALID_PARAMETER - KeyData is NULL.
|
||||
--*/
|
||||
;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SET_STATE) (
|
||||
IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Set certain state for the input device.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the
|
||||
state for the input device.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The device state was set successfully.
|
||||
EFI_DEVICE_ERROR - The device is not functioning correctly and could
|
||||
not have the setting adjusted.
|
||||
EFI_UNSUPPORTED - The device does not have the ability to set its state.
|
||||
EFI_INVALID_PARAMETER - KeyToggleState is NULL.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) (
|
||||
IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
IN EFI_KEY_DATA *KeyData,
|
||||
IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
|
||||
OUT EFI_HANDLE *NotifyHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Register a notification function for a particular keystroke for the input device.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
KeyData - A pointer to a buffer that is filled in with the keystroke
|
||||
information data for the key that was pressed.
|
||||
KeyNotificationFunction - Points to the function to be called when the key
|
||||
sequence is typed specified by KeyData.
|
||||
NotifyHandle - Points to the unique handle assigned to the registered notification.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The notification function was registered successfully.
|
||||
EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.
|
||||
EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) (
|
||||
IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||
IN EFI_HANDLE NotificationHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Remove a registered notification function from a particular keystroke.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
NotificationHandle - The handle of the notification function being unregistered.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The notification function was unregistered successfully.
|
||||
EFI_INVALID_PARAMETER - The NotificationHandle is invalid.
|
||||
EFI_NOT_FOUND - Can not find the matching entry in database.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL {
|
||||
EFI_INPUT_RESET_EX Reset;
|
||||
EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;
|
||||
EFI_EVENT WaitForKeyEx;
|
||||
EFI_SET_STATE SetState;
|
||||
EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;
|
||||
EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;
|
||||
} EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;
|
||||
|
||||
#endif
|
||||
134
bsps/shared/freebsd/stand/efi/include/eficonsctl.h
Normal file
134
bsps/shared/freebsd/stand/efi/include/eficonsctl.h
Normal file
@@ -0,0 +1,134 @@
|
||||
/*-
|
||||
* Copyright (c) 2004 - 2010, Intel Corporation. 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Original Module Name: ConsoleControl.h
|
||||
* Abstract: Abstraction of a Text mode or GOP/UGA screen
|
||||
*/
|
||||
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#ifndef _EFI_CONS_CTL_H
|
||||
#define _EFI_CONS_CTL_H
|
||||
|
||||
#define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \
|
||||
{ 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} }
|
||||
|
||||
typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL EFI_CONSOLE_CONTROL_PROTOCOL;
|
||||
|
||||
|
||||
typedef enum {
|
||||
EfiConsoleControlScreenText,
|
||||
EfiConsoleControlScreenGraphics,
|
||||
EfiConsoleControlScreenMaxValue
|
||||
} EFI_CONSOLE_CONTROL_SCREEN_MODE;
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE) (
|
||||
IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
|
||||
OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode,
|
||||
OUT BOOLEAN *GopUgaExists, OPTIONAL
|
||||
OUT BOOLEAN *StdInLocked OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Return the current video mode information. Also returns info about existence
|
||||
of Graphics Output devices or UGA Draw devices in system, and if the Std In
|
||||
device is locked. All the arguments are optional and only returned if a non
|
||||
NULL pointer is passed in.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
Mode - Are we in text of grahics mode.
|
||||
GopUgaExists - TRUE if Console Spliter has found a GOP or UGA device
|
||||
StdInLocked - TRUE if StdIn device is keyboard locked
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Mode information returned.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE) (
|
||||
IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
|
||||
IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Set the current mode to either text or graphics. Graphics is
|
||||
for Quiet Boot.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
Mode - Mode to set the
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Mode information returned.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN) (
|
||||
IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
|
||||
IN CHAR16 *Password
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Lock Std In devices until Password is typed.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
Password - Password needed to unlock screen. NULL means unlock keyboard
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Mode information returned.
|
||||
EFI_DEVICE_ERROR - Std In not locked
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
|
||||
struct _EFI_CONSOLE_CONTROL_PROTOCOL {
|
||||
EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE GetMode;
|
||||
EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE SetMode;
|
||||
EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN LockStdIn;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiConsoleControlProtocolGuid;
|
||||
|
||||
#endif
|
||||
224
bsps/shared/freebsd/stand/efi/include/efidef.h
Normal file
224
bsps/shared/freebsd/stand/efi/include/efidef.h
Normal file
@@ -0,0 +1,224 @@
|
||||
/* $FreeBSD$ */
|
||||
#ifndef _EFI_DEF_H
|
||||
#define _EFI_DEF_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
Module Name:
|
||||
|
||||
efidef.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI definitions
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
typedef UINT16 CHAR16;
|
||||
typedef UINT8 CHAR8;
|
||||
#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */
|
||||
typedef UINT8 BOOLEAN;
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE ((BOOLEAN) 1)
|
||||
#define FALSE ((BOOLEAN) 0)
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((VOID *) 0)
|
||||
#endif
|
||||
|
||||
typedef UINTN EFI_STATUS;
|
||||
typedef UINT64 EFI_LBA;
|
||||
typedef UINTN EFI_TPL;
|
||||
typedef VOID *EFI_HANDLE;
|
||||
typedef VOID *EFI_EVENT;
|
||||
|
||||
|
||||
//
|
||||
// Prototype argument decoration for EFI parameters to indicate
|
||||
// their direction
|
||||
//
|
||||
// IN - argument is passed into the function
|
||||
// OUT - argument (pointer) is returned from the function
|
||||
// OPTIONAL - argument is optional
|
||||
//
|
||||
|
||||
#ifndef IN
|
||||
#define IN
|
||||
#define OUT
|
||||
#define OPTIONAL
|
||||
#define CONST const
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// A GUID
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
UINT32 Data1;
|
||||
UINT16 Data2;
|
||||
UINT16 Data3;
|
||||
UINT8 Data4[8];
|
||||
} EFI_GUID;
|
||||
|
||||
|
||||
//
|
||||
// Time
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
UINT16 Year; // 1998 - 20XX
|
||||
UINT8 Month; // 1 - 12
|
||||
UINT8 Day; // 1 - 31
|
||||
UINT8 Hour; // 0 - 23
|
||||
UINT8 Minute; // 0 - 59
|
||||
UINT8 Second; // 0 - 59
|
||||
UINT8 Pad1;
|
||||
UINT32 Nanosecond; // 0 - 999,999,999
|
||||
INT16 TimeZone; // -1440 to 1440 or 2047
|
||||
UINT8 Daylight;
|
||||
UINT8 Pad2;
|
||||
} EFI_TIME;
|
||||
|
||||
// Bit definitions for EFI_TIME.Daylight
|
||||
#define EFI_TIME_ADJUST_DAYLIGHT 0x01
|
||||
#define EFI_TIME_IN_DAYLIGHT 0x02
|
||||
|
||||
// Value definition for EFI_TIME.TimeZone
|
||||
#define EFI_UNSPECIFIED_TIMEZONE 0x07FF
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Networking
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
UINT8 Addr[4];
|
||||
} EFI_IPv4_ADDRESS;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Addr[16];
|
||||
} EFI_IPv6_ADDRESS;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Addr[32];
|
||||
} EFI_MAC_ADDRESS;
|
||||
|
||||
typedef struct {
|
||||
UINT32 ReceivedQueueTimeoutValue;
|
||||
UINT32 TransmitQueueTimeoutValue;
|
||||
UINT16 ProtocolTypeFilter;
|
||||
BOOLEAN EnableUnicastReceive;
|
||||
BOOLEAN EnableMulticastReceive;
|
||||
BOOLEAN EnableBroadcastReceive;
|
||||
BOOLEAN EnablePromiscuousReceive;
|
||||
BOOLEAN FlushQueuesOnReset;
|
||||
BOOLEAN EnableReceiveTimestamps;
|
||||
BOOLEAN DisableBackgroundPolling;
|
||||
} EFI_MANAGED_NETWORK_CONFIG_DATA;
|
||||
|
||||
//
|
||||
// Memory
|
||||
//
|
||||
|
||||
typedef UINT64 EFI_PHYSICAL_ADDRESS;
|
||||
typedef UINT64 EFI_VIRTUAL_ADDRESS;
|
||||
|
||||
typedef enum {
|
||||
AllocateAnyPages,
|
||||
AllocateMaxAddress,
|
||||
AllocateAddress,
|
||||
MaxAllocateType
|
||||
} EFI_ALLOCATE_TYPE;
|
||||
|
||||
//Preseve the attr on any range supplied.
|
||||
//ConventialMemory must have WB,SR,SW when supplied.
|
||||
//When allocating from ConventialMemory always make it WB,SR,SW
|
||||
//When returning to ConventialMemory always make it WB,SR,SW
|
||||
//When getting the memory map, or on RT for runtime types
|
||||
|
||||
|
||||
typedef enum {
|
||||
EfiReservedMemoryType,
|
||||
EfiLoaderCode,
|
||||
EfiLoaderData,
|
||||
EfiBootServicesCode,
|
||||
EfiBootServicesData,
|
||||
EfiRuntimeServicesCode,
|
||||
EfiRuntimeServicesData,
|
||||
EfiConventionalMemory,
|
||||
EfiUnusableMemory,
|
||||
EfiACPIReclaimMemory,
|
||||
EfiACPIMemoryNVS,
|
||||
EfiMemoryMappedIO,
|
||||
EfiMemoryMappedIOPortSpace,
|
||||
EfiPalCode,
|
||||
EfiPersistentMemory,
|
||||
EfiMaxMemoryType
|
||||
} EFI_MEMORY_TYPE;
|
||||
|
||||
// possible caching types for the memory range
|
||||
#define EFI_MEMORY_UC 0x0000000000000001
|
||||
#define EFI_MEMORY_WC 0x0000000000000002
|
||||
#define EFI_MEMORY_WT 0x0000000000000004
|
||||
#define EFI_MEMORY_WB 0x0000000000000008
|
||||
#define EFI_MEMORY_UCE 0x0000000000000010
|
||||
|
||||
// physical memory protection on range
|
||||
#define EFI_MEMORY_WP 0x0000000000001000
|
||||
#define EFI_MEMORY_RP 0x0000000000002000
|
||||
#define EFI_MEMORY_XP 0x0000000000004000
|
||||
#define EFI_MEMORY_NV 0x0000000000008000
|
||||
#define EFI_MEMORY_MORE_RELIABLE 0x0000000000010000
|
||||
#define EFI_MEMORY_RO 0x0000000000020000
|
||||
|
||||
// range requires a runtime mapping
|
||||
#define EFI_MEMORY_RUNTIME 0x8000000000000000
|
||||
|
||||
#define EFI_MEMORY_DESCRIPTOR_VERSION 1
|
||||
typedef struct {
|
||||
UINT32 Type; // Field size is 32 bits followed by 32 bit pad
|
||||
UINT32 Pad;
|
||||
EFI_PHYSICAL_ADDRESS PhysicalStart; // Field size is 64 bits
|
||||
EFI_VIRTUAL_ADDRESS VirtualStart; // Field size is 64 bits
|
||||
UINT64 NumberOfPages; // Field size is 64 bits
|
||||
UINT64 Attribute; // Field size is 64 bits
|
||||
} EFI_MEMORY_DESCRIPTOR;
|
||||
|
||||
//
|
||||
// International Language
|
||||
//
|
||||
|
||||
typedef UINT8 ISO_639_2;
|
||||
#define ISO_639_2_ENTRY_SIZE 3
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#define EFI_PAGE_SIZE 4096
|
||||
#define EFI_PAGE_MASK 0xFFF
|
||||
#define EFI_PAGE_SHIFT 12
|
||||
|
||||
#define EFI_SIZE_TO_PAGES(a) \
|
||||
( ((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0) )
|
||||
|
||||
#endif
|
||||
511
bsps/shared/freebsd/stand/efi/include/efidevp.h
Normal file
511
bsps/shared/freebsd/stand/efi/include/efidevp.h
Normal file
@@ -0,0 +1,511 @@
|
||||
/* $FreeBSD$ */
|
||||
#ifndef _DEVPATH_H
|
||||
#define _DEVPATH_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
Module Name:
|
||||
|
||||
devpath.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Defines for parsing the EFI Device Path structures
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Device Path structures - Section C
|
||||
//
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct _EFI_DEVICE_PATH {
|
||||
UINT8 Type;
|
||||
UINT8 SubType;
|
||||
UINT8 Length[2];
|
||||
} EFI_DEVICE_PATH;
|
||||
|
||||
#define EFI_DP_TYPE_MASK 0x7F
|
||||
#define EFI_DP_TYPE_UNPACKED 0x80
|
||||
|
||||
#define END_DEVICE_PATH_TYPE 0x7f
|
||||
|
||||
#define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
|
||||
#define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01
|
||||
#define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH))
|
||||
|
||||
|
||||
#define DP_IS_END_TYPE(a)
|
||||
#define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
|
||||
|
||||
#define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK )
|
||||
#define DevicePathSubType(a) ( (a)->SubType )
|
||||
#define DevicePathNodeLength(a) ((size_t)(((a)->Length[0]) | ((a)->Length[1] << 8)))
|
||||
#define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a)))
|
||||
#define IsDevicePathType(a, t) ( DevicePathType(a) == t )
|
||||
#define IsDevicePathEndType(a) IsDevicePathType(a, END_DEVICE_PATH_TYPE)
|
||||
#define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
|
||||
#define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) )
|
||||
#define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED )
|
||||
|
||||
|
||||
#define SetDevicePathNodeLength(a,l) { \
|
||||
(a)->Length[0] = (UINT8) (l); \
|
||||
(a)->Length[1] = (UINT8) ((l) >> 8); \
|
||||
}
|
||||
|
||||
#define SetDevicePathEndNode(a) { \
|
||||
(a)->Type = END_DEVICE_PATH_TYPE; \
|
||||
(a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
|
||||
(a)->Length[0] = sizeof(EFI_DEVICE_PATH); \
|
||||
(a)->Length[1] = 0; \
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
#define HARDWARE_DEVICE_PATH 0x01
|
||||
|
||||
#define HW_PCI_DP 0x01
|
||||
typedef struct _PCI_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT8 Function;
|
||||
UINT8 Device;
|
||||
} PCI_DEVICE_PATH;
|
||||
|
||||
#define HW_PCCARD_DP 0x02
|
||||
typedef struct _PCCARD_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT8 FunctionNumber;
|
||||
} PCCARD_DEVICE_PATH;
|
||||
|
||||
#define HW_MEMMAP_DP 0x03
|
||||
typedef struct _MEMMAP_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 MemoryType;
|
||||
EFI_PHYSICAL_ADDRESS StartingAddress;
|
||||
EFI_PHYSICAL_ADDRESS EndingAddress;
|
||||
} MEMMAP_DEVICE_PATH;
|
||||
|
||||
#define HW_VENDOR_DP 0x04
|
||||
typedef struct _VENDOR_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
EFI_GUID Guid;
|
||||
} VENDOR_DEVICE_PATH;
|
||||
|
||||
#define UNKNOWN_DEVICE_GUID \
|
||||
{ 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} }
|
||||
|
||||
typedef struct _UKNOWN_DEVICE_VENDOR_DP {
|
||||
VENDOR_DEVICE_PATH DevicePath;
|
||||
UINT8 LegacyDriveLetter;
|
||||
} UNKNOWN_DEVICE_VENDOR_DEVICE_PATH;
|
||||
|
||||
#define HW_CONTROLLER_DP 0x05
|
||||
typedef struct _CONTROLLER_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Controller;
|
||||
} CONTROLLER_DEVICE_PATH;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
#define ACPI_DEVICE_PATH 0x02
|
||||
|
||||
#define ACPI_DP 0x01
|
||||
typedef struct _ACPI_HID_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 HID;
|
||||
UINT32 UID;
|
||||
} ACPI_HID_DEVICE_PATH;
|
||||
|
||||
#define ACPI_EXTENDED_DP 0x02
|
||||
typedef struct _ACPI_EXTENDED_HID_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 HID;
|
||||
UINT32 UID;
|
||||
UINT32 CID;
|
||||
} ACPI_EXTENDED_HID_DEVICE_PATH;
|
||||
|
||||
#define ACPI_ADR_DP 0x03
|
||||
/* ACPI_ADR_DEVICE_PATH not defined */
|
||||
|
||||
//
|
||||
// EISA ID Macro
|
||||
// EISA ID Definition 32-bits
|
||||
// bits[15:0] - three character compressed ASCII EISA ID.
|
||||
// bits[31:16] - binary number
|
||||
// Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
|
||||
//
|
||||
#define PNP_EISA_ID_CONST 0x41d0
|
||||
#define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16))
|
||||
#define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
|
||||
#define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
|
||||
|
||||
#define PNP_EISA_ID_MASK 0xffff
|
||||
#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
|
||||
/*
|
||||
*
|
||||
*/
|
||||
#define MESSAGING_DEVICE_PATH 0x03
|
||||
|
||||
#define MSG_ATAPI_DP 0x01
|
||||
typedef struct _ATAPI_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT8 PrimarySecondary;
|
||||
UINT8 SlaveMaster;
|
||||
UINT16 Lun;
|
||||
} ATAPI_DEVICE_PATH;
|
||||
|
||||
#define MSG_SCSI_DP 0x02
|
||||
typedef struct _SCSI_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT16 Pun;
|
||||
UINT16 Lun;
|
||||
} SCSI_DEVICE_PATH;
|
||||
|
||||
#define MSG_FIBRECHANNEL_DP 0x03
|
||||
typedef struct _FIBRECHANNEL_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Reserved;
|
||||
UINT64 WWN;
|
||||
UINT64 Lun;
|
||||
} FIBRECHANNEL_DEVICE_PATH;
|
||||
|
||||
#define MSG_1394_DP 0x04
|
||||
typedef struct _F1394_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Reserved;
|
||||
UINT64 Guid;
|
||||
} F1394_DEVICE_PATH;
|
||||
|
||||
#define MSG_USB_DP 0x05
|
||||
typedef struct _USB_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT8 ParentPortNumber;
|
||||
UINT8 InterfaceNumber;
|
||||
} USB_DEVICE_PATH;
|
||||
|
||||
#define MSG_USB_CLASS_DP 0x0F
|
||||
typedef struct _USB_CLASS_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT16 VendorId;
|
||||
UINT16 ProductId;
|
||||
UINT8 DeviceClass;
|
||||
UINT8 DeviceSubClass;
|
||||
UINT8 DeviceProtocol;
|
||||
} USB_CLASS_DEVICE_PATH;
|
||||
|
||||
#define MSG_I2O_DP 0x06
|
||||
typedef struct _I2O_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Tid;
|
||||
} I2O_DEVICE_PATH;
|
||||
|
||||
#define MSG_MAC_ADDR_DP 0x0b
|
||||
typedef struct _MAC_ADDR_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
EFI_MAC_ADDRESS MacAddress;
|
||||
UINT8 IfType;
|
||||
} MAC_ADDR_DEVICE_PATH;
|
||||
|
||||
#define MSG_IPv4_DP 0x0c
|
||||
typedef struct _IPv4_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
EFI_IPv4_ADDRESS LocalIpAddress;
|
||||
EFI_IPv4_ADDRESS RemoteIpAddress;
|
||||
UINT16 LocalPort;
|
||||
UINT16 RemotePort;
|
||||
UINT16 Protocol;
|
||||
BOOLEAN StaticIpAddress;
|
||||
EFI_IPv4_ADDRESS GatewayIpAddress;
|
||||
EFI_IPv4_ADDRESS SubnetMask;
|
||||
} IPv4_DEVICE_PATH;
|
||||
|
||||
#define MSG_IPv6_DP 0x0d
|
||||
typedef struct _IPv6_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
EFI_IPv6_ADDRESS LocalIpAddress;
|
||||
EFI_IPv6_ADDRESS RemoteIpAddress;
|
||||
UINT16 LocalPort;
|
||||
UINT16 RemotePort;
|
||||
UINT16 Protocol;
|
||||
BOOLEAN StaticIpAddress;
|
||||
} IPv6_DEVICE_PATH;
|
||||
|
||||
#define MSG_INFINIBAND_DP 0x09
|
||||
typedef struct _INFINIBAND_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 ResourceFlags;
|
||||
UINT8 PortGid[16];
|
||||
UINT64 ServiceId;
|
||||
UINT64 TargetPortId;
|
||||
UINT64 DeviceId;
|
||||
} INFINIBAND_DEVICE_PATH;
|
||||
|
||||
#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01
|
||||
#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02
|
||||
#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04
|
||||
#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08
|
||||
#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10
|
||||
|
||||
#define MSG_UART_DP 0x0e
|
||||
typedef struct _UART_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Reserved;
|
||||
UINT64 BaudRate;
|
||||
UINT8 DataBits;
|
||||
UINT8 Parity;
|
||||
UINT8 StopBits;
|
||||
} UART_DEVICE_PATH;
|
||||
|
||||
#define MSG_VENDOR_DP 0x0A
|
||||
/* Use VENDOR_DEVICE_PATH struct */
|
||||
|
||||
#define DEVICE_PATH_MESSAGING_PC_ANSI \
|
||||
{ 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
#define DEVICE_PATH_MESSAGING_VT_100 \
|
||||
{ 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
#define DEVICE_PATH_MESSAGING_VT_100_PLUS \
|
||||
{ 0x7baec70b, 0x57e0, 0x4c76, {0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43} }
|
||||
|
||||
#define DEVICE_PATH_MESSAGING_VT_UTF8 \
|
||||
{ 0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88} }
|
||||
|
||||
/* Device Logical Unit SubType. */
|
||||
#define MSG_DEVICE_LOGICAL_UNIT_DP 0x11
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH Header;
|
||||
/* Logical Unit Number for the interface. */
|
||||
UINT8 Lun;
|
||||
} DEVICE_LOGICAL_UNIT_DEVICE_PATH;
|
||||
|
||||
#define MSG_SATA_DP 0x12
|
||||
typedef struct _SATA_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT16 HBAPortNumber;
|
||||
UINT16 PortMultiplierPortNumber;
|
||||
UINT16 Lun;
|
||||
} SATA_DEVICE_PATH;
|
||||
|
||||
|
||||
/* DNS Device Path SubType */
|
||||
#define MSG_DNS_DP 0x1F
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH Header;
|
||||
/* Indicates the DNS server address is IPv4 or IPv6 address. */
|
||||
UINT8 IsIPv6;
|
||||
/* Instance of the DNS server address. */
|
||||
/* XXX: actually EFI_IP_ADDRESS */
|
||||
EFI_IPv4_ADDRESS DnsServerIp[];
|
||||
} DNS_DEVICE_PATH;
|
||||
|
||||
/* Uniform Resource Identifiers (URI) Device Path SubType */
|
||||
#define MSG_URI_DP 0x18
|
||||
typedef struct {
|
||||
EFI_DEVICE_PATH Header;
|
||||
/* Instance of the URI pursuant to RFC 3986. */
|
||||
CHAR8 Uri[];
|
||||
} URI_DEVICE_PATH;
|
||||
|
||||
#define MEDIA_DEVICE_PATH 0x04
|
||||
|
||||
#define MEDIA_HARDDRIVE_DP 0x01
|
||||
typedef struct _HARDDRIVE_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 PartitionNumber;
|
||||
UINT64 PartitionStart;
|
||||
UINT64 PartitionSize;
|
||||
UINT8 Signature[16];
|
||||
UINT8 MBRType;
|
||||
UINT8 SignatureType;
|
||||
} HARDDRIVE_DEVICE_PATH;
|
||||
|
||||
#define MBR_TYPE_PCAT 0x01
|
||||
#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
|
||||
|
||||
#define SIGNATURE_TYPE_MBR 0x01
|
||||
#define SIGNATURE_TYPE_GUID 0x02
|
||||
|
||||
#define MEDIA_CDROM_DP 0x02
|
||||
typedef struct _CDROM_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 BootEntry;
|
||||
UINT64 PartitionStart;
|
||||
UINT64 PartitionSize;
|
||||
} CDROM_DEVICE_PATH;
|
||||
|
||||
#define MEDIA_VENDOR_DP 0x03
|
||||
/* Use VENDOR_DEVICE_PATH struct */
|
||||
|
||||
#define MEDIA_FILEPATH_DP 0x04
|
||||
typedef struct _FILEPATH_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
CHAR16 PathName[1];
|
||||
} FILEPATH_DEVICE_PATH;
|
||||
|
||||
#define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)
|
||||
|
||||
#define MEDIA_PROTOCOL_DP 0x05
|
||||
typedef struct _MEDIA_PROTOCOL_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
EFI_GUID Protocol;
|
||||
} MEDIA_PROTOCOL_DEVICE_PATH;
|
||||
|
||||
|
||||
#define BBS_DEVICE_PATH 0x05
|
||||
#define BBS_BBS_DP 0x01
|
||||
typedef struct _BBS_BBS_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT16 DeviceType;
|
||||
UINT16 StatusFlag;
|
||||
CHAR8 String[1];
|
||||
} BBS_BBS_DEVICE_PATH;
|
||||
|
||||
/* DeviceType definitions - from BBS specification */
|
||||
#define BBS_TYPE_FLOPPY 0x01
|
||||
#define BBS_TYPE_HARDDRIVE 0x02
|
||||
#define BBS_TYPE_CDROM 0x03
|
||||
#define BBS_TYPE_PCMCIA 0x04
|
||||
#define BBS_TYPE_USB 0x05
|
||||
#define BBS_TYPE_EMBEDDED_NETWORK 0x06
|
||||
#define BBS_TYPE_DEV 0x80
|
||||
#define BBS_TYPE_UNKNOWN 0xFF
|
||||
|
||||
typedef union {
|
||||
EFI_DEVICE_PATH DevPath;
|
||||
PCI_DEVICE_PATH Pci;
|
||||
PCCARD_DEVICE_PATH PcCard;
|
||||
MEMMAP_DEVICE_PATH MemMap;
|
||||
VENDOR_DEVICE_PATH Vendor;
|
||||
UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor;
|
||||
CONTROLLER_DEVICE_PATH Controller;
|
||||
ACPI_HID_DEVICE_PATH Acpi;
|
||||
|
||||
ATAPI_DEVICE_PATH Atapi;
|
||||
SCSI_DEVICE_PATH Scsi;
|
||||
FIBRECHANNEL_DEVICE_PATH FibreChannel;
|
||||
|
||||
F1394_DEVICE_PATH F1394;
|
||||
USB_DEVICE_PATH Usb;
|
||||
USB_CLASS_DEVICE_PATH UsbClass;
|
||||
I2O_DEVICE_PATH I2O;
|
||||
MAC_ADDR_DEVICE_PATH MacAddr;
|
||||
IPv4_DEVICE_PATH Ipv4;
|
||||
IPv6_DEVICE_PATH Ipv6;
|
||||
INFINIBAND_DEVICE_PATH InfiniBand;
|
||||
UART_DEVICE_PATH Uart;
|
||||
|
||||
HARDDRIVE_DEVICE_PATH HardDrive;
|
||||
CDROM_DEVICE_PATH CD;
|
||||
|
||||
FILEPATH_DEVICE_PATH FilePath;
|
||||
MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol;
|
||||
|
||||
BBS_BBS_DEVICE_PATH Bbs;
|
||||
|
||||
} EFI_DEV_PATH;
|
||||
|
||||
typedef union {
|
||||
EFI_DEVICE_PATH *DevPath;
|
||||
PCI_DEVICE_PATH *Pci;
|
||||
PCCARD_DEVICE_PATH *PcCard;
|
||||
MEMMAP_DEVICE_PATH *MemMap;
|
||||
VENDOR_DEVICE_PATH *Vendor;
|
||||
UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor;
|
||||
CONTROLLER_DEVICE_PATH *Controller;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi;
|
||||
|
||||
ATAPI_DEVICE_PATH *Atapi;
|
||||
SCSI_DEVICE_PATH *Scsi;
|
||||
FIBRECHANNEL_DEVICE_PATH *FibreChannel;
|
||||
|
||||
F1394_DEVICE_PATH *F1394;
|
||||
USB_DEVICE_PATH *Usb;
|
||||
USB_CLASS_DEVICE_PATH *UsbClass;
|
||||
I2O_DEVICE_PATH *I2O;
|
||||
MAC_ADDR_DEVICE_PATH *MacAddr;
|
||||
IPv4_DEVICE_PATH *Ipv4;
|
||||
IPv6_DEVICE_PATH *Ipv6;
|
||||
INFINIBAND_DEVICE_PATH *InfiniBand;
|
||||
UART_DEVICE_PATH *Uart;
|
||||
|
||||
HARDDRIVE_DEVICE_PATH *HardDrive;
|
||||
|
||||
FILEPATH_DEVICE_PATH *FilePath;
|
||||
MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol;
|
||||
|
||||
CDROM_DEVICE_PATH *CD;
|
||||
BBS_BBS_DEVICE_PATH *Bbs;
|
||||
|
||||
} EFI_DEV_PATH_PTR;
|
||||
|
||||
#define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \
|
||||
{ 0xbc62157e, 0x3e33, 0x4fec, { 0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf } }
|
||||
|
||||
#define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \
|
||||
{ 0x8b843e20, 0x8132, 0x4852, { 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } }
|
||||
|
||||
#define EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID \
|
||||
{ 0x05c99a21, 0xc70f, 0x4ad2, { 0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e } }
|
||||
|
||||
INTERFACE_DECL(_EFI_DEVICE_PATH_PROTOCOL);
|
||||
|
||||
typedef
|
||||
CHAR16*
|
||||
(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_NODE) (
|
||||
IN struct _EFI_DEVICE_PATH *This,
|
||||
IN BOOLEAN DisplayOnly,
|
||||
IN BOOLEAN AllowShortCuts
|
||||
);
|
||||
|
||||
typedef
|
||||
CHAR16*
|
||||
(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_PATH) (
|
||||
IN struct _EFI_DEVICE_PATH *This,
|
||||
IN BOOLEAN DisplayOnly,
|
||||
IN BOOLEAN AllowShortCuts
|
||||
);
|
||||
|
||||
typedef struct _EFI_DEVICE_PATH_TO_TEXT_PROTOCOL {
|
||||
EFI_DEVICE_PATH_TO_TEXT_NODE ConvertDeviceNodeToText;
|
||||
EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText;
|
||||
} EFI_DEVICE_PATH_TO_TEXT_PROTOCOL;
|
||||
|
||||
typedef
|
||||
struct _EFI_DEVICE_PATH*
|
||||
(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_NODE) (
|
||||
IN CONST CHAR16* TextDeviceNode
|
||||
);
|
||||
typedef
|
||||
struct _EFI_DEVICE_PATH*
|
||||
(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_PATH) (
|
||||
IN CONST CHAR16* TextDevicePath
|
||||
);
|
||||
|
||||
|
||||
typedef struct _EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL {
|
||||
EFI_DEVICE_PATH_FROM_TEXT_NODE ConvertTextToDeviceNode;
|
||||
EFI_DEVICE_PATH_FROM_TEXT_PATH ConvertTextToDevicePath;
|
||||
} EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
||||
68
bsps/shared/freebsd/stand/efi/include/efierr.h
Normal file
68
bsps/shared/freebsd/stand/efi/include/efierr.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* $FreeBSD$ */
|
||||
#ifndef _EFI_ERR_H
|
||||
#define _EFI_ERR_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
Module Name:
|
||||
|
||||
efierr.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI error codes
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
#define EFIWARN(a) (a)
|
||||
#define EFI_ERROR(a) (((INTN) a) < 0)
|
||||
#define EFI_ERROR_CODE(a) (unsigned long)(a & ~EFI_ERROR_MASK)
|
||||
|
||||
|
||||
#define EFI_SUCCESS 0
|
||||
#define EFI_LOAD_ERROR EFIERR(1)
|
||||
#define EFI_INVALID_PARAMETER EFIERR(2)
|
||||
#define EFI_UNSUPPORTED EFIERR(3)
|
||||
#define EFI_BAD_BUFFER_SIZE EFIERR(4)
|
||||
#define EFI_BUFFER_TOO_SMALL EFIERR(5)
|
||||
#define EFI_NOT_READY EFIERR(6)
|
||||
#define EFI_DEVICE_ERROR EFIERR(7)
|
||||
#define EFI_WRITE_PROTECTED EFIERR(8)
|
||||
#define EFI_OUT_OF_RESOURCES EFIERR(9)
|
||||
#define EFI_VOLUME_CORRUPTED EFIERR(10)
|
||||
#define EFI_VOLUME_FULL EFIERR(11)
|
||||
#define EFI_NO_MEDIA EFIERR(12)
|
||||
#define EFI_MEDIA_CHANGED EFIERR(13)
|
||||
#define EFI_NOT_FOUND EFIERR(14)
|
||||
#define EFI_ACCESS_DENIED EFIERR(15)
|
||||
#define EFI_NO_RESPONSE EFIERR(16)
|
||||
#define EFI_NO_MAPPING EFIERR(17)
|
||||
#define EFI_TIMEOUT EFIERR(18)
|
||||
#define EFI_NOT_STARTED EFIERR(19)
|
||||
#define EFI_ALREADY_STARTED EFIERR(20)
|
||||
#define EFI_ABORTED EFIERR(21)
|
||||
#define EFI_ICMP_ERROR EFIERR(22)
|
||||
#define EFI_TFTP_ERROR EFIERR(23)
|
||||
#define EFI_PROTOCOL_ERROR EFIERR(24)
|
||||
|
||||
#define EFI_WARN_UNKNOWN_GLYPH EFIWARN(1)
|
||||
#define EFI_WARN_DELETE_FAILURE EFIWARN(2)
|
||||
#define EFI_WARN_WRITE_FAILURE EFIWARN(3)
|
||||
#define EFI_WARN_BUFFER_TOO_SMALL EFIWARN(4)
|
||||
|
||||
#endif
|
||||
121
bsps/shared/freebsd/stand/efi/include/efigop.h
Normal file
121
bsps/shared/freebsd/stand/efi/include/efigop.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/* $FreeBSD$ */
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
Module Name:
|
||||
|
||||
efigop.h
|
||||
|
||||
Abstract:
|
||||
Info about framebuffers
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFIGOP_H
|
||||
#define _EFIGOP_H
|
||||
|
||||
#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
|
||||
{ 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a} }
|
||||
|
||||
INTERFACE_DECL(_EFI_GRAPHICS_OUTPUT);
|
||||
|
||||
typedef struct {
|
||||
UINT32 RedMask;
|
||||
UINT32 GreenMask;
|
||||
UINT32 BlueMask;
|
||||
UINT32 ReservedMask;
|
||||
} EFI_PIXEL_BITMASK;
|
||||
|
||||
typedef enum {
|
||||
PixelRedGreenBlueReserved8BitPerColor,
|
||||
PixelBlueGreenRedReserved8BitPerColor,
|
||||
PixelBitMask,
|
||||
PixelBltOnly,
|
||||
PixelFormatMax,
|
||||
} EFI_GRAPHICS_PIXEL_FORMAT;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Version;
|
||||
UINT32 HorizontalResolution;
|
||||
UINT32 VerticalResolution;
|
||||
EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
|
||||
EFI_PIXEL_BITMASK PixelInformation;
|
||||
UINT32 PixelsPerScanLine;
|
||||
} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
|
||||
|
||||
typedef struct {
|
||||
UINT32 MaxMode;
|
||||
UINT32 Mode;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
|
||||
UINTN SizeOfInfo;
|
||||
EFI_PHYSICAL_ADDRESS FrameBufferBase;
|
||||
UINTN FrameBufferSize;
|
||||
} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
|
||||
IN struct _EFI_GRAPHICS_OUTPUT *This,
|
||||
IN UINT32 ModeNumber,
|
||||
OUT UINTN *SizeOfInfo,
|
||||
OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
|
||||
IN struct _EFI_GRAPHICS_OUTPUT *This,
|
||||
IN UINT32 ModeNumber
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
UINT8 Blue;
|
||||
UINT8 Green;
|
||||
UINT8 Red;
|
||||
UINT8 Reserved;
|
||||
} EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
|
||||
|
||||
typedef enum {
|
||||
EfiBltVideoFill,
|
||||
EfiBltVideoToBltBuffer,
|
||||
EfiBltBufferToVideo,
|
||||
EfiBltVideoToVideo,
|
||||
EfiGraphcisOutputBltOperationMax,
|
||||
} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
|
||||
IN struct _EFI_GRAPHICS_OUTPUT *This,
|
||||
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN UINTN Delta
|
||||
);
|
||||
|
||||
typedef struct _EFI_GRAPHICS_OUTPUT {
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
|
||||
} EFI_GRAPHICS_OUTPUT;
|
||||
|
||||
#endif /* _EFIGOP_H */
|
||||
172
bsps/shared/freebsd/stand/efi/include/efilib.h
Normal file
172
bsps/shared/freebsd/stand/efi/include/efilib.h
Normal file
@@ -0,0 +1,172 @@
|
||||
/*-
|
||||
* Copyright (c) 2000 Doug Rabson
|
||||
* Copyright (c) 2006 Marcel Moolenaar
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#ifndef _LOADER_EFILIB_H
|
||||
#define _LOADER_EFILIB_H
|
||||
|
||||
#ifndef __rtems__
|
||||
#include <stand.h>
|
||||
#endif /* __rtems__ */
|
||||
#include <stdbool.h>
|
||||
#include <sys/queue.h>
|
||||
#ifdef __rtems__
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#endif /* __rtems__ */
|
||||
|
||||
extern EFI_HANDLE IH;
|
||||
extern EFI_SYSTEM_TABLE *ST;
|
||||
extern EFI_BOOT_SERVICES *BS;
|
||||
extern EFI_RUNTIME_SERVICES *RS;
|
||||
|
||||
#ifndef __rtems__
|
||||
|
||||
extern struct devsw efipart_fddev;
|
||||
extern struct devsw efipart_cddev;
|
||||
extern struct devsw efipart_hddev;
|
||||
extern struct devsw efihttp_dev;
|
||||
extern struct devsw efinet_dev;
|
||||
extern struct netif_driver efinetif;
|
||||
|
||||
/* EFI block device data, included here to help efi_zfs_probe() */
|
||||
typedef STAILQ_HEAD(pdinfo_list, pdinfo) pdinfo_list_t;
|
||||
|
||||
typedef struct pdinfo
|
||||
{
|
||||
STAILQ_ENTRY(pdinfo) pd_link; /* link in device list */
|
||||
pdinfo_list_t pd_part; /* list of partitions */
|
||||
EFI_HANDLE pd_handle;
|
||||
EFI_HANDLE pd_alias;
|
||||
EFI_DEVICE_PATH *pd_devpath;
|
||||
EFI_BLOCK_IO *pd_blkio;
|
||||
uint32_t pd_unit; /* unit number */
|
||||
uint32_t pd_open; /* reference counter */
|
||||
void *pd_bcache; /* buffer cache data */
|
||||
struct pdinfo *pd_parent; /* Linked items (eg partitions) */
|
||||
struct devsw *pd_devsw; /* Back pointer to devsw */
|
||||
} pdinfo_t;
|
||||
|
||||
pdinfo_list_t *efiblk_get_pdinfo_list(struct devsw *dev);
|
||||
pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev);
|
||||
pdinfo_t *efiblk_get_pdinfo_by_handle(EFI_HANDLE h);
|
||||
pdinfo_t *efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path);
|
||||
|
||||
/* libefi.c */
|
||||
void *efi_get_table(EFI_GUID *tbl);
|
||||
EFI_STATUS OpenProtocolByHandle(EFI_HANDLE, EFI_GUID *, void **);
|
||||
|
||||
static inline EFI_STATUS
|
||||
efi_exit_boot_services(UINTN key)
|
||||
{
|
||||
EFI_STATUS status;
|
||||
|
||||
status = BS->ExitBootServices(IH, key);
|
||||
if (!EFI_ERROR(status))
|
||||
boot_services_active = false;
|
||||
return (status);
|
||||
}
|
||||
|
||||
int efi_getdev(void **vdev, const char *devspec, const char **path);
|
||||
|
||||
int efi_register_handles(struct devsw *, EFI_HANDLE *, EFI_HANDLE *, int);
|
||||
EFI_HANDLE efi_find_handle(struct devsw *, int);
|
||||
int efi_handle_lookup(EFI_HANDLE, struct devsw **, int *, uint64_t *);
|
||||
int efi_handle_update_dev(EFI_HANDLE, struct devsw *, int, uint64_t);
|
||||
|
||||
EFI_DEVICE_PATH *efi_lookup_image_devpath(EFI_HANDLE);
|
||||
EFI_DEVICE_PATH *efi_lookup_devpath(EFI_HANDLE);
|
||||
void efi_close_devpath(EFI_HANDLE);
|
||||
EFI_HANDLE efi_devpath_handle(EFI_DEVICE_PATH *);
|
||||
EFI_DEVICE_PATH *efi_devpath_last_node(EFI_DEVICE_PATH *);
|
||||
EFI_DEVICE_PATH *efi_devpath_trim(EFI_DEVICE_PATH *);
|
||||
bool efi_devpath_match(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
|
||||
bool efi_devpath_match_node(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
|
||||
bool efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
|
||||
CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *);
|
||||
void efi_free_devpath_name(CHAR16 *);
|
||||
bool efi_devpath_same_disk(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
|
||||
EFI_DEVICE_PATH *efi_devpath_to_media_path(EFI_DEVICE_PATH *);
|
||||
UINTN efi_devpath_length(EFI_DEVICE_PATH *);
|
||||
EFI_DEVICE_PATH *efi_name_to_devpath(const char *path);
|
||||
EFI_DEVICE_PATH *efi_name_to_devpath16(CHAR16 *path);
|
||||
void efi_devpath_free(EFI_DEVICE_PATH *dp);
|
||||
EFI_HANDLE efi_devpath_to_handle(EFI_DEVICE_PATH *path, EFI_HANDLE *handles, unsigned nhandles);
|
||||
|
||||
int efi_status_to_errno(EFI_STATUS);
|
||||
EFI_STATUS errno_to_efi_status(int errno);
|
||||
|
||||
void efi_time_init(void);
|
||||
void efi_time_fini(void);
|
||||
|
||||
int parse_uefi_con_out(void);
|
||||
EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab);
|
||||
|
||||
EFI_STATUS main(int argc, CHAR16 *argv[]);
|
||||
void efi_exit(EFI_STATUS status) __dead2;
|
||||
|
||||
/* EFI environment initialization. */
|
||||
void efi_init_environment(void);
|
||||
|
||||
/* EFI Memory type strings. */
|
||||
const char *efi_memory_type(EFI_MEMORY_TYPE);
|
||||
#endif /* __rtems__ */
|
||||
|
||||
/* CHAR16 utility functions. */
|
||||
int wcscmp(CHAR16 *, CHAR16 *);
|
||||
void cpy8to16(const char *, CHAR16 *, size_t);
|
||||
void cpy16to8(const CHAR16 *, char *, size_t);
|
||||
|
||||
#ifndef __rtems__
|
||||
/*
|
||||
* Routines for interacting with EFI's env vars in a more unix-like
|
||||
* way than the standard APIs. In addition, convenience routines for
|
||||
* the loader setting / getting FreeBSD specific variables.
|
||||
*/
|
||||
|
||||
EFI_STATUS efi_delenv(EFI_GUID *guid, const char *varname);
|
||||
EFI_STATUS efi_freebsd_delenv(const char *varname);
|
||||
EFI_STATUS efi_freebsd_getenv(const char *v, void *data, __size_t *len);
|
||||
EFI_STATUS efi_getenv(EFI_GUID *g, const char *v, void *data, __size_t *len);
|
||||
EFI_STATUS efi_global_getenv(const char *v, void *data, __size_t *len);
|
||||
EFI_STATUS efi_setenv(EFI_GUID *guid, const char *varname, UINT32 attr, void *data, __size_t len);
|
||||
EFI_STATUS efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr);
|
||||
|
||||
/* guids and names */
|
||||
bool efi_guid_to_str(const EFI_GUID *, char **);
|
||||
bool efi_str_to_guid(const char *, EFI_GUID *);
|
||||
bool efi_name_to_guid(const char *, EFI_GUID *);
|
||||
bool efi_guid_to_name(EFI_GUID *, char **);
|
||||
|
||||
/* efipart.c */
|
||||
int efipart_inithandles(void);
|
||||
|
||||
#endif /* __rtems__ */
|
||||
|
||||
#endif /* _LOADER_EFILIB_H */
|
||||
63
bsps/shared/freebsd/stand/efi/libefi/libefi.c
Normal file
63
bsps/shared/freebsd/stand/efi/libefi/libefi.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/*-
|
||||
* Copyright (c) 2000 Doug Rabson
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <efi.h>
|
||||
#ifndef __rtems__
|
||||
#include <eficonsctl.h>
|
||||
#include <efilib.h>
|
||||
#include <stand.h>
|
||||
#endif /* __rtems__ */
|
||||
|
||||
EFI_HANDLE IH;
|
||||
EFI_SYSTEM_TABLE *ST;
|
||||
EFI_BOOT_SERVICES *BS;
|
||||
EFI_RUNTIME_SERVICES *RS;
|
||||
|
||||
#ifndef __rtems__
|
||||
void *
|
||||
efi_get_table(EFI_GUID *tbl)
|
||||
{
|
||||
EFI_GUID *id;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ST->NumberOfTableEntries; i++) {
|
||||
id = &ST->ConfigurationTable[i].VendorGuid;
|
||||
if (!memcmp(id, tbl, sizeof(EFI_GUID)))
|
||||
return (ST->ConfigurationTable[i].VendorTable);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
OpenProtocolByHandle(EFI_HANDLE handle, EFI_GUID *protocol, void **interface)
|
||||
{
|
||||
return (BS->OpenProtocol(handle, protocol, interface, IH, NULL,
|
||||
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL));
|
||||
}
|
||||
#endif
|
||||
73
bsps/shared/freebsd/stand/efi/libefi/wchar.c
Normal file
73
bsps/shared/freebsd/stand/efi/libefi/wchar.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/*-
|
||||
* Copyright 2016 Netflix, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
/*
|
||||
* CHAR16 related functions moved from loader.
|
||||
* Perhaps we should move those to libsa afterall, but they are
|
||||
* needed only by UEFI.
|
||||
*/
|
||||
|
||||
int
|
||||
wcscmp(CHAR16 *a, CHAR16 *b)
|
||||
{
|
||||
|
||||
while (*a && *b && *a == *b) {
|
||||
a++;
|
||||
b++;
|
||||
}
|
||||
return *a - *b;
|
||||
}
|
||||
|
||||
/*
|
||||
* cpy8to16 copies a traditional C string into a CHAR16 string and
|
||||
* 0 terminates it. len is the size of *dst in bytes.
|
||||
*/
|
||||
void
|
||||
cpy8to16(const char *src, CHAR16 *dst, size_t len)
|
||||
{
|
||||
len <<= 1; /* Assume CHAR16 is 2 bytes */
|
||||
while (len > 0 && *src) {
|
||||
*dst++ = *src++;
|
||||
len--;
|
||||
}
|
||||
*dst++ = (CHAR16)0;
|
||||
}
|
||||
|
||||
void
|
||||
cpy16to8(const CHAR16 *src, char *dst, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < len && src[i]; i++)
|
||||
dst[i] = (char)src[i];
|
||||
if (i < len)
|
||||
dst[i] = '\0';
|
||||
}
|
||||
Reference in New Issue
Block a user