Compare commits

..

No commits in common. "440b4998e3f3f83ebbed0b2de269a1f7fec16af8" and "d4e6dd4da8456e42ae7028364bc0dafb8ee55ca3" have entirely different histories.

247 changed files with 3200 additions and 40283 deletions

10
.clang-format Normal file
View File

@ -0,0 +1,10 @@
---
DerivePointerAlignment: 'true'
SpaceBeforeParens: ControlStatements
UseTab: ForIndentation
IndentWidth: 2
TabWidth: 2
ColumnLimit: 120
BreakBeforeBraces: Attach
...

2
.gitattributes vendored
View File

@ -1,2 +0,0 @@
*.sh eol=lf
Makefile eol=lf

73
.gitignore vendored
View File

@ -1,18 +1,59 @@
# Created by https://www.gitignore.io/api/c
# Edit at https://www.gitignore.io/?templates=c
### C ###
# Prerequisites
*.d
# Object files
*.o
*.efi
*.vhd
*.sdf
*.suo
*.opensdf
*.opendb
*.db*
*.*db*
*.pdb
*.tlog
*.ko
*.obj
*.log
x86_32
image/
.vs/
x64/
*.vbs
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
# End of https://www.gitignore.io/api/c

4
.gitmodules vendored
View File

@ -1,4 +0,0 @@
[submodule "gnu-efi"]
path = gnu-efi
url = git://git.code.sf.net/p/gnu-efi/code
ignore = dirty

Binary file not shown.

View File

@ -1,7 +1,9 @@
##Sync UEFI Bootloader
# Sync
This branch represents the UEFI bootloader used by Sync.
It tries to set a nice video mode, then gets the date and time, then finds, packs and loads the kernel, giving the information gathered to it.
Sync, an experimental synchronising OS.
The best way to compile currently is using the compile.sh script provided.
It's far easier to compile on Windows, but ¯\_(?)_/¯
Currently features:
* Text mode printing with CSI support
* literally nothing else
Keep posted. Development is relatively active.

94
arch/i386/boot.s Executable file
View File

@ -0,0 +1,94 @@
[BITS 32] ;... somehow.
[GLOBAL start]
start:
mov esp, _sys_stack ; Stack pointer!
jmp stublet ; This has a purpse. I don't know what it is, but there is one.
ALIGN 4 ; 4KB alignment, required by GRUB.
mboot: ; This is all magic, and all of it required for GRUB to see our stuff.
MULTIBOOT_ALIGN equ 1<<0
MULTIBOOT_MEM equ 1<<1
MULTIBOOT_AOUT equ 1<<16
MULTIBOOT_MAGIC equ 0x1BADB002
MULTIBOOT_FLAGS equ MULTIBOOT_ALIGN | MULTIBOOT_MEM | MULTIBOOT_AOUT
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_MAGIC + MULTIBOOT_FLAGS)
EXTERN code, bss, end
dd MULTIBOOT_MAGIC
dd MULTIBOOT_FLAGS
dd MULTIBOOT_CHECKSUM
dd mboot
dd code
dd bss
dd end
dd start
stublet: ; Where the kernel stuff goes.
;=====================================
;===Priority: 32 bit Protected Mode===
;=====================================
cli ; Interrupts be gone!
xor cx, cx ; CX - GP, useful here.
kbempty:
in al, 64h ; Read keyboard status
test al, 02h ; Check if the buffer is full
loopnz kbempty ; Wait until it is
mov al, 0d1h ; Prepare a message
out 64h, al ; And then send it to the keyboard (controller)
kbempty2:
in al, 64h ; Read the status again
test al, 02h ; Check if it's processed our message
loopnz kbempty2 ; And wait until it has
mov al, 0dfh ; Prepare a different message, telling it to enable A20
out 60h, al ; Send the message
mov cx, 14h ; Restore the value of CX
wait_kb: ; Insinuate a 25uS delay to allow the processor to catch up
out 0edh, ax
loop wait_kb
mov eax, cr0 ; Read the control register
or al, 1 ; Set bit 1: protected mode
mov cr0, eax ; Set the control register back
jmp $+2 ; Clear the queue
nop ; (jump straight to kernel)
nop
;==================================
;===32-bit Protected Mode active===
;==================================
; Call the kernel
EXTERN kernel_main
call kernel_main
jmp $
[GLOBAL load_gdt]
[EXTERN gp]
load_gdt:
lgdt [gp] ; Load the new GDT pointer
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp 0x08:flush
flush:
ret
[GLOBAL idt_load]
[EXTERN idtp]
idt_load:
lidt [idtp]
ret
SECTION .bss
resb 8192
_sys_stack:

25
arch/i386/linker.ld Executable file
View File

@ -0,0 +1,25 @@
OUTPUT_FORMAT("elf32-i386")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}

9
arch/i386/make.config Executable file
View File

@ -0,0 +1,9 @@
KERNEL_ARCH_CFLAGS=
KERNEL_ARCH_CPPFLAGS=
KERNEL_ARCH_LDFLAGS=
KERNEL_ARCH_LIBS=
KERNEL_ARCH_OBJS= \
$(ARCHDIR)/boot.o \
$(ARCHDIR)/sys_clock.o \
$(ARCHDIR)/tty.o

35
arch/i386/sys_clock.c Executable file
View File

@ -0,0 +1,35 @@
/************************
*** Team Kitty, 2019 ***
*** Sync ***
***********************/
/* This file provides an interface to
* the hardware timer / RTC. Not much
* more to be said about it. */
#include <kernel/utils.h>
#include <kernel.h>
#include <kernel/serial.h>
#include <kernel/descriptor_tables.h>
size_t timer_ticks = 0;
size_t flag = 0;
void timer_handler(struct int_frame* r) {
gdb_end();
timer_ticks++;
if(timer_ticks % 18 == 0) {
if(++flag % 2 == 0) {
serial_print(0x3F8, "Tick.");
} else {
serial_print(0x3F8, "Tock.");
}
}
if(timer_ticks > 18)
timer_ticks = 0;
}
void timer_install() {
irq_install_handler(0, &timer_handler);
}

348
arch/i386/tty.c Normal file
View File

@ -0,0 +1,348 @@
/************************
*** Team Kitty, 2019 ***
*** Sync ***
***********************/
/* This file provides all of the functionality
* needed to interact with the Text-Mode VGA
* buffer, which will soon be defunct due to
* EFI and graphics.
*
* This file will be left for the forseeable
* future, because it allows for easy debugging.
* 17/07/19 Curle
*/
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
//#include <string.h>
#include "kernel/tty.h"
#include "kernel/utils.h"
static const size_t TERM_WIDTH = 80;
static const size_t TERM_HEIGHT = 25;
static size_t terminal_row;
static size_t terminal_column;
static uint8_t current_color;
static uint16_t* term_buffer;
volatile uint16_t* vga_buffer = (uint16_t*)0xB8000;
void screen_initialize(void) {
terminal_row = 0;
terminal_column = 0;
current_color = vga_color_set(LIGHT_GREY, BLACK);
term_buffer = vga_buffer;
for (size_t y = 0; y < TERM_HEIGHT; y++) {
for (size_t x = 0; x < TERM_WIDTH; x++) {
const size_t offset = y * TERM_WIDTH + x;
term_buffer[offset] = vga_entry(' ', current_color);
}
}
}
void term_setcolor(enum vga_colors color) { current_color = color; }
void term_putentryat(char c, uint8_t color, size_t x, size_t y) {
const size_t offset = y * TERM_WIDTH + x;
term_buffer[offset] = vga_entry(c, color);
}
void term_putchar(char c) {
unsigned char uc = c;
// Handle escaped characters, such as newline, and crtn.
switch (uc) {
case '\n':
terminal_column = 0;
terminal_row += 1;
break;
default:
term_putentryat(uc, current_color, terminal_column, terminal_row);
if (++terminal_column == TERM_WIDTH) {
terminal_column = 0;
if (++terminal_row == TERM_HEIGHT) {
term_scroll(false);
terminal_row = 0;
}
}
break;
}
}
struct csi_sequence parse_csi(const char* data, size_t size) {
enum State { PARAMETER, INTERMEDIATE, FINAL, INVALID };
enum State state = PARAMETER;
struct csi_sequence sequence = {.parameter = NULL,
.parameter_len = 0,
.intermediate = NULL,
.intermediate_len = 0,
.final = NULL,
.valid = false};
for (size_t j = 0; j < size; j++) {
uint8_t c = data[j];
if (state == PARAMETER && (c >= 0x30 && c <= 0x3F)) {
if (!sequence.parameter)
sequence.parameter = data + j;
sequence.parameter_len++;
} else if (c >= 0x20 && c <= 0x2F) {
if (!sequence.intermediate)
sequence.intermediate = data + j;
sequence.intermediate_len++;
state = INTERMEDIATE;
} else if (c >= 0x40 && c <= 0x7F) {
sequence.final = data + j;
sequence.valid = true;
state = FINAL;
break;
} else {
// Parameter found in intermediate byte location, or byte out of
// range
state = INVALID;
break;
}
}
return sequence;
}
void term_write(const char* data, size_t size) {
for (size_t i = 0; i < size; i++) {
// Begin handling ANSI escape codes.
if (data[i] == 0x1b) { // The current character is ESC - the start of ANSI codes.
// term_writes("ANSI Code encountered: ");
bool string_terminated = false; // Flag used in some of the escape codes
// TODO: Should only progress if we have at least 2 more bytes
switch ((uint8_t)data[i + 1]) {
case '[': // CSI - Control Sequence Introducer (The most common one, hence it comes first)
{
struct csi_sequence sequence = parse_csi(data + i + 2, size - (i + 2));
if (sequence.valid) {
// Send it off to our handler function to keep this part clean
handleControlSequence(sequence);
i += sequence.parameter_len + sequence.intermediate_len + 2; // Move past sequence
}
} break;
// Single shifts are not handled, so just print them and exit
case 'N': // SS2 - Single Shift Two
term_writes("Single Shift Two\n");
break;
case 'O': // SS3 - Single Shift Three
term_writes("Single Shift Three\n");
break;
// Control Strings
case 'P': // DCS - Device Control String
term_writes("Device Control String");
string_terminated = false;
break;
case '\\': // ST - String Terminator
term_writes("String Terminator\n");
string_terminated = true;
break;
case ']': // OSC - Operating System Command
term_writes("Operating System Command\n");
string_terminated = false;
break;
case 'X': // SOS - Start Of String
term_writes("Start of String");
string_terminated = false;
break;
case '^': // PM - Privacy Message
term_writes("Privacy Message\n");
break;
case '_': // APC - Application Program Command
term_writes("Application Program Command\n");
break;
}
} else {
term_putchar(data[i]);
}
}
}
void term_writes(const char* data) { term_write(data, strlen(data)); }
void puts(const char* string) {
term_write(string, strlen(string));
term_putchar('\n');
}
void handleControlSequence(struct csi_sequence sequence) {
// Check for our failsafes
if (sequence.valid) {
int n = 0; // Default of the flag used for a few items
// Parse parameters, we only care about a max 2 of number only parameters
// for now
int params[2] = {0};
int param_count = 0;
if (sequence.parameter_len) {
for (size_t i = 0; i < sequence.parameter_len && param_count < 1; i++) {
char c = sequence.parameter[i];
if (isDigit(c)) {
n = (n * 10) + (sequence.parameter[i] - '0');
} else if (c == ';') {
params[param_count++] = n;
}
}
params[param_count++] = n;
}
switch (*(sequence.final)) {
case 'H':
case 'f': // CUP - Cursor Position
// TODO: Check to see if we have 2 paramaters
if (params[0])
params[0]--;
if (params[1])
params[1]--;
set_cursor(params[0], params[1]);
break;
case 'A': // CUU - Cursor Up
if (!params[0])
params[0] = 1;
set_cursor(terminal_column, terminal_row - params[0]);
break;
case 'B': // CUD - Cursor Down
if (!params[0])
params[0] = 1;
set_cursor(terminal_column, terminal_row + params[0]);
break;
case 'C': // CUF - Cursor Forward
if (!params[0])
params[0] = 1;
set_cursor(terminal_column + params[0], terminal_row);
break;
case 'D': // CUB - Cursor Back
if (!params[0])
params[0] = 1;
set_cursor(terminal_column - params[0], terminal_row);
break;
case 'E': // CNL - Cursor Next Line
if (!params[0])
params[0] = 1;
set_cursor(0, terminal_row + params[0]);
break;
case 'F': // CPL - Cursor Previous Line
if (!params[0])
params[0] = 1;
set_cursor(0, terminal_row - params[0]);
break;
case 'G': // CHA - Cursor Horizontal Absolute
if (params[0])
params[0]--;
set_cursor(params[0], terminal_row);
break;
case 'J': // ED - Erase in Display
{
// current cursor pos = y * width + x
int pos = terminal_row * 80 + terminal_column;
if (params[0] == 0) { // Clear from cursor to end of screen
for (; pos < (25 * 80); pos++) {
vga_buffer[pos] = '\0';
}
} else if (params[0] == 1) { // Clear from cursor to beginning
for (; pos > 0; pos--) {
vga_buffer[pos] = '\0';
}
} else if (params[0] == 2 || params[0] == 3) { // Clear entire screen
// TODO: Support scrollback buffer? (n = 3)
for (int i = 0; i < (25 * 80); i++) {
vga_buffer[0] = '\0';
}
}
break;
}
case 'K': // EL - Erase in Line
{
int pos = terminal_row * 80 + terminal_column;
if (params[0] == 0) { // From cursor to end of line
int endPos = (terminal_row + 1) * 80 - 1; // End of line = current row + 25 columns = current row + 1
for (; pos < endPos; pos++) {
vga_buffer[pos] = '\0';
}
} else if (params[0] == 1) { // From cursor to start of line
int endPos = terminal_row * 80; // Start of line = end of previous line + 1 == current line
for (; pos > endPos; pos--) {
vga_buffer[pos] = '\0';
}
} else if (params[0] == 2) { // Entire current line
pos = terminal_row * 80;
int endPos = (terminal_row + 1) * 80 - 1;
for (; pos < endPos; pos++) {
vga_buffer[pos] = '\0';
}
}
break;
}
case 'S': // SU - Scroll Up
term_scroll(true);
break;
case 'T': // SD - Scroll Down
term_scroll(false);
break;
}
}
}
bool isDigit(char c) { return c >= '0' && c <= '9'; }
void set_cursor(int n, int m) {
terminal_column = n;
terminal_row = m;
}
void term_scroll(bool down) {
int current_pos;
if (down) {
current_pos = 25 * 80; // Start of the last line.
} else {
current_pos = 160; // Start of the second line.
}
unsigned char* term_buffer = (unsigned char*)vga_buffer;
if (down) { // To scroll down, move every character into the one below it, or "pull" every character down
while (current_pos > 80) {
term_buffer[current_pos + 160] = vga_buffer[current_pos];
term_buffer[current_pos + 159] = vga_buffer[current_pos - 1];
current_pos -= 2;
}
} else {
while (current_pos <= 4000) {
term_buffer[current_pos - 160 /*The character immediately below it*/] =
vga_buffer[current_pos]; // Move each character up a line
term_buffer[current_pos - 159 /*The color of the character below*/] =
vga_buffer[current_pos + 1]; // As well as its color
current_pos += 2; // Move to next char
}
}
if (down) {
current_pos = 0; // Start of first line
for (; current_pos < 80; current_pos++) {
term_buffer[current_pos] = '\0';
current_pos += 2;
}
} else {
; // Start of the last line
// Wipe out the bottom line
for (current_pos = 3840; current_pos <= 3920; current_pos += 2) {
term_buffer[current_pos] = 0;
}
}
terminal_row = 24; // Start writing on the last line
terminal_column = 0;
}

53
bochsrc.txt Normal file
View File

@ -0,0 +1,53 @@
# configuration file generated by Bochs
plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, iodebug=1
config_interface: textconfig
display_library: x
memory: host=32, guest=32
romimage: file="/usr/share/bochs/BIOS-bochs-latest", address=0x0, options=none
vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest"
boot: a
floppy_bootsig_check: disabled=1
floppya: 1_44=/dev/loop0, status=inserted
# no floppyb
ata0: enabled=0
ata1: enabled=0
ata2: enabled=0
ata3: enabled=0
optromimage1: file=none
optromimage2: file=none
optromimage3: file=none
optromimage4: file=none
optramimage1: file=none
optramimage2: file=none
optramimage3: file=none
optramimage4: file=none
pci: enabled=1, chipset=i440fx
vga: extension=vbe, update_freq=5, realtime=1
cpu: count=1:1:1, ips=1000000, quantum=16, model=bx_generic, reset_on_triple_fault=0, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
cpuid: level=6, stepping=3, model=3, family=6, vendor_string="AuthenticAMD", brand_string="AMD Athlon(tm) processor"
cpuid: mmx=1, apic=xapic, simd=sse2, sse4a=0, misaligned_sse=0, sep=1, movbe=0, adx=0
cpuid: aes=0, sha=0, xsave=0, xsaveopt=0, avx_f16c=0, avx_fma=0, bmi=0, xop=0, fma4=0
cpuid: tbm=0, x86_64=1, 1g_pages=0, pcid=0, fsgsbase=0, smep=0, smap=0, mwait=1
print_timestamps: enabled=0
debugger_log: ../red.debug
magic_break: enabled=1
port_e9_hack: enabled=0
private_colormap: enabled=0
clock: sync=none, time0=local, rtc_sync=0
# no cmosimage
# no loader
log: ../red.log
logprefix: %t%e%d
debug: action=ignore
info: action=report
error: action=report
panic: action=ask
keyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=none
mouse: type=ps2, enabled=0, toggle=ctrl+mbutton
speaker: enabled=1, mode=system
parport1: enabled=1, file=none
parport2: enabled=0
com1: enabled=1, mode=null
com2: enabled=0
com3: enabled=0
com4: enabled=0

View File

@ -1,50 +0,0 @@
set +v
CurrentDir=$PWD
GCC_NAME=x86_64-w64-mingw32
EFI_FOLDER=gnu-efi
Linker="$EFI_FOLDER/gnuefi/elf_x86_64_efi.lds"
cd ./x64
rm objects.list
HeaderFiles=-I$CurrentDir/inc/ \
-I$CurrentDir/gnu-efi/inc \
-I$CurrentDir/gnu-efi/inc/x86_64 \
-I$CurrentDir/gnu-efi/inc/protocol \
-I$CurrentDir/gnu-efi/lib
set -v
for f in $CurrentDir/src/*.c; do
echo "$GCC_NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-redzone -DGNU_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFiles -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
"$GCC_NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-redzone -DGNU_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFiles -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
done
set +v
set -v
while read f; do
echo "$GCC_NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-red-zone -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFILES -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
"$GCC_NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-red-zone -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFILES -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
done < $CurrentDir/c_files.txt
set +v
while read f; do
echo "${f%.*}.o" | tee -a objects.list
done < $CurrentDir/c_files.txt
for f in $CurrentDir/src/*.o; do
echo "$f" | tee -a objects.list
done
set -v
"$GCC_NAME-ld" -T$Linker -nostdlib --warn-common --no-undefined -znocombreloc -s -shared -Bsymbolic -Map=output.map -o "program.so" @"objects.list"
set +v
rm image/efi/boot/BOOTx64.efi
objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .reloc --target=efi-app-x86_64 "program.so" "image/efi/boot/BOOTx64.efi"

View File

@ -1,30 +0,0 @@
gnu-efi/lib/misc.c
gnu-efi/lib/print.c
gnu-efi/lib/smbios.c
gnu-efi/lib/sread.c
gnu-efi/lib/str.c
gnu-efi/lib/boxdraw.c
gnu-efi/lib/cmdline.c
gnu-efi/lib/console.c
gnu-efi/lib/crc.c
gnu-efi/lib/data.c
gnu-efi/lib/debug.c
gnu-efi/lib/dpath.c
gnu-efi/lib/error.c
gnu-efi/lib/event.c
gnu-efi/lib/exit.c
gnu-efi/lib/guid.c
gnu-efi/lib/hand.c
gnu-efi/lib/hw.c
gnu-efi/lib/init.c
gnu-efi/lib/lock.c
gnu-efi/lib/x86_64/callwrap.c
gnu-efi/lib/x86_64/efi_stub.S
gnu-efi/lib/x86_64/initplat.c
gnu-efi/lib/x86_64/math.c
gnu-efi/lib/x86_64/setjmp.S
gnu-efi/lib/runtime/efirtlib.c
gnu-efi/lib/runtime/rtdata.c
gnu-efi/lib/runtime/rtlock.c
gnu-efi/lib/runtime/rtstr.c
gnu-efi/lib/runtime/vm.c

141
debug.vbs
View File

@ -1,141 +0,0 @@
' Visual Studio QEMU debugging script.
'
' I like invoking vbs as much as anyone else, but we need to download and unzip our
' firmware file, as well as launch QEMU, and neither Powershell or a standard batch
' can do that without having an extra console appearing.
'
' Note: You may get a prompt from the firewall when trying to download the BIOS file
' Modify these variables as needed
QEMU_PATH = "C:\Program Files\qemu\"
' You can add something like "-S -gdb tcp:127.0.0.1:1234" if you plan to use gdb to debug
QEMU_OPTS = "-net none -vga std -display sdl -serial file:qemu.log -parallel none"
' Set to True if you need to download a file that might be cached locally
NO_CACHE = False
' You shouldn't have to modify anything below this
TARGET = WScript.Arguments(1)
If (TARGET = "x86") Then
UEFI_EXT = "ia32"
QEMU_ARCH = "i386"
FW_BASE = "OVMF"
ElseIf (TARGET = "x64") Then
UEFI_EXT = "x64"
QEMU_ARCH = "x86_64"
FW_BASE = "OVMF"
ElseIf (TARGET = "ARM") Then
UEFI_EXT = "arm"
QEMU_ARCH = "arm"
FW_BASE = "QEMU_EFI"
' You can also add '-device VGA' to the options below, to get graphics output.
' But if you do, be mindful that the keyboard input may not work... :(
QEMU_OPTS = "-M virt -cpu cortex-a15 " & QEMU_OPTS
ElseIf (TARGET = "ARM64") Then
UEFI_EXT = "aa64"
QEMU_ARCH = "aarch64"
FW_BASE = "QEMU_EFI"
QEMU_OPTS = "-M virt -cpu cortex-a57 " & QEMU_OPTS
Else
MsgBox("Unsupported debug target: " & TARGET)
Call WScript.Quit(1)
End If
BOOT_NAME = "boot" & UEFI_EXT & ".efi"
QEMU_EXE = "qemu-system-" & QEMU_ARCH & "w.exe"
FW_ARCH = UCase(UEFI_EXT)
FW_DIR = "https://efi.akeo.ie/" & FW_BASE & "/"
FW_ZIP = FW_BASE & "-" & FW_ARCH & ".zip"
FW_FILE = FW_BASE & "_" & FW_ARCH & ".fd"
FW_URL = FW_DIR & FW_ZIP
' Globals
Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("WScript.Shell")
' Download a file from FTP
Sub DownloadFtp(Server, Path)
Set file = fso.CreateTextFile("ftp.txt", True)
Call file.Write("open " & Server & vbCrLf &_
"anonymous" & vbCrLf & "user" & vbCrLf & "bin" & vbCrLf &_
"get " & Path & vbCrLf & "bye" & vbCrLf)
Call file.Close()
Call shell.Run("%comspec% /c ftp -s:ftp.txt > NUL", 0, True)
Call fso.DeleteFile("ftp.txt")
End Sub
' Download a file from HTTP
Sub DownloadHttp(Url, File)
Const BINARY = 1
Const OVERWRITE = 2
Set xHttp = createobject("Microsoft.XMLHTTP")
Set bStrm = createobject("Adodb.Stream")
Call xHttp.Open("GET", Url, False)
If NO_CACHE = True Then
Call xHttp.SetRequestHeader("If-None-Match", "some-random-string")
Call xHttp.SetRequestHeader("Cache-Control", "no-cache,max-age=0")
Call xHttp.SetRequestHeader("Pragma", "no-cache")
End If
Call xHttp.Send()
If Not xHttp.Status = 200 Then
Call WScript.Echo("Unable to access file - Error " & xHttp.Status)
Call WScript.Quit(1)
End If
With bStrm
.type = BINARY
.open
.write xHttp.responseBody
.savetofile File, OVERWRITE
End With
End Sub
' Unzip a specific file from an archive
Sub Unzip(Archive, File)
Const NOCONFIRMATION = &H10&
Const NOERRORUI = &H400&
Const SIMPLEPROGRESS = &H100&
unzipFlags = NOCONFIRMATION + NOERRORUI + SIMPLEPROGRESS
Set objShell = CreateObject("Shell.Application")
Set objSource = objShell.NameSpace(fso.GetAbsolutePathName(Archive)).Items()
Set objTarget = objShell.NameSpace(fso.GetAbsolutePathName("."))
' Only extract the file we are interested in
For i = 0 To objSource.Count - 1
If objSource.Item(i).Name = File Then
Call objTarget.CopyHere(objSource.Item(i), unzipFlags)
End If
Next
End Sub
' Check that QEMU is available
If Not fso.FileExists(QEMU_PATH & QEMU_EXE) Then
Call WScript.Echo("'" & QEMU_PATH & QEMU_EXE & "' was not found." & vbCrLf &_
"Please make sure QEMU is installed or edit the path in '.msvc\debug.vbs'.")
Call WScript.Quit(1)
End If
' Fetch the UEFI firmware and unzip it
If Not fso.FileExists(FW_FILE) Then
Call WScript.Echo("The UEFI firmware file, needed for QEMU, " &_
"will be downloaded from: " & FW_URL & vbCrLf & vbCrLf &_
"Note: Unless you delete the file, this should only happen once.")
Call DownloadHttp(FW_URL, FW_ZIP)
End If
If Not fso.FileExists(FW_ZIP) And Not fso.FileExists(FW_FILE) Then
Call WScript.Echo("There was a problem downloading the QEMU UEFI firmware.")
Call WScript.Quit(1)
End If
If fso.FileExists(FW_ZIP) Then
Call Unzip(FW_ZIP, FW_BASE & ".fd")
Call fso.MoveFile(FW_BASE & ".fd", FW_FILE)
Call fso.DeleteFile(FW_ZIP)
End If
If Not fso.FileExists(FW_FILE) Then
Call WScript.Echo("There was a problem unzipping the QEMU UEFI firmware.")
Call WScript.Quit(1)
End If
' Copy the app file as boot application and run it in QEMU
Call shell.Run("%COMSPEC% /c mkdir ""image\efi\boot""", 0, True)
Call fso.CopyFile(WScript.Arguments(0), "image\efi\boot\" & BOOT_NAME, True)
Call shell.Run("""" & QEMU_PATH & QEMU_EXE & """ " & QEMU_OPTS & " -L . -bios " & FW_FILE & " -hda fat:rw:image", 1, True)

6
gnu-efi/.gitignore vendored
View File

@ -1,6 +0,0 @@
*.efi
*.efi.debug
*.o
*.a
*.tar.*
*.tar

File diff suppressed because it is too large Load Diff

View File

@ -1,183 +0,0 @@
# -*- makefile -*-
# Copyright (c) 1999-2007 Hewlett-Packard Development Company, L.P.
# Contributed by David Mosberger <davidm@hpl.hp.com>
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
#
# All rights reserved.
#
# 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.
# * Neither the name of Hewlett-Packard Co. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# 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 OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANYDIRECT, 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.
#
TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
#
# Variables below overridable from command-line:
# make VARNAME=value ...
#
#
# Where to install the package. GNU-EFI will create and access
# lib and include under the root
#
INSTALLROOT := /
PREFIX := /usr/local
LIBDIR := $(PREFIX)/lib
INSTALL := install
# Compilation tools
HOSTCC := $(prefix)gcc
CC := $(prefix)$(CROSS_COMPILE)gcc
AS := $(prefix)$(CROSS_COMPILE)as
LD := $(prefix)$(CROSS_COMPILE)ld
AR := $(prefix)$(CROSS_COMPILE)ar
RANLIB := $(prefix)$(CROSS_COMPILE)ranlib
OBJCOPY := $(prefix)$(CROSS_COMPILE)objcopy
# Host/target identification
OS := $(shell uname -s)
HOSTARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv7.*,arm,' )
ARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv7.*,arm,' )
# Get ARCH from the compiler if cross compiling
ifneq ($(CROSS_COMPILE),)
override ARCH := $(shell $(CC) -dumpmachine | cut -f1 -d-| sed -e s,i[3456789]86,ia32, -e 's,armv7.*,arm,' )
endif
# FreeBSD (and possibly others) reports amd64 instead of x86_64
ifeq ($(ARCH),amd64)
override ARCH := x86_64
endif
#
# Where to build the package
#
OBJDIR := $(TOPDIR)/$(ARCH)
#
# Variables below derived from variables above
#
# Arch-specific compilation flags
CPPFLAGS += -DCONFIG_$(ARCH)
CFLAGS += -Wno-error=pragmas
ifeq ($(ARCH),ia64)
CFLAGS += -mfixed-range=f32-f127
endif
ifeq ($(ARCH),ia32)
CFLAGS += -mno-mmx -mno-sse
ifeq ($(HOSTARCH),x86_64)
ARCH3264 = -m32
endif
endif
ifeq ($(ARCH),x86_64)
GCCVERSION := $(shell $(CC) -dumpversion | cut -f1 -d.)
GCCMINOR := $(shell $(CC) -dumpversion | cut -f2 -d.)
USING_CLANG := $(shell $(CC) -v 2>&1 | grep -q 'clang version' && echo clang)
# Rely on GCC MS ABI support?
GCCNEWENOUGH := $(shell ( [ $(GCCVERSION) -gt "4" ] \
|| ( [ $(GCCVERSION) -eq "4" ] \
&& [ $(GCCMINOR) -ge "7" ] ) ) \
&& echo 1)
ifeq ($(GCCNEWENOUGH),1)
CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11
else ifeq ($(USING_CLANG),clang)
CPPFLAGS += -DGNU_EFI_USE_MS_ABI --std=c11
endif
CFLAGS += -mno-red-zone
ifeq ($(HOSTARCH),ia32)
ARCH3264 = -m64
endif
endif
ifneq (,$(filter $(ARCH),ia32 x86_64))
# Disable AVX, if the compiler supports that.
CC_CAN_DISABLE_AVX=$(shell $(CC) -Werror -c -o /dev/null -xc -mno-avx - </dev/null >/dev/null 2>&1 && echo 1)
ifeq ($(CC_CAN_DISABLE_AVX), 1)
CFLAGS += -mno-avx
endif
endif
ifeq ($(ARCH),mips64el)
CFLAGS += -march=mips64r2
ARCH3264 = -mabi=64
endif
#
# Set HAVE_EFI_OBJCOPY if objcopy understands --target efi-[app|bsdrv|rtdrv],
# otherwise we need to compose the PE/COFF header using the assembler
#
ifneq ($(ARCH),aarch64)
ifneq ($(ARCH),arm)
ifneq ($(ARCH),mips64el)
export HAVE_EFI_OBJCOPY=y
endif
endif
endif
ifneq ($(ARCH),arm)
export LIBGCC=$(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
endif
ifeq ($(ARCH),arm)
CFLAGS += -marm
endif
# Generic compilation flags
INCDIR += -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) \
-I$(TOPDIR)/inc/protocol
# Only enable -fpic for non MinGW compilers (unneeded on MinGW)
GCCMACHINE := $(shell $(CC) -dumpmachine)
ifneq (mingw32,$(findstring mingw32, $(GCCMACHINE)))
CFLAGS += -fpic
endif
ifeq (FreeBSD, $(findstring FreeBSD, $(OS)))
CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \
-fshort-wchar -fno-strict-aliasing \
-ffreestanding -fno-stack-protector
else
CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \
-fshort-wchar -fno-strict-aliasing \
-ffreestanding -fno-stack-protector -fno-stack-check \
-fno-stack-check \
$(if $(findstring gcc,$(CC)),-fno-merge-all-constants,)
endif
ARFLAGS := rDv
ASFLAGS += $(ARCH3264)
LDFLAGS += -nostdlib --warn-common --no-undefined --fatal-warnings \
--build-id=sha1

View File

@ -1,58 +0,0 @@
#
# Copyright (C) 1999-2007 Hewlett-Packard Co.
# Contributed by David Mosberger <davidm@hpl.hp.com>
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
#
# All rights reserved.
#
# 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.
# * Neither the name of Hewlett-Packard Co. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# 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 OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANYDIRECT, 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.
#
%.efi: %.so
$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
-j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \
-j .reloc $(FORMAT) $*.so $@
%.efi.debug: %.so
$(OBJCOPY) -j .debug_info -j .debug_abbrev -j .debug_aranges \
-j .debug_line -j .debug_str -j .debug_ranges \
-j .note.gnu.build-id \
$(FORMAT) $*.so $@
%.so: %.o
$(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES)
%.o: %.c
$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
%.S: %.c
$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -S $< -o $@
%.E: %.c
$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -E $< -o $@

View File

@ -1,129 +0,0 @@
#
# Copyright (C) 1999-2007 Hewlett-Packard Co.
# Contributed by David Mosberger <davidm@hpl.hp.com>
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
#
# All rights reserved.
#
# 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.
# * Neither the name of Hewlett-Packard Co. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# 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 OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANYDIRECT, 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.
#
VERSION = 3.0.9
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
SRCDIR = $(dir $(MKFILE_PATH))
VPATH = $(SRCDIR)
include $(SRCDIR)/Make.defaults
SUBDIRS = lib gnuefi inc apps
gnuefi: lib
all: check_gcc $(SUBDIRS)
mkvars:
@echo AR=$(AR)
@echo ARCH=$(ARCH)
@echo ARCH3264=$(ARCH3264)
@echo AS=$(AS)
@echo ASFLAGS=$(ASFLAGS)
@echo CC=$(CC)
@echo CFLAGS=$(CFLAGS)
@echo CPPFLAGS=$(CPPFLAGS)
@echo GCCMINOR=$(GCCMINOR)
@echo GCCNEWENOUGH=$(GCCNEWENOUGH)
@echo GCCVERSION=$(GCCVERSION)
@echo HOSTARCH=$(HOSTARCH)
@echo INCDIR=$(INCDIR)
@echo INSTALL=$(INSTALL)
@echo INSTALLROOT=$(INSTALLROOT)
@echo LD=$(LD)
@echo LDFLAGS=$(LDFLAGS)
@echo LIBDIR=$(LIBDIR)
@echo OBJCOPY=$(OBJCOPY)
@echo OS=$(OS)
@echo prefix=$(prefix)
@echo PREFIX=$(PREFIX)
@echo RANLIB=$(RANLIB)
@echo SRCDIR=$(SRCDIR)
@echo TOPDIR=$(TOPDIR)
$(SUBDIRS):
mkdir -p $(OBJDIR)/$@
$(MAKE) -C $(OBJDIR)/$@ -f $(SRCDIR)/$@/Makefile SRCDIR=$(SRCDIR)/$@ ARCH=$(ARCH)
clean:
rm -f *~
@for d in $(SUBDIRS); do \
if [ -d $(OBJDIR)/$$d ]; then \
$(MAKE) -C $(OBJDIR)/$$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d clean; \
fi; \
done
install:
@for d in $(SUBDIRS); do \
mkdir -p $(OBJDIR)/$$d; \
$(MAKE) -C $(OBJDIR)/$$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d install; done
.PHONY: $(SUBDIRS) clean depend
#
# on both platforms you must use gcc 3.0 or higher
#
check_gcc:
ifeq ($(GCC_VERSION),2)
@echo "you need to use a version of gcc >= 3.0, you are using `$(CC) --version`"
@exit 1
endif
include $(SRCDIR)/Make.rules
test-archive:
@rm -rf /tmp/gnu-efi-$(VERSION) /tmp/gnu-efi-$(VERSION)-tmp
@mkdir -p /tmp/gnu-efi-$(VERSION)-tmp
@git archive --format=tar $(shell git branch | awk '/^*/ { print $$2 }') | ( cd /tmp/gnu-efi-$(VERSION)-tmp/ ; tar x )
@git diff | ( cd /tmp/gnu-efi-$(VERSION)-tmp/ ; patch -s -p1 -b -z .gitdiff )
@mv /tmp/gnu-efi-$(VERSION)-tmp/ /tmp/gnu-efi-$(VERSION)/
@dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/gnu-efi-$(VERSION).tar.bz2 gnu-efi-$(VERSION)
@rm -rf /tmp/gnu-efi-$(VERSION)
@echo "The archive is in gnu-efi-$(VERSION).tar.bz2"
tag:
git tag $(VERSION) refs/heads/master
archive: tag
@rm -rf /tmp/gnu-efi-$(VERSION) /tmp/gnu-efi-$(VERSION)-tmp
@mkdir -p /tmp/gnu-efi-$(VERSION)-tmp
@git archive --format=tar $(VERSION) | ( cd /tmp/gnu-efi-$(VERSION)-tmp/ ; tar x )
@mv /tmp/gnu-efi-$(VERSION)-tmp/ /tmp/gnu-efi-$(VERSION)/
@dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/gnu-efi-$(VERSION).tar.bz2 gnu-efi-$(VERSION)
@rm -rf /tmp/gnu-efi-$(VERSION)
@echo "The archive is in gnu-efi-$(VERSION).tar.bz2"

View File

@ -1,30 +0,0 @@
The files in the "lib" and "inc" subdirectories are using the EFI Application
Toolkit distributed by Intel at http://developer.intel.com/technology/efi
This code is covered by the following agreement:
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.

View File

@ -1,19 +0,0 @@
IMPORTANT information related to the gnu-efi package
----------------------------------------------------
June 2001
As of version 3.0, the gnu-efi package is now split in two different packages:
-> gnu-efi-X.y: contains the EFI library, include files and crt0.
-> elilo-X.y : contains the ELILO bootloader.
Note that X.y don't need to match for both packages. However elilo-3.x
requires at least gnu-efi-3.0. EFI support for x86_64 is provided in
gnu-efi-3.0d.
Both packages can be downloaded from:
http://www.sf.net/projects/gnu-efi
http://www.sf.net/projects/elilo

View File

@ -1,21 +0,0 @@
README.git
Generating releases from git a very simple process;
1) Edit the file "Makefile". Changing the "VERSION" line to the new version.
2) Do a "git commit" just for the version number change.
3) Then do a "make test-archive".
That will make a file in the current directory gnu-efi-$VERSION.tar.bz2 ,
with its top level directory gnu-efi-$VERSION/ and the source tree under that.
Once you've tested that and you're sure it's what you want to release,
4) Do "make archive", which will tag a release in git and generate a
final tarball from it.
You then push to the archive, being sure to include the tag:
5) "git push origin master:master --tags"
And upload the archive wherever it's supposed to go.

View File

@ -1,405 +0,0 @@
-------------------------------------------------
Building EFI Applications Using the GNU Toolchain
-------------------------------------------------
David Mosberger <davidm@hpl.hp.com>
23 September 1999
Copyright (c) 1999-2007 Hewlett-Packard Co.
Copyright (c) 2006-2010 Intel Co.
Last update: 04/09/2007
* Introduction
This document has two parts: the first part describes how to develop
EFI applications for IA-64,x86 and x86_64 using the GNU toolchain and the EFI
development environment contained in this directory. The second part
describes some of the more subtle aspects of how this development
environment works.
* Part 1: Developing EFI Applications
** Prerequisites:
To develop x86 and x86_64 EFI applications, the following tools are needed:
- gcc-3.0 or newer (gcc 2.7.2 is NOT sufficient!)
As of gnu-efi-3.0b, the Redhat 8.0 toolchain is known to work,
but the Redhat 9.0 toolchain is not currently supported.
- A version of "objcopy" that supports EFI applications. To
check if your version includes EFI support, issue the
command:
objcopy --help
Verify that the line "supported targets" contains the string
"efi-app-ia32" and "efi-app-x86_64" and that the "-j" option
accepts wildcards. The binutils release binutils-2.24
supports Intel64 EFI and accepts wildcard section names.
- For debugging purposes, it's useful to have a version of
"objdump" that supports EFI applications as well. This
allows inspect and disassemble EFI binaries.
To develop IA-64 EFI applications, the following tools are needed:
- A version of gcc newer than July 30th 1999 (older versions
had problems with generating position independent code).
As of gnu-efi-3.0b, gcc-3.1 is known to work well.
- A version of "objcopy" that supports EFI applications. To
check if your version includes EFI support, issue the
command:
objcopy --help
Verify that the line "supported targets" contains the string
"efi-app-ia64" and that the "-j" option accepts wildcards.
- For debugging purposes, it's useful to have a version of
"objdump" that supports EFI applications as well. This
allows inspect and disassemble EFI binaries.
** Directory Structure
This EFI development environment contains the following
subdirectories:
inc: This directory contains the EFI-related include files. The
files are taken from Intel's EFI source distribution, except
that various fixes were applied to make it compile with the
GNU toolchain.
lib: This directory contains the source code for Intel's EFI library.
Again, the files are taken from Intel's EFI source
distribution, with changes to make them compile with the GNU
toolchain.
gnuefi: This directory contains the glue necessary to convert ELF64
binaries to EFI binaries. Various runtime code bits, such as
a self-relocator are included as well. This code has been
contributed by the Hewlett-Packard Company and is distributed
under the GNU GPL.
apps: This directory contains a few simple EFI test apps.
** Setup
It is necessary to edit the Makefile in the directory containing this
README file before EFI applications can be built. Specifically, you
should verify that macros CC, AS, LD, AR, RANLIB, and OBJCOPY point to
the appropriate compiler, assembler, linker, ar, and ranlib binaries,
respectively.
If you're working in a cross-development environment, be sure to set
macro ARCH to the desired target architecture ("ia32" for x86, "x86_64" for
x86_64 and "ia64" for IA-64). For convenience, this can also be done from
the make command line (e.g., "make ARCH=ia64").
** Building
To build the sample EFI applications provided in subdirectory "apps",
simply invoke "make" in the toplevel directory (the directory
containing this README file). This should build lib/libefi.a and
gnuefi/libgnuefi.a first and then all the EFI applications such as a
apps/t6.efi.
** Running
Just copy the EFI application (e.g., apps/t6.efi) to the EFI
filesystem, boot EFI, and then select "Invoke EFI application" to run
the application you want to test. Alternatively, you can invoke the
Intel-provided "nshell" application and then invoke your test binary
via the command line interface that "nshell" provides.
** Writing Your Own EFI Application
Suppose you have your own EFI application in a file called
"apps/myefiapp.c". To get this application built by the GNU EFI build
environment, simply add "myefiapp.efi" to macro TARGETS in
apps/Makefile. Once this is done, invoke "make" in the top level
directory. This should result in EFI application apps/myefiapp.efi,
ready for execution.
The GNU EFI build environment allows to write EFI applications as
described in Intel's EFI documentation, except for two differences:
- The EFI application's entry point is always called "efi_main". The
declaration of this routine is:
EFI_STATUS efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab);
- UNICODE string literals must be written as W2U(L"Sample String")
instead of just L"Sample String". The W2U() macro is defined in
<efilib.h>. This header file also declares the function W2UCpy()
which allows to convert a wide string into a UNICODE string and
store the result in a programmer-supplied buffer.
- Calls to EFI services should be made via uefi_call_wrapper(). This
ensures appropriate parameter passing for the architecture.
* Part 2: Inner Workings
WARNING: This part contains all the gory detail of how the GNU EFI
toolchain works. Normal users do not have to worry about such
details. Reading this part incurs a definite risk of inducing severe
headaches or other maladies.
The basic idea behind the GNU EFI build environment is to use the GNU
toolchain to build a normal ELF binary that, at the end, is converted
to an EFI binary. EFI binaries are really just PE32+ binaries. PE
stands for "Portable Executable" and is the object file format
Microsoft is using on its Windows platforms. PE is basically the COFF
object file format with an MS-DOS2.0 compatible header slapped on in
front of it. The "32" in PE32+ stands for 32 bits, meaning that PE32
is a 32-bit object file format. The plus in "PE32+" indicates that
this format has been hacked to allow loading a 4GB binary anywhere in
a 64-bit address space (unlike ELF64, however, this is not a full
64-bit object file format because the entire binary cannot span more
than 4GB of address space). EFI binaries are plain PE32+ binaries
except that the "subsystem id" differs from normal Windows binaries.
There are two flavors of EFI binaries: "applications" and "drivers"
and each has there own subsystem id and are identical otherwise. At
present, the GNU EFI build environment supports the building of EFI
applications only, though it would be trivial to generate drivers, as
the only difference is the subsystem id. For more details on PE32+,
see the spec at
http://msdn.microsoft.com/library/specs/msdn_pecoff.htm.
In theory, converting a suitable ELF64 binary to PE32+ is easy and
could be accomplished with the "objcopy" utility by specifying option
--target=efi-app-ia32 (x86) or --target=efi-app-ia64 (IA-64). But
life never is that easy, so here some complicating factors:
(1) COFF sections are very different from ELF sections.
ELF binaries distinguish between program headers and sections.
The program headers describe the memory segments that need to
be loaded/initialized, whereas the sections describe what
constitutes those segments. In COFF (and therefore PE32+) no
such distinction is made. Thus, COFF sections need to be page
aligned and have a size that is a multiple of the page size
(4KB for EFI), whereas ELF allows sections at arbitrary
addresses and with arbitrary sizes.
(2) EFI binaries should be relocatable.
Since EFI binaries are executed in physical mode, EFI cannot
guarantee that a given binary can be loaded at its preferred
address. EFI does _try_ to load a binary at it's preferred
address, but if it can't do so, it will load it at another
address and then relocate the binary using the contents of the
.reloc section.
(3) On IA-64, the EFI entry point needs to point to a function
descriptor, not to the code address of the entry point.
(4) The EFI specification assumes that wide characters use UNICODE
encoding.
ANSI C does not specify the size or encoding that a wide
character uses. These choices are "implementation defined".
On most UNIX systems, the GNU toolchain uses a wchar_t that is
4 bytes in size. The encoding used for such characters is
(mostly) UCS4.
In the following sections, we address how the GNU EFI build
environment addresses each of these issues.
** (1) Accommodating COFF Sections
In order to satisfy the COFF constraint of page-sized and page-aligned
sections, the GNU EFI build environment uses the special linker script
in gnuefi/elf_$(ARCH)_efi.lds where $(ARCH) is the target architecture
("ia32" for x86, "x86_64" for x86_64 and "ia64" for IA-64).
This script is set up to create only eight COFF section, each page aligned
and page sized.These eight sections are used to group together the much
greater number of sections that are typically present in ELF object files.
Specifically:
.hash (and/or .gnu.hash)
Collects the ELF .hash info (this section _must_ be the first
section in order to build a shared object file; the section is
not actually loaded or used at runtime).
GNU binutils provides a mechanism to generate different hash info
via --hash-style=<sysv|gnu|both> option. In this case output
shared object will contain .hash section, .gnu.hash section or
both. In order to generate correct output linker script preserves
both types of hash sections.
.text
Collects all sections containing executable code.
.data
Collects read-only and read-write data, literal string data,
global offset tables, the uninitialized data segment (bss) and
various other sections containing data.
The reason read-only data is placed here instead of the in
.text is to make it possible to disassemble the .text section
without getting garbage due to read-only data. Besides, since
EFI binaries execute in physical mode, differences in page
protection do not matter.
The reason the uninitialized data is placed in this section is
that the EFI loader appears to be unable to handle sections
that are allocated but not loaded from the binary.
.dynamic, .dynsym, .rela, .rel, .reloc
These sections contains the dynamic information necessary to
self-relocate the binary (see below).
A couple of more points worth noting about the linker script:
o On IA-64, the global pointer symbol (__gp) needs to be placed such
that the _entire_ EFI binary can be addressed using the signed
22-bit offset that the "addl" instruction affords. Specifically,
this means that __gp should be placed at ImageBase + 0x200000.
Strictly speaking, only a couple of symbols need to be addressable
in this fashion, so with some care it should be possible to build
binaries much larger than 4MB. To get a list of symbols that need
to be addressable in this fashion, grep the assembly files in
directory gnuefi for the string "@gprel".
o The link address (ImageBase) of the binary is (arbitrarily) set to
zero. This could be set to something larger to increase the chance
of EFI being able to load the binary without requiring relocation.
However, a start address of 0 makes debugging a wee bit easier
(great for those of us who can add, but not subtract... ;-).
o The relocation related sections (.dynamic, .rel, .rela, .reloc)
cannot be placed inside .data because some tools in the GNU
toolchain rely on the existence of these sections.
o Some sections in the ELF binary intentionally get dropped when
building the EFI binary. Particularly noteworthy are the dynamic
relocation sections for the .plabel and .reloc sections. It would
be _wrong_ to include these sections in the EFI binary because it
would result in .reloc and .plabel being relocated twice (once by
the EFI loader and once by the self-relocator; see below for a
description of the latter). Specifically, only the sections
mentioned with the -j option in the final "objcopy" command are
retained in the EFI binary (see Make.rules).
** (2) Building Relocatable Binaries
ELF binaries are normally linked for a fixed load address and are thus
not relocatable. The only kind of ELF object that is relocatable are
shared objects ("shared libraries"). However, even those objects are
usually not completely position independent and therefore require
runtime relocation by the dynamic loader. For example, IA-64 binaries
normally require relocation of the global offset table.
The approach to building relocatable binaries in the GNU EFI build
environment is to:
(a) build an ELF shared object
(b) link it together with a self-relocator that takes care of
applying the dynamic relocations that may be present in the
ELF shared object
(c) convert the resulting image to an EFI binary
The self-relocator is of course architecture dependent. The x86
version can be found in gnuefi/reloc_ia32.c, the x86_64 version
can be found in gnuefi/reloc_x86_64.c and the IA-64 version can be
found in gnuefi/reloc_ia64.S.
The self-relocator operates as follows: the startup code invokes it
right after EFI has handed off control to the EFI binary at symbol
"_start". Upon activation, the self-relocator searches the .dynamic
section (whose starting address is given by symbol _DYNAMIC) for the
dynamic relocation information, which can be found in the DT_REL,
DT_RELSZ, and DT_RELENT entries of the dynamic table (DT_RELA,
DT_RELASZ, and DT_RELAENT in the case of rela relocations, as is the
case for IA-64). The dynamic relocation information points to the ELF
relocation table. Once this table is found, the self-relocator walks
through it, applying each relocation one by one. Since the EFI
binaries are fully resolved shared objects, only a subset of all
possible relocations need to be supported. Specifically, on x86 only
the R_386_RELATIVE relocation is needed. On IA-64, the relocations
R_IA64_DIR64LSB, R_IA64_REL64LSB, and R_IA64_FPTR64LSB are needed.
Note that the R_IA64_FPTR64LSB relocation requires access to the
dynamic symbol table. This is why the .dynsym section is included in
the EFI binary. Another complication is that this relocation requires
memory to hold the function descriptors (aka "procedure labels" or
"plabels"). Each function descriptor uses 16 bytes of memory. The
IA-64 self-relocator currently reserves a static memory area that can
hold 100 of these descriptors. If the self-relocator runs out of
space, it causes the EFI binary to fail with error code 5
(EFI_BUFFER_TOO_SMALL). When this happens, the manifest constant
MAX_FUNCTION_DESCRIPTORS in gnuefi/reloc_ia64.S should be increased
and the application recompiled. An easy way to count the number of
function descriptors required by an EFI application is to run the
command:
objdump --dynamic-reloc example.so | fgrep FPTR64 | wc -l
assuming "example" is the name of the desired EFI application.
** (3) Creating the Function Descriptor for the IA-64 EFI Binaries
As mentioned above, the IA-64 PE32+ format assumes that the entry
point of the binary is a function descriptor. A function descriptors
consists of two double words: the first one is the code entry point
and the second is the global pointer that should be loaded before
calling the entry point. Since the ELF toolchain doesn't know how to
generate a function descriptor for the entry point, the startup code
in gnuefi/crt0-efi-ia64.S crafts one manually by with the code:
.section .plabel, "a"
_start_plabel:
data8 _start
data8 __gp
this places the procedure label for entry point _start in a section
called ".plabel". Now, the only problem is that _start and __gp need
to be relocated _before_ EFI hands control over to the EFI binary.
Fortunately, PE32+ defines a section called ".reloc" that can achieve
this. Thus, in addition to manually crafting the function descriptor,
the startup code also crafts a ".reloc" section that has will cause
the EFI loader to relocate the function descriptor before handing over
control to the EFI binary (again, see the PECOFF spec mentioned above
for details).
A final question may be why .plabel and .reloc need to go in their own
COFF sections. The answer is simply: we need to be able to discard
the relocation entries that are generated for these sections. By
placing them in these sections, the relocations end up in sections
".rela.plabel" and ".rela.reloc" which makes it easy to filter them
out in the filter script. Also, the ".reloc" section needs to be in
its own section so that the objcopy program can recognize it and can
create the correct directory entries in the PE32+ binary.
** (4) Convenient and Portable Generation of UNICODE String Literals
As of gnu-efi-3.0, we make use (and somewhat abuse) the gcc option
that forces wide characters (WCHAR_T) to use short integers (2 bytes)
instead of integers (4 bytes). This way we match the Unicode character
size. By abuse, we mean that we rely on the fact that the regular ASCII
characters are encoded the same way between (short) wide characters
and Unicode and basically only use the first byte. This allows us
to just use them interchangeably.
The gcc option to force short wide characters is : -fshort-wchar
* * * The End * * *

View File

@ -1,184 +0,0 @@
/*
* Copyright (C) 2013 Jerry Hoemann <jerry.hoemann@hp.com>
*
*
* Application to allocate memory at EFI. Syntax of command
* mimics the EFI Boot Service "AllocatePages."
*
* See UEFI spec 2.3, Section 6.2.
*
*
FS1:\> memmap
Type Start End #pages Attributes
BS_Code 0000000000000000-0000000000000FFF 0000000000000001 000000000000000F
Available 0000000000001000-000000000008DFFF 000000000000008D 000000000000000F
Reserved 000000000008E000-000000000008FFFF 0000000000000002 000000000000000F
Available 0000000000090000-000000000009FFFF 0000000000000010 000000000000000F
Available 0000000000100000-000000000FFFFFFF 000000000000FF00 000000000000000F
BS_Code 0000000010000000-0000000010061FFF 0000000000000062 000000000000000F
Available 0000000010062000-000000005CDFFFFF 000000000004CD9E 000000000000000F
ACPI_NVS 000000005CE00000-000000005DDFFFFF 0000000000001000 000000000000000F
BS_Data 000000005DE00000-000000005DFFFFFF 0000000000000200 000000000000000F
Available 000000005E000000-000000005EF1CFFF 0000000000000F1D 000000000000000F
BS_Data 000000005EF1D000-00000000709FBFFF 0000000000011ADF 000000000000000F
Available 00000000709FC000-00000000710E3FFF 00000000000006E8 000000000000000F
LoaderCode 00000000710E4000-00000000711FEFFF 000000000000011B 000000000000000F
Available 00000000711FF000-0000000071901FFF 0000000000000703 000000000000000F
BS_Code 0000000071902000-00000000721FEFFF 00000000000008FD 000000000000000F
Example to allocat 5 pages type BootCode at address 20000000 (hex)
FS1:\> AllocPages.efi 2 3 5 20000000
AllocatePage: __AllocType__ __MemType__ __NumPages__ [__Addr__]
__AllocType__ {0,1,2} -- Any, MaxAddr, Addr
__MemType__ {0..13}, Reserved ==0, LCode==1, LData==2, BSCode==3, BSData==4, ...
__NumPages__ {0..F000000}
[__Addr__] 0... 3FFFFFFFFFFF
All numbers in hex no leading 0x
AllocatPage(2,3,5,20000000)
Example to allocat 5 pages type BootCode at address 30000000 (hex)
FS1:\> AllocPages.efi 2 3 5 30000000
AllocatePage: __AllocType__ __MemType__ __NumPages__ [__Addr__]
__AllocType__ {0,1,2} -- Any, MaxAddr, Addr
__MemType__ {0..13}, Reserved ==0, LCode==1, LData==2, BSCode==3, BSData==4, ...
__NumPages__ {0..F000000}
[__Addr__] 0... 3FFFFFFFFFFF
All numbers in hex no leading 0x
FS1:\> memmap
Type Start End #pages Attributes
BS_Code 0000000000000000-0000000000000FFF 0000000000000001 000000000000000F
Available 0000000000001000-000000000008DFFF 000000000000008D 000000000000000F
Reserved 000000000008E000-000000000008FFFF 0000000000000002 000000000000000F
Available 0000000000090000-000000000009FFFF 0000000000000010 000000000000000F
Available 0000000000100000-000000000FFFFFFF 000000000000FF00 000000000000000F
BS_Code 0000000010000000-0000000010061FFF 0000000000000062 000000000000000F
Available 0000000010062000-000000001FFFFFFF 000000000000FF9E 000000000000000F
BS_Code 0000000020000000-0000000020004FFF 0000000000000005 000000000000000F
Available 0000000020005000-000000002FFFFFFF 000000000000FFFB 000000000000000F
BS_Code 0000000030000000-0000000030004FFF 0000000000000005 000000000000000F
Available 0000000030005000-000000005CDFFFFF 000000000002CDFB 000000000000000F
ACPI_NVS 000000005CE00000-000000005DDFFFFF 0000000000001000 000000000000000F
BS_Data 000000005DE00000-000000005DFFFFFF 0000000000000200 000000000000000F
Available 000000005E000000-000000005EF1CFFF 0000000000000F1D 000000000000000F
BS_Data 000000005EF1D000-00000000709FBFFF 0000000000011ADF 000000000000000F
Available 00000000709FC000-00000000710E3FFF 00000000000006E8 000000000000000F
LoaderCode 00000000710E4000-00000000711FEFFF 000000000000011B 000000000000000F
Available 00000000711FF000-0000000071901FFF 0000000000000703 000000000000000F
BS_Code 0000000071902000-00000000721FEFFF 00000000000008FD 000000000000000F
*/
#include <efi.h>
#include <efilib.h>
#define MAX_NUM_PAGES 0x000000000F000000
#define MAX_ADDR ((1ULL << 46) - 1)
#ifdef DEBUG
#undef DEBUG
#endif
#define DEBUG 0
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS efi_status;
CHAR16 **argv;
INTN argc;
INTN err = 0;
#if DEBUG
INTN c = 0;
#endif
INTN AllocType = -1;
INTN MemType = -1;
INTN NumPages = -1;
EFI_PHYSICAL_ADDRESS Addr = 0;
InitializeLib(image, systab);
Print(L"AllocatePage: __AllocType__ __MemType__ __NumPages__ [__Addr__]\n");
Print(L"__AllocType__ {0,1,2} -- Any, MaxAddr, Addr\n");
Print(L"__MemType__ {0..13}, Reserved ==0, LCode==1, LData==2, BSCode==3, BSData==4, ...\n");
Print(L"__NumPages__ {0..%x}\n", MAX_NUM_PAGES);
Print(L"[__Addr__] 0... %llx\n", MAX_ADDR);
Print(L"All numbers in hex no leading 0x\n");
Print(L"\n");
#if DEBUG
Print(L"Now get argc/argv\n");
#endif
argc = GetShellArgcArgv(image, &argv);
#if DEBUG
Print(L"argc = %d\n", argc);
#endif
#if DEBUG
for (c = 0; c < argc; c++ ) {
Print(L"argv[%d] = <%s>\n", c, argv[c]);
}
#endif
if ( (argc < 4) || (argc > 5) ) {
Print(L"Wrong argument count\n");
return EFI_SUCCESS;
}
AllocType = xtoi(argv[1]);
MemType = xtoi(argv[2]);
NumPages = xtoi(argv[3]);
if ( argc == 5 ) Addr = xtoi(argv[4]);
if ( (AllocType < 0) || (AllocType > 2)) {
Print(L"Invalid AllocType\n");
err++;
}
if ( (MemType < 0) || (MemType > 13) ) {
Print(L"Invalid MemType\n");
err++;
}
if ( (NumPages < 0) || (NumPages > MAX_NUM_PAGES) ) {
Print(L"Inavlid NumPages\n");
err++;
}
if ( Addr > MAX_ADDR ) {
Print(L"Inavlid Address\n");
err++;
}
if ( err ) {
return EFI_INVALID_PARAMETER;
}
Print(L"AllocatPage(%d,%d,%d,%lx)\n", AllocType, MemType, NumPages, Addr);
efi_status = uefi_call_wrapper(BS->AllocatePages, 4, AllocType, MemType, NumPages, &Addr);
if ( EFI_ERROR(efi_status) ) {
Print(L"Allocate Pages Failed: %d\n", efi_status);
return efi_status;
}
return EFI_SUCCESS;
}

View File

@ -1,145 +0,0 @@
/*
* Copyright (C) 2013 Jerry Hoemann <jerry.hoemann@hp.com>
*
* Application to allocate memory at EFI. Syntax of command
* mimics the EFI Boot Service "FreePages."
*
* See UEFI spec 2.3, Section 6.2.
*
Example freeing a 5 page BS_Code setment at address: 0000000020000000 (hex)
FS1:\> memmap
Type Start End #pages Attributes
BS_Code 0000000000000000-0000000000000FFF 0000000000000001 000000000000000F
Available 0000000000001000-000000000008DFFF 000000000000008D 000000000000000F
Reserved 000000000008E000-000000000008FFFF 0000000000000002 000000000000000F
Available 0000000000090000-000000000009FFFF 0000000000000010 000000000000000F
Available 0000000000100000-000000000FFFFFFF 000000000000FF00 000000000000000F
BS_Code 0000000010000000-0000000010061FFF 0000000000000062 000000000000000F
Available 0000000010062000-000000001FFFFFFF 000000000000FF9E 000000000000000F
BS_Code 0000000020000000-0000000020004FFF 0000000000000005 000000000000000F
Available 0000000020005000-000000005DDFFFFF 000000000003DDFB 000000000000000F
BS_Data 000000005DE00000-000000005DFFFFFF 0000000000000200 000000000000000F
Available 000000005E000000-000000006DE7CFFF 000000000000FE7D 000000000000000F
ACPI_NVS 000000006DE7D000-000000006EE7CFFF 0000000000001000 000000000000000F
BS_Data 000000006EE7D000-00000000709FBFFF 0000000000001B7F 000000000000000F
Available 00000000709FC000-00000000710E3FFF 00000000000006E8 000000000000000F
FS1:\> FreePages 0000000020000000 5
FreePages: __PhysAddr__ __PgCnt__
__PhysAddr__ 0... 3FFFFFFFFFFF
__PgCnt__ [0..F000000]
All numbers hex w/ no leading 0x
FreePages(20000000,5)
FS1:\> memmap
Type Start End #pages Attributes
BS_Code 0000000000000000-0000000000000FFF 0000000000000001 000000000000000F
Available 0000000000001000-000000000008DFFF 000000000000008D 000000000000000F
Reserved 000000000008E000-000000000008FFFF 0000000000000002 000000000000000F
Available 0000000000090000-000000000009FFFF 0000000000000010 000000000000000F
Available 0000000000100000-000000000FFFFFFF 000000000000FF00 000000000000000F
BS_Code 0000000010000000-0000000010061FFF 0000000000000062 000000000000000F
Available 0000000010062000-000000005DDFFFFF 000000000004DD9E 000000000000000F
BS_Data 000000005DE00000-000000005DFFFFFF 0000000000000200 000000000000000F
Available 000000005E000000-000000006DE7CFFF 000000000000FE7D 000000000000000F
ACPI_NVS 000000006DE7D000-000000006EE7CFFF 0000000000001000 000000000000000F
BS_Data 000000006EE7D000-00000000709FBFFF 0000000000001B7F 000000000000000F
Available 00000000709FC000-00000000710E3FFF 00000000000006E8 000000000000000F
*/
#include <efi.h>
#include <efilib.h>
/*
* FreePages: __PhysAddr__ __PgCnt__
*
*/
#define MAX_NUM_PAGES 0x000000000F000000
#define MAX_ADDR ((1ULL << 46) - 1)
#ifdef DEBUG
#undef DEBUG
#endif
#define DEBUG 0
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS efi_status;
CHAR16 **argv;
INTN argc = 0;
#if DEBUG
INTN c = 0;
#endif
INTN err = 0;
INTN PgCnt = -1;
EFI_PHYSICAL_ADDRESS PhysAddr = 0;
InitializeLib(image, systab);
Print(L"FreePages: __PhysAddr__ __PgCnt__\n");
Print(L"__PhysAddr__ 0... %llx\n", MAX_ADDR);
Print(L"__PgCnt__ [0..%lx]\n", MAX_NUM_PAGES);
Print(L"All numbers hex w/ no leading 0x\n");
Print(L"\n");
#if DEBUG
Print(L"Now parse argc/argv\n");
#endif
argc = GetShellArgcArgv(image, &argv);
#if DEBUG
Print(L"argc = %d\n", argc);
#endif
#if DEBUG
for (c = 0; c < argc; c++ ) {
Print(L"argv[%d] = <%s>\n", c, argv[c]);
}
#endif
if (argc != 3) {
Print(L"Invalid argument count\n");
return EFI_SUCCESS;
}
PhysAddr = xtoi(argv[1]);
PgCnt = xtoi(argv[2]);
if ( (PgCnt < 0) || (PgCnt > MAX_NUM_PAGES) ) {
Print(L"Inavlid PgCnt\n");
err++;
}
if ( PhysAddr > MAX_ADDR ) {
Print(L"Inavlid Address\n");
err++;
}
if ( err ) {
return EFI_SUCCESS;
}
Print(L"FreePages(%lx,%d)\n", PhysAddr, PgCnt);
efi_status = uefi_call_wrapper(BS->FreePages, 2, PhysAddr, PgCnt);
if ( EFI_ERROR(efi_status) ) {
Print(L"Free Pages Failed: %d\n", efi_status);
return efi_status;
}
return EFI_SUCCESS;
}

View File

@ -1,95 +0,0 @@
#
# Copyright (C) 1999-2001 Hewlett-Packard Co.
# Contributed by David Mosberger <davidm@hpl.hp.com>
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
#
# All rights reserved.
#
# 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.
# * Neither the name of Hewlett-Packard Co. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# 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 OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANYDIRECT, 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.
#
SRCDIR = .
VPATH = $(SRCDIR)
include $(SRCDIR)/../Make.defaults
TOPDIR = $(SRCDIR)/..
CDIR=$(TOPDIR)/..
LINUX_HEADERS = /usr/src/sys/build
CPPFLAGS += -D__KERNEL__ -I$(LINUX_HEADERS)/include
CRTOBJS = ../gnuefi/crt0-efi-$(ARCH).o
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_efi.lds
ifneq (,$(findstring FreeBSD,$(OS)))
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds
endif
LDFLAGS += -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
LOADLIBES += -lefi -lgnuefi
LOADLIBES += $(LIBGCC)
LOADLIBES += -T $(LDSCRIPT)
TARGET_APPS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi \
printenv.efi t7.efi t8.efi tcc.efi modelist.efi \
route80h.efi drv0_use.efi AllocPages.efi exit.efi \
FreePages.efi setjmp.efi debughook.efi debughook.efi.debug \
bltgrid.efi lfbgrid.efi setdbg.efi unsetdbg.efi
TARGET_BSDRIVERS = drv0.efi
TARGET_RTDRIVERS =
ifneq ($(HAVE_EFI_OBJCOPY),)
FORMAT := --target efi-app-$(ARCH)
$(TARGET_BSDRIVERS): FORMAT=--target efi-bsdrv-$(ARCH)
$(TARGET_RTDRIVERS): FORMAT=--target efi-rtdrv-$(ARCH)
else
SUBSYSTEM := 0xa
$(TARGET_BSDRIVERS): SUBSYSTEM = 0xb
$(TARGET_RTDRIVERS): SUBSYSTEM = 0xc
FORMAT := -O binary
LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
endif
TARGETS = $(TARGET_APPS) $(TARGET_BSDRIVERS) $(TARGET_RTDRIVERS)
all: $(TARGETS)
clean:
rm -f $(TARGETS) *~ *.o *.so
.PHONY: install
include $(SRCDIR)/../Make.rules

View File

@ -1,131 +0,0 @@
#include <efi.h>
#include <efilib.h>
extern EFI_GUID GraphicsOutputProtocol;
static void
fill_boxes(UINT32 *PixelBuffer, UINT32 Width, UINT32 Height)
{
UINT32 y, x = 0;
/*
* This assums BGRR, but it doesn't really matter; we pick red and
* green so it'll just be blue/green if the pixel format is backwards.
*/
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Red = {0, 0, 0xff, 0},
Green = {0, 0xff, 0, 0},
*Color;
for (y = 0; y < Height; y++) {
Color = ((y / 32) % 2 == 0) ? &Red : &Green;
for (x = 0; x < Width; x++) {
if (x % 32 == 0 && x != 0)
Color = (Color == &Red) ? &Green : &Red;
PixelBuffer[y * Width + x] = *(UINT32 *)Color;
}
}
}
static void
draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
{
int i, imax;
EFI_STATUS rc;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
UINTN NumPixels;
UINT32 *PixelBuffer;
UINT32 BufferSize;
if (gop->Mode) {
imax = gop->Mode->MaxMode;
} else {
Print(L"gop->Mode is NULL\n");
return;
}
for (i = 0; i < imax; i++) {
UINTN SizeOfInfo;
rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo,
&info);
if (EFI_ERROR(rc) && rc == EFI_NOT_STARTED) {
Print(L"gop->QueryMode() returned %r\n", rc);
Print(L"Trying to start GOP with SetMode().\n");
rc = uefi_call_wrapper(gop->SetMode, 2, gop,
gop->Mode ? gop->Mode->Mode : 0);
rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i,
&SizeOfInfo, &info);
}
if (EFI_ERROR(rc)) {
Print(L"%d: Bad response from QueryMode: %r (%d)\n",
i, rc, rc);
continue;
}
if (CompareMem(info, gop->Mode->Info, sizeof (*info)))
continue;
NumPixels = info->VerticalResolution * info->HorizontalResolution;
BufferSize = NumPixels * sizeof(UINT32);
PixelBuffer = AllocatePool(BufferSize);
if (!PixelBuffer) {
Print(L"Allocation of 0x%08lx bytes failed.\n",
sizeof(UINT32) * NumPixels);
return;
}
fill_boxes(PixelBuffer,
info->HorizontalResolution, info->VerticalResolution);
uefi_call_wrapper(gop->Blt, 10, gop,
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)PixelBuffer,
EfiBltBufferToVideo,
0, 0, 0, 0,
info->HorizontalResolution,
info->VerticalResolution,
0);
return;
}
Print(L"Never found the active video mode?\n");
}
static EFI_STATUS
SetWatchdog(UINTN seconds)
{
EFI_STATUS rc;
rc = uefi_call_wrapper(BS->SetWatchdogTimer, 4, seconds, 0x1ffff,
0, NULL);
if (EFI_ERROR(rc)) {
CHAR16 Buffer[64];
StatusToString(Buffer, rc);
Print(L"Bad response from QueryMode: %s (%d)\n", Buffer, rc);
}
return rc;
}
EFI_STATUS
efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS rc;
EFI_GRAPHICS_OUTPUT_PROTOCOL *gop;
InitializeLib(image_handle, systab);
SetWatchdog(10);
rc = LibLocateProtocol(&GraphicsOutputProtocol, (void **)&gop);
if (EFI_ERROR(rc)) {
Print(L"Could not locate GOP: %r\n", rc);
return rc;
}
if (!gop) {
Print(L"LocateProtocol(GOP, &gop) returned %r but GOP is NULL\n", rc);
return EFI_UNSUPPORTED;
}
draw_boxes(gop);
SetWatchdog(0);
return EFI_SUCCESS;
}

View File

@ -1,97 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
GetVariableAttr(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner,
UINT32 *attributes)
{
EFI_STATUS efi_status;
*len = 0;
efi_status = uefi_call_wrapper(RT->GetVariable, 5, var, &owner,
NULL, len, NULL);
if (efi_status != EFI_BUFFER_TOO_SMALL)
return efi_status;
*data = AllocateZeroPool(*len);
if (!*data)
return EFI_OUT_OF_RESOURCES;
efi_status = uefi_call_wrapper(RT->GetVariable, 5, var, &owner,
attributes, len, *data);
if (efi_status != EFI_SUCCESS) {
FreePool(*data);
*data = NULL;
}
return efi_status;
}
EFI_STATUS
GetVariable(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner)
{
return GetVariableAttr(var, data, len, owner, NULL);
}
EFI_GUID DUMMY_GUID =
{0x55aad538, 0x8f82, 0x4e2a, {0xa4,0xf0,0xbe, 0x59, 0x13, 0xb6, 0x5f, 0x1e}};
#if defined(__clang__)
# define _OPTNONE __attribute__((optnone))
#else
# define _OPTNONE __attribute__((__optimize__("0")))
#endif
static _OPTNONE void
DebugHook(void)
{
EFI_GUID guid = DUMMY_GUID;
UINT8 *data = NULL;
UINTN dataSize = 0;
EFI_STATUS efi_status;
register volatile unsigned long long x = 0;
extern char _text, _data;
if (x)
return;
efi_status = GetVariable(L"DUMMY_DEBUG", &data, &dataSize, guid);
if (EFI_ERROR(efi_status)) {
return;
}
Print(L"add-symbol-file /usr/lib/debug/boot/efi/debughook.debug "
L"0x%08x -s .data 0x%08x\n", &_text, &_data);
Print(L"Pausing for debugger attachment.\n");
Print(L"To disable this, remove the EFI variable DUMMY_DEBUG-%g .\n",
&guid);
x = 1;
while (x++) {
/* Make this so it can't /totally/ DoS us. */
#if defined(__x86_64__) || defined(__i386__) || defined(__i686__)
if (x > 4294967294ULL)
break;
__asm__ __volatile__("pause");
#elif defined(__aarch64__)
if (x > 1000)
break;
__asm__ __volatile__("wfi");
#else
if (x > 12000)
break;
uefi_call_wrapper(BS->Stall, 1, 5000);
#endif
}
x = 1;
}
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
InitializeLib(image, systab);
DebugHook();
return EFI_SUCCESS;
}

View File

@ -1,191 +0,0 @@
/*
* Copyright (C) 2013 David Decotigny <decot@googlers.com>
*
* Sample EFI shell session, together with drv0_use.efi:
*
* # Loading first instance:
*
* fs0:\> load drv0.efi
* Driver instance loaded successfully.
* load: Image fs0:\drv0.efi loaded at 2FD7C000 - Success
*
* # Testing 1st instance:
*
* fs0:\> drv0_use.efi
* Playing with driver instance 0...
* Hello Sample UEFI Driver!
* Hello was called 1 time(s).
*
* fs0:\> drv0_use.efi
* Playing with driver instance 0...
* Hello Sample UEFI Driver!
* Hello was called 2 time(s).
*
* # Loading another instance:
*
* fs0:\> load drv0.efi
* Driver instance loaded successfully.
* load: Image fs0:\drv0.efi loaded at 2FD6D000 - Success
*
* # Using both instances:
*
* fs0:\> drv0_use.efi
* Playing with driver instance 0...
* Hello Sample UEFI Driver!
* Hello was called 3 time(s).
* Playing with driver instance 1...
* Hello Sample UEFI Driver!
* Hello was called 1 time(s).
*
* fs0:\> drv0_use.efi
* Playing with driver instance 0...
* Hello Sample UEFI Driver!
* Hello was called 4 time(s).
* Playing with driver instance 1...
* Hello Sample UEFI Driver!
* Hello was called 2 time(s).
*
* # Removing 1st instance:
*
* fs0:\> dh
* Handle dump
* 1: Image(DxeCore)
* [...]
* 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
* 7A: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
*
* fs0:\> unload 79
* 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
* Unload driver image (y/n)? y
* Driver instance unloaded.
* unload: Success
*
* # Only 2nd instance remaining:
*
* fs0:\> drv0_use.efi
* Playing with driver instance 0...
* Hello Sample UEFI Driver!
* Hello was called 3 time(s).
*
* # Removing 2nd/last instance:
*
* fs0:\> dh
* Handle dump
* 1: Image(DxeCore)
* [...]
* 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
*
* fs0:\> unload 79
* 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
* Unload driver image (y/n)? y
* Driver instance unloaded.
* unload: Success
*
* # Expect error: no other drv0 instance left
*
* fs0:\> drv0_use.efi
* Error looking up handles for proto: 14
*/
#include <efi.h>
#include <efilib.h>
#include "drv0.h"
static const EFI_GUID GnuEfiAppsDrv0ProtocolGuid
= GNU_EFI_APPS_DRV0_PROTOCOL_GUID;
static struct {
GNU_EFI_APPS_DRV0_PROTOCOL Proto;
UINTN Counter;
} InternalGnuEfiAppsDrv0ProtocolData;
static
EFI_STATUS
EFI_FUNCTION
Drv0SayHello(
IN const CHAR16 *HelloWho
)
{
if (! HelloWho)
return EFI_INVALID_PARAMETER;
Print(L"Hello %s!\n", HelloWho);
InternalGnuEfiAppsDrv0ProtocolData.Counter ++;
return EFI_SUCCESS;
}
static
EFI_STATUS
EFI_FUNCTION
Drv0GetNumberOfHello(
OUT UINTN *NumberOfHello
)
{
if (! NumberOfHello)
return EFI_INVALID_PARAMETER;
*NumberOfHello = InternalGnuEfiAppsDrv0ProtocolData.Counter;
return EFI_SUCCESS;
}
static
EFI_STATUS
EFI_FUNCTION
Drv0Unload(IN EFI_HANDLE ImageHandle)
{
LibUninstallProtocolInterfaces(ImageHandle,
&GnuEfiAppsDrv0ProtocolGuid,
&InternalGnuEfiAppsDrv0ProtocolData.Proto,
NULL);
Print(L"Driver instance unloaded.\n", ImageHandle);
return EFI_SUCCESS;
}
EFI_STATUS
efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SysTab)
{
EFI_STATUS Status;
EFI_LOADED_IMAGE *LoadedImage = NULL;
InitializeLib(ImageHandle, SysTab);
/* Initialize global protocol definition + data */
InternalGnuEfiAppsDrv0ProtocolData.Proto.SayHello
= (GNU_EFI_APPS_DRV0_SAY_HELLO) Drv0SayHello;
InternalGnuEfiAppsDrv0ProtocolData.Proto.GetNumberOfHello
= (GNU_EFI_APPS_DRV0_GET_NUMBER_OF_HELLO) Drv0GetNumberOfHello;
InternalGnuEfiAppsDrv0ProtocolData.Counter = 0;
/* Grab handle to this image: we'll attach our proto instance to it */
Status = uefi_call_wrapper(BS->OpenProtocol, 6,
ImageHandle, &LoadedImageProtocol,
(void**)&LoadedImage, ImageHandle,
NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(Status)) {
Print(L"Could not open loaded image protocol: %d\n", Status);
return Status;
}
/* Attach our proto to the current driver image */
Status = LibInstallProtocolInterfaces(
&ImageHandle, &GnuEfiAppsDrv0ProtocolGuid,
&InternalGnuEfiAppsDrv0ProtocolData.Proto, NULL);
if (EFI_ERROR(Status)) {
Print(L"Error registering driver instance: %d\n", Status);
return Status;
}
/* Register Unload callback, used to unregister current protocol
* instance from system */
LoadedImage->Unload = (EFI_IMAGE_UNLOAD)Drv0Unload;
Print(L"Driver instance loaded successfully.\n");
return EFI_SUCCESS; /* at this point, this instance stays resident
* until image is unloaded, eg. with shell's unload,
* ExitBootServices() */
}

View File

@ -1,35 +0,0 @@
#ifndef _GNU_EFI_APPS_DRV0_H_
#define _GNU_EFI_APPS_DRV0_H_
#ifdef __cplusplus
extern "C" {
#endif
/* UEFI naming conventions */
#define GNU_EFI_APPS_DRV0_PROTOCOL_GUID \
{ 0xe4dcafd0, 0x586c, 0x4b3d, {0x86, 0xe7, 0x28, 0xde, 0x7f, 0xcc, 0x04, 0xb9} }
INTERFACE_DECL(_GNU_EFI_APPS_DRV0_PROTOCOL);
typedef
EFI_STATUS
(EFIAPI *GNU_EFI_APPS_DRV0_SAY_HELLO) (
IN const CHAR16 *HelloWho
);
typedef
EFI_STATUS
(EFIAPI *GNU_EFI_APPS_DRV0_GET_NUMBER_OF_HELLO) (
OUT UINTN *NumberOfHello
);
typedef struct _GNU_EFI_APPS_DRV0_PROTOCOL {
GNU_EFI_APPS_DRV0_SAY_HELLO SayHello;
GNU_EFI_APPS_DRV0_GET_NUMBER_OF_HELLO GetNumberOfHello;
} GNU_EFI_APPS_DRV0_PROTOCOL;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,79 +0,0 @@
/*
* Copyright (C) 2013 David Decotigny <decot@googlers.com>
*
* See drv0.c for an example session.
*/
#include <efi.h>
#include <efilib.h>
#include "drv0.h"
static EFI_GUID GnuEfiAppsDrv0ProtocolGuid
= GNU_EFI_APPS_DRV0_PROTOCOL_GUID;
static
EFI_STATUS
PlayWithGnuEfiAppsDrv0Protocol(IN EFI_HANDLE DrvHandle) {
EFI_STATUS Status;
GNU_EFI_APPS_DRV0_PROTOCOL *drv = NULL;
UINTN NumberOfHello = 0;
Status = uefi_call_wrapper(BS->OpenProtocol, 6,
DrvHandle,
&GnuEfiAppsDrv0ProtocolGuid,
(void**)&drv,
DrvHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(Status)) {
Print(L"Cannot open proto: %d\n", Status);
return Status;
}
Status = uefi_call_wrapper(drv->SayHello, 2, L"Sample UEFI Driver");
if (EFI_ERROR(Status)) {
Print(L"Cannot call SayHello: %d\n", Status);
}
Status = uefi_call_wrapper(drv->GetNumberOfHello, 2, &NumberOfHello);
if (EFI_ERROR(Status)) {
Print(L"Cannot call GetNumberOfHello: %d\n", Status);
} else {
Print(L"Hello was called %d time(s).\n", NumberOfHello);
}
return EFI_SUCCESS;
}
EFI_STATUS
efi_main (EFI_HANDLE Image, EFI_SYSTEM_TABLE *SysTab)
{
EFI_STATUS Status;
EFI_HANDLE *Handles = NULL;
UINTN i, NoHandles = 0;
InitializeLib(Image, SysTab);
Status = LibLocateHandle(ByProtocol, &GnuEfiAppsDrv0ProtocolGuid,
NULL, &NoHandles, &Handles);
if (EFI_ERROR(Status)) {
Print(L"Error looking up handles for proto: %d\n", Status);
return Status;
}
for (i = 0 ; i < NoHandles ; ++i)
{
Print(L"Playing with driver instance %d...\n", i);
Status = PlayWithGnuEfiAppsDrv0Protocol(Handles[i]);
if (EFI_ERROR(Status))
Print(L"Error playing with instance %d, skipping\n", i);
}
if (Handles)
FreePool(Handles);
return EFI_SUCCESS;
}

View File

@ -1,12 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
{
InitializeLib(image_handle, systab);
Exit(EFI_SUCCESS, 0, NULL);
return EFI_UNSUPPORTED;
}

View File

@ -1,170 +0,0 @@
#include <efi.h>
#include <efilib.h>
extern EFI_GUID GraphicsOutputProtocol;
#define be32_to_cpu(x) __builtin_bswap32(x)
static void
fill_boxes(UINT32 *PixelBuffer, UINT32 Width, UINT32 Height, UINT32 Pitch,
EFI_GRAPHICS_PIXEL_FORMAT Format, EFI_PIXEL_BITMASK Info )
{
UINT32 Red, Green;
UINT32 y, x, color;
switch(Format) {
case PixelRedGreenBlueReserved8BitPerColor:
Red = be32_to_cpu(0xff000000);
Green = be32_to_cpu(0x00ff0000);
break;
case PixelBlueGreenRedReserved8BitPerColor:
Red = be32_to_cpu(0x0000ff00);
Green = be32_to_cpu(0x00ff0000);
break;
case PixelBitMask:
Red = Info.RedMask;
Green = Info.GreenMask;
break;
case PixelBltOnly:
return;
default:
Print(L"Invalid pixel format\n");
return;
}
for (y = 0; y < Height; y++) {
color = ((y / 32) % 2 == 0) ? Red : Green;
for (x = 0; x < Width; x++) {
if (x % 32 == 0 && x != 0)
color = (color == Red) ? Green : Red;
PixelBuffer[y * Pitch + x] = color;
}
}
}
static void
draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
{
int i, imax;
EFI_STATUS rc;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
UINTN NumPixels;
UINT32 *PixelBuffer;
UINT32 CopySize, BufferSize;
#if defined(__x86_64__) || defined(__aarch64__)
UINT64 FrameBufferAddr;
#elif defined(__i386__) || defined(__arm__)
UINT32 FrameBufferAddr;
#else
#error YOUR ARCH HERE
#endif
if (gop->Mode) {
imax = gop->Mode->MaxMode;
} else {
Print(L"gop->Mode is NULL\n");
return;
}
for (i = 0; i < imax; i++) {
UINTN SizeOfInfo;
rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo,
&info);
if (EFI_ERROR(rc) && rc == EFI_NOT_STARTED) {
Print(L"gop->QueryMode() returned %r\n", rc);
Print(L"Trying to start GOP with SetMode().\n");
rc = uefi_call_wrapper(gop->SetMode, 2, gop,
gop->Mode ? gop->Mode->Mode : 0);
rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i,
&SizeOfInfo, &info);
}
if (EFI_ERROR(rc)) {
Print(L"%d: Bad response from QueryMode: %r (%d)\n",
i, rc, rc);
continue;
}
if (CompareMem(info, gop->Mode->Info, sizeof (*info)))
continue;
NumPixels = info->VerticalResolution * info->PixelsPerScanLine;
BufferSize = NumPixels * sizeof(UINT32);
if (BufferSize == gop->Mode->FrameBufferSize) {
CopySize = BufferSize;
} else {
CopySize = BufferSize < gop->Mode->FrameBufferSize ?
BufferSize : gop->Mode->FrameBufferSize;
Print(L"height * pitch * pixelsize = %lu buf fb size is %lu; using %lu\n",
BufferSize, gop->Mode->FrameBufferSize, CopySize);
}
PixelBuffer = AllocatePool(BufferSize);
if (!PixelBuffer) {
Print(L"Allocation of 0x%08lx bytes failed.\n",
sizeof(UINT32) * NumPixels);
return;
}
fill_boxes(PixelBuffer, info->HorizontalResolution,
info->VerticalResolution, info->PixelsPerScanLine,
info->PixelFormat, info->PixelInformation);
if (info->PixelFormat == PixelBltOnly) {
Print(L"No linear framebuffer on this device.\n");
return;
}
#if defined(__x86_64__) || defined(__aarch64__)
FrameBufferAddr = (UINT64)gop->Mode->FrameBufferBase;
#elif defined(__i386__) || defined(__arm__)
FrameBufferAddr = (UINT32)(UINT64)gop->Mode->FrameBufferBase;
#else
#error YOUR ARCH HERE
#endif
CopyMem((VOID *)FrameBufferAddr, PixelBuffer, CopySize);
return;
}
Print(L"Never found the active video mode?\n");
}
static EFI_STATUS
SetWatchdog(UINTN seconds)
{
EFI_STATUS rc;
rc = uefi_call_wrapper(BS->SetWatchdogTimer, 4, seconds, 0x1ffff,
0, NULL);
if (EFI_ERROR(rc)) {
CHAR16 Buffer[64];
StatusToString(Buffer, rc);
Print(L"Bad response from QueryMode: %s (%d)\n", Buffer, rc);
}
return rc;
}
EFI_STATUS
efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS rc;
EFI_GRAPHICS_OUTPUT_PROTOCOL *gop;
InitializeLib(image_handle, systab);
SetWatchdog(10);
rc = LibLocateProtocol(&GraphicsOutputProtocol, (void **)&gop);
if (EFI_ERROR(rc)) {
Print(L"Could not locate GOP: %r\n", rc);
return rc;
}
if (!gop) {
Print(L"LocateProtocol(GOP, &gop) returned %r but GOP is NULL\n", rc);
return EFI_UNSUPPORTED;
}
draw_boxes(gop);
SetWatchdog(0);
return EFI_SUCCESS;
}

View File

@ -1,108 +0,0 @@
#include <efi.h>
#include <efilib.h>
extern EFI_GUID GraphicsOutputProtocol;
static void
print_modes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
{
int i, imax;
EFI_STATUS rc;
if (gop->Mode) {
imax = gop->Mode->MaxMode;
Print(L"GOP reports MaxMode %d\n", imax);
} else {
Print(L"gop->Mode is NULL\n");
imax = 1;
}
for (i = 0; i < imax; i++) {
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
UINTN SizeOfInfo;
rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo,
&info);
if (EFI_ERROR(rc) && rc == EFI_NOT_STARTED) {
Print(L"gop->QueryMode() returned %r\n", rc);
Print(L"Trying to start GOP with SetMode().\n");
rc = uefi_call_wrapper(gop->SetMode, 2, gop,
gop->Mode ? gop->Mode->Mode : 0);
rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i,
&SizeOfInfo, &info);
}
if (EFI_ERROR(rc)) {
Print(L"%d: Bad response from QueryMode: %r (%d)\n",
i, rc, rc);
continue;
}
Print(L"%c%d: %dx%d ",
(gop->Mode &&
CompareMem(info,gop->Mode->Info,sizeof(*info)) == 0
) ? '*' : ' ',
i, info->HorizontalResolution, info->VerticalResolution);
switch(info->PixelFormat) {
case PixelRedGreenBlueReserved8BitPerColor:
Print(L"RGBR");
break;
case PixelBlueGreenRedReserved8BitPerColor:
Print(L"BGRR");
break;
case PixelBitMask:
Print(L"R:%08x G:%08x B:%08x X:%08x",
info->PixelInformation.RedMask,
info->PixelInformation.GreenMask,
info->PixelInformation.BlueMask,
info->PixelInformation.ReservedMask);
break;
case PixelBltOnly:
Print(L"(blt only)");
break;
default:
Print(L"(Invalid pixel format)");
break;
}
Print(L" pitch %d\n", info->PixelsPerScanLine);
}
}
static EFI_STATUS
SetWatchdog(UINTN seconds)
{
EFI_STATUS rc;
rc = uefi_call_wrapper(BS->SetWatchdogTimer, 4, seconds, 0x1ffff,
0, NULL);
if (EFI_ERROR(rc)) {
CHAR16 Buffer[64];
StatusToString(Buffer, rc);
Print(L"Bad response from QueryMode: %s (%d)\n", Buffer, rc);
}
return rc;
}
EFI_STATUS
efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS rc;
EFI_GRAPHICS_OUTPUT_PROTOCOL *gop;
InitializeLib(image_handle, systab);
SetWatchdog(10);
rc = LibLocateProtocol(&GraphicsOutputProtocol, (void **)&gop);
if (EFI_ERROR(rc)) {
Print(L"Could not locate GOP: %r\n", rc);
return rc;
}
if (!gop) {
Print(L"LocateProtocol(GOP, &gop) returned %r but GOP is NULL\n", rc);
return EFI_UNSUPPORTED;
}
print_modes(gop);
SetWatchdog(0);
return EFI_SUCCESS;
}

View File

@ -1,32 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS status;
CHAR16 name[256], *val, fmt[20];
EFI_GUID vendor;
UINTN size;
InitializeLib(image, systab);
name[0] = 0;
vendor = NullGuid;
Print(L"GUID Variable Name Value\n");
Print(L"=================================== ==================== ========\n");
StrCpy(fmt, L"%.-35g %.-20s %s\n");
while (1) {
size = sizeof(name);
status = uefi_call_wrapper(RT->GetNextVariableName, 3, &size, name, &vendor);
if (status != EFI_SUCCESS)
break;
val = LibGetVariable(name, &vendor);
Print(fmt, &vendor, name, val);
FreePool(val);
}
return EFI_SUCCESS;
}

View File

@ -1,136 +0,0 @@
#include <efi.h>
#include <efilib.h>
/* this example program changes the Reserved Page Route (RPR) bit on ICH10's General
* Control And Status Register (GCS) from LPC to PCI. In practical terms, it routes
* outb to port 80h to the PCI bus. */
#define GCS_OFFSET_ADDR 0x3410
#define GCS_RPR_SHIFT 2
#define GCS_RPR_PCI 1
#define GCS_RPR_LPC 0
#define VENDOR_ID_INTEL 0x8086
#define DEVICE_ID_LPCIF 0x3a16
#define DEVICE_ID_COUGARPOINT_LPCIF 0x1c56
static EFI_HANDLE ImageHandle;
typedef struct {
uint16_t vendor_id; /* 00-01 */
uint16_t device_id; /* 02-03 */
char pad[0xEB]; /* 04-EF */
uint32_t rcba; /* F0-F3 */
uint32_t reserved[3]; /* F4-FF */
} lpcif_t;
static inline void set_bit(volatile uint32_t *flag, int bit, int value)
{
uint32_t val = *flag;
Print(L"current value is 0x%2x\n", val);
if (value) {
val |= (1 << bit);
} else {
val &= ~(1 << bit);
}
Print(L"setting value to 0x%2x\n", val);
*flag = val;
val = *flag;
Print(L"new value is 0x%2x\n", val);
}
static int is_device(EFI_PCI_IO *pciio, uint16_t vendor_id, uint16_t device_id)
{
lpcif_t lpcif;
EFI_STATUS rc;
rc = uefi_call_wrapper(pciio->Pci.Read, 5, pciio, EfiPciIoWidthUint16, 0, 2, &lpcif);
if (EFI_ERROR(rc))
return 0;
if (vendor_id == lpcif.vendor_id && device_id == lpcif.device_id)
return 1;
return 0;
}
static EFI_STATUS find_pci_device(uint16_t vendor_id, uint16_t device_id,
EFI_PCI_IO **pciio)
{
EFI_STATUS rc;
EFI_HANDLE *Handles;
UINTN NoHandles, i;
if (!pciio)
return EFI_INVALID_PARAMETER;
rc = LibLocateHandle(ByProtocol, &PciIoProtocol, NULL, &NoHandles,
&Handles);
if (EFI_ERROR(rc))
return rc;
for (i = 0; i < NoHandles; i++) {
void *pciio_tmp = NULL;
rc = uefi_call_wrapper(BS->OpenProtocol, 6, Handles[i],
&PciIoProtocol, &pciio_tmp, ImageHandle,
NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(rc))
continue;
*pciio = pciio_tmp;
if (!is_device(*pciio, vendor_id, device_id)) {
*pciio = NULL;
continue;
}
return EFI_SUCCESS;
}
return EFI_NOT_FOUND;
}
EFI_STATUS
efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
{
InitializeLib(image_handle, systab);
EFI_PCI_IO *pciio = NULL;
lpcif_t lpcif;
EFI_STATUS rc = EFI_SUCCESS;
struct {
uint16_t vendor;
uint16_t device;
} devices[] = {
{ VENDOR_ID_INTEL, DEVICE_ID_LPCIF },
{ VENDOR_ID_INTEL, DEVICE_ID_COUGARPOINT_LPCIF },
{ 0, 0 }
};
int i;
ImageHandle = image_handle;
for (i = 0; devices[i].vendor != 0; i++) {
rc = find_pci_device(devices[i].vendor, devices[i].device, &pciio);
if (EFI_ERROR(rc))
continue;
}
if (rc == EFI_NOT_FOUND) {
Print(L"Device not found.\n");
return rc;
} else if (EFI_ERROR(rc)) {
return rc;
}
rc = uefi_call_wrapper(pciio->Pci.Read, 5, pciio, EfiPciIoWidthUint32,
EFI_FIELD_OFFSET(lpcif_t, rcba), 1, &lpcif.rcba);
if (EFI_ERROR(rc))
return rc;
if (!(lpcif.rcba & 1)) {
Print(L"rcrb is not mapped, cannot route port 80h\n");
return EFI_UNSUPPORTED;
}
lpcif.rcba &= ~1UL;
Print(L"rcba: 0x%8x\n", lpcif.rcba, lpcif.rcba);
set_bit((uint32_t *)(intptr_t)(lpcif.rcba + GCS_OFFSET_ADDR),
GCS_RPR_SHIFT, GCS_RPR_PCI);
return EFI_SUCCESS;
}

View File

@ -1,37 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_GUID GRUB_EFI_GRUB_VARIABLE_GUID = {0x91376aff,0xcba6,0x42be,{0x94,0x9d,0x06,0xfd,0xe8,0x11,0x28,0xe8}};
EFI_GUID SHIM_GUID = {0x605dab50,0xe046,0x4300,{0xab,0xb6,0x3d,0xd8,0x10,0xdd,0x8b,0x23}};
char grubenv[] = "# GRUB Environment Block\n\
debug=tcp,http,net\n\
####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################";
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS status;
InitializeLib(image, systab);
#if 0
UINT8 data = 1;
status = RT->SetVariable(L"SHIM_DEBUG", &SHIM_GUID,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(data), &data);
if (EFI_ERROR(status))
Print(L"SetVariable failed: %r\n", status);
#endif
status = RT->SetVariable(L"GRUB_ENV", &SHIM_GUID,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(grubenv)-1, grubenv);
if (EFI_ERROR(status))
Print(L"SetVariable(GRUB_ENV) failed: %r\n", status);
return EFI_SUCCESS;
}

View File

@ -1,31 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main(
EFI_HANDLE image_handle,
EFI_SYSTEM_TABLE *systab
)
{
jmp_buf env;
int rc;
InitializeLib(image_handle, systab);
rc = setjmp(&env);
Print(L"setjmp() = %d\n", rc);
if (rc == 3) {
Print(L"3 worked\n");
longjmp(&env, 0);
return 0;
}
if (rc == 1) {
Print(L"0 got to be one yay\n");
return 0;
}
longjmp(&env, 3);
return 0;
}

View File

@ -1,27 +0,0 @@
#include <efi.h>
#include <efilib.h>
static CHAR16 *
a2u (char *str)
{
static CHAR16 mem[2048];
int i;
for (i = 0; str[i]; ++i)
mem[i] = (CHAR16) str[i];
mem[i] = 0;
return mem;
}
EFI_STATUS
efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
{
SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
InitializeLib(image_handle, systab);
conout = systab->ConOut;
uefi_call_wrapper(conout->OutputString, 2, conout, (CHAR16 *)L"Hello World!\n\r");
uefi_call_wrapper(conout->OutputString, 2, conout, a2u("Hello World!\n\r"));
return EFI_SUCCESS;
}

View File

@ -1,14 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
InitializeLib(image, systab);
conout = systab->ConOut;
uefi_call_wrapper(conout->OutputString, 2, conout, L"Hello World!\n\r");
return EFI_SUCCESS;
}

View File

@ -1,95 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main(
EFI_HANDLE image_handle,
EFI_SYSTEM_TABLE *systab
)
{
EFI_GUID loaded_image_protocol = LOADED_IMAGE_PROTOCOL;
EFI_STATUS efi_status;
EFI_LOADED_IMAGE *li;
UINTN pat = PoolAllocationType;
VOID *void_li_p;
InitializeLib(image_handle, systab);
PoolAllocationType = 2; /* klooj */
Print(L"Hello World! (0xd=0x%x, 13=%d)\n", 13, 13);
Print(L"before InitializeLib(): PoolAllocationType=%d\n",
pat);
Print(L" after InitializeLib(): PoolAllocationType=%d\n",
PoolAllocationType);
/*
* Locate loaded_image_handle instance.
*/
Print(L"BS->HandleProtocol() ");
efi_status = uefi_call_wrapper(
BS->HandleProtocol,
3,
image_handle,
&loaded_image_protocol,
&void_li_p);
li = void_li_p;
Print(L"%xh (%r)\n", efi_status, efi_status);
if (efi_status != EFI_SUCCESS) {
return efi_status;
}
Print(L" li: %xh\n", li);
if (!li) {
return EFI_UNSUPPORTED;
}
Print(L" li->Revision: %xh\n", li->Revision);
Print(L" li->ParentHandle: %xh\n", li->ParentHandle);
Print(L" li->SystemTable: %xh\n", li->SystemTable);
Print(L" li->DeviceHandle: %xh\n", li->DeviceHandle);
Print(L" li->FilePath: %xh\n", li->FilePath);
Print(L" li->Reserved: %xh\n", li->Reserved);
Print(L" li->LoadOptionsSize: %xh\n", li->LoadOptionsSize);
Print(L" li->LoadOptions: %xh\n", li->LoadOptions);
Print(L" li->ImageBase: %xh\n", li->ImageBase);
Print(L" li->ImageSize: %xh\n", li->ImageSize);
Print(L" li->ImageCodeType: %xh\n", li->ImageCodeType);
Print(L" li->ImageDataType: %xh\n", li->ImageDataType);
Print(L" li->Unload: %xh\n", li->Unload);
#if 0
typedef struct {
UINT32 Revision;
EFI_HANDLE ParentHandle;
struct _EFI_SYSTEM_TABLE *SystemTable;
// Source location of image
EFI_HANDLE DeviceHandle;
EFI_DEVICE_PATH *FilePath;
VOID *Reserved;
// Images load options
UINT32 LoadOptionsSize;
VOID *LoadOptions;
// Location of where image was loaded
VOID *ImageBase;
UINT64 ImageSize;
EFI_MEMORY_TYPE ImageCodeType;
EFI_MEMORY_TYPE ImageDataType;
// If the driver image supports a dynamic unload request
EFI_IMAGE_UNLOAD Unload;
} EFI_LOADED_IMAGE;
#endif
return EFI_SUCCESS;
}

View File

@ -1,14 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main (EFI_HANDLE *image, EFI_SYSTEM_TABLE *systab)
{
UINTN index;
InitializeLib(image, systab);
uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut, L"Hello application started\r\n");
uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut, L"\r\n\r\n\r\nHit any key to exit\r\n");
uefi_call_wrapper(systab->BootServices->WaitForEvent, 3, 1, &systab->ConIn->WaitForKey, &index);
return EFI_SUCCESS;
}

View File

@ -1,13 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
InitializeLib(image, systab);
Print(L"HelloLib application started\n");
Print(L"\n\n\nHit any key to exit this image\n");
WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"\n\n");
return EFI_SUCCESS;
}

View File

@ -1,43 +0,0 @@
#include <efi.h>
#include <efilib.h>
typedef EFI_STATUS (*foo_t)(EFI_HANDLE, EFI_GUID *, VOID **);
typedef struct {
unsigned long addr;
unsigned long gp;
} fdesc_t;
EFI_LOADED_IMAGE my_loaded;
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
EFI_LOADED_IMAGE *loaded_image = NULL;
#if 0
EFI_DEVICE_PATH *dev_path;
#endif
EFI_STATUS status;
InitializeLib(image, systab);
status = uefi_call_wrapper(systab->BootServices->HandleProtocol,
3,
image,
&LoadedImageProtocol,
(void **) &loaded_image);
if (EFI_ERROR(status)) {
Print(L"handleprotocol: %r\n", status);
}
#if 0
BS->HandleProtocol(loaded_image->DeviceHandle, &DevicePathProtocol, (void **) &dev_path);
Print(L"Image device : %s\n", DevicePathToStr(dev_path));
Print(L"Image file : %s\n", DevicePathToStr(loaded_image->FilePath));
#endif
Print(L"Image base : %lx\n", loaded_image->ImageBase);
Print(L"Image size : %lx\n", loaded_image->ImageSize);
Print(L"Load options size : %lx\n", loaded_image->LoadOptionsSize);
Print(L"Load options : %s\n", loaded_image->LoadOptions);
return EFI_SUCCESS;
}

View File

@ -1,25 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
EFI_INPUT_KEY efi_input_key;
EFI_STATUS efi_status;
InitializeLib(image, systab);
Print(L"HelloLib application started\n");
Print(L"\n\n\nHit any key to exit this image\n");
WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"\n\n");
efi_status = uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, &efi_input_key);
Print(L"ScanCode: %xh UnicodeChar: %xh CallRtStatus: %x\n",
efi_input_key.ScanCode, efi_input_key.UnicodeChar, efi_status);
return EFI_SUCCESS;
}

View File

@ -1,19 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
INTN Argc, i;
CHAR16 **Argv;
InitializeLib(ImageHandle, SystemTable);
Argc = GetShellArgcArgv(ImageHandle, &Argv);
Print(L"Hello World, started with Argc=%d\n", Argc);
for (i = 0 ; i < Argc ; ++i)
Print(L" Argv[%d] = '%s'\n", i, Argv[i]);
Print(L"Bye.\n");
return EFI_SUCCESS;
}

View File

@ -1,431 +0,0 @@
/*
* Test if our calling convention gymnastics actually work
*/
#include <efi.h>
#include <efilib.h>
#if 0
extern void dump_stack(void);
asm( ".globl dump_stack\n"
"dump_stack:\n"
" movq %rsp, %rdi\n"
" jmp *dump_stack_helper@GOTPCREL(%rip)\n"
".size dump_stack, .-dump_stack");
void dump_stack_helper(uint64_t rsp_val)
{
uint64_t *rsp = (uint64_t *)rsp_val;
int x;
Print(L"%%rsp: 0x%08x%08x stack:\r\n",
(rsp_val & 0xffffffff00000000) >>32,
rsp_val & 0xffffffff);
for (x = 0; x < 8; x++) {
Print(L"%08x: ", ((uint64_t)rsp) & 0xffffffff);
Print(L"%016x ", *rsp++);
Print(L"%016x ", *rsp++);
Print(L"%016x ", *rsp++);
Print(L"%016x\r\n", *rsp++);
}
}
#endif
EFI_STATUS EFI_FUNCTION test_failure_callback(void)
{
return EFI_UNSUPPORTED;
}
EFI_STATUS test_failure(void)
{
return uefi_call_wrapper(test_failure_callback, 0);
}
EFI_STATUS EFI_FUNCTION test_call0_callback(void)
{
return EFI_SUCCESS;
}
EFI_STATUS test_call0(void)
{
return uefi_call_wrapper(test_call0_callback, 0);
}
EFI_STATUS EFI_FUNCTION test_call1_callback(UINT32 a)
{
if (a != 0x12345678) {
return EFI_LOAD_ERROR;
}
return EFI_SUCCESS;
}
EFI_STATUS test_call1(void)
{
return uefi_call_wrapper(test_call1_callback, 1,0x12345678);
}
EFI_STATUS EFI_FUNCTION test_call2_callback(UINT32 a, UINT32 b)
{
if (a != 0x12345678) {
return EFI_LOAD_ERROR;
}
if (b != 0x23456789) {
return EFI_INVALID_PARAMETER;
}
return EFI_SUCCESS;
}
EFI_STATUS test_call2(void)
{
return uefi_call_wrapper(test_call2_callback, 2,
0x12345678, 0x23456789);
}
EFI_STATUS EFI_FUNCTION test_call3_callback(UINT32 a, UINT32 b,
UINT32 c)
{
if (a != 0x12345678)
return EFI_LOAD_ERROR;
if (b != 0x23456789)
return EFI_INVALID_PARAMETER;
if (c != 0x3456789a)
return EFI_UNSUPPORTED;
return EFI_SUCCESS;
}
EFI_STATUS test_call3(void)
{
return uefi_call_wrapper(test_call3_callback, 3,
0x12345678, 0x23456789, 0x3456789a);
}
EFI_STATUS EFI_FUNCTION test_call4_callback(UINT32 a, UINT32 b,
UINT32 c, UINT32 d)
{
if (a != 0x12345678)
return EFI_LOAD_ERROR;
if (b != 0x23456789)
return EFI_INVALID_PARAMETER;
if (c != 0x3456789a)
return EFI_UNSUPPORTED;
if (d != 0x456789ab)
return EFI_BAD_BUFFER_SIZE;
return EFI_SUCCESS;
}
EFI_STATUS test_call4(void)
{
return uefi_call_wrapper(test_call4_callback, 4,
0x12345678, 0x23456789, 0x3456789a, 0x456789ab);
}
EFI_STATUS EFI_FUNCTION test_call5_callback(UINT32 a, UINT32 b,
UINT32 c, UINT32 d, UINT32 e)
{
if (a != 0x12345678)
return EFI_LOAD_ERROR;
if (b != 0x23456789)
return EFI_INVALID_PARAMETER;
if (c != 0x3456789a)
return EFI_UNSUPPORTED;
if (d != 0x456789ab)
return EFI_BAD_BUFFER_SIZE;
if (e != 0x56789abc)
return EFI_BUFFER_TOO_SMALL;
return EFI_SUCCESS;
}
EFI_STATUS test_call5(void)
{
return uefi_call_wrapper(test_call5_callback, 5,
0x12345678, 0x23456789, 0x3456789a, 0x456789ab, 0x56789abc);
}
EFI_STATUS EFI_FUNCTION test_call6_callback(UINT32 a, UINT32 b,
UINT32 c, UINT32 d, UINT32 e, UINT32 f)
{
if (a != 0x12345678)
return EFI_LOAD_ERROR;
if (b != 0x23456789)
return EFI_INVALID_PARAMETER;
if (c != 0x3456789a)
return EFI_UNSUPPORTED;
if (d != 0x456789ab)
return EFI_BAD_BUFFER_SIZE;
if (e != 0x56789abc)
return EFI_BUFFER_TOO_SMALL;
if (f != 0x6789abcd)
return EFI_NOT_READY;
return EFI_SUCCESS;
}
EFI_STATUS test_call6(void)
{
return uefi_call_wrapper(test_call6_callback, 6,
0x12345678, 0x23456789, 0x3456789a, 0x456789ab, 0x56789abc,
0x6789abcd);
}
EFI_STATUS EFI_FUNCTION test_call7_callback(UINT32 a, UINT32 b,
UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g)
{
if (a != 0x12345678)
return EFI_LOAD_ERROR;
if (b != 0x23456789)
return EFI_INVALID_PARAMETER;
if (c != 0x3456789a)
return EFI_UNSUPPORTED;
if (d != 0x456789ab)
return EFI_BAD_BUFFER_SIZE;
if (e != 0x56789abc)
return EFI_BUFFER_TOO_SMALL;
if (f != 0x6789abcd)
return EFI_NOT_READY;
if (g != 0x789abcde)
return EFI_DEVICE_ERROR;
return EFI_SUCCESS;
}
EFI_STATUS test_call7(void)
{
return uefi_call_wrapper(test_call7_callback, 7,
0x12345678, 0x23456789, 0x3456789a, 0x456789ab,
0x56789abc, 0x6789abcd, 0x789abcde);
}
EFI_STATUS EFI_FUNCTION test_call8_callback(UINT32 a, UINT32 b,
UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g, UINT32 h)
{
if (a != 0x12345678)
return EFI_LOAD_ERROR;
if (b != 0x23456789)
return EFI_INVALID_PARAMETER;
if (c != 0x3456789a)
return EFI_UNSUPPORTED;
if (d != 0x456789ab)
return EFI_BAD_BUFFER_SIZE;
if (e != 0x56789abc)
return EFI_BUFFER_TOO_SMALL;
if (f != 0x6789abcd)
return EFI_NOT_READY;
if (g != 0x789abcde)
return EFI_DEVICE_ERROR;
if (h != 0x89abcdef)
return EFI_WRITE_PROTECTED;
return EFI_SUCCESS;
}
EFI_STATUS test_call8(void)
{
return uefi_call_wrapper(test_call8_callback, 8,
0x12345678,
0x23456789,
0x3456789a,
0x456789ab,
0x56789abc,
0x6789abcd,
0x789abcde,
0x89abcdef);
}
EFI_STATUS EFI_FUNCTION test_call9_callback(UINT32 a, UINT32 b,
UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g, UINT32 h, UINT32 i)
{
if (a != 0x12345678)
return EFI_LOAD_ERROR;
if (b != 0x23456789)
return EFI_INVALID_PARAMETER;
if (c != 0x3456789a)
return EFI_UNSUPPORTED;
if (d != 0x456789ab)
return EFI_BAD_BUFFER_SIZE;
if (e != 0x56789abc)
return EFI_BUFFER_TOO_SMALL;
if (f != 0x6789abcd)
return EFI_NOT_READY;
if (g != 0x789abcde)
return EFI_DEVICE_ERROR;
if (h != 0x89abcdef)
return EFI_WRITE_PROTECTED;
if (i != 0x9abcdef0)
return EFI_OUT_OF_RESOURCES;
return EFI_SUCCESS;
}
EFI_STATUS test_call9(void)
{
return uefi_call_wrapper(test_call9_callback, 9,
0x12345678,
0x23456789,
0x3456789a,
0x456789ab,
0x56789abc,
0x6789abcd,
0x789abcde,
0x89abcdef,
0x9abcdef0);
}
extern EFI_STATUS test_call10(void);
EFI_STATUS EFI_FUNCTION test_call10_callback(UINT32 a, UINT32 b,
UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g, UINT32 h, UINT32 i,
UINT32 j)
{
if (a != 0x12345678)
return EFI_LOAD_ERROR;
if (b != 0x23456789)
return EFI_INVALID_PARAMETER;
if (c != 0x3456789a)
return EFI_UNSUPPORTED;
if (d != 0x456789ab)
return EFI_BAD_BUFFER_SIZE;
if (e != 0x56789abc)
return EFI_BUFFER_TOO_SMALL;
if (f != 0x6789abcd)
return EFI_NOT_READY;
if (g != 0x789abcde)
return EFI_DEVICE_ERROR;
if (h != 0x89abcdef)
return EFI_WRITE_PROTECTED;
if (i != 0x9abcdef0)
return EFI_OUT_OF_RESOURCES;
if (j != 0xabcdef01)
return EFI_VOLUME_CORRUPTED;
return EFI_SUCCESS;
}
EFI_STATUS test_call10(void)
{
return uefi_call_wrapper(test_call10_callback, 10,
0x12345678,
0x23456789,
0x3456789a,
0x456789ab,
0x56789abc,
0x6789abcd,
0x789abcde,
0x89abcdef,
0x9abcdef0,
0xabcdef01);
}
EFI_STATUS
efi_main (EFI_HANDLE *image, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS rc = EFI_SUCCESS;
InitializeLib(image, systab);
PoolAllocationType = 2; /* klooj */
#ifdef __x86_64__
__asm__ volatile("out %0,%1" : : "a" ((uint8_t)0x14), "dN" (0x80));
#endif
Print(L"Hello\r\n");
rc = test_failure();
if (EFI_ERROR(rc)) {
Print(L"Returning Failure works\n");
} else {
Print(L"Returning failure doesn't work.\r\n");
Print(L"%%rax was 0x%016x, should have been 0x%016x\n",
rc, EFI_UNSUPPORTED);
return EFI_INVALID_PARAMETER;
}
rc = test_call0();
if (!EFI_ERROR(rc)) {
Print(L"0 args works just fine here.\r\n");
} else {
Print(L"0 args failed: 0x%016x\n", rc);
return rc;
}
rc = test_call1();
if (!EFI_ERROR(rc)) {
Print(L"1 arg works just fine here.\r\n");
} else {
Print(L"1 arg failed: 0x%016x\n", rc);
return rc;
}
rc = test_call2();
if (!EFI_ERROR(rc)) {
Print(L"2 args works just fine here.\r\n");
} else {
Print(L"2 args failed: 0x%016x\n", rc);
return rc;
}
rc = test_call3();
if (!EFI_ERROR(rc)) {
Print(L"3 args works just fine here.\r\n");
} else {
Print(L"3 args failed: 0x%016x\n", rc);
return rc;
}
rc = test_call4();
if (!EFI_ERROR(rc)) {
Print(L"4 args works just fine here.\r\n");
} else {
Print(L"4 args failed: 0x%016x\n", rc);
return rc;
}
rc = test_call5();
if (!EFI_ERROR(rc)) {
Print(L"5 args works just fine here.\r\n");
} else {
Print(L"5 args failed: 0x%016x\n", rc);
return rc;
}
rc = test_call6();
if (!EFI_ERROR(rc)) {
Print(L"6 args works just fine here.\r\n");
} else {
Print(L"6 args failed: 0x%016x\n", rc);
return rc;
}
rc = test_call7();
if (!EFI_ERROR(rc)) {
Print(L"7 args works just fine here.\r\n");
} else {
Print(L"7 args failed: 0x%016x\n", rc);
return rc;
}
rc = test_call8();
if (!EFI_ERROR(rc)) {
Print(L"8 args works just fine here.\r\n");
} else {
Print(L"8 args failed: 0x%016x\n", rc);
return rc;
}
rc = test_call9();
if (!EFI_ERROR(rc)) {
Print(L"9 args works just fine here.\r\n");
} else {
Print(L"9 args failed: 0x%016x\n", rc);
return rc;
}
rc = test_call10();
if (!EFI_ERROR(rc)) {
Print(L"10 args works just fine here.\r\n");
} else {
Print(L"10 args failed: 0x%016x\n", rc);
return rc;
}
return rc;
}

View File

@ -1,9 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
Print(L"Press `q' to quit, any other key to continue:\n");
}

View File

@ -1,43 +0,0 @@
.text
.align 4
.globl _start
_start:
#if 0
pushl %ebp
movl %esp,%ebp
pushl %ebx # save ebx
movl 12(%ebp),%eax # eax <- systab
movl 24(%eax),%ebx # ebx <- systab->FirmwareVendor
pushl %ebx
movl 44(%eax),%ebx # ebx <- systab->ConOut
pushl %ebx
movl 4(%ebx),%eax # eax <- conout->OutputString
call *%eax
movl -4(%ebp),%ebx # restore ebx
leave
ret
#else
pushl %ebp
movl %esp,%ebp
pushl %ebx
call 0f
0: popl %eax
addl $hello-0b,%eax
pushl %eax
movl 12(%ebp),%eax # eax <- systab
movl 44(%eax),%ebx # ebx <- systab->ConOut
pushl %ebx
movl 4(%ebx),%eax # eax <- conout->OutputString
call *%eax
movl -4(%ebp),%ebx
leave
ret
.section .rodata
.align 2
hello: .byte 'h',0,'e',0,'l',0,'l',0,'o',0,'\n',0,'\r',0,0,0
#endif

View File

@ -1,37 +0,0 @@
#include <efi.h>
#include <efilib.h>
EFI_GUID GRUB_EFI_GRUB_VARIABLE_GUID = {0x91376aff,0xcba6,0x42be,{0x94,0x9d,0x06,0xfd,0xe8,0x11,0x28,0xe8}};
EFI_GUID SHIM_GUID = {0x605dab50,0xe046,0x4300,{0xab,0xb6,0x3d,0xd8,0x10,0xdd,0x8b,0x23}};
char grubenv[] = "# GRUB Environment Block\n\
debug=all\n\
#############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################";
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS status;
UINT8 data = 1;
InitializeLib(image, systab);
status = RT->SetVariable(L"SHIM_DEBUG", &SHIM_GUID,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
0, &data);
if (EFI_ERROR(status))
Print(L"SetVariable failed: %r\n", status);
#if 0
status = RT->SetVariable(L"GRUB_ENV", &SHIM_GUID,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(grubenv)-1, grubenv);
if (EFI_ERROR(status))
Print(L"SetVariable(GRUB_ENV) failed: %r\n", status);
#endif
return EFI_SUCCESS;
}

View File

@ -1,75 +0,0 @@
#
# Copyright (C) 1999-2001 Hewlett-Packard Co.
# Contributed by David Mosberger <davidm@hpl.hp.com>
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
#
# All rights reserved.
#
# 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.
# * Neither the name of Hewlett-Packard Co. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# 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 OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANYDIRECT, 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.
#
SRCDIR = .
VPATH = $(SRCDIR)
include $(SRCDIR)/../Make.defaults
TOPDIR = $(SRCDIR)/..
CDIR=$(TOPDIR)/..
FILES = reloc_$(ARCH)
OBJS = $(FILES:%=%.o)
# on aarch64, avoid jump tables before all relocations have been processed
reloc_aarch64.o: CFLAGS += -fno-jump-tables
TARGETS = crt0-efi-$(ARCH).o libgnuefi.a
all: $(TARGETS)
libgnuefi.a: $(patsubst %,libgnuefi.a(%),$(OBJS))
clean:
rm -f $(TARGETS) *~ *.o $(OBJS)
install:
mkdir -p $(INSTALLROOT)$(LIBDIR)
$(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)$(LIBDIR)
ifneq (,$(findstring FreeBSD,$(OS)))
ifeq ($(ARCH),x86_64)
$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)$(LIBDIR)
else
$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)
endif
else
$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)
endif
include $(SRCDIR)/../Make.rules

View File

@ -1,130 +0,0 @@
/*
* crt0-efi-aarch64.S - PE/COFF header for AArch64 EFI applications
*
* Copright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
*
* 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 and this list of conditions, without modification.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version.
*/
.section .text.head
/*
* Magic "MZ" signature for PE/COFF
*/
.globl ImageBase
ImageBase:
.ascii "MZ"
.skip 58 // 'MZ' + pad + offset == 64
.long pe_header - ImageBase // Offset to the PE header.
pe_header:
.ascii "PE"
.short 0
coff_header:
.short 0xaa64 // AArch64
.short 2 // nr_sections
.long 0 // TimeDateStamp
.long 0 // PointerToSymbolTable
.long 1 // NumberOfSymbols
.short section_table - optional_header // SizeOfOptionalHeader
.short 0x206 // Characteristics.
// IMAGE_FILE_DEBUG_STRIPPED |
// IMAGE_FILE_EXECUTABLE_IMAGE |
// IMAGE_FILE_LINE_NUMS_STRIPPED
optional_header:
.short 0x20b // PE32+ format
.byte 0x02 // MajorLinkerVersion
.byte 0x14 // MinorLinkerVersion
.long _data - _start // SizeOfCode
.long _data_size // SizeOfInitializedData
.long 0 // SizeOfUninitializedData
.long _start - ImageBase // AddressOfEntryPoint
.long _start - ImageBase // BaseOfCode
extra_header_fields:
.quad 0 // ImageBase
.long 0x1000 // SectionAlignment
.long 0x200 // FileAlignment
.short 0 // MajorOperatingSystemVersion
.short 0 // MinorOperatingSystemVersion
.short 0 // MajorImageVersion
.short 0 // MinorImageVersion
.short 0 // MajorSubsystemVersion
.short 0 // MinorSubsystemVersion
.long 0 // Win32VersionValue
.long _edata - ImageBase // SizeOfImage
// Everything before the kernel image is considered part of the header
.long _start - ImageBase // SizeOfHeaders
.long 0 // CheckSum
.short EFI_SUBSYSTEM // Subsystem
.short 0 // DllCharacteristics
.quad 0 // SizeOfStackReserve
.quad 0 // SizeOfStackCommit
.quad 0 // SizeOfHeapReserve
.quad 0 // SizeOfHeapCommit
.long 0 // LoaderFlags
.long 0x6 // NumberOfRvaAndSizes
.quad 0 // ExportTable
.quad 0 // ImportTable
.quad 0 // ResourceTable
.quad 0 // ExceptionTable
.quad 0 // CertificationTable
.quad 0 // BaseRelocationTable
// Section table
section_table:
.ascii ".text\0\0\0"
.long _data - _start // VirtualSize
.long _start - ImageBase // VirtualAddress
.long _data - _start // SizeOfRawData
.long _start - ImageBase // PointerToRawData
.long 0 // PointerToRelocations (0 for executables)
.long 0 // PointerToLineNumbers (0 for executables)
.short 0 // NumberOfRelocations (0 for executables)
.short 0 // NumberOfLineNumbers (0 for executables)
.long 0x60000020 // Characteristics (section flags)
.ascii ".data\0\0\0"
.long _data_size // VirtualSize
.long _data - ImageBase // VirtualAddress
.long _data_size // SizeOfRawData
.long _data - ImageBase // PointerToRawData
.long 0 // PointerToRelocations (0 for executables)
.long 0 // PointerToLineNumbers (0 for executables)
.short 0 // NumberOfRelocations (0 for executables)
.short 0 // NumberOfLineNumbers (0 for executables)
.long 0xc0000040 // Characteristics (section flags)
.align 12
_start:
stp x29, x30, [sp, #-32]!
mov x29, sp
stp x0, x1, [sp, #16]
mov x2, x0
mov x3, x1
adr x0, ImageBase
adrp x1, _DYNAMIC
add x1, x1, #:lo12:_DYNAMIC
bl _relocate
cbnz x0, 0f
ldp x0, x1, [sp, #16]
bl efi_main
0: ldp x29, x30, [sp], #32
ret

View File

@ -1,145 +0,0 @@
/*
* crt0-efi-arm.S - PE/COFF header for ARM EFI applications
*
* Copright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
*
* 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 and this list of conditions, without modification.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version.
*/
.section .text.head
/*
* Magic "MZ" signature for PE/COFF
*/
.globl ImageBase
ImageBase:
.ascii "MZ"
.skip 58 // 'MZ' + pad + offset == 64
.long pe_header - ImageBase // Offset to the PE header.
pe_header:
.ascii "PE"
.short 0
coff_header:
.short 0x1c2 // Mixed ARM/Thumb
.short 2 // nr_sections
.long 0 // TimeDateStamp
.long 0 // PointerToSymbolTable
.long 1 // NumberOfSymbols
.short section_table - optional_header // SizeOfOptionalHeader
.short 0x306 // Characteristics.
// IMAGE_FILE_32BIT_MACHINE |
// IMAGE_FILE_DEBUG_STRIPPED |
// IMAGE_FILE_EXECUTABLE_IMAGE |
// IMAGE_FILE_LINE_NUMS_STRIPPED
optional_header:
.short 0x10b // PE32+ format
.byte 0x02 // MajorLinkerVersion
.byte 0x14 // MinorLinkerVersion
.long _edata - _start // SizeOfCode
.long 0 // SizeOfInitializedData
.long 0 // SizeOfUninitializedData
.long _start - ImageBase // AddressOfEntryPoint
.long _start - ImageBase // BaseOfCode
.long 0 // BaseOfData
extra_header_fields:
.long 0 // ImageBase
.long 0x20 // SectionAlignment
.long 0x8 // FileAlignment
.short 0 // MajorOperatingSystemVersion
.short 0 // MinorOperatingSystemVersion
.short 0 // MajorImageVersion
.short 0 // MinorImageVersion
.short 0 // MajorSubsystemVersion
.short 0 // MinorSubsystemVersion
.long 0 // Win32VersionValue
.long _edata - ImageBase // SizeOfImage
// Everything before the kernel image is considered part of the header
.long _start - ImageBase // SizeOfHeaders
.long 0 // CheckSum
.short EFI_SUBSYSTEM // Subsystem
.short 0 // DllCharacteristics
.long 0 // SizeOfStackReserve
.long 0 // SizeOfStackCommit
.long 0 // SizeOfHeapReserve
.long 0 // SizeOfHeapCommit
.long 0 // LoaderFlags
.long 0x6 // NumberOfRvaAndSizes
.quad 0 // ExportTable
.quad 0 // ImportTable
.quad 0 // ResourceTable
.quad 0 // ExceptionTable
.quad 0 // CertificationTable
.quad 0 // BaseRelocationTable
// Section table
section_table:
/*
* The EFI application loader requires a relocation section
* because EFI applications must be relocatable. This is a
* dummy section as far as we are concerned.
*/
.ascii ".reloc"
.byte 0
.byte 0 // end of 0 padding of section name
.long 0
.long 0
.long 0 // SizeOfRawData
.long 0 // PointerToRawData
.long 0 // PointerToRelocations
.long 0 // PointerToLineNumbers
.short 0 // NumberOfRelocations
.short 0 // NumberOfLineNumbers
.long 0x42100040 // Characteristics (section flags)
.ascii ".text"
.byte 0
.byte 0
.byte 0 // end of 0 padding of section name
.long _edata - _start // VirtualSize
.long _start - ImageBase // VirtualAddress
.long _edata - _start // SizeOfRawData
.long _start - ImageBase // PointerToRawData
.long 0 // PointerToRelocations (0 for executables)
.long 0 // PointerToLineNumbers (0 for executables)
.short 0 // NumberOfRelocations (0 for executables)
.short 0 // NumberOfLineNumbers (0 for executables)
.long 0xe0500020 // Characteristics (section flags)
_start:
stmfd sp!, {r0-r2, lr}
mov r2, r0
mov r3, r1
adr r1, .L_DYNAMIC
ldr r0, [r1]
add r1, r0, r1
adr r0, ImageBase
bl _relocate
teq r0, #0
bne 0f
ldmfd sp, {r0-r1}
bl efi_main
0: add sp, sp, #12
ldr pc, [sp], #4
.L_DYNAMIC:
.word _DYNAMIC - .

View File

@ -1,76 +0,0 @@
/* crt0-efi-ia32.S - x86 EFI startup code.
Copyright (C) 1999 Hewlett-Packard Co.
Contributed by David Mosberger <davidm@hpl.hp.com>.
All rights reserved.
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.
* Neither the name of Hewlett-Packard Co. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
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 OWNER OR CONTRIBUTORS
BE LIABLE FOR ANYDIRECT, 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.
*/
.text
.align 4
.globl _start
_start:
pushl %ebp
movl %esp,%ebp
pushl 12(%ebp) # copy "image" argument
pushl 8(%ebp) # copy "systab" argument
call 0f
0: popl %eax
movl %eax,%ebx
addl $ImageBase-0b,%eax # %eax = ldbase
addl $_DYNAMIC-0b,%ebx # %ebx = _DYNAMIC
pushl %ebx # pass _DYNAMIC as second argument
pushl %eax # pass ldbase as first argument
call _relocate
popl %ebx
popl %ebx
testl %eax,%eax
jne .exit
call efi_main # call app with "image" and "systab" argument
.exit: leave
ret
// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
.data
dummy: .long 0
#define IMAGE_REL_ABSOLUTE 0
.section .reloc
.long dummy // Page RVA
.long 10 // Block Size (2*4+2)
.word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy

View File

@ -1,87 +0,0 @@
/* crt0-efi-ia64.S - IA-64 EFI startup code.
Copyright (C) 1999 Hewlett-Packard Co.
Contributed by David Mosberger <davidm@hpl.hp.com>.
All rights reserved.
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.
* Neither the name of Hewlett-Packard Co. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
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 OWNER OR CONTRIBUTORS
BE LIABLE FOR ANYDIRECT, 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.
*/
.text
.psr abi64
.psr lsb
.lsb
.proc _start
_start:
alloc loc0=ar.pfs,2,2,2,0
mov loc1=rp
movl out0=@gprel(ImageBase) // out0 <- ImageBase (ldbase)
;;
add out0=out0,gp
movl out1=@gprel(_DYNAMIC) // out1 <- _DYNAMIC
;; // avoid WAW on CFM
add out1=out1,gp
br.call.sptk.few rp=_relocate
.Lret0:
cmp.ne p6,p0=r0,r8 // r8 == EFI_SUCCESS?
(p6) br.cond.sptk.few .exit // no ->
.Lret1:
mov out0=in0 // image handle
mov out1=in1 // systab
br.call.sptk.few rp=efi_main
.Lret2:
.exit:
mov ar.pfs=loc0
mov rp=loc1
;;
br.ret.sptk.few rp
.endp _start
// PE32+ wants a PLABEL, not the code address of the entry point:
.align 16
.global _start_plabel
.section .plabel, "a"
_start_plabel:
data8 _start
data8 __gp
// hand-craft a .reloc section for the plabel:
#define IMAGE_REL_BASED_DIR64 10
.section .reloc, "a"
data4 _start_plabel // Page RVA
data4 12 // Block Size (2*4+2*2)
data2 (IMAGE_REL_BASED_DIR64<<12) + 0 // reloc for plabel's entry point
data2 (IMAGE_REL_BASED_DIR64<<12) + 8 // reloc for plabel's global pointer

View File

@ -1,188 +0,0 @@
/*
* crt0-efi-mips64el.S - PE/COFF header for MIPS64 EFI applications
*
* Copright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
* Copright (C) 2017 Heiher <r@hev.cc>
*
* 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 and this list of conditions, without modification.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version.
*/
.section .text.head
/*
* Magic "MZ" signature for PE/COFF
*/
.globl ImageBase
ImageBase:
.ascii "MZ"
.skip 58 // 'MZ' + pad + offset == 64
.long pe_header - ImageBase // Offset to the PE header.
pe_header:
.ascii "PE"
.short 0
coff_header:
.short 0x166 // MIPS little endian
.short 2 // nr_sections
.long 0 // TimeDateStamp
.long 0 // PointerToSymbolTable
.long 1 // NumberOfSymbols
.short section_table - optional_header // SizeOfOptionalHeader
.short 0x206 // Characteristics.
// IMAGE_FILE_DEBUG_STRIPPED |
// IMAGE_FILE_EXECUTABLE_IMAGE |
// IMAGE_FILE_LINE_NUMS_STRIPPED
optional_header:
.short 0x20b // PE32+ format
.byte 0x02 // MajorLinkerVersion
.byte 0x14 // MinorLinkerVersion
.long _edata - _start // SizeOfCode
.long 0 // SizeOfInitializedData
.long 0 // SizeOfUninitializedData
.long _start - ImageBase // AddressOfEntryPoint
.long _start - ImageBase // BaseOfCode
extra_header_fields:
.quad 0 // ImageBase
.long 0x20 // SectionAlignment
.long 0x8 // FileAlignment
.short 0 // MajorOperatingSystemVersion
.short 0 // MinorOperatingSystemVersion
.short 0 // MajorImageVersion
.short 0 // MinorImageVersion
.short 0 // MajorSubsystemVersion
.short 0 // MinorSubsystemVersion
.long 0 // Win32VersionValue
.long _edata - ImageBase // SizeOfImage
// Everything before the kernel image is considered part of the header
.long _start - ImageBase // SizeOfHeaders
.long 0 // CheckSum
.short EFI_SUBSYSTEM // Subsystem
.short 0 // DllCharacteristics
.quad 0 // SizeOfStackReserve
.quad 0 // SizeOfStackCommit
.quad 0 // SizeOfHeapReserve
.quad 0 // SizeOfHeapCommit
.long 0 // LoaderFlags
.long 0x6 // NumberOfRvaAndSizes
.quad 0 // ExportTable
.quad 0 // ImportTable
.quad 0 // ResourceTable
.quad 0 // ExceptionTable
.quad 0 // CertificationTable
.quad 0 // BaseRelocationTable
// Section table
section_table:
/*
* The EFI application loader requires a relocation section
* because EFI applications must be relocatable. This is a
* dummy section as far as we are concerned.
*/
.ascii ".reloc"
.byte 0
.byte 0 // end of 0 padding of section name
.long 0
.long 0
.long 0 // SizeOfRawData
.long 0 // PointerToRawData
.long 0 // PointerToRelocations
.long 0 // PointerToLineNumbers
.short 0 // NumberOfRelocations
.short 0 // NumberOfLineNumbers
.long 0x42100040 // Characteristics (section flags)
.ascii ".text"
.byte 0
.byte 0
.byte 0 // end of 0 padding of section name
.long _edata - _start // VirtualSize
.long _start - ImageBase // VirtualAddress
.long _edata - _start // SizeOfRawData
.long _start - ImageBase // PointerToRawData
.long 0 // PointerToRelocations (0 for executables)
.long 0 // PointerToLineNumbers (0 for executables)
.short 0 // NumberOfRelocations (0 for executables)
.short 0 // NumberOfLineNumbers (0 for executables)
.long 0xe0500020 // Characteristics (section flags)
.set push
.set noreorder
.align 4
.globl _start
.ent _start
.type _start, @function
_start:
daddiu $sp, -32
sd $ra, ($sp)
// Get pc & gp
.align 3
bal 1f
sd $gp, 8($sp)
_pc:
.dword _gp
.dword _DYNAMIC
.dword _relocate
1:
// pc in ra
ld $gp, ($ra)
dli $t0, _pc
dsubu $gp, $t0
daddu $gp, $ra
sd $a0, 16($sp)
sd $a1, 24($sp)
// a2: ImageHandle
move $a2, $a0
// a3: SystemTable
move $a3, $a1
// a0: ImageBase
dli $t1, ImageBase - _pc
daddu $a0, $ra, $t1
// a1: DynamicSection
ld $t1, 8($ra)
dsubu $t1, $t0
daddu $a1, $ra, $t1
// call _relocate
ld $t1, 16($ra)
dsubu $t1, $t0
daddu $t9, $ra, $t1
jalr $t9
nop
bnez $v0, 1b
nop
// a0: ImageHandle
ld $a0, 16($sp)
// call efi_main
dla $t9, efi_main
jalr $t9
// a1: SystemTable
ld $a1, 24($sp)
1:
ld $gp, 8($sp)
ld $ra, ($sp)
jr $ra
daddiu $sp, 32
.end _start
.set pop

View File

@ -1,76 +0,0 @@
/* crt0-efi-x86_64.S - x86_64 EFI startup code.
Copyright (C) 1999 Hewlett-Packard Co.
Contributed by David Mosberger <davidm@hpl.hp.com>.
Copyright (C) 2005 Intel Co.
Contributed by Fenghua Yu <fenghua.yu@intel.com>.
All rights reserved.
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.
* Neither the name of Hewlett-Packard Co. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
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 OWNER OR CONTRIBUTORS
BE LIABLE FOR ANYDIRECT, 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.
*/
.text
.align 4
.globl _start
_start:
subq $8, %rsp
pushq %rcx
pushq %rdx
0:
lea ImageBase(%rip), %rdi
lea _DYNAMIC(%rip), %rsi
popq %rcx
popq %rdx
pushq %rcx
pushq %rdx
call _relocate
popq %rdi
popq %rsi
call efi_main
addq $8, %rsp
.exit:
ret
// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
.data
dummy: .long 0
#define IMAGE_REL_ABSOLUTE 0
.section .reloc, "a"
label1:
.long dummy-label1 // Page RVA
.long 10 // Block Size (2*4+2)
.word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy

View File

@ -1,63 +0,0 @@
OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
OUTPUT_ARCH(aarch64)
ENTRY(_start)
SECTIONS
{
.text 0x0 : {
_text = .;
*(.text.head)
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
. = ALIGN(16);
}
_etext = .;
_text_size = . - _text;
.dynamic : { *(.dynamic) }
.data : ALIGN(4096)
{
_data = .;
*(.sdata)
*(.data)
*(.data1)
*(.data.*)
*(.got.plt)
*(.got)
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
. = ALIGN(16);
_bss = .;
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
. = ALIGN(16);
_bss_end = .;
}
.rela.dyn : { *(.rela.dyn) }
.rela.plt : { *(.rela.plt) }
.rela.got : { *(.rela.got) }
.rela.data : { *(.rela.data) *(.rela.data*) }
. = ALIGN(512);
_edata = .;
_data_size = . - _data;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
. = ALIGN(4096);
.note.gnu.build-id : { *(.note.gnu.build-id) }
/DISCARD/ :
{
*(.rel.reloc)
*(.eh_frame)
*(.note.GNU-stack)
}
.comment 0 : { *(.comment) }
}

View File

@ -1,63 +0,0 @@
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
.text 0x0 : {
_text = .;
*(.text.head)
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
. = ALIGN(16);
}
_etext = .;
_text_size = . - _text;
.dynamic : { *(.dynamic) }
.data :
{
_data = .;
*(.sdata)
*(.data)
*(.data1)
*(.data.*)
*(.got.plt)
*(.got)
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
. = ALIGN(16);
_bss = .;
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
*(.bss.*)
*(COMMON)
. = ALIGN(16);
_bss_end = .;
}
.rel.dyn : { *(.rel.dyn) }
.rel.plt : { *(.rel.plt) }
.rel.got : { *(.rel.got) }
.rel.data : { *(.rel.data) *(.rel.data*) }
_edata = .;
_data_size = . - _etext;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
. = ALIGN(4096);
.note.gnu.build-id : { *(.note.gnu.build-id) }
/DISCARD/ :
{
*(.rel.reloc)
*(.eh_frame)
*(.note.GNU-stack)
}
.comment 0 : { *(.comment) }
}

View File

@ -1,86 +0,0 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SECTIONS
{
. = 0;
ImageBase = .;
/* .hash and/or .gnu.hash MUST come first! */
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
. = ALIGN(4096);
.text :
{
_text = .;
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
. = ALIGN(16);
}
_etext = .;
_text_size = . - _text;
. = ALIGN(4096);
.sdata :
{
_data = .;
*(.got.plt)
*(.got)
*(.srodata)
*(.sdata)
*(.sbss)
*(.scommon)
}
. = ALIGN(4096);
.data :
{
*(.rodata*)
*(.data)
*(.data1)
*(.data.*)
*(.sdata)
*(.got.plt)
*(.got)
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
}
.note.gnu.build-id : { *(.note.gnu.build-id) }
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.rel :
{
*(.rel.data)
*(.rel.data.*)
*(.rel.got)
*(.rel.stab)
*(.data.rel.ro.local)
*(.data.rel.local)
*(.data.rel.ro)
*(.data.rel*)
}
_edata = .;
_data_size = . - _etext;
. = ALIGN(4096);
.reloc : /* This is the PECOFF .reloc section! */
{
*(.reloc)
}
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
. = ALIGN(4096);
/DISCARD/ :
{
*(.rel.reloc)
*(.eh_frame)
*(.note.GNU-stack)
}
.comment 0 : { *(.comment) }
}

View File

@ -1,86 +0,0 @@
OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd")
OUTPUT_ARCH(i386)
ENTRY(_start)
SECTIONS
{
. = 0;
ImageBase = .;
/* .hash and/or .gnu.hash MUST come first! */
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
. = ALIGN(4096);
.text :
{
_text = .;
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
. = ALIGN(16);
}
_etext = .;
_text_size = . - _text;
. = ALIGN(4096);
.sdata :
{
_data = .;
*(.got.plt)
*(.got)
*(.srodata)
*(.sdata)
*(.sbss)
*(.scommon)
}
. = ALIGN(4096);
.data :
{
*(.rodata*)
*(.data)
*(.data1)
*(.data.*)
*(.sdata)
*(.got.plt)
*(.got)
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
}
.note.gnu.build-id : { *(.note.gnu.build-id) }
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.rel :
{
*(.rel.data)
*(.rel.data.*)
*(.rel.got)
*(.rel.stab)
*(.data.rel.ro.local)
*(.data.rel.local)
*(.data.rel.ro)
*(.data.rel*)
}
_edata = .;
_data_size = . - _etext;
. = ALIGN(4096);
.reloc : /* This is the PECOFF .reloc section! */
{
*(.reloc)
}
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
. = ALIGN(4096);
/DISCARD/ :
{
*(.rel.reloc)
*(.eh_frame)
*(.note.GNU-stack)
}
.comment 0 : { *(.comment) }
}

View File

@ -1,81 +0,0 @@
OUTPUT_FORMAT("elf64-ia64-little")
OUTPUT_ARCH(ia64)
ENTRY(_start_plabel)
SECTIONS
{
. = 0;
ImageBase = .;
/* .hash and/or .gnu.hash MUST come first! */
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
. = ALIGN(4096);
.text :
{
_text = .;
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
. = ALIGN(16);
}
_etext = .;
_text_size = . - _text;
. = ALIGN(4096);
__gp = ALIGN (8) + 0x200000;
.sdata :
{
_data = .;
*(.got.plt)
*(.got)
*(.srodata)
*(.sdata)
*(.sbss)
*(.scommon)
}
. = ALIGN(4096);
.data :
{
*(.rodata*)
*(.ctors)
*(.data*)
*(.gnu.linkonce.d*)
*(.plabel) /* data whose relocs we want to ignore */
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
*(.dynbss)
*(.bss)
*(COMMON)
}
.note.gnu.build-id : { *(.note.gnu.build-id) }
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.rela :
{
*(.rela.text)
*(.rela.data*)
*(.rela.sdata)
*(.rela.got)
*(.rela.gnu.linkonce.d*)
*(.rela.stab)
*(.rela.ctors)
}
_edata = .;
_data_size = . - _etext;
. = ALIGN(4096);
.reloc : /* This is the PECOFF .reloc section! */
{
*(.reloc)
}
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
/DISCARD/ :
{
*(.rela.plabel)
*(.rela.reloc)
*(.IA_64.unwind*)
*(.IA64.unwind*)
}
}

View File

@ -1,64 +0,0 @@
OUTPUT_FORMAT("elf64-tradlittlemips", "elf64-tradbigmips", "elf64-tradlittlemips")
OUTPUT_ARCH(mips)
ENTRY(_start)
SECTIONS
{
.text 0x0 : {
_text = .;
*(.text.head)
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
. = ALIGN(16);
}
_etext = .;
_text_size = . - _text;
.dynamic : { *(.dynamic) }
.data :
{
_data = .;
*(.sdata)
*(.data)
*(.data1)
*(.data.*)
*(.got.plt)
HIDDEN (_gp = ALIGN (16) + 0x7ff0);
*(.got)
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
. = ALIGN(16);
_bss = .;
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
. = ALIGN(16);
_bss_end = .;
}
.rel.dyn : { *(.rel.dyn) }
.rel.plt : { *(.rel.plt) }
.rel.got : { *(.rel.got) }
.rel.data : { *(.rel.data) *(.rel.data*) }
_edata = .;
_data_size = . - _etext;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
. = ALIGN(4096);
.note.gnu.build-id : { *(.note.gnu.build-id) }
/DISCARD/ :
{
*(.rel.reloc)
*(.eh_frame)
*(.MIPS.abiflags)
*(.note.GNU-stack)
}
.comment 0 : { *(.comment) }
}

View File

@ -1,76 +0,0 @@
/* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
SECTIONS
{
. = 0;
ImageBase = .;
/* .hash and/or .gnu.hash MUST come first! */
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
. = ALIGN(4096);
.eh_frame :
{
*(.eh_frame)
}
. = ALIGN(4096);
.text :
{
_text = .;
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
. = ALIGN(16);
}
_etext = .;
_text_size = . - _text;
. = ALIGN(4096);
.reloc :
{
*(.reloc)
}
. = ALIGN(4096);
.data :
{
_data = .;
*(.rodata*)
*(.got.plt)
*(.got)
*(.data*)
*(.sdata)
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
*(.rel.local)
}
.note.gnu.build-id : { *(.note.gnu.build-id) }
_edata = .;
_data_size = . - _etext;
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.rela :
{
*(.rela.data*)
*(.rela.got)
*(.rela.stab)
}
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
. = ALIGN(4096);
.ignored.reloc :
{
*(.rela.reloc)
*(.eh_frame)
*(.note.GNU-stack)
}
.comment 0 : { *(.comment) }
}

View File

@ -1,70 +0,0 @@
/* Same as elf_x86_64_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
SECTIONS
{
. = 0;
ImageBase = .;
/* .hash and/or .gnu.hash MUST come first! */
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
. = ALIGN(4096);
.eh_frame :
{
*(.eh_frame)
}
. = ALIGN(4096);
.text :
{
_text = .;
*(.text)
. = ALIGN(16);
}
_etext = .;
_text_size = . - _text;
.reloc :
{
*(.reloc)
}
. = ALIGN(4096);
.data :
{
_data = .;
*(.rodata*)
*(.got.plt)
*(.got)
*(.data*)
*(.sdata)
/* the EFI loader doesn't seem to like a .bss section, so we stick
it all into .data: */
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
*(.rel.local)
}
.note.gnu.build-id : { *(.note.gnu.build-id) }
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.rela :
{
*(.rela.data*)
*(.rela.got)
*(.rela.stab)
}
_edata = .;
_data_size = . - _etext;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
. = ALIGN(4096);
.ignored.reloc :
{
*(.rela.reloc)
}
}

View File

@ -1,97 +0,0 @@
/* reloc_aarch64.c - position independent x86 ELF shared object relocator
Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
Copyright (C) 1999 Hewlett-Packard Co.
Contributed by David Mosberger <davidm@hpl.hp.com>.
All rights reserved.
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.
* Neither the name of Hewlett-Packard Co. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
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 OWNER OR CONTRIBUTORS
BE LIABLE FOR ANYDIRECT, 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 <efi.h>
#include <efilib.h>
#include <elf.h>
EFI_STATUS _relocate (long ldbase, Elf64_Dyn *dyn,
EFI_HANDLE image EFI_UNUSED,
EFI_SYSTEM_TABLE *systab EFI_UNUSED)
{
long relsz = 0, relent = 0;
Elf64_Rela *rel = 0;
unsigned long *addr;
int i;
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
switch (dyn[i].d_tag) {
case DT_RELA:
rel = (Elf64_Rela*)
((unsigned long)dyn[i].d_un.d_ptr
+ ldbase);
break;
case DT_RELASZ:
relsz = dyn[i].d_un.d_val;
break;
case DT_RELAENT:
relent = dyn[i].d_un.d_val;
break;
default:
break;
}
}
if (!rel && relent == 0)
return EFI_SUCCESS;
if (!rel || relent == 0)
return EFI_LOAD_ERROR;
while (relsz > 0) {
/* apply the relocs */
switch (ELF64_R_TYPE (rel->r_info)) {
case R_AARCH64_NONE:
break;
case R_AARCH64_RELATIVE:
addr = (unsigned long *)
(ldbase + rel->r_offset);
*addr = ldbase + rel->r_addend;
break;
default:
break;
}
rel = (Elf64_Rela*) ((char *) rel + relent);
relsz -= relent;
}
return EFI_SUCCESS;
}

View File

@ -1,97 +0,0 @@
/* reloc_arm.c - position independent x86 ELF shared object relocator
Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
Copyright (C) 1999 Hewlett-Packard Co.
Contributed by David Mosberger <davidm@hpl.hp.com>.
All rights reserved.
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.
* Neither the name of Hewlett-Packard Co. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
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 OWNER OR CONTRIBUTORS
BE LIABLE FOR ANYDIRECT, 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 <efi.h>
#include <efilib.h>
#include <elf.h>
EFI_STATUS _relocate (long ldbase, Elf32_Dyn *dyn,
EFI_HANDLE image EFI_UNUSED,
EFI_SYSTEM_TABLE *systab EFI_UNUSED)
{
long relsz = 0, relent = 0;
Elf32_Rel *rel = 0;
unsigned long *addr;
int i;
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
switch (dyn[i].d_tag) {
case DT_REL:
rel = (Elf32_Rel*)
((unsigned long)dyn[i].d_un.d_ptr
+ ldbase);
break;
case DT_RELSZ:
relsz = dyn[i].d_un.d_val;
break;
case DT_RELENT:
relent = dyn[i].d_un.d_val;
break;
default:
break;
}
}
if (!rel && relent == 0)
return EFI_SUCCESS;
if (!rel || relent == 0)
return EFI_LOAD_ERROR;
while (relsz > 0) {
/* apply the relocs */
switch (ELF32_R_TYPE (rel->r_info)) {
case R_ARM_NONE:
break;
case R_ARM_RELATIVE:
addr = (unsigned long *)
(ldbase + rel->r_offset);
*addr += ldbase;
break;
default:
break;
}
rel = (Elf32_Rel*) ((char *) rel + relent);
relsz -= relent;
}
return EFI_SUCCESS;
}

View File

@ -1,99 +0,0 @@
/* reloc_ia32.c - position independent x86 ELF shared object relocator
Copyright (C) 1999 Hewlett-Packard Co.
Contributed by David Mosberger <davidm@hpl.hp.com>.
All rights reserved.
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.
* Neither the name of Hewlett-Packard Co. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
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 OWNER OR CONTRIBUTORS
BE LIABLE FOR ANYDIRECT, 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 <efi.h>
#include <efilib.h>
#include <elf.h>
EFI_STATUS _relocate (long ldbase, Elf32_Dyn *dyn,
EFI_HANDLE image EFI_UNUSED,
EFI_SYSTEM_TABLE *systab EFI_UNUSED)
{
long relsz = 0, relent = 0;
Elf32_Rel *rel = 0;
unsigned long *addr;
int i;
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
switch (dyn[i].d_tag) {
case DT_REL:
rel = (Elf32_Rel*)
((unsigned long)dyn[i].d_un.d_ptr
+ ldbase);
break;
case DT_RELSZ:
relsz = dyn[i].d_un.d_val;
break;
case DT_RELENT:
relent = dyn[i].d_un.d_val;
break;
case DT_RELA:
break;
default:
break;
}
}
if (!rel && relent == 0)
return EFI_SUCCESS;
if (!rel || relent == 0)
return EFI_LOAD_ERROR;
while (relsz > 0) {
/* apply the relocs */
switch (ELF32_R_TYPE (rel->r_info)) {
case R_386_NONE:
break;
case R_386_RELATIVE:
addr = (unsigned long *)
(ldbase + rel->r_offset);
*addr += ldbase;
break;
default:
break;
}
rel = (Elf32_Rel*) ((char *) rel + relent);
relsz -= relent;
}
return EFI_SUCCESS;
}

View File

@ -1,227 +0,0 @@
/* reloc_ia64.S - position independent IA-64 ELF shared object relocator
Copyright (C) 1999 Hewlett-Packard Co.
Contributed by David Mosberger <davidm@hpl.hp.com>.
All rights reserved.
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.
* Neither the name of Hewlett-Packard Co. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
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 OWNER OR CONTRIBUTORS
BE LIABLE FOR ANYDIRECT, 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.
*/
/*
* This is written in assembly because the entire code needs to be position
* independent. Note that the compiler does not generate code that's position
* independent by itself because it relies on the global offset table being
* relocated.
*/
.text
.psr abi64
.psr lsb
.lsb
/*
* This constant determines how many R_IA64_FPTR64LSB relocations we
* can deal with. If you get EFI_BUFFER_TOO_SMALL errors, you may
* need to increase this number.
*/
#define MAX_FUNCTION_DESCRIPTORS 750
#define ST_VALUE_OFF 8 /* offset of st_value in elf sym */
#define EFI_SUCCESS 0
#define EFI_LOAD_ERROR 1
#define EFI_BUFFER_TOO_SMALL 5
#define DT_NULL 0 /* Marks end of dynamic section */
#define DT_RELA 7 /* Address of Rela relocs */
#define DT_RELASZ 8 /* Total size of Rela relocs */
#define DT_RELAENT 9 /* Size of one Rela reloc */
#define DT_SYMTAB 6 /* Address of symbol table */
#define DT_SYMENT 11 /* Size of one symbol table entry */
#define R_IA64_NONE 0
#define R_IA64_REL64MSB 0x6e
#define R_IA64_REL64LSB 0x6f
#define R_IA64_DIR64MSB 0x26
#define R_IA64_DIR64LSB 0x27
#define R_IA64_FPTR64MSB 0x46
#define R_IA64_FPTR64LSB 0x47
#define ldbase in0 /* load address (address of .text) */
#define dyn in1 /* address of _DYNAMIC */
#define d_tag r16
#define d_val r17
#define rela r18
#define relasz r19
#define relaent r20
#define addr r21
#define r_info r22
#define r_offset r23
#define r_addend r24
#define r_type r25
#define r_sym r25 /* alias of r_type ! */
#define fptr r26
#define fptr_limit r27
#define symtab f8
#define syment f9
#define ftmp f10
#define target r16
#define val r17
#define NLOC 0
#define Pnull p6
#define Prela p7
#define Prelasz p8
#define Prelaent p9
#define Psymtab p10
#define Psyment p11
#define Pnone p6
#define Prel p7
#define Pfptr p8
#define Pmore p6
#define Poom p6 /* out-of-memory */
.global _relocate
.proc _relocate
_relocate:
alloc r2=ar.pfs,2,0,0,0
movl fptr = @gprel(fptr_mem_base)
;;
add fptr = fptr, gp
movl fptr_limit = @gprel(fptr_mem_limit)
;;
add fptr_limit = fptr_limit, gp
search_dynamic:
ld8 d_tag = [dyn],8
;;
ld8 d_val = [dyn],8
cmp.eq Pnull,p0 = DT_NULL,d_tag
(Pnull) br.cond.sptk.few apply_relocs
cmp.eq Prela,p0 = DT_RELA,d_tag
cmp.eq Prelasz,p0 = DT_RELASZ,d_tag
cmp.eq Psymtab,p0 = DT_SYMTAB,d_tag
cmp.eq Psyment,p0 = DT_SYMENT,d_tag
cmp.eq Prelaent,p0 = DT_RELAENT,d_tag
;;
(Prela) add rela = d_val, ldbase
(Prelasz) mov relasz = d_val
(Prelaent) mov relaent = d_val
(Psymtab) add val = d_val, ldbase
;;
(Psyment) setf.sig syment = d_val
;;
(Psymtab) setf.sig symtab = val
br.sptk.few search_dynamic
apply_loop:
ld8 r_offset = [rela]
add addr = 8,rela
sub relasz = relasz,relaent
;;
ld8 r_info = [addr],8
;;
ld8 r_addend = [addr]
add target = ldbase, r_offset
add rela = rela,relaent
extr.u r_type = r_info, 0, 32
;;
cmp.eq Pnone,p0 = R_IA64_NONE,r_type
cmp.eq Prel,p0 = R_IA64_REL64LSB,r_type
cmp.eq Pfptr,p0 = R_IA64_FPTR64LSB,r_type
(Prel) br.cond.sptk.few apply_REL64
;;
cmp.eq Prel,p0 = R_IA64_DIR64LSB,r_type // treat DIR64 just like REL64
(Pnone) br.cond.sptk.few apply_relocs
(Prel) br.cond.sptk.few apply_REL64
(Pfptr) br.cond.sptk.few apply_FPTR64
mov r8 = EFI_LOAD_ERROR
br.ret.sptk.few rp
apply_relocs:
cmp.ltu Pmore,p0=0,relasz
(Pmore) br.cond.sptk.few apply_loop
mov r8 = EFI_SUCCESS
br.ret.sptk.few rp
apply_REL64:
ld8 val = [target]
;;
add val = val,ldbase
;;
st8 [target] = val
br.cond.sptk.few apply_relocs
// FPTR relocs are a bit more interesting: we need to lookup
// the symbol's value in symtab, allocate 16 bytes of memory,
// store the value in [target] in the first and the gp in the
// second dword.
apply_FPTR64:
st8 [target] = fptr
extr.u r_sym = r_info,32,32
add target = 8,fptr
;;
setf.sig ftmp = r_sym
mov r8=EFI_BUFFER_TOO_SMALL
;;
cmp.geu Poom,p0 = fptr,fptr_limit
xma.lu ftmp = ftmp,syment,symtab
(Poom) br.ret.sptk.few rp
;;
getf.sig addr = ftmp
st8 [target] = gp
;;
add addr = ST_VALUE_OFF, addr
;;
ld8 val = [addr]
;;
add val = val,ldbase
;;
st8 [fptr] = val,16
br.cond.sptk.few apply_relocs
.endp _relocate
.data
.align 16
fptr_mem_base:
.space MAX_FUNCTION_DESCRIPTORS*16
fptr_mem_limit:

View File

@ -1,115 +0,0 @@
/* reloc_mips64el.c - position independent MIPS64 ELF shared object relocator
Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
Copyright (C) 1999 Hewlett-Packard Co.
Contributed by David Mosberger <davidm@hpl.hp.com>.
Copyright (C) 2017 Lemote Co.
Contributed by Heiher <r@hev.cc>
All rights reserved.
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.
* Neither the name of Hewlett-Packard Co. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
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 OWNER OR CONTRIBUTORS
BE LIABLE FOR ANYDIRECT, 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 <efi.h>
#include <efilib.h>
#include <elf.h>
EFI_STATUS _relocate (long ldbase, Elf64_Dyn *dyn,
EFI_HANDLE image EFI_UNUSED,
EFI_SYSTEM_TABLE *systab EFI_UNUSED)
{
long relsz = 0, relent = 0, gotsz = 0;
Elf64_Rel *rel = 0;
unsigned long *addr = 0;
int i;
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
switch (dyn[i].d_tag) {
case DT_REL:
rel = (Elf64_Rel*)
((unsigned long)dyn[i].d_un.d_ptr
+ ldbase);
break;
case DT_RELSZ:
relsz = dyn[i].d_un.d_val;
break;
case DT_RELENT:
relent = dyn[i].d_un.d_val;
break;
case DT_PLTGOT:
addr = (unsigned long *)
((unsigned long)dyn[i].d_un.d_ptr
+ ldbase);
break;
case DT_MIPS_LOCAL_GOTNO:
gotsz = dyn[i].d_un.d_val;
break;
default:
break;
}
}
if ((!rel && relent == 0) && (!addr && gotsz == 0))
return EFI_SUCCESS;
if ((!rel && relent != 0) || (!addr && gotsz != 0))
return EFI_LOAD_ERROR;
while (gotsz > 0) {
*addr += ldbase;
addr += 1;
gotsz --;
}
while (relsz > 0) {
/* apply the relocs */
switch (ELF64_R_TYPE (swap_uint64 (rel->r_info))) {
case R_MIPS_NONE:
break;
case (R_MIPS_64 << 8) | R_MIPS_REL32:
addr = (unsigned long *)
(ldbase + rel->r_offset);
*addr += ldbase;
break;
default:
break;
}
rel = (Elf64_Rel*) ((char *) rel + relent);
relsz -= relent;
}
return EFI_SUCCESS;
}

View File

@ -1,98 +0,0 @@
/* reloc_x86_64.c - position independent x86_64 ELF shared object relocator
Copyright (C) 1999 Hewlett-Packard Co.
Contributed by David Mosberger <davidm@hpl.hp.com>.
Copyright (C) 2005 Intel Co.
Contributed by Fenghua Yu <fenghua.yu@intel.com>.
All rights reserved.
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.
* Neither the name of Hewlett-Packard Co. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
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 OWNER OR CONTRIBUTORS
BE LIABLE FOR ANYDIRECT, 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 <efi.h>
#include <efilib.h>
#include <elf.h>
EFI_STATUS _relocate (long ldbase, Elf64_Dyn *dyn,
EFI_HANDLE image EFI_UNUSED,
EFI_SYSTEM_TABLE *systab EFI_UNUSED)
{
long relsz = 0, relent = 0;
Elf64_Rel *rel = 0;
unsigned long *addr;
int i;
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
switch (dyn[i].d_tag) {
case DT_RELA:
rel = (Elf64_Rel*)
((unsigned long)dyn[i].d_un.d_ptr
+ ldbase);
break;
case DT_RELASZ:
relsz = dyn[i].d_un.d_val;
break;
case DT_RELAENT:
relent = dyn[i].d_un.d_val;
break;
default:
break;
}
}
if (!rel && relent == 0)
return EFI_SUCCESS;
if (!rel || relent == 0)
return EFI_LOAD_ERROR;
while (relsz > 0) {
/* apply the relocs */
switch (ELF64_R_TYPE (rel->r_info)) {
case R_X86_64_NONE:
break;
case R_X86_64_RELATIVE:
addr = (unsigned long *)
(ldbase + rel->r_offset);
*addr += ldbase;
break;
default:
break;
}
rel = (Elf64_Rel*) ((char *) rel + relent);
relsz -= relent;
}
return EFI_SUCCESS;
}

View File

@ -1,27 +0,0 @@
SRCDIR = .
VPATH = $(SRCDIR)
include $(SRCDIR)/../Make.defaults
TOPDIR = $(SRCDIR)/..
CDIR=$(TOPDIR)/..
all:
clean:
install:
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/protocol
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH)
$(INSTALL) -m 644 $(SRCDIR)/*.h $(INSTALLROOT)$(PREFIX)/include/efi
$(INSTALL) -m 644 $(SRCDIR)/protocol/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol
$(INSTALL) -m 644 $(SRCDIR)/$(ARCH)/*.h $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH)
ifeq ($(ARCH),ia64)
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/protocol/ia64
$(INSTALL) -m 644 $(SRCDIR)/protocol/ia64/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol/ia64
endif
include $(SRCDIR)/../Make.rules

View File

@ -1,156 +0,0 @@
/*
* Copright (C) 2014 - 2015 Linaro Ltd.
* Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
*
* 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 and this list of conditions, without modification.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version.
*/
#if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ))
// ANSI C 1999/2000 stdint.h 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 signed char int8_t; // unqualified 'char' is unsigned on ARM
#else
#include <stdint.h>
#endif
//
// Basic EFI types of various widths
//
#ifndef __WCHAR_TYPE__
# define __WCHAR_TYPE__ short
#endif
typedef uint64_t UINT64;
typedef int64_t INT64;
typedef uint32_t UINT32;
typedef int32_t INT32;
typedef uint16_t UINT16;
typedef int16_t INT16;
typedef uint8_t UINT8;
typedef int8_t INT8;
typedef __WCHAR_TYPE__ WCHAR;
#undef VOID
#define VOID void
typedef int64_t INTN;
typedef uint64_t UINTN;
#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() while (TRUE); // Make it hang on Bios[Dbg]32
//
// Pointers must be aligned to these address to function
//
#define MIN_ALIGNMENT_SIZE 8
#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
//
#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options
#define EFIAPI // Substitute expresion to force C calling convention
#endif
#define BOOTSERVICE
#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 __sync_synchronize
//
// When build similiar to FW, then link everything together as
// one big module. For the MSVC toolchain, we simply tell the
// linker what our driver init function is using /ENTRY.
//
#if defined(_MSC_EXTENSIONS)
#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
__pragma(comment(linker, "/ENTRY:" # InitFunction))
#else
#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
UINTN \
InitializeDriver ( \
VOID *ImageHandle, \
VOID *SystemTable \
) \
{ \
return InitFunction(ImageHandle, \
SystemTable); \
} \
\
EFI_STATUS efi_main( \
EFI_HANDLE image, \
EFI_SYSTEM_TABLE *systab \
) __attribute__((weak, \
alias ("InitializeDriver")));
#endif
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
(_if)->LoadInternal(type, name, entry)
//
// Some compilers don't support the forward reference construct:
// typedef struct XXXXX
//
// The following macro provide a workaround for such cases.
#define INTERFACE_DECL(x) struct x
#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
#define EFI_FUNCTION

View File

@ -1,25 +0,0 @@
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
efilibplat.h
Abstract:
EFI to compile bindings
Revision History
--*/
VOID
InitializeLibPlatform (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);

View File

@ -1,33 +0,0 @@
#ifndef GNU_EFI_AARCH64_SETJMP_H
#define GNU_EFI_AARCH64_SETJMP_H
#define JMPBUF_ALIGN 8
typedef struct {
/* GP regs */
UINT64 X19;
UINT64 X20;
UINT64 X21;
UINT64 X22;
UINT64 X23;
UINT64 X24;
UINT64 X25;
UINT64 X26;
UINT64 X27;
UINT64 X28;
UINT64 FP;
UINT64 LR;
UINT64 IP0;
/* FP regs */
UINT64 D8;
UINT64 D9;
UINT64 D10;
UINT64 D11;
UINT64 D12;
UINT64 D13;
UINT64 D14;
UINT64 D15;
} ALIGN(JMPBUF_ALIGN) jmp_buf;
#endif /* GNU_EFI_AARCH64_SETJMP_H */

View File

@ -1,164 +0,0 @@
/*
* Copright (C) 2014 - 2015 Linaro Ltd.
* Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
*
* 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 and this list of conditions, without modification.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version.
*/
#if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ))
// ANSI C 1999/2000 stdint.h 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 signed char int8_t; // unqualified 'char' is unsigned on ARM
#else
#include <stdint.h>
#endif
/*
* This prevents GCC from emitting GOT based relocations, and use R_ARM_REL32
* relative relocations instead, which are more suitable for static binaries.
*/
#ifdef __GNUC__
#pragma GCC visibility push (hidden)
#endif
//
// Basic EFI types of various widths
//
#ifndef __WCHAR_TYPE__
# define __WCHAR_TYPE__ short
#endif
typedef uint64_t UINT64;
typedef int64_t INT64;
typedef uint32_t UINT32;
typedef int32_t INT32;
typedef uint16_t UINT16;
typedef int16_t INT16;
typedef uint8_t UINT8;
typedef int8_t INT8;
typedef __WCHAR_TYPE__ WCHAR;
#undef VOID
#define VOID void
typedef int32_t INTN;
typedef uint32_t UINTN;
#define EFIERR(a) (0x80000000 | a)
#define EFI_ERROR_MASK 0x80000000
#define EFIERR_OEM(a) (0xc0000000 | a)
#define BAD_POINTER 0xFBFBFBFB
#define MAX_ADDRESS 0xFFFFFFFF
#define BREAKPOINT() while (TRUE);
//
// 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
//
#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options
#define EFIAPI // Substitute expresion to force C calling convention
#endif
#define BOOTSERVICE
#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 __sync_synchronize
//
// When build similiar to FW, then link everything together as
// one big module. For the MSVC toolchain, we simply tell the
// linker what our driver init function is using /ENTRY.
//
#if defined(_MSC_EXTENSIONS)
#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
__pragma(comment(linker, "/ENTRY:" # InitFunction))
#else
#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
UINTN \
InitializeDriver ( \
VOID *ImageHandle, \
VOID *SystemTable \
) \
{ \
return InitFunction(ImageHandle, \
SystemTable); \
} \
\
EFI_STATUS efi_main( \
EFI_HANDLE image, \
EFI_SYSTEM_TABLE *systab \
) __attribute__((weak, \
alias ("InitializeDriver")));
#endif
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
(_if)->LoadInternal(type, name, entry)
//
// Some compilers don't support the forward reference construct:
// typedef struct XXXXX
//
// The following macro provide a workaround for such cases.
#define INTERFACE_DECL(x) struct x
#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
#define EFI_FUNCTION

View File

@ -1,25 +0,0 @@
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
efilibplat.h
Abstract:
EFI to compile bindings
Revision History
--*/
VOID
InitializeLibPlatform (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);

View File

@ -1,21 +0,0 @@
#ifndef GNU_EFI_ARM_SETJMP_H
#define GNU_EFI_ARM_SETJMP_H
#define JMPBUF_ALIGN 4
typedef struct {
UINT32 R3; // A copy of R13
UINT32 R4;
UINT32 R5;
UINT32 R6;
UINT32 R7;
UINT32 R8;
UINT32 R9;
UINT32 R10;
UINT32 R11;
UINT32 R12;
UINT32 R13;
UINT32 R14;
} ALIGN(JMPBUF_ALIGN) jmp_buf;
#endif /* GNU_EFI_ARM_SETJMP_H */

View File

@ -1,62 +0,0 @@
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
efi.h
Abstract:
Public EFI header files
Revision History
--*/
// Add a predefined macro to detect usage of the library
#ifndef _GNU_EFI
#define _GNU_EFI
#endif
//
// 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 12
#define EFI_FIRMWARE_MINOR_REVISION 33
#define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) | (EFI_FIRMWARE_MINOR_REVISION))
#include "efibind.h"
#include "eficompiler.h"
#include "efidef.h"
#include "efidevp.h"
#include "efipciio.h"
#include "efiprot.h"
#include "eficon.h"
#include "efiser.h"
#include "efi_nii.h"
#include "efipxebc.h"
#include "efinet.h"
#include "efiapi.h"
#include "efifs.h"
#include "efierr.h"
#include "efiui.h"
#include "efiip.h"
#include "efiudp.h"
#include "efitcp.h"
#include "efipoint.h"
#include "efisetjmp.h"
#endif

View File

@ -1,78 +0,0 @@
#ifndef _EFI_NII_H
#define _EFI_NII_H
/*++
Copyright (c) 2000 Intel Corporation
Module name:
efi_nii.h
Abstract:
Revision history:
2000-Feb-18 M(f)J GUID updated.
Structure order changed for machine word alignment.
Added StringId[4] to structure.
2000-Feb-14 M(f)J Genesis.
--*/
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID \
{ 0xE18541CD, 0xF755, 0x4f73, {0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29} }
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION 0x00010000
#define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION
typedef enum {
EfiNetworkInterfaceUndi = 1
} EFI_NETWORK_INTERFACE_TYPE;
typedef struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL {
UINT64 Revision;
// Revision of the network interface identifier protocol interface.
UINT64 ID;
// Address of the first byte of the identifying structure for this
// network interface. This is set to zero if there is no structure.
//
// For PXE/UNDI this is the first byte of the !PXE structure.
UINT64 ImageAddr;
// Address of the UNrelocated driver/ROM image. This is set
// to zero if there is no driver/ROM image.
//
// For 16-bit UNDI, this is the first byte of the option ROM in
// upper memory.
//
// For 32/64-bit S/W UNDI, this is the first byte of the EFI ROM
// image.
//
// For H/W UNDI, this is set to zero.
UINT32 ImageSize;
// Size of the UNrelocated driver/ROM image of this network interface.
// This is set to zero if there is no driver/ROM image.
CHAR8 StringId[4];
// 4 char ASCII string to go in class identifier (option 60) in DHCP
// and Boot Server discover packets.
// For EfiNetworkInterfaceUndi this field is "UNDI".
// For EfiNetworkInterfaceSnp this field is "SNPN".
UINT8 Type;
UINT8 MajorVer;
UINT8 MinorVer;
// Information to be placed into the PXE DHCP and Discover packets.
// This is the network interface type and version number that will
// be placed into DHCP option 94 (client network interface identifier).
BOOLEAN Ipv6Supported;
UINT8 IfNum; // interface number to be used with pxeid structure
} EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL, EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE;
// Note: Because it conflicted with the EDK2 struct name, the
// 'EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL' GUID definition,
// from older versions of gnu-efi, is now obsoleted.
// Use 'EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID' instead.
#endif // _EFI_NII_H

File diff suppressed because it is too large Load Diff

View File

@ -1,967 +0,0 @@
#ifndef _EFI_API_H
#define _EFI_API_H
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
efiapi.h
Abstract:
Global EFI runtime & boot service interfaces
Revision History
--*/
//
// EFI Specification Revision
//
#define EFI_SPECIFICATION_MAJOR_REVISION 1
#define EFI_SPECIFICATION_MINOR_REVISION 02
//
// Declare forward referenced data structures
//
INTERFACE_DECL(_EFI_SYSTEM_TABLE);
//
// EFI Memory
//
typedef
EFI_STATUS
(EFIAPI *EFI_ALLOCATE_PAGES) (
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN NoPages,
OUT EFI_PHYSICAL_ADDRESS *Memory
);
typedef
EFI_STATUS
(EFIAPI *EFI_FREE_PAGES) (
IN EFI_PHYSICAL_ADDRESS Memory,
IN UINTN NoPages
);
typedef
EFI_STATUS
(EFIAPI *EFI_GET_MEMORY_MAP) (
IN OUT UINTN *MemoryMapSize,
IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,
OUT UINTN *MapKey,
OUT UINTN *DescriptorSize,
OUT UINT32 *DescriptorVersion
);
#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
typedef
EFI_STATUS
(EFIAPI *EFI_ALLOCATE_POOL) (
IN EFI_MEMORY_TYPE PoolType,
IN UINTN Size,
OUT VOID **Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_FREE_POOL) (
IN VOID *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (
IN UINTN MemoryMapSize,
IN UINTN DescriptorSize,
IN UINT32 DescriptorVersion,
IN EFI_MEMORY_DESCRIPTOR *VirtualMap
);
#define EFI_OPTIONAL_PTR 0x00000001
#define EFI_INTERNAL_FNC 0x00000002 // Pointer to internal runtime fnc
#define EFI_INTERNAL_PTR 0x00000004 // Pointer to internal runtime data
typedef
EFI_STATUS
(EFIAPI *EFI_CONVERT_POINTER) (
IN UINTN DebugDisposition,
IN OUT VOID **Address
);
//
// EFI Events
//
#define EVT_TIMER 0x80000000
#define EVT_RUNTIME 0x40000000
#define EVT_RUNTIME_CONTEXT 0x20000000
#define EVT_NOTIFY_WAIT 0x00000100
#define EVT_NOTIFY_SIGNAL 0x00000200
#define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201
#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
#define EVT_EFI_SIGNAL_MASK 0x000000FF
#define EVT_EFI_SIGNAL_MAX 4
#define EFI_EVENT_TIMER EVT_TIMER
#define EFI_EVENT_RUNTIME EVT_RUNTIME
#define EFI_EVENT_RUNTIME_CONTEXT EVT_RUNTIME_CONTEXT
#define EFI_EVENT_NOTIFY_WAIT EVT_NOTIFY_WAIT
#define EFI_EVENT_NOTIFY_SIGNAL EVT_NOTIFY_SIGNAL
#define EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES EVT_SIGNAL_EXIT_BOOT_SERVICES
#define EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
#define EFI_EVENT_EFI_SIGNAL_MASK EVT_EFI_SIGNAL_MASK
#define EFI_EVENT_EFI_SIGNAL_MAX EVT_EFI_SIGNAL_MAX
typedef
VOID
(EFIAPI *EFI_EVENT_NOTIFY) (
IN EFI_EVENT Event,
IN VOID *Context
);
typedef
EFI_STATUS
(EFIAPI *EFI_CREATE_EVENT) (
IN UINT32 Type,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction,
IN VOID *NotifyContext,
OUT EFI_EVENT *Event
);
typedef enum {
TimerCancel,
TimerPeriodic,
TimerRelative,
TimerTypeMax
} EFI_TIMER_DELAY;
typedef
EFI_STATUS
(EFIAPI *EFI_SET_TIMER) (
IN EFI_EVENT Event,
IN EFI_TIMER_DELAY Type,
IN UINT64 TriggerTime
);
typedef
EFI_STATUS
(EFIAPI *EFI_SIGNAL_EVENT) (
IN EFI_EVENT Event
);
typedef
EFI_STATUS
(EFIAPI *EFI_WAIT_FOR_EVENT) (
IN UINTN NumberOfEvents,
IN EFI_EVENT *Event,
OUT UINTN *Index
);
typedef
EFI_STATUS
(EFIAPI *EFI_CLOSE_EVENT) (
IN EFI_EVENT Event
);
typedef
EFI_STATUS
(EFIAPI *EFI_CHECK_EVENT) (
IN EFI_EVENT Event
);
//
// Task priority level
//
#define TPL_APPLICATION 4
#define TPL_CALLBACK 8
#define TPL_NOTIFY 16
#define TPL_HIGH_LEVEL 31
#define EFI_TPL_APPLICATION TPL_APPLICATION
#define EFI_TPL_CALLBACK TPL_CALLBACK
#define EFI_TPL_NOTIFY TPL_NOTIFY
#define EFI_TPL_HIGH_LEVEL TPL_HIGH_LEVEL
typedef
EFI_TPL
(EFIAPI *EFI_RAISE_TPL) (
IN EFI_TPL NewTpl
);
typedef
VOID
(EFIAPI *EFI_RESTORE_TPL) (
IN EFI_TPL OldTpl
);
//
// EFI platform varibles
//
#define EFI_GLOBAL_VARIABLE \
{ 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} }
// Variable attributes
#define EFI_VARIABLE_NON_VOLATILE 0x00000001
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008
#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010
#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020
#define EFI_VARIABLE_APPEND_WRITE 0x00000040
// Variable size limitation
#define EFI_MAXIMUM_VARIABLE_SIZE 1024
typedef
EFI_STATUS
(EFIAPI *EFI_GET_VARIABLE) (
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
OUT UINT32 *Attributes OPTIONAL,
IN OUT UINTN *DataSize,
OUT VOID *Data
);
typedef
EFI_STATUS
(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (
IN OUT UINTN *VariableNameSize,
IN OUT CHAR16 *VariableName,
IN OUT EFI_GUID *VendorGuid
);
typedef
EFI_STATUS
(EFIAPI *EFI_SET_VARIABLE) (
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
);
//
// EFI Time
//
typedef struct {
UINT32 Resolution; // 1e-6 parts per million
UINT32 Accuracy; // hertz
BOOLEAN SetsToZero; // Set clears sub-second time
} EFI_TIME_CAPABILITIES;
typedef
EFI_STATUS
(EFIAPI *EFI_GET_TIME) (
OUT EFI_TIME *Time,
OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_SET_TIME) (
IN EFI_TIME *Time
);
typedef
EFI_STATUS
(EFIAPI *EFI_GET_WAKEUP_TIME) (
OUT BOOLEAN *Enabled,
OUT BOOLEAN *Pending,
OUT EFI_TIME *Time
);
typedef
EFI_STATUS
(EFIAPI *EFI_SET_WAKEUP_TIME) (
IN BOOLEAN Enable,
IN EFI_TIME *Time OPTIONAL
);
//
// Image functions
//
// PE32+ Subsystem type for EFI images
#if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION)
#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
#endif
// PE32+ Machine type for EFI images
#if !defined(EFI_IMAGE_MACHINE_IA32)
#define EFI_IMAGE_MACHINE_IA32 0x014c
#endif
#if !defined(EFI_IMAGE_MACHINE_IA64)
#define EFI_IMAGE_MACHINE_IA64 0x0200
#endif
#if !defined(EFI_IMAGE_MACHINE_EBC)
#define EFI_IMAGE_MACHINE_EBC 0x0EBC
#endif
#if !defined(EFI_IMAGE_MACHINE_X64)
#define EFI_IMAGE_MACHINE_X64 0x8664
#endif
#if !defined(EFI_IMAGE_MACHINE_ARMTHUMB_MIXED)
#define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2
#endif
#if !defined(EFI_IMAGE_MACHINE_AARCH64)
#define EFI_IMAGE_MACHINE_AARCH64 0xAA64
#endif
// Image Entry prototype
typedef
EFI_STATUS
(EFIAPI *EFI_IMAGE_ENTRY_POINT) (
IN EFI_HANDLE ImageHandle,
IN struct _EFI_SYSTEM_TABLE *SystemTable
);
typedef
EFI_STATUS
(EFIAPI *EFI_IMAGE_LOAD) (
IN BOOLEAN BootPolicy,
IN EFI_HANDLE ParentImageHandle,
IN EFI_DEVICE_PATH *FilePath,
IN VOID *SourceBuffer OPTIONAL,
IN UINTN SourceSize,
OUT EFI_HANDLE *ImageHandle
);
typedef
EFI_STATUS
(EFIAPI *EFI_IMAGE_START) (
IN EFI_HANDLE ImageHandle,
OUT UINTN *ExitDataSize,
OUT CHAR16 **ExitData OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_EXIT) (
IN EFI_HANDLE ImageHandle,
IN EFI_STATUS ExitStatus,
IN UINTN ExitDataSize,
IN CHAR16 *ExitData OPTIONAL
);
// Image handle
/*#define LOADED_IMAGE_PROTOCOL \
{ 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
#define EFI_IMAGE_INFORMATION_REVISION 0x1000
typedef struct {
UINT32 Revision;
EFI_HANDLE ParentHandle;
struct _EFI_SYSTEM_TABLE *SystemTable;
// Source location of image
EFI_HANDLE DeviceHandle;
EFI_DEVICE_PATH *FilePath;
VOID *Reserved;
// Images load options
UINT32 LoadOptionsSize;
VOID *LoadOptions;
// Location of where image was loaded
VOID *ImageBase;
UINT64 ImageSize;
EFI_MEMORY_TYPE ImageCodeType;
EFI_MEMORY_TYPE ImageDataType;
// If the driver image supports a dynamic unload request
EFI_IMAGE_UNLOAD Unload;
} EFI_LOADED_IMAGE;*/
typedef
EFI_STATUS
(EFIAPI *EFI_EXIT_BOOT_SERVICES) (
IN EFI_HANDLE ImageHandle,
IN UINTN MapKey
);
//
// Misc
//
typedef
EFI_STATUS
(EFIAPI *EFI_STALL) (
IN UINTN Microseconds
);
typedef
EFI_STATUS
(EFIAPI *EFI_SET_WATCHDOG_TIMER) (
IN UINTN Timeout,
IN UINT64 WatchdogCode,
IN UINTN DataSize,
IN CHAR16 *WatchdogData OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_CONNECT_CONTROLLER) (
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE *DriverImageHandle OPTIONAL,
IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL,
IN BOOLEAN Recursive
);
typedef
EFI_STATUS
(EFIAPI *EFI_DISCONNECT_CONTROLLER) (
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE DriverImageHandle OPTIONAL,
IN EFI_HANDLE ChildHandle OPTIONAL
);
#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
typedef
EFI_STATUS
(EFIAPI *EFI_OPEN_PROTOCOL) (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
OUT VOID **Interface OPTIONAL,
IN EFI_HANDLE AgentHandle,
IN EFI_HANDLE ControllerHandle,
IN UINT32 Attributes
);
typedef
EFI_STATUS
(EFIAPI *EFI_CLOSE_PROTOCOL) (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
IN EFI_HANDLE AgentHandle,
IN EFI_HANDLE ControllerHandle
);
typedef struct {
EFI_HANDLE AgentHandle;
EFI_HANDLE ControllerHandle;
UINT32 Attributes;
UINT32 OpenCount;
} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
typedef
EFI_STATUS
(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
OUT UINTN *EntryCount
);
typedef
EFI_STATUS
(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
IN EFI_HANDLE Handle,
OUT EFI_GUID ***ProtocolBuffer,
OUT UINTN *ProtocolBufferCount
);
typedef enum {
AllHandles,
ByRegisterNotify,
ByProtocol
} EFI_LOCATE_SEARCH_TYPE;
typedef
EFI_STATUS
(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *NoHandles,
OUT EFI_HANDLE **Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_LOCATE_PROTOCOL) (
IN EFI_GUID *Protocol,
IN VOID *Registration OPTIONAL,
OUT VOID **Interface
);
typedef
EFI_STATUS
(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
IN OUT EFI_HANDLE *Handle,
...
);
typedef
EFI_STATUS
(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
IN OUT EFI_HANDLE Handle,
...
);
typedef
EFI_STATUS
(EFIAPI *EFI_CALCULATE_CRC32) (
IN VOID *Data,
IN UINTN DataSize,
OUT UINT32 *Crc32
);
typedef
VOID
(EFIAPI *EFI_COPY_MEM) (
IN VOID *Destination,
IN VOID *Source,
IN UINTN Length
);
typedef
VOID
(EFIAPI *EFI_SET_MEM) (
IN VOID *Buffer,
IN UINTN Size,
IN UINT8 Value
);
typedef
EFI_STATUS
(EFIAPI *EFI_CREATE_EVENT_EX) (
IN UINT32 Type,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
IN const VOID *NotifyContext OPTIONAL,
IN const EFI_GUID EventGroup OPTIONAL,
OUT EFI_EVENT *Event
);
typedef enum {
EfiResetCold,
EfiResetWarm,
EfiResetShutdown
} EFI_RESET_TYPE;
typedef
EFI_STATUS
(EFIAPI *EFI_RESET_SYSTEM) (
IN EFI_RESET_TYPE ResetType,
IN EFI_STATUS ResetStatus,
IN UINTN DataSize,
IN CHAR16 *ResetData OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
OUT UINT64 *Count
);
typedef
EFI_STATUS
(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
OUT UINT32 *HighCount
);
typedef struct {
UINT64 Length;
union {
EFI_PHYSICAL_ADDRESS DataBlock;
EFI_PHYSICAL_ADDRESS ContinuationPointer;
} Union;
} EFI_CAPSULE_BLOCK_DESCRIPTOR;
typedef struct {
EFI_GUID CapsuleGuid;
UINT32 HeaderSize;
UINT32 Flags;
UINT32 CapsuleImageSize;
} EFI_CAPSULE_HEADER;
#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
#define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
typedef
EFI_STATUS
(EFIAPI *EFI_UPDATE_CAPSULE) (
IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
IN UINTN CapsuleCount,
IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES) (
IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
IN UINTN CapsuleCount,
OUT UINT64 *MaximumCapsuleSize,
OUT EFI_RESET_TYPE *ResetType
);
typedef
EFI_STATUS
(EFIAPI *EFI_QUERY_VARIABLE_INFO) (
IN UINT32 Attributes,
OUT UINT64 *MaximumVariableStorageSize,
OUT UINT64 *RemainingVariableStorageSize,
OUT UINT64 *MaximumVariableSize
);
//
// Protocol handler functions
//
typedef enum {
EFI_NATIVE_INTERFACE,
EFI_PCODE_INTERFACE
} EFI_INTERFACE_TYPE;
typedef
EFI_STATUS
(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
IN OUT EFI_HANDLE *Handle,
IN EFI_GUID *Protocol,
IN EFI_INTERFACE_TYPE InterfaceType,
IN VOID *Interface
);
typedef
EFI_STATUS
(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
IN VOID *OldInterface,
IN VOID *NewInterface
);
typedef
EFI_STATUS
(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
IN VOID *Interface
);
typedef
EFI_STATUS
(EFIAPI *EFI_HANDLE_PROTOCOL) (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
OUT VOID **Interface
);
typedef
EFI_STATUS
(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
IN EFI_GUID *Protocol,
IN EFI_EVENT Event,
OUT VOID **Registration
);
typedef
EFI_STATUS
(EFIAPI *EFI_LOCATE_HANDLE) (
IN EFI_LOCATE_SEARCH_TYPE SearchType,
IN EFI_GUID *Protocol OPTIONAL,
IN VOID *SearchKey OPTIONAL,
IN OUT UINTN *BufferSize,
OUT EFI_HANDLE *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_LOCATE_DEVICE_PATH) (
IN EFI_GUID *Protocol,
IN OUT EFI_DEVICE_PATH **DevicePath,
OUT EFI_HANDLE *Device
);
typedef
EFI_STATUS
(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
IN EFI_GUID *Guid,
IN VOID *Table
);
typedef
EFI_STATUS
(EFIAPI *EFI_RESERVED_SERVICE) (
);
//
// Standard EFI table header
//
typedef struct _EFI_TABLE_HEADER {
UINT64 Signature;
UINT32 Revision;
UINT32 HeaderSize;
UINT32 CRC32;
UINT32 Reserved;
} EFI_TABLE_HEADER;
//
// EFI Runtime Serivces Table
//
#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552
#define EFI_RUNTIME_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
typedef struct {
EFI_TABLE_HEADER Hdr;
//
// Time services
//
EFI_GET_TIME GetTime;
EFI_SET_TIME SetTime;
EFI_GET_WAKEUP_TIME GetWakeupTime;
EFI_SET_WAKEUP_TIME SetWakeupTime;
//
// Virtual memory services
//
EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
EFI_CONVERT_POINTER ConvertPointer;
//
// Variable serviers
//
EFI_GET_VARIABLE GetVariable;
EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
EFI_SET_VARIABLE SetVariable;
//
// Misc
//
EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
EFI_RESET_SYSTEM ResetSystem;
EFI_UPDATE_CAPSULE UpdateCapsule;
EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities;
EFI_QUERY_VARIABLE_INFO QueryVariableInfo;
} EFI_RUNTIME_SERVICES;
//
// EFI Boot Services Table
//
#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
#define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
typedef struct _EFI_BOOT_SERVICES {
EFI_TABLE_HEADER Hdr;
//
// Task priority functions
//
EFI_RAISE_TPL RaiseTPL;
EFI_RESTORE_TPL RestoreTPL;
//
// Memory functions
//
EFI_ALLOCATE_PAGES AllocatePages;
EFI_FREE_PAGES FreePages;
EFI_GET_MEMORY_MAP GetMemoryMap;
EFI_ALLOCATE_POOL AllocatePool;
EFI_FREE_POOL FreePool;
//
// Event & timer functions
//
EFI_CREATE_EVENT CreateEvent;
EFI_SET_TIMER SetTimer;
EFI_WAIT_FOR_EVENT WaitForEvent;
EFI_SIGNAL_EVENT SignalEvent;
EFI_CLOSE_EVENT CloseEvent;
EFI_CHECK_EVENT CheckEvent;
//
// Protocol handler functions
//
EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
EFI_HANDLE_PROTOCOL HandleProtocol;
EFI_HANDLE_PROTOCOL PCHandleProtocol;
EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
EFI_LOCATE_HANDLE LocateHandle;
EFI_LOCATE_DEVICE_PATH LocateDevicePath;
EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
//
// Image functions
//
EFI_IMAGE_LOAD LoadImage;
EFI_IMAGE_START StartImage;
EFI_EXIT Exit;
EFI_IMAGE_UNLOAD UnloadImage;
EFI_EXIT_BOOT_SERVICES ExitBootServices;
//
// Misc functions
//
EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
EFI_STALL Stall;
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
//
// DriverSupport Services
//
EFI_CONNECT_CONTROLLER ConnectController;
EFI_DISCONNECT_CONTROLLER DisconnectController;
//
// Open and Close Protocol Services
//
EFI_OPEN_PROTOCOL OpenProtocol;
EFI_CLOSE_PROTOCOL CloseProtocol;
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
//
// Library Services
//
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
EFI_LOCATE_PROTOCOL LocateProtocol;
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
//
// 32-bit CRC Services
//
EFI_CALCULATE_CRC32 CalculateCrc32;
//
// Misc Services
//
EFI_COPY_MEM CopyMem;
EFI_SET_MEM SetMem;
EFI_CREATE_EVENT_EX CreateEventEx;
} EFI_BOOT_SERVICES;
//
// EFI Configuration Table and GUID definitions
//
#define MPS_TABLE_GUID \
{ 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define ACPI_TABLE_GUID \
{ 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define ACPI_20_TABLE_GUID \
{ 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
#define SMBIOS_TABLE_GUID \
{ 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define SMBIOS3_TABLE_GUID \
{ 0xf2fd1544, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94} }
#define SAL_SYSTEM_TABLE_GUID \
{ 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
typedef struct _EFI_CONFIGURATION_TABLE {
EFI_GUID VendorGuid;
VOID *VendorTable;
} EFI_CONFIGURATION_TABLE;
//
// EFI System Table
//
#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
#define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
typedef struct _EFI_SYSTEM_TABLE {
EFI_TABLE_HEADER Hdr;
CHAR16 *FirmwareVendor;
UINT32 FirmwareRevision;
EFI_HANDLE ConsoleInHandle;
SIMPLE_INPUT_INTERFACE *ConIn;
EFI_HANDLE ConsoleOutHandle;
SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut;
EFI_HANDLE StandardErrorHandle;
SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr;
EFI_RUNTIME_SERVICES *RuntimeServices;
EFI_BOOT_SERVICES *BootServices;
UINTN NumberOfTableEntries;
EFI_CONFIGURATION_TABLE *ConfigurationTable;
} EFI_SYSTEM_TABLE;
#endif

View File

@ -1,30 +0,0 @@
/*++
Copyright (c) 2016 Pete Batard <pete@akeo.ie>
Module Name:
eficompiler.h
Abstract:
Compiler specific adjustments
--*/
#ifdef _MSC_EXTENSIONS
#define EFI_UNUSED
#else
#define EFI_UNUSED __attribute__((__unused__))
#endif
#ifdef _MSC_EXTENSIONS
#define ALIGN(x) __declspec(align(x))
#else
#define ALIGN(x) __attribute__((__aligned__(x)))
#endif
/* Also add a catch-all on __attribute__() for MS compilers */
#ifdef _MSC_EXTENSIONS
#define __attribute__(x)
#endif

View File

@ -1,306 +0,0 @@
#ifndef _EFI_CON_H
#define _EFI_CON_H
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
eficon.h
Abstract:
EFI console protocols
Revision History
--*/
//
// Text output protocol
//
#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
{ 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
#define SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID
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, EFI_SIMPLE_TEXT_OUT_PROTOCOL;
//
// 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 EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
{ 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
#define SIMPLE_TEXT_INPUT_PROTOCOL EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID
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_F11 0x0015
#define SCAN_F12 0x0016
#define SCAN_ESC 0x0017
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, EFI_SIMPLE_TEXT_IN_PROTOCOL;
#endif

View File

@ -1,620 +0,0 @@
#ifndef _EFI_DEBUG_H
#define _EFI_DEBUG_H
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
efidebug.h
Abstract:
EFI library debug functions
Revision History
--*/
extern UINTN EFIDebug;
#if EFI_DEBUG
#define DBGASSERT(a) DbgAssert(__FILE__, __LINE__, #a)
#define DEBUG(a) DbgPrint a
#else
#define DBGASSERT(a)
#define DEBUG(a)
#endif
#if EFI_DEBUG_CLEAR_MEMORY
#define DBGSETMEM(a,l) SetMem(a,l,(CHAR8)BAD_POINTER)
#else
#define DBGSETMEM(a,l)
#endif
#define D_INIT 0x00000001 // Initialization style messages
#define D_WARN 0x00000002 // Warnings
#define D_LOAD 0x00000004 // Load events
#define D_FS 0x00000008 // EFI File system
#define D_POOL 0x00000010 // Alloc & Free's
#define D_PAGE 0x00000020 // Alloc & Free's
#define D_INFO 0x00000040 // Verbose
#define D_VAR 0x00000100 // Variable
#define D_PARSE 0x00000200 // Command parsing
#define D_BM 0x00000400 // Boot manager
#define D_BLKIO 0x00001000 // BlkIo Driver
#define D_BLKIO_ULTRA 0x00002000 // BlkIo Driver
#define D_NET 0x00004000 // SNI Driver
#define D_NET_ULTRA 0x00008000 // SNI Driver
#define D_TXTIN 0x00010000 // Simple Input Driver
#define D_TXTOUT 0x00020000 // Simple Text Output Driver
#define D_ERROR_ATA 0x00040000 // ATA error messages
#define D_ERROR 0x80000000 // Error
#define D_RESERVED 0x7fffC880 // Bits not reserved above
//
// Current Debug level of the system, value of EFIDebug
//
//#define EFI_DBUG_MASK (D_ERROR | D_WARN | D_LOAD | D_BLKIO | D_INIT)
#define EFI_DBUG_MASK (D_ERROR)
//
//
//
#if EFI_DEBUG
#define ASSERT(a) if(!(a)) DBGASSERT(a)
#define ASSERT_LOCKED(l) if(!(l)->Lock) DBGASSERT(l not locked)
#define ASSERT_STRUCT(p,t) DBGASSERT(t not structure), p
#else
#define ASSERT(a)
#define ASSERT_LOCKED(l)
#define ASSERT_STRUCT(p,t)
#endif
//
// Prototypes
//
INTN
DbgAssert (
CONST CHAR8 *file,
INTN lineno,
CONST CHAR8 *string
);
INTN
DbgPrint (
INTN mask,
CONST CHAR8 *format,
...
);
//
// Instruction Set Architectures definitions for debuggers
//
typedef INTN EFI_EXCEPTION_TYPE;
// IA32
#define EXCEPT_IA32_DIVIDE_ERROR 0
#define EXCEPT_IA32_DEBUG 1
#define EXCEPT_IA32_NMI 2
#define EXCEPT_IA32_BREAKPOINT 3
#define EXCEPT_IA32_OVERFLOW 4
#define EXCEPT_IA32_BOUND 5
#define EXCEPT_IA32_INVALID_OPCODE 6
#define EXCEPT_IA32_DOUBLE_FAULT 8
#define EXCEPT_IA32_INVALID_TSS 10
#define EXCEPT_IA32_SEG_NOT_PRESENT 11
#define EXCEPT_IA32_STACK_FAULT 12
#define EXCEPT_IA32_GP_FAULT 13
#define EXCEPT_IA32_PAGE_FAULT 14
#define EXCEPT_IA32_FP_ERROR 16
#define EXCEPT_IA32_ALIGNMENT_CHECK 17
#define EXCEPT_IA32_MACHINE_CHECK 18
#define EXCEPT_IA32_SIMD 19
typedef struct {
UINT16 Fcw;
UINT16 Fsw;
UINT16 Ftw;
UINT16 Opcode;
UINT32 Eip;
UINT16 Cs;
UINT16 Reserved1;
UINT32 DataOffset;
UINT16 Ds;
UINT8 Reserved2[10];
UINT8 St0Mm0[10], Reserved3[6];
UINT8 St1Mm1[10], Reserved4[6];
UINT8 St2Mm2[10], Reserved5[6];
UINT8 St3Mm3[10], Reserved6[6];
UINT8 St4Mm4[10], Reserved7[6];
UINT8 St5Mm5[10], Reserved8[6];
UINT8 St6Mm6[10], Reserved9[6];
UINT8 St7Mm7[10], Reserved10[6];
UINT8 Xmm0[16];
UINT8 Xmm1[16];
UINT8 Xmm2[16];
UINT8 Xmm3[16];
UINT8 Xmm4[16];
UINT8 Xmm5[16];
UINT8 Xmm6[16];
UINT8 Xmm7[16];
UINT8 Reserved11[14 * 16];
} EFI_FX_SAVE_STATE_IA32;
typedef struct {
UINT32 ExceptionData;
EFI_FX_SAVE_STATE_IA32 FxSaveState;
UINT32 Dr0;
UINT32 Dr1;
UINT32 Dr2;
UINT32 Dr3;
UINT32 Dr6;
UINT32 Dr7;
UINT32 Cr0;
UINT32 Cr1;
UINT32 Cr2;
UINT32 Cr3;
UINT32 Cr4;
UINT32 Eflags;
UINT32 Ldtr;
UINT32 Tr;
UINT32 Gdtr[2];
UINT32 Idtr[2];
UINT32 Eip;
UINT32 Gs;
UINT32 Fs;
UINT32 Es;
UINT32 Ds;
UINT32 Cs;
UINT32 Ss;
UINT32 Edi;
UINT32 Esi;
UINT32 Ebp;
UINT32 Esp;
UINT32 Ebx;
UINT32 Edx;
UINT32 Ecx;
UINT32 Eax;
} EFI_SYSTEM_CONTEXT_IA32;
// X64
#define EXCEPT_X64_DIVIDE_ERROR 0
#define EXCEPT_X64_DEBUG 1
#define EXCEPT_X64_NMI 2
#define EXCEPT_X64_BREAKPOINT 3
#define EXCEPT_X64_OVERFLOW 4
#define EXCEPT_X64_BOUND 5
#define EXCEPT_X64_INVALID_OPCODE 6
#define EXCEPT_X64_DOUBLE_FAULT 8
#define EXCEPT_X64_INVALID_TSS 10
#define EXCEPT_X64_SEG_NOT_PRESENT 11
#define EXCEPT_X64_STACK_FAULT 12
#define EXCEPT_X64_GP_FAULT 13
#define EXCEPT_X64_PAGE_FAULT 14
#define EXCEPT_X64_FP_ERROR 16
#define EXCEPT_X64_ALIGNMENT_CHECK 17
#define EXCEPT_X64_MACHINE_CHECK 18
#define EXCEPT_X64_SIMD 19
typedef struct {
UINT16 Fcw;
UINT16 Fsw;
UINT16 Ftw;
UINT16 Opcode;
UINT64 Rip;
UINT64 DataOffset;
UINT8 Reserved1[8];
UINT8 St0Mm0[10], Reserved2[6];
UINT8 St1Mm1[10], Reserved3[6];
UINT8 St2Mm2[10], Reserved4[6];
UINT8 St3Mm3[10], Reserved5[6];
UINT8 St4Mm4[10], Reserved6[6];
UINT8 St5Mm5[10], Reserved7[6];
UINT8 St6Mm6[10], Reserved8[6];
UINT8 St7Mm7[10], Reserved9[6];
UINT8 Xmm0[16];
UINT8 Xmm1[16];
UINT8 Xmm2[16];
UINT8 Xmm3[16];
UINT8 Xmm4[16];
UINT8 Xmm5[16];
UINT8 Xmm6[16];
UINT8 Xmm7[16];
UINT8 Reserved11[14 * 16];
} EFI_FX_SAVE_STATE_X64;
typedef struct {
UINT64 ExceptionData;
EFI_FX_SAVE_STATE_X64 FxSaveState;
UINT64 Dr0;
UINT64 Dr1;
UINT64 Dr2;
UINT64 Dr3;
UINT64 Dr6;
UINT64 Dr7;
UINT64 Cr0;
UINT64 Cr1;
UINT64 Cr2;
UINT64 Cr3;
UINT64 Cr4;
UINT64 Cr8;
UINT64 Rflags;
UINT64 Ldtr;
UINT64 Tr;
UINT64 Gdtr[2];
UINT64 Idtr[2];
UINT64 Rip;
UINT64 Gs;
UINT64 Fs;
UINT64 Es;
UINT64 Ds;
UINT64 Cs;
UINT64 Ss;
UINT64 Rdi;
UINT64 Rsi;
UINT64 Rbp;
UINT64 Rsp;
UINT64 Rbx;
UINT64 Rdx;
UINT64 Rcx;
UINT64 Rax;
UINT64 R8;
UINT64 R9;
UINT64 R10;
UINT64 R11;
UINT64 R12;
UINT64 R13;
UINT64 R14;
UINT64 R15;
} EFI_SYSTEM_CONTEXT_X64;
/// IA64
#define EXCEPT_IPF_VHTP_TRANSLATION 0
#define EXCEPT_IPF_INSTRUCTION_TLB 1
#define EXCEPT_IPF_DATA_TLB 2
#define EXCEPT_IPF_ALT_INSTRUCTION_TLB 3
#define EXCEPT_IPF_ALT_DATA_TLB 4
#define EXCEPT_IPF_DATA_NESTED_TLB 5
#define EXCEPT_IPF_INSTRUCTION_KEY_MISSED 6
#define EXCEPT_IPF_DATA_KEY_MISSED 7
#define EXCEPT_IPF_DIRTY_BIT 8
#define EXCEPT_IPF_INSTRUCTION_ACCESS_BIT 9
#define EXCEPT_IPF_DATA_ACCESS_BIT 10
#define EXCEPT_IPF_BREAKPOINT 11
#define EXCEPT_IPF_EXTERNAL_INTERRUPT 12
#define EXCEPT_IPF_PAGE_NOT_PRESENT 20
#define EXCEPT_IPF_KEY_PERMISSION 21
#define EXCEPT_IPF_INSTRUCTION_ACCESS_RIGHTS 22
#define EXCEPT_IPF_DATA_ACCESS_RIGHTS 23
#define EXCEPT_IPF_GENERAL_EXCEPTION 24
#define EXCEPT_IPF_DISABLED_FP_REGISTER 25
#define EXCEPT_IPF_NAT_CONSUMPTION 26
#define EXCEPT_IPF_SPECULATION 27
#define EXCEPT_IPF_DEBUG 29
#define EXCEPT_IPF_UNALIGNED_REFERENCE 30
#define EXCEPT_IPF_UNSUPPORTED_DATA_REFERENCE 31
#define EXCEPT_IPF_FP_FAULT 32
#define EXCEPT_IPF_FP_TRAP 33
#define EXCEPT_IPF_LOWER_PRIVILEGE_TRANSFER_TRAP 34
#define EXCEPT_IPF_TAKEN_BRANCH 35
#define EXCEPT_IPF_SINGLE_STEP 36
#define EXCEPT_IPF_IA32_EXCEPTION 45
#define EXCEPT_IPF_IA32_INTERCEPT 46
#define EXCEPT_IPF_IA32_INTERRUPT 47
typedef struct {
UINT64 Reserved;
UINT64 R1;
UINT64 R2;
UINT64 R3;
UINT64 R4;
UINT64 R5;
UINT64 R6;
UINT64 R7;
UINT64 R8;
UINT64 R9;
UINT64 R10;
UINT64 R11;
UINT64 R12;
UINT64 R13;
UINT64 R14;
UINT64 R15;
UINT64 R16;
UINT64 R17;
UINT64 R18;
UINT64 R19;
UINT64 R20;
UINT64 R21;
UINT64 R22;
UINT64 R23;
UINT64 R24;
UINT64 R25;
UINT64 R26;
UINT64 R27;
UINT64 R28;
UINT64 R29;
UINT64 R30;
UINT64 R31;
UINT64 F2[2];
UINT64 F3[2];
UINT64 F4[2];
UINT64 F5[2];
UINT64 F6[2];
UINT64 F7[2];
UINT64 F8[2];
UINT64 F9[2];
UINT64 F10[2];
UINT64 F11[2];
UINT64 F12[2];
UINT64 F13[2];
UINT64 F14[2];
UINT64 F15[2];
UINT64 F16[2];
UINT64 F17[2];
UINT64 F18[2];
UINT64 F19[2];
UINT64 F20[2];
UINT64 F21[2];
UINT64 F22[2];
UINT64 F23[2];
UINT64 F24[2];
UINT64 F25[2];
UINT64 F26[2];
UINT64 F27[2];
UINT64 F28[2];
UINT64 F29[2];
UINT64 F30[2];
UINT64 F31[2];
UINT64 Pr;
UINT64 B0;
UINT64 B1;
UINT64 B2;
UINT64 B3;
UINT64 B4;
UINT64 B5;
UINT64 B6;
UINT64 B7;
UINT64 ArRsc;
UINT64 ArBsp;
UINT64 ArBspstore;
UINT64 ArRnat;
UINT64 ArFcr;
UINT64 ArEflag;
UINT64 ArCsd;
UINT64 ArSsd;
UINT64 ArCflg;
UINT64 ArFsr;
UINT64 ArFir;
UINT64 ArFdr;
UINT64 ArCcv;
UINT64 ArUnat;
UINT64 ArFpsr;
UINT64 ArPfs;
UINT64 ArLc;
UINT64 ArEc;
UINT64 CrDcr;
UINT64 CrItm;
UINT64 CrIva;
UINT64 CrPta;
UINT64 CrIpsr;
UINT64 CrIsr;
UINT64 CrIip;
UINT64 CrIfa;
UINT64 CrItir;
UINT64 CrIipa;
UINT64 CrIfs;
UINT64 CrIim;
UINT64 CrIha;
UINT64 Dbr0;
UINT64 Dbr1;
UINT64 Dbr2;
UINT64 Dbr3;
UINT64 Dbr4;
UINT64 Dbr5;
UINT64 Dbr6;
UINT64 Dbr7;
UINT64 Ibr0;
UINT64 Ibr1;
UINT64 Ibr2;
UINT64 Ibr3;
UINT64 Ibr4;
UINT64 Ibr5;
UINT64 Ibr6;
UINT64 Ibr7;
UINT64 IntNat;
} EFI_SYSTEM_CONTEXT_IPF;
// EBC
#define EXCEPT_EBC_UNDEFINED 0
#define EXCEPT_EBC_DIVIDE_ERROR 1
#define EXCEPT_EBC_DEBUG 2
#define EXCEPT_EBC_BREAKPOINT 3
#define EXCEPT_EBC_OVERFLOW 4
#define EXCEPT_EBC_INVALID_OPCODE 5
#define EXCEPT_EBC_STACK_FAULT 6
#define EXCEPT_EBC_ALIGNMENT_CHECK 7
#define EXCEPT_EBC_INSTRUCTION_ENCODING 8
#define EXCEPT_EBC_BAD_BREAK 9
#define EXCEPT_EBC_STEP 10
#define MAX_EBC_EXCEPTION EXCEPT_EBC_STEP
typedef struct {
UINT64 R0;
UINT64 R1;
UINT64 R2;
UINT64 R3;
UINT64 R4;
UINT64 R5;
UINT64 R6;
UINT64 R7;
UINT64 Flags;
UINT64 ControlFlags;
UINT64 Ip;
} EFI_SYSTEM_CONTEXT_EBC;
// ARM
#define EXCEPT_ARM_RESET 0
#define EXCEPT_ARM_UNDEFINED_INSTRUCTION 1
#define EXCEPT_ARM_SOFTWARE_INTERRUPT 2
#define EXCEPT_ARM_PREFETCH_ABORT 3
#define EXCEPT_ARM_DATA_ABORT 4
#define EXCEPT_ARM_RESERVED 5
#define EXCEPT_ARM_IRQ 6
#define EXCEPT_ARM_FIQ 7
#define MAX_ARM_EXCEPTION EXCEPT_ARM_FIQ
typedef struct {
UINT32 R0;
UINT32 R1;
UINT32 R2;
UINT32 R3;
UINT32 R4;
UINT32 R5;
UINT32 R6;
UINT32 R7;
UINT32 R8;
UINT32 R9;
UINT32 R10;
UINT32 R11;
UINT32 R12;
UINT32 SP;
UINT32 LR;
UINT32 PC;
UINT32 CPSR;
UINT32 DFSR;
UINT32 DFAR;
UINT32 IFSR;
UINT32 IFAR;
} EFI_SYSTEM_CONTEXT_ARM;
typedef union {
EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
} EFI_SYSTEM_CONTEXT;
typedef
VOID
(EFIAPI *EFI_EXCEPTION_CALLBACK)(
IN EFI_EXCEPTION_TYPE ExceptionType,
IN OUT EFI_SYSTEM_CONTEXT SystemContext);
typedef
VOID
(EFIAPI *EFI_PERIODIC_CALLBACK)(
IN OUT EFI_SYSTEM_CONTEXT SystemContext);
typedef enum {
IsaIa32 = EFI_IMAGE_MACHINE_IA32,
IsaX64 = EFI_IMAGE_MACHINE_X64,
IsaIpf = EFI_IMAGE_MACHINE_IA64,
IsaEbc = EFI_IMAGE_MACHINE_EBC,
IsaArm = EFI_IMAGE_MACHINE_ARMTHUMB_MIXED,
// IsaArm64 = EFI_IMAGE_MACHINE_AARCH64
} EFI_INSTRUCTION_SET_ARCHITECTURE;
//
// DEBUG_IMAGE_INFO
//
#define EFI_DEBUG_IMAGE_INFO_TABLE_GUID \
{ 0x49152e77, 0x1ada, 0x4764, {0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b} }
#define EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS 0x01
#define EFI_DEBUG_IMAGE_INFO_TABLE_MODIFIED 0x02
#define EFI_DEBUG_IMAGE_INFO_INITIAL_SIZE (EFI_PAGE_SIZE / sizeof (UINTN))
#define EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL 0x01
typedef struct {
UINT64 Signature;
EFI_PHYSICAL_ADDRESS EfiSystemTableBase;
UINT32 Crc32;
} EFI_SYSTEM_TABLE_POINTER;
typedef struct {
UINT32 ImageInfoType;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImageProtocolInstance;
EFI_HANDLE *ImageHandle;
} EFI_DEBUG_IMAGE_INFO_NORMAL;
typedef union {
UINT32 *ImageInfoType;
EFI_DEBUG_IMAGE_INFO_NORMAL *NormalImage;
} EFI_DEBUG_IMAGE_INFO;
typedef struct {
volatile UINT32 UpdateStatus;
UINT32 TableSize;
EFI_DEBUG_IMAGE_INFO *EfiDebugImageInfoTable;
} EFI_DEBUG_IMAGE_INFO_TABLE_HEADER;
//
// EFI_DEBUGGER_PROTOCOL
//
#define EFI_DEBUG_SUPPORT_PROTOCOL_GUID \
{ 0x2755590c, 0x6f3c, 0x42fa, {0x9e, 0xa4, 0xa3, 0xba, 0x54, 0x3c, 0xda, 0x25} }
INTERFACE_DECL(_EFI_DEBUG_SUPPORT_PROTOCOL);
typedef
EFI_STATUS
(EFIAPI *EFI_GET_MAXIMUM_PROCESSOR_INDEX)(
IN struct _EFI_DEBUG_SUPPORT_PROTOCOL *This,
OUT UINTN *MaxProcessorIndex);
typedef
EFI_STATUS
(EFIAPI *EFI_REGISTER_PERIODIC_CALLBACK)(
IN struct _EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN EFI_PERIODIC_CALLBACK PeriodicCallback);
typedef
EFI_STATUS
(EFIAPI *EFI_REGISTER_EXCEPTION_CALLBACK)(
IN struct _EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN EFI_EXCEPTION_CALLBACK ExceptionCallback,
IN EFI_EXCEPTION_TYPE ExceptionType);
typedef
EFI_STATUS
(EFIAPI *EFI_INVALIDATE_INSTRUCTION_CACHE)(
IN struct _EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN VOID *Start,
IN UINT64 Length);
typedef struct _EFI_DEBUG_SUPPORT_PROTOCOL {
EFI_INSTRUCTION_SET_ARCHITECTURE Isa;
EFI_GET_MAXIMUM_PROCESSOR_INDEX GetMaximumProcessorIndex;
EFI_REGISTER_PERIODIC_CALLBACK RegisterPeriodicCallback;
EFI_REGISTER_EXCEPTION_CALLBACK RegisterExceptionCallback;
EFI_INVALIDATE_INSTRUCTION_CACHE InvalidateInstructionCache;
} EFI_DEBUG_SUPPORT_PROTOCOL;
#endif

View File

@ -1,220 +0,0 @@
#ifndef _EFI_DEF_H
#define _EFI_DEF_H
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
efidef.h
Abstract:
EFI definitions
Revision History
--*/
typedef UINT16 CHAR16;
typedef UINT8 CHAR8;
typedef UINT8 BOOLEAN;
#ifndef CONST
#define CONST const
#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
#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,
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
// 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) )
#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001
#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002
#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED \
0x0000000000000004
#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED \
0x0000000000000008
#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED \
0x0000000000000010
#endif

View File

@ -1,582 +0,0 @@
#ifndef _DEVPATH_H
#define _DEVPATH_H
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
devpath.h
Abstract:
Defines for parsing the EFI Device Path structures
Revision History
--*/
//
// Device Path structures - Section C
//
typedef struct _EFI_DEVICE_PATH_PROTOCOL {
UINT8 Type;
UINT8 SubType;
UINT8 Length[2];
} EFI_DEVICE_PATH_PROTOCOL;
typedef struct _EFI_DEVICE_PATH_PROTOCOL _EFI_DEVICE_PATH;
typedef EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH;
#define EFI_DP_TYPE_MASK 0x7F
#define EFI_DP_TYPE_UNPACKED 0x80
//#define END_DEVICE_PATH_TYPE 0xff
#define END_DEVICE_PATH_TYPE 0x7f
//#define END_DEVICE_PATH_TYPE_UNPACKED 0x7f
#define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
#define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01
#define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH_PROTOCOL))
#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) ( ((a)->Length[0]) | ((a)->Length[1] << 8) )
#define NextDevicePathNode(a) ( (EFI_DEVICE_PATH_PROTOCOL *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a)))
//#define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE_UNPACKED )
#define IsDevicePathEndType(a) ( DevicePathType(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_PROTOCOL); \
(a)->Length[1] = 0; \
}
/*
* Hardware Device Path (UEFI 2.4 specification, version 2.4 § 9.3.2.)
*/
#define HARDWARE_DEVICE_PATH 0x01
#define HW_PCI_DP 0x01
typedef struct _PCI_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT8 Function;
UINT8 Device;
} PCI_DEVICE_PATH;
#define HW_PCCARD_DP 0x02
typedef struct _PCCARD_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT8 FunctionNumber ;
} PCCARD_DEVICE_PATH;
#define HW_MEMMAP_DP 0x03
typedef struct _MEMMAP_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL 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_PROTOCOL 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_PROTOCOL Header;
UINT32 Controller;
} CONTROLLER_DEVICE_PATH;
/*
* ACPI Device Path (UEFI 2.4 specification, version 2.4 § 9.3.3 and 9.3.4.)
*/
#define ACPI_DEVICE_PATH 0x02
#define ACPI_DP 0x01
typedef struct _ACPI_HID_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 HID;
UINT32 UID;
} ACPI_HID_DEVICE_PATH;
#define EXPANDED_ACPI_DP 0x02
typedef struct _EXPANDED_ACPI_HID_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 HID;
UINT32 UID;
UINT32 CID;
UINT8 HidStr[1];
} EXPANDED_ACPI_HID_DEVICE_PATH;
#define ACPI_ADR_DP 3
typedef struct _ACPI_ADR_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header ;
UINT32 ADR ;
} ACPI_ADR_DEVICE_PATH ;
//
// 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 PNP_EISA_ID_MASK 0xffff
#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
/*
* Messaging Device Path (UEFI 2.4 specification, version 2.4 § 9.3.5.)
*/
#define MESSAGING_DEVICE_PATH 0x03
#define MSG_ATAPI_DP 0x01
typedef struct _ATAPI_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT8 PrimarySecondary;
UINT8 SlaveMaster;
UINT16 Lun;
} ATAPI_DEVICE_PATH;
#define MSG_SCSI_DP 0x02
typedef struct _SCSI_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 Pun;
UINT16 Lun;
} SCSI_DEVICE_PATH;
#define MSG_FIBRECHANNEL_DP 0x03
typedef struct _FIBRECHANNEL_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 Reserved;
UINT64 WWN;
UINT64 Lun;
} FIBRECHANNEL_DEVICE_PATH;
/**
* Fibre Channel Ex SubType.
* UEFI 2.0 specification version 2.4 § 9.3.5.6.
*/
#define MSG_FIBRECHANNELEX_DP 21
typedef struct _FIBRECHANNELEX_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header ;
UINT32 Reserved ;
UINT8 WWN[ 8 ] ; /* World Wide Name */
UINT8 Lun[ 8 ] ; /* Logical unit, T-10 SCSI Architecture Model 4 specification */
} FIBRECHANNELEX_DEVICE_PATH ;
#define MSG_1394_DP 0x04
typedef struct _F1394_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 Reserved;
UINT64 Guid;
} F1394_DEVICE_PATH;
#define MSG_USB_DP 0x05
typedef struct _USB_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT8 Port;
UINT8 Endpoint;
} USB_DEVICE_PATH;
/**
* SATA Device Path SubType.
* UEFI 2.0 specification version 2.4 § 9.3.5.6.
*/
#define MSG_SATA_DP 18
typedef struct _SATA_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header ;
UINT16 HBAPortNumber ;
UINT16 PortMultiplierPortNumber ;
UINT16 Lun ; /* Logical Unit Number */
} SATA_DEVICE_PATH ;
/**
* USB WWID Device Path SubType.
* UEFI 2.0 specification version 2.4 § 9.3.5.7.
*/
#define MSG_USB_WWID_DP 16
typedef struct _USB_WWID_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header ;
UINT16 InterfaceNumber ;
UINT16 VendorId ;
UINT16 ProductId ;
CHAR16 SerialNumber[ 1 ] ; /* UTF-16 characters of the USB serial number */
} USB_WWID_DEVICE_PATH ;
/**
* Device Logical Unit SubType.
* UEFI 2.0 specification version 2.4 § 9.3.5.8.
*/
#define MSG_DEVICE_LOGICAL_UNIT_DP 17
typedef struct _DEVICE_LOGICAL_UNIT_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header ;
UINT8 Lun ; /* Logical Unit Number */
} DEVICE_LOGICAL_UNIT_DEVICE_PATH ;
#define MSG_USB_CLASS_DP 0x0F
typedef struct _USB_CLASS_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL 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_PROTOCOL Header;
UINT32 Tid;
} I2O_DEVICE_PATH;
#define MSG_MAC_ADDR_DP 0x0b
typedef struct _MAC_ADDR_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_MAC_ADDRESS MacAddress;
UINT8 IfType;
} MAC_ADDR_DEVICE_PATH;
#define MSG_IPv4_DP 0x0c
typedef struct _IPv4_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_IPv4_ADDRESS LocalIpAddress;
EFI_IPv4_ADDRESS RemoteIpAddress;
UINT16 LocalPort;
UINT16 RemotePort;
UINT16 Protocol;
BOOLEAN StaticIpAddress;
/* new from UEFI version 2, code must check Length field in Header */
EFI_IPv4_ADDRESS GatewayIpAddress ;
EFI_IPv4_ADDRESS SubnetMask ;
} IPv4_DEVICE_PATH;
#define MSG_IPv6_DP 0x0d
typedef struct _IPv6_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_IPv6_ADDRESS LocalIpAddress;
EFI_IPv6_ADDRESS RemoteIpAddress;
UINT16 LocalPort;
UINT16 RemotePort;
UINT16 Protocol;
BOOLEAN IPAddressOrigin ;
/* new from UEFI version 2, code must check Length field in Header */
UINT8 PrefixLength ;
EFI_IPv6_ADDRESS GatewayIpAddress ;
} IPv6_DEVICE_PATH;
/**
* Uniform Resource Identifiers SubType.
* UEFI 2.0 specification version 2.4C § 9.3.5.23.
*/
#define MSG_URI_DP 24
typedef struct _URI_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
CHAR8 Uri[1];
} URI_DEVICE_PATH;
/**
* Device Logical Unit SubType.
* UEFI 2.0 specification version 2.4 § 9.3.5.8.
*/
#define MSG_VLAN_DP 20
typedef struct _VLAN_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header ;
UINT16 VlanId ;
} VLAN_DEVICE_PATH;
#define MSG_INFINIBAND_DP 0x09
typedef struct _INFINIBAND_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 ResourceFlags ;
UINT64 PortGid ;
UINT64 ServiceId ;
UINT64 TargetPortId ;
UINT64 DeviceId ;
} INFINIBAND_DEVICE_PATH;
#define MSG_UART_DP 0x0e
typedef struct _UART_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL 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 EFI_PC_ANSI_GUID \
{ 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define DEVICE_PATH_MESSAGING_PC_ANSI EFI_PC_ANSI_GUID
#define EFI_VT_100_GUID \
{ 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define DEVICE_PATH_MESSAGING_VT_100 EFI_VT_100_GUID
#define EFI_VT_100_PLUS_GUID \
{ 0x7baec70b, 0x57e0, 0x4c76, {0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43} }
#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID
#define EFI_VT_UTF8_GUID \
{ 0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88} }
#define DEVICE_PATH_MESSAGING_VT_UTF8 EFI_VT_UTF8_GUID
/*
* Media Device Path (UEFI 2.4 specification, version 2.4 § 9.3.6.)
*/
#define MEDIA_DEVICE_PATH 0x04
#define MEDIA_HARDDRIVE_DP 0x01
typedef struct _HARDDRIVE_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL 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_PROTOCOL 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_PROTOCOL 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_PROTOCOL Header;
EFI_GUID Protocol;
} MEDIA_PROTOCOL_DEVICE_PATH;
/**
* PIWG Firmware File SubType.
* UEFI 2.0 specification version 2.4 § 9.3.6.6.
*/
#define MEDIA_PIWG_FW_FILE_DP 6
typedef struct _MEDIA_FW_VOL_FILEPATH_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header ;
EFI_GUID FvFileName ;
} MEDIA_FW_VOL_FILEPATH_DEVICE_PATH ;
/**
* PIWG Firmware Volume Device Path SubType.
* UEFI 2.0 specification version 2.4 § 9.3.6.7.
*/
#define MEDIA_PIWG_FW_VOL_DP 7
typedef struct _MEDIA_FW_VOL_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header ;
EFI_GUID FvName ;
} MEDIA_FW_VOL_DEVICE_PATH ;
/**
* Media relative offset range device path.
* UEFI 2.0 specification version 2.4 § 9.3.6.8.
*/
#define MEDIA_RELATIVE_OFFSET_RANGE_DP 8
typedef struct _MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL Header ;
UINT32 Reserved ;
UINT64 StartingOffset ;
UINT64 EndingOffset ;
} MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH ;
/*
* BIOS Boot Specification Device Path (UEFI 2.4 specification, version 2.4 § 9.3.7.)
*/
#define BBS_DEVICE_PATH 0x05
#define BBS_BBS_DP 0x01
typedef struct _BBS_BBS_DEVICE_PATH {
EFI_DEVICE_PATH_PROTOCOL 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_PROTOCOL 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;
URI_DEVICE_PATH Uri;
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_PROTOCOL *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;
URI_DEVICE_PATH *Uri;
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_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \
{ 0x8b843e20, 0x8132, 0x4852, {0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c} }
typedef
CHAR16*
(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_NODE) (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
IN BOOLEAN DisplayOnly,
IN BOOLEAN AllowShortcuts
);
typedef
CHAR16*
(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_PATH) (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
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;
#define EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID \
{ 0x5c99a21, 0xc70f, 0x4ad2, {0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e} }
typedef
EFI_DEVICE_PATH_PROTOCOL*
(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_NODE) (
IN CONST CHAR16 *TextDeviceNode
);
typedef
EFI_DEVICE_PATH_PROTOCOL*
(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_PATH) (
IN CONST CHAR16 *TextDevicePath
);
typedef struct {
EFI_DEVICE_PATH_FROM_TEXT_NODE ConvertTextToDeviceNode;
EFI_DEVICE_PATH_FROM_TEXT_PATH ConvertTextToDevicePath;
} EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL;
#endif

View File

@ -1,67 +0,0 @@
#ifndef _EFI_ERR_H
#define _EFI_ERR_H
/*++
Copyright (c) 1998 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_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_INCOMPATIBLE_VERSION EFIERR(25)
#define EFI_SECURITY_VIOLATION EFIERR(26)
#define EFI_CRC_ERROR EFIERR(27)
#define EFI_END_OF_MEDIA EFIERR(28)
#define EFI_END_OF_FILE EFIERR(31)
#define EFI_INVALID_LANGUAGE EFIERR(32)
#define EFI_COMPROMISED_DATA EFIERR(33)
#define EFI_WARN_UNKOWN_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

View File

@ -1,116 +0,0 @@
#ifndef _EFI_FS_H
#define _EFI_FS_H
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
efifs.h
Abstract:
EFI File System structures
Revision History
--*/
//
// EFI Partition header (normaly starts in LBA 1)
//
#define EFI_PARTITION_SIGNATURE 0x5053595320494249
#define EFI_PARTITION_REVISION 0x00010001
#define MIN_EFI_PARTITION_BLOCK_SIZE 512
#define EFI_PARTITION_LBA 1
typedef struct _EFI_PARTITION_HEADER {
EFI_TABLE_HEADER Hdr;
UINT32 DirectoryAllocationNumber;
UINT32 BlockSize;
EFI_LBA FirstUsableLba;
EFI_LBA LastUsableLba;
EFI_LBA UnusableSpace;
EFI_LBA FreeSpace;
EFI_LBA RootFile;
EFI_LBA SecutiryFile;
} EFI_PARTITION_HEADER;
//
// File header
//
#define EFI_FILE_HEADER_SIGNATURE 0x454c494620494249
#define EFI_FILE_HEADER_REVISION 0x00010000
#define EFI_FILE_STRING_SIZE 260
typedef struct _EFI_FILE_HEADER {
EFI_TABLE_HEADER Hdr;
UINT32 Class;
UINT32 LBALOffset;
EFI_LBA Parent;
UINT64 FileSize;
UINT64 FileAttributes;
EFI_TIME FileCreateTime;
EFI_TIME FileModificationTime;
EFI_GUID VendorGuid;
CHAR16 FileString[EFI_FILE_STRING_SIZE];
} EFI_FILE_HEADER;
//
// Return the file's first LBAL which is in the same
// logical block as the file header
//
#define EFI_FILE_LBAL(a) ((EFI_LBAL *) (((CHAR8 *) (a)) + (a)->LBALOffset))
#define EFI_FILE_CLASS_FREE_SPACE 1
#define EFI_FILE_CLASS_EMPTY 2
#define EFI_FILE_CLASS_NORMAL 3
//
// Logical Block Address List - the fundemental block
// description structure
//
#define EFI_LBAL_SIGNATURE 0x4c41424c20494249
#define EFI_LBAL_REVISION 0x00010000
typedef struct _EFI_LBAL {
EFI_TABLE_HEADER Hdr;
UINT32 Class;
EFI_LBA Parent;
EFI_LBA Next;
UINT32 ArraySize;
UINT32 ArrayCount;
} EFI_LBAL;
// Array size
#define EFI_LBAL_ARRAY_SIZE(lbal,offs,blks) \
(((blks) - (offs) - (lbal)->Hdr.HeaderSize) / sizeof(EFI_RL))
//
// Logical Block run-length
//
typedef struct {
EFI_LBA Start;
UINT64 Length;
} EFI_RL;
//
// Return the run-length structure from an LBAL header
//
#define EFI_LBAL_RL(a) ((EFI_RL*) (((CHAR8 *) (a)) + (a)->Hdr.HeaderSize))
#endif

View File

@ -1,68 +0,0 @@
#ifndef _EFI_GPT_H
#define _EFI_GPT_H
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
EfiGpt.h
Abstract:
Include file for EFI partitioning scheme
Revision History
--*/
#define PRIMARY_PART_HEADER_LBA 1
typedef struct {
EFI_TABLE_HEADER Header;
EFI_LBA MyLBA;
EFI_LBA AlternateLBA;
EFI_LBA FirstUsableLBA;
EFI_LBA LastUsableLBA;
EFI_GUID DiskGUID;
EFI_LBA PartitionEntryLBA;
UINT32 NumberOfPartitionEntries;
UINT32 SizeOfPartitionEntry;
UINT32 PartitionEntryArrayCRC32;
} EFI_PARTITION_TABLE_HEADER;
#define EFI_PTAB_HEADER_ID "EFI PART"
typedef struct {
EFI_GUID PartitionTypeGUID;
EFI_GUID UniquePartitionGUID;
EFI_LBA StartingLBA;
EFI_LBA EndingLBA;
UINT64 Attributes;
CHAR16 PartitionName[36];
} EFI_PARTITION_ENTRY;
//
// EFI Partition Attributes
//
#define EFI_PART_USED_BY_EFI 0x0000000000000001
#define EFI_PART_REQUIRED_TO_FUNCTION 0x0000000000000002
#define EFI_PART_USED_BY_OS 0x0000000000000004
#define EFI_PART_REQUIRED_BY_OS 0x0000000000000008
#define EFI_PART_BACKUP_REQUIRED 0x0000000000000010
#define EFI_PART_USER_DATA 0x0000000000000020
#define EFI_PART_CRITICAL_USER_DATA 0x0000000000000040
#define EFI_PART_REDUNDANT_PARTITION 0x0000000000000080
#define EFI_PART_TYPE_UNUSED_GUID \
{ 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }
#define EFI_PART_TYPE_EFI_SYSTEM_PART_GUID \
{ 0xc12a7328, 0xf81f, 0x11d2, {0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} }
#define EFI_PART_TYPE_LEGACY_MBR_GUID \
{ 0x024dee41, 0x33e7, 0x11d3, {0x9d, 0x69, 0x00, 0x08, 0xc7, 0x81, 0xf3, 0x9f} }
#endif

View File

@ -1,459 +0,0 @@
#ifndef _EFI_IP_H
#define _EFI_IP_H
/*++
Copyright (c) 2013 Intel Corporation
--*/
#define EFI_IP4_SERVICE_BINDING_PROTOCOL \
{0xc51711e7,0xb4bf,0x404a,{0xbf,0xb8,0x0a,0x04, 0x8e,0xf1,0xff,0xe4}}
#define EFI_IP4_PROTOCOL \
{0x41d94cd2,0x35b6,0x455a,{0x82,0x58,0xd4,0xe5,0x13,0x34,0xaa,0xdd}}
#define EFI_IP6_SERVICE_BINDING_PROTOCOL \
{0xec835dd3,0xfe0f,0x617b,{0xa6,0x21,0xb3,0x50,0xc3,0xe1,0x33,0x88}}
#define EFI_IP6_PROTOCOL \
{0x2c8759d5,0x5c2d,0x66ef,{0x92,0x5f,0xb6,0x6c,0x10,0x19,0x57,0xe2}}
INTERFACE_DECL(_EFI_IP4);
INTERFACE_DECL(_EFI_IP6);
typedef struct {
EFI_HANDLE InstanceHandle;
EFI_IPv4_ADDRESS Ip4Address;
EFI_IPv4_ADDRESS SubnetMask;
} EFI_IP4_ADDRESS_PAIR;
typedef struct {
EFI_HANDLE DriverHandle;
UINT32 AddressCount;
EFI_IP4_ADDRESS_PAIR AddressPairs[1];
} EFI_IP4_VARIABLE_DATA;
typedef struct {
UINT8 DefaultProtocol;
BOOLEAN AcceptAnyProtocol;
BOOLEAN AcceptIcmpErrors;
BOOLEAN AcceptBroadcast;
BOOLEAN AcceptPromiscuous;
BOOLEAN UseDefaultAddress;
EFI_IPv4_ADDRESS StationAddress;
EFI_IPv4_ADDRESS SubnetMask;
UINT8 TypeOfService;
UINT8 TimeToLive;
BOOLEAN DoNotFragment;
BOOLEAN RawData;
UINT32 ReceiveTimeout;
UINT32 TransmitTimeout;
} EFI_IP4_CONFIG_DATA;
typedef struct {
EFI_IPv4_ADDRESS SubnetAddress;
EFI_IPv4_ADDRESS SubnetMask;
EFI_IPv4_ADDRESS GatewayAddress;
} EFI_IP4_ROUTE_TABLE;
typedef struct {
UINT8 Type;
UINT8 Code;
} EFI_IP4_ICMP_TYPE;
typedef struct {
BOOLEAN IsStarted;
UINT32 MaxPacketSize;
EFI_IP4_CONFIG_DATA ConfigData;
BOOLEAN IsConfigured;
UINT32 GroupCount;
EFI_IPv4_ADDRESS *GroupTable;
UINT32 RouteCount;
EFI_IP4_ROUTE_TABLE *RouteTable;
UINT32 IcmpTypeCount;
EFI_IP4_ICMP_TYPE *IcmpTypeList;
} EFI_IP4_MODE_DATA;
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_GET_MODE_DATA) (
IN struct _EFI_IP4 *This,
OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_CONFIGURE) (
IN struct _EFI_IP4 *This,
IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_GROUPS) (
IN struct _EFI_IP4 *This,
IN BOOLEAN JoinFlag,
IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_ROUTES) (
IN struct _EFI_IP4 *This,
IN BOOLEAN DeleteRoute,
IN EFI_IPv4_ADDRESS *SubnetAddress,
IN EFI_IPv4_ADDRESS *SubnetMask,
IN EFI_IPv4_ADDRESS *GatewayAddress
);
#pragma pack(1)
typedef struct {
UINT8 HeaderLength:4;
UINT8 Version:4;
UINT8 TypeOfService;
UINT16 TotalLength;
UINT16 Identification;
UINT16 Fragmentation;
UINT8 TimeToLive;
UINT8 Protocol;
UINT16 Checksum;
EFI_IPv4_ADDRESS SourceAddress;
EFI_IPv4_ADDRESS DestinationAddress;
} EFI_IP4_HEADER;
#pragma pack()
typedef struct {
UINT32 FragmentLength;
VOID *FragmentBuffer;
} EFI_IP4_FRAGMENT_DATA;
typedef struct {
EFI_TIME TimeStamp;
EFI_EVENT RecycleSignal;
UINT32 HeaderLength;
EFI_IP4_HEADER *Header;
UINT32 OptionsLength;
VOID *Options;
UINT32 DataLength;
UINT32 FragmentCount;
EFI_IP4_FRAGMENT_DATA FragmentTable[1];
} EFI_IP4_RECEIVE_DATA;
typedef struct {
EFI_IPv4_ADDRESS SourceAddress;
EFI_IPv4_ADDRESS GatewayAddress;
UINT8 Protocol;
UINT8 TypeOfService;
UINT8 TimeToLive;
BOOLEAN DoNotFragment;
} EFI_IP4_OVERRIDE_DATA;
typedef struct {
EFI_IPv4_ADDRESS DestinationAddress;
EFI_IP4_OVERRIDE_DATA *OverrideData;
UINT32 OptionsLength;
VOID *OptionsBuffer;
UINT32 TotalDataLength;
UINT32 FragmentCount;
EFI_IP4_FRAGMENT_DATA FragmentTable[1];
} EFI_IP4_TRANSMIT_DATA;
typedef struct {
EFI_EVENT Event;
EFI_STATUS Status;
union {
EFI_IP4_RECEIVE_DATA *RxData;
EFI_IP4_TRANSMIT_DATA *TxData;
} Packet;
} EFI_IP4_COMPLETION_TOKEN;
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_TRANSMIT) (
IN struct _EFI_IP4 *This,
IN EFI_IP4_COMPLETION_TOKEN *Token
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_RECEIVE) (
IN struct _EFI_IP4 *This,
IN EFI_IP4_COMPLETION_TOKEN *Token
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_CANCEL)(
IN struct _EFI_IP4 *This,
IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP4_POLL) (
IN struct _EFI_IP4 *This
);
typedef struct _EFI_IP4 {
EFI_IP4_GET_MODE_DATA GetModeData;
EFI_IP4_CONFIGURE Configure;
EFI_IP4_GROUPS Groups;
EFI_IP4_ROUTES Routes;
EFI_IP4_TRANSMIT Transmit;
EFI_IP4_RECEIVE Receive;
EFI_IP4_CANCEL Cancel;
EFI_IP4_POLL Poll;
} EFI_IP4;
typedef struct {
UINT8 DefaultProtocol;
BOOLEAN AcceptAnyProtocol;
BOOLEAN AcceptIcmpErrors;
BOOLEAN AcceptPromiscuous;
EFI_IPv6_ADDRESS DestinationAddress;
EFI_IPv6_ADDRESS StationAddress;
UINT8 TrafficClass;
UINT8 HopLimit;
UINT32 FlowLabel;
UINT32 ReceiveTimeout;
UINT32 TransmitTimeout;
} EFI_IP6_CONFIG_DATA;
typedef struct {
EFI_IPv6_ADDRESS Address;
UINT8 PrefixLength;
} EFI_IP6_ADDRESS_INFO;
typedef struct {
EFI_IPv6_ADDRESS Gateway;
EFI_IPv6_ADDRESS Destination;
UINT8 PrefixLength;
} EFI_IP6_ROUTE_TABLE;
typedef enum {
EfiNeighborInComplete,
EfiNeighborReachable,
EfiNeighborStale,
EfiNeighborDelay,
EfiNeighborProbe
} EFI_IP6_NEIGHBOR_STATE;
typedef struct {
EFI_IPv6_ADDRESS Neighbor;
EFI_MAC_ADDRESS LinkAddress;
EFI_IP6_NEIGHBOR_STATE State;
} EFI_IP6_NEIGHBOR_CACHE;
typedef struct {
UINT8 Type;
UINT8 Code;
} EFI_IP6_ICMP_TYPE;
//***********************************************************
// ICMPv6 type definitions for error messages
//***********************************************************
#define ICMP_V6_DEST_UNREACHABLE 0x1
#define ICMP_V6_PACKET_TOO_BIG 0x2
#define ICMP_V6_TIME_EXCEEDED 0x3
#define ICMP_V6_PARAMETER_PROBLEM 0x4
//***********************************************************
// ICMPv6 type definition for informational messages
//***********************************************************
#define ICMP_V6_ECHO_REQUEST 0x80
#define ICMP_V6_ECHO_REPLY 0x81
#define ICMP_V6_LISTENER_QUERY 0x82
#define ICMP_V6_LISTENER_REPORT 0x83
#define ICMP_V6_LISTENER_DONE 0x84
#define ICMP_V6_ROUTER_SOLICIT 0x85
#define ICMP_V6_ROUTER_ADVERTISE 0x86
#define ICMP_V6_NEIGHBOR_SOLICIT 0x87
#define ICMP_V6_NEIGHBOR_ADVERTISE 0x88
#define ICMP_V6_REDIRECT 0x89
#define ICMP_V6_LISTENER_REPORT_2 0x8F
//***********************************************************
// ICMPv6 code definitions for ICMP_V6_DEST_UNREACHABLE
//***********************************************************
#define ICMP_V6_NO_ROUTE_TO_DEST 0x0
#define ICMP_V6_COMM_PROHIBITED 0x1
#define ICMP_V6_BEYOND_SCOPE 0x2
#define ICMP_V6_ADDR_UNREACHABLE 0x3
#define ICMP_V6_PORT_UNREACHABLE 0x4
#define ICMP_V6_SOURCE_ADDR_FAILED 0x5
#define ICMP_V6_ROUTE_REJECTED 0x6
//***********************************************************
// ICMPv6 code definitions for ICMP_V6_TIME_EXCEEDED
//***********************************************************
#define ICMP_V6_TIMEOUT_HOP_LIMIT 0x0
#define ICMP_V6_TIMEOUT_REASSEMBLE 0x1
//***********************************************************
// ICMPv6 code definitions for ICMP_V6_PARAMETER_PROBLEM
//***********************************************************
#define ICMP_V6_ERRONEOUS_HEADER 0x0
#define ICMP_V6_UNRECOGNIZE_NEXT_HDR 0x1
#define ICMP_V6_UNRECOGNIZE_OPTION 0x2
typedef struct {
BOOLEAN IsStarted;
UINT32 MaxPacketSize;
EFI_IP6_CONFIG_DATA ConfigData;
BOOLEAN IsConfigured;
UINT32 AddressCount;
EFI_IP6_ADDRESS_INFO *AddressList;
UINT32 GroupCount;
EFI_IPv6_ADDRESS *GroupTable;
UINT32 RouteCount;
EFI_IP6_ROUTE_TABLE *RouteTable;
UINT32 NeighborCount;
EFI_IP6_NEIGHBOR_CACHE *NeighborCache;
UINT32 PrefixCount;
EFI_IP6_ADDRESS_INFO *PrefixTable;
UINT32 IcmpTypeCount;
EFI_IP6_ICMP_TYPE *IcmpTypeList;
} EFI_IP6_MODE_DATA;
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_GET_MODE_DATA) (
IN struct _EFI_IP6 *This,
OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_CONFIGURE) (
IN struct _EFI_IP6 *This,
IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_GROUPS) (
IN struct _EFI_IP6 *This,
IN BOOLEAN JoinFlag,
IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_ROUTES) (
IN struct _EFI_IP6 *This,
IN BOOLEAN DeleteRoute,
IN EFI_IPv6_ADDRESS *Destination OPTIONAL,
IN UINT8 PrefixLength,
IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_NEIGHBORS) (
IN struct _EFI_IP6 *This,
IN BOOLEAN DeleteFlag,
IN EFI_IPv6_ADDRESS *TargetIp6Address,
IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,
IN UINT32 Timeout,
IN BOOLEAN Override
);
typedef struct _EFI_IP6_FRAGMENT_DATA {
UINT32 FragmentLength;
VOID *FragmentBuffer;
} EFI_IP6_FRAGMENT_DATA;
typedef struct _EFI_IP6_OVERRIDE_DATA {
UINT8 Protocol;
UINT8 HopLimit;
UINT32 FlowLabel;
} EFI_IP6_OVERRIDE_DATA;
typedef struct _EFI_IP6_TRANSMIT_DATA {
EFI_IPv6_ADDRESS DestinationAddress;
EFI_IP6_OVERRIDE_DATA *OverrideData;
UINT32 ExtHdrsLength;
VOID *ExtHdrs;
UINT8 NextHeader;
UINT32 DataLength;
UINT32 FragmentCount;
EFI_IP6_FRAGMENT_DATA FragmentTable[1];
} EFI_IP6_TRANSMIT_DATA;
#pragma pack(1)
typedef struct _EFI_IP6_HEADER {
UINT8 TrafficClassH:4;
UINT8 Version:4;
UINT8 FlowLabelH:4;
UINT8 TrafficClassL:4;
UINT16 FlowLabelL;
UINT16 PayloadLength;
UINT8 NextHeader;
UINT8 HopLimit;
EFI_IPv6_ADDRESS SourceAddress;
EFI_IPv6_ADDRESS DestinationAddress;
} EFI_IP6_HEADER;
#pragma pack()
typedef struct _EFI_IP6_RECEIVE_DATA {
EFI_TIME TimeStamp;
EFI_EVENT RecycleSignal;
UINT32 HeaderLength;
EFI_IP6_HEADER *Header;
UINT32 DataLength;
UINT32 FragmentCount;
EFI_IP6_FRAGMENT_DATA FragmentTable[1];
} EFI_IP6_RECEIVE_DATA;
typedef struct {
EFI_EVENT Event;
EFI_STATUS Status;
union {
EFI_IP6_RECEIVE_DATA *RxData;
EFI_IP6_TRANSMIT_DATA *TxData;
} Packet;
} EFI_IP6_COMPLETION_TOKEN;
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_TRANSMIT) (
IN struct _EFI_IP6 *This,
IN EFI_IP6_COMPLETION_TOKEN *Token
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_RECEIVE) (
IN struct _EFI_IP6 *This,
IN EFI_IP6_COMPLETION_TOKEN *Token
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_CANCEL)(
IN struct _EFI_IP6 *This,
IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_IP6_POLL) (
IN struct _EFI_IP6 *This
);
typedef struct _EFI_IP6 {
EFI_IP6_GET_MODE_DATA GetModeData;
EFI_IP6_CONFIGURE Configure;
EFI_IP6_GROUPS Groups;
EFI_IP6_ROUTES Routes;
EFI_IP6_NEIGHBORS Neighbors;
EFI_IP6_TRANSMIT Transmit;
EFI_IP6_RECEIVE Receive;
EFI_IP6_CANCEL Cancel;
EFI_IP6_POLL Poll;
} EFI_IP6;
#endif /* _EFI_IP_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,177 +0,0 @@
#ifndef _EFI_LINK_H
#define _EFI_LINK_H
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
link.h (renamed efilink.h to avoid conflicts)
Abstract:
EFI link list macro's
Revision History
--*/
#ifndef EFI_NT_EMUL
//
// List entry - doubly linked list
//
typedef struct _LIST_ENTRY {
struct _LIST_ENTRY *Flink;
struct _LIST_ENTRY *Blink;
} LIST_ENTRY;
#endif
//
// VOID
// InitializeListHead(
// LIST_ENTRY *ListHead
// );
//
#define InitializeListHead(ListHead) \
(ListHead)->Flink = ListHead; \
(ListHead)->Blink = ListHead;
//
// BOOLEAN
// IsListEmpty(
// PLIST_ENTRY ListHead
// );
//
#define IsListEmpty(ListHead) \
((ListHead)->Flink == (ListHead))
//
// VOID
// RemoveEntryList(
// PLIST_ENTRY Entry
// );
//
#define _RemoveEntryList(Entry) { \
LIST_ENTRY *_Blink, *_Flink; \
_Flink = (Entry)->Flink; \
_Blink = (Entry)->Blink; \
_Blink->Flink = _Flink; \
_Flink->Blink = _Blink; \
}
#if EFI_DEBUG
#define RemoveEntryList(Entry) \
_RemoveEntryList(Entry); \
(Entry)->Flink = (LIST_ENTRY *) BAD_POINTER; \
(Entry)->Blink = (LIST_ENTRY *) BAD_POINTER;
#else
#define RemoveEntryList(Entry) \
_RemoveEntryList(Entry);
#endif
//
// VOID
// InsertTailList(
// PLIST_ENTRY ListHead,
// PLIST_ENTRY Entry
// );
//
#define InsertTailList(ListHead,Entry) {\
LIST_ENTRY *_ListHead, *_Blink; \
_ListHead = (ListHead); \
_Blink = _ListHead->Blink; \
(Entry)->Flink = _ListHead; \
(Entry)->Blink = _Blink; \
_Blink->Flink = (Entry); \
_ListHead->Blink = (Entry); \
}
//
// VOID
// InsertHeadList(
// PLIST_ENTRY ListHead,
// PLIST_ENTRY Entry
// );
//
#define InsertHeadList(ListHead,Entry) {\
LIST_ENTRY *_ListHead, *_Flink; \
_ListHead = (ListHead); \
_Flink = _ListHead->Flink; \
(Entry)->Flink = _Flink; \
(Entry)->Blink = _ListHead; \
_Flink->Blink = (Entry); \
_ListHead->Flink = (Entry); \
}
// VOID
// SwapListEntries(
// PLIST_ENTRY Entry1,
// PLIST_ENTRY Entry2
// );
//
// Put Entry2 before Entry1
//
#define SwapListEntries(Entry1,Entry2) {\
LIST_ENTRY *Entry1Flink, *Entry1Blink; \
LIST_ENTRY *Entry2Flink, *Entry2Blink; \
Entry2Flink = (Entry2)->Flink; \
Entry2Blink = (Entry2)->Blink; \
Entry1Flink = (Entry1)->Flink; \
Entry1Blink = (Entry1)->Blink; \
Entry2Blink->Flink = Entry2Flink; \
Entry2Flink->Blink = Entry2Blink; \
(Entry2)->Flink = Entry1; \
(Entry2)->Blink = Entry1Blink; \
Entry1Blink->Flink = (Entry2); \
(Entry1)->Blink = (Entry2); \
}
//
// EFI_FIELD_OFFSET - returns the byte offset to a field within a structure
//
#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(intptr_t)(&(((TYPE *) 0)->Field)))
//
// CONTAINING_RECORD - returns a pointer to the structure
// from one of it's elements.
//
#define _CR(Record, TYPE, Field) \
((TYPE *) ( (CHAR8 *)(Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
#if EFI_DEBUG
#define CR(Record, TYPE, Field, Sig) \
_CR(Record, TYPE, Field)->Signature != Sig ? \
(TYPE *) ASSERT_STRUCT(_CR(Record, TYPE, Field), Record) : \
_CR(Record, TYPE, Field)
#else
#define CR(Record, TYPE, Field, Signature) \
_CR(Record, TYPE, Field)
#endif
//
// A lock structure
//
typedef struct _FLOCK {
EFI_TPL Tpl;
EFI_TPL OwnerTpl;
UINTN Lock;
} FLOCK;
#endif

View File

@ -1,348 +0,0 @@
#ifndef _EFINET_H
#define _EFINET_H
/*++
Copyright (c) 1999 Intel Corporation
Module Name:
efinet.h
Abstract:
EFI Simple Network protocol
Revision History
--*/
///////////////////////////////////////////////////////////////////////////////
//
// Simple Network Protocol
//
#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \
{ 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
INTERFACE_DECL(_EFI_SIMPLE_NETWORK_PROTOCOL);
///////////////////////////////////////////////////////////////////////////////
//
typedef struct {
//
// Total number of frames received. Includes frames with errors and
// dropped frames.
//
UINT64 RxTotalFrames;
//
// Number of valid frames received and copied into receive buffers.
//
UINT64 RxGoodFrames;
//
// Number of frames below the minimum length for the media.
// This would be <64 for ethernet.
//
UINT64 RxUndersizeFrames;
//
// Number of frames longer than the maxminum length for the
// media. This would be >1500 for ethernet.
//
UINT64 RxOversizeFrames;
//
// Valid frames that were dropped because receive buffers were full.
//
UINT64 RxDroppedFrames;
//
// Number of valid unicast frames received and not dropped.
//
UINT64 RxUnicastFrames;
//
// Number of valid broadcast frames received and not dropped.
//
UINT64 RxBroadcastFrames;
//
// Number of valid mutlicast frames received and not dropped.
//
UINT64 RxMulticastFrames;
//
// Number of frames w/ CRC or alignment errors.
//
UINT64 RxCrcErrorFrames;
//
// Total number of bytes received. Includes frames with errors
// and dropped frames.
//
UINT64 RxTotalBytes;
//
// Transmit statistics.
//
UINT64 TxTotalFrames;
UINT64 TxGoodFrames;
UINT64 TxUndersizeFrames;
UINT64 TxOversizeFrames;
UINT64 TxDroppedFrames;
UINT64 TxUnicastFrames;
UINT64 TxBroadcastFrames;
UINT64 TxMulticastFrames;
UINT64 TxCrcErrorFrames;
UINT64 TxTotalBytes;
//
// Number of collisions detection on this subnet.
//
UINT64 Collisions;
//
// Number of frames destined for unsupported protocol.
//
UINT64 UnsupportedProtocol;
} EFI_NETWORK_STATISTICS;
///////////////////////////////////////////////////////////////////////////////
//
typedef enum {
EfiSimpleNetworkStopped,
EfiSimpleNetworkStarted,
EfiSimpleNetworkInitialized,
EfiSimpleNetworkMaxState
} EFI_SIMPLE_NETWORK_STATE;
///////////////////////////////////////////////////////////////////////////////
//
#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01
#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02
#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04
#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08
#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
///////////////////////////////////////////////////////////////////////////////
//
#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01
#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02
#define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04
#define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08
///////////////////////////////////////////////////////////////////////////////
//
#define MAX_MCAST_FILTER_CNT 16
typedef struct {
UINT32 State;
UINT32 HwAddressSize;
UINT32 MediaHeaderSize;
UINT32 MaxPacketSize;
UINT32 NvRamSize;
UINT32 NvRamAccessSize;
UINT32 ReceiveFilterMask;
UINT32 ReceiveFilterSetting;
UINT32 MaxMCastFilterCount;
UINT32 MCastFilterCount;
EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT];
EFI_MAC_ADDRESS CurrentAddress;
EFI_MAC_ADDRESS BroadcastAddress;
EFI_MAC_ADDRESS PermanentAddress;
UINT8 IfType;
BOOLEAN MacAddressChangeable;
BOOLEAN MultipleTxSupported;
BOOLEAN MediaPresentSupported;
BOOLEAN MediaPresent;
} EFI_SIMPLE_NETWORK_MODE;
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_START) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_STOP) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
IN UINTN ExtraRxBufferSize OPTIONAL,
IN UINTN ExtraTxBufferSize OPTIONAL
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_RESET) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
IN UINT32 Enable,
IN UINT32 Disable,
IN BOOLEAN ResetMCastFilter,
IN UINTN MCastFilterCnt OPTIONAL,
IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
IN BOOLEAN Reset,
IN EFI_MAC_ADDRESS *New OPTIONAL
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
IN BOOLEAN Reset,
IN OUT UINTN *StatisticsSize OPTIONAL,
OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
IN BOOLEAN IPv6,
IN EFI_IP_ADDRESS *IP,
OUT EFI_MAC_ADDRESS *MAC
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
IN BOOLEAN ReadWrite,
IN UINTN Offset,
IN UINTN BufferSize,
IN OUT VOID *Buffer
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
OUT UINT32 *InterruptStatus OPTIONAL,
OUT VOID **TxBuf OPTIONAL
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
IN UINTN HeaderSize,
IN UINTN BufferSize,
IN VOID *Buffer,
IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,
IN UINT16 *Protocol OPTIONAL
);
///////////////////////////////////////////////////////////////////////////////
//
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) (
IN struct _EFI_SIMPLE_NETWORK_PROTOCOL *This,
OUT UINTN *HeaderSize OPTIONAL,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer,
OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
OUT UINT16 *Protocol OPTIONAL
);
///////////////////////////////////////////////////////////////////////////////
//
#define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000
#define EFI_SIMPLE_NETWORK_INTERFACE_REVISION EFI_SIMPLE_NETWORK_PROTOCOL_REVISION
typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL {
UINT64 Revision;
EFI_SIMPLE_NETWORK_START Start;
EFI_SIMPLE_NETWORK_STOP Stop;
EFI_SIMPLE_NETWORK_INITIALIZE Initialize;
EFI_SIMPLE_NETWORK_RESET Reset;
EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown;
EFI_SIMPLE_NETWORK_RECEIVE_FILTERS ReceiveFilters;
EFI_SIMPLE_NETWORK_STATION_ADDRESS StationAddress;
EFI_SIMPLE_NETWORK_STATISTICS Statistics;
EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC MCastIpToMac;
EFI_SIMPLE_NETWORK_NVDATA NvData;
EFI_SIMPLE_NETWORK_GET_STATUS GetStatus;
EFI_SIMPLE_NETWORK_TRANSMIT Transmit;
EFI_SIMPLE_NETWORK_RECEIVE Receive;
EFI_EVENT WaitForPacket;
EFI_SIMPLE_NETWORK_MODE *Mode;
} EFI_SIMPLE_NETWORK_PROTOCOL;
// Note: Because it conflicted with the EDK2 struct name, the
// 'EFI_SIMPLE_NETWORK_PROTOCOL' GUID definition, from older
// versions of gnu-efi, is now obsoleted.
// Use 'EFI_SIMPLE_NETWORK_PROTOCOL_GUID' instead.
typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL _EFI_SIMPLE_NETWORK;
typedef EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK;
#endif /* _EFINET_H */

View File

@ -1,61 +0,0 @@
#ifndef _EFI_PART_H
#define _EFI_PART_H
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
efipart.h
Abstract:
Info about disk partitions and Master Boot Records
Revision History
--*/
//
//
//
#define EFI_PARTITION 0xef
#define MBR_SIZE 512
#pragma pack(1)
typedef struct {
UINT8 BootIndicator;
UINT8 StartHead;
UINT8 StartSector;
UINT8 StartTrack;
UINT8 OSIndicator;
UINT8 EndHead;
UINT8 EndSector;
UINT8 EndTrack;
UINT8 StartingLBA[4];
UINT8 SizeInLBA[4];
} MBR_PARTITION_RECORD;
#define EXTRACT_UINT32(D) (UINT32)(D[0] | (D[1] << 8) | (D[2] << 16) | (D[3] << 24))
#define MBR_SIGNATURE 0xaa55
#define MIN_MBR_DEVICE_SIZE 0x80000
#define MBR_ERRATA_PAD 0x40000 // 128 MB
#define MAX_MBR_PARTITIONS 4
typedef struct {
UINT8 BootStrapCode[440];
UINT8 UniqueMbrSignature[4];
UINT8 Unknown[2];
MBR_PARTITION_RECORD Partition[MAX_MBR_PARTITIONS];
UINT16 Signature;
} MASTER_BOOT_RECORD;
#pragma pack()
#endif

View File

@ -1,399 +0,0 @@
#ifndef _EFI_PCI_IO_H
#define _EFI_PCI_IO_H
#define EFI_PCI_IO_PROTOCOL_GUID \
{ 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x02, 0x9a} }
#define EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \
{ 0x2f707ebb, 0x4a1a, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
INTERFACE_DECL(_EFI_PCI_IO_PROTOCOL);
INTERFACE_DECL(_EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL);
typedef enum {
EfiPciIoWidthUint8,
EfiPciIoWidthUint16,
EfiPciIoWidthUint32,
EfiPciIoWidthUint64,
EfiPciIoWidthFifoUint8,
EfiPciIoWidthFifoUint16,
EfiPciIoWidthFifoUint32,
EfiPciIoWidthFifoUint64,
EfiPciIoWidthFillUint8,
EfiPciIoWidthFillUint16,
EfiPciIoWidthFillUint32,
EfiPciIoWidthFillUint64,
EfiPciIoWidthMaximum
} EFI_PCI_IO_PROTOCOL_WIDTH, EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH;
#define EFI_PCI_IO_PASS_THROUGH_BAR 0xff
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT8 BarIndex,
IN UINT64 Offset,
IN UINT64 Mask,
IN UINT64 Value,
IN UINT64 Delay,
OUT UINT64 *Result
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM) (
IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINT64 Mask,
IN UINT64 Value,
IN UINT64 Delay,
OUT UINT64 *Result
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT8 BarIndex,
IN UINT64 Offset,
IN UINTN Count,
IN OUT VOID *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM) (
IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
);
typedef struct {
EFI_PCI_IO_PROTOCOL_IO_MEM Read;
EFI_PCI_IO_PROTOCOL_IO_MEM Write;
} EFI_PCI_IO_PROTOCOL_ACCESS;
typedef struct {
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM Read;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM Write;
} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS;
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT32 Offset,
IN UINTN Count,
IN OUT VOID *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION) (
IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
OUT VOID **Resources
);
typedef struct {
EFI_PCI_IO_PROTOCOL_CONFIG Read;
EFI_PCI_IO_PROTOCOL_CONFIG Write;
} EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT8 DestBarIndex,
IN UINT64 DestOffset,
IN UINT8 SrcBarIndex,
IN UINT64 SrcOffset,
IN UINTN Count
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_COPY_MEM) (
IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 DestAddress,
IN UINT64 SrcAddress,
IN UINTN Count
);
typedef enum {
EfiPciIoOperationBusMasterRead,
EfiPciIoOperationBusMasterWrite,
EfiPciIoOperationBusMasterCommonBuffer,
EfiPciIoOperationMaximum
} EFI_PCI_IO_PROTOCOL_OPERATION;
typedef enum {
EfiPciOperationBusMasterRead,
EfiPciOperationBusMasterWrite,
EfiPciOperationBusMasterCommonBuffer,
EfiPciOperationBusMasterRead64,
EfiPciOperationBusMasterWrite64,
EfiPciOperationBusMasterCommonBuffer64,
EfiPciOperationMaximum
} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION;
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_MAP) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,
IN VOID *HostAddress,
IN OUT UINTN *NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
OUT VOID **Mapping
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_MAP) (
IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation,
IN VOID *HostAddress,
IN OUT UINTN *NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
OUT VOID **Mapping
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
IN VOID *Mapping
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_UNMAP) (
IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN VOID *Mapping
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
OUT VOID **HostAddress,
IN UINT64 Attributes
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ALLOCATE_BUFFER) (
IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
IN OUT VOID **HostAddress,
IN UINT64 Attributes
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
IN UINTN Pages,
IN VOID *HostAddress
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FREE_BUFFER) (
IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN UINTN Pages,
IN VOID *HostAddress
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH) (
IN struct _EFI_PCI_IO_PROTOCOL *This
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FLUSH) (
IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
OUT UINTN *SegmentNumber,
OUT UINTN *BusNumber,
OUT UINTN *DeviceNumber,
OUT UINTN *FunctionNumber
);
#define EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001
#define EFI_PCI_ATTRIBUTE_ISA_IO 0x0002
#define EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO 0x0004
#define EFI_PCI_ATTRIBUTE_VGA_MEMORY 0x0008
#define EFI_PCI_ATTRIBUTE_VGA_IO 0x0010
#define EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO 0x0020
#define EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO 0x0040
#define EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080
#define EFI_PCI_ATTRIBUTE_IO 0x0100
#define EFI_PCI_ATTRIBUTE_MEMORY 0x0200
#define EFI_PCI_ATTRIBUTE_BUS_MASTER 0x0400
#define EFI_PCI_ATTRIBUTE_MEMORY_CACHED 0x0800
#define EFI_PCI_ATTRIBUTE_MEMORY_DISABLE 0x1000
#define EFI_PCI_ATTRIBUTE_EMBEDDED_DEVICE 0x2000
#define EFI_PCI_ATTRIBUTE_EMBEDDED_ROM 0x4000
#define EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000
#define EFI_PCI_ATTRIBUTE_ISA_IO_16 0x10000
#define EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000
#define EFI_PCI_ATTRIBUTE_VGA_IO_16 0x40000
#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO EFI_PCI_ATTRIBUTE_ISA_IO
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO
#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY EFI_PCI_ATTRIBUTE_VGA_MEMORY
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO EFI_PCI_ATTRIBUTE_VGA_IO
#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO
#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE
#define EFI_PCI_IO_ATTRIBUTE_IO EFI_PCI_ATTRIBUTE_IO
#define EFI_PCI_IO_ATTRIBUTE_MEMORY EFI_PCI_ATTRIBUTE_MEMORY
#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER EFI_PCI_ATTRIBUTE_BUS_MASTER
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED EFI_PCI_ATTRIBUTE_MEMORY_CACHED
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE EFI_PCI_ATTRIBUTE_MEMORY_DISABLE
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE EFI_PCI_ATTRIBUTE_EMBEDDED_DEVICE
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM EFI_PCI_ATTRIBUTE_EMBEDDED_ROM
#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 EFI_PCI_ATTRIBUTE_ISA_IO_16
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 EFI_PCI_ATTRIBUTE_VGA_IO_16
#define EFI_PCI_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER \
(EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE | EFI_PCI_ATTRIBUTE_MEMORY_CACHED | EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE)
#define EFI_PCI_ATTRIBUTE_INVALID_FOR_ALLOCATE_BUFFER \
(~EFI_PCI_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER)
typedef struct {
UINT8 Register;
UINT8 Function;
UINT8 Device;
UINT8 Bus;
UINT32 ExtendedRegister;
} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS;
typedef enum {
EfiPciIoAttributeOperationGet,
EfiPciIoAttributeOperationSet,
EfiPciIoAttributeOperationEnable,
EfiPciIoAttributeOperationDisable,
EfiPciIoAttributeOperationSupported,
EfiPciIoAttributeOperationMaximum
} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
IN UINT64 Attributes,
OUT UINT64 *Result OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
IN UINT8 BarIndex,
OUT UINT64 *Supports OPTIONAL,
OUT VOID **Resources OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES) (
IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
OUT UINT64 *Supports,
OUT UINT64 *Attributes
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES) (
IN struct _EFI_PCI_IO_PROTOCOL *This,
IN UINT64 Attributes,
IN UINT8 BarIndex,
IN OUT UINT64 *Offset,
IN OUT UINT64 *Length
);
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES) (
IN struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN UINT64 Attributes,
IN OUT UINT64 *ResourceBase,
IN OUT UINT64 *ResourceLength
);
typedef struct _EFI_PCI_IO_PROTOCOL {
EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollMem;
EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollIo;
EFI_PCI_IO_PROTOCOL_ACCESS Mem;
EFI_PCI_IO_PROTOCOL_ACCESS Io;
EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci;
EFI_PCI_IO_PROTOCOL_COPY_MEM CopyMem;
EFI_PCI_IO_PROTOCOL_MAP Map;
EFI_PCI_IO_PROTOCOL_UNMAP Unmap;
EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
EFI_PCI_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
EFI_PCI_IO_PROTOCOL_FLUSH Flush;
EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation;
EFI_PCI_IO_PROTOCOL_ATTRIBUTES Attributes;
EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES GetBarAttributes;
EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES SetBarAttributes;
UINT64 RomSize;
VOID *RomImage;
} EFI_PCI_IO_PROTOCOL;
// Note: Because it conflicted with the EDK2 struct name, the
// 'EFI_PCI_IO_PROTOCOL' GUID definition, from older versions
// of gnu-efi, is now obsoleted.
// Use 'EFI_PCI_IO_PROTOCOL_GUID' instead.
typedef struct _EFI_PCI_IO_PROTOCOL _EFI_PCI_IO;
typedef EFI_PCI_IO_PROTOCOL EFI_PCI_IO;
typedef struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL {
EFI_HANDLE ParentHandle;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM PollMem;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM PollIo;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Mem;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Io;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Pci;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_COPY_MEM CopyMem;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_MAP Map;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_UNMAP Unmap;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FLUSH Flush;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES GetAttributes;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES SetAttributes;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION Configuration;
UINT32 SegmentNumber;
} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL;
#endif /* _EFI_PCI_IO_H */

View File

@ -1,115 +0,0 @@
/* Copyright (C) 2014 by John Cronin
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef _EFI_POINT_H
#define _EFI_POINT_H
#define EFI_SIMPLE_POINTER_PROTOCOL_GUID \
{ 0x31878c87, 0xb75, 0x11d5, { 0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
INTERFACE_DECL(_EFI_SIMPLE_POINTER);
typedef struct {
INT32 RelativeMovementX;
INT32 RelativeMovementY;
INT32 RelativeMovementZ;
BOOLEAN LeftButton;
BOOLEAN RightButton;
} EFI_SIMPLE_POINTER_STATE;
typedef struct {
UINT64 ResolutionX;
UINT64 ResolutionY;
UINT64 ResolutionZ;
BOOLEAN LeftButton;
BOOLEAN RightButton;
} EFI_SIMPLE_POINTER_MODE;
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_POINTER_RESET) (
IN struct _EFI_SIMPLE_POINTER *This,
IN BOOLEAN ExtendedVerification
);
typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_POINTER_GET_STATE) (
IN struct _EFI_SIMPLE_POINTER *This,
IN OUT EFI_SIMPLE_POINTER_STATE *State
);
typedef struct _EFI_SIMPLE_POINTER {
EFI_SIMPLE_POINTER_RESET Reset;
EFI_SIMPLE_POINTER_GET_STATE GetState;
EFI_EVENT WaitForInput;
EFI_SIMPLE_POINTER_MODE *Mode;
} EFI_SIMPLE_POINTER_PROTOCOL;
#define EFI_ABSOLUTE_POINTER_PROTOCOL_GUID \
{ 0x8D59D32B, 0xC655, 0x4AE9, { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 } }
INTERFACE_DECL(_EFI_ABSOLUTE_POINTER_PROTOCOL);
typedef struct {
UINT64 AbsoluteMinX;
UINT64 AbsoluteMinY;
UINT64 AbsoluteMinZ;
UINT64 AbsoluteMaxX;
UINT64 AbsoluteMaxY;
UINT64 AbsoluteMaxZ;
UINT32 Attributes;
} EFI_ABSOLUTE_POINTER_MODE;
typedef struct {
UINT64 CurrentX;
UINT64 CurrentY;
UINT64 CurrentZ;
UINT32 ActiveButtons;
} EFI_ABSOLUTE_POINTER_STATE;
#define EFI_ABSP_SupportsAltActive 0x00000001
#define EFI_ABSP_SupportsPressureAsZ 0x00000002
#define EFI_ABSP_TouchActive 0x00000001
#define EFI_ABS_AltActive 0x00000002
typedef
EFI_STATUS
(EFIAPI *EFI_ABSOLUTE_POINTER_RESET) (
IN struct _EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
typedef
EFI_STATUS
(EFIAPI *EFI_ABSOLUTE_POINTER_GET_STATE) (
IN struct _EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN OUT EFI_ABSOLUTE_POINTER_STATE *State
);
typedef struct _EFI_ABSOLUTE_POINTER_PROTOCOL {
EFI_ABSOLUTE_POINTER_RESET Reset;
EFI_ABSOLUTE_POINTER_GET_STATE GetState;
EFI_EVENT WaitForInput;
EFI_ABSOLUTE_POINTER_MODE *Mode;
} EFI_ABSOLUTE_POINTER_PROTOCOL;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,482 +0,0 @@
#ifndef _EFIPXEBC_H
#define _EFIPXEBC_H
/*++
Copyright (c) 1998 Intel Corporation
Module Name:
efipxebc.h
Abstract:
EFI PXE Base Code Protocol
Revision History
--*/
//
// PXE Base Code protocol
//
#define EFI_PXE_BASE_CODE_PROTOCOL_GUID \
{ 0x03c4e603, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
INTERFACE_DECL(_EFI_PXE_BASE_CODE_PROTOCOL);
#define DEFAULT_TTL 4
#define DEFAULT_ToS 0
//
// Address definitions
//
typedef union {
UINT32 Addr[4];
EFI_IPv4_ADDRESS v4;
EFI_IPv6_ADDRESS v6;
} EFI_IP_ADDRESS;
typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
//
// Packet definitions
//
typedef struct {
UINT8 BootpOpcode;
UINT8 BootpHwType;
UINT8 BootpHwAddrLen;
UINT8 BootpGateHops;
UINT32 BootpIdent;
UINT16 BootpSeconds;
UINT16 BootpFlags;
UINT8 BootpCiAddr[4];
UINT8 BootpYiAddr[4];
UINT8 BootpSiAddr[4];
UINT8 BootpGiAddr[4];
UINT8 BootpHwAddr[16];
UINT8 BootpSrvName[64];
UINT8 BootpBootFile[128];
UINT32 DhcpMagik;
UINT8 DhcpOptions[56];
} EFI_PXE_BASE_CODE_DHCPV4_PACKET;
typedef struct {
UINT32 MessageType:8;
UINT32 TransactionId:24;
UINT8 DhcpOptions[1024];
} EFI_PXE_BASE_CODE_DHCPV6_PACKET;
typedef union {
UINT8 Raw[1472];
EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4;
EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6;
} EFI_PXE_BASE_CODE_PACKET;
typedef struct {
UINT8 Type;
UINT8 Code;
UINT16 Checksum;
union {
UINT32 reserved;
UINT32 Mtu;
UINT32 Pointer;
struct {
UINT16 Identifier;
UINT16 Sequence;
} Echo;
} u;
UINT8 Data[494];
} EFI_PXE_BASE_CODE_ICMP_ERROR;
typedef struct {
UINT8 ErrorCode;
CHAR8 ErrorString[127];
} EFI_PXE_BASE_CODE_TFTP_ERROR;
//
// IP Receive Filter definitions
//
#define EFI_PXE_BASE_CODE_MAX_IPCNT 8
typedef struct {
UINT8 Filters;
UINT8 IpCnt;
UINT16 reserved;
EFI_IP_ADDRESS IpList[EFI_PXE_BASE_CODE_MAX_IPCNT];
} EFI_PXE_BASE_CODE_IP_FILTER;
#define EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP 0x0001
#define EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST 0x0002
#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS 0x0004
#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST 0x0008
//
// ARP Cache definitions
//
typedef struct {
EFI_IP_ADDRESS IpAddr;
EFI_MAC_ADDRESS MacAddr;
} EFI_PXE_BASE_CODE_ARP_ENTRY;
typedef struct {
EFI_IP_ADDRESS IpAddr;
EFI_IP_ADDRESS SubnetMask;
EFI_IP_ADDRESS GwAddr;
} EFI_PXE_BASE_CODE_ROUTE_ENTRY;
//
// UDP definitions
//
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP 0x0001
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT 0x0002
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP 0x0004
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT 0x0008
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER 0x0010
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT 0x0020
//
// Discover() definitions
//
#define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP 0
#define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS 1
#define EFI_PXE_BASE_CODE_BOOT_TYPE_INTEL_LCM 2
#define EFI_PXE_BASE_CODE_BOOT_TYPE_DOSUNDI 3
#define EFI_PXE_BASE_CODE_BOOT_TYPE_NEC_ESMPRO 4
#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_WSoD 5
#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_LCCM 6
#define EFI_PXE_BASE_CODE_BOOT_TYPE_CA_UNICENTER_TNG 7
#define EFI_PXE_BASE_CODE_BOOT_TYPE_HP_OPENVIEW 8
#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_9 9
#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_10 10
#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_11 11
#define EFI_PXE_BASE_CODE_BOOT_TYPE_NOT_USED_12 12
#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_INSTALL 13
#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_BOOT 14
#define EFI_PXE_BASE_CODE_BOOT_TYPE_REMBO 15
#define EFI_PXE_BASE_CODE_BOOT_TYPE_BEOBOOT 16
//
// 17 through 32767 are reserved
// 32768 through 65279 are for vendor use
// 65280 through 65534 are reserved
//
#define EFI_PXE_BASE_CODE_BOOT_TYPE_PXETEST 65535
#define EFI_PXE_BASE_CODE_BOOT_LAYER_MASK 0x7FFF
#define EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL 0x0000
typedef struct {
UINT16 Type;
BOOLEAN AcceptAnyResponse;
UINT8 Reserved;
EFI_IP_ADDRESS IpAddr;
} EFI_PXE_BASE_CODE_SRVLIST;
typedef struct {
BOOLEAN UseMCast;
BOOLEAN UseBCast;
BOOLEAN UseUCast;
BOOLEAN MustUseList;
EFI_IP_ADDRESS ServerMCastIp;
UINT16 IpCnt;
EFI_PXE_BASE_CODE_SRVLIST SrvList[1];
} EFI_PXE_BASE_CODE_DISCOVER_INFO;
//
// Mtftp() definitions
//
typedef enum {
EFI_PXE_BASE_CODE_TFTP_FIRST,
EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
EFI_PXE_BASE_CODE_TFTP_READ_FILE,
EFI_PXE_BASE_CODE_TFTP_WRITE_FILE,
EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY,
EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE,
EFI_PXE_BASE_CODE_MTFTP_READ_FILE,
EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY,
EFI_PXE_BASE_CODE_MTFTP_LAST
} EFI_PXE_BASE_CODE_TFTP_OPCODE;
typedef struct {
EFI_IP_ADDRESS MCastIp;
EFI_PXE_BASE_CODE_UDP_PORT CPort;
EFI_PXE_BASE_CODE_UDP_PORT SPort;
UINT16 ListenTimeout;
UINT16 TransmitTimeout;
} EFI_PXE_BASE_CODE_MTFTP_INFO;
//
// PXE Base Code Mode structure
//
#define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8
#define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8
typedef struct {
BOOLEAN Started;
BOOLEAN Ipv6Available;
BOOLEAN Ipv6Supported;
BOOLEAN UsingIpv6;
BOOLEAN BisSupported;
BOOLEAN BisDetected;
BOOLEAN AutoArp;
BOOLEAN SendGUID;
BOOLEAN DhcpDiscoverValid;
BOOLEAN DhcpAckReceived;
BOOLEAN ProxyOfferReceived;
BOOLEAN PxeDiscoverValid;
BOOLEAN PxeReplyReceived;
BOOLEAN PxeBisReplyReceived;
BOOLEAN IcmpErrorReceived;
BOOLEAN TftpErrorReceived;
BOOLEAN MakeCallbacks;
UINT8 TTL;
UINT8 ToS;
EFI_IP_ADDRESS StationIp;
EFI_IP_ADDRESS SubnetMask;
EFI_PXE_BASE_CODE_PACKET DhcpDiscover;
EFI_PXE_BASE_CODE_PACKET DhcpAck;
EFI_PXE_BASE_CODE_PACKET ProxyOffer;
EFI_PXE_BASE_CODE_PACKET PxeDiscover;
EFI_PXE_BASE_CODE_PACKET PxeReply;
EFI_PXE_BASE_CODE_PACKET PxeBisReply;
EFI_PXE_BASE_CODE_IP_FILTER IpFilter;
UINT32 ArpCacheEntries;
EFI_PXE_BASE_CODE_ARP_ENTRY ArpCache[EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES];
UINT32 RouteTableEntries;
EFI_PXE_BASE_CODE_ROUTE_ENTRY RouteTable[EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES];
EFI_PXE_BASE_CODE_ICMP_ERROR IcmpError;
EFI_PXE_BASE_CODE_TFTP_ERROR TftpError;
} EFI_PXE_BASE_CODE_MODE;
//
// PXE Base Code Interface Function definitions
//
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_START) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This,
IN BOOLEAN UseIpv6
);
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_STOP) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This
);
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_DHCP) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This,
IN BOOLEAN SortOffers
);
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_DISCOVER) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This,
IN UINT16 Type,
IN UINT16 *Layer,
IN BOOLEAN UseBis,
IN OUT EFI_PXE_BASE_CODE_DISCOVER_INFO *Info OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_MTFTP) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This,
IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
IN OUT VOID *BufferPtr OPTIONAL,
IN BOOLEAN Overwrite,
IN OUT UINT64 *BufferSize,
IN UINTN *BlockSize OPTIONAL,
IN EFI_IP_ADDRESS *ServerIp,
IN UINT8 *Filename,
IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL,
IN BOOLEAN DontUseBuffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_UDP_WRITE) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This,
IN UINT16 OpFlags,
IN EFI_IP_ADDRESS *DestIp,
IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort,
IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL
IN EFI_IP_ADDRESS *SrcIp, OPTIONAL
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
IN UINTN *HeaderSize, OPTIONAL
IN VOID *HeaderPtr, OPTIONAL
IN UINTN *BufferSize,
IN VOID *BufferPtr
);
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_UDP_READ) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This,
IN UINT16 OpFlags,
IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL
IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
IN UINTN *HeaderSize, OPTIONAL
IN VOID *HeaderPtr, OPTIONAL
IN OUT UINTN *BufferSize,
IN VOID *BufferPtr
);
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_SET_IP_FILTER) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This,
IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter
);
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_ARP) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This,
IN EFI_IP_ADDRESS *IpAddr,
IN EFI_MAC_ADDRESS *MacAddr OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_SET_PARAMETERS) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This,
IN BOOLEAN *NewAutoArp, OPTIONAL
IN BOOLEAN *NewSendGUID, OPTIONAL
IN UINT8 *NewTTL, OPTIONAL
IN UINT8 *NewToS, OPTIONAL
IN BOOLEAN *NewMakeCallback OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_SET_STATION_IP) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This,
IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL
IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_SET_PACKETS) (
IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This,
BOOLEAN *NewDhcpDiscoverValid, OPTIONAL
BOOLEAN *NewDhcpAckReceived, OPTIONAL
BOOLEAN *NewProxyOfferReceived, OPTIONAL
BOOLEAN *NewPxeDiscoverValid, OPTIONAL
BOOLEAN *NewPxeReplyReceived, OPTIONAL
BOOLEAN *NewPxeBisReplyReceived,OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewDhcpDiscover, OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewDhcpAck, OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewProxyOffer, OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewPxeDiscover, OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewPxeReply, OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply OPTIONAL
);
//
// PXE Base Code Protocol structure
//
#define EFI_PXE_BASE_CODE_PROTOCOL_REVISION 0x00010000
#define EFI_PXE_BASE_CODE_INTERFACE_REVISION EFI_PXE_BASE_CODE_PROTOCOL_REVISION
typedef struct _EFI_PXE_BASE_CODE_PROTOCOL {
UINT64 Revision;
EFI_PXE_BASE_CODE_START Start;
EFI_PXE_BASE_CODE_STOP Stop;
EFI_PXE_BASE_CODE_DHCP Dhcp;
EFI_PXE_BASE_CODE_DISCOVER Discover;
EFI_PXE_BASE_CODE_MTFTP Mtftp;
EFI_PXE_BASE_CODE_UDP_WRITE UdpWrite;
EFI_PXE_BASE_CODE_UDP_READ UdpRead;
EFI_PXE_BASE_CODE_SET_IP_FILTER SetIpFilter;
EFI_PXE_BASE_CODE_ARP Arp;
EFI_PXE_BASE_CODE_SET_PARAMETERS SetParameters;
EFI_PXE_BASE_CODE_SET_STATION_IP SetStationIp;
EFI_PXE_BASE_CODE_SET_PACKETS SetPackets;
EFI_PXE_BASE_CODE_MODE *Mode;
} EFI_PXE_BASE_CODE_PROTOCOL;
// Note: Because it conflicted with the EDK2 struct name, the
// 'EFI_PXE_BASE_CODE_PROTOCOL' GUID definition, from older
// versions of gnu-efi, is now obsoleted.
// Use 'EFI_PXE_BASE_CODE_PROTOCOL_GUID' instead.
typedef struct _EFI_PXE_BASE_CODE_PROTOCOL _EFI_PXE_BASE_CODE;
typedef struct _EFI_PXE_BASE_CODE_PROTOCOL EFI_PXE_BASE_CODE;
//
// Call Back Definitions
//
#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID \
{ 0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
//
// Revision Number
//
#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION 0x00010000
#define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION
INTERFACE_DECL(_EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL);
typedef enum {
EFI_PXE_BASE_CODE_FUNCTION_FIRST,
EFI_PXE_BASE_CODE_FUNCTION_DHCP,
EFI_PXE_BASE_CODE_FUNCTION_DISCOVER,
EFI_PXE_BASE_CODE_FUNCTION_MTFTP,
EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE,
EFI_PXE_BASE_CODE_FUNCTION_UDP_READ,
EFI_PXE_BASE_CODE_FUNCTION_ARP,
EFI_PXE_BASE_CODE_FUNCTION_IGMP,
EFI_PXE_BASE_CODE_PXE_FUNCTION_LAST
} EFI_PXE_BASE_CODE_FUNCTION;
typedef enum {
EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST,
EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT,
EFI_PXE_BASE_CODE_CALLBACK_STATUS_LAST
} EFI_PXE_BASE_CODE_CALLBACK_STATUS;
typedef
EFI_PXE_BASE_CODE_CALLBACK_STATUS
(EFIAPI *EFI_PXE_CALLBACK) (
IN struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *This,
IN EFI_PXE_BASE_CODE_FUNCTION Function,
IN BOOLEAN Received,
IN UINT32 PacketLen,
IN EFI_PXE_BASE_CODE_PACKET *Packet OPTIONAL
);
typedef struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL {
UINT64 Revision;
EFI_PXE_CALLBACK Callback;
} EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL;
// Note: Because it conflicted with the EDK2 struct name, the
// 'EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL' GUID definition, from
// older versions of gnu-efi, is now obsoleted.
// Use 'EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID' instead.
typedef struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL _EFI_PXE_BASE_CODE_CALLBACK;
typedef EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK;
#endif /* _EFIPXEBC_H */

Some files were not shown because too many files have changed in this diff Show More