diff options
| author | Michael Brown | 2008-10-12 02:55:55 +0200 |
|---|---|---|
| committer | Michael Brown | 2008-10-13 11:24:14 +0200 |
| commit | 81d92c6d34f9ce68f7c2bbd5b92352b3a631bcd0 (patch) | |
| tree | 7bb6912503c83076ef9cad54a0503abc7aa19907 /src/include/gpxe/efi/efi.h | |
| parent | [sanboot] Quick and dirty hack to make SAN boot protocols selectable (diff) | |
| download | ipxe-81d92c6d34f9ce68f7c2bbd5b92352b3a631bcd0.tar.gz ipxe-81d92c6d34f9ce68f7c2bbd5b92352b3a631bcd0.tar.xz ipxe-81d92c6d34f9ce68f7c2bbd5b92352b3a631bcd0.zip | |
[efi] Add EFI image format and basic runtime environment
We have EFI APIs for CPU I/O, PCI I/O, timers, console I/O, user
access and user memory allocation.
EFI executables are created using the vanilla GNU toolchain, with the
EXE header handcrafted in assembly and relocations generated by a
custom efilink utility.
Diffstat (limited to 'src/include/gpxe/efi/efi.h')
| -rw-r--r-- | src/include/gpxe/efi/efi.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/include/gpxe/efi/efi.h b/src/include/gpxe/efi/efi.h index 36aab5eb4..0643066fb 100644 --- a/src/include/gpxe/efi/efi.h +++ b/src/include/gpxe/efi/efi.h @@ -34,4 +34,56 @@ /* Reset any trailing #pragma pack directives */ #pragma pack() +#include <gpxe/tables.h> +#include <gpxe/uuid.h> + +/** An EFI protocol used by gPXE */ +struct efi_protocol { + union { + /** EFI protocol GUID */ + EFI_GUID guid; + /** UUID structure understood by gPXE */ + union uuid uuid; + } u; + /** Variable containing pointer to protocol structure */ + void **protocol; +}; + +/** Declare an EFI protocol used by gPXE */ +#define __efi_protocol \ + __table ( struct efi_protocol, efi_protocols, 01 ) + +/** Declare an EFI protocol to be required by gPXE + * + * @v _protocol EFI protocol name + * @v _ptr Pointer to protocol instance + */ +#define EFI_REQUIRE_PROTOCOL( _protocol, _ptr ) \ + struct efi_protocol __ ## _protocol __efi_protocol = { \ + .u.guid = _protocol ## _GUID, \ + .protocol = ( ( void ** ) ( void * ) \ + ( ( (_ptr) == ( ( _protocol ** ) NULL ) ) ? \ + (_ptr) : (_ptr) ) ), \ + } + +/** Convert a gPXE status code to an EFI status code + * + * FIXME: actually perform some kind of conversion. gPXE error codes + * will be detected as EFI error codes; both have the top bit set, and + * the success return code is zero for both. Anything that just + * reports a numerical error will be OK, anything attempting to + * interpret the value or to display a text equivalent will be + * screwed. + */ +#define RC_TO_EFIRC( rc ) (rc) + +/** Convert an EFI status code to a gPXE status code + * + * FIXME: as above + */ +#define EFIRC_TO_RC( efirc ) (efirc) + +extern EFI_HANDLE efi_image_handle; +extern EFI_SYSTEM_TABLE *efi_systab; + #endif /* _EFI_H */ |
