From 454247f5b375f2f52893242354fb78b27e0d9776 Mon Sep 17 00:00:00 2001 From: "Zone.N" Date: Wed, 17 May 2023 23:54:27 +0800 Subject: [PATCH 01/37] perf(cmake): remove nostdinc Signed-off-by: Zone.N --- src/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4a9b30988..854a868c0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,10 +58,10 @@ endif () target_link_options(${KernelName} PRIVATE -T ${CMAKE_SOURCE_DIR}/arch/${ARCH}/link.ld) # 其它链接选项 -if (ARCH STREQUAL riscv64) +if (ARCH STREQUAL "riscv64") target_link_options(${KernelName} PRIVATE -Wl,-melf64lriscv) -elseif (ARCH STREQUAL x86_64) +elseif (ARCH STREQUAL "x86_64") target_link_options(${KernelName} PRIVATE -Wl,-melf_x86_64) -elseif (ARCH STREQUAL aarch64) +elseif (ARCH STREQUAL "aarch64") target_link_options(${KernelName} PRIVATE -Wl,-maarch64elf) endif () From 75ae47619e87e8daea885a06a9cc3e1fe4221f42 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Sun, 18 Jun 2023 23:22:31 +0800 Subject: [PATCH 02/37] =?UTF-8?q?posix-uefi=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 1 + tools/startup.nsh | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 tools/startup.nsh diff --git a/CMakeLists.txt b/CMakeLists.txt index 36779be97..2774e366c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,6 +170,7 @@ add_custom_command(TARGET image_uefi COMMENT "Copying bootloader and kernel" COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/image/efi/boot COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/*.efi ${CMAKE_BINARY_DIR}/image/efi/boot/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tools/startup.nsh ${CMAKE_BINARY_DIR}/image/startup.nsh ) # 制作镜像 add_custom_target(image DEPENDS image_uefi) diff --git a/tools/startup.nsh b/tools/startup.nsh new file mode 100644 index 000000000..dbed0a12d --- /dev/null +++ b/tools/startup.nsh @@ -0,0 +1,4 @@ +fs0: +cd efi +cd boot +kernel.efi From c302fc00166f139dd74252317c5bddce0f9fd40c Mon Sep 17 00:00:00 2001 From: KehRoche Date: Sun, 18 Jun 2023 23:40:52 +0800 Subject: [PATCH 03/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 13 +++++++ src/CMakeLists.txt | 6 ++- src/arch/x86_64/CMakeLists.txt | 6 +-- src/arch/x86_64/boot/boot.S | 67 ---------------------------------- src/arch/x86_64/boot/boot.cpp | 20 +++++++--- 5 files changed, 34 insertions(+), 78 deletions(-) delete mode 100644 src/arch/x86_64/boot/boot.S diff --git a/CMakeLists.txt b/CMakeLists.txt index 2774e366c..b537b6db4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,19 @@ add_custom_command(TARGET gnuefi COMMENT "build gnu-efi..." ) +## posix-uefi +#add_custom_target(posixuefi) +#add_custom_command(TARGET posixuefi +# POST_BUILD +# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/3rd/posix-uefi +# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/3rd/posix-uefi +# COMMAND +# make +# ARCH=${ARCH} +# OBJDIR=${CMAKE_BINARY_DIR}/3rd/gnu-efi +# COMMENT "build gnu-efi..." +# ) + add_custom_target(kernel_pre) if (ARCH STREQUAL "riscv64") add_custom_command(TARGET kernel_pre diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 854a868c0..ac03a5b4d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,11 +30,12 @@ elseif (ARCH STREQUAL "x86_64") # 将各个子对象链接为内核文件 add_executable(${KernelName} ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/reloc_${ARCH}.o + ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/crt0-efi-${ARCH}.o # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/bin/crt0_${ARCH}.o $ $ ) - link_libraries(${KernelName} PRIVATE + target_link_libraries(${KernelName} PRIVATE ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/lib/libefi.a ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/libgnuefi.a # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/bin/libuefi_${ARCH}.a @@ -43,11 +44,12 @@ elseif (ARCH STREQUAL "aarch64") # 将各个子对象链接为内核文件 add_executable(${KernelName} ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/reloc_${ARCH}.o + ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/crt0-efi-${ARCH}.o # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/bin/crt0_${ARCH}.o $ $ ) - link_libraries(${KernelName} PRIVATE + target_link_libraries(${KernelName} PRIVATE ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/lib/libefi.a ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/libgnuefi.a # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/bin/libuefi_${ARCH}.a diff --git a/src/arch/x86_64/CMakeLists.txt b/src/arch/x86_64/CMakeLists.txt index c5a14557e..95da47c8e 100644 --- a/src/arch/x86_64/CMakeLists.txt +++ b/src/arch/x86_64/CMakeLists.txt @@ -11,12 +11,10 @@ PROJECT(arch) enable_language(ASM) enable_language(CXX) -# 寻找汇编文件 -find_asm_source_files(boot_asm_src ${arch_SOURCE_DIR}/boot) -aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/boot c_cxx_src) +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/boot boot_src) # 添加到 boot_src -set(boot_src ${boot_asm_src} ${c_cxx_src}) +set(boot_src ${boot_src}) # 设置子模块所有的源码 set(arch_src ${boot_src}) diff --git a/src/arch/x86_64/boot/boot.S b/src/arch/x86_64/boot/boot.S deleted file mode 100644 index 2f027c29e..000000000 --- a/src/arch/x86_64/boot/boot.S +++ /dev/null @@ -1,67 +0,0 @@ - -/** - * @file boot.S - * @brief uefi 引动 - * @author Zone.N (Zone.Niuzh@hotmail.com) - * @version 1.0 - * @date 2021-01-01 - * @copyright MIT LICENSE - * https://github.com/Simple-XX/SimpleKernel - * @par change log: - * - *
DateAuthorDescription - *
2021-01-02MRNIU迁移到 doxygen - *
2023-05-20kehrocheuefi - *
- */ - -// clang-format off - -.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: - // Page RVA - .long dummy-label1 - // Block Size (2*4+2*2), must be aligned by 32 Bits - .long 12 - // reloc for dummy - .word (IMAGE_REL_ABSOLUTE<<12) + 0 - // reloc for dummy - .word (IMAGE_REL_ABSOLUTE<<12) + 0 - -#if defined(__ELF__) && defined(__linux__) -.section .note.GNU-stack,"",%progbits -#endif diff --git a/src/arch/x86_64/boot/boot.cpp b/src/arch/x86_64/boot/boot.cpp index 4df217bb8..5fa2f57f0 100644 --- a/src/arch/x86_64/boot/boot.cpp +++ b/src/arch/x86_64/boot/boot.cpp @@ -18,7 +18,7 @@ #include "efi.h" #include "efilib.h" -// #include "uefi.h" +//#include "uefi.h" #include "kernel.h" @@ -42,7 +42,17 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { return EFI_SUCCESS; } -// int main(int, char**){ -// printf("1111\n"); -// return 0; -// } +///** +// * Dump memory at given address, should accept 0x prefixes from the command line +// */ +//extern "C" int main(int argc, char** argv) { +// efi_physical_address_t address +// = (argc < 2 ? (efi_physical_address_t)IM +// : (efi_physical_address_t)atol(argv[1])); +// +// printf("%4D", address); +// +// kernel_main(); +// +// return EFI_SUCCESS; +//} From 42866e6f4513f1b93cc7712119cd26ed1e280803 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Sun, 18 Jun 2023 23:54:51 +0800 Subject: [PATCH 04/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 34 ++++++++++++-------- run.sh | 4 +-- src/CMakeLists.txt | 16 +++++----- src/arch/x86_64/boot/boot.cpp | 58 +++++++++++++++++------------------ 4 files changed, 60 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b537b6db4..36165c0fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,18 +55,25 @@ add_custom_command(TARGET gnuefi COMMENT "build gnu-efi..." ) -## posix-uefi -#add_custom_target(posixuefi) -#add_custom_command(TARGET posixuefi -# POST_BUILD -# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/3rd/posix-uefi -# COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/3rd/posix-uefi -# COMMAND -# make -# ARCH=${ARCH} -# OBJDIR=${CMAKE_BINARY_DIR}/3rd/gnu-efi -# COMMENT "build gnu-efi..." -# ) +# posix-uefi +add_custom_target(posixuefi) +add_custom_command(TARGET posixuefi + POST_BUILD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/3rd/posix-uefi/uefi + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/3rd/posix-uefi + COMMAND + USE_GCC=1 + ARCH=${ARCH} + make + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/3rd/posix-uefi/build/uefi/crt0.o ${CMAKE_BINARY_DIR}/3rd/posix-uefi + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/3rd/posix-uefi/build/uefi/libuefi.a ${CMAKE_BINARY_DIR}/3rd/posix-uefi + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/3rd/posix-uefi/build/uefi/uefi.h ${CMAKE_BINARY_DIR}/3rd/posix-uefi + COMMAND + make clean + COMMAND + rm -rf ${CMAKE_SOURCE_DIR}/3rd/posix-uefi/build + COMMENT "build gnu-efi..." + ) add_custom_target(kernel_pre) if (ARCH STREQUAL "riscv64") @@ -77,8 +84,9 @@ if (ARCH STREQUAL "riscv64") elseif (ARCH STREQUAL "x86_64") add_custom_command(TARGET kernel_pre - DEPENDS gnuefi + DEPENDS gnuefi posixuefi COMMAND make gnuefi + COMMAND make posixuefi ) elseif (ARCH STREQUAL "aarch64") diff --git a/run.sh b/run.sh index 01798a885..0cdf9032e 100755 --- a/run.sh +++ b/run.sh @@ -13,8 +13,8 @@ set -e MACHINE=qemu -ARCH=riscv64 -#ARCH=x86_64 +#ARCH=riscv64 +ARCH=x86_64 #ARCH=aarch64 CMAKE_BUILD_TYPE=Debug diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ac03a5b4d..5cb55e52a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,30 +29,30 @@ if (ARCH STREQUAL "riscv64") elseif (ARCH STREQUAL "x86_64") # 将各个子对象链接为内核文件 add_executable(${KernelName} - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/reloc_${ARCH}.o - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/crt0-efi-${ARCH}.o - # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/bin/crt0_${ARCH}.o +# ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/reloc_${ARCH}.o +# ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/crt0-efi-${ARCH}.o + ${CMAKE_BINARY_DIR}/../3rd/posix-uefi/crt0.o $ $ ) target_link_libraries(${KernelName} PRIVATE - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/lib/libefi.a - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/libgnuefi.a - # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/bin/libuefi_${ARCH}.a +# ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/lib/libefi.a +# ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/libgnuefi.a + ${CMAKE_BINARY_DIR}/../3rd/posix-uefi/libuefi.a ) elseif (ARCH STREQUAL "aarch64") # 将各个子对象链接为内核文件 add_executable(${KernelName} ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/reloc_${ARCH}.o ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/crt0-efi-${ARCH}.o - # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/bin/crt0_${ARCH}.o + # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/crt0.o $ $ ) target_link_libraries(${KernelName} PRIVATE ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/lib/libefi.a ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/libgnuefi.a - # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/bin/libuefi_${ARCH}.a + # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/libuefi.a ) endif () diff --git a/src/arch/x86_64/boot/boot.cpp b/src/arch/x86_64/boot/boot.cpp index 5fa2f57f0..772a81deb 100644 --- a/src/arch/x86_64/boot/boot.cpp +++ b/src/arch/x86_64/boot/boot.cpp @@ -15,44 +15,44 @@ */ #include "cassert" -#include "efi.h" -#include "efilib.h" +//#include "efi.h" +//#include "efilib.h" -//#include "uefi.h" +#include "uefi.h" #include "kernel.h" -/** - * efi_main - The entry point for the EFI application - * @image: firmware-allocated handle that identifies the image - * @SystemTable: EFI system table - */ -extern "C" EFI_STATUS -efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { - uefi_call_wrapper(InitializeLib, 2, image, systemTable); - EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, 1, - systemTable->ConOut); - - status = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, - systemTable->ConOut, L"Hello UEFI!\n"); - assert(status != EFI_SUCCESS); - - kernel_main(); - - return EFI_SUCCESS; -} - ///** -// * Dump memory at given address, should accept 0x prefixes from the command line +// * efi_main - The entry point for the EFI application +// * @image: firmware-allocated handle that identifies the image +// * @SystemTable: EFI system table // */ -//extern "C" int main(int argc, char** argv) { -// efi_physical_address_t address -// = (argc < 2 ? (efi_physical_address_t)IM -// : (efi_physical_address_t)atol(argv[1])); +//extern "C" EFI_STATUS +//efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { +// uefi_call_wrapper(InitializeLib, 2, image, systemTable); +// EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, 1, +// systemTable->ConOut); // -// printf("%4D", address); +// status = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, +// systemTable->ConOut, L"Hello UEFI!\n"); +// assert(status != EFI_SUCCESS); // // kernel_main(); // // return EFI_SUCCESS; //} + +/** + * Dump memory at given address, should accept 0x prefixes from the command line + */ +extern "C" int main(int argc, char** argv) { + efi_physical_address_t address + = (argc < 2 ? (efi_physical_address_t)IM + : (efi_physical_address_t)atol(argv[1])); + + printf("%4D", address); + + kernel_main(); + + return EFI_SUCCESS; +} From eb0edec6fb4ae79277e3599d095c779b7efb0f7e Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 19 Jun 2023 00:19:07 +0800 Subject: [PATCH 05/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- 3rd/posix-uefi/bin/libuefi_aarch64.a | Bin 67728 -> 0 bytes 3rd/posix-uefi/bin/libuefi_riscv64.a | Bin 121104 -> 0 bytes 3rd/posix-uefi/bin/libuefi_x86_64.a | Bin 56752 -> 0 bytes 3rd/posix-uefi/bin/link_aarch64.ld | 63 -- 3rd/posix-uefi/bin/link_riscv64.ld | 64 -- 3rd/posix-uefi/bin/link_x86_64.ld | 76 -- 3rd/posix-uefi/bin/uefi.h | 1433 -------------------------- CMakeLists.txt | 1 + cmake/config.cmake | 5 +- run.sh | 4 + src/CMakeLists.txt | 22 +- src/arch/x86_64/boot/boot.cpp | 54 +- 12 files changed, 54 insertions(+), 1668 deletions(-) delete mode 100644 3rd/posix-uefi/bin/libuefi_aarch64.a delete mode 100644 3rd/posix-uefi/bin/libuefi_riscv64.a delete mode 100644 3rd/posix-uefi/bin/libuefi_x86_64.a delete mode 100644 3rd/posix-uefi/bin/link_aarch64.ld delete mode 100644 3rd/posix-uefi/bin/link_riscv64.ld delete mode 100644 3rd/posix-uefi/bin/link_x86_64.ld delete mode 100644 3rd/posix-uefi/bin/uefi.h diff --git a/3rd/posix-uefi/bin/libuefi_aarch64.a b/3rd/posix-uefi/bin/libuefi_aarch64.a deleted file mode 100644 index c76fc0ec94b22efbc361442c0697e535dd4ff6d3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 67728 zcmeIb4|tWwc_%tY5?C>^EwECEO`{`2V}dcrhQ^SP%Mmy+wn>bIT+@c9NC;sFLPCGA zp^*9z(}o7pfX&{pwM|6g>|&PWvRUs_YuCFGHQmyh?t_8d$M>n5o&zM|HsoHw?tRc+ zi0`D0W4XI(vFFzI&Ym^`T|J%My{4zPrPr)kOv~#+quf%ryaTM=4nk!dwXZAX>}(^XKx{9n`v1_ZM3al<$jhf>oLoE z+Gx;b&9ZjnY|XOX&Zk<q4Agp}+Vm-d!th|Q=tb;!9DrG;Ax#6WPcfe!7E`{gJ+hJqnZ zdd4MhdplRlX(@|*&FbD&Yuc8!tyl#s;H80vTH5WE{aM%3-qr?w_IF)J`>KxBrh5(T z1^;awy;D22zH2RJb@yxdr)JEs9^l@YpK=%J<{O{>+=9=SrBbNw?ns$Gh4~IY&fieL zGWIfKZZcKo%Etfj@|AM4Gk1#_1iS-rah>7yuH0BNm>ZiJtTpCBvoTG)c6es+%Es6C z4U{kauS4^0eDlgiQ{b^6dpvim8Jt^}J)SbzM)Jh}P8$z=%d0bk`R^i)XUxu1<*EJo zaZ01yVa$=IfZM%zfK(28F}8x zykFV)ACr7D4@_@>^5ME{d}a{&KhEn6@>ZKJ|1VcI{+ZQT7!SO6X;}AiV;-0{@6+i? zk1bo*(Yr2v&%IOcomzkQ^mX?3o=*yZIQD>(wMXjr8coIekEd?0sx{+*Ko9oF@VDXS z`WHv;8S%v*|Lx7ZW%x{9;JD16hMRYcXn3)4&!e0E_Q#-L_+sKXEM3FR=@%>ZlrNC@ zY2fP_h=a6EfH{*R*{j{lk^5~h9xT$dZKl1Z53Q)vw~AP0SA2-*8`GjbUIF(6|+{bYoq4rjFi zf$Zr{{E~jQh^pm%kKh?gCFPInS@NeSD?h`)od{TsdN`!uk;7oU{GQnBx zZ3J+%1<5g6t`yJ6{gMFJdbBCP)t=4No(*eyTbALBu7N$T)T{2c_Lix=ZR>l@)a5O` zEoSPno*px`yVKpYcCJ~2=HE>1=K?S9G_aH}NYv(%?fC zg&rmYj0Zaa{^8ps@!RoFEQ5dlm@lp}C-I#hHi?JR`tk`xB8l3G@;DZxt9S@cK>)pG zEWY}CjUReg`akmYZGg0ze#keBPd~}{TF)7m#|aUX`STBzU(a(9sMkInItwL_5Pn?Z zhw^KNb_ZNS`Pm^WReqDi=`~AymLKD4d@Vo9Gc0Xjy9Lb1c@!{qHp2KH0T${QkaBn7KSLq# zJIdT>hMq~i$$oZzlo>pAi|Ic-%Jk<(W%_F?OxJ;O_8YVP=JLD~xoPNkqu-dj3+GWd z--+{G?9<{JeQRE)(q?BK;rTl=gLS}>PtXYt`aJs17Mq5673NLL6W8pc9=I~pgnC@V z^l}prk7?E7%(QODxz?sNEB7Pxk#U`>Kw1dT-)_^I1-`R#xVAXx^FPWsY=Wdkp19Vu z*!M-=rOzzS8+f+JBQMayAoMVJ3TabjK4aMavN2s>E;CIQr+f%gd^Mg265OYkzBl@4 zHROYKu!ix_e%2)P9-sEB@j-l;By@znyztRyo+}$)asB=v4@@&R2YH_ZJyd4w^G5@p zUBE-{4~dMmX>%cW!?$lk!!(BcGk8YHJ!Sfbz6P6sjJ4y;g(H=wDGy$ZpEhP&?qM@H zld?Pv>=83Kk=IYbexR!c=qmS!EjL$|h?6TfZ{&e7Zi=>pYikohSe|7J`$3(x`Ss)F zL3^<%4O+U2Lisi2ZX-Q zTzGIK=)sru5BZ!dw72JaP#!(me&!AO-j?gh^qcjyi_E6XbE@0Zu-#L5e$1Cw?5B<& zpnjMx;@SK|eis*faLqg=ad4kQyiYR@<@fm8xDOQK>U|O)VYW;Ve=_4EKb9|X@}@ts=Yp68L-x=`F>X zWm8Jmix9R5G>@CXJIMD5XSXfzduiG}?cSGhsmM4D@xa^42+Yce`~0+sj8=}!;P)sa z=xsT&+#p+?VYi5_L1ugZxU;Q&BgCg5e@u@yntK8=iJaent=jq~_nTvKgP+yyU6333 zwQ>Wqa^pUKS43{Bo6O)-kef2vvIb`B1$Czwcv%d3^yNoC+4)4u51LT^hgjE`e}u6v zO{#z$`1(eem78sil^3+YtlYR~JHzW?Hi0nGJqWqA978>ql6~*c(AZkE3%Rd3J2>=y zeVw*no-ewpuS2`Ud|a=uyVWm`M@0AkNWN|{>Pabo$a-#d4EwG#=8aRdbCi1q*DTxg zvFxAtw)+Lv`6t8|p{%U`pihS_TmON$|K}Cd7x)d@EP1lb=;JJZvCZq^4<5t#Bh5qP zk8=*PBK!?2AJRbjlU*H4t-c#_<|!xebmhRGSYPI7_A`HXuuh9CF&=CDyoxMrlYPE9 z^gG7>a%k+8jYsWx-1QE)>GQll*2ZV;aroy^0mH&rSo6~|hNjO5hZ!hiaGl;5+Ct(u zjOxA50Zv5_$C`$v>pK6f97gJSs%7np zbsepkB3M4%P2o(n1NJTLt6F+E*5syjm`ZHyV1^UH=-7egzbU{~j;oCk3>zN!M;sQo z9rCh>LJemmAG@7F$enwBOm1*dhkwQopUd6~;%OW)2fa0S;)>6S?>9cj1jtkC8!qjk z>0j%a{5L@z%0vdgyiWNalK8`F7$2f>taYd4SD%R$_#7@O@SjmY&X@QQjbpw$Ssk&A zG`{*B%04V@U~47)g_1dD=cW?ziHEueWCkRCwR2)TLS4n4$usgCto6ag9v+{wq242T z`kM1!(`6#;JQIUwkfS+f$2YWMtAkx0%c=+;?U9+&0RE<#7!bJJ?@3 zRA%Rt`i;qs;d3W(=%?fy8sn9Xbn{~51=?MVhw`k+<32amVR+u}FI;E(3(uW}xjJ9g zK6$2uJXY42d}x-gDqoAuS9T0+(LO(me2tnu?#*QW;CO2JuXdj50GUb~xyoxJXA;Me z<&T8_?zI|7kfIDwr#`%SCW=$44RdwVGd2?9a8-#?4L?fF8#z87eBS5|B>e z*j)8+QLKTK!r7LW!s{Y9eR?T+ZJSk&Ea>cEodB9<|Lte*RzZaQaI< z-ja(@{(l&?H1DDF zNt$1_$Ns@S60wXA@>&SBjb)Pyl@4p8*#{vWwzC+6EO~_R6i~5D-*5bT5SKi|e!^Nw zNSb<3xI^tn?`PqHr1c8Od85R?Rv&Aw#1EpIy%ImfLpV0?u}=sW2Mj{_WAh#hrLt?j zSbmJF@y7{YCKKw;1_`KreCn|Z|6%-CAM1z|=nTuO@Dt`g*2l_<{4Is3_9~2TSEPBJ ztZVhLrq@rO{;4#N>!0_?^b~~1*h}qW{m71&1KNQaWXGA<$4aA*;IvBtWj*QTW8dd=i&t0 zEOgZ#)_`$Olv6)!CZW^*B>MRYwpZwwAN~)`Gj=Xz==I{YSL_pJj(?*uH+gS&?zyu5 z+`q*2T_ZMRKK<3k+_VuJ2JZRVabsS&n4b057c(6{yO?_M%}B{iN!* z3lC>+rQ$H2sj_2i>^57wEJJ>Ck2~HO;VpEWr`uVF`3%dyg1WjUZ#xHP=_{RXA3#1V zfAGp7U&@2J%p+Zv$?KR$VR=`iF>moY=Jv1-E{8R3r_0Os`)l&D90Om3HF=BNn!Noi zOI(BJE|lXKv`IBGmyoQrOQqdfyHtI)(S;S(;Tf~lt-~`r8q;``NMU@@$_~58*FrDU zEApMk7_H_h2l-4N%hBwzW0j<-g1r*Y1$edK%>iEHbYs`Eb3eQqQ7!OqY&)a7p zXUkd_X|tb8>;q*=oAqp*e#7Zm!aRF!hR-Mp^XxgaQ}`^;Co&HOyK8}5X~;1Fatxuq z7W|0WX>E_sjwS3>LFDL{o_pkn-kqo|D4;&m8bWc z%TJ%+yrn)D`fEt9N0;;diRiNKed-eHuC8B~lLB2vbU4hHk2U>?FW*+?eEIF-%WF&c z@`q8^W$i7?Hib5jWoXNde%|^LYoB($xLNG!Ys||du70P{?s;_1#t}x_C~4yoR?@~L ztdx!Sh5lJ+^IqMnlQxt#|GO+F_@Nq{oqS^R^hLhSUxUvA=9O_+2f$Bx*?IhZn3Uf~%eLZ+uKM5b1e+Ka;1b!0X)=$FM((kekk77LXz_=0mw@vdn!`aqfPp-*`kM3#>`w+H`V4Y56k#V2GJ;r^o z);aN)g|*Hp_0=}N)7!Q;+UtEc z*?x(=K5*0UzDehV!J#K6B>fpn_v%Pn5A5}NFaD+y@mnXj`f%4BiS462`YAWdD98Cv zTR+^GSu^jY-vj%w*RYFOwMSB2v{#1N`?phFwhZ-t3<yN%%g~m4eT=_pmb?2X>GS zu^p+dtnyX51L$LVb--(Xj(@z&*}h+|X(Xx&evps( zvUPn#B#k6LqK_EQf56%dwQ0)}?cjOALb| z3w2%X(y-xZ7ob1eXH-4H1{0mCEi_jlp4dk@^sI5Yo(JXHm@6+ww^x0&d#+S^^2lwR zF!%-f-Hj-p^Iti^zI1wJ^CilZ#hM03D|WMh^aZ+!pi^Ec@X~8rccfiQrP1a|HIGxP&@(a%58I#>o>oyM8*tv`fq zWyHQU@6<2T_5DOkp^ZQO0_7fMec!HJ5A@jMe2uk#)SF!h&&?aX^VHBY$NAg~zJOdA zkoO3dm)wt}zO)@f+mZ3x60{uylv~5mt_{%d@ZM{$m~J!DW%;FXX8$5Ls^N#6&#D7m z9omdJXzNIqDs$neSI195#-Bl7Kg-^ZdY?kQ=lZ!D_UFn+?hotyLy&`gmZa|j|H^zZ z?>rmu`z@QUEt6Tbkd^5%d?9h1*@xr#G}3HshJILPnbEGya<}cw27cy^%jgICc|{)T zsGmj4kfwX4wS7DAw9iX8r^y3nClhs^8T9&R$M04dRe#`_4tVxa=hxu5*RzLl%9Cv~ z%51OXdoFwz^=$Q|Wr#9v0so=tcUWCiOmsRqb=R^)FV==tACQB6KHZ~wmJ z+E>JL&x{Wk-D_c+=w#=^}gT_ zY?-?;BndM}vnU?&Nqc0xJkr&$y)q_8`}tmyR>2=Mdp?lqD-V{txaX4(VRr)>f6A*`$G_0q7u>Q2P-pI=l)uT2W+c&};Mu_WP*;1tG*(65=C z_z7>VxgDS48g%gq^;gk1b?58Fw*8{ZX6UlPq|i-rx}*J4mzW!?$&rR_7|K)gWo-jE z?W_EP^Ba86m19)210A@^#8x=+=;aK zfDy1g)lFEh{->^Uu!&z)of|42Rd}x*9 z`Gw~{nN}^@aLTK;W&K_W9y)f1c6H3#;4$>2)ZjNfUe+eRgfTF`?Grw!>H_~#bhb?> zHK!u{GR5tneUF6mAgb49Psay1PABD%=9qw#1M`Ua?3z;;&ttzv^K07(NvGLsBd|80 zMrlHsZ98)vJZ`)S56Zx{h<)H#IyPOI-}$6hMxi{M10t`h@zF5bzbLI&+rPNO>nnum z_|JxHua)O89d1fJ@8rogJ_;S=m>%0#*o?-pb_Sd_e)<<^U!|M|@VutwTF3WyU_*AS z_B6&6&>rMkgRxqKXW1uP3VT@U#%fo?2J)P5VjGV#wYCB}?%%*MQrmXpJ|po^2RJ@E zScX1d?z=bc48xW0&(U|JuCJFb=YTC=rVCj@zU&(mJp+mSU$%ZCYu_P5eRE^B<)h?X zyVsKaDL7}OeQ&?Md%opatg#R~_IwNa>rvk#VJ5LRiO2r7g!yTC{q1M5o+zm^QQuO6 zhv!?Ky$d{s(7*jPkC(MW^bw1Ei}0yS}s+5?x4`H)r`i%CoUINvrVu)R&~;uu?YRm1kosc(8rF$K$1btyFn#PR6t_)*$mm zT4rH9-fNikYp9##nJI2B@SbDftAwt(m~JqGXCGTH#=3VnXFz5ZH2H)L+t`Zdh)_-Wf`4q$$M z{JEcZZuzxKoHN$G3b6>U3rAMBlN8{YS0A0$oxIUN|TSqHML1CWK+EzVCh{$V-F z_+c~Hf-}RQpINoLFi-Y`qqV;O7Vz-G48n%KY5GkC#$*33H7f}lz&H<|(MLMG8oJ4U zGlRA%HQDrjd=XZxjpDnSImFdCX23j38pt{-!C7X0ny;Czmqm6f-x<^OpyI^7d$) zB6+SOjrSstEo&*4zrdW9mVGV8+xoQJXm>ARe(a_aWi|Uc%F3fDQC4`b)(j49gWa*L zVE=#5ba9O`e8ZOEwhZjqjLwk;V_x?C*RN&!^XR+GS(%<`-?jZ&`44kPw_k(}JYRNs z?sMtOPd_)8@6KVK#Jv0anBOSdW-dK_;tpULlv^I}Qr1<#zVR+C?0huJc1%uq-T|IW zKM$UH@JwxLc)kuiv6kaG)CDJ#$eN|B@?PfA{|`P3vLX+5e4jYve$Aue~OEd%hq9e#fADlxTn9tmevL_nueY?pcF8yXH+cB5#e=hMq>ffd8 z&e2Y!{J)^(pD|tMAVaMD%aAt9KUJd4x0fjMBE26C^nMsN@Uag`@31$nWkdQG>OPA0 zM#g$+ha5LfbPO5tcz%^NakFZ-nyx-RS0b)$H`Zdj-@hM^aQbEqPh*{cf8UO9>Qck& zWgUUu&pZ+VPwm;>yZ4H9s{gER2y@F2)@I!*bHx|(!y2jh*Qd}P*P)G}Zu#8CF@i+L&`lnB&)ssk0>A)8^r-g4N`UulqT3i2qsObvj(LPpns;i;)L#jJ?SAOUj)BmSP zFN=19?S|C_{D$2>VwInlo$9jT23OvG+*9L<>qZLwO_rZeQ%0Icklr-p3wikr^~g4Mn(P0v z?98T$MZOdCwhl?Yu4<&Gc=1KiakT&?VN(e}n6XJzbX4)1P6T z2KDpt68fp#WV-%{ek#aY?WI)L5!$?mr=U;Tz#-ZW($u;YmdjVs=Po7d-9fo0b;z@s zQ)sXK{4{7i^JvOQgK{?+)N|N$?ita`GiZyY-TMV(KZR>PU$D=x6zw1OVz`a+r}6BT zN1R%dT7C3qLrv5R{Q|>yPU_+Z^bLMK_`Iz?s3;xj8z*VPPh`;U_;xJ;Sk`$g=Kl{`BvY-9gXR@EoJyT)l`|SBH(7#^3)9$A=B0DD6it@h&=O=KU2N@@%b|y07 z-pYtEAuD68lQGu`+D^XLdtB!CzVGCe{GNimry<`N$oCV-_tWPf=eLk9WXwaxQ;_jA zWIO{Ie*zhQ3K@Sk2Xej+IpLS=na|2FaE?8CC(RitZ< z3nGmDkQVqb17Bsw;-=LPUvoWeZSmNu#LL@wuKenfvAFD*M^X24j6IU&hW6KYCvd#}UX;^-x?fbvKZ{r$CJ9aqC#?`O6HRE_E zq`#;A5M4QSWx;qPyR=cHtRqb&?=xViepvOTG#vIhez#!TWkPVxug zJ?I!P-a_8vm<@#hKZrfXe{0WUWkKSo{Eta^n&$?$NBQSPZer(&<2Z|oXy)FW{o_=_i@DKz{%&;nlV!?7_c88u zd06=3je9;)_BRC?W>7X9rNYy|ny(!nMypA{}0^4TKc@UO%9lzrVYBA)|7_Y$s|XDja$1$mE3_!1Xx z_osi%1zS1JNx105hKuRh@G6!!4qF3d-;pm#d>1nOmn!@)_Z*>_`g_}>pKTA;!DJ%> zd+mNOpK0lpPS3wCc(u?fK1uL#0Y1ati-Aa(o=WY3;^Y~jBt_>^d!0D?55CvQeMrgQ z>tu_hjCW#-_To^18YB2)5&U<6lfUvkDU8}8^z_H1Uo5J#eh^q!gnoSl-x$HS0w;fd z2!n_9qc~&U*Wx)T0_#74{qKTLya5+Dtlz}>+xRD+Gc+(9)*s@$8~?-)3!cV34~%)1 z)FKh5pWvT(RUJ{hK`*`ob2=6um|$UJ{Vy)x6@1FQ4!1rAm;WI6 zdcpU(VDodq)9ASJP#j})mj4mKsb3y9z@8{i?+ka}=T3GXI^s3I=>Y3PaXC`xn^-|` zSf7dW&4OPN-1{B;NWvdQ~9Ze?#|9$ey@T1_}~)^ zZTvFMvi8+W(ZlJH%MN=zaXrI>&m^^UKk?+c-W4;=+(rE6QCmWie8s`-0wh}kEouUR z_uZYVeozUU@$;)bh{}`wn2~(NXu*RE3!foc@m@c;^kn#9rK^8Xi7KlUy>ZWDkF9`dh=(6her2vV`hf`loZu`+)iKjMO8F&NnA5td7h;Gy2edGvmH)ko-OMCcbp z=od!lR|+1MOS|A6%f`|5hBtnn%0QLy!&qV0YM(DM}6qaL!RH(2V zYXlGJ$3^I;2p;OEUhq&qSodHL<*((tFyOCvZ-oE)2>;yyf3=4f0{)8E$nzP?9dql+ zF;4I>U*iQ2^R+O-rzyf`afHuqkB{G8^m({1=Rptm`-i%JGxNnU3q7)SSaW#4Xp7)s zzUrltgnF1Ect}5AaIJTucC$cmt#^ty2~IiFDkRQX!NYX72p*=p+oSjE-3uPQj~@_R zB~R>c2+tQ2&zzr#^i?QzHClM(Afp z=(j}Zw?^o9d-OEb`7WF01&`jxUlKel-&Z}{FW&)=Kl7{g?y$$-$E)lJ{qX1dYQe+u zT`xH0nIN+Bloed{tnJPg!L=L}-yWgg5uxvk(7zO+9}t{!stzdU;ed~Z9SQg-ek?+N zGD3e@@UXt<2F;;9$IHgeq2AJhhkBb7(5swN0(!-l1oW!^=73)Dl>xo-X%FZX-x|;> zpX~v?;=2NR<+D4WSNzq0UirKh&?|m8pjSRe0(!;IMd;5*=r2d;b-+r?OZiU{!L)o8 zpCWijKO;gvGeSQE1s2$(BEzmJoLA_1=swt&hdCbaLunnF^A^y zpQs?t2R;5iKH$;&?apD3-p7x5^gf@H9=(rOk9Iw52?Lzj}#>`~Bzh5&T`jLp@v)Jk-Pe zQm9PV=RaTYkk10aLq3~4KA-UPHc^;{d?pDV@|o??`~A0!NAKf{BlJrm^t}=K^%43V z9=$)Fyvw8a@qL1;ooGMsfZ%E;ioX`2ABfPOjL^Rop+6I$KO3R165~_(r8=8x!Bu|6 zXGG{{M(7tt=(!-3N63Fmgnny;{$Paul?Z(n|Dy|$-s2lR@kWqvi3bGP7OeSbmlu)ZJk=>2;AibwC`Mc<*W5NEx6i);`I^w84>#V5&8uY`o$6YB@y~;K(Fsy*{gDX$r3n4y2>nDc4%NTPIZ1HUzv4|1`o$6Y-U$8r2>p%-{jLc8 z8NtJPbUwo8-3Xs*nWPEzP$PJ#hXnz>sMjnE=oQ~3cqr#g8SD$|%WT2J`m)fYm#kR7 z&yQB~Aia;bN9fl^=(k4bw@2t-^616YSvmH3^gjNY;Hqb>*8_s9o)te9p+6a+KPz~s z&vSx@`mB@%1S*f(d6nQQkK*+a`WX@W#S!`?5&D4${ox4xnF#&a2z`YN7Kiz*6gpTx{lW-+Z-jn*gnn0qes_faV1)ja2>sg;`doy*LMD@j=~M7fpECn`^$)WH zdc}9idaKZ$cMBfc^8t_E_X7t#dLKU$p+6d-KNF!p8=*I8>kfvk)2I+Ulz*Jys!#O; z;{{iJDn2DbUmu~rU+_?$^92v(Ssw6LKd>_3ulV)|{f-Fzs{y^1`)dKc;>+udJwo|c z3LeV8$)oqnJ?qi?`0fb(3laKPBJ{6D=#P2ye!FneqxbQ%f`|5SPVmqkE=TB%3`U3a zHG+rw94C0F&l!TNJX-EE1OAFHiSTcZ@NbXsUmM}SHA25VLVqwq|4M}Z-GE;0@KQjp z`28~Y9`T94vAZ=V1!uYV_{w`70r}h|v^-T!FO9zv!7FE!rl08H{y5bn z!D$bEy_h06?ZL-qN9Z#Vdh?qFd8WBb`@7h~{rvWNxG(1}!9zKB3m(cjAb4oEhXvPq zp>})LTncZ$;?ej?kZv(7zj@H}@5nucliecqq>q!C8Or z@$9@}rn?Ety;AV7+{Z=e$4BUwc=R%)Y7=bs=zYB1qxb9eT94kxcL~mXiOaG4UyJY= zi10ZUp+6a+e^+qzpUqB<=91vlKmDiT()~}qzb@o>ea{{G4bv@h-xT1B!H-9;J0*Pd zeTrQHuJ2R465#qi#mNBI_a@#AaDC5WoTRUE>U#>b4<3r^dkQMA;`+YBrhs1GUw9$F z_5B51_p5yL{e`y!dVPPvloiXP?=PeST;E^F1h~Gxurk2){e`UouJ11#3~+sa;aGs{ z`wQm-T;E@)mi4QeUwwb!f0l38*35F{qrVk;A!iN?5X;EDo)*q?SM%?7XD*+j38>#2 z=U~IR8sefxLGf;5kgf)Z8R;!P#p8H}@fS<{bVBJaG<}8XTgg+3S7D>^S0sqL2;(yu z#;*_P{-dPt&qa|$<=69E5A#`^xz7AQF7ZS8&r1ABfnq}W8xg-$`R!ioq|y4u@?%_$ zujN-tcZ^y6S^nZY!ky_`N8>+?&*gc6h&Do+ior2O73FRd{mHH6St|Zp-HxI~2_y0G zno#?yWrdH|UhCVn_e{UYy+p2mCS+#^%p zTkqq$;CP1}+-70e!0x?^1Ulf)YFrd_@m`bzrVD%eIbH~}{IKU- z176Rv{IRc78TOhyS z<$g7EJp zJcV3Ed4yaq`!-D-`1jDkgYSSJ_TOPSXBmcTrVaNnNWJE;S1j!kc2aVGYVPF>Kj-#f zhF$a9C9vro_@~|5Z^X{Qej#(AAH`F^vHybo_Ey^MlWNn?Cwqz%$4y}$Cl}Y&%|Y(p z;NMgB0m$xSrYX}8-(8cz{u9W{jylLwhji;8BldJX!Ecz^y*j-8pSLmp$TRunJ${=D zd!rm*3Z5<WRl}+0!nNpy^&D~1&<*&rEUf%@ zfL9)Rqx}5V33-DiiO>5K@>k%8{mxJ)+&$C8z9ng%Sw8Nb@(*}I?G$<2W&I22nKv|SO@27b z0e;u+OXg_F_jTFRsj&At{h`1A`exb&(qNpIXzx;I_7b=Ck$WL!kH3hp>#Y;Zu2Ls# z9Rc4ts5^%u^&($F=agYnVxu3h%#p{dm3gW3sk1L3{jffS_5BRW0lKt)BJl^F-O~>IH3*_J62^jjW)JqMWSXX8ok!PW*)U zUf|T-FdHSk_@=AcsKhUo{^t|>ls)}Do{%}wo#oFk&n_5#y|NE$bG&qDU(`=7tXm>? zKB=2XAGCg%@}6a=W$epbxGuzFS&%-*ei7PJrVHaw+AH;!1wZs7ySJS3S6R~^OeXlJ zg5R%br+kI`a`=rh{O`s0{!-@r#Vq8l#r}U+HXah+DBlvseoOyYa*c5Hv>*C%d**V_ zCS3m&eJ-wZ<>q1hPsV04KO70063pJS?WZr)e7QZHM(i)->(7dOK7BUrsu^+k-5-7v zeF*K#5ZZxXb$;(i?BChQ2<)A9YM$HkihJ@^K!($38*RG_d+ej_Kt8tpeF(!YNEhd@ zT}bvbb9~Bri_4VlUPj{5-_hV ziuYxNu1-ToXQ-oT&JX3VcOB*eYVvo%zfN<0(p+vhk$2bI?B0;rBTf61+=na;pNsy! z`?djOwDLZHJ-r@qW&L%QHRFIcUKOZO{QH8_H*o(%yoOklFTtC3!Sr*Gi8`BrJkl<% zZ2V8Q{ISpNo4FgH+j9Kh0J?G~Q;zLF_Z9<2-C!KieqV_9sE@O-;n1zXyS~i6xnkz_ zF~s&#He!?wyvI=Pgl2p(4Sg?Y@VxHP{JN#ttbD2*4ec8|N5dAZT*}|djrM@~`;Nxp zvlV37{NK>OM?B=y_TP)1_mFOyeWAO+5Ai{Np^x!#%{(%G3+@eQx+tIExus@u{IpNzn|zyjt>MdWTZ92$eAD2zF)5raP9IOb66d!CaE5J6=9%ebM9%r1 z9N6{5=~Bu7-{ZRQAg?u@1vQI?@z=C#ZcEZgXl&m(E<>}(aA%PWuB=dxTwW{9g_l(Z z%@gFX`C3p@$gie#HF;3(SJO#W0DJFl#9yKEb{pE z=gLNTMu7jz!~bE-#P-4HpS5kbbqMWzQiq@~l+SVWFKg^GHT)cG`wers;W^tbp`0*+ zY5SD?ZW#M?hR-qgp=|DRe(=k#9zJV*3B&0(AVcmxjH~b&9ey+?{R>TZuk53Y`nMrW zx8T>Wk{_hQy31#%5_#Kzu&%wf4ay$3W#;m{0ePBywLE-`NXzDdc@jS4 z&puC)?A6>;7|+ts8OBC_zOs<^Bc-QT^K{mh?V%sq4VV$xSY9VzfdJN=Vy z9`Aeh<%@lP@Z*c=8-I@PftcsvBT%0UX}fEdHJ;1+P*>rjxfdndeLSNcZw}gSeB3lC z2kM1-s=$7`Jm-73Z*gk>R}qhKvxuu{k-xdza>AAi+Jdw(57{;Z*9AR&tnlqb*mNH4 zU;5nhjoD5Ax;r<0WPjfueq&5-b=8K%{rrZbm=kwTq@_;9~P1T)3F4EyuUj zFs_-#ci^o(^Le86F@(~(eITu3-$tCW{=x`0_g4Y1Ji_Ftj&Pl#uZ+9+(Q=}W0^%> z_WMcmKIYoVc^@h0!>j9wPCirSbh5F+>EvmgL!C^(H|tJ|PNYs3>0}DZ?R4c%(wu?L zPNN*r2XA!xK-@d=ExPjbethrc1biO)VwsnR=6%G<2R`QRr~lc4yWf3uv3X$Lyicbm zJ+^FJNAJ4yJ@-z%cWV9J)7RPCdp;=u=&KnCM{KXq@eGtbH$Ug?yEv0L4!akU?5kKd z*AbxMN!HBRJ%12h_VwbuLhb&L4L7?zGQaKOF)da?9*g-Se4D&<4-&^QfKDmGUHl&u z;vci2#vDQ8q4CSs7Q)X8ae{NhCO&JU7^~4}u_#Y^)Lll-j#91Des0 zM-RQiI14&w1$kIrJRZhBalN%0ey_g^Ty=oUWFDZDL$ zw*x2toXlxje*ml}LjQY0KT}j{{R6PC3Vuln#QFtbUlV-5Dcm+pfXp}WUrJ7l;g-bv zfKyK0JH*y|VBZs5_q4G70vMiA9X$;UhtmIBT$9ffsUzoYs4@RuaDB(!`UhZtCU|)b|< zJ!ay1gFUo6It{jeT*aSuu^S*UYY%}Q)5E+NY#-Uy@uX>NGTihMSME?9aZQ#Koeel3;l$COPmXsZxb8I=(r2YU z>RLQaZ;Rl%_D%8K0loUI7Xo_4Ukm7!&p<%0_({RJhE7b$=IAZKX9hUt0PI2fk4oNo zI_uH<_@xN_RF`*sS2%pdn(}IU~IMJi`?NImp3+ZP@=+}Gvef!zu(fjxg!8O0C zXWb)E^Q-v52>mO9hxEEfAnin&2x}*kq&+1*&LZw-iHH02y&lfKk{-JRSNXMEb_=fZ zD1IQIPx2MeD}FMdS3YkA^opMoJgnE}1rO_Wg>=0_`>7N>w4WM}-nWx+9=(rGiqKDq z(6@W^zMbe^gQ5IegR<7F5&8oWdff{!^fPB8e9lGq=-z&zoa05XP|n$c zhxC~U{aV38d-nJC^V=zZZ$BU35=nP!B;9=x`U4UABN6(e5&CLO7Vrq|S@#qS?O~?S ztKPI;%oberthnwesPrO+(LDu~Uh(x2{+lBFcL*NJzf15?{+9y&n(n@Uzv2TCdR^Nc z%KvUauX?x?@K?M_o+Cp2R0|&RuMg;z&y0Xx@%e&>{%3*Uq5oMN@K-%73HU3%GD6=T zq3;doRnGMRz2g2}k45!J=tKGU2_D+R0gvAIdq)Hh^?y|GQ2%dx{C#@Y!m76_!IfU|8o}wu^qHL;#t9zU$#}s-Jx}uJf8B{- zf2Vl#KHe<2%Bl9VTyT|B@m`O=ug~=!e;?O9HADVeBm8#>9@6iQ(Dw!Os?V1Kdc}2b z&QQ;~H)p8lSA8dc|K5Jk;|`f`|FqCwQ2za}oOU5qjM_Gb|S)<1^&%m&;*!IH#O< zc=ctgbb^Ub@bI)4H_K5TNp0vv!KpVN*S)Di`b`n~7b5)oBJ{dvRj5zhvnteQrF2q5 zd35inP=4LRiF%mm=|T5!V!EI7@a@8%>H2t1aPsk=FUHG5EOGyNcDIN7>FVA{VY+=n zAEv9mRNpaDQD@7A;!3w9z;&FoH^6nAbXS1u_~t7CuH%>|16;>3-wkjb$JB8lm9t6w z%M9p?hvGUe*%aVSV)wlPuH%y116;=?UkY#?mki%g({agR@2E*3Uk>=_xMYpYDX9E9 zE;%E>bzE|Bfb00$YW@>j^d&|_el}lH2 zx2$P%+Wp|aX|SLQ@=eVW>XUywgNV~O4 z_8RjsteZ>Y+OBKC+5pP@5v)VBYlIM<#@Ypj z5uYpT&tQ;m5@VRv2k0z@_!fh1ynMdt<@3!`Sm$uHd~*8wSEiq_rvH?$AJv6dCVeOq z)SDWvC4$a(=D7}IY^Gn=XN6^P=)IPOq?x7e)LwAS^((xmUi)Z2QWhCp*Qh+Oha7YY zdz=Nj)i7TB?hxWdMco=;xrlttyoOA~ZFxzV_dyrdFG#*u;hy=1 z8@BdNTYx^_&@zKBuCec?&`z+H&tN?gc-pnHyhk_8y${DSmUV%M>*|`MpAy~b`m2A8 z{GcCOl%E{Rj%&)P6KgM!^*!Y6&FjsZzs8#O!1qmaSZB?0$a(cWOZx>*nmMpPgL~_% zxF(yr#2RgeS)UBwk@zZv8`w9?U@v_DXmCA?WHU+92Xt8IjLKMue-3eSy7A5Wi(*hTUp?3*U27nG;{-$v8kgB3;^|UF&AA zQ`@NP_bQ*&q02jcM)H1~T}uhQgTK`osKWV<@GT7PH@NYmGg?%Z#v&myf)YR666W-wsFm7 z;s+?d_zKFeWuD;?^V+Ly&|VpaIs3oB{8;_d7APz09qmx;)bfWMl!@)hE_*Qh(4*Eo_N; zItARyW%bAK683k4d;fuP(y)8muBh$Y5VUc?SzgqMO`ClVUW>nI5I~j> zeEF^WRhRFeER@esd8){k)MsS<_7M86#k)Rzo+dde=sXMzi z9qF+R!1HTO9_!R|(=+|Z(`wK+y*o5CmbPuqqpjp=;L(zv@l3JAZ(;2)={&IDDMraQiHZXI!33 ztc5)y;ct84>%6tFXC-`#3r{bV^bGTX;}!luj@7`K-Z;UnJiuQZxo5;OkKarQ?{o30 zS4g~tf)6;{u3hf%;;of%$wz&+#M8CG3tc>$UZWRppTt`(={+v-1_aM~@qSn0rGe!n z+?J2zWA1YmU;Odko&X0|rn=s6F=?UOvL?6wc)Sc!Od+AH4}Va2Q%AFl!>!C3PFq#he&AYPJu2mbV{gMpwZ4x2 zgRk}F&>q)h>S608Zs0R5uJ>snxm)m8<=)myU^4`tC}m^oC9uy3epYZ>|A5UET)(@n zILE-OJfb3N&%hoPT-S!#`Uvc|1wQ~M%VUc>nP!~HN53y>>mjg}g6sD-Z9N3mDfqD} zT;Q;_h4Yj6C!bypxZ&utzs7t8XX5&u$pOLtK=6}NuqyvI1lP3(wmt&eh5u^&hsW~( z$Y0kIEEj_B2(EMVS;6-U{uT%KaM*f@^S{PF`RLr-6b9m8l_CC;~>}B>ZRRg?bLcMw&j=8u_zX&HJwkk>8e=yo;pt}y9r{wt3Bh=-tr7qjEYl-oLgIZ zdCO(748#}NZJ5y2c^oqiX>|T-O4Gc(wQy;{F_$&Z+9$uco_Q z%30@H6{o-Dp>red&edlhS3j^o2$Wv^fZC_x>IXIj^y&v__dJwd{lEbSC%C%GqXDjd z;9P*KAEvg60QN^`=Ne8&r_e_9meQyqM^?U!L&v8xkD;vsR+=8_Q{;=I7mcf6~QRD7rN_nvQ z@>1ME;v-^nT+4%WmAA0dTl7l#_wIVrmZl;l}=x4AHx~<&JdF8pW|BSm1V{XlYuU(+#HuT-Uj8oS(`4q za74y<@a)}>=ih$3pohKd%5KH}8t%Tr*nJUN`0RTp!tvg-4a3+Oo_8-~h~v5rV`s>3 zKcC-u&#-26rR3W28kc%Bg+2Dn+CMy=p51q`4(~Cax-;8v>c4(GZTc=|aG%CF$TJ>~ z&EPR~J7j6an3In4?MS_ux_tkM^bfvvJd^)-7n^JT^Toag@^~+L;Q8D%(Bc`q3^WZT zXzECVcX-Vuya&sD&#?cHJ)hfj0{VI*Hv#b{xN(KQr~K0-&*Tf-WJZqmY4Vas&HoVI z^B#ik?qeRvXMB0rO&ssx^?{16Ux2=udjW8t4Dvfz@hJJhwrVmyo-Vhz9sg(C?I{~K z?bGZ?SsGNE8m4R0;JCHOgfg(Qz`a>nQdMR&u&(q$?189d4Bi-fTa9uZQ-^vc+WH3>neLZ!*|_r&G^bo$Lx|hAn>v2*TB|L z_v}0i^-!JZxAhohQ#-|UZKuuf8usxJ$AM8VbMK^n*!HYYkG%@-T;ce>_#;ag&ZafY+27pFe z+u-~W!Vm{G0J)Jjl<|I!%N_gW(6>0&uKA>VW_`=0yzKj9$KhE|Xy4+iu!l?6Un5_n zQ6FP@bIhJPs6yJX1?!W<2XSwOBA(7>`blH`hVvJ1n6n!bzhPx$8t^Ap4#ug-6ym_Q zAnXnE?(cKog#8@5FQP>~v3rmDdBL@g<@;qhG!(Ik?|L?YYv^g0mNj&8A1G!OocMl8ih5Ur*Sx zIkLl@ACsqq53sKQyJzEEYWn_uec2D(cv8LKXL*+Kr1jo-(n1NJ@51eP(n2qMt%M(? zv@!-**5wG&fObfDGtUzKTM}P_N}kB>!yJ2J-^L$HnkZ7Z=0EKD>T|Ix5?|n3al^4H zJqDx?b_alzkq2m8H!A_orQREN=@#fca?r~FiU&ISN<04R!S=E|>A4k$lo|^|J8Q=> zRBmer!0s3Pyma_%`2u@b@O^??y8!kW{;TmH9-jxmv69y$Yt2evJ9Djg1-N$&M@Kkf zvUCGp_g&iCiT9CP@j5SlmiDgf?p*i8%B5>MJ9<}Q9A)X!HLDqOY1@ib#$6h`t=!U1 z&@5^)mqh>JGyG-2!)JKi+dibPk^F`9*l)=mA^nsHeI`PGe}sN8?@AXVt|CoXswjp8sW|4cMPb{=PbPsOGQ`}M#r16^*#9c5g|Cogv#;^B5Tn|Y4 z%%6X#{Cb{?K)v?qek$>OjMpLU;#{L{CEWl!?6B7ch)mzQDubsej)y+&a) z<62`G_ssg#%(OkOe=OsmS7|a8?pKy=EId<%`^^^U zPjSp+{?_BUl#V}eud@N(0OLLe#M^P^k+#3a)Ztu;&t%}F-!61%IUA{L zc3uvB&2>HPZEb7K+(igzU)8Z1y~^%3J1N(_X8EdajP|*MeE|9oJv2@B0eoEL4e2uy zF{IB5&OU=b{oWVBV|@utSNi~}za_#)an;|Z09QS|_ddfvt-itm$(Noyw`ZYPU!hqX z_zsE4HUUL4tgT>MN<8%U=YW+uNb4U{aKrZJ{l?e6f|jrH*7UE{*2mt>850UBj6*m! zZ!t~?cdI~h*0xsRhj3AnPd^-0T-QRWHYp=cbp1rRal~)p;ozwB_Y4KC0_-dEsXIk2bELKeK=y~3^JumT0 z{C~GH&&$|k|3{wmy#K?0-&IGw|MmZeD?H!-_W!n>o=^V&c9rLg{TCG%6z0z<@k$C7 z&MC~dOL=A zSmez#;+e+5n>lmt{LKc3#P}IWzML@AT-KS3KWP&&D^e ztZ0r0A9EpvIgd` z!q9oeW;VM7XAqK^!=m|$bBH!>3bR6*hoQ9KD@F)cf`eIUX(4^jhr+|PU_7!pfS;BrkDjMWhxq4U0W5J!^gI(qR>?kM0KA z$`naX<+|d8vTO2|EKc$Hj-+RG9hjb3KG3@eoDSCny#DE#jYm_G>${X+lM22mNlBjA z`bb@AO>)K2lz{(ecGb2@@IJDnmct7FD&Q?0=0955fZ>GS3Sf+)VUMV<4S3$tp9j43 z`hZuS`{)MHzVpfhkG{4dw`={Axv8)=B>-!EO29K9>DwjfP60>{*A$3+{~9 zJ~lrIaziR*yf;?oRIH48oZK#H|CpA z5+!p=!wWp$H(=4PFPN~-_`Od)Z%>lgZjFK?3;eY=C4!Tl@POnKyrZb3i5}L<_$kGF6(X@Z(Srh0 zQxEgKt3RPcz&5ylmyum-rKk4wFkT{95IMIMGWsYxPH>*FhuiS|Hs-eH%}T z$uRHIM(uewk$xbBJBT#XiSza+iO+_4dp<=DewTwUcJO7uG5*(6eEPz7oL0hrd*O29 zABIDSJq~z%7kL@ijmw0O%ry82!T(VB&xZeD@IM^>g9w8t2?p_FsK@;j?mg(<3LP!E zYZC2>L=U^s?hJKHOsu`=ev=B{FCd09-k*jDhKroWp0JGjJWtHE9(6e3{{9uSWIvc| zy{-42hxNRx&}Yyx`dr=)*FO2A!F0)1gSpmYy}=3NMTb)Jow?S}HEV6U(r6iH%(Z?M zX)vF<(K62JXc^O+Ld!T?N6V=1PRlskNXw|bf|hZ{T!;GtX$Hgm5?aO?w;$-;NARt* zjQP;19j^UfB@O!9Hrj%{#4%l120ZPj1=MpLK*a5hE-&Uf+{5I99v9Iv&X{ZcY0|Ji zAK93*p7|Nlqkm^w#u;@#9 z_Ghm3-Gx8aIi8qn{czG_`CiImn9m@d0?Yl{;o8T`D7|xDS>6noLzmmkXY*1?!Q8xz zvVuirUPgXiS)P|MqqNk^C@HdE!bS7uLATn=C@d-~$jF^^<6t=J3f~R_>`Z0km6esu znK8etpj5=-A74y^O)+WuNH-c7P75gA_M7J=@B+=TU*L!T(e#~X)5&l#u7nBOV6^Ih zUtr>Wq(3Yp=lY53aN456wbW{P8Ru9|=&85gO54l+8tOTGT*fH~|0vbz;_bDs-X8lK zxP2!4%jp*sKBiAjgv~a{$HG4|se7+I*pBvkU=YV*xh*d9_7l|#ZHwP^+HsRig3Bob zIs)qr|D1jkzWnL&)$DJY$HrkSa| zbI@VI?BRCpmp=y`O$`AiX|##RXgHR3^uBw?y2iyl;moQzJ#%yO3)R`x=^2gZwpFKJ z)p%~{fQrv9gLAXW-0&+6$x8?9`s|^l=~<0sFN*;!~EwBX^o_kQ|pN_XIdVqM|W@lFYwMXo)`vxZ&|uK z;QjbwbgyVhsZNFSV&l}3m<#8PiyQEK)$&Z>xsB(EMIa30=#QNE)|qCX*T1X)&Jm+$ z-EejdX>Ls)wW}q4_(4oXWa&_Ut39XOSRMXDAi=VVNFwkhwZLAL49`7*9l|r_ipZn& z@Yz}ppZ?atcwP){V#~2-gj?K}twG!}a;e!ec4i;EBRSINv&B9*r*BLjzPT|yYgc1> z=D|kL{uOcvbEEn32UdIx^G2Be3Fq&nzBufRSJTvVaruC*^~-Y8`!qJE5AruB4)g!@ z(cJI{4V@EVD^zZ)#oYY?#)Kyas+&HK_kx;j@~tMYI3e8H&=DOUT8jGv>dFWFBG8mjJ|H~}N@4)! za77Em7?#%7rh4TAc2t3?WlQbSY=2{p9c78;L3-Bu7F622^|uU3YVxdyAM)950W~qE z&$N2$OeJ!jx8m=1%f#%8^E)azx1sJdqaRXqlqHdFT(Qg_!F{wD%6t^;^N@q4q?@s% zVT)lEpRGBOWXiXEKqAzUZB;o{r}Rui9A2IuXn5#mGNpw*&pk?_Y29Uz8S z!2Q5f!To2M8_oG=TI5k?A2u=coBV_JXjny4 zd--QuD$YNfUUIg3o5?|{YZS-t{n7{ZcKrGB0e@})-&hU!qIPBYmu*-45YK>KB!ME9|q-MkWHGc2e$9 z=b_vqF9wVww5BgsHGnr9RiLc@ws*yO?d^|_;!?S`qPK|~)JM~qtUeEB7Qa|4v!mPyJ$KwF0e0~bh0bd`o^obohqJKb|oB>|9OUEv2XW(ITnk3 z%>>a~{uI9B)XjYAo~0cZKt1a=7@gKwV*H<1{9fW66|W$! zPk5FQzlTq5%y-Xwn0Tu?L8&4BzT#_$52SNmvhf}#K0)zy#6MO1C&W)G{w(pWivNuG zVa2x)Un2(!f&GFwpPQSn@UfG4mD2x;_)UuMC0?fZ8^m8#{2=km6@QC(j@S{^9#dxsbF3~{t$Z$LWa5EoHut)9*lyS%LYSWj+YJa@&R5p7yTZizfLkPDBp}`Py*}*K~7DI50A-Kg5++qlBF$A|5 zf?EthT^8!HFpMk|XQ4O?#aSrMLUA^J3`OUms2hs9p{N^*x}hc!MuMh8(KH*y*(lCN z`)u4I8@I?d5znOCGBA((;|EMQZb`!-=KB)!X}KKJuOg0P(4A-*XCKfq`p7Y5TYs#N z91F&B#0m9sOm?i`xQ?fZ#4%iXZDX>7-{j!4g}*(f+Ys&+JcR>=d4CXRU^uMM;ceJY#7yaOGFFn@U53|Ds{j`5)(CdA$Zp~t=oPqT?* z-pD4Ax$Sqb+Vk!wJ;u{szqRW&3XWrXJRJ~RUeh{E9OEyqQJoX|ud)fu`_pj|!%Y)> zE^&;%Y?_$s_}4k~%(ecoL(g36KXvGtYrUV2uUKAJh;;QQj``C^@Eqd0yqIhMdxTHA z@Tn5v_7!}U;Qa*OB7C?F!PWbT>-aF&@o6SKmg4~7-;*jI@_~Z)CXV?a^?iwBzFjHw zA;AX;euMC_eQ&#RE^!@y<~siMq{nz-*gWkJ9OKHv)bLJ^ILUpFkYL#p@J2-6ZrOhA`)AF6bk}m@Ry=g#HQPGgR=M#C80c zOK;rlebQq-XA7SM+R2gIb052Mkl@3GK7%;MU$!&13jGM7FBE*F;LC~Y_%qk>-zI$Q zxtKNEEBGkkf7;>CT>E#U{ubuL)xsx}IL1?U$(U=On}meZvCi|d)Sdp4@t+7ALEMYwwz$mO<9a#iu<*Ms6VwmK zff|@Hsa?RYW8j~o#rcn1=N%w#Hg!6)RDkNM>1(#P{c#Gwj#r?go%Hs2H?z2O_&2W| z4#~{6H?pRE`D=&gDA9PR7;U048v5q(_pibgD!eiiS%&v!M(~PV`EDG)T=plts}t`S z{ci4>*CJDXw&9EJbS?ilCD}{F`#Sy6yI>Y{5Z zs!>k|9{bgN+VelSJ}Ve5+9r@XC}JJ!<#8HUGv6k(xM7Ug}PkI^dZN7yomX>nW|{Ox(PEDh$m&&2&*>>J7Q;QEi}>2$b)rC9$}`;0VeZMYq28E4G3 zek^HHVBU+CamHNhuO|)WgB(M-l{orfe}^aL+GjQibb3pOqmMl2XRduJgkFvXFxUF$ zNssaGM$0(cO3TPGY@W8!f-c`3#PJYr+ZYR&>u~pw9@C3nJnf|gEZ?aL| zdy&vH*ZRYx!8FP8Wv=xfkRJ0vjwPKUuH%1(IQq-{XRiJK{=WV{=lzC!pC~22P5;u> z=jSnrMbsh0eHxFV+(uBB&>Sa`>we?-_7Ayj`qx-~==qOs&wc&`@Q~BB6uzwUxSr$B zT0H+nX(j`je}}f`c9U0gvUrZ|4==L@=XbUT+tFe>1!*tFZREt;Pm~arwJm*%26)8K6(19&vCB2 zx#5B%$tkr1qT6n(ts93L_T5&yq#Bp;{N+wKe|fT=zYT?NgE#QEJK)>U=(-Ew+lc5o zJn!*Ezg>dgAbvB<@73VlP-$mf>D-r`a(7p`=;xE4?mj zPL$_ZzGb-?Yuw~k|37k=cm*s@e#fT8q6^-~+uv;3`hm|U?hs zYZ}^js4K$zM~&i7<+=ZbceS-v2Jl`r*4Kq01+6FMHsO7ihqi}nlKn?gk}D3wuO%bq zw~~k8x00Fb;SL{vYxr&ab!6rzJ6YRdyPECk}jp`Y9$>cYgafZ6v@s2uM7P!PU9&)j@W_Q!) zks5m!Z0t-uZcMru~unFO&AGu@1FgD=F>UMcUozZQHgyk9VTU)+NidE^z-L z{bu;E7@LW*Nk}x_j{rj*Ft~miNYql%k&Vo@{uWFe-qpTS`oqh9QN^KKkVml zuQT4UjCBj{5XZ6z?+@Uem50g)JbnUvac_P@);W&tjS$<&6muuF@rV27yPNh1xA?fd zExv8GcoJ)Sq^?MXdLWR{wcZ!^`)lbzqf*hD-*#`8zlM(72-}MBv)J#Up`I*HAJw%m zeRz3cir-iKNlA|tpDcVObzN=x_Ma@LrL8|-&iM#OrA$+A;NI=@QT}GZvraa{(F%SC zK=sMgHEcET*W%V`>CdZIeDYds8Al2a{f55>R{UyrY#G<(RM!O30^#H)e_LK02zP8s zXv@1KhdVb#!walnpZbLGCDNxdfNNfk#wM`B5)5;6au|*!G4I%#O$iWcw1(o*y*#(z zCsrBVe_pCy!7b9p>L>pc^WnHa+}n*K#9h??B;)?fPq>C*i#+r{z9_89kK2X?`Patt zo#%w-z5o5x|Ayzco{D*HpY`qMtmohf?dQs8(U?}RcupL>U~CuqJLqKh+UFXqPbv_6 zwm|oA`lcfXd(KMV+z_o_bz!Jw-S1ck>kp1e?NghY4BF&mulyS9MW*w9yeHPPs|&}D zd)Qwq&pq_xSeQ$<27LVOzHlP!oy%rHY^H|)3cogiw&9BUPiECr2GWwQeKI#GwMvF~GERIeP9IwZN;Gs_3Yq`pYYf#1P$QneSV_D#6p8j(N03iOJ`>OjhoVYCmS zcZ`=)ZH7=g#IIQ?(lN;No6QmaL@Zyz4+pyOw>9CICu~`TWySjpYh=IP+;QLfPCafl z1b$%!O@jfR8A7CL6dawZWN z{G#QIeewq8XMCPKw41j#J=aM12exf8IUmO3itRmL`ZVe=hiq+s=h@hH&wR}5>cTG@ zKdMDVsj!Vb8|zsFz2NiE8*bTB8MjZp5rC4YIB)v#=Xp|!BO48ya zE^pZ9=~p3-!r8(z&)W2x{rQlsw{R|z48PEUb~U?AErFD8t&Zm7ebIUqYx$wIy->FN z+zLZ$d$DZgnZuFdVtE9KYyF{z`cQ7LzB2cU`pA^l)Q19hEW|bk@@Yj<0DqIVttthN zAFDp_UYXFfzI+0w1NX(6B!48kdPh~lnrN$Z5YA~leWZuF5Q+8Z;Ylm&xK6}UWsYaK zA4K}C!_V!|Qu!m$lQ{@InS(V+70p}@P(rOIb_SYb9g2lP zi#tGhz&X)o=+o?KhTj7=g9n~zoQGdHfV2H2;tIIB>2G-y(p7QZoQ0o{)oa@m7;N?{ zyZ>OX*nb}SE(x4-_8c2nn{#Yn;ut;O*Z2x&&v>L`WRi10reLt0sjy>^=719pB zJ+u2MoU49w9iDfTn=}1ryAbU^L&!avM5~N-1>1~R+ZKPGeJpoLYIzO*GK7Ao6yaF5 zryBygFIvyJ%bK_|e$)QgV}2sUs#_qtw!NF01r-Hw3YJs%Vc_EZl zn{)K?+`PE+2%FYb;00HlArCQsmSejKdGJDQcI}!IxCWeBFvUM}pPS8SIt8lpb)`5` zfccMS5&rXVbajjtl;@79m)<#*Pft(I&x2pX{6A467jilMKUE`3IaRUR_fKCVp(pr1 zt&z}D9)xqmL2!;ZXmJvcQ@&80-oFtz{8E+n95^>@Go}Fh(xJy+gWq=_g!AX!ILCAE z%3K^R;&01x^*I%s-9C@5v6d7@FWa=Fz}mE=c9fI1#g;TO<+tlOhV745vKq%5B2&Km zERHwCMmVue65|br;8@d>{p7m#M<{Vi9-%a?9h}{WbSK5-!fWuGRFhNBnH-~>N^DAa zseUQ6YtUXC;*hbGLT}qj{j8pOEJmhPbLfL{t)NXEy01Cmi}s{qPPkMNfnPzlvn~8@#Z7+x1~sgg z8S61)x@xQk$8`A|@wGq)$OkhnYk!H0_1BDy$Hsp_`!XI04%K}h#*5-O(AMy40YByn zl+U3r@)%(~U_2FcIOat0xB^Cfus>+L4&pc!^djw8?$@B-@-^5SuUfKr#2v{keaOewy^t?FM=dssPUaUTw0Ik*NnxCiA^CYfumrPz0J}W}+4czZ} z2d~H3^PAYUlFHn2Q~TQ)c@}Jky`#^cy{>SqIt$m- z&ZcMWItx$Fz<4&{FScRdY>K2N!Z+AM&67(iny^P-akjjnJh#Z}G6atSFdvMJ&od?` zoVc{9FA`Hj(M_(qsHsnSh95`M6Mmd%&KRO=y+jxb_QRS)Tr(7&EU+t*Q@yQvEnIzk z`A7I<2YBuZrqygwK45KiAcD_Z*cEyCN4%zOm}e5g=Nqt{h=#K~@x)&ma6gHXoyky3 zjHd1OnRtfP1M=dmc|uF($+LCiuy>E+=8(&+HGwmM@EazCCiCQ#Q76sw22vI_U7WtS z!5h4eRQHB|15Y1-EgppwRr}T+sU8z~fR}0-0xfG-13g?d24WU`^$!rwAa2=k!D>2f!11THe8@Xh82`e8i03KNvWd z2)bu-U!2vHfY-wkVa*SQr4KsU0`)5~1xQTWz}noV1mg-@u7Lj9c&LZ?{2UCWe87q~ zkVL>E7EVgw&4ly^8{o+qyFd}X=?orqBiMI&D;H`{LJ*&$p|(lPEo-scpnv%r@8n`# zfAmMV6@@vWsRfR%_&g4L-UM82_%4ic#Ok#d2&b5lhFIM-x%5gd?k~Kj^}|*sx-Tro zaiF;UWpNT5i8{BH!saCYsUP0DmVNIKA}T|kpx#6;OV!; ziNSjKOu7_4y~IRFh0S?LdGpIZ(s_^WE2`V%`-C%`tJlYJ^_5)M+uF_56bK1(^_8}{ zIZ@|ke9mOH$(b&JaJQy`DrcY+AgwJhB-)pcHCQrNKPz(pwoGm6jXJK;X$g?;9VFSA z6i$!?p2*V??*ZU#p3H^y;`^U*y+5}8XSiN`e+k!PIZ&9-;Ck^L$_cL8#MVET3#HTz zzQQ+msKZwzs(K*xuH`{ZE`|+&EL9PB;K)0GCJZ@mSi|-h8EPv z)5(T@Q)#Cg3QwYmb2x73t-Gesq9c&Y1p4KN)YV9_Q zng+$M_Y&gP--UZu1wJVWpV8IwYtu?Xi0~XM%+Iw)ay`}3{JpXMep4Teb5Ou@sNQu~NR0YqVXv0FNCN zt*@ASh~ODsnDT*mWHd*@Th2fXcSY7#1-vo2;qM&rUdhGhvQrp6CgYe0`wZ{DbRJ244^WvUTf$~0@!1F;C3jT87=Oh0M(=`vD@pya zN3;um4TNWb_{2Z$59b0c?Sx>SHVD1<>gu=V z^mDU>S1m317J6~1F(UMgOd+E$s3*KtgKJPOx7M4m_AJ<#c7mk+z2?s=v+ zJZBJcdX&j=KVOl9{DA8skf+c?G0%W%Hy_X!^Lhl8&c{UUe(pfmWXTk~#BkfBZsd z#Wfo{?r{m;8|56oh?Q5}y~2gA<=7F1FD}XV%qR>gXE{A?kE;#0$Jd5$i;_JR2Y@8*J0+EdWBaqQ5~ycNgHB0i@AxlFQ$5t^nGf#z&KYmJU5fofzPq^ zz?#WpHhORUvaNx6Dq-An_S$O;qW46l!B|9WeEIt_zj}TjuA#N6>)fvgyron6wqpB@ zV{!a83HFP5Z8z5l=&Jem#{}RSWGlXBBMI)b;Qdy6LfI7NBMTfaD$nBEHd?QYmg|nn5ZuSGbP7C=6mpmMd3#6p|Lk*R;gk!$ zG4DXvhevqzzn)X_FN4VL>-hx>zK%DR7h1sIi{_UZz~AAASmJv@$(+2ovG4hFN^iHD zdwu?W((3Q#$HFOkqu(zMesZAeW1YO^1HSP}0e_!_oWJuNe?Nr03*|lYe#H5=56tm5B)CO;Q+vNDMO}OEtjID3 zzG!^dk2%IyPR!FJgk|O#4nESsCpq}dirZ&CwEZnBhr3$onLq8|FF5#42jB1D#~hr0 z)5WVfKIa(F+&&8;$s4UW>+SQpVk?>J=l(G-R8@lcN(X=1!S_1&VF%~u9&t=L-2Uo^ zKFr5EI6uco`>b*3SE(QJu>X1o-|FD|9Q?S0pLXyL^cy4{|B!<(ckp@#-|XOf9Q>Gr zf9T+TwTp3nW;pl~#mAb2CwY@O18B}ZPbfX}Ee^iV!H+w5ql0&VJ6h$$;dXcM{tnL1 z>0vMS(a-T?UgGdM=-|oFr;<~y`I6*qkPw#HpPyU9tC=5AKFmLI@I8EBA*1WeJjt8N z#x!T2ca@%bfB8dd*oJww;@>9!*$)4SO3yxbIr#mG-$ee49R5!zJ^Sx>@OKr*-`L|5 z*zR-qH!3~*55yleifOu8PKy3Unpd%Yq|!5=Jj209I{0-CKGnhR zcJMV0{;Y!^bnr$8?l}QqgXiPJBE-b;DRc1q9K6oKH#zuD z2jA!5?>hJ?2k+cnBnlQeU4tAv$H8Yhc$I^1bnu-He$c^t$OnFi_-8oyEe?Lz!F%^; zKYy-r@X-!_gM-g@@I?+@;oz$s{89K4f!(2hvgRSsU^;7>dF z76;$!;O{#4rw*PVAK)b7-`T;_96Z~>uXpfU9lXTBmpl0DiWiycn&cfd^Vmn0S%hb? zT@horG~awp@{XH%?1S~Y`otJ6F+b?wldf!Ee~W`ZIH-O7CI>&@;HMqD)xmpyt^IKO zJNQ@!zs13CbMPt$U+Lf*9ej&}KX_I9>3Yn;k2?5C2hSYbzJHG5-#4-(kKf(NTXFrl zRq4x(z~^PKkmi-dXDYso_&LQNB5vRF5L>yDxE`miC4P$3>c9BgO4_I=q)h@!zq(;G}EV>~lGBJ>Hv6{B`9skoYZX{BSUFJzg3j zo~_0?hY{D~qN9lObILiMV~Fc<*9pXXsQCOV@l3_-dnkO~NfnU~* zUYbvQi5eH3L;R@X_BxHvyGNa0myv$_1)KwRZlA3N&s0_X9@6Xa)uqJODE)oJ^?2z+ z#7`@|ZFhX09{;Q*{f8an<5@>sj~_lsT#q-}>rXy!kMj8`>GvzXiMSrmd5O3lN3!js z&pU8od_4b?^m;sM7xDfV#p{1fytm@}iI43Rum2r!Jsx$GxE>dJhj>Rd&htL;{)#sc z->7O?&P0Mym0sPQ-gF-i`QF#d{L( zrTFE<_bJ|&^=dyFM0~vB_MOH)?=Ho&Nw3GpMiJNJV`Dj7HC}NoaXk(;iMSpIyMg!u zHNJE+@v~~2XF72`{xg&KPNknqT#ql65ZB{oi->nt>AHuw9$%^;uE&?`duM#!vueCz zIqCH{(rV&*9I1|YhwkzF*E-_&DgO<`_4tW>KODSAPw6+4UXRagBd*7tb`q~wKCctk z<1qV(>v0(So*md<)Oqev((Cb-cZuuqmXpMvR^uV3i0kozGsGvTaf7qON2+m&7UFu` zBf<2ae4ZXB=|EhMw{#}1$3wak*W*9Ei0@VLOe5Y|<(qxq5F8&Bzl!vO6b})u zhbx{#T#uiOC!Vj)_a_q9<0O-b>v58sh@Vp7-a=fDZ_FUxM}<3^xE?>T=N0hWOr!y1@r?(GXR2|7mBjUU!W!b+mHr9hdfdbI`+Z&~70->N zZ&5y*h&L;~h4^~qvz_=x#a|_UctCu+w1@aTiti`hP4R=odno=k@v-v3&k&ToAI0a* zRQvXN$QaK|Gwh8h?l7ScQ5gyD!p$KFH?H^-d3OYLI3#p+xxeC-mbp!{C)CSuK0(< zS1JAx@zpBaM&kKOZ^s?rJ)TMrx4gjQ^PW&VnfU2`@$u|Le1hWLh)-19KEoZJKdt=j z`(l0G8l|`68a}U1@j>MOwDQR$zESaP;=Ps6DB{m6{aE7nsq(s(_^pahB0fWL`<^?W z_k!}jne=H&Z^wyz-WH{wN&0Py+xOzZoyCfmkUs7ueNc3Zh$k!kJ;ZNT^`wG$Po=+~ z_*BK06Q7{?YT`Q-uOt3~I{vOBzEkNp5Pw>Y!#_`aqvD&1cUR-j+lcFN{+-0%S3Y*U z%;)Lr2=@L(pQp$350Fm>74A{udffh9;%}>Q_>;tUDW6lsUswDLaXlVx-(v{<3N=pN zLi$tjyS3*_Mga9zad>E`;rkW8koYmhFDAZIad;LxOg`_pYR@kvepd0X63i0A!Y4);&X}jr`10L-d=ugb@2am@Ldl68wY>G!H)vRa^FJZ z34A~MyTn&gWLHvpar_$feQA7#`JaeSr1MAq-M}Zr3+cSCh060R@!P0fE#vV~$S?GN zm)g~A$~PbJ?gK5DPP~bH%82I^zku{diEknfPgpSi_g!hhRN`HUA17|d*Fa0W54B^r zlD-%5#l$BQA4vR7;$w;9^#Dv)H)`K*BktLkd4#=b(@Khp%BJPdDS^e(0{omY_x5S< zv#e5DEHumT+H!h%7QP;99KOkW9KO2SyhUpqzB+3hzVUk;zCdf7k>D%7$KiXl#^DRL z#+jFxhs+zs#|8P-Tju58ur`Pi^Ir3yc^SERUpcx2(IA9h|GpQV|LxbDXQ8Qm!?}6a zxp@m1#z(y79AjW!S}tC5j$-w$bMs2`p(r-5IUkC7U|wmSjfpYuNe^b47og+EFbsGY z=D;xY8ioN6!+?jG7m(p5!_Z+E8V*PCa1;+m@o*FmN8NDL4L7eVGdgr0f#MM;9)aQ! zC?0{%BXElmxWxz*k3exS6V<^?lm|0WAI!uJg7$6mnYc+X6SoOwVlcr>+%y<8N?Ts$ zrSm~sY^L0TL8A;>r3uB9UC(7dibXx>*J3>oK;(VI#UG;gX8+E>*NF|itA!ZL5G z51QB22hIEHgXV?xLG#A?pee?nDaW8GhoE_3ebBtIK4{7^Xx>>LG%u|WW|_EUnYfu! z4Vt&t2Zx%lOu+`tTkM18HTFUCruv|HRejJDY|xZ((3Ee`6j{)gaJF&IHqNGugQk#! zrj&!Gn1iNZ;k7uJlf#VC6mZa#aL^QS(3Ej-IF?(`6m`&)b#S=Ro8k?c@(r2d51JAV z8P5=DjK3-6kSXPmDdmtU<&Y`mP$v3^Oeu#<`G!pShD<#T*`3wyrl!P0ro=-*vz00F zkSXzyDe;gg@sQnF?cPeeE9Pp*)RRyMYgEXTd&rb~D1`A0nQ{-Aau1nu51A4VnGz3~ z5)YXY51DcdnGy_{5)7FdA2KBvGWixVB^WX#7&0Xo8j3Y7Wb!R!$}VJc&+Hx{Q@$Zn zzM*WBI-8$n*A1DH4Vm31WcHtsDcR5nthXUkvLRElA+raE%37E#N_-C zv#$*?`8>qr^AMA(L+pNJcVdX2DQJwSNs!rHLT1+qncXOqWeU*jULmuqg@&Ly1Unxb zF5q{&MbpA_3-Su*7sL0wl35Gpm(3jRjs1={v!tLPDk&`}qclmt{L?Ef4&@mb9pJ2x%N*39Zou)d>V_}$xE5cwNHj|@jSdd0$qvd z#9Zq`q(Fap$&$I&4<|k513b<=I*p_y9WHb2lS6t8SN3z6YyAY$r@*|U$YO3C*Z%uRp#Ap~*Zv2Hqd)%h#9aHoO#UN zePgbD`1kV|pNoaQgnTfcEbk{`MY4yU`xvI$e8-V|_~&{>-(%y`RdKdmo`^ zuJs4WAM4wNw2Ye_c7)4Z`@BthEMGa4$6V`Ak{WL3J48d65X0pUa@bWv+ef{ZzJG`eA@HG1q#2zJvB>uJ!i5 zDeK>#&0)@5>t|ECv_EsLxA#F={{h0Exz;~O{<<9bK4}bB_D`5=AAA3j4VQ+(Oz6zD z{%KKOJobtk>=WGH18i)(gTzzd>xHz8YnW?)dmmBTcJc$-7WbnrqMn>4j``44@N+`n zO>ld^ko8Xyd=QQEVm!Nucrw@VwD;B6zL?ZA*Lr)OOj|v3t+)4|cpj$L-a8EoF!A`S zJ|5ZoQfxWW5T(&G*Z%7$y_j#8hp{lZelXYmn@NxRbr0dcmAF2B z+51>*{N*Ji=Gx!h$6}9P(tn@B|4k8p%u}A2YyV@8_}lwiY+q6yFPLkelOkNqYo3^E z{VCF898*QU+52SLhRa<0oDtz>aG)?}uJz3#y)s| zAFNkj7x84S^=YKXdS!n*U^nV7;v?%b|1Ltehs?Eqwun!rh!1nExA)uFde}?kgS}72 z?(g!vmAUq@_n+AP{W9URoZ_SRcY9xo-Cu$tp3JrX6C!_l3x9jRO56Q?y~u}<@Mo_5 zH<2F8o|y(fd1d9c~Bm!To)hh$nNc?@fBFS7{>LJ|aFcp8WeFy}vWp{vi>c;UYfF zwcg%uW9#7+B0fvV2g8-;t<1Ggl?Zo)2$#9m^K+@tf27be*ZOtB|6hcjxz=waeF|v1 zi~bLDt>@=q>2}H9mtyzpQ6gOC+Q;6nV%xnwB0qOge6YUR-+WoKy~J^U;V}VR!_VQ; z{fak5K3r`r%qMdlpJSxQ`X>F46W9Ls{uZ0w9O2Jg``i0lZ2gh`{9G{Ye@?{z8^WKt z_V-gGrQ^@f7sL7^+cDxPn07+zf6bAT>JDC;f@jEGS~V( zq{sBiaQXLsx_%B4{$qtdbM2o+dR-4k3f^C&mwyL{>6Pcp%(ee$5ub4)KFqcL2GV1C z2Z(T|64&XyMfi^w{>-&M-iL#ePA~r+64NEmE17Gb1tQ#QjHCTvuJwyakLlvEJKW-7 z!LJnQ-7NSZ!FLeHdiXWLUw80*#8W`uRkVA|bvzG}UgtC3Cxa92FB8m?{a~(r-Y31z z=Z}bEKFIW*BaZ2kyp_0)KXV-}Kfh1Mzav#vjDN0;y7^?TeY%rg$A1uUjQ>?4|1*Ss zu;AImG5&IVfVmELtkBEyVy^YqiE!m{@<+;{I~2$w~Xc zT~NP5h-kcel;3vesj z&lw_kAHlN(=iiO%d>cf1%(s6tj`oAOj!zcpb-wZM&(U9=hmI8flZ8KX?LXGxKan_= z%eRFObL}%pgnPZvGuQf?NS^{)SuV`Aemd!~T!xB#UO*i8qin(XxurV)?-B9*j)*67 z9qxUk*ZF@xah?AU3;!F0KXdKB+Ts5Mam@c4g%5M>vrdG2lh8BQ`i-Pd0jCwDb~V#GS}fABfZZ5cZI*K|L+U`sluPR_CMwD z=jX{{{(o2aFxNikM7TE#J#($MkLS1JX{qA)%UtU_cC@CL|06^_??pTXcu(QOT>J3z za4}uf)iTD+wf-vd$MX7jqqHB)wLT=`Ia0)vpR0@E-XeUMYo8nu?)QYAxz_XZd9l99 z`Xl@){+|>viIo-m3*a=7Lm!j=6fe!es2LxJ#Nu6-Is zxHE;Gxz@LkJ_WS0y<)EQ$@KdM%(onoKRt<~k8H1)Yaf0-HKvQYX0YUW%(Z?H`D1%E z%P8#!bFI%5@%)B}CqL&J!<{XBm}{RL5$+tJXRh`9ylmZGO&3152_NR#r_K@oSBc~P zK3b&fIPnzVmx|*BbM4R1@5X$fQza8C=34)ei2vu{NCpX5$9IW=E9%=##IFKAPH=ucyRQGYh;WNVxXg99 z{5*GEj?A_GZsC82@Mo^|OGvNtjk(rW3I7t|&s^)DCOy_qnLqs8d7Uoi+UI!@Zm9^D zxz_XZ>vg)AYyDQ?UncySYyB?LU!~IZI&qyY=Gtek2zR~+m$}ySbM|$*m}~t(;lDum zGuQg}Nq?0}7eB{er;EAv`A~$rP=w1|>-l{EI$g}Q{!`(V`F;m=&_vq+Eo*LczX3@1Jqc-(QHxQ-7$w@&-# zkRH?feGwn#TF=kR)Beo0exmTdTlh2A`pKlna=b>Qm*4B4!)300ZW7`CK!nR&>!*_* z^I3+=?~TB4W&eS>_L(ihy+?%0TMT!oOVjGuQt04u5_RhdwSpE&P`V zf9Bf%c}F~75I#$V4|DDFCh4(W$$WU1xXyp(+UI={ZiNV!xz_XZBDFtrt^ZW`R|
d8tE~f*NS-db@-1L z{+EgR$z1#M`&V>6GuQgbq{sUCO_4v# z9ejh}6NUa&!T(k8J;bpb`L`Pwt$hxDO89(B_?!{?NrHEyAIo9<|4s0o#4+5-f~OHr z0WPm^GS~T&A@uUPBy+7FF2a@db`o)n=eI?CZgS}F68h_fewEo8_Jg_h=}CGW{|w?dyHUh{6mg7aZ_#cr*Zxz5&rQN-2XV}YDT42E@VyTH zrr=YB4?nL~=g(o%WBxn<|2#3*@jp&_%%ATHe}3*Q`pfGY9|->k*&OD~wg0E2$Jx!o z|15Fs-z@we68_A!e=_~JRQvOLs z|0>e!{O9Kdy0LO{DYh;W%}J-=T~`!m=2O~QY*@Mo^| z2OaTeuJuQSf35ImuJw%$f96_$PWZ18{>-(W-y5g%hq>1G?q*G~y?RvmGuL{4|D5(` zuJs|||CsP+uJ!yLJMGV0>n8~RwZfmd))$i=>+N(=Zx<0y0WSM{%(c%F((87WpNFpF z&s_W5C*ofx;?G>``MrJGpSjl83;)N3KXa|$;Yb%h7aqfv@T$%-+A$UTHHN}}MFXr066X|t%O(u@Vsj%?B$-!@N@EL;V3m<;2y*`f5COz(V zKe9xz^t% z{C_I^nQMI&>9s#|t-oLRKP&v1YyC!tKXa{rUid#J{F!S#zvorQpSjlW68_H%f96`x z?~B#`%(ecg@c$3t&s^&hF0mr4w{u0k?MOTYxI8X1*FN1zuiI6AZ;FmTbM4cMd~m

EidtV7Rg$#a#PL7va7j!ey@Yw~-#pWu7RP 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 ViDD8(8#q)t5;GFN4 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 c{$3>*%5k8qNFvS3S?^ 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 == 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_t *) ( ((uint8_t *) (a)) + DevicePathNodeLength(a))) -#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_t) (l); \ - (a)->Length[1] = (uint8_t) ((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_t); \ - (a)->Length[1] = 0; \ - } - -/* efiapi.h */ -#define EFI_SPECIFICATION_MAJOR_REVISION 1 -#define EFI_SPECIFICATION_MINOR_REVISION 02 - -#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 - -#define NextMemoryDescriptor(Ptr,Size) ((efi_memory_descriptor_t *) (((uint8_t *) Ptr) + Size)) - -#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_MEMORY_UC 0x0000000000000001 -#define EFI_MEMORY_WC 0x0000000000000002 -#define EFI_MEMORY_WT 0x0000000000000004 -#define EFI_MEMORY_WB 0x0000000000000008 -#define EFI_MEMORY_UCE 0x0000000000000010 -#define EFI_MEMORY_WP 0x0000000000001000 -#define EFI_MEMORY_RP 0x0000000000002000 -#define EFI_MEMORY_XP 0x0000000000004000 -#define EFI_MEMORY_RUNTIME 0x8000000000000000 -#define EFI_MEMORY_DESCRIPTOR_VERSION 1 - -#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 - -#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 - -#define EFI_OPTIONAL_PTR 0x00000001 -#define EFI_INTERNAL_FNC 0x00000002 -#define EFI_INTERNAL_PTR 0x00000004 - -#define EFI_GLOBAL_VARIABLE { 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} } -#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 -#define EFI_MAXIMUM_VARIABLE_SIZE 1024 - -#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000 -#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000 -#define CAPSULE_FLAGS_INITIATE_RESET 0x00040000 - -#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} } - -#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552 -#define EFI_RUNTIME_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) - -#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 -#define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) - -#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 -#define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION) - -/* eficon.h */ -#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -#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) -#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 -#define BLOCKELEMENT_FULL_BLOCK 0x2588 -#define BLOCKELEMENT_LIGHT_SHADE 0x2591 -#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2 -#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba -#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc -#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4 -#define ARROW_UP 0x2191 -#define ARROW_DOWN 0x2193 - -#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -#define CHAR_NULL 0x0000 -#define CHAR_BACKSPACE 0x0008 -#define CHAR_TAB 0x0009 -#define CHAR_LINEFEED 0x000A -#define CHAR_CARRIAGE_RETURN 0x000D -#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 - -/* efigpt.h */ -#define PRIMARY_PART_HEADER_LBA 1 -#define EFI_PTAB_HEADER_ID "EFI PART" -#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} } - -/* Protocol GUIDs */ -#ifndef INTERNAL_SHELL_GUID -#define INTERNAL_SHELL_GUID { 0xd65a6b8c, 0x71e5, 0x4df0, {0xa9, 0x09, 0xf0, 0xd2, 0x99, 0x2b, 0x5a, 0xa9} } -#endif - -typedef enum { - AllocateAnyPages, - AllocateMaxAddress, - AllocateAddress, - MaxAllocateType -} efi_allocate_type_t; - -typedef enum { - EfiReservedMemoryType, - EfiLoaderCode, - EfiLoaderData, - EfiBootServicesCode, - EfiBootServicesData, - EfiRuntimeServicesCode, - EfiRuntimeServicesData, - EfiConventionalMemory, - EfiUnusableMemory, - EfiACPIReclaimMemory, - EfiACPIMemoryNVS, - EfiMemoryMappedIO, - EfiMemoryMappedIOPortSpace, - EfiPalCode, - EfiPersistentMemory, - EfiUnacceptedMemoryType, - EfiMaxMemoryType -} efi_memory_type_t; - -typedef enum { - TimerCancel, - TimerPeriodic, - TimerRelative, - TimerTypeMax -} efi_timer_delay_t; - -typedef enum { - AllHandles, - ByRegisterNotify, - ByProtocol -} efi_locate_search_type_t; - -typedef enum { - EfiResetCold, - EfiResetWarm, - EfiResetShutdown -} efi_reset_type_t; - -#else - -#define efi_allocate_type_t EFI_ALLOCATE_TYPE -#define efi_memory_type_t EFI_MEMORY_TYPE -#define efi_timer_delay_t EFI_TIMER_DELAY -#define efi_locate_search_type_t EFI_LOCATE_SEARCH_TYPE -#define efi_reset_type_t EFI_RESET_TYPE - -#endif - -/*** standard input, output and error streams via ConIn, ConOut and StdErr ***/ -typedef struct { - uint16_t ScanCode; - wchar_t UnicodeChar; -} efi_input_key_t; - -typedef efi_status_t (EFIAPI *efi_input_reset_t)(void *This, boolean_t ExtendedVerification); -typedef efi_status_t (EFIAPI *efi_input_read_key_t)(void *This, efi_input_key_t *Key); - -typedef struct { - efi_input_reset_t Reset; - efi_input_read_key_t ReadKeyStroke; - efi_event_t WaitForKey; -} simple_input_interface_t; - -typedef efi_status_t (EFIAPI *efi_text_reset_t)(void *This, boolean_t ExtendedVerification); -typedef efi_status_t (EFIAPI *efi_text_output_string_t)(void *This, wchar_t *String); -typedef efi_status_t (EFIAPI *efi_text_test_string_t)(void *This, wchar_t *String); -typedef efi_status_t (EFIAPI *efi_text_query_mode_t)(void *This, uintn_t ModeNumber, uintn_t *Column, uintn_t *Row); -typedef efi_status_t (EFIAPI *efi_text_set_mode_t)(void *This, uintn_t ModeNumber); -typedef efi_status_t (EFIAPI *efi_text_set_attribute_t)(void *This, uintn_t Attribute); -typedef efi_status_t (EFIAPI *efi_text_clear_screen_t)(void *This); -typedef efi_status_t (EFIAPI *efi_text_set_cursor_t)(void *This, uintn_t Column, uintn_t Row); -typedef efi_status_t (EFIAPI *efi_text_enable_cursor_t)(void *This, boolean_t Enable); - -typedef struct { - int32_t MaxMode; - int32_t Mode; - int32_t Attribute; - int32_t CursorColumn; - int32_t CursorRow; - boolean_t CursorVisible; -} simple_text_output_mode_t; - -typedef struct { - efi_text_reset_t Reset; - efi_text_output_string_t OutputString; - efi_text_test_string_t TestString; - efi_text_query_mode_t QueryMode; - efi_text_set_mode_t SetMode; - efi_text_set_attribute_t SetAttribute; - efi_text_clear_screen_t ClearScreen; - efi_text_set_cursor_t SetCursorPosition; - efi_text_enable_cursor_t EnableCursor; - simple_text_output_mode_t *Mode; -} simple_text_output_interface_t; - -/*** Runtime Services ***/ -typedef struct { - uint16_t Year; /* 1998 - 2XXX */ - uint8_t Month; /* 1 - 12 */ - uint8_t Day; /* 1 - 31 */ - uint8_t Hour; /* 0 - 23 */ - uint8_t Minute; /* 0 - 59 */ - uint8_t Second; /* 0 - 59 */ - uint8_t Pad1; - uint32_t Nanosecond; /* 0 - 999,999,999 */ - int16_t TimeZone; /* -1440 to 1440 or 2047 */ - uint8_t Daylight; - uint8_t Pad2; -} efi_time_t; - -typedef struct { - uint32_t Resolution; - uint32_t Accuracy; - boolean_t SetsToZero; -} efi_time_capabilities_t; - -typedef struct { - efi_guid_t CapsuleGuid; - uint32_t HeaderSize; - uint32_t Flags; - uint32_t CapsuleImageSize; -} efi_capsule_header_t; - -#ifndef DataBlock -#define DataBlock ContinuationPointer -#endif -typedef struct { - uint64_t Length; - efi_physical_address_t ContinuationPointer; -} efi_capsule_block_descriptor_t; - -typedef efi_status_t (EFIAPI *efi_get_time_t)(efi_time_t *Time, efi_time_capabilities_t *Capabilities); -typedef efi_status_t (EFIAPI *efi_set_time_t)(efi_time_t *Time); -typedef efi_status_t (EFIAPI *efi_get_wakeup_time_t)(boolean_t *Enable, boolean_t *Pending, efi_time_t *Time); -typedef efi_status_t (EFIAPI *efi_set_wakeup_time_t)(boolean_t Enable, efi_time_t *Time); -typedef efi_status_t (EFIAPI *efi_set_virtual_address_map_t)(uintn_t MemoryMapSize, uintn_t DescriptorSize, - uint32_t DescriptorVersion, efi_memory_descriptor_t *VirtualMap); -typedef efi_status_t (EFIAPI *efi_convert_pointer_t)(uintn_t DebugDisposition, void **Address); -typedef efi_status_t (EFIAPI *efi_get_variable_t)(wchar_t *VariableName, efi_guid_t *VendorGuid, uint32_t *Attributes, - uintn_t *DataSize, void *Data); -typedef efi_status_t (EFIAPI *efi_get_next_variable_name_t)(uintn_t *VariableNameSize, wchar_t *VariableName, - efi_guid_t *VendorGuid); -typedef efi_status_t (EFIAPI *efi_set_variable_t)(wchar_t *VariableName, efi_guid_t *VendorGuid, uint32_t Attributes, - uintn_t DataSize, void *Data); -typedef efi_status_t (EFIAPI *efi_get_next_high_mono_t)(uint64_t *Count); -typedef efi_status_t (EFIAPI *efi_reset_system_t)(efi_reset_type_t ResetType, efi_status_t ResetStatus, uintn_t DataSize, - wchar_t *ResetData); -typedef efi_status_t (EFIAPI *efi_update_capsule_t)(efi_capsule_header_t **CapsuleHeaderArray, uintn_t CapsuleCount, - efi_physical_address_t ScatterGatherList); -typedef efi_status_t (EFIAPI *efi_query_capsule_capabilities_t)(efi_capsule_header_t **CapsuleHeaderArray, uintn_t CapsuleCount, - uint64_t *MaximumCapsuleSize, efi_reset_type_t *ResetType); -typedef efi_status_t (EFIAPI *efi_query_variable_info_t)(uint32_t Attributes, uint64_t *MaximumVariableStorageSize, - uint64_t *RemainingVariableStorageSize, uint64_t *MaximumVariableSize); - -typedef struct { - efi_table_header_t Hdr; - - efi_get_time_t GetTime; - efi_set_time_t SetTime; - efi_get_wakeup_time_t GetWakeupTime; - efi_set_wakeup_time_t SetWakeupTime; - - efi_set_virtual_address_map_t SetVirtualAddressMap; - efi_convert_pointer_t ConvertPointer; - - efi_get_variable_t GetVariable; - efi_get_next_variable_name_t GetNextVariableName; - efi_set_variable_t SetVariable; - - efi_get_next_high_mono_t GetNextHighMonotonicCount; - efi_reset_system_t ResetSystem; - - efi_update_capsule_t UpdateCapsule; - efi_query_capsule_capabilities_t QueryCapsuleCapabilities; - efi_query_variable_info_t QueryVariableInfo; -} efi_runtime_services_t; -extern efi_runtime_services_t *RT; -#define gRT RT - -/** Boot Services ***/ -typedef struct { - efi_handle_t AgentHandle; - efi_handle_t ControllerHandle; - uint32_t Attributes; - uint32_t OpenCount; -} efi_open_protocol_information_entry_t; - -typedef efi_tpl_t (EFIAPI *efi_raise_tpl_t)(efi_tpl_t NewTpl); -typedef efi_tpl_t (EFIAPI *efi_restore_tpl_t)(efi_tpl_t OldTpl); -typedef efi_status_t (EFIAPI *efi_allocate_pages_t)(efi_allocate_type_t Type, efi_memory_type_t MemoryType, - uintn_t NoPages, efi_physical_address_t *Memory); -typedef efi_status_t (EFIAPI *efi_free_pages_t)(efi_physical_address_t Memory, uintn_t NoPages); -typedef efi_status_t (EFIAPI *efi_get_memory_map_t)(uintn_t *MemoryMapSize, efi_memory_descriptor_t *MemoryMap, - uintn_t *MapKey, uintn_t *DescriptorSize, uint32_t *DescriptorVersion); -typedef efi_status_t (EFIAPI *efi_allocate_pool_t)(efi_memory_type_t PoolType, uintn_t Size, void **Buffer); -typedef efi_status_t (EFIAPI *efi_free_pool_t)(void *Buffer); -typedef void (EFIAPI *efi_event_notify_t)(efi_event_t Event, void *Context); -typedef efi_status_t (EFIAPI *efi_create_event_t)(uint32_t Type, efi_tpl_t NotifyTpl, efi_event_notify_t NotifyFunction, - void *NextContext, efi_event_t *Event); -typedef efi_status_t (EFIAPI *efi_set_timer_t)(efi_event_t Event, efi_timer_delay_t Type, uint64_t TriggerTime); -typedef efi_status_t (EFIAPI *efi_wait_for_event_t)(uintn_t NumberOfEvents, efi_event_t *Event, uintn_t *Index); -typedef efi_status_t (EFIAPI *efi_signal_event_t)(efi_event_t Event); -typedef efi_status_t (EFIAPI *efi_close_event_t)(efi_event_t Event); -typedef efi_status_t (EFIAPI *efi_check_event_t)(efi_event_t Event); -typedef efi_status_t (EFIAPI *efi_handle_protocol_t)(efi_handle_t Handle, efi_guid_t *Protocol, void **Interface); -typedef efi_status_t (EFIAPI *efi_register_protocol_notify_t)(efi_guid_t *Protocol, efi_event_t Event, void **Registration); -typedef efi_status_t (EFIAPI *efi_locate_handle_t)(efi_locate_search_type_t SearchType, efi_guid_t *Protocol, - void *SearchKey, uintn_t *BufferSize, efi_handle_t *Buffer); -typedef efi_status_t (EFIAPI *efi_locate_device_path_t)(efi_guid_t *Protocol, efi_device_path_t **DevicePath, - efi_handle_t *Device); -typedef efi_status_t (EFIAPI *efi_install_configuration_table_t)(efi_guid_t *Guid, void *Table); -typedef efi_status_t (EFIAPI *efi_image_load_t)(boolean_t BootPolicy, efi_handle_t ParentImageHandle, efi_device_path_t *FilePath, - void *SourceBuffer, uintn_t SourceSize, efi_handle_t *ImageHandle); -typedef efi_status_t (EFIAPI *efi_image_start_t)(efi_handle_t ImageHandle, uintn_t *ExitDataSize, wchar_t **ExitData); -typedef efi_status_t (EFIAPI *efi_exit_t)(efi_handle_t ImageHandle, efi_status_t ExitStatus, uintn_t ExitDataSize, - wchar_t *ExitData); -typedef efi_status_t (EFIAPI *efi_exit_boot_services_t)(efi_handle_t ImageHandle, uintn_t MapKey); -typedef efi_status_t (EFIAPI *efi_get_next_monotonic_t)(uint64_t *Count); -typedef efi_status_t (EFIAPI *efi_stall_t)(uintn_t Microseconds); -typedef efi_status_t (EFIAPI *efi_set_watchdog_timer_t)(uintn_t Timeout, uint64_t WatchdogCode, uintn_t DataSize, - wchar_t *WatchdogData); -typedef efi_status_t (EFIAPI *efi_connect_controller_t)(efi_handle_t ControllerHandle, efi_handle_t *DriverImageHandle, - efi_device_path_t *RemainingDevicePath, boolean_t Recursive); -typedef efi_status_t (EFIAPI *efi_disconnect_controller_t)(efi_handle_t ControllerHandle, efi_handle_t DriverImageHandle, - efi_handle_t ChildHandle); -typedef efi_status_t (EFIAPI *efi_open_protocol_t)(efi_handle_t Handle, efi_guid_t *Protocol, void **Interface, - efi_handle_t AgentHandle, efi_handle_t ControllerHandle, uint32_t Attributes); -typedef efi_status_t (EFIAPI *efi_close_protocol_t)(efi_handle_t Handle, efi_guid_t *Protocol, efi_handle_t AgentHandle, - efi_handle_t ControllerHandle); -typedef efi_status_t (EFIAPI *efi_open_protocol_information_t)(efi_handle_t Handle, efi_guid_t *Protocol, - efi_open_protocol_information_entry_t**EntryBuffer, uintn_t *EntryCount); -typedef efi_status_t (EFIAPI *efi_protocols_per_handle_t)(efi_handle_t Handle, efi_guid_t ***ProtocolBuffer, - uintn_t *ProtocolBufferCount); -typedef efi_status_t (EFIAPI *efi_locate_handle_buffer_t)(efi_locate_search_type_t SearchType, efi_guid_t *Protocol, - void *SearchKey, uintn_t *NoHandles, efi_handle_t **Handles); -typedef efi_status_t (EFIAPI *efi_locate_protocol_t)(efi_guid_t *Protocol, void *Registration, void **Interface); -typedef efi_status_t (EFIAPI *efi_calculate_crc32_t)(void *Data, uintn_t DataSize, uint32_t *Crc32); - -typedef struct { - efi_table_header_t Hdr; - - efi_raise_tpl_t RaiseTPL; - efi_restore_tpl_t RestoreTPL; - - efi_allocate_pages_t AllocatePages; - efi_free_pages_t FreePages; - efi_get_memory_map_t GetMemoryMap; - efi_allocate_pool_t AllocatePool; - efi_free_pool_t FreePool; - - efi_create_event_t CreateEvent; - efi_set_timer_t SetTimer; - efi_wait_for_event_t WaitForEvent; - efi_signal_event_t SignalEvent; - efi_close_event_t CloseEvent; - efi_check_event_t CheckEvent; - - void* InstallProtocolInterface; /* not defined yet */ - void* ReinstallProtocolInterface; - void* UninstallProtocolInterface; - efi_handle_protocol_t HandleProtocol; - efi_handle_protocol_t PCHandleProtocol; - efi_register_protocol_notify_t RegisterProtocolNotify; - efi_locate_handle_t LocateHandle; - efi_locate_device_path_t LocateDevicePath; - efi_install_configuration_table_t InstallConfigurationTable; - - efi_image_load_t LoadImage; - efi_image_start_t StartImage; - efi_exit_t Exit; - void* UnloadImage; /* not defined in gnu-efi either */ - efi_exit_boot_services_t ExitBootServices; - - efi_get_next_monotonic_t GetNextHighMonotonicCount; - efi_stall_t Stall; - efi_set_watchdog_timer_t SetWatchdogTimer; - - efi_connect_controller_t ConnectController; - efi_disconnect_controller_t DisconnectController; - - efi_open_protocol_t OpenProtocol; - efi_close_protocol_t CloseProtocol; - efi_open_protocol_information_t OpenProtocolInformation; - - efi_protocols_per_handle_t ProtocolsPerHandle; - efi_locate_handle_buffer_t LocateHandleBuffer; - efi_locate_protocol_t LocateProtocol; - void* InstallMultipleProtocolInterfaces; - void* UninstallMultipleProtocolInterfaces; - - efi_calculate_crc32_t CalculateCrc32; -} efi_boot_services_t; -extern efi_boot_services_t *BS; -#define gBS BS - -/*** Loaded Image Protocol ***/ -#ifndef EFI_LOADED_IMAGE_PROTOCOL_GUID -#define EFI_LOADED_IMAGE_PROTOCOL_GUID { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } -#define LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE_PROTOCOL_GUID - -#define EFI_LOADED_IMAGE_PROTOCOL_REVISION 0x1000 -#define EFI_IMAGE_INFORMATION_REVISION EFI_LOADED_IMAGE_PROTOCOL_REVISION -#endif - -typedef struct { - uint32_t Revision; - efi_handle_t ParentHandle; - void *SystemTable; - efi_handle_t DeviceHandle; - efi_device_path_t *FilePath; - void *Reserved; - uint32_t LoadOptionsSize; - void *LoadOptions; - void *ImageBase; - uint64_t ImageSize; - efi_memory_type_t ImageCodeType; - efi_memory_type_t ImageDataType; -} efi_loaded_image_protocol_t; -extern efi_loaded_image_protocol_t *LIP; -extern efi_handle_t IM; - -/*** System Table ***/ -typedef struct { - efi_guid_t VendorGuid; - void *VendorTable; -} efi_configuration_table_t; - -typedef struct { - efi_table_header_t Hdr; - - wchar_t *FirmwareVendor; - uint32_t FirmwareRevision; - - efi_handle_t ConsoleInHandle; - simple_input_interface_t *ConIn; - - efi_handle_t ConsoleOutHandle; - simple_text_output_interface_t *ConOut; - - efi_handle_t ConsoleErrorHandle; - simple_text_output_interface_t *StdErr; - - efi_runtime_services_t *RuntimeServices; - efi_boot_services_t *BootServices; - - uintn_t NumberOfTableEntries; - efi_configuration_table_t *ConfigurationTable; -} efi_system_table_t; -extern efi_system_table_t *ST; -#define gST ST - -/*** Simple File System Protocol ***/ -#ifndef EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID -#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000 -#define EFI_FILE_IO_INTERFACE_REVISION EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION - -#define EFI_FILE_MODE_READ 0x0000000000000001 -#define EFI_FILE_MODE_WRITE 0x0000000000000002 -#define EFI_FILE_MODE_CREATE 0x8000000000000000 - -#define EFI_FILE_READ_ONLY 0x0000000000000001 -#define EFI_FILE_HIDDEN 0x0000000000000002 -#define EFI_FILE_SYSTEM 0x0000000000000004 -#define EFI_FILE_RESERVED 0x0000000000000008 -#define EFI_FILE_DIRECTORY 0x0000000000000010 -#define EFI_FILE_ARCHIVE 0x0000000000000020 -#define EFI_FILE_VALID_ATTR 0x0000000000000037 - -#define EFI_FILE_PROTOCOL_REVISION 0x00010000 -#define EFI_FILE_HANDLE_REVISION EFI_FILE_PROTOCOL_REVISION -#endif - -#ifndef EFI_FILE_INFO_GUID -#define EFI_FILE_INFO_GUID { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -#endif - -#ifndef FILENAME_MAX -#define FILENAME_MAX 262 /* from FAT spec */ -#endif - -typedef struct { - uint64_t Size; - uint64_t FileSize; - uint64_t PhysicalSize; - efi_time_t CreateTime; - efi_time_t LastAccessTime; - efi_time_t ModificationTime; - uint64_t Attribute; - wchar_t FileName[FILENAME_MAX]; -} efi_file_info_t; - -typedef struct efi_file_handle_s efi_file_handle_t; - -typedef efi_status_t (EFIAPI *efi_volume_open_t)(void *This, efi_file_handle_t **Root); -typedef struct { - uint64_t Revision; - efi_volume_open_t OpenVolume; -} efi_simple_file_system_protocol_t; - -typedef efi_status_t (EFIAPI *efi_file_open_t)(efi_file_handle_t *File, efi_file_handle_t **NewHandle, wchar_t *FileName, - uint64_t OpenMode, uint64_t Attributes); -typedef efi_status_t (EFIAPI *efi_file_close_t)(efi_file_handle_t *File); -typedef efi_status_t (EFIAPI *efi_file_delete_t)(efi_file_handle_t *File); -typedef efi_status_t (EFIAPI *efi_file_read_t)(efi_file_handle_t *File, uintn_t *BufferSize, void *Buffer); -typedef efi_status_t (EFIAPI *efi_file_write_t)(efi_file_handle_t *File, uintn_t *BufferSize, void *Buffer); -typedef efi_status_t (EFIAPI *efi_file_get_pos_t)(efi_file_handle_t *File, uint64_t *Position); -typedef efi_status_t (EFIAPI *efi_file_set_pos_t)(efi_file_handle_t *File, uint64_t Position); -typedef efi_status_t (EFIAPI *efi_file_get_info_t)(efi_file_handle_t *File, efi_guid_t *InformationType, uintn_t *BufferSize, - void *Buffer); -typedef efi_status_t (EFIAPI *efi_file_set_info_t)(efi_file_handle_t *File, efi_guid_t *InformationType, uintn_t BufferSize, - void *Buffer); -typedef efi_status_t (EFIAPI *efi_file_flush_t)(efi_file_handle_t *File); - -struct efi_file_handle_s { - uint64_t Revision; - efi_file_open_t Open; - efi_file_close_t Close; - efi_file_delete_t Delete; - efi_file_read_t Read; - efi_file_write_t Write; - efi_file_get_pos_t GetPosition; - efi_file_set_pos_t SetPosition; - efi_file_get_info_t GetInfo; - efi_file_set_info_t SetInfo; - efi_file_flush_t Flush; -}; - -/*** Shell Parameter Protocols ***/ -#ifndef EFI_SHELL_PARAMETERS_PROTOCOL_GUID -#define EFI_SHELL_PARAMETERS_PROTOCOL_GUID { 0x752f3136, 0x4e16, 0x4fdc, {0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca} } -#endif - -typedef struct { - wchar_t **Argv; - uintn_t Argc; - efi_handle_t StdIn; - efi_handle_t StdOut; - efi_handle_t StdErr; -} efi_shell_parameters_protocol_t; - -#ifndef SHELL_INTERFACE_PROTOCOL_GUID -#define SHELL_INTERFACE_PROTOCOL_GUID { 0x47c7b223, 0xc42a, 0x11d2, {0x8e, 0x57, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -#endif - -typedef struct { - efi_handle_t ImageHandle; - void* *Info; - wchar_t **Argv; - uintn_t Argc; - wchar_t **RedirArgv; - uintn_t RedirArgc; - efi_handle_t StdIn; - efi_handle_t StdOut; - efi_handle_t StdErr; -} efi_shell_interface_protocol_t; - -/*** Random Number Generator ***/ -#ifndef EFI_RNG_PROTOCOL_GUID -#define EFI_RNG_PROTOCOL_GUID { 0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44} } -#endif - -typedef efi_status_t (EFIAPI *efi_rng_get_info_t)(void *This, uintn_t *RNGAlgorithmListSize, efi_guid_t *RNGAlgorithmList); -typedef efi_status_t (EFIAPI *efi_rng_get_rng_t)(void *This, efi_guid_t *RNGAlgorithm, uintn_t RNGValueLength, uint8_t *RNGValue); - -typedef struct { - efi_rng_get_info_t GetInfo; - efi_rng_get_rng_t GetRNG; -} efi_rng_protocol_t; - -/*** Serial IO Protocol ***/ -#ifndef EFI_SERIAL_IO_PROTOCOL_GUID -#define EFI_SERIAL_IO_PROTOCOL_GUID { 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD} } - -#define SERIAL_IO_INTERFACE_REVISION 0x00010000 -#define EFI_SERIAL_CLEAR_TO_SEND 0x0010 -#define EFI_SERIAL_DATA_SET_READY 0x0020 -#define EFI_SERIAL_RING_INDICATE 0x0040 -#define EFI_SERIAL_CARRIER_DETECT 0x0080 -#define EFI_SERIAL_REQUEST_TO_SEND 0x0002 -#define EFI_SERIAL_DATA_TERMINAL_READY 0x0001 -#define EFI_SERIAL_INPUT_BUFFER_EMPTY 0x0100 -#define EFI_SERIAL_OUTPUT_BUFFER_EMPTY 0x0200 -#define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE 0x1000 -#define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE 0x2000 -#define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x4000 - -typedef enum { - DefaultParity, - NoParity, - EvenParity, - OddParity, - MarkParity, - SpaceParity -} efi_parity_type_t; - -typedef enum { - DefaultStopBits, - OneStopBit, - OneFiveStopBits, - TwoStopBits -} efi_stop_bits_type_t; - -#else - -#define efi_parity_type_t EFI_PARITY_TYPE -#define efi_stop_bits_type_t EFI_STOP_BITS_TYPE - -#endif - -typedef struct { - uint32_t ControlMask; - uint32_t Timeout; - uint64_t BaudRate; - uint32_t ReceiveFifoDepth; - uint32_t DataBits; - uint32_t Parity; - uint32_t StopBits; -} efi_serial_io_mode_t; - -typedef efi_status_t (EFIAPI *efi_serial_reset_t)(void *This); -typedef efi_status_t (EFIAPI *efi_serial_set_attributes_t)(void *This, uint64_t BaudRate, uint32_t ReceiveFifoDepth, - uint32_t Timeout, efi_parity_type_t Parity, uint8_t DataBits, efi_stop_bits_type_t StopBits); -typedef efi_status_t (EFIAPI *efi_serial_set_control_bits_t)(void *This, uint32_t Control); -typedef efi_status_t (EFIAPI *efi_serial_get_control_bits_t)(void *This, uint32_t *Control); -typedef efi_status_t (EFIAPI *efi_serial_write_t)(void *This, uintn_t *BufferSize, void *Buffer); -typedef efi_status_t (EFIAPI *efi_serial_read_t)(void *This, uintn_t *BufferSize, void *Buffer); - -typedef struct { - uint32_t Revision; - efi_serial_reset_t Reset; - efi_serial_set_attributes_t SetAttributes; - efi_serial_set_control_bits_t SetControl; - efi_serial_get_control_bits_t GetControl; - efi_serial_write_t Write; - efi_serial_read_t Read; - efi_serial_io_mode_t *Mode; -} efi_serial_io_protocol_t; - -/*** Block IO Protocol ***/ -#ifndef EFI_BLOCK_IO_PROTOCOL_GUID -#define EFI_BLOCK_IO_PROTOCOL_GUID { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -#define EFI_BLOCK_IO_PROTOCOL_REVISION 0x00010000 -#define EFI_BLOCK_IO_INTERFACE_REVISION EFI_BLOCK_IO_PROTOCOL_REVISION - -#endif - -typedef struct { - uint32_t MediaId; - boolean_t RemovableMedia; - boolean_t MediaPresent; - boolean_t LogicalPartition; - boolean_t ReadOnly; - boolean_t WriteCaching; - uint32_t BlockSize; - uint32_t IoAlign; - efi_lba_t LastBlock; -} efi_block_io_media_t; - -typedef efi_status_t (EFIAPI *efi_block_reset_t)(void *This, boolean_t ExtendedVerification); -typedef efi_status_t (EFIAPI *efi_block_read_t)(void *This, uint32_t MediaId, efi_lba_t LBA, uintn_t BufferSize, void *Buffer); -typedef efi_status_t (EFIAPI *efi_block_write_t)(void *This, uint32_t MediaId, efi_lba_t LBA, uintn_t BufferSize, void *Buffer); -typedef efi_status_t (EFIAPI *efi_block_flush_t)(void *This); - -typedef struct { - uint64_t Revision; - efi_block_io_media_t *Media; - efi_block_reset_t Reset; - efi_block_read_t ReadBlocks; - efi_block_write_t WriteBlocks; - efi_block_flush_t FlushBlocks; -} efi_block_io_t; - -typedef struct { - off_t offset; - efi_block_io_t *bio; -} block_file_t; - -/*** Graphics Output Protocol (not used, but could be useful to have) ***/ -#ifndef EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID -#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID { 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } } - -typedef enum { - PixelRedGreenBlueReserved8BitPerColor, - PixelBlueGreenRedReserved8BitPerColor, - PixelBitMask, - PixelBltOnly, - PixelFormatMax -} efi_gop_pixel_format_t; - -typedef enum { - EfiBltVideoFill, - EfiBltVideoToBltBuffer, - EfiBltBufferToVideo, - EfiBltVideoToVideo, - EfiGraphicsOutputBltOperationMax -} efi_gop_blt_operation_t; - -#else - -#define efi_gop_pixel_format_t EFI_GRAPHICS_PIXEL_FORMAT -#define efi_gop_blt_operation_t EFI_GRAPHICS_OUTPUT_BLT_OPERATION - -#endif - -typedef struct { - uint32_t RedMask; - uint32_t GreenMask; - uint32_t BlueMask; - uint32_t ReservedMask; -} efi_gop_pixel_bitmask_t; - -typedef struct { - uint32_t Version; - uint32_t HorizontalResolution; - uint32_t VerticalResolution; - efi_gop_pixel_format_t PixelFormat; - efi_gop_pixel_bitmask_t PixelInformation; - uint32_t PixelsPerScanLine; -} efi_gop_mode_info_t; - -typedef struct { - uint32_t MaxMode; - uint32_t Mode; - efi_gop_mode_info_t *Information; - uintn_t SizeOfInfo; - efi_physical_address_t FrameBufferBase; - uintn_t FrameBufferSize; -} efi_gop_mode_t; - -typedef efi_status_t (EFIAPI *efi_gop_query_mode_t)(void *This, uint32_t ModeNumber, uintn_t *SizeOfInfo, - efi_gop_mode_info_t **Info); -typedef efi_status_t (EFIAPI *efi_gop_set_mode_t)(void *This, uint32_t ModeNumber); -typedef efi_status_t (EFIAPI *efi_gop_blt_t)(void *This, uint32_t *BltBuffer, efi_gop_blt_operation_t BltOperation, - uintn_t SourceX, uintn_t SourceY, uintn_t DestinationX, uintn_t DestionationY, uintn_t Width, uintn_t Height, uintn_t Delta); - -typedef struct { - efi_gop_query_mode_t QueryMode; - efi_gop_set_mode_t SetMode; - efi_gop_blt_t Blt; - efi_gop_mode_t *Mode; -} efi_gop_t; - -/*** Simple Pointer Protocol (not used, but could be useful to have) ***/ -#ifndef EFI_SIMPLE_POINTER_PROTOCOL_GUID -#define EFI_SIMPLE_POINTER_PROTOCOL_GUID { 0x31878c87, 0xb75, 0x11d5, { 0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } -#endif - -typedef struct { - int32_t RelativeMovementX; - int32_t RelativeMovementY; - int32_t RelativeMovementZ; - boolean_t LeftButton; - boolean_t RightButton; -} efi_simple_pointer_state_t; - -typedef struct { - uint64_t ResolutionX; - uint64_t ResolutionY; - uint64_t ResolutionZ; - boolean_t LeftButton; - boolean_t RightButton; -} efi_simple_pointer_mode_t; - -typedef efi_status_t (EFIAPI *efi_simple_pointer_reset_t) (void *This, boolean_t ExtendedVerification); -typedef efi_status_t (EFIAPI *efi_simple_pointer_get_state_t) (void *This, efi_simple_pointer_state_t *State); - -typedef struct { - efi_simple_pointer_reset_t Reset; - efi_simple_pointer_get_state_t GetState; - efi_event_t WaitForInput; - efi_simple_pointer_mode_t *Mode; -} efi_simple_pointer_protocol_t; - -/*** Option ROM Protocol (not used, but could be useful to have) ***/ -#ifndef EFI_PCI_OPTION_ROM_TABLE_GUID -#define EFI_PCI_OPTION_ROM_TABLE_GUID { 0x7462660f, 0x1cbd, 0x48da, {0xad, 0x11, 0x91, 0x71, 0x79, 0x13, 0x83, 0x1c} } -#endif - -typedef struct { - efi_physical_address_t RomAddress; - efi_memory_type_t MemoryType; - uint32_t RomLength; - uint32_t Seg; - uint8_t Bus; - uint8_t Dev; - uint8_t Func; - boolean_t ExecutedLegacyBiosImage; - boolean_t DontLoadEfiRom; -} efi_pci_option_rom_descriptor_t; - -typedef struct { - uint64_t PciOptionRomCount; - efi_pci_option_rom_descriptor_t *PciOptionRomDescriptors; -} efi_pci_option_rom_table_t; - -/*** GPT partitioning table (not used, but could be useful to have) ***/ -typedef struct { - efi_table_header_t Header; - efi_lba_t MyLBA; - efi_lba_t AlternateLBA; - efi_lba_t FirstUsableLBA; - efi_lba_t LastUsableLBA; - efi_guid_t DiskGUID; - efi_lba_t PartitionEntryLBA; - uint32_t NumberOfPartitionEntries; - uint32_t SizeOfPartitionEntry; - uint32_t PartitionEntryArrayCRC32; -} efi_partition_table_header_t; - -typedef struct { - efi_guid_t PartitionTypeGUID; - efi_guid_t UniquePartitionGUID; - efi_lba_t StartingLBA; - efi_lba_t EndingLBA; - uint64_t Attributes; - wchar_t PartitionName[36]; -} efi_partition_entry_t; - -/*** POSIX definitions ***/ -#define abs(x) ((x)<0?-(x):(x)) -#define min(x,y) ((x)<(y)?(x):(y)) -#define max(x,y) ((x)>(y)?(x):(y)) - -/* dirent.h */ -#define IFTODT(mode) (((mode) & 0170000) >> 12) -#define DTTOIF(dirtype) ((dirtype) << 12) -#define DT_DIR 4 -#define DT_REG 8 -struct dirent { - unsigned short int d_reclen; - unsigned char d_type; - char_t d_name[FILENAME_MAX]; -}; -typedef struct efi_file_handle_s DIR; -extern DIR *opendir (const char_t *__name); -extern struct dirent *readdir (DIR *__dirp); -extern void rewinddir (DIR *__dirp); -extern int closedir (DIR *__dirp); - -/* errno.h */ -extern int errno; -#define EPERM 1 /* Operation not permitted */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* I/O error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Argument list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file number */ -#define ECHILD 10 /* No child processes */ -#define EAGAIN 11 /* Try again */ -#define ENOMEM 12 /* Out of memory */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#define ENOTBLK 15 /* Block device required */ -#define EBUSY 16 /* Device or resource busy */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* File table overflow */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Not a typewriter */ -#define ETXTBSY 26 /* Text file busy */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ -#define EDOM 33 /* Math argument out of domain of func */ -#define ERANGE 34 /* Math result not representable */ - -/* stdlib.h */ -#define RAND_MAX 2147483647 -typedef int (*__compar_fn_t) (const void *, const void *); -extern int atoi (const char_t *__nptr); -extern int64_t atol (const char_t *__nptr); -extern int64_t strtol (const char_t *__nptr, char_t **__endptr, int __base); -extern void *malloc (size_t __size); -extern void *calloc (size_t __nmemb, size_t __size); -extern void *realloc (void *__ptr, size_t __size); -extern void free (void *__ptr); -extern void abort (void); -extern void exit (int __status); -/* exit Boot Services function. Returns 0 on success. */ -extern int exit_bs(void); -extern void *bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar); -extern void qsort (void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar); -extern int mblen (const char *__s, size_t __n); -extern int mbtowc (wchar_t * __pwc, const char * __s, size_t __n); -extern int wctomb (char *__s, wchar_t __wchar); -extern size_t mbstowcs (wchar_t *__pwcs, const char *__s, size_t __n); -extern size_t wcstombs (char *__s, const wchar_t *__pwcs, size_t __n); -extern void srand(unsigned int __seed); -extern int rand(void); -extern uint8_t *getenv(char_t *name, uintn_t *len); -extern int setenv(char_t *name, uintn_t len, uint8_t *data); - -/* stdio.h */ -#ifndef BUFSIZ -#define BUFSIZ 8192 -#endif -#define SEEK_SET 0 /* Seek from beginning of file. */ -#define SEEK_CUR 1 /* Seek from current position. */ -#define SEEK_END 2 /* Seek from end of file. */ -#define stdin (FILE*)ST->ConsoleInHandle -#define stdout (FILE*)ST->ConsoleOutHandle -#define stderr (FILE*)ST->ConsoleErrorHandle -typedef struct efi_file_handle_s FILE; -extern int fclose (FILE *__stream); -extern int fflush (FILE *__stream); -extern int remove (const char_t *__filename); -extern FILE *fopen (const char_t *__filename, const char_t *__modes); -extern size_t fread (void *__ptr, size_t __size, size_t __n, FILE *__stream); -extern size_t fwrite (const void *__ptr, size_t __size, size_t __n, FILE *__s); -extern int fseek (FILE *__stream, long int __off, int __whence); -extern long int ftell (FILE *__stream); -extern int feof (FILE *__stream); -extern int fprintf (FILE *__stream, const char_t *__format, ...); -extern int printf (const char_t *__format, ...); -extern int sprintf (char_t *__s, const char_t *__format, ...); -extern int vfprintf (FILE *__s, const char_t *__format, __builtin_va_list __arg); -extern int vprintf (const char_t *__format, __builtin_va_list __arg); -extern int vsprintf (char_t *__s, const char_t *__format, __builtin_va_list __arg); -extern int snprintf (char_t *__s, size_t __maxlen, const char_t *__format, ...); -extern int vsnprintf (char_t *__s, size_t __maxlen, const char_t *__format, __builtin_va_list __arg); -extern int getchar (void); -/* non-blocking, only returns UNICODE if there's any key pressed, 0 otherwise */ -extern int getchar_ifany (void); -extern int putchar (int __c); - -/* string.h */ -extern void *memcpy(void *__dest, const void *__src, size_t __n); -extern void *memmove(void *__dest, const void *__src, size_t __n); -extern void *memset(void *__s, int __c, size_t __n); -extern int memcmp(const void *__s1, const void *__s2, size_t __n); -extern void *memchr(const void *__s, int __c, size_t __n); -extern void *memrchr(const void *__s, int __c, size_t __n); -void *memmem(const void *haystack, size_t hl, const void *needle, size_t nl); -void *memrmem(const void *haystack, size_t hl, const void *needle, size_t nl); -extern char_t *strcpy (char_t *__dest, const char_t *__src); -extern char_t *strncpy (char_t *__dest, const char_t *__src, size_t __n); -extern char_t *strcat (char_t *__dest, const char_t *__src); -extern char_t *strncat (char_t *__dest, const char_t *__src, size_t __n); -extern int strcmp (const char_t *__s1, const char_t *__s2); -extern int strncmp (const char_t *__s1, const char_t *__s2, size_t __n); -extern char_t *strdup (const char_t *__s); -extern char_t *strchr (const char_t *__s, int __c); -extern char_t *strrchr (const char_t *__s, int __c); -extern char_t *strstr (const char_t *__haystack, const char_t *__needle); -extern char_t *strtok (char_t *__s, const char_t *__delim); -extern char_t *strtok_r (char_t *__s, const char_t *__delim, char_t **__save_ptr); -extern size_t strlen (const char_t *__s); - -/* sys/stat.h */ -#define S_IREAD 0400 /* Read by owner. */ -#define S_IWRITE 0200 /* Write by owner. */ -#define S_IFMT 0170000 /* These bits determine file type. */ -#define S_IFIFO 0010000 /* FIFO. */ -#define S_IFCHR 0020000 /* Character device. */ -#define S_IFDIR 0040000 /* Directory. */ -#define S_IFBLK 0060000 /* Block device. */ -#define S_IFREG 0100000 /* Regular file. */ -#define S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask)) -#define S_ISCHR(mode) S_ISTYPE((mode), S_IFCHR) -#define S_ISDIR(mode) S_ISTYPE((mode), S_IFDIR) -#define S_ISBLK(mode) S_ISTYPE((mode), S_IFBLK) -#define S_ISREG(mode) S_ISTYPE((mode), S_IFREG) -#define S_ISFIFO(mode) S_ISTYPE((mode), S_IFIFO) -struct stat { - mode_t st_mode; - off_t st_size; - blkcnt_t st_blocks; - time_t st_atime; - time_t st_mtime; - time_t st_ctime; -}; -extern int stat (const char_t *__file, struct stat *__buf); -extern int fstat (FILE *__f, struct stat *__buf); -extern int mkdir (const char_t *__path, mode_t __mode); - -/* time.h */ -struct tm { - int tm_sec; /* Seconds. [0-60] (1 leap second) */ - int tm_min; /* Minutes. [0-59] */ - int tm_hour; /* Hours. [0-23] */ - int tm_mday; /* Day. [1-31] */ - int tm_mon; /* Month. [0-11] */ - int tm_year; /* Year - 1900. */ - int tm_wday; /* Day of week. [0-6] (not set) */ - int tm_yday; /* Days in year.[0-365] (not set) */ - int tm_isdst; /* DST. [-1/0/1]*/ -}; -extern struct tm *localtime (const time_t *__timer); -extern time_t mktime(const struct tm *__tm); -extern time_t time(time_t *__timer); - -/* unistd.h */ -extern unsigned int sleep (unsigned int __seconds); -extern int usleep (unsigned long int __useconds); -extern int unlink (const wchar_t *__filename); -extern int rmdir (const wchar_t *__filename); - -#ifdef __cplusplus -} -#endif - -#endif /* _UEFI_H_ */ diff --git a/CMakeLists.txt b/CMakeLists.txt index 36165c0fd..9312d1778 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,6 +126,7 @@ ExternalProject_Add( -DCMAKE_ASM_FLAGS=${CMAKE_ASM_FLAGS} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DUSE_GNU_UEFI=${USE_GNU_UEFI} -DKernelName=${KernelName} BUILD_COMMAND ${GENERATOR_COMMAND} INSTALL_COMMAND "" diff --git a/cmake/config.cmake b/cmake/config.cmake index 597d8ba13..cfa9443c6 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -48,6 +48,9 @@ if (NOT ARCH IN_LIST VALID_ARCH) message(FATAL_ERROR "ARCH must be one of ${VALID_ARCH}") endif () +# 指定要使用的 efi +message("USE_GNU_UEFI is: ${USE_GNU_UEFI}") + # 是否 debug,默认为 Debug if (CMAKE_BUILD_TYPE STREQUAL "Release") set(DEBUG_FLAGS "-Werror") @@ -66,7 +69,7 @@ set(OPTIMIZE_FLAGS "-O0") set(COMMON_FLAGS "-Wall -Wextra \ -no-pie -nostdlib \ -fPIC -ffreestanding -fexceptions -fshort-wchar \ --DGNU_EFI_USE_MS_ABI") +-DUSE_GNU_UEFI=${USE_GNU_UEFI}") # 架构相关编译选项 # @todo clang 交叉编译参数 diff --git a/run.sh b/run.sh index 0cdf9032e..1b2eba6be 100755 --- a/run.sh +++ b/run.sh @@ -17,6 +17,9 @@ MACHINE=qemu ARCH=x86_64 #ARCH=aarch64 +# 指定要使用的 efi +USE_GNU_UEFI=1 + CMAKE_BUILD_TYPE=Debug #CMAKE_BUILD_TYPE=Release @@ -32,6 +35,7 @@ cd ./build_${ARCH} cmake \ -DMACHINE=${MACHINE} \ -DARCH=${ARCH} \ + -DUSE_GNU_UEFI=${USE_GNU_UEFI} \ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ -DCOMPILER=${COMPILER} \ -DGENERATOR=${GENERATOR} \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5cb55e52a..8b69888b5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,17 +29,23 @@ if (ARCH STREQUAL "riscv64") elseif (ARCH STREQUAL "x86_64") # 将各个子对象链接为内核文件 add_executable(${KernelName} -# ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/reloc_${ARCH}.o -# ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/crt0-efi-${ARCH}.o - ${CMAKE_BINARY_DIR}/../3rd/posix-uefi/crt0.o $ $ ) - target_link_libraries(${KernelName} PRIVATE -# ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/lib/libefi.a -# ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/libgnuefi.a - ${CMAKE_BINARY_DIR}/../3rd/posix-uefi/libuefi.a - ) + if (USE_GNU_UEFI STREQUAL "1") + target_link_libraries(${KernelName} PRIVATE + ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/crt0-efi-${ARCH}.o + ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/reloc_${ARCH}.o + ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/libgnuefi.a + ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/lib/libefi.a + ) + else () + target_link_libraries(${KernelName} PRIVATE + ${CMAKE_BINARY_DIR}/../3rd/posix-uefi/crt0.o + ${CMAKE_BINARY_DIR}/../3rd/posix-uefi/libuefi.a + ) + endif () + elseif (ARCH STREQUAL "aarch64") # 将各个子对象链接为内核文件 add_executable(${KernelName} diff --git a/src/arch/x86_64/boot/boot.cpp b/src/arch/x86_64/boot/boot.cpp index 772a81deb..a123dea93 100644 --- a/src/arch/x86_64/boot/boot.cpp +++ b/src/arch/x86_64/boot/boot.cpp @@ -15,32 +15,38 @@ */ #include "cassert" -//#include "efi.h" -//#include "efilib.h" +#include "kernel.h" -#include "uefi.h" +#if USE_GNU_UEFI == 1 +# include "efi.h" +# include "efilib.h" +#else +# include "uefi.h" +#endif -#include "kernel.h" +#if USE_GNU_UEFI == 1 + +/** + * efi_main - The entry point for the EFI application + * @image: firmware-allocated handle that identifies the image + * @SystemTable: EFI system table + */ +extern "C" EFI_STATUS +efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { + uefi_call_wrapper(InitializeLib, 2, image, systemTable); + EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, 1, + systemTable->ConOut); + + status = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, + systemTable->ConOut, L"Hello UEFI!\n"); + assert(status != EFI_SUCCESS); -///** -// * efi_main - The entry point for the EFI application -// * @image: firmware-allocated handle that identifies the image -// * @SystemTable: EFI system table -// */ -//extern "C" EFI_STATUS -//efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { -// uefi_call_wrapper(InitializeLib, 2, image, systemTable); -// EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, 1, -// systemTable->ConOut); -// -// status = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, -// systemTable->ConOut, L"Hello UEFI!\n"); -// assert(status != EFI_SUCCESS); -// -// kernel_main(); -// -// return EFI_SUCCESS; -//} + kernel_main(); + + return EFI_SUCCESS; +} + +#else /** * Dump memory at given address, should accept 0x prefixes from the command line @@ -56,3 +62,5 @@ extern "C" int main(int argc, char** argv) { return EFI_SUCCESS; } + +#endif From edc870d95914edb078f244b7d33843729d95e9b4 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 19 Jun 2023 01:01:42 +0800 Subject: [PATCH 06/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- src/arch/x86_64/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/arch/x86_64/CMakeLists.txt b/src/arch/x86_64/CMakeLists.txt index 95da47c8e..cd81b6b38 100644 --- a/src/arch/x86_64/CMakeLists.txt +++ b/src/arch/x86_64/CMakeLists.txt @@ -8,14 +8,10 @@ # 设置子模块名 PROJECT(arch) -enable_language(ASM) enable_language(CXX) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/boot boot_src) -# 添加到 boot_src -set(boot_src ${boot_src}) - # 设置子模块所有的源码 set(arch_src ${boot_src}) From 041bafd95878ed5cdb5baaac4d78e16f46498a34 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 19 Jun 2023 21:07:30 +0800 Subject: [PATCH 07/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 1b2eba6be..60ef6ce44 100755 --- a/run.sh +++ b/run.sh @@ -18,7 +18,7 @@ ARCH=x86_64 #ARCH=aarch64 # 指定要使用的 efi -USE_GNU_UEFI=1 +USE_GNU_UEFI=0 CMAKE_BUILD_TYPE=Debug #CMAKE_BUILD_TYPE=Release From f92f15429a27ef9b8b4e4557775cca056a358210 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 19 Jun 2023 23:53:18 +0800 Subject: [PATCH 08/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 52 +++++++++++- cmake/config.cmake | 14 ++-- cmake/header_files.cmake | 4 +- run.sh | 4 +- src/CMakeLists.txt | 16 +--- src/arch/aarch64/CMakeLists.txt | 9 +- src/arch/aarch64/boot/boot.S | 142 -------------------------------- src/arch/x86_64/CMakeLists.txt | 15 ---- src/arch/x86_64/boot/boot.cpp | 66 --------------- src/boot/CMakeLists.txt | 43 ++++++++++ src/boot/aarch64/boot/boot.cpp | 112 +++++++++++++++++++++++++ src/boot/aarch64/link.ld | 72 ++++++++++++++++ src/boot/x86_64/boot.cpp | 112 +++++++++++++++++++++++++ src/boot/x86_64/link.ld | 76 +++++++++++++++++ 14 files changed, 479 insertions(+), 258 deletions(-) delete mode 100644 src/arch/aarch64/boot/boot.S delete mode 100644 src/arch/x86_64/boot/boot.cpp create mode 100644 src/boot/CMakeLists.txt create mode 100644 src/boot/aarch64/boot/boot.cpp create mode 100644 src/boot/aarch64/link.ld create mode 100644 src/boot/x86_64/boot.cpp create mode 100644 src/boot/x86_64/link.ld diff --git a/CMakeLists.txt b/CMakeLists.txt index 9312d1778..e4530c487 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,7 @@ if (ARCH STREQUAL "riscv64") elseif (ARCH STREQUAL "x86_64") add_custom_command(TARGET kernel_pre DEPENDS gnuefi posixuefi - COMMAND make gnuefi + # COMMAND make gnuefi COMMAND make posixuefi ) @@ -97,6 +97,40 @@ elseif (ARCH STREQUAL "aarch64") endif () +# 引导 +ExternalProject_Add( + boot + BUILD_ALWAYS 1 + PREFIX ${CMAKE_BINARY_DIR} + SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/boot + BINARY_DIR ${CMAKE_BINARY_DIR}/src/boot + CMAKE_ARGS + -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} + -DCMAKE_C_COMPILER_WORKS=${CMAKE_C_COMPILER_WORKS} + -DCMAKE_CXX_COMPILER_WORKS=${CMAKE_CXX_COMPILER_WORKS} + -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=${CMAKE_FIND_ROOT_PATH_MODE_PROGRAM} + -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY} + -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=${CMAKE_FIND_ROOT_PATH_MODE_INCLUDE} + -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE} + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + -DCMAKE_C_STANDARD=${CMAKE_C_STANDARD} + -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + -DMACHINE=${MACHINE} + -DARCH=${ARCH} + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} + -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} + -DCMAKE_ASM_FLAGS=${CMAKE_ASM_FLAGS} + -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DUSE_GNU_UEFI=${USE_GNU_UEFI} + -DOUTPUT_NAME=boot.elf + BUILD_COMMAND ${GENERATOR_COMMAND} + INSTALL_COMMAND "" +) + # 内核本体 ExternalProject_Add( kernel @@ -175,6 +209,18 @@ add_custom_command(TARGET objdump COMMAND ${CMAKE_OBJDUMP} -D ${KernelName} > ${KernelName}.disassembly COMMENT "Disassembling...") +# 制作 boot.efi +# 将引导调整为 efi +add_custom_target(boot_efi DEPENDS boot) +add_custom_command(TARGET boot_efi + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMENT "Gen boot.efi" + COMMAND ${CMAKE_OBJCOPY} boot.elf boot.efi + -j .text -j .sdata -j .data -j .dynamic -j .dynsym + -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc + --target=efi-app-x86-64 --subsystem=10 + ) + # 制作内核 # 将内核调整为 efi add_custom_target(kernel_efi DEPENDS kernel) @@ -187,12 +233,12 @@ add_custom_command(TARGET kernel_efi -S -R .eh_frame -R .gcc_except_table ) -add_custom_target(image_uefi DEPENDS kernel_efi) +add_custom_target(image_uefi DEPENDS boot_efi kernel_efi) add_custom_command(TARGET image_uefi COMMENT "Copying bootloader and kernel" COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/image/efi/boot COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/*.efi ${CMAKE_BINARY_DIR}/image/efi/boot/ - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tools/startup.nsh ${CMAKE_BINARY_DIR}/image/startup.nsh + # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tools/startup.nsh ${CMAKE_BINARY_DIR}/image/startup.nsh ) # 制作镜像 add_custom_target(image DEPENDS image_uefi) diff --git a/cmake/config.cmake b/cmake/config.cmake index cfa9443c6..4173b99e9 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -49,6 +49,11 @@ if (NOT ARCH IN_LIST VALID_ARCH) endif () # 指定要使用的 efi +if (USE_GNU_UEFI STREQUAL "1") + set(UEFI_FLAGS "-DUSE_GNU_UEFI=${USE_GNU_UEFI} -DHAVE_USE_MS_ABI") +else () + set(UEFI_FLAGS "-DUSE_GNU_UEFI=${USE_GNU_UEFI} -DHAVE_USE_MS_ABI") +endif () message("USE_GNU_UEFI is: ${USE_GNU_UEFI}") # 是否 debug,默认为 Debug @@ -68,8 +73,7 @@ set(OPTIMIZE_FLAGS "-O0") # 通用编译选项 set(COMMON_FLAGS "-Wall -Wextra \ -no-pie -nostdlib \ --fPIC -ffreestanding -fexceptions -fshort-wchar \ --DUSE_GNU_UEFI=${USE_GNU_UEFI}") +-fPIC -ffreestanding -fexceptions -fshort-wchar") # 架构相关编译选项 # @todo clang 交叉编译参数 @@ -83,17 +87,17 @@ elseif (ARCH STREQUAL "aarch64") set(ARCH_FLAGS "-march=armv8-a -mtune=cortex-a72") endif () -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPTIMIZE_FLAGS} ${COMMON_FLAGS} ${ARCH_FLAGS} ${DEBUG_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPTIMIZE_FLAGS} ${COMMON_FLAGS} ${ARCH_FLAGS} ${DEBUG_FLAGS} ${UEFI_FLAGS}") message("CMAKE_C_FLAGS:${CMAKE_C_FLAGS}") # 将编译选项同步到汇编 set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}") -message("CMAKE_ASM_FLAGS:${CMAKE_ASM_FLAGS}") +message("CMAKE_ASM_FLAGS: ${CMAKE_ASM_FLAGS}") # 将编译选项同步到 c++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -fpermissive") -message("CMAKE_CXX_FLAGS:${CMAKE_CXX_FLAGS}") +message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") # 设置构建使用的工具,默认为 make if (GENERATOR STREQUAL "ninja") diff --git a/cmake/header_files.cmake b/cmake/header_files.cmake index 4b769381a..c68661ef6 100644 --- a/cmake/header_files.cmake +++ b/cmake/header_files.cmake @@ -1,7 +1,7 @@ # This file is a part of Simple-XX/SimpleKernel # (https://github.com/Simple-XX/SimpleKernel). -# Based on https://github.com/SynestiaOS/SynestiaOS +# # CMakeLists.txt for Simple-XX/SimpleKernel. # 将头文件路径添加到 Target 的搜索路径中 @@ -18,5 +18,5 @@ function(target_include_gnu_efi_header_files Target) endfunction() function(target_include_posix_uefi_header_files Target) - target_include_directories(${Target} PRIVATE ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/uefi) + target_include_directories(${Target} PRIVATE ${CMAKE_SOURCE_DIR}/../../3rd/posix-uefi/uefi) endfunction() diff --git a/run.sh b/run.sh index 60ef6ce44..c8ad2823c 100755 --- a/run.sh +++ b/run.sh @@ -13,9 +13,9 @@ set -e MACHINE=qemu -#ARCH=riscv64 +# ARCH=riscv64 ARCH=x86_64 -#ARCH=aarch64 +# ARCH=aarch64 # 指定要使用的 efi USE_GNU_UEFI=0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b69888b5..0932fe0bc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,8 +5,8 @@ # CMakeLists.txt for Simple-XX/SimpleKernel. # 设置编译规则 -project(kernel) cmake_minimum_required(VERSION 3.13) +project(kernel) # 暂时没有用到的变量,消除警告 set(ignoreMe "${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}${MACHINE}") @@ -29,22 +29,8 @@ if (ARCH STREQUAL "riscv64") elseif (ARCH STREQUAL "x86_64") # 将各个子对象链接为内核文件 add_executable(${KernelName} - $ $ ) - if (USE_GNU_UEFI STREQUAL "1") - target_link_libraries(${KernelName} PRIVATE - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/crt0-efi-${ARCH}.o - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/reloc_${ARCH}.o - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/libgnuefi.a - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/lib/libefi.a - ) - else () - target_link_libraries(${KernelName} PRIVATE - ${CMAKE_BINARY_DIR}/../3rd/posix-uefi/crt0.o - ${CMAKE_BINARY_DIR}/../3rd/posix-uefi/libuefi.a - ) - endif () elseif (ARCH STREQUAL "aarch64") # 将各个子对象链接为内核文件 diff --git a/src/arch/aarch64/CMakeLists.txt b/src/arch/aarch64/CMakeLists.txt index 867f4091c..1f78a0e7d 100644 --- a/src/arch/aarch64/CMakeLists.txt +++ b/src/arch/aarch64/CMakeLists.txt @@ -3,11 +3,4 @@ # # CMakeLists.txt for Simple-XX/SimpleKernel. -PROJECT(arch ASM) - -find_asm_source_files(boot_asm_src ${arch_SOURCE_DIR}/boot) -set(boot_src ${boot_asm_src}) - -set(arch_src ${boot_src}) - -add_library(${PROJECT_NAME} OBJECT ${arch_src}) +PROJECT(arch) diff --git a/src/arch/aarch64/boot/boot.S b/src/arch/aarch64/boot/boot.S deleted file mode 100644 index 27a86e8da..000000000 --- a/src/arch/aarch64/boot/boot.S +++ /dev/null @@ -1,142 +0,0 @@ - -// This file is a part of Simple-XX/SimpleKernel -// (https://github.com/Simple-XX/SimpleKernel). -// Based on https://wiki.osdev.org/Raspberry_Pi_Bare_Bones -// boot.S for Simple-XX/SimpleKernel. - -// clang-format off - -/* - * crt0-efi-aarch64.S - PE/COFF header for AArch64 EFI applications - * - * Copright (C) 2014 Linaro Ltd. - * - * 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 0 // 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 - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/src/arch/x86_64/CMakeLists.txt b/src/arch/x86_64/CMakeLists.txt index cd81b6b38..4db0d78b6 100644 --- a/src/arch/x86_64/CMakeLists.txt +++ b/src/arch/x86_64/CMakeLists.txt @@ -7,18 +7,3 @@ # 设置子模块名 PROJECT(arch) - -enable_language(CXX) - -aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/boot boot_src) - -# 设置子模块所有的源码 -set(arch_src ${boot_src}) - -# 添加子模块 -add_library(${PROJECT_NAME} OBJECT ${arch_src}) - -# 添加头文件搜索路径 -target_include_kernel_header_files(${PROJECT_NAME}) -target_include_gnu_efi_header_files(${PROJECT_NAME}) -target_include_posix_uefi_header_files(${PROJECT_NAME}) diff --git a/src/arch/x86_64/boot/boot.cpp b/src/arch/x86_64/boot/boot.cpp deleted file mode 100644 index a123dea93..000000000 --- a/src/arch/x86_64/boot/boot.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -/** - * @file boot.cpp - * @brief uefi 引导 - * @author kehroche (kehroche@gmail.com) - * @version 1.0 - * @date 2023-05-20 - * @copyright MIT LICENSE - * https://github.com/Simple-XX/SimpleKernel - * @par change log: - * - *
DateAuthorDescription - *
2023-05-20kehroche创建文件 - *
- */ - -#include "cassert" -#include "kernel.h" - -#if USE_GNU_UEFI == 1 -# include "efi.h" -# include "efilib.h" -#else -# include "uefi.h" -#endif - -#if USE_GNU_UEFI == 1 - -/** - * efi_main - The entry point for the EFI application - * @image: firmware-allocated handle that identifies the image - * @SystemTable: EFI system table - */ -extern "C" EFI_STATUS -efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { - uefi_call_wrapper(InitializeLib, 2, image, systemTable); - EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, 1, - systemTable->ConOut); - - status = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, - systemTable->ConOut, L"Hello UEFI!\n"); - assert(status != EFI_SUCCESS); - - kernel_main(); - - return EFI_SUCCESS; -} - -#else - -/** - * Dump memory at given address, should accept 0x prefixes from the command line - */ -extern "C" int main(int argc, char** argv) { - efi_physical_address_t address - = (argc < 2 ? (efi_physical_address_t)IM - : (efi_physical_address_t)atol(argv[1])); - - printf("%4D", address); - - kernel_main(); - - return EFI_SUCCESS; -} - -#endif diff --git a/src/boot/CMakeLists.txt b/src/boot/CMakeLists.txt new file mode 100644 index 000000000..073165dfe --- /dev/null +++ b/src/boot/CMakeLists.txt @@ -0,0 +1,43 @@ + +# This file is a part of Simple-XX/SimpleKernel +# (https://github.com/Simple-XX/SimpleKernel). +# +# CMakeLists.txt for Simple-XX/SimpleKernel. +# 引导程序 + +cmake_minimum_required(VERSION 3.13) +project(boot) + +# 暂时没有用到的变量,消除警告 +set(ignoreMe "${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}${MACHINE}${CMAKE_ASM_FLAGS}${USE_GNU_UEFI}") + +enable_language(CXX) + +# 引入添加头文件函数 +include(header_files) + +add_executable(boot + ${CMAKE_SOURCE_DIR}/${ARCH}/boot.cpp + ) + +if (USE_GNU_UEFI STREQUAL "1") + target_link_libraries(boot PRIVATE + ${CMAKE_BINARY_DIR}/../../3rd/gnu-efi/gnuefi/crt0-efi-${ARCH}.o + ${CMAKE_BINARY_DIR}/../../3rd/gnu-efi/gnuefi/reloc_${ARCH}.o + ${CMAKE_BINARY_DIR}/../../3rd/gnu-efi/gnuefi/libgnuefi.a + ${CMAKE_BINARY_DIR}/../../3rd/gnu-efi/lib/libefi.a + ) +else () + target_link_libraries(boot PRIVATE + ${CMAKE_BINARY_DIR}/../../3rd/posix-uefi/crt0.o + ${CMAKE_BINARY_DIR}/../../3rd/posix-uefi/libuefi.a + ) +endif () + +target_link_options(boot PRIVATE -T ${CMAKE_SOURCE_DIR}/${ARCH}/link.ld) + +set_target_properties(boot PROPERTIES OUTPUT_NAME ${OUTPUT_NAME}) + +# 添加头文件搜索路径 +target_include_gnu_efi_header_files(${PROJECT_NAME}) +target_include_posix_uefi_header_files(${PROJECT_NAME}) diff --git a/src/boot/aarch64/boot/boot.cpp b/src/boot/aarch64/boot/boot.cpp new file mode 100644 index 000000000..e21b6aee5 --- /dev/null +++ b/src/boot/aarch64/boot/boot.cpp @@ -0,0 +1,112 @@ + +/** + * @file boot.cpp + * @brief uefi 引导 + * @author kehroche (kehroche@gmail.com) + * @version 1.0 + * @date 2023-05-20 + * @copyright MIT LICENSE + * https://github.com/Simple-XX/SimpleKernel + * @par change log: + * + *
DateAuthorDescription + *
2023-05-20kehroche创建文件 + *
+ */ + +#include "cassert" + +#if USE_GNU_UEFI == 1 +# include "efi.h" +# include "efilib.h" +#else +# include "uefi.h" +#endif + +#if USE_GNU_UEFI == 1 + +/** + * efi_main - The entry point for the EFI application + * @image: firmware-allocated handle that identifies the image + * @SystemTable: EFI system table + */ +extern "C" EFI_STATUS +efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { + uefi_call_wrapper(InitializeLib, 2, image, systemTable); + EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, 1, + systemTable->ConOut); + + status = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, + systemTable->ConOut, L"Hello UEFI!\n"); + assert(status != EFI_SUCCESS); + + return EFI_SUCCESS; +} + +#else + +/** + * Dump memory at given address, should accept 0x prefixes from the command line + */ +extern "C" int main(int argc, char** argv) { + (void)argc; + (void)argv; + + printf("Hello World!\n"); + + efi_status_t status; + efi_memory_descriptor_t *memory_map = NULL, *mement; + uintn_t memory_map_size = 0, map_key = 0, desc_size = 0; + const char* types[] = { "EfiReservedMemoryType", + "EfiLoaderCode", + "EfiLoaderData", + "EfiBootServicesCode", + "EfiBootServicesData", + "EfiRuntimeServicesCode", + "EfiRuntimeServicesData", + "EfiConventionalMemory", + "EfiUnusableMemory", + "EfiACPIReclaimMemory", + "EfiACPIMemoryNVS", + "EfiMemoryMappedIO", + "EfiMemoryMappedIOPortSpace", + "EfiPalCode" }; + + /* get the memory map */ + status + = BS->GetMemoryMap(&memory_map_size, NULL, &map_key, &desc_size, NULL); + if (status != EFI_BUFFER_TOO_SMALL || !memory_map_size) { + goto err; + } + /* in worst case malloc allocates two blocks, and each block might split a + * record into three, that's 4 additional records */ + memory_map_size += 4 * desc_size; + memory_map = (efi_memory_descriptor_t*)malloc(memory_map_size); + if (!memory_map) { + fprintf(stderr, "unable to allocate memory\n"); + return 1; + } + status = BS->GetMemoryMap(&memory_map_size, memory_map, &map_key, + &desc_size, NULL); + if (EFI_ERROR(status)) { +err: + fprintf(stderr, "Unable to get memory map\n"); + return 0; + } + + printf("Address Size Type\n"); + for (mement = memory_map; + (uint8_t*)mement < (uint8_t*)memory_map + memory_map_size; + mement = NextMemoryDescriptor(mement, desc_size)) { + printf("%016x %8d %02x %s\n", mement->PhysicalStart, + mement->NumberOfPages, mement->Type, types[mement->Type]); + } + + free(memory_map); + + printf("DONE\n"); + + return 0; +} + +#endif diff --git a/src/boot/aarch64/link.ld b/src/boot/aarch64/link.ld new file mode 100644 index 000000000..b1acd77f0 --- /dev/null +++ b/src/boot/aarch64/link.ld @@ -0,0 +1,72 @@ + +/* This file is a part of Simple-XX/SimpleKernel + * (https://github.com/Simple-XX/SimpleKernel). + * + * link.ld for Simple-XX/SimpleKernel. + * 链接脚本,指定生成的二进制文件的布局 + */ + + +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) } +} diff --git a/src/boot/x86_64/boot.cpp b/src/boot/x86_64/boot.cpp new file mode 100644 index 000000000..e21b6aee5 --- /dev/null +++ b/src/boot/x86_64/boot.cpp @@ -0,0 +1,112 @@ + +/** + * @file boot.cpp + * @brief uefi 引导 + * @author kehroche (kehroche@gmail.com) + * @version 1.0 + * @date 2023-05-20 + * @copyright MIT LICENSE + * https://github.com/Simple-XX/SimpleKernel + * @par change log: + * + *
DateAuthorDescription + *
2023-05-20kehroche创建文件 + *
+ */ + +#include "cassert" + +#if USE_GNU_UEFI == 1 +# include "efi.h" +# include "efilib.h" +#else +# include "uefi.h" +#endif + +#if USE_GNU_UEFI == 1 + +/** + * efi_main - The entry point for the EFI application + * @image: firmware-allocated handle that identifies the image + * @SystemTable: EFI system table + */ +extern "C" EFI_STATUS +efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { + uefi_call_wrapper(InitializeLib, 2, image, systemTable); + EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, 1, + systemTable->ConOut); + + status = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, + systemTable->ConOut, L"Hello UEFI!\n"); + assert(status != EFI_SUCCESS); + + return EFI_SUCCESS; +} + +#else + +/** + * Dump memory at given address, should accept 0x prefixes from the command line + */ +extern "C" int main(int argc, char** argv) { + (void)argc; + (void)argv; + + printf("Hello World!\n"); + + efi_status_t status; + efi_memory_descriptor_t *memory_map = NULL, *mement; + uintn_t memory_map_size = 0, map_key = 0, desc_size = 0; + const char* types[] = { "EfiReservedMemoryType", + "EfiLoaderCode", + "EfiLoaderData", + "EfiBootServicesCode", + "EfiBootServicesData", + "EfiRuntimeServicesCode", + "EfiRuntimeServicesData", + "EfiConventionalMemory", + "EfiUnusableMemory", + "EfiACPIReclaimMemory", + "EfiACPIMemoryNVS", + "EfiMemoryMappedIO", + "EfiMemoryMappedIOPortSpace", + "EfiPalCode" }; + + /* get the memory map */ + status + = BS->GetMemoryMap(&memory_map_size, NULL, &map_key, &desc_size, NULL); + if (status != EFI_BUFFER_TOO_SMALL || !memory_map_size) { + goto err; + } + /* in worst case malloc allocates two blocks, and each block might split a + * record into three, that's 4 additional records */ + memory_map_size += 4 * desc_size; + memory_map = (efi_memory_descriptor_t*)malloc(memory_map_size); + if (!memory_map) { + fprintf(stderr, "unable to allocate memory\n"); + return 1; + } + status = BS->GetMemoryMap(&memory_map_size, memory_map, &map_key, + &desc_size, NULL); + if (EFI_ERROR(status)) { +err: + fprintf(stderr, "Unable to get memory map\n"); + return 0; + } + + printf("Address Size Type\n"); + for (mement = memory_map; + (uint8_t*)mement < (uint8_t*)memory_map + memory_map_size; + mement = NextMemoryDescriptor(mement, desc_size)) { + printf("%016x %8d %02x %s\n", mement->PhysicalStart, + mement->NumberOfPages, mement->Type, types[mement->Type]); + } + + free(memory_map); + + printf("DONE\n"); + + return 0; +} + +#endif diff --git a/src/boot/x86_64/link.ld b/src/boot/x86_64/link.ld new file mode 100644 index 000000000..7be590235 --- /dev/null +++ b/src/boot/x86_64/link.ld @@ -0,0 +1,76 @@ +/* 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) } +} From 199c0d7cec2f70b802f796719dc260fed027bc85 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 19 Jun 2023 23:57:03 +0800 Subject: [PATCH 09/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 6 ++---- src/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4530c487..e2d280134 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,14 +65,12 @@ add_custom_command(TARGET posixuefi USE_GCC=1 ARCH=${ARCH} make - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/3rd/posix-uefi/build/uefi/crt0.o ${CMAKE_BINARY_DIR}/3rd/posix-uefi - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/3rd/posix-uefi/build/uefi/libuefi.a ${CMAKE_BINARY_DIR}/3rd/posix-uefi - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/3rd/posix-uefi/build/uefi/uefi.h ${CMAKE_BINARY_DIR}/3rd/posix-uefi + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/3rd/posix-uefi/build/uefi/* ${CMAKE_BINARY_DIR}/3rd/posix-uefi COMMAND make clean COMMAND rm -rf ${CMAKE_SOURCE_DIR}/3rd/posix-uefi/build - COMMENT "build gnu-efi..." + COMMENT "Build posix-uefi done." ) add_custom_target(kernel_pre) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0932fe0bc..846a8707e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.13) project(kernel) # 暂时没有用到的变量,消除警告 -set(ignoreMe "${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}${MACHINE}") +set(ignoreMe "${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}${MACHINE}${USE_GNU_UEFI}") # 引入添加头文件函数 include(header_files) From aa3823211140b0021370676e58213780f5cefc01 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Tue, 20 Jun 2023 00:27:20 +0800 Subject: [PATCH 10/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 64 +++++++++++++++++++++++++-------------------- cmake/config.cmake | 7 +++-- image/kernel.efi | Bin 4626 -> 0 bytes src/CMakeLists.txt | 25 +++++++----------- 4 files changed, 49 insertions(+), 47 deletions(-) delete mode 100755 image/kernel.efi diff --git a/CMakeLists.txt b/CMakeLists.txt index e2d280134..a529066c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ add_custom_command(TARGET opensbi COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/3rd/opensbi/platform/generic/firmware/fw_jump.elf ${CMAKE_BINARY_DIR}/firmware/fw_jump.elf - COMMENT "build opensbi..." + COMMENT "Build 3rd/opensbi done." ) # gnu-efi @@ -52,7 +52,7 @@ add_custom_command(TARGET gnuefi make ARCH=${ARCH} OBJDIR=${CMAKE_BINARY_DIR}/3rd/gnu-efi - COMMENT "build gnu-efi..." + COMMENT "Build 3rd/gnu-efi done." ) # posix-uefi @@ -70,7 +70,7 @@ add_custom_command(TARGET posixuefi make clean COMMAND rm -rf ${CMAKE_SOURCE_DIR}/3rd/posix-uefi/build - COMMENT "Build posix-uefi done." + COMMENT "Build 3rd/posix-uefi done." ) add_custom_target(kernel_pre) @@ -81,23 +81,28 @@ if (ARCH STREQUAL "riscv64") ) elseif (ARCH STREQUAL "x86_64") - add_custom_command(TARGET kernel_pre - DEPENDS gnuefi posixuefi - # COMMAND make gnuefi - COMMAND make posixuefi - ) + if (USE_GNU_UEFI STREQUAL "1") + add_custom_command(TARGET kernel_pre + DEPENDS gnuefi + COMMAND make gnuefi + ) + else () + add_custom_command(TARGET kernel_pre + DEPENDS posixuefi + COMMAND make posixuefi + ) + endif () elseif (ARCH STREQUAL "aarch64") add_custom_command(TARGET kernel_pre DEPENDS gnuefi COMMAND make ARCH=${ARCH} gnuefi ) - endif () # 引导 ExternalProject_Add( - boot + boot_elf BUILD_ALWAYS 1 PREFIX ${CMAKE_BINARY_DIR} SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/boot @@ -124,7 +129,7 @@ ExternalProject_Add( -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DUSE_GNU_UEFI=${USE_GNU_UEFI} - -DOUTPUT_NAME=boot.elf + -DOUTPUT_NAME=${BOOT_ELF_OUTPUT_NAME} BUILD_COMMAND ${GENERATOR_COMMAND} INSTALL_COMMAND "" ) @@ -159,7 +164,7 @@ ExternalProject_Add( -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DUSE_GNU_UEFI=${USE_GNU_UEFI} - -DKernelName=${KernelName} + -DOUTPUT_NAME=${KERNEL_ELF_OUTPUT_NAME} BUILD_COMMAND ${GENERATOR_COMMAND} INSTALL_COMMAND "" ) @@ -169,7 +174,7 @@ add_custom_target(kernel_debug DEPENDS kernel) add_custom_command(TARGET kernel_debug POST_BUILD WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${KernelName} ${KernelName}.debug + COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${KERNEL_ELF_OUTPUT_NAME} ${KERNEL_ELF_OUTPUT_NAME}.debug COMMENT "Generating kernel debug...") # objcopy --strip-debug foo 创建一个去掉调试信息的( strip 的)可执行文件 @@ -178,8 +183,8 @@ add_custom_target(kernel_raw DEPENDS kernel) add_custom_command(TARGET kernel_raw POST_BUILD WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_OBJCOPY} --strip-debug ${KernelName} - COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${KernelName}.debug ${KernelName} + COMMAND ${CMAKE_OBJCOPY} --strip-debug ${KERNEL_ELF_OUTPUT_NAME} + COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${KERNEL_ELF_OUTPUT_NAME}.debug ${KERNEL_ELF_OUTPUT_NAME} COMMENT "Generating raw kernel...") # nm @@ -187,8 +192,8 @@ add_custom_target(nm DEPENDS kernel) add_custom_command(TARGET nm POST_BUILD WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_NM} -a -A -C -l -n -s --special-syms --synthetic ${KernelName} - > ${KernelName}.nm + COMMAND ${CMAKE_NM} -a -A -C -l -n -s --special-syms --synthetic ${KERNEL_ELF_OUTPUT_NAME} + > ${KERNEL_ELF_OUTPUT_NAME}.nm COMMENT "nm...") # readelf -a @@ -196,7 +201,7 @@ add_custom_target(readelf DEPENDS kernel) add_custom_command(TARGET readelf POST_BUILD WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_READELF} -a ${KernelName} > ${KernelName}.readelf || (exit 0) + COMMAND ${CMAKE_READELF} -a ${KERNEL_ELF_OUTPUT_NAME} > ${KERNEL_ELF_OUTPUT_NAME}.readelf || (exit 0) COMMENT "readelf...") # objdump -D @@ -204,19 +209,19 @@ add_custom_target(objdump DEPENDS kernel) add_custom_command(TARGET objdump POST_BUILD WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_OBJDUMP} -D ${KernelName} > ${KernelName}.disassembly - COMMENT "Disassembling...") + COMMAND ${CMAKE_OBJDUMP} -D ${KERNEL_ELF_OUTPUT_NAME} > ${KERNEL_ELF_OUTPUT_NAME}.disassembly + COMMENT "objdump done.") # 制作 boot.efi # 将引导调整为 efi -add_custom_target(boot_efi DEPENDS boot) +add_custom_target(boot_efi DEPENDS boot_elf) add_custom_command(TARGET boot_efi WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMENT "Gen boot.efi" - COMMAND ${CMAKE_OBJCOPY} boot.elf boot.efi + COMMAND ${CMAKE_OBJCOPY} ${BOOT_ELF_OUTPUT_NAME} ${BOOT_EFI_OUTPUT_NAME} -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc - --target=efi-app-x86-64 --subsystem=10 + --target=efi-app-${ARCH} --subsystem=10 + COMMENT "Build ${BOOT_EFI_OUTPUT_NAME} done." ) # 制作内核 @@ -224,19 +229,20 @@ add_custom_command(TARGET boot_efi add_custom_target(kernel_efi DEPENDS kernel) add_custom_command(TARGET kernel_efi WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMENT "Gen kernel.efi" - COMMAND ${CMAKE_OBJCOPY} --target=efi-app-x86-64 ${KernelName} kernel.efi + COMMAND ${CMAKE_OBJCOPY} --target=efi-app-x86-64 ${KERNEL_ELF_OUTPUT_NAME} kernel.efi -g -R .comment -R .gnu_debuglink -R .note.gnu.build-id -R .gnu.hash -R .plt -R .rela.plt -R .dynstr -R .dynsym -R .rela.dyn -S -R .eh_frame -R .gcc_except_table + COMMENT "Build kernel.efi done." ) add_custom_target(image_uefi DEPENDS boot_efi kernel_efi) add_custom_command(TARGET image_uefi COMMENT "Copying bootloader and kernel" COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/image/efi/boot - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/*.efi ${CMAKE_BINARY_DIR}/image/efi/boot/ - # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tools/startup.nsh ${CMAKE_BINARY_DIR}/image/startup.nsh + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${BOOT_EFI_OUTPUT_NAME} ${CMAKE_BINARY_DIR}/image/efi/boot/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${KERNEL_EFI_OUTPUT_NAME} ${CMAKE_BINARY_DIR}/image/efi/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tools/startup.nsh ${CMAKE_BINARY_DIR}/image/startup.nsh ) # 制作镜像 add_custom_target(image DEPENDS image_uefi) @@ -278,7 +284,7 @@ endif () if (ARCH STREQUAL "riscv64") set(QEMU_MACHINE -machine virt) set(QEMU_DEVICES) - set(QEMU_IMAGE -kernel ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KernelName}) + set(QEMU_IMAGE -kernel ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${KERNEL_ELF_OUTPUT_NAME}) add_custom_target(run DEPENDS kernel) add_custom_command( TARGET run diff --git a/cmake/config.cmake b/cmake/config.cmake index 4173b99e9..9ee4c5396 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -114,5 +114,8 @@ elseif (COMPILER STREQUAL "clang") endif () message("CMAKE_TOOLCHAIN_FILE is: ${CMAKE_TOOLCHAIN_FILE}") -# 设置内核名称 -set(KernelName kernel.elf) +# 设置二进制文件名称 +set(BOOT_ELF_OUTPUT_NAME boot.elf) +set(BOOT_EFI_OUTPUT_NAME boot.efi) +set(KERNEL_ELF_OUTPUT_NAME kernel.elf) +set(KERNEL_EFI_OUTPUT_NAME kernel.efi) diff --git a/image/kernel.efi b/image/kernel.efi deleted file mode 100755 index d0c6bb9c3595656db5cef62760e3d9c20dcefb5d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4626 zcmeHL-Afcv6hE_;&T8&1Q5F{N2!aMRwNw;Dxr8e>SV=93d`LHU{0QAyrdg;U6E>w~ z5bQtbvFGSPdRj9oAwhhQpqGM*fsHgOSd6@#J6|oEhJ+6$b9QHb_nh;)cg{I8%$%8) z&Iu?1fNi)@3NVStBy8;ez8gWeFZjdDCB9e5}mWcABsRK2L?mQx6{0cbK+UfdB}&Il_j_ zUnG1hIxv|>Zve`Rd~2x%tFA?H?A1cR4#}}?#6VP~8!9do=fKR9<;G4*fd~NIq9Vs* zY7DBG9b++SP+CC3VHp3SA`QwtX8Bmm29N)PclPix({>P{!R8ee&R8#gGZ7ma=n*i! zmuIZ?taD?pioC4YC#zy|P!-UqH(ETO%`h>{ct#dxihS7OAruPZ73%JI<16shU$acK zQZkxVhe`T5ADWMZvZ0w=wLdt*jz-e?GF2g3GmqW?qwPl%uU^8vH}x)xQ-AwX?@4AZ z>dmT0$>_Y=)Pn3rGCDI{*DLyica7lFw|G9~C7OqDdBUBH9+--9Pmy!yV<>>eLK=f`WZjX zlIkFt4>&;}ncF(aq}~#(1Gfl{7f9xX{%wU)RM8X;6Rq`#Gd8A7(Ro}5=SK35Lre0` zn32YJKfvpnWTxnX&DGg`%(#QjI5AA*ezNd4s}PW25PvcV&;b!>hI3H6?mOpZ&B~2y zy%qQzbRMzmo#OJgPzAVsC8yZ4pS2pV7b)#V%p(%S*(FNvA+~*?^dX`vTdx8|Ef;)W zp)$*|0Zb2jrZVZ~Oxgtax F@C$hE^9BF_ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 846a8707e..6b2a300db 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,40 +22,33 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/kernel) if (ARCH STREQUAL "riscv64") # 将各个子对象链接为内核文件 - add_executable(${KernelName} + add_executable(core $ $ ) elseif (ARCH STREQUAL "x86_64") # 将各个子对象链接为内核文件 - add_executable(${KernelName} + add_executable(core $ ) elseif (ARCH STREQUAL "aarch64") # 将各个子对象链接为内核文件 - add_executable(${KernelName} - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/reloc_${ARCH}.o - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/crt0-efi-${ARCH}.o - # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/crt0.o - $ + add_executable(core $ ) - target_link_libraries(${KernelName} PRIVATE - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/lib/libefi.a - ${CMAKE_BINARY_DIR}/../3rd/gnu-efi/gnuefi/libgnuefi.a - # ${CMAKE_SOURCE_DIR}/../3rd/posix-uefi/libuefi.a - ) endif () # 指定链接脚本 -target_link_options(${KernelName} PRIVATE -T ${CMAKE_SOURCE_DIR}/arch/${ARCH}/link.ld) +target_link_options(core PRIVATE -T ${CMAKE_SOURCE_DIR}/arch/${ARCH}/link.ld) # 其它链接选项 if (ARCH STREQUAL "riscv64") - target_link_options(${KernelName} PRIVATE -Wl,-melf64lriscv) + target_link_options(core PRIVATE -Wl,-melf64lriscv) elseif (ARCH STREQUAL "x86_64") - target_link_options(${KernelName} PRIVATE -Wl,-melf_x86_64) + target_link_options(core PRIVATE -Wl,-melf_x86_64) elseif (ARCH STREQUAL "aarch64") - target_link_options(${KernelName} PRIVATE -Wl,-maarch64elf) + target_link_options(core PRIVATE -Wl,-maarch64elf) endif () + +set_target_properties(core PROPERTIES OUTPUT_NAME ${OUTPUT_NAME}) From 1ddb767fbbbdad788171ffc4513c4fe5ac520c22 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Tue, 20 Jun 2023 00:36:31 +0800 Subject: [PATCH 11/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- src/boot/x86_64/boot.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/boot/x86_64/boot.cpp b/src/boot/x86_64/boot.cpp index e21b6aee5..0f9e0cdda 100644 --- a/src/boot/x86_64/boot.cpp +++ b/src/boot/x86_64/boot.cpp @@ -14,8 +14,6 @@ * */ -#include "cassert" - #if USE_GNU_UEFI == 1 # include "efi.h" # include "efilib.h" @@ -38,7 +36,6 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { status = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, systemTable->ConOut, L"Hello UEFI!\n"); - assert(status != EFI_SUCCESS); return EFI_SUCCESS; } From b7902f44b4a8c166bd5475e9744f5662b163ed6c Mon Sep 17 00:00:00 2001 From: KehRoche Date: Tue, 20 Jun 2023 00:50:41 +0800 Subject: [PATCH 12/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 1 + src/boot/x86_64/boot.cpp | 150 +++++++++++++++++++++++++++------------ 2 files changed, 104 insertions(+), 47 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a529066c7..f8a6221a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -242,6 +242,7 @@ add_custom_command(TARGET image_uefi COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/image/efi/boot COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${BOOT_EFI_OUTPUT_NAME} ${CMAKE_BINARY_DIR}/image/efi/boot/ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${KERNEL_EFI_OUTPUT_NAME} ${CMAKE_BINARY_DIR}/image/efi/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${KERNEL_ELF_OUTPUT_NAME} ${CMAKE_BINARY_DIR}/image/ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tools/startup.nsh ${CMAKE_BINARY_DIR}/image/startup.nsh ) # 制作镜像 diff --git a/src/boot/x86_64/boot.cpp b/src/boot/x86_64/boot.cpp index 0f9e0cdda..7b57e5eca 100644 --- a/src/boot/x86_64/boot.cpp +++ b/src/boot/x86_64/boot.cpp @@ -14,6 +14,8 @@ * */ +#include "cstdint" + #if USE_GNU_UEFI == 1 # include "efi.h" # include "efilib.h" @@ -42,66 +44,120 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { #else +/*** ELF64 defines and structs ***/ +# define ELFMAG "\177ELF" +# define SELFMAG 4 +# define EI_CLASS 4 /* File class byte index */ +# define ELFCLASS64 2 /* 64-bit objects */ +# define EI_DATA 5 /* Data encoding byte index */ +# define ELFDATA2LSB 1 /* 2's complement, little endian */ +# define ET_EXEC 2 /* Executable file */ +# define PT_LOAD 1 /* Loadable program segment */ +# ifdef __x86_64__ +# define EM_MACH 62 /* AMD x86-64 architecture */ +# endif +# ifdef __aarch64__ +# define EM_MACH 183 /* ARM aarch64 architecture */ +# endif + +typedef struct { + uint8_t e_ident[16]; /* Magic number and other info */ + uint16_t e_type; /* Object file type */ + uint16_t e_machine; /* Architecture */ + uint32_t e_version; /* Object file version */ + uint64_t e_entry; /* Entry point virtual address */ + uint64_t e_phoff; /* Program header table file offset */ + uint64_t e_shoff; /* Section header table file offset */ + uint32_t e_flags; /* Processor-specific flags */ + uint16_t e_ehsize; /* ELF header size in bytes */ + uint16_t e_phentsize; /* Program header table entry size */ + uint16_t e_phnum; /* Program header table entry count */ + uint16_t e_shentsize; /* Section header table entry size */ + uint16_t e_shnum; /* Section header table entry count */ + uint16_t e_shstrndx; /* Section header string table index */ +} Elf64_Ehdr; + +typedef struct { + uint32_t p_type; /* Segment type */ + uint32_t p_flags; /* Segment flags */ + uint64_t p_offset; /* Segment file offset */ + uint64_t p_vaddr; /* Segment virtual address */ + uint64_t p_paddr; /* Segment physical address */ + uint64_t p_filesz; /* Segment size in file */ + uint64_t p_memsz; /* Segment size in memory */ + uint64_t p_align; /* Segment alignment */ +} Elf64_Phdr; + /** * Dump memory at given address, should accept 0x prefixes from the command line */ extern "C" int main(int argc, char** argv) { (void)argc; (void)argv; - - printf("Hello World!\n"); - - efi_status_t status; - efi_memory_descriptor_t *memory_map = NULL, *mement; - uintn_t memory_map_size = 0, map_key = 0, desc_size = 0; - const char* types[] = { "EfiReservedMemoryType", - "EfiLoaderCode", - "EfiLoaderData", - "EfiBootServicesCode", - "EfiBootServicesData", - "EfiRuntimeServicesCode", - "EfiRuntimeServicesData", - "EfiConventionalMemory", - "EfiUnusableMemory", - "EfiACPIReclaimMemory", - "EfiACPIMemoryNVS", - "EfiMemoryMappedIO", - "EfiMemoryMappedIOPortSpace", - "EfiPalCode" }; - - /* get the memory map */ - status - = BS->GetMemoryMap(&memory_map_size, NULL, &map_key, &desc_size, NULL); - if (status != EFI_BUFFER_TOO_SMALL || !memory_map_size) { - goto err; - } - /* in worst case malloc allocates two blocks, and each block might split a - * record into three, that's 4 additional records */ - memory_map_size += 4 * desc_size; - memory_map = (efi_memory_descriptor_t*)malloc(memory_map_size); - if (!memory_map) { - fprintf(stderr, "unable to allocate memory\n"); - return 1; + FILE* f; + char* buff; + long int size; + Elf64_Ehdr* elf; + Elf64_Phdr* phdr; + uintptr_t entry; + int i; + + /* load the file */ + if ((f = fopen("kernel.elf", "r"))) { + fseek(f, 0, SEEK_END); + size = ftell(f); + fseek(f, 0, SEEK_SET); + buff = malloc(size + 1); + if (!buff) { + fprintf(stderr, "unable to allocate memory\n"); + return 1; + } + fread(buff, size, 1, f); + fclose(f); } - status = BS->GetMemoryMap(&memory_map_size, memory_map, &map_key, - &desc_size, NULL); - if (EFI_ERROR(status)) { -err: - fprintf(stderr, "Unable to get memory map\n"); + else { + fprintf(stderr, "Unable to open file\n"); return 0; } - printf("Address Size Type\n"); - for (mement = memory_map; - (uint8_t*)mement < (uint8_t*)memory_map + memory_map_size; - mement = NextMemoryDescriptor(mement, desc_size)) { - printf("%016x %8d %02x %s\n", mement->PhysicalStart, - mement->NumberOfPages, mement->Type, types[mement->Type]); + /* is it a valid ELF executable for this architecture? */ + elf = (Elf64_Ehdr*)buff; + if (!memcmp(elf->e_ident, ELFMAG, SELFMAG) && /* magic match? */ + elf->e_ident[EI_CLASS] == ELFCLASS64 && /* 64 bit? */ + elf->e_ident[EI_DATA] == ELFDATA2LSB && /* LSB? */ + elf->e_type == ET_EXEC && /* executable object? */ + elf->e_machine == EM_MACH && /* architecture match? */ + elf->e_phnum > 0) { /* has program headers? */ + /* load segments */ + for (phdr = (Elf64_Phdr*)(buff + elf->e_phoff), i = 0; i < elf->e_phnum; + i++, phdr = (Elf64_Phdr*)((uint8_t*)phdr + elf->e_phentsize)) { + if (phdr->p_type == PT_LOAD) { + printf("ELF segment %p %d bytes (bss %d bytes)\n", + phdr->p_vaddr, phdr->p_filesz, + phdr->p_memsz - phdr->p_filesz); + memcpy((void*)phdr->p_vaddr, buff + phdr->p_offset, + phdr->p_filesz); + memset((void*)(phdr->p_vaddr + phdr->p_filesz), 0, + phdr->p_memsz - phdr->p_filesz); + } + } + entry = elf->e_entry; } + else { + fprintf(stderr, "not a valid ELF executable for this architecture\n"); + return 0; + } + /* free resources */ + free(buff); + + /* execute the "kernel" */ + printf("ELF entry point %p\n", entry); + // i = (*((int (*__attribute__((sysv_abi)))(void))(entry)))(); - free(memory_map); + void (*fp)(void) = entry; + fp(); - printf("DONE\n"); + printf("ELF returned %d\n", i); return 0; } From a74d1d90dbdc53094ed24ccd6057e01d28f56f45 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Wed, 21 Jun 2023 10:35:30 +0800 Subject: [PATCH 13/37] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=20elf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 12 ++++++------ cmake/config.cmake | 32 +++++++++++++++++++------------- src/CMakeLists.txt | 4 ++++ src/boot/CMakeLists.txt | 4 ++++ 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8a6221a7..512e53a4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,9 +124,9 @@ ExternalProject_Add( -DARCH=${ARCH} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} - -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} - -DCMAKE_ASM_FLAGS=${CMAKE_ASM_FLAGS} - -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} + -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS_BOOT} + -DCMAKE_ASM_FLAGS=${CMAKE_ASM_FLAGS_BOOT} + -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS_BOOT} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DUSE_GNU_UEFI=${USE_GNU_UEFI} -DOUTPUT_NAME=${BOOT_ELF_OUTPUT_NAME} @@ -159,9 +159,9 @@ ExternalProject_Add( -DARCH=${ARCH} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} - -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} - -DCMAKE_ASM_FLAGS=${CMAKE_ASM_FLAGS} - -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} + -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS_KERNEL} + -DCMAKE_ASM_FLAGS=${CMAKE_ASM_FLAGS_KERNEL} + -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS_KERNEL} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DUSE_GNU_UEFI=${USE_GNU_UEFI} -DOUTPUT_NAME=${KERNEL_ELF_OUTPUT_NAME} diff --git a/cmake/config.cmake b/cmake/config.cmake index 9ee4c5396..cdda9d848 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -71,33 +71,39 @@ message("CMAKE_BUILD_TYPE is: ${CMAKE_BUILD_TYPE}") set(OPTIMIZE_FLAGS "-O0") # 通用编译选项 -set(COMMON_FLAGS "-Wall -Wextra \ --no-pie -nostdlib \ --fPIC -ffreestanding -fexceptions -fshort-wchar") +set(COMMON_FLAGS + "-Wall -Wextra -nostdlib -ffreestanding -fexceptions -fshort-wchar" + ) # 架构相关编译选项 # @todo clang 交叉编译参数 if (ARCH STREQUAL "riscv64") set(ARCH_FLAGS "-march=rv64imafdc") elseif (ARCH STREQUAL "x86_64") - set(ARCH_FLAGS "-march=corei7 -mtune=corei7 -m64 -mno-red-zone \ --z max-page-size=0x1000 \ --Wl,-shared -Wl,-Bsymbolic") + set(ARCH_FLAGS + "-march=corei7 -mtune=corei7 -m64 -mno-red-zone -z max-page-size=0x1000" + ) elseif (ARCH STREQUAL "aarch64") set(ARCH_FLAGS "-march=armv8-a -mtune=cortex-a72") endif () -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPTIMIZE_FLAGS} ${COMMON_FLAGS} ${ARCH_FLAGS} ${DEBUG_FLAGS} ${UEFI_FLAGS}") -message("CMAKE_C_FLAGS:${CMAKE_C_FLAGS}") +set(CMAKE_C_FLAGS_KERNEL + "${OPTIMIZE_FLAGS} ${COMMON_FLAGS} ${ARCH_FLAGS} ${DEBUG_FLAGS} ${UEFI_FLAGS}" + ) + +set(CMAKE_C_FLAGS_BOOT + "${CMAKE_C_FLAGS_KERNEL} -no-pie -fPIC -Wl,-shared -Wl,-Bsymbolic" + ) # 将编译选项同步到汇编 -set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}") -message("CMAKE_ASM_FLAGS: ${CMAKE_ASM_FLAGS}") +set(CMAKE_ASM_FLAGS_KERNEL "${CMAKE_C_FLAGS_KERNEL}") +set(CMAKE_ASM_FLAGS_BOOT "${CMAKE_C_FLAGS_BOOT}") # 将编译选项同步到 c++ -set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -fpermissive") -message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") +set(CMAKE_CXX_FLAGS_KERNEL + "${CMAKE_C_FLAGS_KERNEL} -fpermissive") +set(CMAKE_CXX_FLAGS_BOOT + "${CMAKE_C_FLAGS_BOOT} -fpermissive") # 设置构建使用的工具,默认为 make if (GENERATOR STREQUAL "ninja") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6b2a300db..8216a514f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,6 +16,10 @@ include(header_files) # 引入添加汇编文件函数 include(find_asm_files) +message("CMAKE_ASM_FLAGS: ${CMAKE_ASM_FLAGS}") +message("CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") +message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") + # 处理子目录下的 CMakeLists add_subdirectory(${CMAKE_SOURCE_DIR}/arch) add_subdirectory(${CMAKE_SOURCE_DIR}/kernel) diff --git a/src/boot/CMakeLists.txt b/src/boot/CMakeLists.txt index 073165dfe..435f9b9ea 100644 --- a/src/boot/CMakeLists.txt +++ b/src/boot/CMakeLists.txt @@ -16,6 +16,10 @@ enable_language(CXX) # 引入添加头文件函数 include(header_files) +message("CMAKE_ASM_FLAGS: ${CMAKE_ASM_FLAGS}") +message("CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") +message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") + add_executable(boot ${CMAKE_SOURCE_DIR}/${ARCH}/boot.cpp ) From eabd6de022ea2d6ad12f7184f16fdc79e0d4035b Mon Sep 17 00:00:00 2001 From: KehRoche Date: Wed, 21 Jun 2023 10:47:42 +0800 Subject: [PATCH 14/37] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=20elf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 2 ++ cmake/config.cmake | 9 ++++++--- tools/startup.nsh | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 512e53a4e..3661b0e7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,6 +122,7 @@ ExternalProject_Add( -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} -DMACHINE=${MACHINE} -DARCH=${ARCH} + -DCOMPILE_DEFINITIONS=${COMPILE_DEFINITIONS_BOOT} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS_BOOT} @@ -157,6 +158,7 @@ ExternalProject_Add( -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} -DMACHINE=${MACHINE} -DARCH=${ARCH} + -DCOMPILE_DEFINITIONS=${COMPILE_DEFINITIONS_KERNEL} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS_KERNEL} diff --git a/cmake/config.cmake b/cmake/config.cmake index cdda9d848..8fdf19ccf 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -50,10 +50,13 @@ endif () # 指定要使用的 efi if (USE_GNU_UEFI STREQUAL "1") - set(UEFI_FLAGS "-DUSE_GNU_UEFI=${USE_GNU_UEFI} -DHAVE_USE_MS_ABI") + set(UEFI_DEFINITIONS "USE_GNU_UEFI=${USE_GNU_UEFI} HAVE_USE_MS_ABI") else () - set(UEFI_FLAGS "-DUSE_GNU_UEFI=${USE_GNU_UEFI} -DHAVE_USE_MS_ABI") + set(UEFI_DEFINITIONS "USE_GNU_UEFI=${USE_GNU_UEFI} HAVE_USE_MS_ABI") endif () +# 设置预处理器定义 +set(COMPILE_DEFINITIONS_BOOT "${UEFI_DEFINITIONS}") +set(COMPILE_DEFINITIONS_KERNEL "${UEFI_DEFINITIONS}") message("USE_GNU_UEFI is: ${USE_GNU_UEFI}") # 是否 debug,默认为 Debug @@ -88,7 +91,7 @@ elseif (ARCH STREQUAL "aarch64") endif () set(CMAKE_C_FLAGS_KERNEL - "${OPTIMIZE_FLAGS} ${COMMON_FLAGS} ${ARCH_FLAGS} ${DEBUG_FLAGS} ${UEFI_FLAGS}" + "${DEBUG_FLAGS} ${OPTIMIZE_FLAGS} ${COMMON_FLAGS} ${ARCH_FLAGS} " ) set(CMAKE_C_FLAGS_BOOT diff --git a/tools/startup.nsh b/tools/startup.nsh index dbed0a12d..082ce3b23 100644 --- a/tools/startup.nsh +++ b/tools/startup.nsh @@ -1,4 +1,4 @@ fs0: cd efi cd boot -kernel.efi +boot.efi From 4ca3ad2280eaad14e32c69b1b0b62288b7f7d00b Mon Sep 17 00:00:00 2001 From: KehRoche Date: Wed, 21 Jun 2023 10:58:16 +0800 Subject: [PATCH 15/37] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=20elf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- cmake/config.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/config.cmake b/cmake/config.cmake index 8fdf19ccf..a9198a6af 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -54,10 +54,13 @@ if (USE_GNU_UEFI STREQUAL "1") else () set(UEFI_DEFINITIONS "USE_GNU_UEFI=${USE_GNU_UEFI} HAVE_USE_MS_ABI") endif () -# 设置预处理器定义 +message("USE_GNU_UEFI is: ${USE_GNU_UEFI}") + +# 添加预处理器定义 set(COMPILE_DEFINITIONS_BOOT "${UEFI_DEFINITIONS}") set(COMPILE_DEFINITIONS_KERNEL "${UEFI_DEFINITIONS}") -message("USE_GNU_UEFI is: ${USE_GNU_UEFI}") +message("COMPILE_DEFINITIONS_BOOT is: ${COMPILE_DEFINITIONS_BOOT}") +message("COMPILE_DEFINITIONS_KERNEL is: ${COMPILE_DEFINITIONS_KERNEL}") # 是否 debug,默认为 Debug if (CMAKE_BUILD_TYPE STREQUAL "Release") From dea9d51dec9d157760143a524d5382f3a26cdbf6 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 26 Jun 2023 20:48:02 +0800 Subject: [PATCH 16/37] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- src/boot/CMakeLists.txt | 2 +- src/boot/x86_64/boot.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/boot/CMakeLists.txt b/src/boot/CMakeLists.txt index 435f9b9ea..aa9af1378 100644 --- a/src/boot/CMakeLists.txt +++ b/src/boot/CMakeLists.txt @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.13) project(boot) # 暂时没有用到的变量,消除警告 -set(ignoreMe "${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}${MACHINE}${CMAKE_ASM_FLAGS}${USE_GNU_UEFI}") +set(ignoreMe "${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}${MACHINE}${CMAKE_ASM_FLAGS}${USE_GNU_UEFI}{COMPILE_DEFINITIONS}") enable_language(CXX) diff --git a/src/boot/x86_64/boot.cpp b/src/boot/x86_64/boot.cpp index 7b57e5eca..5f6a60ab3 100644 --- a/src/boot/x86_64/boot.cpp +++ b/src/boot/x86_64/boot.cpp @@ -107,7 +107,7 @@ extern "C" int main(int argc, char** argv) { fseek(f, 0, SEEK_END); size = ftell(f); fseek(f, 0, SEEK_SET); - buff = malloc(size + 1); + buff = (char*)malloc(size + 1); if (!buff) { fprintf(stderr, "unable to allocate memory\n"); return 1; @@ -154,8 +154,8 @@ extern "C" int main(int argc, char** argv) { printf("ELF entry point %p\n", entry); // i = (*((int (*__attribute__((sysv_abi)))(void))(entry)))(); - void (*fp)(void) = entry; - fp(); + int (*entry_fp)(void) = (int(*)())entry; + i = entry_fp(); printf("ELF returned %d\n", i); From cc6c1f4dbc0b1961692da03b763d467dec6686a4 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 26 Jun 2023 20:49:10 +0800 Subject: [PATCH 17/37] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- src/boot/x86_64/boot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/boot/x86_64/boot.cpp b/src/boot/x86_64/boot.cpp index 5f6a60ab3..fa6802015 100644 --- a/src/boot/x86_64/boot.cpp +++ b/src/boot/x86_64/boot.cpp @@ -89,7 +89,7 @@ typedef struct { } Elf64_Phdr; /** - * Dump memory at given address, should accept 0x prefixes from the command line + * Load an ELF executable */ extern "C" int main(int argc, char** argv) { (void)argc; From 73529b372dfcdaca5c57e59af833074cdc4c24dd Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 26 Jun 2023 20:50:30 +0800 Subject: [PATCH 18/37] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- src/boot/x86_64/boot.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/boot/x86_64/boot.cpp b/src/boot/x86_64/boot.cpp index fa6802015..a76b2c403 100644 --- a/src/boot/x86_64/boot.cpp +++ b/src/boot/x86_64/boot.cpp @@ -152,7 +152,6 @@ extern "C" int main(int argc, char** argv) { /* execute the "kernel" */ printf("ELF entry point %p\n", entry); - // i = (*((int (*__attribute__((sysv_abi)))(void))(entry)))(); int (*entry_fp)(void) = (int(*)())entry; i = entry_fp(); From d81194554af6a9a561796aeb5ad582ae3493cec5 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 26 Jun 2023 21:09:39 +0800 Subject: [PATCH 19/37] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20gnuefi=20=E5=88=B0?= =?UTF-8?q?=203.0.17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- 3rd/gnu-efi/Make.defaults | 45 ++- 3rd/gnu-efi/Makefile | 12 +- 3rd/gnu-efi/apps/Makefile | 10 +- 3rd/gnu-efi/apps/bltgrid.c | 3 +- 3rd/gnu-efi/apps/ctors_fns.c | 26 ++ 3rd/gnu-efi/apps/ctors_test.c | 20 ++ 3rd/gnu-efi/apps/lfbgrid.c | 13 +- 3rd/gnu-efi/gnuefi/Makefile | 14 +- 3rd/gnu-efi/gnuefi/crt0-efi-aarch64.S | 111 +----- 3rd/gnu-efi/gnuefi/crt0-efi-arm.S | 2 +- 3rd/gnu-efi/gnuefi/crt0-efi-ia32.S | 8 +- 3rd/gnu-efi/gnuefi/crt0-efi-ia64.S | 2 +- 3rd/gnu-efi/gnuefi/crt0-efi-loongarch64.S | 151 +++++++++ 3rd/gnu-efi/gnuefi/crt0-efi-mips64el.S | 4 +- 3rd/gnu-efi/gnuefi/crt0-efi-riscv64.S | 2 +- 3rd/gnu-efi/gnuefi/crt0-efi-x86_64.S | 2 +- 3rd/gnu-efi/gnuefi/crt0-efi-x86_64.d | 1 - 3rd/gnu-efi/gnuefi/elf_aarch64_efi.lds | 63 +++- 3rd/gnu-efi/gnuefi/elf_arm_efi.lds | 35 +- 3rd/gnu-efi/gnuefi/elf_ia32_efi.lds | 53 +-- 3rd/gnu-efi/gnuefi/elf_ia32_fbsd_efi.lds | 21 ++ 3rd/gnu-efi/gnuefi/elf_ia64_efi.lds | 37 +- 3rd/gnu-efi/gnuefi/elf_loongarch64_efi.lds | 63 ++++ 3rd/gnu-efi/gnuefi/elf_mips64el_efi.lds | 38 ++- 3rd/gnu-efi/gnuefi/elf_riscv64_efi.lds | 27 +- 3rd/gnu-efi/gnuefi/elf_x86_64_efi.lds | 338 ++++++------------- 3rd/gnu-efi/gnuefi/elf_x86_64_fbsd_efi.lds | 21 ++ 3rd/gnu-efi/gnuefi/gnu-efi.pc.in | 10 + 3rd/gnu-efi/gnuefi/reloc_loongarch64.c | 104 ++++++ 3rd/gnu-efi/gnuefi/reloc_riscv64.c | 2 +- 3rd/gnu-efi/gnuefi/reloc_x86_64.d | 12 - 3rd/gnu-efi/inc/Makefile | 16 +- 3rd/gnu-efi/inc/aarch64/efibind.h | 12 +- 3rd/gnu-efi/inc/aarch64/efisetjmp_arch.h | 1 + 3rd/gnu-efi/inc/arm/efibind.h | 12 +- 3rd/gnu-efi/inc/efi.h | 2 + 3rd/gnu-efi/inc/efiapi.h | 8 + 3rd/gnu-efi/inc/efidef.h | 28 +- 3rd/gnu-efi/inc/efilib.h | 2 + 3rd/gnu-efi/inc/ia32/efibind.h | 13 +- 3rd/gnu-efi/inc/ia64/efibind.h | 15 +- 3rd/gnu-efi/inc/loongarch64/efibind.h | 157 +++++++++ 3rd/gnu-efi/inc/loongarch64/efilibplat.h | 24 ++ 3rd/gnu-efi/inc/loongarch64/efisetjmp_arch.h | 23 ++ 3rd/gnu-efi/inc/mips64el/efibind.h | 12 +- 3rd/gnu-efi/inc/riscv64/efibind.h | 11 +- 3rd/gnu-efi/inc/riscv64/efilibplat.h | 2 +- 3rd/gnu-efi/inc/riscv64/efisetjmp_arch.h | 2 + 3rd/gnu-efi/inc/x86_64/efibind.h | 12 +- 3rd/gnu-efi/lib/Makefile | 10 +- 3rd/gnu-efi/lib/Makefile.orig | 91 ----- 3rd/gnu-efi/lib/ctors.S | 47 +++ 3rd/gnu-efi/lib/entry.c | 67 ++++ 3rd/gnu-efi/lib/ia32/math.c | 2 +- 3rd/gnu-efi/lib/init.c | 77 ++--- 3rd/gnu-efi/lib/loongarch64/efi_stub.S | 1 + 3rd/gnu-efi/lib/loongarch64/initplat.c | 26 ++ 3rd/gnu-efi/lib/loongarch64/math.c | 63 ++++ 3rd/gnu-efi/lib/loongarch64/setjmp.S | 68 ++++ 3rd/gnu-efi/lib/print.c | 146 ++++---- 3rd/gnu-efi/lib/riscv64/initplat.c | 2 +- 3rd/gnu-efi/lib/riscv64/setjmp.S | 2 +- 62 files changed, 1504 insertions(+), 700 deletions(-) mode change 100644 => 100755 3rd/gnu-efi/Make.defaults create mode 100644 3rd/gnu-efi/apps/ctors_fns.c create mode 100644 3rd/gnu-efi/apps/ctors_test.c create mode 100644 3rd/gnu-efi/gnuefi/crt0-efi-loongarch64.S delete mode 100644 3rd/gnu-efi/gnuefi/crt0-efi-x86_64.d create mode 100644 3rd/gnu-efi/gnuefi/elf_loongarch64_efi.lds create mode 100644 3rd/gnu-efi/gnuefi/gnu-efi.pc.in create mode 100644 3rd/gnu-efi/gnuefi/reloc_loongarch64.c delete mode 100644 3rd/gnu-efi/gnuefi/reloc_x86_64.d create mode 100644 3rd/gnu-efi/inc/loongarch64/efibind.h create mode 100644 3rd/gnu-efi/inc/loongarch64/efilibplat.h create mode 100644 3rd/gnu-efi/inc/loongarch64/efisetjmp_arch.h delete mode 100644 3rd/gnu-efi/lib/Makefile.orig create mode 100644 3rd/gnu-efi/lib/ctors.S create mode 100644 3rd/gnu-efi/lib/entry.c create mode 100644 3rd/gnu-efi/lib/loongarch64/efi_stub.S create mode 100644 3rd/gnu-efi/lib/loongarch64/initplat.c create mode 100644 3rd/gnu-efi/lib/loongarch64/math.c create mode 100644 3rd/gnu-efi/lib/loongarch64/setjmp.S diff --git a/3rd/gnu-efi/Make.defaults b/3rd/gnu-efi/Make.defaults old mode 100644 new mode 100755 index 47ed36105..1277d14e8 --- a/3rd/gnu-efi/Make.defaults +++ b/3rd/gnu-efi/Make.defaults @@ -45,10 +45,24 @@ TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi) # Where to install the package. GNU-EFI will create and access # lib and include under the root # -INSTALLROOT := / +DESTDIR ?= / +ifeq ($(origin INSTALLROOT),undefined) +INSTALLROOT = $(DESTDIR) +endif + +empty := +space := $(empty) $(empty) +stripped = $(subst $(space),/,$(strip $(subst /,$(space),$(1)))) +unstripped = $(subst $(space),/,$(subst /,$(space),$(1))) +is_absolute = $(subst $(call stripped,$(1)),$(empty),$(call unstripped,$(1))) + +override INSTALLROOT:=$(if $(call is_absolute,$(INSTALLROOT)),,$(TOPDIR)/)$(INSTALLROOT) + PREFIX := /usr/local -LIBDIR := $(PREFIX)/lib -INSTALL := install +EXEC_PREFIX := $(PREFIX) +LIBDIR := $(EXEC_PREFIX)/lib +INCLUDEDIR := $(PREFIX)/include +INSTALL := install # Compilation tools HOSTCC := $(prefix)gcc @@ -139,41 +153,42 @@ 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) ifneq ($(ARCH),riscv64) +ifneq ($(ARCH),loongarch64) export HAVE_EFI_OBJCOPY=y endif endif endif endif -ifneq ($(ARCH),arm) -export LIBGCC=$(shell $(CC) $(ARCH3264) -print-libgcc-file-name) -endif - ifeq ($(ARCH),arm) CFLAGS += -marm endif +ifeq ($(ARCH),aarch64) +LDFLAGS += -z common-page-size=4096 +LDFLAGS += -z max-page-size=4096 +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) +# Only enable -fPIE for non MinGW compilers (unneeded on MinGW) GCCMACHINE := $(shell $(CC) -dumpmachine) ifneq (mingw32,$(findstring mingw32, $(GCCMACHINE))) - CFLAGS += -fpic + CFLAGS += -fPIE endif ifeq (FreeBSD, $(findstring FreeBSD, $(OS))) CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \ - -fshort-wchar -fno-strict-aliasing \ + -funsigned-char -fshort-wchar -fno-strict-aliasing \ -ffreestanding -fno-stack-protector else -CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \ - -fshort-wchar -fno-strict-aliasing \ +CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Wno-pointer-sign -Werror \ + -funsigned-char -fshort-wchar -fno-strict-aliasing \ -ffreestanding -fno-stack-protector -fno-stack-check \ -fno-stack-check \ $(if $(findstring gcc,$(CC)),-fno-merge-all-constants,) @@ -183,3 +198,7 @@ ARFLAGS := rDv ASFLAGS += $(ARCH3264) LDFLAGS += -nostdlib --warn-common --no-undefined --fatal-warnings \ --build-id=sha1 + +ifneq ($(ARCH),arm) +export LIBGCC=$(shell $(CC) $(CFLAGS) $(ARCH3264) -print-libgcc-file-name) +endif diff --git a/3rd/gnu-efi/Makefile b/3rd/gnu-efi/Makefile index 42eed7fea..e58d02ac2 100644 --- a/3rd/gnu-efi/Makefile +++ b/3rd/gnu-efi/Makefile @@ -34,7 +34,7 @@ # SUCH DAMAGE. # -VERSION = 3.0.15 +export VERSION = 3.0.17 MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) SRCDIR = $(dir $(MKFILE_PATH)) @@ -44,9 +44,11 @@ VPATH = $(SRCDIR) include $(SRCDIR)/Make.defaults SUBDIRS = lib gnuefi inc apps -gnuefi: lib -all: $(SUBDIRS) +all: check_gcc $(SUBDIRS) + +gnuefi: lib +apps: gnuefi mkvars: @echo AR=$(AR) @@ -81,14 +83,14 @@ $(SUBDIRS): clean: rm -f *~ - @for d in $(SUBDIRS); do \ + @set -e ; 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 \ + @set -e ; for d in $(SUBDIRS); do \ mkdir -p $(OBJDIR)/$$d; \ $(MAKE) -C $(OBJDIR)/$$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d install; done diff --git a/3rd/gnu-efi/apps/Makefile b/3rd/gnu-efi/apps/Makefile index 4e1b69a38..6ebd438b5 100644 --- a/3rd/gnu-efi/apps/Makefile +++ b/3rd/gnu-efi/apps/Makefile @@ -44,6 +44,7 @@ TOPDIR = $(SRCDIR)/.. CDIR=$(TOPDIR)/.. LINUX_HEADERS = /usr/src/sys/build +APPSDIR = $(LIBDIR)/gnuefi/apps CPPFLAGS += -D__KERNEL__ -I$(LINUX_HEADERS)/include CRTOBJS = ../gnuefi/crt0-efi-$(ARCH).o @@ -62,7 +63,8 @@ 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 + bltgrid.efi lfbgrid.efi setdbg.efi unsetdbg.efi \ + ctors_test.efi TARGET_BSDRIVERS = drv0.efi TARGET_RTDRIVERS = @@ -87,9 +89,15 @@ TARGETS = $(TARGET_APPS) $(TARGET_BSDRIVERS) $(TARGET_RTDRIVERS) all: $(TARGETS) +ctors_test.so : ctors_fns.o ctors_test.o + clean: rm -f $(TARGETS) *~ *.o *.so +install: + mkdir -p $(INSTALLROOT)$(APPSDIR) + $(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)$(APPSDIR) + .PHONY: install include $(SRCDIR)/../Make.rules diff --git a/3rd/gnu-efi/apps/bltgrid.c b/3rd/gnu-efi/apps/bltgrid.c index 4500fbb19..ff6975351 100644 --- a/3rd/gnu-efi/apps/bltgrid.c +++ b/3rd/gnu-efi/apps/bltgrid.c @@ -64,7 +64,8 @@ draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) if (CompareMem(info, gop->Mode->Info, sizeof (*info))) continue; - NumPixels = info->VerticalResolution * info->HorizontalResolution; + NumPixels = (UINTN)info->VerticalResolution + * (UINTN)info->HorizontalResolution; BufferSize = NumPixels * sizeof(UINT32); PixelBuffer = AllocatePool(BufferSize); diff --git a/3rd/gnu-efi/apps/ctors_fns.c b/3rd/gnu-efi/apps/ctors_fns.c new file mode 100644 index 000000000..624190462 --- /dev/null +++ b/3rd/gnu-efi/apps/ctors_fns.c @@ -0,0 +1,26 @@ +/* + * ctors.c + * Copyright 2019 Peter Jones + * + */ + +#include +#include + +int constructed_value = 0; + +static void __attribute__((__constructor__)) ctor(void) +{ + Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value); + constructed_value = 1; + Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value); +} + +static void __attribute__((__destructor__)) dtor(void) +{ + Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value); + constructed_value = 0; + Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value); +} + +// vim:fenc=utf-8:tw=75:noet diff --git a/3rd/gnu-efi/apps/ctors_test.c b/3rd/gnu-efi/apps/ctors_test.c new file mode 100644 index 000000000..7e48da8ef --- /dev/null +++ b/3rd/gnu-efi/apps/ctors_test.c @@ -0,0 +1,20 @@ +/* + * ctors_test.c + * Copyright 2019 Peter Jones + * + */ + +#include +#include + +extern int constructed_value; + +EFI_STATUS +efi_main (EFI_HANDLE image EFI_UNUSED, EFI_SYSTEM_TABLE *systab EFI_UNUSED) +{ + Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value); + + return EFI_SUCCESS; +} + +// vim:fenc=utf-8:tw=75:noet diff --git a/3rd/gnu-efi/apps/lfbgrid.c b/3rd/gnu-efi/apps/lfbgrid.c index 05977d216..3914313a7 100644 --- a/3rd/gnu-efi/apps/lfbgrid.c +++ b/3rd/gnu-efi/apps/lfbgrid.c @@ -51,10 +51,9 @@ draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) UINTN NumPixels; UINT32 *PixelBuffer; UINT32 CopySize, BufferSize; -#if defined(__x86_64__) || defined(__aarch64__) || \ - (defined (__riscv) && __riscv_xlen == 64) +#if __SIZEOF_POINTER__ == 8 UINT64 FrameBufferAddr; -#elif defined(__i386__) || defined(__arm__) +#elif __SIZEOF_POINTER__ == 4 UINT32 FrameBufferAddr; #else #error YOUR ARCH HERE @@ -89,7 +88,8 @@ draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) if (CompareMem(info, gop->Mode->Info, sizeof (*info))) continue; - NumPixels = info->VerticalResolution * info->PixelsPerScanLine; + NumPixels = (UINTN)info->VerticalResolution + * (UINTN)info->PixelsPerScanLine; BufferSize = NumPixels * sizeof(UINT32); if (BufferSize == gop->Mode->FrameBufferSize) { CopySize = BufferSize; @@ -115,10 +115,9 @@ draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) Print(L"No linear framebuffer on this device.\n"); return; } -#if defined(__x86_64__) || defined(__aarch64__) || \ - (defined (__riscv) && __riscv_xlen == 64) +#if __SIZEOF_POINTER__ == 8 FrameBufferAddr = (UINT64)gop->Mode->FrameBufferBase; -#elif defined(__i386__) || defined(__arm__) +#elif __SIZEOF_POINTER__ == 4 FrameBufferAddr = (UINT32)(UINT64)gop->Mode->FrameBufferBase; #else #error YOUR ARCH HERE diff --git a/3rd/gnu-efi/gnuefi/Makefile b/3rd/gnu-efi/gnuefi/Makefile index 10d4e7add..e0c9da84c 100644 --- a/3rd/gnu-efi/gnuefi/Makefile +++ b/3rd/gnu-efi/gnuefi/Makefile @@ -43,6 +43,7 @@ include $(SRCDIR)/../Make.defaults TOPDIR = $(SRCDIR)/.. CDIR=$(TOPDIR)/.. +PKGCONFIGDIR ?= $(LIBDIR)/pkgconfig FILES = reloc_$(ARCH) OBJS = $(FILES:%=%.o) @@ -52,11 +53,20 @@ reloc_aarch64.o: CFLAGS += -fno-jump-tables TARGETS = crt0-efi-$(ARCH).o libgnuefi.a -all: $(TARGETS) +all: $(TARGETS) gnu-efi.pc libgnuefi.a: $(OBJS) $(AR) $(ARFLAGS) $@ $^ +gnu-efi.pc: + sed \ + -e 's:@PREFIX@:$(PREFIX):g' \ + -e 's:@EXEC_PREFIX@:$(EXEC_PREFIX):g' \ + -e 's:@INCLUDEDIR@:$(INCLUDEDIR):g' \ + -e 's:@LIBDIR@:$(LIBDIR):g' \ + -e 's:@VERSION@:$(VERSION):g' \ + $(SRCDIR)/gnu-efi.pc.in > gnu-efi.pc + clean: rm -f $(TARGETS) *~ *.o $(OBJS) @@ -73,5 +83,7 @@ ifneq (,$(findstring FreeBSD,$(OS))) else $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR) endif + $(INSTALL) -d $(INSTALLROOT)$(PKGCONFIGDIR) + $(INSTALL) -m 644 gnu-efi.pc $(INSTALLROOT)$(PKGCONFIGDIR) include $(SRCDIR)/../Make.rules diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-aarch64.S b/3rd/gnu-efi/gnuefi/crt0-efi-aarch64.S index a0687b175..601669801 100644 --- a/3rd/gnu-efi/gnuefi/crt0-efi-aarch64.S +++ b/3rd/gnu-efi/gnuefi/crt0-efi-aarch64.S @@ -16,100 +16,10 @@ * 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 0 // 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) - + .text .align 12 + + .globl _start _start: stp x29, x30, [sp, #-32]! mov x29, sp @@ -124,11 +34,24 @@ _start: cbnz x0, 0f ldp x0, x1, [sp, #16] - bl efi_main + bl _entry 0: ldp x29, x30, [sp], #32 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 12 // Block Size (2*4+2*2), must be aligned by 32 Bits + .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy + .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy + #if defined(__ELF__) && defined(__linux__) .section .note.GNU-stack,"",%progbits #endif diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-arm.S b/3rd/gnu-efi/gnuefi/crt0-efi-arm.S index ea3bbc4ec..716699b61 100644 --- a/3rd/gnu-efi/gnuefi/crt0-efi-arm.S +++ b/3rd/gnu-efi/gnuefi/crt0-efi-arm.S @@ -136,7 +136,7 @@ _start: bne 0f ldmfd sp, {r0-r1} - bl efi_main + bl _entry 0: add sp, sp, #12 ldr pc, [sp], #4 diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-ia32.S b/3rd/gnu-efi/gnuefi/crt0-efi-ia32.S index 9e9c86579..df3340ac1 100644 --- a/3rd/gnu-efi/gnuefi/crt0-efi-ia32.S +++ b/3rd/gnu-efi/gnuefi/crt0-efi-ia32.S @@ -56,13 +56,13 @@ _start: call _relocate popl %ebx popl %ebx - testl %eax,%eax - jne .exit + testl %eax,%eax + jne .exit - call efi_main # call app with "image" and "systab" argument + call _entry # call app with "image" and "systab" argument .exit: leave - ret + ret // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-ia64.S b/3rd/gnu-efi/gnuefi/crt0-efi-ia64.S index 38af6150a..30714d34d 100644 --- a/3rd/gnu-efi/gnuefi/crt0-efi-ia64.S +++ b/3rd/gnu-efi/gnuefi/crt0-efi-ia64.S @@ -56,7 +56,7 @@ _start: mov out0=in0 // image handle mov out1=in1 // systab - br.call.sptk.few rp=efi_main + br.call.sptk.few rp=_entry .Lret2: .exit: mov ar.pfs=loc0 diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-loongarch64.S b/3rd/gnu-efi/gnuefi/crt0-efi-loongarch64.S new file mode 100644 index 000000000..af45d46cd --- /dev/null +++ b/3rd/gnu-efi/gnuefi/crt0-efi-loongarch64.S @@ -0,0 +1,151 @@ +/* + * crt0-efi-loongarch64.S - PE/COFF header for LoongArch64 EFI applications + * + * Copyright (C) 2021 Loongson Technology Corporation Limited. + * Copyright (C) 2014 Linaro Ltd. + * + * 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. + */ + +#ifndef EFI_SUBSYSTEM +#define EFI_SUBSYSTEM 0xa +#endif + .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 0x6264 // loongarch64 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) + + .align 4 + + .globl _start + .type _start, @function +_start: + addi.d $sp, $sp, -24 + st.d $ra, $sp, 0 + st.d $a0, $sp, 8 + st.d $a1, $sp, 16 + + move $a2, $a0 // a2: ImageHandle + move $a3, $a1 // a3: SystemTable + la.local $a0, ImageBase // a0: ImageBase + la.local $a1, _DYNAMIC // a1: DynamicSection + bl _relocate + bnez $a0, 0f + + ld.d $a0, $sp, 8 + ld.d $a1, $sp, 16 + bl efi_main + +0: ld.d $ra, $sp, 0 + addi.d $sp, $sp, 24 + jr $ra + .end _start diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-mips64el.S b/3rd/gnu-efi/gnuefi/crt0-efi-mips64el.S index 4b2c1b217..cecabfbd4 100644 --- a/3rd/gnu-efi/gnuefi/crt0-efi-mips64el.S +++ b/3rd/gnu-efi/gnuefi/crt0-efi-mips64el.S @@ -172,8 +172,8 @@ _pc: // a0: ImageHandle ld $a0, 16($sp) - // call efi_main - dla $t9, efi_main + // call _start + dla $t9, _entry jalr $t9 // a1: SystemTable ld $a1, 24($sp) diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-riscv64.S b/3rd/gnu-efi/gnuefi/crt0-efi-riscv64.S index 0a5b7fc6f..2322b5678 100644 --- a/3rd/gnu-efi/gnuefi/crt0-efi-riscv64.S +++ b/3rd/gnu-efi/gnuefi/crt0-efi-riscv64.S @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ /* * Copright (C) 2014 Linaro Ltd. * Copright (C) 2018 Alexander Graf diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-x86_64.S b/3rd/gnu-efi/gnuefi/crt0-efi-x86_64.S index 49f0a0d42..5179439fc 100644 --- a/3rd/gnu-efi/gnuefi/crt0-efi-x86_64.S +++ b/3rd/gnu-efi/gnuefi/crt0-efi-x86_64.S @@ -56,7 +56,7 @@ _start: popq %rdi popq %rsi - call efi_main + call _entry addq $8, %rsp .exit: diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-x86_64.d b/3rd/gnu-efi/gnuefi/crt0-efi-x86_64.d deleted file mode 100644 index 018a29f25..000000000 --- a/3rd/gnu-efi/gnuefi/crt0-efi-x86_64.d +++ /dev/null @@ -1 +0,0 @@ -gnu-efi/gnuefi/crt0-efi-x86_64.o: gnu-efi/gnuefi/crt0-efi-x86_64.S diff --git a/3rd/gnu-efi/gnuefi/elf_aarch64_efi.lds b/3rd/gnu-efi/gnuefi/elf_aarch64_efi.lds index 836d98255..563e22df1 100644 --- a/3rd/gnu-efi/gnuefi/elf_aarch64_efi.lds +++ b/3rd/gnu-efi/gnuefi/elf_aarch64_efi.lds @@ -3,9 +3,17 @@ OUTPUT_ARCH(aarch64) ENTRY(_start) SECTIONS { - .text 0x0 : { + . = 0; + ImageBase = .; + /* .hash and/or .gnu.hash MUST come first! */ + .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } + . = ALIGN(4096); + .eh_frame : { *(.eh_frame) } + .gcc_except_table : { *(.gcc_except_table*) } + . = ALIGN(4096); + .text : { _text = .; - *(.text.head) *(.text) *(.text.*) *(.gnu.linkonce.t.*) @@ -15,8 +23,15 @@ SECTIONS } _etext = .; _text_size = . - _text; + . = ALIGN(4096); + .reloc : + { + KEEP (*(.reloc)) + } + . = ALIGN(65536); .dynamic : { *(.dynamic) } - .data : ALIGN(4096) + . = ALIGN(4096); + .data : { _data = .; *(.sdata) @@ -26,6 +41,26 @@ SECTIONS *(.got.plt) *(.got) + /* + * Note that these aren't the using the GNU "CONSTRUCTOR" output section + * command, so they don't start with a size. Because of p2align and the + * end/END definitions, and the fact that they're mergeable, they can also + * have NULLs which aren't guaranteed to be at the end. + */ + . = ALIGN(16); + _init_array = .; + *(SORT_BY_NAME(.init_array)) + _init_array_end = .; + __CTOR_LIST__ = .; + *(SORT_BY_NAME(.ctors)) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + *(SORT_BY_NAME(.dtors)) + __DTOR_END__ = .; + _fini_array = .; + *(SORT_BY_NAME(.fini_array)) + _fini_array_end = .; + /* the EFI loader doesn't seem to like a .bss section, so we stick it all into .data: */ . = ALIGN(16); @@ -33,16 +68,25 @@ SECTIONS *(.sbss) *(.scommon) *(.dynbss) - *(.bss) + *(.bss*) *(COMMON) + *(.rel.local) . = ALIGN(16); + _bss_end = .; } - .rela.dyn : { *(.rela.dyn) } + . = ALIGN(4096); + .rela : + { + *(.rela.text*) + *(.rela.data*) + *(.rela.got) + *(.rela.dyn) + *(.rela.stab) + } + . = ALIGN(4096); .rela.plt : { *(.rela.plt) } - .rela.got : { *(.rela.got) } - .rela.data : { *(.rela.data) *(.rela.data*) } . = ALIGN(512); _edata = .; _data_size = . - _data; @@ -53,10 +97,9 @@ SECTIONS .dynstr : { *(.dynstr) } . = ALIGN(4096); .note.gnu.build-id : { *(.note.gnu.build-id) } - /DISCARD/ : + .ignored.reloc : { - *(.rel.reloc) - *(.eh_frame) + *(.rela.reloc) *(.note.GNU-stack) } .comment 0 : { *(.comment) } diff --git a/3rd/gnu-efi/gnuefi/elf_arm_efi.lds b/3rd/gnu-efi/gnuefi/elf_arm_efi.lds index 665bbdbf0..3023ebcdb 100644 --- a/3rd/gnu-efi/gnuefi/elf_arm_efi.lds +++ b/3rd/gnu-efi/gnuefi/elf_arm_efi.lds @@ -15,7 +15,9 @@ SECTIONS } _etext = .; _text_size = . - _text; + . = ALIGN(4096); .dynamic : { *(.dynamic) } + . = ALIGN(4096); .data : { _data = .; @@ -26,6 +28,26 @@ SECTIONS *(.got.plt) *(.got) + /* + * Note that these aren't the using the GNU "CONSTRUCTOR" output section + * command, so they don't start with a size. Because of p2align and the + * end/END definitions, and the fact that they're mergeable, they can also + * have NULLs which aren't guaranteed to be at the end. + */ + . = ALIGN(16); + _init_array = .; + *(SORT_BY_NAME(.init_array)) + _init_array_end = .; + __CTOR_LIST__ = .; + *(SORT_BY_NAME(.ctors)) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + *(SORT_BY_NAME(.dtors)) + __DTOR_END__ = .; + _fini_array = .; + *(SORT_BY_NAME(.fini_array)) + _fini_array_end = .; + /* the EFI loader doesn't seem to like a .bss section, so we stick it all into .data: */ . = ALIGN(16); @@ -40,10 +62,17 @@ SECTIONS _bss_end = .; } - .rel.dyn : { *(.rel.dyn) } + . = ALIGN(4096); + .rel : + { + *(.rel.text*) + *(.rel.data*) + *(.rel.got) + *(.rel.dyn) + *(.rel.stab) + } + . = ALIGN(4096); .rel.plt : { *(.rel.plt) } - .rel.got : { *(.rel.got) } - .rel.data : { *(.rel.data) *(.rel.data*) } _edata = .; _data_size = . - _etext; diff --git a/3rd/gnu-efi/gnuefi/elf_ia32_efi.lds b/3rd/gnu-efi/gnuefi/elf_ia32_efi.lds index f27fe5fc6..5eec52964 100644 --- a/3rd/gnu-efi/gnuefi/elf_ia32_efi.lds +++ b/3rd/gnu-efi/gnuefi/elf_ia32_efi.lds @@ -8,6 +8,8 @@ SECTIONS /* .hash and/or .gnu.hash MUST come first! */ .hash : { *(.hash) } .gnu.hash : { *(.gnu.hash) } + .eh_frame : { *(.eh_frame) } + .gcc_except_table : { *(.gcc_except_table*) } . = ALIGN(4096); .text : { @@ -19,33 +21,41 @@ SECTIONS } _etext = .; _text_size = . - _text; - . = ALIGN(4096); - .sdata : + . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); + .data : { _data = .; *(.got.plt) *(.got) - *(.srodata) - *(.sdata) - *(.sbss) - *(.scommon) - } - . = ALIGN(4096); - .data : - { *(.rodata*) *(.data) *(.data1) *(.data.*) - *(.sdata) - *(.got.plt) - *(.got) + + /* + * Note that these aren't the using the GNU "CONSTRUCTOR" output section + * command, so they don't start with a size. Because of p2align and the + * end/END definitions, and the fact that they're mergeable, they can also + * have NULLs which aren't guaranteed to be at the end. + */ + . = ALIGN(16); + _init_array = .; + *(SORT_BY_NAME(.init_array)) + _init_array_end = .; + __CTOR_LIST__ = .; + *(SORT_BY_NAME(.ctors)) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + *(SORT_BY_NAME(.dtors)) + __DTOR_END__ = .; + _fini_array = .; + *(SORT_BY_NAME(.fini_array)) + _fini_array_end = .; + /* the EFI loader doesn't seem to like a .bss section, so we stick it all into .data: */ - *(.sbss) - *(.scommon) *(.dynbss) - *(.bss) + *(.bss*) *(COMMON) } .note.gnu.build-id : { *(.note.gnu.build-id) } @@ -55,31 +65,34 @@ SECTIONS . = ALIGN(4096); .rel : { - *(.rel.data) - *(.rel.data.*) + *(.rel.text*) + *(.rel.data*) *(.rel.got) + *(.rel.dyn) *(.rel.stab) *(.data.rel.ro.local) *(.data.rel.local) *(.data.rel.ro) *(.data.rel*) } + . = ALIGN(4096); + .rel.plt : { *(.rel.plt) } _edata = .; _data_size = . - _etext; . = ALIGN(4096); .reloc : /* This is the PECOFF .reloc section! */ { - *(.reloc) + KEEP (*(.reloc)) } . = ALIGN(4096); .dynsym : { *(.dynsym) } . = ALIGN(4096); .dynstr : { *(.dynstr) } . = ALIGN(4096); + . = DATA_SEGMENT_END (.); /DISCARD/ : { *(.rel.reloc) - *(.eh_frame) *(.note.GNU-stack) } .comment 0 : { *(.comment) } diff --git a/3rd/gnu-efi/gnuefi/elf_ia32_fbsd_efi.lds b/3rd/gnu-efi/gnuefi/elf_ia32_fbsd_efi.lds index cd309e24f..9e9baec2a 100644 --- a/3rd/gnu-efi/gnuefi/elf_ia32_fbsd_efi.lds +++ b/3rd/gnu-efi/gnuefi/elf_ia32_fbsd_efi.lds @@ -40,6 +40,27 @@ SECTIONS *(.sdata) *(.got.plt) *(.got) + + /* + * Note that these aren't the using the GNU "CONSTRUCTOR" output section + * command, so they don't start with a size. Because of p2align and the + * end/END definitions, and the fact that they're mergeable, they can also + * have NULLs which aren't guaranteed to be at the end. + */ + . = ALIGN(16); + _init_array = .; + *(SORT_BY_NAME(.init_array)) + _init_array_end = .; + __CTOR_LIST__ = .; + *(SORT_BY_NAME(.ctors)) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + *(SORT_BY_NAME(.dtors)) + __DTOR_END__ = .; + _fini_array = .; + *(SORT_BY_NAME(.fini_array)) + _fini_array_end = .; + /* the EFI loader doesn't seem to like a .bss section, so we stick it all into .data: */ *(.sbss) diff --git a/3rd/gnu-efi/gnuefi/elf_ia64_efi.lds b/3rd/gnu-efi/gnuefi/elf_ia64_efi.lds index 190792a0c..e45799c1d 100644 --- a/3rd/gnu-efi/gnuefi/elf_ia64_efi.lds +++ b/3rd/gnu-efi/gnuefi/elf_ia64_efi.lds @@ -8,6 +8,8 @@ SECTIONS /* .hash and/or .gnu.hash MUST come first! */ .hash : { *(.hash) } .gnu.hash : { *(.gnu.hash) } + .eh_frame : { *(.eh_frame) } + .gcc_except_table : { *(.gcc_except_table*) } . = ALIGN(4096); .text : { @@ -19,7 +21,7 @@ SECTIONS } _etext = .; _text_size = . - _text; - . = ALIGN(4096); + . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); __gp = ALIGN (8) + 0x200000; .sdata : { @@ -39,10 +41,31 @@ SECTIONS *(.data*) *(.gnu.linkonce.d*) *(.plabel) /* data whose relocs we want to ignore */ + + /* + * Note that these aren't the using the GNU "CONSTRUCTOR" output section + * command, so they don't start with a size. Because of p2align and the + * end/END definitions, and the fact that they're mergeable, they can also + * have NULLs which aren't guaranteed to be at the end. + */ + . = ALIGN(16); + _init_array = .; + *(SORT_BY_NAME(.init_array)) + _init_array_end = .; + __CTOR_LIST__ = .; + *(SORT_BY_NAME(.ctors)) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + *(SORT_BY_NAME(.dtors)) + __DTOR_END__ = .; + _fini_array = .; + *(SORT_BY_NAME(.fini_array)) + _fini_array_end = .; + /* the EFI loader doesn't seem to like a .bss section, so we stick it all into .data: */ *(.dynbss) - *(.bss) + *(.bss*) *(COMMON) } .note.gnu.build-id : { *(.note.gnu.build-id) } @@ -52,25 +75,29 @@ SECTIONS . = ALIGN(4096); .rela : { - *(.rela.text) + *(.rela.text*) + *(.rela.sdata*) *(.rela.data*) - *(.rela.sdata) *(.rela.got) + *(.rela.dyn) *(.rela.gnu.linkonce.d*) *(.rela.stab) *(.rela.ctors) } + . = ALIGN(4096); + .rela.plt : { *(.rela.plt) } _edata = .; _data_size = . - _etext; . = ALIGN(4096); .reloc : /* This is the PECOFF .reloc section! */ { - *(.reloc) + KEEP (*(.reloc)) } . = ALIGN(4096); .dynsym : { *(.dynsym) } . = ALIGN(4096); .dynstr : { *(.dynstr) } + . = DATA_SEGMENT_END (.); /DISCARD/ : { *(.rela.plabel) diff --git a/3rd/gnu-efi/gnuefi/elf_loongarch64_efi.lds b/3rd/gnu-efi/gnuefi/elf_loongarch64_efi.lds new file mode 100644 index 000000000..e7b4d6bcc --- /dev/null +++ b/3rd/gnu-efi/gnuefi/elf_loongarch64_efi.lds @@ -0,0 +1,63 @@ +OUTPUT_FORMAT("elf64-loongarch", "elf64-loongarch", "elf64-loongarch") +OUTPUT_ARCH(loongarch) +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) } +} diff --git a/3rd/gnu-efi/gnuefi/elf_mips64el_efi.lds b/3rd/gnu-efi/gnuefi/elf_mips64el_efi.lds index 4d1a077d8..bf968416a 100644 --- a/3rd/gnu-efi/gnuefi/elf_mips64el_efi.lds +++ b/3rd/gnu-efi/gnuefi/elf_mips64el_efi.lds @@ -15,7 +15,9 @@ SECTIONS } _etext = .; _text_size = . - _text; + . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); .dynamic : { *(.dynamic) } + . = ALIGN(4096); .data : { _data = .; @@ -27,6 +29,26 @@ SECTIONS HIDDEN (_gp = ALIGN (16) + 0x7ff0); *(.got) + /* + * Note that these aren't the using the GNU "CONSTRUCTOR" output section + * command, so they don't start with a size. Because of p2align and the + * end/END definitions, and the fact that they're mergeable, they can also + * have NULLs which aren't guaranteed to be at the end. + */ + . = ALIGN(16); + _init_array = .; + *(SORT_BY_NAME(.init_array)) + _init_array_end = .; + __CTOR_LIST__ = .; + *(SORT_BY_NAME(.ctors)) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + *(SORT_BY_NAME(.dtors)) + __DTOR_END__ = .; + _fini_array = .; + *(SORT_BY_NAME(.fini_array)) + _fini_array_end = .; + /* the EFI loader doesn't seem to like a .bss section, so we stick it all into .data: */ . = ALIGN(16); @@ -34,16 +56,23 @@ SECTIONS *(.sbss) *(.scommon) *(.dynbss) - *(.bss) + *(.bss*) *(COMMON) . = ALIGN(16); _bss_end = .; } - .rel.dyn : { *(.rel.dyn) } + . = ALIGN(4096); + .rel : + { + *(.rel.text*) + *(.rel.data*) + *(.rel.got) + *(.rel.dyn) + *(.rel.stab) + } + . = ALIGN(4096); .rel.plt : { *(.rel.plt) } - .rel.got : { *(.rel.got) } - .rel.data : { *(.rel.data) *(.rel.data*) } _edata = .; _data_size = . - _etext; @@ -53,6 +82,7 @@ SECTIONS .dynstr : { *(.dynstr) } . = ALIGN(4096); .note.gnu.build-id : { *(.note.gnu.build-id) } + . = DATA_SEGMENT_END (.); /DISCARD/ : { *(.rel.reloc) diff --git a/3rd/gnu-efi/gnuefi/elf_riscv64_efi.lds b/3rd/gnu-efi/gnuefi/elf_riscv64_efi.lds index bb64d8150..3b4724706 100644 --- a/3rd/gnu-efi/gnuefi/elf_riscv64_efi.lds +++ b/3rd/gnu-efi/gnuefi/elf_riscv64_efi.lds @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv") OUTPUT_ARCH(riscv) @@ -17,6 +17,7 @@ SECTIONS { } _etext = .; _text_size = . - _text; +. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); .dynamic : { *(.dynamic) } .data : @@ -37,22 +38,23 @@ SECTIONS { *(.sbss) *(.scommon) *(.dynbss) - *(.bss) + *(.bss*) *(COMMON) . = ALIGN(16); _bss_end = .; } -.rela.text : - { *(.rela.text) *(.rela.text*) } -.rela.dyn : - { *(.rela.dyn) } -.rela.plt : - { *(.rela.plt) } -.rela.got : - { *(.rela.got) } -.rela.data : - { *(.rela.data) *(.rela.data*) } +. = ALIGN(4096); +.rela : + { + *(.rela.text*) + *(.rela.data*) + *(.rela.got) + *(.rela.dyn) + *(.rela.stab) + } +. = ALIGN(4096); +.rela.plt : { *(.rela.plt) } . = ALIGN(512); _edata = .; _data_size = . - _data; @@ -66,6 +68,7 @@ SECTIONS { . = ALIGN(4096); .note.gnu.build-id : { *(.note.gnu.build-id) } +. = DATA_SEGMENT_END (.); /DISCARD/ : { *(.rel.reloc) diff --git a/3rd/gnu-efi/gnuefi/elf_x86_64_efi.lds b/3rd/gnu-efi/gnuefi/elf_x86_64_efi.lds index c265c55a1..2e0e0cb1f 100644 --- a/3rd/gnu-efi/gnuefi/elf_x86_64_efi.lds +++ b/3rd/gnu-efi/gnuefi/elf_x86_64_efi.lds @@ -1,247 +1,99 @@ - -/* This file is a part of Simple-XX/SimpleKernel - * (https://github.com/Simple-XX/SimpleKernel). - * - * link.ld for Simple-XX/SimpleKernel. - * 链接脚本,指定生成的二进制文件的布局 - */ - -/* Script for -z combreloc -z separate-code */ -/* Copyright (C) 2014-2022 Free Software Foundation, Inc. - Copying and distribution of this script, with or without modification, - are permitted in any medium without royalty provided the copyright - notice and this notice are preserved. */ -/* 指定输出格式 */ -OUTPUT_FORMAT( - "elf64-x86-64", - "elf64-x86-64", - "elf64-x86-64" -) -/* 指定输出架构 */ +/* 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) -/* 设置各个 section */ -SECTIONS { - ImageBase = 0; - PROVIDE (__executable_start = SEGMENT_START("text-segment", 1M)); - . = SEGMENT_START("text-segment", 1M); +SECTIONS +{ + . = 0; + ImageBase = .; + /* .hash and/or .gnu.hash MUST come first! */ + .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } + . = ALIGN(4096); + .eh_frame : { *(.eh_frame) } + .gcc_except_table : { *(.gcc_except_table*) } + . = ALIGN(4096); + .text : + { + _text = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + . = ALIGN(16); + } + _etext = .; + _text_size = . - _text; + . = ALIGN(4096); + .reloc : + { + KEEP (*(.reloc)) + } + + . = ALIGN(4096); + .data : + { + _data = .; + *(.rodata*) + *(.got.plt) + *(.got) + *(.data*) + *(.sdata) + + /* + * Note that these aren't the using the GNU "CONSTRUCTOR" output section + * command, so they don't start with a size. Because of p2align and the + * end/END definitions, and the fact that they're mergeable, they can also + * have NULLs which aren't guaranteed to be at the end. + */ + . = ALIGN(16); + _init_array = .; + *(SORT_BY_NAME(.init_array)) + _init_array_end = .; + __CTOR_LIST__ = .; + *(SORT_BY_NAME(.ctors)) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + *(SORT_BY_NAME(.dtors)) + __DTOR_END__ = .; + _fini_array = .; + *(SORT_BY_NAME(.fini_array)) + _fini_array_end = .; + + /* 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) } - .boot : { *(.text.boot) *(.data.boot) *(.bss.boot) } - .interp : { *(.interp) } - .note.gnu.build-id : { *(.note.gnu.build-id) } - .hash : { *(.hash) } - .gnu.hash : { *(.gnu.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rela.dyn : { - *(.rela.init) - *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) - *(.rela.fini) - *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) - *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) - *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) - *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) - *(.rela.ctors) - *(.rela.dtors) - *(.rela.got) - *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) - *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*) - *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*) - *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*) - *(.rela.ifunc) - } - .rela.plt : { - *(.rela.plt) - PROVIDE_HIDDEN (__rela_iplt_start = .); - *(.rela.iplt) - PROVIDE_HIDDEN (__rela_iplt_end = .); - } - .relr.dyn : { *(.relr.dyn) } - . = ALIGN(CONSTANT (MAXPAGESIZE)); - .init : { - KEEP (*(SORT_NONE(.init))) - } - .plt : { *(.plt) *(.iplt) } - .plt.got : { *(.plt.got) } - .plt.sec : { *(.plt.sec) } - .text : { - *(.text.unlikely .text.*_unlikely .text.unlikely.*) - *(.text.exit .text.exit.*) - *(.text.startup .text.startup.*) - *(.text.hot .text.hot.*) - *(SORT(.text.sorted.*)) - *(.text .stub .text.* .gnu.linkonce.t.*) - /* .gnu.warning sections are handled specially by elf.em. */ - *(.gnu.warning) - } - .fini : { - KEEP (*(SORT_NONE(.fini))) - } - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - . = ALIGN(CONSTANT (MAXPAGESIZE)); - /* Adjust the address for the rodata segment. We want to adjust up to - the same address within the page on the next page up. */ - . = SEGMENT_START("rodata-segment", ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1))); - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .rodata1 : { *(.rodata1) } - .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } - .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) } - .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } - .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) } - /* These sections are generated by the Sun/Oracle C++ compiler. */ - .exception_ranges : ONLY_IF_RO { *(.exception_ranges*) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); - /* Exception handling */ - .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) } - .gnu_extab : ONLY_IF_RW { *(.gnu_extab) } - .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } - .exception_ranges : ONLY_IF_RW { *(.exception_ranges*) } - /* Thread Local Storage sections */ - .tdata : { - PROVIDE_HIDDEN (__tdata_start = .); - *(.tdata .tdata.* .gnu.linkonce.td.*) - } - .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } - .preinit_array : { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } - .init_array : { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) - KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)) - PROVIDE_HIDDEN (__init_array_end = .); - } - .fini_array : { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) - KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)) - PROVIDE_HIDDEN (__fini_array_end = .); - } - .ctors : { - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin.o(.ctors)) - KEEP (*crtbegin?.o(.ctors)) - /* We don't want to include the .ctor section from - the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - } - .dtors : { - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - } - .jcr : { KEEP (*(.jcr)) } - .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } - .dynamic : { *(.dynamic) } - .got : { *(.got) *(.igot) } - . = DATA_SEGMENT_RELRO_END (SIZEOF (.got.plt) >= 24 ? 24 : 0, .); - .got.plt : { *(.got.plt) *(.igot.plt) } - .data : { - *(.data .data.* .gnu.linkonce.d.*) - SORT(CONSTRUCTORS) - } - .data1 : { *(.data1) } - _edata = .; PROVIDE (edata = .); - . = .; - __bss_start = .; - .bss : { - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. - FIXME: Why do we need it? When there is no .bss section, we do not - pad the .data section. */ - . = ALIGN(. != 0 ? 64 / 8 : 1); - } - .lbss : { - *(.dynlbss) - *(.lbss .lbss.* .gnu.linkonce.lb.*) - *(LARGE_COMMON) - } - . = ALIGN(64 / 8); - . = SEGMENT_START("ldata-segment", .); - .lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : { - *(.lrodata .lrodata.* .gnu.linkonce.lr.*) - } - .ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : { - *(.ldata .ldata.* .gnu.linkonce.l.*) - . = ALIGN(. != 0 ? 64 / 8 : 1); - } - . = ALIGN(64 / 8); - _end = .; PROVIDE (end = .); - . = DATA_SEGMENT_END (.); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1. */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions. */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2. */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2. */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions. */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* DWARF 3. */ - .debug_pubtypes 0 : { *(.debug_pubtypes) } - .debug_ranges 0 : { *(.debug_ranges) } - /* DWARF 5. */ - .debug_addr 0 : { *(.debug_addr) } - .debug_line_str 0 : { *(.debug_line_str) } - .debug_loclists 0 : { *(.debug_loclists) } - .debug_macro 0 : { *(.debug_macro) } - .debug_names 0 : { *(.debug_names) } - .debug_rnglists 0 : { *(.debug_rnglists) } - .debug_str_offsets 0 : { *(.debug_str_offsets) } - .debug_sup 0 : { *(.debug_sup) } - .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } - /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } + _edata = .; + _data_size = . - _etext; + . = ALIGN(4096); + .dynamic : { *(.dynamic) } + . = ALIGN(4096); + .rela : + { + *(.rela.text*) + *(.rela.data*) + *(.rela.got) + *(.rela.dyn) + *(.rela.stab) + } + . = ALIGN(4096); + .rela.plt : { *(.rela.plt) } + . = ALIGN(4096); + .dynsym : { *(.dynsym) } + . = ALIGN(4096); + .dynstr : { *(.dynstr) } + . = ALIGN(4096); + .ignored.reloc : + { + *(.rela.reloc) + *(.note.GNU-stack) + } + .comment 0 : { *(.comment) } } diff --git a/3rd/gnu-efi/gnuefi/elf_x86_64_fbsd_efi.lds b/3rd/gnu-efi/gnuefi/elf_x86_64_fbsd_efi.lds index fe1f3342c..721ce9a1a 100644 --- a/3rd/gnu-efi/gnuefi/elf_x86_64_fbsd_efi.lds +++ b/3rd/gnu-efi/gnuefi/elf_x86_64_fbsd_efi.lds @@ -36,6 +36,27 @@ SECTIONS *(.got) *(.data*) *(.sdata) + + /* + * Note that these aren't the using the GNU "CONSTRUCTOR" output section + * command, so they don't start with a size. Because of p2align and the + * end/END definitions, and the fact that they're mergeable, they can also + * have NULLs which aren't guaranteed to be at the end. + */ + . = ALIGN(16); + _init_array = .; + *(SORT_BY_NAME(.init_array)) + _init_array_end = .; + __CTOR_LIST__ = .; + *(SORT_BY_NAME(.ctors)) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + *(SORT_BY_NAME(.dtors)) + __DTOR_END__ = .; + _fini_array = .; + *(SORT_BY_NAME(.fini_array)) + _fini_array_end = .; + /* the EFI loader doesn't seem to like a .bss section, so we stick it all into .data: */ *(.sbss) diff --git a/3rd/gnu-efi/gnuefi/gnu-efi.pc.in b/3rd/gnu-efi/gnuefi/gnu-efi.pc.in new file mode 100644 index 000000000..9280bc04a --- /dev/null +++ b/3rd/gnu-efi/gnuefi/gnu-efi.pc.in @@ -0,0 +1,10 @@ +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +includedir=@INCLUDEDIR@ +libdir=@LIBDIR@ + +Name: gnu-efi +Description: EFI development toolkit +Version: @VERSION@ +Cflags: -I${includedir}/efi +Libs: -lefi diff --git a/3rd/gnu-efi/gnuefi/reloc_loongarch64.c b/3rd/gnu-efi/gnuefi/reloc_loongarch64.c new file mode 100644 index 000000000..7860f9d24 --- /dev/null +++ b/3rd/gnu-efi/gnuefi/reloc_loongarch64.c @@ -0,0 +1,104 @@ +/* reloc_loongarch64.c - position independent loongarch64 ELF shared object relocator + Copyright (C) 2021 Loongson Technology Corporation Limited. + Copyright (C) 2014 Linaro Ltd. + Copyright (C) 1999 Hewlett-Packard Co. + Contributed by David Mosberger . + + 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 +#include + +#include + +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; + + case DT_PLTGOT: + addr = (unsigned long *) + ((unsigned long)dyn[i].d_un.d_ptr + + ldbase); + 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_LARCH_NONE: + break; + + case R_LARCH_RELATIVE: + addr = (unsigned long *) + (ldbase + rel->r_offset); + *addr += ldbase; + break; + + default: + break; + } + rel = (Elf64_Rela*) ((char *) rel + relent); + relsz -= relent; + } + return EFI_SUCCESS; +} diff --git a/3rd/gnu-efi/gnuefi/reloc_riscv64.c b/3rd/gnu-efi/gnuefi/reloc_riscv64.c index 73e8d13a9..0b02d83fa 100644 --- a/3rd/gnu-efi/gnuefi/reloc_riscv64.c +++ b/3rd/gnu-efi/gnuefi/reloc_riscv64.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause /* reloc_riscv.c - position independent ELF shared object relocator Copyright (C) 2018 Alexander Graf Copyright (C) 2014 Linaro Ltd. diff --git a/3rd/gnu-efi/gnuefi/reloc_x86_64.d b/3rd/gnu-efi/gnuefi/reloc_x86_64.d deleted file mode 100644 index a361bcbd1..000000000 --- a/3rd/gnu-efi/gnuefi/reloc_x86_64.d +++ /dev/null @@ -1,12 +0,0 @@ -gnu-efi/gnuefi/reloc_x86_64.o: gnu-efi/gnuefi/reloc_x86_64.c \ - gnu-efi/inc/efi.h gnu-efi/inc/x86_64/efibind.h gnu-efi/inc/eficompiler.h \ - gnu-efi/inc/efidef.h gnu-efi/inc/efidevp.h gnu-efi/inc/efipciio.h \ - gnu-efi/inc/efiprot.h gnu-efi/inc/eficon.h gnu-efi/inc/eficonex.h \ - gnu-efi/inc/efiser.h gnu-efi/inc/efi_nii.h gnu-efi/inc/efipxebc.h \ - gnu-efi/inc/efinet.h gnu-efi/inc/efiapi.h gnu-efi/inc/efifs.h \ - gnu-efi/inc/efierr.h gnu-efi/inc/efiui.h gnu-efi/inc/efiip.h \ - gnu-efi/inc/efiudp.h gnu-efi/inc/efitcp.h gnu-efi/inc/efipoint.h \ - gnu-efi/inc/efishell.h gnu-efi/inc/efilink.h gnu-efi/inc/efilib.h \ - gnu-efi/inc/efidebug.h gnu-efi/inc/efipart.h \ - gnu-efi/inc/x86_64/efilibplat.h gnu-efi/inc/efirtlib.h \ - gnu-efi/inc/efistdarg.h gnu-efi/inc/pci22.h gnu-efi/inc/libsmbios.h diff --git a/3rd/gnu-efi/inc/Makefile b/3rd/gnu-efi/inc/Makefile index 273d30307..db3929f62 100644 --- a/3rd/gnu-efi/inc/Makefile +++ b/3rd/gnu-efi/inc/Makefile @@ -13,15 +13,15 @@ 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) + mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi + mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol + mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi/$(ARCH) + $(INSTALL) -m 644 $(SRCDIR)/*.h $(INSTALLROOT)$(INCLUDEDIR)/efi + $(INSTALL) -m 644 $(SRCDIR)/protocol/*.h $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol + $(INSTALL) -m 644 $(SRCDIR)/$(ARCH)/*.h $(INSTALLROOT)$(INCLUDEDIR)/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 + mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol/ia64 + $(INSTALL) -m 644 $(SRCDIR)/protocol/ia64/*.h $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol/ia64 endif include $(SRCDIR)/../Make.rules diff --git a/3rd/gnu-efi/inc/aarch64/efibind.h b/3rd/gnu-efi/inc/aarch64/efibind.h index c2c546b89..d6b5d0fdd 100644 --- a/3rd/gnu-efi/inc/aarch64/efibind.h +++ b/3rd/gnu-efi/inc/aarch64/efibind.h @@ -38,9 +38,10 @@ typedef int64_t intptr_t; // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 typedef uint64_t UINT64; typedef int64_t INT64; @@ -50,12 +51,13 @@ typedef int32_t INT32; typedef uint16_t UINT16; typedef int16_t INT16; + typedef uint8_t UINT8; +typedef char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; #undef VOID -#define VOID void +typedef void VOID; typedef int64_t INTN; typedef uint64_t UINTN; diff --git a/3rd/gnu-efi/inc/aarch64/efisetjmp_arch.h b/3rd/gnu-efi/inc/aarch64/efisetjmp_arch.h index 8dbce0782..d960706d8 100644 --- a/3rd/gnu-efi/inc/aarch64/efisetjmp_arch.h +++ b/3rd/gnu-efi/inc/aarch64/efisetjmp_arch.h @@ -18,6 +18,7 @@ typedef struct { UINT64 FP; UINT64 LR; UINT64 IP0; + UINT64 _pad1; /* FP regs */ UINT64 D8; diff --git a/3rd/gnu-efi/inc/arm/efibind.h b/3rd/gnu-efi/inc/arm/efibind.h index 9e2cb10ee..8c578df66 100644 --- a/3rd/gnu-efi/inc/arm/efibind.h +++ b/3rd/gnu-efi/inc/arm/efibind.h @@ -46,9 +46,10 @@ typedef int32_t intptr_t; // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 typedef uint64_t UINT64; typedef int64_t INT64; @@ -58,12 +59,13 @@ typedef int32_t INT32; typedef uint16_t UINT16; typedef int16_t INT16; + typedef uint8_t UINT8; +typedef char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; #undef VOID -#define VOID void +typedef void VOID; typedef int32_t INTN; typedef uint32_t UINTN; diff --git a/3rd/gnu-efi/inc/efi.h b/3rd/gnu-efi/inc/efi.h index b193932b9..b251a3447 100644 --- a/3rd/gnu-efi/inc/efi.h +++ b/3rd/gnu-efi/inc/efi.h @@ -52,6 +52,8 @@ Revision History #include "mips64el/efibind.h" #elif defined (__riscv) && __riscv_xlen == 64 #include "riscv64/efibind.h" +#elif defined (__loongarch64) +#include "loongarch64/efibind.h" #else #error Usupported architecture #endif diff --git a/3rd/gnu-efi/inc/efiapi.h b/3rd/gnu-efi/inc/efiapi.h index 7dbedc4da..01a09388d 100644 --- a/3rd/gnu-efi/inc/efiapi.h +++ b/3rd/gnu-efi/inc/efiapi.h @@ -354,6 +354,14 @@ EFI_STATUS #define EFI_IMAGE_MACHINE_RISCV128 0x5128 #endif +#if !defined(EFI_IMAGE_MACHINE_LOONGARCH32) +#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232 +#endif + +#if !defined(EFI_IMAGE_MACHINE_LOONGARCH64) +#define EFI_IMAGE_MACHINE_LOONGARCH64 0x6264 +#endif + // Image Entry prototype typedef diff --git a/3rd/gnu-efi/inc/efidef.h b/3rd/gnu-efi/inc/efidef.h index 8b70051f4..5953b6937 100644 --- a/3rd/gnu-efi/inc/efidef.h +++ b/3rd/gnu-efi/inc/efidef.h @@ -20,19 +20,39 @@ Revision History --*/ -typedef UINT16 CHAR16; -typedef UINT8 CHAR8; -typedef UINT8 BOOLEAN; +#if !defined(__cplusplus) +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +typedef _Bool BOOLEAN; +#else +typedef unsigned char BOOLEAN; +#endif +#else +typedef bool BOOLEAN; +#endif + #ifndef CONST #define CONST const #endif #ifndef TRUE +#if defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) + #define TRUE true + #define FALSE false +#else #define TRUE ((BOOLEAN) 1) #define FALSE ((BOOLEAN) 0) #endif +#endif #ifndef NULL +#if (defined(__cplusplus) && __cplusplus >= 201103L) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) + #define NULL nullptr +#else +#if !defined(__cplusplus) #define NULL ((VOID *) 0) +#else + #define NULL 0 +#endif +#endif #endif typedef UINTN EFI_STATUS; @@ -194,7 +214,7 @@ typedef struct { // International Language // -typedef UINT8 ISO_639_2; +typedef CHAR8 ISO_639_2; #define ISO_639_2_ENTRY_SIZE 3 // diff --git a/3rd/gnu-efi/inc/efilib.h b/3rd/gnu-efi/inc/efilib.h index a2b39b2ed..e73177c01 100644 --- a/3rd/gnu-efi/inc/efilib.h +++ b/3rd/gnu-efi/inc/efilib.h @@ -35,6 +35,8 @@ Revision History #include "mips64el/efilibplat.h" #elif defined (__riscv) && __riscv_xlen == 64 #include "riscv64/efilibplat.h" +#elif defined (__loongarch64) +#include "loongarch64/efilibplat.h" #endif #include "efilink.h" #include "efirtlib.h" diff --git a/3rd/gnu-efi/inc/ia32/efibind.h b/3rd/gnu-efi/inc/ia32/efibind.h index 27459e454..718e8d1b1 100644 --- a/3rd/gnu-efi/inc/ia32/efibind.h +++ b/3rd/gnu-efi/inc/ia32/efibind.h @@ -85,9 +85,11 @@ Revision History // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 + typedef uint64_t UINT64; typedef int64_t INT64; @@ -99,12 +101,13 @@ typedef int64_t INT64; typedef uint16_t UINT16; typedef int16_t INT16; + typedef uint8_t UINT8; +typedef char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; #undef VOID -#define VOID void +typedef void VOID; typedef int32_t INTN; diff --git a/3rd/gnu-efi/inc/ia64/efibind.h b/3rd/gnu-efi/inc/ia64/efibind.h index 3ace8d591..1d2745b02 100644 --- a/3rd/gnu-efi/inc/ia64/efibind.h +++ b/3rd/gnu-efi/inc/ia64/efibind.h @@ -71,24 +71,27 @@ Revision History // // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 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 char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; - #undef VOID -#define VOID void +typedef void VOID; typedef int64_t INTN; diff --git a/3rd/gnu-efi/inc/loongarch64/efibind.h b/3rd/gnu-efi/inc/loongarch64/efibind.h new file mode 100644 index 000000000..aaf3fb7e7 --- /dev/null +++ b/3rd/gnu-efi/inc/loongarch64/efibind.h @@ -0,0 +1,157 @@ +/* + * Copright (C) 2014 - 2015 Linaro Ltd. + * Author: Ard Biesheuvel + * Copright (C) 2017 Lemote Co. + * Author: Heiher + * Copright (C) 2021 Loongson Technology Corporation Limited. + * Author: zhoumingtao + * + * 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(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) && !defined(__cplusplus) + +// 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; +typedef uint64_t uintptr_t; +typedef int64_t intptr_t; + +#else +#include +#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. +// + +#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"))); + +#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 diff --git a/3rd/gnu-efi/inc/loongarch64/efilibplat.h b/3rd/gnu-efi/inc/loongarch64/efilibplat.h new file mode 100644 index 000000000..eda7c83bc --- /dev/null +++ b/3rd/gnu-efi/inc/loongarch64/efilibplat.h @@ -0,0 +1,24 @@ +/*++ + +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 + ); diff --git a/3rd/gnu-efi/inc/loongarch64/efisetjmp_arch.h b/3rd/gnu-efi/inc/loongarch64/efisetjmp_arch.h new file mode 100644 index 000000000..18aefaf4d --- /dev/null +++ b/3rd/gnu-efi/inc/loongarch64/efisetjmp_arch.h @@ -0,0 +1,23 @@ +#ifndef GNU_EFI_LOONGARCH64_SETJMP_H +#define GNU_EFI_LOONGARCH64_SETJMP_H + +#define JMPBUF_ALIGN 8 + +typedef struct { + /* GP regs */ + UINT64 RA; + UINT64 SP; + UINT64 FP; + + UINT64 S0; + UINT64 S1; + UINT64 S2; + UINT64 S3; + UINT64 S4; + UINT64 S5; + UINT64 S6; + UINT64 S7; + UINT64 S8; +} ALIGN(JMPBUF_ALIGN) jmp_buf[1]; + +#endif /* GNU_EFI_LOONGARCH64_SETJMP_H */ diff --git a/3rd/gnu-efi/inc/mips64el/efibind.h b/3rd/gnu-efi/inc/mips64el/efibind.h index 1f08cd346..cf77ddc6b 100644 --- a/3rd/gnu-efi/inc/mips64el/efibind.h +++ b/3rd/gnu-efi/inc/mips64el/efibind.h @@ -40,9 +40,10 @@ typedef int64_t intptr_t; // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 typedef uint64_t UINT64; typedef int64_t INT64; @@ -52,12 +53,13 @@ typedef int32_t INT32; typedef uint16_t UINT16; typedef int16_t INT16; + typedef uint8_t UINT8; +typedef char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; #undef VOID -#define VOID void +typedef void VOID; typedef int64_t INTN; typedef uint64_t UINTN; diff --git a/3rd/gnu-efi/inc/riscv64/efibind.h b/3rd/gnu-efi/inc/riscv64/efibind.h index 0a818ae3a..4fdf81dca 100644 --- a/3rd/gnu-efi/inc/riscv64/efibind.h +++ b/3rd/gnu-efi/inc/riscv64/efibind.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ /* * Copright (C) 2014 - 2015 Linaro Ltd. * Author: Ard Biesheuvel @@ -21,7 +22,7 @@ // Basic EFI types of various widths // - +#include typedef uint64_t UINT64; typedef int64_t INT64; @@ -31,15 +32,13 @@ typedef uint16_t UINT16; typedef int16_t INT16; typedef uint8_t UINT8; typedef int8_t INT8; -#ifndef __WCHAR_TYPE__ -#define __WCHAR_TYPE__ short -#endif -typedef __WCHAR_TYPE__ WCHAR; +typedef wchar_t CHAR16; +#define WCHAR CHAR16 #ifndef BOOLEAN typedef uint8_t BOOLEAN; #endif #undef VOID -#define VOID void +typedef void VOID; typedef int64_t INTN; typedef uint64_t UINTN; diff --git a/3rd/gnu-efi/inc/riscv64/efilibplat.h b/3rd/gnu-efi/inc/riscv64/efilibplat.h index 0a61b240d..9b151637e 100644 --- a/3rd/gnu-efi/inc/riscv64/efilibplat.h +++ b/3rd/gnu-efi/inc/riscv64/efilibplat.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ VOID InitializeLibPlatform ( diff --git a/3rd/gnu-efi/inc/riscv64/efisetjmp_arch.h b/3rd/gnu-efi/inc/riscv64/efisetjmp_arch.h index 2bb4efdc1..9288c1fa5 100644 --- a/3rd/gnu-efi/inc/riscv64/efisetjmp_arch.h +++ b/3rd/gnu-efi/inc/riscv64/efisetjmp_arch.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ + #ifndef GNU_EFI_RISCV64_SETJMP_H #define GNU_EFI_RISCV64_SETJMP_H diff --git a/3rd/gnu-efi/inc/x86_64/efibind.h b/3rd/gnu-efi/inc/x86_64/efibind.h index b8c32c3e3..e454ed2c2 100644 --- a/3rd/gnu-efi/inc/x86_64/efibind.h +++ b/3rd/gnu-efi/inc/x86_64/efibind.h @@ -96,9 +96,10 @@ Revision History // Basic EFI types of various widths // -#ifndef __WCHAR_TYPE__ -# define __WCHAR_TYPE__ short -#endif +#include + +typedef wchar_t CHAR16; +#define WCHAR CHAR16 typedef uint64_t UINT64; typedef int64_t INT64; @@ -110,12 +111,13 @@ typedef int64_t INT64; typedef uint16_t UINT16; typedef int16_t INT16; + typedef uint8_t UINT8; +typedef char CHAR8; typedef int8_t INT8; -typedef __WCHAR_TYPE__ WCHAR; #undef VOID -#define VOID void +typedef void VOID; typedef int64_t INTN; diff --git a/3rd/gnu-efi/lib/Makefile b/3rd/gnu-efi/lib/Makefile index 1fc6a47c2..4e0c9bee2 100644 --- a/3rd/gnu-efi/lib/Makefile +++ b/3rd/gnu-efi/lib/Makefile @@ -43,8 +43,8 @@ include $(SRCDIR)/../Make.defaults TOPDIR = $(SRCDIR)/.. CDIR = $(TOPDIR)/.. -FILES = boxdraw smbios console crc data debug dpath \ - error event exit guid hand hw init lock \ +FILES = boxdraw smbios console crc data debug dpath \ + entry error event exit guid hand hw init lock \ misc pause print sread str cmdline\ runtime/rtlock runtime/efirtlib runtime/rtstr runtime/vm runtime/rtdata \ $(ARCH)/initplat $(ARCH)/math $(ARCH)/setjmp @@ -62,9 +62,9 @@ FILES += $(ARCH)/uldiv $(ARCH)/ldivmod $(ARCH)/div $(ARCH)/llsl $(ARCH)/llsr \ $(ARCH)/mullu endif -OBJS = $(FILES:%=%.o) +OBJS = $(FILES:%=%.o) ctors.o -SUBDIRS = ia32 x86_64 ia64 aarch64 arm mips64el riscv64 runtime +SUBDIRS = ia32 x86_64 ia64 aarch64 arm mips64el riscv64 loongarch64 runtime LIBDIRINSTALL = $(INSTALLROOT)$(LIBDIR) @@ -72,7 +72,7 @@ all: libsubdirs libefi.a .PHONY: libsubdirs libsubdirs: - for sdir in $(SUBDIRS); do mkdir -p $$sdir; done + @set -e ; for sdir in $(SUBDIRS); do mkdir -p $$sdir; done $(OBJS): libsubdirs diff --git a/3rd/gnu-efi/lib/Makefile.orig b/3rd/gnu-efi/lib/Makefile.orig deleted file mode 100644 index 65aa8ca5d..000000000 --- a/3rd/gnu-efi/lib/Makefile.orig +++ /dev/null @@ -1,91 +0,0 @@ -# -# Copyright (C) 1999-2001 Hewlett-Packard Co. -# Contributed by David Mosberger -# Contributed by Stephane Eranian -# -# 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 = boxdraw smbios console crc data debug dpath \ - error event guid hand hw init lock \ - misc print sread str cmdline \ - runtime/rtlock runtime/efirtlib runtime/rtstr runtime/vm runtime/rtdata \ - $(ARCH)/initplat $(ARCH)/math - -ifeq ($(ARCH),ia64) -FILES += $(ARCH)/salpal $(ARCH)/palproc -endif - -ifeq ($(ARCH),x86_64) -FILES += $(ARCH)/callwrap $(ARCH)/efi_stub -endif - -ifeq ($(ARCH),arm) -FILES += $(ARCH)/lib1funcs $(ARCH)/div64 -endif - -OBJS = $(FILES:%=%.o) - -SUBDIRS = ia32 x86_64 ia64 aarch64 arm runtime - -LIBDIRINSTALL = $(INSTALLROOT)$(LIBDIR) - -all: libsubdirs libefi.a - -.PHONY: libsubdirs -libsubdirs: - for sdir in $(SUBDIRS); do mkdir -p $$sdir; done - -libefi.a: $(patsubst %,libefi.a(%),$(OBJS)) - -clean: - rm -f libefi.a *~ $(OBJS) */*.o - -$(LIBDIRINSTALL): - mkdir -p $@ - -$(LIBDIRINSTALL)/libefi.a: libefi.a | $(LIBDIRINSTALL) - $(INSTALL) -m 644 $< $(dir $@) - -install: $(LIBDIRINSTALL)/libefi.a - -include $(SRCDIR)/../Make.rules - -.PHONY: libsubdirs diff --git a/3rd/gnu-efi/lib/ctors.S b/3rd/gnu-efi/lib/ctors.S new file mode 100644 index 000000000..4a0c6ab4b --- /dev/null +++ b/3rd/gnu-efi/lib/ctors.S @@ -0,0 +1,47 @@ +/* + * Try to define the minimal empty init/ctor/dtor/fini_arrays so building with + * older or out-of-tree linker scripts will still work. + */ +/* + * Note that these aren't the using the GNU "CONSTRUCTOR" output section + * command, so they don't start with a size. Because of p2align and the + * end/END definitions, and the fact that they're mergeable, they can also + * have NULLs which aren't guaranteed to be at the end. + */ + .section .init_array, "aM", @init_array + .p2align 3, 0 + .globl _init_array +_init_array: + .p2align 3, 0 + .globl _init_array_end +_init_array_end: + .long 0 + .section .ctors, "aM", @init_array + .p2align 3, 0 + .globl __CTOR_LIST__ +__CTOR_LIST__: + .p2align 3, 0 + .globl __CTOR_END__ +__CTOR_END__: + .long 0 + .section .dtors, "aM", @fini_array + .p2align 3, 0 + .globl __DTOR_LIST__ +__DTOR_LIST__: + .p2align 3, 0 + .globl __DTOR_END__ +__DTOR_END__: + .long 0 + .section .fini_array, "aM", @fini_array + .p2align 3, 0 + .globl _fini_array +_fini_array: + .p2align 3, 0 + .globl _fini_array_end +_fini_array_end: + .long 0 + +#if defined(__ELF__) && defined(__linux__) + .section .note.GNU-stack,"",%progbits +#endif + diff --git a/3rd/gnu-efi/lib/entry.c b/3rd/gnu-efi/lib/entry.c new file mode 100644 index 000000000..d85260846 --- /dev/null +++ b/3rd/gnu-efi/lib/entry.c @@ -0,0 +1,67 @@ +/* + * ctors.c + * Copyright 2019 Peter Jones + * + */ + +#include +#include + +/* + * Note that these aren't the using the GNU "CONSTRUCTOR" output section + * command, so they don't start with a size. Because of p2align and the + * end/END definitions, and the fact that they're mergeable, they can also + * have NULLs which aren't guaranteed to be at the end. + */ +extern UINTN _init_array, _init_array_end; +extern UINTN __CTOR_LIST__, __CTOR_END__; +extern UINTN _fini_array, _fini_array_end; +extern UINTN __DTOR_LIST__, __DTOR_END__; + +typedef void (*funcp)(void); + +static void ctors(void) +{ + for (funcp *location = (void *)&_init_array; location < (funcp *)&_init_array_end; location++) { + funcp func = *location; + if (location != NULL) + func(); + } + + for (funcp *location = (void *)&__CTOR_LIST__; location < (funcp *)&__CTOR_END__; location++) { + funcp func = *location; + if (location != NULL) + func(); + } +} + +static void dtors(void) +{ + for (funcp *location = (void *)&__DTOR_LIST__; location < (funcp *)&__DTOR_END__; location++) { + funcp func = *location; + if (location != NULL) + func(); + } + + for (funcp *location = (void *)&_fini_array; location < (funcp *)&_fini_array_end; location++) { + funcp func = *location; + if (location != NULL) + func(); + } +} + +extern EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab); + +EFI_STATUS _entry(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) +{ + EFI_STATUS status; + InitializeLib(image, systab); + + ctors(); + status = efi_main(image, systab); + dtors(); + + return status; +} + +// vim:fenc=utf-8:tw=75:noet diff --git a/3rd/gnu-efi/lib/ia32/math.c b/3rd/gnu-efi/lib/ia32/math.c index fce7a8d48..2ef75883b 100644 --- a/3rd/gnu-efi/lib/ia32/math.c +++ b/3rd/gnu-efi/lib/ia32/math.c @@ -158,7 +158,7 @@ DivU64x32 ( Rem = 0; for (bit=0; bit < 64; bit++) { #if defined(__GNUC__) || defined(__MINGW32__) - asm ( + __asm__ ( "shll $1, %0\n\t" "rcll $1, 4%0\n\t" "rcll $1, %2\n\t" diff --git a/3rd/gnu-efi/lib/init.c b/3rd/gnu-efi/lib/init.c index 4f238c0a2..726e49391 100644 --- a/3rd/gnu-efi/lib/init.c +++ b/3rd/gnu-efi/lib/init.c @@ -46,57 +46,52 @@ Routine Description: EFI_STATUS Status; CHAR8 *LangCode; - if (!LibInitialized) { - LibInitialized = TRUE; - LibFwInstance = FALSE; - LibImageHandle = ImageHandle; + if (LibInitialized) + return; + LibInitialized = TRUE; + LibFwInstance = FALSE; + LibImageHandle = ImageHandle; - // - // Set up global pointer to the system table, boot services table, - // and runtime services table - // - - ST = SystemTable; - BS = SystemTable->BootServices; - RT = SystemTable->RuntimeServices; -// ASSERT (CheckCrc(0, &ST->Hdr)); -// ASSERT (CheckCrc(0, &BS->Hdr)); -// ASSERT (CheckCrc(0, &RT->Hdr)); - - - // - // Initialize pool allocation type - // - - if (ImageHandle) { - Status = uefi_call_wrapper( - BS->HandleProtocol, - 3, - ImageHandle, - &LoadedImageProtocol, - (VOID*)&LoadedImage - ); - - if (!EFI_ERROR(Status)) { - PoolAllocationType = LoadedImage->ImageDataType; - } - EFIDebugVariable (); - } + // + // Set up global pointer to the system table, boot services table, + // and runtime services table + // - // - // Initialize Guid table - // + ST = SystemTable; + BS = SystemTable->BootServices; + RT = SystemTable->RuntimeServices; + // ASSERT (CheckCrc(0, &ST->Hdr)); + // ASSERT (CheckCrc(0, &BS->Hdr)); + // ASSERT (CheckCrc(0, &RT->Hdr)); - InitializeGuid(); + // + // Initialize pool allocation type + // - InitializeLibPlatform(ImageHandle,SystemTable); + if (ImageHandle) { + Status = uefi_call_wrapper( + BS->HandleProtocol, + 3, + ImageHandle, + &LoadedImageProtocol, + (VOID*)&LoadedImage + ); + + if (!EFI_ERROR(Status)) { + PoolAllocationType = LoadedImage->ImageDataType; + } + EFIDebugVariable (); } // - // + // Initialize Guid table // + InitializeGuid(); + + InitializeLibPlatform(ImageHandle,SystemTable); + if (ImageHandle && UnicodeInterface == &LibStubUnicodeInterface) { LangCode = LibGetVariable (VarLanguage, &EfiGlobalVariable); InitializeUnicodeSupport (LangCode); diff --git a/3rd/gnu-efi/lib/loongarch64/efi_stub.S b/3rd/gnu-efi/lib/loongarch64/efi_stub.S new file mode 100644 index 000000000..464eae58a --- /dev/null +++ b/3rd/gnu-efi/lib/loongarch64/efi_stub.S @@ -0,0 +1 @@ +/* This stub is a stub to make the build happy */ diff --git a/3rd/gnu-efi/lib/loongarch64/initplat.c b/3rd/gnu-efi/lib/loongarch64/initplat.c new file mode 100644 index 000000000..6c5e1fa52 --- /dev/null +++ b/3rd/gnu-efi/lib/loongarch64/initplat.c @@ -0,0 +1,26 @@ +/* + * Copright (C) 2014 Linaro Ltd. + * Author: Ard Biesheuvel + * + * 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. + */ + +#include "lib.h" + +VOID +InitializeLibPlatform ( + IN EFI_HANDLE ImageHandle EFI_UNUSED, + IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED + ) +{ +} diff --git a/3rd/gnu-efi/lib/loongarch64/math.c b/3rd/gnu-efi/lib/loongarch64/math.c new file mode 100644 index 000000000..8c1644466 --- /dev/null +++ b/3rd/gnu-efi/lib/loongarch64/math.c @@ -0,0 +1,63 @@ +/* + * Copright (C) 2014 Linaro Ltd. + * Author: Ard Biesheuvel + * + * 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. + */ + +#include "lib.h" + +UINT64 +LShiftU64 ( + IN UINT64 Operand, + IN UINTN Count + ) +// Left shift 64bit by 32bit and get a 64bit result +{ + return Operand << Count; +} + +UINT64 +RShiftU64 ( + IN UINT64 Operand, + IN UINTN Count + ) +// Right shift 64bit by 32bit and get a 64bit result +{ + return Operand >> Count; +} + + +UINT64 +MultU64x32 ( + IN UINT64 Multiplicand, + IN UINTN Multiplier + ) +// Multiple 64bit by 32bit and get a 64bit result +{ + return Multiplicand * Multiplier; +} + +UINT64 +DivU64x32 ( + IN UINT64 Dividend, + IN UINTN Divisor, + OUT UINTN *Remainder OPTIONAL + ) +// divide 64bit by 32bit and get a 64bit result +// N.B. only works for 31bit divisors!! +{ + if (Remainder) + *Remainder = Dividend % Divisor; + return Dividend / Divisor; +} diff --git a/3rd/gnu-efi/lib/loongarch64/setjmp.S b/3rd/gnu-efi/lib/loongarch64/setjmp.S new file mode 100644 index 000000000..6821af36c --- /dev/null +++ b/3rd/gnu-efi/lib/loongarch64/setjmp.S @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. + * Copyright (c) 2021 Loongson Technology Corporation Limited.All rights + * reserved. + * Author: zhoumingtao + * + * This program and the accompanying materials are licensed and made + * available + * under the terms and conditions of the BSD License which accompanies + * this + * distribution. The full text of the license may be found at + * http://opensource.org/licenses/bsd-license.php. + * + * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" + * BASIS, + * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR + * IMPLIED. + */ + + .text + .p2align 3 + +/* + int setjmp(jmp_buf env); +*/ + .globl setjmp + .type setjmp, @function +setjmp: + st.d $ra, $a0, 0x0 + st.d $sp, $a0, 0x8 + st.d $fp, $a0, 0x10 + st.d $s0, $a0, 0x18 + st.d $s1, $a0, 0x20 + st.d $s2, $a0, 0x28 + st.d $s3, $a0, 0x30 + st.d $s4, $a0, 0x38 + st.d $s5, $a0, 0x40 + st.d $s6, $a0, 0x48 + st.d $s7, $a0, 0x50 + st.d $s8, $a0, 0x58 + + move $a0, $zero + jr $ra + +/* + void longjmp(jmp_buf env, int val); +*/ + .globl longjmp + .type longjmp, @function +longjmp: + ld.d $ra, $a0, 0x0 + ld.d $sp, $a0, 0x8 + ld.d $fp, $a0, 0x10 + ld.d $s0, $a0, 0x18 + ld.d $s1, $a0, 0x20 + ld.d $s2, $a0, 0x28 + ld.d $s3, $a0, 0x30 + ld.d $s4, $a0, 0x38 + ld.d $s5, $a0, 0x40 + ld.d $s6, $a0, 0x48 + ld.d $s7, $a0, 0x50 + ld.d $s8, $a0, 0x58 + + addi.d $a0, $zero, 1 # a0 = 1 + beqz $a1, .L0 # if (a1 == 0); goto L0 + move $a0, $a1 # a0 = a1 +.L0: + jr $ra diff --git a/3rd/gnu-efi/lib/print.c b/3rd/gnu-efi/lib/print.c index 8a7466cfb..a43dc8ce2 100644 --- a/3rd/gnu-efi/lib/print.c +++ b/3rd/gnu-efi/lib/print.c @@ -1125,24 +1125,24 @@ Routine Description: Item.Item.pw = Item.Scratch; break; - case '0': - Item.Pad = '0'; + case ',': + Item.Comma = TRUE; break; case '-': Item.PadBefore = FALSE; break; - case ',': - Item.Comma = TRUE; + case '*': + *Item.WidthParse = va_arg(ps->args, UINTN); break; case '.': Item.WidthParse = &Item.FieldWidth; break; - case '*': - *Item.WidthParse = va_arg(ps->args, UINTN); + case '0': + Item.Pad = '0'; break; case '1': @@ -1170,52 +1170,23 @@ Routine Description: } break; - case 's': - Item.Item.pw = va_arg(ps->args, CHAR16 *); - if (!Item.Item.pw) { - Item.Item.pw = L"(null)"; - } - break; - case 'c': Item.Scratch[0] = (CHAR16) va_arg(ps->args, UINTN); Item.Scratch[1] = 0; Item.Item.pw = Item.Scratch; break; - case 'l': - Item.Long = TRUE; - break; - - case 'X': - Item.Width = Item.Long ? 16 : 8; - Item.Pad = '0'; -#if __GNUC__ >= 7 - __attribute__ ((fallthrough)); -#endif - case 'x': - ValueToHex ( - Item.Scratch, - Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32) - ); - Item.Item.pw = Item.Scratch; - - break; - + case 'D': + { + EFI_DEVICE_PATH *dp = va_arg(ps->args, EFI_DEVICE_PATH *); + CHAR16 *dpstr = DevicePathToStr(dp); + StrnCpy(Item.Scratch, dpstr, PRINT_ITEM_BUFFER_LEN); + Item.Scratch[PRINT_ITEM_BUFFER_LEN-1] = L'\0'; + FreePool(dpstr); - case 'g': - GuidToString (Item.Scratch, va_arg(ps->args, EFI_GUID *)); - Item.Item.pw = Item.Scratch; - break; - - case 'u': - ValueToString ( - Item.Scratch, - Item.Comma, - Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32) - ); Item.Item.pw = Item.Scratch; break; + } case 'd': ValueToString ( @@ -1226,17 +1197,13 @@ Routine Description: Item.Item.pw = Item.Scratch; break; - case 'D': - { - EFI_DEVICE_PATH *dp = va_arg(ps->args, EFI_DEVICE_PATH *); - CHAR16 *dpstr = DevicePathToStr(dp); - StrnCpy(Item.Scratch, dpstr, PRINT_ITEM_BUFFER_LEN); - Item.Scratch[PRINT_ITEM_BUFFER_LEN-1] = L'\0'; - FreePool(dpstr); + case 'E': + Attr = ps->AttrError; + break; - Item.Item.pw = Item.Scratch; + case 'e': + PSETATTR(ps, ps->AttrError); break; - } case 'f': FloatToString ( @@ -1247,38 +1214,83 @@ Routine Description: Item.Item.pw = Item.Scratch; break; - case 't': - TimeToString (Item.Scratch, va_arg(ps->args, EFI_TIME *)); - Item.Item.pw = Item.Scratch; - break; - - case 'r': - StatusToString (Item.Scratch, va_arg(ps->args, EFI_STATUS)); + case 'g': + GuidToString (Item.Scratch, va_arg(ps->args, EFI_GUID *)); Item.Item.pw = Item.Scratch; break; - case 'n': - PSETATTR(ps, ps->AttrNorm); + case 'H': + Attr = ps->AttrHighlight; break; case 'h': PSETATTR(ps, ps->AttrHighlight); break; - case 'e': - PSETATTR(ps, ps->AttrError); + case 'l': + Item.Long = TRUE; break; case 'N': Attr = ps->AttrNorm; break; - case 'H': - Attr = ps->AttrHighlight; + case 'n': + PSETATTR(ps, ps->AttrNorm); break; - case 'E': - Attr = ps->AttrError; + case 'p': + Item.Width = sizeof(void *) == (8 ? 16 : 8) + 2; + Item.Pad = '0'; + Item.Scratch[0] = ' '; + Item.Scratch[1] = ' '; + ValueToHex ( + Item.Scratch+2, + Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32) + ); + Item.Scratch[0] = '0'; + Item.Scratch[1] = 'x'; + Item.Item.pw = Item.Scratch; + break; + + case 'r': + StatusToString (Item.Scratch, va_arg(ps->args, EFI_STATUS)); + Item.Item.pw = Item.Scratch; + break; + + case 's': + Item.Item.pw = va_arg(ps->args, CHAR16 *); + if (!Item.Item.pw) { + Item.Item.pw = L"(null)"; + } + break; + + case 't': + TimeToString (Item.Scratch, va_arg(ps->args, EFI_TIME *)); + Item.Item.pw = Item.Scratch; + break; + + case 'u': + ValueToString ( + Item.Scratch, + Item.Comma, + Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32) + ); + Item.Item.pw = Item.Scratch; + break; + + case 'X': + Item.Width = Item.Long ? 16 : 8; + Item.Pad = '0'; +#if __GNUC__ >= 7 + __attribute__ ((fallthrough)); +#endif + case 'x': + ValueToHex ( + Item.Scratch, + Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32) + ); + Item.Item.pw = Item.Scratch; break; default: diff --git a/3rd/gnu-efi/lib/riscv64/initplat.c b/3rd/gnu-efi/lib/riscv64/initplat.c index ed4203797..895353ad3 100644 --- a/3rd/gnu-efi/lib/riscv64/initplat.c +++ b/3rd/gnu-efi/lib/riscv64/initplat.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +// SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause #include "lib.h" diff --git a/3rd/gnu-efi/lib/riscv64/setjmp.S b/3rd/gnu-efi/lib/riscv64/setjmp.S index f7928e5e5..275a715f7 100644 --- a/3rd/gnu-efi/lib/riscv64/setjmp.S +++ b/3rd/gnu-efi/lib/riscv64/setjmp.S @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +// SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause /* * Copyright Heinrich Schuchardt */ From 2607aece4a037d814aa250c342290ed634989af6 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 26 Jun 2023 21:26:40 +0800 Subject: [PATCH 20/37] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=20gn?= =?UTF-8?q?uefi=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 1 + run.sh | 2 +- src/boot/CMakeLists.txt | 5 +-- src/boot/x86_64/boot.cpp | 10 +++--- src/boot/x86_64/link.ld | 76 ---------------------------------------- 5 files changed, 10 insertions(+), 84 deletions(-) delete mode 100644 src/boot/x86_64/link.ld diff --git a/CMakeLists.txt b/CMakeLists.txt index 3661b0e7a..c977476c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,7 @@ add_custom_command(TARGET gnuefi make ARCH=${ARCH} OBJDIR=${CMAKE_BINARY_DIR}/3rd/gnu-efi + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/3rd/gnu-efi/gnuefi/elf_${ARCH}_efi.lds ${CMAKE_BINARY_DIR}/3rd/gnu-efi/link.ld COMMENT "Build 3rd/gnu-efi done." ) diff --git a/run.sh b/run.sh index c8ad2823c..019c90f34 100755 --- a/run.sh +++ b/run.sh @@ -18,7 +18,7 @@ ARCH=x86_64 # ARCH=aarch64 # 指定要使用的 efi -USE_GNU_UEFI=0 +USE_GNU_UEFI=1 CMAKE_BUILD_TYPE=Debug #CMAKE_BUILD_TYPE=Release diff --git a/src/boot/CMakeLists.txt b/src/boot/CMakeLists.txt index aa9af1378..29efc16a0 100644 --- a/src/boot/CMakeLists.txt +++ b/src/boot/CMakeLists.txt @@ -31,15 +31,16 @@ if (USE_GNU_UEFI STREQUAL "1") ${CMAKE_BINARY_DIR}/../../3rd/gnu-efi/gnuefi/libgnuefi.a ${CMAKE_BINARY_DIR}/../../3rd/gnu-efi/lib/libefi.a ) + target_link_options(boot PRIVATE -T ${CMAKE_BINARY_DIR}/../../3rd/gnu-efi/link.ld) + else () target_link_libraries(boot PRIVATE ${CMAKE_BINARY_DIR}/../../3rd/posix-uefi/crt0.o ${CMAKE_BINARY_DIR}/../../3rd/posix-uefi/libuefi.a ) + target_link_options(boot PRIVATE -T ${CMAKE_BINARY_DIR}/../../3rd/posix-uefi/link.ld) endif () -target_link_options(boot PRIVATE -T ${CMAKE_SOURCE_DIR}/${ARCH}/link.ld) - set_target_properties(boot PROPERTIES OUTPUT_NAME ${OUTPUT_NAME}) # 添加头文件搜索路径 diff --git a/src/boot/x86_64/boot.cpp b/src/boot/x86_64/boot.cpp index a76b2c403..d538566e7 100644 --- a/src/boot/x86_64/boot.cpp +++ b/src/boot/x86_64/boot.cpp @@ -32,12 +32,12 @@ */ extern "C" EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { - uefi_call_wrapper(InitializeLib, 2, image, systemTable); - EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, 1, - systemTable->ConOut); + // uefi_call_wrapper(InitializeLib, 2, image, systemTable); + // EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, 1, + // systemTable->ConOut); - status = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, - systemTable->ConOut, L"Hello UEFI!\n"); + // status = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, + // systemTable->ConOut, L"Hello UEFI!\n"); return EFI_SUCCESS; } diff --git a/src/boot/x86_64/link.ld b/src/boot/x86_64/link.ld deleted file mode 100644 index 7be590235..000000000 --- a/src/boot/x86_64/link.ld +++ /dev/null @@ -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) } -} From e4aaec7dd77dd2b734650ef12ab5f070a0d16b94 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 26 Jun 2023 22:15:36 +0800 Subject: [PATCH 21/37] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=20gn?= =?UTF-8?q?uefi=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- run.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 019c90f34..7f84786c6 100755 --- a/run.sh +++ b/run.sh @@ -18,7 +18,8 @@ ARCH=x86_64 # ARCH=aarch64 # 指定要使用的 efi -USE_GNU_UEFI=1 +# @todo 目前只支持使用 posix-uefi +USE_GNU_UEFI=0 CMAKE_BUILD_TYPE=Debug #CMAKE_BUILD_TYPE=Release From c657e66c97ae4e5ca6ff80697d38416f4d14efb0 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 26 Jun 2023 22:20:51 +0800 Subject: [PATCH 22/37] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=20gn?= =?UTF-8?q?uefi=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- src/boot/x86_64/boot.cpp | 15 ++++++++------- src/kernel/include/kernel.h | 2 +- src/kernel/kernel_main.cpp | 5 ++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/boot/x86_64/boot.cpp b/src/boot/x86_64/boot.cpp index d538566e7..9d8480080 100644 --- a/src/boot/x86_64/boot.cpp +++ b/src/boot/x86_64/boot.cpp @@ -14,8 +14,6 @@ * */ -#include "cstdint" - #if USE_GNU_UEFI == 1 # include "efi.h" # include "efilib.h" @@ -33,11 +31,14 @@ extern "C" EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { // uefi_call_wrapper(InitializeLib, 2, image, systemTable); - // EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, 1, + // EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, + // 1, // systemTable->ConOut); - // status = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, - // systemTable->ConOut, L"Hello UEFI!\n"); + // status = uefi_call_wrapper(systemTable->ConOut->OutputString, + // 2, + // systemTable->ConOut, L"Hello + // UEFI!\n"); return EFI_SUCCESS; } @@ -153,8 +154,8 @@ extern "C" int main(int argc, char** argv) { /* execute the "kernel" */ printf("ELF entry point %p\n", entry); - int (*entry_fp)(void) = (int(*)())entry; - i = entry_fp(); + int (*entry_fp)(int, char**) = (int (*)(int, char**))entry; + i = entry_fp(0, nullptr); printf("ELF returned %d\n", i); diff --git a/src/kernel/include/kernel.h b/src/kernel/include/kernel.h index 37d43e3f0..1aabb8313 100644 --- a/src/kernel/include/kernel.h +++ b/src/kernel/include/kernel.h @@ -20,6 +20,6 @@ /** * @brief 声明 kernel_main 用 C 方法编译 */ -extern "C" void kernel_main(void); +extern "C" int kernel_main(int, char**); #endif /* SIMPLEKERNEL_KERNEL_H */ diff --git a/src/kernel/kernel_main.cpp b/src/kernel/kernel_main.cpp index 52cc630ab..7a65d17a3 100644 --- a/src/kernel/kernel_main.cpp +++ b/src/kernel/kernel_main.cpp @@ -18,12 +18,11 @@ /** * @brief 内核主要逻辑 - * @note 这个函数不会返回 */ -void kernel_main(void) { +int kernel_main(int, char**) { // 进入死循环 while (1) { ; } - return; + return 0; } From 7d594568c46c9cbdff67d1348d7b97385a0a9e26 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 26 Jun 2023 22:28:12 +0800 Subject: [PATCH 23/37] =?UTF-8?q?=E5=B0=86=E5=90=AF=E5=8A=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=85=A8=E9=83=A8=E7=A7=BB=E5=8A=A8=E5=88=B0=20src/bo?= =?UTF-8?q?ot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- run.sh | 4 ++-- src/CMakeLists.txt | 3 ++- src/arch/riscv64/CMakeLists.txt | 16 +--------------- src/{arch/riscv64/boot => boot/riscv64}/boot.S | 0 4 files changed, 5 insertions(+), 18 deletions(-) rename src/{arch/riscv64/boot => boot/riscv64}/boot.S (100%) diff --git a/run.sh b/run.sh index 7f84786c6..00a530d34 100755 --- a/run.sh +++ b/run.sh @@ -13,8 +13,8 @@ set -e MACHINE=qemu -# ARCH=riscv64 -ARCH=x86_64 +ARCH=riscv64 +# ARCH=x86_64 # ARCH=aarch64 # 指定要使用的 efi diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8216a514f..c395cb97f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,9 +25,10 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/arch) add_subdirectory(${CMAKE_SOURCE_DIR}/kernel) if (ARCH STREQUAL "riscv64") + enable_language(ASM) # 将各个子对象链接为内核文件 add_executable(core - $ + ${CMAKE_SOURCE_DIR}/boot/${ARCH}/boot.S $ ) elseif (ARCH STREQUAL "x86_64") diff --git a/src/arch/riscv64/CMakeLists.txt b/src/arch/riscv64/CMakeLists.txt index 6fc319d3b..2910ef795 100644 --- a/src/arch/riscv64/CMakeLists.txt +++ b/src/arch/riscv64/CMakeLists.txt @@ -6,18 +6,4 @@ # 架构相关子模块的编译规则 # 设置子模块名与使用的语言 -PROJECT(arch ASM) - -# 寻找汇编文件 -find_asm_source_files(boot_asm_src ${arch_SOURCE_DIR}/boot) -# 添加到 boot_src -set(boot_src ${boot_asm_src}) - -# 设置子模块所有的源码 -set(arch_src ${boot_src}) - -# 添加子模块 -add_library(${PROJECT_NAME} OBJECT ${arch_src}) - -# 添加头文件搜索路径 -target_include_kernel_header_files(${PROJECT_NAME}) +PROJECT(arch) diff --git a/src/arch/riscv64/boot/boot.S b/src/boot/riscv64/boot.S similarity index 100% rename from src/arch/riscv64/boot/boot.S rename to src/boot/riscv64/boot.S From d0a0cd967c41543b3ac649550d239ddfe53aea7e Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 26 Jun 2023 23:09:03 +0800 Subject: [PATCH 24/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=20kernel.efi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c977476c5..f24162e8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,24 +227,11 @@ add_custom_command(TARGET boot_efi COMMENT "Build ${BOOT_EFI_OUTPUT_NAME} done." ) -# 制作内核 -# 将内核调整为 efi -add_custom_target(kernel_efi DEPENDS kernel) -add_custom_command(TARGET kernel_efi - WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_OBJCOPY} --target=efi-app-x86-64 ${KERNEL_ELF_OUTPUT_NAME} kernel.efi - -g -R .comment -R .gnu_debuglink -R .note.gnu.build-id - -R .gnu.hash -R .plt -R .rela.plt -R .dynstr -R .dynsym -R .rela.dyn - -S -R .eh_frame -R .gcc_except_table - COMMENT "Build kernel.efi done." - ) - -add_custom_target(image_uefi DEPENDS boot_efi kernel_efi) +add_custom_target(image_uefi DEPENDS boot_efi) add_custom_command(TARGET image_uefi COMMENT "Copying bootloader and kernel" COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/image/efi/boot COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${BOOT_EFI_OUTPUT_NAME} ${CMAKE_BINARY_DIR}/image/efi/boot/ - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${KERNEL_EFI_OUTPUT_NAME} ${CMAKE_BINARY_DIR}/image/efi/ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${KERNEL_ELF_OUTPUT_NAME} ${CMAKE_BINARY_DIR}/image/ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tools/startup.nsh ${CMAKE_BINARY_DIR}/image/startup.nsh ) From d140557e17d181d02b8988c2d4d496ef2f332bd8 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Wed, 5 Jul 2023 21:49:26 +0800 Subject: [PATCH 25/37] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8A=BD=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 2 ++ cmake/header_files.cmake | 8 +++--- src/boot/CMakeLists.txt | 1 + src/boot/x86_64/boot.cpp | 52 +++++++------------------------------ src/kernel/include/kernel.h | 5 ++++ 5 files changed, 22 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f24162e8f..3dc65d6c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,6 +132,7 @@ ExternalProject_Add( -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DUSE_GNU_UEFI=${USE_GNU_UEFI} -DOUTPUT_NAME=${BOOT_ELF_OUTPUT_NAME} + -DROOT_DIR=${CMAKE_SOURCE_DIR} BUILD_COMMAND ${GENERATOR_COMMAND} INSTALL_COMMAND "" ) @@ -168,6 +169,7 @@ ExternalProject_Add( -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DUSE_GNU_UEFI=${USE_GNU_UEFI} -DOUTPUT_NAME=${KERNEL_ELF_OUTPUT_NAME} + -DROOT_DIR=${CMAKE_SOURCE_DIR} BUILD_COMMAND ${GENERATOR_COMMAND} INSTALL_COMMAND "" ) diff --git a/cmake/header_files.cmake b/cmake/header_files.cmake index c68661ef6..b41eced9f 100644 --- a/cmake/header_files.cmake +++ b/cmake/header_files.cmake @@ -6,17 +6,17 @@ # 将头文件路径添加到 Target 的搜索路径中 function(target_include_arch_header_files Target) - target_include_directories(${Target} PRIVATE ${CMAKE_SOURCE_DIR}/arch/${SimpleKernelArch}) + target_include_directories(${Target} PRIVATE ${ROOT_DIR}/src/arch/${SimpleKernelArch}) endfunction() function(target_include_kernel_header_files Target) - target_include_directories(${Target} PRIVATE ${CMAKE_SOURCE_DIR}/kernel/include) + target_include_directories(${Target} PRIVATE ${ROOT_DIR}/src/kernel/include) endfunction() function(target_include_gnu_efi_header_files Target) - target_include_directories(${Target} PRIVATE ${CMAKE_SOURCE_DIR}/../3rd/gnu-efi/inc) + target_include_directories(${Target} PRIVATE ${ROOT_DIR}/3rd/gnu-efi/inc) endfunction() function(target_include_posix_uefi_header_files Target) - target_include_directories(${Target} PRIVATE ${CMAKE_SOURCE_DIR}/../../3rd/posix-uefi/uefi) + target_include_directories(${Target} PRIVATE ${ROOT_DIR}/3rd/posix-uefi/uefi) endfunction() diff --git a/src/boot/CMakeLists.txt b/src/boot/CMakeLists.txt index 29efc16a0..268f1f0a9 100644 --- a/src/boot/CMakeLists.txt +++ b/src/boot/CMakeLists.txt @@ -44,5 +44,6 @@ endif () set_target_properties(boot PROPERTIES OUTPUT_NAME ${OUTPUT_NAME}) # 添加头文件搜索路径 +target_include_kernel_header_files(${PROJECT_NAME}) target_include_gnu_efi_header_files(${PROJECT_NAME}) target_include_posix_uefi_header_files(${PROJECT_NAME}) diff --git a/src/boot/x86_64/boot.cpp b/src/boot/x86_64/boot.cpp index 9d8480080..95b41ed79 100644 --- a/src/boot/x86_64/boot.cpp +++ b/src/boot/x86_64/boot.cpp @@ -18,9 +18,14 @@ # include "efi.h" # include "efilib.h" #else +# include "elf.h" # include "uefi.h" #endif +#include "cstdint" + +#include "kernel.h" + #if USE_GNU_UEFI == 1 /** @@ -45,52 +50,15 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { #else -/*** ELF64 defines and structs ***/ -# define ELFMAG "\177ELF" -# define SELFMAG 4 -# define EI_CLASS 4 /* File class byte index */ -# define ELFCLASS64 2 /* 64-bit objects */ -# define EI_DATA 5 /* Data encoding byte index */ -# define ELFDATA2LSB 1 /* 2's complement, little endian */ -# define ET_EXEC 2 /* Executable file */ -# define PT_LOAD 1 /* Loadable program segment */ # ifdef __x86_64__ -# define EM_MACH 62 /* AMD x86-64 architecture */ +# define EM_MACH EM_X86_64 # endif # ifdef __aarch64__ -# define EM_MACH 183 /* ARM aarch64 architecture */ +# define EM_MACH EM_AARCH64 # endif -typedef struct { - uint8_t e_ident[16]; /* Magic number and other info */ - uint16_t e_type; /* Object file type */ - uint16_t e_machine; /* Architecture */ - uint32_t e_version; /* Object file version */ - uint64_t e_entry; /* Entry point virtual address */ - uint64_t e_phoff; /* Program header table file offset */ - uint64_t e_shoff; /* Section header table file offset */ - uint32_t e_flags; /* Processor-specific flags */ - uint16_t e_ehsize; /* ELF header size in bytes */ - uint16_t e_phentsize; /* Program header table entry size */ - uint16_t e_phnum; /* Program header table entry count */ - uint16_t e_shentsize; /* Section header table entry size */ - uint16_t e_shnum; /* Section header table entry count */ - uint16_t e_shstrndx; /* Section header string table index */ -} Elf64_Ehdr; - -typedef struct { - uint32_t p_type; /* Segment type */ - uint32_t p_flags; /* Segment flags */ - uint64_t p_offset; /* Segment file offset */ - uint64_t p_vaddr; /* Segment virtual address */ - uint64_t p_paddr; /* Segment physical address */ - uint64_t p_filesz; /* Segment size in file */ - uint64_t p_memsz; /* Segment size in memory */ - uint64_t p_align; /* Segment alignment */ -} Elf64_Phdr; - /** - * Load an ELF executable + * @brief 进行系统初始化,加载内核 */ extern "C" int main(int argc, char** argv) { (void)argc; @@ -154,8 +122,8 @@ extern "C" int main(int argc, char** argv) { /* execute the "kernel" */ printf("ELF entry point %p\n", entry); - int (*entry_fp)(int, char**) = (int (*)(int, char**))entry; - i = entry_fp(0, nullptr); + entry_func entry_fp = (int (*)(int, char**))entry; + i = entry_fp(0, nullptr); printf("ELF returned %d\n", i); diff --git a/src/kernel/include/kernel.h b/src/kernel/include/kernel.h index 1aabb8313..c6bb9afde 100644 --- a/src/kernel/include/kernel.h +++ b/src/kernel/include/kernel.h @@ -17,6 +17,11 @@ #ifndef SIMPLEKERNEL_KERNEL_H #define SIMPLEKERNEL_KERNEL_H +/// 内核入口函数指针 +typedef int (*entry_func)(int, char**); + +/// 内核启动参数结构体 + /** * @brief 声明 kernel_main 用 C 方法编译 */ From 2ef8f85efad7968ac448b07d2631c1fc816e4005 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Thu, 6 Jul 2023 23:48:36 +0800 Subject: [PATCH 26/37] =?UTF-8?q?=E9=87=8D=E6=9E=84=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 15 +-- run.sh | 4 +- src/boot/x86_64/boot.cpp | 181 +++++++++++++++++++++--------------- src/kernel/include/kernel.h | 2 +- 4 files changed, 115 insertions(+), 87 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3dc65d6c2..abd6f3dcd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,28 +74,28 @@ add_custom_command(TARGET posixuefi COMMENT "Build 3rd/posix-uefi done." ) -add_custom_target(kernel_pre) +add_custom_target(deps) if (ARCH STREQUAL "riscv64") - add_custom_command(TARGET kernel_pre + add_custom_command(TARGET deps DEPENDS opensbi COMMAND make opensbi ) elseif (ARCH STREQUAL "x86_64") if (USE_GNU_UEFI STREQUAL "1") - add_custom_command(TARGET kernel_pre + add_custom_command(TARGET deps DEPENDS gnuefi COMMAND make gnuefi ) else () - add_custom_command(TARGET kernel_pre + add_custom_command(TARGET deps DEPENDS posixuefi COMMAND make posixuefi ) endif () elseif (ARCH STREQUAL "aarch64") - add_custom_command(TARGET kernel_pre + add_custom_command(TARGET deps DEPENDS gnuefi COMMAND make ARCH=${ARCH} gnuefi ) @@ -104,6 +104,7 @@ endif () # 引导 ExternalProject_Add( boot_elf + DEPENDS deps BUILD_ALWAYS 1 PREFIX ${CMAKE_BINARY_DIR} SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/boot @@ -140,7 +141,7 @@ ExternalProject_Add( # 内核本体 ExternalProject_Add( kernel - DEPENDS kernel_pre + DEPENDS deps BUILD_ALWAYS 1 PREFIX ${CMAKE_BINARY_DIR} SOURCE_DIR ${CMAKE_SOURCE_DIR}/src @@ -229,7 +230,7 @@ add_custom_command(TARGET boot_efi COMMENT "Build ${BOOT_EFI_OUTPUT_NAME} done." ) -add_custom_target(image_uefi DEPENDS boot_efi) +add_custom_target(image_uefi DEPENDS boot_efi kernel) add_custom_command(TARGET image_uefi COMMENT "Copying bootloader and kernel" COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/image/efi/boot diff --git a/run.sh b/run.sh index 00a530d34..84bb43f1c 100755 --- a/run.sh +++ b/run.sh @@ -13,8 +13,8 @@ set -e MACHINE=qemu -ARCH=riscv64 -# ARCH=x86_64 +#ARCH=riscv64 + ARCH=x86_64 # ARCH=aarch64 # 指定要使用的 efi diff --git a/src/boot/x86_64/boot.cpp b/src/boot/x86_64/boot.cpp index 95b41ed79..9f992afec 100644 --- a/src/boot/x86_64/boot.cpp +++ b/src/boot/x86_64/boot.cpp @@ -22,10 +22,109 @@ # include "uefi.h" #endif -#include "cstdint" - #include "kernel.h" +/// @todo 内核名称,由 cmake 传入 +#define KERNEL_ELF_OUTPUT_NAME "kernel.elf" + +/// 确定架构 +#ifdef __x86_64__ +# define EM_MACH EM_X86_64 +#endif +#ifdef __aarch64__ +# define EM_MACH EM_AARCH64 +#endif + +/** + * @brief 获取内核入口地址 + * @return entry_func 内核入口地址 + */ +static entry_func get_kernel_entry(void) { + // 打开内核 elf 文件 + auto kernel_file = fopen(KERNEL_ELF_OUTPUT_NAME, "r"); + if (kernel_file == nullptr) { + fprintf(stderr, "Unable to open file [%s]\n", KERNEL_ELF_OUTPUT_NAME); + return nullptr; + } + + // 获取内核大小 + fseek(kernel_file, 0, SEEK_END); + auto size = ftell(kernel_file); + // 将内核读入 buffer + fseek(kernel_file, 0, SEEK_SET); + auto kernel_buff = malloc(size + 1); + if (kernel_buff == nullptr) { + fprintf(stderr, "unable to allocate memory\n"); + return nullptr; + } + fread(kernel_buff, size, 1, kernel_file); + fclose(kernel_file); + + // 验证 elf 信息 + auto kernel_elf_header = (Elf64_Ehdr*)kernel_buff; + // magic 匹配 + auto is_magic = (memcmp(kernel_elf_header->e_ident, ELFMAG, SELFMAG) == 0); + if (is_magic == false) { + printf("is_magic == false\n"); + return nullptr; + } + // 是否为 64 位 + auto is_64bit = kernel_elf_header->e_ident[EI_CLASS] == ELFCLASS64; + if (is_64bit == false) { + printf("is_magic == false\n"); + return nullptr; + } + // 是否为 LSB + auto is_lsb = kernel_elf_header->e_ident[EI_DATA] == ELFDATA2LSB; + if (is_lsb == false) { + printf("is_magic == false\n"); + return nullptr; + } + // 是否可执行 + auto is_executable = kernel_elf_header->e_type == ET_EXEC; + if (is_executable == false) { + printf("is_magic == false\n"); + return nullptr; + } + // 架构是否匹配 + auto is_architecture = kernel_elf_header->e_machine == EM_MACH; + if (is_architecture == false) { + printf("is_magic == false\n"); + return nullptr; + } + // 是否包含程序头 + auto is_has_headers = kernel_elf_header->e_phnum > 0; + if (is_has_headers == false) { + printf("is_magic == false\n"); + return nullptr; + } + + // 加载段 + auto phdr + = (Elf64_Phdr*)((uint8_t*)kernel_buff + kernel_elf_header->e_phoff); + for (auto i = 0; i < kernel_elf_header->e_phnum; i++) { + if (phdr->p_type == PT_LOAD) { + printf("ELF segment %p %d bytes (bss %d bytes)\n", phdr->p_vaddr, + phdr->p_filesz, phdr->p_memsz - phdr->p_filesz); + // 将内核的各个段复制到对应的虚拟地址 + memcpy((void*)phdr->p_vaddr, (uint8_t*)kernel_buff + phdr->p_offset, + phdr->p_filesz); + memset((void*)(phdr->p_vaddr + phdr->p_filesz), 0, + phdr->p_memsz - phdr->p_filesz); + } + phdr = (Elf64_Phdr*)((uint8_t*)phdr + kernel_elf_header->e_phentsize); + } + + // 保存入口地址 + auto entry = (entry_func)kernel_elf_header->e_entry; + + free(kernel_buff); + + printf("ELF entry point %p\n", entry); + + return entry; +} + #if USE_GNU_UEFI == 1 /** @@ -50,84 +149,12 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { #else -# ifdef __x86_64__ -# define EM_MACH EM_X86_64 -# endif -# ifdef __aarch64__ -# define EM_MACH EM_AARCH64 -# endif - /** * @brief 进行系统初始化,加载内核 */ -extern "C" int main(int argc, char** argv) { - (void)argc; - (void)argv; - FILE* f; - char* buff; - long int size; - Elf64_Ehdr* elf; - Elf64_Phdr* phdr; - uintptr_t entry; - int i; - - /* load the file */ - if ((f = fopen("kernel.elf", "r"))) { - fseek(f, 0, SEEK_END); - size = ftell(f); - fseek(f, 0, SEEK_SET); - buff = (char*)malloc(size + 1); - if (!buff) { - fprintf(stderr, "unable to allocate memory\n"); - return 1; - } - fread(buff, size, 1, f); - fclose(f); - } - else { - fprintf(stderr, "Unable to open file\n"); - return 0; - } - - /* is it a valid ELF executable for this architecture? */ - elf = (Elf64_Ehdr*)buff; - if (!memcmp(elf->e_ident, ELFMAG, SELFMAG) && /* magic match? */ - elf->e_ident[EI_CLASS] == ELFCLASS64 && /* 64 bit? */ - elf->e_ident[EI_DATA] == ELFDATA2LSB && /* LSB? */ - elf->e_type == ET_EXEC && /* executable object? */ - elf->e_machine == EM_MACH && /* architecture match? */ - elf->e_phnum > 0) { /* has program headers? */ - /* load segments */ - for (phdr = (Elf64_Phdr*)(buff + elf->e_phoff), i = 0; i < elf->e_phnum; - i++, phdr = (Elf64_Phdr*)((uint8_t*)phdr + elf->e_phentsize)) { - if (phdr->p_type == PT_LOAD) { - printf("ELF segment %p %d bytes (bss %d bytes)\n", - phdr->p_vaddr, phdr->p_filesz, - phdr->p_memsz - phdr->p_filesz); - memcpy((void*)phdr->p_vaddr, buff + phdr->p_offset, - phdr->p_filesz); - memset((void*)(phdr->p_vaddr + phdr->p_filesz), 0, - phdr->p_memsz - phdr->p_filesz); - } - } - entry = elf->e_entry; - } - else { - fprintf(stderr, "not a valid ELF executable for this architecture\n"); - return 0; - } - /* free resources */ - free(buff); - - /* execute the "kernel" */ - printf("ELF entry point %p\n", entry); - - entry_func entry_fp = (int (*)(int, char**))entry; - i = entry_fp(0, nullptr); - - printf("ELF returned %d\n", i); - - return 0; +extern "C" int main(int _argc, char** _argv) { + auto kernel_entry = get_kernel_entry(); + return kernel_entry(_argc, _argv); } #endif diff --git a/src/kernel/include/kernel.h b/src/kernel/include/kernel.h index c6bb9afde..e56a78881 100644 --- a/src/kernel/include/kernel.h +++ b/src/kernel/include/kernel.h @@ -20,7 +20,7 @@ /// 内核入口函数指针 typedef int (*entry_func)(int, char**); -/// 内核启动参数结构体 +/// @todo 内核启动参数结构体 /** * @brief 声明 kernel_main 用 C 方法编译 From 34315caad5819a92b3ee18f6c4109ad393706423 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 10 Jul 2023 22:17:53 +0800 Subject: [PATCH 27/37] =?UTF-8?q?=E9=87=8D=E6=9E=84=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- README.md | 55 ++++++++++++++++++- src/boot/x86_64/boot.cpp | 114 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 165 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e253c7ee1..7a8ae9ea9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,57 @@ # boot -系统启动 +## 本分支新增特性 -支持:i386, x86_64, riscv64 +基本的构建体系与辅助脚本,包括 + +- 对不同体系结构的支持 + + 目前支持 x86_64,aarch64,riscv64 三种架构 + + 支持在 qemu 平台上运行 + + 支持在 x86_64 架构的 osx、win(wsl)、linux(ubuntu) 上编译运行 + +- 对 uefi 与 opensbi 的支持 + + x86_64 与 aarch64 架构通过 uefi 进行引导 + + riscv64 通过 opensbi 进行引导 + +- 对 qemu 的支持 + + 通过 qemu 进行模拟 + +- 对使用 qemu gdb 进行调试的支持 + + 通过生成内核调试符号、向 qemu 传递正确的参数,达到使用 gdb 进行调试,观察内核的目标 + +- 对 clion 的支持 + + clion 的配置文件与用法 + +- 对第三方代码的支持 + + 用到的第三方库的自动下载、编译 + +- 对项目的约束 + + 代码规范、commit 规范 + +编译参数的确定 + +- 汇总到 config.cmake + +从系统启动到进入内核 + +- x86_64,aarch64 通过 uefi 进行引导 +- riscvf64 通过 opensbi 进行引导 + +## 已支持的全部特性 + +- poxix-uefi +- gnu-efi +- x86_64 +- aarch64 +- uefi diff --git a/src/boot/x86_64/boot.cpp b/src/boot/x86_64/boot.cpp index 9f992afec..bacf466bd 100644 --- a/src/boot/x86_64/boot.cpp +++ b/src/boot/x86_64/boot.cpp @@ -35,6 +35,115 @@ # define EM_MACH EM_AARCH64 #endif +/** + * List memory map + */ +int get_memory_map(void) { + efi_status_t status; + efi_memory_descriptor_t* memory_map = nullptr; + efi_memory_descriptor_t* mement; + uintn_t memory_map_size = 0; + uintn_t map_key = 0; + uintn_t desc_size = 0; + const char* types[] = { "EfiReservedMemoryType", + "EfiLoaderCode", + "EfiLoaderData", + "EfiBootServicesCode", + "EfiBootServicesData", + "EfiRuntimeServicesCode", + "EfiRuntimeServicesData", + "EfiConventionalMemory", + "EfiUnusableMemory", + "EfiACPIReclaimMemory", + "EfiACPIMemoryNVS", + "EfiMemoryMappedIO", + "EfiMemoryMappedIOPortSpace", + "EfiPalCode" }; + + /* get the memory map */ + status + = BS->GetMemoryMap(&memory_map_size, nullptr, &map_key, &desc_size, nullptr); + if (status != EFI_BUFFER_TOO_SMALL || !memory_map_size) { + fprintf(stderr, "status != EFI_BUFFER_TOO_SMALL [0x%X] || !memory_map_size [%d], desc_size [%d]\n",status,memory_map_size,desc_size); + return 0; + } + /* in worst case malloc allocates two blocks, and each block might split a + * record into three, that's 4 additional records */ + memory_map_size += 4 * desc_size; + memory_map = (efi_memory_descriptor_t*)malloc(memory_map_size); + if (!memory_map) { + fprintf(stderr, "!memory_map\n"); + return 1; + } + status = BS->GetMemoryMap(&memory_map_size, memory_map, &map_key, + &desc_size, nullptr); + if (EFI_ERROR(status)) { + fprintf(stderr, "Unable to get memory map\n"); + return 0; + } + + printf("Address Size Type\n"); + for (mement = memory_map; + (uint8_t*)mement < (uint8_t*)memory_map + memory_map_size; + mement = NextMemoryDescriptor(mement, desc_size)) { + printf("%016x %8d %02x %s\n", mement->PhysicalStart, + mement->NumberOfPages, mement->Type, types[mement->Type]); + } + + free(memory_map); + return 0; + +// #if defined(__x86_64__) +// EFI_SYSTEM_TABLE* systemTable = (EFI_SYSTEM_TABLE*)_systemtable; +// EFI_STATUS status +// = uefi_call_wrapper(systemTable->ConOut->OutputString, 2, +// systemTable->ConOut, L"Hello UEFI111!\n"); + +// EFI_STATUS Status; +// EFI_MEMORY_DESCRIPTOR* EfiMemoryMap; +// ptrdiff_t EfiMemoryMapSize; +// ptrdiff_t EfiMapKey; +// ptrdiff_t EfiDescriptorSize; +// UINT32 EfiDescriptorVersion; + +// // +// // Get the EFI memory map. +// // +// EfiMemoryMapSize = 0; +// EfiMemoryMap = nullptr; +// Status = uefi_call_wrapper(systemTable->BootServices->GetMemoryMap, 5, +// &EfiMemoryMapSize, EfiMemoryMap, &EfiMapKey, +// &EfiDescriptorSize, &EfiDescriptorVersion); +// ASSERT(Status == EFI_BUFFER_TOO_SMALL); + +// // +// // Use size returned for the AllocatePool. +// // +// EfiMemoryMap +// = (EFI_MEMORY_DESCRIPTOR*)AllocatePool(EfiMemoryMapSize +// + 2 * EfiDescriptorSize); +// ASSERT(EfiMemoryMap != nullptr); +// Status = uefi_call_wrapper(systemTable->BootServices->GetMemoryMap, 5, +// &EfiMemoryMapSize, EfiMemoryMap, &EfiMapKey, +// &EfiDescriptorSize, &EfiDescriptorVersion); +// if (EFI_ERROR(Status)) { +// FreePool(EfiMemoryMap); +// } + +// // +// // Get descriptors +// // +// EFI_MEMORY_DESCRIPTOR* EfiEntry = EfiMemoryMap; +// do { +// // ... do something with EfiEntry ... +// EfiEntry = NextMemoryDescriptor(EfiEntry, EfiDescriptorSize); + +// } while ((UINT8*)EfiEntry < (UINT8*)EfiMemoryMap + EfiMemoryMapSize); + +// #endif + +} + /** * @brief 获取内核入口地址 * @return entry_func 内核入口地址 @@ -133,7 +242,7 @@ static entry_func get_kernel_entry(void) { * @SystemTable: EFI system table */ extern "C" EFI_STATUS -efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { +efi_main(void* systemTable) { // uefi_call_wrapper(InitializeLib, 2, image, systemTable); // EFI_STATUS status = uefi_call_wrapper(systemTable->ConOut->ClearScreen, // 1, @@ -153,8 +262,9 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable) { * @brief 进行系统初始化,加载内核 */ extern "C" int main(int _argc, char** _argv) { + get_memory_map(); auto kernel_entry = get_kernel_entry(); - return kernel_entry(_argc, _argv); + return kernel_entry(_argc, _argv); } #endif From a7e9da9f475830a7238c464508b84037fb5c21b3 Mon Sep 17 00:00:00 2001 From: KehRoche Date: Mon, 10 Jul 2023 22:34:59 +0800 Subject: [PATCH 28/37] =?UTF-8?q?=E9=87=8D=E6=9E=84=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- CMakeLists.txt | 2 -- cmake/config.cmake | 20 +++++++------------- run.sh | 4 ++-- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abd6f3dcd..7f10cd470 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,7 +128,6 @@ ExternalProject_Add( -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS_BOOT} - -DCMAKE_ASM_FLAGS=${CMAKE_ASM_FLAGS_BOOT} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS_BOOT} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DUSE_GNU_UEFI=${USE_GNU_UEFI} @@ -165,7 +164,6 @@ ExternalProject_Add( -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS_KERNEL} - -DCMAKE_ASM_FLAGS=${CMAKE_ASM_FLAGS_KERNEL} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS_KERNEL} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DUSE_GNU_UEFI=${USE_GNU_UEFI} diff --git a/cmake/config.cmake b/cmake/config.cmake index a9198a6af..55536def7 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -17,6 +17,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) +# 设置 cmake 编译结果输出路径 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -30,11 +31,10 @@ set(VALID_MACHINE qemu) if (NOT DEFINED MACHINE) set(MACHINE qemu) endif () -message("MACHINE is: ${MACHINE}") - if (NOT MACHINE IN_LIST VALID_MACHINE) - message(FATAL_ERROR "MACHINE must be one of ${VALID_MACHINE}") +message(FATAL_ERROR "MACHINE must be one of ${VALID_MACHINE}") endif () +message("MACHINE is: ${MACHINE}") # 架构 set(VALID_ARCH riscv64 x86_64 aarch64) @@ -42,11 +42,10 @@ set(VALID_ARCH riscv64 x86_64 aarch64) if (NOT DEFINED ARCH) set(ARCH riscv64) endif () -message("ARCH is: ${ARCH}") - if (NOT ARCH IN_LIST VALID_ARCH) - message(FATAL_ERROR "ARCH must be one of ${VALID_ARCH}") +message(FATAL_ERROR "ARCH must be one of ${VALID_ARCH}") endif () +message("ARCH is: ${ARCH}") # 指定要使用的 efi if (USE_GNU_UEFI STREQUAL "1") @@ -84,10 +83,10 @@ set(COMMON_FLAGS # 架构相关编译选项 # @todo clang 交叉编译参数 if (ARCH STREQUAL "riscv64") - set(ARCH_FLAGS "-march=rv64imafdc") + set(ARCH_FLAGS "") elseif (ARCH STREQUAL "x86_64") set(ARCH_FLAGS - "-march=corei7 -mtune=corei7 -m64 -mno-red-zone -z max-page-size=0x1000" + "-mno-red-zone -z max-page-size=0x1000" ) elseif (ARCH STREQUAL "aarch64") set(ARCH_FLAGS "-march=armv8-a -mtune=cortex-a72") @@ -96,15 +95,10 @@ endif () set(CMAKE_C_FLAGS_KERNEL "${DEBUG_FLAGS} ${OPTIMIZE_FLAGS} ${COMMON_FLAGS} ${ARCH_FLAGS} " ) - set(CMAKE_C_FLAGS_BOOT "${CMAKE_C_FLAGS_KERNEL} -no-pie -fPIC -Wl,-shared -Wl,-Bsymbolic" ) -# 将编译选项同步到汇编 -set(CMAKE_ASM_FLAGS_KERNEL "${CMAKE_C_FLAGS_KERNEL}") -set(CMAKE_ASM_FLAGS_BOOT "${CMAKE_C_FLAGS_BOOT}") - # 将编译选项同步到 c++ set(CMAKE_CXX_FLAGS_KERNEL "${CMAKE_C_FLAGS_KERNEL} -fpermissive") diff --git a/run.sh b/run.sh index 84bb43f1c..e29a9822c 100755 --- a/run.sh +++ b/run.sh @@ -13,8 +13,8 @@ set -e MACHINE=qemu -#ARCH=riscv64 - ARCH=x86_64 +ARCH=riscv64 +# ARCH=x86_64 # ARCH=aarch64 # 指定要使用的 efi From 486bda66bfd0aa8344b681a0eeef03bb7050ad0f Mon Sep 17 00:00:00 2001 From: KehRoche Date: Sun, 10 Sep 2023 09:02:36 +0800 Subject: [PATCH 29/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=203rd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: KehRoche --- 3rd/gnu-efi/.gitignore | 6 - 3rd/gnu-efi/ChangeLog | 1324 --- 3rd/gnu-efi/Make.defaults | 204 - 3rd/gnu-efi/Make.rules | 64 - 3rd/gnu-efi/Makefile | 131 - 3rd/gnu-efi/README.efilib | 30 - 3rd/gnu-efi/README.elilo | 19 - 3rd/gnu-efi/README.git | 21 - 3rd/gnu-efi/README.gnuefi | 405 - 3rd/gnu-efi/apps/AllocPages.c | 184 - 3rd/gnu-efi/apps/FreePages.c | 145 - 3rd/gnu-efi/apps/Makefile | 103 - 3rd/gnu-efi/apps/bltgrid.c | 133 - 3rd/gnu-efi/apps/ctors_fns.c | 26 - 3rd/gnu-efi/apps/ctors_test.c | 20 - 3rd/gnu-efi/apps/debughook.c | 97 - 3rd/gnu-efi/apps/drv0.c | 191 - 3rd/gnu-efi/apps/drv0.h | 35 - 3rd/gnu-efi/apps/drv0_use.c | 79 - 3rd/gnu-efi/apps/exit.c | 12 - 3rd/gnu-efi/apps/lfbgrid.c | 171 - 3rd/gnu-efi/apps/modelist.c | 108 - 3rd/gnu-efi/apps/printenv.c | 32 - 3rd/gnu-efi/apps/route80h.c | 136 - 3rd/gnu-efi/apps/setdbg.c | 37 - 3rd/gnu-efi/apps/setjmp.c | 32 - 3rd/gnu-efi/apps/t.c | 27 - 3rd/gnu-efi/apps/t2.c | 14 - 3rd/gnu-efi/apps/t3.c | 95 - 3rd/gnu-efi/apps/t4.c | 14 - 3rd/gnu-efi/apps/t5.c | 13 - 3rd/gnu-efi/apps/t6.c | 43 - 3rd/gnu-efi/apps/t7.c | 25 - 3rd/gnu-efi/apps/t8.c | 19 - 3rd/gnu-efi/apps/tcc.c | 431 - 3rd/gnu-efi/apps/tpause.c | 9 - 3rd/gnu-efi/apps/trivial.S | 47 - 3rd/gnu-efi/apps/unsetdbg.c | 37 - 3rd/gnu-efi/gnuefi/Makefile | 89 - 3rd/gnu-efi/gnuefi/crt0-efi-aarch64.S | 57 - 3rd/gnu-efi/gnuefi/crt0-efi-arm.S | 149 - 3rd/gnu-efi/gnuefi/crt0-efi-ia32.S | 81 - 3rd/gnu-efi/gnuefi/crt0-efi-ia64.S | 91 - 3rd/gnu-efi/gnuefi/crt0-efi-loongarch64.S | 151 - 3rd/gnu-efi/gnuefi/crt0-efi-mips64el.S | 192 - 3rd/gnu-efi/gnuefi/crt0-efi-riscv64.S | 140 - 3rd/gnu-efi/gnuefi/crt0-efi-x86_64.S | 80 - 3rd/gnu-efi/gnuefi/elf_aarch64_efi.lds | 106 - 3rd/gnu-efi/gnuefi/elf_arm_efi.lds | 92 - 3rd/gnu-efi/gnuefi/elf_ia32_efi.lds | 99 - 3rd/gnu-efi/gnuefi/elf_ia32_fbsd_efi.lds | 107 - 3rd/gnu-efi/gnuefi/elf_ia64_efi.lds | 108 - 3rd/gnu-efi/gnuefi/elf_loongarch64_efi.lds | 63 - 3rd/gnu-efi/gnuefi/elf_mips64el_efi.lds | 94 - 3rd/gnu-efi/gnuefi/elf_riscv64_efi.lds | 80 - 3rd/gnu-efi/gnuefi/elf_x86_64_efi.lds | 99 - 3rd/gnu-efi/gnuefi/elf_x86_64_fbsd_efi.lds | 91 - 3rd/gnu-efi/gnuefi/gnu-efi.pc.in | 10 - 3rd/gnu-efi/gnuefi/reloc_aarch64.c | 97 - 3rd/gnu-efi/gnuefi/reloc_arm.c | 97 - 3rd/gnu-efi/gnuefi/reloc_ia32.c | 99 - 3rd/gnu-efi/gnuefi/reloc_ia64.S | 231 - 3rd/gnu-efi/gnuefi/reloc_loongarch64.c | 104 - 3rd/gnu-efi/gnuefi/reloc_mips64el.c | 115 - 3rd/gnu-efi/gnuefi/reloc_riscv64.c | 91 - 3rd/gnu-efi/gnuefi/reloc_x86_64.c | 98 - 3rd/gnu-efi/inc/Makefile | 27 - 3rd/gnu-efi/inc/aarch64/efibind.h | 160 - 3rd/gnu-efi/inc/aarch64/efilibplat.h | 25 - 3rd/gnu-efi/inc/aarch64/efisetjmp_arch.h | 34 - 3rd/gnu-efi/inc/arm/efibind.h | 168 - 3rd/gnu-efi/inc/arm/efilibplat.h | 25 - 3rd/gnu-efi/inc/arm/efisetjmp_arch.h | 21 - 3rd/gnu-efi/inc/efi.h | 82 - 3rd/gnu-efi/inc/efi_nii.h | 78 - 3rd/gnu-efi/inc/efi_pxe.h | 1743 ---- 3rd/gnu-efi/inc/efiapi.h | 989 --- 3rd/gnu-efi/inc/eficompiler.h | 30 - 3rd/gnu-efi/inc/eficon.h | 306 - 3rd/gnu-efi/inc/eficonex.h | 111 - 3rd/gnu-efi/inc/efidebug.h | 620 -- 3rd/gnu-efi/inc/efidef.h | 240 - 3rd/gnu-efi/inc/efidevp.h | 650 -- 3rd/gnu-efi/inc/efierr.h | 68 - 3rd/gnu-efi/inc/efifs.h | 116 - 3rd/gnu-efi/inc/efigpt.h | 68 - 3rd/gnu-efi/inc/efiip.h | 459 -- 3rd/gnu-efi/inc/efilib.h | 1081 --- 3rd/gnu-efi/inc/efilink.h | 182 - 3rd/gnu-efi/inc/efinet.h | 348 - 3rd/gnu-efi/inc/efipart.h | 61 - 3rd/gnu-efi/inc/efipciio.h | 399 - 3rd/gnu-efi/inc/efipoint.h | 115 - 3rd/gnu-efi/inc/efiprot.h | 1431 ---- 3rd/gnu-efi/inc/efipxebc.h | 482 -- 3rd/gnu-efi/inc/efirtlib.h | 193 - 3rd/gnu-efi/inc/efiser.h | 136 - 3rd/gnu-efi/inc/efisetjmp.h | 10 - 3rd/gnu-efi/inc/efishell.h | 449 -- 3rd/gnu-efi/inc/efishellintf.h | 94 - 3rd/gnu-efi/inc/efistdarg.h | 33 - 3rd/gnu-efi/inc/efitcp.h | 391 - 3rd/gnu-efi/inc/efiudp.h | 272 - 3rd/gnu-efi/inc/efiui.h | 58 - 3rd/gnu-efi/inc/ia32/efibind.h | 294 - 3rd/gnu-efi/inc/ia32/efilibplat.h | 26 - 3rd/gnu-efi/inc/ia32/efisetjmp_arch.h | 15 - 3rd/gnu-efi/inc/ia32/pe.h | 595 -- 3rd/gnu-efi/inc/ia64/efibind.h | 236 - 3rd/gnu-efi/inc/ia64/efilibplat.h | 80 - 3rd/gnu-efi/inc/ia64/efisetjmp_arch.h | 47 - 3rd/gnu-efi/inc/ia64/pe.h | 601 -- 3rd/gnu-efi/inc/ia64/salproc.h | 264 - 3rd/gnu-efi/inc/inc.mak | 23 - 3rd/gnu-efi/inc/lib.h | 92 - 3rd/gnu-efi/inc/libsmbios.h | 143 - 3rd/gnu-efi/inc/loongarch64/efibind.h | 157 - 3rd/gnu-efi/inc/loongarch64/efilibplat.h | 24 - 3rd/gnu-efi/inc/loongarch64/efisetjmp_arch.h | 23 - 3rd/gnu-efi/inc/make.inf | 33 - 3rd/gnu-efi/inc/makefile.hdr | 48 - 3rd/gnu-efi/inc/mips64el/efibind.h | 168 - 3rd/gnu-efi/inc/mips64el/efilibplat.h | 25 - 3rd/gnu-efi/inc/mips64el/efisetjmp_arch.h | 34 - 3rd/gnu-efi/inc/pci22.h | 193 - 3rd/gnu-efi/inc/protocol/adapterdebug.h | 32 - 3rd/gnu-efi/inc/protocol/eficonsplit.h | 32 - 3rd/gnu-efi/inc/protocol/efidbg.h | 210 - 3rd/gnu-efi/inc/protocol/efivar.h | 133 - 3rd/gnu-efi/inc/protocol/ia64/eficontext.h | 208 - 3rd/gnu-efi/inc/protocol/intload.h | 27 - 3rd/gnu-efi/inc/protocol/legacyboot.h | 119 - 3rd/gnu-efi/inc/protocol/make.inf | 13 - 3rd/gnu-efi/inc/protocol/makefile.hdr | 29 - 3rd/gnu-efi/inc/protocol/piflash64.h | 121 - 3rd/gnu-efi/inc/protocol/readme.txt | 3 - 3rd/gnu-efi/inc/protocol/vgaclass.h | 95 - 3rd/gnu-efi/inc/riscv64/efibind.h | 130 - 3rd/gnu-efi/inc/riscv64/efilibplat.h | 7 - 3rd/gnu-efi/inc/riscv64/efisetjmp_arch.h | 40 - 3rd/gnu-efi/inc/romload.h | 41 - 3rd/gnu-efi/inc/x86_64/efibind.h | 396 - 3rd/gnu-efi/inc/x86_64/efilibplat.h | 26 - 3rd/gnu-efi/inc/x86_64/efisetjmp_arch.h | 22 - 3rd/gnu-efi/inc/x86_64/pe.h | 595 -- 3rd/gnu-efi/lib/Makefile | 93 - 3rd/gnu-efi/lib/aarch64/efi_stub.S | 5 - 3rd/gnu-efi/lib/aarch64/initplat.c | 26 - 3rd/gnu-efi/lib/aarch64/math.c | 63 - 3rd/gnu-efi/lib/aarch64/setjmp.S | 64 - 3rd/gnu-efi/lib/arm/div.S | 159 - 3rd/gnu-efi/lib/arm/edk2asm.h | 6 - 3rd/gnu-efi/lib/arm/efi_stub.S | 5 - 3rd/gnu-efi/lib/arm/initplat.c | 34 - 3rd/gnu-efi/lib/arm/ldivmod.S | 62 - 3rd/gnu-efi/lib/arm/llsl.S | 45 - 3rd/gnu-efi/lib/arm/llsr.S | 45 - 3rd/gnu-efi/lib/arm/math.c | 67 - 3rd/gnu-efi/lib/arm/mullu.S | 37 - 3rd/gnu-efi/lib/arm/setjmp.S | 29 - 3rd/gnu-efi/lib/arm/uldiv.S | 269 - 3rd/gnu-efi/lib/boxdraw.c | 173 - 3rd/gnu-efi/lib/cmdline.c | 119 - 3rd/gnu-efi/lib/console.c | 104 - 3rd/gnu-efi/lib/crc.c | 218 - 3rd/gnu-efi/lib/ctors.S | 47 - 3rd/gnu-efi/lib/data.c | 218 - 3rd/gnu-efi/lib/debug.c | 43 - 3rd/gnu-efi/lib/dpath.c | 1262 --- 3rd/gnu-efi/lib/entry.c | 67 - 3rd/gnu-efi/lib/error.c | 83 - 3rd/gnu-efi/lib/event.c | 154 - 3rd/gnu-efi/lib/exit.c | 19 - 3rd/gnu-efi/lib/guid.c | 179 - 3rd/gnu-efi/lib/hand.c | 641 -- 3rd/gnu-efi/lib/hw.c | 132 - 3rd/gnu-efi/lib/ia32/efi_stub.S | 5 - 3rd/gnu-efi/lib/ia32/initplat.c | 27 - 3rd/gnu-efi/lib/ia32/math.c | 199 - 3rd/gnu-efi/lib/ia32/setjmp.S | 49 - 3rd/gnu-efi/lib/ia64/initplat.c | 30 - 3rd/gnu-efi/lib/ia64/math.c | 88 - 3rd/gnu-efi/lib/ia64/palproc.S | 164 - 3rd/gnu-efi/lib/ia64/palproc.h | 51 - 3rd/gnu-efi/lib/ia64/salpal.c | 335 - 3rd/gnu-efi/lib/ia64/setjmp.S | 203 - 3rd/gnu-efi/lib/init.c | 209 - 3rd/gnu-efi/lib/lock.c | 107 - 3rd/gnu-efi/lib/loongarch64/efi_stub.S | 1 - 3rd/gnu-efi/lib/loongarch64/initplat.c | 26 - 3rd/gnu-efi/lib/loongarch64/math.c | 63 - 3rd/gnu-efi/lib/loongarch64/setjmp.S | 68 - 3rd/gnu-efi/lib/mips64el/efi_stub.S | 5 - 3rd/gnu-efi/lib/mips64el/initplat.c | 26 - 3rd/gnu-efi/lib/mips64el/math.c | 63 - 3rd/gnu-efi/lib/mips64el/setjmp.S | 96 - 3rd/gnu-efi/lib/misc.c | 563 -- 3rd/gnu-efi/lib/pause.c | 15 - 3rd/gnu-efi/lib/print.c | 1552 ---- 3rd/gnu-efi/lib/riscv64/initplat.c | 11 - 3rd/gnu-efi/lib/riscv64/math.c | 62 - 3rd/gnu-efi/lib/riscv64/setjmp.S | 73 - 3rd/gnu-efi/lib/runtime/efirtlib.c | 155 - 3rd/gnu-efi/lib/runtime/rtdata.c | 65 - 3rd/gnu-efi/lib/runtime/rtlock.c | 102 - 3rd/gnu-efi/lib/runtime/rtstr.c | 231 - 3rd/gnu-efi/lib/runtime/vm.c | 105 - 3rd/gnu-efi/lib/smbios.c | 135 - 3rd/gnu-efi/lib/sread.c | 358 - 3rd/gnu-efi/lib/str.c | 432 - 3rd/gnu-efi/lib/x86_64/callwrap.c | 40 - 3rd/gnu-efi/lib/x86_64/efi_stub.S | 193 - 3rd/gnu-efi/lib/x86_64/initplat.c | 27 - 3rd/gnu-efi/lib/x86_64/math.c | 181 - 3rd/gnu-efi/lib/x86_64/setjmp.S | 45 - 3rd/opensbi/.clang-format | 16 - 3rd/opensbi/.gitignore | 13 - 3rd/opensbi/CONTRIBUTORS.md | 27 - 3rd/opensbi/COPYING.BSD | 25 - 3rd/opensbi/Kconfig | 25 - 3rd/opensbi/Makefile | 677 -- 3rd/opensbi/README.md | 383 - 3rd/opensbi/ThirdPartyNotices.md | 18 - 3rd/opensbi/docs/contributing.md | 84 - 3rd/opensbi/docs/domain_support.md | 314 - 3rd/opensbi/docs/doxygen.cfg | 2462 ------ 3rd/opensbi/docs/external/coreboot.md | 32 - 3rd/opensbi/docs/firmware/fw.md | 124 - 3rd/opensbi/docs/firmware/fw_dynamic.md | 36 - 3rd/opensbi/docs/firmware/fw_jump.md | 67 - 3rd/opensbi/docs/firmware/fw_payload.md | 72 - 3rd/opensbi/docs/firmware/payload_linux.md | 9 - 3rd/opensbi/docs/firmware/payload_uboot.md | 15 - 3rd/opensbi/docs/library_usage.md | 85 - 3rd/opensbi/docs/platform/andes-ae350.md | 207 - 3rd/opensbi/docs/platform/fpga-ariane.md | 38 - 3rd/opensbi/docs/platform/fpga-openpiton.md | 33 - 3rd/opensbi/docs/platform/generic.md | 62 - 3rd/opensbi/docs/platform/nuclei_ux600.md | 22 - 3rd/opensbi/docs/platform/platform.md | 61 - 3rd/opensbi/docs/platform/qemu_virt.md | 173 - 3rd/opensbi/docs/platform/renesas-rzfive.md | 160 - 3rd/opensbi/docs/platform/shakti_cclass.md | 33 - 3rd/opensbi/docs/platform/sifive_fu540.md | 196 - 3rd/opensbi/docs/platform/spike.md | 100 - 3rd/opensbi/docs/platform/thead-c9xx.md | 196 - 3rd/opensbi/docs/platform_guide.md | 43 - 3rd/opensbi/docs/platform_requirements.md | 44 - 3rd/opensbi/docs/pmu_support.md | 127 - 3rd/opensbi/firmware/Kconfig | 1 - 3rd/opensbi/firmware/external_deps.mk | 14 - 3rd/opensbi/firmware/fw_base.S | 835 -- 3rd/opensbi/firmware/fw_base.ldS | 92 - 3rd/opensbi/firmware/fw_dynamic.S | 143 - 3rd/opensbi/firmware/fw_dynamic.elf.ldS | 18 - 3rd/opensbi/firmware/fw_jump.S | 96 - 3rd/opensbi/firmware/fw_jump.elf.ldS | 18 - 3rd/opensbi/firmware/fw_payload.S | 97 - 3rd/opensbi/firmware/fw_payload.elf.ldS | 32 - 3rd/opensbi/firmware/objects.mk | 68 - 3rd/opensbi/firmware/payloads/objects.mk | 19 - 3rd/opensbi/firmware/payloads/test.elf.ldS | 85 - 3rd/opensbi/firmware/payloads/test_head.S | 88 - 3rd/opensbi/firmware/payloads/test_main.c | 49 - 3rd/opensbi/include/sbi/fw_dynamic.h | 115 - 3rd/opensbi/include/sbi/riscv_asm.h | 192 - 3rd/opensbi/include/sbi/riscv_atomic.h | 70 - 3rd/opensbi/include/sbi/riscv_barrier.h | 60 - 3rd/opensbi/include/sbi/riscv_elf.h | 14 - 3rd/opensbi/include/sbi/riscv_encoding.h | 919 --- 3rd/opensbi/include/sbi/riscv_fp.h | 107 - 3rd/opensbi/include/sbi/riscv_io.h | 114 - 3rd/opensbi/include/sbi/riscv_locks.h | 45 - 3rd/opensbi/include/sbi/sbi_bitmap.h | 128 - 3rd/opensbi/include/sbi/sbi_bitops.h | 250 - 3rd/opensbi/include/sbi/sbi_console.h | 61 - 3rd/opensbi/include/sbi/sbi_const.h | 48 - 3rd/opensbi/include/sbi/sbi_csr_detect.h | 53 - 3rd/opensbi/include/sbi/sbi_domain.h | 203 - 3rd/opensbi/include/sbi/sbi_ecall.h | 52 - 3rd/opensbi/include/sbi/sbi_ecall_interface.h | 257 - 3rd/opensbi/include/sbi/sbi_emulate_csr.h | 23 - 3rd/opensbi/include/sbi/sbi_error.h | 40 - 3rd/opensbi/include/sbi/sbi_fifo.h | 42 - 3rd/opensbi/include/sbi/sbi_hart.h | 92 - 3rd/opensbi/include/sbi/sbi_hartmask.h | 141 - 3rd/opensbi/include/sbi/sbi_hfence.h | 39 - 3rd/opensbi/include/sbi/sbi_hsm.h | 73 - 3rd/opensbi/include/sbi/sbi_illegal_insn.h | 19 - 3rd/opensbi/include/sbi/sbi_init.h | 23 - 3rd/opensbi/include/sbi/sbi_ipi.h | 88 - 3rd/opensbi/include/sbi/sbi_irqchip.h | 44 - 3rd/opensbi/include/sbi/sbi_list.h | 163 - 3rd/opensbi/include/sbi/sbi_math.h | 15 - 3rd/opensbi/include/sbi/sbi_misaligned_ldst.h | 23 - 3rd/opensbi/include/sbi/sbi_platform.h | 666 -- 3rd/opensbi/include/sbi/sbi_pmu.h | 135 - 3rd/opensbi/include/sbi/sbi_scratch.h | 188 - 3rd/opensbi/include/sbi/sbi_string.h | 46 - 3rd/opensbi/include/sbi/sbi_system.h | 46 - 3rd/opensbi/include/sbi/sbi_timer.h | 102 - 3rd/opensbi/include/sbi/sbi_tlb.h | 60 - 3rd/opensbi/include/sbi/sbi_trap.h | 236 - 3rd/opensbi/include/sbi/sbi_types.h | 116 - 3rd/opensbi/include/sbi/sbi_unpriv.h | 41 - 3rd/opensbi/include/sbi/sbi_version.h | 24 - .../include/sbi_utils/fdt/fdt_domain.h | 82 - 3rd/opensbi/include/sbi_utils/fdt/fdt_fixup.h | 102 - .../include/sbi_utils/fdt/fdt_helper.h | 115 - 3rd/opensbi/include/sbi_utils/fdt/fdt_pmu.h | 56 - 3rd/opensbi/include/sbi_utils/gpio/fdt_gpio.h | 36 - 3rd/opensbi/include/sbi_utils/gpio/gpio.h | 107 - 3rd/opensbi/include/sbi_utils/i2c/fdt_i2c.h | 26 - 3rd/opensbi/include/sbi_utils/i2c/i2c.h | 85 - .../include/sbi_utils/ipi/aclint_mswi.h | 33 - .../include/sbi_utils/ipi/andes_plicsw.h | 46 - 3rd/opensbi/include/sbi_utils/ipi/fdt_ipi.h | 35 - 3rd/opensbi/include/sbi_utils/irqchip/aplic.h | 47 - .../include/sbi_utils/irqchip/fdt_irqchip.h | 36 - .../sbi_utils/irqchip/fdt_irqchip_plic.h | 33 - 3rd/opensbi/include/sbi_utils/irqchip/imsic.h | 60 - 3rd/opensbi/include/sbi_utils/irqchip/plic.h | 40 - .../include/sbi_utils/reset/fdt_reset.h | 44 - .../include/sbi_utils/serial/cadence-uart.h | 16 - .../include/sbi_utils/serial/fdt_serial.h | 30 - .../include/sbi_utils/serial/gaisler-uart.h | 17 - .../include/sbi_utils/serial/litex-uart.h | 17 - .../include/sbi_utils/serial/renesas-scif.h | 11 - .../include/sbi_utils/serial/semihosting.h | 47 - .../include/sbi_utils/serial/shakti-uart.h | 14 - .../include/sbi_utils/serial/sifive-uart.h | 17 - .../include/sbi_utils/serial/uart8250.h | 18 - .../include/sbi_utils/serial/xlnx_uartlite.h | 16 - 3rd/opensbi/include/sbi_utils/sys/htif.h | 21 - .../include/sbi_utils/sys/sifive_test.h | 17 - .../include/sbi_utils/timer/aclint_mtimer.h | 55 - .../include/sbi_utils/timer/andes_plmt.h | 29 - .../include/sbi_utils/timer/fdt_timer.h | 35 - 3rd/opensbi/lib/sbi/Kconfig | 37 - 3rd/opensbi/lib/sbi/objects.mk | 70 - 3rd/opensbi/lib/sbi/riscv_asm.c | 350 - 3rd/opensbi/lib/sbi/riscv_atomic.c | 253 - 3rd/opensbi/lib/sbi/riscv_hardfp.S | 171 - 3rd/opensbi/lib/sbi/riscv_locks.c | 77 - 3rd/opensbi/lib/sbi/sbi_bitmap.c | 40 - 3rd/opensbi/lib/sbi/sbi_bitops.c | 200 - 3rd/opensbi/lib/sbi/sbi_console.c | 411 - 3rd/opensbi/lib/sbi/sbi_domain.c | 652 -- 3rd/opensbi/lib/sbi/sbi_ecall.c | 161 - 3rd/opensbi/lib/sbi/sbi_ecall_base.c | 79 - 3rd/opensbi/lib/sbi/sbi_ecall_exts.carray | 3 - 3rd/opensbi/lib/sbi/sbi_ecall_hsm.c | 61 - 3rd/opensbi/lib/sbi/sbi_ecall_ipi.c | 36 - 3rd/opensbi/lib/sbi/sbi_ecall_legacy.c | 124 - 3rd/opensbi/lib/sbi/sbi_ecall_pmu.c | 88 - 3rd/opensbi/lib/sbi/sbi_ecall_rfence.c | 86 - 3rd/opensbi/lib/sbi/sbi_ecall_srst.c | 75 - 3rd/opensbi/lib/sbi/sbi_ecall_time.c | 40 - 3rd/opensbi/lib/sbi/sbi_ecall_vendor.c | 40 - 3rd/opensbi/lib/sbi/sbi_emulate_csr.c | 197 - 3rd/opensbi/lib/sbi/sbi_expected_trap.S | 69 - 3rd/opensbi/lib/sbi/sbi_fifo.c | 198 - 3rd/opensbi/lib/sbi/sbi_hart.c | 812 -- 3rd/opensbi/lib/sbi/sbi_hfence.S | 135 - 3rd/opensbi/lib/sbi/sbi_hsm.c | 497 -- 3rd/opensbi/lib/sbi/sbi_illegal_insn.c | 167 - 3rd/opensbi/lib/sbi/sbi_init.c | 565 -- 3rd/opensbi/lib/sbi/sbi_ipi.c | 285 - 3rd/opensbi/lib/sbi/sbi_irqchip.c | 54 - 3rd/opensbi/lib/sbi/sbi_math.c | 23 - 3rd/opensbi/lib/sbi/sbi_misaligned_ldst.c | 266 - 3rd/opensbi/lib/sbi/sbi_platform.c | 90 - 3rd/opensbi/lib/sbi/sbi_pmu.c | 854 -- 3rd/opensbi/lib/sbi/sbi_scratch.c | 99 - 3rd/opensbi/lib/sbi/sbi_string.c | 191 - 3rd/opensbi/lib/sbi/sbi_system.c | 94 - 3rd/opensbi/lib/sbi/sbi_timer.c | 213 - 3rd/opensbi/lib/sbi/sbi_tlb.c | 464 -- 3rd/opensbi/lib/sbi/sbi_trap.c | 348 - 3rd/opensbi/lib/sbi/sbi_unpriv.c | 169 - 3rd/opensbi/lib/utils/Kconfig | 25 - 3rd/opensbi/lib/utils/fdt/Kconfig | 18 - 3rd/opensbi/lib/utils/fdt/fdt_domain.c | 486 -- 3rd/opensbi/lib/utils/fdt/fdt_fixup.c | 313 - 3rd/opensbi/lib/utils/fdt/fdt_helper.c | 940 --- 3rd/opensbi/lib/utils/fdt/fdt_pmu.c | 127 - 3rd/opensbi/lib/utils/fdt/objects.mk | 10 - 3rd/opensbi/lib/utils/gpio/Kconfig | 23 - 3rd/opensbi/lib/utils/gpio/fdt_gpio.c | 133 - .../lib/utils/gpio/fdt_gpio_drivers.carray | 3 - 3rd/opensbi/lib/utils/gpio/fdt_gpio_sifive.c | 107 - 3rd/opensbi/lib/utils/gpio/gpio.c | 98 - 3rd/opensbi/lib/utils/gpio/objects.mk | 16 - 3rd/opensbi/lib/utils/i2c/Kconfig | 23 - 3rd/opensbi/lib/utils/i2c/fdt_i2c.c | 86 - .../utils/i2c/fdt_i2c_adapter_drivers.carray | 3 - 3rd/opensbi/lib/utils/i2c/fdt_i2c_sifive.c | 277 - 3rd/opensbi/lib/utils/i2c/i2c.c | 75 - 3rd/opensbi/lib/utils/i2c/objects.mk | 16 - 3rd/opensbi/lib/utils/ipi/Kconfig | 32 - 3rd/opensbi/lib/utils/ipi/aclint_mswi.c | 100 - 3rd/opensbi/lib/utils/ipi/andes_plicsw.c | 137 - 3rd/opensbi/lib/utils/ipi/fdt_ipi.c | 82 - .../lib/utils/ipi/fdt_ipi_drivers.carray | 3 - 3rd/opensbi/lib/utils/ipi/fdt_ipi_mswi.c | 69 - 3rd/opensbi/lib/utils/ipi/fdt_ipi_plicsw.c | 47 - 3rd/opensbi/lib/utils/ipi/objects.mk | 20 - 3rd/opensbi/lib/utils/irqchip/Kconfig | 41 - 3rd/opensbi/lib/utils/irqchip/aplic.c | 279 - 3rd/opensbi/lib/utils/irqchip/fdt_irqchip.c | 98 - .../lib/utils/irqchip/fdt_irqchip_aplic.c | 56 - .../utils/irqchip/fdt_irqchip_drivers.carray | 3 - .../lib/utils/irqchip/fdt_irqchip_imsic.c | 106 - .../lib/utils/irqchip/fdt_irqchip_plic.c | 176 - 3rd/opensbi/lib/utils/irqchip/imsic.c | 326 - 3rd/opensbi/lib/utils/irqchip/objects.mk | 24 - 3rd/opensbi/lib/utils/irqchip/plic.c | 175 - 3rd/opensbi/lib/utils/libfdt/.clang-format | 1 - 3rd/opensbi/lib/utils/libfdt/Kconfig | 5 - 3rd/opensbi/lib/utils/libfdt/Makefile.libfdt | 18 - 3rd/opensbi/lib/utils/libfdt/TODO | 3 - 3rd/opensbi/lib/utils/libfdt/fdt.c | 335 - 3rd/opensbi/lib/utils/libfdt/fdt.h | 66 - 3rd/opensbi/lib/utils/libfdt/fdt_addresses.c | 101 - 3rd/opensbi/lib/utils/libfdt/fdt_check.c | 93 - 3rd/opensbi/lib/utils/libfdt/fdt_empty_tree.c | 38 - 3rd/opensbi/lib/utils/libfdt/fdt_overlay.c | 882 -- 3rd/opensbi/lib/utils/libfdt/fdt_ro.c | 859 -- 3rd/opensbi/lib/utils/libfdt/fdt_rw.c | 500 -- 3rd/opensbi/lib/utils/libfdt/fdt_strerror.c | 59 - 3rd/opensbi/lib/utils/libfdt/fdt_sw.c | 384 - 3rd/opensbi/lib/utils/libfdt/fdt_wip.c | 94 - 3rd/opensbi/lib/utils/libfdt/libfdt.h | 2122 ----- 3rd/opensbi/lib/utils/libfdt/libfdt_env.h | 111 - .../lib/utils/libfdt/libfdt_internal.h | 192 - 3rd/opensbi/lib/utils/libfdt/objects.mk | 16 - 3rd/opensbi/lib/utils/libfdt/version.lds | 82 - 3rd/opensbi/lib/utils/libquad/divdi3.c | 64 - .../lib/utils/libquad/include/limits.h | 12 - .../lib/utils/libquad/include/sys/cdefs.h | 12 - .../lib/utils/libquad/include/sys/types.h | 25 - 3rd/opensbi/lib/utils/libquad/moddi3.c | 66 - 3rd/opensbi/lib/utils/libquad/objects.mk | 14 - 3rd/opensbi/lib/utils/libquad/qdivrem.c | 278 - 3rd/opensbi/lib/utils/libquad/quad.h | 105 - 3rd/opensbi/lib/utils/libquad/udivdi3.c | 52 - 3rd/opensbi/lib/utils/libquad/umoddi3.c | 54 - 3rd/opensbi/lib/utils/reset/Kconfig | 41 - 3rd/opensbi/lib/utils/reset/fdt_reset.c | 47 - .../lib/utils/reset/fdt_reset_atcwdt200.c | 122 - .../lib/utils/reset/fdt_reset_drivers.carray | 3 - 3rd/opensbi/lib/utils/reset/fdt_reset_gpio.c | 169 - 3rd/opensbi/lib/utils/reset/fdt_reset_htif.c | 38 - .../lib/utils/reset/fdt_reset_sifive_test.c | 36 - .../lib/utils/reset/fdt_reset_sunxi_wdt.c | 77 - 3rd/opensbi/lib/utils/reset/fdt_reset_thead.c | 134 - 3rd/opensbi/lib/utils/reset/fdt_reset_thead.h | 23 - .../lib/utils/reset/fdt_reset_thead_asm.S | 47 - 3rd/opensbi/lib/utils/reset/objects.mk | 31 - 3rd/opensbi/lib/utils/serial/Kconfig | 95 - 3rd/opensbi/lib/utils/serial/cadence-uart.c | 128 - 3rd/opensbi/lib/utils/serial/fdt_serial.c | 96 - .../lib/utils/serial/fdt_serial_cadence.c | 35 - .../utils/serial/fdt_serial_drivers.carray | 3 - .../lib/utils/serial/fdt_serial_gaisler.c | 35 - .../lib/utils/serial/fdt_serial_htif.c | 38 - .../lib/utils/serial/fdt_serial_litex.c | 39 - .../utils/serial/fdt_serial_renesas_scif.c | 31 - .../lib/utils/serial/fdt_serial_shakti.c | 33 - .../lib/utils/serial/fdt_serial_sifive.c | 36 - .../lib/utils/serial/fdt_serial_uart8250.c | 39 - .../utils/serial/fdt_serial_xlnx_uartlite.c | 35 - 3rd/opensbi/lib/utils/serial/gaisler-uart.c | 86 - 3rd/opensbi/lib/utils/serial/litex-uart.c | 63 - 3rd/opensbi/lib/utils/serial/objects.mk | 48 - 3rd/opensbi/lib/utils/serial/renesas_scif.c | 116 - 3rd/opensbi/lib/utils/serial/semihosting.c | 178 - 3rd/opensbi/lib/utils/serial/shakti-uart.c | 60 - 3rd/opensbi/lib/utils/serial/sifive-uart.c | 115 - 3rd/opensbi/lib/utils/serial/uart8250.c | 137 - 3rd/opensbi/lib/utils/serial/xlnx-uartlite.c | 67 - 3rd/opensbi/lib/utils/sys/Kconfig | 13 - 3rd/opensbi/lib/utils/sys/htif.c | 247 - 3rd/opensbi/lib/utils/sys/objects.mk | 11 - 3rd/opensbi/lib/utils/sys/sifive_test.c | 65 - 3rd/opensbi/lib/utils/timer/Kconfig | 32 - 3rd/opensbi/lib/utils/timer/aclint_mtimer.c | 219 - 3rd/opensbi/lib/utils/timer/andes_plmt.c | 104 - 3rd/opensbi/lib/utils/timer/fdt_timer.c | 82 - .../lib/utils/timer/fdt_timer_drivers.carray | 3 - .../lib/utils/timer/fdt_timer_mtimer.c | 145 - 3rd/opensbi/lib/utils/timer/fdt_timer_plmt.c | 51 - 3rd/opensbi/lib/utils/timer/objects.mk | 20 - 3rd/opensbi/platform/fpga/ariane/Kconfig | 10 - .../platform/fpga/ariane/configs/defconfig | 0 3rd/opensbi/platform/fpga/ariane/objects.mk | 43 - 3rd/opensbi/platform/fpga/ariane/platform.c | 189 - 3rd/opensbi/platform/fpga/openpiton/Kconfig | 10 - .../platform/fpga/openpiton/configs/defconfig | 0 .../platform/fpga/openpiton/objects.mk | 42 - .../platform/fpga/openpiton/platform.c | 224 - 3rd/opensbi/platform/generic/Kconfig | 48 - .../platform/generic/allwinner/objects.mk | 6 - .../platform/generic/allwinner/sun20i-d1.c | 269 - 3rd/opensbi/platform/generic/andes/ae350.c | 21 - 3rd/opensbi/platform/generic/andes/objects.mk | 6 - .../platform/generic/configs/defconfig | 37 - .../generic/include/platform_override.h | 36 - .../platform/generic/include/thead_c9xx.h | 127 - 3rd/opensbi/platform/generic/objects.mk | 44 - 3rd/opensbi/platform/generic/platform.c | 296 - .../generic/platform_override_modules.carray | 3 - .../generic/renesas/rzfive/objects.mk | 8 - .../platform/generic/renesas/rzfive/rzfive.c | 17 - 3rd/opensbi/platform/generic/sifive/fu540.c | 47 - 3rd/opensbi/platform/generic/sifive/fu740.c | 256 - .../platform/generic/sifive/objects.mk | 9 - 3rd/opensbi/platform/kendryte/k210/Kconfig | 10 - .../platform/kendryte/k210/configs/defconfig | 0 3rd/opensbi/platform/kendryte/k210/k210.dts | 70 - 3rd/opensbi/platform/kendryte/k210/objects.mk | 26 - 3rd/opensbi/platform/kendryte/k210/platform.c | 200 - 3rd/opensbi/platform/kendryte/k210/platform.h | 49 - 3rd/opensbi/platform/nuclei/ux600/Kconfig | 10 - .../platform/nuclei/ux600/configs/defconfig | 0 3rd/opensbi/platform/nuclei/ux600/objects.mk | 33 - 3rd/opensbi/platform/nuclei/ux600/platform.c | 248 - 3rd/opensbi/platform/template/Kconfig | 16 - .../platform/template/configs/defconfig | 0 3rd/opensbi/platform/template/objects.mk | 87 - 3rd/opensbi/platform/template/platform.c | 156 - 3rd/opensbi/scripts/Kconfiglib/LICENSE.txt | 5 - 3rd/opensbi/scripts/Kconfiglib/allnoconfig.py | 45 - .../scripts/Kconfiglib/allyesconfig.py | 56 - 3rd/opensbi/scripts/Kconfiglib/defconfig.py | 43 - 3rd/opensbi/scripts/Kconfiglib/genconfig.py | 154 - 3rd/opensbi/scripts/Kconfiglib/kconfiglib.py | 7160 ----------------- 3rd/opensbi/scripts/Kconfiglib/menuconfig.py | 3278 -------- 3rd/opensbi/scripts/Kconfiglib/oldconfig.py | 246 - .../scripts/Kconfiglib/olddefconfig.py | 28 - .../scripts/Kconfiglib/savedefconfig.py | 49 - 3rd/opensbi/scripts/Kconfiglib/setconfig.py | 92 - 3rd/opensbi/scripts/carray.sh | 77 - 3rd/opensbi/scripts/create-binary-archive.sh | 164 - 3rd/opensbi/scripts/d2c.sh | 74 - 3rd/ovmf/OVMF_aarch64.fd | Bin 2097152 -> 0 bytes 3rd/ovmf/OVMF_riscv64.fd | Bin 8388608 -> 0 bytes 3rd/ovmf/OVMF_x86_64.fd | Bin 2097152 -> 0 bytes 3rd/ovmf/RELEASEAARCH64_QEMU_EFI.fd | Bin 2097152 -> 0 bytes ...RELEASEAARCH64_QEMU_EFI.fd:Zone.Identifier | 4 - 3rd/ovmf/RELEASEAARCH64_QEMU_VARS.fd | Bin 786432 -> 0 bytes ...ELEASEAARCH64_QEMU_VARS.fd:Zone.Identifier | 4 - 3rd/ovmf/ovmf-aarch64.fd | Bin 2097152 -> 0 bytes 3rd/posix-uefi/LICENSE | 21 - 3rd/posix-uefi/Makefile | 11 - 3rd/posix-uefi/OLVASSEL.md | 385 - 3rd/posix-uefi/README.md | 389 - .../examples/01_helloworld/Makefile | 18 - .../examples/01_helloworld/helloworld.c | 13 - .../examples/01_helloworld/screenshot.png | Bin 3702 -> 0 bytes 3rd/posix-uefi/examples/01_helloworld/uefi | 1 - 3rd/posix-uefi/examples/02_args/Makefile | 4 - 3rd/posix-uefi/examples/02_args/args.c | 15 - .../examples/02_args/screenshot.png | Bin 4189 -> 0 bytes 3rd/posix-uefi/examples/02_args/uefi | 1 - 3rd/posix-uefi/examples/03_dumpmem/Makefile | 4 - 3rd/posix-uefi/examples/03_dumpmem/dumpmem.c | 13 - .../examples/03_dumpmem/screenshot.png | Bin 4747 -> 0 bytes 3rd/posix-uefi/examples/03_dumpmem/uefi | 1 - 3rd/posix-uefi/examples/04_dirent/Makefile | 4 - 3rd/posix-uefi/examples/04_dirent/dirent.c | 21 - .../examples/04_dirent/screenshot.png | Bin 3804 -> 0 bytes 3rd/posix-uefi/examples/04_dirent/uefi | 1 - 3rd/posix-uefi/examples/05_file/Makefile | 4 - 3rd/posix-uefi/examples/05_file/file.c | 32 - 3rd/posix-uefi/examples/05_file/file.txt | 2 - .../examples/05_file/screenshot.png | Bin 4270 -> 0 bytes 3rd/posix-uefi/examples/05_file/uefi | 1 - 3rd/posix-uefi/examples/06_block/Makefile | 4 - 3rd/posix-uefi/examples/06_block/block.c | 27 - .../examples/06_block/screenshot.png | Bin 3903 -> 0 bytes 3rd/posix-uefi/examples/06_block/uefi | 1 - 3rd/posix-uefi/examples/07_serial/Makefile | 4 - .../examples/07_serial/screenshot.png | Bin 6326 -> 0 bytes 3rd/posix-uefi/examples/07_serial/serial.c | 24 - 3rd/posix-uefi/examples/07_serial/uefi | 1 - 3rd/posix-uefi/examples/08_pointer/Makefile | 4 - 3rd/posix-uefi/examples/08_pointer/pointer.c | 32 - .../examples/08_pointer/screenshot.png | Bin 3926 -> 0 bytes 3rd/posix-uefi/examples/08_pointer/uefi | 1 - 3rd/posix-uefi/examples/09_vidmodes/Makefile | 4 - .../examples/09_vidmodes/screenshot.png | Bin 4456 -> 0 bytes 3rd/posix-uefi/examples/09_vidmodes/uefi | 1 - .../examples/09_vidmodes/vidmodes.c | 59 - 3rd/posix-uefi/examples/0A_bmpfont/Makefile | 4 - 3rd/posix-uefi/examples/0A_bmpfont/bmpfont.c | 118 - 3rd/posix-uefi/examples/0A_bmpfont/font.sfn | Bin 8283 -> 0 bytes .../examples/0A_bmpfont/screenshot.png | Bin 928 -> 0 bytes 3rd/posix-uefi/examples/0A_bmpfont/uefi | 1 - 3rd/posix-uefi/examples/0B_vecfont/Makefile | 4 - 3rd/posix-uefi/examples/0B_vecfont/font.sfn | Bin 283958 -> 0 bytes .../examples/0B_vecfont/screenshot.png | Bin 3528 -> 0 bytes 3rd/posix-uefi/examples/0B_vecfont/ssfn.h | 1599 ---- 3rd/posix-uefi/examples/0B_vecfont/uefi | 1 - 3rd/posix-uefi/examples/0B_vecfont/vecfont.c | 83 - 3rd/posix-uefi/examples/0C_png/Makefile | 4 - 3rd/posix-uefi/examples/0C_png/image.png | Bin 9500 -> 0 bytes 3rd/posix-uefi/examples/0C_png/png.c | 78 - 3rd/posix-uefi/examples/0C_png/screenshot.png | Bin 11129 -> 0 bytes 3rd/posix-uefi/examples/0C_png/stb_image.h | 1198 --- 3rd/posix-uefi/examples/0C_png/uefi | 1 - 3rd/posix-uefi/examples/0D_memmap/Makefile | 4 - 3rd/posix-uefi/examples/0D_memmap/memmap.c | 54 - .../examples/0D_memmap/screenshot.png | Bin 4550 -> 0 bytes 3rd/posix-uefi/examples/0D_memmap/uefi | 1 - 3rd/posix-uefi/examples/0E_elfload/Makefile | 9 - 3rd/posix-uefi/examples/0E_elfload/elfload.c | 114 - .../examples/0E_elfload/kernel/Makefile | 21 - .../examples/0E_elfload/kernel/kernel.c | 7 - .../examples/0E_elfload/screenshot.png | Bin 4368 -> 0 bytes 3rd/posix-uefi/examples/0E_elfload/uefi | 1 - 3rd/posix-uefi/examples/0F_exit_bs/Makefile | 9 - 3rd/posix-uefi/examples/0F_exit_bs/exit_bs.c | 153 - .../examples/0F_exit_bs/kernel/Makefile | 21 - .../examples/0F_exit_bs/kernel/bootparam.h | 11 - .../examples/0F_exit_bs/kernel/kernel.c | 86 - .../examples/0F_exit_bs/screenshot.png | Bin 560 -> 0 bytes 3rd/posix-uefi/examples/0F_exit_bs/uefi | 1 - 3rd/posix-uefi/uefi/Makefile | 133 - 3rd/posix-uefi/uefi/crt_aarch64.c | 239 - 3rd/posix-uefi/uefi/crt_riscv64.c | 270 - 3rd/posix-uefi/uefi/crt_x86_64.c | 241 - 3rd/posix-uefi/uefi/dirent.c | 76 - 3rd/posix-uefi/uefi/elf_aarch64_efi.lds | 63 - 3rd/posix-uefi/uefi/elf_riscv64_efi.lds | 64 - 3rd/posix-uefi/uefi/elf_x86_64_efi.lds | 76 - 3rd/posix-uefi/uefi/qsort.c | 154 - 3rd/posix-uefi/uefi/stat.c | 68 - 3rd/posix-uefi/uefi/stdio.c | 816 -- 3rd/posix-uefi/uefi/stdlib.c | 365 - 3rd/posix-uefi/uefi/string.c | 262 - 3rd/posix-uefi/uefi/time.c | 146 - 3rd/posix-uefi/uefi/uefi.h | 1433 ---- 3rd/posix-uefi/uefi/unistd.c | 55 - 3rd/posix-uefi/utils/Makefile | 11 - 3rd/posix-uefi/utils/OLVASSEL.md | 41 - 3rd/posix-uefi/utils/README.md | 41 - 3rd/posix-uefi/utils/efidsk.c | 648 -- 3rd/posix-uefi/utils/efiffs.c | 269 - 3rd/posix-uefi/utils/efirom.c | 1258 --- 650 files changed, 98223 deletions(-) delete mode 100644 3rd/gnu-efi/.gitignore delete mode 100644 3rd/gnu-efi/ChangeLog delete mode 100755 3rd/gnu-efi/Make.defaults delete mode 100644 3rd/gnu-efi/Make.rules delete mode 100644 3rd/gnu-efi/Makefile delete mode 100644 3rd/gnu-efi/README.efilib delete mode 100644 3rd/gnu-efi/README.elilo delete mode 100644 3rd/gnu-efi/README.git delete mode 100644 3rd/gnu-efi/README.gnuefi delete mode 100644 3rd/gnu-efi/apps/AllocPages.c delete mode 100644 3rd/gnu-efi/apps/FreePages.c delete mode 100644 3rd/gnu-efi/apps/Makefile delete mode 100644 3rd/gnu-efi/apps/bltgrid.c delete mode 100644 3rd/gnu-efi/apps/ctors_fns.c delete mode 100644 3rd/gnu-efi/apps/ctors_test.c delete mode 100644 3rd/gnu-efi/apps/debughook.c delete mode 100644 3rd/gnu-efi/apps/drv0.c delete mode 100644 3rd/gnu-efi/apps/drv0.h delete mode 100644 3rd/gnu-efi/apps/drv0_use.c delete mode 100644 3rd/gnu-efi/apps/exit.c delete mode 100644 3rd/gnu-efi/apps/lfbgrid.c delete mode 100644 3rd/gnu-efi/apps/modelist.c delete mode 100644 3rd/gnu-efi/apps/printenv.c delete mode 100644 3rd/gnu-efi/apps/route80h.c delete mode 100644 3rd/gnu-efi/apps/setdbg.c delete mode 100644 3rd/gnu-efi/apps/setjmp.c delete mode 100644 3rd/gnu-efi/apps/t.c delete mode 100644 3rd/gnu-efi/apps/t2.c delete mode 100644 3rd/gnu-efi/apps/t3.c delete mode 100644 3rd/gnu-efi/apps/t4.c delete mode 100644 3rd/gnu-efi/apps/t5.c delete mode 100644 3rd/gnu-efi/apps/t6.c delete mode 100644 3rd/gnu-efi/apps/t7.c delete mode 100644 3rd/gnu-efi/apps/t8.c delete mode 100644 3rd/gnu-efi/apps/tcc.c delete mode 100644 3rd/gnu-efi/apps/tpause.c delete mode 100644 3rd/gnu-efi/apps/trivial.S delete mode 100644 3rd/gnu-efi/apps/unsetdbg.c delete mode 100644 3rd/gnu-efi/gnuefi/Makefile delete mode 100644 3rd/gnu-efi/gnuefi/crt0-efi-aarch64.S delete mode 100644 3rd/gnu-efi/gnuefi/crt0-efi-arm.S delete mode 100644 3rd/gnu-efi/gnuefi/crt0-efi-ia32.S delete mode 100644 3rd/gnu-efi/gnuefi/crt0-efi-ia64.S delete mode 100644 3rd/gnu-efi/gnuefi/crt0-efi-loongarch64.S delete mode 100644 3rd/gnu-efi/gnuefi/crt0-efi-mips64el.S delete mode 100644 3rd/gnu-efi/gnuefi/crt0-efi-riscv64.S delete mode 100644 3rd/gnu-efi/gnuefi/crt0-efi-x86_64.S delete mode 100644 3rd/gnu-efi/gnuefi/elf_aarch64_efi.lds delete mode 100644 3rd/gnu-efi/gnuefi/elf_arm_efi.lds delete mode 100644 3rd/gnu-efi/gnuefi/elf_ia32_efi.lds delete mode 100644 3rd/gnu-efi/gnuefi/elf_ia32_fbsd_efi.lds delete mode 100644 3rd/gnu-efi/gnuefi/elf_ia64_efi.lds delete mode 100644 3rd/gnu-efi/gnuefi/elf_loongarch64_efi.lds delete mode 100644 3rd/gnu-efi/gnuefi/elf_mips64el_efi.lds delete mode 100644 3rd/gnu-efi/gnuefi/elf_riscv64_efi.lds delete mode 100644 3rd/gnu-efi/gnuefi/elf_x86_64_efi.lds delete mode 100644 3rd/gnu-efi/gnuefi/elf_x86_64_fbsd_efi.lds delete mode 100644 3rd/gnu-efi/gnuefi/gnu-efi.pc.in delete mode 100644 3rd/gnu-efi/gnuefi/reloc_aarch64.c delete mode 100644 3rd/gnu-efi/gnuefi/reloc_arm.c delete mode 100644 3rd/gnu-efi/gnuefi/reloc_ia32.c delete mode 100644 3rd/gnu-efi/gnuefi/reloc_ia64.S delete mode 100644 3rd/gnu-efi/gnuefi/reloc_loongarch64.c delete mode 100644 3rd/gnu-efi/gnuefi/reloc_mips64el.c delete mode 100644 3rd/gnu-efi/gnuefi/reloc_riscv64.c delete mode 100644 3rd/gnu-efi/gnuefi/reloc_x86_64.c delete mode 100644 3rd/gnu-efi/inc/Makefile delete mode 100644 3rd/gnu-efi/inc/aarch64/efibind.h delete mode 100644 3rd/gnu-efi/inc/aarch64/efilibplat.h delete mode 100644 3rd/gnu-efi/inc/aarch64/efisetjmp_arch.h delete mode 100644 3rd/gnu-efi/inc/arm/efibind.h delete mode 100644 3rd/gnu-efi/inc/arm/efilibplat.h delete mode 100644 3rd/gnu-efi/inc/arm/efisetjmp_arch.h delete mode 100644 3rd/gnu-efi/inc/efi.h delete mode 100644 3rd/gnu-efi/inc/efi_nii.h delete mode 100644 3rd/gnu-efi/inc/efi_pxe.h delete mode 100644 3rd/gnu-efi/inc/efiapi.h delete mode 100644 3rd/gnu-efi/inc/eficompiler.h delete mode 100644 3rd/gnu-efi/inc/eficon.h delete mode 100644 3rd/gnu-efi/inc/eficonex.h delete mode 100644 3rd/gnu-efi/inc/efidebug.h delete mode 100644 3rd/gnu-efi/inc/efidef.h delete mode 100644 3rd/gnu-efi/inc/efidevp.h delete mode 100644 3rd/gnu-efi/inc/efierr.h delete mode 100644 3rd/gnu-efi/inc/efifs.h delete mode 100644 3rd/gnu-efi/inc/efigpt.h delete mode 100644 3rd/gnu-efi/inc/efiip.h delete mode 100644 3rd/gnu-efi/inc/efilib.h delete mode 100644 3rd/gnu-efi/inc/efilink.h delete mode 100644 3rd/gnu-efi/inc/efinet.h delete mode 100644 3rd/gnu-efi/inc/efipart.h delete mode 100644 3rd/gnu-efi/inc/efipciio.h delete mode 100644 3rd/gnu-efi/inc/efipoint.h delete mode 100644 3rd/gnu-efi/inc/efiprot.h delete mode 100644 3rd/gnu-efi/inc/efipxebc.h delete mode 100644 3rd/gnu-efi/inc/efirtlib.h delete mode 100644 3rd/gnu-efi/inc/efiser.h delete mode 100644 3rd/gnu-efi/inc/efisetjmp.h delete mode 100644 3rd/gnu-efi/inc/efishell.h delete mode 100644 3rd/gnu-efi/inc/efishellintf.h delete mode 100644 3rd/gnu-efi/inc/efistdarg.h delete mode 100644 3rd/gnu-efi/inc/efitcp.h delete mode 100644 3rd/gnu-efi/inc/efiudp.h delete mode 100644 3rd/gnu-efi/inc/efiui.h delete mode 100644 3rd/gnu-efi/inc/ia32/efibind.h delete mode 100644 3rd/gnu-efi/inc/ia32/efilibplat.h delete mode 100644 3rd/gnu-efi/inc/ia32/efisetjmp_arch.h delete mode 100644 3rd/gnu-efi/inc/ia32/pe.h delete mode 100644 3rd/gnu-efi/inc/ia64/efibind.h delete mode 100644 3rd/gnu-efi/inc/ia64/efilibplat.h delete mode 100644 3rd/gnu-efi/inc/ia64/efisetjmp_arch.h delete mode 100644 3rd/gnu-efi/inc/ia64/pe.h delete mode 100644 3rd/gnu-efi/inc/ia64/salproc.h delete mode 100644 3rd/gnu-efi/inc/inc.mak delete mode 100644 3rd/gnu-efi/inc/lib.h delete mode 100644 3rd/gnu-efi/inc/libsmbios.h delete mode 100644 3rd/gnu-efi/inc/loongarch64/efibind.h delete mode 100644 3rd/gnu-efi/inc/loongarch64/efilibplat.h delete mode 100644 3rd/gnu-efi/inc/loongarch64/efisetjmp_arch.h delete mode 100644 3rd/gnu-efi/inc/make.inf delete mode 100644 3rd/gnu-efi/inc/makefile.hdr delete mode 100644 3rd/gnu-efi/inc/mips64el/efibind.h delete mode 100644 3rd/gnu-efi/inc/mips64el/efilibplat.h delete mode 100644 3rd/gnu-efi/inc/mips64el/efisetjmp_arch.h delete mode 100644 3rd/gnu-efi/inc/pci22.h delete mode 100644 3rd/gnu-efi/inc/protocol/adapterdebug.h delete mode 100644 3rd/gnu-efi/inc/protocol/eficonsplit.h delete mode 100644 3rd/gnu-efi/inc/protocol/efidbg.h delete mode 100644 3rd/gnu-efi/inc/protocol/efivar.h delete mode 100644 3rd/gnu-efi/inc/protocol/ia64/eficontext.h delete mode 100644 3rd/gnu-efi/inc/protocol/intload.h delete mode 100644 3rd/gnu-efi/inc/protocol/legacyboot.h delete mode 100644 3rd/gnu-efi/inc/protocol/make.inf delete mode 100644 3rd/gnu-efi/inc/protocol/makefile.hdr delete mode 100644 3rd/gnu-efi/inc/protocol/piflash64.h delete mode 100644 3rd/gnu-efi/inc/protocol/readme.txt delete mode 100644 3rd/gnu-efi/inc/protocol/vgaclass.h delete mode 100644 3rd/gnu-efi/inc/riscv64/efibind.h delete mode 100644 3rd/gnu-efi/inc/riscv64/efilibplat.h delete mode 100644 3rd/gnu-efi/inc/riscv64/efisetjmp_arch.h delete mode 100644 3rd/gnu-efi/inc/romload.h delete mode 100644 3rd/gnu-efi/inc/x86_64/efibind.h delete mode 100644 3rd/gnu-efi/inc/x86_64/efilibplat.h delete mode 100644 3rd/gnu-efi/inc/x86_64/efisetjmp_arch.h delete mode 100644 3rd/gnu-efi/inc/x86_64/pe.h delete mode 100644 3rd/gnu-efi/lib/Makefile delete mode 100644 3rd/gnu-efi/lib/aarch64/efi_stub.S delete mode 100644 3rd/gnu-efi/lib/aarch64/initplat.c delete mode 100644 3rd/gnu-efi/lib/aarch64/math.c delete mode 100644 3rd/gnu-efi/lib/aarch64/setjmp.S delete mode 100644 3rd/gnu-efi/lib/arm/div.S delete mode 100644 3rd/gnu-efi/lib/arm/edk2asm.h delete mode 100644 3rd/gnu-efi/lib/arm/efi_stub.S delete mode 100644 3rd/gnu-efi/lib/arm/initplat.c delete mode 100644 3rd/gnu-efi/lib/arm/ldivmod.S delete mode 100644 3rd/gnu-efi/lib/arm/llsl.S delete mode 100644 3rd/gnu-efi/lib/arm/llsr.S delete mode 100644 3rd/gnu-efi/lib/arm/math.c delete mode 100644 3rd/gnu-efi/lib/arm/mullu.S delete mode 100644 3rd/gnu-efi/lib/arm/setjmp.S delete mode 100644 3rd/gnu-efi/lib/arm/uldiv.S delete mode 100644 3rd/gnu-efi/lib/boxdraw.c delete mode 100644 3rd/gnu-efi/lib/cmdline.c delete mode 100644 3rd/gnu-efi/lib/console.c delete mode 100644 3rd/gnu-efi/lib/crc.c delete mode 100644 3rd/gnu-efi/lib/ctors.S delete mode 100644 3rd/gnu-efi/lib/data.c delete mode 100644 3rd/gnu-efi/lib/debug.c delete mode 100644 3rd/gnu-efi/lib/dpath.c delete mode 100644 3rd/gnu-efi/lib/entry.c delete mode 100644 3rd/gnu-efi/lib/error.c delete mode 100644 3rd/gnu-efi/lib/event.c delete mode 100644 3rd/gnu-efi/lib/exit.c delete mode 100644 3rd/gnu-efi/lib/guid.c delete mode 100644 3rd/gnu-efi/lib/hand.c delete mode 100644 3rd/gnu-efi/lib/hw.c delete mode 100644 3rd/gnu-efi/lib/ia32/efi_stub.S delete mode 100644 3rd/gnu-efi/lib/ia32/initplat.c delete mode 100644 3rd/gnu-efi/lib/ia32/math.c delete mode 100644 3rd/gnu-efi/lib/ia32/setjmp.S delete mode 100644 3rd/gnu-efi/lib/ia64/initplat.c delete mode 100644 3rd/gnu-efi/lib/ia64/math.c delete mode 100644 3rd/gnu-efi/lib/ia64/palproc.S delete mode 100644 3rd/gnu-efi/lib/ia64/palproc.h delete mode 100644 3rd/gnu-efi/lib/ia64/salpal.c delete mode 100644 3rd/gnu-efi/lib/ia64/setjmp.S delete mode 100644 3rd/gnu-efi/lib/init.c delete mode 100644 3rd/gnu-efi/lib/lock.c delete mode 100644 3rd/gnu-efi/lib/loongarch64/efi_stub.S delete mode 100644 3rd/gnu-efi/lib/loongarch64/initplat.c delete mode 100644 3rd/gnu-efi/lib/loongarch64/math.c delete mode 100644 3rd/gnu-efi/lib/loongarch64/setjmp.S delete mode 100644 3rd/gnu-efi/lib/mips64el/efi_stub.S delete mode 100644 3rd/gnu-efi/lib/mips64el/initplat.c delete mode 100644 3rd/gnu-efi/lib/mips64el/math.c delete mode 100644 3rd/gnu-efi/lib/mips64el/setjmp.S delete mode 100644 3rd/gnu-efi/lib/misc.c delete mode 100644 3rd/gnu-efi/lib/pause.c delete mode 100644 3rd/gnu-efi/lib/print.c delete mode 100644 3rd/gnu-efi/lib/riscv64/initplat.c delete mode 100644 3rd/gnu-efi/lib/riscv64/math.c delete mode 100644 3rd/gnu-efi/lib/riscv64/setjmp.S delete mode 100644 3rd/gnu-efi/lib/runtime/efirtlib.c delete mode 100644 3rd/gnu-efi/lib/runtime/rtdata.c delete mode 100644 3rd/gnu-efi/lib/runtime/rtlock.c delete mode 100644 3rd/gnu-efi/lib/runtime/rtstr.c delete mode 100644 3rd/gnu-efi/lib/runtime/vm.c delete mode 100644 3rd/gnu-efi/lib/smbios.c delete mode 100644 3rd/gnu-efi/lib/sread.c delete mode 100644 3rd/gnu-efi/lib/str.c delete mode 100644 3rd/gnu-efi/lib/x86_64/callwrap.c delete mode 100644 3rd/gnu-efi/lib/x86_64/efi_stub.S delete mode 100644 3rd/gnu-efi/lib/x86_64/initplat.c delete mode 100644 3rd/gnu-efi/lib/x86_64/math.c delete mode 100644 3rd/gnu-efi/lib/x86_64/setjmp.S delete mode 100644 3rd/opensbi/.clang-format delete mode 100644 3rd/opensbi/.gitignore delete mode 100644 3rd/opensbi/CONTRIBUTORS.md delete mode 100644 3rd/opensbi/COPYING.BSD delete mode 100644 3rd/opensbi/Kconfig delete mode 100644 3rd/opensbi/Makefile delete mode 100644 3rd/opensbi/README.md delete mode 100644 3rd/opensbi/ThirdPartyNotices.md delete mode 100644 3rd/opensbi/docs/contributing.md delete mode 100644 3rd/opensbi/docs/domain_support.md delete mode 100644 3rd/opensbi/docs/doxygen.cfg delete mode 100644 3rd/opensbi/docs/external/coreboot.md delete mode 100644 3rd/opensbi/docs/firmware/fw.md delete mode 100644 3rd/opensbi/docs/firmware/fw_dynamic.md delete mode 100644 3rd/opensbi/docs/firmware/fw_jump.md delete mode 100644 3rd/opensbi/docs/firmware/fw_payload.md delete mode 100644 3rd/opensbi/docs/firmware/payload_linux.md delete mode 100644 3rd/opensbi/docs/firmware/payload_uboot.md delete mode 100644 3rd/opensbi/docs/library_usage.md delete mode 100644 3rd/opensbi/docs/platform/andes-ae350.md delete mode 100644 3rd/opensbi/docs/platform/fpga-ariane.md delete mode 100644 3rd/opensbi/docs/platform/fpga-openpiton.md delete mode 100644 3rd/opensbi/docs/platform/generic.md delete mode 100644 3rd/opensbi/docs/platform/nuclei_ux600.md delete mode 100644 3rd/opensbi/docs/platform/platform.md delete mode 100644 3rd/opensbi/docs/platform/qemu_virt.md delete mode 100644 3rd/opensbi/docs/platform/renesas-rzfive.md delete mode 100644 3rd/opensbi/docs/platform/shakti_cclass.md delete mode 100644 3rd/opensbi/docs/platform/sifive_fu540.md delete mode 100644 3rd/opensbi/docs/platform/spike.md delete mode 100644 3rd/opensbi/docs/platform/thead-c9xx.md delete mode 100644 3rd/opensbi/docs/platform_guide.md delete mode 100644 3rd/opensbi/docs/platform_requirements.md delete mode 100644 3rd/opensbi/docs/pmu_support.md delete mode 100644 3rd/opensbi/firmware/Kconfig delete mode 100644 3rd/opensbi/firmware/external_deps.mk delete mode 100644 3rd/opensbi/firmware/fw_base.S delete mode 100644 3rd/opensbi/firmware/fw_base.ldS delete mode 100644 3rd/opensbi/firmware/fw_dynamic.S delete mode 100644 3rd/opensbi/firmware/fw_dynamic.elf.ldS delete mode 100644 3rd/opensbi/firmware/fw_jump.S delete mode 100644 3rd/opensbi/firmware/fw_jump.elf.ldS delete mode 100644 3rd/opensbi/firmware/fw_payload.S delete mode 100644 3rd/opensbi/firmware/fw_payload.elf.ldS delete mode 100644 3rd/opensbi/firmware/objects.mk delete mode 100644 3rd/opensbi/firmware/payloads/objects.mk delete mode 100644 3rd/opensbi/firmware/payloads/test.elf.ldS delete mode 100644 3rd/opensbi/firmware/payloads/test_head.S delete mode 100644 3rd/opensbi/firmware/payloads/test_main.c delete mode 100644 3rd/opensbi/include/sbi/fw_dynamic.h delete mode 100644 3rd/opensbi/include/sbi/riscv_asm.h delete mode 100644 3rd/opensbi/include/sbi/riscv_atomic.h delete mode 100644 3rd/opensbi/include/sbi/riscv_barrier.h delete mode 100644 3rd/opensbi/include/sbi/riscv_elf.h delete mode 100644 3rd/opensbi/include/sbi/riscv_encoding.h delete mode 100644 3rd/opensbi/include/sbi/riscv_fp.h delete mode 100644 3rd/opensbi/include/sbi/riscv_io.h delete mode 100644 3rd/opensbi/include/sbi/riscv_locks.h delete mode 100644 3rd/opensbi/include/sbi/sbi_bitmap.h delete mode 100644 3rd/opensbi/include/sbi/sbi_bitops.h delete mode 100644 3rd/opensbi/include/sbi/sbi_console.h delete mode 100644 3rd/opensbi/include/sbi/sbi_const.h delete mode 100644 3rd/opensbi/include/sbi/sbi_csr_detect.h delete mode 100644 3rd/opensbi/include/sbi/sbi_domain.h delete mode 100644 3rd/opensbi/include/sbi/sbi_ecall.h delete mode 100644 3rd/opensbi/include/sbi/sbi_ecall_interface.h delete mode 100644 3rd/opensbi/include/sbi/sbi_emulate_csr.h delete mode 100644 3rd/opensbi/include/sbi/sbi_error.h delete mode 100644 3rd/opensbi/include/sbi/sbi_fifo.h delete mode 100644 3rd/opensbi/include/sbi/sbi_hart.h delete mode 100644 3rd/opensbi/include/sbi/sbi_hartmask.h delete mode 100644 3rd/opensbi/include/sbi/sbi_hfence.h delete mode 100644 3rd/opensbi/include/sbi/sbi_hsm.h delete mode 100644 3rd/opensbi/include/sbi/sbi_illegal_insn.h delete mode 100644 3rd/opensbi/include/sbi/sbi_init.h delete mode 100644 3rd/opensbi/include/sbi/sbi_ipi.h delete mode 100644 3rd/opensbi/include/sbi/sbi_irqchip.h delete mode 100644 3rd/opensbi/include/sbi/sbi_list.h delete mode 100644 3rd/opensbi/include/sbi/sbi_math.h delete mode 100644 3rd/opensbi/include/sbi/sbi_misaligned_ldst.h delete mode 100644 3rd/opensbi/include/sbi/sbi_platform.h delete mode 100644 3rd/opensbi/include/sbi/sbi_pmu.h delete mode 100644 3rd/opensbi/include/sbi/sbi_scratch.h delete mode 100644 3rd/opensbi/include/sbi/sbi_string.h delete mode 100644 3rd/opensbi/include/sbi/sbi_system.h delete mode 100644 3rd/opensbi/include/sbi/sbi_timer.h delete mode 100644 3rd/opensbi/include/sbi/sbi_tlb.h delete mode 100644 3rd/opensbi/include/sbi/sbi_trap.h delete mode 100644 3rd/opensbi/include/sbi/sbi_types.h delete mode 100644 3rd/opensbi/include/sbi/sbi_unpriv.h delete mode 100644 3rd/opensbi/include/sbi/sbi_version.h delete mode 100644 3rd/opensbi/include/sbi_utils/fdt/fdt_domain.h delete mode 100644 3rd/opensbi/include/sbi_utils/fdt/fdt_fixup.h delete mode 100644 3rd/opensbi/include/sbi_utils/fdt/fdt_helper.h delete mode 100644 3rd/opensbi/include/sbi_utils/fdt/fdt_pmu.h delete mode 100644 3rd/opensbi/include/sbi_utils/gpio/fdt_gpio.h delete mode 100644 3rd/opensbi/include/sbi_utils/gpio/gpio.h delete mode 100644 3rd/opensbi/include/sbi_utils/i2c/fdt_i2c.h delete mode 100644 3rd/opensbi/include/sbi_utils/i2c/i2c.h delete mode 100644 3rd/opensbi/include/sbi_utils/ipi/aclint_mswi.h delete mode 100644 3rd/opensbi/include/sbi_utils/ipi/andes_plicsw.h delete mode 100644 3rd/opensbi/include/sbi_utils/ipi/fdt_ipi.h delete mode 100644 3rd/opensbi/include/sbi_utils/irqchip/aplic.h delete mode 100644 3rd/opensbi/include/sbi_utils/irqchip/fdt_irqchip.h delete mode 100644 3rd/opensbi/include/sbi_utils/irqchip/fdt_irqchip_plic.h delete mode 100644 3rd/opensbi/include/sbi_utils/irqchip/imsic.h delete mode 100644 3rd/opensbi/include/sbi_utils/irqchip/plic.h delete mode 100644 3rd/opensbi/include/sbi_utils/reset/fdt_reset.h delete mode 100644 3rd/opensbi/include/sbi_utils/serial/cadence-uart.h delete mode 100644 3rd/opensbi/include/sbi_utils/serial/fdt_serial.h delete mode 100644 3rd/opensbi/include/sbi_utils/serial/gaisler-uart.h delete mode 100644 3rd/opensbi/include/sbi_utils/serial/litex-uart.h delete mode 100644 3rd/opensbi/include/sbi_utils/serial/renesas-scif.h delete mode 100644 3rd/opensbi/include/sbi_utils/serial/semihosting.h delete mode 100644 3rd/opensbi/include/sbi_utils/serial/shakti-uart.h delete mode 100644 3rd/opensbi/include/sbi_utils/serial/sifive-uart.h delete mode 100644 3rd/opensbi/include/sbi_utils/serial/uart8250.h delete mode 100644 3rd/opensbi/include/sbi_utils/serial/xlnx_uartlite.h delete mode 100644 3rd/opensbi/include/sbi_utils/sys/htif.h delete mode 100644 3rd/opensbi/include/sbi_utils/sys/sifive_test.h delete mode 100644 3rd/opensbi/include/sbi_utils/timer/aclint_mtimer.h delete mode 100644 3rd/opensbi/include/sbi_utils/timer/andes_plmt.h delete mode 100644 3rd/opensbi/include/sbi_utils/timer/fdt_timer.h delete mode 100644 3rd/opensbi/lib/sbi/Kconfig delete mode 100644 3rd/opensbi/lib/sbi/objects.mk delete mode 100644 3rd/opensbi/lib/sbi/riscv_asm.c delete mode 100644 3rd/opensbi/lib/sbi/riscv_atomic.c delete mode 100644 3rd/opensbi/lib/sbi/riscv_hardfp.S delete mode 100644 3rd/opensbi/lib/sbi/riscv_locks.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_bitmap.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_bitops.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_console.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_domain.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_ecall.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_ecall_base.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_ecall_exts.carray delete mode 100644 3rd/opensbi/lib/sbi/sbi_ecall_hsm.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_ecall_ipi.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_ecall_legacy.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_ecall_pmu.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_ecall_rfence.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_ecall_srst.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_ecall_time.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_ecall_vendor.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_emulate_csr.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_expected_trap.S delete mode 100644 3rd/opensbi/lib/sbi/sbi_fifo.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_hart.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_hfence.S delete mode 100644 3rd/opensbi/lib/sbi/sbi_hsm.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_illegal_insn.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_init.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_ipi.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_irqchip.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_math.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_misaligned_ldst.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_platform.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_pmu.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_scratch.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_string.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_system.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_timer.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_tlb.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_trap.c delete mode 100644 3rd/opensbi/lib/sbi/sbi_unpriv.c delete mode 100644 3rd/opensbi/lib/utils/Kconfig delete mode 100644 3rd/opensbi/lib/utils/fdt/Kconfig delete mode 100644 3rd/opensbi/lib/utils/fdt/fdt_domain.c delete mode 100644 3rd/opensbi/lib/utils/fdt/fdt_fixup.c delete mode 100644 3rd/opensbi/lib/utils/fdt/fdt_helper.c delete mode 100644 3rd/opensbi/lib/utils/fdt/fdt_pmu.c delete mode 100644 3rd/opensbi/lib/utils/fdt/objects.mk delete mode 100644 3rd/opensbi/lib/utils/gpio/Kconfig delete mode 100644 3rd/opensbi/lib/utils/gpio/fdt_gpio.c delete mode 100644 3rd/opensbi/lib/utils/gpio/fdt_gpio_drivers.carray delete mode 100644 3rd/opensbi/lib/utils/gpio/fdt_gpio_sifive.c delete mode 100644 3rd/opensbi/lib/utils/gpio/gpio.c delete mode 100644 3rd/opensbi/lib/utils/gpio/objects.mk delete mode 100644 3rd/opensbi/lib/utils/i2c/Kconfig delete mode 100644 3rd/opensbi/lib/utils/i2c/fdt_i2c.c delete mode 100644 3rd/opensbi/lib/utils/i2c/fdt_i2c_adapter_drivers.carray delete mode 100644 3rd/opensbi/lib/utils/i2c/fdt_i2c_sifive.c delete mode 100644 3rd/opensbi/lib/utils/i2c/i2c.c delete mode 100644 3rd/opensbi/lib/utils/i2c/objects.mk delete mode 100644 3rd/opensbi/lib/utils/ipi/Kconfig delete mode 100644 3rd/opensbi/lib/utils/ipi/aclint_mswi.c delete mode 100644 3rd/opensbi/lib/utils/ipi/andes_plicsw.c delete mode 100644 3rd/opensbi/lib/utils/ipi/fdt_ipi.c delete mode 100644 3rd/opensbi/lib/utils/ipi/fdt_ipi_drivers.carray delete mode 100644 3rd/opensbi/lib/utils/ipi/fdt_ipi_mswi.c delete mode 100644 3rd/opensbi/lib/utils/ipi/fdt_ipi_plicsw.c delete mode 100644 3rd/opensbi/lib/utils/ipi/objects.mk delete mode 100644 3rd/opensbi/lib/utils/irqchip/Kconfig delete mode 100644 3rd/opensbi/lib/utils/irqchip/aplic.c delete mode 100644 3rd/opensbi/lib/utils/irqchip/fdt_irqchip.c delete mode 100644 3rd/opensbi/lib/utils/irqchip/fdt_irqchip_aplic.c delete mode 100644 3rd/opensbi/lib/utils/irqchip/fdt_irqchip_drivers.carray delete mode 100644 3rd/opensbi/lib/utils/irqchip/fdt_irqchip_imsic.c delete mode 100644 3rd/opensbi/lib/utils/irqchip/fdt_irqchip_plic.c delete mode 100644 3rd/opensbi/lib/utils/irqchip/imsic.c delete mode 100644 3rd/opensbi/lib/utils/irqchip/objects.mk delete mode 100644 3rd/opensbi/lib/utils/irqchip/plic.c delete mode 100644 3rd/opensbi/lib/utils/libfdt/.clang-format delete mode 100644 3rd/opensbi/lib/utils/libfdt/Kconfig delete mode 100644 3rd/opensbi/lib/utils/libfdt/Makefile.libfdt delete mode 100644 3rd/opensbi/lib/utils/libfdt/TODO delete mode 100644 3rd/opensbi/lib/utils/libfdt/fdt.c delete mode 100644 3rd/opensbi/lib/utils/libfdt/fdt.h delete mode 100644 3rd/opensbi/lib/utils/libfdt/fdt_addresses.c delete mode 100644 3rd/opensbi/lib/utils/libfdt/fdt_check.c delete mode 100644 3rd/opensbi/lib/utils/libfdt/fdt_empty_tree.c delete mode 100644 3rd/opensbi/lib/utils/libfdt/fdt_overlay.c delete mode 100644 3rd/opensbi/lib/utils/libfdt/fdt_ro.c delete mode 100644 3rd/opensbi/lib/utils/libfdt/fdt_rw.c delete mode 100644 3rd/opensbi/lib/utils/libfdt/fdt_strerror.c delete mode 100644 3rd/opensbi/lib/utils/libfdt/fdt_sw.c delete mode 100644 3rd/opensbi/lib/utils/libfdt/fdt_wip.c delete mode 100644 3rd/opensbi/lib/utils/libfdt/libfdt.h delete mode 100644 3rd/opensbi/lib/utils/libfdt/libfdt_env.h delete mode 100644 3rd/opensbi/lib/utils/libfdt/libfdt_internal.h delete mode 100644 3rd/opensbi/lib/utils/libfdt/objects.mk delete mode 100644 3rd/opensbi/lib/utils/libfdt/version.lds delete mode 100644 3rd/opensbi/lib/utils/libquad/divdi3.c delete mode 100644 3rd/opensbi/lib/utils/libquad/include/limits.h delete mode 100644 3rd/opensbi/lib/utils/libquad/include/sys/cdefs.h delete mode 100644 3rd/opensbi/lib/utils/libquad/include/sys/types.h delete mode 100644 3rd/opensbi/lib/utils/libquad/moddi3.c delete mode 100644 3rd/opensbi/lib/utils/libquad/objects.mk delete mode 100644 3rd/opensbi/lib/utils/libquad/qdivrem.c delete mode 100644 3rd/opensbi/lib/utils/libquad/quad.h delete mode 100644 3rd/opensbi/lib/utils/libquad/udivdi3.c delete mode 100644 3rd/opensbi/lib/utils/libquad/umoddi3.c delete mode 100644 3rd/opensbi/lib/utils/reset/Kconfig delete mode 100644 3rd/opensbi/lib/utils/reset/fdt_reset.c delete mode 100644 3rd/opensbi/lib/utils/reset/fdt_reset_atcwdt200.c delete mode 100644 3rd/opensbi/lib/utils/reset/fdt_reset_drivers.carray delete mode 100644 3rd/opensbi/lib/utils/reset/fdt_reset_gpio.c delete mode 100644 3rd/opensbi/lib/utils/reset/fdt_reset_htif.c delete mode 100644 3rd/opensbi/lib/utils/reset/fdt_reset_sifive_test.c delete mode 100644 3rd/opensbi/lib/utils/reset/fdt_reset_sunxi_wdt.c delete mode 100644 3rd/opensbi/lib/utils/reset/fdt_reset_thead.c delete mode 100644 3rd/opensbi/lib/utils/reset/fdt_reset_thead.h delete mode 100644 3rd/opensbi/lib/utils/reset/fdt_reset_thead_asm.S delete mode 100644 3rd/opensbi/lib/utils/reset/objects.mk delete mode 100644 3rd/opensbi/lib/utils/serial/Kconfig delete mode 100644 3rd/opensbi/lib/utils/serial/cadence-uart.c delete mode 100644 3rd/opensbi/lib/utils/serial/fdt_serial.c delete mode 100644 3rd/opensbi/lib/utils/serial/fdt_serial_cadence.c delete mode 100644 3rd/opensbi/lib/utils/serial/fdt_serial_drivers.carray delete mode 100644 3rd/opensbi/lib/utils/serial/fdt_serial_gaisler.c delete mode 100644 3rd/opensbi/lib/utils/serial/fdt_serial_htif.c delete mode 100644 3rd/opensbi/lib/utils/serial/fdt_serial_litex.c delete mode 100644 3rd/opensbi/lib/utils/serial/fdt_serial_renesas_scif.c delete mode 100644 3rd/opensbi/lib/utils/serial/fdt_serial_shakti.c delete mode 100644 3rd/opensbi/lib/utils/serial/fdt_serial_sifive.c delete mode 100644 3rd/opensbi/lib/utils/serial/fdt_serial_uart8250.c delete mode 100644 3rd/opensbi/lib/utils/serial/fdt_serial_xlnx_uartlite.c delete mode 100644 3rd/opensbi/lib/utils/serial/gaisler-uart.c delete mode 100644 3rd/opensbi/lib/utils/serial/litex-uart.c delete mode 100644 3rd/opensbi/lib/utils/serial/objects.mk delete mode 100644 3rd/opensbi/lib/utils/serial/renesas_scif.c delete mode 100644 3rd/opensbi/lib/utils/serial/semihosting.c delete mode 100644 3rd/opensbi/lib/utils/serial/shakti-uart.c delete mode 100644 3rd/opensbi/lib/utils/serial/sifive-uart.c delete mode 100644 3rd/opensbi/lib/utils/serial/uart8250.c delete mode 100644 3rd/opensbi/lib/utils/serial/xlnx-uartlite.c delete mode 100644 3rd/opensbi/lib/utils/sys/Kconfig delete mode 100644 3rd/opensbi/lib/utils/sys/htif.c delete mode 100644 3rd/opensbi/lib/utils/sys/objects.mk delete mode 100644 3rd/opensbi/lib/utils/sys/sifive_test.c delete mode 100644 3rd/opensbi/lib/utils/timer/Kconfig delete mode 100644 3rd/opensbi/lib/utils/timer/aclint_mtimer.c delete mode 100644 3rd/opensbi/lib/utils/timer/andes_plmt.c delete mode 100644 3rd/opensbi/lib/utils/timer/fdt_timer.c delete mode 100644 3rd/opensbi/lib/utils/timer/fdt_timer_drivers.carray delete mode 100644 3rd/opensbi/lib/utils/timer/fdt_timer_mtimer.c delete mode 100644 3rd/opensbi/lib/utils/timer/fdt_timer_plmt.c delete mode 100644 3rd/opensbi/lib/utils/timer/objects.mk delete mode 100644 3rd/opensbi/platform/fpga/ariane/Kconfig delete mode 100644 3rd/opensbi/platform/fpga/ariane/configs/defconfig delete mode 100644 3rd/opensbi/platform/fpga/ariane/objects.mk delete mode 100644 3rd/opensbi/platform/fpga/ariane/platform.c delete mode 100644 3rd/opensbi/platform/fpga/openpiton/Kconfig delete mode 100644 3rd/opensbi/platform/fpga/openpiton/configs/defconfig delete mode 100644 3rd/opensbi/platform/fpga/openpiton/objects.mk delete mode 100644 3rd/opensbi/platform/fpga/openpiton/platform.c delete mode 100644 3rd/opensbi/platform/generic/Kconfig delete mode 100644 3rd/opensbi/platform/generic/allwinner/objects.mk delete mode 100644 3rd/opensbi/platform/generic/allwinner/sun20i-d1.c delete mode 100644 3rd/opensbi/platform/generic/andes/ae350.c delete mode 100644 3rd/opensbi/platform/generic/andes/objects.mk delete mode 100644 3rd/opensbi/platform/generic/configs/defconfig delete mode 100644 3rd/opensbi/platform/generic/include/platform_override.h delete mode 100644 3rd/opensbi/platform/generic/include/thead_c9xx.h delete mode 100644 3rd/opensbi/platform/generic/objects.mk delete mode 100644 3rd/opensbi/platform/generic/platform.c delete mode 100644 3rd/opensbi/platform/generic/platform_override_modules.carray delete mode 100644 3rd/opensbi/platform/generic/renesas/rzfive/objects.mk delete mode 100644 3rd/opensbi/platform/generic/renesas/rzfive/rzfive.c delete mode 100644 3rd/opensbi/platform/generic/sifive/fu540.c delete mode 100644 3rd/opensbi/platform/generic/sifive/fu740.c delete mode 100644 3rd/opensbi/platform/generic/sifive/objects.mk delete mode 100644 3rd/opensbi/platform/kendryte/k210/Kconfig delete mode 100644 3rd/opensbi/platform/kendryte/k210/configs/defconfig delete mode 100644 3rd/opensbi/platform/kendryte/k210/k210.dts delete mode 100644 3rd/opensbi/platform/kendryte/k210/objects.mk delete mode 100644 3rd/opensbi/platform/kendryte/k210/platform.c delete mode 100644 3rd/opensbi/platform/kendryte/k210/platform.h delete mode 100644 3rd/opensbi/platform/nuclei/ux600/Kconfig delete mode 100644 3rd/opensbi/platform/nuclei/ux600/configs/defconfig delete mode 100644 3rd/opensbi/platform/nuclei/ux600/objects.mk delete mode 100644 3rd/opensbi/platform/nuclei/ux600/platform.c delete mode 100644 3rd/opensbi/platform/template/Kconfig delete mode 100644 3rd/opensbi/platform/template/configs/defconfig delete mode 100644 3rd/opensbi/platform/template/objects.mk delete mode 100644 3rd/opensbi/platform/template/platform.c delete mode 100644 3rd/opensbi/scripts/Kconfiglib/LICENSE.txt delete mode 100755 3rd/opensbi/scripts/Kconfiglib/allnoconfig.py delete mode 100755 3rd/opensbi/scripts/Kconfiglib/allyesconfig.py delete mode 100755 3rd/opensbi/scripts/Kconfiglib/defconfig.py delete mode 100755 3rd/opensbi/scripts/Kconfiglib/genconfig.py delete mode 100644 3rd/opensbi/scripts/Kconfiglib/kconfiglib.py delete mode 100755 3rd/opensbi/scripts/Kconfiglib/menuconfig.py delete mode 100755 3rd/opensbi/scripts/Kconfiglib/oldconfig.py delete mode 100755 3rd/opensbi/scripts/Kconfiglib/olddefconfig.py delete mode 100755 3rd/opensbi/scripts/Kconfiglib/savedefconfig.py delete mode 100755 3rd/opensbi/scripts/Kconfiglib/setconfig.py delete mode 100755 3rd/opensbi/scripts/carray.sh delete mode 100755 3rd/opensbi/scripts/create-binary-archive.sh delete mode 100755 3rd/opensbi/scripts/d2c.sh delete mode 100644 3rd/ovmf/OVMF_aarch64.fd delete mode 100644 3rd/ovmf/OVMF_riscv64.fd delete mode 100644 3rd/ovmf/OVMF_x86_64.fd delete mode 100644 3rd/ovmf/RELEASEAARCH64_QEMU_EFI.fd delete mode 100644 3rd/ovmf/RELEASEAARCH64_QEMU_EFI.fd:Zone.Identifier delete mode 100644 3rd/ovmf/RELEASEAARCH64_QEMU_VARS.fd delete mode 100644 3rd/ovmf/RELEASEAARCH64_QEMU_VARS.fd:Zone.Identifier delete mode 100644 3rd/ovmf/ovmf-aarch64.fd delete mode 100644 3rd/posix-uefi/LICENSE delete mode 100644 3rd/posix-uefi/Makefile delete mode 100644 3rd/posix-uefi/OLVASSEL.md delete mode 100644 3rd/posix-uefi/README.md delete mode 100644 3rd/posix-uefi/examples/01_helloworld/Makefile delete mode 100644 3rd/posix-uefi/examples/01_helloworld/helloworld.c delete mode 100644 3rd/posix-uefi/examples/01_helloworld/screenshot.png delete mode 120000 3rd/posix-uefi/examples/01_helloworld/uefi delete mode 100644 3rd/posix-uefi/examples/02_args/Makefile delete mode 100644 3rd/posix-uefi/examples/02_args/args.c delete mode 100644 3rd/posix-uefi/examples/02_args/screenshot.png delete mode 120000 3rd/posix-uefi/examples/02_args/uefi delete mode 100644 3rd/posix-uefi/examples/03_dumpmem/Makefile delete mode 100644 3rd/posix-uefi/examples/03_dumpmem/dumpmem.c delete mode 100644 3rd/posix-uefi/examples/03_dumpmem/screenshot.png delete mode 120000 3rd/posix-uefi/examples/03_dumpmem/uefi delete mode 100644 3rd/posix-uefi/examples/04_dirent/Makefile delete mode 100644 3rd/posix-uefi/examples/04_dirent/dirent.c delete mode 100644 3rd/posix-uefi/examples/04_dirent/screenshot.png delete mode 120000 3rd/posix-uefi/examples/04_dirent/uefi delete mode 100644 3rd/posix-uefi/examples/05_file/Makefile delete mode 100644 3rd/posix-uefi/examples/05_file/file.c delete mode 100644 3rd/posix-uefi/examples/05_file/file.txt delete mode 100644 3rd/posix-uefi/examples/05_file/screenshot.png delete mode 120000 3rd/posix-uefi/examples/05_file/uefi delete mode 100644 3rd/posix-uefi/examples/06_block/Makefile delete mode 100644 3rd/posix-uefi/examples/06_block/block.c delete mode 100644 3rd/posix-uefi/examples/06_block/screenshot.png delete mode 120000 3rd/posix-uefi/examples/06_block/uefi delete mode 100644 3rd/posix-uefi/examples/07_serial/Makefile delete mode 100644 3rd/posix-uefi/examples/07_serial/screenshot.png delete mode 100644 3rd/posix-uefi/examples/07_serial/serial.c delete mode 120000 3rd/posix-uefi/examples/07_serial/uefi delete mode 100644 3rd/posix-uefi/examples/08_pointer/Makefile delete mode 100644 3rd/posix-uefi/examples/08_pointer/pointer.c delete mode 100644 3rd/posix-uefi/examples/08_pointer/screenshot.png delete mode 120000 3rd/posix-uefi/examples/08_pointer/uefi delete mode 100644 3rd/posix-uefi/examples/09_vidmodes/Makefile delete mode 100644 3rd/posix-uefi/examples/09_vidmodes/screenshot.png delete mode 120000 3rd/posix-uefi/examples/09_vidmodes/uefi delete mode 100644 3rd/posix-uefi/examples/09_vidmodes/vidmodes.c delete mode 100644 3rd/posix-uefi/examples/0A_bmpfont/Makefile delete mode 100644 3rd/posix-uefi/examples/0A_bmpfont/bmpfont.c delete mode 100644 3rd/posix-uefi/examples/0A_bmpfont/font.sfn delete mode 100644 3rd/posix-uefi/examples/0A_bmpfont/screenshot.png delete mode 120000 3rd/posix-uefi/examples/0A_bmpfont/uefi delete mode 100644 3rd/posix-uefi/examples/0B_vecfont/Makefile delete mode 100644 3rd/posix-uefi/examples/0B_vecfont/font.sfn delete mode 100644 3rd/posix-uefi/examples/0B_vecfont/screenshot.png delete mode 100644 3rd/posix-uefi/examples/0B_vecfont/ssfn.h delete mode 120000 3rd/posix-uefi/examples/0B_vecfont/uefi delete mode 100644 3rd/posix-uefi/examples/0B_vecfont/vecfont.c delete mode 100644 3rd/posix-uefi/examples/0C_png/Makefile delete mode 100644 3rd/posix-uefi/examples/0C_png/image.png delete mode 100644 3rd/posix-uefi/examples/0C_png/png.c delete mode 100644 3rd/posix-uefi/examples/0C_png/screenshot.png delete mode 100644 3rd/posix-uefi/examples/0C_png/stb_image.h delete mode 120000 3rd/posix-uefi/examples/0C_png/uefi delete mode 100644 3rd/posix-uefi/examples/0D_memmap/Makefile delete mode 100644 3rd/posix-uefi/examples/0D_memmap/memmap.c delete mode 100644 3rd/posix-uefi/examples/0D_memmap/screenshot.png delete mode 120000 3rd/posix-uefi/examples/0D_memmap/uefi delete mode 100644 3rd/posix-uefi/examples/0E_elfload/Makefile delete mode 100644 3rd/posix-uefi/examples/0E_elfload/elfload.c delete mode 100644 3rd/posix-uefi/examples/0E_elfload/kernel/Makefile delete mode 100644 3rd/posix-uefi/examples/0E_elfload/kernel/kernel.c delete mode 100644 3rd/posix-uefi/examples/0E_elfload/screenshot.png delete mode 120000 3rd/posix-uefi/examples/0E_elfload/uefi delete mode 100644 3rd/posix-uefi/examples/0F_exit_bs/Makefile delete mode 100644 3rd/posix-uefi/examples/0F_exit_bs/exit_bs.c delete mode 100644 3rd/posix-uefi/examples/0F_exit_bs/kernel/Makefile delete mode 100644 3rd/posix-uefi/examples/0F_exit_bs/kernel/bootparam.h delete mode 100644 3rd/posix-uefi/examples/0F_exit_bs/kernel/kernel.c delete mode 100644 3rd/posix-uefi/examples/0F_exit_bs/screenshot.png delete mode 120000 3rd/posix-uefi/examples/0F_exit_bs/uefi delete mode 100644 3rd/posix-uefi/uefi/Makefile delete mode 100644 3rd/posix-uefi/uefi/crt_aarch64.c delete mode 100644 3rd/posix-uefi/uefi/crt_riscv64.c delete mode 100644 3rd/posix-uefi/uefi/crt_x86_64.c delete mode 100644 3rd/posix-uefi/uefi/dirent.c delete mode 100644 3rd/posix-uefi/uefi/elf_aarch64_efi.lds delete mode 100644 3rd/posix-uefi/uefi/elf_riscv64_efi.lds delete mode 100644 3rd/posix-uefi/uefi/elf_x86_64_efi.lds delete mode 100644 3rd/posix-uefi/uefi/qsort.c delete mode 100644 3rd/posix-uefi/uefi/stat.c delete mode 100644 3rd/posix-uefi/uefi/stdio.c delete mode 100644 3rd/posix-uefi/uefi/stdlib.c delete mode 100644 3rd/posix-uefi/uefi/string.c delete mode 100644 3rd/posix-uefi/uefi/time.c delete mode 100644 3rd/posix-uefi/uefi/uefi.h delete mode 100644 3rd/posix-uefi/uefi/unistd.c delete mode 100644 3rd/posix-uefi/utils/Makefile delete mode 100644 3rd/posix-uefi/utils/OLVASSEL.md delete mode 100644 3rd/posix-uefi/utils/README.md delete mode 100644 3rd/posix-uefi/utils/efidsk.c delete mode 100644 3rd/posix-uefi/utils/efiffs.c delete mode 100644 3rd/posix-uefi/utils/efirom.c diff --git a/3rd/gnu-efi/.gitignore b/3rd/gnu-efi/.gitignore deleted file mode 100644 index 970b638e0..000000000 --- a/3rd/gnu-efi/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.efi -*.efi.debug -*.o -*.a -*.tar.* -*.tar diff --git a/3rd/gnu-efi/ChangeLog b/3rd/gnu-efi/ChangeLog deleted file mode 100644 index b30ba2520..000000000 --- a/3rd/gnu-efi/ChangeLog +++ /dev/null @@ -1,1324 +0,0 @@ - Updated Changelog - - Signed-off-by: Nigel Croxon - -commit 37d7bee82a627999563069b090866076e055a871 -Author: Nigel Croxon -Date: Thu May 14 12:38:39 2015 -0400 - - Added some missing error code descriptions - - Signed-off-by: Peter Jones - Signed-off-by: Nigel Croxon - -commit dae0b4b0b0d522caecf09123db2cf0250c37a169 -Author: Nigel Croxon -Date: Thu May 14 12:20:51 2015 -0400 - - Turns out we actually need setjmp in one of gnu-efi's prominent - users, and it seems to make more sense to put it here than in - the application. - - All of these are derived from the Tiano code, but I re-wrote the - x86_64 one because we use the ELF psABI calling conventions instead - of the MS ABI calling conventions. Which is to say you probably - shouldn't setjmp()/longjmp() between functions with EFIAPI (aka - __attribute__((ms_abi))) and those without. - - Signed-off-by: Peter Jones - Signed-off-by: Nigel Croxon - -commit b5a8e93cec396381a6d2beee022abbf50100f2fd -Author: Nigel Croxon -Date: Fri Apr 10 08:49:50 2015 -0400 - - Bump version to 3.0.2 - - Signed-off-by: Nigel Croxon - -commit 01c9f11ed5ad55661e8fc8a3eee35c578564754b -Author: Nigel Croxon -Date: Fri Apr 10 08:46:40 2015 -0400 - - Fix ARM32 and AARCH64 builds - Without these added into SUBDIRS the initplat.c compilation will fail. - - Signed-off-by: Koen Kooi - Acked-by: Ard Biesheuvel - Signed-off-by: Nigel Croxon - -commit dada63fd3de148c6f8551d253355c113547cd5a0 -Author: Nigel Croxon -Date: Mon Mar 23 10:41:43 2015 -0400 - - [PATCH] _SPrint: fix NULL termination - - maxlen is the maximum string length not the buffer size. - - Signed-off-by: Jeremy Compostella - Signed-off-by: Nigel Croxon - -commit ce7098fb52e5fd4d16038964d029eb759f28eaaf -Author: Nigel Croxon -Date: Thu Feb 19 11:22:45 2015 -0500 - - Enable out-of-tree building - - This patch enables building gnu-efi outside of the source tree. - That in turn enables building for multiple architectures in parallel. - - The build directory is controlled by the OBJDIR make variable. It - defaults to the value of ARCH, and can be overridden from the command - line. - - This patch also cleans up some doubled slashes between INSTALLROOT - and PREFIX. - - Signed-off-by: Jonathan Boeing - Signed-off-by: Nigel Croxon - -commit f64cef26270bfbe04f038da33f95ae3f14c071bc -Author: Nigel Croxon -Date: Tue Jan 6 15:49:50 2015 -0500 - - Since we're keeping this in git, it'd be nice not to see a bunch - of make targets in 'status' - - Signed-off-by: Peter Jones - Signed-off-by: Nigel Croxon - -commit 322efb6b21ed0a5e42e8f124fd22bf0f8dbf01ae -Author: Nigel Croxon -Date: Mon Jan 5 13:20:43 2015 -0500 - - version number changed from VERSION = 3.0u to VERSION = 3.0.1 - - Signed-off-by: Nigel Croxon - -commit 09027207f7c18af6caa45a744fc15c90b2a829db -Author: Nigel Croxon -Date: Mon Jan 5 13:13:22 2015 -0500 - - From: Pete Batard - Date: Wed, 10 Dec 2014 21:08:34 +0000 - Subject: [PATCH] fixes for MSVC compilation - - These fixes are needed to address the following error and warnings when compiling the library part - using Visual Studio 2013 Community Edition (as in https://github.com/pbatard/uefi-simple): - * "lib\x86_64\math.c(49): error C4235: nonstandard extension used : '_asm' keyword not supported - on this architecture" - * "lib\print.c(98): error C2059: syntax error : '('" due to placement of EFIAPI macro - * "lib\cmdline.c(94): warning C4090: 'function' : different 'const' qualifiers" - * "lib\smbios.c(25): warning C4068: unknown pragma" - * Also update macro definitions in "inc\\efibind.h" for MSVC - - Signed-off-by: Pete Batard - Signed-off-by: Nigel Croxon - -commit 15805ff38b83a72c2c7c96a24bd642ee1176d819 -Author: Nigel Croxon -Date: Tue Nov 25 14:23:21 2014 -0500 - - Add README.git file. Instructions on how to archive. - - Signed-off-by: Nigel Croxon - -commit b868aa75669723b7e32f46524822e17e388fe2ba -Author: Nigel Croxon -Date: Tue Nov 25 13:26:45 2014 -0500 - - This patch makes generating releases from git a very simple process; you - simply edit the makefile's "VERSION" line to the new version, commit - that as its own commit, and do: "make test-archive". That'll 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, - you 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: - - git push origin master:master --tags - - And upload the archive wherever it's supposed to go. - - Signed-off-by: Peter Jones - Signed-off-by: Nigel Croxon - -commit 530d68ba191850edafc6da22cb2df55bec0c5fa5 -Author: Nigel Croxon -Date: Tue Nov 25 10:09:50 2014 -0500 - - The gnu-efi-3.0 toplevel subdirectory is really annoying. Kill it. - - Signed-off-by: Peter Jones - Signed-off-by: Nigel Croxon - -commit 00bd66ef46b59a1623a293491a8b2c65a6d61975 -Author: Nigel Croxon -Date: Mon Nov 24 14:33:09 2014 -0500 - - FreeBSD's binutils doesn't have "-j " support, so we need to - include non-globbed versions of .rel/.rela individually. - - Signed-off-by: Peter Jones - Signed-off-by: Bill Paul - Signed-off-by: Nigel Croxon - -commit 56eb64d3c06854b9b68d61e3c2d3bdf6ff2a9853 -Author: Nigel Croxon -Date: Mon Nov 24 14:27:14 2014 -0500 - - Right now we wind up trying to build gnuefi/.o from a source file that's - an empty string. This is caused by the macros trying to generate - install rules, but there's no real reason to have all that anyway. So - just have some static install rules that are simpler and don't generate - stuff on the fly. - - Signed-off-by: Peter Jones - Signed-off-by: Nigel Croxon - -commit 65e28a90a7be9e990b360286cea31e63319217fb -Author: Nigel Croxon -Date: Mon Nov 24 12:17:45 2014 -0500 - - Add current OsIndications values. - - Signed-off-by: Peter Jones - Signed-off-by: Nigel Croxon -Date: Mon Nov 24 12:15:34 2014 -0500 - - Add the QueryVariableInfo() API. - - Signed-off-by: Peter Jones - Signed-off-by: Nigel Croxon - -commit 60efb7a2939b65a01e95aa8b535f1b756d984fba -Author: Nigel Croxon -Date: Mon Nov 24 12:13:23 2014 -0500 - - Add the capsule API. - - Signed-off-by: Peter Jones - Signed-off-by: Nigel Croxon - -commit ef08b655d1f8dfbd9a0f3a86d5685b24695ef12f -Author: Nigel Croxon -Date: Mon Nov 17 16:05:42 2014 -0500 - - Fix Table Header misspelling. Change from EFI_TABLE_HEARDER to - EFI_TABLE_HEADER. - - Signed-Off-By: Nigel Croxon - -commit 370cce41da3fff41ba38feb1262002aff2d85ffd -Author: Nigel Croxon -Date: Thu Nov 6 14:41:40 2014 -0500 - - If CROSS_COMPILE is set, ignore the ARCH value supplied on the - command line and use the target machine of the cross compiler. - - Signed-off-by: Ard Biesheuvel - Signed-off-by: Nigel Croxon - -commit d32fb845433ff6fb38e81ae0d9273454e7d18197 -Author: Nigel Croxon -Date: Thu Nov 6 14:30:03 2014 -0500 - - Allow reuse of this file beyond GPL compatible software, - update the license of crt0-efi-aarch64.S to dual 2-clause BSD/GPLv2+. - - Signed-off-by: Ard Biesheuvel - Signed-off-by: Nigel Croxon - -commit aa1df67f48f3c035fa8891e1bb311ec21500d6d9 -Author: Nigel Croxon -Date: Tue Oct 21 11:08:47 2014 -0400 - - Add the missing Variable attributes - - From: Jeremy Compostella - Date: Mon, 13 Oct 2014 17:50:50 +0200 - Subject: [PATCH] Add the missing Variable attributes - - Signed-off-by: Jeremy Compostella - Signed-off-by: Nigel Croxon - -commit 5706dff09364cbbec37f47e2fe1350747f631d74 -Author: Nigel Croxon -Date: Tue Aug 26 10:54:22 2014 -0400 - - From: David Decotigny - Date: Mon, 25 Aug 2014 13:28:49 -0700 - Subject: [PATCH] document that binutils >= 2.24 needed. - - commit ac983081 "Add support for non-PE/COFF capable objcopy" depends - on objcopy accepting wildcards for the section names. This feature is - available only with binutils >= 2.24 (binutils 2e62b7218 "PR - binutils/15033"). - - Signed-off-by: David Decotigny - Signed-off-by: Nigel Croxon - -commit 6c10e225bc759d69af520a551b9d7b37f3ae0a82 -Author: Nigel Croxon -Date: Mon Aug 25 08:51:23 2014 -0400 - - From: David Decotigny - Date: Thu, 31 Jul 2014 18:19:16 -0700 - Subject: [PATCH 5/5] allow to use external stdarg.h - - in cases we use gnu-efi together with other libs that define stdarg.h, - break the tie by telling gnu-efi to use that stdarg.h . - - Signed-off-by: David Decotigny - Signed-off-by: Nigel Croxon - -commit 16d65c0669258c8044e3549b2d9eb0cf0eb08f5a -Author: Nigel Croxon -Date: Tue Aug 19 12:07:00 2014 -0400 - - From: Ard Biesheuvel - Date: Mon, 11 Aug 2014 15:39:16 +0200 - Subject: [PATCH] Add support for 32-bit ARM - - This adds support for 32-bit ARM using an approach similar to the one used for - 64-bit ARM (AArch64), i.e., it does not rely on an objcopy that is aware of EFI - or PE/COFF, but lays out the entire PE/COFF header using the assembler. - - In the 32-bit ARM case (which does not have a division instruction), some code - has been imported from the Linux kernel to perform the division operations in - software. - - Signed-off-by: Ard Biesheuvel - Signed-off-by: Nigel Croxon - -commit b28143d4fb4f6969dc0c87c853d3527d889951d7 -Author: Nigel Croxon -Date: Fri Aug 8 15:54:19 2014 -0400 - - Updated Changelog - - Signed-off-by: Nigel Croxon - -commit 1525190354f5faac33015e17c9ba7ea2bb2be35b -Author: Nigel Croxon -Date: Fri Aug 8 15:35:09 2014 -0400 - - From: Ard Biesheuvel - Date: Fri, 8 Aug 2014 18:16:59 +0200 - Subject: [PATCH 4/4] Add support for 64-bit ARM (AArch64) - - This adds support for 64-bit ARM (AArch64) environments. Since there is no - EFI-capable objcopy for this platform, this contains a manually laid out - PE/COFF header using the assembler. - - In addition, it includes the relocation bits, some string functions that GCC - assumes are available and other glue to hold it all together. - - This can be cross built using - - make CROSS_COMPILE=aarch64-linux-gnu- - - Signed-off-by: Ard Biesheuvel - Signed-off-by: Nigel Croxon - -commit ac983081525f9483941517dfb53cf8d0163d49c0 -Author: Nigel Croxon -Date: Fri Aug 8 15:32:26 2014 -0400 - - From: Ard Biesheuvel - Date: Fri, 8 Aug 2014 17:53:42 +0200 - Subject: [PATCH 3/4] Add support for non-PE/COFF capable objcopy - - Introduce HAVE_EFI_OBJCOPY and set it if objcopy for $ARCH support PE/COOF and - EFI, i.e., it supports --target efi-[app|bsdrv|rtdrv] options. Use it to decide - whether to invoke objcopy with those options or use the linker to populate the - PE/COFF header. - - Signed-off-by: Ard Biesheuvel - Signed-off-by: Nigel Croxon - -commit fb063f0f65543b3e2bf55a39d5aa70b17a98c65e -Author: Nigel Croxon -Date: Fri Aug 8 15:26:38 2014 -0400 - - From: Ard Biesheuvel - Date: Fri, 8 Aug 2014 17:37:36 +0200 - Subject: [PATCH 2/4] Add support for cross compilation - - This changes the logic that defines ARCH (and HOSTARCH) to take CROSS_COMPILE - into account. Also, $prefix is not assigned, so that the default will be what - is on the path rather than hardcoded in /usr/bin. - - This results in the build doing the right thing if CROSS_COMPILE is set in the - environment and no ARCH or prefix options are passed to make, aligning it with - most other CROSS_COMPILE compatible projects. - - Signed-off-by: Ard Biesheuvel - Signed-off-by: Nigel Croxon - -commit 7a98d83fc32de6cf0b1ce5e12dfe80690f29fb3f -Author: Nigel Croxon -Date: Fri Aug 8 15:25:03 2014 -0400 - - From: Ard Biesheuvel - Date: Fri, 8 Aug 2014 16:50:45 +0200 - Subject: [PATCH 1/4] Restrict GNU_EFI_USE_MS_ABI GCC version test to x86_64 - - The version test only applies to x86_64 builds, so no need to do it - for other archs. - - Signed-off-by: Ard Biesheuvel - Signed-off-by: Nigel Croxon - -commit f42974dd9a7d0ea690d293f88396abd289f0014c -Author: Nigel Croxon -Date: Fri Aug 8 15:21:16 2014 -0400 - - From: David Decotigny - Date: Thu, 31 Jul 2014 13:42:23 -0700 - Subject: [PATCH 4/4] Use Shell protocols to retrieve argc/argv, when - available. - - New header files efishellintf.h efishellparm.h are coming from EDK - II, initial location and license at top of files. Only modifications: - - efishellintf.h: s/EFI_FILE_PROTOCOL/EFI_FILE/ + expand BITx macros (1< - Signed-off-by: Nigel Croxon - -commit a61fa058e9a87f966de3342b8c95fdbdcb007827 -Author: Nigel Croxon -Date: Fri Aug 8 15:17:32 2014 -0400 - - From: David Decotigny - Date: Thu, 31 Jul 2014 13:41:52 -0700 - Subject: [PATCH 3/4] document format of LoadedImage::LoadOptions data - - Signed-off-by: David Decotigny - Signed-off-by: Nigel Croxon - -commit 2f440200c855154f929d28971b2fd702ea7a207a -Author: Nigel Croxon -Date: Fri Aug 8 15:15:59 2014 -0400 - - From: David Decotigny - Date: Thu, 31 Jul 2014 13:39:37 -0700 - Subject: [PATCH 2/4] Use OpenProtocol instead of HandleProtocol - - UEFI 2.x recommends OpenProtocol instead of HandleProtocol. - - Signed-off-by: David Decotigny - Signed-off-by: Nigel Croxon - -commit 7f173da1e54f8cfe4c7c7c091ab6585af07b25ce -Author: Nigel Croxon -Date: Fri Aug 8 15:14:26 2014 -0400 - - From: David Decotigny - Date: Thu, 31 Jul 2014 13:30:07 -0700 - Subject: [PATCH 1/4] move cmdline parser to its own file - - Signed-off-by: David Decotigny - Signed-off-by: Nigel Croxon - -commit 0ad8fb87cbc59f58675b18253ad802ba51f1d132 -Author: Nigel Croxon -Date: Wed Jul 30 15:06:36 2014 -0400 - - From: David Decotigny - Date: Mon, 28 Jul 2014 21:28:50 -0700 - Subject: [PATCH 3/3] make cmdline parsing a 1st class citizen - - Refactor ParseCmdline and apps/Alloc+FreePages to factorize - boilerplate and move the new parser to the main API. - - Signed-off-by: David Decotigny - Signed-off-by: Nigel Croxon - -commit ff7ec964f2c0de0cfc4b52cfdd356003450f28bf -Author: Nigel Croxon -Date: Wed Jul 30 15:05:28 2014 -0400 - - From: David Decotigny - Date: Mon, 28 Jul 2014 21:00:52 -0700 - Subject: [PATCH 2/3] Avoid buffer overflow while parsing the cmdline args - - Signed-off-by: David Decotigny - Signed-off-by: Nigel Croxon - -commit 8d86ee202a9bb553375f56ae1d2944818112b68b -Author: Nigel Croxon -Date: Wed Jul 30 15:04:44 2014 -0400 - - From: David Decotigny - Date: Mon, 28 Jul 2014 21:01:35 -0700 - Subject: [PATCH 1/3] Fix cmdline parser - - The cmdline parser would not return the correct number of args, would - allocate one too many. Also make it clear from the declaration that we - expect a suitably lare argv. - - Signed-off-by: David Decotigny - Signed-off-by: Nigel Croxon - -commit 1ec094bfaf46a610a740dadc0150bf457dd72345 -Author: Nigel Croxon -Date: Wed Jul 23 09:54:25 2014 -0400 - - From: Julian Klode - Date: Mon, 21 Jul 2014 14:26:23 -0400 - Subject: [PATCH] inc/efistdarg.h: Use gcc builtins instead of stdarg.h or broken stubs - - We cannot use stdarg.h, as this breaks applications compiling - with -nostdinc because those will not find the header. - We also cannot use the stubs, as they just produce broken code, - as seen in the gummiboot 45-1 Debian release. - - Signed-off-by: Julian Klode - Signed-off-by: Nigel Croxon - -commit 6caab22f23434f41f42cfe7591d9a7ae66de9f0a -Author: Nigel Croxon -Date: Thu Jun 19 10:39:23 2014 -0400 - - From: Laszlo Ersek - Date: Mon, 2 Jun 2014 23:26:48 +0200 - Subject: [PATCH] always observe EFIAPI calling convention when calling - STO.SetAttribute - - We have to consider the following cases wrt. the PRINT_STATE.Output and - PRINT_STATE.SetAttr EFIAPI function pointers, especially when building for - x86_64 with gcc: - - (1) The compiler is new enough, and EFIAPI actually ensures the Microsoft - calling convention. In this case everything happens to work fine even - if we forget uefi_call_wrapper(), because the wrapper would expand to - a normal C function call anyway. - - (2) Otherwise (ie. gcc is old), EFIAPI expands to nothing, and we must - take into account the called function's origin: - - (2a) If the callee that is declared EFIAPI is *defined* inside gnu-efi, - then EFIAPI means nothing for the callee too, so caller and callee - only understand each other if the caller intentionally omits - uefi_call_wrapper(). - - (2b) If the callee that is declared EFIAPI is defined by the platform - UEFI implementation, then the caller *must* use - uefi_call_wrapper(). - - The PRINT_STATE.Output EFIAPI function pointer is dereferenced correctly: - the PFLUSH() distinguishes cases (2a) from (2b) by using IsLocalPrint(). - - However use of the PRINT_STATE.SetAttr EFIAPI function pointer is not - always correct: - - - The PSETATTR() helper function always relies on the wrapper (case (2b)). - This is correct, because PRINT_STATE.SetAttr always points to a - platform-provided function. - - - The DbgPrint() function contains two incorrect calls: they mistakenly - assume case (2a) (or case (1)), even though the pointer always points to - a platform function, implying (2b). (The error is masked in case (1).) - Fix them. - - Signed-off-by: Laszlo Ersek - Signed-off-by: Nigel Croxon - -commit ecfd1ded9a799c3a572d4eb7fbb52582fe4d3390 -Author: Nigel Croxon -Date: Tue Jun 10 12:59:09 2014 -0400 - - Add VPoolPrint Function - - Equivalent to PoolPrint but using a va_list parameter - - Signed-off-by: Sylvain Chouleur - Signed-off-by: Nigel Croxon - -commit f16d93f3b9e314336a387a3885c7fd2f176c41d3 -Author: Nigel Croxon -Date: Fri May 16 11:33:51 2014 -0400 - - Revert "The prototype of DbgPrint() is incorrect, at the end of "inc/efidebug.h"." - A problem was found compiling on GCC 4.8. - - This reverts commit 644898eabc06c8efaa3aa54f84cdd468960a2f6c. - -commit 644898eabc06c8efaa3aa54f84cdd468960a2f6c -Author: Nigel Croxon -Date: Wed May 14 09:09:47 2014 -0400 - - The prototype of DbgPrint() is incorrect, at the end of "inc/efidebug.h". - Consequently, when your program calls DbgPrint() via the DEBUG() macro, - it fails to set up the stack correctly (it does not pass the arguments - through the ellipsis (...) according to the EFIAPI calling convention). - However, va_start() inside DbgPrint() *assumes* that stack. - - Signed-off-by: Laszlo Ersek - Signed-off-by: Nigel Croxon - -commit 8921ba2fc5f6163bdad3b5902c5d9d638415dde0 -Author: Nigel Croxon -Date: Mon Apr 14 18:49:23 2014 -0400 - - Cleaned up compile warnings. - - Signed-off-by: Nigel Croxon - -commit 42cca551dbf1c0be9e02e8d3d3c417ce35749638 -Author: Nigel Croxon -Date: Mon Apr 14 14:04:11 2014 -0400 - - Module lib/ParseCmdLine.c has errors, it incorrectly mixes "char" and "CHAR16" - and uses a pointer to argv[] like it's argv[]. The compiler only issues - warnings though. Here is a patch to remove compiler warnings and make the - code behave. - - Signed-off-by: Bernard Burette - Signed-off-by: Nigel Croxon - -commit 4e8460f1aedd2724de876be5b154eb5752bfada5 -Author: Nigel Croxon -Date: Mon Apr 14 13:53:03 2014 -0400 - - Here is a very small patch to remove a compiler warning when processing lib/smbios.c. - - Signed-off-by: Bernard Burette - Signed-off-by: Nigel Croxon - -commit 6a0875ca2fcb67e7d1a1e2d15f3bcc645329dc75 -Author: Nigel Croxon -Date: Mon Apr 14 13:45:16 2014 -0400 - - Here is a very small patch to remove compiler warning in function - "LibLocateHandleByDiskSignature()" because the "Start" variable is - give a value which is not used. - - Signed-off-by: Bernard Burette - Signed-off-by: Nigel Croxon - -commit d5f35dfb8008ba65bcc641559accd9bc13386ef9 -Author: Nigel Croxon -Date: Mon Apr 14 13:40:29 2014 -0400 - - Here is a very small patch to remove *~ files in include diretory. - - Signed-off-by: Bernard Burette - Signed-off-by: Nigel Croxon - -commit 1a04669a7bb022984c9b54a0f73d7d67a2540fb7 -Author: Nigel Croxon -Date: Mon Apr 14 12:45:57 2014 -0400 - - Here is a patch for "DevicePathToStr()" to display device path according to UEFI 2 specification. - The path is in the two files inc/efidevp.h and lib/dpath.c. - - It also add the Sata device path and removes the "/?" path for unknown device paths. - - Signed-off-by: Bernard Burette - Signed-off-by: Nigel Croxon - -commit 3c62e78556aea01e9798380cd46794c6ca09d4bd -Author: Nigel Croxon -Date: Tue Apr 1 10:26:44 2014 -0400 - - Removed GPL code setjmp_ia32.S, setjmp_ia64.S, setjmp_x86_64.S - Not used anymore. - - Signed-off-by: Nigel Croxon - -commit f9baa4f622cf34576d73e00d4a774a31f0f81fd7 -Author: Nigel Croxon -Date: Mon Mar 31 08:37:56 2014 -0400 - - Remove incumbent GPL 'debian' subdiretory. - Update ChangeLog - - Signed-off-by: Nigel Croxon - - -Changelog format change from here and above to 'git log' style. - -2014-04-01 Nigel Croxon - - Removed GPL code setjmp_ia32.S, setjmp_ia64.S, setjmp_x86_64.S - Not used anymore. - - Signed-off-by: Nigel Croxon - -2014-03-17 Nigel Croxon - - Add support for the simple pointer and absolute pointer protocols - - Signed-off-by: John Cronin - Signed-off-by: Nigel Croxon - -2014-03-14 Nigel Croxon - - Trying to recurse into subdirectories of object files may lead - to an error if the directory doesn't exist. Even when cleaning. - - Signed-off-by: Sylvain Gault - Signed-off-by: Nigel Croxon - -2014-03-14 Nigel Croxon - - Make install used to copy files unconditionnally to their - destination. However, if the destination is used by another - Makefile, it will always see modified files. "install" target - now only updates the files when they need to. - - Signed-off-by: Sylvain Gault - Signed-off-by: Nigel Croxon - -2014-02-13 Nigel Croxon - - Patch GNU-EFI to remove the ELILO code - - Signed-off-by: Jerry Hoemann - Signed-off-by: Nigel Croxon - -2014-02-13 Nigel Croxon - - Initialize Status before calling GrowBuffer() - Status must be initialized before calling GrowBuffer() as it may - otherwise be uninitialized or set to EFI_BUFFER_TOO_SMALL by - other functions. - - Signed-off-by: Gene Cumm - Signed-off-by: Nigel Croxon - -2014-01-23 Nigel Croxon - - These changes allow manually overridden SRCDIR (current source - directory) and TOPDIR (top of source tree) to separate the - build directory from the source tree. - - Signed-off-by: Gene Cumm - Signed-off-by: Nigel Croxon - -2014-01-16 Nigel Croxon - compilation: fix uninitialized variables warning - - Signed-off-by: Jeremy Compostella - Signed-off-by: Nigel Croxon - -2014-01-13 Nigel Croxon - Implement VSPrint function, prints a formatted unicode string to a buffer. - - Signed-off-by: Jeremy Compostella - Signed-off-by: Nigel Croxon - -2014-01-10 Nigel Croxon - Created lib/argify.c and inc/argify.h containing the function argify. - It contains verbatim copy of the comment at beginning of file from - elilo. - There was no COPYING file in the elilo source that the comment refers to. - - Signed-off-by: Jerry Hoemann - Signed-off-by: Nigel Croxon - -2014-01-08 Nigel Croxon - The information needed is not really the host architecture as given by - the kernel arch. The information actually needed is the default target - of gcc. - - Signed-off-by: Sylvain Gault - Signed-off-by: Nigel Croxon - -2013-10-11 Nigel Croxon - Added support for SetVariable to store volatile variable, - and SetNVVariable to store non volatile variable. - - Signed-off-by: Sylvain Chouleur - Signed-off-by: Nigel Croxon - -2013-10-07 Nigel Croxon - - Atoi needs to have consistent declaration/definition. - - Signed-off-by: Nigel Croxon - -2013-10-07 Nigel Croxon - if you have a function that takes const arguments and then - e.g. tries to copy StrCmp, gcc will give you warnings about those - calls, and the warnings are right. These clutter up other things - you might miss that you should be more concered about. - - You could work around it through vigorous typecasting - to non-const types, but why should you have to? All of these - functions are regorously defined as not changing their input - - it is const, and should be marked as such. - - Signed-off-by: Peter Jones - -2013-10-02 Nigel Croxon - - Added two simple applications to allocate/free memory at EFI. - Used to test/find memory fragmentation issues linux. - - Signed-off-by: Jerry Hoemann - Signed-off-by: Nigel Croxon - -2013-06-25 Nigel Croxon - Sample boot service driver. - - Signed-off-by: David Decotigny - -2013-06-25 Nigel Croxon -Date: Tue Jun 25 08:47:03 2013 -0400 - - Be more pedantic when linking, don't allow duplicate symbols, - abort upon first error. Also make sure linker script comes - last for apps. - - Signed-off-by: David Decotigny - -2013-06-25 Nigel Croxon - Fix compilation on x86_64 without HAVE_USE_MS_ABI - make -C apps would fail on tcc.c because uefi_call_wrapper() - doesn't deal correctly with efi_callO-type invocation. - - Signed-off-by: David Decotigny - -2013-06-12 Nigel Croxon - Fix typo when disabling mno-mmx - - Signed-Off-By: Nigel Croxon - -2013-06-12 Nigel Croxon - Disable MMX and SSE - - GCC 4.8.0 adds some optimizations that will use movups/movaps (and use - %xmm* registers) when they're faster, and of course that won't work at - all since UEFI firmwares aren't guaranteed to initialize the mmx/sse - instructions. - - This will be even more annoying, since most UEFI firmwares don't - initialize the #DE or #UD trap handlers, and your backtrace will be a - random path through uninitialized memory, occasionally including - whatever address the IDT has for #UD, but also addresses like "0x4" and - "0x507" that you don't normally expect to see in your call path. - - Signed-off-by: Peter Jones - - Author: Nigel Croxon - Date: Wed Jun 12 10:29:40 2013 -0400 - - bug in make 3.82 expand to odd values - - Some Makefiles tickle a bug in make 3.82 that cause libefi.a - and libgnuefi.a dependencies to expand to the odd values: - - libefi.a: boxdraw.o) smbios.o) ... - libgnuefi.a(reloc_x86_64.o: - - The patch replaces libgnuefi.a($(OBJS)) & libefi.a($(OBJS)) - with an equivalent expansion that should work with any make - that supports $(patsubst). - - Author: Nigel Croxon - Date: Wed Jun 12 09:53:01 2013 -0400 - - support .text.* sections on x86_64 - - Group them in .text. Also add vague linkage sections in .text. - - Signed-off-by: David Decotigny - - Author: Nigel Croxon - Date: Wed Jun 12 09:51:36 2013 -0400 - - cleanup and fix Make.defaults - - Reorder variables in Make.defaults so that they are grouped by - functions. Also fixed ifeq (x,y) to have required syntax and make it - work for ARCH amd64->x86_64 renaming on BSD. Also provides top-level - Makefile with a "mkvars" target that displays effective variables. - - Signed-off-by: David Decotigny - - Author: Nigel Croxon - Date: Wed Jun 12 09:47:16 2013 -0400 - - automatically determine number of uefi_call_wrapper() args on x86_64 - - Instead of asking developers to explicitly pass the number of - parameters to the functions that get called, we determine them - automatically at preprocessing time. This should result in more - robust code. - - Argument va_num is now ignored in x86_64 code, both with and - without HAVE_USE_MS_ABI. - - Credits to the macro magic given in the comments. - - Signed-off-by: David Decotigny - - Author: Nigel Croxon - Date: Wed Jun 12 09:38:10 2013 -0400 - - fix parameter-passing corruption on x86_64 for >= 5 args - - On x86_64 without HAVE_USE_MS_ABI support, uefi_call_wrapper() is a - variadic function. Parameters >=5 are copied to the stack and, when - passed small immediate values (and possibly other parameters), gcc - would emit a movl instruction before calling uefi_call_wrapper(). As a - result, only the lower 32b of these stack values are significant, the - upper 32b potentially contain garbage. Considering that - uefi_call_wrapper() assumes these arguments are clean 64b values - before calling the efi_callX() trampolines, the latter may be passed - garbage. This makes calling functions like - EFI_PCI_IO_PROTOCOL.Mem.Read()/Write() or BS->OpenProtocol() quite - unreliable. - - This patch fixes this by turning uefi_call_wrapper() into a macro that - allows to expose the efi_callX() trampoline signatures to the callers, - so that gcc can know upfront that it has to pass all arguments to - efi_callX() as clean 64b values (eg. movq for immediates). The - _cast64_efi_callX macros are just here to avoid a gcc warning, they do - nothing otherwise. - - Signed-off-by: David Decotigny - - Author: noxorc - Date: Wed May 15 15:26:16 2013 -0400 - - - Removes the ElfW() macro usage from reloc_ia32.c and reloc_x86_64.c. These - macros only exist in link.h on Linux. On FreeBSD, the equivalent macro is - __ElfN(). But the macro usage is redundant. You're only going to compile the - ia32 file for IA32 binaries and the x86_64 file for X64 binaries. If you had - just one file built for both cases, then using the macro might make more - sense. - - - Removes the "#define foo_t efi_foo_t" macros from reloc_ia32.c and - reloc_x86_64.c. - - - Modifies inc/x86_64/efibind.h and inc/ia32/efibind.h to use the new - definitions for uint64_t, int64_t and int8_t. The 64-bit types are now defined - as: - - typedef int __attribute__((__mode__(__DI__))) int64_t; - typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t; - - This removes the conflict between the host types dragged in by elf.h and the - type definitions in efibind.h that made the #define foo_t efi_foo_t" hack - necessary. Also, int8_t is now defined as signed char instead of just char - (assuming char == signed char is apparently not good enough). - - - Also modifies these files to use stdint.h instead of stdint-gcc.h. It's - unclear if this is completely correct, but stdint-gcc.h is not present with - all GCC installs, and if you use -std=c99 or later you will force this case to - be hit. This also can break clang, which doesn't have a stdint-gcc.h at all. - - - Removes the #include of from reloc_ia32.c and reloc_x86_64.c (since - with the previous changes it's not needed anymore). - - - Places the #include of after #include /#include so - that we know the types will always be defined properly, in case you build on a - system where doesn't automatically pull in the right header files to - define all the needed types. (This actually happens on VxWorks. It's harmless - elsewhere. If you don't care about VxWorks, you can leave this out.) - - - Modifies setjmp_ia32.S and setjmp_x86_64.S so to change "function" to - @function. The clang compiler doesn't like the former. Clang and GCC both like - the latter. - - - Modifles Make.defaults so that if ARCH is detected as "amd64," it's changed - to "x86_64." It happens that uname -m on 64-bit FreeBSD reports the former - rather than the latter, which breaks the build. This may also be the case on - some other OSes. There's a way to force uname(1) to return x86_64 as the - machine type, but this way is a little friendlier. - - - Creates gnuefi/elf_ia32_fbsd_efi.lds which specifies the object file type as - elf-ia32-freebsd. This is required for building on FreeBSD/i386, not just - FreeBSD/amd64. - - - Modifies apps/Makefile to always use - $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds when building on either 32-bit or - 64-bit FreeBSD instead of just for the x86_64 case. - - - Changed LDFLAGS in Make.defaults to include --no-undefined. This will cause - linking to fail if there are any unsatisfied symbols when creating foo.so - during any of the app builds, as opposed to just silently succeeding and - producing an unusable binary. - - - Changed CFLAGS to include -ffreestanding -fno-stack-protector -fno-stack- - check. This prevents clang from inserting a call to memset() when compiling - the RtZeroMem() and RtSetMem() routines in lib/runtime/efirtlib.c and guards - against the native compiler in some Linux distros from adding in stack - checking code which relies on libc help that isn't present in the EFI runtime - environment. - - This does the following: - - - Cleans up the ia32 and x86-64 relocation code a bit (tries to break the - dependency between the host ELF headers and the EFI runtime environment) - - Avoids the dependency on stdint-gcc.h which may not always be available - - Allows GNU EFI to build out of the box on both FreeBSD/i386 and - FreeBSD/amd64 - - Allows GNU EFI to build out of the box with either GCC or clang on - FreeBSD/i386 and FreeBSD/amd64 9.0 and later. - - Makes things a little easier to port to VxWorks - - Avoids creating un-runable binaries with unresolved symbol definitions - (which can be very confusing to debug) - - Author: noxorc - Date: Wed May 8 16:29:45 2013 -0400 - - Add the definitions for TCP, UDP and IP, for both IPv4 and IPv6. - - -2013-05-02 Nigel Croxon - * Chnage from Matt Fleming - - Preparation for adding the networking protocol definitions. - Add the service binding protocol. - -2013-02-21 Nigel Croxon - * Change from Peter Jones - - Previously we were incorrectly passing 3 functions with - the System V ABI to UEFI functions as EFI ABI functions. - Mark them as EFIAPI so the compiler will (in our new - GNU_EFI_USE_MS_ABI world) use the correct ABI. - - These need to be EFIAPI functions because in some cases - they call ST->ConOut->OutputString(), which is an EFIAPI - function. (Which means that previously in cases that - needed "cdecl", these didn't work right.) - - If the compiler version is new enough, and GNU_EFI_USE_MS_ABI - is defined, use the function attribute ms_abi on everything - defined with "EFIAPI". Such calls will no longer go through - efi_call*, and as such will be properly type-checked. - - Honor PREFIX and LIBDIR correctly when passed in during the build. - - Add machine type defines for i386, arm/thumb, ia64, ebc, x86_64. - - __STDC_VERSION__ never actually gets defined unless there's a - --std=... line. So we were accidentally defining lots of c99 - types ourself. Since it's 2012, use --std=c11 where appropriate, - and if it's defined and we're using gcc, actually include gcc's - stdint definitions. - - New test application added: route80h. This is a test program - for PciIo. It routes ioport 80h on ICH10 to PCI. This is also - useful on a very limited set of hardware to enable use of - a port 80h debug card. - - New test applcation added: modelist. This lists video modes - the GOP driver is showing us. - * Change from Finnbarr Murphy - - https://sourceforge.net/p/gnu-efi/feature-requests/2/ - Please add the following status codes to - EFI_INCOMPATIBLE_VERSION 25 - EFI_SECURITY_VIOLATION 26 - EFI_CRC_ERROR 27 - EFI_END_OF_MEDIA 28 - EFI_END_OF_FILE 31 - EFI_INVALID_LANGUAGE 32 - EFI_COMPROMISED_DATA 33 - * Change from SourceForge.net Bug report - - https://sourceforge.net/p/gnu-efi/bugs/5/ - BufferSize is a UINT64 *. The file shipped with GNU EFI is from - 1998 whereas the latest one is from 2004. I suspect Intel changed - the API in order handle 64-bit systems. - * Change from Felipe Contreras - - The current code seems to screw the stack at certain points. - Multiple people have complained that gummiboot hangs right away, - which is in part the fault of gummiboot, but happens only - because the stack gets screwed. x86_64 EFI already aligns the - stack, so there's no need for so much code to find a proper - alignment, we always need to shift by 8 anyway. - * Change from A. Steinmetz - - https://sourceforge.net/p/gnu-efi/patches/1/ - The patch prepares for elilo to support uefi pxe over ipv6 - See uefi spec 2.3.1 errata c page 963 as reference. - Verfied on an ASUS Sabertooth X79 BIOS Rev. 2104 system which - is able to do an IPv6 UEFI PXE boot. - * Release 3.0t - -2012-09-21 Nigel Croxon - * Change from Peter Jones - - EFI Block I/O protocol versions 2 and 3 provide more information - regarding physical disk layout, including alingment offset at the - beginning of the disk ("LowestAlignedLba"), logical block size - ("LogicalBlocksPerPhysicalBlock"), and optimal block transfer size - ("OptimalTransferLengthGranularity"). - * Release 3.0r - -2012-04-30 Nigel Croxon - * Change from Matt Fleming - - The .reloc section is now 4096-byte boundary for x86_64. - Without this patch the .reloc section will not adhere to - the alignment value in the FileAlignment field (512 bytes by - default) of the PE/COFF header. This results in a signed - executable failing to boot in a secure boot environment. - * Release 3.0q - -2011-12-12 Nigel Croxon - * Changes from Fenghua Yu - - This fixes redefined types compilation failure for tcc.c on x86_64 machines. - * Release 3.0p - -2011-11-15 Nigel Croxon - * Changes from Darren Hart - - Conditionally assign toolchain binaries to allow overriding them. - - Force a dependency on lib for gnuefi. - * Release 3.0n - -2011-08-23 Nigel Croxon - * Changes from Peter Jones - - Add guarantee 16-byte stack alignment on x86_64. - - Add routine to make callbacks work. - - Add apps/tcc.efi to test calling convention. - * Release 3.0m - -2011-07-22 Nigel Croxon - * Changed Makefiles from GPL to BSD. - * Changes from Peter Jones - - Add ifdefs for ia64 to mirror ia32 and x86-64 so that - one can build with GCC. - - Add headers for PciIo. - - Add the UEFI 2.x bits for EFI_BOOT_SERVICES - - Add an ignore for .note.GNU-stack section in X86-64 linker maps. - * Release 3.0l - -2011-04-07 Nigel Croxon - * Change license from GPL to BSD. - * Release 3.0j - -2009-09-12 Julien BLACHE - * Add support for FreeBSD. - * Release 3.0i - -2009-09-11 Julien BLACHE - * Fix elf_ia32_efi.lds linker script to be compatible with the new - linker behaviour. Patch from the RedHat bugzilla 492183. - -2009-06-18 Nigel Croxon - * Release 3.0h - -2008-11-06 Nigel Croxon - * Fix to not having any relocations at all. - -2008-09-18 Nigel Croxon - * Use LIBDIR in makefiles - * Add setjmp/longjmp - * Fixes incorrect section attribute in crt0-efi-ia32.S - * Adds value EfiResetShutdown to enum EFI_RESET_TYPE - * Fixes a RAW warning in reloc_ia64.S - * Adds the USB HCI device path structure in the headers - patches were supplied by Peter Jones @ RedHat - -2008-02-22 Nigel Croxon - * Added '-mno-red-zone' to x68_64 compiles. - Patch provided by Mats Andersson. - -2008-01-23 Nigel Croxon - * release 3.0e to support x86_64 - EFI calling convention, the stack should be aligned in 16 bytes - to make it possible to use SSE2 in EFI boot services. - This patch fixes this issue. Patch provided by Huang Ying from Intel. - -2007-05-11 Nigel Croxon - * release 3.0d to support x86_64 from Chandramouli Narayanan - from Intel and based on 3.0c-1 - -2006-03-21 Stephane Eranian - * merged patch to support gcc-4.1 submitted by - Raymund Will from Novell/SuSE - -2006-03-20 Stephane Eranian - * updated ia-64 and ia-32 linker scripts to - match latest gcc. The new gcc may put functions in - .text* sections. patch submitted by H.J. Lu from Intel. - -2004-11-19 Stephane Eranian - * added patch to ignore .eh_frame section for IA-32. Patch - submitted by Jim Wilson - -2004-09-23 Stephane Eranian - * added patch to discard unwind sections, newer toolchains - complained about them. Patch submitted by Jesse Barnes from SGI. - -2003-09-29 Stephane Eranian - * updated elf_ia64_efi.lds to reflect new data sections - created by gcc-3.3. Patch provided by Andreas Schwab from Suse. - -2003-06-20 Stephane Eranian - * updated elf_ia64_efi.lds and elf_ia32_efi.lds to include - new types data sections produced by recent version of gcc-3.x - -2002-02-22 Stephane Eranian - * release 3.0a - * modified both IA-64 and IA-32 loader scripts to add support for the - new .rodata sections names (such as rodata.str2.8). Required - for new versions of gcc3.x. - -2001-06-20 Stephane Eranian - * release 3.0 - * split gnu-efi package in two different packages: the libary+include+crt and the bootloader. - * removed W2U() hack and related files to get from wide-char to unicode. - * Use -fshort-wchar option for unicode. - * restructured Makefiles now install under INSTALLROOT. - -2001-04-06 Stephane Eranian - - * incorporated patches from David and Michael Johnston at Intel - to get the package to compile for IA-32 linux target. - - * Fixed ELILO to compile for Ia-32 (does not execute yet, though): - Makefile and start_kernel() function. - -2001-04-06 Andreas Schwab - - * Fixed config.c to - get the timeout directive to do something. implemented the global - root= directive. - - * Fix the efi_main() to deal with the -C option properly - -2001-04-05 Stephane Eranian - - * update efi library to latest EFI toolkit 1.02 as distributed - by Intel. Fixed header + library files to compile with GCC - - * merged ELI and LILO (as of gnu-efi-1.1) together, mostly - taking the config file feature of ELI. - - * renamed LILO to ELILO to make the distinction - - * restructured code to make it easier to understand and maintain - - * fixed FPSWA driver checking and loading: we try all possible - files and let the driver itself figure out if it is the most - recent. - * added support for compression (gzip) but keep support for plain - ELF image. ELILO autodetects the format - - * change the way the kernel is invoked. Now we call it in - physical memory mode. This breaks the dependency between the - kernel code and the loader. No more lilo_start.c madness. - - * changed the way the boot_params are passed. We don't use the - ZERO_PAGE_ADDR trick anymore. Instead we use EFI runtime memory. - The address of the structure is passed to the kernel in r28 - by our convention. - - * released as gnu-efi-2.0 - -2001-04-03 David Mosberger - - * gnuefi/reloc_ia32.c (_relocate): Change return type from "void" - to "int". Return error status if relocation fails for some - reason. - - * gnuefi/elf_ia32_efi.lds: Drop unneeded ".rel.reloc" section. - - * gnuefi/crt0-efi-ia32.S (_start): Exit if _relocate() returns with - non-zero exit status. - - * inc/ia32/efibind.h [__GNUC__]: Force 8-byte alignment for 64-bit - types as that is what EFI appears to be expecting, despite the - "#pragma pack()" at the beginning of the file! - -2001-03-29 David Mosberger - - * gnuefi/reloc_ia32.c: Add a couple of defines to work around - libc/efilib collision on uint64_t et al. - (_relocate): Use ELF32_R_TYPE() instead of ELFW(R_TYPE)(). - - * gnuefi/crt0-efi-ia32.S (dummy): Add a dummy relocation entry. - -2001-03-29 David Mosberger - - * gnuefi/reloc_ia32.c: Add a couple of defines to work around - libc/efilib collision on uint64_t et al. - (_relocate): Use ELF32_R_TYPE() instead of ELFW(R_TYPE)(). - - * gnuefi/crt0-efi-ia32.S (dummy): Add a dummy relocation entry. - -2000-10-26 David Mosberger - - * gnuefi/elf_ia64_efi.lds: Mention .rela.sdata. - - * Make.defaults (CFLAGS): Remove -nostdinc flags so we can pick - up the C compiler's stdarg.h. - - * inc/stdarg.h: Remove this file. It's not correct for gcc (nor - most other optimizing compilers). - -2000-10-10 Stephane Eranian - - * cleaned up the error message and printing of those. - * added support to load the FPSWA from a file in case support is not - present in the firmware already - * fixed split_args() to do the right thing when you have leading spaces - before kernel name - * changed the argify() function to rely on \0 instead of LoadOptionSize - as the field seems to be broken with current firmware - * bumped version to 1.0 - -2000-10-04 David Mosberger - - * gnuefi/reloc_ia64.S: Reserve space for up to 750 function descriptors. - - * gnuefi/elf_ia64_efi.lds: Add .sdata section for small data and - put __gp in the "middle" of it. - - * gnuefi/crt0-efi-ia64.S (_start): Use movl/add to load - gp-relative addresses that could be out of the range of the addl - offset. - * gnuefi/reloc_ia64.S (_relocate): Ditto. - - * apps/Makefile: Remove standard rules and include Make.rules instead. - * lilo/Makefile: Ditto. - - * Make.rules: New file. - -2000-08-04 Stephane Eranian - * released version 0.9 - * incorporated ACPI changes for Asuza by NEC < kouchi@hpc.bs1.fc.nec.co.jp> - * added support for initrd (-i option) original ELI code from Bill Nottingham ) - * lots of cleanups - * got rid of #ifdef LILO_DEBUG and uses macro instead - * fix a few extra memory leaks in create_boot_params() - * added exit capability just before starting the kernel - -2000-06-22 David Mosberger - - * gnuefi/elf_ia64_efi.lds: Add .srodata, .ctors, .IA64.unwind, - .IA64.unwind_info to .data section and .rela.ctors to .rela - section. - -2000-04-03 David Mosberger - - * lilo/lilo.c (LILO_VERSION): Up version number to 0.9. - - * gnuefi/elf_ia64_efi.lds: Include .IA_64.unwind and - .IA_64.unwind_info in .data segment to avoid EFI load error - "ImageAddress: pointer outside of image" error due to the .dynsym - relocations against these sections. - - * ChangeLog: Moved from lilo/ChangeLogs. - - * gnuefi/reloc_ia64.S: fixed typo: .space directive had constant - 100 hardcoded instead of using MAX_FUNCTION_DESCRIPTORS - macro. Duh. - -2000-03-17 Stephane Eranian - - * Released 0.8 - * replace the getopt.c with new version free with better license - * created a documentation file - * fix a couple of memory leaks - * code cleanups - * created a separate directory for lilo in the gnu-efi package. - * added support for the BOOT_IMAGE argument to kernel - * default is to build natively now - diff --git a/3rd/gnu-efi/Make.defaults b/3rd/gnu-efi/Make.defaults deleted file mode 100755 index 1277d14e8..000000000 --- a/3rd/gnu-efi/Make.defaults +++ /dev/null @@ -1,204 +0,0 @@ -# -*- makefile -*- -# Copyright (c) 1999-2007 Hewlett-Packard Development Company, L.P. -# Contributed by David Mosberger -# Contributed by Stephane Eranian -# -# 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 -# -DESTDIR ?= / -ifeq ($(origin INSTALLROOT),undefined) -INSTALLROOT = $(DESTDIR) -endif - -empty := -space := $(empty) $(empty) -stripped = $(subst $(space),/,$(strip $(subst /,$(space),$(1)))) -unstripped = $(subst $(space),/,$(subst /,$(space),$(1))) -is_absolute = $(subst $(call stripped,$(1)),$(empty),$(call unstripped,$(1))) - -override INSTALLROOT:=$(if $(call is_absolute,$(INSTALLROOT)),,$(TOPDIR)/)$(INSTALLROOT) - -PREFIX := /usr/local -EXEC_PREFIX := $(PREFIX) -LIBDIR := $(EXEC_PREFIX)/lib -INCLUDEDIR := $(PREFIX)/include -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,armv[67].*,arm,' ) -ARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv[67].*,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,armv[67].*,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 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),arm) -ifneq ($(ARCH),mips64el) -ifneq ($(ARCH),riscv64) -ifneq ($(ARCH),loongarch64) -export HAVE_EFI_OBJCOPY=y -endif -endif -endif -endif - -ifeq ($(ARCH),arm) -CFLAGS += -marm -endif - -ifeq ($(ARCH),aarch64) -LDFLAGS += -z common-page-size=4096 -LDFLAGS += -z max-page-size=4096 -endif - -# Generic compilation flags -INCDIR += -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) \ - -I$(TOPDIR)/inc/protocol - -# Only enable -fPIE for non MinGW compilers (unneeded on MinGW) -GCCMACHINE := $(shell $(CC) -dumpmachine) -ifneq (mingw32,$(findstring mingw32, $(GCCMACHINE))) - CFLAGS += -fPIE -endif - -ifeq (FreeBSD, $(findstring FreeBSD, $(OS))) -CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \ - -funsigned-char -fshort-wchar -fno-strict-aliasing \ - -ffreestanding -fno-stack-protector -else -CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Wno-pointer-sign -Werror \ - -funsigned-char -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 - -ifneq ($(ARCH),arm) -export LIBGCC=$(shell $(CC) $(CFLAGS) $(ARCH3264) -print-libgcc-file-name) -endif diff --git a/3rd/gnu-efi/Make.rules b/3rd/gnu-efi/Make.rules deleted file mode 100644 index 8cb93b0a0..000000000 --- a/3rd/gnu-efi/Make.rules +++ /dev/null @@ -1,64 +0,0 @@ -# -# Copyright (C) 1999-2007 Hewlett-Packard Co. -# Contributed by David Mosberger -# Contributed by Stephane Eranian -# -# 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 $@ - -%.i: %.c - $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -E $< -o $@ - -%.o: %.S - $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ - -%.s: %.S - $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -E $< -o $@ diff --git a/3rd/gnu-efi/Makefile b/3rd/gnu-efi/Makefile deleted file mode 100644 index e58d02ac2..000000000 --- a/3rd/gnu-efi/Makefile +++ /dev/null @@ -1,131 +0,0 @@ -# -# Copyright (C) 1999-2007 Hewlett-Packard Co. -# Contributed by David Mosberger -# Contributed by Stephane Eranian -# -# 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. -# - -export VERSION = 3.0.17 - -MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) -SRCDIR = $(dir $(MKFILE_PATH)) - -VPATH = $(SRCDIR) - -include $(SRCDIR)/Make.defaults - -SUBDIRS = lib gnuefi inc apps - -all: check_gcc $(SUBDIRS) - -gnuefi: lib -apps: gnuefi - -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 *~ - @set -e ; 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: - @set -e ; 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" - diff --git a/3rd/gnu-efi/README.efilib b/3rd/gnu-efi/README.efilib deleted file mode 100644 index bb857ec83..000000000 --- a/3rd/gnu-efi/README.efilib +++ /dev/null @@ -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. diff --git a/3rd/gnu-efi/README.elilo b/3rd/gnu-efi/README.elilo deleted file mode 100644 index 96a817219..000000000 --- a/3rd/gnu-efi/README.elilo +++ /dev/null @@ -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 diff --git a/3rd/gnu-efi/README.git b/3rd/gnu-efi/README.git deleted file mode 100644 index c719b208d..000000000 --- a/3rd/gnu-efi/README.git +++ /dev/null @@ -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. - - - diff --git a/3rd/gnu-efi/README.gnuefi b/3rd/gnu-efi/README.gnuefi deleted file mode 100644 index 512698c28..000000000 --- a/3rd/gnu-efi/README.gnuefi +++ /dev/null @@ -1,405 +0,0 @@ - ------------------------------------------------- - Building EFI Applications Using the GNU Toolchain - ------------------------------------------------- - - David Mosberger - - 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 - . 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= 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 * * * diff --git a/3rd/gnu-efi/apps/AllocPages.c b/3rd/gnu-efi/apps/AllocPages.c deleted file mode 100644 index bb81849c2..000000000 --- a/3rd/gnu-efi/apps/AllocPages.c +++ /dev/null @@ -1,184 +0,0 @@ - -/* - * Copyright (C) 2013 Jerry Hoemann - * - * - * 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 -#include - - -#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; -} diff --git a/3rd/gnu-efi/apps/FreePages.c b/3rd/gnu-efi/apps/FreePages.c deleted file mode 100644 index 247c75dc2..000000000 --- a/3rd/gnu-efi/apps/FreePages.c +++ /dev/null @@ -1,145 +0,0 @@ - - -/* - * Copyright (C) 2013 Jerry Hoemann - * - * 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 -#include - -/* - * 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; -} diff --git a/3rd/gnu-efi/apps/Makefile b/3rd/gnu-efi/apps/Makefile deleted file mode 100644 index 6ebd438b5..000000000 --- a/3rd/gnu-efi/apps/Makefile +++ /dev/null @@ -1,103 +0,0 @@ -# -# Copyright (C) 1999-2001 Hewlett-Packard Co. -# Contributed by David Mosberger -# Contributed by Stephane Eranian -# -# 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 -APPSDIR = $(LIBDIR)/gnuefi/apps -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 \ - ctors_test.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) - -ctors_test.so : ctors_fns.o ctors_test.o - -clean: - rm -f $(TARGETS) *~ *.o *.so - -install: - mkdir -p $(INSTALLROOT)$(APPSDIR) - $(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)$(APPSDIR) - -.PHONY: install - -include $(SRCDIR)/../Make.rules diff --git a/3rd/gnu-efi/apps/bltgrid.c b/3rd/gnu-efi/apps/bltgrid.c deleted file mode 100644 index ff6975351..000000000 --- a/3rd/gnu-efi/apps/bltgrid.c +++ /dev/null @@ -1,133 +0,0 @@ -#include -#include - -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 (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 = (UINTN)info->VerticalResolution - * (UINTN)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); - FreePool(PixelBuffer); - 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; -} diff --git a/3rd/gnu-efi/apps/ctors_fns.c b/3rd/gnu-efi/apps/ctors_fns.c deleted file mode 100644 index 624190462..000000000 --- a/3rd/gnu-efi/apps/ctors_fns.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * ctors.c - * Copyright 2019 Peter Jones - * - */ - -#include -#include - -int constructed_value = 0; - -static void __attribute__((__constructor__)) ctor(void) -{ - Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value); - constructed_value = 1; - Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value); -} - -static void __attribute__((__destructor__)) dtor(void) -{ - Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value); - constructed_value = 0; - Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value); -} - -// vim:fenc=utf-8:tw=75:noet diff --git a/3rd/gnu-efi/apps/ctors_test.c b/3rd/gnu-efi/apps/ctors_test.c deleted file mode 100644 index 7e48da8ef..000000000 --- a/3rd/gnu-efi/apps/ctors_test.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * ctors_test.c - * Copyright 2019 Peter Jones - * - */ - -#include -#include - -extern int constructed_value; - -EFI_STATUS -efi_main (EFI_HANDLE image EFI_UNUSED, EFI_SYSTEM_TABLE *systab EFI_UNUSED) -{ - Print(L"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value); - - return EFI_SUCCESS; -} - -// vim:fenc=utf-8:tw=75:noet diff --git a/3rd/gnu-efi/apps/debughook.c b/3rd/gnu-efi/apps/debughook.c deleted file mode 100644 index 78e4a767b..000000000 --- a/3rd/gnu-efi/apps/debughook.c +++ /dev/null @@ -1,97 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/drv0.c b/3rd/gnu-efi/apps/drv0.c deleted file mode 100644 index 1d0c06f9f..000000000 --- a/3rd/gnu-efi/apps/drv0.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (C) 2013 David Decotigny - * - * 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 -#include -#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() */ -} diff --git a/3rd/gnu-efi/apps/drv0.h b/3rd/gnu-efi/apps/drv0.h deleted file mode 100644 index cf0e05447..000000000 --- a/3rd/gnu-efi/apps/drv0.h +++ /dev/null @@ -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 diff --git a/3rd/gnu-efi/apps/drv0_use.c b/3rd/gnu-efi/apps/drv0_use.c deleted file mode 100644 index d8688cf12..000000000 --- a/3rd/gnu-efi/apps/drv0_use.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2013 David Decotigny - * - * See drv0.c for an example session. - */ - -#include -#include -#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; -} diff --git a/3rd/gnu-efi/apps/exit.c b/3rd/gnu-efi/apps/exit.c deleted file mode 100644 index 78b94a574..000000000 --- a/3rd/gnu-efi/apps/exit.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -EFI_STATUS -efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) -{ - InitializeLib(image_handle, systab); - - Exit(EFI_SUCCESS, 0, NULL); - - return EFI_UNSUPPORTED; -} diff --git a/3rd/gnu-efi/apps/lfbgrid.c b/3rd/gnu-efi/apps/lfbgrid.c deleted file mode 100644 index 3914313a7..000000000 --- a/3rd/gnu-efi/apps/lfbgrid.c +++ /dev/null @@ -1,171 +0,0 @@ -#include -#include - -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 __SIZEOF_POINTER__ == 8 - UINT64 FrameBufferAddr; -#elif __SIZEOF_POINTER__ == 4 - 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 (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 = (UINTN)info->VerticalResolution - * (UINTN)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 __SIZEOF_POINTER__ == 8 - FrameBufferAddr = (UINT64)gop->Mode->FrameBufferBase; -#elif __SIZEOF_POINTER__ == 4 - 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; -} diff --git a/3rd/gnu-efi/apps/modelist.c b/3rd/gnu-efi/apps/modelist.c deleted file mode 100644 index 13219b71d..000000000 --- a/3rd/gnu-efi/apps/modelist.c +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include - -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 (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; -} diff --git a/3rd/gnu-efi/apps/printenv.c b/3rd/gnu-efi/apps/printenv.c deleted file mode 100644 index 6341e406b..000000000 --- a/3rd/gnu-efi/apps/printenv.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/route80h.c b/3rd/gnu-efi/apps/route80h.c deleted file mode 100644 index 5272dd3cd..000000000 --- a/3rd/gnu-efi/apps/route80h.c +++ /dev/null @@ -1,136 +0,0 @@ -#include -#include - -/* 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; -} diff --git a/3rd/gnu-efi/apps/setdbg.c b/3rd/gnu-efi/apps/setdbg.c deleted file mode 100644 index 897140ec3..000000000 --- a/3rd/gnu-efi/apps/setdbg.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/setjmp.c b/3rd/gnu-efi/apps/setjmp.c deleted file mode 100644 index d9e0f290d..000000000 --- a/3rd/gnu-efi/apps/setjmp.c +++ /dev/null @@ -1,32 +0,0 @@ - -#include -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/t.c b/3rd/gnu-efi/apps/t.c deleted file mode 100644 index c7e3d57bd..000000000 --- a/3rd/gnu-efi/apps/t.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/t2.c b/3rd/gnu-efi/apps/t2.c deleted file mode 100644 index 6a09c42c2..000000000 --- a/3rd/gnu-efi/apps/t2.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/t3.c b/3rd/gnu-efi/apps/t3.c deleted file mode 100644 index 623830aa1..000000000 --- a/3rd/gnu-efi/apps/t3.c +++ /dev/null @@ -1,95 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/t4.c b/3rd/gnu-efi/apps/t4.c deleted file mode 100644 index b8487ecab..000000000 --- a/3rd/gnu-efi/apps/t4.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/t5.c b/3rd/gnu-efi/apps/t5.c deleted file mode 100644 index 7c868d2c8..000000000 --- a/3rd/gnu-efi/apps/t5.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/t6.c b/3rd/gnu-efi/apps/t6.c deleted file mode 100644 index f95ea660f..000000000 --- a/3rd/gnu-efi/apps/t6.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/t7.c b/3rd/gnu-efi/apps/t7.c deleted file mode 100644 index f02aaee64..000000000 --- a/3rd/gnu-efi/apps/t7.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/t8.c b/3rd/gnu-efi/apps/t8.c deleted file mode 100644 index 10f881180..000000000 --- a/3rd/gnu-efi/apps/t8.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/apps/tcc.c b/3rd/gnu-efi/apps/tcc.c deleted file mode 100644 index 09ad98b5a..000000000 --- a/3rd/gnu-efi/apps/tcc.c +++ /dev/null @@ -1,431 +0,0 @@ -/* - * Test if our calling convention gymnastics actually work - */ - -#include -#include - -#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; -} diff --git a/3rd/gnu-efi/apps/tpause.c b/3rd/gnu-efi/apps/tpause.c deleted file mode 100644 index 51c86df51..000000000 --- a/3rd/gnu-efi/apps/tpause.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -EFI_STATUS -efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) -{ - Print(L"Press `q' to quit, any other key to continue:\n"); - -} diff --git a/3rd/gnu-efi/apps/trivial.S b/3rd/gnu-efi/apps/trivial.S deleted file mode 100644 index 3ec656232..000000000 --- a/3rd/gnu-efi/apps/trivial.S +++ /dev/null @@ -1,47 +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 - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/apps/unsetdbg.c b/3rd/gnu-efi/apps/unsetdbg.c deleted file mode 100644 index 731e09b13..000000000 --- a/3rd/gnu-efi/apps/unsetdbg.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include - -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; -} diff --git a/3rd/gnu-efi/gnuefi/Makefile b/3rd/gnu-efi/gnuefi/Makefile deleted file mode 100644 index e0c9da84c..000000000 --- a/3rd/gnu-efi/gnuefi/Makefile +++ /dev/null @@ -1,89 +0,0 @@ -# -# Copyright (C) 1999-2001 Hewlett-Packard Co. -# Contributed by David Mosberger -# Contributed by Stephane Eranian -# -# 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)/.. -PKGCONFIGDIR ?= $(LIBDIR)/pkgconfig -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) gnu-efi.pc - -libgnuefi.a: $(OBJS) - $(AR) $(ARFLAGS) $@ $^ - -gnu-efi.pc: - sed \ - -e 's:@PREFIX@:$(PREFIX):g' \ - -e 's:@EXEC_PREFIX@:$(EXEC_PREFIX):g' \ - -e 's:@INCLUDEDIR@:$(INCLUDEDIR):g' \ - -e 's:@LIBDIR@:$(LIBDIR):g' \ - -e 's:@VERSION@:$(VERSION):g' \ - $(SRCDIR)/gnu-efi.pc.in > gnu-efi.pc - - -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 - $(INSTALL) -d $(INSTALLROOT)$(PKGCONFIGDIR) - $(INSTALL) -m 644 gnu-efi.pc $(INSTALLROOT)$(PKGCONFIGDIR) - -include $(SRCDIR)/../Make.rules diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-aarch64.S b/3rd/gnu-efi/gnuefi/crt0-efi-aarch64.S deleted file mode 100644 index 601669801..000000000 --- a/3rd/gnu-efi/gnuefi/crt0-efi-aarch64.S +++ /dev/null @@ -1,57 +0,0 @@ -/* - * crt0-efi-aarch64.S - PE/COFF header for AArch64 EFI applications - * - * Copright (C) 2014 Linaro Ltd. - * - * 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. - */ - - .text - .align 12 - - .globl _start -_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 _entry - -0: ldp x29, x30, [sp], #32 - 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 12 // Block Size (2*4+2*2), must be aligned by 32 Bits - .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy - .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-arm.S b/3rd/gnu-efi/gnuefi/crt0-efi-arm.S deleted file mode 100644 index 716699b61..000000000 --- a/3rd/gnu-efi/gnuefi/crt0-efi-arm.S +++ /dev/null @@ -1,149 +0,0 @@ -/* - * crt0-efi-arm.S - PE/COFF header for ARM EFI applications - * - * Copright (C) 2014 Linaro Ltd. - * - * 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 0 // 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 _entry - -0: add sp, sp, #12 - ldr pc, [sp], #4 - -.L_DYNAMIC: - .word _DYNAMIC - . - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-ia32.S b/3rd/gnu-efi/gnuefi/crt0-efi-ia32.S deleted file mode 100644 index df3340ac1..000000000 --- a/3rd/gnu-efi/gnuefi/crt0-efi-ia32.S +++ /dev/null @@ -1,81 +0,0 @@ -/* crt0-efi-ia32.S - x86 EFI startup code. - Copyright (C) 1999 Hewlett-Packard Co. - Contributed by David Mosberger . - - 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 _entry # 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 12 // Block Size (2*4+2*2), must be aligned by 32 Bits - .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy - .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-ia64.S b/3rd/gnu-efi/gnuefi/crt0-efi-ia64.S deleted file mode 100644 index 30714d34d..000000000 --- a/3rd/gnu-efi/gnuefi/crt0-efi-ia64.S +++ /dev/null @@ -1,91 +0,0 @@ -/* crt0-efi-ia64.S - IA-64 EFI startup code. - Copyright (C) 1999 Hewlett-Packard Co. - Contributed by David Mosberger . - - 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=_entry -.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), must be aligned by 32 Bits - 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 - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-loongarch64.S b/3rd/gnu-efi/gnuefi/crt0-efi-loongarch64.S deleted file mode 100644 index af45d46cd..000000000 --- a/3rd/gnu-efi/gnuefi/crt0-efi-loongarch64.S +++ /dev/null @@ -1,151 +0,0 @@ -/* - * crt0-efi-loongarch64.S - PE/COFF header for LoongArch64 EFI applications - * - * Copyright (C) 2021 Loongson Technology Corporation Limited. - * Copyright (C) 2014 Linaro Ltd. - * - * 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. - */ - -#ifndef EFI_SUBSYSTEM -#define EFI_SUBSYSTEM 0xa -#endif - .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 0x6264 // loongarch64 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) - - .align 4 - - .globl _start - .type _start, @function -_start: - addi.d $sp, $sp, -24 - st.d $ra, $sp, 0 - st.d $a0, $sp, 8 - st.d $a1, $sp, 16 - - move $a2, $a0 // a2: ImageHandle - move $a3, $a1 // a3: SystemTable - la.local $a0, ImageBase // a0: ImageBase - la.local $a1, _DYNAMIC // a1: DynamicSection - bl _relocate - bnez $a0, 0f - - ld.d $a0, $sp, 8 - ld.d $a1, $sp, 16 - bl efi_main - -0: ld.d $ra, $sp, 0 - addi.d $sp, $sp, 24 - jr $ra - .end _start diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-mips64el.S b/3rd/gnu-efi/gnuefi/crt0-efi-mips64el.S deleted file mode 100644 index cecabfbd4..000000000 --- a/3rd/gnu-efi/gnuefi/crt0-efi-mips64el.S +++ /dev/null @@ -1,192 +0,0 @@ -/* - * crt0-efi-mips64el.S - PE/COFF header for MIPS64 EFI applications - * - * Copright (C) 2014 Linaro Ltd. - * Copright (C) 2017 Heiher - * - * 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 0 // 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 _start - dla $t9, _entry - 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 - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-riscv64.S b/3rd/gnu-efi/gnuefi/crt0-efi-riscv64.S deleted file mode 100644 index 2322b5678..000000000 --- a/3rd/gnu-efi/gnuefi/crt0-efi-riscv64.S +++ /dev/null @@ -1,140 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ -/* - * Copright (C) 2014 Linaro Ltd. - * Copright (C) 2018 Alexander Graf - * - * 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. - */ - -#ifndef EFI_SUBSYSTEM -#define EFI_SUBSYSTEM 10 -#endif - - .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 0x5064 // riscv64 - .short 2 // nr_sections - .long 0 // TimeDateStamp - .long 0 // PointerToSymbolTable - .long 0 // 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: - /* - * 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\0\0" - .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\0\0\0" - .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) - - .align 12 - .globl _start -_start: - addi sp, sp, -24 - sd a0, 0(sp) - sd a1, 8(sp) - sd ra, 16(sp) - lla a0, ImageBase - lla a1, _DYNAMIC - call _relocate - bne a0, zero, 0f - ld a1, 8(sp) - ld a0, 0(sp) - call efi_main - ld ra, 16(sp) -0: addi sp, sp, 24 - ret - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/gnuefi/crt0-efi-x86_64.S b/3rd/gnu-efi/gnuefi/crt0-efi-x86_64.S deleted file mode 100644 index 5179439fc..000000000 --- a/3rd/gnu-efi/gnuefi/crt0-efi-x86_64.S +++ /dev/null @@ -1,80 +0,0 @@ -/* crt0-efi-x86_64.S - x86_64 EFI startup code. - Copyright (C) 1999 Hewlett-Packard Co. - Contributed by David Mosberger . - Copyright (C) 2005 Intel Co. - Contributed by Fenghua Yu . - - 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 _entry - 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 12 // Block Size (2*4+2*2), must be aligned by 32 Bits - .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy - .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/gnuefi/elf_aarch64_efi.lds b/3rd/gnu-efi/gnuefi/elf_aarch64_efi.lds deleted file mode 100644 index 563e22df1..000000000 --- a/3rd/gnu-efi/gnuefi/elf_aarch64_efi.lds +++ /dev/null @@ -1,106 +0,0 @@ -OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") -OUTPUT_ARCH(aarch64) -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) } - .gcc_except_table : { *(.gcc_except_table*) } - . = ALIGN(4096); - .text : { - _text = .; - *(.text) - *(.text.*) - *(.gnu.linkonce.t.*) - *(.srodata) - *(.rodata*) - . = ALIGN(16); - } - _etext = .; - _text_size = . - _text; - . = ALIGN(4096); - .reloc : - { - KEEP (*(.reloc)) - } - . = ALIGN(65536); - .dynamic : { *(.dynamic) } - . = ALIGN(4096); - .data : - { - _data = .; - *(.sdata) - *(.data) - *(.data1) - *(.data.*) - *(.got.plt) - *(.got) - - /* - * Note that these aren't the using the GNU "CONSTRUCTOR" output section - * command, so they don't start with a size. Because of p2align and the - * end/END definitions, and the fact that they're mergeable, they can also - * have NULLs which aren't guaranteed to be at the end. - */ - . = ALIGN(16); - _init_array = .; - *(SORT_BY_NAME(.init_array)) - _init_array_end = .; - __CTOR_LIST__ = .; - *(SORT_BY_NAME(.ctors)) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - *(SORT_BY_NAME(.dtors)) - __DTOR_END__ = .; - _fini_array = .; - *(SORT_BY_NAME(.fini_array)) - _fini_array_end = .; - - /* 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) - *(.rel.local) - . = ALIGN(16); - - _bss_end = .; - } - - . = ALIGN(4096); - .rela : - { - *(.rela.text*) - *(.rela.data*) - *(.rela.got) - *(.rela.dyn) - *(.rela.stab) - } - . = ALIGN(4096); - .rela.plt : { *(.rela.plt) } - . = ALIGN(512); - _edata = .; - _data_size = . - _data; - - . = ALIGN(4096); - .dynsym : { *(.dynsym) } - . = ALIGN(4096); - .dynstr : { *(.dynstr) } - . = ALIGN(4096); - .note.gnu.build-id : { *(.note.gnu.build-id) } - .ignored.reloc : - { - *(.rela.reloc) - *(.note.GNU-stack) - } - .comment 0 : { *(.comment) } -} diff --git a/3rd/gnu-efi/gnuefi/elf_arm_efi.lds b/3rd/gnu-efi/gnuefi/elf_arm_efi.lds deleted file mode 100644 index 3023ebcdb..000000000 --- a/3rd/gnu-efi/gnuefi/elf_arm_efi.lds +++ /dev/null @@ -1,92 +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; - . = ALIGN(4096); - .dynamic : { *(.dynamic) } - . = ALIGN(4096); - .data : - { - _data = .; - *(.sdata) - *(.data) - *(.data1) - *(.data.*) - *(.got.plt) - *(.got) - - /* - * Note that these aren't the using the GNU "CONSTRUCTOR" output section - * command, so they don't start with a size. Because of p2align and the - * end/END definitions, and the fact that they're mergeable, they can also - * have NULLs which aren't guaranteed to be at the end. - */ - . = ALIGN(16); - _init_array = .; - *(SORT_BY_NAME(.init_array)) - _init_array_end = .; - __CTOR_LIST__ = .; - *(SORT_BY_NAME(.ctors)) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - *(SORT_BY_NAME(.dtors)) - __DTOR_END__ = .; - _fini_array = .; - *(SORT_BY_NAME(.fini_array)) - _fini_array_end = .; - - /* 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 = .; - } - - . = ALIGN(4096); - .rel : - { - *(.rel.text*) - *(.rel.data*) - *(.rel.got) - *(.rel.dyn) - *(.rel.stab) - } - . = ALIGN(4096); - .rel.plt : { *(.rel.plt) } - _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) } -} diff --git a/3rd/gnu-efi/gnuefi/elf_ia32_efi.lds b/3rd/gnu-efi/gnuefi/elf_ia32_efi.lds deleted file mode 100644 index 5eec52964..000000000 --- a/3rd/gnu-efi/gnuefi/elf_ia32_efi.lds +++ /dev/null @@ -1,99 +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) } - .eh_frame : { *(.eh_frame) } - .gcc_except_table : { *(.gcc_except_table*) } - . = ALIGN(4096); - .text : - { - _text = .; - *(.text) - *(.text.*) - *(.gnu.linkonce.t.*) - . = ALIGN(16); - } - _etext = .; - _text_size = . - _text; - . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); - .data : - { - _data = .; - *(.got.plt) - *(.got) - *(.rodata*) - *(.data) - *(.data1) - *(.data.*) - - /* - * Note that these aren't the using the GNU "CONSTRUCTOR" output section - * command, so they don't start with a size. Because of p2align and the - * end/END definitions, and the fact that they're mergeable, they can also - * have NULLs which aren't guaranteed to be at the end. - */ - . = ALIGN(16); - _init_array = .; - *(SORT_BY_NAME(.init_array)) - _init_array_end = .; - __CTOR_LIST__ = .; - *(SORT_BY_NAME(.ctors)) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - *(SORT_BY_NAME(.dtors)) - __DTOR_END__ = .; - _fini_array = .; - *(SORT_BY_NAME(.fini_array)) - _fini_array_end = .; - - /* 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); - .rel : - { - *(.rel.text*) - *(.rel.data*) - *(.rel.got) - *(.rel.dyn) - *(.rel.stab) - *(.data.rel.ro.local) - *(.data.rel.local) - *(.data.rel.ro) - *(.data.rel*) - } - . = ALIGN(4096); - .rel.plt : { *(.rel.plt) } - _edata = .; - _data_size = . - _etext; - . = ALIGN(4096); - .reloc : /* This is the PECOFF .reloc section! */ - { - KEEP (*(.reloc)) - } - . = ALIGN(4096); - .dynsym : { *(.dynsym) } - . = ALIGN(4096); - .dynstr : { *(.dynstr) } - . = ALIGN(4096); - . = DATA_SEGMENT_END (.); - /DISCARD/ : - { - *(.rel.reloc) - *(.note.GNU-stack) - } - .comment 0 : { *(.comment) } -} diff --git a/3rd/gnu-efi/gnuefi/elf_ia32_fbsd_efi.lds b/3rd/gnu-efi/gnuefi/elf_ia32_fbsd_efi.lds deleted file mode 100644 index 9e9baec2a..000000000 --- a/3rd/gnu-efi/gnuefi/elf_ia32_fbsd_efi.lds +++ /dev/null @@ -1,107 +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) - - /* - * Note that these aren't the using the GNU "CONSTRUCTOR" output section - * command, so they don't start with a size. Because of p2align and the - * end/END definitions, and the fact that they're mergeable, they can also - * have NULLs which aren't guaranteed to be at the end. - */ - . = ALIGN(16); - _init_array = .; - *(SORT_BY_NAME(.init_array)) - _init_array_end = .; - __CTOR_LIST__ = .; - *(SORT_BY_NAME(.ctors)) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - *(SORT_BY_NAME(.dtors)) - __DTOR_END__ = .; - _fini_array = .; - *(SORT_BY_NAME(.fini_array)) - _fini_array_end = .; - - /* 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) } -} diff --git a/3rd/gnu-efi/gnuefi/elf_ia64_efi.lds b/3rd/gnu-efi/gnuefi/elf_ia64_efi.lds deleted file mode 100644 index e45799c1d..000000000 --- a/3rd/gnu-efi/gnuefi/elf_ia64_efi.lds +++ /dev/null @@ -1,108 +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) } - .eh_frame : { *(.eh_frame) } - .gcc_except_table : { *(.gcc_except_table*) } - . = ALIGN(4096); - .text : - { - _text = .; - *(.text) - *(.text.*) - *(.gnu.linkonce.t.*) - . = ALIGN(16); - } - _etext = .; - _text_size = . - _text; - . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); - __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 */ - - /* - * Note that these aren't the using the GNU "CONSTRUCTOR" output section - * command, so they don't start with a size. Because of p2align and the - * end/END definitions, and the fact that they're mergeable, they can also - * have NULLs which aren't guaranteed to be at the end. - */ - . = ALIGN(16); - _init_array = .; - *(SORT_BY_NAME(.init_array)) - _init_array_end = .; - __CTOR_LIST__ = .; - *(SORT_BY_NAME(.ctors)) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - *(SORT_BY_NAME(.dtors)) - __DTOR_END__ = .; - _fini_array = .; - *(SORT_BY_NAME(.fini_array)) - _fini_array_end = .; - - /* 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.sdata*) - *(.rela.data*) - *(.rela.got) - *(.rela.dyn) - *(.rela.gnu.linkonce.d*) - *(.rela.stab) - *(.rela.ctors) - } - . = ALIGN(4096); - .rela.plt : { *(.rela.plt) } - _edata = .; - _data_size = . - _etext; - . = ALIGN(4096); - .reloc : /* This is the PECOFF .reloc section! */ - { - KEEP (*(.reloc)) - } - . = ALIGN(4096); - .dynsym : { *(.dynsym) } - . = ALIGN(4096); - .dynstr : { *(.dynstr) } - . = DATA_SEGMENT_END (.); - /DISCARD/ : - { - *(.rela.plabel) - *(.rela.reloc) - *(.IA_64.unwind*) - *(.IA64.unwind*) - } -} diff --git a/3rd/gnu-efi/gnuefi/elf_loongarch64_efi.lds b/3rd/gnu-efi/gnuefi/elf_loongarch64_efi.lds deleted file mode 100644 index e7b4d6bcc..000000000 --- a/3rd/gnu-efi/gnuefi/elf_loongarch64_efi.lds +++ /dev/null @@ -1,63 +0,0 @@ -OUTPUT_FORMAT("elf64-loongarch", "elf64-loongarch", "elf64-loongarch") -OUTPUT_ARCH(loongarch) -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) } -} diff --git a/3rd/gnu-efi/gnuefi/elf_mips64el_efi.lds b/3rd/gnu-efi/gnuefi/elf_mips64el_efi.lds deleted file mode 100644 index bf968416a..000000000 --- a/3rd/gnu-efi/gnuefi/elf_mips64el_efi.lds +++ /dev/null @@ -1,94 +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; - . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); - .dynamic : { *(.dynamic) } - . = ALIGN(4096); - .data : - { - _data = .; - *(.sdata) - *(.data) - *(.data1) - *(.data.*) - *(.got.plt) - HIDDEN (_gp = ALIGN (16) + 0x7ff0); - *(.got) - - /* - * Note that these aren't the using the GNU "CONSTRUCTOR" output section - * command, so they don't start with a size. Because of p2align and the - * end/END definitions, and the fact that they're mergeable, they can also - * have NULLs which aren't guaranteed to be at the end. - */ - . = ALIGN(16); - _init_array = .; - *(SORT_BY_NAME(.init_array)) - _init_array_end = .; - __CTOR_LIST__ = .; - *(SORT_BY_NAME(.ctors)) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - *(SORT_BY_NAME(.dtors)) - __DTOR_END__ = .; - _fini_array = .; - *(SORT_BY_NAME(.fini_array)) - _fini_array_end = .; - - /* 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 = .; - } - - . = ALIGN(4096); - .rel : - { - *(.rel.text*) - *(.rel.data*) - *(.rel.got) - *(.rel.dyn) - *(.rel.stab) - } - . = ALIGN(4096); - .rel.plt : { *(.rel.plt) } - _edata = .; - _data_size = . - _etext; - - . = ALIGN(4096); - .dynsym : { *(.dynsym) } - . = ALIGN(4096); - .dynstr : { *(.dynstr) } - . = ALIGN(4096); - .note.gnu.build-id : { *(.note.gnu.build-id) } - . = DATA_SEGMENT_END (.); - /DISCARD/ : - { - *(.rel.reloc) - *(.eh_frame) - *(.MIPS.abiflags) - *(.note.GNU-stack) - } - .comment 0 : { *(.comment) } -} diff --git a/3rd/gnu-efi/gnuefi/elf_riscv64_efi.lds b/3rd/gnu-efi/gnuefi/elf_riscv64_efi.lds deleted file mode 100644 index 3b4724706..000000000 --- a/3rd/gnu-efi/gnuefi/elf_riscv64_efi.lds +++ /dev/null @@ -1,80 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ - -OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv") -OUTPUT_ARCH(riscv) -ENTRY(_start) -SECTIONS { -.text 0x0 : - { - _text = .; - *(.text.head) - *(.text) - *(.text.*) - *(.gnu.linkonce.t.*) - *(.srodata) - *(.rodata*) - . = ALIGN(16); - } - _etext = .; - _text_size = . - _text; -. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); -.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 = .; - } - -. = ALIGN(4096); -.rela : - { - *(.rela.text*) - *(.rela.data*) - *(.rela.got) - *(.rela.dyn) - *(.rela.stab) - } -. = ALIGN(4096); -.rela.plt : { *(.rela.plt) } - . = ALIGN(512); - _edata = .; - _data_size = . - _data; - - . = ALIGN(4096); -.dynsym : - { *(.dynsym) } - . = ALIGN(4096); -.dynstr : - { *(.dynstr) } - . = ALIGN(4096); -.note.gnu.build-id : - { *(.note.gnu.build-id) } -. = DATA_SEGMENT_END (.); -/DISCARD/ : - { - *(.rel.reloc) - *(.eh_frame) - *(.note.GNU-stack) - } -.comment 0 : - { *(.comment) } -} diff --git a/3rd/gnu-efi/gnuefi/elf_x86_64_efi.lds b/3rd/gnu-efi/gnuefi/elf_x86_64_efi.lds deleted file mode 100644 index 2e0e0cb1f..000000000 --- a/3rd/gnu-efi/gnuefi/elf_x86_64_efi.lds +++ /dev/null @@ -1,99 +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) } - .gcc_except_table : { *(.gcc_except_table*) } - . = ALIGN(4096); - .text : - { - _text = .; - *(.text) - *(.text.*) - *(.gnu.linkonce.t.*) - . = ALIGN(16); - } - _etext = .; - _text_size = . - _text; - . = ALIGN(4096); - .reloc : - { - KEEP (*(.reloc)) - } - - . = ALIGN(4096); - .data : - { - _data = .; - *(.rodata*) - *(.got.plt) - *(.got) - *(.data*) - *(.sdata) - - /* - * Note that these aren't the using the GNU "CONSTRUCTOR" output section - * command, so they don't start with a size. Because of p2align and the - * end/END definitions, and the fact that they're mergeable, they can also - * have NULLs which aren't guaranteed to be at the end. - */ - . = ALIGN(16); - _init_array = .; - *(SORT_BY_NAME(.init_array)) - _init_array_end = .; - __CTOR_LIST__ = .; - *(SORT_BY_NAME(.ctors)) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - *(SORT_BY_NAME(.dtors)) - __DTOR_END__ = .; - _fini_array = .; - *(SORT_BY_NAME(.fini_array)) - _fini_array_end = .; - - /* 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.text*) - *(.rela.data*) - *(.rela.got) - *(.rela.dyn) - *(.rela.stab) - } - . = ALIGN(4096); - .rela.plt : { *(.rela.plt) } - . = ALIGN(4096); - .dynsym : { *(.dynsym) } - . = ALIGN(4096); - .dynstr : { *(.dynstr) } - . = ALIGN(4096); - .ignored.reloc : - { - *(.rela.reloc) - *(.note.GNU-stack) - } - .comment 0 : { *(.comment) } -} diff --git a/3rd/gnu-efi/gnuefi/elf_x86_64_fbsd_efi.lds b/3rd/gnu-efi/gnuefi/elf_x86_64_fbsd_efi.lds deleted file mode 100644 index 721ce9a1a..000000000 --- a/3rd/gnu-efi/gnuefi/elf_x86_64_fbsd_efi.lds +++ /dev/null @@ -1,91 +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) - - /* - * Note that these aren't the using the GNU "CONSTRUCTOR" output section - * command, so they don't start with a size. Because of p2align and the - * end/END definitions, and the fact that they're mergeable, they can also - * have NULLs which aren't guaranteed to be at the end. - */ - . = ALIGN(16); - _init_array = .; - *(SORT_BY_NAME(.init_array)) - _init_array_end = .; - __CTOR_LIST__ = .; - *(SORT_BY_NAME(.ctors)) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - *(SORT_BY_NAME(.dtors)) - __DTOR_END__ = .; - _fini_array = .; - *(SORT_BY_NAME(.fini_array)) - _fini_array_end = .; - - /* 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) - } -} diff --git a/3rd/gnu-efi/gnuefi/gnu-efi.pc.in b/3rd/gnu-efi/gnuefi/gnu-efi.pc.in deleted file mode 100644 index 9280bc04a..000000000 --- a/3rd/gnu-efi/gnuefi/gnu-efi.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@PREFIX@ -exec_prefix=@EXEC_PREFIX@ -includedir=@INCLUDEDIR@ -libdir=@LIBDIR@ - -Name: gnu-efi -Description: EFI development toolkit -Version: @VERSION@ -Cflags: -I${includedir}/efi -Libs: -lefi diff --git a/3rd/gnu-efi/gnuefi/reloc_aarch64.c b/3rd/gnu-efi/gnuefi/reloc_aarch64.c deleted file mode 100644 index 086727961..000000000 --- a/3rd/gnu-efi/gnuefi/reloc_aarch64.c +++ /dev/null @@ -1,97 +0,0 @@ -/* reloc_aarch64.c - position independent x86 ELF shared object relocator - Copyright (C) 2014 Linaro Ltd. - Copyright (C) 1999 Hewlett-Packard Co. - Contributed by David Mosberger . - - 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 -#include - -#include - -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; -} diff --git a/3rd/gnu-efi/gnuefi/reloc_arm.c b/3rd/gnu-efi/gnuefi/reloc_arm.c deleted file mode 100644 index 758506669..000000000 --- a/3rd/gnu-efi/gnuefi/reloc_arm.c +++ /dev/null @@ -1,97 +0,0 @@ -/* reloc_arm.c - position independent x86 ELF shared object relocator - Copyright (C) 2014 Linaro Ltd. - Copyright (C) 1999 Hewlett-Packard Co. - Contributed by David Mosberger . - - 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 -#include - -#include - -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; -} diff --git a/3rd/gnu-efi/gnuefi/reloc_ia32.c b/3rd/gnu-efi/gnuefi/reloc_ia32.c deleted file mode 100644 index da9d8a7b4..000000000 --- a/3rd/gnu-efi/gnuefi/reloc_ia32.c +++ /dev/null @@ -1,99 +0,0 @@ -/* reloc_ia32.c - position independent x86 ELF shared object relocator - Copyright (C) 1999 Hewlett-Packard Co. - Contributed by David Mosberger . - - 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 -#include - -#include - -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; -} diff --git a/3rd/gnu-efi/gnuefi/reloc_ia64.S b/3rd/gnu-efi/gnuefi/reloc_ia64.S deleted file mode 100644 index ce2bf6a4e..000000000 --- a/3rd/gnu-efi/gnuefi/reloc_ia64.S +++ /dev/null @@ -1,231 +0,0 @@ -/* reloc_ia64.S - position independent IA-64 ELF shared object relocator - Copyright (C) 1999 Hewlett-Packard Co. - Contributed by David Mosberger . - - 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: - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/gnuefi/reloc_loongarch64.c b/3rd/gnu-efi/gnuefi/reloc_loongarch64.c deleted file mode 100644 index 7860f9d24..000000000 --- a/3rd/gnu-efi/gnuefi/reloc_loongarch64.c +++ /dev/null @@ -1,104 +0,0 @@ -/* reloc_loongarch64.c - position independent loongarch64 ELF shared object relocator - Copyright (C) 2021 Loongson Technology Corporation Limited. - Copyright (C) 2014 Linaro Ltd. - Copyright (C) 1999 Hewlett-Packard Co. - Contributed by David Mosberger . - - 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 -#include - -#include - -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; - - case DT_PLTGOT: - addr = (unsigned long *) - ((unsigned long)dyn[i].d_un.d_ptr - + ldbase); - 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_LARCH_NONE: - break; - - case R_LARCH_RELATIVE: - addr = (unsigned long *) - (ldbase + rel->r_offset); - *addr += ldbase; - break; - - default: - break; - } - rel = (Elf64_Rela*) ((char *) rel + relent); - relsz -= relent; - } - return EFI_SUCCESS; -} diff --git a/3rd/gnu-efi/gnuefi/reloc_mips64el.c b/3rd/gnu-efi/gnuefi/reloc_mips64el.c deleted file mode 100644 index 4db21adce..000000000 --- a/3rd/gnu-efi/gnuefi/reloc_mips64el.c +++ /dev/null @@ -1,115 +0,0 @@ -/* reloc_mips64el.c - position independent MIPS64 ELF shared object relocator - Copyright (C) 2014 Linaro Ltd. - Copyright (C) 1999 Hewlett-Packard Co. - Contributed by David Mosberger . - Copyright (C) 2017 Lemote Co. - Contributed by Heiher - - 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 -#include - -#include - -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; -} diff --git a/3rd/gnu-efi/gnuefi/reloc_riscv64.c b/3rd/gnu-efi/gnuefi/reloc_riscv64.c deleted file mode 100644 index 0b02d83fa..000000000 --- a/3rd/gnu-efi/gnuefi/reloc_riscv64.c +++ /dev/null @@ -1,91 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause -/* reloc_riscv.c - position independent ELF shared object relocator - Copyright (C) 2018 Alexander Graf - Copyright (C) 2014 Linaro Ltd. - Copyright (C) 1999 Hewlett-Packard Co. - Contributed by David Mosberger . - - 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 - -#include - -#define Elf_Dyn Elf64_Dyn -#define Elf_Rela Elf64_Rela -#define ELF_R_TYPE ELF64_R_TYPE - -EFI_STATUS EFIAPI _relocate(long ldbase, Elf_Dyn *dyn) -{ - long relsz = 0, relent = 0; - Elf_Rela *rel = NULL; - unsigned long *addr; - int i; - - for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { - switch (dyn[i].d_tag) { - case DT_RELA: - rel = (Elf_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 (ELF_R_TYPE(rel->r_info)) { - case R_RISCV_RELATIVE: - addr = (unsigned long *)(ldbase + rel->r_offset); - *addr = ldbase + rel->r_addend; - break; - default: - /* Panic */ - while (1) ; - } - rel = (Elf_Rela *)((char *)rel + relent); - relsz -= relent; - } - return EFI_SUCCESS; -} diff --git a/3rd/gnu-efi/gnuefi/reloc_x86_64.c b/3rd/gnu-efi/gnuefi/reloc_x86_64.c deleted file mode 100644 index 04b75b29f..000000000 --- a/3rd/gnu-efi/gnuefi/reloc_x86_64.c +++ /dev/null @@ -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 . - Copyright (C) 2005 Intel Co. - Contributed by Fenghua Yu . - - 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 -#include - -#include - -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; -} diff --git a/3rd/gnu-efi/inc/Makefile b/3rd/gnu-efi/inc/Makefile deleted file mode 100644 index db3929f62..000000000 --- a/3rd/gnu-efi/inc/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -SRCDIR = . - -VPATH = $(SRCDIR) - -include $(SRCDIR)/../Make.defaults - -TOPDIR = $(SRCDIR)/.. - -CDIR=$(TOPDIR)/.. - -all: - -clean: - -install: - mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi - mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol - mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi/$(ARCH) - $(INSTALL) -m 644 $(SRCDIR)/*.h $(INSTALLROOT)$(INCLUDEDIR)/efi - $(INSTALL) -m 644 $(SRCDIR)/protocol/*.h $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol - $(INSTALL) -m 644 $(SRCDIR)/$(ARCH)/*.h $(INSTALLROOT)$(INCLUDEDIR)/efi/$(ARCH) -ifeq ($(ARCH),ia64) - mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol/ia64 - $(INSTALL) -m 644 $(SRCDIR)/protocol/ia64/*.h $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol/ia64 -endif - -include $(SRCDIR)/../Make.rules diff --git a/3rd/gnu-efi/inc/aarch64/efibind.h b/3rd/gnu-efi/inc/aarch64/efibind.h deleted file mode 100644 index d6b5d0fdd..000000000 --- a/3rd/gnu-efi/inc/aarch64/efibind.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copright (C) 2014 - 2015 Linaro Ltd. - * Author: Ard Biesheuvel - * - * 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 )) && !defined(__cplusplus) - -// 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 -typedef uint64_t uintptr_t; -typedef int64_t intptr_t; - -#else -#include -#endif - -// -// Basic EFI types of various widths -// - -#include - -typedef wchar_t CHAR16; -#define WCHAR CHAR16 - -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 char CHAR8; -typedef int8_t INT8; - -#undef VOID -typedef 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 diff --git a/3rd/gnu-efi/inc/aarch64/efilibplat.h b/3rd/gnu-efi/inc/aarch64/efilibplat.h deleted file mode 100644 index 70a07865d..000000000 --- a/3rd/gnu-efi/inc/aarch64/efilibplat.h +++ /dev/null @@ -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 - ); - diff --git a/3rd/gnu-efi/inc/aarch64/efisetjmp_arch.h b/3rd/gnu-efi/inc/aarch64/efisetjmp_arch.h deleted file mode 100644 index d960706d8..000000000 --- a/3rd/gnu-efi/inc/aarch64/efisetjmp_arch.h +++ /dev/null @@ -1,34 +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; - UINT64 _pad1; - - /* FP regs */ - UINT64 D8; - UINT64 D9; - UINT64 D10; - UINT64 D11; - UINT64 D12; - UINT64 D13; - UINT64 D14; - UINT64 D15; -} ALIGN(JMPBUF_ALIGN) jmp_buf[1]; - -#endif /* GNU_EFI_AARCH64_SETJMP_H */ diff --git a/3rd/gnu-efi/inc/arm/efibind.h b/3rd/gnu-efi/inc/arm/efibind.h deleted file mode 100644 index 8c578df66..000000000 --- a/3rd/gnu-efi/inc/arm/efibind.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copright (C) 2014 - 2015 Linaro Ltd. - * Author: Ard Biesheuvel - * - * 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 )) && !defined(__cplusplus) - -// 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 -typedef uint32_t uintptr_t; -typedef int32_t intptr_t; - -#else -#include -#endif - -/* - * This prevents GCC from emitting GOT based relocations, and use R_ARM_REL32 - * relative relocations instead, which are more suitable for static binaries. - */ -#if defined(__GNUC__) && !__STDC_HOSTED__ -#pragma GCC visibility push (hidden) -#endif - -// -// Basic EFI types of various widths -// - -#include - -typedef wchar_t CHAR16; -#define WCHAR CHAR16 - -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 char CHAR8; -typedef int8_t INT8; - -#undef VOID -typedef 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 diff --git a/3rd/gnu-efi/inc/arm/efilibplat.h b/3rd/gnu-efi/inc/arm/efilibplat.h deleted file mode 100644 index 70a07865d..000000000 --- a/3rd/gnu-efi/inc/arm/efilibplat.h +++ /dev/null @@ -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 - ); - diff --git a/3rd/gnu-efi/inc/arm/efisetjmp_arch.h b/3rd/gnu-efi/inc/arm/efisetjmp_arch.h deleted file mode 100644 index 17f5dc0fa..000000000 --- a/3rd/gnu-efi/inc/arm/efisetjmp_arch.h +++ /dev/null @@ -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[1]; - -#endif /* GNU_EFI_ARM_SETJMP_H */ diff --git a/3rd/gnu-efi/inc/efi.h b/3rd/gnu-efi/inc/efi.h deleted file mode 100644 index b251a3447..000000000 --- a/3rd/gnu-efi/inc/efi.h +++ /dev/null @@ -1,82 +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)) - -#if defined(_M_X64) || defined(__x86_64__) || defined(__amd64__) -#include "x86_64/efibind.h" -#elif defined(_M_IX86) || defined(__i386__) -#include "ia32/efibind.h" -#elif defined(_M_IA64) || defined(__ia64__) -#include "ia64/efibind.h" -#elif defined (_M_ARM64) || defined(__aarch64__) -#include "aarch64/efibind.h" -#elif defined (_M_ARM) || defined(__arm__) -#include "arm/efibind.h" -#elif defined (_M_MIPS64) || defined(__mips64__) || defined(__mips64) -#include "mips64el/efibind.h" -#elif defined (__riscv) && __riscv_xlen == 64 -#include "riscv64/efibind.h" -#elif defined (__loongarch64) -#include "loongarch64/efibind.h" -#else -#error Usupported architecture -#endif - -#include "eficompiler.h" -#include "efidef.h" -#include "efidevp.h" -#include "efipciio.h" -#include "efiprot.h" -#include "eficon.h" -#include "eficonex.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 "efishell.h" - -#endif diff --git a/3rd/gnu-efi/inc/efi_nii.h b/3rd/gnu-efi/inc/efi_nii.h deleted file mode 100644 index fdf5cb432..000000000 --- a/3rd/gnu-efi/inc/efi_nii.h +++ /dev/null @@ -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 diff --git a/3rd/gnu-efi/inc/efi_pxe.h b/3rd/gnu-efi/inc/efi_pxe.h deleted file mode 100644 index d24251f55..000000000 --- a/3rd/gnu-efi/inc/efi_pxe.h +++ /dev/null @@ -1,1743 +0,0 @@ -#ifndef _EFI_PXE_H -#define _EFI_PXE_H - - -/*++ -Copyright (c) Intel 1999 - -Module name: - efi_pxe.h - -32/64-bit PXE specification: - alpha-4, 99-Dec-17 - -Abstract: - This header file contains all of the PXE type definitions, - structure prototypes, global variables and constants that - are needed for porting PXE to EFI. ---*/ - -#pragma pack(1) - -#define PXE_INTEL_ORDER 1 // Intel order -//#define PXE_NETWORK_ORDER 1 // network order - -#define PXE_UINT64_SUPPORT 1 // UINT64 supported -//#define PXE_NO_UINT64_SUPPORT 1 // UINT64 not supported - -#define PXE_BUSTYPE(a,b,c,d) \ -((((PXE_UINT32)(d) & 0xFF) << 24) | \ -(((PXE_UINT32)(c) & 0xFF) << 16) | \ -(((PXE_UINT32)(b) & 0xFF) << 8) | \ -((PXE_UINT32)(a) & 0xFF)) - -// -// UNDI ROM ID and devive ID signature -// -#define PXE_BUSTYPE_PXE PXE_BUSTYPE('!', 'P', 'X', 'E') - -// -// BUS ROM ID signatures -// -#define PXE_BUSTYPE_PCI PXE_BUSTYPE('P', 'C', 'I', 'R') -#define PXE_BUSTYPE_PC_CARD PXE_BUSTYPE('P', 'C', 'C', 'R') -#define PXE_BUSTYPE_USB PXE_BUSTYPE('U', 'S', 'B', 'R') -#define PXE_BUSTYPE_1394 PXE_BUSTYPE('1', '3', '9', '4') - -#define PXE_SWAP_UINT16(n) \ -((((PXE_UINT16)(n) & 0x00FF) << 8) | \ -(((PXE_UINT16)(n) & 0xFF00) >> 8)) - -#define PXE_SWAP_UINT32(n) \ -((((PXE_UINT32)(n) & 0x000000FF) << 24) | \ -(((PXE_UINT32)(n) & 0x0000FF00) << 8) | \ -(((PXE_UINT32)(n) & 0x00FF0000) >> 8) | \ -(((PXE_UINT32)(n) & 0xFF000000) >> 24)) - -#if PXE_UINT64_SUPPORT != 0 -#define PXE_SWAP_UINT64(n) \ -((((PXE_UINT64)(n) & 0x00000000000000FF) << 56) | \ -(((PXE_UINT64)(n) & 0x000000000000FF00) << 40) | \ -(((PXE_UINT64)(n) & 0x0000000000FF0000) << 24) | \ -(((PXE_UINT64)(n) & 0x00000000FF000000) << 8) | \ -(((PXE_UINT64)(n) & 0x000000FF00000000) >> 8) | \ -(((PXE_UINT64)(n) & 0x0000FF0000000000) >> 24) | \ -(((PXE_UINT64)(n) & 0x00FF000000000000) >> 40) | \ -(((PXE_UINT64)(n) & 0xFF00000000000000) >> 56)) -#endif // PXE_UINT64_SUPPORT - -#if PXE_NO_UINT64_SUPPORT != 0 -#define PXE_SWAP_UINT64(n) \ -{ \ -PXE_UINT32 tmp = (PXE_UINT64)(n)[1]; \ -(PXE_UINT64)(n)[1] = PXE_SWAP_UINT32((PXE_UINT64)(n)[0]); \ -(PXE_UINT64)(n)[0] = tmp; \ -} -#endif // PXE_NO_UINT64_SUPPORT - -#define PXE_CPBSIZE_NOT_USED 0 // zero -#define PXE_DBSIZE_NOT_USED 0 // zero -#define PXE_CPBADDR_NOT_USED (PXE_UINT64)0 // zero -#define PXE_DBADDR_NOT_USED (PXE_UINT64)0 // zero - -#define PXE_CONST const - -#define PXE_VOLATILE volatile - -typedef void PXE_VOID; - -typedef unsigned char PXE_UINT8; - -typedef unsigned short PXE_UINT16; - -typedef unsigned PXE_UINT32; - -#if PXE_UINT64_SUPPORT != 0 -// typedef unsigned long PXE_UINT64; -typedef UINT64 PXE_UINT64; -#endif // PXE_UINT64_SUPPORT - -#if PXE_NO_UINT64_SUPPORT != 0 -typedef PXE_UINT32 PXE_UINT64[2]; -#endif // PXE_NO_UINT64_SUPPORT - -typedef unsigned PXE_UINTN; - -typedef PXE_UINT8 PXE_BOOL; - -#define PXE_FALSE 0 // zero -#define PXE_TRUE (!PXE_FALSE) - -typedef PXE_UINT16 PXE_OPCODE; - -// -// Return UNDI operational state. -// -#define PXE_OPCODE_GET_STATE 0x0000 - -// -// Change UNDI operational state from Stopped to Started. -// -#define PXE_OPCODE_START 0x0001 - -// -// Change UNDI operational state from Started to Stopped. -// -#define PXE_OPCODE_STOP 0x0002 - -// -// Get UNDI initialization information. -// -#define PXE_OPCODE_GET_INIT_INFO 0x0003 - -// -// Get NIC configuration information. -// -#define PXE_OPCODE_GET_CONFIG_INFO 0x0004 - -// -// Changed UNDI operational state from Started to Initialized. -// -#define PXE_OPCODE_INITIALIZE 0x0005 - -// -// Re-initialize the NIC H/W. -// -#define PXE_OPCODE_RESET 0x0006 - -// -// Change the UNDI operational state from Initialized to Started. -// -#define PXE_OPCODE_SHUTDOWN 0x0007 - -// -// Read & change state of external interrupt enables. -// -#define PXE_OPCODE_INTERRUPT_ENABLES 0x0008 - -// -// Read & change state of packet receive filters. -// -#define PXE_OPCODE_RECEIVE_FILTERS 0x0009 - -// -// Read & change station MAC address. -// -#define PXE_OPCODE_STATION_ADDRESS 0x000A - -// -// Read traffic statistics. -// -#define PXE_OPCODE_STATISTICS 0x000B - -// -// Convert multicast IP address to multicast MAC address. -// -#define PXE_OPCODE_MCAST_IP_TO_MAC 0x000C - -// -// Read or change non-volatile storage on the NIC. -// -#define PXE_OPCODE_NVDATA 0x000D - -// -// Get & clear interrupt status. -// -#define PXE_OPCODE_GET_STATUS 0x000E - -// -// Fill media header in packet for transmit. -// -#define PXE_OPCODE_FILL_HEADER 0x000F - -// -// Transmit packet(s). -// -#define PXE_OPCODE_TRANSMIT 0x0010 - -// -// Receive packet. -// -#define PXE_OPCODE_RECEIVE 0x0011 - -// last valid opcode: -#define PXE_OPCODE_VALID_MAX 0x0011 - -// -// Last valid PXE UNDI OpCode number. -// -#define PXE_OPCODE_LAST_VALID 0x0011 - -typedef PXE_UINT16 PXE_OPFLAGS; - -#define PXE_OPFLAGS_NOT_USED 0x0000 - -//////////////////////////////////////// -// UNDI Get State -// - -// No OpFlags - -//////////////////////////////////////// -// UNDI Start -// - -// No OpFlags - -//////////////////////////////////////// -// UNDI Stop -// - -// No OpFlags - -//////////////////////////////////////// -// UNDI Get Init Info -// - -// No Opflags - -//////////////////////////////////////// -// UNDI Get Config Info -// - -// No Opflags - -//////////////////////////////////////// -// UNDI Initialize -// - -#define PXE_OPFLAGS_INITIALIZE_CABLE_DETECT_MASK 0x0001 -#define PXE_OPFLAGS_INITIALIZE_DETECT_CABLE 0x0000 -#define PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE 0x0001 - -//////////////////////////////////////// -// UNDI Reset -// - -#define PXE_OPFLAGS_RESET_DISABLE_INTERRUPTS 0x0001 -#define PXE_OPFLAGS_RESET_DISABLE_FILTERS 0x0002 - -//////////////////////////////////////// -// UNDI Shutdown -// - -// No OpFlags - -//////////////////////////////////////// -// UNDI Interrupt Enables -// - -// -// Select whether to enable or disable external interrupt signals. -// Setting both enable and disable will return PXE_STATCODE_INVALID_OPFLAGS. -// -#define PXE_OPFLAGS_INTERRUPT_OPMASK 0xC000 -#define PXE_OPFLAGS_INTERRUPT_ENABLE 0x8000 -#define PXE_OPFLAGS_INTERRUPT_DISABLE 0x4000 -#define PXE_OPFLAGS_INTERRUPT_READ 0x0000 - -// -// Enable receive interrupts. An external interrupt will be generated -// after a complete non-error packet has been received. -// -#define PXE_OPFLAGS_INTERRUPT_RECEIVE 0x0001 - -// -// Enable transmit interrupts. An external interrupt will be generated -// after a complete non-error packet has been transmitted. -// -#define PXE_OPFLAGS_INTERRUPT_TRANSMIT 0x0002 - -// -// Enable command interrupts. An external interrupt will be generated -// when command execution stops. -// -#define PXE_OPFLAGS_INTERRUPT_COMMAND 0x0004 - -// -// Generate software interrupt. Setting this bit generates an external -// interrupt, if it is supported by the hardware. -// -#define PXE_OPFLAGS_INTERRUPT_SOFTWARE 0x0008 - -//////////////////////////////////////// -// UNDI Receive Filters -// - -// -// Select whether to enable or disable receive filters. -// Setting both enable and disable will return PXE_STATCODE_INVALID_OPCODE. -// -#define PXE_OPFLAGS_RECEIVE_FILTER_OPMASK 0xC000 -#define PXE_OPFLAGS_RECEIVE_FILTER_ENABLE 0x8000 -#define PXE_OPFLAGS_RECEIVE_FILTER_DISABLE 0x4000 -#define PXE_OPFLAGS_RECEIVE_FILTER_READ 0x0000 - -// -// To reset the contents of the multicast MAC address filter list, -// set this OpFlag: -// -#define PXE_OPFLAGS_RECEIVE_FILTER_RESET_MCAST_LIST 0x2000 - -// -// Enable unicast packet receiving. Packets sent to the current station -// MAC address will be received. -// -#define PXE_OPFLAGS_RECEIVE_FILTER_UNICAST 0x0001 - -// -// Enable broadcast packet receiving. Packets sent to the broadcast -// MAC address will be received. -// -#define PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST 0x0002 - -// -// Enable filtered multicast packet receiving. Packets sent to any -// of the multicast MAC addresses in the multicast MAC address filter -// list will be received. If the filter list is empty, no multicast -// -#define PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST 0x0004 - -// -// Enable promiscuous packet receiving. All packets will be received. -// -#define PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS 0x0008 - -// -// Enable promiscuous multicast packet receiving. All multicast -// packets will be received. -// -#define PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST 0x0010 - -//////////////////////////////////////// -// UNDI Station Address -// - -#define PXE_OPFLAGS_STATION_ADDRESS_READ 0x0000 -#define PXE_OPFLAGS_STATION_ADDRESS_RESET 0x0001 - -//////////////////////////////////////// -// UNDI Statistics -// - -#define PXE_OPFLAGS_STATISTICS_READ 0x0000 -#define PXE_OPFLAGS_STATISTICS_RESET 0x0001 - -//////////////////////////////////////// -// UNDI MCast IP to MAC -// - -// -// Identify the type of IP address in the CPB. -// -#define PXE_OPFLAGS_MCAST_IP_TO_MAC_OPMASK 0x0003 -#define PXE_OPFLAGS_MCAST_IPV4_TO_MAC 0x0000 -#define PXE_OPFLAGS_MCAST_IPV6_TO_MAC 0x0001 - -//////////////////////////////////////// -// UNDI NvData -// - -// -// Select the type of non-volatile data operation. -// -#define PXE_OPFLAGS_NVDATA_OPMASK 0x0001 -#define PXE_OPFLAGS_NVDATA_READ 0x0000 -#define PXE_OPFLAGS_NVDATA_WRITE 0x0001 - -//////////////////////////////////////// -// UNDI Get Status -// - -// -// Return current interrupt status. This will also clear any interrupts -// that are currently set. This can be used in a polling routine. The -// interrupt flags are still set and cleared even when the interrupts -// are disabled. -// -#define PXE_OPFLAGS_GET_INTERRUPT_STATUS 0x0001 - -// -// Return list of transmitted buffers for recycling. Transmit buffers -// must not be changed or unallocated until they have recycled. After -// issuing a transmit command, wait for a transmit complete interrupt. -// When a transmit complete interrupt is received, read the transmitted -// buffers. Do not plan on getting one buffer per interrupt. Some -// NICs and UNDIs may transmit multiple buffers per interrupt. -// -#define PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS 0x0002 - -//////////////////////////////////////// -// UNDI Fill Header -// - -#define PXE_OPFLAGS_FILL_HEADER_OPMASK 0x0001 -#define PXE_OPFLAGS_FILL_HEADER_FRAGMENTED 0x0001 -#define PXE_OPFLAGS_FILL_HEADER_WHOLE 0x0000 - -//////////////////////////////////////// -// UNDI Transmit -// - -// -// S/W UNDI only. Return after the packet has been transmitted. A -// transmit complete interrupt will still be generated and the transmit -// buffer will have to be recycled. -// -#define PXE_OPFLAGS_SWUNDI_TRANSMIT_OPMASK 0x0001 -#define PXE_OPFLAGS_TRANSMIT_BLOCK 0x0001 -#define PXE_OPFLAGS_TRANSMIT_DONT_BLOCK 0x0000 - -// -// -// -#define PXE_OPFLAGS_TRANSMIT_OPMASK 0x0002 -#define PXE_OPFLAGS_TRANSMIT_FRAGMENTED 0x0002 -#define PXE_OPFLAGS_TRANSMIT_WHOLE 0x0000 - -//////////////////////////////////////// -// UNDI Receive -// - -// No OpFlags - -typedef PXE_UINT16 PXE_STATFLAGS; - -#define PXE_STATFLAGS_INITIALIZE 0x0000 - -//////////////////////////////////////// -// Common StatFlags that can be returned by all commands. -// - -// -// The COMMAND_COMPLETE and COMMAND_FAILED status flags must be -// implemented by all UNDIs. COMMAND_QUEUED is only needed by UNDIs -// that support command queuing. -// -#define PXE_STATFLAGS_STATUS_MASK 0xC000 -#define PXE_STATFLAGS_COMMAND_COMPLETE 0xC000 -#define PXE_STATFLAGS_COMMAND_FAILED 0x8000 -#define PXE_STATFLAGS_COMMAND_QUEUED 0x4000 -//#define PXE_STATFLAGS_INITIALIZE 0x0000 - -#define PXE_STATFLAGS_DB_WRITE_TRUNCATED 0x2000 - -//////////////////////////////////////// -// UNDI Get State -// - -#define PXE_STATFLAGS_GET_STATE_MASK 0x0003 -#define PXE_STATFLAGS_GET_STATE_INITIALIZED 0x0002 -#define PXE_STATFLAGS_GET_STATE_STARTED 0x0001 -#define PXE_STATFLAGS_GET_STATE_STOPPED 0x0000 - -//////////////////////////////////////// -// UNDI Start -// - -// No additional StatFlags - -//////////////////////////////////////// -// UNDI Get Init Info -// - -#define PXE_STATFLAGS_CABLE_DETECT_MASK 0x0001 -#define PXE_STATFLAGS_CABLE_DETECT_NOT_SUPPORTED 0x0000 -#define PXE_STATFLAGS_CABLE_DETECT_SUPPORTED 0x0001 - - -//////////////////////////////////////// -// UNDI Initialize -// - -#define PXE_STATFLAGS_INITIALIZED_NO_MEDIA 0x0001 - -//////////////////////////////////////// -// UNDI Reset -// - -#define PXE_STATFLAGS_RESET_NO_MEDIA 0x0001 - -//////////////////////////////////////// -// UNDI Shutdown -// - -// No additional StatFlags - -//////////////////////////////////////// -// UNDI Interrupt Enables -// - -// -// If set, receive interrupts are enabled. -// -#define PXE_STATFLAGS_INTERRUPT_RECEIVE 0x0001 - -// -// If set, transmit interrupts are enabled. -// -#define PXE_STATFLAGS_INTERRUPT_TRANSMIT 0x0002 - -// -// If set, command interrupts are enabled. -// -#define PXE_STATFLAGS_INTERRUPT_COMMAND 0x0004 - - -//////////////////////////////////////// -// UNDI Receive Filters -// - -// -// If set, unicast packets will be received. -// -#define PXE_STATFLAGS_RECEIVE_FILTER_UNICAST 0x0001 - -// -// If set, broadcast packets will be received. -// -#define PXE_STATFLAGS_RECEIVE_FILTER_BROADCAST 0x0002 - -// -// If set, multicast packets that match up with the multicast address -// filter list will be received. -// -#define PXE_STATFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST 0x0004 - -// -// If set, all packets will be received. -// -#define PXE_STATFLAGS_RECEIVE_FILTER_PROMISCUOUS 0x0008 - -// -// If set, all multicast packets will be received. -// -#define PXE_STATFLAGS_RECEIVE_FILTER_ALL_MULTICAST 0x0010 - -//////////////////////////////////////// -// UNDI Station Address -// - -// No additional StatFlags - -//////////////////////////////////////// -// UNDI Statistics -// - -// No additional StatFlags - -//////////////////////////////////////// -// UNDI MCast IP to MAC -// - -// No additional StatFlags - -//////////////////////////////////////// -// UNDI NvData -// - -// No additional StatFlags - - -//////////////////////////////////////// -// UNDI Get Status -// - -// -// Use to determine if an interrupt has occurred. -// -#define PXE_STATFLAGS_GET_STATUS_INTERRUPT_MASK 0x000F -#define PXE_STATFLAGS_GET_STATUS_NO_INTERRUPTS 0x0000 - -// -// If set, at least one receive interrupt occurred. -// -#define PXE_STATFLAGS_GET_STATUS_RECEIVE 0x0001 - -// -// If set, at least one transmit interrupt occurred. -// -#define PXE_STATFLAGS_GET_STATUS_TRANSMIT 0x0002 - -// -// If set, at least one command interrupt occurred. -// -#define PXE_STATFLAGS_GET_STATUS_COMMAND 0x0004 - -// -// If set, at least one software interrupt occurred. -// -#define PXE_STATFLAGS_GET_STATUS_SOFTWARE 0x0008 - -// -// This flag is set if the transmitted buffer queue is empty. This flag -// will be set if all transmitted buffer addresses get written into the DB. -// -#define PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY 0x0010 - -// -// This flag is set if no transmitted buffer addresses were written -// into the DB. (This could be because DBsize was too small.) -// -#define PXE_STATFLAGS_GET_STATUS_NO_TXBUFS_WRITTEN 0x0020 - -//////////////////////////////////////// -// UNDI Fill Header -// - -// No additional StatFlags - -//////////////////////////////////////// -// UNDI Transmit -// - -// No additional StatFlags. - -//////////////////////////////////////// -// UNDI Receive -// - -// No additional StatFlags. - -typedef PXE_UINT16 PXE_STATCODE; - -#define PXE_STATCODE_INITIALIZE 0x0000 - -//////////////////////////////////////// -// Common StatCodes returned by all UNDI commands, UNDI protocol functions -// and BC protocol functions. -// - -#define PXE_STATCODE_SUCCESS 0x0000 - -#define PXE_STATCODE_INVALID_CDB 0x0001 -#define PXE_STATCODE_INVALID_CPB 0x0002 -#define PXE_STATCODE_BUSY 0x0003 -#define PXE_STATCODE_QUEUE_FULL 0x0004 -#define PXE_STATCODE_ALREADY_STARTED 0x0005 -#define PXE_STATCODE_NOT_STARTED 0x0006 -#define PXE_STATCODE_NOT_SHUTDOWN 0x0007 -#define PXE_STATCODE_ALREADY_INITIALIZED 0x0008 -#define PXE_STATCODE_NOT_INITIALIZED 0x0009 -#define PXE_STATCODE_DEVICE_FAILURE 0x000A -#define PXE_STATCODE_NVDATA_FAILURE 0x000B -#define PXE_STATCODE_UNSUPPORTED 0x000C -#define PXE_STATCODE_BUFFER_FULL 0x000D -#define PXE_STATCODE_INVALID_PARAMETER 0x000E -#define PXE_STATCODE_INVALID_UNDI 0x000F -#define PXE_STATCODE_IPV4_NOT_SUPPORTED 0x0010 -#define PXE_STATCODE_IPV6_NOT_SUPPORTED 0x0011 -#define PXE_STATCODE_NOT_ENOUGH_MEMORY 0x0012 -#define PXE_STATCODE_NO_DATA 0x0013 - - -typedef PXE_UINT16 PXE_IFNUM; - -// -// This interface number must be passed to the S/W UNDI Start command. -// -#define PXE_IFNUM_START 0x0000 - -// -// This interface number is returned by the S/W UNDI Get State and -// Start commands if information in the CDB, CPB or DB is invalid. -// -#define PXE_IFNUM_INVALID 0x0000 - -typedef PXE_UINT16 PXE_CONTROL; - -// -// Setting this flag directs the UNDI to queue this command for later -// execution if the UNDI is busy and it supports command queuing. -// If queuing is not supported, a PXE_STATCODE_INVALID_CONTROL error -// is returned. If the queue is full, a PXE_STATCODE_CDB_QUEUE_FULL -// error is returned. -// -#define PXE_CONTROL_QUEUE_IF_BUSY 0x0002 - -// -// These two bit values are used to determine if there are more UNDI -// CDB structures following this one. If the link bit is set, there -// must be a CDB structure following this one. Execution will start -// on the next CDB structure as soon as this one completes successfully. -// If an error is generated by this command, execution will stop. -// -#define PXE_CONTROL_LINK 0x0001 -#define PXE_CONTROL_LAST_CDB_IN_LIST 0x0000 - -typedef PXE_UINT8 PXE_FRAME_TYPE; - -#define PXE_FRAME_TYPE_NONE 0x00 -#define PXE_FRAME_TYPE_UNICAST 0x01 -#define PXE_FRAME_TYPE_BROADCAST 0x02 -#define PXE_FRAME_TYPE_MULTICAST 0x03 -#define PXE_FRAME_TYPE_PROMISCUOUS 0x04 - -typedef PXE_UINT32 PXE_IPV4; - -typedef PXE_UINT32 PXE_IPV6[4]; -#define PXE_MAC_LENGTH 32 - -typedef PXE_UINT8 PXE_MAC_ADDR[PXE_MAC_LENGTH]; - -typedef PXE_UINT8 PXE_IFTYPE; -typedef PXE_UINT16 PXE_MEDIA_PROTOCOL; - -// -// This information is from the ARP section of RFC 1700. -// -// 1 Ethernet (10Mb) [JBP] -// 2 Experimental Ethernet (3Mb) [JBP] -// 3 Amateur Radio AX.25 [PXK] -// 4 Proteon ProNET Token Ring [JBP] -// 5 Chaos [GXP] -// 6 IEEE 802 Networks [JBP] -// 7 ARCNET [JBP] -// 8 Hyperchannel [JBP] -// 9 Lanstar [TU] -// 10 Autonet Short Address [MXB1] -// 11 LocalTalk [JKR1] -// 12 LocalNet (IBM PCNet or SYTEK LocalNET) [JXM] -// 13 Ultra link [RXD2] -// 14 SMDS [GXC1] -// 15 Frame Relay [AGM] -// 16 Asynchronous Transmission Mode (ATM) [JXB2] -// 17 HDLC [JBP] -// 18 Fibre Channel [Yakov Rekhter] -// 19 Asynchronous Transmission Mode (ATM) [Mark Laubach] -// 20 Serial Line [JBP] -// 21 Asynchronous Transmission Mode (ATM) [MXB1] -// - -#define PXE_IFTYPE_ETHERNET 0x01 -#define PXE_IFTYPE_TOKENRING 0x04 -#define PXE_IFTYPE_FIBRE_CHANNEL 0x12 - -typedef struct s_pxe_hw_undi { -PXE_UINT32 Signature; // PXE_ROMID_SIGNATURE -PXE_UINT8 Len; // sizeof(PXE_HW_UNDI) -PXE_UINT8 Fudge; // makes 8-bit cksum equal zero -PXE_UINT8 Rev; // PXE_ROMID_REV -PXE_UINT8 IFcnt; // physical connector count -PXE_UINT8 MajorVer; // PXE_ROMID_MAJORVER -PXE_UINT8 MinorVer; // PXE_ROMID_MINORVER -PXE_UINT16 reserved; // zero, not used -PXE_UINT32 Implementation; // implementation flags -// reserved // vendor use -// PXE_UINT32 Status; // status port -// PXE_UINT32 Command; // command port -// PXE_UINT64 CDBaddr; // CDB address port -} PXE_HW_UNDI; - -// -// Status port bit definitions -// - -// -// UNDI operation state -// -#define PXE_HWSTAT_STATE_MASK 0xC0000000 -#define PXE_HWSTAT_BUSY 0xC0000000 -#define PXE_HWSTAT_INITIALIZED 0x80000000 -#define PXE_HWSTAT_STARTED 0x40000000 -#define PXE_HWSTAT_STOPPED 0x00000000 - -// -// If set, last command failed -// -#define PXE_HWSTAT_COMMAND_FAILED 0x20000000 - -// -// If set, identifies enabled receive filters -// -#define PXE_HWSTAT_PROMISCUOUS_MULTICAST_RX_ENABLED 0x00001000 -#define PXE_HWSTAT_PROMISCUOUS_RX_ENABLED 0x00000800 -#define PXE_HWSTAT_BROADCAST_RX_ENABLED 0x00000400 -#define PXE_HWSTAT_MULTICAST_RX_ENABLED 0x00000200 -#define PXE_HWSTAT_UNICAST_RX_ENABLED 0x00000100 - -// -// If set, identifies enabled external interrupts -// -#define PXE_HWSTAT_SOFTWARE_INT_ENABLED 0x00000080 -#define PXE_HWSTAT_TX_COMPLETE_INT_ENABLED 0x00000040 -#define PXE_HWSTAT_PACKET_RX_INT_ENABLED 0x00000020 -#define PXE_HWSTAT_CMD_COMPLETE_INT_ENABLED 0x00000010 - -// -// If set, identifies pending interrupts -// -#define PXE_HWSTAT_SOFTWARE_INT_PENDING 0x00000008 -#define PXE_HWSTAT_TX_COMPLETE_INT_PENDING 0x00000004 -#define PXE_HWSTAT_PACKET_RX_INT_PENDING 0x00000002 -#define PXE_HWSTAT_CMD_COMPLETE_INT_PENDING 0x00000001 - -// -// Command port definitions -// - -// -// If set, CDB identified in CDBaddr port is given to UNDI. -// If not set, other bits in this word will be processed. -// -#define PXE_HWCMD_ISSUE_COMMAND 0x80000000 -#define PXE_HWCMD_INTS_AND_FILTS 0x00000000 - -// -// Use these to enable/disable receive filters. -// -#define PXE_HWCMD_PROMISCUOUS_MULTICAST_RX_ENABLE 0x00001000 -#define PXE_HWCMD_PROMISCUOUS_RX_ENABLE 0x00000800 -#define PXE_HWCMD_BROADCAST_RX_ENABLE 0x00000400 -#define PXE_HWCMD_MULTICAST_RX_ENABLE 0x00000200 -#define PXE_HWCMD_UNICAST_RX_ENABLE 0x00000100 - -// -// Use these to enable/disable external interrupts -// -#define PXE_HWCMD_SOFTWARE_INT_ENABLE 0x00000080 -#define PXE_HWCMD_TX_COMPLETE_INT_ENABLE 0x00000040 -#define PXE_HWCMD_PACKET_RX_INT_ENABLE 0x00000020 -#define PXE_HWCMD_CMD_COMPLETE_INT_ENABLE 0x00000010 - -// -// Use these to clear pending external interrupts -// -#define PXE_HWCMD_CLEAR_SOFTWARE_INT 0x00000008 -#define PXE_HWCMD_CLEAR_TX_COMPLETE_INT 0x00000004 -#define PXE_HWCMD_CLEAR_PACKET_RX_INT 0x00000002 -#define PXE_HWCMD_CLEAR_CMD_COMPLETE_INT 0x00000001 - -typedef struct s_pxe_sw_undi { -PXE_UINT32 Signature; // PXE_ROMID_SIGNATURE -PXE_UINT8 Len; // sizeof(PXE_SW_UNDI) -PXE_UINT8 Fudge; // makes 8-bit cksum zero -PXE_UINT8 Rev; // PXE_ROMID_REV -PXE_UINT8 IFcnt; // physical connector count -PXE_UINT8 MajorVer; // PXE_ROMID_MAJORVER -PXE_UINT8 MinorVer; // PXE_ROMID_MINORVER -PXE_UINT16 reserved1; // zero, not used -PXE_UINT32 Implementation; // Implementation flags -PXE_UINT64 EntryPoint; // API entry point -PXE_UINT8 reserved2[3]; // zero, not used -PXE_UINT8 BusCnt; // number of bustypes supported -PXE_UINT32 BusType[1]; // list of supported bustypes -} PXE_SW_UNDI; - -typedef union u_pxe_undi { -PXE_HW_UNDI hw; -PXE_SW_UNDI sw; -} PXE_UNDI; - -// -// Signature of !PXE structure -// -#define PXE_ROMID_SIGNATURE PXE_BUSTYPE('!', 'P', 'X', 'E') - -// -// !PXE structure format revision -// -#define PXE_ROMID_REV 0x02 - -// -// UNDI command interface revision. These are the values that get sent -// in option 94 (Client Network Interface Identifier) in the DHCP Discover -// and PXE Boot Server Request packets. -// -#define PXE_ROMID_MAJORVER 0x03 -#define PXE_ROMID_MINORVER 0x00 - -// -// Implementation flags -// -#define PXE_ROMID_IMP_HW_UNDI 0x80000000 -#define PXE_ROMID_IMP_SW_VIRT_ADDR 0x40000000 -#define PXE_ROMID_IMP_64BIT_DEVICE 0x00010000 -#define PXE_ROMID_IMP_FRAG_SUPPORTED 0x00008000 -#define PXE_ROMID_IMP_CMD_LINK_SUPPORTED 0x00004000 -#define PXE_ROMID_IMP_CMD_QUEUE_SUPPORTED 0x00002000 -#define PXE_ROMID_IMP_MULTI_FRAME_SUPPORTED 0x00001000 -#define PXE_ROMID_IMP_NVDATA_SUPPORT_MASK 0x00000C00 -#define PXE_ROMID_IMP_NVDATA_BULK_WRITABLE 0x00000C00 -#define PXE_ROMID_IMP_NVDATA_SPARSE_WRITABLE 0x00000800 -#define PXE_ROMID_IMP_NVDATA_READ_ONLY 0x00000400 -#define PXE_ROMID_IMP_NVDATA_NOT_AVAILABLE 0x00000000 -#define PXE_ROMID_IMP_STATISTICS_SUPPORTED 0x00000200 -#define PXE_ROMID_IMP_STATION_ADDR_SETTABLE 0x00000100 -#define PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED 0x00000080 -#define PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED 0x00000040 -#define PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED 0x00000020 -#define PXE_ROMID_IMP_FILTERED_MULTICAST_RX_SUPPORTED 0x00000010 -#define PXE_ROMID_IMP_SOFTWARE_INT_SUPPORTED 0x00000008 -#define PXE_ROMID_IMP_TX_COMPLETE_INT_SUPPORTED 0x00000004 -#define PXE_ROMID_IMP_PACKET_RX_INT_SUPPORTED 0x00000002 -#define PXE_ROMID_IMP_CMD_COMPLETE_INT_SUPPORTED 0x00000001 - - -typedef struct s_pxe_cdb { -PXE_OPCODE OpCode; -PXE_OPFLAGS OpFlags; -PXE_UINT16 CPBsize; -PXE_UINT16 DBsize; -UINT64 CPBaddr; -UINT64 DBaddr; -PXE_STATCODE StatCode; -PXE_STATFLAGS StatFlags; -PXE_UINT16 IFnum; -PXE_CONTROL Control; -} PXE_CDB; - - -typedef union u_pxe_ip_addr { -PXE_IPV6 IPv6; -PXE_IPV4 IPv4; -} PXE_IP_ADDR; - -typedef union pxe_device { -// -// PCI and PC Card NICs are both identified using bus, device -// and function numbers. For PC Card, this may require PC -// Card services to be loaded in the BIOS or preboot -// environment. -// -struct { -// -// See S/W UNDI ROMID structure definition for PCI and -// PCC BusType definitions. -// -PXE_UINT32 BusType; - -// -// Bus, device & function numbers that locate this device. -// -PXE_UINT16 Bus; -PXE_UINT8 Device; -PXE_UINT8 Function; -} PCI, PCC; - -// -// %%TBD - More information is needed about enumerating -// USB and 1394 devices. -// -struct { -PXE_UINT32 BusType; -PXE_UINT32 tdb; -} USB, _1394; -} PXE_DEVICE; - -// cpb and db definitions - -#define MAX_PCI_CONFIG_LEN 64 // # of dwords -#define MAX_EEPROM_LEN 128 // #of dwords -#define MAX_XMIT_BUFFERS 32 // recycling Q length for xmit_done -#define MAX_MCAST_ADDRESS_CNT 8 - -typedef struct s_pxe_cpb_start { - // - // PXE_VOID Delay(PXE_UINT64 microseconds); - // - // UNDI will never request a delay smaller than 10 microseconds - // and will always request delays in increments of 10 microseconds. - // The Delay() CallBack routine must delay between n and n + 10 - // microseconds before returning control to the UNDI. - // - // This field cannot be set to zero. - // - PXE_UINT64 Delay; - - // - // PXE_VOID Block(PXE_UINT32 enable); - // - // UNDI may need to block multi-threaded/multi-processor access to - // critical code sections when programming or accessing the network - // device. To this end, a blocking service is needed by the UNDI. - // When UNDI needs a block, it will call Block() passing a non-zero - // value. When UNDI no longer needs a block, it will call Block() - // with a zero value. When called, if the Block() is already enabled, - // do not return control to the UNDI until the previous Block() is - // disabled. - // - // This field cannot be set to zero. - // - PXE_UINT64 Block; - - // - // PXE_VOID Virt2Phys(PXE_UINT64 virtual, PXE_UINT64 physical_ptr); - // - // UNDI will pass the virtual address of a buffer and the virtual - // address of a 64-bit physical buffer. Convert the virtual address - // to a physical address and write the result to the physical address - // buffer. If virtual and physical addresses are the same, just - // copy the virtual address to the physical address buffer. - // - // This field can be set to zero if virtual and physical addresses - // are equal. - // - PXE_UINT64 Virt2Phys; - // - // PXE_VOID Mem_IO(PXE_UINT8 read_write, PXE_UINT8 len, PXE_UINT64 port, - // PXE_UINT64 buf_addr); - // - // UNDI will read or write the device io space using this call back - // function. It passes the number of bytes as the len parameter and it - // will be either 1,2,4 or 8. - // - // This field can not be set to zero. - // - PXE_UINT64 Mem_IO; -} PXE_CPB_START; - -#define PXE_DELAY_MILLISECOND 1000 -#define PXE_DELAY_SECOND 1000000 -#define PXE_IO_READ 0 -#define PXE_IO_WRITE 1 -#define PXE_MEM_READ 2 -#define PXE_MEM_WRITE 4 - - -typedef struct s_pxe_db_get_init_info { - // - // Minimum length of locked memory buffer that must be given to - // the Initialize command. Giving UNDI more memory will generally - // give better performance. - // - // If MemoryRequired is zero, the UNDI does not need and will not - // use system memory to receive and transmit packets. - // - PXE_UINT32 MemoryRequired; - - // - // Maximum frame data length for Tx/Rx excluding the media header. - // - PXE_UINT32 FrameDataLen; - - // - // Supported link speeds are in units of mega bits. Common ethernet - // values are 10, 100 and 1000. Unused LinkSpeeds[] entries are zero - // filled. - // - PXE_UINT32 LinkSpeeds[4]; - - // - // Number of non-volatile storage items. - // - PXE_UINT32 NvCount; - - // - // Width of non-volatile storage item in bytes. 0, 1, 2 or 4 - // - PXE_UINT16 NvWidth; - - // - // Media header length. This is the typical media header length for - // this UNDI. This information is needed when allocating receive - // and transmit buffers. - // - PXE_UINT16 MediaHeaderLen; - - // - // Number of bytes in the NIC hardware (MAC) address. - // - PXE_UINT16 HWaddrLen; - - // - // Maximum number of multicast MAC addresses in the multicast - // MAC address filter list. - // - PXE_UINT16 MCastFilterCnt; - - // - // Default number and size of transmit and receive buffers that will - // be allocated by the UNDI. If MemoryRequired is non-zero, this - // allocation will come out of the memory buffer given to the Initialize - // command. If MemoryRequired is zero, this allocation will come out of - // memory on the NIC. - // - PXE_UINT16 TxBufCnt; - PXE_UINT16 TxBufSize; - PXE_UINT16 RxBufCnt; - PXE_UINT16 RxBufSize; - - // - // Hardware interface types defined in the Assigned Numbers RFC - // and used in DHCP and ARP packets. - // See the PXE_IFTYPE typedef and PXE_IFTYPE_xxx macros. - // - PXE_UINT8 IFtype; - - // - // Supported duplex. See PXE_DUPLEX_xxxxx #defines below. - // - PXE_UINT8 Duplex; - - // - // Supported loopback options. See PXE_LOOPBACK_xxxxx #defines below. - // - PXE_UINT8 LoopBack; -} PXE_DB_GET_INIT_INFO; - -#define PXE_MAX_TXRX_UNIT_ETHER 1500 - -#define PXE_HWADDR_LEN_ETHER 0x0006 -#define PXE_MAC_HEADER_LEN_ETHER 0x000E - -#define PXE_DUPLEX_ENABLE_FULL_SUPPORTED 1 -#define PXE_DUPLEX_FORCE_FULL_SUPPORTED 2 - -#define PXE_LOOPBACK_INTERNAL_SUPPORTED 1 -#define PXE_LOOPBACK_EXTERNAL_SUPPORTED 2 - - -typedef struct s_pxe_pci_config_info { - // - // This is the flag field for the PXE_DB_GET_CONFIG_INFO union. - // For PCI bus devices, this field is set to PXE_BUSTYPE_PCI. - // - PXE_UINT32 BusType; - - // - // This identifies the PCI network device that this UNDI interface - // is bound to. - // - PXE_UINT16 Bus; - PXE_UINT8 Device; - PXE_UINT8 Function; - - // - // This is a copy of the PCI configuration space for this - // network device. - // - union { - PXE_UINT8 Byte[256]; - PXE_UINT16 Word[128]; - PXE_UINT32 Dword[64]; - } Config; -} PXE_PCI_CONFIG_INFO; - - -typedef struct s_pxe_pcc_config_info { - // - // This is the flag field for the PXE_DB_GET_CONFIG_INFO union. - // For PCC bus devices, this field is set to PXE_BUSTYPE_PCC. - // - PXE_UINT32 BusType; - - // - // This identifies the PCC network device that this UNDI interface - // is bound to. - // - PXE_UINT16 Bus; - PXE_UINT8 Device; - PXE_UINT8 Function; - - // - // This is a copy of the PCC configuration space for this - // network device. - // - union { - PXE_UINT8 Byte[256]; - PXE_UINT16 Word[128]; - PXE_UINT32 Dword[64]; - } Config; -} PXE_PCC_CONFIG_INFO; - - -typedef struct s_pxe_usb_config_info { - PXE_UINT32 BusType; - // %%TBD What should we return here... -} PXE_USB_CONFIG_INFO; - - -typedef struct s_pxe_1394_config_info { - PXE_UINT32 BusType; - // %%TBD What should we return here... -} PXE_1394_CONFIG_INFO; - - -typedef union u_pxe_db_get_config_info { - PXE_PCI_CONFIG_INFO pci; - PXE_PCC_CONFIG_INFO pcc; - PXE_USB_CONFIG_INFO usb; - PXE_1394_CONFIG_INFO _1394; -} PXE_DB_GET_CONFIG_INFO; - - -typedef struct s_pxe_cpb_initialize { - // - // Address of first (lowest) byte of the memory buffer. This buffer must - // be in contiguous physical memory and cannot be swapped out. The UNDI - // will be using this for transmit and receive buffering. - // - PXE_UINT64 MemoryAddr; - - // - // MemoryLength must be greater than or equal to MemoryRequired - // returned by the Get Init Info command. - // - PXE_UINT32 MemoryLength; - - // - // Desired link speed in Mbit/sec. Common ethernet values are 10, 100 - // and 1000. Setting a value of zero will auto-detect and/or use the - // default link speed (operation depends on UNDI/NIC functionality). - // - PXE_UINT32 LinkSpeed; - - // - // Suggested number and size of receive and transmit buffers to - // allocate. If MemoryAddr and MemoryLength are non-zero, this - // allocation comes out of the supplied memory buffer. If MemoryAddr - // and MemoryLength are zero, this allocation comes out of memory - // on the NIC. - // - // If these fields are set to zero, the UNDI will allocate buffer - // counts and sizes as it sees fit. - // - PXE_UINT16 TxBufCnt; - PXE_UINT16 TxBufSize; - PXE_UINT16 RxBufCnt; - PXE_UINT16 RxBufSize; - - // - // The following configuration parameters are optional and must be zero - // to use the default values. - // - PXE_UINT8 Duplex; - - PXE_UINT8 LoopBack; -} PXE_CPB_INITIALIZE; - - -#define PXE_DUPLEX_DEFAULT 0x00 -#define PXE_FORCE_FULL_DUPLEX 0x01 -#define PXE_ENABLE_FULL_DUPLEX 0x02 - -#define LOOPBACK_NORMAL 0 -#define LOOPBACK_INTERNAL 1 -#define LOOPBACK_EXTERNAL 2 - - -typedef struct s_pxe_db_initialize { - // - // Actual amount of memory used from the supplied memory buffer. This - // may be less that the amount of memory suppllied and may be zero if - // the UNDI and network device do not use external memory buffers. - // - // Memory used by the UNDI and network device is allocated from the - // lowest memory buffer address. - // - PXE_UINT32 MemoryUsed; - - // - // Actual number and size of receive and transmit buffers that were - // allocated. - // - PXE_UINT16 TxBufCnt; - PXE_UINT16 TxBufSize; - PXE_UINT16 RxBufCnt; - PXE_UINT16 RxBufSize; -} PXE_DB_INITIALIZE; - - -typedef struct s_pxe_cpb_receive_filters { - // - // List of multicast MAC addresses. This list, if present, will - // replace the existing multicast MAC address filter list. - // - PXE_MAC_ADDR MCastList[MAX_MCAST_ADDRESS_CNT]; -} PXE_CPB_RECEIVE_FILTERS; - - -typedef struct s_pxe_db_receive_filters { - // - // Filtered multicast MAC address list. - // - PXE_MAC_ADDR MCastList[MAX_MCAST_ADDRESS_CNT]; -} PXE_DB_RECEIVE_FILTERS; - - -typedef struct s_pxe_cpb_station_address { - // - // If supplied and supported, the current station MAC address - // will be changed. - // - PXE_MAC_ADDR StationAddr; -} PXE_CPB_STATION_ADDRESS; - - -typedef struct s_pxe_dpb_station_address { - // - // Current station MAC address. - // - PXE_MAC_ADDR StationAddr; - - // - // Station broadcast MAC address. - // - PXE_MAC_ADDR BroadcastAddr; - - // - // Permanent station MAC address. - // - PXE_MAC_ADDR PermanentAddr; -} PXE_DB_STATION_ADDRESS; - - -typedef struct s_pxe_db_statistics { - // - // Bit field identifying what statistic data is collected by the - // UNDI/NIC. - // If bit 0x00 is set, Data[0x00] is collected. - // If bit 0x01 is set, Data[0x01] is collected. - // If bit 0x20 is set, Data[0x20] is collected. - // If bit 0x21 is set, Data[0x21] is collected. - // Etc. - // - PXE_UINT64 Supported; - - // - // Statistic data. - // - PXE_UINT64 Data[64]; -} PXE_DB_STATISTICS; - -// -// Total number of frames received. Includes frames with errors and -// dropped frames. -// -#define PXE_STATISTICS_RX_TOTAL_FRAMES 0x00 - -// -// Number of valid frames received and copied into receive buffers. -// -#define PXE_STATISTICS_RX_GOOD_FRAMES 0x01 - -// -// Number of frames below the minimum length for the media. -// This would be <64 for ethernet. -// -#define PXE_STATISTICS_RX_UNDERSIZE_FRAMES 0x02 - -// -// Number of frames longer than the maxminum length for the -// media. This would be >1500 for ethernet. -// -#define PXE_STATISTICS_RX_OVERSIZE_FRAMES 0x03 - -// -// Valid frames that were dropped because receive buffers were full. -// -#define PXE_STATISTICS_RX_DROPPED_FRAMES 0x04 - -// -// Number of valid unicast frames received and not dropped. -// -#define PXE_STATISTICS_RX_UNICAST_FRAMES 0x05 - -// -// Number of valid broadcast frames received and not dropped. -// -#define PXE_STATISTICS_RX_BROADCAST_FRAMES 0x06 - -// -// Number of valid mutlicast frames received and not dropped. -// -#define PXE_STATISTICS_RX_MULTICAST_FRAMES 0x07 - -// -// Number of frames w/ CRC or alignment errors. -// -#define PXE_STATISTICS_RX_CRC_ERROR_FRAMES 0x08 - -// -// Total number of bytes received. Includes frames with errors -// and dropped frames. -// -#define PXE_STATISTICS_RX_TOTAL_BYTES 0x09 - -// -// Transmit statistics. -// -#define PXE_STATISTICS_TX_TOTAL_FRAMES 0x0A -#define PXE_STATISTICS_TX_GOOD_FRAMES 0x0B -#define PXE_STATISTICS_TX_UNDERSIZE_FRAMES 0x0C -#define PXE_STATISTICS_TX_OVERSIZE_FRAMES 0x0D -#define PXE_STATISTICS_TX_DROPPED_FRAMES 0x0E -#define PXE_STATISTICS_TX_UNICAST_FRAMES 0x0F -#define PXE_STATISTICS_TX_BROADCAST_FRAMES 0x10 -#define PXE_STATISTICS_TX_MULTICAST_FRAMES 0x11 -#define PXE_STATISTICS_TX_CRC_ERROR_FRAMES 0x12 -#define PXE_STATISTICS_TX_TOTAL_BYTES 0x13 - -// -// Number of collisions detection on this subnet. -// -#define PXE_STATISTICS_COLLISIONS 0x14 - -// -// Number of frames destined for unsupported protocol. -// -#define PXE_STATISTICS_UNSUPPORTED_PROTOCOL 0x15 - - -typedef struct s_pxe_cpb_mcast_ip_to_mac { - // - // Multicast IP address to be converted to multicast MAC address. - // - PXE_IP_ADDR IP; -} PXE_CPB_MCAST_IP_TO_MAC; - - -typedef struct s_pxe_db_mcast_ip_to_mac { - // - // Multicast MAC address. - // - PXE_MAC_ADDR MAC; -} PXE_DB_MCAST_IP_TO_MAC; - - -typedef struct s_pxe_cpb_nvdata_sparse { - // - // NvData item list. Only items in this list will be updated. - // - struct { - // Non-volatile storage address to be changed. - PXE_UINT32 Addr; - - // Data item to write into above storage address. - - union { - PXE_UINT8 Byte; - PXE_UINT16 Word; - PXE_UINT32 Dword; - } Data; - } Item[MAX_EEPROM_LEN]; -} PXE_CPB_NVDATA_SPARSE; - - -// -// When using bulk update, the size of the CPB structure must be -// the same size as the non-volatile NIC storage. -// -typedef union u_pxe_cpb_nvdata_bulk { - // - // Array of byte-wide data items. - // - PXE_UINT8 Byte[MAX_EEPROM_LEN << 2]; - - // - // Array of word-wide data items. - // - PXE_UINT16 Word[MAX_EEPROM_LEN << 1]; - - // - // Array of dword-wide data items. - // - PXE_UINT32 Dword[MAX_EEPROM_LEN]; -} PXE_CPB_NVDATA_BULK; - -typedef struct s_pxe_db_nvdata { - - // Arrays of data items from non-volatile storage. - - union { - // - // Array of byte-wide data items. - // - PXE_UINT8 Byte[MAX_EEPROM_LEN << 2]; - - // - // Array of word-wide data items. - // - PXE_UINT16 Word[MAX_EEPROM_LEN << 1]; - - // Array of dword-wide data items. - - PXE_UINT32 Dword[MAX_EEPROM_LEN]; - } Data; -} PXE_DB_NVDATA; - - -typedef struct s_pxe_db_get_status { - // - // Length of next receive frame (header + data). If this is zero, - // there is no next receive frame available. - // - PXE_UINT32 RxFrameLen; - - // - // Reserved, set to zero. - // - PXE_UINT32 reserved; - - // - // Addresses of transmitted buffers that need to be recycled. - // - PXE_UINT64 TxBuffer[MAX_XMIT_BUFFERS]; -} PXE_DB_GET_STATUS; - - - -typedef struct s_pxe_cpb_fill_header { - // - // Source and destination MAC addresses. These will be copied into - // the media header without doing byte swapping. - // - PXE_MAC_ADDR SrcAddr; - PXE_MAC_ADDR DestAddr; - - // - // Address of first byte of media header. The first byte of packet data - // follows the last byte of the media header. - // - PXE_UINT64 MediaHeader; - - // - // Length of packet data in bytes (not including the media header). - // - PXE_UINT32 PacketLen; - - // - // Protocol type. This will be copied into the media header without - // doing byte swapping. Protocol type numbers can be obtained from - // the Assigned Numbers RFC 1700. - // - PXE_UINT16 Protocol; - - // - // Length of the media header in bytes. - // - PXE_UINT16 MediaHeaderLen; -} PXE_CPB_FILL_HEADER; - - -#define PXE_PROTOCOL_ETHERNET_IP 0x0800 -#define PXE_PROTOCOL_ETHERNET_ARP 0x0806 -#define MAX_XMIT_FRAGMENTS 16 - -typedef struct s_pxe_cpb_fill_header_fragmented { - // - // Source and destination MAC addresses. These will be copied into - // the media header without doing byte swapping. - // - PXE_MAC_ADDR SrcAddr; - PXE_MAC_ADDR DestAddr; - - // - // Length of packet data in bytes (not including the media header). - // - PXE_UINT32 PacketLen; - - // - // Protocol type. This will be copied into the media header without - // doing byte swapping. Protocol type numbers can be obtained from - // the Assigned Numbers RFC 1700. - // - PXE_MEDIA_PROTOCOL Protocol; - - // - // Length of the media header in bytes. - // - PXE_UINT16 MediaHeaderLen; - - // - // Number of packet fragment descriptors. - // - PXE_UINT16 FragCnt; - - // - // Reserved, must be set to zero. - // - PXE_UINT16 reserved; - - // - // Array of packet fragment descriptors. The first byte of the media - // header is the first byte of the first fragment. - // - struct { - // - // Address of this packet fragment. - // - PXE_UINT64 FragAddr; - - // - // Length of this packet fragment. - // - PXE_UINT32 FragLen; - - // - // Reserved, must be set to zero. - // - PXE_UINT32 reserved; - } FragDesc[MAX_XMIT_FRAGMENTS]; -} PXE_CPB_FILL_HEADER_FRAGMENTED; - - - -typedef struct s_pxe_cpb_transmit { - // - // Address of first byte of frame buffer. This is also the first byte - // of the media header. - // - PXE_UINT64 FrameAddr; - - // - // Length of the data portion of the frame buffer in bytes. Do not - // include the length of the media header. - // - PXE_UINT32 DataLen; - - // - // Length of the media header in bytes. - // - PXE_UINT16 MediaheaderLen; - - // - // Reserved, must be zero. - // - PXE_UINT16 reserved; -} PXE_CPB_TRANSMIT; - - - -typedef struct s_pxe_cpb_transmit_fragments { - // - // Length of packet data in bytes (not including the media header). - // - PXE_UINT32 FrameLen; - - // - // Length of the media header in bytes. - // - PXE_UINT16 MediaheaderLen; - - // - // Number of packet fragment descriptors. - // - PXE_UINT16 FragCnt; - - // - // Array of frame fragment descriptors. The first byte of the first - // fragment is also the first byte of the media header. - // - struct { - // - // Address of this frame fragment. - // - PXE_UINT64 FragAddr; - - // - // Length of this frame fragment. - // - PXE_UINT32 FragLen; - - // - // Reserved, must be set to zero. - // - PXE_UINT32 reserved; - } FragDesc[MAX_XMIT_FRAGMENTS]; -} PXE_CPB_TRANSMIT_FRAGMENTS; - - -typedef struct s_pxe_cpb_receive { - // - // Address of first byte of receive buffer. This is also the first byte - // of the frame header. - // - PXE_UINT64 BufferAddr; - - // - // Length of receive buffer. This must be large enough to hold the - // received frame (media header + data). If the length of smaller than - // the received frame, data will be lost. - // - PXE_UINT32 BufferLen; - - // - // Reserved, must be set to zero. - // - PXE_UINT32 reserved; -} PXE_CPB_RECEIVE; - - -typedef struct s_pxe_db_receive { - // - // Source and destination MAC addresses from media header. - // - PXE_MAC_ADDR SrcAddr; - PXE_MAC_ADDR DestAddr; - - // - // Length of received frame. May be larger than receive buffer size. - // The receive buffer will not be overwritten. This is how to tell - // if data was lost because the receive buffer was too small. - // - PXE_UINT32 FrameLen; - - // - // Protocol type from media header. - // - PXE_MEDIA_PROTOCOL Protocol; - - // - // Length of media header in received frame. - // - PXE_UINT16 MediaHeaderLen; - - // - // Type of receive frame. - // - PXE_FRAME_TYPE Type; - - // - // Reserved, must be zero. - // - PXE_UINT8 reserved[7]; - -} PXE_DB_RECEIVE; - -#pragma pack() - -/* EOF - efi_pxe.h */ -#endif /* _EFI_PXE_H */ - diff --git a/3rd/gnu-efi/inc/efiapi.h b/3rd/gnu-efi/inc/efiapi.h deleted file mode 100644 index 01a09388d..000000000 --- a/3rd/gnu-efi/inc/efiapi.h +++ /dev/null @@ -1,989 +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 - -#if !defined(EFI_IMAGE_MACHINE_RISCV32) -#define EFI_IMAGE_MACHINE_RISCV32 0x5032 -#endif - -#if !defined(EFI_IMAGE_MACHINE_RISCV64) -#define EFI_IMAGE_MACHINE_RISCV64 0x5064 -#endif - -#if !defined(EFI_IMAGE_MACHINE_RISCV128) -#define EFI_IMAGE_MACHINE_RISCV128 0x5128 -#endif - -#if !defined(EFI_IMAGE_MACHINE_LOONGARCH32) -#define EFI_IMAGE_MACHINE_LOONGARCH32 0x6232 -#endif - -#if !defined(EFI_IMAGE_MACHINE_LOONGARCH64) -#define EFI_IMAGE_MACHINE_LOONGARCH64 0x6264 -#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} } - -#define EFI_DTB_TABLE_GUID \ - { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} } - -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 - diff --git a/3rd/gnu-efi/inc/eficompiler.h b/3rd/gnu-efi/inc/eficompiler.h deleted file mode 100644 index 26636c7b7..000000000 --- a/3rd/gnu-efi/inc/eficompiler.h +++ /dev/null @@ -1,30 +0,0 @@ -/*++ - -Copyright (c) 2016 Pete Batard - -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 diff --git a/3rd/gnu-efi/inc/eficon.h b/3rd/gnu-efi/inc/eficon.h deleted file mode 100644 index 5d17e0406..000000000 --- a/3rd/gnu-efi/inc/eficon.h +++ /dev/null @@ -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 - diff --git a/3rd/gnu-efi/inc/eficonex.h b/3rd/gnu-efi/inc/eficonex.h deleted file mode 100644 index 5746662df..000000000 --- a/3rd/gnu-efi/inc/eficonex.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef _EFI_CONEX_H -#define _EFI_CONEX_H - -/*++ - -Copyright (c) 2020 Kagurazaka Kotori - -Module Name: - - eficonex.h - -Abstract: - - EFI console extension protocols - ---*/ - -// -// Simple Text Input Ex Protocol -// - -#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \ - { 0xdd9e7534, 0x7762, 0x4698, {0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa} } - -INTERFACE_DECL(_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL); - -typedef UINT8 EFI_KEY_TOGGLE_STATE; - -typedef struct EFI_KEY_STATE { - UINT32 KeyShiftState; - EFI_KEY_TOGGLE_STATE KeyToggleState; -} EFI_KEY_STATE; - -typedef struct { - EFI_INPUT_KEY Key; - EFI_KEY_STATE KeyState; -} EFI_KEY_DATA; - -// Shift states -#define EFI_SHIFT_STATE_VALID 0x80000000 -#define EFI_RIGHT_SHIFT_PRESSED 0x00000001 -#define EFI_LEFT_SHIFT_PRESSED 0x00000002 -#define EFI_RIGHT_CONTROL_PRESSED 0x00000004 -#define EFI_LEFT_CONTROL_PRESSED 0x00000008 -#define EFI_RIGHT_ALT_PRESSED 0x00000010 -#define EFI_LEFT_ALT_PRESSED 0x00000020 -#define EFI_RIGHT_LOGO_PRESSED 0x00000040 -#define EFI_LEFT_LOGO_PRESSED 0x00000080 -#define EFI_MENU_KEY_PRESSED 0x00000100 -#define EFI_SYS_REQ_PRESSED 0x00000200 - -// Toggle states -#define EFI_TOGGLE_STATE_VALID 0x80 -#define EFI_KEY_STATE_EXPOSED 0x40 -#define EFI_SCROLL_LOCK_ACTIVE 0x01 -#define EFI_NUM_LOCK_ACTIVE 0x02 -#define EFI_CAPS_LOCK_ACTIVE 0x04 - -typedef -EFI_STATUS -(EFIAPI *EFI_INPUT_RESET_EX) ( - IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN BOOLEAN ExtendedVerification - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_INPUT_READ_KEY_EX) ( - IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - OUT EFI_KEY_DATA *KeyData - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SET_STATE) ( - IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN EFI_KEY_TOGGLE_STATE *KeyToggleState - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_KEY_NOTIFY_FUNCTION) ( - IN EFI_KEY_DATA *KeyData - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) ( - IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN EFI_KEY_DATA *KeyData, - IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, - OUT VOID **NotifyHandle - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) ( - IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN VOID *NotificationHandle - ); - -typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{ - EFI_INPUT_RESET_EX Reset; - EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx; - EFI_EVENT WaitForKeyEx; - EFI_SET_STATE SetState; - EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify; - EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify; -} EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL; - -#endif diff --git a/3rd/gnu-efi/inc/efidebug.h b/3rd/gnu-efi/inc/efidebug.h deleted file mode 100644 index 8e54dcda8..000000000 --- a/3rd/gnu-efi/inc/efidebug.h +++ /dev/null @@ -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 diff --git a/3rd/gnu-efi/inc/efidef.h b/3rd/gnu-efi/inc/efidef.h deleted file mode 100644 index 5953b6937..000000000 --- a/3rd/gnu-efi/inc/efidef.h +++ /dev/null @@ -1,240 +0,0 @@ -#ifndef _EFI_DEF_H -#define _EFI_DEF_H - -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - efidef.h - -Abstract: - - EFI definitions - - - - -Revision History - ---*/ - -#if !defined(__cplusplus) -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -typedef _Bool BOOLEAN; -#else -typedef unsigned char BOOLEAN; -#endif -#else -typedef bool BOOLEAN; -#endif - -#ifndef CONST - #define CONST const -#endif -#ifndef TRUE -#if defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) - #define TRUE true - #define FALSE false -#else - #define TRUE ((BOOLEAN) 1) - #define FALSE ((BOOLEAN) 0) -#endif -#endif - -#ifndef NULL -#if (defined(__cplusplus) && __cplusplus >= 201103L) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) - #define NULL nullptr -#else -#if !defined(__cplusplus) - #define NULL ((VOID *) 0) -#else - #define NULL 0 -#endif -#endif -#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 CHAR8 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 diff --git a/3rd/gnu-efi/inc/efidevp.h b/3rd/gnu-efi/inc/efidevp.h deleted file mode 100644 index 90fa5465e..000000000 --- a/3rd/gnu-efi/inc/efidevp.h +++ /dev/null @@ -1,650 +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; - UINT8 PortGid[16]; - 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; - -#define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \ - { 0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4} } - -typedef -UINTN -(EFIAPI *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE) ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ); - -typedef -EFI_DEVICE_PATH_PROTOCOL* -(EFIAPI *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH) ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ); - -typedef -EFI_DEVICE_PATH_PROTOCOL* -(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_PATH) ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1, - IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2 - ); - -typedef -EFI_DEVICE_PATH_PROTOCOL* -(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_NODE) ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode -); - -typedef -EFI_DEVICE_PATH_PROTOCOL* -(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE) ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance -); - -typedef -EFI_DEVICE_PATH_PROTOCOL* -(EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE) ( - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance, - OUT UINTN *DevicePathInstanceSize OPTIONAL -); - -typedef -EFI_DEVICE_PATH_PROTOCOL* -(EFIAPI *EFI_DEVICE_PATH_UTILS_CREATE_NODE) ( - IN UINT8 NodeType, - IN UINT8 NodeSubType, - IN UINT16 NodeLength - ); - -typedef -BOOLEAN -(EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE) ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath - ); - -typedef struct _EFI_DEVICE_PATH_UTILITIES_PROTOCOL { - EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize; - EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath; - EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath; - EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode; - EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance; - EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance; - EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance; - EFI_DEVICE_PATH_UTILS_CREATE_NODE CreateDeviceNode; -} EFI_DEVICE_PATH_UTILITIES_PROTOCOL; - -#endif diff --git a/3rd/gnu-efi/inc/efierr.h b/3rd/gnu-efi/inc/efierr.h deleted file mode 100644 index 5a66e1a06..000000000 --- a/3rd/gnu-efi/inc/efierr.h +++ /dev/null @@ -1,68 +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_UNKNOWN_GLYPH EFIWARN(1) -#define EFI_WARN_DELETE_FAILURE EFIWARN(2) -#define EFI_WARN_WRITE_FAILURE EFIWARN(3) -#define EFI_WARN_BUFFER_TOO_SMALL EFIWARN(4) - -#endif - diff --git a/3rd/gnu-efi/inc/efifs.h b/3rd/gnu-efi/inc/efifs.h deleted file mode 100644 index fc595d102..000000000 --- a/3rd/gnu-efi/inc/efifs.h +++ /dev/null @@ -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 - diff --git a/3rd/gnu-efi/inc/efigpt.h b/3rd/gnu-efi/inc/efigpt.h deleted file mode 100644 index d1694ae7b..000000000 --- a/3rd/gnu-efi/inc/efigpt.h +++ /dev/null @@ -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 - diff --git a/3rd/gnu-efi/inc/efiip.h b/3rd/gnu-efi/inc/efiip.h deleted file mode 100644 index 839507964..000000000 --- a/3rd/gnu-efi/inc/efiip.h +++ /dev/null @@ -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 */ diff --git a/3rd/gnu-efi/inc/efilib.h b/3rd/gnu-efi/inc/efilib.h deleted file mode 100644 index e73177c01..000000000 --- a/3rd/gnu-efi/inc/efilib.h +++ /dev/null @@ -1,1081 +0,0 @@ -#ifndef _EFILIB_INCLUDE_ -#define _EFILIB_INCLUDE_ - -/*++ - -Copyright (c) 2000 Intel Corporation - -Module Name: - - efilib.h - -Abstract: - - EFI library functions - - - -Revision History - ---*/ - -#include "efidebug.h" -#include "efipart.h" -#if defined(_M_X64) || defined(__x86_64__) || defined(__amd64__) -#include "x86_64/efilibplat.h" -#elif defined(_M_IX86) || defined(__i386__) -#include "ia32/efilibplat.h" -#elif defined(_M_IA64) || defined(__ia64__) -#include "ia64/efilibplat.h" -#elif defined (_M_ARM64) || defined(__aarch64__) -#include "aarch64/efilibplat.h" -#elif defined (_M_ARM) || defined(__arm__) -#include "arm/efilibplat.h" -#elif defined (_M_MIPS64) || defined(__mips64__) || defined(__mips64) -#include "mips64el/efilibplat.h" -#elif defined (__riscv) && __riscv_xlen == 64 -#include "riscv64/efilibplat.h" -#elif defined (__loongarch64) -#include "loongarch64/efilibplat.h" -#endif -#include "efilink.h" -#include "efirtlib.h" -#include "efistdarg.h" -#include "pci22.h" -#include "libsmbios.h" - -// -// Public read-only data in the EFI library -// - -extern EFI_SYSTEM_TABLE *ST; -#define gST ST -extern EFI_BOOT_SERVICES *BS; -#define gBS BS -extern EFI_RUNTIME_SERVICES *RT; -#define gRT RT - -extern EFI_GUID gEfiDevicePathProtocolGuid; -#define DevicePathProtocol gEfiDevicePathProtocolGuid -extern EFI_GUID gEfiDevicePathToTextProtocolGuid; -#define DevicePathToTextProtocol gEfiDevicePathToTextProtocolGuid -extern EFI_GUID gEfiDevicePathFromTextProtocolGuid; -#define DevicePathFromTextProtocol gEfiDevicePathFromTextProtocolGuid -extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid; -#define DevicePathUtilitiesProtocol gEfiDevicePathUtilitiesProtocolGuid -extern EFI_GUID gEfiLoadedImageProtocolGuid; -#define LoadedImageProtocol gEfiLoadedImageProtocolGuid -extern EFI_GUID gEfiSimpleTextInProtocolGuid; -#define TextInProtocol gEfiSimpleTextInProtocolGuid -extern EFI_GUID gEfiSimpleTextOutProtocolGuid; -#define TextOutProtocol gEfiSimpleTextOutProtocolGuid -extern EFI_GUID gEfiGraphicsOutputProtocolGuid; -#define GraphicsOutputProtocol gEfiGraphicsOutputProtocolGuid -extern EFI_GUID gEfiEdidDiscoveredProtocolGuid; -#define EdidDiscoveredProtocol gEfiEdidDiscoveredProtocolGuid -extern EFI_GUID gEfiEdidActiveProtocolGuid; -#define EdidActiveProtocol gEfiEdidActiveProtocolGuid -extern EFI_GUID gEfiEdidOverrideProtocolGuid; -#define EdidOverrideProtocol gEfiEdidOverrideProtocolGuid -extern EFI_GUID gEfiBlockIoProtocolGuid; -#define BlockIoProtocol gEfiBlockIoProtocolGuid -extern EFI_GUID gEfiBlockIo2ProtocolGuid; -#define BlockIo2Protocol gEfiBlockIo2ProtocolGuid -extern EFI_GUID gEfiDiskIoProtocolGuid; -#define DiskIoProtocol gEfiDiskIoProtocolGuid -extern EFI_GUID gEfiDiskIo2ProtocolGuid; -#define DiskIo2Protocol gEfiDiskIo2ProtocolGuid -extern EFI_GUID gEfiSimpleFileSystemProtocolGuid; -#define FileSystemProtocol gEfiSimpleFileSystemProtocolGuid -extern EFI_GUID gEfiLoadFileProtocolGuid; -#define LoadFileProtocol gEfiLoadFileProtocolGuid -extern EFI_GUID gEfiDeviceIoProtocolGuid; -#define DeviceIoProtocol gEfiDeviceIoProtocolGuid -extern EFI_GUID VariableStoreProtocol; -extern EFI_GUID LegacyBootProtocol; -extern EFI_GUID gEfiUnicodeCollationProtocolGuid; -#define UnicodeCollationProtocol gEfiUnicodeCollationProtocolGuid -extern EFI_GUID gEfiSerialIoProtocolGuid; -#define SerialIoProtocol gEfiSerialIoProtocolGuid -extern EFI_GUID VgaClassProtocol; -extern EFI_GUID TextOutSpliterProtocol; -extern EFI_GUID ErrorOutSpliterProtocol; -extern EFI_GUID TextInSpliterProtocol; -extern EFI_GUID gEfiSimpleNetworkProtocolGuid; -#define SimpleNetworkProtocol gEfiSimpleNetworkProtocolGuid -extern EFI_GUID gEfiPxeBaseCodeProtocolGuid; -#define PxeBaseCodeProtocol gEfiPxeBaseCodeProtocolGuid -extern EFI_GUID gEfiPxeBaseCodeCallbackProtocolGuid; -#define PxeCallbackProtocol gEfiPxeBaseCodeCallbackProtocolGuid -extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid; -#define NetworkInterfaceIdentifierProtocol gEfiNetworkInterfaceIdentifierProtocolGuid -extern EFI_GUID gEFiUiInterfaceProtocolGuid; -#define UiProtocol gEFiUiInterfaceProtocolGuid -extern EFI_GUID InternalShellProtocol; -extern EFI_GUID gEfiPciIoProtocolGuid; -#define PciIoProtocol gEfiPciIoProtocolGuid -extern EFI_GUID gEfiPciRootBridgeIoProtocolGuid; -extern EFI_GUID gEfiDriverBindingProtocolGuid; -#define DriverBindingProtocol gEfiDriverBindingProtocolGuid -extern EFI_GUID gEfiComponentNameProtocolGuid; -#define ComponentNameProtocol gEfiComponentNameProtocolGuid -extern EFI_GUID gEfiComponentName2ProtocolGuid; -#define ComponentName2Protocol gEfiComponentName2ProtocolGuid -extern EFI_GUID gEfiHashProtocolGuid; -#define HashProtocol gEfiHashProtocolGuid -extern EFI_GUID gEfiPlatformDriverOverrideProtocolGuid; -#define PlatformDriverOverrideProtocol gEfiPlatformDriverOverrideProtocolGuid -extern EFI_GUID gEfiBusSpecificDriverOverrideProtocolGuid; -#define BusSpecificDriverOverrideProtocol gEfiBusSpecificDriverOverrideProtocolGuid -extern EFI_GUID gEfiDriverFamilyOverrideProtocolGuid; -#define DriverFamilyOverrideProtocol gEfiDriverFamilyOverrideProtocolGuid -extern EFI_GUID gEfiEbcProtocolGuid; - -extern EFI_GUID gEfiGlobalVariableGuid; -#define EfiGlobalVariable gEfiGlobalVariableGuid -extern EFI_GUID gEfiFileInfoGuid; -#define GenericFileInfo gEfiFileInfoGuid -extern EFI_GUID gEfiFileSystemInfoGuid; -#define FileSystemInfo gEfiFileSystemInfoGuid -extern EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid; -#define FileSystemVolumeLabelInfo gEfiFileSystemVolumeLabelInfoIdGuid -extern EFI_GUID gEfiPcAnsiGuid; -#define PcAnsiProtocol gEfiPcAnsiGuid -extern EFI_GUID gEfiVT100Guid; -#define Vt100Protocol gEfiVT100Guid -extern EFI_GUID gEfiVT100PlusGuid; -extern EFI_GUID gEfiVTUTF8Guid; - -extern EFI_GUID NullGuid; -extern EFI_GUID UnknownDevice; - -extern EFI_GUID EfiPartTypeSystemPartitionGuid; -extern EFI_GUID EfiPartTypeLegacyMbrGuid; - -extern EFI_GUID MpsTableGuid; -extern EFI_GUID AcpiTableGuid; -extern EFI_GUID SMBIOSTableGuid; -extern EFI_GUID SMBIOS3TableGuid; -extern EFI_GUID SalSystemTableGuid; -extern EFI_GUID EfiDtbTableGuid; - -extern EFI_GUID SimplePointerProtocol; -extern EFI_GUID AbsolutePointerProtocol; - -extern EFI_GUID gEfiDebugImageInfoTableGuid; -extern EFI_GUID gEfiDebugSupportProtocolGuid; - -extern EFI_GUID SimpleTextInputExProtocol; - -extern EFI_GUID ShellProtocolGuid; -extern EFI_GUID ShellParametersProtocolGuid; -extern EFI_GUID ShellDynamicCommandProtocolGuid; - -// -// EFI Variable strings -// -#define LOAD_OPTION_ACTIVE 0x00000001 - -#define VarLanguageCodes L"LangCodes" -#define VarLanguage L"Lang" -#define VarTimeout L"Timeout" -#define VarConsoleInp L"ConIn" -#define VarConsoleOut L"ConOut" -#define VarErrorOut L"ErrOut" -#define VarBootOption L"Boot%04x" -#define VarBootOrder L"BootOrder" -#define VarBootNext L"BootNext" -#define VarBootCurrent L"BootCurrent" -#define VarDriverOption L"Driver%04x" -#define VarDriverOrder L"DriverOrder" -#define VarConsoleInpDev L"ConInDev" -#define VarConsoleOutDev L"ConOutDev" -#define VarErrorOutDev L"ErrOutDev" - -#define LanguageCodeEnglish "eng" - -extern EFI_DEVICE_PATH RootDevicePath[]; -extern EFI_DEVICE_PATH EndDevicePath[]; -extern EFI_DEVICE_PATH EndInstanceDevicePath[]; - -// -// Other public data in the EFI library -// - -extern EFI_MEMORY_TYPE PoolAllocationType; - -// -// STATIC - Name is internal to the module -// INTERNAL - Name is internal to the component (i.e., directory) -// BOOTSERVCE - Name of a boot service function -// - -#define STATIC -#define INTERNAL -#define BOOTSERVICE - -// -// Prototypes -// - -VOID -InitializeLib ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -VOID -InitializeUnicodeSupport ( - CHAR8 *LangCode - ); - -VOID -EFIDebugVariable ( - VOID - ); - -VOID -Exit( - IN EFI_STATUS ExitStatus, - IN UINTN ExitDataSize, - IN CHAR16 *ExitData OPTIONAL - ); - -INTN -GetShellArgcArgv( - EFI_HANDLE ImageHandle, - CHAR16 **Argv[] /* Statically allocated */ - ); - -VOID -SetCrc ( - IN OUT EFI_TABLE_HEADER *Hdr - ); - -VOID -SetCrcAltSize ( - IN UINTN Size, - IN OUT EFI_TABLE_HEADER *Hdr - ); - -BOOLEAN -CheckCrc ( - IN UINTN MaxSize, - IN OUT EFI_TABLE_HEADER *Hdr - ); - -BOOLEAN -CheckCrcAltSize ( - IN UINTN MaxSize, - IN UINTN Size, - IN OUT EFI_TABLE_HEADER *Hdr - ); - -UINT32 -CalculateCrc ( - UINT8 *pt, - UINTN Size - ); - -VOID -ZeroMem ( - IN VOID *Buffer, - IN UINTN Size - ); - -VOID -SetMem ( - IN VOID *Buffer, - IN UINTN Size, - IN UINT8 Value - ); - -VOID -CopyMem ( - IN VOID *Dest, - IN CONST VOID *Src, - IN UINTN len - ); - -INTN -CompareMem ( - IN CONST VOID *Dest, - IN CONST VOID *Src, - IN UINTN len - ); - -INTN -StrCmp ( - IN CONST CHAR16 *s1, - IN CONST CHAR16 *s2 - ); - -INTN -StrnCmp ( - IN CONST CHAR16 *s1, - IN CONST CHAR16 *s2, - IN UINTN len - ); - -INTN -StriCmp ( - IN CONST CHAR16 *s1, - IN CONST CHAR16 *s2 - ); - -VOID -StrLwr ( - IN CHAR16 *Str - ); - -VOID -StrUpr ( - IN CHAR16 *Str - ); - -VOID -StrCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ); - -VOID -StrnCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ); - -CHAR16 * -StpCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ); - -CHAR16 * -StpnCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ); - -VOID -StrCat ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ); - -VOID -StrnCat ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ); - -UINTN -StrLen ( - IN CONST CHAR16 *s1 - ); - -UINTN -StrnLen ( - IN CONST CHAR16 *s1, - IN UINTN Len - ); - -UINTN -StrSize ( - IN CONST CHAR16 *s1 - ); - -CHAR16 * -StrDuplicate ( - IN CONST CHAR16 *Src - ); - -UINTN -strlena ( - IN CONST CHAR8 *s1 - ); - -UINTN -strcmpa ( - IN CONST CHAR8 *s1, - IN CONST CHAR8 *s2 - ); - -UINTN -strncmpa ( - IN CONST CHAR8 *s1, - IN CONST CHAR8 *s2, - IN UINTN len - ); - -UINTN -xtoi ( - CONST CHAR16 *str - ); - -UINTN -Atoi ( - CONST CHAR16 *str - ); - -BOOLEAN -MetaMatch ( - IN CHAR16 *String, - IN CHAR16 *Pattern - ); - -BOOLEAN -MetaiMatch ( - IN CHAR16 *String, - IN CHAR16 *Pattern - ); - -UINT64 -LShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ); - -UINT64 -RShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ); - -UINT64 -MultU64x32 ( - IN UINT64 Multiplicand, - IN UINTN Multiplier - ); - -UINT64 -DivU64x32 ( - IN UINT64 Dividend, - IN UINTN Divisor, - OUT UINTN *Remainder OPTIONAL - ); - -VOID -InitializeLock ( - IN OUT FLOCK *Lock, - IN EFI_TPL Priority - ); - -VOID -AcquireLock ( - IN FLOCK *Lock - ); - -VOID -ReleaseLock ( - IN FLOCK *Lock - ); - - -INTN -CompareGuid( - IN EFI_GUID *Guid1, - IN EFI_GUID *Guid2 - ); - -VOID * -AllocatePool ( - IN UINTN Size - ); - -VOID * -AllocateZeroPool ( - IN UINTN Size - ); - -VOID * -ReallocatePool ( - IN VOID *OldPool, - IN UINTN OldSize, - IN UINTN NewSize - ); - -VOID -FreePool ( - IN VOID *p - ); - - -VOID -Output ( - IN CHAR16 *Str - ); - -VOID -Input ( - IN CHAR16 *Prompt OPTIONAL, - OUT CHAR16 *InStr, - IN UINTN StrLen - ); - -VOID -IInput ( - IN SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut, - IN SIMPLE_INPUT_INTERFACE *ConIn, - IN CHAR16 *Prompt OPTIONAL, - OUT CHAR16 *InStr, - IN UINTN StrLen - ); - -UINTN -Print ( - IN CONST CHAR16 *fmt, - ... - ); - -UINTN -VPrint ( - IN CONST CHAR16 *fmt, - va_list args - ); - -UINTN -UnicodeSPrint ( - OUT CHAR16 *Str, - IN UINTN StrSize, - IN CONST CHAR16 *fmt, - ... - ); - -UINTN -UnicodeVSPrint ( - OUT CHAR16 *Str, - IN UINTN StrSize, - IN CONST CHAR16 *fmt, - va_list args - ); - -CHAR16 * -VPoolPrint ( - IN CONST CHAR16 *fmt, - va_list args - ); - -CHAR16 * -PoolPrint ( - IN CONST CHAR16 *fmt, - ... - ); - -typedef struct { - CHAR16 *str; - UINTN len; - UINTN maxlen; -} POOL_PRINT; - -CHAR16 * -CatPrint ( - IN OUT POOL_PRINT *Str, - IN CONST CHAR16 *fmt, - ... - ); - -UINTN -PrintAt ( - IN UINTN Column, - IN UINTN Row, - IN CONST CHAR16 *fmt, - ... - ); - -UINTN -IPrint ( - IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out, - IN CONST CHAR16 *fmt, - ... - ); - -UINTN -IPrintAt ( - IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out, - IN UINTN Column, - IN UINTN Row, - IN CONST CHAR16 *fmt, - ... - ); - -UINTN -AsciiPrint ( - IN CONST CHAR8 *fmt, - ... - ); - -UINTN -AsciiVSPrint( - OUT CHAR8 *Str, - IN UINTN StrSize, - IN CONST CHAR8 *fmt, - va_list args -); - -// -// For compatibility with previous gnu-efi versions -// -#define SPrint UnicodeSPrint -#define VSPrint UnicodeVSPrint -#define APrint AsciiPrint - -VOID -ValueToHex ( - IN CHAR16 *Buffer, - IN UINT64 v - ); - -VOID -ValueToString ( - IN CHAR16 *Buffer, - IN BOOLEAN Comma, - IN INT64 v - ); - -VOID -FloatToString ( - IN CHAR16 *Buffer, - IN BOOLEAN Comma, - IN double v - ); - -VOID -TimeToString ( - OUT CHAR16 *Buffer, - IN EFI_TIME *Time - ); - -VOID -GuidToString ( - OUT CHAR16 *Buffer, - IN EFI_GUID *Guid - ); - -VOID -StatusToString ( - OUT CHAR16 *Buffer, - EFI_STATUS Status - ); - -VOID -DumpHex ( - IN UINTN Indent, - IN UINTN Offset, - IN UINTN DataSize, - IN VOID *UserData - ); - -BOOLEAN -GrowBuffer( - IN OUT EFI_STATUS *Status, - IN OUT VOID **Buffer, - IN UINTN BufferSize - ); - -EFI_MEMORY_DESCRIPTOR * -LibMemoryMap ( - OUT UINTN *NoEntries, - OUT UINTN *MapKey, - OUT UINTN *DescriptorSize, - OUT UINT32 *DescriptorVersion - ); - -VOID * -LibGetVariable ( - IN CHAR16 *Name, - IN EFI_GUID *VendorGuid - ); - -VOID * -LibGetVariableAndSize ( - IN CHAR16 *Name, - IN EFI_GUID *VendorGuid, - OUT UINTN *VarSize - ); - -EFI_STATUS -LibDeleteVariable ( - IN CHAR16 *VarName, - IN EFI_GUID *VarGuid - ); - -EFI_STATUS -LibSetNVVariable ( - IN CHAR16 *VarName, - IN EFI_GUID *VarGuid, - IN UINTN DataSize, - IN VOID *Data - ); - -EFI_STATUS -LibSetVariable ( - IN CHAR16 *VarName, - IN EFI_GUID *VarGuid, - IN UINTN DataSize, - IN VOID *Data - ); -EFI_STATUS -LibInsertToTailOfBootOrder ( - IN UINT16 BootOption, - IN BOOLEAN OnlyInsertIfEmpty - ); - -EFI_STATUS -LibLocateProtocol ( - IN EFI_GUID *ProtocolGuid, - OUT VOID **Interface - ); - -EFI_STATUS -LibLocateHandle ( - IN EFI_LOCATE_SEARCH_TYPE SearchType, - IN EFI_GUID *Protocol OPTIONAL, - IN VOID *SearchKey OPTIONAL, - IN OUT UINTN *NoHandles, - OUT EFI_HANDLE **Buffer - ); - -EFI_STATUS -LibLocateHandleByDiskSignature ( - IN UINT8 MBRType, - IN UINT8 SignatureType, - IN VOID *Signature, - IN OUT UINTN *NoHandles, - OUT EFI_HANDLE **Buffer - ); - -EFI_STATUS -LibInstallProtocolInterfaces ( - IN OUT EFI_HANDLE *Handle, - ... - ); - -VOID -LibUninstallProtocolInterfaces ( - IN EFI_HANDLE Handle, - ... - ); - -EFI_STATUS -LibReinstallProtocolInterfaces ( - IN OUT EFI_HANDLE *Handle, - ... - ); - -EFI_EVENT -LibCreateProtocolNotifyEvent ( - IN EFI_GUID *ProtocolGuid, - IN EFI_TPL NotifyTpl, - IN EFI_EVENT_NOTIFY NotifyFunction, - IN VOID *NotifyContext, - OUT VOID *Registration - ); - -EFI_STATUS -WaitForSingleEvent ( - IN EFI_EVENT Event, - IN UINT64 Timeout OPTIONAL - ); - -VOID -WaitForEventWithTimeout ( - IN EFI_EVENT Event, - IN UINTN Timeout, - IN UINTN Row, - IN UINTN Column, - IN CHAR16 *String, - IN EFI_INPUT_KEY TimeoutKey, - OUT EFI_INPUT_KEY *Key - ); - -EFI_FILE_HANDLE -LibOpenRoot ( - IN EFI_HANDLE DeviceHandle - ); - -EFI_FILE_INFO * -LibFileInfo ( - IN EFI_FILE_HANDLE FHand - ); - -EFI_FILE_SYSTEM_INFO * -LibFileSystemInfo ( - IN EFI_FILE_HANDLE FHand - ); - -EFI_FILE_SYSTEM_VOLUME_LABEL_INFO * -LibFileSystemVolumeLabelInfo ( - IN EFI_FILE_HANDLE FHand - ); - -BOOLEAN -ValidMBR( - IN MASTER_BOOT_RECORD *Mbr, - IN EFI_BLOCK_IO *BlkIo - ); - -BOOLEAN -LibMatchDevicePaths ( - IN EFI_DEVICE_PATH *Multi, - IN EFI_DEVICE_PATH *Single - ); - -EFI_DEVICE_PATH * -LibDuplicateDevicePathInstance ( - IN EFI_DEVICE_PATH *DevPath - ); - -EFI_DEVICE_PATH * -DevicePathFromHandle ( - IN EFI_HANDLE Handle - ); - -EFI_DEVICE_PATH * -DevicePathInstance ( - IN OUT EFI_DEVICE_PATH **DevicePath, - OUT UINTN *Size - ); - -UINTN -DevicePathInstanceCount ( - IN EFI_DEVICE_PATH *DevicePath - ); - -EFI_DEVICE_PATH * -AppendDevicePath ( - IN EFI_DEVICE_PATH *Src1, - IN EFI_DEVICE_PATH *Src2 - ); - -EFI_DEVICE_PATH * -AppendDevicePathNode ( - IN EFI_DEVICE_PATH *Src1, - IN EFI_DEVICE_PATH *Src2 - ); - -EFI_DEVICE_PATH* -AppendDevicePathInstance ( - IN EFI_DEVICE_PATH *Src, - IN EFI_DEVICE_PATH *Instance - ); - -EFI_DEVICE_PATH * -FileDevicePath ( - IN EFI_HANDLE Device OPTIONAL, - IN CHAR16 *FileName - ); - -UINTN -DevicePathSize ( - IN EFI_DEVICE_PATH *DevPath - ); - -EFI_DEVICE_PATH * -DuplicateDevicePath ( - IN EFI_DEVICE_PATH *DevPath - ); - -EFI_DEVICE_PATH * -UnpackDevicePath ( - IN EFI_DEVICE_PATH *DevPath - ); - -EFI_STATUS -LibDevicePathToInterface ( - IN EFI_GUID *Protocol, - IN EFI_DEVICE_PATH *FilePath, - OUT VOID **Interface - ); - -CHAR16 * -DevicePathToStr ( - EFI_DEVICE_PATH *DevPath - ); - -// -// BugBug: I need my own include files -// -typedef struct { - UINT8 Register; - UINT8 Function; - UINT8 Device; - UINT8 Bus; - UINT32 Reserved; -} EFI_ADDRESS; - -typedef union { - UINT64 Address; - EFI_ADDRESS EfiAddress; -} EFI_PCI_ADDRESS_UNION; - - -EFI_STATUS -PciFindDeviceClass ( - IN OUT EFI_PCI_ADDRESS_UNION *Address, - IN UINT8 BaseClass, - IN UINT8 SubClass - ); - -EFI_STATUS -PciFindDevice ( - IN OUT EFI_PCI_ADDRESS_UNION *DeviceAddress, - IN UINT16 VendorId, - IN UINT16 DeviceId, - IN OUT PCI_TYPE00 *Pci - ); - -// -// SIMPLE_READ_FILE object used to access files -// - -typedef VOID *SIMPLE_READ_FILE; - -EFI_STATUS -OpenSimpleReadFile ( - IN BOOLEAN BootPolicy, - IN VOID *SourceBuffer OPTIONAL, - IN UINTN SourceSize, - IN OUT EFI_DEVICE_PATH **FilePath, - OUT EFI_HANDLE *DeviceHandle, - OUT SIMPLE_READ_FILE *SimpleReadHandle - ); - -EFI_STATUS -ReadSimpleReadFile ( - IN SIMPLE_READ_FILE SimpleReadHandle, - IN UINTN Offset, - IN OUT UINTN *ReadSize, - OUT VOID *Buffer - ); - - -VOID -CloseSimpleReadFile ( - IN SIMPLE_READ_FILE SimpleReadHandle - ); - -VOID -InitializeGuid ( - VOID - ); - -UINT8 -DecimaltoBCD( - IN UINT8 DecValue - ); - -UINT8 -BCDtoDecimal( - IN UINT8 BcdValue - ); - -EFI_STATUS -LibGetSystemConfigurationTable( - IN EFI_GUID *TableGuid, - IN OUT VOID **Table - ); - -BOOLEAN -LibIsValidTextGraphics ( - IN CHAR16 Graphic, - OUT CHAR8 *PcAnsi, OPTIONAL - OUT CHAR8 *Ascii OPTIONAL - ); - -BOOLEAN -IsValidAscii ( - IN CHAR16 Ascii - ); - -BOOLEAN -IsValidEfiCntlChar ( - IN CHAR16 c - ); - -CHAR16 * -LibGetUiString ( - IN EFI_HANDLE Handle, - IN UI_STRING_TYPE StringType, - IN ISO_639_2 *LangCode, - IN BOOLEAN ReturnDevicePathStrOnMismatch - ); - -CHAR8* -LibGetSmbiosString ( - IN SMBIOS_STRUCTURE_POINTER *Smbios, - IN UINT16 StringNumber - ); - -EFI_STATUS -LibGetSmbiosSystemGuidAndSerialNumber ( - IN EFI_GUID *SystemGuid, - OUT CHAR8 **SystemSerialNumber - ); - - -EFI_STATUS -InitializeGlobalIoDevice ( - IN EFI_DEVICE_PATH *DevicePath, - IN EFI_GUID *Protocol, - IN CHAR8 *ErrorStr, - OUT EFI_DEVICE_IO_INTERFACE **GlobalIoFncs - ); - -UINT32 -ReadPort ( - IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, - IN EFI_IO_WIDTH Width, - IN UINTN Port - ); - -UINT32 -WritePort ( - IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, - IN EFI_IO_WIDTH Width, - IN UINTN Port, - IN UINTN Data - ); - -UINT32 -ReadPciConfig ( - IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, - IN EFI_IO_WIDTH Width, - IN UINTN Port - ); - -UINT32 -WritePciConfig ( - IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, - IN EFI_IO_WIDTH Width, - IN UINTN Port, - IN UINTN Data - ); - -VOID -Pause ( - VOID -); - -extern EFI_DEVICE_IO_INTERFACE *GlobalIoFncs; - -#define outp(_Port, _DataByte) (UINT8)WritePort(GlobalIoFncs, IO_UINT8, (UINTN)_Port, (UINTN)_DataByte) -#define inp(_Port) (UINT8)ReadPort(GlobalIoFncs, IO_UINT8, (UINTN)_Port) -#define outpw(_Port, _DataByte) (UINT16)WritePort(GlobalIoFncs, IO_UINT16, (UINTN)_Port, (UINTN)_DataByte) -#define inpw(_Port) (UINT16)ReadPort(GlobalIoFncs, IO_UINT16, (UINTN)_Port) -#define outpd(_Port, _DataByte) (UINT32)WritePort(GlobalIoFncs, IO_UINT32, (UINTN)_Port, (UINTN)_DataByte) -#define inpd(_Port) (UINT32)ReadPort(GlobalIoFncs, IO_UINT32, (UINTN)_Port) - -#define writepci8(_Addr, _DataByte) (UINT8)WritePciConfig(GlobalIoFncs, IO_UINT8, (UINTN)_Addr, (UINTN)_DataByte) -#define readpci8(_Addr) (UINT8)ReadPciConfig(GlobalIoFncs, IO_UINT8, (UINTN)_Addr) -#define writepci16(_Addr, _DataByte) (UINT16)WritePciConfig(GlobalIoFncs, IO_UINT16, (UINTN)_Addr, (UINTN)_DataByte) -#define readpci16(_Addr) (UINT16)ReadPciConfig(GlobalIoFncs, IO_UINT16, (UINTN)_Addr) -#define writepci32(_Addr, _DataByte) (UINT32)WritePciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr, (UINTN)_DataByte) -#define readpci32(_Addr) (UINT32)ReadPciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr) - -#define Port80(_PostCode) GlobalIoFncs->Io.Write (GlobalIoFncs, IO_UINT16, (UINT64)0x80, 1, &(_PostCode)) - -#endif diff --git a/3rd/gnu-efi/inc/efilink.h b/3rd/gnu-efi/inc/efilink.h deleted file mode 100644 index 31f2ac68a..000000000 --- a/3rd/gnu-efi/inc/efilink.h +++ /dev/null @@ -1,182 +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, EFI_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))) - -// -// EDK2 uses BASE_CR for the above -// -#define BASE_CR _CR - -#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 - diff --git a/3rd/gnu-efi/inc/efinet.h b/3rd/gnu-efi/inc/efinet.h deleted file mode 100644 index 6215816a2..000000000 --- a/3rd/gnu-efi/inc/efinet.h +++ /dev/null @@ -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 */ diff --git a/3rd/gnu-efi/inc/efipart.h b/3rd/gnu-efi/inc/efipart.h deleted file mode 100644 index d4c557319..000000000 --- a/3rd/gnu-efi/inc/efipart.h +++ /dev/null @@ -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 diff --git a/3rd/gnu-efi/inc/efipciio.h b/3rd/gnu-efi/inc/efipciio.h deleted file mode 100644 index e88538775..000000000 --- a/3rd/gnu-efi/inc/efipciio.h +++ /dev/null @@ -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 */ diff --git a/3rd/gnu-efi/inc/efipoint.h b/3rd/gnu-efi/inc/efipoint.h deleted file mode 100644 index 4dbcf18bf..000000000 --- a/3rd/gnu-efi/inc/efipoint.h +++ /dev/null @@ -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 diff --git a/3rd/gnu-efi/inc/efiprot.h b/3rd/gnu-efi/inc/efiprot.h deleted file mode 100644 index 3e4d60b93..000000000 --- a/3rd/gnu-efi/inc/efiprot.h +++ /dev/null @@ -1,1431 +0,0 @@ -#ifndef _EFI_PROT_H -#define _EFI_PROT_H - -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - efiprot.h - -Abstract: - - EFI Protocols - - - -Revision History - ---*/ - -// -// FPSWA library protocol -// -#define EFI_FPSWA_PROTOCOL_GUID \ - { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -#define FPSWA_PROTOCOL EFI_FPSWA_PROTOCOL_GUID - -// -// Device Path protocol -// - -#define EFI_DEVICE_PATH_PROTOCOL_GUID \ - { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -#define DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH_PROTOCOL_GUID - - -// -// Block IO protocol -// - -#define EFI_BLOCK_IO_PROTOCOL_GUID \ - { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -#define BLOCK_IO_PROTOCOL EFI_BLOCK_IO_PROTOCOL_GUID - -#define EFI_BLOCK_IO_PROTOCOL_REVISION 0x00010000 -#define EFI_BLOCK_IO_PROTOCOL_REVISION2 0x00020001 -#define EFI_BLOCK_IO_PROTOCOL_REVISION3 ((2<<16) | 31) -#define EFI_BLOCK_IO_INTERFACE_REVISION EFI_BLOCK_IO_PROTOCOL_REVISION -#define EFI_BLOCK_IO_INTERFACE_REVISION2 EFI_BLOCK_IO_PROTOCOL_REVISION2 -#define EFI_BLOCK_IO_INTERFACE_REVISION3 EFI_BLOCK_IO_PROTOCOL_REVISION3 - -INTERFACE_DECL(_EFI_BLOCK_IO_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_RESET) ( - IN struct _EFI_BLOCK_IO_PROTOCOL *This, - IN BOOLEAN ExtendedVerification - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_READ) ( - IN struct _EFI_BLOCK_IO_PROTOCOL *This, - IN UINT32 MediaId, - IN EFI_LBA LBA, - IN UINTN BufferSize, - OUT VOID *Buffer - ); - - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_WRITE) ( - IN struct _EFI_BLOCK_IO_PROTOCOL *This, - IN UINT32 MediaId, - IN EFI_LBA LBA, - IN UINTN BufferSize, - IN VOID *Buffer - ); - - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_FLUSH) ( - IN struct _EFI_BLOCK_IO_PROTOCOL *This - ); - - - -typedef struct { - UINT32 MediaId; - BOOLEAN RemovableMedia; - BOOLEAN MediaPresent; - - BOOLEAN LogicalPartition; - BOOLEAN ReadOnly; - BOOLEAN WriteCaching; - - UINT32 BlockSize; - UINT32 IoAlign; - - EFI_LBA LastBlock; - - /* revision 2 */ - EFI_LBA LowestAlignedLba; - UINT32 LogicalBlocksPerPhysicalBlock; - /* revision 3 */ - UINT32 OptimalTransferLengthGranularity; -} EFI_BLOCK_IO_MEDIA; - -typedef struct _EFI_BLOCK_IO_PROTOCOL { - UINT64 Revision; - - EFI_BLOCK_IO_MEDIA *Media; - - EFI_BLOCK_RESET Reset; - EFI_BLOCK_READ ReadBlocks; - EFI_BLOCK_WRITE WriteBlocks; - EFI_BLOCK_FLUSH FlushBlocks; - -} EFI_BLOCK_IO_PROTOCOL; - -typedef struct _EFI_BLOCK_IO_PROTOCOL _EFI_BLOCK_IO; -typedef EFI_BLOCK_IO_PROTOCOL EFI_BLOCK_IO; - -#define EFI_BLOCK_IO2_PROTOCOL_GUID \ - { 0xa77b2472, 0xe282, 0x4e9f, {0xa2, 0x45, 0xc2, 0xc0, 0xe2, 0x7b, 0xbc, 0xc1} } - -INTERFACE_DECL(_EFI_BLOCK_IO2_PROTOCOL); - -typedef struct { - EFI_EVENT Event; - EFI_STATUS TransactionStatus; -} EFI_BLOCK_IO2_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_RESET_EX) ( - IN struct _EFI_BLOCK_IO2_PROTOCOL *This, - IN BOOLEAN ExtendedVerification - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_READ_EX) ( - IN struct _EFI_BLOCK_IO2_PROTOCOL *This, - IN UINT32 MediaId, - IN EFI_LBA LBA, - IN OUT EFI_BLOCK_IO2_TOKEN *Token, - IN UINTN BufferSize, - OUT VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_WRITE_EX) ( - IN struct _EFI_BLOCK_IO2_PROTOCOL *This, - IN UINT32 MediaId, - IN EFI_LBA LBA, - IN OUT EFI_BLOCK_IO2_TOKEN *Token, - IN UINTN BufferSize, - IN VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_FLUSH_EX) ( - IN struct _EFI_BLOCK_IO2_PROTOCOL *This, - IN OUT EFI_BLOCK_IO2_TOKEN *Token - ); - -typedef struct _EFI_BLOCK_IO2_PROTOCOL { - EFI_BLOCK_IO_MEDIA *Media; - EFI_BLOCK_RESET_EX Reset; - EFI_BLOCK_READ_EX ReadBlocksEx; - EFI_BLOCK_WRITE_EX WriteBlocksEx; - EFI_BLOCK_FLUSH_EX FlushBlocksEx; -} EFI_BLOCK_IO2_PROTOCOL; - -// -// Disk Block IO protocol -// - -#define EFI_DISK_IO_PROTOCOL_GUID \ - { 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -#define DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL_GUID - -#define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000 -#define EFI_DISK_IO_INTERFACE_REVISION EFI_DISK_IO_PROTOCOL_REVISION - -INTERFACE_DECL(_EFI_DISK_IO_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_DISK_READ) ( - IN struct _EFI_DISK_IO_PROTOCOL *This, - IN UINT32 MediaId, - IN UINT64 Offset, - IN UINTN BufferSize, - OUT VOID *Buffer - ); - - -typedef -EFI_STATUS -(EFIAPI *EFI_DISK_WRITE) ( - IN struct _EFI_DISK_IO_PROTOCOL *This, - IN UINT32 MediaId, - IN UINT64 Offset, - IN UINTN BufferSize, - IN VOID *Buffer - ); - - -typedef struct _EFI_DISK_IO_PROTOCOL { - UINT64 Revision; - EFI_DISK_READ ReadDisk; - EFI_DISK_WRITE WriteDisk; -} EFI_DISK_IO_PROTOCOL; - -typedef struct _EFI_DISK_IO_PROTOCOL _EFI_DISK_IO; -typedef EFI_DISK_IO_PROTOCOL EFI_DISK_IO; - - -#define EFI_DISK_IO2_PROTOCOL_GUID \ - { 0x151c8eae, 0x7f2c, 0x472c, {0x9e, 0x54, 0x98, 0x28, 0x19, 0x4f, 0x6a, 0x88} } - -#define EFI_DISK_IO2_PROTOCOL_REVISION 0x00020000 - -INTERFACE_DECL(_EFI_DISK_IO2_PROTOCOL); - -typedef struct { - EFI_EVENT Event; - EFI_STATUS TransactionStatus; -} EFI_DISK_IO2_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_DISK_CANCEL_EX) ( - IN struct _EFI_DISK_IO2_PROTOCOL *This - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_DISK_READ_EX) ( - IN struct _EFI_DISK_IO2_PROTOCOL *This, - IN UINT32 MediaId, - IN UINT64 Offset, - IN OUT EFI_DISK_IO2_TOKEN *Token, - IN UINTN BufferSize, - OUT VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_DISK_WRITE_EX) ( - IN struct _EFI_DISK_IO2_PROTOCOL *This, - IN UINT32 MediaId, - IN UINT64 Offset, - IN OUT EFI_DISK_IO2_TOKEN *Token, - IN UINTN BufferSize, - IN VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_DISK_FLUSH_EX) ( - IN struct _EFI_DISK_IO2_PROTOCOL *This, - IN OUT EFI_DISK_IO2_TOKEN *Token - ); - -typedef struct _EFI_DISK_IO2_PROTOCOL { - UINT64 Revision; - EFI_DISK_CANCEL_EX Cancel; - EFI_DISK_READ_EX ReadDiskEx; - EFI_DISK_WRITE_EX WriteDiskEx; - EFI_DISK_FLUSH_EX FlushDiskEx; -} EFI_DISK_IO2_PROTOCOL; - -// -// Simple file system protocol -// - -#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \ - { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -#define SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID - -INTERFACE_DECL(_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL); -INTERFACE_DECL(_EFI_FILE_HANDLE); - -typedef -EFI_STATUS -(EFIAPI *EFI_VOLUME_OPEN) ( - IN struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This, - OUT struct _EFI_FILE_HANDLE **Root - ); - -#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000 -#define EFI_FILE_IO_INTERFACE_REVISION EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION - -typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL { - UINT64 Revision; - EFI_VOLUME_OPEN OpenVolume; -} EFI_SIMPLE_FILE_SYSTEM_PROTOCOL; - -typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL _EFI_FILE_IO_INTERFACE; -typedef EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_FILE_IO_INTERFACE; - -// -// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_OPEN) ( - IN struct _EFI_FILE_HANDLE *File, - OUT struct _EFI_FILE_HANDLE **NewHandle, - IN CHAR16 *FileName, - IN UINT64 OpenMode, - IN UINT64 Attributes - ); - -// Open modes -#define EFI_FILE_MODE_READ 0x0000000000000001 -#define EFI_FILE_MODE_WRITE 0x0000000000000002 -#define EFI_FILE_MODE_CREATE 0x8000000000000000 - -// File attributes -#define EFI_FILE_READ_ONLY 0x0000000000000001 -#define EFI_FILE_HIDDEN 0x0000000000000002 -#define EFI_FILE_SYSTEM 0x0000000000000004 -#define EFI_FILE_RESERVIED 0x0000000000000008 -#define EFI_FILE_DIRECTORY 0x0000000000000010 -#define EFI_FILE_ARCHIVE 0x0000000000000020 -#define EFI_FILE_VALID_ATTR 0x0000000000000037 - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_CLOSE) ( - IN struct _EFI_FILE_HANDLE *File - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_DELETE) ( - IN struct _EFI_FILE_HANDLE *File - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_READ) ( - IN struct _EFI_FILE_HANDLE *File, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_WRITE) ( - IN struct _EFI_FILE_HANDLE *File, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_SET_POSITION) ( - IN struct _EFI_FILE_HANDLE *File, - IN UINT64 Position - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_GET_POSITION) ( - IN struct _EFI_FILE_HANDLE *File, - OUT UINT64 *Position - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_GET_INFO) ( - IN struct _EFI_FILE_HANDLE *File, - IN EFI_GUID *InformationType, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_SET_INFO) ( - IN struct _EFI_FILE_HANDLE *File, - IN EFI_GUID *InformationType, - IN UINTN BufferSize, - IN VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_FLUSH) ( - IN struct _EFI_FILE_HANDLE *File - ); - -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; - UINTN BufferSize; - VOID *Buffer; -} EFI_FILE_IO_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_OPEN_EX)( - IN struct _EFI_FILE_HANDLE *File, - OUT struct _EFI_FILE_HANDLE **NewHandle, - IN CHAR16 *FileName, - IN UINT64 OpenMode, - IN UINT64 Attributes, - IN OUT EFI_FILE_IO_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_READ_EX) ( - IN struct _EFI_FILE_HANDLE *File, - IN OUT EFI_FILE_IO_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_WRITE_EX) ( - IN struct _EFI_FILE_HANDLE *File, - IN OUT EFI_FILE_IO_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_FLUSH_EX) ( - IN struct _EFI_FILE_HANDLE *File, - IN OUT EFI_FILE_IO_TOKEN *Token - ); - -#define EFI_FILE_PROTOCOL_REVISION 0x00010000 -#define EFI_FILE_PROTOCOL_REVISION2 0x00020000 -#define EFI_FILE_PROTOCOL_LATEST_REVISION EFI_FILE_PROTOCOL_REVISION2 -#define EFI_FILE_HANDLE_REVISION EFI_FILE_PROTOCOL_REVISION - -typedef struct _EFI_FILE_HANDLE { - UINT64 Revision; - EFI_FILE_OPEN Open; - EFI_FILE_CLOSE Close; - EFI_FILE_DELETE Delete; - EFI_FILE_READ Read; - EFI_FILE_WRITE Write; - EFI_FILE_GET_POSITION GetPosition; - EFI_FILE_SET_POSITION SetPosition; - EFI_FILE_GET_INFO GetInfo; - EFI_FILE_SET_INFO SetInfo; - EFI_FILE_FLUSH Flush; - EFI_FILE_OPEN_EX OpenEx; - EFI_FILE_READ_EX ReadEx; - EFI_FILE_WRITE_EX WriteEx; - EFI_FILE_FLUSH_EX FlushEx; -} EFI_FILE_PROTOCOL, *EFI_FILE_HANDLE; - -typedef EFI_FILE_PROTOCOL EFI_FILE; - - -// -// File information types -// - -#define EFI_FILE_INFO_ID \ - { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -typedef struct { - UINT64 Size; - UINT64 FileSize; - UINT64 PhysicalSize; - EFI_TIME CreateTime; - EFI_TIME LastAccessTime; - EFI_TIME ModificationTime; - UINT64 Attribute; - CHAR16 FileName[1]; -} EFI_FILE_INFO; - -// -// The FileName field of the EFI_FILE_INFO data structure is variable length. -// Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to -// be the size of the data structure without the FileName field. The following macro -// computes this size correctly no matter how big the FileName array is declared. -// This is required to make the EFI_FILE_INFO data structure ANSI compilant. -// - -#define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName) - -#define EFI_FILE_SYSTEM_INFO_ID \ - { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -typedef struct { - UINT64 Size; - BOOLEAN ReadOnly; - UINT64 VolumeSize; - UINT64 FreeSpace; - UINT32 BlockSize; - CHAR16 VolumeLabel[1]; -} EFI_FILE_SYSTEM_INFO; - -// -// The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length. -// Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs -// to be the size of the data structure without the VolumeLable field. The following macro -// computes this size correctly no matter how big the VolumeLable array is declared. -// This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant. -// - -#define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel) - -#define EFI_FILE_SYSTEM_VOLUME_LABEL_ID \ - { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} } - -typedef struct { - CHAR16 VolumeLabel[1]; -} EFI_FILE_SYSTEM_VOLUME_LABEL; - -#define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL,VolumeLabel) - -// -// For compatibility with older versions of gnu-efi -// -#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID EFI_FILE_SYSTEM_VOLUME_LABEL_ID -#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FILE_SYSTEM_VOLUME_LABEL - -// -// Load file protocol -// - - -#define EFI_LOAD_FILE_PROTOCOL_GUID \ - { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } -#define LOAD_FILE_PROTOCOL EFI_LOAD_FILE_PROTOCOL_GUID - -INTERFACE_DECL(_EFI_LOAD_FILE_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_LOAD_FILE) ( - IN struct _EFI_LOAD_FILE_PROTOCOL *This, - IN EFI_DEVICE_PATH *FilePath, - IN BOOLEAN BootPolicy, - IN OUT UINTN *BufferSize, - IN VOID *Buffer OPTIONAL - ); - -typedef struct _EFI_LOAD_FILE_PROTOCOL { - EFI_LOAD_FILE LoadFile; -} EFI_LOAD_FILE_PROTOCOL; - -typedef struct _EFI_LOAD_FILE_PROTOCOL _EFI_LOAD_FILE_INTERFACE; -typedef EFI_LOAD_FILE_PROTOCOL EFI_LOAD_FILE_INTERFACE; - -// -// Device IO protocol -// - -#define EFI_DEVICE_IO_PROTOCOL_GUID \ - { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -#define DEVICE_IO_PROTOCOL EFI_DEVICE_IO_PROTOCOL_GUID - -INTERFACE_DECL(_EFI_DEVICE_IO_PROTOCOL); - -typedef enum { - IO_UINT8, - IO_UINT16, - IO_UINT32, - IO_UINT64, -// -// Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO -// - MMIO_COPY_UINT8, - MMIO_COPY_UINT16, - MMIO_COPY_UINT32, - MMIO_COPY_UINT64 -} EFI_IO_WIDTH; - -#define EFI_PCI_ADDRESS(_bus,_dev,_func) \ - ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) ) - - -typedef -EFI_STATUS -(EFIAPI *EFI_DEVICE_IO) ( - IN struct _EFI_DEVICE_IO_PROTOCOL *This, - IN EFI_IO_WIDTH Width, - IN UINT64 Address, - IN UINTN Count, - IN OUT VOID *Buffer - ); - -typedef struct { - EFI_DEVICE_IO Read; - EFI_DEVICE_IO Write; -} EFI_IO_ACCESS; - -typedef -EFI_STATUS -(EFIAPI *EFI_PCI_DEVICE_PATH) ( - IN struct _EFI_DEVICE_IO_PROTOCOL *This, - IN UINT64 Address, - IN OUT EFI_DEVICE_PATH **PciDevicePath - ); - -typedef enum { - EfiBusMasterRead, - EfiBusMasterWrite, - EfiBusMasterCommonBuffer -} EFI_IO_OPERATION_TYPE; - -typedef -EFI_STATUS -(EFIAPI *EFI_IO_MAP) ( - IN struct _EFI_DEVICE_IO_PROTOCOL *This, - IN EFI_IO_OPERATION_TYPE Operation, - IN EFI_PHYSICAL_ADDRESS *HostAddress, - IN OUT UINTN *NumberOfBytes, - OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, - OUT VOID **Mapping - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IO_UNMAP) ( - IN struct _EFI_DEVICE_IO_PROTOCOL *This, - IN VOID *Mapping - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IO_ALLOCATE_BUFFER) ( - IN struct _EFI_DEVICE_IO_PROTOCOL *This, - IN EFI_ALLOCATE_TYPE Type, - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN Pages, - IN OUT EFI_PHYSICAL_ADDRESS *HostAddress - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IO_FLUSH) ( - IN struct _EFI_DEVICE_IO_PROTOCOL *This - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IO_FREE_BUFFER) ( - IN struct _EFI_DEVICE_IO_PROTOCOL *This, - IN UINTN Pages, - IN EFI_PHYSICAL_ADDRESS HostAddress - ); - -typedef struct _EFI_DEVICE_IO_PROTOCOL { - EFI_IO_ACCESS Mem; - EFI_IO_ACCESS Io; - EFI_IO_ACCESS Pci; - EFI_IO_MAP Map; - EFI_PCI_DEVICE_PATH PciDevicePath; - EFI_IO_UNMAP Unmap; - EFI_IO_ALLOCATE_BUFFER AllocateBuffer; - EFI_IO_FLUSH Flush; - EFI_IO_FREE_BUFFER FreeBuffer; -} EFI_DEVICE_IO_PROTOCOL; - -typedef struct _EFI_DEVICE_IO_PROTOCOL _EFI_DEVICE_IO_INTERFACE; -typedef EFI_DEVICE_IO_PROTOCOL EFI_DEVICE_IO_INTERFACE; - -// -// Unicode Collation protocol -// - -#define EFI_UNICODE_COLLATION_PROTOCOL_GUID \ - { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } -#define UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_PROTOCOL_GUID - -#define EFI_UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff) -#define UNICODE_BYTE_ORDER_MARK EFI_UNICODE_BYTE_ORDER_MARK - -INTERFACE_DECL(_EFI_UNICODE_COLLATION_PROTOCOL); - -typedef -INTN -(EFIAPI *EFI_UNICODE_STRICOLL) ( - IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This, - IN CHAR16 *s1, - IN CHAR16 *s2 - ); - -typedef -BOOLEAN -(EFIAPI *EFI_UNICODE_METAIMATCH) ( - IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This, - IN CHAR16 *String, - IN CHAR16 *Pattern - ); - -typedef -VOID -(EFIAPI *EFI_UNICODE_STRLWR) ( - IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This, - IN OUT CHAR16 *Str - ); - -typedef -VOID -(EFIAPI *EFI_UNICODE_STRUPR) ( - IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This, - IN OUT CHAR16 *Str - ); - -typedef -VOID -(EFIAPI *EFI_UNICODE_FATTOSTR) ( - IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This, - IN UINTN FatSize, - IN CHAR8 *Fat, - OUT CHAR16 *String - ); - -typedef -BOOLEAN -(EFIAPI *EFI_UNICODE_STRTOFAT) ( - IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This, - IN CHAR16 *String, - IN UINTN FatSize, - OUT CHAR8 *Fat - ); - -// -// Hash Protocol -// -#define EFI_HASH_PROTOCOL_GUID \ - { 0xC5184932, 0xDBA5, 0x46DB, { 0xA5, 0xBA, 0xCC, 0x0B, 0xDA, 0x9C, 0x14, 0x35 } } -#define HASH_PROTOCOL EFI_HASH_PROTOCOL_GUID - -#define EFI_HASH_ALGORITHM_SHA1_GUID \ - { 0x2AE9D80F, 0x3FB2, 0x4095, { 0xB7, 0xB1, 0xE9, 0x31, 0x57, 0xB9, 0x46, 0xB6 } } // Deprecated -#define EFI_HASH_ALGORITHM_SHA1 EFI_HASH_ALGORITHM_SHA1_GUID - -#define EFI_HASH_ALGORITHM_SHA224_GUID \ - { 0x8DF01A06, 0x9BD5, 0x4BF7, { 0xB0, 0x21, 0xDB, 0x4F, 0xD9, 0xCC, 0xF4, 0x5B } } // Deprecated -#define EFI_HASH_ALGORITHM_SHA224 EFI_HASH_ALGORITHM_SHA224_GUID - -#define EFI_HASH_ALGORITHM_SHA256_GUID \ - { 0x51AA59DE, 0xFDF2, 0x4EA3, { 0xBC, 0x63, 0x87, 0x5F, 0xB7, 0x84, 0x2E, 0xE9 } } // Deprecated -#define EFI_HASH_ALGORITHM_SHA256 EFI_HASH_ALGORITHM_SHA256_GUID - -#define EFI_HASH_ALGORITHM_SHA384_GUID \ - { 0xEFA96432, 0xDE33, 0x4DD2, { 0xAE, 0xE6, 0x32, 0x8C, 0x33, 0xDF, 0x77, 0x7A } } // Deprecated -#define EFI_HASH_ALGORITHM_SHA384 EFI_HASH_ALGORITHM_SHA384_GUID - -#define EFI_HASH_ALGORITHM_SHA512_GUID \ - { 0xCAA4381E, 0x750C, 0x4770, { 0xB8, 0x70, 0x7A, 0x23, 0xB4, 0xE4, 0x21, 0x30 } } // Deprecated -#define EFI_HASH_ALGORITHM_SHA512 EFI_HASH_ALGORITHM_SHA512_GUID - -#define EFI_HASH_ALGORITHM_MD5_GUID \ - { 0x0AF7C79C, 0x65B5, 0x4319, { 0xB0, 0xAE, 0x44, 0xEC, 0x48, 0x4E, 0x4A, 0xD7 } } // Deprecated -#define EFI_HASH_ALGORITHM_MD5 EFI_HASH_ALGORITHM_MD5_GUID - -#define EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID \ - { 0x24C5DC2F, 0x53E2, 0x40CA, { 0x9E, 0xD6, 0xA5, 0xD9, 0xA4, 0x9F, 0x46, 0x3B } } -#define EFI_HASH_ALGORITHM_SHA1_NOPAD EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID - -#define EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID \ - { 0x8628752A, 0x6CB7, 0x4814, { 0x96, 0xFC, 0x24, 0xA8, 0x15, 0xAC, 0x22, 0x26 } } -#define EFI_HASH_ALGORITHM_SHA256_NOPAD EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID - - -INTERFACE_DECL(_EFI_HASH_PROTOCOL); - -typedef UINT8 EFI_MD5_HASH[16]; -typedef UINT8 EFI_SHA1_HASH[20]; -typedef UINT8 EFI_SHA224_HASH[28]; -typedef UINT8 EFI_SHA256_HASH[32]; -typedef UINT8 EFI_SHA384_HASH[48]; -typedef UINT8 EFI_SHA512_HASH[64]; -typedef union _EFI_HASH_OUTPUT { - EFI_MD5_HASH *Md5Hash; - EFI_SHA1_HASH *Sha1Hash; - EFI_SHA224_HASH *Sha224Hash; - EFI_SHA256_HASH *Sha256Hash; - EFI_SHA384_HASH *Sha384Hash; - EFI_SHA512_HASH *Sha512Hash; -} EFI_HASH_OUTPUT; - -typedef -EFI_STATUS -(EFIAPI *EFI_HASH_GET_HASH_SIZE) ( - IN CONST struct _EFI_HASH_PROTOCOL *This, - IN CONST EFI_GUID *HashAlgorithm, - OUT UINTN *HashSize); - -typedef -EFI_STATUS -(EFIAPI *EFI_HASH_HASH) ( - IN CONST struct _EFI_HASH_PROTOCOL *This, - IN CONST EFI_GUID *HashAlgorithm, - IN BOOLEAN Extend, - IN CONST UINT8 *Message, - IN UINT64 MessageSize, - IN OUT EFI_HASH_OUTPUT *Hash); - -typedef struct _EFI_HASH_PROTOCOL { - EFI_HASH_GET_HASH_SIZE GetHashSize; - EFI_HASH_HASH Hash; -} EFI_HASH_PROTOCOL; - -typedef struct _EFI_HASH_PROTOCOL _EFI_HASH; -typedef EFI_HASH_PROTOCOL EFI_HASH; - - -typedef struct _EFI_UNICODE_COLLATION_PROTOCOL { - - // general - EFI_UNICODE_STRICOLL StriColl; - EFI_UNICODE_METAIMATCH MetaiMatch; - EFI_UNICODE_STRLWR StrLwr; - EFI_UNICODE_STRUPR StrUpr; - - // for supporting fat volumes - EFI_UNICODE_FATTOSTR FatToStr; - EFI_UNICODE_STRTOFAT StrToFat; - - CHAR8 *SupportedLanguages; -} EFI_UNICODE_COLLATION_PROTOCOL; - -typedef EFI_UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_INTERFACE; - -/* Graphics output protocol */ -#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \ - { 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } } -typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL; - -typedef struct { - UINT32 RedMask; - UINT32 GreenMask; - UINT32 BlueMask; - UINT32 ReservedMask; -} EFI_PIXEL_BITMASK; - -typedef enum { - PixelRedGreenBlueReserved8BitPerColor, - PixelBlueGreenRedReserved8BitPerColor, - PixelBitMask, - PixelBltOnly, - PixelFormatMax -} EFI_GRAPHICS_PIXEL_FORMAT; - -typedef struct { - UINT32 Version; - UINT32 HorizontalResolution; - UINT32 VerticalResolution; - EFI_GRAPHICS_PIXEL_FORMAT PixelFormat; - EFI_PIXEL_BITMASK PixelInformation; - UINT32 PixelsPerScanLine; -} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION; - -/** - Return the current video mode information. - - @param This Protocol instance pointer. - @param ModeNumber The mode number to return information on. - @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer. - @param Info A pointer to callee allocated buffer that returns information about ModeNumber. - - @retval EFI_SUCCESS Mode information returned. - @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small. - @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode. - @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode () - @retval EFI_INVALID_PARAMETER One of the input args was NULL. - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) ( - IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, - IN UINT32 ModeNumber, - OUT UINTN *SizeOfInfo, - OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info - ) -; - -/** - Return the current video mode information. - - @param This Protocol instance pointer. - @param ModeNumber The mode number to be set. - - @retval EFI_SUCCESS Graphics mode was changed. - @retval EFI_DEVICE_ERROR The device had an error and could not complete the request. - @retval EFI_UNSUPPORTED ModeNumber is not supported by this device. - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) ( - IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, - IN UINT32 ModeNumber - ); - -typedef struct { - UINT8 Blue; - UINT8 Green; - UINT8 Red; - UINT8 Reserved; -} EFI_GRAPHICS_OUTPUT_BLT_PIXEL; - -typedef union { - EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel; - UINT32 Raw; -} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION; - -typedef enum { - EfiBltVideoFill, - EfiBltVideoToBltBuffer, - EfiBltBufferToVideo, - EfiBltVideoToVideo, - EfiGraphicsOutputBltOperationMax -} EFI_GRAPHICS_OUTPUT_BLT_OPERATION; - -/** - The following table defines actions for BltOperations: - - EfiBltVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY) - directly to every pixel of the video display rectangle - (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). - Only one pixel will be used from the BltBuffer. Delta is NOT used. - - EfiBltVideoToBltBuffer - Read data from the video display rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in - the BltBuffer rectangle (DestinationX, DestinationY ) - (DestinationX + Width, DestinationY + Height). If DestinationX or - DestinationY is not zero then Delta must be set to the length in bytes - of a row in the BltBuffer. - - EfiBltBufferToVideo - Write data from the BltBuffer rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the - video display rectangle (DestinationX, DestinationY) - (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is - not zero then Delta must be set to the length in bytes of a row in the - BltBuffer. - - EfiBltVideoToVideo - Copy from the video display rectangle (SourceX, SourceY) - (SourceX + Width, SourceY + Height) .to the video display rectangle - (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). - The BltBuffer and Delta are not used in this mode. - - @param This Protocol instance pointer. - @param BltBuffer Buffer containing data to blit into video buffer. This - buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) - @param BltOperation Operation to perform on BlitBuffer and video memory - @param SourceX X coordinate of source for the BltBuffer. - @param SourceY Y coordinate of source for the BltBuffer. - @param DestinationX X coordinate of destination for the BltBuffer. - @param DestinationY Y coordinate of destination for the BltBuffer. - @param Width Width of rectangle in BltBuffer in pixels. - @param Height Hight of rectangle in BltBuffer in pixels. - @param Delta OPTIONAL - - @retval EFI_SUCCESS The Blt operation completed. - @retval EFI_INVALID_PARAMETER BltOperation is not valid. - @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer. - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) ( - IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, - IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL - IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, - IN UINTN SourceX, - IN UINTN SourceY, - IN UINTN DestinationX, - IN UINTN DestinationY, - IN UINTN Width, - IN UINTN Height, - IN UINTN Delta OPTIONAL - ); - -typedef struct { - UINT32 MaxMode; - UINT32 Mode; - EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; - UINTN SizeOfInfo; - EFI_PHYSICAL_ADDRESS FrameBufferBase; - UINTN FrameBufferSize; -} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE; - -struct _EFI_GRAPHICS_OUTPUT_PROTOCOL { - EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode; - EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode; - EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt; - EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode; -}; - - - -/* - * EFI EDID Discovered Protocol - * UEFI Specification Version 2.5 Section 11.9 - */ -#define EFI_EDID_DISCOVERED_PROTOCOL_GUID \ - { 0x1C0C34F6, 0xD380, 0x41FA, { 0xA0, 0x49, 0x8a, 0xD0, 0x6C, 0x1A, 0x66, 0xAA} } - -typedef struct _EFI_EDID_DISCOVERED_PROTOCOL { - UINT32 SizeOfEdid; - UINT8 *Edid; -} EFI_EDID_DISCOVERED_PROTOCOL; - - - -/* - * EFI EDID Active Protocol - * UEFI Specification Version 2.5 Section 11.9 - */ -#define EFI_EDID_ACTIVE_PROTOCOL_GUID \ - { 0xBD8C1056, 0x9F36, 0x44EC, { 0x92, 0xA8, 0xA6, 0x33, 0x7F, 0x81, 0x79, 0x86} } - -typedef struct _EFI_EDID_ACTIVE_PROTOCOL { - UINT32 SizeOfEdid; - UINT8 *Edid; -} EFI_EDID_ACTIVE_PROTOCOL; - - - -/* - * EFI EDID Override Protocol - * UEFI Specification Version 2.5 Section 11.9 - */ -#define EFI_EDID_OVERRIDE_PROTOCOL_GUID \ - { 0x48ECB431, 0xFB72, 0x45C0, { 0xA9, 0x22, 0xF4, 0x58, 0xFE, 0x04, 0x0B, 0xD5} } - -INTERFACE_DECL(_EFI_EDID_OVERRIDE_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID) ( - IN struct _EFI_EDID_OVERRIDE_PROTOCOL *This, - IN EFI_HANDLE *ChildHandle, - OUT UINT32 *Attributes, - IN OUT UINTN *EdidSize, - IN OUT UINT8 **Edid); - -typedef struct _EFI_EDID_OVERRIDE_PROTOCOL { - EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID GetEdid; -} EFI_EDID_OVERRIDE_PROTOCOL; - - - -INTERFACE_DECL(_EFI_SERVICE_BINDING); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD) ( - IN struct _EFI_SERVICE_BINDING *This, - IN EFI_HANDLE *ChildHandle - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD) ( - IN struct _EFI_SERVICE_BINDING *This, - IN EFI_HANDLE ChildHandle - ); - -typedef struct _EFI_SERVICE_BINDING { - EFI_SERVICE_BINDING_CREATE_CHILD CreateChild; - EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild; -} EFI_SERVICE_BINDING; - - - -/* - * EFI Driver Binding Protocol - * UEFI Specification Version 2.5 Section 10.1 - */ -#define EFI_DRIVER_BINDING_PROTOCOL_GUID \ - { 0x18A031AB, 0xB443, 0x4D1A, { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71} } -#define DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING_PROTOCOL_GUID - -INTERFACE_DECL(_EFI_DRIVER_BINDING_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED) ( - IN struct _EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE ControllerHandle, - IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL); - -typedef -EFI_STATUS -(EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_START) ( - IN struct _EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE ControllerHandle, - IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL); - -typedef -EFI_STATUS -(EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_STOP) ( - IN struct _EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE ControllerHandle, - IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer OPTIONAL); - -typedef struct _EFI_DRIVER_BINDING_PROTOCOL { - EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED Supported; - EFI_DRIVER_BINDING_PROTOCOL_START Start; - EFI_DRIVER_BINDING_PROTOCOL_STOP Stop; - UINT32 Version; - EFI_HANDLE ImageHandle; - EFI_HANDLE DriverBindingHandle; -} EFI_DRIVER_BINDING_PROTOCOL; - -typedef struct _EFI_DRIVER_BINDING_PROTOCOL _EFI_DRIVER_BINDING; -typedef EFI_DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING; - - -/* - * Backwards compatibility with older GNU-EFI versions. Deprecated. - */ -#define EFI_DRIVER_SUPPORTED EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED -#define EFI_DRIVER_START EFI_DRIVER_BINDING_PROTOCOL_START -#define EFI_DRIVER_STOP EFI_DRIVER_BINDING_PROTOCOL_STOP - - - -/* - * EFI Component Name Protocol - * Deprecated - use EFI Component Name 2 Protocol instead - */ -#define EFI_COMPONENT_NAME_PROTOCOL_GUID \ - {0x107A772C, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} } -#define COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL_GUID - -INTERFACE_DECL(_EFI_COMPONENT_NAME_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME) ( - IN struct _EFI_COMPONENT_NAME_PROTOCOL *This, - IN CHAR8 *Language, - OUT CHAR16 **DriverName); - -typedef -EFI_STATUS -(EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) ( - IN struct _EFI_COMPONENT_NAME_PROTOCOL *This, - IN EFI_HANDLE ControllerHandle, - IN EFI_HANDLE ChildHandle OPTIONAL, - IN CHAR8 *Language, - OUT CHAR16 **ControllerName); - -typedef struct _EFI_COMPONENT_NAME_PROTOCOL { - EFI_COMPONENT_NAME_GET_DRIVER_NAME GetDriverName; - EFI_COMPONENT_NAME_GET_CONTROLLER_NAME GetControllerName; - CHAR8 *SupportedLanguages; -} EFI_COMPONENT_NAME_PROTOCOL; - -typedef struct _EFI_COMPONENT_NAME_PROTOCOL _EFI_COMPONENT_NAME; -typedef EFI_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME; - - -/* - * EFI Component Name 2 Protocol - * UEFI Specification Version 2.5 Section 10.5 - */ -#define EFI_COMPONENT_NAME2_PROTOCOL_GUID \ - {0x6A7A5CFF, 0xE8D9, 0x4F70, { 0xBA, 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14} } -#define COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2_PROTOCOL_GUID - -INTERFACE_DECL(_EFI_COMPONENT_NAME2_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ( - IN struct _EFI_COMPONENT_NAME2_PROTOCOL *This, - IN CHAR8 *Language, - OUT CHAR16 **DriverName); - -typedef -EFI_STATUS -(EFIAPI *EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ( - IN struct _EFI_COMPONENT_NAME2_PROTOCOL *This, - IN EFI_HANDLE ControllerHandle, - IN EFI_HANDLE ChildHandle OPTIONAL, - IN CHAR8 *Language, - OUT CHAR16 **ControllerName); - -typedef struct _EFI_COMPONENT_NAME2_PROTOCOL { - EFI_COMPONENT_NAME2_GET_DRIVER_NAME GetDriverName; - EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME GetControllerName; - CHAR8 *SupportedLanguages; -} EFI_COMPONENT_NAME2_PROTOCOL; - -typedef struct _EFI_COMPONENT_NAME2_PROTOCOL _EFI_COMPONENT_NAME2; -typedef EFI_COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2; - - - -/* - * EFI Loaded Image Protocol - * UEFI Specification Version 2.5 Section 8.1 - */ -#define EFI_LOADED_IMAGE_PROTOCOL_GUID \ - { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } -#define LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE_PROTOCOL_GUID - -#define EFI_LOADED_IMAGE_PROTOCOL_REVISION 0x1000 -#define EFI_IMAGE_INFORMATION_REVISION EFI_LOADED_IMAGE_PROTOCOL_REVISION - -typedef -EFI_STATUS -(EFIAPI *EFI_IMAGE_UNLOAD) ( - IN EFI_HANDLE ImageHandle - ); - -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_PROTOCOL; - -typedef EFI_LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE; - -#define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \ - {0xbc62157e, 0x3e33, 0x4fec, {0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf} } - -/* - * Random Number Generator Protocol - * UEFI Specification Version 2.5 Section 35.5 - */ -#define EFI_RNG_PROTOCOL_GUID \ - { 0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44} } - -typedef EFI_GUID EFI_RNG_ALGORITHM; - -#define EFI_RNG_ALGORITHM_SP800_90_HASH_256_GUID \ - {0xa7af67cb, 0x603b, 0x4d42, {0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96} } - -#define EFI_RNG_ALGORITHM_SP800_90_HMAC_256_GUID \ - {0xc5149b43, 0xae85, 0x4f53, {0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7} } - -#define EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID \ - {0x44f0de6e, 0x4d8c, 0x4045, {0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e} } - -#define EFI_RNG_ALGORITHM_X9_31_3DES_GUID \ - {0x63c4785a, 0xca34, 0x4012, {0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46} } - -#define EFI_RNG_ALGORITHM_X9_31_AES_GUID \ - {0xacd03321, 0x777e, 0x4d3d, {0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9} } - -#define EFI_RNG_ALGORITHM_RAW \ - {0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61} } - -INTERFACE_DECL(_EFI_RNG_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_RNG_GET_INFO) ( - IN struct _EFI_RNG_PROTOCOL *This, - IN OUT UINTN *RNGAlgorithmListSize, - OUT EFI_RNG_ALGORITHM *RNGAlgorithmList -); - -typedef -EFI_STATUS -(EFIAPI *EFI_RNG_GET_RNG) ( - IN struct _EFI_RNG_PROTOCOL *This, - IN EFI_RNG_ALGORITHM *RNGAlgorithm, OPTIONAL - IN UINTN RNGValueLength, - OUT UINT8 *RNGValue -); - -typedef struct _EFI_RNG_PROTOCOL { - EFI_RNG_GET_INFO GetInfo; - EFI_RNG_GET_RNG GetRNG; -} EFI_RNG_PROTOCOL; - - -// -// EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL -// - -#define EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID \ - { 0x6b30c738, 0xa391, 0x11d4, {0x9a, 0x3b, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -INTERFACE_DECL(_EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER) ( -IN struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This, -IN EFI_HANDLE ControllerHandle, -IN OUT EFI_HANDLE *DriverImageHandle); - -typedef -EFI_STATUS -(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH) ( -IN struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This, -IN EFI_HANDLE ControllerHandle, -IN OUT EFI_DEVICE_PATH **DriverImagePath); - -typedef -EFI_STATUS -(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED) ( -IN struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This, -IN EFI_HANDLE ControllerHandle, -IN EFI_DEVICE_PATH *DriverImagePath, -IN EFI_HANDLE DriverImageHandle); - -typedef struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL { - EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER GetDriver; - EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH GetDriverPath; - EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED DriverLoaded; -} EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL; - -// -// EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL -// - -#define EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID \ - { 0x3bc1b285, 0x8a15, 0x4a82, {0xaa, 0xbf, 0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65} } - -INTERFACE_DECL(_EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER) ( -IN struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This, -IN OUT EFI_HANDLE *DriverImageHandle); - -typedef struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL { - EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER GetDriver; -} EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL; - -// -// EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL -// - -#define EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL_GUID \ - { 0xb1ee129e, 0xda36, 0x4181, {0x91, 0xf8, 0x04, 0xa4, 0x92, 0x37, 0x66, 0xa7} } - -INTERFACE_DECL(_EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL); - -typedef -UINT32 -(EFIAPI *EFI_DRIVER_FAMILY_OVERRIDE_GET_VERSION) ( -IN struct _EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL *This); - -typedef struct _EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL { - EFI_DRIVER_FAMILY_OVERRIDE_GET_VERSION GetVersion; -} EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL; - -// -// EFI_EBC_PROTOCOL -// - -#define EFI_EBC_INTERPRETER_PROTOCOL_GUID \ - {0x13ac6dd1, 0x73d0, 0x11d4, {0xb0, 0x6b, 0x00, 0xaa, 0x00, 0xbd, 0x6d, 0xe7} } - -#define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID - -INTERFACE_DECL(_EFI_EBC_PROTOCOL); - -typedef -EFI_STATUS -(EFIAPI *EFI_EBC_CREATE_THUNK)( - IN struct _EFI_EBC_PROTOCOL *This, - IN EFI_HANDLE ImageHandle, - IN VOID *EbcEntryPoint, - OUT VOID **Thunk); - -typedef -EFI_STATUS -(EFIAPI *EFI_EBC_UNLOAD_IMAGE)( - IN struct _EFI_EBC_PROTOCOL *This, - IN EFI_HANDLE ImageHandle); - -typedef -EFI_STATUS -(EFIAPI *EBC_ICACHE_FLUSH)( - IN EFI_PHYSICAL_ADDRESS Start, - IN UINT64 Length); - -typedef -EFI_STATUS -(EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH)( - IN struct _EFI_EBC_PROTOCOL *This, - IN EBC_ICACHE_FLUSH Flush); - -typedef -EFI_STATUS -(EFIAPI *EFI_EBC_GET_VERSION)( - IN struct _EFI_EBC_PROTOCOL *This, - IN OUT UINT64 *Version); - -typedef struct _EFI_EBC_PROTOCOL { - EFI_EBC_CREATE_THUNK CreateThunk; - EFI_EBC_UNLOAD_IMAGE UnloadImage; - EFI_EBC_REGISTER_ICACHE_FLUSH RegisterICacheFlush; - EFI_EBC_GET_VERSION GetVersion; -} EFI_EBC_PROTOCOL; - -#endif diff --git a/3rd/gnu-efi/inc/efipxebc.h b/3rd/gnu-efi/inc/efipxebc.h deleted file mode 100644 index 3760c7cbb..000000000 --- a/3rd/gnu-efi/inc/efipxebc.h +++ /dev/null @@ -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 */ diff --git a/3rd/gnu-efi/inc/efirtlib.h b/3rd/gnu-efi/inc/efirtlib.h deleted file mode 100644 index 518859e3a..000000000 --- a/3rd/gnu-efi/inc/efirtlib.h +++ /dev/null @@ -1,193 +0,0 @@ -#ifndef _EFI_RT_LIB_INCLUDE_ -#define _EFI_RT_LIB_INCLUDE_ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - efilib.h - -Abstract: - - EFI Runtime library functions - - - -Revision History - ---*/ - -#include "efidebug.h" -#include "efipart.h" -#if defined(_M_X64) || defined(__x86_64__) || defined(__amd64__) -#include "x86_64/efilibplat.h" -#elif defined(_M_IX86) || defined(__i386__) -#include "ia32/efilibplat.h" -#elif defined(_M_IA64) || defined(__ia64__) -#include "ia64/efilibplat.h" -#elif defined (_M_ARM64) || defined(__aarch64__) -#include "aarch64/efilibplat.h" -#elif defined (_M_ARM) || defined(__arm__) -#include "arm/efilibplat.h" -#elif defined (_M_MIPS64) || defined(__mips64__) || defined(__mips64) -#include "mips64el/efilibplat.h" -#elif defined (__riscv) && __riscv_xlen == 64 -#include "riscv64/efilibplat.h" -#endif - - -VOID -RUNTIMEFUNCTION -RtZeroMem ( - IN VOID *Buffer, - IN UINTN Size - ); - -VOID -RUNTIMEFUNCTION -RtSetMem ( - IN VOID *Buffer, - IN UINTN Size, - IN UINT8 Value - ); - -VOID -RUNTIMEFUNCTION -RtCopyMem ( - IN VOID *Dest, - IN CONST VOID *Src, - IN UINTN len - ); - -INTN -RUNTIMEFUNCTION -RtCompareMem ( - IN CONST VOID *Dest, - IN CONST VOID *Src, - IN UINTN len - ); - -INTN -RUNTIMEFUNCTION -RtStrCmp ( - IN CONST CHAR16 *s1, - IN CONST CHAR16 *s2 - ); - - -VOID -RUNTIMEFUNCTION -RtStrCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ); - -VOID -RUNTIMEFUNCTION -RtStrnCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ); - -CHAR16 * -RUNTIMEFUNCTION -RtStpCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ); - -CHAR16 * -RUNTIMEFUNCTION -RtStpnCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ); - -VOID -RUNTIMEFUNCTION -RtStrCat ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ); - -VOID -RUNTIMEFUNCTION -RtStrnCat ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ); - -UINTN -RUNTIMEFUNCTION -RtStrLen ( - IN CONST CHAR16 *s1 - ); - -UINTN -RUNTIMEFUNCTION -RtStrnLen ( - IN CONST CHAR16 *s1, - IN UINTN Len - ); - -UINTN -RUNTIMEFUNCTION -RtStrSize ( - IN CONST CHAR16 *s1 - ); - -INTN -RUNTIMEFUNCTION -RtCompareGuid ( - IN EFI_GUID *Guid1, - IN EFI_GUID *Guid2 - ); - -UINT8 -RUNTIMEFUNCTION -RtDecimaltoBCD( - IN UINT8 BcdValue - ); - -UINT8 -RUNTIMEFUNCTION -RtBCDtoDecimal( - IN UINT8 BcdValue - ); - -// -// Virtual mapping transition support. (Only used during -// the virtual address change transisition) -// - -VOID -RUNTIMEFUNCTION -RtLibEnableVirtualMappings ( - VOID - ); - -VOID -RUNTIMEFUNCTION -RtConvertList ( - IN UINTN DebugDisposition, - IN OUT LIST_ENTRY *ListHead - ); - -VOID -RUNTIMEFUNCTION -RtAcquireLock ( - IN FLOCK *Lock - ); - -VOID -RUNTIMEFUNCTION -RtReleaseLock ( - IN FLOCK *Lock - ); - - -#endif diff --git a/3rd/gnu-efi/inc/efiser.h b/3rd/gnu-efi/inc/efiser.h deleted file mode 100644 index 45a463e88..000000000 --- a/3rd/gnu-efi/inc/efiser.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef _EFI_SER_H -#define _EFI_SER_H - -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - efiser.h - -Abstract: - - EFI serial protocol - -Revision History - ---*/ - -// -// Serial protocol -// - -#define EFI_SERIAL_IO_PROTOCOL_GUID \ - { 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD} } -#define SERIAL_IO_PROTOCOL EFI_SERIAL_IO_PROTOCOL_GUID - -INTERFACE_DECL(_EFI_SERIAL_IO_PROTOCOL); - -typedef enum { - DefaultParity, - NoParity, - EvenParity, - OddParity, - MarkParity, - SpaceParity -} EFI_PARITY_TYPE; - -typedef enum { - DefaultStopBits, - OneStopBit, // 1 stop bit - OneFiveStopBits, // 1.5 stop bits - TwoStopBits // 2 stop bits -} EFI_STOP_BITS_TYPE; - -#define EFI_SERIAL_CLEAR_TO_SEND 0x0010 // RO -#define EFI_SERIAL_DATA_SET_READY 0x0020 // RO -#define EFI_SERIAL_RING_INDICATE 0x0040 // RO -#define EFI_SERIAL_CARRIER_DETECT 0x0080 // RO -#define EFI_SERIAL_REQUEST_TO_SEND 0x0002 // WO -#define EFI_SERIAL_DATA_TERMINAL_READY 0x0001 // WO -#define EFI_SERIAL_INPUT_BUFFER_EMPTY 0x0100 // RO -#define EFI_SERIAL_OUTPUT_BUFFER_EMPTY 0x0200 // RO -#define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE 0x1000 // RW -#define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE 0x2000 // RW -#define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x4000 // RW - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_RESET) ( - IN struct _EFI_SERIAL_IO_PROTOCOL *This - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_SET_ATTRIBUTES) ( - IN struct _EFI_SERIAL_IO_PROTOCOL *This, - IN UINT64 BaudRate, - IN UINT32 ReceiveFifoDepth, - IN UINT32 Timeout, - IN EFI_PARITY_TYPE Parity, - IN UINT8 DataBits, - IN EFI_STOP_BITS_TYPE StopBits - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_SET_CONTROL_BITS) ( - IN struct _EFI_SERIAL_IO_PROTOCOL *This, - IN UINT32 Control - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_GET_CONTROL_BITS) ( - IN struct _EFI_SERIAL_IO_PROTOCOL *This, - OUT UINT32 *Control - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_WRITE) ( - IN struct _EFI_SERIAL_IO_PROTOCOL *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_READ) ( - IN struct _EFI_SERIAL_IO_PROTOCOL *This, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ); - -typedef struct { - UINT32 ControlMask; - - // current Attributes - UINT32 Timeout; - UINT64 BaudRate; - UINT32 ReceiveFifoDepth; - UINT32 DataBits; - UINT32 Parity; - UINT32 StopBits; -} SERIAL_IO_MODE; - -#define SERIAL_IO_INTERFACE_REVISION 0x00010000 - -typedef struct _EFI_SERIAL_IO_PROTOCOL { - UINT32 Revision; - EFI_SERIAL_RESET Reset; - EFI_SERIAL_SET_ATTRIBUTES SetAttributes; - EFI_SERIAL_SET_CONTROL_BITS SetControl; - EFI_SERIAL_GET_CONTROL_BITS GetControl; - EFI_SERIAL_WRITE Write; - EFI_SERIAL_READ Read; - - SERIAL_IO_MODE *Mode; -} EFI_SERIAL_IO_PROTOCOL; - -typedef struct _EFI_SERIAL_IO_PROTOCOL _SERIAL_IO_INTERFACE; -typedef EFI_SERIAL_IO_PROTOCOL SERIAL_IO_INTERFACE; - -#endif - diff --git a/3rd/gnu-efi/inc/efisetjmp.h b/3rd/gnu-efi/inc/efisetjmp.h deleted file mode 100644 index de69194b4..000000000 --- a/3rd/gnu-efi/inc/efisetjmp.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GNU_EFI_SETJMP_H -#define GNU_EFI_SETJMP_H - -#include "eficompiler.h" -#include "efisetjmp_arch.h" - -extern UINTN setjmp(jmp_buf env) __attribute__((returns_twice)); -extern VOID longjmp(jmp_buf env, UINTN value) __attribute__((noreturn)); - -#endif /* GNU_EFI_SETJMP_H */ diff --git a/3rd/gnu-efi/inc/efishell.h b/3rd/gnu-efi/inc/efishell.h deleted file mode 100644 index aa3fab257..000000000 --- a/3rd/gnu-efi/inc/efishell.h +++ /dev/null @@ -1,449 +0,0 @@ -/** - EFI Shell protocol as defined in the UEFI Shell Specification 2.2. - - (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - - This file is based on MdePkg/Include/Protocol/Shell.h from EDK2 - Ported to gnu-efi by Jiaqing Zhao -**/ - -#ifndef _EFI_SHELL_H -#define _EFI_SHELL_H - -#include "efilink.h" - -#define EFI_SHELL_PROTOCOL_GUID \ - { 0x6302d008, 0x7f9b, 0x4f30, { 0x87, 0xac, 0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e } } - -INTERFACE_DECL(_EFI_SHELL_PROTOCOL); - -typedef enum { - SHELL_SUCCESS = 0, - SHELL_LOAD_ERROR = 1, - SHELL_INVALID_PARAMETER = 2, - SHELL_UNSUPPORTED = 3, - SHELL_BAD_BUFFER_SIZE = 4, - SHELL_BUFFER_TOO_SMALL = 5, - SHELL_NOT_READY = 6, - SHELL_DEVICE_ERROR = 7, - SHELL_WRITE_PROTECTED = 8, - SHELL_OUT_OF_RESOURCES = 9, - SHELL_VOLUME_CORRUPTED = 10, - SHELL_VOLUME_FULL = 11, - SHELL_NO_MEDIA = 12, - SHELL_MEDIA_CHANGED = 13, - SHELL_NOT_FOUND = 14, - SHELL_ACCESS_DENIED = 15, - SHELL_TIMEOUT = 18, - SHELL_NOT_STARTED = 19, - SHELL_ALREADY_STARTED = 20, - SHELL_ABORTED = 21, - SHELL_INCOMPATIBLE_VERSION = 25, - SHELL_SECURITY_VIOLATION = 26, - SHELL_NOT_EQUAL = 27 -} SHELL_STATUS; - -typedef VOID *SHELL_FILE_HANDLE; - -typedef struct { - EFI_LIST_ENTRY Link; - EFI_STATUS Status; - CONST CHAR16 *FullName; - CONST CHAR16 *FileName; - SHELL_FILE_HANDLE Handle; - EFI_FILE_INFO *Info; -} EFI_SHELL_FILE_INFO; - -typedef -BOOLEAN -(EFIAPI *EFI_SHELL_BATCH_IS_ACTIVE) ( - VOID - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_CLOSE_FILE) ( - IN SHELL_FILE_HANDLE FileHandle - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_CREATE_FILE) ( - IN CONST CHAR16 *FileName, - IN UINT64 FileAttribs, - OUT SHELL_FILE_HANDLE *FileHandle - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_DELETE_FILE) ( - IN SHELL_FILE_HANDLE FileHandle - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_DELETE_FILE_BY_NAME) ( - IN CONST CHAR16 *FileName - ); - -typedef -VOID -(EFIAPI *EFI_SHELL_DISABLE_PAGE_BREAK) ( - VOID - ); - -typedef -VOID -(EFIAPI *EFI_SHELL_ENABLE_PAGE_BREAK) ( - VOID - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_EXECUTE) ( - IN EFI_HANDLE *ParentImageHandle, - IN CHAR16 *CommandLine OPTIONAL, - IN CHAR16 **Environment OPTIONAL, - OUT EFI_STATUS *StatusCode OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_FIND_FILES) ( - IN CONST CHAR16 *FilePattern, - OUT EFI_SHELL_FILE_INFO **FileList - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_FIND_FILES_IN_DIR) ( - IN SHELL_FILE_HANDLE FileDirHandle, - OUT EFI_SHELL_FILE_INFO **FileList - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_FLUSH_FILE) ( - IN SHELL_FILE_HANDLE FileHandle - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_FREE_FILE_LIST) ( - IN EFI_SHELL_FILE_INFO **FileList - ); - -typedef -CONST CHAR16 * -(EFIAPI *EFI_SHELL_GET_ALIAS) ( - IN CONST CHAR16 *Alias, - OUT BOOLEAN *Volatile OPTIONAL - ); - -typedef -CONST CHAR16 * -(EFIAPI *EFI_SHELL_GET_CUR_DIR) ( - IN CONST CHAR16 *FileSystemMapping OPTIONAL - ); - -typedef UINT32 EFI_SHELL_DEVICE_NAME_FLAGS; -#define EFI_DEVICE_NAME_USE_COMPONENT_NAME 0x00000001 -#define EFI_DEVICE_NAME_USE_DEVICE_PATH 0x00000002 - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_GET_DEVICE_NAME) ( - IN EFI_HANDLE DeviceHandle, - IN EFI_SHELL_DEVICE_NAME_FLAGS Flags, - IN CHAR8 *Language, - OUT CHAR16 **BestDeviceName - ); - -typedef -CONST EFI_DEVICE_PATH_PROTOCOL * -(EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_MAP) ( - IN CONST CHAR16 *Mapping - ); - -typedef -EFI_DEVICE_PATH_PROTOCOL * -(EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH) ( - IN CONST CHAR16 *Path - ); - -typedef -CONST CHAR16 * -(EFIAPI *EFI_SHELL_GET_ENV) ( - IN CONST CHAR16 *Name - ); - -typedef -CONST CHAR16 * -(EFIAPI *EFI_SHELL_GET_ENV_EX) ( - IN CONST CHAR16 *Name, - OUT UINT32 *Attributes OPTIONAL - ); - -typedef -EFI_FILE_INFO * -(EFIAPI *EFI_SHELL_GET_FILE_INFO) ( - IN SHELL_FILE_HANDLE FileHandle - ); - -typedef -CHAR16 * -(EFIAPI *EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH) ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *Path - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_GET_FILE_POSITION) ( - IN SHELL_FILE_HANDLE FileHandle, - OUT UINT64 *Position - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_GET_FILE_SIZE) ( - IN SHELL_FILE_HANDLE FileHandle, - OUT UINT64 *Size - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_GET_GUID_FROM_NAME) ( - IN CONST CHAR16 *GuidName, - OUT EFI_GUID *Guid - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_GET_GUID_NAME)( - IN CONST EFI_GUID *Guid, - OUT CONST CHAR16 **GuidName - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_GET_HELP_TEXT) ( - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Sections, - OUT CHAR16 **HelpText - ); - -typedef -CONST CHAR16 * -(EFIAPI *EFI_SHELL_GET_MAP_FROM_DEVICE_PATH) ( - IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath - ); - -typedef -BOOLEAN -(EFIAPI *EFI_SHELL_GET_PAGE_BREAK) ( - VOID - ); - -typedef -BOOLEAN -(EFIAPI *EFI_SHELL_IS_ROOT_SHELL) ( - VOID - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_OPEN_FILE_BY_NAME) ( - IN CONST CHAR16 *FileName, - OUT SHELL_FILE_HANDLE *FileHandle, - IN UINT64 OpenMode - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_OPEN_FILE_LIST) ( - IN CHAR16 *Path, - IN UINT64 OpenMode, - IN OUT EFI_SHELL_FILE_INFO **FileList - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_OPEN_ROOT) ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, - OUT SHELL_FILE_HANDLE *FileHandle - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_OPEN_ROOT_BY_HANDLE) ( - IN EFI_HANDLE DeviceHandle, - OUT SHELL_FILE_HANDLE *FileHandle - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_READ_FILE) ( - IN SHELL_FILE_HANDLE FileHandle, - IN OUT UINTN *ReadSize, - IN OUT VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_REGISTER_GUID_NAME) ( - IN CONST EFI_GUID *Guid, - IN CONST CHAR16 *GuidName - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_REMOVE_DUP_IN_FILE_LIST) ( - IN EFI_SHELL_FILE_INFO **FileList - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_SET_ALIAS) ( - IN CONST CHAR16 *Command, - IN CONST CHAR16 *Alias, - IN BOOLEAN Replace, - IN BOOLEAN Volatile - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_SET_CUR_DIR) ( - IN CONST CHAR16 *FileSystem OPTIONAL, - IN CONST CHAR16 *Dir - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_SET_ENV) ( - IN CONST CHAR16 *Name, - IN CONST CHAR16 *Value, - IN BOOLEAN Volatile - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_SET_FILE_INFO) ( - IN SHELL_FILE_HANDLE FileHandle, - IN CONST EFI_FILE_INFO *FileInfo - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_SET_FILE_POSITION) ( - IN SHELL_FILE_HANDLE FileHandle, - IN UINT64 Position - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_SET_MAP) ( - IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN CONST CHAR16 *Mapping - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SHELL_WRITE_FILE) ( - IN SHELL_FILE_HANDLE FileHandle, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ); - -typedef struct _EFI_SHELL_PROTOCOL { - EFI_SHELL_EXECUTE Execute; - EFI_SHELL_GET_ENV GetEnv; - EFI_SHELL_SET_ENV SetEnv; - EFI_SHELL_GET_ALIAS GetAlias; - EFI_SHELL_SET_ALIAS SetAlias; - EFI_SHELL_GET_HELP_TEXT GetHelpText; - EFI_SHELL_GET_DEVICE_PATH_FROM_MAP GetDevicePathFromMap; - EFI_SHELL_GET_MAP_FROM_DEVICE_PATH GetMapFromDevicePath; - EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH GetDevicePathFromFilePath; - EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH GetFilePathFromDevicePath; - EFI_SHELL_SET_MAP SetMap; - EFI_SHELL_GET_CUR_DIR GetCurDir; - EFI_SHELL_SET_CUR_DIR SetCurDir; - EFI_SHELL_OPEN_FILE_LIST OpenFileList; - EFI_SHELL_FREE_FILE_LIST FreeFileList; - EFI_SHELL_REMOVE_DUP_IN_FILE_LIST RemoveDupInFileList; - EFI_SHELL_BATCH_IS_ACTIVE BatchIsActive; - EFI_SHELL_IS_ROOT_SHELL IsRootShell; - EFI_SHELL_ENABLE_PAGE_BREAK EnablePageBreak; - EFI_SHELL_DISABLE_PAGE_BREAK DisablePageBreak; - EFI_SHELL_GET_PAGE_BREAK GetPageBreak; - EFI_SHELL_GET_DEVICE_NAME GetDeviceName; - EFI_SHELL_GET_FILE_INFO GetFileInfo; - EFI_SHELL_SET_FILE_INFO SetFileInfo; - EFI_SHELL_OPEN_FILE_BY_NAME OpenFileByName; - EFI_SHELL_CLOSE_FILE CloseFile; - EFI_SHELL_CREATE_FILE CreateFile; - EFI_SHELL_READ_FILE ReadFile; - EFI_SHELL_WRITE_FILE WriteFile; - EFI_SHELL_DELETE_FILE DeleteFile; - EFI_SHELL_DELETE_FILE_BY_NAME DeleteFileByName; - EFI_SHELL_GET_FILE_POSITION GetFilePosition; - EFI_SHELL_SET_FILE_POSITION SetFilePosition; - EFI_SHELL_FLUSH_FILE FlushFile; - EFI_SHELL_FIND_FILES FindFiles; - EFI_SHELL_FIND_FILES_IN_DIR FindFilesInDir; - EFI_SHELL_GET_FILE_SIZE GetFileSize; - EFI_SHELL_OPEN_ROOT OpenRoot; - EFI_SHELL_OPEN_ROOT_BY_HANDLE OpenRootByHandle; - EFI_EVENT ExecutionBreak; - UINT32 MajorVersion; - UINT32 MinorVersion; - // Added for Shell 2.1 - EFI_SHELL_REGISTER_GUID_NAME RegisterGuidName; - EFI_SHELL_GET_GUID_NAME GetGuidName; - EFI_SHELL_GET_GUID_FROM_NAME GetGuidFromName; - EFI_SHELL_GET_ENV_EX GetEnvEx; -} EFI_SHELL_PROTOCOL; - -#define EFI_SHELL_PARAMETERS_PROTOCOL_GUID \ - { 0x752f3136, 0x4e16, 0x4fdc, { 0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca } } - -INTERFACE_DECL(_EFI_SHELL_PARAMETERS_PROTOCOL); - -typedef struct _EFI_SHELL_PARAMETERS_PROTOCOL { - CHAR16 **Argv; - UINTN Argc; - SHELL_FILE_HANDLE StdIn; - SHELL_FILE_HANDLE StdOut; - SHELL_FILE_HANDLE StdErr; -} EFI_SHELL_PARAMETERS_PROTOCOL; - -#define EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_GUID \ - { 0x3c7200e9, 0x005f, 0x4ea4, { 0x87, 0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3 } } - -INTERFACE_DECL(_EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL); - -typedef -SHELL_STATUS -(EFIAPI *SHELL_COMMAND_HANDLER)( - IN struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, - IN EFI_SYSTEM_TABLE *SystemTable, - IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, - IN EFI_SHELL_PROTOCOL *Shell - ); - -typedef -CHAR16* -(EFIAPI *SHELL_COMMAND_GETHELP)( - IN struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, - IN CONST CHAR8 *Language - ); - -typedef struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL { - CONST CHAR16 *CommandName; - SHELL_COMMAND_HANDLER Handler; - SHELL_COMMAND_GETHELP GetHelp; -} EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL; - -#endif diff --git a/3rd/gnu-efi/inc/efishellintf.h b/3rd/gnu-efi/inc/efishellintf.h deleted file mode 100644 index e649acd31..000000000 --- a/3rd/gnu-efi/inc/efishellintf.h +++ /dev/null @@ -1,94 +0,0 @@ -/** @file - SHELL_INTERFACE_PROTOCOL from EDK shell (no spec). - - Shell Interface - additional information (over image_info) provided - to an application started by the shell. - - ConIo provides a file-style interface to the console. - - The shell interface's and data (including ConIo) are only valid during - the applications Entry Point. Once the application returns from it's - entry point the data is freed by the invoking shell. - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ -/* - * This is based on ShellPkg/Include/Protocol/EfiShellInterface.h from EDK II. - */ - -#ifndef _SHELLINTERFACE_H_ -#define _SHELLINTERFACE_H_ - - -#define SHELL_INTERFACE_PROTOCOL_GUID \ - { \ - 0x47c7b223, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \ - } - -/// -/// Bit definitions for EFI_SHELL_ARG_INFO -/// -typedef enum { - ARG_NO_ATTRIB = 0x0, - ARG_IS_QUOTED = 1<<0, - ARG_PARTIALLY_QUOTED = 1<<1, - ARG_FIRST_HALF_QUOTED = 1<<2, - ARG_FIRST_CHAR_IS_ESC = 1<<3 -} EFI_SHELL_ARG_INFO_TYPES; - -/// -/// Attributes for an argument. -/// -typedef struct _EFI_SHELL_ARG_INFO { - UINT32 Attributes; -} EFI_SHELL_ARG_INFO; - -/// -/// This protocol provides access to additional information about a shell application. -/// -typedef struct { - /// - /// Handle back to original image handle & image information. - /// - EFI_HANDLE ImageHandle; - EFI_LOADED_IMAGE *Info; - - /// - /// Parsed arg list converted more C-like format. - /// - CHAR16 **Argv; - UINTN Argc; - - /// - /// Storage for file redirection args after parsing. - /// - CHAR16 **RedirArgv; - UINTN RedirArgc; - - /// - /// A file style handle for console io. - /// - EFI_FILE *StdIn; - EFI_FILE *StdOut; - EFI_FILE *StdErr; - - /// - /// List of attributes for each argument. - /// - EFI_SHELL_ARG_INFO *ArgInfo; - - /// - /// Whether we are echoing. - /// - BOOLEAN EchoOn; -} EFI_SHELL_INTERFACE; - -#endif diff --git a/3rd/gnu-efi/inc/efistdarg.h b/3rd/gnu-efi/inc/efistdarg.h deleted file mode 100644 index 8312c3d0b..000000000 --- a/3rd/gnu-efi/inc/efistdarg.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _EFISTDARG_H_ -#define _EFISTDARG_H_ - -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - devpath.h - -Abstract: - - Defines for parsing the EFI Device Path structures - - - -Revision History - ---*/ - -#if !defined(GNU_EFI_USE_EXTERNAL_STDARG) && !defined(_MSC_VER) -typedef __builtin_va_list va_list; - -# define va_start(v,l) __builtin_va_start(v,l) -# define va_end(v) __builtin_va_end(v) -# define va_arg(v,l) __builtin_va_arg(v,l) -# define va_copy(d,s) __builtin_va_copy(d,s) -#else -# include -#endif - -#endif diff --git a/3rd/gnu-efi/inc/efitcp.h b/3rd/gnu-efi/inc/efitcp.h deleted file mode 100644 index 6c5df7fd9..000000000 --- a/3rd/gnu-efi/inc/efitcp.h +++ /dev/null @@ -1,391 +0,0 @@ -#ifndef _EFI_TCP_H -#define _EFI_TCP_H - -/*++ -Copyright (c) 2013 Intel Corporation - ---*/ - -#define EFI_TCP4_SERVICE_BINDING_PROTOCOL \ - { 0x00720665, 0x67eb, 0x4a99, {0xba, 0xf7, 0xd3, 0xc3, 0x3a, 0x1c,0x7c, 0xc9}} - -#define EFI_TCP4_PROTOCOL \ - { 0x65530bc7, 0xa359, 0x410f, {0xb0, 0x10, 0x5a, 0xad, 0xc7, 0xec, 0x2b, 0x62}} - -#define EFI_TCP6_SERVICE_BINDING_PROTOCOL \ - { 0xec20eb79, 0x6c1a, 0x4664, {0x9a, 0xd, 0xd2, 0xe4, 0xcc, 0x16, 0xd6, 0x64}} - -#define EFI_TCP6_PROTOCOL \ - { 0x46e44855, 0xbd60, 0x4ab7, {0xab, 0xd, 0xa6, 0x79, 0xb9, 0x44, 0x7d, 0x77}} - -INTERFACE_DECL(_EFI_TCP4); -INTERFACE_DECL(_EFI_TCP6); - -typedef struct { - BOOLEAN UseDefaultAddress; - EFI_IPv4_ADDRESS StationAddress; - EFI_IPv4_ADDRESS SubnetMask; - UINT16 StationPort; - EFI_IPv4_ADDRESS RemoteAddress; - UINT16 RemotePort; - BOOLEAN ActiveFlag; -} EFI_TCP4_ACCESS_POINT; - -typedef struct { - UINT32 ReceiveBufferSize; - UINT32 SendBufferSize; - UINT32 MaxSynBackLog; - UINT32 ConnectionTimeout; - UINT32 DataRetries; - UINT32 FinTimeout; - UINT32 TimeWaitTimeout; - UINT32 KeepAliveProbes; - UINT32 KeepAliveTime; - UINT32 KeepAliveInterval; - BOOLEAN EnableNagle; - BOOLEAN EnableTimeStamp; - BOOLEAN EnableWindowScaling; - BOOLEAN EnableSelectiveAck; - BOOLEAN EnablePAthMtuDiscovery; -} EFI_TCP4_OPTION; - -typedef struct { - // Receiving Filters - // I/O parameters - UINT8 TypeOfService; - UINT8 TimeToLive; - - // Access Point - EFI_TCP4_ACCESS_POINT AccessPoint; - - // TCP Control Options - EFI_TCP4_OPTION *ControlOption; -} EFI_TCP4_CONFIG_DATA; - -typedef enum { - Tcp4StateClosed = 0, - Tcp4StateListen = 1, - Tcp4StateSynSent = 2, - Tcp4StateSynReceived = 3, - Tcp4StateEstablished = 4, - Tcp4StateFinWait1 = 5, - Tcp4StateFinWait2 = 6, - Tcp4StateClosing = 7, - Tcp4StateTimeWait = 8, - Tcp4StateCloseWait = 9, - Tcp4StateLastAck = 10 -} EFI_TCP4_CONNECTION_STATE; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_GET_MODE_DATA) ( - IN struct _EFI_TCP4 *This, - OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL, - OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL, - 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_TCP4_CONFIGURE) ( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_ROUTES) ( - IN struct _EFI_TCP4 *This, - IN BOOLEAN DeleteRoute, - IN EFI_IPv4_ADDRESS *SubnetAddress, - IN EFI_IPv4_ADDRESS *SubnetMask, - IN EFI_IPv4_ADDRESS *GatewayAddress -); - -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; -} EFI_TCP4_COMPLETION_TOKEN; - -typedef struct { - EFI_TCP4_COMPLETION_TOKEN CompletionToken; -} EFI_TCP4_CONNECTION_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_CONNECT) ( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken - ); - -typedef struct { - EFI_TCP4_COMPLETION_TOKEN CompletionToken; - EFI_HANDLE NewChildHandle; -} EFI_TCP4_LISTEN_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_ACCEPT) ( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_LISTEN_TOKEN *ListenToken - ); - -#define EFI_CONNECTION_FIN EFIERR(104) -#define EFI_CONNECTION_RESET EFIERR(105) -#define EFI_CONNECTION_REFUSED EFIERR(106) - -typedef struct { - UINT32 FragmentLength; - VOID *FragmentBuffer; -} EFI_TCP4_FRAGMENT_DATA; - -typedef struct { - BOOLEAN UrgentFlag; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_TCP4_FRAGMENT_DATA FragmentTable[1]; -} EFI_TCP4_RECEIVE_DATA; - -typedef struct { - BOOLEAN Push; - BOOLEAN Urgent; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_TCP4_FRAGMENT_DATA FragmentTable[1]; -} EFI_TCP4_TRANSMIT_DATA; - -typedef struct { - EFI_TCP4_COMPLETION_TOKEN CompletionToken; - union { - EFI_TCP4_RECEIVE_DATA *RxData; - EFI_TCP4_TRANSMIT_DATA *TxData; - } Packet; -} EFI_TCP4_IO_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_TRANSMIT) ( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_IO_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_RECEIVE) ( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_IO_TOKEN *Token - ); - -typedef struct { - EFI_TCP4_COMPLETION_TOKEN CompletionToken; - BOOLEAN AbortOnClose; -} EFI_TCP4_CLOSE_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_CLOSE)( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_CLOSE_TOKEN *CloseToken - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_CANCEL)( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL -); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_POLL) ( - IN struct _EFI_TCP4 *This - ); - -typedef struct _EFI_TCP4 { - EFI_TCP4_GET_MODE_DATA GetModeData; - EFI_TCP4_CONFIGURE Configure; - EFI_TCP4_ROUTES Routes; - EFI_TCP4_CONNECT Connect; - EFI_TCP4_ACCEPT Accept; - EFI_TCP4_TRANSMIT Transmit; - EFI_TCP4_RECEIVE Receive; - EFI_TCP4_CLOSE Close; - EFI_TCP4_CANCEL Cancel; - EFI_TCP4_POLL Poll; -} EFI_TCP4; - -typedef enum { - Tcp6StateClosed = 0, - Tcp6StateListen = 1, - Tcp6StateSynSent = 2, - Tcp6StateSynReceived = 3, - Tcp6StateEstablished = 4, - Tcp6StateFinWait1 = 5, - Tcp6StateFinWait2 = 6, - Tcp6StateClosing = 7, - Tcp6StateTimeWait = 8, - Tcp6StateCloseWait = 9, - Tcp6StateLastAck = 10 -} EFI_TCP6_CONNECTION_STATE; - -typedef struct { - EFI_IPv6_ADDRESS StationAddress; - UINT16 StationPort; - EFI_IPv6_ADDRESS RemoteAddress; - UINT16 RemotePort; - BOOLEAN ActiveFlag; -} EFI_TCP6_ACCESS_POINT; - -typedef struct { - UINT32 ReceiveBufferSize; - UINT32 SendBufferSize; - UINT32 MaxSynBackLog; - UINT32 ConnectionTimeout; - UINT32 DataRetries; - UINT32 FinTimeout; - UINT32 TimeWaitTimeout; - UINT32 KeepAliveProbes; - UINT32 KeepAliveTime; - UINT32 KeepAliveInterval; - BOOLEAN EnableNagle; - BOOLEAN EnableTimeStamp; - BOOLEAN EnableWindbowScaling; - BOOLEAN EnableSelectiveAck; - BOOLEAN EnablePathMtuDiscovery; -} EFI_TCP6_OPTION; - -typedef struct { - UINT8 TrafficClass; - UINT8 HopLimit; - EFI_TCP6_ACCESS_POINT AccessPoint; - EFI_TCP6_OPTION *ControlOption; -} EFI_TCP6_CONFIG_DATA; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_GET_MODE_DATA) ( - IN struct _EFI_TCP6 *This, - OUT EFI_TCP6_CONNECTION_STATE *Tcp6State OPTIONAL, - OUT EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL, - 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_TCP6_CONFIGURE) ( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL - ); - -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; -} EFI_TCP6_COMPLETION_TOKEN; - -typedef struct { - EFI_TCP6_COMPLETION_TOKEN CompletionToken; -} EFI_TCP6_CONNECTION_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_CONNECT) ( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken - ); - -typedef struct { - EFI_TCP6_COMPLETION_TOKEN CompletionToken; - EFI_HANDLE NewChildHandle; -} EFI_TCP6_LISTEN_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_ACCEPT) ( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_LISTEN_TOKEN *ListenToken - ); - -typedef struct { - UINT32 FragmentLength; - VOID *FragmentBuffer; -} EFI_TCP6_FRAGMENT_DATA; - -typedef struct { - BOOLEAN UrgentFlag; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_TCP6_FRAGMENT_DATA FragmentTable[1]; -} EFI_TCP6_RECEIVE_DATA; - -typedef struct { - BOOLEAN Push; - BOOLEAN Urgent; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_TCP6_FRAGMENT_DATA FragmentTable[1]; -} EFI_TCP6_TRANSMIT_DATA; - -typedef struct { - EFI_TCP6_COMPLETION_TOKEN CompletionToken; - union { - EFI_TCP6_RECEIVE_DATA *RxData; - EFI_TCP6_TRANSMIT_DATA *TxData; - } Packet; -} EFI_TCP6_IO_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_TRANSMIT) ( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_IO_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_RECEIVE) ( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_IO_TOKEN *Token - ); - -typedef struct { - EFI_TCP6_COMPLETION_TOKEN CompletionToken; - BOOLEAN AbortOnClose; -} EFI_TCP6_CLOSE_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_CLOSE)( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_CLOSE_TOKEN *CloseToken - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_CANCEL)( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_POLL) ( - IN struct _EFI_TCP6 *This - ); - -typedef struct _EFI_TCP6 { - EFI_TCP6_GET_MODE_DATA GetModeData; - EFI_TCP6_CONFIGURE Configure; - EFI_TCP6_CONNECT Connect; - EFI_TCP6_ACCEPT Accept; - EFI_TCP6_TRANSMIT Transmit; - EFI_TCP6_RECEIVE Receive; - EFI_TCP6_CLOSE Close; - EFI_TCP6_CANCEL Cancel; - EFI_TCP6_POLL Poll; -} EFI_TCP6; - -#endif /* _EFI_TCP_H */ diff --git a/3rd/gnu-efi/inc/efiudp.h b/3rd/gnu-efi/inc/efiudp.h deleted file mode 100644 index 7c8b467eb..000000000 --- a/3rd/gnu-efi/inc/efiudp.h +++ /dev/null @@ -1,272 +0,0 @@ -#ifndef _EFI_UDP_H -#define _EFI_UDP_H - - -/*++ -Copyright (c) 2013 Intel Corporation - ---*/ - -#define EFI_UDP4_SERVICE_BINDING_PROTOCOL \ - { 0x83f01464, 0x99bd, 0x45e5, {0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6} } - -#define EFI_UDP4_PROTOCOL \ - { 0x3ad9df29, 0x4501, 0x478d, {0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3} } - -#define EFI_UDP6_SERVICE_BINDING_PROTOCOL \ - { 0x66ed4721, 0x3c98, 0x4d3e, {0x81, 0xe3, 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54} } - -#define EFI_UDP6_PROTOCOL \ - { 0x4f948815, 0xb4b9, 0x43cb, {0x8a, 0x33, 0x90, 0xe0, 0x60, 0xb3,0x49, 0x55} } - -INTERFACE_DECL(_EFI_UDP4); -INTERFACE_DECL(_EFI_UDP6); - -typedef struct { - BOOLEAN AcceptBroadcast; - BOOLEAN AcceptPromiscuous; - BOOLEAN AcceptAnyPort; - BOOLEAN AllowDuplicatePort; - UINT8 TypeOfService; - UINT8 TimeToLive; - BOOLEAN DoNotFragment; - UINT32 ReceiveTimeout; - UINT32 TransmitTimeout; - BOOLEAN UseDefaultAddress; - EFI_IPv4_ADDRESS StationAddress; - EFI_IPv4_ADDRESS SubnetMask; - UINT16 StationPort; - EFI_IPv4_ADDRESS RemoteAddress; - UINT16 RemotePort; -} EFI_UDP4_CONFIG_DATA; - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_GET_MODE_DATA) ( - IN struct _EFI_UDP4 *This, - OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL, - 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_UDP4_CONFIGURE) ( - IN struct _EFI_UDP4 *This, - IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_GROUPS) ( - IN struct _EFI_UDP4 *This, - IN BOOLEAN JoinFlag, - IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_ROUTES) ( - IN struct _EFI_UDP4 *This, - IN BOOLEAN DeleteRoute, - IN EFI_IPv4_ADDRESS *SubnetAddress, - IN EFI_IPv4_ADDRESS *SubnetMask, - IN EFI_IPv4_ADDRESS *GatewayAddress - ); - -#define EFI_NETWORK_UNREACHABLE EFIERR(100) -#define EFI_HOST_UNREACHABLE EFIERR(101) -#define EFI_PROTOCOL_UNREACHABLE EFIERR(102) -#define EFI_PORT_UNREACHABLE EFIERR(103) - -typedef struct { - EFI_IPv4_ADDRESS SourceAddress; - UINT16 SourcePort; - EFI_IPv4_ADDRESS DestinationAddress; - UINT16 DestinationPort; -} EFI_UDP4_SESSION_DATA; - -typedef struct { - UINT32 FragmentLength; - VOID *FragmentBuffer; -} EFI_UDP4_FRAGMENT_DATA; - -typedef struct { - EFI_TIME TimeStamp; - EFI_EVENT RecycleSignal; - EFI_UDP4_SESSION_DATA UdpSession; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_UDP4_FRAGMENT_DATA FragmentTable[1]; -} EFI_UDP4_RECEIVE_DATA; - -typedef struct { - EFI_UDP4_SESSION_DATA *UdpSessionData; - EFI_IPv4_ADDRESS *GatewayAddress; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_UDP4_FRAGMENT_DATA FragmentTable[1]; -} EFI_UDP4_TRANSMIT_DATA; - -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; - union { - EFI_UDP4_RECEIVE_DATA *RxData; - EFI_UDP4_TRANSMIT_DATA *TxData; - } Packet; -} EFI_UDP4_COMPLETION_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_TRANSMIT) ( - IN struct _EFI_UDP4 *This, - IN EFI_UDP4_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_RECEIVE) ( - IN struct _EFI_UDP4 *This, - IN EFI_UDP4_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_CANCEL)( - IN struct _EFI_UDP4 *This, - IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_POLL) ( - IN struct _EFI_UDP4 *This - ); - -typedef struct _EFI_UDP4 { - EFI_UDP4_GET_MODE_DATA GetModeData; - EFI_UDP4_CONFIGURE Configure; - EFI_UDP4_GROUPS Groups; - EFI_UDP4_ROUTES Routes; - EFI_UDP4_TRANSMIT Transmit; - EFI_UDP4_RECEIVE Receive; - EFI_UDP4_CANCEL Cancel; - EFI_UDP4_POLL Poll; -} EFI_UDP4; - -typedef struct { - BOOLEAN AcceptPromiscuous; - BOOLEAN AcceptAnyPort; - BOOLEAN AllowDuplicatePort; - UINT8 TrafficClass; - UINT8 HopLimit; - UINT32 ReceiveTimeout; - UINT32 TransmitTimeout; - EFI_IPv6_ADDRESS StationAddress; - UINT16 StationPort; - EFI_IPv6_ADDRESS RemoteAddress; - UINT16 RemotePort; -} EFI_UDP6_CONFIG_DATA; - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_GET_MODE_DATA) ( - IN struct _EFI_UDP6 *This, - OUT EFI_UDP6_CONFIG_DATA *Udp6ConfigData OPTIONAL, - 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_UDP6_CONFIGURE) ( - IN struct _EFI_UDP6 *This, - IN EFI_UDP6_CONFIG_DATA *UdpConfigData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_GROUPS) ( - IN struct _EFI_UDP6 *This, - IN BOOLEAN JoinFlag, - IN EFI_IPv6_ADDRESS *MulticastAddress OPTIONAL - ); - -typedef struct { - EFI_IPv6_ADDRESS SourceAddress; - UINT16 SourcePort; - EFI_IPv6_ADDRESS DestinationAddress; - UINT16 DestinationPort; -} EFI_UDP6_SESSION_DATA; - -typedef struct { - UINT32 FragmentLength; - VOID *FragmentBuffer; -} EFI_UDP6_FRAGMENT_DATA; - -typedef struct { - EFI_TIME TimeStamp; - EFI_EVENT RecycleSignal; - EFI_UDP6_SESSION_DATA UdpSession; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_UDP6_FRAGMENT_DATA FragmentTable[1]; -} EFI_UDP6_RECEIVE_DATA; - -typedef struct { - EFI_UDP6_SESSION_DATA *UdpSessionData; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_UDP6_FRAGMENT_DATA FragmentTable[1]; -} EFI_UDP6_TRANSMIT_DATA; - -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; - union { - EFI_UDP6_RECEIVE_DATA *RxData; - EFI_UDP6_TRANSMIT_DATA *TxData; - } Packet; -} EFI_UDP6_COMPLETION_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_TRANSMIT) ( - IN struct _EFI_UDP6 *This, - IN EFI_UDP6_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_RECEIVE) ( - IN struct _EFI_UDP6 *This, - IN EFI_UDP6_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_CANCEL)( - IN struct _EFI_UDP6 *This, - IN EFI_UDP6_COMPLETION_TOKEN *Token OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_POLL) ( - IN struct _EFI_UDP6 *This - ); - -typedef struct _EFI_UDP6 { - EFI_UDP6_GET_MODE_DATA GetModeData; - EFI_UDP6_CONFIGURE Configure; - EFI_UDP6_GROUPS Groups; - EFI_UDP6_TRANSMIT Transmit; - EFI_UDP6_RECEIVE Receive; - EFI_UDP6_CANCEL Cancel; - EFI_UDP6_POLL Poll; -} EFI_UDP6; - -#endif /* _EFI_UDP_H */ diff --git a/3rd/gnu-efi/inc/efiui.h b/3rd/gnu-efi/inc/efiui.h deleted file mode 100644 index 37569361a..000000000 --- a/3rd/gnu-efi/inc/efiui.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef _EFI_UI_H -#define _EFI_UI_H - -/*++ - -Copyright (c) 200 Intel Corporation - -Module Name: - - EfiUi.h - -Abstract: - Protocol used to build User Interface (UI) stuff. - - This protocol is just data. It is a multi dimentional array. - For each string there is an array of UI_STRING_ENTRY. Each string - is for a different language translation of the same string. The list - is terminated by a NULL UiString. There can be any number of - UI_STRING_ENTRY arrays. A NULL array terminates the list. A NULL array - entry contains all zeros. - - Thus the shortest possible EFI_UI_PROTOCOL has three UI_STRING_ENTRY. - The String, it's NULL terminator, and the NULL terminator for the entire - thing. - - -Revision History - ---*/ - -#define EFI_UI_INTERFACE_PROTOCOL_GUID \ - { 0x32dd7981, 0x2d27, 0x11d4, {0xbc, 0x8b, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } -#define EFI_UI_PROTOCOL EFI_UI_INTERFACE_PROTOCOL_GUID - - -typedef enum { - UiDeviceString, - UiVendorString, - UiMaxString -} UI_STRING_TYPE; - -typedef struct { - ISO_639_2 *LangCode; - CHAR16 *UiString; -} UI_STRING_ENTRY; - -#define EFI_UI_INTERFACE_PROTOCOL_VERSION 0x00010000 -#define EFI_UI_VERSION EFI_UI_INTERFACE_PROTOCOL_VERSION - -typedef struct _EFI_UI_INTERFACE_PROTOCOL { - UINT32 Version; - UI_STRING_ENTRY *Entry; -} EFI_UI_INTERFACE_PROTOCOL; - -typedef struct _EFI_UI_INTERFACE_PROTOCOL _UI_INTERFACE; -typedef EFI_UI_INTERFACE_PROTOCOL UI_INTERFACE; - -#endif diff --git a/3rd/gnu-efi/inc/ia32/efibind.h b/3rd/gnu-efi/inc/ia32/efibind.h deleted file mode 100644 index 718e8d1b1..000000000 --- a/3rd/gnu-efi/inc/ia32/efibind.h +++ /dev/null @@ -1,294 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - efefind.h - -Abstract: - - EFI to compile bindings - - - - -Revision History - ---*/ - -#ifndef __GNUC__ -#pragma pack() -#endif - -// -// Basic int types of various widths -// - -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) && !defined(__cplusplus) - - // No ANSI C 1999/2000 stdint.h integer width declarations - - #if defined(_MSC_EXTENSIONS) - - // Use Microsoft C compiler integer width declarations - - typedef unsigned __int64 uint64_t; - typedef __int64 int64_t; - typedef unsigned __int32 uint32_t; - typedef __int32 int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #elif defined(__GNUC__) - typedef int __attribute__((__mode__(__DI__))) int64_t; - typedef unsigned int __attribute__((__mode__(__DI__))) uint64_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; - #elif defined(UNIX_LP64) - - /* Use LP64 programming model from C_FLAGS for integer width declarations */ - - typedef unsigned long uint64_t; - typedef long int64_t; - typedef unsigned int uint32_t; - typedef int int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #else - - /* Assume P64 programming model from C_FLAGS for integer width declarations */ - - typedef unsigned long long uint64_t __attribute__((aligned (8))); - typedef long long int64_t __attribute__((aligned (8))); - typedef unsigned int uint32_t; - typedef int int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #endif - typedef uint32_t uintptr_t; - typedef int32_t intptr_t; -#elif defined(__GNUC__) - #include -#endif - -// -// Basic EFI types of various widths -// - -#include - -typedef wchar_t CHAR16; -#define WCHAR CHAR16 - - -typedef uint64_t UINT64; -typedef int64_t INT64; - -#ifndef _BASETSD_H_ - typedef uint32_t UINT32; - typedef int32_t INT32; -#endif - -typedef uint16_t UINT16; -typedef int16_t INT16; - -typedef uint8_t UINT8; -typedef char CHAR8; -typedef int8_t INT8; - -#undef VOID -typedef void VOID; - - -typedef int32_t INTN; -typedef uint32_t UINTN; - -#ifdef EFI_NT_EMULATOR - #define POST_CODE(_Data) -#else - #ifdef EFI_DEBUG -#define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al - #else - #define POST_CODE(_Data) - #endif -#endif - -#define EFIERR(a) (0x80000000 | a) -#define EFI_ERROR_MASK 0x80000000 -#define EFIERR_OEM(a) (0xc0000000 | a) - - -#define BAD_POINTER 0xFBFBFBFB -#define MAX_ADDRESS 0xFFFFFFFF - -#ifdef EFI_NT_EMULATOR - #define BREAKPOINT() __asm { int 3 } -#else - #define BREAKPOINT() while (TRUE); // Make it hang on Bios[Dbg]32 -#endif - -// -// 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)) -// -// To export & import functions in the EFI emulator environment -// - -#ifdef EFI_NT_EMULATOR - #define EXPORTAPI __declspec( dllexport ) -#else - #define EXPORTAPI -#endif - - -// -// 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 - #ifdef _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler - #else - #define EFIAPI // Substitute expresion to force C calling convention - #endif -#endif - -#define BOOTSERVICE -//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a -//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a -#define RUNTIMESERVICE -#define RUNTIMEFUNCTION - - -#define RUNTIME_CODE(a) alloc_text("rtcode", a) -#define BEGIN_RUNTIME_DATA() data_seg("rtdata") -#define END_RUNTIME_DATA() data_seg("") - -#define VOLATILE volatile - -#define MEMORY_FENCE() - -#ifdef EFI_NT_EMULATOR - -// -// To help ensure proper coding of integrated drivers, they are -// compiled as DLLs. In NT they require a dll init entry pointer. -// The macro puts a stub entry point into the DLL so it will load. -// - -#define EFI_DRIVER_ENTRY_POINT(InitFunction) \ - UINTN \ - __stdcall \ - _DllMainCRTStartup ( \ - UINTN Inst, \ - UINTN reason_for_call, \ - VOID *rserved \ - ) \ - { \ - return 1; \ - } \ - \ - int \ - EXPORTAPI \ - __cdecl \ - InitializeDriver ( \ - void *ImageHandle, \ - void *SystemTable \ - ) \ - { \ - return InitFunction(ImageHandle, SystemTable); \ - } - - - #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, NULL) - -#else // EFI_NT_EMULATOR - -// -// When 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) - -#endif // EFI_FW_NT - -// -// Some compilers don't support the forward reference construct: -// typedef struct XXXXX -// -// The following macro provide a workaround for such cases. -// -#ifdef NO_INTERFACE_DECL -#define INTERFACE_DECL(x) -#else -#if defined(__GNUC__) || defined(_MSC_EXTENSIONS) -#define INTERFACE_DECL(x) struct x -#else -#define INTERFACE_DECL(x) typedef struct x -#endif -#endif - -/* No efi call wrapper for IA32 architecture */ -#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__) -#define EFI_FUNCTION - -#ifdef _MSC_EXTENSIONS -#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP -#endif - diff --git a/3rd/gnu-efi/inc/ia32/efilibplat.h b/3rd/gnu-efi/inc/ia32/efilibplat.h deleted file mode 100644 index 3844578dd..000000000 --- a/3rd/gnu-efi/inc/ia32/efilibplat.h +++ /dev/null @@ -1,26 +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 - ); - - diff --git a/3rd/gnu-efi/inc/ia32/efisetjmp_arch.h b/3rd/gnu-efi/inc/ia32/efisetjmp_arch.h deleted file mode 100644 index a5c1a81c9..000000000 --- a/3rd/gnu-efi/inc/ia32/efisetjmp_arch.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef GNU_EFI_IA32_SETJMP_H -#define GNU_EFI_IA32_SETJMP_H - -#define JMPBUF_ALIGN 4 - -typedef struct { - UINT32 Ebx; - UINT32 Esi; - UINT32 Edi; - UINT32 Ebp; - UINT32 Esp; - UINT32 Eip; -} ALIGN(JMPBUF_ALIGN) jmp_buf[1]; - -#endif /* GNU_EFI_IA32_SETJMP_H */ diff --git a/3rd/gnu-efi/inc/ia32/pe.h b/3rd/gnu-efi/inc/ia32/pe.h deleted file mode 100644 index 979b9360e..000000000 --- a/3rd/gnu-efi/inc/ia32/pe.h +++ /dev/null @@ -1,595 +0,0 @@ -/* - PE32+ header file - */ -#ifndef _PE_H -#define _PE_H - -#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ -#define IMAGE_OS2_SIGNATURE 0x454E // NE -#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE -#define IMAGE_NT_SIGNATURE 0x00004550 // PE00 -#define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED - - -typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header - UINT16 e_magic; // Magic number - UINT16 e_cblp; // Bytes on last page of file - UINT16 e_cp; // Pages in file - UINT16 e_crlc; // Relocations - UINT16 e_cparhdr; // Size of header in paragraphs - UINT16 e_minalloc; // Minimum extra paragraphs needed - UINT16 e_maxalloc; // Maximum extra paragraphs needed - UINT16 e_ss; // Initial (relative) SS value - UINT16 e_sp; // Initial SP value - UINT16 e_csum; // Checksum - UINT16 e_ip; // Initial IP value - UINT16 e_cs; // Initial (relative) CS value - UINT16 e_lfarlc; // File address of relocation table - UINT16 e_ovno; // Overlay number - UINT16 e_res[4]; // Reserved words - UINT16 e_oemid; // OEM identifier (for e_oeminfo) - UINT16 e_oeminfo; // OEM information; e_oemid specific - UINT16 e_res2[10]; // Reserved words - UINT32 e_lfanew; // File address of new exe header - } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; - -typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header - UINT16 ne_magic; // Magic number - UINT8 ne_ver; // Version number - UINT8 ne_rev; // Revision number - UINT16 ne_enttab; // Offset of Entry Table - UINT16 ne_cbenttab; // Number of bytes in Entry Table - UINT32 ne_crc; // Checksum of whole file - UINT16 ne_flags; // Flag UINT16 - UINT16 ne_autodata; // Automatic data segment number - UINT16 ne_heap; // Initial heap allocation - UINT16 ne_stack; // Initial stack allocation - UINT32 ne_csip; // Initial CS:IP setting - UINT32 ne_sssp; // Initial SS:SP setting - UINT16 ne_cseg; // Count of file segments - UINT16 ne_cmod; // Entries in Module Reference Table - UINT16 ne_cbnrestab; // Size of non-resident name table - UINT16 ne_segtab; // Offset of Segment Table - UINT16 ne_rsrctab; // Offset of Resource Table - UINT16 ne_restab; // Offset of resident name table - UINT16 ne_modtab; // Offset of Module Reference Table - UINT16 ne_imptab; // Offset of Imported Names Table - UINT32 ne_nrestab; // Offset of Non-resident Names Table - UINT16 ne_cmovent; // Count of movable entries - UINT16 ne_align; // Segment alignment shift count - UINT16 ne_cres; // Count of resource segments - UINT8 ne_exetyp; // Target Operating system - UINT8 ne_flagsothers; // Other .EXE flags - UINT16 ne_pretthunks; // offset to return thunks - UINT16 ne_psegrefbytes; // offset to segment ref. bytes - UINT16 ne_swaparea; // Minimum code swap area size - UINT16 ne_expver; // Expected Windows version number - } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; - -// -// File header format. -// - -typedef struct _IMAGE_FILE_HEADER { - UINT16 Machine; - UINT16 NumberOfSections; - UINT32 TimeDateStamp; - UINT32 PointerToSymbolTable; - UINT32 NumberOfSymbols; - UINT16 SizeOfOptionalHeader; - UINT16 Characteristics; -} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; - -#define IMAGE_SIZEOF_FILE_HEADER 20 - -#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file. -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references). -#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file. -#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file. -#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed. -#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine. -#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file -#define IMAGE_FILE_SYSTEM 0x1000 // System File. -#define IMAGE_FILE_DLL 0x2000 // File is a DLL. -#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed. - -#define IMAGE_FILE_MACHINE_UNKNOWN 0 -#define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386. -#define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian -#define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian -#define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP -#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED 0x1c2 // Arm/Thumb -#define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian -#define IMAGE_FILE_MACHINE_IA64 0x200 // IA-64 -#define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine -#define IMAGE_FILE_MACHINE_EBC 0xebc // EFI Byte Code -#define IMAGE_FILE_MACHINE_X64 0x8664 // x86_64 -// -// Directory format. -// - -typedef struct _IMAGE_DATA_DIRECTORY { - UINT32 VirtualAddress; - UINT32 Size; -} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; - -#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 - -// -// Optional header format. -// - -typedef struct _IMAGE_OPTIONAL_HEADER { - // - // Standard fields. - // - - UINT16 Magic; - UINT8 MajorLinkerVersion; - UINT8 MinorLinkerVersion; - UINT32 SizeOfCode; - UINT32 SizeOfInitializedData; - UINT32 SizeOfUninitializedData; - UINT32 AddressOfEntryPoint; - UINT32 BaseOfCode; - UINT32 BaseOfData; - - // - // NT additional fields. - // - - UINT32 ImageBase; - UINT32 SectionAlignment; - UINT32 FileAlignment; - UINT16 MajorOperatingSystemVersion; - UINT16 MinorOperatingSystemVersion; - UINT16 MajorImageVersion; - UINT16 MinorImageVersion; - UINT16 MajorSubsystemVersion; - UINT16 MinorSubsystemVersion; - UINT32 Reserved1; - UINT32 SizeOfImage; - UINT32 SizeOfHeaders; - UINT32 CheckSum; - UINT16 Subsystem; - UINT16 DllCharacteristics; - UINT32 SizeOfStackReserve; - UINT32 SizeOfStackCommit; - UINT32 SizeOfHeapReserve; - UINT32 SizeOfHeapCommit; - UINT32 LoaderFlags; - UINT32 NumberOfRvaAndSizes; - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; -} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; - -typedef struct _IMAGE_ROM_OPTIONAL_HEADER { - UINT16 Magic; - UINT8 MajorLinkerVersion; - UINT8 MinorLinkerVersion; - UINT32 SizeOfCode; - UINT32 SizeOfInitializedData; - UINT32 SizeOfUninitializedData; - UINT32 AddressOfEntryPoint; - UINT32 BaseOfCode; - UINT32 BaseOfData; - UINT32 BaseOfBss; - UINT32 GprMask; - UINT32 CprMask[4]; - UINT32 GpValue; -} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER; - -#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56 -#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 -#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224 - -#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b -#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 - -typedef struct _IMAGE_NT_HEADERS { - UINT32 Signature; - IMAGE_FILE_HEADER FileHeader; - IMAGE_OPTIONAL_HEADER OptionalHeader; -} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; - -typedef struct _IMAGE_ROM_HEADERS { - IMAGE_FILE_HEADER FileHeader; - IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; -} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS; - -#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \ - ((UINT32)ntheader + \ - FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \ - ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \ - )) - - -// Subsystem Values - -#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem. -#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem. -#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem. -#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix character subsystem. - - -// Directory Entries - -#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory -#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory -#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory -#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory -#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory -#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table -#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory -#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String -#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP) -#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory -#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory - -// -// Section header format. -// - -#define IMAGE_SIZEOF_SHORT_NAME 8 - -typedef struct _IMAGE_SECTION_HEADER { - UINT8 Name[IMAGE_SIZEOF_SHORT_NAME]; - union { - UINT32 PhysicalAddress; - UINT32 VirtualSize; - } Misc; - UINT32 VirtualAddress; - UINT32 SizeOfRawData; - UINT32 PointerToRawData; - UINT32 PointerToRelocations; - UINT32 PointerToLinenumbers; - UINT16 NumberOfRelocations; - UINT16 NumberOfLinenumbers; - UINT32 Characteristics; -} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; - -#define IMAGE_SIZEOF_SECTION_HEADER 40 - -#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved. - -#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code. -#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data. -#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data. - -#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved. -#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information. -#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image. -#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat. - -#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 // -#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 // -#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 // -#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 // -#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified. -#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 // -#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 // - -#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded. -#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable. -#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable. -#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable. -#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable. -#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable. -#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable. - -// -// Symbol format. -// - - -#define IMAGE_SIZEOF_SYMBOL 18 - -// -// Section values. -// -// Symbols have a section number of the section in which they are -// defined. Otherwise, section numbers have the following meanings: -// - -#define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is undefined or is common. -#define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an absolute value. -#define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a special debug item. - -// -// Type (fundamental) values. -// - -#define IMAGE_SYM_TYPE_NULL 0 // no type. -#define IMAGE_SYM_TYPE_VOID 1 // -#define IMAGE_SYM_TYPE_CHAR 2 // type character. -#define IMAGE_SYM_TYPE_SHORT 3 // type short integer. -#define IMAGE_SYM_TYPE_INT 4 // -#define IMAGE_SYM_TYPE_LONG 5 // -#define IMAGE_SYM_TYPE_FLOAT 6 // -#define IMAGE_SYM_TYPE_DOUBLE 7 // -#define IMAGE_SYM_TYPE_STRUCT 8 // -#define IMAGE_SYM_TYPE_UNION 9 // -#define IMAGE_SYM_TYPE_ENUM 10 // enumeration. -#define IMAGE_SYM_TYPE_MOE 11 // member of enumeration. -#define IMAGE_SYM_TYPE_BYTE 12 // -#define IMAGE_SYM_TYPE_WORD 13 // -#define IMAGE_SYM_TYPE_UINT 14 // -#define IMAGE_SYM_TYPE_DWORD 15 // - -// -// Type (derived) values. -// - -#define IMAGE_SYM_DTYPE_NULL 0 // no derived type. -#define IMAGE_SYM_DTYPE_POINTER 1 // pointer. -#define IMAGE_SYM_DTYPE_FUNCTION 2 // function. -#define IMAGE_SYM_DTYPE_ARRAY 3 // array. - -// -// Storage classes. -// - -#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1 -#define IMAGE_SYM_CLASS_NULL 0 -#define IMAGE_SYM_CLASS_AUTOMATIC 1 -#define IMAGE_SYM_CLASS_EXTERNAL 2 -#define IMAGE_SYM_CLASS_STATIC 3 -#define IMAGE_SYM_CLASS_REGISTER 4 -#define IMAGE_SYM_CLASS_EXTERNAL_DEF 5 -#define IMAGE_SYM_CLASS_LABEL 6 -#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7 -#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8 -#define IMAGE_SYM_CLASS_ARGUMENT 9 -#define IMAGE_SYM_CLASS_STRUCT_TAG 10 -#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11 -#define IMAGE_SYM_CLASS_UNION_TAG 12 -#define IMAGE_SYM_CLASS_TYPE_DEFINITION 13 -#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14 -#define IMAGE_SYM_CLASS_ENUM_TAG 15 -#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16 -#define IMAGE_SYM_CLASS_REGISTER_PARAM 17 -#define IMAGE_SYM_CLASS_BIT_FIELD 18 -#define IMAGE_SYM_CLASS_BLOCK 100 -#define IMAGE_SYM_CLASS_FUNCTION 101 -#define IMAGE_SYM_CLASS_END_OF_STRUCT 102 -#define IMAGE_SYM_CLASS_FILE 103 -// new -#define IMAGE_SYM_CLASS_SECTION 104 -#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105 - -// type packing constants - -#define N_BTMASK 017 -#define N_TMASK 060 -#define N_TMASK1 0300 -#define N_TMASK2 0360 -#define N_BTSHFT 4 -#define N_TSHIFT 2 - -// MACROS - -// -// Communal selection types. -// - -#define IMAGE_COMDAT_SELECT_NODUPLICATES 1 -#define IMAGE_COMDAT_SELECT_ANY 2 -#define IMAGE_COMDAT_SELECT_SAME_SIZE 3 -#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 -#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 - -#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 -#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 -#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 - - -// -// Relocation format. -// - -typedef struct _IMAGE_RELOCATION { - UINT32 VirtualAddress; - UINT32 SymbolTableIndex; - UINT16 Type; -} IMAGE_RELOCATION; - -#define IMAGE_SIZEOF_RELOCATION 10 - -// -// I386 relocation types. -// - -#define IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included -#define IMAGE_REL_I386_SEG12 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address -#define IMAGE_REL_I386_SECTION 012 -#define IMAGE_REL_I386_SECREL 013 -#define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address - -// -// MIPS relocation types. -// - -#define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_MIPS_REFHALF 01 -#define IMAGE_REL_MIPS_REFWORD 02 -#define IMAGE_REL_MIPS_JMPADDR 03 -#define IMAGE_REL_MIPS_REFHI 04 -#define IMAGE_REL_MIPS_REFLO 05 -#define IMAGE_REL_MIPS_GPREL 06 -#define IMAGE_REL_MIPS_LITERAL 07 -#define IMAGE_REL_MIPS_SECTION 012 -#define IMAGE_REL_MIPS_SECREL 013 -#define IMAGE_REL_MIPS_REFWORDNB 042 -#define IMAGE_REL_MIPS_PAIR 045 - -// -// Alpha Relocation types. -// - -#define IMAGE_REL_ALPHA_ABSOLUTE 0x0 -#define IMAGE_REL_ALPHA_REFLONG 0x1 -#define IMAGE_REL_ALPHA_REFQUAD 0x2 -#define IMAGE_REL_ALPHA_GPREL32 0x3 -#define IMAGE_REL_ALPHA_LITERAL 0x4 -#define IMAGE_REL_ALPHA_LITUSE 0x5 -#define IMAGE_REL_ALPHA_GPDISP 0x6 -#define IMAGE_REL_ALPHA_BRADDR 0x7 -#define IMAGE_REL_ALPHA_HINT 0x8 -#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9 -#define IMAGE_REL_ALPHA_REFHI 0xA -#define IMAGE_REL_ALPHA_REFLO 0xB -#define IMAGE_REL_ALPHA_PAIR 0xC -#define IMAGE_REL_ALPHA_MATCH 0xD -#define IMAGE_REL_ALPHA_SECTION 0xE -#define IMAGE_REL_ALPHA_SECREL 0xF -#define IMAGE_REL_ALPHA_REFLONGNB 0x10 - -// -// IBM PowerPC relocation types. -// - -#define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP -#define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address -#define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address -#define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2 (branch absolute) -#define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address -#define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load doubleword) -#define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted left 2 (branch relative) -#define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted left 2 (br cond relative) -#define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base -#define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted left 2 (load doubleword) - -#define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base -#define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an image sectionhdr) -#define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number -#define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction iff symbol is glue code -#define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address is TOC restore instruction - -#define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in IMAGE_RELOCATION.Type - -// Flag bits in IMAGE_RELOCATION.TYPE - -#define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than adding it -#define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict branch taken -#define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict branch not taken -#define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data in toc) - -// -// Based relocation format. -// - -typedef struct _IMAGE_BASE_RELOCATION { - UINT32 VirtualAddress; - UINT32 SizeOfBlock; -// UINT16 TypeOffset[1]; -} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION; - -#define IMAGE_SIZEOF_BASE_RELOCATION 8 - -// -// Based relocation types. -// - -#define IMAGE_REL_BASED_ABSOLUTE 0 -#define IMAGE_REL_BASED_HIGH 1 -#define IMAGE_REL_BASED_LOW 2 -#define IMAGE_REL_BASED_HIGHLOW 3 -#define IMAGE_REL_BASED_HIGHADJ 4 -#define IMAGE_REL_BASED_MIPS_JMPADDR 5 -#define IMAGE_REL_BASED_IA64_IMM64 9 -#define IMAGE_REL_BASED_DIR64 10 - -// -// Line number format. -// - -typedef struct _IMAGE_LINENUMBER { - union { - UINT32 SymbolTableIndex; // Symbol table index of function name if Linenumber is 0. - UINT32 VirtualAddress; // Virtual address of line number. - } Type; - UINT16 Linenumber; // Line number. -} IMAGE_LINENUMBER; - -#define IMAGE_SIZEOF_LINENUMBER 6 - -// -// Archive format. -// - -#define IMAGE_ARCHIVE_START_SIZE 8 -#define IMAGE_ARCHIVE_START "!\n" -#define IMAGE_ARCHIVE_END "`\n" -#define IMAGE_ARCHIVE_PAD "\n" -#define IMAGE_ARCHIVE_LINKER_MEMBER "/ " -#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " - -typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { - UINT8 Name[16]; // File member name - `/' terminated. - UINT8 Date[12]; // File member date - decimal. - UINT8 UserID[6]; // File member user id - decimal. - UINT8 GroupID[6]; // File member group id - decimal. - UINT8 Mode[8]; // File member mode - octal. - UINT8 Size[10]; // File member size - decimal. - UINT8 EndHeader[2]; // String to end header. -} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; - -#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 - -// -// DLL support. -// - -// -// Export Format -// - -typedef struct _IMAGE_EXPORT_DIRECTORY { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT16 MajorVersion; - UINT16 MinorVersion; - UINT32 Name; - UINT32 Base; - UINT32 NumberOfFunctions; - UINT32 NumberOfNames; - UINT32 *AddressOfFunctions; - UINT32 *AddressOfNames; - UINT32 *AddressOfNameOrdinals; -} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; - -// -// Import Format -// - -typedef struct _IMAGE_IMPORT_BY_NAME { - UINT16 Hint; - UINT8 Name[1]; -} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; - -typedef struct _IMAGE_THUNK_DATA { - union { - UINT32 Function; - UINT32 Ordinal; - PIMAGE_IMPORT_BY_NAME AddressOfData; - } u1; -} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA; - -#define IMAGE_ORDINAL_FLAG 0x80000000 -#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0) -#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff) - -typedef struct _IMAGE_IMPORT_DESCRIPTOR { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT32 ForwarderChain; - UINT32 Name; - PIMAGE_THUNK_DATA FirstThunk; -} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR; - -#endif diff --git a/3rd/gnu-efi/inc/ia64/efibind.h b/3rd/gnu-efi/inc/ia64/efibind.h deleted file mode 100644 index 1d2745b02..000000000 --- a/3rd/gnu-efi/inc/ia64/efibind.h +++ /dev/null @@ -1,236 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - efefind.h - -Abstract: - - EFI to compile bindings - - - - -Revision History - ---*/ - -#pragma pack() - - -// -// Basic int types of various widths -// - -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) && !defined(__cplusplus) - - // No ANSI C 1999/2000 stdint.h integer width declarations - - #ifdef _MSC_EXTENSIONS - // Use Microsoft C compiler integer width declarations - - typedef unsigned __int64 uint64_t; - typedef __int64 int64_t; - typedef unsigned __int32 uint32_t; - typedef __int32 int32_t; - typedef unsigned __int16 uint16_t; - typedef __int16 int16_t; - typedef unsigned __int8 uint8_t; - typedef __int8 int8_t; - #elif defined(UNIX_LP64) - // Use LP64 programming model from C_FLAGS for integer width declarations - - typedef unsigned long uint64_t; - typedef long int64_t; - typedef unsigned int uint32_t; - typedef int int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #else - // Assume P64 programming model from C_FLAGS for integer width declarations - - typedef unsigned long long uint64_t; - typedef long long int64_t; - typedef unsigned int uint32_t; - typedef int int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #endif - typedef uint64_t uintptr_t; - typedef int64_t intptr_t; -#elif defined(__GNUC__) - #include -#endif - -// -// Basic EFI types of various widths -// - -#include - -typedef wchar_t CHAR16; -#define WCHAR CHAR16 - -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 char CHAR8; -typedef int8_t INT8; - -#undef VOID -typedef void VOID; - - -typedef int64_t INTN; -typedef uint64_t UINTN; - -//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// BugBug: Code to debug -// -#define BIT63 0x8000000000000000 - -#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63) -#define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) ) - -// -// Macro's with casts make this much easier to use and read. -// -#define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port))) -#define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data)) -// -// BugBug: End Debug Code!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#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) - -// -// Pointers must be aligned to these address to function -// you will get an alignment fault if this value is less than 8 -// -#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 create data structure signatures. -// - -#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)) -// -// To export & import functions in the EFI emulator environment -// - - #define EXPORTAPI - -// -// 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 - #ifdef _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler - #else - #define EFIAPI // Substitute expresion to force C calling convention - #endif -#endif - -#define BOOTSERVICE -#define RUNTIMESERVICE -#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 - -// -// BugBug: Need to find out if this is portable accross compliers. -// -#ifdef __GNUC__ -#define MEMORY_FENCE() __asm__ __volatile__ ("mf.a" ::: "memory") -#else -void __mf (void); -#pragma intrinsic (__mf) -#define MEMORY_FENCE() __mf() -#endif - -// -// 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. -// -#ifdef NO_INTERFACE_DECL -#define INTERFACE_DECL(x) -#else -#if defined(__GNUC__) || defined(_MSC_EXTENSIONS) -#define INTERFACE_DECL(x) struct x -#else -#define INTERFACE_DECL(x) typedef struct x -#endif -#endif - -/* No efi call wrapper for IA32 architecture */ -#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__) -#define EFI_FUNCTION diff --git a/3rd/gnu-efi/inc/ia64/efilibplat.h b/3rd/gnu-efi/inc/ia64/efilibplat.h deleted file mode 100644 index f07be3f89..000000000 --- a/3rd/gnu-efi/inc/ia64/efilibplat.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef _EFI_LIB_PLAT_H -#define _EFI_LIB_PLAT_H -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - efilibplat.h - -Abstract: - - EFI to compile bindings - - - -Revision History - ---*/ - -#include "salproc.h" - - -VOID -InitializeLibPlatform ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -VOID -LibInitSalAndPalProc( - OUT PLABEL *SalPlabel, - OUT UINT64 *PalEntry - ); - -EFI_STATUS -LibGetSalIoPortMapping ( - OUT UINT64 *IoPortMapping - ); - -EFI_STATUS -LibGetSalIpiBlock ( - OUT UINT64 *IpiBlock - ); - -EFI_STATUS -LibGetSalWakeupVector ( - OUT UINT64 *WakeVector - ); - -VOID * -LibSearchSalSystemTable ( - IN UINT8 EntryType - ); - - -VOID -LibSalProc ( - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4, - IN UINT64 Arg5, - IN UINT64 Arg6, - IN UINT64 Arg7, - IN UINT64 Arg8, - OUT rArg *Results OPTIONAL - ); - -VOID -LibPalProc ( - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4, - OUT rArg *Results OPTIONAL - ); - -#endif - diff --git a/3rd/gnu-efi/inc/ia64/efisetjmp_arch.h b/3rd/gnu-efi/inc/ia64/efisetjmp_arch.h deleted file mode 100644 index ceda4481d..000000000 --- a/3rd/gnu-efi/inc/ia64/efisetjmp_arch.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef GNU_EFI_IA64_SETJMP_H -#define GNU_EFI_IA64_SETJMP_H - -#define JMPBUF_ALIGN 0x10 - -typedef struct { - UINT64 F2[2]; - UINT64 F3[2]; - UINT64 F4[2]; - UINT64 F5[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 R4; - UINT64 R5; - UINT64 R6; - UINT64 R7; - UINT64 SP; - UINT64 BR0; - UINT64 BR1; - UINT64 BR2; - UINT64 BR3; - UINT64 BR4; - UINT64 BR5; - UINT64 InitialUNAT; - UINT64 AfterSpillUNAT; - UINT64 PFS; - UINT64 BSP; - UINT64 Predicates; - UINT64 LoopCount; - UINT64 FPSR; -} ALIGN(JMPBUF_ALIGN) jmp_buf[1]; - -#endif /* GNU_EFI_IA64_SETJMP_H */ diff --git a/3rd/gnu-efi/inc/ia64/pe.h b/3rd/gnu-efi/inc/ia64/pe.h deleted file mode 100644 index b1cade205..000000000 --- a/3rd/gnu-efi/inc/ia64/pe.h +++ /dev/null @@ -1,601 +0,0 @@ -/* - PE32+ header file - */ -#ifndef _PE_H -#define _PE_H - -#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ -#define IMAGE_OS2_SIGNATURE 0x454E // NE -#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE -#define IMAGE_NT_SIGNATURE 0x00004550 // PE00 -#define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED - -/***************************************************************************** - * The following stuff comes from winnt.h from the ia64sdk, plus the Plabel for - * loading EM executables. - *****************************************************************************/ -// -// Intel IA64 specific -// - -#define IMAGE_REL_BASED_IA64_IMM64 9 -#define IMAGE_REL_BASED_IA64_DIR64 10 - -struct Plabel { - UINT64 EntryPoint; - UINT64 NewGP; -}; - -typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header - UINT16 e_magic; // Magic number - UINT16 e_cblp; // Bytes on last page of file - UINT16 e_cp; // Pages in file - UINT16 e_crlc; // Relocations - UINT16 e_cparhdr; // Size of header in paragraphs - UINT16 e_minalloc; // Minimum extra paragraphs needed - UINT16 e_maxalloc; // Maximum extra paragraphs needed - UINT16 e_ss; // Initial (relative) SS value - UINT16 e_sp; // Initial SP value - UINT16 e_csum; // Checksum - UINT16 e_ip; // Initial IP value - UINT16 e_cs; // Initial (relative) CS value - UINT16 e_lfarlc; // File address of relocation table - UINT16 e_ovno; // Overlay number - UINT16 e_res[4]; // Reserved words - UINT16 e_oemid; // OEM identifier (for e_oeminfo) - UINT16 e_oeminfo; // OEM information; e_oemid specific - UINT16 e_res2[10]; // Reserved words - UINT32 e_lfanew; // File address of new exe header - } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; - -typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header - UINT16 ne_magic; // Magic number - UINT8 ne_ver; // Version number - UINT8 ne_rev; // Revision number - UINT16 ne_enttab; // Offset of Entry Table - UINT16 ne_cbenttab; // Number of bytes in Entry Table - UINT32 ne_crc; // Checksum of whole file - UINT16 ne_flags; // Flag UINT16 - UINT16 ne_autodata; // Automatic data segment number - UINT16 ne_heap; // Initial heap allocation - UINT16 ne_stack; // Initial stack allocation - UINT32 ne_csip; // Initial CS:IP setting - UINT32 ne_sssp; // Initial SS:SP setting - UINT16 ne_cseg; // Count of file segments - UINT16 ne_cmod; // Entries in Module Reference Table - UINT16 ne_cbnrestab; // Size of non-resident name table - UINT16 ne_segtab; // Offset of Segment Table - UINT16 ne_rsrctab; // Offset of Resource Table - UINT16 ne_restab; // Offset of resident name table - UINT16 ne_modtab; // Offset of Module Reference Table - UINT16 ne_imptab; // Offset of Imported Names Table - UINT32 ne_nrestab; // Offset of Non-resident Names Table - UINT16 ne_cmovent; // Count of movable entries - UINT16 ne_align; // Segment alignment shift count - UINT16 ne_cres; // Count of resource segments - UINT8 ne_exetyp; // Target Operating system - UINT8 ne_flagsothers; // Other .EXE flags - UINT16 ne_pretthunks; // offset to return thunks - UINT16 ne_psegrefbytes; // offset to segment ref. bytes - UINT16 ne_swaparea; // Minimum code swap area size - UINT16 ne_expver; // Expected Windows version number - } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; - -// -// File header format. -// - -typedef struct _IMAGE_FILE_HEADER { - UINT16 Machine; - UINT16 NumberOfSections; - UINT32 TimeDateStamp; - UINT32 PointerToSymbolTable; - UINT32 NumberOfSymbols; - UINT16 SizeOfOptionalHeader; - UINT16 Characteristics; -} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; - -#define IMAGE_SIZEOF_FILE_HEADER 20 - -#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file. -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references). -#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file. -#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file. -#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed. -#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine. -#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file -#define IMAGE_FILE_SYSTEM 0x1000 // System File. -#define IMAGE_FILE_DLL 0x2000 // File is a DLL. -#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed. - -#define IMAGE_FILE_MACHINE_UNKNOWN 0 -#define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386. -#define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian -#define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian -#define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP -#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED 0x1c2 // Arm/Thumb -#define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian -#define IMAGE_FILE_MACHINE_IA64 0x200 // IA-64 -#define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine -#define IMAGE_FILE_MACHINE_EBC 0xebc // EFI Byte Code -#define IMAGE_FILE_MACHINE_X64 0x8664 // x86_64 -// -// Directory format. -// - -typedef struct _IMAGE_DATA_DIRECTORY { - UINT32 VirtualAddress; - UINT32 Size; -} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; - -#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 - - -typedef struct _IMAGE_ROM_OPTIONAL_HEADER { - UINT16 Magic; - UINT8 MajorLinkerVersion; - UINT8 MinorLinkerVersion; - UINT32 SizeOfCode; - UINT32 SizeOfInitializedData; - UINT32 SizeOfUninitializedData; - UINT32 AddressOfEntryPoint; - UINT32 BaseOfCode; - UINT32 BaseOfData; - UINT32 BaseOfBss; - UINT32 GprMask; - UINT32 CprMask[4]; - UINT32 GpValue; -} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER; - -typedef struct _IMAGE_OPTIONAL_HEADER { - UINT16 Magic; - UINT8 MajorLinkerVersion; - UINT8 MinorLinkerVersion; - UINT32 SizeOfCode; - UINT32 SizeOfInitializedData; - UINT32 SizeOfUninitializedData; - UINT32 AddressOfEntryPoint; - UINT32 BaseOfCode; - // UINT32 BaseOfData; - UINT64 ImageBase; - UINT32 SectionAlignment; - UINT32 FileAlignment; - UINT16 MajorOperatingSystemVersion; - UINT16 MinorOperatingSystemVersion; - UINT16 MajorImageVersion; - UINT16 MinorImageVersion; - UINT16 MajorSubsystemVersion; - UINT16 MinorSubsystemVersion; - UINT32 Win32VersionValue; - UINT32 SizeOfImage; - UINT32 SizeOfHeaders; - UINT32 CheckSum; - UINT16 Subsystem; - UINT16 DllCharacteristics; - UINT64 SizeOfStackReserve; - UINT64 SizeOfStackCommit; - UINT64 SizeOfHeapReserve; - UINT64 SizeOfHeapCommit; - UINT32 LoaderFlags; - UINT32 NumberOfRvaAndSizes; - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; -} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; - - -#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56 -#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 -#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224 -#define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 244 - -#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b -#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b -#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 - -typedef struct _IMAGE_NT_HEADERS { - UINT32 Signature; - IMAGE_FILE_HEADER FileHeader; - IMAGE_OPTIONAL_HEADER OptionalHeader; -} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; - -typedef struct _IMAGE_ROM_HEADERS { - IMAGE_FILE_HEADER FileHeader; - IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; -} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS; - -#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \ - ((UINT32)ntheader + \ - FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \ - ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \ - )) - - -// Subsystem Values - -#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem. -#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem. -#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem. -#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix character subsystem. - - -// Directory Entries - -#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory -#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory -#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory -#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory -#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory -#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table -#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory -#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String -#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP) -#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory -#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory - -// -// Section header format. -// - -#define IMAGE_SIZEOF_SHORT_NAME 8 - -typedef struct _IMAGE_SECTION_HEADER { - UINT8 Name[IMAGE_SIZEOF_SHORT_NAME]; - union { - UINT32 PhysicalAddress; - UINT32 VirtualSize; - } Misc; - UINT32 VirtualAddress; - UINT32 SizeOfRawData; - UINT32 PointerToRawData; - UINT32 PointerToRelocations; - UINT32 PointerToLinenumbers; - UINT16 NumberOfRelocations; - UINT16 NumberOfLinenumbers; - UINT32 Characteristics; -} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; - -#define IMAGE_SIZEOF_SECTION_HEADER 40 - -#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved. - -#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code. -#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data. -#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data. - -#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved. -#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information. -#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image. -#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat. - -#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 // -#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 // -#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 // -#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 // -#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified. -#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 // -#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 // - -#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded. -#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable. -#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable. -#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable. -#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable. -#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable. -#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable. - -// -// Symbol format. -// - - -#define IMAGE_SIZEOF_SYMBOL 18 - -// -// Section values. -// -// Symbols have a section number of the section in which they are -// defined. Otherwise, section numbers have the following meanings: -// - -#define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is undefined or is common. -#define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an absolute value. -#define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a special debug item. - -// -// Type (fundamental) values. -// - -#define IMAGE_SYM_TYPE_NULL 0 // no type. -#define IMAGE_SYM_TYPE_VOID 1 // -#define IMAGE_SYM_TYPE_CHAR 2 // type character. -#define IMAGE_SYM_TYPE_SHORT 3 // type short integer. -#define IMAGE_SYM_TYPE_INT 4 // -#define IMAGE_SYM_TYPE_LONG 5 // -#define IMAGE_SYM_TYPE_FLOAT 6 // -#define IMAGE_SYM_TYPE_DOUBLE 7 // -#define IMAGE_SYM_TYPE_STRUCT 8 // -#define IMAGE_SYM_TYPE_UNION 9 // -#define IMAGE_SYM_TYPE_ENUM 10 // enumeration. -#define IMAGE_SYM_TYPE_MOE 11 // member of enumeration. -#define IMAGE_SYM_TYPE_BYTE 12 // -#define IMAGE_SYM_TYPE_WORD 13 // -#define IMAGE_SYM_TYPE_UINT 14 // -#define IMAGE_SYM_TYPE_DWORD 15 // - -// -// Type (derived) values. -// - -#define IMAGE_SYM_DTYPE_NULL 0 // no derived type. -#define IMAGE_SYM_DTYPE_POINTER 1 // pointer. -#define IMAGE_SYM_DTYPE_FUNCTION 2 // function. -#define IMAGE_SYM_DTYPE_ARRAY 3 // array. - -// -// Storage classes. -// - -#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1 -#define IMAGE_SYM_CLASS_NULL 0 -#define IMAGE_SYM_CLASS_AUTOMATIC 1 -#define IMAGE_SYM_CLASS_EXTERNAL 2 -#define IMAGE_SYM_CLASS_STATIC 3 -#define IMAGE_SYM_CLASS_REGISTER 4 -#define IMAGE_SYM_CLASS_EXTERNAL_DEF 5 -#define IMAGE_SYM_CLASS_LABEL 6 -#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7 -#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8 -#define IMAGE_SYM_CLASS_ARGUMENT 9 -#define IMAGE_SYM_CLASS_STRUCT_TAG 10 -#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11 -#define IMAGE_SYM_CLASS_UNION_TAG 12 -#define IMAGE_SYM_CLASS_TYPE_DEFINITION 13 -#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14 -#define IMAGE_SYM_CLASS_ENUM_TAG 15 -#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16 -#define IMAGE_SYM_CLASS_REGISTER_PARAM 17 -#define IMAGE_SYM_CLASS_BIT_FIELD 18 -#define IMAGE_SYM_CLASS_BLOCK 100 -#define IMAGE_SYM_CLASS_FUNCTION 101 -#define IMAGE_SYM_CLASS_END_OF_STRUCT 102 -#define IMAGE_SYM_CLASS_FILE 103 -// new -#define IMAGE_SYM_CLASS_SECTION 104 -#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105 - -// type packing constants - -#define N_BTMASK 017 -#define N_TMASK 060 -#define N_TMASK1 0300 -#define N_TMASK2 0360 -#define N_BTSHFT 4 -#define N_TSHIFT 2 - -// MACROS - -// -// Communal selection types. -// - -#define IMAGE_COMDAT_SELECT_NODUPLICATES 1 -#define IMAGE_COMDAT_SELECT_ANY 2 -#define IMAGE_COMDAT_SELECT_SAME_SIZE 3 -#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 -#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 - -#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 -#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 -#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 - - -// -// Relocation format. -// - -typedef struct _IMAGE_RELOCATION { - UINT32 VirtualAddress; - UINT32 SymbolTableIndex; - UINT16 Type; -} IMAGE_RELOCATION; - -#define IMAGE_SIZEOF_RELOCATION 10 - -// -// I386 relocation types. -// - -#define IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included -#define IMAGE_REL_I386_SEG12 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address -#define IMAGE_REL_I386_SECTION 012 -#define IMAGE_REL_I386_SECREL 013 -#define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address - -// -// MIPS relocation types. -// - -#define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_MIPS_REFHALF 01 -#define IMAGE_REL_MIPS_REFWORD 02 -#define IMAGE_REL_MIPS_JMPADDR 03 -#define IMAGE_REL_MIPS_REFHI 04 -#define IMAGE_REL_MIPS_REFLO 05 -#define IMAGE_REL_MIPS_GPREL 06 -#define IMAGE_REL_MIPS_LITERAL 07 -#define IMAGE_REL_MIPS_SECTION 012 -#define IMAGE_REL_MIPS_SECREL 013 -#define IMAGE_REL_MIPS_REFWORDNB 042 -#define IMAGE_REL_MIPS_PAIR 045 - -// -// Alpha Relocation types. -// - -#define IMAGE_REL_ALPHA_ABSOLUTE 0x0 -#define IMAGE_REL_ALPHA_REFLONG 0x1 -#define IMAGE_REL_ALPHA_REFQUAD 0x2 -#define IMAGE_REL_ALPHA_GPREL32 0x3 -#define IMAGE_REL_ALPHA_LITERAL 0x4 -#define IMAGE_REL_ALPHA_LITUSE 0x5 -#define IMAGE_REL_ALPHA_GPDISP 0x6 -#define IMAGE_REL_ALPHA_BRADDR 0x7 -#define IMAGE_REL_ALPHA_HINT 0x8 -#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9 -#define IMAGE_REL_ALPHA_REFHI 0xA -#define IMAGE_REL_ALPHA_REFLO 0xB -#define IMAGE_REL_ALPHA_PAIR 0xC -#define IMAGE_REL_ALPHA_MATCH 0xD -#define IMAGE_REL_ALPHA_SECTION 0xE -#define IMAGE_REL_ALPHA_SECREL 0xF -#define IMAGE_REL_ALPHA_REFLONGNB 0x10 - -// -// IBM PowerPC relocation types. -// - -#define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP -#define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address -#define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address -#define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2 (branch absolute) -#define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address -#define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load doubleword) -#define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted left 2 (branch relative) -#define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted left 2 (br cond relative) -#define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base -#define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted left 2 (load doubleword) - -#define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base -#define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an image sectionhdr) -#define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number -#define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction iff symbol is glue code -#define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address is TOC restore instruction - -#define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in IMAGE_RELOCATION.Type - -// Flag bits in IMAGE_RELOCATION.TYPE - -#define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than adding it -#define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict branch taken -#define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict branch not taken -#define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data in toc) - -// -// Based relocation format. -// - -typedef struct _IMAGE_BASE_RELOCATION { - UINT32 VirtualAddress; - UINT32 SizeOfBlock; -// UINT16 TypeOffset[1]; -} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION; - -#define IMAGE_SIZEOF_BASE_RELOCATION 8 - -// -// Based relocation types. -// - -#define IMAGE_REL_BASED_ABSOLUTE 0 -#define IMAGE_REL_BASED_HIGH 1 -#define IMAGE_REL_BASED_LOW 2 -#define IMAGE_REL_BASED_HIGHLOW 3 -#define IMAGE_REL_BASED_HIGHADJ 4 -#define IMAGE_REL_BASED_MIPS_JMPADDR 5 -#define IMAGE_REL_BASED_IA64_IMM64 9 -#define IMAGE_REL_BASED_DIR64 10 - -// -// Line number format. -// - -typedef struct _IMAGE_LINENUMBER { - union { - UINT32 SymbolTableIndex; // Symbol table index of function name if Linenumber is 0. - UINT32 VirtualAddress; // Virtual address of line number. - } Type; - UINT16 Linenumber; // Line number. -} IMAGE_LINENUMBER; - -#define IMAGE_SIZEOF_LINENUMBER 6 - -// -// Archive format. -// - -#define IMAGE_ARCHIVE_START_SIZE 8 -#define IMAGE_ARCHIVE_START "!\n" -#define IMAGE_ARCHIVE_END "`\n" -#define IMAGE_ARCHIVE_PAD "\n" -#define IMAGE_ARCHIVE_LINKER_MEMBER "/ " -#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " - -typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { - UINT8 Name[16]; // File member name - `/' terminated. - UINT8 Date[12]; // File member date - decimal. - UINT8 UserID[6]; // File member user id - decimal. - UINT8 GroupID[6]; // File member group id - decimal. - UINT8 Mode[8]; // File member mode - octal. - UINT8 Size[10]; // File member size - decimal. - UINT8 EndHeader[2]; // String to end header. -} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; - -#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 - -// -// DLL support. -// - -// -// Export Format -// - -typedef struct _IMAGE_EXPORT_DIRECTORY { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT16 MajorVersion; - UINT16 MinorVersion; - UINT32 Name; - UINT32 Base; - UINT32 NumberOfFunctions; - UINT32 NumberOfNames; - UINT32 AddressOfFunctions; - UINT32 AddressOfNames; - UINT32 AddressOfNameOrdinals; -} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; - -// -// Import Format -// - -typedef struct _IMAGE_IMPORT_BY_NAME { - UINT16 Hint; - UINT8 Name[1]; -} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; - -typedef struct _IMAGE_THUNK_DATA { - union { - UINT32 Function; - UINT32 Ordinal; - PIMAGE_IMPORT_BY_NAME AddressOfData; - } u1; -} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA; - -#define IMAGE_ORDINAL_FLAG 0x80000000 -#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0) -#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff) - -typedef struct _IMAGE_IMPORT_DESCRIPTOR { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT32 ForwarderChain; - UINT32 Name; - PIMAGE_THUNK_DATA FirstThunk; -} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR; - -#endif diff --git a/3rd/gnu-efi/inc/ia64/salproc.h b/3rd/gnu-efi/inc/ia64/salproc.h deleted file mode 100644 index 62a5dca6d..000000000 --- a/3rd/gnu-efi/inc/ia64/salproc.h +++ /dev/null @@ -1,264 +0,0 @@ -#ifndef _SAL_PROC_H -#define _SAL_PROC_H -// -// -//Copyright (c) 1999 Intel Corporation -// -//Module Name: -// -// SalProc.h -// -//Abstract: -// -// Main SAL interface routins for IA-64 calls. -// -// -//Revision History -// -// - -// return value that mimicks r8,r9,r10 & r11 registers -typedef struct { - UINT64 p0; - UINT64 p1; - UINT64 p2; - UINT64 p3; -} rArg; - -#define SAL_PCI_CONFIG_READ 0x01000010 -#define SAL_PCI_CONFIG_WRITE 0x01000011 - -typedef VOID (*PFN)(); -typedef rArg (*PFN_SAL_PROC)(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64); -typedef rArg (*PFN_SAL_CALLBACK)(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64); - -typedef struct _PLABEL { - UINT64 ProcEntryPoint; - UINT64 GP; -} PLABEL; - -typedef struct tagIA32_BIOS_REGISTER_STATE { - - // general registers - UINT32 eax; - UINT32 ecx; - UINT32 edx; - UINT32 ebx; - - // stack registers - UINT32 esp; - UINT32 ebp; - UINT32 esi; - UINT32 edi; - - // eflags - UINT32 eflags; - - // instruction pointer - UINT32 eip; - - UINT16 cs; - UINT16 ds; - UINT16 es; - UINT16 fs; - UINT16 gs; - UINT16 ss; - - // Reserved - UINT32 Reserved1; - UINT64 Reserved2; -} IA32_BIOS_REGISTER_STATE; - -VOID EFIInitMsg(VOID); - -EFI_STATUS -PlRegisterAndStartTimer( - IN UINTN Period - ); - -EFI_STATUS -PlDeRegisterAndCancelTimer(VOID); - -VOID -SalProc ( - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4, - IN UINT64 Arg5, - IN UINT64 Arg6, - IN UINT64 Arg7, - IN UINT64 Arg8, - OUT rArg *Results OPTIONAL - ); - -VOID -SalCallBack ( - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4, - IN UINT64 Arg5, - IN UINT64 Arg6, - IN UINT64 Arg7, - IN UINT64 Arg8, - OUT rArg *Results OPTIONAL - ); - -VOID -RUNTIMEFUNCTION -RtSalCallBack ( - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4, - IN UINT64 Arg5, - IN UINT64 Arg6, - IN UINT64 Arg7, - IN UINT64 Arg8, - OUT rArg *Results OPTIONAL - ); - - -extern PLABEL RtGlobalSalProcEntry; -extern PLABEL RtGlobalSALCallBack; - -#pragma pack(1) -// -// SAL System Table -// -typedef struct { - UINT32 Signature; - UINT32 Length; - UINT16 Revision; - UINT16 EntryCount; - UINT8 CheckSum; - UINT8 Reserved[7]; - UINT16 SALA_Ver; - UINT16 SALB_Ver; - UINT8 OemId[32]; - UINT8 ProductID[32]; - UINT8 Reserved2[8]; -} SAL_SYSTEM_TABLE_HDR; - -#define SAL_ST_ENTRY_POINT 0 -#define SAL_ST_MEMORY_DESCRIPTOR 1 -#define SAL_ST_PLATFORM_FEATURES 2 -#define SAL_ST_TR_USAGE 3 -#define SAL_ST_PTC 4 -#define SAL_ST_AP_WAKEUP 5 - -typedef struct { - UINT8 Type; // Type == 0 - UINT8 Reserved[7]; - UINT64 PalProcEntry; - UINT64 SalProcEntry; - UINT64 GlobalDataPointer; - UINT64 Reserved2[2]; -} SAL_ST_ENTRY_POINT_DESCRIPTOR; - -typedef struct { - UINT8 Type; // Type == 1 - UINT8 NeedVirtualRegistration; - UINT8 MemoryAttributes; - UINT8 PageAccessRights; - UINT8 SupportedAttributes; - UINT8 Reserved; - UINT16 MemoryType; - UINT64 PhysicalMemoryAddress; - UINT32 Length; - UINT32 Reserved1; - UINT64 OemReserved; -} SAL_ST_MEMORY_DESCRIPTOR_ENTRY; - -// -// MemoryType info -// -#define SAL_SAPIC_IPI_BLOCK 0x0002 -#define SAL_IO_PORT_MAPPING 0x0003 - -typedef struct { - UINT8 Type; // Type == 2 - UINT8 PlatformFeatures; - UINT8 Reserved[14]; -} SAL_ST_MEMORY_DECRIPTOR; - -typedef struct { - UINT8 Type; // Type == 3 - UINT8 TRType; - UINT8 TRNumber; - UINT8 Reserved[5]; - UINT64 VirtualAddress; - UINT64 EncodedPageSize; - UINT64 Reserved1; -} SAL_ST_TR_DECRIPTOR; - -typedef struct { - UINT64 NumberOfProcessors; - UINT64 LocalIDRegister; -} SAL_COHERENCE_DOMAIN_INFO; - -typedef struct { - UINT8 Type; // Type == 4 - UINT8 Reserved[3]; - UINT32 NumberOfDomains; - SAL_COHERENCE_DOMAIN_INFO *DomainInformation; -} SAL_ST_CACHE_COHERENCE_DECRIPTOR; - -typedef struct { - UINT8 Type; // Type == 5 - UINT8 WakeUpType; - UINT8 Reserved[6]; - UINT64 ExternalInterruptVector; -} SAL_ST_AP_WAKEUP_DECRIPTOR; - -typedef struct { - SAL_SYSTEM_TABLE_HDR Header; - SAL_ST_ENTRY_POINT_DESCRIPTOR Entry0; -} SAL_SYSTEM_TABLE_ASCENDING_ORDER; - -#define FIT_ENTRY_PTR (0x100000000 - 32) // 4GB - 24 -#define FIT_PALA_ENTRY (0x100000000 - 48) // 4GB - 32 -#define FIT_PALB_TYPE 01 - -typedef struct { - UINT64 Address; - UINT8 Size[3]; - UINT8 Reserved; - UINT16 Revision; - UINT8 Type:7; - UINT8 CheckSumValid:1; - UINT8 CheckSum; -} FIT_ENTRY; - -#pragma pack() - -typedef - rArg -(*CALL_SAL_PROC)( - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4, - IN UINT64 Arg5, - IN UINT64 Arg6, - IN UINT64 Arg7, - IN UINT64 Arg8 - ); - -typedef - rArg -(*CALL_PAL_PROC)( - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4 - ); - -extern CALL_SAL_PROC GlobalSalProc; -extern CALL_PAL_PROC GlobalPalProc; -extern PLABEL SalProcPlabel; -extern PLABEL PalProcPlabel; - -#endif - diff --git a/3rd/gnu-efi/inc/inc.mak b/3rd/gnu-efi/inc/inc.mak deleted file mode 100644 index 992996bec..000000000 --- a/3rd/gnu-efi/inc/inc.mak +++ /dev/null @@ -1,23 +0,0 @@ - - -INC_DEPS = $(INC_DEPS) \ - efi.h \ - efiapi.h \ - efibind.h \ - eficon.h \ - efidebug.h \ - efidef.h \ - efidevp.h \ - efierr.h \ - efifs.h \ - efilib.h \ - efipart.h \ - efipciio.h \ - efiprot.h \ - efipxe.h \ - efivar.h \ - pe.h \ - efiip.h \ - efiudp.h \ - efitcp.h \ - stdarg.h diff --git a/3rd/gnu-efi/inc/lib.h b/3rd/gnu-efi/inc/lib.h deleted file mode 100644 index 7e78c62e9..000000000 --- a/3rd/gnu-efi/inc/lib.h +++ /dev/null @@ -1,92 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - lib.h - -Abstract: - - EFI library header files - - - -Revision History - ---*/ - -#ifdef __GNUC__ -#pragma GCC visibility push(hidden) -#endif - -#include "efi.h" -#include "efilib.h" -#include "efirtlib.h" - -// -// Include non architectural protocols -// -#include "protocol/efivar.h" -#include "protocol/legacyboot.h" -#include "protocol/intload.h" -#include "protocol/vgaclass.h" -#include "protocol/eficonsplit.h" -#include "protocol/adapterdebug.h" -#include "protocol/intload.h" - -#include "efigpt.h" -#include "libsmbios.h" - -// -// Prototypes -// - -VOID -InitializeGuid ( - VOID - ); - -INTN EFIAPI -LibStubStriCmp ( - IN EFI_UNICODE_COLLATION_INTERFACE *This, - IN CHAR16 *S1, - IN CHAR16 *S2 - ); - -BOOLEAN EFIAPI -LibStubMetaiMatch ( - IN EFI_UNICODE_COLLATION_INTERFACE *This, - IN CHAR16 *String, - IN CHAR16 *Pattern - ); - -VOID EFIAPI -LibStubStrLwrUpr ( - IN EFI_UNICODE_COLLATION_INTERFACE *This, - IN CHAR16 *Str - ); - -BOOLEAN -LibMatchDevicePaths ( - IN EFI_DEVICE_PATH *Multi, - IN EFI_DEVICE_PATH *Single - ); - -EFI_DEVICE_PATH * -LibDuplicateDevicePathInstance ( - IN EFI_DEVICE_PATH *DevPath - ); - - -// -// Globals -// -extern BOOLEAN LibInitialized; -extern BOOLEAN LibFwInstance; -extern EFI_HANDLE LibImageHandle; -extern SIMPLE_TEXT_OUTPUT_INTERFACE *LibRuntimeDebugOut; -extern EFI_UNICODE_COLLATION_INTERFACE *UnicodeInterface; -extern EFI_UNICODE_COLLATION_INTERFACE LibStubUnicodeInterface; -extern EFI_RAISE_TPL LibRuntimeRaiseTPL; -extern EFI_RESTORE_TPL LibRuntimeRestoreTPL; diff --git a/3rd/gnu-efi/inc/libsmbios.h b/3rd/gnu-efi/inc/libsmbios.h deleted file mode 100644 index 658c01d84..000000000 --- a/3rd/gnu-efi/inc/libsmbios.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef _LIB_SMBIOS_H -#define _LIB_SMBIOS_H -/*++ - -Copyright (c) 2000 Intel Corporation - -Module Name: - - LibSmbios.h - -Abstract: - - Lib include for SMBIOS services. Used to get system serial number and GUID - -Revision History - ---*/ - -// -// Define SMBIOS tables. -// -#pragma pack(1) -typedef struct { - UINT8 AnchorString[4]; - UINT8 EntryPointStructureChecksum; - UINT8 EntryPointLength; - UINT8 MajorVersion; - UINT8 MinorVersion; - UINT16 MaxStructureSize; - UINT8 EntryPointRevision; - UINT8 FormattedArea[5]; - UINT8 IntermediateAnchorString[5]; - UINT8 IntermediateChecksum; - UINT16 TableLength; - UINT32 TableAddress; - UINT16 NumberOfSmbiosStructures; - UINT8 SmbiosBcdRevision; -} SMBIOS_STRUCTURE_TABLE; - -typedef struct { - UINT8 AnchorString[5]; - UINT8 EntryPointStructureChecksum; - UINT8 EntryPointLength; - UINT8 MajorVersion; - UINT8 MinorVersion; - UINT8 DocRev; - UINT8 EntryPointRevision; - UINT8 Reserved; - UINT32 TableMaximumSize; - UINT64 TableAddress; -} SMBIOS3_STRUCTURE_TABLE; - -// -// Please note that SMBIOS structures can be odd byte aligned since the -// unformated section of each record is a set of arbitrary size strings. -// - -typedef struct { - UINT8 Type; - UINT8 Length; - UINT8 Handle[2]; -} SMBIOS_HEADER; - -typedef UINT8 SMBIOS_STRING; - -typedef struct { - SMBIOS_HEADER Hdr; - SMBIOS_STRING Vendor; - SMBIOS_STRING BiosVersion; - UINT8 BiosSegment[2]; - SMBIOS_STRING BiosReleaseDate; - UINT8 BiosSize; - UINT8 BiosCharacteristics[8]; -} SMBIOS_TYPE0; - -typedef struct { - SMBIOS_HEADER Hdr; - SMBIOS_STRING Manufacturer; - SMBIOS_STRING ProductName; - SMBIOS_STRING Version; - SMBIOS_STRING SerialNumber; - - // - // always byte copy this data to prevent alignment faults! - // - EFI_GUID Uuid; - - UINT8 WakeUpType; -} SMBIOS_TYPE1; - -typedef struct { - SMBIOS_HEADER Hdr; - SMBIOS_STRING Manufacturer; - SMBIOS_STRING ProductName; - SMBIOS_STRING Version; - SMBIOS_STRING SerialNumber; -} SMBIOS_TYPE2; - -typedef struct { - SMBIOS_HEADER Hdr; - SMBIOS_STRING Manufacturer; - UINT8 Type; - SMBIOS_STRING Version; - SMBIOS_STRING SerialNumber; - SMBIOS_STRING AssetTag; - UINT8 BootupState; - UINT8 PowerSupplyState; - UINT8 ThermalState; - UINT8 SecurityStatus; - UINT8 OemDefined[4]; -} SMBIOS_TYPE3; - -typedef struct { - SMBIOS_HEADER Hdr; - UINT8 Socket; - UINT8 ProcessorType; - UINT8 ProcessorFamily; - SMBIOS_STRING ProcessorManufacture; - UINT8 ProcessorId[8]; - SMBIOS_STRING ProcessorVersion; - UINT8 Voltage; - UINT8 ExternalClock[2]; - UINT8 MaxSpeed[2]; - UINT8 CurrentSpeed[2]; - UINT8 Status; - UINT8 ProcessorUpgrade; - UINT8 L1CacheHandle[2]; - UINT8 L2CacheHandle[2]; - UINT8 L3CacheHandle[2]; -} SMBIOS_TYPE4; - -typedef union { - SMBIOS_HEADER *Hdr; - SMBIOS_TYPE0 *Type0; - SMBIOS_TYPE1 *Type1; - SMBIOS_TYPE2 *Type2; - SMBIOS_TYPE3 *Type3; - SMBIOS_TYPE4 *Type4; - UINT8 *Raw; -} SMBIOS_STRUCTURE_POINTER; -#pragma pack() - -#endif diff --git a/3rd/gnu-efi/inc/loongarch64/efibind.h b/3rd/gnu-efi/inc/loongarch64/efibind.h deleted file mode 100644 index aaf3fb7e7..000000000 --- a/3rd/gnu-efi/inc/loongarch64/efibind.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copright (C) 2014 - 2015 Linaro Ltd. - * Author: Ard Biesheuvel - * Copright (C) 2017 Lemote Co. - * Author: Heiher - * Copright (C) 2021 Loongson Technology Corporation Limited. - * Author: zhoumingtao - * - * 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(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) && !defined(__cplusplus) - -// 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; -typedef uint64_t uintptr_t; -typedef int64_t intptr_t; - -#else -#include -#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. -// - -#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"))); - -#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 diff --git a/3rd/gnu-efi/inc/loongarch64/efilibplat.h b/3rd/gnu-efi/inc/loongarch64/efilibplat.h deleted file mode 100644 index eda7c83bc..000000000 --- a/3rd/gnu-efi/inc/loongarch64/efilibplat.h +++ /dev/null @@ -1,24 +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 - ); diff --git a/3rd/gnu-efi/inc/loongarch64/efisetjmp_arch.h b/3rd/gnu-efi/inc/loongarch64/efisetjmp_arch.h deleted file mode 100644 index 18aefaf4d..000000000 --- a/3rd/gnu-efi/inc/loongarch64/efisetjmp_arch.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef GNU_EFI_LOONGARCH64_SETJMP_H -#define GNU_EFI_LOONGARCH64_SETJMP_H - -#define JMPBUF_ALIGN 8 - -typedef struct { - /* GP regs */ - UINT64 RA; - UINT64 SP; - UINT64 FP; - - UINT64 S0; - UINT64 S1; - UINT64 S2; - UINT64 S3; - UINT64 S4; - UINT64 S5; - UINT64 S6; - UINT64 S7; - UINT64 S8; -} ALIGN(JMPBUF_ALIGN) jmp_buf[1]; - -#endif /* GNU_EFI_LOONGARCH64_SETJMP_H */ diff --git a/3rd/gnu-efi/inc/make.inf b/3rd/gnu-efi/inc/make.inf deleted file mode 100644 index f173196f0..000000000 --- a/3rd/gnu-efi/inc/make.inf +++ /dev/null @@ -1,33 +0,0 @@ -# -# -# - -[sources] - efi.h - efiapi.h - eficon.h - efidebug.h - efidef.h - efidevp.h - efierr.h - efifs.h - efilib.h - efipart.h - efipciio.h - efiprot.h - efipxebc.h - efistdarg.h - efinet.h - efiip.h - efiudp.h - efitcp.h - -[ia32sources] - efibind.h - pe.h - efilibplat.h - -[ia64sources] - efibind.h - pe.h - efilibplat.h diff --git a/3rd/gnu-efi/inc/makefile.hdr b/3rd/gnu-efi/inc/makefile.hdr deleted file mode 100644 index 46ef38769..000000000 --- a/3rd/gnu-efi/inc/makefile.hdr +++ /dev/null @@ -1,48 +0,0 @@ - -# -# This is a machine generated file - DO NOT EDIT -# Generated by genmake.exe -# Generated from make.inf -# Copyright (c) 1998 Intel Corporation -# - -INC_DEPS = $(INC_DEPS) \ - $(SDK_INSTALL_DIR)\include\efi\efi.h \ - $(SDK_INSTALL_DIR)\include\efi\efiapi.h \ - $(SDK_INSTALL_DIR)\include\efi\eficon.h \ - $(SDK_INSTALL_DIR)\include\efi\efidebug.h \ - $(SDK_INSTALL_DIR)\include\efi\efidef.h \ - $(SDK_INSTALL_DIR)\include\efi\efidevp.h \ - $(SDK_INSTALL_DIR)\include\efi\efierr.h \ - $(SDK_INSTALL_DIR)\include\efi\efifs.h \ - $(SDK_INSTALL_DIR)\include\efi\efilib.h \ - $(SDK_INSTALL_DIR)\include\efi\efipart.h \ - $(SDK_INSTALL_DIR)\include\efi\efipciio.h \ - $(SDK_INSTALL_DIR)\include\efi\efiprot.h \ - $(SDK_INSTALL_DIR)\include\efi\efipxebc.h \ - $(SDK_INSTALL_DIR)\include\efi\efistdarg.h \ - $(SDK_INSTALL_DIR)\include\efi\efinet.h \ - $(SDK_INSTALL_DIR)\include\efi\efiip.h \ - $(SDK_INSTALL_DIR)\include\efi\efiudp.h \ - $(SDK_INSTALL_DIR)\include\efi\efitcp.h \ - - -!IF "$(PROCESSOR)" == "Ia32" -INC_DEPS = $(INC_DEPS) \ - $(SDK_INSTALL_DIR)\include\efi\Ia32\efibind.h \ - $(SDK_INSTALL_DIR)\include\efi\Ia32\pe.h \ - $(SDK_INSTALL_DIR)\include\efi\Ia32\efilibplat.h \ - - -!ENDIF - - -!IF "$(PROCESSOR)" == "Ia64" -INC_DEPS = $(INC_DEPS) \ - $(SDK_INSTALL_DIR)\include\efi\Ia64\efibind.h \ - $(SDK_INSTALL_DIR)\include\efi\Ia64\pe.h \ - $(SDK_INSTALL_DIR)\include\efi\Ia64\efilibplat.h \ - - -!ENDIF - diff --git a/3rd/gnu-efi/inc/mips64el/efibind.h b/3rd/gnu-efi/inc/mips64el/efibind.h deleted file mode 100644 index cf77ddc6b..000000000 --- a/3rd/gnu-efi/inc/mips64el/efibind.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copright (C) 2014 - 2015 Linaro Ltd. - * Author: Ard Biesheuvel - * Copright (C) 2017 Lemote Co. - * Author: Heiher - * - * 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(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) && !defined(__cplusplus) - -// 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 -typedef uint64_t uintptr_t; -typedef int64_t intptr_t; - -#else -#include -#endif - -// -// Basic EFI types of various widths -// - -#include - -typedef wchar_t CHAR16; -#define WCHAR CHAR16 - -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 char CHAR8; -typedef int8_t INT8; - -#undef VOID -typedef 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. -// - -#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"))); - -#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 - -static inline UINT64 swap_uint64 (UINT64 v) -{ - asm volatile ( - "dsbh %[v], %[v] \n\t" - "dshd %[v], %[v] \n\t" - :[v]"+r"(v) - ); - - return v; -} diff --git a/3rd/gnu-efi/inc/mips64el/efilibplat.h b/3rd/gnu-efi/inc/mips64el/efilibplat.h deleted file mode 100644 index 70a07865d..000000000 --- a/3rd/gnu-efi/inc/mips64el/efilibplat.h +++ /dev/null @@ -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 - ); - diff --git a/3rd/gnu-efi/inc/mips64el/efisetjmp_arch.h b/3rd/gnu-efi/inc/mips64el/efisetjmp_arch.h deleted file mode 100644 index 2b8f756eb..000000000 --- a/3rd/gnu-efi/inc/mips64el/efisetjmp_arch.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef GNU_EFI_MIPS64EL_SETJMP_H -#define GNU_EFI_MIPS64EL_SETJMP_H - -#define JMPBUF_ALIGN 8 - -typedef struct { - /* GP regs */ - UINT64 RA; - UINT64 SP; - UINT64 FP; - UINT64 GP; - UINT64 S0; - UINT64 S1; - UINT64 S2; - UINT64 S3; - UINT64 S4; - UINT64 S5; - UINT64 S6; - UINT64 S7; - -#ifdef __mips_hard_float - /* FP regs */ - UINT64 F24; - UINT64 F25; - UINT64 F26; - UINT64 F27; - UINT64 F28; - UINT64 F29; - UINT64 F30; - UINT64 F31; -#endif -} ALIGN(JMPBUF_ALIGN) jmp_buf[1]; - -#endif /* GNU_EFI_MIPS64EL_SETJMP_H */ diff --git a/3rd/gnu-efi/inc/pci22.h b/3rd/gnu-efi/inc/pci22.h deleted file mode 100644 index b94f5198a..000000000 --- a/3rd/gnu-efi/inc/pci22.h +++ /dev/null @@ -1,193 +0,0 @@ -#ifndef _PCI22_H -#define _PCI22_H - -/*++ - -Copyright (c) 1999 Intel Corporation - -Module Name: - - pci22.h - -Abstract: - Support for PCI 2.2 standard. - - - - -Revision History - ---*/ - -#ifdef SOFT_SDV -#define PCI_MAX_BUS 1 -#else -#define PCI_MAX_BUS 255 -#endif - -#define PCI_MAX_DEVICE 31 -#define PCI_MAX_FUNC 7 - -// -// Command -// -#define PCI_VGA_PALETTE_SNOOP_DISABLED 0x20 - -#pragma pack(1) -typedef struct { - UINT16 VendorId; - UINT16 DeviceId; - UINT16 Command; - UINT16 Status; - UINT8 RevisionID; - UINT8 ClassCode[3]; - UINT8 CacheLineSize; - UINT8 LaytencyTimer; - UINT8 HeaderType; - UINT8 BIST; -} PCI_DEVICE_INDEPENDENT_REGION; - -typedef struct { - UINT32 Bar[6]; - UINT32 CISPtr; - UINT16 SubsystemVendorID; - UINT16 SubsystemID; - UINT32 ExpansionRomBar; - UINT32 Reserved[2]; - UINT8 InterruptLine; - UINT8 InterruptPin; - UINT8 MinGnt; - UINT8 MaxLat; -} PCI_DEVICE_HEADER_TYPE_REGION; - -typedef struct { - PCI_DEVICE_INDEPENDENT_REGION Hdr; - PCI_DEVICE_HEADER_TYPE_REGION Device; -} PCI_TYPE00; - -typedef struct { - UINT32 Bar[2]; - UINT8 PrimaryBus; - UINT8 SecondaryBus; - UINT8 SubordinateBus; - UINT8 SecondaryLatencyTimer; - UINT8 IoBase; - UINT8 IoLimit; - UINT16 SecondaryStatus; - UINT16 MemoryBase; - UINT16 MemoryLimit; - UINT16 PrefetchableMemoryBase; - UINT16 PrefetchableMemoryLimit; - UINT32 PrefetchableBaseUpper32; - UINT32 PrefetchableLimitUpper32; - UINT16 IoBaseUpper16; - UINT16 IoLimitUpper16; - UINT32 Reserved; - UINT32 ExpansionRomBAR; - UINT8 InterruptLine; - UINT8 InterruptPin; - UINT16 BridgeControl; -} PCI_BRIDGE_CONTROL_REGISTER; - -#define PCI_CLASS_DISPLAY_CTRL 0x03 -#define PCI_CLASS_VGA 0x00 - -#define PCI_CLASS_BRIDGE 0x06 -#define PCI_CLASS_ISA 0x01 -#define PCI_CLASS_ISA_POSITIVE_DECODE 0x80 - -#define PCI_CLASS_NETWORK 0x02 -#define PCI_CLASS_ETHERNET 0x00 - -#define HEADER_TYPE_DEVICE 0x00 -#define HEADER_TYPE_PCI_TO_PCI_BRIDGE 0x01 -#define HEADER_TYPE_MULTI_FUNCTION 0x80 -#define HEADER_LAYOUT_CODE 0x7f - -#define IS_PCI_BRIDGE(_p) ((((_p)->Hdr.HeaderType) & HEADER_LAYOUT_CODE) == HEADER_TYPE_PCI_TO_PCI_BRIDGE) -#define IS_PCI_MULTI_FUNC(_p) (((_p)->Hdr.HeaderType) & HEADER_TYPE_MULTI_FUNCTION) - -typedef struct { - PCI_DEVICE_INDEPENDENT_REGION Hdr; - PCI_BRIDGE_CONTROL_REGISTER Bridge; -} PCI_TYPE01; - -typedef struct { - UINT8 Register; - UINT8 Function; - UINT8 Device; - UINT8 Bus; - UINT8 Reserved[4]; -} DEFIO_PCI_ADDR; - -typedef struct { - UINT32 Reg : 8; - UINT32 Func : 3; - UINT32 Dev : 5; - UINT32 Bus : 8; - UINT32 Reserved: 7; - UINT32 Enable : 1; -} PCI_CONFIG_ACCESS_CF8; - -#pragma pack() - -#define EFI_ROOT_BRIDGE_LIST 'eprb' -typedef struct { - UINTN Signature; - - UINT16 BridgeNumber; - UINT16 PrimaryBus; - UINT16 SubordinateBus; - - EFI_DEVICE_PATH *DevicePath; - - LIST_ENTRY Link; -} PCI_ROOT_BRIDGE_ENTRY; - - -#define PCI_EXPANSION_ROM_HEADER_SIGNATURE 0xaa55 -#define EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE 0x0EF1 -#define PCI_DATA_STRUCTURE_SIGNATURE EFI_SIGNATURE_32('P','C','I','R') - -#pragma pack(1) -typedef struct { - UINT16 Signature; // 0xaa55 - UINT8 Reserved[0x16]; - UINT16 PcirOffset; -} PCI_EXPANSION_ROM_HEADER; - - -typedef struct { - UINT16 Signature; // 0xaa55 - UINT16 InitializationSize; - UINT16 EfiSignature; // 0x0EF1 - UINT16 EfiSubsystem; - UINT16 EfiMachineType; - UINT8 Reserved[0x0A]; - UINT16 EfiImageHeaderOffset; - UINT16 PcirOffset; -} EFI_PCI_EXPANSION_ROM_HEADER; - -typedef struct { - UINT32 Signature; // "PCIR" - UINT16 VendorId; - UINT16 DeviceId; - UINT16 Reserved0; - UINT16 Length; - UINT8 Revision; - UINT8 ClassCode[3]; - UINT16 ImageLength; - UINT16 CodeRevision; - UINT8 CodeType; - UINT8 Indicator; - UINT16 Reserved1; -} PCI_DATA_STRUCTURE; -#pragma pack() - -#endif - - - - - - diff --git a/3rd/gnu-efi/inc/protocol/adapterdebug.h b/3rd/gnu-efi/inc/protocol/adapterdebug.h deleted file mode 100644 index d70af5dfa..000000000 --- a/3rd/gnu-efi/inc/protocol/adapterdebug.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _ADAPTER_DEBUG_H -#define _ADAPTER_DEBUG_H - -/*++ - -Copyright (c) 1999 Intel Corporation - -Module Name: - - AdapterDebug.h - -Abstract: - - Protocol to debug the EDD 3.0 enablement of BIOS option ROMs - - - -Revision History - ---*/ - -// {82F86881-282B-11d4-BC7D-0080C73C8881} -#define ADAPTER_DEBUG_PROTOCOL \ -{ 0x82f86881, 0x282b, 0x11d4, {0xbc, 0x7d, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } - -// -// This protocol points to the BIOS_LEGACY_DRIVE data structure -// see edd.h for more details -// - -#endif - diff --git a/3rd/gnu-efi/inc/protocol/eficonsplit.h b/3rd/gnu-efi/inc/protocol/eficonsplit.h deleted file mode 100644 index 15adb925b..000000000 --- a/3rd/gnu-efi/inc/protocol/eficonsplit.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _EFI_CONFORK_H -#define _EFI_CONFORK_H -/*++ - -Copyright (c) 1999 Intel Corporation - -Module Name: - -Abstract: - - - -Revision History - ---*/ - - - -// -// ConOut Forker Protocol -// - -#define TEXT_OUT_SPLITER_PROTOCOL \ - { 0x56d830a0, 0x7e7a, 0x11d3, {0xbb, 0xa0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -#define ERROR_OUT_SPLITER_PROTOCOL \ - { 0xf0ba9039, 0x68f1, 0x425e, {0xaa, 0x7f, 0xd9, 0xaa, 0xf9, 0x1b, 0x82, 0xa1}} - -#define TEXT_IN_SPLITER_PROTOCOL \ - { 0xf9a3c550, 0x7fb5, 0x11d3, {0xbb, 0xa0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -#endif diff --git a/3rd/gnu-efi/inc/protocol/efidbg.h b/3rd/gnu-efi/inc/protocol/efidbg.h deleted file mode 100644 index 1f95a70bb..000000000 --- a/3rd/gnu-efi/inc/protocol/efidbg.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 1999, 2000 - * Intel Corporation. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by Intel Corporation and - * its contributors. - * - * 4. Neither the name of Intel Corporation or its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION 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 INTEL CORPORATION OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef _EFIDBG_H_ -#define _EFIDBG_H_ - -#include "eficontext.h" -#include "efiser.h" - -typedef struct _DEBUGPORT_16550_CONFIG_DATA { - UINT32 PortAddress; - UINT64 BaudRate; - UINT32 ReceiveFifoDepth; - UINT32 Timeout; - UINT8 Parity; - UINT8 DataBits; - UINT8 StopBits; - UINT32 ControlMask; - BOOLEAN RtsCtsEnable; // RTS, CTS control -} DEBUGPORT_16550_CONFIG_DATA; - -typedef struct _DEBUGPORT_16550_DEVICE_PATH { - EFI_DEVICE_PATH Header; - DEBUGPORT_16550_CONFIG_DATA ConfigData; -} DEBUGPORT_16550_DEVICE_PATH; - -typedef union { - EFI_DEVICE_PATH DevPath; - DEBUGPORT_16550_DEVICE_PATH Uart; - // add new types of debugport device paths to this union... -} DEBUGPORT_DEV_PATH; - - -// -// Debug Support protocol {2755590C-6F3C-42FA-9EA4-A3BA543CDA25} -// - -#define DEBUG_SUPPORT_PROTOCOL \ -{ 0x2755590C, 0x6F3C, 0x42fa, 0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 } - - -typedef UINTN EXCEPTION_TYPE; - -typedef -VOID -(*EXCEPTION_HANDLER) ( - IN EXCEPTION_TYPE ExceptionType, - IN SYSTEM_CONTEXT *SystemContext - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_REGISTER_TIMER_TICK_CALLBACK) ( - IN struct _EFI_DEBUG_SUPPORT_INTERFACE *This, - IN EXCEPTION_HANDLER TimerTickCallback - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_REGISTER_EXCEPTION_HANDLER) ( - IN struct _EFI_DEBUG_SUPPORT_INTERFACE *This, - IN EXCEPTION_HANDLER ExceptionHandler, - IN EXCEPTION_TYPE ExceptionType - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP_CALL_TRACE) ( - IN struct _EFI_DEBUG_SUPPORT_INTERFACE *This - ); - - -#define EFI_DEBUG_SUPPORT_INTERFACE_REVISION 0x00010000 - -typedef struct _EFI_DEBUG_SUPPORT_INTERFACE { - UINT32 Revision; - EFI_REGISTER_TIMER_TICK_CALLBACK RegisterTimerTickCallback; - EFI_REGISTER_EXCEPTION_HANDLER RegisterExceptionHandler; - EFI_IP_CALL_TRACE IpCallTrace; -} EFI_DEBUG_SUPPORT_INTERFACE; - - -// -// Debugport io protocol {EBA4E8D2-3858-41EC-A281-2647BA9660D0} -// - -#define DEBUGPORT_IO_PROTOCOL \ -{ 0XEBA4E8D2, 0X3858, 0X41EC, 0XA2, 0X81, 0X26, 0X47, 0XBA, 0X96, 0X60, 0XD0 } - - -typedef -EFI_STATUS -(EFIAPI *EFI_DEBUGPORT_IO_RESET) ( - IN struct _EFI_DEBUGPORT_IO_INTERFACE *This - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_DEBUGPORT_IO_READ) ( - IN struct _EFI_DEBUGPORT_IO_INTERFACE *This, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_DEBUGPORT_IO_WRITE) ( - IN struct _EFI_DEBUGPORT_IO_INTERFACE *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ); - -#define EFI_DEBUGPORT_IO_INTERFACE_REVISION 0x00010000 - -typedef struct _EFI_DEBUGPORT_IO_INTERFACE { - UINT32 Revision; - EFI_DEBUGPORT_IO_READ Read; - EFI_DEBUGPORT_IO_WRITE Write; - EFI_DEBUGPORT_IO_RESET Reset; -} EFI_DEBUGPORT_IO_INTERFACE; - - -// -// Debugport UART16550 control protocol {628EA978-4C26-4605-BC02-A42A496917DD} -// - -#define DEBUGPORT_UART16550_CONTROL_PROTOCOL \ -{ 0X628EA978, 0X4C26, 0X4605, 0XBC, 0X2, 0XA4, 0X2A, 0X49, 0X69, 0X17, 0XDD } - -// Note: The definitions for EFI_PARITY_TYPE, EFI_STOP_BITS_TYPE, and -// SERIAL_IO_MODE are included from efiser.h - -typedef -EFI_STATUS -(EFIAPI *EFI_UART16550_SET_ATTRIBUTES) ( - IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE *This, - IN UINT64 BaudRate, - IN UINT32 ReceiveFifoDepth, - IN UINT32 Timeout, - IN EFI_PARITY_TYPE Parity, - IN UINT8 DataBits, - IN EFI_STOP_BITS_TYPE StopBits - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UART16550_SET_CONTROL_BITS) ( - IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE *This, - IN UINT32 Control - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UART16550_GET_CONTROL_BITS) ( - IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE *This, - OUT UINT32 *Control - ); - -#define EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE_REVISION 0x00010000 - -typedef struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE { - UINT32 Revision; - EFI_UART16550_SET_ATTRIBUTES SetAttributes; - EFI_UART16550_SET_CONTROL_BITS SetControl; - EFI_UART16550_GET_CONTROL_BITS GetControl; - DEBUGPORT_16550_CONFIG_DATA *Mode; -} EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE; - - -#define DEVICE_PATH_DEBUGPORT DEBUGPORT_IO_PROTOCOL - -#endif /* _EFIDBG_H_ */ diff --git a/3rd/gnu-efi/inc/protocol/efivar.h b/3rd/gnu-efi/inc/protocol/efivar.h deleted file mode 100644 index 92dc506a1..000000000 --- a/3rd/gnu-efi/inc/protocol/efivar.h +++ /dev/null @@ -1,133 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - -Abstract: - - - -Revision History - ---*/ - - - -// -// The variable store protocol interface is specific to the reference -// implementation. The initialization code adds variable store devices -// to the system, and the FW connects to the devices to provide the -// variable store interfaces through these devices. -// - -// -// Variable Store Device protocol -// - -#define VARIABLE_STORE_PROTOCOL \ - { 0xf088cd91, 0xa046, 0x11d2, {0x8e, 0x42, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -INTERFACE_DECL(_EFI_VARIABLE_STORE); - -typedef -EFI_STATUS -(EFIAPI *EFI_STORE_CLEAR) ( - IN struct _EFI_VARIABLE_STORE *This, - IN UINTN BankNo, - IN OUT VOID *Scratch - ); - - -typedef -EFI_STATUS -(EFIAPI *EFI_STORE_READ) ( - IN struct _EFI_VARIABLE_STORE *This, - IN UINTN BankNo, - IN UINTN Offset, - IN UINTN BufferSize, - OUT VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_STORE_UPDATE) ( - IN struct _EFI_VARIABLE_STORE *This, - IN UINTN BankNo, - IN UINTN Offset, - IN UINTN BufferSize, - IN VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_STORE_SIZE) ( - IN struct _EFI_VARIABLE_STORE *This, - IN UINTN NoBanks - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TRANSACTION_UPDATE) ( - IN struct _EFI_VARIABLE_STORE *This, - IN UINTN BankNo, - IN VOID *NewContents - ); - -typedef struct _EFI_VARIABLE_STORE { - - // - // Number of banks and bank size - // - - UINT32 Attributes; - UINT32 BankSize; - UINT32 NoBanks; - - // - // Functions to access the storage banks - // - - EFI_STORE_CLEAR ClearStore; - EFI_STORE_READ ReadStore; - EFI_STORE_UPDATE UpdateStore; - EFI_STORE_SIZE SizeStore OPTIONAL; - EFI_TRANSACTION_UPDATE TransactionUpdate OPTIONAL; - -} EFI_VARIABLE_STORE; - - -// -// -// ClearStore() - A function to clear the requested storage bank. A cleared -// bank contains all "on" bits. -// -// ReadStore() - Read data from the requested store. -// -// UpdateStore() - Updates data on the requested store. The FW will only -// ever issue updates to clear bits in the store. Updates must be -// performed in LSb to MSb order of the update buffer. -// -// SizeStore() - An optional function for non-runtime stores that can be -// dynamically sized. The FW will only ever increase or decrease the store -// by 1 banksize at a time, and it is always adding or removing a bank from -// the end of the store. -// -// By default the FW will update variables and storage banks in an -// "atomic" manner by keeping 1 old copy of the data during an update, -// and recovering appropiately if the power is lost during the middle -// of an operation. To do this the FW needs to have multiple banks -// of storage dedicated to its use. If that's not possible, the driver -// can implement an atomic bank update function and the FW will allow -// 1 bank in this case. (It will allow any number of banks, -// but it won't require an "extra" bank to provide its bank transaction -// function). -// -// TransactionUpdate() - An optional function that can clear & update an -// entire bank in an "atomic" fashion. If the operation fails in the -// middle the driver is responsible for having either the previous copy -// of the bank's data or the new copy. A copy that's partially written -// is not valid as internal data settings may get lost. Supply this -// function only when needed. -// - diff --git a/3rd/gnu-efi/inc/protocol/ia64/eficontext.h b/3rd/gnu-efi/inc/protocol/ia64/eficontext.h deleted file mode 100644 index 1a39a6db1..000000000 --- a/3rd/gnu-efi/inc/protocol/ia64/eficontext.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 1999, 2000 - * Intel Corporation. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by Intel Corporation and - * its contributors. - * - * 4. Neither the name of Intel Corporation or its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION 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 INTEL CORPORATION OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef _EFICONTEXT_H_ -#define _EFICONTEXT_H_ - - -// -// IA-64 processor exception types -// -#define EXCPT_ALT_DTLB 4 -#define EXCPT_DNESTED_TLB 5 -#define EXCPT_BREAKPOINT 11 -#define EXCPT_EXTERNAL_INTERRUPT 12 -#define EXCPT_GEN_EXCEPT 24 -#define EXCPT_NAT_CONSUMPTION 26 -#define EXCPT_DEBUG_EXCEPT 29 -#define EXCPT_UNALIGNED_ACCESS 30 -#define EXCPT_FP_FAULT 32 -#define EXCPT_FP_TRAP 33 -#define EXCPT_TAKEN_BRANCH 35 -#define EXCPT_SINGLE_STEP 36 - -// -// IA-64 processor context definition - must be 512 byte aligned!!! -// -typedef -struct { - UINT64 reserved; // necessary to preserve alignment for the correct bits in UNAT and to insure F2 is 16 byte aligned... - - 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; - - // application registers - UINT64 ar_rsc; - UINT64 ar_bsp; - UINT64 ar_bspstore; - UINT64 ar_rnat; - - UINT64 ar_fcr; - - UINT64 ar_eflag; - UINT64 ar_csd; - UINT64 ar_ssd; - UINT64 ar_cflg; - UINT64 ar_fsr; - UINT64 ar_fir; - UINT64 ar_fdr; - - UINT64 ar_ccv; - - UINT64 ar_unat; - - UINT64 ar_fpsr; - - UINT64 ar_pfs; - UINT64 ar_lc; - UINT64 ar_ec; - - // control registers - UINT64 cr_dcr; - UINT64 cr_itm; - UINT64 cr_iva; - UINT64 cr_pta; - UINT64 cr_ipsr; - UINT64 cr_isr; - UINT64 cr_iip; - UINT64 cr_ifa; - UINT64 cr_itir; - UINT64 cr_iipa; - UINT64 cr_ifs; - UINT64 cr_iim; - UINT64 cr_iha; - - // debug registers - 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; - - // virtual registers - UINT64 int_nat; // nat bits for R1-R31 - -} SYSTEM_CONTEXT; - -#endif /* _EFI_CONTEXT_H_ */ diff --git a/3rd/gnu-efi/inc/protocol/intload.h b/3rd/gnu-efi/inc/protocol/intload.h deleted file mode 100644 index fb24e3f44..000000000 --- a/3rd/gnu-efi/inc/protocol/intload.h +++ /dev/null @@ -1,27 +0,0 @@ -/*++ - -Copyright (c) 1999 Intel Corporation - -Module Name: - - intload - -Abstract: - - EFI support for loading internally linked in apps - - - -Revision History - ---*/ - -#ifndef _INTERNAL_LOAD_INCLUDE_ -#define _INTERNAL_LOAD_INCLUDE_ - -// {D65A6B8C-71E5-4df0-A909-F0D2992B5AA9} -#define INTERNAL_SHELL_GUID \ - { 0xd65a6b8c, 0x71e5, 0x4df0, {0xa9, 0x09, 0xf0, 0xd2, 0x99, 0x2b, 0x5a, 0xa9} } - - -#endif diff --git a/3rd/gnu-efi/inc/protocol/legacyboot.h b/3rd/gnu-efi/inc/protocol/legacyboot.h deleted file mode 100644 index 16e94e7eb..000000000 --- a/3rd/gnu-efi/inc/protocol/legacyboot.h +++ /dev/null @@ -1,119 +0,0 @@ -/*++ - -Copyright (c) 1999 Intel Corporation - -Module Name: - - legacyboot - -Abstract: - - EFI support for legacy boot - - - -Revision History - ---*/ - -#ifndef _LEGACY_BOOT_INCLUDE_ -#define _LEGACY_BOOT_INCLUDE_ - -#define LEGACY_BOOT_PROTOCOL \ - { 0x376e5eb2, 0x30e4, 0x11d3, { 0xba, 0xe5, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } - -#pragma pack(1) - -// -// BBS 1.01 (See Appendix A) IPL and BCV Table Entry Data structure. -// Seg:Off pointers have been converted to EFI pointers in this data structure -// This is the structure that also maps to the EFI device path for the boot selection -// -typedef struct { - UINT16 DeviceType; - UINT16 StatusFlag; - UINT32 Reserved; - VOID *BootHandler; // Not an EFI entry point - CHAR8 *DescString; -} BBS_TABLE_ENTRY; -#pragma pack() - -typedef -EFI_STATUS -(EFIAPI *LEGACY_BOOT_CALL) ( - IN EFI_DEVICE_PATH *DevicePath - ); - - -// -// BBS support functions -// PnP Call numbers and BiosSelector hidden in implementation -// - -typedef enum { - IplRelative, - BcvRelative -} BBS_TYPE; - -INTERFACE_DECL(_LEGACY_BOOT_INTERFACE); - -// -// == PnP Function 0x60 then BbsVersion == 0x0101 if this call fails then BbsVersion == 0x0000 -// - -// -// == PnP Function 0x61 -// -typedef -EFI_STATUS -(EFIAPI *GET_DEVICE_COUNT) ( - IN struct _LEGACY_BOOT_INTERFACE *This, - IN BBS_TYPE *TableType, - OUT UINTN *DeviceCount, - OUT UINTN *MaxCount - ); - -// -// == PnP Function 0x62 -// -typedef -EFI_STATUS -(EFIAPI *GET_PRIORITY_AND_TABLE) ( - IN struct _LEGACY_BOOT_INTERFACE *This, - IN BBS_TYPE *TableType, - IN OUT UINTN *PrioritySize, // MaxCount * sizeof(UINT8) - OUT UINTN *Priority, - IN OUT UINTN *TableSize, // MaxCount * sizeof(BBS_TABLE_ENTRY) - OUT BBS_TABLE_ENTRY *TableEntrySize - ); - -// -// == PnP Function 0x63 -// -typedef -EFI_STATUS -(EFIAPI *SET_PRIORITY) ( - IN struct _LEGACY_BOOT_INTERFACE *This, - IN BBS_TYPE *TableType, - IN OUT UINTN *PrioritySize, - OUT UINTN *Priority - ); - -typedef struct _LEGACY_BOOT_INTERFACE { - LEGACY_BOOT_CALL BootIt; - - // - // New functions to allow BBS booting to be configured from EFI - // - UINTN BbsVersion; // Currently 0x0101 - GET_DEVICE_COUNT GetDeviceCount; - GET_PRIORITY_AND_TABLE GetPriorityAndTable; - SET_PRIORITY SetPriority; -} LEGACY_BOOT_INTERFACE; - -EFI_STATUS -PlInitializeLegacyBoot ( - VOID - ); - -#endif diff --git a/3rd/gnu-efi/inc/protocol/make.inf b/3rd/gnu-efi/inc/protocol/make.inf deleted file mode 100644 index f3bb9076c..000000000 --- a/3rd/gnu-efi/inc/protocol/make.inf +++ /dev/null @@ -1,13 +0,0 @@ -# -# -# - -[sources] - efivar.h - legacyboot.h - VgaClass.h - intload.h - -[ia32sources] - -[ia64sources] diff --git a/3rd/gnu-efi/inc/protocol/makefile.hdr b/3rd/gnu-efi/inc/protocol/makefile.hdr deleted file mode 100644 index 118d6ba3a..000000000 --- a/3rd/gnu-efi/inc/protocol/makefile.hdr +++ /dev/null @@ -1,29 +0,0 @@ - -# -# This is a machine generated file - DO NOT EDIT -# Generated by genmake.exe -# Generated from make.inf -# Copyright (c) 1998 Intel Corporation -# - -INC_DEPS = $(INC_DEPS) \ - $(SDK_INSTALL_DIR)\include\efi\protocol\efivar.h \ - $(SDK_INSTALL_DIR)\include\efi\protocol\legacyboot.h \ - $(SDK_INSTALL_DIR)\include\efi\protocol\vgaclass.h \ - $(SDK_INSTALL_DIR)\include\efi\protocol\efidbg.h \ - - -!IF "$(PROCESSOR)" == "Ia32" -INC_DEPS = $(INC_DEPS) \ - - -!ENDIF - - -!IF "$(PROCESSOR)" == "Ia64" -INC_DEPS = $(INC_DEPS) \ - $(SDK_INSTALL_DIR)\include\efi\protocol\$(PROCESSOR)\eficontext.h \ - - -!ENDIF - diff --git a/3rd/gnu-efi/inc/protocol/piflash64.h b/3rd/gnu-efi/inc/protocol/piflash64.h deleted file mode 100644 index d521dfcc4..000000000 --- a/3rd/gnu-efi/inc/protocol/piflash64.h +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef _PIFLASH64_H -#define _PIFLASH64_H - -/*++ - -Copyright (c) 1999 Intel Corporation - -Module Name: - - PIflash64.h - -Abstract: - - Iflash64.efi protocol to abstract iflash from - the system. - -Revision History - ---*/ - -// -// Guid that identifies the IFLASH protocol -// -#define IFLASH64_PROTOCOL_PROTOCOL \ - { 0x65cba110, 0x74ab, 0x11d3, 0xbb, 0x89, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }; - -// -// Unlock FLASH from StartAddress to EndAddress and return a LockKey -// -typedef -EFI_STATUS -(EFIAPI *UNLOCK_FLASH_API)( - IN struct _IFLASH64_PROTOCOL_INTERFACE *This - ); - -// -// Lock the flash represented by the LockKey -// -typedef -EFI_STATUS -(EFIAPI *LOCK_FLASH_API)( - IN struct _IFLASH64_PROTOCOL_INTERFACE *This - ); - -// -// Status callback for a utility like IFLASH64 -// -// Token would map to a list like Ted proposed. The utility has no idea what -// happens on the other side. -// ErrorStatus - Level of Error or success. Independent of Token. If you -// don't know the token you will at least know pass or fail. -// String - Optional extra information about the error. Could be used for -// debug or future expansion -// -// Attributes - Options screen attributes for String. Could allow the string to be different colors. -// -typedef -EFI_STATUS -(EFIAPI *UTILITY_PROGRESS_API)( - IN struct _IFLASH64_PROTOCOL_INTERFACE *This, - IN UINTN Token, - IN EFI_STATUS ErrorStatus, - IN CHAR16 *String, OPTIONAL - IN UINTN *Attributes OPTIONAL - ); - -// -// Token Values -// -// IFlash64 Token Codes -#define IFLASH_TOKEN_IFLASHSTART 0xB0 // IFlash64 has started -#define IFLASH_TOKEN_READINGFILE 0xB1 // Reading File -#define IFLASH_TOKEN_INITVPP 0xB2 // Initializing Vpp -#define IFLASH_TOKEN_DISABLEVPP 0x10 // Disable Vpp -#define IFLASH_TOKEN_FLASHUNLOCK 0xB3 // Unlocking FLASH Devices -#define IFLASH_TOKEN_FLASHERASE 0xB4 // Erasing FLASH Devices -#define IFLASH_TOKEN_FLASHPROGRAM 0xB5 // Programming FLASH -#define IFLASH_TOKEN_FLASHVERIFY 0xB6 // Verifying FLASH -#define IFLASH_TOKEN_UPDATESUCCES 0xB7 // FLASH Updage Success! - -#define IFLASH_TOKEN_PROGRESS_READINGFILE 0x11 // % Reading File -#define IFLASH_TOKEN_PROGRESS_FLASHUNLOCK 0x13 // % Unlocking FLASH Devices -#define IFLASH_TOKEN_PROGRESS_FLASHERASE 0x14 // % Erasing FLASH Devices -#define IFLASH_TOKEN_PROGRESS_FLASHPROGRAM 0x15 // % Programming FLASH -#define IFLASH_TOKEN_PROGRESS_FLASHVERIFY 0x16 // % Verifying FLASH - -#define IFLASH_TOKEN_READINGFILE_ER 0xB8 // File Read Error -#define IFLASH_TOKEN_INITVPP_ER 0xB9 // Initialization of IFB Error -#define IFLASH_TOKEN_FLASHUNLOCK_ER 0xBA // FLASH Unlock Error -#define IFLASH_TOKEN_FLASHERASE_ER 0xBB // FLASH Erase Error -#define IFLASH_TOKEN_FLASHVERIFY_ER 0xBC // FLASH Verify Error -#define IFLASH_TOKEN_FLASHPROG_ER 0xBD // FLASH Program Error - -#define IFLASH_TABLE_END 0x00 - -// -// If this number changes one of the existing API's has changes -// -#define IFLASH_PI_MAJOR_VERSION 0x01 - -// -// This number changes when new APIs or data variables get added to the end -// of the data structure -// -#define IFLASH_PI_MINOR_VERSION 0x01 - -typedef struct _IFLASH64_PROTOCOL_INTERFACE { - UINT32 MajorVersion; - UINT32 MinorVersion; - UNLOCK_FLASH_API UnlockFlash; - LOCK_FLASH_API LockFlash; - UTILITY_PROGRESS_API Progress; - - // - // Future expansion goes here - // - -} IFLASH64_PROTOCOL_INTERFACE; - - -#endif diff --git a/3rd/gnu-efi/inc/protocol/readme.txt b/3rd/gnu-efi/inc/protocol/readme.txt deleted file mode 100644 index 66e155cca..000000000 --- a/3rd/gnu-efi/inc/protocol/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -The protocol directory contains non Architectural -Protocols that span the FW, Platform, or application -space. \ No newline at end of file diff --git a/3rd/gnu-efi/inc/protocol/vgaclass.h b/3rd/gnu-efi/inc/protocol/vgaclass.h deleted file mode 100644 index d0deb5ce6..000000000 --- a/3rd/gnu-efi/inc/protocol/vgaclass.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef _VGA_CLASS_H -#define _VGA_CLASS_H - -/*++ - -Copyright (c) 1999 Intel Corporation - -Module Name: - - VgaClass.h - -Abstract: - - Vga Mini port binding to Vga Class protocol - - - -Revision History - ---*/ - -// -// VGA Device Structure -// - -// {0E3D6310-6FE4-11d3-BB81-0080C73C8881} -#define VGA_CLASS_DRIVER_PROTOCOL \ - { 0xe3d6310, 0x6fe4, 0x11d3, {0xbb, 0x81, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } - -typedef -EFI_STATUS -(* INIT_VGA_CARD) ( - IN UINTN VgaMode, - IN VOID *Context - ); - -typedef struct { - UINTN MaxColumns; - UINTN MaxRows; -} MAX_CONSOLE_GEOMETRY; - -#define VGA_CON_OUT_DEV_SIGNATURE EFI_SIGNATURE_32('c','v','g','a') -typedef struct { - UINTN Signature; - - EFI_HANDLE Handle; - SIMPLE_TEXT_OUTPUT_INTERFACE ConOut; - SIMPLE_TEXT_OUTPUT_MODE ConOutMode; - EFI_DEVICE_PATH *DevicePath; - - UINT8 *Buffer; - EFI_DEVICE_IO_INTERFACE *DeviceIo; - - // - // Video Card Context - // - INIT_VGA_CARD InitVgaCard; - VOID *VgaCardContext; - MAX_CONSOLE_GEOMETRY *Geometry; - // - // Video buffer normally 0xb8000 - // - UINT64 VideoBuffer; - - // - // Clear Screen & Default Attribute - // - UINT32 Attribute; - - // - // -1 means search for active VGA device - // - EFI_PCI_ADDRESS_UNION Pci; -} VGA_CON_OUT_DEV; - -#define VGA_CON_OUT_DEV_FROM_THIS(a) CR(a, VGA_CON_OUT_DEV, ConOut, VGA_CON_OUT_DEV_SIGNATURE) - -// -// Vga Class Driver Protocol. -// GUID defined in EFI Lib -// - -typedef -EFI_STATUS -(EFIAPI *INSTALL_VGA_DRIVER) ( - IN VGA_CON_OUT_DEV *ConOutDev - ); - -typedef struct { - UINT32 Version; - INSTALL_VGA_DRIVER InstallGenericVgaDriver; -} INSTALL_VGA_DRIVER_INTERFACE; - -#endif - diff --git a/3rd/gnu-efi/inc/riscv64/efibind.h b/3rd/gnu-efi/inc/riscv64/efibind.h deleted file mode 100644 index 4fdf81dca..000000000 --- a/3rd/gnu-efi/inc/riscv64/efibind.h +++ /dev/null @@ -1,130 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ -/* - * Copright (C) 2014 - 2015 Linaro Ltd. - * Author: Ard Biesheuvel - * - * 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. - */ - -#include - -// -// Basic EFI types of various widths -// - -#include - -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_t CHAR16; -#define WCHAR CHAR16 -#ifndef BOOLEAN -typedef uint8_t BOOLEAN; -#endif -#undef VOID -typedef void VOID; -typedef int64_t INTN; -typedef uint64_t UINTN; - -#define EFI_ERROR_MASK 0x8000000000000000 -#define EFIERR(a) (EFI_ERROR_MASK | a) -#define EFIERR_OEM(a) (0xc000000000000000 | a) - -#define BAD_POINTER 0xFBFBFBFBFBFBFBFB -#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF - -#define BREAKPOINT() while(1); - -// -// 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 diff --git a/3rd/gnu-efi/inc/riscv64/efilibplat.h b/3rd/gnu-efi/inc/riscv64/efilibplat.h deleted file mode 100644 index 9b151637e..000000000 --- a/3rd/gnu-efi/inc/riscv64/efilibplat.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ - -VOID -InitializeLibPlatform ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); diff --git a/3rd/gnu-efi/inc/riscv64/efisetjmp_arch.h b/3rd/gnu-efi/inc/riscv64/efisetjmp_arch.h deleted file mode 100644 index 9288c1fa5..000000000 --- a/3rd/gnu-efi/inc/riscv64/efisetjmp_arch.h +++ /dev/null @@ -1,40 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */ - -#ifndef GNU_EFI_RISCV64_SETJMP_H -#define GNU_EFI_RISCV64_SETJMP_H - -#define JMPBUF_ALIGN 8 - -typedef struct { - /* GP regs */ - UINT64 s0; - UINT64 s1; - UINT64 s2; - UINT64 s3; - UINT64 s4; - UINT64 s5; - UINT64 s6; - UINT64 s7; - UINT64 s8; - UINT64 s9; - UINT64 s10; - UINT64 s11; - UINT64 sp; - UINT64 ra; - - /* FP regs */ - UINT64 fs0; - UINT64 fs1; - UINT64 fs2; - UINT64 fs3; - UINT64 fs4; - UINT64 fs5; - UINT64 fs6; - UINT64 fs7; - UINT64 fs8; - UINT64 fs9; - UINT64 fs10; - UINT64 fs11; -} ALIGN(JMPBUF_ALIGN) jmp_buf[1]; - -#endif /* GNU_EFI_RISCV64_SETJMP_H */ diff --git a/3rd/gnu-efi/inc/romload.h b/3rd/gnu-efi/inc/romload.h deleted file mode 100644 index 050601125..000000000 --- a/3rd/gnu-efi/inc/romload.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _EFI_ROMLOAD_H -#define _EFI_ROMLOAD_H - -#define ROM_SIGNATURE 0xaa55 -#define PCIDS_SIGNATURE "PCIR" -#pragma pack(push) -#pragma pack(1) -typedef struct -{ - UINT8 Pcids_Sig[4]; - UINT16 VendId; - UINT16 DevId; - UINT16 Vpd_Off; - UINT16 Size; - UINT8 Rev; - UINT8 Class_Code[3]; - UINT16 Image_Len; - UINT16 Rev_Lvl; - UINT8 Code_Type; - UINT8 Indi; - UINT16 Rsvd; -}PciDataStructure; -typedef struct -{ - UINT16 Size; - UINT32 Header_Sig; - UINT16 SubSystem; - UINT16 MachineType; - UINT8 Resvd[10]; - UINT16 EfiOffset; -}ArchData; -typedef struct -{ - UINT16 Rom_Sig; - ArchData Arch_Data; - UINT16 Pcids_Off; - UINT8 resvd[38]; -}RomHeader; -#pragma pack(pop) - -#endif diff --git a/3rd/gnu-efi/inc/x86_64/efibind.h b/3rd/gnu-efi/inc/x86_64/efibind.h deleted file mode 100644 index e454ed2c2..000000000 --- a/3rd/gnu-efi/inc/x86_64/efibind.h +++ /dev/null @@ -1,396 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - efefind.h - -Abstract: - - EFI to compile bindings - - - - -Revision History - ---*/ -#ifndef X86_64_EFI_BIND -#define X86_64_EFI_BIND -#ifndef __GNUC__ -#pragma pack() -#endif - -#if defined(_MSC_VER) - #define HAVE_USE_MS_ABI 1 -#elif defined(GNU_EFI_USE_MS_ABI) - #if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)))||(defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 2))) - #define HAVE_USE_MS_ABI 1 - #else - #error Compiler is too old for GNU_EFI_USE_MS_ABI - #endif -#endif - -// -// Basic int types of various widths -// - -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) && !defined(__cplusplus) - - // No ANSI C 1999/2000 stdint.h integer width declarations - - #if defined(_MSC_EXTENSIONS) - - // Use Microsoft C compiler integer width declarations - - typedef unsigned __int64 uint64_t; - typedef __int64 int64_t; - typedef unsigned __int32 uint32_t; - typedef __int32 int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #elif defined(__GNUC__) - typedef int __attribute__((__mode__(__DI__))) int64_t; - typedef unsigned int __attribute__((__mode__(__DI__))) uint64_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; - #elif defined(UNIX_LP64) - - /* Use LP64 programming model from C_FLAGS for integer width declarations */ - - typedef unsigned long uint64_t; - typedef long int64_t; - typedef unsigned int uint32_t; - typedef int int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #else - - /* Assume P64 programming model from C_FLAGS for integer width declarations */ - - typedef unsigned long long uint64_t __attribute__((aligned (8))); - typedef long long int64_t __attribute__((aligned (8))); - typedef unsigned int uint32_t; - typedef int int32_t; - typedef unsigned short uint16_t; - typedef short int16_t; - typedef unsigned char uint8_t; - typedef char int8_t; - #endif - typedef uint64_t uintptr_t; - typedef int64_t intptr_t; -#else - #include -#endif - -// -// Basic EFI types of various widths -// - -#include - -typedef wchar_t CHAR16; -#define WCHAR CHAR16 - -typedef uint64_t UINT64; -typedef int64_t INT64; - -#ifndef _BASETSD_H_ - typedef uint32_t UINT32; - typedef int32_t INT32; -#endif - -typedef uint16_t UINT16; -typedef int16_t INT16; - -typedef uint8_t UINT8; -typedef char CHAR8; -typedef int8_t INT8; - -#undef VOID -typedef void VOID; - - -typedef int64_t INTN; -typedef uint64_t UINTN; - -#ifdef EFI_NT_EMULATOR - #define POST_CODE(_Data) -#else - #ifdef EFI_DEBUG -#define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al - #else - #define POST_CODE(_Data) - #endif -#endif - -#define EFIERR(a) (0x8000000000000000 | a) -#define EFI_ERROR_MASK 0x8000000000000000 -#define EFIERR_OEM(a) (0xc000000000000000 | a) - - -#define BAD_POINTER 0xFBFBFBFBFBFBFBFB -#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF - -#ifdef EFI_NT_EMULATOR - #define BREAKPOINT() __asm { int 3 } -#else - #define BREAKPOINT() while (TRUE); // Make it hang on Bios[Dbg]32 -#endif - -// -// 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)) -// -// To export & import functions in the EFI emulator environment -// - -#ifdef EFI_NT_EMULATOR - #define EXPORTAPI __declspec( dllexport ) -#else - #define EXPORTAPI -#endif - - -// -// 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 - #ifdef _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler - #elif defined(HAVE_USE_MS_ABI) - // Force amd64/ms calling conventions. - #define EFIAPI __attribute__((ms_abi)) - #else - #define EFIAPI // Substitute expresion to force C calling convention - #endif -#endif - -#define BOOTSERVICE -//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a -//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a -#define RUNTIMESERVICE -#define RUNTIMEFUNCTION - - -#define RUNTIME_CODE(a) alloc_text("rtcode", a) -#define BEGIN_RUNTIME_DATA() data_seg("rtdata") -#define END_RUNTIME_DATA() data_seg("") - -#define VOLATILE volatile - -#define MEMORY_FENCE() - -#ifdef EFI_NT_EMULATOR - -// -// To help ensure proper coding of integrated drivers, they are -// compiled as DLLs. In NT they require a dll init entry pointer. -// The macro puts a stub entry point into the DLL so it will load. -// - -#define EFI_DRIVER_ENTRY_POINT(InitFunction) \ - UINTN \ - __stdcall \ - _DllMainCRTStartup ( \ - UINTN Inst, \ - UINTN reason_for_call, \ - VOID *rserved \ - ) \ - { \ - return 1; \ - } \ - \ - int \ - EXPORTAPI \ - __cdecl \ - InitializeDriver ( \ - void *ImageHandle, \ - void *SystemTable \ - ) \ - { \ - return InitFunction(ImageHandle, SystemTable); \ - } - - - #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, NULL) - -#else // EFI_NT_EMULATOR - -// -// When 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) - -#endif // EFI_NT_EMULATOR - -// -// Some compilers don't support the forward reference construct: -// typedef struct XXXXX -// -// The following macro provide a workaround for such cases. -// -#ifdef NO_INTERFACE_DECL -#define INTERFACE_DECL(x) -#else -#if defined(__GNUC__) || defined(_MSC_EXTENSIONS) -#define INTERFACE_DECL(x) struct x -#else -#define INTERFACE_DECL(x) typedef struct x -#endif -#endif - -/* for x86_64, EFI_FUNCTION_WRAPPER must be defined */ -#if defined(HAVE_USE_MS_ABI) -#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__) -#else -/* - Credits for macro-magic: - https://groups.google.com/forum/?fromgroups#!topic/comp.std.c/d-6Mj5Lko_s - http://efesx.com/2010/08/31/overloading-macros/ -*/ -#define __VA_NARG__(...) \ - __VA_NARG_(_0, ## __VA_ARGS__, __RSEQ_N()) -#define __VA_NARG_(...) \ - __VA_ARG_N(__VA_ARGS__) -#define __VA_ARG_N( \ - _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,N,...) N -#define __RSEQ_N() \ - 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 - -#define __VA_ARG_NSUFFIX__(prefix,...) \ - __VA_ARG_NSUFFIX_N(prefix, __VA_NARG__(__VA_ARGS__)) -#define __VA_ARG_NSUFFIX_N(prefix,nargs) \ - __VA_ARG_NSUFFIX_N_(prefix, nargs) -#define __VA_ARG_NSUFFIX_N_(prefix,nargs) \ - prefix ## nargs - -/* Prototypes of EFI cdecl -> stdcall trampolines */ -UINT64 efi_call0(void *func); -UINT64 efi_call1(void *func, UINT64 arg1); -UINT64 efi_call2(void *func, UINT64 arg1, UINT64 arg2); -UINT64 efi_call3(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3); -UINT64 efi_call4(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, - UINT64 arg4); -UINT64 efi_call5(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, - UINT64 arg4, UINT64 arg5); -UINT64 efi_call6(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, - UINT64 arg4, UINT64 arg5, UINT64 arg6); -UINT64 efi_call7(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, - UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7); -UINT64 efi_call8(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, - UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7, - UINT64 arg8); -UINT64 efi_call9(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, - UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7, - UINT64 arg8, UINT64 arg9); -UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3, - UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7, - UINT64 arg8, UINT64 arg9, UINT64 arg10); - -/* Front-ends to efi_callX to avoid compiler warnings */ -#define _cast64_efi_call0(f) \ - efi_call0(f) -#define _cast64_efi_call1(f,a1) \ - efi_call1(f, (UINT64)(a1)) -#define _cast64_efi_call2(f,a1,a2) \ - efi_call2(f, (UINT64)(a1), (UINT64)(a2)) -#define _cast64_efi_call3(f,a1,a2,a3) \ - efi_call3(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3)) -#define _cast64_efi_call4(f,a1,a2,a3,a4) \ - efi_call4(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4)) -#define _cast64_efi_call5(f,a1,a2,a3,a4,a5) \ - efi_call5(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ - (UINT64)(a5)) -#define _cast64_efi_call6(f,a1,a2,a3,a4,a5,a6) \ - efi_call6(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ - (UINT64)(a5), (UINT64)(a6)) -#define _cast64_efi_call7(f,a1,a2,a3,a4,a5,a6,a7) \ - efi_call7(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ - (UINT64)(a5), (UINT64)(a6), (UINT64)(a7)) -#define _cast64_efi_call8(f,a1,a2,a3,a4,a5,a6,a7,a8) \ - efi_call8(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ - (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8)) -#define _cast64_efi_call9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) \ - efi_call9(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ - (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8), \ - (UINT64)(a9)) -#define _cast64_efi_call10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \ - efi_call10(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \ - (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8), \ - (UINT64)(a9), (UINT64)(a10)) - -/* main wrapper (va_num ignored) */ -#define uefi_call_wrapper(func,va_num,...) \ - __VA_ARG_NSUFFIX__(_cast64_efi_call, __VA_ARGS__) (func , ##__VA_ARGS__) - -#endif - -#if defined(HAVE_USE_MS_ABI) && !defined(_MSC_EXTENSIONS) - #define EFI_FUNCTION __attribute__((ms_abi)) -#else - #define EFI_FUNCTION -#endif - -#ifdef _MSC_EXTENSIONS -#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP -#endif - -#endif diff --git a/3rd/gnu-efi/inc/x86_64/efilibplat.h b/3rd/gnu-efi/inc/x86_64/efilibplat.h deleted file mode 100644 index 3844578dd..000000000 --- a/3rd/gnu-efi/inc/x86_64/efilibplat.h +++ /dev/null @@ -1,26 +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 - ); - - diff --git a/3rd/gnu-efi/inc/x86_64/efisetjmp_arch.h b/3rd/gnu-efi/inc/x86_64/efisetjmp_arch.h deleted file mode 100644 index b1ad1fe30..000000000 --- a/3rd/gnu-efi/inc/x86_64/efisetjmp_arch.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef GNU_EFI_X86_64_SETJMP_H -#define GNU_EFI_X86_64_SETJMP_H - -#define JMPBUF_ALIGN 8 - -typedef struct { - UINT64 Rbx; - UINT64 Rsp; - UINT64 Rbp; - - UINT64 Rdi; - UINT64 Rsi; - UINT64 R12; - UINT64 R13; - UINT64 R14; - UINT64 R15; - UINT64 Rip; - UINT64 MxCsr; - UINT8 XmmBuffer[160]; // XMM6 - XMM15 -} ALIGN(JMPBUF_ALIGN) jmp_buf[1]; - -#endif /* GNU_EFI_X86_64_SETJMP_H */ diff --git a/3rd/gnu-efi/inc/x86_64/pe.h b/3rd/gnu-efi/inc/x86_64/pe.h deleted file mode 100644 index 979b9360e..000000000 --- a/3rd/gnu-efi/inc/x86_64/pe.h +++ /dev/null @@ -1,595 +0,0 @@ -/* - PE32+ header file - */ -#ifndef _PE_H -#define _PE_H - -#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ -#define IMAGE_OS2_SIGNATURE 0x454E // NE -#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE -#define IMAGE_NT_SIGNATURE 0x00004550 // PE00 -#define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED - - -typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header - UINT16 e_magic; // Magic number - UINT16 e_cblp; // Bytes on last page of file - UINT16 e_cp; // Pages in file - UINT16 e_crlc; // Relocations - UINT16 e_cparhdr; // Size of header in paragraphs - UINT16 e_minalloc; // Minimum extra paragraphs needed - UINT16 e_maxalloc; // Maximum extra paragraphs needed - UINT16 e_ss; // Initial (relative) SS value - UINT16 e_sp; // Initial SP value - UINT16 e_csum; // Checksum - UINT16 e_ip; // Initial IP value - UINT16 e_cs; // Initial (relative) CS value - UINT16 e_lfarlc; // File address of relocation table - UINT16 e_ovno; // Overlay number - UINT16 e_res[4]; // Reserved words - UINT16 e_oemid; // OEM identifier (for e_oeminfo) - UINT16 e_oeminfo; // OEM information; e_oemid specific - UINT16 e_res2[10]; // Reserved words - UINT32 e_lfanew; // File address of new exe header - } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; - -typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header - UINT16 ne_magic; // Magic number - UINT8 ne_ver; // Version number - UINT8 ne_rev; // Revision number - UINT16 ne_enttab; // Offset of Entry Table - UINT16 ne_cbenttab; // Number of bytes in Entry Table - UINT32 ne_crc; // Checksum of whole file - UINT16 ne_flags; // Flag UINT16 - UINT16 ne_autodata; // Automatic data segment number - UINT16 ne_heap; // Initial heap allocation - UINT16 ne_stack; // Initial stack allocation - UINT32 ne_csip; // Initial CS:IP setting - UINT32 ne_sssp; // Initial SS:SP setting - UINT16 ne_cseg; // Count of file segments - UINT16 ne_cmod; // Entries in Module Reference Table - UINT16 ne_cbnrestab; // Size of non-resident name table - UINT16 ne_segtab; // Offset of Segment Table - UINT16 ne_rsrctab; // Offset of Resource Table - UINT16 ne_restab; // Offset of resident name table - UINT16 ne_modtab; // Offset of Module Reference Table - UINT16 ne_imptab; // Offset of Imported Names Table - UINT32 ne_nrestab; // Offset of Non-resident Names Table - UINT16 ne_cmovent; // Count of movable entries - UINT16 ne_align; // Segment alignment shift count - UINT16 ne_cres; // Count of resource segments - UINT8 ne_exetyp; // Target Operating system - UINT8 ne_flagsothers; // Other .EXE flags - UINT16 ne_pretthunks; // offset to return thunks - UINT16 ne_psegrefbytes; // offset to segment ref. bytes - UINT16 ne_swaparea; // Minimum code swap area size - UINT16 ne_expver; // Expected Windows version number - } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; - -// -// File header format. -// - -typedef struct _IMAGE_FILE_HEADER { - UINT16 Machine; - UINT16 NumberOfSections; - UINT32 TimeDateStamp; - UINT32 PointerToSymbolTable; - UINT32 NumberOfSymbols; - UINT16 SizeOfOptionalHeader; - UINT16 Characteristics; -} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; - -#define IMAGE_SIZEOF_FILE_HEADER 20 - -#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file. -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references). -#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file. -#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file. -#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed. -#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine. -#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file -#define IMAGE_FILE_SYSTEM 0x1000 // System File. -#define IMAGE_FILE_DLL 0x2000 // File is a DLL. -#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed. - -#define IMAGE_FILE_MACHINE_UNKNOWN 0 -#define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386. -#define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian -#define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian -#define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP -#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED 0x1c2 // Arm/Thumb -#define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian -#define IMAGE_FILE_MACHINE_IA64 0x200 // IA-64 -#define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine -#define IMAGE_FILE_MACHINE_EBC 0xebc // EFI Byte Code -#define IMAGE_FILE_MACHINE_X64 0x8664 // x86_64 -// -// Directory format. -// - -typedef struct _IMAGE_DATA_DIRECTORY { - UINT32 VirtualAddress; - UINT32 Size; -} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; - -#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 - -// -// Optional header format. -// - -typedef struct _IMAGE_OPTIONAL_HEADER { - // - // Standard fields. - // - - UINT16 Magic; - UINT8 MajorLinkerVersion; - UINT8 MinorLinkerVersion; - UINT32 SizeOfCode; - UINT32 SizeOfInitializedData; - UINT32 SizeOfUninitializedData; - UINT32 AddressOfEntryPoint; - UINT32 BaseOfCode; - UINT32 BaseOfData; - - // - // NT additional fields. - // - - UINT32 ImageBase; - UINT32 SectionAlignment; - UINT32 FileAlignment; - UINT16 MajorOperatingSystemVersion; - UINT16 MinorOperatingSystemVersion; - UINT16 MajorImageVersion; - UINT16 MinorImageVersion; - UINT16 MajorSubsystemVersion; - UINT16 MinorSubsystemVersion; - UINT32 Reserved1; - UINT32 SizeOfImage; - UINT32 SizeOfHeaders; - UINT32 CheckSum; - UINT16 Subsystem; - UINT16 DllCharacteristics; - UINT32 SizeOfStackReserve; - UINT32 SizeOfStackCommit; - UINT32 SizeOfHeapReserve; - UINT32 SizeOfHeapCommit; - UINT32 LoaderFlags; - UINT32 NumberOfRvaAndSizes; - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; -} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; - -typedef struct _IMAGE_ROM_OPTIONAL_HEADER { - UINT16 Magic; - UINT8 MajorLinkerVersion; - UINT8 MinorLinkerVersion; - UINT32 SizeOfCode; - UINT32 SizeOfInitializedData; - UINT32 SizeOfUninitializedData; - UINT32 AddressOfEntryPoint; - UINT32 BaseOfCode; - UINT32 BaseOfData; - UINT32 BaseOfBss; - UINT32 GprMask; - UINT32 CprMask[4]; - UINT32 GpValue; -} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER; - -#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56 -#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 -#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224 - -#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b -#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 - -typedef struct _IMAGE_NT_HEADERS { - UINT32 Signature; - IMAGE_FILE_HEADER FileHeader; - IMAGE_OPTIONAL_HEADER OptionalHeader; -} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; - -typedef struct _IMAGE_ROM_HEADERS { - IMAGE_FILE_HEADER FileHeader; - IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; -} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS; - -#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \ - ((UINT32)ntheader + \ - FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \ - ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \ - )) - - -// Subsystem Values - -#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem. -#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem. -#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem. -#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem. -#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix character subsystem. - - -// Directory Entries - -#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory -#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory -#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory -#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory -#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory -#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table -#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory -#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String -#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP) -#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory -#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory - -// -// Section header format. -// - -#define IMAGE_SIZEOF_SHORT_NAME 8 - -typedef struct _IMAGE_SECTION_HEADER { - UINT8 Name[IMAGE_SIZEOF_SHORT_NAME]; - union { - UINT32 PhysicalAddress; - UINT32 VirtualSize; - } Misc; - UINT32 VirtualAddress; - UINT32 SizeOfRawData; - UINT32 PointerToRawData; - UINT32 PointerToRelocations; - UINT32 PointerToLinenumbers; - UINT16 NumberOfRelocations; - UINT16 NumberOfLinenumbers; - UINT32 Characteristics; -} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; - -#define IMAGE_SIZEOF_SECTION_HEADER 40 - -#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved. - -#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code. -#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data. -#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data. - -#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved. -#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information. -#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image. -#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat. - -#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 // -#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 // -#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 // -#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 // -#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified. -#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 // -#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 // - -#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded. -#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable. -#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable. -#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable. -#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable. -#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable. -#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable. - -// -// Symbol format. -// - - -#define IMAGE_SIZEOF_SYMBOL 18 - -// -// Section values. -// -// Symbols have a section number of the section in which they are -// defined. Otherwise, section numbers have the following meanings: -// - -#define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is undefined or is common. -#define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an absolute value. -#define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a special debug item. - -// -// Type (fundamental) values. -// - -#define IMAGE_SYM_TYPE_NULL 0 // no type. -#define IMAGE_SYM_TYPE_VOID 1 // -#define IMAGE_SYM_TYPE_CHAR 2 // type character. -#define IMAGE_SYM_TYPE_SHORT 3 // type short integer. -#define IMAGE_SYM_TYPE_INT 4 // -#define IMAGE_SYM_TYPE_LONG 5 // -#define IMAGE_SYM_TYPE_FLOAT 6 // -#define IMAGE_SYM_TYPE_DOUBLE 7 // -#define IMAGE_SYM_TYPE_STRUCT 8 // -#define IMAGE_SYM_TYPE_UNION 9 // -#define IMAGE_SYM_TYPE_ENUM 10 // enumeration. -#define IMAGE_SYM_TYPE_MOE 11 // member of enumeration. -#define IMAGE_SYM_TYPE_BYTE 12 // -#define IMAGE_SYM_TYPE_WORD 13 // -#define IMAGE_SYM_TYPE_UINT 14 // -#define IMAGE_SYM_TYPE_DWORD 15 // - -// -// Type (derived) values. -// - -#define IMAGE_SYM_DTYPE_NULL 0 // no derived type. -#define IMAGE_SYM_DTYPE_POINTER 1 // pointer. -#define IMAGE_SYM_DTYPE_FUNCTION 2 // function. -#define IMAGE_SYM_DTYPE_ARRAY 3 // array. - -// -// Storage classes. -// - -#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1 -#define IMAGE_SYM_CLASS_NULL 0 -#define IMAGE_SYM_CLASS_AUTOMATIC 1 -#define IMAGE_SYM_CLASS_EXTERNAL 2 -#define IMAGE_SYM_CLASS_STATIC 3 -#define IMAGE_SYM_CLASS_REGISTER 4 -#define IMAGE_SYM_CLASS_EXTERNAL_DEF 5 -#define IMAGE_SYM_CLASS_LABEL 6 -#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7 -#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8 -#define IMAGE_SYM_CLASS_ARGUMENT 9 -#define IMAGE_SYM_CLASS_STRUCT_TAG 10 -#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11 -#define IMAGE_SYM_CLASS_UNION_TAG 12 -#define IMAGE_SYM_CLASS_TYPE_DEFINITION 13 -#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14 -#define IMAGE_SYM_CLASS_ENUM_TAG 15 -#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16 -#define IMAGE_SYM_CLASS_REGISTER_PARAM 17 -#define IMAGE_SYM_CLASS_BIT_FIELD 18 -#define IMAGE_SYM_CLASS_BLOCK 100 -#define IMAGE_SYM_CLASS_FUNCTION 101 -#define IMAGE_SYM_CLASS_END_OF_STRUCT 102 -#define IMAGE_SYM_CLASS_FILE 103 -// new -#define IMAGE_SYM_CLASS_SECTION 104 -#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105 - -// type packing constants - -#define N_BTMASK 017 -#define N_TMASK 060 -#define N_TMASK1 0300 -#define N_TMASK2 0360 -#define N_BTSHFT 4 -#define N_TSHIFT 2 - -// MACROS - -// -// Communal selection types. -// - -#define IMAGE_COMDAT_SELECT_NODUPLICATES 1 -#define IMAGE_COMDAT_SELECT_ANY 2 -#define IMAGE_COMDAT_SELECT_SAME_SIZE 3 -#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 -#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 - -#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 -#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 -#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 - - -// -// Relocation format. -// - -typedef struct _IMAGE_RELOCATION { - UINT32 VirtualAddress; - UINT32 SymbolTableIndex; - UINT16 Type; -} IMAGE_RELOCATION; - -#define IMAGE_SIZEOF_RELOCATION 10 - -// -// I386 relocation types. -// - -#define IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address -#define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included -#define IMAGE_REL_I386_SEG12 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address -#define IMAGE_REL_I386_SECTION 012 -#define IMAGE_REL_I386_SECREL 013 -#define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address - -// -// MIPS relocation types. -// - -#define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is absolute, no relocation is necessary -#define IMAGE_REL_MIPS_REFHALF 01 -#define IMAGE_REL_MIPS_REFWORD 02 -#define IMAGE_REL_MIPS_JMPADDR 03 -#define IMAGE_REL_MIPS_REFHI 04 -#define IMAGE_REL_MIPS_REFLO 05 -#define IMAGE_REL_MIPS_GPREL 06 -#define IMAGE_REL_MIPS_LITERAL 07 -#define IMAGE_REL_MIPS_SECTION 012 -#define IMAGE_REL_MIPS_SECREL 013 -#define IMAGE_REL_MIPS_REFWORDNB 042 -#define IMAGE_REL_MIPS_PAIR 045 - -// -// Alpha Relocation types. -// - -#define IMAGE_REL_ALPHA_ABSOLUTE 0x0 -#define IMAGE_REL_ALPHA_REFLONG 0x1 -#define IMAGE_REL_ALPHA_REFQUAD 0x2 -#define IMAGE_REL_ALPHA_GPREL32 0x3 -#define IMAGE_REL_ALPHA_LITERAL 0x4 -#define IMAGE_REL_ALPHA_LITUSE 0x5 -#define IMAGE_REL_ALPHA_GPDISP 0x6 -#define IMAGE_REL_ALPHA_BRADDR 0x7 -#define IMAGE_REL_ALPHA_HINT 0x8 -#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9 -#define IMAGE_REL_ALPHA_REFHI 0xA -#define IMAGE_REL_ALPHA_REFLO 0xB -#define IMAGE_REL_ALPHA_PAIR 0xC -#define IMAGE_REL_ALPHA_MATCH 0xD -#define IMAGE_REL_ALPHA_SECTION 0xE -#define IMAGE_REL_ALPHA_SECREL 0xF -#define IMAGE_REL_ALPHA_REFLONGNB 0x10 - -// -// IBM PowerPC relocation types. -// - -#define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP -#define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address -#define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address -#define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2 (branch absolute) -#define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address -#define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load doubleword) -#define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted left 2 (branch relative) -#define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted left 2 (br cond relative) -#define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base -#define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted left 2 (load doubleword) - -#define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base -#define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an image sectionhdr) -#define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number -#define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction iff symbol is glue code -#define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address is TOC restore instruction - -#define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in IMAGE_RELOCATION.Type - -// Flag bits in IMAGE_RELOCATION.TYPE - -#define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than adding it -#define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict branch taken -#define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict branch not taken -#define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data in toc) - -// -// Based relocation format. -// - -typedef struct _IMAGE_BASE_RELOCATION { - UINT32 VirtualAddress; - UINT32 SizeOfBlock; -// UINT16 TypeOffset[1]; -} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION; - -#define IMAGE_SIZEOF_BASE_RELOCATION 8 - -// -// Based relocation types. -// - -#define IMAGE_REL_BASED_ABSOLUTE 0 -#define IMAGE_REL_BASED_HIGH 1 -#define IMAGE_REL_BASED_LOW 2 -#define IMAGE_REL_BASED_HIGHLOW 3 -#define IMAGE_REL_BASED_HIGHADJ 4 -#define IMAGE_REL_BASED_MIPS_JMPADDR 5 -#define IMAGE_REL_BASED_IA64_IMM64 9 -#define IMAGE_REL_BASED_DIR64 10 - -// -// Line number format. -// - -typedef struct _IMAGE_LINENUMBER { - union { - UINT32 SymbolTableIndex; // Symbol table index of function name if Linenumber is 0. - UINT32 VirtualAddress; // Virtual address of line number. - } Type; - UINT16 Linenumber; // Line number. -} IMAGE_LINENUMBER; - -#define IMAGE_SIZEOF_LINENUMBER 6 - -// -// Archive format. -// - -#define IMAGE_ARCHIVE_START_SIZE 8 -#define IMAGE_ARCHIVE_START "!\n" -#define IMAGE_ARCHIVE_END "`\n" -#define IMAGE_ARCHIVE_PAD "\n" -#define IMAGE_ARCHIVE_LINKER_MEMBER "/ " -#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " - -typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { - UINT8 Name[16]; // File member name - `/' terminated. - UINT8 Date[12]; // File member date - decimal. - UINT8 UserID[6]; // File member user id - decimal. - UINT8 GroupID[6]; // File member group id - decimal. - UINT8 Mode[8]; // File member mode - octal. - UINT8 Size[10]; // File member size - decimal. - UINT8 EndHeader[2]; // String to end header. -} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; - -#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 - -// -// DLL support. -// - -// -// Export Format -// - -typedef struct _IMAGE_EXPORT_DIRECTORY { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT16 MajorVersion; - UINT16 MinorVersion; - UINT32 Name; - UINT32 Base; - UINT32 NumberOfFunctions; - UINT32 NumberOfNames; - UINT32 *AddressOfFunctions; - UINT32 *AddressOfNames; - UINT32 *AddressOfNameOrdinals; -} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; - -// -// Import Format -// - -typedef struct _IMAGE_IMPORT_BY_NAME { - UINT16 Hint; - UINT8 Name[1]; -} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; - -typedef struct _IMAGE_THUNK_DATA { - union { - UINT32 Function; - UINT32 Ordinal; - PIMAGE_IMPORT_BY_NAME AddressOfData; - } u1; -} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA; - -#define IMAGE_ORDINAL_FLAG 0x80000000 -#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0) -#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff) - -typedef struct _IMAGE_IMPORT_DESCRIPTOR { - UINT32 Characteristics; - UINT32 TimeDateStamp; - UINT32 ForwarderChain; - UINT32 Name; - PIMAGE_THUNK_DATA FirstThunk; -} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR; - -#endif diff --git a/3rd/gnu-efi/lib/Makefile b/3rd/gnu-efi/lib/Makefile deleted file mode 100644 index 4e0c9bee2..000000000 --- a/3rd/gnu-efi/lib/Makefile +++ /dev/null @@ -1,93 +0,0 @@ -# -# Copyright (C) 1999-2001 Hewlett-Packard Co. -# Contributed by David Mosberger -# Contributed by Stephane Eranian -# -# 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 = boxdraw smbios console crc data debug dpath \ - entry error event exit guid hand hw init lock \ - misc pause print sread str cmdline\ - runtime/rtlock runtime/efirtlib runtime/rtstr runtime/vm runtime/rtdata \ - $(ARCH)/initplat $(ARCH)/math $(ARCH)/setjmp - -ifeq ($(ARCH),ia64) -FILES += $(ARCH)/salpal $(ARCH)/palproc -endif - -ifeq ($(ARCH),x86_64) -FILES += $(ARCH)/callwrap $(ARCH)/efi_stub -endif - -ifeq ($(ARCH),arm) -FILES += $(ARCH)/uldiv $(ARCH)/ldivmod $(ARCH)/div $(ARCH)/llsl $(ARCH)/llsr \ - $(ARCH)/mullu -endif - -OBJS = $(FILES:%=%.o) ctors.o - -SUBDIRS = ia32 x86_64 ia64 aarch64 arm mips64el riscv64 loongarch64 runtime - -LIBDIRINSTALL = $(INSTALLROOT)$(LIBDIR) - -all: libsubdirs libefi.a - -.PHONY: libsubdirs -libsubdirs: - @set -e ; for sdir in $(SUBDIRS); do mkdir -p $$sdir; done - -$(OBJS): libsubdirs - -libefi.a: $(OBJS) - $(AR) $(ARFLAGS) $@ $^ - -clean: - rm -f libefi.a *~ $(OBJS) */*.o - -$(LIBDIRINSTALL): - mkdir -p $@ - -$(LIBDIRINSTALL)/libefi.a: libefi.a | $(LIBDIRINSTALL) - $(INSTALL) -m 644 $< $(dir $@) - -install: $(LIBDIRINSTALL)/libefi.a - -include $(SRCDIR)/../Make.rules diff --git a/3rd/gnu-efi/lib/aarch64/efi_stub.S b/3rd/gnu-efi/lib/aarch64/efi_stub.S deleted file mode 100644 index f84aaf293..000000000 --- a/3rd/gnu-efi/lib/aarch64/efi_stub.S +++ /dev/null @@ -1,5 +0,0 @@ -/* This stub is a stub to make the build happy */ - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/aarch64/initplat.c b/3rd/gnu-efi/lib/aarch64/initplat.c deleted file mode 100644 index 6c5e1fa52..000000000 --- a/3rd/gnu-efi/lib/aarch64/initplat.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copright (C) 2014 Linaro Ltd. - * Author: Ard Biesheuvel - * - * 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. - */ - -#include "lib.h" - -VOID -InitializeLibPlatform ( - IN EFI_HANDLE ImageHandle EFI_UNUSED, - IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED - ) -{ -} diff --git a/3rd/gnu-efi/lib/aarch64/math.c b/3rd/gnu-efi/lib/aarch64/math.c deleted file mode 100644 index 8c1644466..000000000 --- a/3rd/gnu-efi/lib/aarch64/math.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copright (C) 2014 Linaro Ltd. - * Author: Ard Biesheuvel - * - * 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. - */ - -#include "lib.h" - -UINT64 -LShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Left shift 64bit by 32bit and get a 64bit result -{ - return Operand << Count; -} - -UINT64 -RShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Right shift 64bit by 32bit and get a 64bit result -{ - return Operand >> Count; -} - - -UINT64 -MultU64x32 ( - IN UINT64 Multiplicand, - IN UINTN Multiplier - ) -// Multiple 64bit by 32bit and get a 64bit result -{ - return Multiplicand * Multiplier; -} - -UINT64 -DivU64x32 ( - IN UINT64 Dividend, - IN UINTN Divisor, - OUT UINTN *Remainder OPTIONAL - ) -// divide 64bit by 32bit and get a 64bit result -// N.B. only works for 31bit divisors!! -{ - if (Remainder) - *Remainder = Dividend % Divisor; - return Dividend / Divisor; -} diff --git a/3rd/gnu-efi/lib/aarch64/setjmp.S b/3rd/gnu-efi/lib/aarch64/setjmp.S deleted file mode 100644 index 700af785d..000000000 --- a/3rd/gnu-efi/lib/aarch64/setjmp.S +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. - * This program and the accompanying materials are licensed and made -available - * under the terms and conditions of the BSD License which accompanies -this - * distribution. The full text of the license may be found at - * http://opensource.org/licenses/bsd-license.php. - * - * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" -BASIS, - * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR - * IMPLIED. - */ - .text - .p2align 3 - -#define GPR_LAYOUT \ - REG_PAIR (x19, x20, 0); \ - REG_PAIR (x21, x22, 16); \ - REG_PAIR (x23, x24, 32); \ - REG_PAIR (x25, x26, 48); \ - REG_PAIR (x27, x28, 64); \ - REG_PAIR (x29, x30, 80); \ - REG_ONE (x16, 96) - -#define FPR_LAYOUT \ - REG_PAIR(d8, d9, 112); \ - REG_PAIR(d10, d11, 128); \ - REG_PAIR(d12, d13, 144); \ - REG_PAIR(d14, d15, 160); - -#define REG_PAIR(REG1, REG2, OFFS) stp REG1, REG2, [x0, OFFS] -#define REG_ONE(REG1, OFFS) str REG1, [x0, OFFS] - - .globl setjmp - .type setjmp, @function -setjmp: - mov x16, sp - GPR_LAYOUT - FPR_LAYOUT - mov w0, #0 - ret - -#undef REG_PAIR -#undef REG_ONE - -#define REG_PAIR(REG1, REG2, OFFS) ldp REG1, REG2, [x0, OFFS] -#define REG_ONE(REG1, OFFS) ldr REG1, [x0, OFFS] - - .globl longjmp - .type longjmp, @function -longjmp: - GPR_LAYOUT - FPR_LAYOUT - mov sp, x16 - cmp w1, #0 - mov w0, #1 - csel w0, w1, w0, ne - br x30 - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/arm/div.S b/3rd/gnu-efi/lib/arm/div.S deleted file mode 100644 index 6371327f5..000000000 --- a/3rd/gnu-efi/lib/arm/div.S +++ /dev/null @@ -1,159 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2011, ARM. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -#include "edk2asm.h" - -.text -.align 2 -GCC_ASM_EXPORT(__aeabi_uidiv) -GCC_ASM_EXPORT(__aeabi_uidivmod) -GCC_ASM_EXPORT(__aeabi_idiv) -GCC_ASM_EXPORT(__aeabi_idivmod) - -# AREA Math, CODE, READONLY - -# -#UINT32 -#EFIAPI -#__aeabi_uidivmode ( -# IN UINT32 Dividen -# IN UINT32 Divisor -# ); -# - -ASM_PFX(__aeabi_uidiv): -ASM_PFX(__aeabi_uidivmod): - rsbs r12, r1, r0, LSR #4 - mov r2, #0 - bcc ASM_PFX(__arm_div4) - rsbs r12, r1, r0, LSR #8 - bcc ASM_PFX(__arm_div8) - mov r3, #0 - b ASM_PFX(__arm_div_large) - -# -#INT32 -#EFIAPI -#__aeabi_idivmode ( -# IN INT32 Dividen -# IN INT32 Divisor -# ); -# -ASM_PFX(__aeabi_idiv): -ASM_PFX(__aeabi_idivmod): - orrs r12, r0, r1 - bmi ASM_PFX(__arm_div_negative) - rsbs r12, r1, r0, LSR #1 - mov r2, #0 - bcc ASM_PFX(__arm_div1) - rsbs r12, r1, r0, LSR #4 - bcc ASM_PFX(__arm_div4) - rsbs r12, r1, r0, LSR #8 - bcc ASM_PFX(__arm_div8) - mov r3, #0 - b ASM_PFX(__arm_div_large) -ASM_PFX(__arm_div8): - rsbs r12, r1, r0, LSR #7 - subcs r0, r0, r1, LSL #7 - adc r2, r2, r2 - rsbs r12, r1, r0,LSR #6 - subcs r0, r0, r1, LSL #6 - adc r2, r2, r2 - rsbs r12, r1, r0, LSR #5 - subcs r0, r0, r1, LSL #5 - adc r2, r2, r2 - rsbs r12, r1, r0, LSR #4 - subcs r0, r0, r1, LSL #4 - adc r2, r2, r2 -ASM_PFX(__arm_div4): - rsbs r12, r1, r0, LSR #3 - subcs r0, r0, r1, LSL #3 - adc r2, r2, r2 - rsbs r12, r1, r0, LSR #2 - subcs r0, r0, r1, LSL #2 - adcs r2, r2, r2 - rsbs r12, r1, r0, LSR #1 - subcs r0, r0, r1, LSL #1 - adc r2, r2, r2 -ASM_PFX(__arm_div1): - subs r1, r0, r1 - movcc r1, r0 - adc r0, r2, r2 - bx r14 -ASM_PFX(__arm_div_negative): - ands r2, r1, #0x80000000 - rsbmi r1, r1, #0 - eors r3, r2, r0, ASR #32 - rsbcs r0, r0, #0 - rsbs r12, r1, r0, LSR #4 - bcc label1 - rsbs r12, r1, r0, LSR #8 - bcc label2 -ASM_PFX(__arm_div_large): - lsl r1, r1, #6 - rsbs r12, r1, r0, LSR #8 - orr r2, r2, #0xfc000000 - bcc label2 - lsl r1, r1, #6 - rsbs r12, r1, r0, LSR #8 - orr r2, r2, #0x3f00000 - bcc label2 - lsl r1, r1, #6 - rsbs r12, r1, r0, LSR #8 - orr r2, r2, #0xfc000 - orrcs r2, r2, #0x3f00 - lslcs r1, r1, #6 - rsbs r12, r1, #0 - bcs ASM_PFX(__aeabi_idiv0) -label3: - lsrcs r1, r1, #6 -label2: - rsbs r12, r1, r0, LSR #7 - subcs r0, r0, r1, LSL #7 - adc r2, r2, r2 - rsbs r12, r1, r0, LSR #6 - subcs r0, r0, r1, LSL #6 - adc r2, r2, r2 - rsbs r12, r1, r0, LSR #5 - subcs r0, r0, r1, LSL #5 - adc r2, r2, r2 - rsbs r12, r1, r0, LSR #4 - subcs r0, r0, r1, LSL #4 - adc r2, r2, r2 -label1: - rsbs r12, r1, r0, LSR #3 - subcs r0, r0, r1, LSL #3 - adc r2, r2, r2 - rsbs r12, r1, r0, LSR #2 - subcs r0, r0, r1, LSL #2 - adcs r2, r2, r2 - bcs label3 - rsbs r12, r1, r0, LSR #1 - subcs r0, r0, r1, LSL #1 - adc r2, r2, r2 - subs r1, r0, r1 - movcc r1, r0 - adc r0, r2, r2 - asrs r3, r3, #31 - rsbmi r0, r0, #0 - rsbcs r1, r1, #0 - bx r14 - - @ What to do about division by zero? For now, just return. -ASM_PFX(__aeabi_idiv0): - bx r14 - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/arm/edk2asm.h b/3rd/gnu-efi/lib/arm/edk2asm.h deleted file mode 100644 index 9515eaf77..000000000 --- a/3rd/gnu-efi/lib/arm/edk2asm.h +++ /dev/null @@ -1,6 +0,0 @@ - -#define ASM_PFX(x) x -#define GCC_ASM_EXPORT(x) \ - .globl x ; \ - .type x, %function - diff --git a/3rd/gnu-efi/lib/arm/efi_stub.S b/3rd/gnu-efi/lib/arm/efi_stub.S deleted file mode 100644 index f84aaf293..000000000 --- a/3rd/gnu-efi/lib/arm/efi_stub.S +++ /dev/null @@ -1,5 +0,0 @@ -/* This stub is a stub to make the build happy */ - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/arm/initplat.c b/3rd/gnu-efi/lib/arm/initplat.c deleted file mode 100644 index 135a64921..000000000 --- a/3rd/gnu-efi/lib/arm/initplat.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copright (C) 2014 Linaro Ltd. - * Author: Ard Biesheuvel - * - * 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. - */ - -#include "lib.h" - -VOID -InitializeLibPlatform ( - IN EFI_HANDLE ImageHandle EFI_UNUSED, - IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED - ) -{ -} - -#ifdef __GNUC__ -void __div0(void) -{ - // TODO handle divide by zero fault - while (1); -} -#endif diff --git a/3rd/gnu-efi/lib/arm/ldivmod.S b/3rd/gnu-efi/lib/arm/ldivmod.S deleted file mode 100644 index a0648cc07..000000000 --- a/3rd/gnu-efi/lib/arm/ldivmod.S +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -//------------------------------------------------------------------------------ - - -#include "edk2asm.h" - - .text - .align 2 - GCC_ASM_EXPORT(__aeabi_ldivmod) - -// -// A pair of (unsigned) long longs is returned in {{r0, r1}, {r2, r3}}, -// the quotient in {r0, r1}, and the remainder in {r2, r3}. -// -//__value_in_regs lldiv_t -//EFIAPI -//__aeabi_ldivmod ( -// IN UINT64 Dividen -// IN UINT64 Divisor -// )// -// - -ASM_PFX(__aeabi_ldivmod): - push {r4,lr} - asrs r4,r1,#1 - eor r4,r4,r3,LSR #1 - bpl L_Test1 - rsbs r0,r0,#0 - rsc r1,r1,#0 -L_Test1: - tst r3,r3 - bpl L_Test2 - rsbs r2,r2,#0 - rsc r3,r3,#0 -L_Test2: - bl ASM_PFX(__aeabi_uldivmod) - tst r4,#0x40000000 - beq L_Test3 - rsbs r0,r0,#0 - rsc r1,r1,#0 -L_Test3: - tst r4,#0x80000000 - beq L_Exit - rsbs r2,r2,#0 - rsc r3,r3,#0 -L_Exit: - pop {r4,pc} - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/arm/llsl.S b/3rd/gnu-efi/lib/arm/llsl.S deleted file mode 100644 index d89d3dfbe..000000000 --- a/3rd/gnu-efi/lib/arm/llsl.S +++ /dev/null @@ -1,45 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2013, ARM. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -#include "edk2asm.h" - -.text -.align 2 -GCC_ASM_EXPORT(__aeabi_llsl) - -# -#VOID -#EFIAPI -#__aeabi_llsl ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINT32 Size -# ); -# -ASM_PFX(__aeabi_llsl): - subs r3,r2,#0x20 - bpl 1f - rsb r3,r2,#0x20 - lsl r1,r1,r2 - orr r1,r1,r0,lsr r3 - lsl r0,r0,r2 - bx lr -1: - lsl r1,r0,r3 - mov r0,#0 - bx lr - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/arm/llsr.S b/3rd/gnu-efi/lib/arm/llsr.S deleted file mode 100644 index 4ecf1e1f8..000000000 --- a/3rd/gnu-efi/lib/arm/llsr.S +++ /dev/null @@ -1,45 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2013, ARM. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -#include "edk2asm.h" - -.text -.align 2 -GCC_ASM_EXPORT(__aeabi_llsr) - -# -#VOID -#EFIAPI -#__aeabi_llsr ( -# IN VOID *Destination, -# IN VOID *Source, -# IN UINT32 Size -# ); -# -ASM_PFX(__aeabi_llsr): - subs r3,r2,#0x20 - bpl 1f - rsb r3,r2,#0x20 - lsr r0,r0,r2 - orr r0,r0,r1,lsl r3 - lsr r1,r1,r2 - bx lr -1: - lsr r0,r1,r3 - mov r1,#0 - bx lr - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/arm/math.c b/3rd/gnu-efi/lib/arm/math.c deleted file mode 100644 index 4793ae2fb..000000000 --- a/3rd/gnu-efi/lib/arm/math.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copright (C) 2014 Linaro Ltd. - * Author: Ard Biesheuvel - * - * 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. - */ - -#include "lib.h" - -UINT64 -LShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Left shift 64bit by 32bit and get a 64bit result -{ - return Operand << Count; -} - -UINT64 -RShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Right shift 64bit by 32bit and get a 64bit result -{ - return Operand >> Count; -} - - -UINT64 -MultU64x32 ( - IN UINT64 Multiplicand, - IN UINTN Multiplier - ) -// Multiply 64bit by 32bit and get a 64bit result -{ - return Multiplicand * Multiplier; -} - -UINT64 -DivU64x32 ( - IN UINT64 Dividend, - IN UINTN Divisor, - OUT UINTN *Remainder OPTIONAL - ) -{ - /* - * GCC turns a division into a multiplication and shift with precalculated - * constants if the divisor is constant and the dividend fits into a 32 bit - * variable. Otherwise, it will turn this into calls into the 32-bit div - * library functions. - */ - if (Remainder) - *Remainder = Dividend % Divisor; - return Dividend / Divisor; -} diff --git a/3rd/gnu-efi/lib/arm/mullu.S b/3rd/gnu-efi/lib/arm/mullu.S deleted file mode 100644 index 70cea2d95..000000000 --- a/3rd/gnu-efi/lib/arm/mullu.S +++ /dev/null @@ -1,37 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#------------------------------------------------------------------------------ - -#include "edk2asm.h" - -.text -GCC_ASM_EXPORT(__aeabi_lmul) -# -#INT64 -#EFIAPI -#__aeabi_lmul ( -# IN INT64 Multiplicand -# IN INT64 Multiplier -# ); -# -ASM_PFX(__aeabi_lmul): - stmdb sp!, {lr} - mov lr, r0 - umull r0, ip, r2, lr - mla r1, r2, r1, ip - mla r1, r3, lr, r1 - ldmia sp!, {pc} - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/arm/setjmp.S b/3rd/gnu-efi/lib/arm/setjmp.S deleted file mode 100644 index 24b709ae1..000000000 --- a/3rd/gnu-efi/lib/arm/setjmp.S +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. - * This program and the accompanying materials are licensed and made - * available under the terms and conditions of the BSD License which - * accompanies this distribution. The full text of the license may - * be found at http://opensource.org/licenses/bsd-license.php. - * - * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" - * BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER - * EXPRESS OR IMPLIED. - */ - .text - .arm - .globl setjmp - .type setjmp, %function -setjmp: - mov r3, r13 - stmia r0, {r3-r12,r14} - eor r0, r0, r0 - bx lr - - .globl longjmp - .type longjmp, %function -longjmp: - ldmia r0, {r3-r12,r14} - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/arm/uldiv.S b/3rd/gnu-efi/lib/arm/uldiv.S deleted file mode 100644 index d606476a2..000000000 --- a/3rd/gnu-efi/lib/arm/uldiv.S +++ /dev/null @@ -1,269 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
-// -// This program and the accompanying materials -// are licensed and made available under the terms and conditions of the BSD License -// which accompanies this distribution. The full text of the license may be found at -// http://opensource.org/licenses/bsd-license.php -// -// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -// -//------------------------------------------------------------------------------ - -#include "edk2asm.h" - - .text - .align 2 - GCC_ASM_EXPORT(__aeabi_uldivmod) - -// -//UINT64 -//EFIAPI -//__aeabi_uldivmod ( -// IN UINT64 Dividend -// IN UINT64 Divisor -// ) -// -ASM_PFX(__aeabi_uldivmod): - stmdb sp!, {r4, r5, r6, lr} - mov r4, r1 - mov r5, r0 - mov r6, #0 // 0x0 - orrs ip, r3, r2, lsr #31 - bne ASM_PFX(__aeabi_uldivmod_label1) - tst r2, r2 - beq ASM_PFX(_ll_div0) - movs ip, r2, lsr #15 - addeq r6, r6, #16 // 0x10 - mov ip, r2, lsl r6 - movs lr, ip, lsr #23 - moveq ip, ip, lsl #8 - addeq r6, r6, #8 // 0x8 - movs lr, ip, lsr #27 - moveq ip, ip, lsl #4 - addeq r6, r6, #4 // 0x4 - movs lr, ip, lsr #29 - moveq ip, ip, lsl #2 - addeq r6, r6, #2 // 0x2 - movs lr, ip, lsr #30 - moveq ip, ip, lsl #1 - addeq r6, r6, #1 // 0x1 - b ASM_PFX(_ll_udiv_small) -ASM_PFX(__aeabi_uldivmod_label1): - tst r3, #-2147483648 // 0x80000000 - bne ASM_PFX(__aeabi_uldivmod_label2) - movs ip, r3, lsr #15 - addeq r6, r6, #16 // 0x10 - mov ip, r3, lsl r6 - movs lr, ip, lsr #23 - moveq ip, ip, lsl #8 - addeq r6, r6, #8 // 0x8 - movs lr, ip, lsr #27 - moveq ip, ip, lsl #4 - addeq r6, r6, #4 // 0x4 - movs lr, ip, lsr #29 - moveq ip, ip, lsl #2 - addeq r6, r6, #2 // 0x2 - movs lr, ip, lsr #30 - addeq r6, r6, #1 // 0x1 - rsb r3, r6, #32 // 0x20 - moveq ip, ip, lsl #1 - orr ip, ip, r2, lsr r3 - mov lr, r2, lsl r6 - b ASM_PFX(_ll_udiv_big) -ASM_PFX(__aeabi_uldivmod_label2): - mov ip, r3 - mov lr, r2 - b ASM_PFX(_ll_udiv_ginormous) - -ASM_PFX(_ll_udiv_small): - cmp r4, ip, lsl #1 - mov r3, #0 // 0x0 - subcs r4, r4, ip, lsl #1 - addcs r3, r3, #2 // 0x2 - cmp r4, ip - subcs r4, r4, ip - adcs r3, r3, #0 // 0x0 - add r2, r6, #32 // 0x20 - cmp r2, #32 // 0x20 - rsb ip, ip, #0 // 0x0 - bcc ASM_PFX(_ll_udiv_small_label1) - orrs r0, r4, r5, lsr #30 - moveq r4, r5 - moveq r5, #0 // 0x0 - subeq r2, r2, #32 // 0x20 -ASM_PFX(_ll_udiv_small_label1): - mov r1, #0 // 0x0 - cmp r2, #16 // 0x10 - bcc ASM_PFX(_ll_udiv_small_label2) - movs r0, r4, lsr #14 - moveq r4, r4, lsl #16 - addeq r1, r1, #16 // 0x10 -ASM_PFX(_ll_udiv_small_label2): - sub lr, r2, r1 - cmp lr, #8 // 0x8 - bcc ASM_PFX(_ll_udiv_small_label3) - movs r0, r4, lsr #22 - moveq r4, r4, lsl #8 - addeq r1, r1, #8 // 0x8 -ASM_PFX(_ll_udiv_small_label3): - rsb r0, r1, #32 // 0x20 - sub r2, r2, r1 - orr r4, r4, r5, lsr r0 - mov r5, r5, lsl r1 - cmp r2, #1 // 0x1 - bcc ASM_PFX(_ll_udiv_small_label5) - sub r2, r2, #1 // 0x1 - and r0, r2, #7 // 0x7 - eor r0, r0, #7 // 0x7 - adds r0, r0, r0, lsl #1 - add pc, pc, r0, lsl #2 - nop // (mov r0,r0) -ASM_PFX(_ll_udiv_small_label4): - adcs r5, r5, r5 - adcs r4, ip, r4, lsl #1 - rsbcc r4, ip, r4 - adcs r5, r5, r5 - adcs r4, ip, r4, lsl #1 - rsbcc r4, ip, r4 - adcs r5, r5, r5 - adcs r4, ip, r4, lsl #1 - rsbcc r4, ip, r4 - adcs r5, r5, r5 - adcs r4, ip, r4, lsl #1 - rsbcc r4, ip, r4 - adcs r5, r5, r5 - adcs r4, ip, r4, lsl #1 - rsbcc r4, ip, r4 - adcs r5, r5, r5 - adcs r4, ip, r4, lsl #1 - rsbcc r4, ip, r4 - adcs r5, r5, r5 - adcs r4, ip, r4, lsl #1 - rsbcc r4, ip, r4 - adcs r5, r5, r5 - adcs r4, ip, r4, lsl #1 - sub r2, r2, #8 // 0x8 - tst r2, r2 - rsbcc r4, ip, r4 - bpl ASM_PFX(_ll_udiv_small_label4) -ASM_PFX(_ll_udiv_small_label5): - mov r2, r4, lsr r6 - bic r4, r4, r2, lsl r6 - adcs r0, r5, r5 - adc r1, r4, r4 - add r1, r1, r3, lsl r6 - mov r3, #0 // 0x0 - ldmia sp!, {r4, r5, r6, pc} - -ASM_PFX(_ll_udiv_big): - subs r0, r5, lr - mov r3, #0 // 0x0 - sbcs r1, r4, ip - movcs r5, r0 - movcs r4, r1 - adcs r3, r3, #0 // 0x0 - subs r0, r5, lr - sbcs r1, r4, ip - movcs r5, r0 - movcs r4, r1 - adcs r3, r3, #0 // 0x0 - subs r0, r5, lr - sbcs r1, r4, ip - movcs r5, r0 - movcs r4, r1 - adcs r3, r3, #0 // 0x0 - mov r1, #0 // 0x0 - rsbs lr, lr, #0 // 0x0 - rsc ip, ip, #0 // 0x0 - cmp r6, #16 // 0x10 - bcc ASM_PFX(_ll_udiv_big_label1) - movs r0, r4, lsr #14 - moveq r4, r4, lsl #16 - addeq r1, r1, #16 // 0x10 -ASM_PFX(_ll_udiv_big_label1): - sub r2, r6, r1 - cmp r2, #8 // 0x8 - bcc ASM_PFX(_ll_udiv_big_label2) - movs r0, r4, lsr #22 - moveq r4, r4, lsl #8 - addeq r1, r1, #8 // 0x8 -ASM_PFX(_ll_udiv_big_label2): - rsb r0, r1, #32 // 0x20 - sub r2, r6, r1 - orr r4, r4, r5, lsr r0 - mov r5, r5, lsl r1 - cmp r2, #1 // 0x1 - bcc ASM_PFX(_ll_udiv_big_label4) - sub r2, r2, #1 // 0x1 - and r0, r2, #3 // 0x3 - rsb r0, r0, #3 // 0x3 - adds r0, r0, r0, lsl #1 - add pc, pc, r0, lsl #3 - nop // (mov r0,r0) -ASM_PFX(_ll_udiv_big_label3): - adcs r5, r5, r5 - adcs r4, r4, r4 - adcs r0, lr, r5 - adcs r1, ip, r4 - movcs r5, r0 - movcs r4, r1 - adcs r5, r5, r5 - adcs r4, r4, r4 - adcs r0, lr, r5 - adcs r1, ip, r4 - movcs r5, r0 - movcs r4, r1 - adcs r5, r5, r5 - adcs r4, r4, r4 - adcs r0, lr, r5 - adcs r1, ip, r4 - movcs r5, r0 - movcs r4, r1 - sub r2, r2, #4 // 0x4 - adcs r5, r5, r5 - adcs r4, r4, r4 - adcs r0, lr, r5 - adcs r1, ip, r4 - tst r2, r2 - movcs r5, r0 - movcs r4, r1 - bpl ASM_PFX(_ll_udiv_big_label3) -ASM_PFX(_ll_udiv_big_label4): - mov r1, #0 // 0x0 - mov r2, r5, lsr r6 - bic r5, r5, r2, lsl r6 - adcs r0, r5, r5 - adc r1, r1, #0 // 0x0 - movs lr, r3, lsl r6 - mov r3, r4, lsr r6 - bic r4, r4, r3, lsl r6 - adc r1, r1, #0 // 0x0 - adds r0, r0, lr - orr r2, r2, r4, ror r6 - adc r1, r1, #0 // 0x0 - ldmia sp!, {r4, r5, r6, pc} - -ASM_PFX(_ll_udiv_ginormous): - subs r2, r5, lr - mov r1, #0 // 0x0 - sbcs r3, r4, ip - adc r0, r1, r1 - movcc r2, r5 - movcc r3, r4 - ldmia sp!, {r4, r5, r6, pc} - -ASM_PFX(_ll_div0): - ldmia sp!, {r4, r5, r6, lr} - mov r0, #0 // 0x0 - mov r1, #0 // 0x0 - b ASM_PFX(__aeabi_ldiv0) - -ASM_PFX(__aeabi_ldiv0): - bx r14 - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/boxdraw.c b/3rd/gnu-efi/lib/boxdraw.c deleted file mode 100644 index 5865fb917..000000000 --- a/3rd/gnu-efi/lib/boxdraw.c +++ /dev/null @@ -1,173 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - BoxDraw.c - -Abstract: - Lib functions to support Box Draw Unicode code pages. - - - -Revision History - ---*/ - -#include "lib.h" - -typedef struct { - CHAR16 Unicode; - CHAR8 PcAnsi; - CHAR8 Ascii; -} UNICODE_TO_CHAR; - - -// -// This list is used to define the valid extend chars. -// It also provides a mapping from Unicode to PCANSI or -// ASCII. The ASCII mapping we just made up. -// -// - -STATIC UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[] = { - { BOXDRAW_HORIZONTAL, 0xc4, L'-'}, - { BOXDRAW_VERTICAL, 0xb3, L'|'}, - { BOXDRAW_DOWN_RIGHT, 0xda, L'/'}, - { BOXDRAW_DOWN_LEFT, 0xbf, L'\\'}, - { BOXDRAW_UP_RIGHT, 0xc0, L'\\'}, - { BOXDRAW_UP_LEFT, 0xd9, L'/'}, - { BOXDRAW_VERTICAL_RIGHT, 0xc3, L'|'}, - { BOXDRAW_VERTICAL_LEFT, 0xb4, L'|'}, - { BOXDRAW_DOWN_HORIZONTAL, 0xc2, L'+'}, - { BOXDRAW_UP_HORIZONTAL, 0xc1, L'+'}, - { BOXDRAW_VERTICAL_HORIZONTAL, 0xc5, L'+'}, - { BOXDRAW_DOUBLE_HORIZONTAL, 0xcd, L'-'}, - { BOXDRAW_DOUBLE_VERTICAL, 0xba, L'|'}, - { BOXDRAW_DOWN_RIGHT_DOUBLE, 0xd5, L'/'}, - { BOXDRAW_DOWN_DOUBLE_RIGHT, 0xd6, L'/'}, - { BOXDRAW_DOUBLE_DOWN_RIGHT, 0xc9, L'/'}, - { BOXDRAW_DOWN_LEFT_DOUBLE, 0xb8, L'\\'}, - { BOXDRAW_DOWN_DOUBLE_LEFT, 0xb7, L'\\'}, - { BOXDRAW_DOUBLE_DOWN_LEFT, 0xbb, L'\\'}, - { BOXDRAW_UP_RIGHT_DOUBLE, 0xd4, L'\\'}, - { BOXDRAW_UP_DOUBLE_RIGHT, 0xd3, L'\\'}, - { BOXDRAW_DOUBLE_UP_RIGHT, 0xc8, L'\\'}, - { BOXDRAW_UP_LEFT_DOUBLE, 0xbe, L'/'}, - { BOXDRAW_UP_DOUBLE_LEFT, 0xbd, L'/'}, - { BOXDRAW_DOUBLE_UP_LEFT, 0xbc, L'/'}, - { BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0xc6, L'|'}, - { BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0xc7, L'|'}, - { BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0xcc, L'|'}, - { BOXDRAW_VERTICAL_LEFT_DOUBLE, 0xb5, L'|'}, - { BOXDRAW_VERTICAL_DOUBLE_LEFT, 0xb6, L'|'}, - { BOXDRAW_DOUBLE_VERTICAL_LEFT, 0xb9, L'|'}, - { BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0xd1, L'+'}, - { BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0xd2, L'+'}, - { BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0xcb, L'+'}, - { BOXDRAW_UP_HORIZONTAL_DOUBLE, 0xcf, L'+'}, - { BOXDRAW_UP_DOUBLE_HORIZONTAL, 0xd0, L'+'}, - { BOXDRAW_DOUBLE_UP_HORIZONTAL, 0xca, L'+'}, - { BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0xd8, L'+'}, - { BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0xd7, L'+'}, - { BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0xce, L'+'}, - - { BLOCKELEMENT_FULL_BLOCK, 0xdb, L'*'}, - { BLOCKELEMENT_LIGHT_SHADE, 0xb0, L'+'}, - - { GEOMETRICSHAPE_UP_TRIANGLE, 0x1e, L'^'}, - { GEOMETRICSHAPE_RIGHT_TRIANGLE, 0x10, L'>'}, - { GEOMETRICSHAPE_DOWN_TRIANGLE, 0x1f, L'v'}, - { GEOMETRICSHAPE_LEFT_TRIANGLE, 0x11, L'<'}, - - /* BugBug: Left Arrow is an ESC. We can not make it print - on a PCANSI terminal. If we can make left arrow - come out on PC ANSI we can add it back. - - { ARROW_LEFT, 0x1b, L'<'}, - */ - - { ARROW_UP, 0x18, L'^'}, - - /* BugBut: Took out left arrow so right has to go too. - { ARROW_RIGHT, 0x1a, L'>'}, - */ - { ARROW_DOWN, 0x19, L'v'}, - - { 0x0000, 0x00, L'\0' } -}; - - -BOOLEAN -LibIsValidTextGraphics ( - IN CHAR16 Graphic, - OUT CHAR8 *PcAnsi, OPTIONAL - OUT CHAR8 *Ascii OPTIONAL - ) -/*++ - -Routine Description: - - Detects if a Unicode char is for Box Drawing text graphics. - -Arguments: - - Grphic - Unicode char to test. - - PcAnsi - Optional pointer to return PCANSI equivalent of Graphic. - - Asci - Optional pointer to return Ascii equivalent of Graphic. - -Returns: - - TRUE if Gpaphic is a supported Unicode Box Drawing character. - ---*/{ - UNICODE_TO_CHAR *Table; - - if ((((Graphic & 0xff00) != 0x2500) && ((Graphic & 0xff00) != 0x2100))) { - - // - // Unicode drawing code charts are all in the 0x25xx range, - // arrows are 0x21xx - // - return FALSE; - } - - for (Table = UnicodeToPcAnsiOrAscii; Table->Unicode != 0x0000; Table++) { - if (Graphic == Table->Unicode) { - if (PcAnsi) { - *PcAnsi = Table->PcAnsi; - } - if (Ascii) { - *Ascii = Table->Ascii; - } - return TRUE; - } - } - return FALSE; -} - -BOOLEAN -IsValidAscii ( - IN CHAR16 Ascii - ) -{ - if ((Ascii >= 0x20) && (Ascii <= 0x7f)) { - return TRUE; - } - return FALSE; -} - -BOOLEAN -IsValidEfiCntlChar ( - IN CHAR16 c - ) -{ - if (c == CHAR_NULL || c == CHAR_BACKSPACE || c == CHAR_LINEFEED || c == CHAR_CARRIAGE_RETURN) { - return TRUE; - } - return FALSE; -} - diff --git a/3rd/gnu-efi/lib/cmdline.c b/3rd/gnu-efi/lib/cmdline.c deleted file mode 100644 index 9c214dd39..000000000 --- a/3rd/gnu-efi/lib/cmdline.c +++ /dev/null @@ -1,119 +0,0 @@ -#include "lib.h" - -#include "efiprot.h" -#include "efishell.h" -#include "efishellintf.h" - -#ifndef MAX_ARGV_CONTENTS_SIZE -# define MAX_CMDLINE_SIZE 1024 -#endif -#ifndef MAX_ARGC -# define MAX_CMDLINE_ARGC 32 -#endif - -/* - Parse LoadedImage options area, called only in case the regular - shell protos are not available. - - Format of LoadedImage->LoadOptions appears to be a - single-space-separated list of args (looks like the shell already - pre-parses the input, it apparently folds several consecutive spaces - into one): - argv[0] space argv[1] (etc.) argv[N] space \0 cwd \0 other data - For safety, we support the trailing \0 without a space before, as - well as several consecutive spaces (-> several args). -*/ -static -INTN -GetShellArgcArgvFromLoadedImage( - EFI_HANDLE ImageHandle, - CHAR16 **ResultArgv[] - ) -{ - EFI_STATUS Status; - void *LoadedImage = NULL; - static CHAR16 ArgvContents[MAX_CMDLINE_SIZE]; - static CHAR16 *Argv[MAX_CMDLINE_ARGC], *ArgStart, *c; - UINTN Argc = 0, BufLen; - - Status = uefi_call_wrapper(BS->OpenProtocol, 6, - ImageHandle, - &LoadedImageProtocol, - &LoadedImage, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR(Status)) - return -1; - - BufLen = ((EFI_LOADED_IMAGE *)LoadedImage)->LoadOptionsSize; - if (BufLen < 2) /* We are expecting at least a \0 */ - return -1; - else if (BufLen > sizeof(ArgvContents)) - BufLen = sizeof(ArgvContents); - - CopyMem(ArgvContents, ((EFI_LOADED_IMAGE *)LoadedImage)->LoadOptions, BufLen); - ArgvContents[MAX_CMDLINE_SIZE - 1] = L'\0'; - - for (c = ArgStart = ArgvContents ; *c != L'\0' ; ++c) { - if (*c == L' ') { - *c = L'\0'; - if (Argc < MAX_CMDLINE_ARGC) Argv[Argc++] = ArgStart; - ArgStart = c + 1; - } - } - - if ((*ArgStart != L'\0') && (Argc < MAX_CMDLINE_ARGC)) - Argv[Argc++] = ArgStart; - - // Print(L"Got argc/argv from loaded image proto\n"); - *ResultArgv = Argv; - return Argc; -} - -INTN GetShellArgcArgv(EFI_HANDLE ImageHandle, CHAR16 **Argv[]) -{ - // Code inspired from EDK2's - // ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c (BSD) - EFI_STATUS Status; - static const EFI_GUID ShellInterfaceProtocolGuid - = SHELL_INTERFACE_PROTOCOL_GUID; - EFI_SHELL_PARAMETERS_PROTOCOL *EfiShellParametersProtocol = NULL; - EFI_SHELL_INTERFACE *EfiShellInterfaceProtocol = NULL; - - Status = uefi_call_wrapper(BS->OpenProtocol, 6, - ImageHandle, - (EFI_GUID*)&ShellParametersProtocolGuid, - (VOID **)&EfiShellParametersProtocol, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR(Status)) - { - // use shell 2.0 interface - // Print(L"Got argc/argv from shell intf proto\n"); - *Argv = EfiShellParametersProtocol->Argv; - return EfiShellParametersProtocol->Argc; - } - - // try to get shell 1.0 interface instead. - Status = uefi_call_wrapper(BS->OpenProtocol, 6, - ImageHandle, - (EFI_GUID*)&ShellInterfaceProtocolGuid, - (VOID **)&EfiShellInterfaceProtocol, - ImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (!EFI_ERROR(Status)) - { - // Print(L"Got argc/argv from shell params proto\n"); - *Argv = EfiShellInterfaceProtocol->Argv; - return EfiShellInterfaceProtocol->Argc; - } - - // shell 1.0 and 2.0 interfaces failed - return GetShellArgcArgvFromLoadedImage(ImageHandle, Argv); -} diff --git a/3rd/gnu-efi/lib/console.c b/3rd/gnu-efi/lib/console.c deleted file mode 100644 index 5ca47ef67..000000000 --- a/3rd/gnu-efi/lib/console.c +++ /dev/null @@ -1,104 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - console.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" - - - -VOID -Output ( - IN CHAR16 *Str - ) -// Write a string to the console at the current cursor location -{ - uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, Str); -} - - -VOID -Input ( - IN CHAR16 *Prompt OPTIONAL, - OUT CHAR16 *InStr, - IN UINTN StrLen - ) -// Input a string at the current cursor location, for StrLen -{ - IInput ( - ST->ConOut, - ST->ConIn, - Prompt, - InStr, - StrLen - ); -} - -VOID -IInput ( - IN SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut, - IN SIMPLE_INPUT_INTERFACE *ConIn, - IN CHAR16 *Prompt OPTIONAL, - OUT CHAR16 *InStr, - IN UINTN StrLen - ) -// Input a string at the current cursor location, for StrLen -{ - EFI_INPUT_KEY Key; - EFI_STATUS Status; - UINTN Len; - - if (Prompt) { - ConOut->OutputString (ConOut, Prompt); - } - - Len = 0; - for (; ;) { - WaitForSingleEvent (ConIn->WaitForKey, 0); - - Status = uefi_call_wrapper(ConIn->ReadKeyStroke, 2, ConIn, &Key); - if (EFI_ERROR(Status)) { - DEBUG((D_ERROR, "Input: error return from ReadKey %x\n", Status)); - break; - } - - if (Key.UnicodeChar == '\n' || - Key.UnicodeChar == '\r') { - break; - } - - if (Key.UnicodeChar == '\b') { - if (Len) { - uefi_call_wrapper(ConOut->OutputString, 2, ConOut, L"\b \b"); - Len -= 1; - } - continue; - } - - if (Key.UnicodeChar >= ' ') { - if (Len < StrLen-1) { - InStr[Len] = Key.UnicodeChar; - - InStr[Len+1] = 0; - uefi_call_wrapper(ConOut->OutputString, 2, ConOut, &InStr[Len]); - - Len += 1; - } - continue; - } - } - - InStr[Len] = 0; -} diff --git a/3rd/gnu-efi/lib/crc.c b/3rd/gnu-efi/lib/crc.c deleted file mode 100644 index 4367ed115..000000000 --- a/3rd/gnu-efi/lib/crc.c +++ /dev/null @@ -1,218 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - crc.c - -Abstract: - - CRC32 functions - - - -Revision History - ---*/ - -#include "lib.h" - - -UINT32 CRCTable[256] = { - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, - 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, - 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, - 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, - 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, - 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, - 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, - 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, - 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, - 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, - 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, - 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, - 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, - 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, - 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, - 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, - 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, - 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, - 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, - 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, - 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, - 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D - }; - - - -VOID -SetCrc ( - IN OUT EFI_TABLE_HEADER *Hdr - ) -/*++ - -Routine Description: - - Updates the CRC32 value in the table header - -Arguments: - - Hdr - The table to update - -Returns: - - None - ---*/ -{ - SetCrcAltSize (Hdr->HeaderSize, Hdr); -} - -VOID -SetCrcAltSize ( - IN UINTN Size, - IN OUT EFI_TABLE_HEADER *Hdr - ) -/*++ - -Routine Description: - - Updates the CRC32 value in the table header - -Arguments: - - Hdr - The table to update - -Returns: - - None - ---*/ -{ - Hdr->CRC32 = 0; - Hdr->CRC32 = CalculateCrc((UINT8 *)Hdr, Size); -} - - -BOOLEAN -CheckCrc ( - IN UINTN MaxSize, - IN OUT EFI_TABLE_HEADER *Hdr - ) -/*++ - -Routine Description: - - Checks the CRC32 value in the table header - -Arguments: - - Hdr - The table to check - -Returns: - - TRUE if the CRC is OK in the table - ---*/ -{ - return CheckCrcAltSize (MaxSize, Hdr->HeaderSize, Hdr); -} - - - - -BOOLEAN -CheckCrcAltSize ( - IN UINTN MaxSize, - IN UINTN Size, - IN OUT EFI_TABLE_HEADER *Hdr - ) -/*++ - -Routine Description: - - Checks the CRC32 value in the table header - -Arguments: - - Hdr - The table to check - -Returns: - - TRUE if the CRC is OK in the table - ---*/ -{ - UINT32 Crc; - UINT32 OrgCrc; - BOOLEAN f; - - if (Size == 0) { - // - // If header size is 0 CRC will pass so return FALSE here - // - return FALSE; - } - if (MaxSize && Size > MaxSize) { - DEBUG((D_ERROR, "CheckCrc32: Size > MaxSize\n")); - return FALSE; - } - - // clear old crc from header - OrgCrc = Hdr->CRC32; - Hdr->CRC32 = 0; - Crc = CalculateCrc((UINT8 *)Hdr, Size); - - // set restults - Hdr->CRC32 = OrgCrc; - - // return status - f = OrgCrc == (UINT32) Crc; - if (!f) { - DEBUG((D_ERROR, "CheckCrc32: Crc check failed\n")); - } - - return f; -} - - -UINT32 -CalculateCrc ( - UINT8 *pt, - UINTN Size - ) -{ - UINTN Crc; - - // compute crc - Crc = 0xffffffff; - while (Size) { - Crc = (Crc >> 8) ^ CRCTable[(UINT8) Crc ^ *pt]; - pt += 1; - Size -= 1; - } - Crc = Crc ^ 0xffffffff; - return (UINT32)Crc; -} diff --git a/3rd/gnu-efi/lib/ctors.S b/3rd/gnu-efi/lib/ctors.S deleted file mode 100644 index 4a0c6ab4b..000000000 --- a/3rd/gnu-efi/lib/ctors.S +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Try to define the minimal empty init/ctor/dtor/fini_arrays so building with - * older or out-of-tree linker scripts will still work. - */ -/* - * Note that these aren't the using the GNU "CONSTRUCTOR" output section - * command, so they don't start with a size. Because of p2align and the - * end/END definitions, and the fact that they're mergeable, they can also - * have NULLs which aren't guaranteed to be at the end. - */ - .section .init_array, "aM", @init_array - .p2align 3, 0 - .globl _init_array -_init_array: - .p2align 3, 0 - .globl _init_array_end -_init_array_end: - .long 0 - .section .ctors, "aM", @init_array - .p2align 3, 0 - .globl __CTOR_LIST__ -__CTOR_LIST__: - .p2align 3, 0 - .globl __CTOR_END__ -__CTOR_END__: - .long 0 - .section .dtors, "aM", @fini_array - .p2align 3, 0 - .globl __DTOR_LIST__ -__DTOR_LIST__: - .p2align 3, 0 - .globl __DTOR_END__ -__DTOR_END__: - .long 0 - .section .fini_array, "aM", @fini_array - .p2align 3, 0 - .globl _fini_array -_fini_array: - .p2align 3, 0 - .globl _fini_array_end -_fini_array_end: - .long 0 - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif - diff --git a/3rd/gnu-efi/lib/data.c b/3rd/gnu-efi/lib/data.c deleted file mode 100644 index ec6ae5433..000000000 --- a/3rd/gnu-efi/lib/data.c +++ /dev/null @@ -1,218 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - data.c - -Abstract: - - EFI library global data - - - -Revision History - ---*/ - -#include "lib.h" - -// -// LibInitialized - TRUE once InitializeLib() is called for the first time -// - -BOOLEAN LibInitialized = FALSE; - -// -// ImageHandle - Current ImageHandle, as passed to InitializeLib -// -EFI_HANDLE LibImageHandle; - -// -// ST - pointer to the EFI system table -// - -EFI_SYSTEM_TABLE *ST; - -// -// BS - pointer to the boot services table -// - -EFI_BOOT_SERVICES *BS; - - -// -// Default pool allocation type -// - -EFI_MEMORY_TYPE PoolAllocationType = EfiBootServicesData; - -// -// Unicode collation functions that are in use -// - -EFI_UNICODE_COLLATION_INTERFACE LibStubUnicodeInterface = { - LibStubStriCmp, - LibStubMetaiMatch, - LibStubStrLwrUpr, - LibStubStrLwrUpr, - NULL, // FatToStr - NULL, // StrToFat - NULL // SupportedLanguages -}; - -EFI_UNICODE_COLLATION_INTERFACE *UnicodeInterface = &LibStubUnicodeInterface; - -// -// Root device path -// - -EFI_DEVICE_PATH RootDevicePath[] = { - {END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, {END_DEVICE_PATH_LENGTH,0}} -}; - -EFI_DEVICE_PATH EndDevicePath[] = { - {END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, {END_DEVICE_PATH_LENGTH, 0}} -}; - -EFI_DEVICE_PATH EndInstanceDevicePath[] = { - {END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, {END_DEVICE_PATH_LENGTH, 0}} -}; - - -// -// EFI IDs -// - -EFI_GUID gEfiGlobalVariableGuid = EFI_GLOBAL_VARIABLE; -EFI_GUID NullGuid = { 0,0,0,{0,0,0,0,0,0,0,0} }; - -// -// Protocol IDs -// - -EFI_GUID gEfiDevicePathProtocolGuid = EFI_DEVICE_PATH_PROTOCOL_GUID; -EFI_GUID gEfiDevicePathToTextProtocolGuid = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID; -EFI_GUID gEfiDevicePathFromTextProtocolGuid = EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID; -EFI_GUID gEfiDevicePathUtilitiesProtocolGuid = EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID; -EFI_GUID gEfiLoadedImageProtocolGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID; -EFI_GUID gEfiSimpleTextInProtocolGuid = EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID; -EFI_GUID gEfiSimpleTextOutProtocolGuid = EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID; -EFI_GUID gEfiBlockIoProtocolGuid = EFI_BLOCK_IO_PROTOCOL_GUID; -EFI_GUID gEfiBlockIo2ProtocolGuid = EFI_BLOCK_IO2_PROTOCOL_GUID; -EFI_GUID gEfiDiskIoProtocolGuid = EFI_DISK_IO_PROTOCOL_GUID; -EFI_GUID gEfiDiskIo2ProtocolGuid = EFI_DISK_IO2_PROTOCOL_GUID; -EFI_GUID gEfiSimpleFileSystemProtocolGuid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; -EFI_GUID gEfiLoadFileProtocolGuid = EFI_LOAD_FILE_PROTOCOL_GUID; -EFI_GUID gEfiDeviceIoProtocolGuid = EFI_DEVICE_IO_PROTOCOL_GUID; -EFI_GUID gEfiUnicodeCollationProtocolGuid = EFI_UNICODE_COLLATION_PROTOCOL_GUID; -EFI_GUID gEfiSerialIoProtocolGuid = EFI_SERIAL_IO_PROTOCOL_GUID; -EFI_GUID gEfiSimpleNetworkProtocolGuid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID; -EFI_GUID gEfiPxeBaseCodeProtocolGuid = EFI_PXE_BASE_CODE_PROTOCOL_GUID; -EFI_GUID gEfiPxeBaseCodeCallbackProtocolGuid = EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID; -EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID; -EFI_GUID gEFiUiInterfaceProtocolGuid = EFI_UI_INTERFACE_PROTOCOL_GUID; -EFI_GUID gEfiPciIoProtocolGuid = EFI_PCI_IO_PROTOCOL_GUID; -EFI_GUID gEfiPciRootBridgeIoProtocolGuid = EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID; -EFI_GUID gEfiDriverBindingProtocolGuid = EFI_DRIVER_BINDING_PROTOCOL_GUID; -EFI_GUID gEfiComponentNameProtocolGuid = EFI_COMPONENT_NAME_PROTOCOL_GUID; -EFI_GUID gEfiComponentName2ProtocolGuid = EFI_COMPONENT_NAME2_PROTOCOL_GUID; -EFI_GUID gEfiHashProtocolGuid = EFI_HASH_PROTOCOL_GUID; -EFI_GUID gEfiPlatformDriverOverrideProtocolGuid = EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID; -EFI_GUID gEfiBusSpecificDriverOverrideProtocolGuid = EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID; -EFI_GUID gEfiDriverFamilyOverrideProtocolGuid = EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL_GUID; -EFI_GUID gEfiEbcProtocolGuid = EFI_EBC_PROTOCOL_GUID; - -// -// File system information IDs -// - -EFI_GUID gEfiFileInfoGuid = EFI_FILE_INFO_ID; -EFI_GUID gEfiFileSystemInfoGuid = EFI_FILE_SYSTEM_INFO_ID; -EFI_GUID gEfiFileSystemVolumeLabelInfoIdGuid = EFI_FILE_SYSTEM_VOLUME_LABEL_ID; - -// -// Reference implementation public protocol IDs -// - -EFI_GUID InternalShellProtocol = INTERNAL_SHELL_GUID; -EFI_GUID VariableStoreProtocol = VARIABLE_STORE_PROTOCOL; -EFI_GUID LegacyBootProtocol = LEGACY_BOOT_PROTOCOL; -EFI_GUID VgaClassProtocol = VGA_CLASS_DRIVER_PROTOCOL; - -EFI_GUID TextOutSpliterProtocol = TEXT_OUT_SPLITER_PROTOCOL; -EFI_GUID ErrorOutSpliterProtocol = ERROR_OUT_SPLITER_PROTOCOL; -EFI_GUID TextInSpliterProtocol = TEXT_IN_SPLITER_PROTOCOL; -/* Added for GOP support */ -EFI_GUID gEfiGraphicsOutputProtocolGuid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; -EFI_GUID gEfiEdidDiscoveredProtocolGuid = EFI_EDID_DISCOVERED_PROTOCOL_GUID; -EFI_GUID gEfiEdidActiveProtocolGuid = EFI_EDID_ACTIVE_PROTOCOL_GUID; -EFI_GUID gEfiEdidOverrideProtocolGuid = EFI_EDID_OVERRIDE_PROTOCOL_GUID; - -EFI_GUID AdapterDebugProtocol = ADAPTER_DEBUG_PROTOCOL; - -// -// Device path media protocol IDs -// -EFI_GUID gEfiPcAnsiGuid = EFI_PC_ANSI_GUID; -EFI_GUID gEfiVT100Guid = EFI_VT_100_GUID; -EFI_GUID gEfiVT100PlusGuid = EFI_VT_100_PLUS_GUID; -EFI_GUID gEfiVTUTF8Guid = EFI_VT_UTF8_GUID; - -// -// EFI GPT Partition Type GUIDs -// -EFI_GUID EfiPartTypeSystemPartitionGuid = EFI_PART_TYPE_EFI_SYSTEM_PART_GUID; -EFI_GUID EfiPartTypeLegacyMbrGuid = EFI_PART_TYPE_LEGACY_MBR_GUID; - - -// -// Reference implementation Vendor Device Path Guids -// -EFI_GUID UnknownDevice = UNKNOWN_DEVICE_GUID; - -// -// Configuration Table GUIDs -// - -EFI_GUID MpsTableGuid = MPS_TABLE_GUID; -EFI_GUID AcpiTableGuid = ACPI_TABLE_GUID; -EFI_GUID SMBIOSTableGuid = SMBIOS_TABLE_GUID; -EFI_GUID SMBIOS3TableGuid = SMBIOS3_TABLE_GUID; -EFI_GUID SalSystemTableGuid = SAL_SYSTEM_TABLE_GUID; -EFI_GUID EfiDtbTableGuid = EFI_DTB_TABLE_GUID; - -// -// Network protocol GUIDs -// -EFI_GUID Ip4ServiceBindingProtocol = EFI_IP4_SERVICE_BINDING_PROTOCOL; -EFI_GUID Ip4Protocol = EFI_IP4_PROTOCOL; -EFI_GUID Udp4ServiceBindingProtocol = EFI_UDP4_SERVICE_BINDING_PROTOCOL; -EFI_GUID Udp4Protocol = EFI_UDP4_PROTOCOL; -EFI_GUID Tcp4ServiceBindingProtocol = EFI_TCP4_SERVICE_BINDING_PROTOCOL; -EFI_GUID Tcp4Protocol = EFI_TCP4_PROTOCOL; - -// -// Pointer protocol GUIDs -// -EFI_GUID SimplePointerProtocol = EFI_SIMPLE_POINTER_PROTOCOL_GUID; -EFI_GUID AbsolutePointerProtocol = EFI_ABSOLUTE_POINTER_PROTOCOL_GUID; - -// -// Debugger protocol GUIDs -// -EFI_GUID gEfiDebugImageInfoTableGuid = EFI_DEBUG_IMAGE_INFO_TABLE_GUID; -EFI_GUID gEfiDebugSupportProtocolGuid = EFI_DEBUG_SUPPORT_PROTOCOL_GUID; - -// -// Console extension protocol GUIDs -// -EFI_GUID SimpleTextInputExProtocol = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID; - -// -// Shell protocol GUIDs -// -EFI_GUID ShellProtocolGuid = EFI_SHELL_PROTOCOL_GUID; -EFI_GUID ShellParametersProtocolGuid = EFI_SHELL_PARAMETERS_PROTOCOL_GUID; -EFI_GUID ShellDynamicCommandProtocolGuid = EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_GUID; diff --git a/3rd/gnu-efi/lib/debug.c b/3rd/gnu-efi/lib/debug.c deleted file mode 100644 index b63512368..000000000 --- a/3rd/gnu-efi/lib/debug.c +++ /dev/null @@ -1,43 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - debug.c - -Abstract: - - Debug library functions - - - -Revision History - ---*/ - -#include "lib.h" - - - -// -// Declare runtime functions -// - -// -// -// - -INTN -DbgAssert ( - IN CONST CHAR8 *FileName, - IN INTN LineNo, - IN CONST CHAR8 *Description - ) -{ - DbgPrint (D_ERROR, (CHAR8 *)"%EASSERT FAILED: %a(%d): %a%N\n", FileName, LineNo, Description); - - BREAKPOINT(); - return 0; -} - diff --git a/3rd/gnu-efi/lib/dpath.c b/3rd/gnu-efi/lib/dpath.c deleted file mode 100644 index 5e079d687..000000000 --- a/3rd/gnu-efi/lib/dpath.c +++ /dev/null @@ -1,1262 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - dpath.c - -Abstract: - MBR & Device Path functions - - - -Revision History - -2014/04 B.Burette - updated device path text representation, conforming to - UEFI specification 2.4 (dec. 2013). More specifically: - - § 9.3.5: added some media types ie. Sata() - - § 9.6.1.2: Acpi(PNP0A03,0) makes more sense when displayed as PciRoot(0) - - § 9.6.1.5: use commas (instead of '|') between option specific parameters - - § 9.6.1.6: hex values in device paths must be preceded by "0x" or "0X" - ---*/ - -#include "lib.h" - -#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0) - - - -EFI_DEVICE_PATH * -DevicePathFromHandle ( - IN EFI_HANDLE Handle - ) -{ - EFI_STATUS Status; - EFI_DEVICE_PATH *DevicePath; - - Status = uefi_call_wrapper(BS->HandleProtocol, 3, Handle, &DevicePathProtocol, (VOID*)&DevicePath); - if (EFI_ERROR(Status)) { - DevicePath = NULL; - } - - return DevicePath; -} - - -EFI_DEVICE_PATH * -DevicePathInstance ( - IN OUT EFI_DEVICE_PATH **DevicePath, - OUT UINTN *Size - ) -{ - EFI_DEVICE_PATH *Start, *Next, *DevPath; - UINTN Count; - - DevPath = *DevicePath; - Start = DevPath; - - if (!DevPath) { - return NULL; - } - - // - // Check for end of device path type - // - - for (Count = 0; ; Count++) { - Next = NextDevicePathNode(DevPath); - - if (IsDevicePathEndType(DevPath)) { - break; - } - - if (Count > 01000) { - // - // BugBug: Debug code to catch bogus device paths - // - DEBUG((D_ERROR, "DevicePathInstance: DevicePath %x Size %d", *DevicePath, ((UINT8 *) DevPath) - ((UINT8 *) Start) )); - DumpHex (0, 0, ((UINT8 *) DevPath) - ((UINT8 *) Start), Start); - break; - } - - DevPath = Next; - } - - ASSERT (DevicePathSubType(DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE || - DevicePathSubType(DevPath) == END_INSTANCE_DEVICE_PATH_SUBTYPE); - - // - // Set next position - // - - if (DevicePathSubType(DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE) { - Next = NULL; - } - - *DevicePath = Next; - - // - // Return size and start of device path instance - // - - *Size = ((UINT8 *) DevPath) - ((UINT8 *) Start); - return Start; -} - -UINTN -DevicePathInstanceCount ( - IN EFI_DEVICE_PATH *DevicePath - ) -{ - UINTN Count, Size; - - Count = 0; - while (DevicePathInstance(&DevicePath, &Size)) { - Count += 1; - } - - return Count; -} - - -EFI_DEVICE_PATH * -AppendDevicePath ( - IN EFI_DEVICE_PATH *Src1, - IN EFI_DEVICE_PATH *Src2 - ) -// Src1 may have multiple "instances" and each instance is appended -// Src2 is appended to each instance is Src1. (E.g., it's possible -// to append a new instance to the complete device path by passing -// it in Src2) -{ - UINTN Src1Size, Src1Inst, Src2Size, Size; - EFI_DEVICE_PATH *Dst, *Inst; - UINT8 *DstPos; - - // - // If there's only 1 path, just duplicate it - // - - if (!Src1) { - ASSERT (!IsDevicePathUnpacked (Src2)); - return DuplicateDevicePath (Src2); - } - - if (!Src2) { - ASSERT (!IsDevicePathUnpacked (Src1)); - return DuplicateDevicePath (Src1); - } - - // - // Verify we're not working with unpacked paths - // - -// ASSERT (!IsDevicePathUnpacked (Src1)); -// ASSERT (!IsDevicePathUnpacked (Src2)); - - // - // Append Src2 to every instance in Src1 - // - - Src1Size = DevicePathSize(Src1); - Src1Inst = DevicePathInstanceCount(Src1); - Src2Size = DevicePathSize(Src2); - Size = Src1Size * Src1Inst + Src2Size; - - Dst = AllocatePool (Size); - if (Dst) { - DstPos = (UINT8 *) Dst; - - // - // Copy all device path instances - // - - while ((Inst = DevicePathInstance (&Src1, &Size))) { - - CopyMem(DstPos, Inst, Size); - DstPos += Size; - - CopyMem(DstPos, Src2, Src2Size); - DstPos += Src2Size; - - CopyMem(DstPos, EndInstanceDevicePath, sizeof(EFI_DEVICE_PATH)); - DstPos += sizeof(EFI_DEVICE_PATH); - } - - // Change last end marker - DstPos -= sizeof(EFI_DEVICE_PATH); - CopyMem(DstPos, EndDevicePath, sizeof(EFI_DEVICE_PATH)); - } - - return Dst; -} - - -EFI_DEVICE_PATH * -AppendDevicePathNode ( - IN EFI_DEVICE_PATH *Src1, - IN EFI_DEVICE_PATH *Src2 - ) -// Src1 may have multiple "instances" and each instance is appended -// Src2 is a signal device path node (without a terminator) that is -// appended to each instance is Src1. -{ - EFI_DEVICE_PATH *Temp, *Eop; - UINTN Length; - - // - // Build a Src2 that has a terminator on it - // - - Length = DevicePathNodeLength(Src2); - Temp = AllocatePool (Length + sizeof(EFI_DEVICE_PATH)); - if (!Temp) { - return NULL; - } - - CopyMem (Temp, Src2, Length); - Eop = NextDevicePathNode(Temp); - SetDevicePathEndNode(Eop); - - // - // Append device paths - // - - Src1 = AppendDevicePath (Src1, Temp); - FreePool (Temp); - return Src1; -} - - -EFI_DEVICE_PATH * -FileDevicePath ( - IN EFI_HANDLE Device OPTIONAL, - IN CHAR16 *FileName - ) -/*++ - - N.B. Results are allocated from pool. The caller must FreePool - the resulting device path structure - ---*/ -{ - UINTN Size; - FILEPATH_DEVICE_PATH *FilePath; - EFI_DEVICE_PATH *Eop, *DevicePath; - - Size = StrSize(FileName); - FilePath = AllocateZeroPool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + sizeof(EFI_DEVICE_PATH)); - DevicePath = NULL; - - if (FilePath) { - - // - // Build a file path - // - - FilePath->Header.Type = MEDIA_DEVICE_PATH; - FilePath->Header.SubType = MEDIA_FILEPATH_DP; - SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH); - CopyMem (FilePath->PathName, FileName, Size); - Eop = NextDevicePathNode(&FilePath->Header); - SetDevicePathEndNode(Eop); - - // - // Append file path to device's device path - // - - DevicePath = (EFI_DEVICE_PATH *) FilePath; - if (Device) { - DevicePath = AppendDevicePath ( - DevicePathFromHandle(Device), - DevicePath - ); - - FreePool(FilePath); - } - } - - return DevicePath; -} - - - -UINTN -DevicePathSize ( - IN EFI_DEVICE_PATH *DevPath - ) -{ - EFI_DEVICE_PATH *Start; - - // - // Search for the end of the device path structure - // - - Start = DevPath; - while (!IsDevicePathEnd(DevPath)) { - DevPath = NextDevicePathNode(DevPath); - } - - // - // Compute the size - // - - return ((UINTN) DevPath - (UINTN) Start) + sizeof(EFI_DEVICE_PATH); -} - -EFI_DEVICE_PATH * -DuplicateDevicePath ( - IN EFI_DEVICE_PATH *DevPath - ) -{ - EFI_DEVICE_PATH *NewDevPath; - UINTN Size; - - - // - // Compute the size - // - - Size = DevicePathSize (DevPath); - - // - // Make a copy - // - - NewDevPath = AllocatePool (Size); - if (NewDevPath) { - CopyMem (NewDevPath, DevPath, Size); - } - - return NewDevPath; -} - -EFI_DEVICE_PATH * -UnpackDevicePath ( - IN EFI_DEVICE_PATH *DevPath - ) -{ - EFI_DEVICE_PATH *Src, *Dest, *NewPath; - UINTN Size; - - // - // Walk device path and round sizes to valid boundries - // - - Src = DevPath; - Size = 0; - for (; ;) { - Size += DevicePathNodeLength(Src); - Size += ALIGN_SIZE(Size); - - if (IsDevicePathEnd(Src)) { - break; - } - - Src = NextDevicePathNode(Src); - } - - - // - // Allocate space for the unpacked path - // - - NewPath = AllocateZeroPool (Size); - if (NewPath) { - - ASSERT (((UINTN)NewPath) % MIN_ALIGNMENT_SIZE == 0); - - // - // Copy each node - // - - Src = DevPath; - Dest = NewPath; - for (; ;) { - Size = DevicePathNodeLength(Src); - CopyMem (Dest, Src, Size); - Size += ALIGN_SIZE(Size); - SetDevicePathNodeLength (Dest, Size); - Dest->Type |= EFI_DP_TYPE_UNPACKED; - Dest = (EFI_DEVICE_PATH *) (((UINT8 *) Dest) + Size); - - if (IsDevicePathEnd(Src)) { - break; - } - - Src = NextDevicePathNode(Src); - } - } - - return NewPath; -} - - -EFI_DEVICE_PATH* -AppendDevicePathInstance ( - IN EFI_DEVICE_PATH *Src, - IN EFI_DEVICE_PATH *Instance - ) -{ - UINT8 *Ptr; - EFI_DEVICE_PATH *DevPath; - UINTN SrcSize; - UINTN InstanceSize; - - if (Src == NULL) { - return DuplicateDevicePath (Instance); - } - SrcSize = DevicePathSize(Src); - InstanceSize = DevicePathSize(Instance); - Ptr = AllocatePool (SrcSize + InstanceSize); - DevPath = (EFI_DEVICE_PATH *)Ptr; - ASSERT(DevPath); - - CopyMem (Ptr, Src, SrcSize); -// FreePool (Src); - - while (!IsDevicePathEnd(DevPath)) { - DevPath = NextDevicePathNode(DevPath); - } - // - // Convert the End to an End Instance, since we are - // appending another instacne after this one its a good - // idea. - // - DevPath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; - - DevPath = NextDevicePathNode(DevPath); - CopyMem (DevPath, Instance, InstanceSize); - return (EFI_DEVICE_PATH *)Ptr; -} - -EFI_STATUS -LibDevicePathToInterface ( - IN EFI_GUID *Protocol, - IN EFI_DEVICE_PATH *FilePath, - OUT VOID **Interface - ) -{ - EFI_STATUS Status; - EFI_HANDLE Device; - - Status = uefi_call_wrapper(BS->LocateDevicePath, 3, Protocol, &FilePath, &Device); - - if (!EFI_ERROR(Status)) { - - // If we didn't get a direct match return not found - Status = EFI_NOT_FOUND; - - if (IsDevicePathEnd(FilePath)) { - - // - // It was a direct match, lookup the protocol interface - // - - Status =uefi_call_wrapper(BS->HandleProtocol, 3, Device, Protocol, Interface); - } - } - - // - // If there was an error, do not return an interface - // - - if (EFI_ERROR(Status)) { - *Interface = NULL; - } - - return Status; -} - -static VOID -_DevPathPci ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - PCI_DEVICE_PATH *Pci; - - Pci = DevPath; - CatPrint(Str, L"Pci(0x%x,0x%x)", Pci->Device, Pci->Function); -} - -static VOID -_DevPathPccard ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - PCCARD_DEVICE_PATH *Pccard; - - Pccard = DevPath; - CatPrint(Str, L"Pccard(0x%x)", Pccard-> FunctionNumber ); -} - -static VOID -_DevPathMemMap ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - MEMMAP_DEVICE_PATH *MemMap; - - MemMap = DevPath; - CatPrint(Str, L"MemMap(%d,0x%x,0x%x)", - MemMap->MemoryType, - MemMap->StartingAddress, - MemMap->EndingAddress - ); -} - -static VOID -_DevPathController ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - CONTROLLER_DEVICE_PATH *Controller; - - Controller = DevPath; - CatPrint(Str, L"Ctrl(%d)", - Controller->Controller - ); -} - -static VOID -_DevPathVendor ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - VENDOR_DEVICE_PATH *Vendor; - CHAR16 *Type; - UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownDevPath; - - Vendor = DevPath; - switch (DevicePathType(&Vendor->Header)) { - case HARDWARE_DEVICE_PATH: Type = L"Hw"; break; - case MESSAGING_DEVICE_PATH: Type = L"Msg"; break; - case MEDIA_DEVICE_PATH: Type = L"Media"; break; - default: Type = L"?"; break; - } - - CatPrint(Str, L"Ven%s(%g", Type, &Vendor->Guid); - if (CompareGuid (&Vendor->Guid, &UnknownDevice) == 0) { - // - // GUID used by EFI to enumerate an EDD 1.1 device - // - UnknownDevPath = (UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *)Vendor; - CatPrint(Str, L":%02x)", UnknownDevPath->LegacyDriveLetter); - } else { - CatPrint(Str, L")"); - } -} - - -/* - Type: 2 (ACPI Device Path) SubType: 1 (ACPI Device Path) - */ -static VOID -_DevPathAcpi ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - ACPI_HID_DEVICE_PATH *Acpi; - - Acpi = DevPath; - if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) { - switch ( EISA_ID_TO_NUM( Acpi-> HID ) ) { - case 0x301 : { - CatPrint( Str , L"Keyboard(%d)" , Acpi-> UID ) ; - break ; - } - case 0x401 : { - CatPrint( Str , L"ParallelPort(%d)" , Acpi-> UID ) ; - break ; - } - case 0x501 : { - CatPrint( Str , L"Serial(%d)" , Acpi-> UID ) ; - break ; - } - case 0x604 : { - CatPrint( Str , L"Floppy(%d)" , Acpi-> UID ) ; - break ; - } - case 0xa03 : { - CatPrint( Str , L"PciRoot(%d)" , Acpi-> UID ) ; - break ; - } - case 0xa08 : { - CatPrint( Str , L"PcieRoot(%d)" , Acpi-> UID ) ; - break ; - } - default : { - CatPrint( Str , L"Acpi(PNP%04x" , EISA_ID_TO_NUM( Acpi-> HID ) ) ; - if ( Acpi-> UID ) CatPrint( Str , L",%d" , Acpi-> UID ) ; - CatPrint( Str , L")" ) ; - break ; - } - } - } else { - CatPrint( Str , L"Acpi(0x%X" , Acpi-> HID ) ; - if ( Acpi-> UID ) CatPrint( Str , L",%d" , Acpi-> UID ) ; - CatPrint( Str , L")" , Acpi-> HID , Acpi-> UID ) ; - } -} - - -static VOID -_DevPathAtapi ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - ATAPI_DEVICE_PATH *Atapi; - - Atapi = DevPath; - CatPrint(Str, L"Ata(%s,%s)", - Atapi->PrimarySecondary ? L"Secondary" : L"Primary", - Atapi->SlaveMaster ? L"Slave" : L"Master" - ); -} - -static VOID -_DevPathScsi ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - SCSI_DEVICE_PATH *Scsi; - - Scsi = DevPath; - CatPrint(Str, L"Scsi(%d,%d)", Scsi->Pun, Scsi->Lun); -} - - -static VOID -_DevPathFibre ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - FIBRECHANNEL_DEVICE_PATH *Fibre; - - Fibre = DevPath; - CatPrint( Str , L"Fibre%s(0x%016lx,0x%016lx)" , - DevicePathType( & Fibre-> Header ) == MSG_FIBRECHANNEL_DP ? L"" : L"Ex" , - Fibre-> WWN , Fibre-> Lun ) ; -} - -static VOID -_DevPath1394 ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - F1394_DEVICE_PATH *F1394; - - F1394 = DevPath; - // Guid has format of IEEE-EUI64 - CatPrint(Str, L"I1394(%016lx)", F1394->Guid); -} - - - -static VOID -_DevPathUsb ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - USB_DEVICE_PATH *Usb; - - Usb = DevPath; - CatPrint( Str , L"Usb(0x%x,0x%x)" , Usb-> Port , Usb-> Endpoint ) ; -} - - -static VOID -_DevPathI2O ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - I2O_DEVICE_PATH *I2O; - - I2O = DevPath; - CatPrint(Str, L"I2O(0x%X)", I2O->Tid); -} - -static VOID -_DevPathMacAddr ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - MAC_ADDR_DEVICE_PATH *MAC; - UINTN HwAddressSize; - UINTN Index; - - MAC = DevPath; - - /* HwAddressSize = sizeof(EFI_MAC_ADDRESS); */ - HwAddressSize = DevicePathNodeLength( & MAC-> Header ) ; - HwAddressSize -= sizeof( MAC-> Header ) ; - HwAddressSize -= sizeof( MAC-> IfType ) ; - if (MAC->IfType == 0x01 || MAC->IfType == 0x00) { - HwAddressSize = 6; - } - - CatPrint(Str, L"Mac("); - - for(Index = 0; Index < HwAddressSize; Index++) { - CatPrint(Str, L"%02x",MAC->MacAddress.Addr[Index]); - } - if ( MAC-> IfType != 0 ) { - CatPrint(Str, L",%d" , MAC-> IfType ) ; - } - CatPrint(Str, L")"); -} - -static VOID -CatPrintIPv4( - IN OUT POOL_PRINT * Str , - IN EFI_IPv4_ADDRESS * Address - ) -{ - CatPrint( Str , L"%d.%d.%d.%d" , Address-> Addr[ 0 ] , Address-> Addr[ 1 ] , - Address-> Addr[ 2 ] , Address-> Addr[ 3 ] ) ; -} - -static BOOLEAN -IsNotNullIPv4( - IN EFI_IPv4_ADDRESS * Address - ) -{ - UINT8 val ; - val = Address-> Addr[ 0 ] | Address-> Addr[ 1 ] ; - val |= Address-> Addr[ 2 ] | Address-> Addr[ 3 ] ; - return val != 0 ; -} - -static VOID -CatPrintNetworkProtocol( - IN OUT POOL_PRINT * Str , - IN UINT16 Proto - ) -{ - if ( Proto == 6 ) { - CatPrint( Str , L"TCP" ) ; - } else if ( Proto == 17 ) { - CatPrint( Str , L"UDP" ) ; - } else { - CatPrint( Str , L"%d" , Proto ) ; - } -} - -static VOID -_DevPathIPv4 ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - IPv4_DEVICE_PATH *IP; - BOOLEAN show ; - - IP = DevPath; - CatPrint( Str , L"IPv4(") ; - CatPrintIPv4( Str , & IP-> RemoteIpAddress ) ; - CatPrint( Str , L",") ; - CatPrintNetworkProtocol( Str , IP-> Protocol ) ; - CatPrint( Str , L",%s" , IP-> StaticIpAddress ? L"Static" : L"DHCP" ) ; - show = IsNotNullIPv4( & IP-> LocalIpAddress ) ; - if ( ! show && DevicePathNodeLength( & IP-> Header ) == sizeof( IPv4_DEVICE_PATH ) ) { - /* only version 2 includes gateway and netmask */ - show |= IsNotNullIPv4( & IP-> GatewayIpAddress ) ; - show |= IsNotNullIPv4( & IP-> SubnetMask ) ; - } - if ( show ) { - CatPrint( Str , L"," ) ; - CatPrintIPv4( Str , & IP-> LocalIpAddress ) ; - if ( DevicePathNodeLength( & IP-> Header ) == sizeof( IPv4_DEVICE_PATH ) ) { - /* only version 2 includes gateway and netmask */ - show = IsNotNullIPv4( & IP-> GatewayIpAddress ) ; - show |= IsNotNullIPv4( & IP-> SubnetMask ) ; - if ( show ) { - CatPrint( Str , L",") ; - CatPrintIPv4( Str , & IP-> GatewayIpAddress ) ; - if ( IsNotNullIPv4( & IP-> SubnetMask ) ) { - CatPrint( Str , L",") ; - CatPrintIPv4( Str , & IP-> SubnetMask ) ; - } - } - } - } - CatPrint( Str , L")") ; -} - -#define CatPrintIPv6_ADD( x , y ) ( ( (UINT16) ( x ) ) << 8 | ( y ) ) -static VOID -CatPrintIPv6( - IN OUT POOL_PRINT * Str , - IN EFI_IPv6_ADDRESS * Address - ) -{ - CatPrint( Str , L"%x:%x:%x:%x:%x:%x:%x:%x" , - CatPrintIPv6_ADD( Address-> Addr[ 0 ] , Address-> Addr[ 1 ] ) , - CatPrintIPv6_ADD( Address-> Addr[ 2 ] , Address-> Addr[ 3 ] ) , - CatPrintIPv6_ADD( Address-> Addr[ 4 ] , Address-> Addr[ 5 ] ) , - CatPrintIPv6_ADD( Address-> Addr[ 6 ] , Address-> Addr[ 7 ] ) , - CatPrintIPv6_ADD( Address-> Addr[ 8 ] , Address-> Addr[ 9 ] ) , - CatPrintIPv6_ADD( Address-> Addr[ 10 ] , Address-> Addr[ 11 ] ) , - CatPrintIPv6_ADD( Address-> Addr[ 12 ] , Address-> Addr[ 13 ] ) , - CatPrintIPv6_ADD( Address-> Addr[ 14 ] , Address-> Addr[ 15 ] ) ) ; -} - -static VOID -_DevPathIPv6 ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - IPv6_DEVICE_PATH *IP; - - IP = DevPath; - CatPrint( Str , L"IPv6(") ; - CatPrintIPv6( Str , & IP-> RemoteIpAddress ) ; - CatPrint( Str , L",") ; - CatPrintNetworkProtocol( Str, IP-> Protocol ) ; - CatPrint( Str , L",%s," , IP-> IPAddressOrigin ? - ( IP-> IPAddressOrigin == 1 ? L"StatelessAutoConfigure" : - L"StatefulAutoConfigure" ) : L"Static" ) ; - CatPrintIPv6( Str , & IP-> LocalIpAddress ) ; - if ( DevicePathNodeLength( & IP-> Header ) == sizeof( IPv6_DEVICE_PATH ) ) { - CatPrint( Str , L",") ; - CatPrintIPv6( Str , & IP-> GatewayIpAddress ) ; - CatPrint( Str , L",") ; - CatPrint( Str , L"%d" , & IP-> PrefixLength ) ; - } - CatPrint( Str , L")") ; -} - -static VOID -_DevPathUri ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - URI_DEVICE_PATH *Uri; - - Uri = DevPath; - - CatPrint( Str, L"Uri(%a)", Uri->Uri ); -} - -static VOID -_DevPathInfiniBand ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - INFINIBAND_DEVICE_PATH *InfiniBand; - - InfiniBand = DevPath; - CatPrint(Str, L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)", - InfiniBand->ResourceFlags, InfiniBand->PortGid, InfiniBand->ServiceId, - InfiniBand->TargetPortId, InfiniBand->DeviceId); -} - -static VOID -_DevPathUart ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - UART_DEVICE_PATH *Uart; - CHAR8 Parity; - - Uart = DevPath; - switch (Uart->Parity) { - case 0 : Parity = 'D'; break; - case 1 : Parity = 'N'; break; - case 2 : Parity = 'E'; break; - case 3 : Parity = 'O'; break; - case 4 : Parity = 'M'; break; - case 5 : Parity = 'S'; break; - default : Parity = 'x'; break; - } - - if (Uart->BaudRate == 0) { - CatPrint(Str, L"Uart(DEFAULT,"); - } else { - CatPrint(Str, L"Uart(%ld,", Uart->BaudRate); - } - - if (Uart->DataBits == 0) { - CatPrint(Str, L"DEFAULT,"); - } else { - CatPrint(Str, L"%d,", Uart->DataBits); - } - - CatPrint(Str, L"%c,", Parity); - - switch (Uart->StopBits) { - case 0 : CatPrint(Str, L"D)"); break; - case 1 : CatPrint(Str, L"1)"); break; - case 2 : CatPrint(Str, L"1.5)"); break; - case 3 : CatPrint(Str, L"2)"); break; - default : CatPrint(Str, L"x)"); break; - } -} - -static VOID -_DevPathSata ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - SATA_DEVICE_PATH * Sata ; - - Sata = DevPath; - CatPrint( Str , L"Sata(0x%x,0x%x,0x%x)" , Sata-> HBAPortNumber , - Sata-> PortMultiplierPortNumber , Sata-> Lun ) ; -} - -static VOID -_DevPathHardDrive ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - HARDDRIVE_DEVICE_PATH *Hd; - - Hd = DevPath; - switch (Hd->SignatureType) { - case SIGNATURE_TYPE_MBR: - CatPrint(Str, L"HD(%d,MBR,0x%08x)", - Hd->PartitionNumber, - *((UINT32 *)(&(Hd->Signature[0]))) - ); - break; - case SIGNATURE_TYPE_GUID: - CatPrint(Str, L"HD(%d,GPT,%g)", - Hd->PartitionNumber, - (EFI_GUID *) &(Hd->Signature[0]) - ); - break; - default: - CatPrint(Str, L"HD(%d,%d,0)", - Hd->PartitionNumber, - Hd->SignatureType - ); - break; - } -} - -static VOID -_DevPathCDROM ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - CDROM_DEVICE_PATH *Cd; - - Cd = DevPath; - CatPrint( Str , L"CDROM(0x%x)" , Cd-> BootEntry ) ; -} - -static VOID -_DevPathFilePath ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - FILEPATH_DEVICE_PATH *Fp; - - Fp = DevPath; - CatPrint(Str, L"%s", Fp->PathName); -} - -static VOID -_DevPathMediaProtocol ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - MEDIA_PROTOCOL_DEVICE_PATH *MediaProt; - - MediaProt = DevPath; - CatPrint(Str, L"%g", &MediaProt->Protocol); -} - -static VOID -_DevPathBssBss ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - BBS_BBS_DEVICE_PATH *Bss; - CHAR16 *Type; - - Bss = DevPath; - switch (Bss->DeviceType) { - case BBS_TYPE_FLOPPY: Type = L"Floppy"; break; - case BBS_TYPE_HARDDRIVE: Type = L"Harddrive"; break; - case BBS_TYPE_CDROM: Type = L"CDROM"; break; - case BBS_TYPE_PCMCIA: Type = L"PCMCIA"; break; - case BBS_TYPE_USB: Type = L"Usb"; break; - case BBS_TYPE_EMBEDDED_NETWORK: Type = L"Net"; break; - default: Type = L"?"; break; - } - - CatPrint(Str, L"Bss-%s(%a)", Type, Bss->String); -} - - -static VOID -_DevPathEndInstance ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath EFI_UNUSED - ) -{ - CatPrint(Str, L","); -} - -/** - * Print unknown device node. - * UEFI 2.4 § 9.6.1.6 table 89. - */ - -static VOID -_DevPathNodeUnknown ( - IN OUT POOL_PRINT *Str, - IN VOID *DevPath - ) -{ - EFI_DEVICE_PATH * Path ; - UINT8 * value ; - int length , index ; - Path = DevPath ; - value = DevPath ; - value += 4 ; - switch ( Path-> Type ) { - case HARDWARE_DEVICE_PATH : { /* Unknown Hardware Device Path */ - CatPrint( Str , L"HardwarePath(%d" , Path-> SubType ) ; - break ; - } - case ACPI_DEVICE_PATH : { /* Unknown ACPI Device Path */ - CatPrint( Str , L"AcpiPath(%d" , Path-> SubType ) ; - break ; - } - case MESSAGING_DEVICE_PATH : { /* Unknown Messaging Device Path */ - CatPrint( Str , L"Msg(%d" , Path-> SubType ) ; - break ; - } - case MEDIA_DEVICE_PATH : { /* Unknown Media Device Path */ - CatPrint( Str , L"MediaPath(%d" , Path-> SubType ) ; - break ; - } - case BBS_DEVICE_PATH : { /* Unknown BIOS Boot Specification Device Path */ - CatPrint( Str , L"BbsPath(%d" , Path-> SubType ) ; - break ; - } - default : { /* Unknown Device Path */ - CatPrint( Str , L"Path(%d,%d" , Path-> Type , Path-> SubType ) ; - break ; - } - } - length = DevicePathNodeLength( Path ) ; - for ( index = 0 ; index < length ; index ++ ) { - if ( index == 0 ) CatPrint( Str , L",0x" ) ; - CatPrint( Str , L"%02x" , * value ) ; - value ++ ; - } - CatPrint( Str , L")" ) ; -} - - -/* - * Table to convert "Type" and "SubType" to a "convert to text" function/ - * Entries hold "Type" and "SubType" for know values. - * Special "SubType" 0 is used as default for known type with unknown subtype. - */ -struct { - UINT8 Type; - UINT8 SubType; - VOID (*Function)(POOL_PRINT *, VOID *); -} DevPathTable[] = { - { HARDWARE_DEVICE_PATH, HW_PCI_DP, _DevPathPci}, - { HARDWARE_DEVICE_PATH, HW_PCCARD_DP, _DevPathPccard}, - { HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, _DevPathMemMap}, - { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, _DevPathVendor}, - { HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, _DevPathController}, - { ACPI_DEVICE_PATH, ACPI_DP, _DevPathAcpi}, - { MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, _DevPathAtapi}, - { MESSAGING_DEVICE_PATH, MSG_SCSI_DP, _DevPathScsi}, - { MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, _DevPathFibre}, - { MESSAGING_DEVICE_PATH, MSG_1394_DP, _DevPath1394}, - { MESSAGING_DEVICE_PATH, MSG_USB_DP, _DevPathUsb}, - { MESSAGING_DEVICE_PATH, MSG_I2O_DP, _DevPathI2O}, - { MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, _DevPathMacAddr}, - { MESSAGING_DEVICE_PATH, MSG_IPv4_DP, _DevPathIPv4}, - { MESSAGING_DEVICE_PATH, MSG_IPv6_DP, _DevPathIPv6}, - { MESSAGING_DEVICE_PATH, MSG_URI_DP, _DevPathUri}, - { MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, _DevPathInfiniBand}, - { MESSAGING_DEVICE_PATH, MSG_UART_DP, _DevPathUart}, - { MESSAGING_DEVICE_PATH , MSG_SATA_DP , _DevPathSata } , - { MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, _DevPathVendor}, - { MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, _DevPathHardDrive}, - { MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, _DevPathCDROM}, - { MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, _DevPathVendor}, - { MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, _DevPathFilePath}, - { MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, _DevPathMediaProtocol}, - { BBS_DEVICE_PATH, BBS_BBS_DP, _DevPathBssBss}, - { END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, _DevPathEndInstance}, - { 0, 0, NULL} -}; - - -CHAR16 * -DevicePathToStr ( - EFI_DEVICE_PATH *DevPath - ) -/*++ - - Turns the Device Path into a printable string. Allcoates - the string from pool. The caller must FreePool the returned - string. - ---*/ -{ - POOL_PRINT Str; - EFI_DEVICE_PATH *DevPathNode; - VOID (*DumpNode)(POOL_PRINT *, VOID *); - UINTN Index, NewSize; - - ZeroMem(&Str, sizeof(Str)); - - // - // Unpacked the device path - // - - DevPath = UnpackDevicePath(DevPath); - ASSERT (DevPath); - - - // - // Process each device path node - // - - DevPathNode = DevPath; - while (!IsDevicePathEnd(DevPathNode)) { - // - // Find the handler to dump this device path node - // - - DumpNode = NULL; - for (Index = 0; DevPathTable[Index].Function; Index += 1) { - - if (DevicePathType(DevPathNode) == DevPathTable[Index].Type && - DevicePathSubType(DevPathNode) == DevPathTable[Index].SubType) { - DumpNode = DevPathTable[Index].Function; - break; - } - } - - // - // If not found, use a generic function - // - - if (!DumpNode) { - DumpNode = _DevPathNodeUnknown; - } - - // - // Put a path seperator in if needed - // - - if (Str.len && DumpNode != _DevPathEndInstance) { - CatPrint (&Str, L"/"); - } - - // - // Print this node of the device path - // - - DumpNode (&Str, DevPathNode); - - // - // Next device path node - // - - DevPathNode = NextDevicePathNode(DevPathNode); - } - - // - // Shrink pool used for string allocation - // - - FreePool (DevPath); - NewSize = (Str.len + 1) * sizeof(CHAR16); - Str.str = ReallocatePool (Str.str, NewSize, NewSize); - Str.str[Str.len] = 0; - return Str.str; -} - -BOOLEAN -LibMatchDevicePaths ( - IN EFI_DEVICE_PATH *Multi, - IN EFI_DEVICE_PATH *Single - ) -{ - EFI_DEVICE_PATH *DevicePath, *DevicePathInst; - UINTN Size; - - if (!Multi || !Single) { - return FALSE; - } - - DevicePath = Multi; - while ((DevicePathInst = DevicePathInstance (&DevicePath, &Size))) { - if (CompareMem (Single, DevicePathInst, Size) == 0) { - return TRUE; - } - } - return FALSE; -} - -EFI_DEVICE_PATH * -LibDuplicateDevicePathInstance ( - IN EFI_DEVICE_PATH *DevPath - ) -{ - EFI_DEVICE_PATH *NewDevPath,*DevicePathInst,*Temp; - UINTN Size = 0; - - // - // get the size of an instance from the input - // - - Temp = DevPath; - DevicePathInst = DevicePathInstance (&Temp, &Size); - - // - // Make a copy and set proper end type - // - NewDevPath = NULL; - if (Size) { - NewDevPath = AllocatePool (Size + sizeof(EFI_DEVICE_PATH)); - } - - if (NewDevPath) { - CopyMem (NewDevPath, DevicePathInst, Size); - Temp = NextDevicePathNode(NewDevPath); - SetDevicePathEndNode(Temp); - } - - return NewDevPath; -} - diff --git a/3rd/gnu-efi/lib/entry.c b/3rd/gnu-efi/lib/entry.c deleted file mode 100644 index d85260846..000000000 --- a/3rd/gnu-efi/lib/entry.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * ctors.c - * Copyright 2019 Peter Jones - * - */ - -#include -#include - -/* - * Note that these aren't the using the GNU "CONSTRUCTOR" output section - * command, so they don't start with a size. Because of p2align and the - * end/END definitions, and the fact that they're mergeable, they can also - * have NULLs which aren't guaranteed to be at the end. - */ -extern UINTN _init_array, _init_array_end; -extern UINTN __CTOR_LIST__, __CTOR_END__; -extern UINTN _fini_array, _fini_array_end; -extern UINTN __DTOR_LIST__, __DTOR_END__; - -typedef void (*funcp)(void); - -static void ctors(void) -{ - for (funcp *location = (void *)&_init_array; location < (funcp *)&_init_array_end; location++) { - funcp func = *location; - if (location != NULL) - func(); - } - - for (funcp *location = (void *)&__CTOR_LIST__; location < (funcp *)&__CTOR_END__; location++) { - funcp func = *location; - if (location != NULL) - func(); - } -} - -static void dtors(void) -{ - for (funcp *location = (void *)&__DTOR_LIST__; location < (funcp *)&__DTOR_END__; location++) { - funcp func = *location; - if (location != NULL) - func(); - } - - for (funcp *location = (void *)&_fini_array; location < (funcp *)&_fini_array_end; location++) { - funcp func = *location; - if (location != NULL) - func(); - } -} - -extern EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab); - -EFI_STATUS _entry(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) -{ - EFI_STATUS status; - InitializeLib(image, systab); - - ctors(); - status = efi_main(image, systab); - dtors(); - - return status; -} - -// vim:fenc=utf-8:tw=75:noet diff --git a/3rd/gnu-efi/lib/error.c b/3rd/gnu-efi/lib/error.c deleted file mode 100644 index 2399a0640..000000000 --- a/3rd/gnu-efi/lib/error.c +++ /dev/null @@ -1,83 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - error.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" - - -struct { - EFI_STATUS Code; - WCHAR *Desc; -} ErrorCodeTable[] = { - { EFI_SUCCESS, L"Success"}, - { EFI_LOAD_ERROR, L"Load Error"}, - { EFI_INVALID_PARAMETER, L"Invalid Parameter"}, - { EFI_UNSUPPORTED, L"Unsupported"}, - { EFI_BAD_BUFFER_SIZE, L"Bad Buffer Size"}, - { EFI_BUFFER_TOO_SMALL, L"Buffer Too Small"}, - { EFI_NOT_READY, L"Not Ready"}, - { EFI_DEVICE_ERROR, L"Device Error"}, - { EFI_WRITE_PROTECTED, L"Write Protected"}, - { EFI_OUT_OF_RESOURCES, L"Out of Resources"}, - { EFI_VOLUME_CORRUPTED, L"Volume Corrupt"}, - { EFI_VOLUME_FULL, L"Volume Full"}, - { EFI_NO_MEDIA, L"No Media"}, - { EFI_MEDIA_CHANGED, L"Media changed"}, - { EFI_NOT_FOUND, L"Not Found"}, - { EFI_ACCESS_DENIED, L"Access Denied"}, - { EFI_NO_RESPONSE, L"No Response"}, - { EFI_NO_MAPPING, L"No mapping"}, - { EFI_TIMEOUT, L"Time out"}, - { EFI_NOT_STARTED, L"Not started"}, - { EFI_ALREADY_STARTED, L"Already started"}, - { EFI_ABORTED, L"Aborted"}, - { EFI_ICMP_ERROR, L"ICMP Error"}, - { EFI_TFTP_ERROR, L"TFTP Error"}, - { EFI_PROTOCOL_ERROR, L"Protocol Error"}, - { EFI_INCOMPATIBLE_VERSION, L"Incompatible Version"}, - { EFI_SECURITY_VIOLATION, L"Security Policy Violation"}, - { EFI_CRC_ERROR, L"CRC Error"}, - { EFI_END_OF_MEDIA, L"End of Media"}, - { EFI_END_OF_FILE, L"End of File"}, - { EFI_INVALID_LANGUAGE, L"Invalid Languages"}, - { EFI_COMPROMISED_DATA, L"Compromised Data"}, - - // warnings - { EFI_WARN_UNKNOWN_GLYPH, L"Warning Unknown Glyph"}, - { EFI_WARN_DELETE_FAILURE, L"Warning Delete Failure"}, - { EFI_WARN_WRITE_FAILURE, L"Warning Write Failure"}, - { EFI_WARN_BUFFER_TOO_SMALL, L"Warning Buffer Too Small"}, - { 0, NULL} -} ; - - -VOID -StatusToString ( - OUT CHAR16 *Buffer, - IN EFI_STATUS Status - ) -{ - UINTN Index; - - for (Index = 0; ErrorCodeTable[Index].Desc; Index +=1) { - if (ErrorCodeTable[Index].Code == Status) { - StrCpy (Buffer, ErrorCodeTable[Index].Desc); - return; - } - } - - UnicodeSPrint (Buffer, 0, L"%X", Status); -} diff --git a/3rd/gnu-efi/lib/event.c b/3rd/gnu-efi/lib/event.c deleted file mode 100644 index 0babc92ed..000000000 --- a/3rd/gnu-efi/lib/event.c +++ /dev/null @@ -1,154 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - event.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" - - -EFI_EVENT -LibCreateProtocolNotifyEvent ( - IN EFI_GUID *ProtocolGuid, - IN EFI_TPL NotifyTpl, - IN EFI_EVENT_NOTIFY NotifyFunction, - IN VOID *NotifyContext, - OUT VOID *Registration - ) -{ - EFI_STATUS Status; - EFI_EVENT Event; - - // - // Create the event - // - - Status = uefi_call_wrapper( - BS->CreateEvent, - 5, - EVT_NOTIFY_SIGNAL, - NotifyTpl, - NotifyFunction, - NotifyContext, - &Event - ); - if ( EFI_ERROR( Status ) ) return NULL ; - ASSERT (!EFI_ERROR(Status)); - - // - // Register for protocol notifactions on this event - // - - Status = uefi_call_wrapper( - BS->RegisterProtocolNotify, - 3, - ProtocolGuid, - Event, - Registration - ); - if ( EFI_ERROR( Status ) ) return NULL ; - ASSERT (!EFI_ERROR(Status)); - - // - // Kick the event so we will perform an initial pass of - // current installed drivers - // - - uefi_call_wrapper(BS->SignalEvent, 1, Event); - return Event; -} - - -EFI_STATUS -WaitForSingleEvent ( - IN EFI_EVENT Event, - IN UINT64 Timeout OPTIONAL - ) -{ - EFI_STATUS Status; - UINTN Index; - EFI_EVENT TimerEvent; - EFI_EVENT WaitList[2]; - - if (Timeout) { - // - // Create a timer event - // - - Status = uefi_call_wrapper(BS->CreateEvent, 5, EVT_TIMER, 0, NULL, NULL, &TimerEvent); - if (!EFI_ERROR(Status)) { - - // - // Set the timer event - // - - uefi_call_wrapper(BS->SetTimer, 3, TimerEvent, TimerRelative, Timeout); - - // - // Wait for the original event or the timer - // - - WaitList[0] = Event; - WaitList[1] = TimerEvent; - Status = uefi_call_wrapper(BS->WaitForEvent, 3, 2, WaitList, &Index); - uefi_call_wrapper(BS->CloseEvent, 1, TimerEvent); - - // - // If the timer expired, change the return to timed out - // - - if (!EFI_ERROR(Status) && Index == 1) { - Status = EFI_TIMEOUT; - } - } - - } else { - - // - // No timeout... just wait on the event - // - - Status = uefi_call_wrapper(BS->WaitForEvent, 3, 1, &Event, &Index); - ASSERT (!EFI_ERROR(Status)); - ASSERT (Index == 0); - } - - return Status; -} - -VOID -WaitForEventWithTimeout ( - IN EFI_EVENT Event, - IN UINTN Timeout, - IN UINTN Row, - IN UINTN Column, - IN CHAR16 *String, - IN EFI_INPUT_KEY TimeoutKey, - OUT EFI_INPUT_KEY *Key - ) -{ - EFI_STATUS Status; - - do { - PrintAt (Column, Row, String, Timeout); - Status = WaitForSingleEvent (Event, 10000000); - if (Status == EFI_SUCCESS) { - if (!EFI_ERROR(uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, Key))) { - return; - } - } - } while (Timeout > 0); - CopyMem(Key, &TimeoutKey, sizeof(EFI_INPUT_KEY)); -} - diff --git a/3rd/gnu-efi/lib/exit.c b/3rd/gnu-efi/lib/exit.c deleted file mode 100644 index ada27c94f..000000000 --- a/3rd/gnu-efi/lib/exit.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "lib.h" - -VOID -Exit( - IN EFI_STATUS ExitStatus, - IN UINTN ExitDataSize, - IN CHAR16 *ExitData OPTIONAL - ) -{ - uefi_call_wrapper(BS->Exit, - 4, - LibImageHandle, - ExitStatus, - ExitDataSize, - ExitData); - - // Uh oh, Exit() returned?! - for (;;) { } -} diff --git a/3rd/gnu-efi/lib/guid.c b/3rd/gnu-efi/lib/guid.c deleted file mode 100644 index 9c8cc6d24..000000000 --- a/3rd/gnu-efi/lib/guid.c +++ /dev/null @@ -1,179 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - misc.c - -Abstract: - - Misc EFI support functions - - - -Revision History - ---*/ - -#include "lib.h" - - -// -// Additional Known guids -// - -#define SHELL_INTERFACE_PROTOCOL \ - { 0x47c7b223, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -#define ENVIRONMENT_VARIABLE_ID \ - { 0x47c7b224, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -#define DEVICE_PATH_MAPPING_ID \ - { 0x47c7b225, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -#define PROTOCOL_ID_ID \ - { 0x47c7b226, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -#define ALIAS_ID \ - { 0x47c7b227, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -static EFI_GUID ShellInterfaceProtocol = SHELL_INTERFACE_PROTOCOL; -static EFI_GUID SEnvId = ENVIRONMENT_VARIABLE_ID; -static EFI_GUID SMapId = DEVICE_PATH_MAPPING_ID; -static EFI_GUID SProtId = PROTOCOL_ID_ID; -static EFI_GUID SAliasId = ALIAS_ID; - -static struct { - EFI_GUID *Guid; - WCHAR *GuidName; -} KnownGuids[] = { - { &NullGuid, L"G0" }, - { &gEfiGlobalVariableGuid, L"EfiVar" }, - - { &VariableStoreProtocol, L"VarStore" }, - { &gEfiDevicePathProtocolGuid, L"DevPath" }, - { &gEfiLoadedImageProtocolGuid, L"LdImg" }, - { &gEfiSimpleTextInProtocolGuid, L"TxtIn" }, - { &gEfiSimpleTextOutProtocolGuid, L"TxtOut" }, - { &gEfiBlockIoProtocolGuid, L"BlkIo" }, - { &gEfiBlockIo2ProtocolGuid, L"BlkIo2" }, - { &gEfiDiskIoProtocolGuid, L"DskIo" }, - { &gEfiDiskIo2ProtocolGuid, L"DskIo2" }, - { &gEfiSimpleFileSystemProtocolGuid, L"Fs" }, - { &gEfiLoadFileProtocolGuid, L"LdFile" }, - { &gEfiDeviceIoProtocolGuid, L"DevIo" }, - { &gEfiComponentNameProtocolGuid, L"CName" }, - { &gEfiComponentName2ProtocolGuid, L"CName2" }, - - { &gEfiFileInfoGuid, L"FileInfo" }, - { &gEfiFileSystemInfoGuid, L"FsInfo" }, - { &gEfiFileSystemVolumeLabelInfoIdGuid, L"FsVolInfo" }, - - { &gEfiUnicodeCollationProtocolGuid, L"Unicode" }, - { &LegacyBootProtocol, L"LegacyBoot" }, - { &gEfiSerialIoProtocolGuid, L"SerIo" }, - { &VgaClassProtocol, L"VgaClass"}, - { &gEfiSimpleNetworkProtocolGuid, L"Net" }, - { &gEfiNetworkInterfaceIdentifierProtocolGuid, L"Nii" }, - { &gEfiPxeBaseCodeProtocolGuid, L"Pxe" }, - { &gEfiPxeBaseCodeCallbackProtocolGuid, L"PxeCb" }, - - { &TextOutSpliterProtocol, L"TxtOutSplit" }, - { &ErrorOutSpliterProtocol, L"ErrOutSplit" }, - { &TextInSpliterProtocol, L"TxtInSplit" }, - { &gEfiPcAnsiGuid, L"PcAnsi" }, - { &gEfiVT100Guid, L"Vt100" }, - { &gEfiVT100PlusGuid, L"Vt100Plus" }, - { &gEfiVTUTF8Guid, L"VtUtf8" }, - { &UnknownDevice, L"UnknownDev" }, - - { &EfiPartTypeSystemPartitionGuid, L"ESP" }, - { &EfiPartTypeLegacyMbrGuid, L"GPT MBR" }, - - { &ShellInterfaceProtocol, L"ShellInt" }, - { &SEnvId, L"SEnv" }, - { &SProtId, L"ShellProtId" }, - { &SMapId, L"ShellDevPathMap" }, - { &SAliasId, L"ShellAlias" }, - - { NULL, L"" } -}; - -// -// -// - -LIST_ENTRY GuidList; - - -VOID -InitializeGuid ( - VOID - ) -{ -} - -INTN -CompareGuid( - IN EFI_GUID *Guid1, - IN EFI_GUID *Guid2 - ) -/*++ - -Routine Description: - - Compares to GUIDs - -Arguments: - - Guid1 - guid to compare - Guid2 - guid to compare - -Returns: - = 0 if Guid1 == Guid2 - ---*/ -{ - return RtCompareGuid (Guid1, Guid2); -} - - -VOID -GuidToString ( - OUT CHAR16 *Buffer, - IN EFI_GUID *Guid - ) -{ - - UINTN Index; - - // - // Else, (for now) use additional internal function for mapping guids - // - - for (Index=0; KnownGuids[Index].Guid; Index++) { - if (CompareGuid(Guid, KnownGuids[Index].Guid) == 0) { - UnicodeSPrint (Buffer, 0, KnownGuids[Index].GuidName); - return ; - } - } - - // - // Else dump it - // - - UnicodeSPrint (Buffer, 0, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - Guid->Data1, - Guid->Data2, - Guid->Data3, - Guid->Data4[0], - Guid->Data4[1], - Guid->Data4[2], - Guid->Data4[3], - Guid->Data4[4], - Guid->Data4[5], - Guid->Data4[6], - Guid->Data4[7] - ); -} diff --git a/3rd/gnu-efi/lib/hand.c b/3rd/gnu-efi/lib/hand.c deleted file mode 100644 index 73dbc8979..000000000 --- a/3rd/gnu-efi/lib/hand.c +++ /dev/null @@ -1,641 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - hand.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" -#include "efistdarg.h" // !!! - - -EFI_STATUS -LibLocateProtocol ( - IN EFI_GUID *ProtocolGuid, - OUT VOID **Interface - ) -// -// Find the first instance of this Protocol in the system and return it's interface -// -{ - EFI_STATUS Status; - UINTN NumberHandles, Index; - EFI_HANDLE *Handles; - - - *Interface = NULL; - Status = LibLocateHandle (ByProtocol, ProtocolGuid, NULL, &NumberHandles, &Handles); - if (EFI_ERROR(Status)) { - DEBUG((D_INFO, "LibLocateProtocol: Handle not found\n")); - return Status; - } - - for (Index=0; Index < NumberHandles; Index++) { - Status = uefi_call_wrapper(BS->HandleProtocol, 3, Handles[Index], ProtocolGuid, Interface); - if (!EFI_ERROR(Status)) { - break; - } - } - - if (Handles) { - FreePool (Handles); - } - - return Status; -} - -EFI_STATUS -LibLocateHandle ( - IN EFI_LOCATE_SEARCH_TYPE SearchType, - IN EFI_GUID *Protocol OPTIONAL, - IN VOID *SearchKey OPTIONAL, - IN OUT UINTN *NoHandles, - OUT EFI_HANDLE **Buffer - ) - -{ - EFI_STATUS Status; - UINTN BufferSize; - - // - // Initialize for GrowBuffer loop - // - - Status = EFI_SUCCESS; - *Buffer = NULL; - BufferSize = 50 * sizeof(EFI_HANDLE); - - // - // Call the real function - // - - while (GrowBuffer (&Status, (VOID **) Buffer, BufferSize)) { - - Status = uefi_call_wrapper( - BS->LocateHandle, - 5, - SearchType, - Protocol, - SearchKey, - &BufferSize, - *Buffer - ); - - } - - *NoHandles = BufferSize / sizeof (EFI_HANDLE); - if (EFI_ERROR(Status)) { - *NoHandles = 0; - } - - return Status; -} - -EFI_STATUS -LibLocateHandleByDiskSignature ( - IN UINT8 MBRType, - IN UINT8 SignatureType, - IN VOID *Signature, - IN OUT UINTN *NoHandles, - OUT EFI_HANDLE **Buffer - ) - -{ - EFI_STATUS Status; - UINTN BufferSize; - UINTN NoBlockIoHandles; - EFI_HANDLE *BlockIoBuffer; - EFI_DEVICE_PATH *DevicePath; - UINTN Index; - EFI_DEVICE_PATH *Next, *DevPath; - HARDDRIVE_DEVICE_PATH *HardDriveDevicePath; - BOOLEAN Match; - BOOLEAN PreviousNodeIsHardDriveDevicePath; - - // - // Initialize for GrowBuffer loop - // - - Status = EFI_SUCCESS; - BlockIoBuffer = NULL; - BufferSize = 50 * sizeof(EFI_HANDLE); - - // - // Call the real function - // - - while (GrowBuffer (&Status, (VOID **)&BlockIoBuffer, BufferSize)) { - - // - // Get list of device handles that support the BLOCK_IO Protocol. - // - - Status = uefi_call_wrapper( - BS->LocateHandle, - 5, - ByProtocol, - &BlockIoProtocol, - NULL, - &BufferSize, - BlockIoBuffer - ); - - } - - NoBlockIoHandles = BufferSize / sizeof (EFI_HANDLE); - if (EFI_ERROR(Status)) { - NoBlockIoHandles = 0; - } - - // - // If there was an error or there are no device handles that support - // the BLOCK_IO Protocol, then return. - // - - if (NoBlockIoHandles == 0) { - FreePool(BlockIoBuffer); - *NoHandles = 0; - *Buffer = NULL; - return Status; - } - - // - // Loop through all the device handles that support the BLOCK_IO Protocol - // - - *NoHandles = 0; - - for(Index=0;IndexHandleProtocol, - 3, - BlockIoBuffer[Index], - &DevicePathProtocol, - (VOID*)&DevicePath - ); - - // - // Search DevicePath for a Hard Drive Media Device Path node. - // If one is found, then see if it matches the signature that was - // passed in. If it does match, and the next node is the End of the - // device path, and the previous node is not a Hard Drive Media Device - // Path, then we have found a match. - // - - Match = FALSE; - - if (DevicePath != NULL) { - - PreviousNodeIsHardDriveDevicePath = FALSE; - - DevPath = DevicePath; - - // - // Check for end of device path type - // - - for (; ;) { - - if ((DevicePathType(DevPath) == MEDIA_DEVICE_PATH) && - (DevicePathSubType(DevPath) == MEDIA_HARDDRIVE_DP)) { - - HardDriveDevicePath = (HARDDRIVE_DEVICE_PATH *)(DevPath); - - if (PreviousNodeIsHardDriveDevicePath == FALSE) { - - Next = NextDevicePathNode(DevPath); - if (IsDevicePathEndType(Next)) { - if ((HardDriveDevicePath->MBRType == MBRType) && - (HardDriveDevicePath->SignatureType == SignatureType)) { - switch(SignatureType) { - case SIGNATURE_TYPE_MBR: - if (*((UINT32 *)(Signature)) == *(UINT32 *)(&(HardDriveDevicePath->Signature[0]))) { - Match = TRUE; - } - break; - case SIGNATURE_TYPE_GUID: - if (CompareGuid((EFI_GUID *)Signature,(EFI_GUID *)(&(HardDriveDevicePath->Signature[0]))) == 0) { - Match = TRUE; - } - break; - } - } - } - } - PreviousNodeIsHardDriveDevicePath = TRUE; - } else { - PreviousNodeIsHardDriveDevicePath = FALSE; - } - - if (IsDevicePathEnd(DevPath)) { - break; - } - - DevPath = NextDevicePathNode(DevPath); - } - - } - - if (Match == FALSE) { - BlockIoBuffer[Index] = NULL; - } else { - *NoHandles = *NoHandles + 1; - } - } - - // - // If there are no matches, then return - // - - if (*NoHandles == 0) { - FreePool(BlockIoBuffer); - *NoHandles = 0; - *Buffer = NULL; - return EFI_SUCCESS; - } - - // - // Allocate space for the return buffer of device handles. - // - - *Buffer = AllocatePool(*NoHandles * sizeof(EFI_HANDLE)); - - if (*Buffer == NULL) { - FreePool(BlockIoBuffer); - *NoHandles = 0; - *Buffer = NULL; - return EFI_OUT_OF_RESOURCES; - } - - // - // Build list of matching device handles. - // - - *NoHandles = 0; - for(Index=0;IndexHandleProtocol, 3, DeviceHandle, &FileSystemProtocol, (VOID*)&Volume); - - // - // Open the root directory of the volume - // - - if (!EFI_ERROR(Status)) { - Status = uefi_call_wrapper(Volume->OpenVolume, 2, Volume, &File); - } - - // - // Done - // - - return EFI_ERROR(Status) ? NULL : File; -} - -EFI_FILE_INFO * -LibFileInfo ( - IN EFI_FILE_HANDLE FHand - ) -{ - EFI_STATUS Status; - EFI_FILE_INFO *Buffer; - UINTN BufferSize; - - // - // Initialize for GrowBuffer loop - // - - Status = EFI_SUCCESS; - Buffer = NULL; - BufferSize = SIZE_OF_EFI_FILE_INFO + 200; - - // - // Call the real function - // - - while (GrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) { - Status = uefi_call_wrapper( - FHand->GetInfo, - 4, - FHand, - &GenericFileInfo, - &BufferSize, - Buffer - ); - } - - return Buffer; -} - - -EFI_FILE_SYSTEM_INFO * -LibFileSystemInfo ( - IN EFI_FILE_HANDLE FHand - ) -{ - EFI_STATUS Status; - EFI_FILE_SYSTEM_INFO *Buffer; - UINTN BufferSize; - - // - // Initialize for GrowBuffer loop - // - - Status = EFI_SUCCESS; - Buffer = NULL; - BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + 200; - - // - // Call the real function - // - - while (GrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) { - Status = uefi_call_wrapper( - FHand->GetInfo, - 4, - FHand, - &FileSystemInfo, - &BufferSize, - Buffer - ); - } - - return Buffer; -} - -EFI_FILE_SYSTEM_VOLUME_LABEL_INFO * -LibFileSystemVolumeLabelInfo ( - IN EFI_FILE_HANDLE FHand - ) -{ - EFI_STATUS Status; - EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *Buffer; - UINTN BufferSize; - - // - // Initialize for GrowBuffer loop - // - - Status = EFI_SUCCESS; - Buffer = NULL; - BufferSize = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO + 200; - - // - // Call the real function - // - - while (GrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) { - Status = uefi_call_wrapper( - FHand->GetInfo, - 4, - FHand, - &FileSystemVolumeLabelInfo, - &BufferSize, - Buffer - ); - } - - return Buffer; -} - - - -EFI_STATUS -LibInstallProtocolInterfaces ( - IN OUT EFI_HANDLE *Handle, - ... - ) -{ - va_list args; - EFI_STATUS Status; - EFI_GUID *Protocol; - VOID *Interface; - EFI_TPL OldTpl; - UINTN Index; - EFI_HANDLE OldHandle; - - // - // Syncronize with notifcations - // - - OldTpl = uefi_call_wrapper(BS->RaiseTPL, 1, TPL_NOTIFY); - OldHandle = *Handle; - - // - // Install the protocol interfaces - // - - Index = 0; - Status = EFI_SUCCESS; - va_start (args, Handle); - - while (!EFI_ERROR(Status)) { - - // - // If protocol is NULL, then it's the end of the list - // - - Protocol = va_arg(args, EFI_GUID *); - if (!Protocol) { - break; - } - - Interface = va_arg(args, VOID *); - - // - // Install it - // - - DEBUG((D_INFO, "LibInstallProtocolInterface: %d %x\n", Protocol, Interface)); - Status = uefi_call_wrapper(BS->InstallProtocolInterface, 4, Handle, Protocol, EFI_NATIVE_INTERFACE, Interface); - if (EFI_ERROR(Status)) { - break; - } - - Index += 1; - } - va_end (args); - - // - // If there was an error, remove all the interfaces that were - // installed without any errors - // - - if (EFI_ERROR(Status)) { - va_start (args, Handle); - while (Index) { - - Protocol = va_arg(args, EFI_GUID *); - Interface = va_arg(args, VOID *); - uefi_call_wrapper(BS->UninstallProtocolInterface, 3, *Handle, Protocol, Interface); - - Index -= 1; - } - - *Handle = OldHandle; - va_end (args); - } - - // - // Done - // - - uefi_call_wrapper(BS->RestoreTPL, 1, OldTpl); - return Status; -} - - -VOID -LibUninstallProtocolInterfaces ( - IN EFI_HANDLE Handle, - ... - ) -{ - va_list args; - EFI_STATUS Status; - EFI_GUID *Protocol; - VOID *Interface; - - - va_start (args, Handle); - for (; ;) { - - // - // If protocol is NULL, then it's the end of the list - // - - Protocol = va_arg(args, EFI_GUID *); - if (!Protocol) { - break; - } - - Interface = va_arg(args, VOID *); - - // - // Uninstall it - // - - Status = uefi_call_wrapper(BS->UninstallProtocolInterface, 3, Handle, Protocol, Interface); - if (EFI_ERROR(Status)) { - DEBUG((D_ERROR, "LibUninstallProtocolInterfaces: failed %g, %r\n", Protocol, Handle)); - } - } - va_end (args); -} - - -EFI_STATUS -LibReinstallProtocolInterfaces ( - IN OUT EFI_HANDLE *Handle, - ... - ) -{ - va_list args; - EFI_STATUS Status; - EFI_GUID *Protocol; - VOID *OldInterface, *NewInterface; - EFI_TPL OldTpl; - UINTN Index; - - // - // Syncronize with notifcations - // - - OldTpl = uefi_call_wrapper(BS->RaiseTPL, 1, TPL_NOTIFY); - - // - // Install the protocol interfaces - // - - Index = 0; - Status = EFI_SUCCESS; - va_start (args, Handle); - - while (!EFI_ERROR(Status)) { - - // - // If protocol is NULL, then it's the end of the list - // - - Protocol = va_arg(args, EFI_GUID *); - if (!Protocol) { - break; - } - - OldInterface = va_arg(args, VOID *); - NewInterface = va_arg(args, VOID *); - - // - // Reinstall it - // - - Status = uefi_call_wrapper(BS->ReinstallProtocolInterface, 4, Handle, Protocol, OldInterface, NewInterface); - if (EFI_ERROR(Status)) { - break; - } - - Index += 1; - } - va_end (args); - - // - // If there was an error, undo all the interfaces that were - // reinstalled without any errors - // - - if (EFI_ERROR(Status)) { - va_start (args, Handle); - while (Index) { - - Protocol = va_arg(args, EFI_GUID *); - OldInterface = va_arg(args, VOID *); - NewInterface = va_arg(args, VOID *); - - uefi_call_wrapper(BS->ReinstallProtocolInterface, 4, Handle, Protocol, NewInterface, OldInterface); - - Index -= 1; - } - va_end (args); - } - - // - // Done - // - - uefi_call_wrapper(BS->RestoreTPL, 1, OldTpl); - return Status; -} diff --git a/3rd/gnu-efi/lib/hw.c b/3rd/gnu-efi/lib/hw.c deleted file mode 100644 index 09a77f9aa..000000000 --- a/3rd/gnu-efi/lib/hw.c +++ /dev/null @@ -1,132 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - hw.c - -Abstract: - - Debug library functions for Hardware IO access - - - -Revision History - ---*/ - -#include "lib.h" - - -EFI_STATUS -InitializeGlobalIoDevice ( - IN EFI_DEVICE_PATH *DevicePath, - IN EFI_GUID *Protocol, - IN CHAR8 *ErrorStr EFI_UNUSED, - OUT EFI_DEVICE_IO_INTERFACE **GlobalIoFncs - ) -/*++ - -Routine Description: - - Check to see if DevicePath exists for a given Protocol. Return Error if it - exists. Return GlobalIoFuncs set match the DevicePath - - Arguments: - - DevicePath - to operate on - Protocol - to check the DevicePath against - ErrorStr - ASCII string to display on error - GlobalIoFncs - Returned with DeviceIoProtocol for the DevicePath - -Returns: - - Pass or Fail based on wether GlobalIoFncs where found - ---*/ -{ - EFI_STATUS Status; - EFI_HANDLE Handle; - - // - // Check to see if this device path already has Protocol on it. - // if so we are loading recursivly and should exit with an error - // - Status = uefi_call_wrapper(BS->LocateDevicePath, 3, Protocol, &DevicePath, &Handle); - if (!EFI_ERROR(Status)) { - DEBUG ((D_INIT, "Device Already Loaded for %a device\n", ErrorStr)); - return EFI_LOAD_ERROR; - } - - Status = uefi_call_wrapper(BS->LocateDevicePath, 3, &DeviceIoProtocol, &DevicePath, &Handle); - if (!EFI_ERROR(Status)) { - Status = uefi_call_wrapper(BS->HandleProtocol, 3, Handle, &DeviceIoProtocol, (VOID*)GlobalIoFncs); - } - - ASSERT (!EFI_ERROR(Status)); - return Status; -} - -UINT32 -ReadPort ( - IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, - IN EFI_IO_WIDTH Width, - IN UINTN Port - ) -{ - UINT32 Data; - EFI_STATUS Status EFI_UNUSED; - - Status = uefi_call_wrapper(GlobalIoFncs->Io.Read, 5, GlobalIoFncs, Width, (UINT64)Port, 1, &Data); - ASSERT(!EFI_ERROR(Status)); - return Data; -} - -UINT32 -WritePort ( - IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, - IN EFI_IO_WIDTH Width, - IN UINTN Port, - IN UINTN Data - ) -{ - EFI_STATUS Status EFI_UNUSED; - - Status = uefi_call_wrapper(GlobalIoFncs->Io.Write, 5, GlobalIoFncs, Width, (UINT64)Port, 1, &Data); - ASSERT(!EFI_ERROR(Status)); - return (UINT32)Data; -} - -UINT32 -ReadPciConfig ( - IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, - IN EFI_IO_WIDTH Width, - IN UINTN Address - ) -{ - UINT32 Data; - EFI_STATUS Status EFI_UNUSED; - - Status = uefi_call_wrapper(GlobalIoFncs->Pci.Read, 5, GlobalIoFncs, Width, (UINT64)Address, 1, &Data); - ASSERT(!EFI_ERROR(Status)); - return Data; -} - -UINT32 -WritePciConfig ( - IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, - IN EFI_IO_WIDTH Width, - IN UINTN Address, - IN UINTN Data - ) -{ - EFI_STATUS Status EFI_UNUSED; - - Status = uefi_call_wrapper(GlobalIoFncs->Pci.Write, 5, GlobalIoFncs, Width, (UINT64)Address, 1, &Data); - ASSERT(!EFI_ERROR(Status)); - return (UINT32)Data; -} - - - diff --git a/3rd/gnu-efi/lib/ia32/efi_stub.S b/3rd/gnu-efi/lib/ia32/efi_stub.S deleted file mode 100644 index f84aaf293..000000000 --- a/3rd/gnu-efi/lib/ia32/efi_stub.S +++ /dev/null @@ -1,5 +0,0 @@ -/* This stub is a stub to make the build happy */ - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/ia32/initplat.c b/3rd/gnu-efi/lib/ia32/initplat.c deleted file mode 100644 index 7c887a67b..000000000 --- a/3rd/gnu-efi/lib/ia32/initplat.c +++ /dev/null @@ -1,27 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - initplat.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" - -VOID -InitializeLibPlatform ( - IN EFI_HANDLE ImageHandle EFI_UNUSED, - IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED - ) -{ -} - diff --git a/3rd/gnu-efi/lib/ia32/math.c b/3rd/gnu-efi/lib/ia32/math.c deleted file mode 100644 index 2ef75883b..000000000 --- a/3rd/gnu-efi/lib/ia32/math.c +++ /dev/null @@ -1,199 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - math.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" - - -// -// Declare runtime functions -// - -#ifdef RUNTIME_CODE -#ifndef __GNUC__ -#pragma RUNTIME_CODE(LShiftU64) -#pragma RUNTIME_CODE(RShiftU64) -#pragma RUNTIME_CODE(MultU64x32) -#pragma RUNTIME_CODE(DivU64x32) -#endif -#endif - -// -// -// - -UINT64 -LShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Left shift 64bit by 32bit and get a 64bit result -{ -#ifdef __GNUC__ - return Operand << Count; -#else - UINT64 Result; - _asm { - mov eax, dword ptr Operand[0] - mov edx, dword ptr Operand[4] - mov ecx, Count - and ecx, 63 - - shld edx, eax, cl - shl eax, cl - - cmp ecx, 32 - jc short ls10 - - mov edx, eax - xor eax, eax - -ls10: - mov dword ptr Result[0], eax - mov dword ptr Result[4], edx - } - - return Result; -#endif -} - -UINT64 -RShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Right shift 64bit by 32bit and get a 64bit result -{ -#ifdef __GNUC__ - return Operand >> Count; -#else - UINT64 Result; - _asm { - mov eax, dword ptr Operand[0] - mov edx, dword ptr Operand[4] - mov ecx, Count - and ecx, 63 - - shrd eax, edx, cl - shr edx, cl - - cmp ecx, 32 - jc short rs10 - - mov eax, edx - xor edx, edx - -rs10: - mov dword ptr Result[0], eax - mov dword ptr Result[4], edx - } - - return Result; -#endif -} - - -UINT64 -MultU64x32 ( - IN UINT64 Multiplicand, - IN UINTN Multiplier - ) -// Multiple 64bit by 32bit and get a 64bit result -{ -#ifdef __GNUC__ - return Multiplicand * Multiplier; -#else - UINT64 Result; - _asm { - mov eax, dword ptr Multiplicand[0] - mul Multiplier - mov dword ptr Result[0], eax - mov dword ptr Result[4], edx - mov eax, dword ptr Multiplicand[4] - mul Multiplier - add dword ptr Result[4], eax - } - - return Result; -#endif -} - -UINT64 -DivU64x32 ( - IN UINT64 Dividend, - IN UINTN Divisor, - OUT UINTN *Remainder OPTIONAL - ) -// divide 64bit by 32bit and get a 64bit result -// N.B. only works for 31bit divisors!! -{ -#if 0 && defined(__GNUC__) && !defined(__MINGW32__) - if (Remainder) - *Remainder = Dividend % Divisor; - return Dividend / Divisor; -#else - UINT32 Rem; - UINT32 bit; - - ASSERT (Divisor != 0); - ASSERT ((Divisor >> 31) == 0); - - // - // For each bit in the dividend - // - - Rem = 0; - for (bit=0; bit < 64; bit++) { -#if defined(__GNUC__) || defined(__MINGW32__) - __asm__ ( - "shll $1, %0\n\t" - "rcll $1, 4%0\n\t" - "rcll $1, %2\n\t" - "mov %2, %%eax\n\t" - "cmp %1, %%eax\n\t" - "cmc\n\t" - "sbb %%eax, %%eax\n\t" - "sub %%eax, %0\n\t" - "and %1, %%eax\n\t" - "sub %%eax, %2" - : /* no outputs */ - : "m"(Dividend), "m"(Divisor), "m"(Rem) - : "cc","memory","%eax" - ); -#else - _asm { - shl dword ptr Dividend[0], 1 ; shift rem:dividend left one - rcl dword ptr Dividend[4], 1 - rcl dword ptr Rem, 1 - - mov eax, Rem - cmp eax, Divisor ; Is Rem >= Divisor? - cmc ; No - do nothing - sbb eax, eax ; Else, - sub dword ptr Dividend[0], eax ; set low bit in dividen - and eax, Divisor ; and - sub Rem, eax ; subtract divisor - } -#endif - } - - if (Remainder) { - *Remainder = Rem; - } - - return Dividend; -#endif -} diff --git a/3rd/gnu-efi/lib/ia32/setjmp.S b/3rd/gnu-efi/lib/ia32/setjmp.S deleted file mode 100644 index c768488b3..000000000 --- a/3rd/gnu-efi/lib/ia32/setjmp.S +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. - * This program and the accompanying materials are licensed and made -available - * under the terms and conditions of the BSD License which accompanies -this - * distribution. The full text of the license may be found at - * http://opensource.org/licenses/bsd-license.php. - * - * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" -BASIS, - * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR - * IMPLIED. - */ - .text - .globl setjmp -#ifndef __MINGW32__ - .type setjmp, @function -#else - .def setjmp; .scl 2; .type 32; .endef -#endif -setjmp: - pop %ecx - movl (%esp), %edx - movl %ebx, (%edx) - movl %esi, 4(%edx) - movl %edi, 8(%edx) - movl %ebp, 12(%edx) - movl %esp, 16(%edx) - xorl %eax, %eax - jmp *%ecx - - .globl longjmp -#ifndef __MINGW32__ - .type longjmp, @function -#else - .def longjmp; .scl 2; .type 32; .endef -#endif -longjmp: - pop %eax - pop %edx - pop %eax - movl (%edx), %ebx - movl 4(%edx), %esi - movl 8(%edx), %edi - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/ia64/initplat.c b/3rd/gnu-efi/lib/ia64/initplat.c deleted file mode 100644 index 810d4fe14..000000000 --- a/3rd/gnu-efi/lib/ia64/initplat.c +++ /dev/null @@ -1,30 +0,0 @@ -/*++ - -Copyright (c) 1999 Intel Corporation - -Module Name: - - initplat.c - -Abstract: - - Functions to make SAL and PAL proc calls - -Revision History - ---*/ -#include "lib.h" - -//#include "palproc.h" - -VOID -InitializeLibPlatform ( - IN EFI_HANDLE ImageHandle EFI_UNUSED, - IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED - ) -{ - PLABEL SalPlabel; - UINT64 PalEntry; - - LibInitSalAndPalProc (&SalPlabel, &PalEntry); -} diff --git a/3rd/gnu-efi/lib/ia64/math.c b/3rd/gnu-efi/lib/ia64/math.c deleted file mode 100644 index a8c4e1229..000000000 --- a/3rd/gnu-efi/lib/ia64/math.c +++ /dev/null @@ -1,88 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - math.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" - - -// -// Declare runtime functions -// - -#ifdef RUNTIME_CODE -#ifndef __GNUC__ -#pragma RUNTIME_CODE(LShiftU64) -#pragma RUNTIME_CODE(RShiftU64) -#pragma RUNTIME_CODE(MultU64x32) -#pragma RUNTIME_CODE(DivU64x32) -#endif -#endif - -// -// -// - - - - -UINT64 -LShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Left shift 64bit by 32bit and get a 64bit result -{ - return Operand << Count; -} - -UINT64 -RShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Right shift 64bit by 32bit and get a 64bit result -{ - return Operand >> Count; -} - - -UINT64 -MultU64x32 ( - IN UINT64 Multiplicand, - IN UINTN Multiplier - ) -// Multiple 64bit by 32bit and get a 64bit result -{ - return Multiplicand * Multiplier; -} - -UINT64 -DivU64x32 ( - IN UINT64 Dividend, - IN UINTN Divisor, - OUT UINTN *Remainder OPTIONAL - ) -// divide 64bit by 32bit and get a 64bit result -// N.B. only works for 31bit divisors!! -{ - ASSERT (Divisor != 0); - - if (Remainder) { - *Remainder = Dividend % Divisor; - } - - return Dividend / Divisor; -} diff --git a/3rd/gnu-efi/lib/ia64/palproc.S b/3rd/gnu-efi/lib/ia64/palproc.S deleted file mode 100644 index b778623f9..000000000 --- a/3rd/gnu-efi/lib/ia64/palproc.S +++ /dev/null @@ -1,164 +0,0 @@ -//++ -// Copyright (c) 1996-99 Intel Corp. -// -// -// Module Name: -// -// palproc.s -// -// Abstract: -// -// Contains an implementation for making PAL PROC calls on -// IA-64 architecture. -// -// -// -// Revision History: -// -//-- - - .file "palproc.s" - -#include "palproc.h" - - -//----------------------------------------------------------------------------- -//++ -// MakeStaticPALCall -// -// This routine is called whenever an architected static calling convention -// based PAL call is to be made. This call does use RSE actually, but our policy -// in making static PAL calls before memory is available is to make sure that -// we do not nest too deep and allocate beyond 96 banked registers. In other -// words we carefully code calls and control flow before memory is available. -// -// Arguments : All parameters set up to do static PAL call. -// -// On Entry : -// -// Return Value: -// -// As per static calling conventions. -// -//-- -//--------------------------------------------------------------------------- -PROCEDURE_ENTRY(MakeStaticPALCall) - - NESTED_SETUP (5,8,0,0) - mov loc3 = b5 - mov loc4 = r2 - mov loc7 = r1;; - - movl loc6 = PAL_MC_CLEAR_LOG - mov r2 = psr;; - mov loc5 = r2 - - cmp.eq p6,p7 = r28,loc6;; - (p7)movl loc6 = PAL_MC_DYNAMIC_STATE;; - (p7)cmp.eq p6,p7 = r28,loc6;; - - (p7)movl loc6 = PAL_MC_ERROR_INFO;; - (p7)cmp.eq p6,p7 = r28,loc6;; - - (p7)movl loc6 = PAL_MC_RESUME;; - (p7)cmp.eq p6,p7 = r28,loc6 - - mov loc6 = 0x1;; - (p7)dep r2 = loc6,r2,13,1;; // psr.ic = 1 - -// p6 will be true, if it is one of the MCHK calls. There has been lots of debate -// on psr.ic for these values. For now, do not do any thing to psr.ic - -// (p6)dep r2 = r0,r2,13,1;; // psr.ic = 0 - dep r2 = r0,r2,14,1;; // psr.i = 0 - - mov psr.l = r2 - srlz.d;; // Needs data serailization. - srlz.i;; // Needs instruction serailization. - -StaticGetPALLocalIP: - mov loc2 = ip;; - add loc2 = StaticComeBackFromPALCall - StaticGetPALLocalIP,loc2;; - mov b0 = loc2 // return address after Pal call - mov r28 = in1 // get the input parameters to PAL call - mov r29 = in2 - mov r30 = in3;; - mov r31 = in4 - mov b5 = in0;; // get the PalProcEntrypt from input - br.sptk b5 // Take the plunge. - -StaticComeBackFromPALCall: - - mov psr.l = loc5;; - srlz.d;; // Needs data serailization. - srlz.i;; // Needs instruction serailization. - - mov b5 = loc3 - mov r2 = loc4 - mov r1 = loc7 - - NESTED_RETURN - -PROCEDURE_EXIT(MakeStaticPALCall) - - -//----------------------------------------------------------------------------- -//++ -// MakeStackedPALCall -// -// This routine is called whenever an architected stacked calling convention -// based PAL call is to be made. This call is made after memory is available. -// Although stacked calls could be made directly from 'C', there is a PAL -// requirement which forces the index to be in GR28 and hence this stub is -// needed -// -// Arguments : All parameters set up to do stacted PAL call. -// -// On Entry : -// in0: PAL_PROC entrypoint -// in1-in4 : PAL_PROC arguments -// -// Return Value: -// -// As per stacked calling conventions. -// -//-- -//--------------------------------------------------------------------------- -PROCEDURE_ENTRY(MakeStackedPALCall) - - NESTED_SETUP (5,8,4,0) - mov loc3 = b5 - mov loc4 = r2 - mov loc7 = r1 - mov r2 = psr;; - mov loc5 = r2;; - dep r2 = r0,r2,14,1;; // psr.i = 0 - mov psr.l = r2 - srlz.d;; // Needs data serailization. - srlz.i;; // Needs instruction serailization. - -StackedGetPALLocalIP: - mov r28 = in1 // get the input parameters to PAL call - mov out0 = in1 - mov out1 = in2;; - mov out2 = in3 - mov out3 = in4 - mov b5 = in0;; // get the PalProcEntrypt from input - br.call.dpnt b0=b5;; // Take the plunge. - -StackedComeBackFromPALCall: - - mov psr.l = loc5;; - srlz.d;; // Needs data serailization. - srlz.i;; // Needs instruction serailization. - mov b5 = loc3 - mov r2 = loc4 - mov r1 = loc7 - - NESTED_RETURN - -PROCEDURE_EXIT(MakeStackedPALCall) - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/ia64/palproc.h b/3rd/gnu-efi/lib/ia64/palproc.h deleted file mode 100644 index 240946d63..000000000 --- a/3rd/gnu-efi/lib/ia64/palproc.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// -// Copyright (c) 1996-99 Intel Corp. -// -// -//Module Name: -// -// palproc.h -// -//Abstract: -// -// This module contains generic macros for an IA64 assembly writer. -// -// -//Revision History -// - -#ifndef _PALPROC_H -#define _PALPROC_H - -#define PROCEDURE_ENTRY(name) .##text; \ - .##type name, @function; \ - .##global name; \ - .##proc name; \ -name: - -#define PROCEDURE_EXIT(name) .##endp name - -// Note: use of NESTED_SETUP requires number of locals (l) >= 3 - -#define NESTED_SETUP(i,l,o,r) \ - alloc loc1=ar##.##pfs,i,l,o,r ;\ - mov loc0=b0 - -#define NESTED_RETURN \ - mov b0=loc0 ;\ - mov ar##.##pfs=loc1 ;;\ - br##.##ret##.##dpnt b0;; - - -// defines needed in palproc.s - -#define PAL_MC_CLEAR_LOG 0x0015 -#define PAL_MC_DRAIN 0x0016 -#define PAL_MC_EXPECTED 0x0017 -#define PAL_MC_DYNAMIC_STATE 0x0018 -#define PAL_MC_ERROR_INFO 0x0019 -#define PAL_MC_RESUME 0x001a -#define PAL_MC_REGISTER_MEM 0x001b - -#endif // _PALPROC_H diff --git a/3rd/gnu-efi/lib/ia64/salpal.c b/3rd/gnu-efi/lib/ia64/salpal.c deleted file mode 100644 index 3d808f3e8..000000000 --- a/3rd/gnu-efi/lib/ia64/salpal.c +++ /dev/null @@ -1,335 +0,0 @@ -/*++ - -Copyright (c) 1999 Intel Corporation - -Module Name: - - salpal.c - -Abstract: - - Functions to make SAL and PAL proc calls - -Revision History - ---*/ -#include "lib.h" -#include "palproc.h" -#include "salproc.h" -/*++ - -Copyright (c) 1999 Intel Corporation - -Module Name: - - EfiRtLib.h - -Abstract: - - EFI Runtime library functions - - - -Revision History - ---*/ - -#include "efi.h" -#include "efilib.h" - -rArg -MakeStaticPALCall ( - IN UINT64 PALPROCPtr, - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4 - ); - -rArg -MakeStackedPALCall ( - IN UINT64 PALPROCPtr, - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4 - ); - - -PLABEL SalProcPlabel; -PLABEL PalProcPlabel; -CALL_SAL_PROC GlobalSalProc; -CALL_PAL_PROC GlobalPalProc; - -VOID -LibInitSalAndPalProc ( - OUT PLABEL *SalPlabel, - OUT UINT64 *PalEntry - ) -{ - SAL_SYSTEM_TABLE_ASCENDING_ORDER *SalSystemTable; - EFI_STATUS Status; - - GlobalSalProc = NULL; - GlobalPalProc = NULL; - - Status = LibGetSystemConfigurationTable(&SalSystemTableGuid, (VOID **)&SalSystemTable); - if (EFI_ERROR(Status)) { - return; - } - - // - // BugBug: Add code to test checksum on the Sal System Table - // - if (SalSystemTable->Entry0.Type != 0) { - return; - } - - SalProcPlabel.ProcEntryPoint = SalSystemTable->Entry0.SalProcEntry; - SalProcPlabel.GP = SalSystemTable->Entry0.GlobalDataPointer; - GlobalSalProc = (CALL_SAL_PROC)&SalProcPlabel.ProcEntryPoint; - - // - // Need to check the PAL spec to make sure I'm not responsible for - // storing more state. - // We are passing in a Plabel that should be ignorred by the PAL. Call - // this way will cause use to retore our gp after the PAL returns. - // - PalProcPlabel.ProcEntryPoint = SalSystemTable->Entry0.PalProcEntry; - PalProcPlabel.GP = SalSystemTable->Entry0.GlobalDataPointer; - GlobalPalProc = (CALL_PAL_PROC)PalProcPlabel.ProcEntryPoint; - - *PalEntry = PalProcPlabel.ProcEntryPoint; - *SalPlabel = SalProcPlabel; -} - -EFI_STATUS -LibGetSalIoPortMapping ( - OUT UINT64 *IoPortMapping - ) -/*++ - - Get the IO Port Map from the SAL System Table. - DO NOT USE THIS TO DO YOU OWN IO's!!!!!!!!!!!! - Only use this for getting info, or initing the built in EFI IO abstraction. - Always use the EFI Device IO protoocl to access IO space. - ---*/ -{ - SAL_SYSTEM_TABLE_ASCENDING_ORDER *SalSystemTable; - SAL_ST_MEMORY_DESCRIPTOR_ENTRY *SalMemDesc; - EFI_STATUS Status; - - Status = LibGetSystemConfigurationTable(&SalSystemTableGuid, (VOID **)&SalSystemTable); - if (EFI_ERROR(Status)) { - return EFI_UNSUPPORTED; - } - - // - // BugBug: Add code to test checksum on the Sal System Table - // - if (SalSystemTable->Entry0.Type != 0) { - return EFI_UNSUPPORTED; - } - - // - // The SalSystemTable pointer includes the Type 0 entry. - // The SalMemDesc is Type 1 so it comes next. - // - SalMemDesc = (SAL_ST_MEMORY_DESCRIPTOR_ENTRY *)(SalSystemTable + 1); - while (SalMemDesc->Type == SAL_ST_MEMORY_DESCRIPTOR) { - if (SalMemDesc->MemoryType == SAL_IO_PORT_MAPPING) { - *IoPortMapping = SalMemDesc->PhysicalMemoryAddress; - return EFI_SUCCESS; - } - SalMemDesc++; - } - return EFI_UNSUPPORTED; -} - -EFI_STATUS -LibGetSalIpiBlock ( - OUT UINT64 *IpiBlock - ) -/*++ - - Get the IPI block from the SAL system table - ---*/ -{ - SAL_SYSTEM_TABLE_ASCENDING_ORDER *SalSystemTable; - SAL_ST_MEMORY_DESCRIPTOR_ENTRY *SalMemDesc; - EFI_STATUS Status; - - Status = LibGetSystemConfigurationTable(&SalSystemTableGuid, (VOID*)&SalSystemTable); - if (EFI_ERROR(Status)) { - return EFI_UNSUPPORTED; - } - - // - // BugBug: Add code to test checksum on the Sal System Table - // - if (SalSystemTable->Entry0.Type != 0) { - return EFI_UNSUPPORTED; - } - - // - // The SalSystemTable pointer includes the Type 0 entry. - // The SalMemDesc is Type 1 so it comes next. - // - SalMemDesc = (SAL_ST_MEMORY_DESCRIPTOR_ENTRY *)(SalSystemTable + 1); - while (SalMemDesc->Type == SAL_ST_MEMORY_DESCRIPTOR) { - if (SalMemDesc->MemoryType == SAL_SAPIC_IPI_BLOCK ) { - *IpiBlock = SalMemDesc->PhysicalMemoryAddress; - return EFI_SUCCESS; - } - SalMemDesc++; - } - return EFI_UNSUPPORTED; -} - -EFI_STATUS -LibGetSalWakeupVector ( - OUT UINT64 *WakeVector - ) -/*++ - -Get the wakeup vector from the SAL system table - ---*/ -{ - SAL_ST_AP_WAKEUP_DECRIPTOR *ApWakeUp; - - ApWakeUp = LibSearchSalSystemTable (SAL_ST_AP_WAKEUP); - if (!ApWakeUp) { - *WakeVector = -1; - return EFI_UNSUPPORTED; - } - *WakeVector = ApWakeUp->ExternalInterruptVector; - return EFI_SUCCESS; -} - -VOID * -LibSearchSalSystemTable ( - IN UINT8 EntryType - ) -{ - EFI_STATUS Status; - UINT8 *SalTableHack; - SAL_SYSTEM_TABLE_ASCENDING_ORDER *SalSystemTable; - UINT16 EntryCount; - UINT16 Count; - - Status = LibGetSystemConfigurationTable(&SalSystemTableGuid, (VOID*)&SalSystemTable); - if (EFI_ERROR(Status)) { - return NULL; - } - - EntryCount = SalSystemTable->Header.EntryCount; - if (EntryCount == 0) { - return NULL; - } - // - // BugBug: Add code to test checksum on the Sal System Table - // - - SalTableHack = (UINT8 *)&SalSystemTable->Entry0; - for (Count = 0; Count < EntryCount ;Count++) { - if (*SalTableHack == EntryType) { - return (VOID *)SalTableHack; - } - switch (*SalTableHack) { - case SAL_ST_ENTRY_POINT: - SalTableHack += 48; - break; - case SAL_ST_MEMORY_DESCRIPTOR: - SalTableHack += 32; - break; - case SAL_ST_PLATFORM_FEATURES: - SalTableHack += 16; - break; - case SAL_ST_TR_USAGE: - SalTableHack += 32; - break; - case SAL_ST_PTC: - SalTableHack += 16; - break; - case SAL_ST_AP_WAKEUP: - SalTableHack += 16; - break; - default: - ASSERT(FALSE); - break; - } - } - return NULL; -} - -VOID -LibSalProc ( - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4, - IN UINT64 Arg5, - IN UINT64 Arg6, - IN UINT64 Arg7, - IN UINT64 Arg8, - OUT rArg *Results OPTIONAL - ) -{ - rArg ReturnValue; - - ReturnValue.p0 = -3; // SAL status return completed with error - if (GlobalSalProc) { - ReturnValue = GlobalSalProc(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8); - } - - if (Results) { - CopyMem (Results, &ReturnValue, sizeof(rArg)); - } -} - -VOID -LibPalProc ( - IN UINT64 Arg1, // Pal Proc index - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4, - OUT rArg *Results OPTIONAL - ) -{ - - rArg ReturnValue; - - ReturnValue.p0 = -3; // PAL status return completed with error - - // - // check for valid PalProc entry point - // - - if (!GlobalPalProc) { - if (Results) - CopyMem (Results, &ReturnValue, sizeof(rArg)); - return; - } - - // - // check if index falls within stacked or static register calling conventions - // and call appropriate Pal stub call - // - - if (((Arg1 >=255) && (Arg1 <=511)) || - ((Arg1 >=768) && (Arg1 <=1023))) { - ReturnValue = MakeStackedPALCall((UINT64)GlobalPalProc,Arg1,Arg2,Arg3,Arg4); - } - else { - ReturnValue = MakeStaticPALCall((UINT64)GlobalPalProc,Arg1,Arg2,Arg3,Arg4); - } - - if (Results) - CopyMem (Results, &ReturnValue, sizeof(rArg)); - - return; -} - diff --git a/3rd/gnu-efi/lib/ia64/setjmp.S b/3rd/gnu-efi/lib/ia64/setjmp.S deleted file mode 100644 index 09d686296..000000000 --- a/3rd/gnu-efi/lib/ia64/setjmp.S +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. - * This program and the accompanying materials are licensed and made -available - * under the terms and conditions of the BSD License which accompanies -this - * distribution. The full text of the license may be found at - * http://opensource.org/licenses/bsd-license.php. - * - * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" -BASIS, - * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR - * IMPLIED. - */ - .text - .globl setjmp - .type setjmp, @function -setjmp: - alloc loc0 = ar.pfs, 1, 2, 1, 0 - ;; - mov r14 = ar.unat - mov r15 = ar.bsp - add r10 = 0x10*20, in0 - ;; - stf.spill.nta [in0] = f2, 0x10 - st8.spill.nta [r10] = r4, 8 - mov r21 = b1 - ;; - stf.spill.nta [in0] = f3, 0x10 - st8.spill.nta [r10] = r5, 8 - mov r22 = b2 - ;; - stf.spill.nta [in0] = f4, 0x10 - st8.spill.nta [r10] = r6, 8 - mov r23 = b3 - ;; - stf.spill.nta [in0] = f5, 0x10 - st8.spill.nta [r10] = r7, 8 - mov r24 = b4 - ;; - stf.spill.nta [in0] = f16, 0x10 - st8.spill.nta [r10] = sp, 8 - mov r25 = b5 - ;; - stf.spill.nta [in0] = f17, 0x10 - st8.nta [r10] = loc1, 8 - mov r16 = pr - ;; - stf.spill.nta [in0] = f18, 0x10 - st8.nta [r10] = r21, 8 - mov r17 = ar.lc - ;; - stf.spill.nta [in0] = f19, 0x10 - st8.nta [r10] = r22, 8 - ;; - stf.spill.nta [in0] = f20, 0x10 - st8.nta [r10] = r23, 8 - ;; - stf.spill.nta [in0] = f21, 0x10 - st8.nta [r10] = r24, 8 - ;; - stf.spill.nta [in0] = f22, 0x10 - st8.nta [r10] = r25, 8 - ;; - stf.spill.nta [in0] = f23, 0x10 - mov r18 = ar.unat - ;; - stf.spill.nta [in0] = f24, 0x10 - st8.nta [r10] = r14, 8 - ;; - stf.spill.nta [in0] = f25, 0x10 - st8.nta [r10] = r18, 8 - ;; - stf.spill.nta [in0] = f26, 0x10 - st8.nta [r10] = loc0, 8 - ;; - stf.spill.nta [in0] = f27, 0x10 - st8.nta [r10] = r15, 8 - mov r8 = 0 - ;; - stf.spill.nta [in0] = f28, 0x10 - mov r19 = ar.fpsr - ;; - stf.spill.nta [in0] = f29, 0x10 - st8.nta [r10] = r16, 8 - mov ar.pfs = loc0 - ;; - stf.spill.nta [in0] = f30, 0x10 - st8.nta [r10] = r17, 8 - mov b0 = loc1 - ;; - stf.spill.nta [in0] = f31, 0x10 - st8.nta [r10] = r19 - ;; - mov ar.unat = r14 - br.ret.sptk b0 - ;; - - .globl longjmp - .type longjmp, @function - .regstk 2, 0, 0, 0 -longjmp: - add r10 = 0x10*20 + 8*14, in0 - movl r2 = ~((((1<<14) - 1) << 16) | 3) - ;; - ld8.nt1 r14 = [r10], -8*2 - mov r15 = ar.bspstore - ;; - ld8.nt1 r17 = [r10], -8 - mov r16 = ar.rsc - cmp.leu p6 = r14, r15 - ;; - ld8.nt1 r18 = [r10], -8 - ld8.nt1 r25 = [r10], -8 - and r2 = r16, r2 - ;; - ldf.fill.nt1 f2 = [in0], 0x10 - ld8.nt1 r24 = [r10], -8 - mov b5 = r25 - ;; - mov ar.rsc = r2 - ld8.nt1 r23 = [r10], -8 - mov b4 = r24 - ;; - ldf.fill.nt1 f3 = [in0], 0x10 - mov ar.unat = r17 -(p6) br.spnt.many _skip_flushrs - ;; - flushrs - mov r15 = ar.bsp - ;; -_skip_flushrs: - mov r31 = ar.rnat - loadrs - ;; - ldf.fill.nt1 f4 = [in0], 0x10 - ld8.nt1 r22 = [r10], -8 - dep r2 = -1, r14, 3, 6 - ;; - ldf.fill.nt1 f5 = [in0], 0x10 - ld8.nt1 r21 = [r10], -8 - cmp.ltu p6 = r2, r15 - ;; - ld8.nt1 r20 = [r10], -0x10 -(p6) ld8.nta r31 = [r2] - mov b3 = r23 - ;; - ldf.fill.nt1 f16 = [in0], 0x10 - ld8.fill.nt1 r7 = [r10], -8 - mov b2 = r22 - ;; - ldf.fill.nt1 f17 = [in0], 0x10 - ld8.fill.nt1 r6 = [r10], -8 - mov b1 = r21 - ;; - ldf.fill.nt1 f18 = [in0], 0x10 - ld8.fill.nt1 r5 = [r10], -8 - mov b0 = r20 - ;; - ldf.fill.nt1 f19 = [in0], 0x10 - ld8.fill.nt1 r4 = [r10], 8*13 - ;; - ldf.fill.nt1 f20 = [in0], 0x10 - ld8.nt1 r19 = [r10], 0x10 - ;; - ldf.fill.nt1 f21 = [in0], 0x10 - ld8.nt1 r26 = [r10], 8 - mov ar.pfs = r19 - ;; - ldf.fill.nt1 f22 = [in0], 0x10 - ld8.nt1 r27 = [r10], 8 - mov pr = r26, -1 - ;; - ldf.fill.nt1 f23 = [in0], 0x10 - ld8.nt1 r28 = [r10], -17*8 - 0x10 - mov ar.lc = r27 - ;; - ldf.fill.nt1 f24 = [in0], 0x10 - ldf.fill.nt1 f25 = [in0], 0x10 - mov r8 = in1 - ;; - ldf.fill.nt1 f26 = [in0], 0x10 - ldf.fill.nt1 f31 = [r10], -0x10 - ;; - ldf.fill.nt1 f27 = [in0], 0x10 - ldf.fill.nt1 f30 = [r10], -0x10 - ;; - ldf.fill.nt1 f28 = [in0] - ldf.fill.nt1 f29 = [r10], 0x10*3 + 8*4 - ;; - ld8.fill.nt1 sp = [r10] - mov ar.unat = r18 - ;; - mov ar.bspstore = r14 - mov ar.rnat = r31 - ;; - invala - mov ar.rsc = r16 - br.ret.sptk b0 - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/init.c b/3rd/gnu-efi/lib/init.c deleted file mode 100644 index 726e49391..000000000 --- a/3rd/gnu-efi/lib/init.c +++ /dev/null @@ -1,209 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" - -VOID -EFIDebugVariable ( - VOID - ); - -VOID -InitializeLib ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -/*++ - -Routine Description: - - Initializes EFI library for use - -Arguments: - - Firmware's EFI system table - -Returns: - - None - ---*/ -{ - EFI_LOADED_IMAGE *LoadedImage; - EFI_STATUS Status; - CHAR8 *LangCode; - - if (LibInitialized) - return; - - LibInitialized = TRUE; - LibFwInstance = FALSE; - LibImageHandle = ImageHandle; - - // - // Set up global pointer to the system table, boot services table, - // and runtime services table - // - - ST = SystemTable; - BS = SystemTable->BootServices; - RT = SystemTable->RuntimeServices; - // ASSERT (CheckCrc(0, &ST->Hdr)); - // ASSERT (CheckCrc(0, &BS->Hdr)); - // ASSERT (CheckCrc(0, &RT->Hdr)); - - // - // Initialize pool allocation type - // - - if (ImageHandle) { - Status = uefi_call_wrapper( - BS->HandleProtocol, - 3, - ImageHandle, - &LoadedImageProtocol, - (VOID*)&LoadedImage - ); - - if (!EFI_ERROR(Status)) { - PoolAllocationType = LoadedImage->ImageDataType; - } - EFIDebugVariable (); - } - - // - // Initialize Guid table - // - - InitializeGuid(); - - InitializeLibPlatform(ImageHandle,SystemTable); - - if (ImageHandle && UnicodeInterface == &LibStubUnicodeInterface) { - LangCode = LibGetVariable (VarLanguage, &EfiGlobalVariable); - InitializeUnicodeSupport (LangCode); - if (LangCode) { - FreePool (LangCode); - } - } -} - -VOID -InitializeUnicodeSupport ( - CHAR8 *LangCode - ) -{ - EFI_UNICODE_COLLATION_INTERFACE *Ui; - EFI_STATUS Status; - CHAR8 *Languages; - UINTN Index, Position, Length; - UINTN NoHandles; - EFI_HANDLE *Handles; - - // - // If we don't know it, lookup the current language code - // - - LibLocateHandle (ByProtocol, &UnicodeCollationProtocol, NULL, &NoHandles, &Handles); - if (!LangCode || !NoHandles) { - goto Done; - } - - // - // Check all driver's for a matching language code - // - - for (Index=0; Index < NoHandles; Index++) { - Status = uefi_call_wrapper(BS->HandleProtocol, 3, Handles[Index], &UnicodeCollationProtocol, (VOID*)&Ui); - if (EFI_ERROR(Status)) { - continue; - } - - // - // Check for a matching language code - // - - Languages = Ui->SupportedLanguages; - Length = strlena(Languages); - for (Position=0; Position < Length; Position += ISO_639_2_ENTRY_SIZE) { - - // - // If this code matches, use this driver - // - - if (CompareMem (Languages+Position, LangCode, ISO_639_2_ENTRY_SIZE) == 0) { - UnicodeInterface = Ui; - goto Done; - } - } - } - -Done: - // - // Cleanup - // - - if (Handles) { - FreePool (Handles); - } -} - -VOID -EFIDebugVariable ( - VOID - ) -{ - EFI_STATUS Status; - UINT32 Attributes; - UINTN DataSize; - UINTN NewEFIDebug; - - DataSize = sizeof(EFIDebug); - Status = uefi_call_wrapper(RT->GetVariable, 5, L"EFIDebug", &EfiGlobalVariable, &Attributes, &DataSize, &NewEFIDebug); - if (!EFI_ERROR(Status)) { - EFIDebug = NewEFIDebug; - } -} - -/* - * Calls to memset/memcpy may be emitted implicitly by GCC or MSVC - * even when -ffreestanding or /NODEFAULTLIB are in effect. - */ - -#ifndef __SIZE_TYPE__ -#define __SIZE_TYPE__ UINTN -#endif - -void *memset(void *s, int c, __SIZE_TYPE__ n) -{ - unsigned char *p = s; - - while (n--) - *p++ = c; - - return s; -} - -void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n) -{ - const unsigned char *q = src; - unsigned char *p = dest; - - while (n--) - *p++ = *q++; - - return dest; -} diff --git a/3rd/gnu-efi/lib/lock.c b/3rd/gnu-efi/lib/lock.c deleted file mode 100644 index a33bec34c..000000000 --- a/3rd/gnu-efi/lib/lock.c +++ /dev/null @@ -1,107 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - lock.c - -Abstract: - - Implements FLOCK - - - -Revision History - ---*/ - - -#include "lib.h" - - -VOID -InitializeLock ( - IN OUT FLOCK *Lock, - IN EFI_TPL Priority - ) -/*++ - -Routine Description: - - Initialize a basic mutual exclusion lock. Each lock - provides mutual exclusion access at it's task priority - level. Since there is no-premption (at any TPL) or - multiprocessor support, acquiring the lock only consists - of raising to the locks TPL. - - Note on a debug build the lock is acquired and released - to help ensure proper usage. - -Arguments: - - Lock - The FLOCK structure to initialize - - Priority - The task priority level of the lock - - -Returns: - - An initialized F Lock structure. - ---*/ -{ - Lock->Tpl = Priority; - Lock->OwnerTpl = 0; - Lock->Lock = 0; -} - - -VOID -AcquireLock ( - IN FLOCK *Lock - ) -/*++ - -Routine Description: - - Raising to the task priority level of the mutual exclusion - lock, and then acquires ownership of the lock. - -Arguments: - - Lock - The lock to acquire - -Returns: - - Lock owned - ---*/ -{ - RtAcquireLock (Lock); -} - - -VOID -ReleaseLock ( - IN FLOCK *Lock - ) -/*++ - -Routine Description: - - Releases ownership of the mutual exclusion lock, and - restores the previous task priority level. - -Arguments: - - Lock - The lock to release - -Returns: - - Lock unowned - ---*/ -{ - RtReleaseLock (Lock); -} diff --git a/3rd/gnu-efi/lib/loongarch64/efi_stub.S b/3rd/gnu-efi/lib/loongarch64/efi_stub.S deleted file mode 100644 index 464eae58a..000000000 --- a/3rd/gnu-efi/lib/loongarch64/efi_stub.S +++ /dev/null @@ -1 +0,0 @@ -/* This stub is a stub to make the build happy */ diff --git a/3rd/gnu-efi/lib/loongarch64/initplat.c b/3rd/gnu-efi/lib/loongarch64/initplat.c deleted file mode 100644 index 6c5e1fa52..000000000 --- a/3rd/gnu-efi/lib/loongarch64/initplat.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copright (C) 2014 Linaro Ltd. - * Author: Ard Biesheuvel - * - * 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. - */ - -#include "lib.h" - -VOID -InitializeLibPlatform ( - IN EFI_HANDLE ImageHandle EFI_UNUSED, - IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED - ) -{ -} diff --git a/3rd/gnu-efi/lib/loongarch64/math.c b/3rd/gnu-efi/lib/loongarch64/math.c deleted file mode 100644 index 8c1644466..000000000 --- a/3rd/gnu-efi/lib/loongarch64/math.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copright (C) 2014 Linaro Ltd. - * Author: Ard Biesheuvel - * - * 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. - */ - -#include "lib.h" - -UINT64 -LShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Left shift 64bit by 32bit and get a 64bit result -{ - return Operand << Count; -} - -UINT64 -RShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Right shift 64bit by 32bit and get a 64bit result -{ - return Operand >> Count; -} - - -UINT64 -MultU64x32 ( - IN UINT64 Multiplicand, - IN UINTN Multiplier - ) -// Multiple 64bit by 32bit and get a 64bit result -{ - return Multiplicand * Multiplier; -} - -UINT64 -DivU64x32 ( - IN UINT64 Dividend, - IN UINTN Divisor, - OUT UINTN *Remainder OPTIONAL - ) -// divide 64bit by 32bit and get a 64bit result -// N.B. only works for 31bit divisors!! -{ - if (Remainder) - *Remainder = Dividend % Divisor; - return Dividend / Divisor; -} diff --git a/3rd/gnu-efi/lib/loongarch64/setjmp.S b/3rd/gnu-efi/lib/loongarch64/setjmp.S deleted file mode 100644 index 6821af36c..000000000 --- a/3rd/gnu-efi/lib/loongarch64/setjmp.S +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. - * Copyright (c) 2021 Loongson Technology Corporation Limited.All rights - * reserved. - * Author: zhoumingtao - * - * This program and the accompanying materials are licensed and made - * available - * under the terms and conditions of the BSD License which accompanies - * this - * distribution. The full text of the license may be found at - * http://opensource.org/licenses/bsd-license.php. - * - * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" - * BASIS, - * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR - * IMPLIED. - */ - - .text - .p2align 3 - -/* - int setjmp(jmp_buf env); -*/ - .globl setjmp - .type setjmp, @function -setjmp: - st.d $ra, $a0, 0x0 - st.d $sp, $a0, 0x8 - st.d $fp, $a0, 0x10 - st.d $s0, $a0, 0x18 - st.d $s1, $a0, 0x20 - st.d $s2, $a0, 0x28 - st.d $s3, $a0, 0x30 - st.d $s4, $a0, 0x38 - st.d $s5, $a0, 0x40 - st.d $s6, $a0, 0x48 - st.d $s7, $a0, 0x50 - st.d $s8, $a0, 0x58 - - move $a0, $zero - jr $ra - -/* - void longjmp(jmp_buf env, int val); -*/ - .globl longjmp - .type longjmp, @function -longjmp: - ld.d $ra, $a0, 0x0 - ld.d $sp, $a0, 0x8 - ld.d $fp, $a0, 0x10 - ld.d $s0, $a0, 0x18 - ld.d $s1, $a0, 0x20 - ld.d $s2, $a0, 0x28 - ld.d $s3, $a0, 0x30 - ld.d $s4, $a0, 0x38 - ld.d $s5, $a0, 0x40 - ld.d $s6, $a0, 0x48 - ld.d $s7, $a0, 0x50 - ld.d $s8, $a0, 0x58 - - addi.d $a0, $zero, 1 # a0 = 1 - beqz $a1, .L0 # if (a1 == 0); goto L0 - move $a0, $a1 # a0 = a1 -.L0: - jr $ra diff --git a/3rd/gnu-efi/lib/mips64el/efi_stub.S b/3rd/gnu-efi/lib/mips64el/efi_stub.S deleted file mode 100644 index f84aaf293..000000000 --- a/3rd/gnu-efi/lib/mips64el/efi_stub.S +++ /dev/null @@ -1,5 +0,0 @@ -/* This stub is a stub to make the build happy */ - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/mips64el/initplat.c b/3rd/gnu-efi/lib/mips64el/initplat.c deleted file mode 100644 index 6c5e1fa52..000000000 --- a/3rd/gnu-efi/lib/mips64el/initplat.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copright (C) 2014 Linaro Ltd. - * Author: Ard Biesheuvel - * - * 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. - */ - -#include "lib.h" - -VOID -InitializeLibPlatform ( - IN EFI_HANDLE ImageHandle EFI_UNUSED, - IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED - ) -{ -} diff --git a/3rd/gnu-efi/lib/mips64el/math.c b/3rd/gnu-efi/lib/mips64el/math.c deleted file mode 100644 index 8c1644466..000000000 --- a/3rd/gnu-efi/lib/mips64el/math.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copright (C) 2014 Linaro Ltd. - * Author: Ard Biesheuvel - * - * 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. - */ - -#include "lib.h" - -UINT64 -LShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Left shift 64bit by 32bit and get a 64bit result -{ - return Operand << Count; -} - -UINT64 -RShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Right shift 64bit by 32bit and get a 64bit result -{ - return Operand >> Count; -} - - -UINT64 -MultU64x32 ( - IN UINT64 Multiplicand, - IN UINTN Multiplier - ) -// Multiple 64bit by 32bit and get a 64bit result -{ - return Multiplicand * Multiplier; -} - -UINT64 -DivU64x32 ( - IN UINT64 Dividend, - IN UINTN Divisor, - OUT UINTN *Remainder OPTIONAL - ) -// divide 64bit by 32bit and get a 64bit result -// N.B. only works for 31bit divisors!! -{ - if (Remainder) - *Remainder = Dividend % Divisor; - return Dividend / Divisor; -} diff --git a/3rd/gnu-efi/lib/mips64el/setjmp.S b/3rd/gnu-efi/lib/mips64el/setjmp.S deleted file mode 100644 index 2b60cdb6f..000000000 --- a/3rd/gnu-efi/lib/mips64el/setjmp.S +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. - * Copright (c) 2017 Lemote Co. - * Author: Heiher - * - * This program and the accompanying materials are licensed and made -available - * under the terms and conditions of the BSD License which accompanies -this - * distribution. The full text of the license may be found at - * http://opensource.org/licenses/bsd-license.php. - * - * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" -BASIS, - * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR - * IMPLIED. - */ - .text - .p2align 3 - - .globl setjmp - .type setjmp, @function -setjmp: - sd $ra, 0x00($a0) - sd $sp, 0x08($a0) - sd $fp, 0x10($a0) - sd $gp, 0x18($a0) - - sd $s0, 0x20($a0) - sd $s1, 0x28($a0) - sd $s2, 0x30($a0) - sd $s3, 0x38($a0) - sd $s4, 0x40($a0) - sd $s5, 0x48($a0) - sd $s6, 0x50($a0) - sd $s7, 0x58($a0) - -#ifdef __mips_hard_float - mfc0 $v0, $12 - ext $v0, $v0, 29, 1 - beqz $v0, 1f - - s.d $f24, 0x60($a0) - s.d $f25, 0x68($a0) - s.d $f26, 0x70($a0) - s.d $f27, 0x78($a0) - s.d $f28, 0x80($a0) - s.d $f29, 0x88($a0) - s.d $f30, 0x90($a0) - s.d $f31, 0x98($a0) - -1: -#endif - move $v0, $zero - jr $ra - - .globl longjmp - .type longjmp, @function -longjmp: - ld $ra, 0x00($a0) - ld $sp, 0x08($a0) - ld $fp, 0x10($a0) - ld $gp, 0x18($a0) - - ld $s0, 0x20($a0) - ld $s1, 0x28($a0) - ld $s2, 0x30($a0) - ld $s3, 0x38($a0) - ld $s4, 0x40($a0) - ld $s5, 0x48($a0) - ld $s6, 0x50($a0) - ld $s7, 0x58($a0) - -#ifdef __mips_hard_float - mfc0 $v0, $12 - ext $v0, $v0, 29, 1 - beqz $v0, 1f - - l.d $f24, 0x60($a0) - l.d $f25, 0x68($a0) - l.d $f26, 0x70($a0) - l.d $f27, 0x78($a0) - l.d $f28, 0x80($a0) - l.d $f29, 0x88($a0) - l.d $f30, 0x90($a0) - l.d $f31, 0x98($a0) - -1: -#endif - li $v0, 1 - movn $v0, $a1, $a1 - jr $ra - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/misc.c b/3rd/gnu-efi/lib/misc.c deleted file mode 100644 index 78d61fc25..000000000 --- a/3rd/gnu-efi/lib/misc.c +++ /dev/null @@ -1,563 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - misc.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" - - -// -// -// - -VOID * -AllocatePool ( - IN UINTN Size - ) -{ - EFI_STATUS Status; - VOID *p; - - Status = uefi_call_wrapper(BS->AllocatePool, 3, PoolAllocationType, Size, &p); - if (EFI_ERROR(Status)) { - DEBUG((D_ERROR, "AllocatePool: out of pool %x\n", Status)); - p = NULL; - } - return p; -} - -VOID * -AllocateZeroPool ( - IN UINTN Size - ) -{ - VOID *p; - - p = AllocatePool (Size); - if (p) { - ZeroMem (p, Size); - } - - return p; -} - -VOID * -ReallocatePool ( - IN VOID *OldPool, - IN UINTN OldSize, - IN UINTN NewSize - ) -{ - VOID *NewPool; - - NewPool = NULL; - if (NewSize) { - NewPool = AllocatePool (NewSize); - } - - if (OldPool) { - if (NewPool) { - CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize); - } - - FreePool (OldPool); - } - - return NewPool; -} - - -VOID -FreePool ( - IN VOID *Buffer - ) -{ - uefi_call_wrapper(BS->FreePool, 1, Buffer); -} - - - -VOID -ZeroMem ( - IN VOID *Buffer, - IN UINTN Size - ) -{ - RtZeroMem (Buffer, Size); -} - -VOID -SetMem ( - IN VOID *Buffer, - IN UINTN Size, - IN UINT8 Value - ) -{ - RtSetMem (Buffer, Size, Value); -} - -VOID -CopyMem ( - IN VOID *Dest, - IN CONST VOID *Src, - IN UINTN len - ) -{ - RtCopyMem (Dest, Src, len); -} - -INTN -CompareMem ( - IN CONST VOID *Dest, - IN CONST VOID *Src, - IN UINTN len - ) -{ - return RtCompareMem (Dest, Src, len); -} - -BOOLEAN -GrowBuffer( - IN OUT EFI_STATUS *Status, - IN OUT VOID **Buffer, - IN UINTN BufferSize - ) -/*++ - -Routine Description: - - Helper function called as part of the code needed - to allocate the proper sized buffer for various - EFI interfaces. - -Arguments: - - Status - Current status - - Buffer - Current allocated buffer, or NULL - - BufferSize - Current buffer size needed - -Returns: - - TRUE - if the buffer was reallocated and the caller - should try the API again. - ---*/ -{ - BOOLEAN TryAgain; - - // - // If this is an initial request, buffer will be null with a new buffer size - // - - if (!*Buffer && BufferSize) { - *Status = EFI_BUFFER_TOO_SMALL; - } - - // - // If the status code is "buffer too small", resize the buffer - // - - TryAgain = FALSE; - if (*Status == EFI_BUFFER_TOO_SMALL) { - - if (*Buffer) { - FreePool (*Buffer); - } - - *Buffer = AllocatePool (BufferSize); - - if (*Buffer) { - TryAgain = TRUE; - } else { - *Status = EFI_OUT_OF_RESOURCES; - } - } - - // - // If there's an error, free the buffer - // - - if (!TryAgain && EFI_ERROR(*Status) && *Buffer) { - FreePool (*Buffer); - *Buffer = NULL; - } - - return TryAgain; -} - - -EFI_MEMORY_DESCRIPTOR * -LibMemoryMap ( - OUT UINTN *NoEntries, - OUT UINTN *MapKey, - OUT UINTN *DescriptorSize, - OUT UINT32 *DescriptorVersion - ) -{ - EFI_STATUS Status; - EFI_MEMORY_DESCRIPTOR *Buffer; - UINTN BufferSize; - - // - // Initialize for GrowBuffer loop - // - - Status = EFI_SUCCESS; - Buffer = NULL; - BufferSize = sizeof(EFI_MEMORY_DESCRIPTOR); - - // - // Call the real function - // - - while (GrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) { - Status = uefi_call_wrapper(BS->GetMemoryMap, 5, &BufferSize, Buffer, MapKey, DescriptorSize, DescriptorVersion); - } - - // - // Convert buffer size to NoEntries - // - - if (!EFI_ERROR(Status)) { - *NoEntries = BufferSize / *DescriptorSize; - } - - return Buffer; -} - -VOID * -LibGetVariableAndSize ( - IN CHAR16 *Name, - IN EFI_GUID *VendorGuid, - OUT UINTN *VarSize - ) -{ - EFI_STATUS Status = EFI_SUCCESS; - VOID *Buffer; - UINTN BufferSize; - - // - // Initialize for GrowBuffer loop - // - - Buffer = NULL; - BufferSize = 100; - - // - // Call the real function - // - - while (GrowBuffer (&Status, &Buffer, BufferSize)) { - Status = uefi_call_wrapper( - RT->GetVariable, - 5, - Name, - VendorGuid, - NULL, - &BufferSize, - Buffer - ); - } - if (Buffer) { - *VarSize = BufferSize; - } else { - *VarSize = 0; - } - return Buffer; -} - -VOID * -LibGetVariable ( - IN CHAR16 *Name, - IN EFI_GUID *VendorGuid - ) -{ - UINTN VarSize; - - return LibGetVariableAndSize (Name, VendorGuid, &VarSize); -} - -EFI_STATUS -LibDeleteVariable ( - IN CHAR16 *VarName, - IN EFI_GUID *VarGuid - ) -{ - VOID *VarBuf; - EFI_STATUS Status; - - VarBuf = LibGetVariable(VarName,VarGuid); - - Status = EFI_NOT_FOUND; - - if (VarBuf) { - // - // Delete variable from Storage - // - Status = uefi_call_wrapper( - RT->SetVariable, - 5, - VarName, VarGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, - 0, NULL - ); - ASSERT (!EFI_ERROR(Status)); - FreePool(VarBuf); - } - - return (Status); -} - -EFI_STATUS -LibSetNVVariable ( - IN CHAR16 *VarName, - IN EFI_GUID *VarGuid, - IN UINTN DataSize, - IN VOID *Data - ) -{ - EFI_STATUS Status; - - Status = uefi_call_wrapper( - RT->SetVariable, - 5, - VarName, VarGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, - DataSize, Data - ); - ASSERT (!EFI_ERROR(Status)); - return (Status); -} - -EFI_STATUS -LibSetVariable ( - IN CHAR16 *VarName, - IN EFI_GUID *VarGuid, - IN UINTN DataSize, - IN VOID *Data - ) -{ - EFI_STATUS Status; - - Status = uefi_call_wrapper( - RT->SetVariable, - 5, - VarName, VarGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - DataSize, Data - ); - ASSERT (!EFI_ERROR(Status)); - return (Status); -} - -EFI_STATUS -LibInsertToTailOfBootOrder ( - IN UINT16 BootOption, - IN BOOLEAN OnlyInsertIfEmpty - ) -{ - UINT16 *BootOptionArray; - UINT16 *NewBootOptionArray; - UINTN VarSize; - UINTN Index; - EFI_STATUS Status; - - BootOptionArray = LibGetVariableAndSize (VarBootOrder, &EfiGlobalVariable, &VarSize); - if (VarSize != 0 && OnlyInsertIfEmpty) { - if (BootOptionArray) { - FreePool (BootOptionArray); - } - return EFI_UNSUPPORTED; - } - - VarSize += sizeof(UINT16); - NewBootOptionArray = AllocatePool (VarSize); - if (!NewBootOptionArray) - return EFI_OUT_OF_RESOURCES; - - for (Index = 0; Index < ((VarSize/sizeof(UINT16)) - 1); Index++) { - NewBootOptionArray[Index] = BootOptionArray[Index]; - } - // - // Insert in the tail of the array - // - NewBootOptionArray[Index] = BootOption; - - Status = uefi_call_wrapper( - RT->SetVariable, - 5, - VarBootOrder, &EfiGlobalVariable, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, - VarSize, (VOID*) NewBootOptionArray - ); - - FreePool (NewBootOptionArray); - if (BootOptionArray) { - FreePool (BootOptionArray); - } - return Status; -} - - -BOOLEAN -ValidMBR( - IN MASTER_BOOT_RECORD *Mbr, - IN EFI_BLOCK_IO *BlkIo - ) -{ - UINT32 StartingLBA, EndingLBA; - UINT32 NewEndingLBA; - INTN i, j; - BOOLEAN ValidMbr; - - if (Mbr->Signature != MBR_SIGNATURE) { - // - // The BPB also has this signature, so it can not be used alone. - // - return FALSE; - } - - ValidMbr = FALSE; - for (i=0; iPartition[i].OSIndicator == 0x00 || EXTRACT_UINT32(Mbr->Partition[i].SizeInLBA) == 0 ) { - continue; - } - ValidMbr = TRUE; - StartingLBA = EXTRACT_UINT32(Mbr->Partition[i].StartingLBA); - EndingLBA = StartingLBA + EXTRACT_UINT32(Mbr->Partition[i].SizeInLBA) - 1; - if (EndingLBA > BlkIo->Media->LastBlock) { - // - // Compatability Errata: - // Some systems try to hide drive space with thier INT 13h driver - // This does not hide space from the OS driver. This means the MBR - // that gets created from DOS is smaller than the MBR created from - // a real OS (NT & Win98). This leads to BlkIo->LastBlock being - // wrong on some systems FDISKed by the OS. - // - // - if (BlkIo->Media->LastBlock < MIN_MBR_DEVICE_SIZE) { - // - // If this is a very small device then trust the BlkIo->LastBlock - // - return FALSE; - } - - if (EndingLBA > (BlkIo->Media->LastBlock + MBR_ERRATA_PAD)) { - return FALSE; - } - - } - for (j=i+1; jPartition[j].OSIndicator == 0x00 || EXTRACT_UINT32(Mbr->Partition[j].SizeInLBA) == 0) { - continue; - } - if ( EXTRACT_UINT32(Mbr->Partition[j].StartingLBA) >= StartingLBA && - EXTRACT_UINT32(Mbr->Partition[j].StartingLBA) <= EndingLBA ) { - // - // The Start of this region overlaps with the i'th region - // - return FALSE; - } - NewEndingLBA = EXTRACT_UINT32(Mbr->Partition[j].StartingLBA) + EXTRACT_UINT32(Mbr->Partition[j].SizeInLBA) - 1; - if ( NewEndingLBA >= StartingLBA && NewEndingLBA <= EndingLBA ) { - // - // The End of this region overlaps with the i'th region - // - return FALSE; - } - } - } - // - // Non of the regions overlapped so MBR is O.K. - // - return ValidMbr; -} - - -UINT8 -DecimaltoBCD( - IN UINT8 DecValue - ) -{ - return RtDecimaltoBCD (DecValue); -} - - -UINT8 -BCDtoDecimal( - IN UINT8 BcdValue - ) -{ - return RtBCDtoDecimal (BcdValue); -} - -EFI_STATUS -LibGetSystemConfigurationTable( - IN EFI_GUID *TableGuid, - IN OUT VOID **Table - ) - -{ - UINTN Index; - - for(Index=0;IndexNumberOfTableEntries;Index++) { - if (CompareGuid(TableGuid,&(ST->ConfigurationTable[Index].VendorGuid))==0) { - *Table = ST->ConfigurationTable[Index].VendorTable; - return EFI_SUCCESS; - } - } - return EFI_NOT_FOUND; -} - - -CHAR16 * -LibGetUiString ( - IN EFI_HANDLE Handle, - IN UI_STRING_TYPE StringType, - IN ISO_639_2 *LangCode, - IN BOOLEAN ReturnDevicePathStrOnMismatch - ) -{ - UI_INTERFACE *Ui; - UI_STRING_TYPE Index; - UI_STRING_ENTRY *Array; - EFI_STATUS Status; - - Status = uefi_call_wrapper(BS->HandleProtocol, 3, Handle, &UiProtocol, (VOID *)&Ui); - if (EFI_ERROR(Status)) { - return (ReturnDevicePathStrOnMismatch) ? DevicePathToStr(DevicePathFromHandle(Handle)) : NULL; - } - - // - // Skip the first strings - // - for (Index = UiDeviceString, Array = Ui->Entry; Index < StringType; Index++, Array++) { - while (Array->LangCode) { - Array++; - } - } - - // - // Search for the match - // - while (Array->LangCode) { - if (strcmpa (Array->LangCode, LangCode) == 0) { - return Array->UiString; - } - } - return (ReturnDevicePathStrOnMismatch) ? DevicePathToStr(DevicePathFromHandle(Handle)) : NULL; -} diff --git a/3rd/gnu-efi/lib/pause.c b/3rd/gnu-efi/lib/pause.c deleted file mode 100644 index ecab63dc4..000000000 --- a/3rd/gnu-efi/lib/pause.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "lib.h" - -VOID -Pause( - VOID -) -// Pause until any key is pressed -{ - EFI_INPUT_KEY Key; - EFI_STATUS Status EFI_UNUSED; - - WaitForSingleEvent(ST->ConIn->WaitForKey, 0); - Status = uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, &Key); - ASSERT(!EFI_ERROR(Status)); -} diff --git a/3rd/gnu-efi/lib/print.c b/3rd/gnu-efi/lib/print.c deleted file mode 100644 index a43dc8ce2..000000000 --- a/3rd/gnu-efi/lib/print.c +++ /dev/null @@ -1,1552 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - print.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" -#include "efistdarg.h" // !!! - -// -// Declare runtime functions -// - -#ifdef RUNTIME_CODE -#ifndef __GNUC__ -#pragma RUNTIME_CODE(DbgPrint) - -// For debugging.. - -/* -#pragma RUNTIME_CODE(_Print) -#pragma RUNTIME_CODE(PFLUSH) -#pragma RUNTIME_CODE(PSETATTR) -#pragma RUNTIME_CODE(PPUTC) -#pragma RUNTIME_CODE(PGETC) -#pragma RUNTIME_CODE(PITEM) -#pragma RUNTIME_CODE(ValueToHex) -#pragma RUNTIME_CODE(ValueToString) -#pragma RUNTIME_CODE(TimeToString) -*/ - -#endif /* !defined(__GNUC__) */ -#endif - -// -// -// - - -#define PRINT_STRING_LEN 200 -#define PRINT_ITEM_BUFFER_LEN 100 - -typedef struct { - BOOLEAN Ascii; - UINTN Index; - union { - CONST CHAR16 *pw; - CONST CHAR8 *pc; - } un; -} POINTER; - -#define pw un.pw -#define pc un.pc - -typedef struct _pitem { - - POINTER Item; - CHAR16 Scratch[PRINT_ITEM_BUFFER_LEN]; - UINTN Width; - UINTN FieldWidth; - UINTN *WidthParse; - CHAR16 Pad; - BOOLEAN PadBefore; - BOOLEAN Comma; - BOOLEAN Long; -} PRINT_ITEM; - - -typedef struct _pstate { - // Input - POINTER fmt; - va_list args; - - // Output - CHAR16 *Buffer; - CHAR16 *End; - CHAR16 *Pos; - UINTN Len; - - UINTN Attr; - UINTN RestoreAttr; - - UINTN AttrNorm; - UINTN AttrHighlight; - UINTN AttrError; - - INTN (EFIAPI *Output)(VOID *context, CHAR16 *str); - INTN (EFIAPI *SetAttr)(VOID *context, UINTN attr); - VOID *Context; - - // Current item being formatted - struct _pitem *Item; -} PRINT_STATE; - -// -// Internal fucntions -// - -STATIC -UINTN -_Print ( - IN PRINT_STATE *ps - ); - -STATIC -UINTN -_IPrint ( - IN UINTN Column, - IN UINTN Row, - IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out, - IN CONST CHAR16 *fmt, - IN CONST CHAR8 *fmta, - IN va_list args - ); - -STATIC -INTN EFIAPI -_DbgOut ( - IN VOID *Context, - IN CHAR16 *Buffer - ); - -STATIC -VOID -PFLUSH ( - IN OUT PRINT_STATE *ps - ); - -STATIC -VOID -PPUTC ( - IN OUT PRINT_STATE *ps, - IN CHAR16 c - ); - -STATIC -VOID -PITEM ( - IN OUT PRINT_STATE *ps - ); - -STATIC -CHAR16 -PGETC ( - IN POINTER *p - ); - -STATIC -VOID -PSETATTR ( - IN OUT PRINT_STATE *ps, - IN UINTN Attr - ); - -// -// -// - -INTN EFIAPI -_SPrint ( - IN VOID *Context, - IN CHAR16 *Buffer - ); - -INTN EFIAPI -_PoolPrint ( - IN VOID *Context, - IN CHAR16 *Buffer - ); - -INTN -DbgPrint ( - IN INTN mask, - IN CONST CHAR8 *fmt, - ... - ) -/*++ - -Routine Description: - - Prints a formatted unicode string to the default StandardError console - -Arguments: - - mask - Bit mask of debug string. If a bit is set in the - mask that is also set in EFIDebug the string is - printed; otherwise, the string is not printed - - fmt - Format string - -Returns: - - Length of string printed to the StandardError console - ---*/ -{ - SIMPLE_TEXT_OUTPUT_INTERFACE *DbgOut; - PRINT_STATE ps; - va_list args; - UINTN back; - UINTN attr; - UINTN SavedAttribute; - - - if (!(EFIDebug & mask)) { - return 0; - } - - va_start (args, fmt); - ZeroMem (&ps, sizeof(ps)); - - ps.Output = _DbgOut; - ps.fmt.Ascii = TRUE; - ps.fmt.pc = fmt; - va_copy(ps.args, args); - ps.Attr = EFI_TEXT_ATTR(EFI_LIGHTGRAY, EFI_RED); - - DbgOut = LibRuntimeDebugOut; - - if (!DbgOut) { - DbgOut = ST->StdErr; - } - - if (DbgOut) { - ps.Attr = DbgOut->Mode->Attribute; - ps.Context = DbgOut; - ps.SetAttr = (INTN (EFIAPI *)(VOID *, UINTN)) DbgOut->SetAttribute; - } - - SavedAttribute = ps.Attr; - - back = (ps.Attr >> 4) & 0xf; - ps.AttrNorm = EFI_TEXT_ATTR(EFI_LIGHTGRAY, back); - ps.AttrHighlight = EFI_TEXT_ATTR(EFI_WHITE, back); - ps.AttrError = EFI_TEXT_ATTR(EFI_YELLOW, back); - - attr = ps.AttrNorm; - - if (mask & D_WARN) { - attr = ps.AttrHighlight; - } - - if (mask & D_ERROR) { - attr = ps.AttrError; - } - - if (ps.SetAttr) { - ps.Attr = attr; - uefi_call_wrapper(ps.SetAttr, 2, ps.Context, attr); - } - - _Print (&ps); - - va_end (ps.args); - va_end (args); - - // - // Restore original attributes - // - - if (ps.SetAttr) { - uefi_call_wrapper(ps.SetAttr, 2, ps.Context, SavedAttribute); - } - - return 0; -} - -STATIC -INTN -IsLocalPrint(void *func) -{ - if (func == _DbgOut || func == _SPrint || func == _PoolPrint) - return 1; - return 0; -} - -STATIC -INTN EFIAPI -_DbgOut ( - IN VOID *Context, - IN CHAR16 *Buffer - ) -// Append string worker for DbgPrint -{ - SIMPLE_TEXT_OUTPUT_INTERFACE *DbgOut; - - DbgOut = Context; -// if (!DbgOut && ST && ST->ConOut) { -// DbgOut = ST->ConOut; -// } - - if (DbgOut) { - if (IsLocalPrint(DbgOut->OutputString)) - DbgOut->OutputString(DbgOut, Buffer); - else - uefi_call_wrapper(DbgOut->OutputString, 2, DbgOut, Buffer); - } - - return 0; -} - -INTN EFIAPI -_SPrint ( - IN VOID *Context, - IN CHAR16 *Buffer - ) -// Append string worker for UnicodeSPrint, PoolPrint and CatPrint -{ - UINTN len; - POOL_PRINT *spc; - - spc = Context; - len = StrLen(Buffer); - - // - // Is the string is over the max truncate it - // - - if (spc->len + len > spc->maxlen) { - len = spc->maxlen - spc->len; - } - - // - // Append the new text - // - - CopyMem (spc->str + spc->len, Buffer, len * sizeof(CHAR16)); - spc->len += len; - - // - // Null terminate it - // - - if (spc->len < spc->maxlen) { - spc->str[spc->len] = 0; - } else if (spc->maxlen) { - spc->str[spc->maxlen] = 0; - } - - return 0; -} - - -INTN EFIAPI -_PoolPrint ( - IN VOID *Context, - IN CHAR16 *Buffer - ) -// Append string worker for PoolPrint and CatPrint -{ - UINTN newlen; - POOL_PRINT *spc; - - spc = Context; - newlen = spc->len + StrLen(Buffer) + 1; - - // - // Is the string is over the max, grow the buffer - // - - if (newlen > spc->maxlen) { - - // - // Grow the pool buffer - // - - newlen += PRINT_STRING_LEN; - spc->maxlen = newlen; - spc->str = ReallocatePool ( - spc->str, - spc->len * sizeof(CHAR16), - spc->maxlen * sizeof(CHAR16) - ); - - if (!spc->str) { - spc->len = 0; - spc->maxlen = 0; - } - } - - // - // Append the new text - // - - return _SPrint (Context, Buffer); -} - - - -VOID -_PoolCatPrint ( - IN CONST CHAR16 *fmt, - IN va_list args, - IN OUT POOL_PRINT *spc, - IN INTN (EFIAPI *Output)(VOID *context, CHAR16 *str) - ) -// Dispatch function for UnicodeSPrint, PoolPrint, and CatPrint -{ - PRINT_STATE ps; - - ZeroMem (&ps, sizeof(ps)); - ps.Output = Output; - ps.Context = spc; - ps.fmt.pw = fmt; - va_copy(ps.args, args); - _Print (&ps); - va_end(ps.args); -} - - - -UINTN -UnicodeVSPrint ( - OUT CHAR16 *Str, - IN UINTN StrSize, - IN CONST CHAR16 *fmt, - va_list args - ) -/*++ - -Routine Description: - - Prints a formatted unicode string to a buffer using a va_list - -Arguments: - - Str - Output buffer to print the formatted string into - - StrSize - Size of Str. String is truncated to this size. - A size of 0 means there is no limit - - fmt - The format string - - args - va_list - - -Returns: - - String length returned in buffer - ---*/ -{ - POOL_PRINT spc; - - spc.str = Str; - spc.maxlen = StrSize / sizeof(CHAR16) - 1; - spc.len = 0; - - _PoolCatPrint (fmt, args, &spc, _SPrint); - - return spc.len; -} - -UINTN -UnicodeSPrint ( - OUT CHAR16 *Str, - IN UINTN StrSize, - IN CONST CHAR16 *fmt, - ... - ) -/*++ - -Routine Description: - - Prints a formatted unicode string to a buffer - -Arguments: - - Str - Output buffer to print the formatted string into - - StrSize - Size of Str. String is truncated to this size. - A size of 0 means there is no limit - - fmt - The format string - -Returns: - - String length returned in buffer - ---*/ -{ - va_list args; - UINTN len; - - va_start (args, fmt); - len = UnicodeVSPrint(Str, StrSize, fmt, args); - va_end (args); - - return len; -} - -CHAR16 * -VPoolPrint ( - IN CONST CHAR16 *fmt, - va_list args - ) -/*++ - -Routine Description: - - Prints a formatted unicode string to allocated pool using va_list argument. - The caller must free the resulting buffer. - -Arguments: - - fmt - The format string - args - The arguments in va_list form - -Returns: - - Allocated buffer with the formatted string printed in it. - The caller must free the allocated buffer. The buffer - allocation is not packed. - ---*/ -{ - POOL_PRINT spc; - ZeroMem (&spc, sizeof(spc)); - _PoolCatPrint (fmt, args, &spc, _PoolPrint); - return spc.str; -} - -CHAR16 * -PoolPrint ( - IN CONST CHAR16 *fmt, - ... - ) -/*++ - -Routine Description: - - Prints a formatted unicode string to allocated pool. The caller - must free the resulting buffer. - -Arguments: - - fmt - The format string - -Returns: - - Allocated buffer with the formatted string printed in it. - The caller must free the allocated buffer. The buffer - allocation is not packed. - ---*/ -{ - va_list args; - CHAR16 *pool; - va_start (args, fmt); - pool = VPoolPrint(fmt, args); - va_end (args); - return pool; -} - -CHAR16 * -CatPrint ( - IN OUT POOL_PRINT *Str, - IN CONST CHAR16 *fmt, - ... - ) -/*++ - -Routine Description: - - Concatenates a formatted unicode string to allocated pool. - The caller must free the resulting buffer. - -Arguments: - - Str - Tracks the allocated pool, size in use, and - amount of pool allocated. - - fmt - The format string - -Returns: - - Allocated buffer with the formatted string printed in it. - The caller must free the allocated buffer. The buffer - allocation is not packed. - ---*/ -{ - va_list args; - - va_start (args, fmt); - _PoolCatPrint (fmt, args, Str, _PoolPrint); - va_end (args); - return Str->str; -} - - - -UINTN -Print ( - IN CONST CHAR16 *fmt, - ... - ) -/*++ - -Routine Description: - - Prints a formatted unicode string to the default console - -Arguments: - - fmt - Format string - -Returns: - - Length of string printed to the console - ---*/ -{ - va_list args; - UINTN back; - - va_start (args, fmt); - back = _IPrint ((UINTN) -1, (UINTN) -1, ST->ConOut, fmt, NULL, args); - va_end (args); - return back; -} - -UINTN -VPrint ( - IN CONST CHAR16 *fmt, - va_list args - ) -/*++ - -Routine Description: - - Prints a formatted unicode string to the default console using a va_list - -Arguments: - - fmt - Format string - args - va_list -Returns: - - Length of string printed to the console - ---*/ -{ - return _IPrint ((UINTN) -1, (UINTN) -1, ST->ConOut, fmt, NULL, args); -} - - -UINTN -PrintAt ( - IN UINTN Column, - IN UINTN Row, - IN CONST CHAR16 *fmt, - ... - ) -/*++ - -Routine Description: - - Prints a formatted unicode string to the default console, at - the supplied cursor position - -Arguments: - - Column, Row - The cursor position to print the string at - - fmt - Format string - -Returns: - - Length of string printed to the console - ---*/ -{ - va_list args; - UINTN back; - - va_start (args, fmt); - back = _IPrint (Column, Row, ST->ConOut, fmt, NULL, args); - va_end (args); - return back; -} - - -UINTN -IPrint ( - IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out, - IN CONST CHAR16 *fmt, - ... - ) -/*++ - -Routine Description: - - Prints a formatted unicode string to the specified console - -Arguments: - - Out - The console to print the string too - - fmt - Format string - -Returns: - - Length of string printed to the console - ---*/ -{ - va_list args; - UINTN back; - - va_start (args, fmt); - back = _IPrint ((UINTN) -1, (UINTN) -1, Out, fmt, NULL, args); - va_end (args); - return back; -} - - -UINTN -IPrintAt ( - IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out, - IN UINTN Column, - IN UINTN Row, - IN CONST CHAR16 *fmt, - ... - ) -/*++ - -Routine Description: - - Prints a formatted unicode string to the specified console, at - the supplied cursor position - -Arguments: - - Out - The console to print the string to - - Column, Row - The cursor position to print the string at - - fmt - Format string - -Returns: - - Length of string printed to the console - ---*/ -{ - va_list args; - UINTN back; - - va_start (args, fmt); - back = _IPrint (Column, Row, Out, fmt, NULL, args); - va_end (args); - return back; -} - - -UINTN -_IPrint ( - IN UINTN Column, - IN UINTN Row, - IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out, - IN CONST CHAR16 *fmt, - IN CONST CHAR8 *fmta, - IN va_list args - ) -// Display string worker for: Print, PrintAt, IPrint, IPrintAt -{ - PRINT_STATE ps; - UINTN back; - - ZeroMem (&ps, sizeof(ps)); - ps.Context = Out; - ps.Output = (INTN (EFIAPI *)(VOID *, CHAR16 *)) Out->OutputString; - ps.SetAttr = (INTN (EFIAPI *)(VOID *, UINTN)) Out->SetAttribute; - ps.Attr = Out->Mode->Attribute; - - back = (ps.Attr >> 4) & 0xF; - ps.AttrNorm = EFI_TEXT_ATTR(EFI_LIGHTGRAY, back); - ps.AttrHighlight = EFI_TEXT_ATTR(EFI_WHITE, back); - ps.AttrError = EFI_TEXT_ATTR(EFI_YELLOW, back); - - if (fmt) { - ps.fmt.pw = fmt; - } else { - ps.fmt.Ascii = TRUE; - ps.fmt.pc = fmta; - } - - va_copy(ps.args, args); - - if (Column != (UINTN) -1) { - uefi_call_wrapper(Out->SetCursorPosition, 3, Out, Column, Row); - } - - back = _Print (&ps); - va_end(ps.args); - return back; -} - - -UINTN -AsciiPrint ( - IN CONST CHAR8 *fmt, - ... - ) -/*++ - -Routine Description: - - For those whom really can't deal with unicode, a print - function that takes an ascii format string - -Arguments: - - fmt - ascii format string - -Returns: - - Length of string printed to the console - ---*/ - -{ - va_list args; - UINTN back; - - va_start (args, fmt); - back = _IPrint ((UINTN) -1, (UINTN) -1, ST->ConOut, NULL, fmt, args); - va_end (args); - return back; -} - - -UINTN -AsciiVSPrint ( - OUT CHAR8 *Str, - IN UINTN StrSize, - IN CONST CHAR8 *fmt, - va_list args -) -/*++ - -Routine Description: - - Prints a formatted ascii string to a buffer using a va_list - -Arguments: - - Str - Output buffer to print the formatted string into - - StrSize - Size of Str. String is truncated to this size. - A size of 0 means there is no limit - - fmt - The format string - - args - va_list - - -Returns: - - String length returned in buffer - ---*/ -// Use UnicodeVSPrint() and convert back to ASCII -{ - CHAR16 *UnicodeStr, *UnicodeFmt; - UINTN i, Len; - - UnicodeStr = AllocatePool(StrSize * sizeof(CHAR16)); - if (!UnicodeStr) - return 0; - - UnicodeFmt = PoolPrint(L"%a", fmt); - if (!UnicodeFmt) { - FreePool(UnicodeStr); - return 0; - } - - Len = UnicodeVSPrint(UnicodeStr, StrSize, UnicodeFmt, args); - FreePool(UnicodeFmt); - - // The strings are ASCII so just do a plain Unicode conversion - for (i = 0; i < Len; i++) - Str[i] = (CHAR8)UnicodeStr[i]; - Str[Len] = 0; - FreePool(UnicodeStr); - - return Len; -} - - -STATIC -VOID -PFLUSH ( - IN OUT PRINT_STATE *ps - ) -{ - *ps->Pos = 0; - if (IsLocalPrint(ps->Output)) - ps->Output(ps->Context, ps->Buffer); - else - uefi_call_wrapper(ps->Output, 2, ps->Context, ps->Buffer); - ps->Pos = ps->Buffer; -} - -STATIC -VOID -PSETATTR ( - IN OUT PRINT_STATE *ps, - IN UINTN Attr - ) -{ - PFLUSH (ps); - - ps->RestoreAttr = ps->Attr; - if (ps->SetAttr) { - uefi_call_wrapper(ps->SetAttr, 2, ps->Context, Attr); - } - - ps->Attr = Attr; -} - -STATIC -VOID -PPUTC ( - IN OUT PRINT_STATE *ps, - IN CHAR16 c - ) -{ - // if this is a newline, add a carraige return - if (c == '\n') { - PPUTC (ps, '\r'); - } - - *ps->Pos = c; - ps->Pos += 1; - ps->Len += 1; - - // if at the end of the buffer, flush it - if (ps->Pos >= ps->End) { - PFLUSH(ps); - } -} - - -STATIC -CHAR16 -PGETC ( - IN POINTER *p - ) -{ - CHAR16 c; - - c = p->Ascii ? p->pc[p->Index] : p->pw[p->Index]; - p->Index += 1; - - return c; -} - - -STATIC -VOID -PITEM ( - IN OUT PRINT_STATE *ps - ) -{ - UINTN Len, i; - PRINT_ITEM *Item; - CHAR16 c; - - // Get the length of the item - Item = ps->Item; - Item->Item.Index = 0; - while (Item->Item.Index < Item->FieldWidth) { - c = PGETC(&Item->Item); - if (!c) { - Item->Item.Index -= 1; - break; - } - } - Len = Item->Item.Index; - - // if there is no item field width, use the items width - if (Item->FieldWidth == (UINTN) -1) { - Item->FieldWidth = Len; - } - - // if item is larger then width, update width - if (Len > Item->Width) { - Item->Width = Len; - } - - - // if pad field before, add pad char - if (Item->PadBefore) { - for (i=Item->Width; i < Item->FieldWidth; i+=1) { - PPUTC (ps, ' '); - } - } - - // pad item - for (i=Len; i < Item->Width; i++) { - PPUTC (ps, Item->Pad); - } - - // add the item - Item->Item.Index=0; - while (Item->Item.Index < Len) { - PPUTC (ps, PGETC(&Item->Item)); - } - - // If pad at the end, add pad char - if (!Item->PadBefore) { - for (i=Item->Width; i < Item->FieldWidth; i+=1) { - PPUTC (ps, ' '); - } - } -} - - -STATIC -UINTN -_Print ( - IN PRINT_STATE *ps - ) -/*++ - -Routine Description: - - %w.lF - w = width - l = field width - F = format of arg - - Args F: - 0 - pad with zeros - - - justify on left (default is on right) - , - add comma's to field - * - width provided on stack - n - Set output attribute to normal (for this field only) - h - Set output attribute to highlight (for this field only) - e - Set output attribute to error (for this field only) - l - Value is 64 bits - - a - ascii string - s - unicode string - X - fixed 8 byte value in hex - x - hex value - d - value as signed decimal - u - value as unsigned decimal - f - value as floating point - c - Unicode char - t - EFI time structure - g - Pointer to GUID - r - EFI status code (result code) - D - pointer to Device Path with normal ending. - - N - Set output attribute to normal - H - Set output attribute to highlight - E - Set output attribute to error - % - Print a % - -Arguments: - - SystemTable - The system table - -Returns: - - Number of charactors written - ---*/ -{ - CHAR16 c; - UINTN Attr; - PRINT_ITEM Item; - CHAR16 Buffer[PRINT_STRING_LEN]; - - ps->Len = 0; - ps->Buffer = Buffer; - ps->Pos = Buffer; - ps->End = Buffer + PRINT_STRING_LEN - 1; - ps->Item = &Item; - - ps->fmt.Index = 0; - while ((c = PGETC(&ps->fmt))) { - - if (c != '%') { - PPUTC ( ps, c ); - continue; - } - - // setup for new item - Item.FieldWidth = (UINTN) -1; - Item.Width = 0; - Item.WidthParse = &Item.Width; - Item.Pad = ' '; - Item.PadBefore = TRUE; - Item.Comma = FALSE; - Item.Long = FALSE; - Item.Item.Ascii = FALSE; - Item.Item.pw = NULL; - ps->RestoreAttr = 0; - Attr = 0; - - while ((c = PGETC(&ps->fmt))) { - - switch (c) { - - case '%': - // - // %% -> % - // - Item.Scratch[0] = '%'; - Item.Scratch[1] = 0; - Item.Item.pw = Item.Scratch; - break; - - case ',': - Item.Comma = TRUE; - break; - - case '-': - Item.PadBefore = FALSE; - break; - - case '*': - *Item.WidthParse = va_arg(ps->args, UINTN); - break; - - case '.': - Item.WidthParse = &Item.FieldWidth; - break; - - case '0': - Item.Pad = '0'; - break; - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - *Item.WidthParse = 0; - do { - *Item.WidthParse = *Item.WidthParse * 10 + c - '0'; - c = PGETC(&ps->fmt); - } while (c >= '0' && c <= '9') ; - ps->fmt.Index -= 1; - break; - - case 'a': - Item.Item.pc = va_arg(ps->args, CHAR8 *); - Item.Item.Ascii = TRUE; - if (!Item.Item.pc) { - Item.Item.pc = (CHAR8 *)"(null)"; - } - break; - - case 'c': - Item.Scratch[0] = (CHAR16) va_arg(ps->args, UINTN); - Item.Scratch[1] = 0; - Item.Item.pw = Item.Scratch; - break; - - case 'D': - { - EFI_DEVICE_PATH *dp = va_arg(ps->args, EFI_DEVICE_PATH *); - CHAR16 *dpstr = DevicePathToStr(dp); - StrnCpy(Item.Scratch, dpstr, PRINT_ITEM_BUFFER_LEN); - Item.Scratch[PRINT_ITEM_BUFFER_LEN-1] = L'\0'; - FreePool(dpstr); - - Item.Item.pw = Item.Scratch; - break; - } - - case 'd': - ValueToString ( - Item.Scratch, - Item.Comma, - Item.Long ? va_arg(ps->args, INT64) : va_arg(ps->args, INT32) - ); - Item.Item.pw = Item.Scratch; - break; - - case 'E': - Attr = ps->AttrError; - break; - - case 'e': - PSETATTR(ps, ps->AttrError); - break; - - case 'f': - FloatToString ( - Item.Scratch, - Item.Comma, - va_arg(ps->args, double) - ); - Item.Item.pw = Item.Scratch; - break; - - case 'g': - GuidToString (Item.Scratch, va_arg(ps->args, EFI_GUID *)); - Item.Item.pw = Item.Scratch; - break; - - case 'H': - Attr = ps->AttrHighlight; - break; - - case 'h': - PSETATTR(ps, ps->AttrHighlight); - break; - - case 'l': - Item.Long = TRUE; - break; - - case 'N': - Attr = ps->AttrNorm; - break; - - case 'n': - PSETATTR(ps, ps->AttrNorm); - break; - - case 'p': - Item.Width = sizeof(void *) == (8 ? 16 : 8) + 2; - Item.Pad = '0'; - Item.Scratch[0] = ' '; - Item.Scratch[1] = ' '; - ValueToHex ( - Item.Scratch+2, - Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32) - ); - Item.Scratch[0] = '0'; - Item.Scratch[1] = 'x'; - Item.Item.pw = Item.Scratch; - break; - - case 'r': - StatusToString (Item.Scratch, va_arg(ps->args, EFI_STATUS)); - Item.Item.pw = Item.Scratch; - break; - - case 's': - Item.Item.pw = va_arg(ps->args, CHAR16 *); - if (!Item.Item.pw) { - Item.Item.pw = L"(null)"; - } - break; - - case 't': - TimeToString (Item.Scratch, va_arg(ps->args, EFI_TIME *)); - Item.Item.pw = Item.Scratch; - break; - - case 'u': - ValueToString ( - Item.Scratch, - Item.Comma, - Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32) - ); - Item.Item.pw = Item.Scratch; - break; - - case 'X': - Item.Width = Item.Long ? 16 : 8; - Item.Pad = '0'; -#if __GNUC__ >= 7 - __attribute__ ((fallthrough)); -#endif - case 'x': - ValueToHex ( - Item.Scratch, - Item.Long ? va_arg(ps->args, UINT64) : va_arg(ps->args, UINT32) - ); - Item.Item.pw = Item.Scratch; - break; - - default: - Item.Scratch[0] = '?'; - Item.Scratch[1] = 0; - Item.Item.pw = Item.Scratch; - break; - } - - // if we have an Item - if (Item.Item.pw) { - PITEM (ps); - break; - } - - // if we have an Attr set - if (Attr) { - PSETATTR(ps, Attr); - ps->RestoreAttr = 0; - break; - } - } - - if (ps->RestoreAttr) { - PSETATTR(ps, ps->RestoreAttr); - } - } - - // Flush buffer - PFLUSH (ps); - return ps->Len; -} - -STATIC CHAR8 Hex[] = {'0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F'}; - -VOID -ValueToHex ( - IN CHAR16 *Buffer, - IN UINT64 v - ) -{ - CHAR8 str[30], *p1; - CHAR16 *p2; - - if (!v) { - Buffer[0] = '0'; - Buffer[1] = 0; - return ; - } - - p1 = str; - p2 = Buffer; - - while (v) { - // Without the cast, the MSVC compiler may insert a reference to __allmull - *(p1++) = Hex[(UINTN)(v & 0xf)]; - v = RShiftU64 (v, 4); - } - - while (p1 != str) { - *(p2++) = *(--p1); - } - *p2 = 0; -} - - -VOID -ValueToString ( - IN CHAR16 *Buffer, - IN BOOLEAN Comma, - IN INT64 v - ) -{ - STATIC CHAR8 ca[] = { 3, 1, 2 }; - CHAR8 str[40], *p1; - CHAR16 *p2; - UINTN c, r; - - if (!v) { - Buffer[0] = '0'; - Buffer[1] = 0; - return ; - } - - p1 = str; - p2 = Buffer; - - if (v < 0) { - *(p2++) = '-'; - v = -v; - } - - while (v) { - v = (INT64)DivU64x32 ((UINT64)v, 10, &r); - *(p1++) = (CHAR8)r + '0'; - } - - c = (UINTN) (Comma ? ca[(p1 - str) % 3] : 999) + 1; - while (p1 != str) { - - c -= 1; - if (!c) { - *(p2++) = ','; - c = 3; - } - - *(p2++) = *(--p1); - } - *p2 = 0; -} - -VOID -FloatToString ( - IN CHAR16 *Buffer, - IN BOOLEAN Comma, - IN double v - ) -{ - /* - * Integer part. - */ - INTN i = (INTN)v; - ValueToString(Buffer, Comma, i); - - - /* - * Decimal point. - */ - UINTN x = StrLen(Buffer); - Buffer[x] = L'.'; - x++; - - - /* - * Keep fractional part. - */ - float f = (float)(v - i); - if (f < 0) f = -f; - - - /* - * Leading fractional zeroes. - */ - f *= 10.0; - while ( (f != 0) - && ((INTN)f == 0)) - { - Buffer[x] = L'0'; - x++; - f *= 10.0; - } - - - /* - * Fractional digits. - */ - while ((float)(INTN)f != f) - { - f *= 10; - } - ValueToString(Buffer + x, FALSE, (INTN)f); - return; -} - -VOID -TimeToString ( - OUT CHAR16 *Buffer, - IN EFI_TIME *Time - ) -{ - UINTN Hour, Year; - CHAR16 AmPm; - - AmPm = 'a'; - Hour = Time->Hour; - if (Time->Hour == 0) { - Hour = 12; - } else if (Time->Hour >= 12) { - AmPm = 'p'; - if (Time->Hour >= 13) { - Hour -= 12; - } - } - - Year = Time->Year % 100; - - // bugbug: for now just print it any old way - UnicodeSPrint (Buffer, 0, L"%02d/%02d/%02d %02d:%02d%c", - Time->Month, - Time->Day, - Year, - Hour, - Time->Minute, - AmPm - ); -} - - - - -VOID -DumpHex ( - IN UINTN Indent, - IN UINTN Offset, - IN UINTN DataSize, - IN VOID *UserData - ) -{ - CHAR8 *Data, Val[50], Str[20], c; - UINTN Size, Index; - - UINTN ScreenCount; - UINTN TempColumn; - UINTN ScreenSize; - CHAR16 ReturnStr[1]; - - - uefi_call_wrapper(ST->ConOut->QueryMode, 4, ST->ConOut, ST->ConOut->Mode->Mode, &TempColumn, &ScreenSize); - ScreenCount = 0; - ScreenSize -= 2; - - Data = UserData; - while (DataSize) { - Size = 16; - if (Size > DataSize) { - Size = DataSize; - } - - for (Index=0; Index < Size; Index += 1) { - c = Data[Index]; - Val[Index*3+0] = Hex[c>>4]; - Val[Index*3+1] = Hex[c&0xF]; - Val[Index*3+2] = (Index == 7)?'-':' '; - Str[Index] = (c < ' ' || c > 'z') ? '.' : c; - } - - Val[Index*3] = 0; - Str[Index] = 0; - Print (L"%*a%X: %-.48a *%a*\n", Indent, "", Offset, Val, Str); - - Data += Size; - Offset += Size; - DataSize -= Size; - - ScreenCount++; - if (ScreenCount >= ScreenSize && ScreenSize != 0) { - // - // If ScreenSize == 0 we have the console redirected so don't - // block updates - // - ScreenCount = 0; - Print (L"Press Enter to continue :"); - Input (L"", ReturnStr, sizeof(ReturnStr)/sizeof(CHAR16)); - Print (L"\n"); - } - - } -} diff --git a/3rd/gnu-efi/lib/riscv64/initplat.c b/3rd/gnu-efi/lib/riscv64/initplat.c deleted file mode 100644 index 895353ad3..000000000 --- a/3rd/gnu-efi/lib/riscv64/initplat.c +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause - -#include "lib.h" - -VOID -InitializeLibPlatform ( - IN EFI_HANDLE ImageHandle EFI_UNUSED, - IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED - ) -{ -} diff --git a/3rd/gnu-efi/lib/riscv64/math.c b/3rd/gnu-efi/lib/riscv64/math.c deleted file mode 100644 index 3653e4203..000000000 --- a/3rd/gnu-efi/lib/riscv64/math.c +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-License-Identifier: BSD-2-Clause-Patent -/* - * This code is based on EDK II MdePkg/Library/BaseLib/Math64.c - * Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved. - */ - -#include "lib.h" - -/** - * LShiftU64() - left shift - */ -UINT64 -LShiftU64 ( - IN UINT64 Operand, - IN UINTN Count -) -{ - return Operand << Count; -} - -/** - * RShiftU64() - right shift - */ -UINT64 -RShiftU64 ( - IN UINT64 Operand, - IN UINTN Count -) -{ - return Operand >> Count; -} - -/** - * MultU64x32() - multiply - */ -UINT64 -MultU64x32 ( - IN UINT64 Multiplicand, - IN UINTN Multiplier -) -{ - return Multiplicand * Multiplier; -} - -/** - * DivU64x32() - divide - */ -UINT64 -DivU64x32 ( - IN UINT64 Dividend, - IN UINTN Divisor, - OUT UINTN *Remainder OPTIONAL -) -{ - ASSERT(Divisor != 0); - - if (Remainder) { - *Remainder = Dividend % Divisor; - } - - return Dividend / Divisor; -} diff --git a/3rd/gnu-efi/lib/riscv64/setjmp.S b/3rd/gnu-efi/lib/riscv64/setjmp.S deleted file mode 100644 index 275a715f7..000000000 --- a/3rd/gnu-efi/lib/riscv64/setjmp.S +++ /dev/null @@ -1,73 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause -/* - * Copyright Heinrich Schuchardt - */ - - .text - .p2align 3 - -#define GREG_LIST \ - REG_ONE(s0, 0); \ - REG_ONE(s1, 8); \ - REG_ONE(s2, 16); \ - REG_ONE(s3, 24); \ - REG_ONE(s4, 32); \ - REG_ONE(s5, 40); \ - REG_ONE(s6, 48); \ - REG_ONE(s7, 56); \ - REG_ONE(s8, 64); \ - REG_ONE(s9, 72); \ - REG_ONE(s10, 80); \ - REG_ONE(s11, 88); \ - REG_ONE(sp, 96); \ - REG_ONE(ra, 104); - -#define FREG_LIST \ - FREG_ONE(fs0, 112); \ - FREG_ONE(fs1, 120); \ - FREG_ONE(fs2, 128); \ - FREG_ONE(fs3, 136); \ - FREG_ONE(fs4, 144); \ - FREG_ONE(fs5, 152); \ - FREG_ONE(fs6, 160); \ - FREG_ONE(fs7, 168); \ - FREG_ONE(fs8, 176); \ - FREG_ONE(fs9, 184); \ - FREG_ONE(fs10, 192); \ - FREG_ONE(fs11, 200); - -#define REG_ONE(R, P) sd R, P(a0) -#define FREG_ONE(R, P) fsd R, P(a0) - - .globl setjmp - .type setjmp, @function - -setjmp: - GREG_LIST -#ifndef __riscv_float_abi_soft - FREG_LIST -#endif - li a0, 0 - ret - -#undef REG_ONE -#undef FREG_ONE - -#define REG_ONE(R, P) ld R, P(a0) -#define FREG_ONE(R, P) fld R, P(a0) - - .globl longjmp - .type longjmp, @function - -longjmp: - GREG_LIST -#ifndef __riscv_float_abi_soft - FREG_LIST -#endif - seqz a0, a1 - add a0, a0, a1 - ret - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/runtime/efirtlib.c b/3rd/gnu-efi/lib/runtime/efirtlib.c deleted file mode 100644 index 434db9196..000000000 --- a/3rd/gnu-efi/lib/runtime/efirtlib.c +++ /dev/null @@ -1,155 +0,0 @@ -/*++ - -Copyright (c) 1999 Intel Corporation - -Module Name: - - EfiRtLib.h - -Abstract: - - EFI Runtime library functions - - - -Revision History - ---*/ - -#include "efi.h" -#include "efilib.h" -#include "efirtlib.h" - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtZeroMem) -#endif -VOID -RUNTIMEFUNCTION -RtZeroMem ( - IN VOID *Buffer, - IN UINTN Size - ) -{ - INT8 *pt; - - pt = Buffer; - while (Size--) { - *(pt++) = 0; - } -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtSetMem) -#endif -VOID -RUNTIMEFUNCTION -RtSetMem ( - IN VOID *Buffer, - IN UINTN Size, - IN UINT8 Value - ) -{ - INT8 *pt; - - pt = Buffer; - while (Size--) { - *(pt++) = Value; - } -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtCopyMem) -#endif -VOID -RUNTIMEFUNCTION -RtCopyMem ( - IN VOID *Dest, - IN CONST VOID *Src, - IN UINTN len - ) -{ - CHAR8 *d = (CHAR8*)Dest; - CHAR8 *s = (CHAR8*)Src; - - if (d == NULL || s == NULL || s == d) - return; - - // If the beginning of the destination range overlaps with the end of - // the source range, make sure to start the copy from the end so that - // we don't end up overwriting source data that we need for the copy. - if ((d > s) && (d < s + len)) { - for (d += len, s += len; len--; ) - *--d = *--s; - } else { - while (len--) - *d++ = *s++; - } -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtCompareMem) -#endif -INTN -RUNTIMEFUNCTION -RtCompareMem ( - IN CONST VOID *Dest, - IN CONST VOID *Src, - IN UINTN len - ) -{ - CONST CHAR8 *d = Dest, *s = Src; - while (len--) { - if (*d != *s) { - return *d - *s; - } - - d += 1; - s += 1; - } - - return 0; -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtCompareGuid) -#endif -INTN -RUNTIMEFUNCTION -RtCompareGuid ( - IN EFI_GUID *Guid1, - IN EFI_GUID *Guid2 - ) -/*++ - -Routine Description: - - Compares to GUIDs - -Arguments: - - Guid1 - guid to compare - Guid2 - guid to compare - -Returns: - = 0 if Guid1 == Guid2 - ---*/ -{ - INT32 *g1, *g2, r; - - // - // Compare 32 bits at a time - // - - g1 = (INT32 *) Guid1; - g2 = (INT32 *) Guid2; - - r = g1[0] - g2[0]; - r |= g1[1] - g2[1]; - r |= g1[2] - g2[2]; - r |= g1[3] - g2[3]; - - return r; -} - - diff --git a/3rd/gnu-efi/lib/runtime/rtdata.c b/3rd/gnu-efi/lib/runtime/rtdata.c deleted file mode 100644 index 3efcbf3ad..000000000 --- a/3rd/gnu-efi/lib/runtime/rtdata.c +++ /dev/null @@ -1,65 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - data.c - -Abstract: - - EFI library global data - - - -Revision History - ---*/ - -#include "lib.h" - - -// -// These globals are runtime globals -// -// N.B. The Microsoft C compiler will only put the data in the -// right data section if it is explicitly initialized.. -// - -#ifndef __GNUC__ -#pragma BEGIN_RUNTIME_DATA() -#endif - -// -// RT - pointer to the runtime table -// - -EFI_RUNTIME_SERVICES *RT; - -// -// LibStandalone - TRUE if lib is linked in as part of the firmware. -// N.B. The EFI fw sets this value directly -// - -BOOLEAN LibFwInstance; - -// -// EFIDebug - Debug mask -// - -UINTN EFIDebug = EFI_DBUG_MASK; - -// -// LibRuntimeDebugOut - Runtime Debug Output device -// - -SIMPLE_TEXT_OUTPUT_INTERFACE *LibRuntimeDebugOut; - -// -// LibRuntimeRaiseTPL, LibRuntimeRestoreTPL - pointers to Runtime functions from the -// Boot Services Table -// - -EFI_RAISE_TPL LibRuntimeRaiseTPL = NULL; -EFI_RESTORE_TPL LibRuntimeRestoreTPL = NULL; - diff --git a/3rd/gnu-efi/lib/runtime/rtlock.c b/3rd/gnu-efi/lib/runtime/rtlock.c deleted file mode 100644 index 2eafdca16..000000000 --- a/3rd/gnu-efi/lib/runtime/rtlock.c +++ /dev/null @@ -1,102 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - lock.c - -Abstract: - - Implements FLOCK - - - -Revision History - ---*/ - - -#include "lib.h" - - - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtAcquireLock) -#endif -VOID -RtAcquireLock ( - IN FLOCK *Lock - ) -/*++ - -Routine Description: - - Raising to the task priority level of the mutual exclusion - lock, and then acquires ownership of the lock. - -Arguments: - - Lock - The lock to acquire - -Returns: - - Lock owned - ---*/ -{ - if (BS) { - if (BS->RaiseTPL != NULL) { - Lock->OwnerTpl = uefi_call_wrapper(BS->RaiseTPL, 1, Lock->Tpl); - } - } - else { - if (LibRuntimeRaiseTPL != NULL) { - Lock->OwnerTpl = LibRuntimeRaiseTPL(Lock->Tpl); - } - } - Lock->Lock += 1; - ASSERT (Lock->Lock == 1); -} - - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtAcquireLock) -#endif -VOID -RtReleaseLock ( - IN FLOCK *Lock - ) -/*++ - -Routine Description: - - Releases ownership of the mutual exclusion lock, and - restores the previous task priority level. - -Arguments: - - Lock - The lock to release - -Returns: - - Lock unowned - ---*/ -{ - EFI_TPL Tpl; - - Tpl = Lock->OwnerTpl; - ASSERT(Lock->Lock == 1); - Lock->Lock -= 1; - if (BS) { - if (BS->RestoreTPL != NULL) { - uefi_call_wrapper(BS->RestoreTPL, 1, Tpl); - } - } - else { - if (LibRuntimeRestoreTPL != NULL) { - LibRuntimeRestoreTPL(Tpl); - } - } -} diff --git a/3rd/gnu-efi/lib/runtime/rtstr.c b/3rd/gnu-efi/lib/runtime/rtstr.c deleted file mode 100644 index 802e7f433..000000000 --- a/3rd/gnu-efi/lib/runtime/rtstr.c +++ /dev/null @@ -1,231 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - str.c - -Abstract: - - String runtime functions - - -Revision History - ---*/ - -#include "lib.h" - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtStrCmp) -#endif -INTN -RUNTIMEFUNCTION -RtStrCmp ( - IN CONST CHAR16 *s1, - IN CONST CHAR16 *s2 - ) -// compare strings -{ - while (*s1) { - if (*s1 != *s2) { - break; - } - - s1 += 1; - s2 += 1; - } - - return *s1 - *s2; -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtStrCpy) -#endif -VOID -RUNTIMEFUNCTION -RtStrCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ) -// copy strings -{ - while (*Src) { - *(Dest++) = *(Src++); - } - *Dest = 0; -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtStrnCpy) -#endif -VOID -RUNTIMEFUNCTION -RtStrnCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ) -// copy strings -{ - UINTN Size = RtStrnLen(Src, Len); - if (Size != Len) - RtSetMem(Dest + Size, (Len - Size) * sizeof(CHAR16), '\0'); - RtCopyMem(Dest, Src, Size * sizeof(CHAR16)); -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtStpCpy) -#endif -CHAR16 * -RUNTIMEFUNCTION -RtStpCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ) -// copy strings -{ - while (*Src) { - *(Dest++) = *(Src++); - } - *Dest = 0; - return Dest; -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtStpnCpy) -#endif -CHAR16 * -RUNTIMEFUNCTION -RtStpnCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ) -// copy strings -{ - UINTN Size = RtStrnLen(Src, Len); - if (Size != Len) - RtSetMem(Dest + Size, (Len - Size) * sizeof(CHAR16), '\0'); - RtCopyMem(Dest, Src, Size * sizeof(CHAR16)); - return Dest + Size; -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtStrCat) -#endif -VOID -RUNTIMEFUNCTION -RtStrCat ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ) -{ - RtStrCpy(Dest+RtStrLen(Dest), Src); -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtStrnCat) -#endif -VOID -RUNTIMEFUNCTION -RtStrnCat ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ) -{ - UINTN DestSize, Size; - - DestSize = RtStrLen(Dest); - Size = RtStrnLen(Src, Len); - RtCopyMem(Dest + DestSize, Src, Size * sizeof(CHAR16)); - Dest[DestSize + Size] = '\0'; -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtStrLen) -#endif -UINTN -RUNTIMEFUNCTION -RtStrLen ( - IN CONST CHAR16 *s1 - ) -// string length -{ - UINTN len; - - for (len=0; *s1; s1+=1, len+=1) ; - return len; -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtStrnLen) -#endif -UINTN -RUNTIMEFUNCTION -RtStrnLen ( - IN CONST CHAR16 *s1, - IN UINTN Len - ) -// string length -{ - UINTN i; - for (i = 0; *s1 && i < Len; i++) - s1++; - return i; -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtStrSize) -#endif -UINTN -RUNTIMEFUNCTION -RtStrSize ( - IN CONST CHAR16 *s1 - ) -// string size -{ - UINTN len; - - for (len=0; *s1; s1+=1, len+=1) ; - return (len + 1) * sizeof(CHAR16); -} - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtBCDtoDecimal) -#endif -UINT8 -RUNTIMEFUNCTION -RtBCDtoDecimal( - IN UINT8 BcdValue - ) -{ - UINTN High, Low; - - High = BcdValue >> 4; - Low = BcdValue - (High << 4); - - return ((UINT8)(Low + (High * 10))); -} - - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtDecimaltoBCD) -#endif -UINT8 -RUNTIMEFUNCTION -RtDecimaltoBCD ( - IN UINT8 DecValue - ) -{ - UINTN High, Low; - - High = DecValue / 10; - Low = DecValue - (High * 10); - - return ((UINT8)(Low + (High << 4))); -} - - diff --git a/3rd/gnu-efi/lib/runtime/vm.c b/3rd/gnu-efi/lib/runtime/vm.c deleted file mode 100644 index 26e0c8e1d..000000000 --- a/3rd/gnu-efi/lib/runtime/vm.c +++ /dev/null @@ -1,105 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - vm.c - -Abstract: - - EFI Hell to remap runtime address into the new virual address space - that was registered by the OS for RT calls. - - So the code image needs to be relocated. All pointers need to be - manually fixed up since the address map changes. - - GOOD LUCK NOT HAVING BUGS IN YOUR CODE! PLEASE TEST A LOT. MAKE SURE - EXIT BOOTSERVICES OVER WRITES ALL BOOTSERVICE MEMORY & DATA SPACES WHEN - YOU TEST. - -Revision History - ---*/ - -#include "lib.h" - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtLibEnableVirtualMappings) -#endif -VOID -RUNTIMEFUNCTION -RtLibEnableVirtualMappings ( - VOID - ) -{ - EFI_CONVERT_POINTER ConvertPointer; - - // - // If this copy of the lib is linked into the firmware, then - // do not update the pointers yet. - // - - if (!LibFwInstance) { - - // - // Different components are updating to the new virtual - // mappings at differnt times. The only function that - // is safe to call at this notification is ConvertAddress - // - - ConvertPointer = RT->ConvertPointer; - - // - // Fix any pointers that the lib created, that may be needed - // during runtime. - // - - ConvertPointer (EFI_INTERNAL_PTR, (VOID **)&RT); - ConvertPointer (EFI_OPTIONAL_PTR, (VOID **)&LibRuntimeDebugOut); - - ConvertPointer (EFI_INTERNAL_PTR, (VOID **)&LibRuntimeRaiseTPL); - ConvertPointer (EFI_INTERNAL_PTR, (VOID **)&LibRuntimeRestoreTPL); - - // that was it :^) - } -} - - -#ifndef __GNUC__ -#pragma RUNTIME_CODE(RtConvertList) -#endif -VOID -RUNTIMEFUNCTION -RtConvertList ( - IN UINTN DebugDisposition, - IN OUT LIST_ENTRY *ListHead - ) -{ - LIST_ENTRY *Link; - LIST_ENTRY *NextLink; - EFI_CONVERT_POINTER ConvertPointer; - - ConvertPointer = RT->ConvertPointer; - - // - // Convert all the Flink & Blink pointers in the list - // - - Link = ListHead; - do { - NextLink = Link->Flink; - - ConvertPointer ( - Link->Flink == ListHead ? DebugDisposition : 0, - (VOID **)&Link->Flink - ); - - ConvertPointer ( - Link->Blink == ListHead ? DebugDisposition : 0, - (VOID **)&Link->Blink - ); - - Link = NextLink; - } while (Link != ListHead); -} diff --git a/3rd/gnu-efi/lib/smbios.c b/3rd/gnu-efi/lib/smbios.c deleted file mode 100644 index 23bb47744..000000000 --- a/3rd/gnu-efi/lib/smbios.c +++ /dev/null @@ -1,135 +0,0 @@ -/*++ - -Copyright (c) 2000 Intel Corporation - -Module Name: - - Smbios.c - -Abstract: - - Lib fucntions for SMBIOS. Used to get system serial number and GUID - -Revision History - ---*/ - -#include "lib.h" - -/* - * We convert 32 bit values to pointers. In 64 bit mode the compiler will issue a - * warning stating that the value is too small for the pointer: - * "warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]" - * we can safely ignore them here. - */ -#ifdef __GNUC__ -#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" -#endif - -EFI_STATUS -LibGetSmbiosSystemGuidAndSerialNumber ( - IN EFI_GUID *SystemGuid, - OUT CHAR8 **SystemSerialNumber - ) -{ - EFI_STATUS Status; - SMBIOS_STRUCTURE_TABLE *SmbiosTable; - SMBIOS_STRUCTURE_POINTER Smbios; - SMBIOS_STRUCTURE_POINTER SmbiosEnd; - UINT16 Index; - - Status = LibGetSystemConfigurationTable(&SMBIOSTableGuid, (VOID**)&SmbiosTable); - if (EFI_ERROR(Status)) { - return EFI_NOT_FOUND; - } - - Smbios.Hdr = (SMBIOS_HEADER *)SmbiosTable->TableAddress; - SmbiosEnd.Raw = (UINT8 *)((UINTN)SmbiosTable->TableAddress + SmbiosTable->TableLength); - for (Index = 0; Index < SmbiosTable->TableLength ; Index++) { - if (Smbios.Hdr->Type == 1) { - if (Smbios.Hdr->Length < 0x19) { - // - // Older version did not support Guid and Serial number - // - continue; - } - - // - // SMBIOS tables are byte packed so we need to do a byte copy to - // prevend alignment faults on IA-64. - - CopyMem (SystemGuid, &Smbios.Type1->Uuid, sizeof(EFI_GUID)); - *SystemSerialNumber = LibGetSmbiosString(&Smbios, Smbios.Type1->SerialNumber); - return EFI_SUCCESS; - } - - // - // Make Smbios point to the next record - // - LibGetSmbiosString (&Smbios, -1); - - if (Smbios.Raw >= SmbiosEnd.Raw) { - // - // SMBIOS 2.1 incorrectly stated the length of SmbiosTable as 0x1e. - // given this we must double check against the lenght of - /// the structure. My home PC has this bug.ruthard - // - return EFI_SUCCESS; - } - } - - return EFI_SUCCESS; -} - -CHAR8* -LibGetSmbiosString ( - IN SMBIOS_STRUCTURE_POINTER *Smbios, - IN UINT16 StringNumber - ) -/*++ - - Return SMBIOS string given the string number. - - Arguments: - Smbios - Pointer to SMBIOS structure - StringNumber - String number to return. -1 is used to skip all strings and - point to the next SMBIOS structure. - - Returns: - Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1 ---*/ -{ - UINT16 Index; - CHAR8 *String; - - // - // Skip over formatted section - // - String = (CHAR8 *)(Smbios->Raw + Smbios->Hdr->Length); - - // - // Look through unformated section - // - for (Index = 1; Index <= StringNumber; Index++) { - if (StringNumber == Index) { - return String; - } - - // - // Skip string - // - for (; *String != 0; String++); - String++; - - if (*String == 0) { - // - // If double NULL then we are done. - // Retrun pointer to next structure in Smbios. - // if you pass in a -1 you will always get here - // - Smbios->Raw = (UINT8 *)++String; - return NULL; - } - } - return NULL; -} diff --git a/3rd/gnu-efi/lib/sread.c b/3rd/gnu-efi/lib/sread.c deleted file mode 100644 index 888f954ae..000000000 --- a/3rd/gnu-efi/lib/sread.c +++ /dev/null @@ -1,358 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - sread.c - -Abstract: - - Simple read file access - - - -Revision History - ---*/ - -#include "lib.h" - -#define SIMPLE_READ_SIGNATURE EFI_SIGNATURE_32('s','r','d','r') -typedef struct _SIMPLE_READ_FILE { - UINTN Signature; - BOOLEAN FreeBuffer; - VOID *Source; - UINTN SourceSize; - EFI_FILE_HANDLE FileHandle; -} SIMPLE_READ_HANDLE; - - - -EFI_STATUS -OpenSimpleReadFile ( - IN BOOLEAN BootPolicy, - IN VOID *SourceBuffer OPTIONAL, - IN UINTN SourceSize, - IN OUT EFI_DEVICE_PATH **FilePath, - OUT EFI_HANDLE *DeviceHandle, - OUT SIMPLE_READ_FILE *SimpleReadHandle - ) -/*++ - -Routine Description: - - Opens a file for (simple) reading. The simple read abstraction - will access the file either from a memory copy, from a file - system interface, or from the load file interface. - -Arguments: - -Returns: - - A handle to access the file - ---*/ -{ - SIMPLE_READ_HANDLE *FHand; - EFI_DEVICE_PATH *UserFilePath; - EFI_DEVICE_PATH *TempFilePath; - EFI_DEVICE_PATH *TempFilePathPtr; - FILEPATH_DEVICE_PATH *FilePathNode; - EFI_FILE_HANDLE FileHandle, LastHandle; - EFI_STATUS Status; - EFI_LOAD_FILE_INTERFACE *LoadFile; - - FHand = NULL; - UserFilePath = *FilePath; - - // - // Allocate a new simple read handle structure - // - - FHand = AllocateZeroPool (sizeof(SIMPLE_READ_HANDLE)); - if (!FHand) { - Status = EFI_OUT_OF_RESOURCES; - goto Done; - } - - *SimpleReadHandle = (SIMPLE_READ_FILE) FHand; - FHand->Signature = SIMPLE_READ_SIGNATURE; - - // - // If the caller passed a copy of the file, then just use it - // - - if (SourceBuffer) { - FHand->Source = SourceBuffer; - FHand->SourceSize = SourceSize; - *DeviceHandle = NULL; - Status = EFI_SUCCESS; - goto Done; - } - - // - // Attempt to access the file via a file system interface - // - - FileHandle = NULL; - Status = uefi_call_wrapper(BS->LocateDevicePath, 3, &FileSystemProtocol, FilePath, DeviceHandle); - if (!EFI_ERROR(Status)) { - FileHandle = LibOpenRoot (*DeviceHandle); - } - - Status = FileHandle ? EFI_SUCCESS : EFI_UNSUPPORTED; - - // - // To access as a filesystem, the filepath should only - // contain filepath components. Follow the filepath nodes - // and find the target file - // - - FilePathNode = (FILEPATH_DEVICE_PATH *) *FilePath; - while (!IsDevicePathEnd(&FilePathNode->Header)) { - - // - // For filesystem access each node should be a filepath component - // - - if (DevicePathType(&FilePathNode->Header) != MEDIA_DEVICE_PATH || - DevicePathSubType(&FilePathNode->Header) != MEDIA_FILEPATH_DP) { - Status = EFI_UNSUPPORTED; - } - - // - // If there's been an error, stop - // - - if (EFI_ERROR(Status)) { - break; - } - - // - // Open this file path node - // - - LastHandle = FileHandle; - FileHandle = NULL; - - Status = uefi_call_wrapper( - LastHandle->Open, - 5, - LastHandle, - &FileHandle, - FilePathNode->PathName, - EFI_FILE_MODE_READ, - 0 - ); - - // - // Close the last node - // - - uefi_call_wrapper(LastHandle->Close, 1, LastHandle); - - // - // Get the next node - // - - FilePathNode = (FILEPATH_DEVICE_PATH *) NextDevicePathNode(&FilePathNode->Header); - } - - // - // If success, return the FHand - // - - if (!EFI_ERROR(Status)) { - ASSERT(FileHandle); - FHand->FileHandle = FileHandle; - goto Done; - } - - // - // Cleanup from filesystem access - // - - if (FileHandle) { - uefi_call_wrapper(FileHandle->Close, 1, FileHandle); - FileHandle = NULL; - *FilePath = UserFilePath; - } - - // - // If the error is something other then unsupported, return it - // - - if (Status != EFI_UNSUPPORTED) { - goto Done; - } - - // - // Attempt to access the file via the load file protocol - // - - Status = LibDevicePathToInterface (&LoadFileProtocol, *FilePath, (VOID*)&LoadFile); - if (!EFI_ERROR(Status)) { - - TempFilePath = DuplicateDevicePath (*FilePath); - - TempFilePathPtr = TempFilePath; - - Status = uefi_call_wrapper(BS->LocateDevicePath, 3, &LoadFileProtocol, &TempFilePath, DeviceHandle); - - FreePool (TempFilePathPtr); - - // - // Determine the size of buffer needed to hold the file - // - - SourceSize = 0; - Status = uefi_call_wrapper( - LoadFile->LoadFile, - 5, - LoadFile, - *FilePath, - BootPolicy, - &SourceSize, - NULL - ); - - // - // We expect a buffer too small error to inform us - // of the buffer size needed - // - - if (Status == EFI_BUFFER_TOO_SMALL) { - SourceBuffer = AllocatePool (SourceSize); - - if (SourceBuffer) { - FHand->FreeBuffer = TRUE; - FHand->Source = SourceBuffer; - FHand->SourceSize = SourceSize; - - Status = uefi_call_wrapper( - LoadFile->LoadFile, - 5, - LoadFile, - *FilePath, - BootPolicy, - &SourceSize, - SourceBuffer - ); - } - } - - // - // If success, return FHand - // - - if (!EFI_ERROR(Status) || Status == EFI_ALREADY_STARTED) { - goto Done; - } - } - - // - // Nothing else to try - // - - DEBUG ((D_LOAD|D_WARN, "OpenSimpleReadFile: Device did not support a known load protocol\n")); - Status = EFI_UNSUPPORTED; - -Done: - - // - // If the file was not accessed, clean up - // - if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) { - if (FHand) { - if (FHand->FreeBuffer) { - FreePool (FHand->Source); - } - - FreePool (FHand); - } - } - - return Status; -} - -EFI_STATUS -ReadSimpleReadFile ( - IN SIMPLE_READ_FILE UserHandle, - IN UINTN Offset, - IN OUT UINTN *ReadSize, - OUT VOID *Buffer - ) -{ - UINTN EndPos; - SIMPLE_READ_HANDLE *FHand; - EFI_STATUS Status; - - FHand = UserHandle; - ASSERT (FHand->Signature == SIMPLE_READ_SIGNATURE); - if (FHand->Source) { - - // - // Move data from our local copy of the file - // - - EndPos = Offset + *ReadSize; - if (EndPos > FHand->SourceSize) { - *ReadSize = FHand->SourceSize - Offset; - if (Offset >= FHand->SourceSize) { - *ReadSize = 0; - } - } - - CopyMem (Buffer, (CHAR8 *) FHand->Source + Offset, *ReadSize); - Status = EFI_SUCCESS; - - } else { - - // - // Read data from the file - // - - Status = uefi_call_wrapper(FHand->FileHandle->SetPosition, 2, FHand->FileHandle, Offset); - - if (!EFI_ERROR(Status)) { - Status = uefi_call_wrapper(FHand->FileHandle->Read, 3, FHand->FileHandle, ReadSize, Buffer); - } - } - - return Status; -} - - -VOID -CloseSimpleReadFile ( - IN SIMPLE_READ_FILE UserHandle - ) -{ - SIMPLE_READ_HANDLE *FHand; - - FHand = UserHandle; - ASSERT (FHand->Signature == SIMPLE_READ_SIGNATURE); - - // - // Free any file handle we opened - // - - if (FHand->FileHandle) { - uefi_call_wrapper(FHand->FileHandle->Close, 1, FHand->FileHandle); - } - - // - // If we allocated the Source buffer, free it - // - - if (FHand->FreeBuffer) { - FreePool (FHand->Source); - } - - // - // Done with this simple read file handle - // - - FreePool (FHand); -} diff --git a/3rd/gnu-efi/lib/str.c b/3rd/gnu-efi/lib/str.c deleted file mode 100644 index b9b156bd3..000000000 --- a/3rd/gnu-efi/lib/str.c +++ /dev/null @@ -1,432 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - str.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" - - -INTN -StrCmp ( - IN CONST CHAR16 *s1, - IN CONST CHAR16 *s2 - ) -// compare strings -{ - return RtStrCmp(s1, s2); -} - -INTN -StrnCmp ( - IN CONST CHAR16 *s1, - IN CONST CHAR16 *s2, - IN UINTN len - ) -// compare strings -{ - while (*s1 && len) { - if (*s1 != *s2) { - break; - } - - s1 += 1; - s2 += 1; - len -= 1; - } - - return len ? *s1 - *s2 : 0; -} - - -INTN EFIAPI -LibStubStriCmp ( - IN EFI_UNICODE_COLLATION_INTERFACE *This EFI_UNUSED, - IN CHAR16 *s1, - IN CHAR16 *s2 - ) -{ - return StrCmp (s1, s2); -} - -VOID EFIAPI -LibStubStrLwrUpr ( - IN EFI_UNICODE_COLLATION_INTERFACE *This EFI_UNUSED, - IN CHAR16 *Str EFI_UNUSED - ) -{ -} - -INTN -StriCmp ( - IN CONST CHAR16 *s1, - IN CONST CHAR16 *s2 - ) -// compare strings -{ - if (UnicodeInterface == &LibStubUnicodeInterface) - return UnicodeInterface->StriColl(UnicodeInterface, (CHAR16 *)s1, (CHAR16 *)s2); - else - return uefi_call_wrapper(UnicodeInterface->StriColl, 3, UnicodeInterface, (CHAR16 *)s1, (CHAR16 *)s2); -} - -VOID -StrLwr ( - IN CHAR16 *Str - ) -// lwoer case string -{ - if (UnicodeInterface == &LibStubUnicodeInterface) - UnicodeInterface->StrLwr(UnicodeInterface, Str); - else uefi_call_wrapper(UnicodeInterface->StrLwr, 2, UnicodeInterface, Str); -} - -VOID -StrUpr ( - IN CHAR16 *Str - ) -// upper case string -{ - if (UnicodeInterface == &LibStubUnicodeInterface) - UnicodeInterface->StrUpr(UnicodeInterface, Str); - else uefi_call_wrapper(UnicodeInterface->StrUpr, 2, UnicodeInterface, Str); -} - -VOID -StrCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ) -// copy strings -{ - RtStrCpy (Dest, Src); -} - -VOID -StrnCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ) -// copy strings -{ - RtStrnCpy (Dest, Src, Len); -} - -CHAR16 * -StpCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ) -// copy strings -{ - return RtStpCpy (Dest, Src); -} - -CHAR16 * -StpnCpy ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ) -// copy strings -{ - return RtStpnCpy (Dest, Src, Len); -} - -VOID -StrCat ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src - ) -{ - RtStrCat(Dest, Src); -} - -VOID -StrnCat ( - IN CHAR16 *Dest, - IN CONST CHAR16 *Src, - IN UINTN Len - ) -{ - RtStrnCat(Dest, Src, Len); -} - - -UINTN -StrnLen ( - IN CONST CHAR16 *s1, - IN UINTN Len - ) -// string length -{ - return RtStrnLen(s1, Len); -} - -UINTN -StrLen ( - IN CONST CHAR16 *s1 - ) -// string length -{ - return RtStrLen(s1); -} - -UINTN -StrSize ( - IN CONST CHAR16 *s1 - ) -// string size -{ - return RtStrSize(s1); -} - -CHAR16 * -StrDuplicate ( - IN CONST CHAR16 *Src - ) -// duplicate a string -{ - CHAR16 *Dest; - UINTN Size; - - Size = StrSize(Src); - Dest = AllocatePool (Size); - if (Dest) { - CopyMem (Dest, Src, Size); - } - return Dest; -} - -UINTN -strlena ( - IN CONST CHAR8 *s1 - ) -// string length -{ - UINTN len; - - for (len=0; *s1; s1+=1, len+=1) ; - return len; -} - -UINTN -strcmpa ( - IN CONST CHAR8 *s1, - IN CONST CHAR8 *s2 - ) -// compare strings -{ - while (*s1) { - if (*s1 != *s2) { - break; - } - - s1 += 1; - s2 += 1; - } - - return *s1 - *s2; -} - -UINTN -strncmpa ( - IN CONST CHAR8 *s1, - IN CONST CHAR8 *s2, - IN UINTN len - ) -// compare strings -{ - while (*s1 && len) { - if (*s1 != *s2) { - break; - } - - s1 += 1; - s2 += 1; - len -= 1; - } - - return len ? *s1 - *s2 : 0; -} - - - -UINTN -xtoi ( - CONST CHAR16 *str - ) -// convert hex string to uint -{ - UINTN u; - CHAR16 c; - - // skip preceeding white space - while (*str == ' ') { - str += 1; - } - - // convert hex digits - u = 0; - while ((c = *(str++))) { - if (c >= 'a' && c <= 'f') { - c -= 'a' - 'A'; - } - - if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) { - u = (u << 4) | ((UINTN)c - (c >= 'A' ? 'A'-10 : '0')); - } else { - break; - } - } - - return u; -} - -UINTN -Atoi ( - CONST CHAR16 *str - ) -// convert hex string to uint -{ - UINTN u; - CHAR16 c; - - // skip preceeding white space - while (*str == ' ') { - str += 1; - } - - // convert digits - u = 0; - while ((c = *(str++))) { - if (c >= '0' && c <= '9') { - u = (u * 10) + c - '0'; - } else { - break; - } - } - - return u; -} - -BOOLEAN -MetaMatch ( - IN CHAR16 *String, - IN CHAR16 *Pattern - ) -{ - CHAR16 c, p, l; - - for (; ;) { - p = *Pattern; - Pattern += 1; - - switch (p) { - case 0: - // End of pattern. If end of string, TRUE match - return *String ? FALSE : TRUE; - - case '*': - // Match zero or more chars - while (*String) { - if (MetaMatch (String, Pattern)) { - return TRUE; - } - String += 1; - } - return MetaMatch (String, Pattern); - - case '?': - // Match any one char - if (!*String) { - return FALSE; - } - String += 1; - break; - - case '[': - // Match char set - c = *String; - if (!c) { - return FALSE; // syntax problem - } - - l = 0; - while ((p = *Pattern++)) { - if (p == ']') { - return FALSE; - } - - if (p == '-') { // if range of chars, - p = *Pattern; // get high range - if (p == 0 || p == ']') { - return FALSE; // syntax problem - } - - if (c >= l && c <= p) { // if in range, - break; // it's a match - } - } - - l = p; - if (c == p) { // if char matches - break; // move on - } - } - - // skip to end of match char set - while (p && p != ']') { - p = *Pattern; - Pattern += 1; - } - - String += 1; - break; - - default: - c = *String; - if (c != p) { - return FALSE; - } - - String += 1; - break; - } - } -} - - -BOOLEAN EFIAPI -LibStubMetaiMatch ( - IN EFI_UNICODE_COLLATION_INTERFACE *This EFI_UNUSED, - IN CHAR16 *String, - IN CHAR16 *Pattern - ) -{ - return MetaMatch (String, Pattern); -} - - -BOOLEAN -MetaiMatch ( - IN CHAR16 *String, - IN CHAR16 *Pattern - ) -{ - if (UnicodeInterface == &LibStubUnicodeInterface) - return UnicodeInterface->MetaiMatch(UnicodeInterface, String, Pattern); - else return uefi_call_wrapper(UnicodeInterface->MetaiMatch, 3, UnicodeInterface, String, Pattern); -} diff --git a/3rd/gnu-efi/lib/x86_64/callwrap.c b/3rd/gnu-efi/lib/x86_64/callwrap.c deleted file mode 100644 index 30a532232..000000000 --- a/3rd/gnu-efi/lib/x86_64/callwrap.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Convert SysV calling convention to EFI x86_64 calling convention - * - * Copyright (C) 2007-2010 Intel Corp - * Bibo Mao - * Chandramouli Narayanan - * Huang Ying - * - * 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. - */ - -/* uefi_call_wrapper() is a macro in efibind.h */ diff --git a/3rd/gnu-efi/lib/x86_64/efi_stub.S b/3rd/gnu-efi/lib/x86_64/efi_stub.S deleted file mode 100644 index 617a1dd83..000000000 --- a/3rd/gnu-efi/lib/x86_64/efi_stub.S +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Function calling ABI conversion from Linux to EFI for x86_64 - * - * Copyright (C) 2007 Intel Corp - * Bibo Mao - * Huang Ying - * Copyright (C) 2012 Felipe Contreras - */ - -#if !defined(HAVE_USE_MS_ABI) -/* - * EFI calling conventions are documented at: - * http://msdn.microsoft.com/en-us/library/ms235286%28v=vs.80%29.aspx - * ELF calling conventions are documented at: - * http://www.x86-64.org/documentation/abi.pdf - * - * Basically here are the conversion rules: - * a) our function pointer is in %rdi - * b) rsi through r8 (elf) aka rcx through r9 (ms) require stack space - * on the MS side even though it's not getting used at all. - * c) 8(%rsp) is always aligned to 16 in ELF, so %rsp is shifted 8 bytes extra - * d) arguments are as follows: (elf -> ms) - * 1) rdi -> rcx (32 saved) - * 2) rsi -> rdx (32 saved) - * 3) rdx -> r8 (32 saved) - * 4) rcx -> r9 (32 saved) - * 5) r8 -> 32(%rsp) (32 saved) - * 6) r9 -> 40(%rsp) (48 saved) - * 7) 8(%rsp) -> 48(%rsp) (48 saved) - * 8) 16(%rsp) -> 56(%rsp) (64 saved) - * 9) 24(%rsp) -> 64(%rsp) (64 saved) - * 10) 32(%rsp) -> 72(%rsp) (80 saved) - * e) because the first argument we recieve in a thunker is actually the - * function to be called, arguments are offset as such: - * 0) rdi -> caller - * 1) rsi -> rcx (32 saved) - * 2) rdx -> rdx (32 saved) - * 3) rcx -> r8 (32 saved) - * 4) r8 -> r9 (32 saved) - * 5) r9 -> 32(%rsp) (32 saved) - * 6) 8(%rsp) -> 40(%rsp) (48 saved) - * 7) 16(%rsp) -> 48(%rsp) (48 saved) - * 8) 24(%rsp) -> 56(%rsp) (64 saved) - * 9) 32(%rsp) -> 64(%rsp) (64 saved) - * 10) 40(%rsp) -> 72(%rsp) (80 saved) - * f) arguments need to be moved in opposite order to avoid clobbering - */ - -#define ENTRY(name) \ - .globl name; \ - name: - -ENTRY(efi_call0) - subq $40, %rsp - call *%rdi - addq $40, %rsp - ret - -ENTRY(efi_call1) - subq $40, %rsp - mov %rsi, %rcx - call *%rdi - addq $40, %rsp - ret - -ENTRY(efi_call2) - subq $40, %rsp - /* mov %rdx, %rdx */ - mov %rsi, %rcx - call *%rdi - addq $40, %rsp - ret - -ENTRY(efi_call3) - subq $40, %rsp - mov %rcx, %r8 - /* mov %rdx, %rdx */ - mov %rsi, %rcx - call *%rdi - addq $40, %rsp - ret - -ENTRY(efi_call4) - subq $40, %rsp - mov %r8, %r9 - mov %rcx, %r8 - /* mov %rdx, %rdx */ - mov %rsi, %rcx - call *%rdi - addq $40, %rsp - ret - -ENTRY(efi_call5) - subq $40, %rsp - mov %r9, 32(%rsp) - mov %r8, %r9 - mov %rcx, %r8 - /* mov %rdx, %rdx */ - mov %rsi, %rcx - call *%rdi - addq $40, %rsp - ret - -ENTRY(efi_call6) - subq $56, %rsp - mov 56+8(%rsp), %rax - mov %rax, 40(%rsp) - mov %r9, 32(%rsp) - mov %r8, %r9 - mov %rcx, %r8 - /* mov %rdx, %rdx */ - mov %rsi, %rcx - call *%rdi - addq $56, %rsp - ret - -ENTRY(efi_call7) - subq $56, %rsp - mov 56+16(%rsp), %rax - mov %rax, 48(%rsp) - mov 56+8(%rsp), %rax - mov %rax, 40(%rsp) - mov %r9, 32(%rsp) - mov %r8, %r9 - mov %rcx, %r8 - /* mov %rdx, %rdx */ - mov %rsi, %rcx - call *%rdi - addq $56, %rsp - ret - -ENTRY(efi_call8) - subq $72, %rsp - mov 72+24(%rsp), %rax - mov %rax, 56(%rsp) - mov 72+16(%rsp), %rax - mov %rax, 48(%rsp) - mov 72+8(%rsp), %rax - mov %rax, 40(%rsp) - mov %r9, 32(%rsp) - mov %r8, %r9 - mov %rcx, %r8 - /* mov %rdx, %rdx */ - mov %rsi, %rcx - call *%rdi - addq $72, %rsp - ret - -ENTRY(efi_call9) - subq $72, %rsp - mov 72+32(%rsp), %rax - mov %rax, 64(%rsp) - mov 72+24(%rsp), %rax - mov %rax, 56(%rsp) - mov 72+16(%rsp), %rax - mov %rax, 48(%rsp) - mov 72+8(%rsp), %rax - mov %rax, 40(%rsp) - mov %r9, 32(%rsp) - mov %r8, %r9 - mov %rcx, %r8 - /* mov %rdx, %rdx */ - mov %rsi, %rcx - call *%rdi - addq $72, %rsp - ret - -ENTRY(efi_call10) - subq $88, %rsp - mov 88+40(%rsp), %rax - mov %rax, 72(%rsp) - mov 88+32(%rsp), %rax - mov %rax, 64(%rsp) - mov 88+24(%rsp), %rax - mov %rax, 56(%rsp) - mov 88+16(%rsp), %rax - mov %rax, 48(%rsp) - mov 88+8(%rsp), %rax - mov %rax, 40(%rsp) - mov %r9, 32(%rsp) - mov %r8, %r9 - mov %rcx, %r8 - /* mov %rdx, %rdx */ - mov %rsi, %rcx - call *%rdi - addq $88, %rsp - ret - -#endif - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/gnu-efi/lib/x86_64/initplat.c b/3rd/gnu-efi/lib/x86_64/initplat.c deleted file mode 100644 index 7c887a67b..000000000 --- a/3rd/gnu-efi/lib/x86_64/initplat.c +++ /dev/null @@ -1,27 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - initplat.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" - -VOID -InitializeLibPlatform ( - IN EFI_HANDLE ImageHandle EFI_UNUSED, - IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED - ) -{ -} - diff --git a/3rd/gnu-efi/lib/x86_64/math.c b/3rd/gnu-efi/lib/x86_64/math.c deleted file mode 100644 index aa024319a..000000000 --- a/3rd/gnu-efi/lib/x86_64/math.c +++ /dev/null @@ -1,181 +0,0 @@ -/*++ - -Copyright (c) 1998 Intel Corporation - -Module Name: - - math.c - -Abstract: - - - - -Revision History - ---*/ - -#include "lib.h" - - -// -// Declare runtime functions -// - -#ifdef RUNTIME_CODE -#ifndef __GNUC__ -#pragma RUNTIME_CODE(LShiftU64) -#pragma RUNTIME_CODE(RShiftU64) -#pragma RUNTIME_CODE(MultU64x32) -#pragma RUNTIME_CODE(DivU64x32) -#endif -#endif - -// -// -// - -UINT64 -LShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Left shift 64bit by 32bit and get a 64bit result -{ -#if defined(__GNUC__) || defined(_MSC_EXTENSIONS) - return Operand << Count; -#else - UINT64 Result; - _asm { - mov eax, dword ptr Operand[0] - mov edx, dword ptr Operand[4] - mov ecx, Count - and ecx, 63 - - shld edx, eax, cl - shl eax, cl - - cmp ecx, 32 - jc short ls10 - - mov edx, eax - xor eax, eax - -ls10: - mov dword ptr Result[0], eax - mov dword ptr Result[4], edx - } - - return Result; -#endif -} - -UINT64 -RShiftU64 ( - IN UINT64 Operand, - IN UINTN Count - ) -// Right shift 64bit by 32bit and get a 64bit result -{ -#if defined(__GNUC__) || defined(_MSC_EXTENSIONS) - return Operand >> Count; -#else - UINT64 Result; - _asm { - mov eax, dword ptr Operand[0] - mov edx, dword ptr Operand[4] - mov ecx, Count - and ecx, 63 - - shrd eax, edx, cl - shr edx, cl - - cmp ecx, 32 - jc short rs10 - - mov eax, edx - xor edx, edx - -rs10: - mov dword ptr Result[0], eax - mov dword ptr Result[4], edx - } - - return Result; -#endif -} - - -UINT64 -MultU64x32 ( - IN UINT64 Multiplicand, - IN UINTN Multiplier - ) -// Multiple 64bit by 32bit and get a 64bit result -{ -#if defined(__GNUC__) || defined(_MSC_EXTENSIONS) - return Multiplicand * Multiplier; -#else - UINT64 Result; - _asm { - mov eax, dword ptr Multiplicand[0] - mul Multiplier - mov dword ptr Result[0], eax - mov dword ptr Result[4], edx - mov eax, dword ptr Multiplicand[4] - mul Multiplier - add dword ptr Result[4], eax - } - - return Result; -#endif -} - -UINT64 -DivU64x32 ( - IN UINT64 Dividend, - IN UINTN Divisor, - OUT UINTN *Remainder OPTIONAL - ) -// divide 64bit by 32bit and get a 64bit result -// N.B. only works for 31bit divisors!! -{ -#if defined(__GNUC__) || defined(_MSC_EXTENSIONS) - if (Remainder) - *Remainder = Dividend % Divisor; - return Dividend / Divisor; -#else - UINT32 Rem; - UINT32 bit; - - ASSERT (Divisor != 0); - ASSERT ((Divisor >> 31) == 0); - - // - // For each bit in the dividend - // - - Rem = 0; - for (bit=0; bit < 64; bit++) { - _asm { - shl dword ptr Dividend[0], 1 ; shift rem:dividend left one - rcl dword ptr Dividend[4], 1 - rcl dword ptr Rem, 1 - - mov eax, Rem - cmp eax, Divisor ; Is Rem >= Divisor? - cmc ; No - do nothing - sbb eax, eax ; Else, - sub dword ptr Dividend[0], eax ; set low bit in dividen - and eax, Divisor ; and - sub Rem, eax ; subtract divisor - } - } - - if (Remainder) { - *Remainder = Rem; - } - - return Dividend; -#endif -} diff --git a/3rd/gnu-efi/lib/x86_64/setjmp.S b/3rd/gnu-efi/lib/x86_64/setjmp.S deleted file mode 100644 index 54efa6752..000000000 --- a/3rd/gnu-efi/lib/x86_64/setjmp.S +++ /dev/null @@ -1,45 +0,0 @@ - .text - .globl setjmp -#ifndef __MINGW32__ - .type setjmp, @function -#else - .def setjmp; .scl 2; .type 32; .endef -#endif -setjmp: - pop %rsi - movq %rbx,0x00(%rdi) - movq %rsp,0x08(%rdi) - push %rsi - movq %rbp,0x10(%rdi) - movq %r12,0x18(%rdi) - movq %r13,0x20(%rdi) - movq %r14,0x28(%rdi) - movq %r15,0x30(%rdi) - movq %rsi,0x38(%rdi) - xor %rax,%rax - ret - - .globl longjmp -#ifndef __MINGW32__ - .type longjmp, @function -#else - .def longjmp; .scl 2; .type 32; .endef -#endif -longjmp: - movl %esi, %eax - movq 0x00(%rdi), %rbx - movq 0x08(%rdi), %rsp - movq 0x10(%rdi), %rbp - movq 0x18(%rdi), %r12 - movq 0x20(%rdi), %r13 - movq 0x28(%rdi), %r14 - movq 0x30(%rdi), %r15 - xor %rdx,%rdx - mov $1,%rcx - cmp %rax,%rdx - cmove %rcx,%rax - jmp *0x38(%rdi) - -#if defined(__ELF__) && defined(__linux__) - .section .note.GNU-stack,"",%progbits -#endif diff --git a/3rd/opensbi/.clang-format b/3rd/opensbi/.clang-format deleted file mode 100644 index c80c0aa98..000000000 --- a/3rd/opensbi/.clang-format +++ /dev/null @@ -1,16 +0,0 @@ -AlignConsecutiveAssignments: true -AlignEscapedNewlines: Left -AlignTrailingComments: true -AllowShortFunctionsOnASingleLine: None -BraceWrapping: - AfterFunction: true -BreakBeforeBraces: Custom -BreakStringLiterals: false -ContinuationIndentWidth: 8 -Cpp11BracedListStyle: false -IndentWidth: 8 -ReflowComments: false -SortIncludes: false -SpacesInContainerLiterals: false -TabWidth: 8 -UseTab: Always diff --git a/3rd/opensbi/.gitignore b/3rd/opensbi/.gitignore deleted file mode 100644 index c11afd384..000000000 --- a/3rd/opensbi/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -# Object files -*.o -*.a -*.dep - -#Build & install directories -build/ -install/ - -# Development friendly files -tags -cscope* -*.swp diff --git a/3rd/opensbi/CONTRIBUTORS.md b/3rd/opensbi/CONTRIBUTORS.md deleted file mode 100644 index afae1251d..000000000 --- a/3rd/opensbi/CONTRIBUTORS.md +++ /dev/null @@ -1,27 +0,0 @@ - -List of OpenSBI Contributors (Alphabetically sorted) -==================================================== - -* **[Western Digital Corporation](https://www.wdc.com/)** - * Project initiator and maintainer - * Copyright (c) 2019 Western Digital Corporation or its affiliates - -* Alistair Francis - -* Andreas Schwab - -* Anup Patel - -* Atish Patra - -* Bin Meng - -* Damien Le Moal - -* Karsten Merker - -* Nick Kossifidis - -* Shawn Chang - -* Xiang Wang diff --git a/3rd/opensbi/COPYING.BSD b/3rd/opensbi/COPYING.BSD deleted file mode 100644 index 26972c8a4..000000000 --- a/3rd/opensbi/COPYING.BSD +++ /dev/null @@ -1,25 +0,0 @@ -The 2-Clause BSD License -SPDX short identifier: BSD-2-Clause - -Copyright (c) 2019 Western Digital Corporation or its affiliates and other -contributors. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3rd/opensbi/Kconfig b/3rd/opensbi/Kconfig deleted file mode 100644 index acfc13888..000000000 --- a/3rd/opensbi/Kconfig +++ /dev/null @@ -1,25 +0,0 @@ -# SPDX-License-Identifier: BSD-2-Clause - -mainmenu "OpenSBI $(OPENSBI_PLATFORM) Configuration" - -config OPENSBI_SRC_DIR - string - option env="OPENSBI_SRC_DIR" - -config OPENSBI_PLATFORM - string - option env="OPENSBI_PLATFORM" - -config OPENSBI_PLATFORM_SRC_DIR - string - option env="OPENSBI_PLATFORM_SRC_DIR" - -menu "Platform Options" -source "$(OPENSBI_PLATFORM_SRC_DIR)/Kconfig" -endmenu - -source "$(OPENSBI_SRC_DIR)/lib/sbi/Kconfig" - -source "$(OPENSBI_SRC_DIR)/lib/utils/Kconfig" - -source "$(OPENSBI_SRC_DIR)/firmware/Kconfig" diff --git a/3rd/opensbi/Makefile b/3rd/opensbi/Makefile deleted file mode 100644 index 92203c5a2..000000000 --- a/3rd/opensbi/Makefile +++ /dev/null @@ -1,677 +0,0 @@ -# -# SPDX-License-Identifier: BSD-2-Clause -# -# Copyright (c) 2019 Western Digital Corporation or its affiliates. -# -# Authors: -# Anup Patel -# - -# Select Make Options: -# o Do not use make's built-in rules -# o Do not print "Entering directory ..."; -MAKEFLAGS += -r --no-print-directory - -# Readlink -f requires GNU readlink -ifeq ($(shell uname -s),Darwin) -READLINK ?= greadlink -else -READLINK ?= readlink -endif - -# Find out source, build, and install directories -src_dir=$(CURDIR) -ifdef O - build_dir=$(shell $(READLINK) -f $(O)) -else - build_dir=$(CURDIR)/build -endif -ifeq ($(build_dir),$(CURDIR)) -$(error Build directory is same as source directory.) -endif -install_root_dir_default=$(CURDIR)/install -ifdef I - install_root_dir=$(shell $(READLINK) -f $(I)) -else - install_root_dir=$(install_root_dir_default)/usr -endif -ifeq ($(install_root_dir),$(CURDIR)) -$(error Install root directory is same as source directory.) -endif -ifeq ($(install_root_dir),$(build_dir)) -$(error Install root directory is same as build directory.) -endif -ifdef PLATFORM_DIR - platform_dir_path=$(shell $(READLINK) -f $(PLATFORM_DIR)) - ifdef PLATFORM - platform_parent_dir=$(platform_dir_path) - else - PLATFORM=$(shell basename $(platform_dir_path)) - platform_parent_dir=$(shell realpath ${platform_dir_path}/..) - endif -else - platform_parent_dir=$(src_dir)/platform -endif -ifndef PLATFORM_DEFCONFIG -PLATFORM_DEFCONFIG=defconfig -endif - -# Check if verbosity is ON for build process -CMD_PREFIX_DEFAULT := @ -ifeq ($(V), 1) - CMD_PREFIX := -else - CMD_PREFIX := $(CMD_PREFIX_DEFAULT) -endif - -# Setup path of directories -export platform_subdir=$(PLATFORM) -export platform_src_dir=$(platform_parent_dir)/$(platform_subdir) -export platform_build_dir=$(build_dir)/platform/$(platform_subdir) -export include_dir=$(CURDIR)/include -export libsbi_dir=$(CURDIR)/lib/sbi -export libsbiutils_dir=$(CURDIR)/lib/utils -export firmware_dir=$(CURDIR)/firmware - -# Setup variables for kconfig -ifdef PLATFORM -export PYTHONDONTWRITEBYTECODE=1 -export KCONFIG_DIR=$(platform_build_dir)/kconfig -export KCONFIG_AUTOLIST=$(KCONFIG_DIR)/auto.list -export KCONFIG_AUTOHEADER=$(KCONFIG_DIR)/autoconf.h -export KCONFIG_AUTOCMD=$(KCONFIG_DIR)/auto.conf.cmd -export KCONFIG_CONFIG=$(KCONFIG_DIR)/.config -# Additional exports for include paths in Kconfig files -export OPENSBI_SRC_DIR=$(src_dir) -export OPENSBI_PLATFORM=$(PLATFORM) -export OPENSBI_PLATFORM_SRC_DIR=$(platform_src_dir) -endif - -# Find library version -OPENSBI_VERSION_MAJOR=`grep "define OPENSBI_VERSION_MAJOR" $(include_dir)/sbi/sbi_version.h | sed 's/.*MAJOR.*\([0-9][0-9]*\)/\1/'` -OPENSBI_VERSION_MINOR=`grep "define OPENSBI_VERSION_MINOR" $(include_dir)/sbi/sbi_version.h | sed 's/.*MINOR.*\([0-9][0-9]*\)/\1/'` -OPENSBI_VERSION_GIT=$(shell if [ -d $(src_dir)/.git ]; then git describe 2> /dev/null; fi) - -# Setup compilation commands -ifneq ($(LLVM),) -CC = clang -AR = llvm-ar -LD = ld.lld -OBJCOPY = llvm-objcopy -else -ifdef CROSS_COMPILE -CC = $(CROSS_COMPILE)gcc -AR = $(CROSS_COMPILE)ar -LD = $(CROSS_COMPILE)ld -OBJCOPY = $(CROSS_COMPILE)objcopy -else -CC ?= gcc -AR ?= ar -LD ?= ld -OBJCOPY ?= objcopy -endif -endif -CPP = $(CC) -E -AS = $(CC) -DTC = dtc - -ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) -CC_IS_CLANG = y -else -CC_IS_CLANG = n -endif - -ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),) -LD_IS_LLD = y -else -LD_IS_LLD = n -endif - -ifeq ($(CC_IS_CLANG),y) -ifneq ($(CROSS_COMPILE),) -CLANG_TARGET = --target=$(notdir $(CROSS_COMPILE:%-=%)) -endif -endif - -# Guess the compiler's XLEN -OPENSBI_CC_XLEN := $(shell TMP=`$(CC) $(CLANG_TARGET) -dumpmachine | sed 's/riscv\([0-9][0-9]\).*/\1/'`; echo $${TMP}) - -# Guess the compiler's ABI and ISA -ifneq ($(CC_IS_CLANG),y) -OPENSBI_CC_ABI := $(shell TMP=`$(CC) -v 2>&1 | sed -n 's/.*\(with\-abi=\([a-zA-Z0-9]*\)\).*/\2/p'`; echo $${TMP}) -OPENSBI_CC_ISA := $(shell TMP=`$(CC) -v 2>&1 | sed -n 's/.*\(with\-arch=\([a-zA-Z0-9]*\)\).*/\2/p'`; echo $${TMP}) -endif - -# Setup platform XLEN -ifndef PLATFORM_RISCV_XLEN - ifeq ($(OPENSBI_CC_XLEN), 32) - PLATFORM_RISCV_XLEN = 32 - else - PLATFORM_RISCV_XLEN = 64 - endif -endif - -ifeq ($(CC_IS_CLANG),y) -ifeq ($(CROSS_COMPILE),) -CLANG_TARGET = --target=riscv$(PLATFORM_RISCV_XLEN)-unknown-elf -endif -endif - -ifeq ($(LD_IS_LLD),y) -RELAX_FLAG = -mno-relax -USE_LD_FLAG = -fuse-ld=lld -else -USE_LD_FLAG = -fuse-ld=bfd -endif - -# Check whether the linker supports creating PIEs -OPENSBI_LD_PIE := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) $(USE_LD_FLAG) -fPIE -nostdlib -Wl,-pie -x c /dev/null -o /dev/null >/dev/null 2>&1 && echo y || echo n) - -# Check whether the compiler supports -m(no-)save-restore -CC_SUPPORT_SAVE_RESTORE := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) -nostdlib -mno-save-restore -x c /dev/null -o /dev/null 2>&1 | grep "\-save\-restore" >/dev/null && echo n || echo y) - -# Check whether the assembler and the compiler support the Zicsr and Zifencei extensions -CC_SUPPORT_ZICSR_ZIFENCEI := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) -nostdlib -march=rv$(OPENSBI_CC_XLEN)imafd_zicsr_zifencei -x c /dev/null -o /dev/null 2>&1 | grep "zicsr\|zifencei" > /dev/null && echo n || echo y) - -# Build Info: -# OPENSBI_BUILD_TIME_STAMP -- the compilation time stamp -# OPENSBI_BUILD_COMPILER_VERSION -- the compiler version info -BUILD_INFO ?= n -ifeq ($(BUILD_INFO),y) -OPENSBI_BUILD_DATE_FMT = +%Y-%m-%d %H:%M:%S %z -ifdef SOURCE_DATE_EPOCH - OPENSBI_BUILD_TIME_STAMP ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" \ - "$(OPENSBI_BUILD_DATE_FMT)" 2>/dev/null || \ - date -u -r "$(SOURCE_DATE_EPOCH)" \ - "$(OPENSBI_BUILD_DATE_FMT)" 2>/dev/null || \ - date -u "$(OPENSBI_BUILD_DATE_FMT)") -else - OPENSBI_BUILD_TIME_STAMP ?= $(shell date "$(OPENSBI_BUILD_DATE_FMT)") -endif -OPENSBI_BUILD_COMPILER_VERSION=$(shell $(CC) -v 2>&1 | grep ' version ' | \ - sed 's/[[:space:]]*$$//') -endif - -# Setup list of objects.mk files -ifdef PLATFORM -platform-object-mks=$(shell if [ -d $(platform_src_dir)/ ]; then find $(platform_src_dir) -iname "objects.mk" | sort -r; fi) -endif -libsbi-object-mks=$(shell if [ -d $(libsbi_dir) ]; then find $(libsbi_dir) -iname "objects.mk" | sort -r; fi) -libsbiutils-object-mks=$(shell if [ -d $(libsbiutils_dir) ]; then find $(libsbiutils_dir) -iname "objects.mk" | sort -r; fi) -firmware-object-mks=$(shell if [ -d $(firmware_dir) ]; then find $(firmware_dir) -iname "objects.mk" | sort -r; fi) - -# The "make all" rule should always be first rule -.PHONY: all -all: - -# Include platform specific .config -ifdef PLATFORM -.PHONY: menuconfig -menuconfig: $(platform_src_dir)/Kconfig $(src_dir)/Kconfig - $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) - $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/menuconfig.py $(src_dir)/Kconfig - $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/genconfig.py --header-path $(KCONFIG_AUTOHEADER) --sync-deps $(KCONFIG_DIR) --file-list $(KCONFIG_AUTOLIST) $(src_dir)/Kconfig - -.PHONY: savedefconfig -savedefconfig: $(platform_src_dir)/Kconfig $(src_dir)/Kconfig - $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) - $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/savedefconfig.py --kconfig $(src_dir)/Kconfig --out $(KCONFIG_DIR)/defconfig - -$(KCONFIG_CONFIG): $(platform_src_dir)/configs/$(PLATFORM_DEFCONFIG) $(platform_src_dir)/Kconfig $(src_dir)/Kconfig - $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) - $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/defconfig.py --kconfig $(src_dir)/Kconfig $(platform_src_dir)/configs/$(PLATFORM_DEFCONFIG) - $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/genconfig.py --header-path $(KCONFIG_AUTOHEADER) --sync-deps $(KCONFIG_DIR) --file-list $(KCONFIG_AUTOLIST) $(src_dir)/Kconfig - -$(KCONFIG_AUTOCMD): $(KCONFIG_CONFIG) - $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) - $(CMD_PREFIX)printf "%s: " $(KCONFIG_CONFIG) > $(KCONFIG_AUTOCMD) - $(CMD_PREFIX)cat $(KCONFIG_AUTOLIST) | tr '\n' ' ' >> $(KCONFIG_AUTOCMD) - -include $(KCONFIG_CONFIG) -include $(KCONFIG_AUTOCMD) -endif - -# Include all objects.mk files -ifdef PLATFORM -include $(platform-object-mks) -endif -include $(libsbi-object-mks) -include $(libsbiutils-object-mks) -include $(firmware-object-mks) - -# Setup list of objects -libsbi-objs-path-y=$(foreach obj,$(libsbi-objs-y),$(build_dir)/lib/sbi/$(obj)) -ifdef PLATFORM -libsbiutils-objs-path-y=$(foreach obj,$(libsbiutils-objs-y),$(platform_build_dir)/lib/utils/$(obj)) -platform-objs-path-y=$(foreach obj,$(platform-objs-y),$(platform_build_dir)/$(obj)) -firmware-bins-path-y=$(foreach bin,$(firmware-bins-y),$(platform_build_dir)/firmware/$(bin)) -endif -firmware-elfs-path-y=$(firmware-bins-path-y:.bin=.elf) -firmware-objs-path-y=$(firmware-bins-path-y:.bin=.o) - -# Setup list of deps files for objects -deps-y=$(platform-objs-path-y:.o=.dep) -deps-y+=$(libsbi-objs-path-y:.o=.dep) -deps-y+=$(libsbiutils-objs-path-y:.o=.dep) -deps-y+=$(firmware-objs-path-y:.o=.dep) - -# Setup platform ABI, ISA and Code Model -ifndef PLATFORM_RISCV_ABI - ifneq ($(PLATFORM_RISCV_TOOLCHAIN_DEFAULT), 1) - ifeq ($(PLATFORM_RISCV_XLEN), 32) - PLATFORM_RISCV_ABI = ilp$(PLATFORM_RISCV_XLEN) - else - PLATFORM_RISCV_ABI = lp$(PLATFORM_RISCV_XLEN) - endif - else - PLATFORM_RISCV_ABI = $(OPENSBI_CC_ABI) - endif -endif -ifndef PLATFORM_RISCV_ISA - ifneq ($(PLATFORM_RISCV_TOOLCHAIN_DEFAULT), 1) - ifeq ($(CC_SUPPORT_ZICSR_ZIFENCEI), y) - PLATFORM_RISCV_ISA = rv$(PLATFORM_RISCV_XLEN)imafdc_zicsr_zifencei - else - PLATFORM_RISCV_ISA = rv$(PLATFORM_RISCV_XLEN)imafdc - endif - else - PLATFORM_RISCV_ISA = $(OPENSBI_CC_ISA) - endif -endif -ifndef PLATFORM_RISCV_CODE_MODEL - PLATFORM_RISCV_CODE_MODEL = medany -endif - -# Setup install directories -ifdef INSTALL_INCLUDE_PATH - install_include_path=$(INSTALL_INCLUDE_PATH) -else - install_include_path=include -endif -ifdef INSTALL_LIB_PATH - install_lib_path=$(INSTALL_LIB_PATH) -else - ifneq ($(origin INSTALL_LIB_SUBDIR), undefined) - install_lib_subdir=$(INSTALL_LIB_SUBDIR) - else - install_lib_subdir=$(PLATFORM_RISCV_ABI) - endif - install_lib_path=lib$(subst 32,,$(PLATFORM_RISCV_XLEN))/$(install_lib_subdir) -endif -ifdef INSTALL_FIRMWARE_PATH - install_firmware_path=$(INSTALL_FIRMWARE_PATH) -else - install_firmware_path=share/opensbi/$(PLATFORM_RISCV_ABI) -endif -ifdef INSTALL_DOCS_PATH - install_docs_path=$(INSTALL_DOCS_PATH) -else - install_docs_path=share/opensbi/docs -endif - -# Setup compilation commands flags -ifeq ($(CC_IS_CLANG),y) -GENFLAGS += $(CLANG_TARGET) -GENFLAGS += -Wno-unused-command-line-argument -endif -GENFLAGS += -I$(platform_src_dir)/include -GENFLAGS += -I$(include_dir) -ifneq ($(OPENSBI_VERSION_GIT),) -GENFLAGS += -DOPENSBI_VERSION_GIT="\"$(OPENSBI_VERSION_GIT)\"" -endif -ifeq ($(BUILD_INFO),y) -GENFLAGS += -DOPENSBI_BUILD_TIME_STAMP="\"$(OPENSBI_BUILD_TIME_STAMP)\"" -GENFLAGS += -DOPENSBI_BUILD_COMPILER_VERSION="\"$(OPENSBI_BUILD_COMPILER_VERSION)\"" -endif -ifdef PLATFORM -GENFLAGS += -include $(KCONFIG_AUTOHEADER) -endif -GENFLAGS += $(libsbiutils-genflags-y) -GENFLAGS += $(platform-genflags-y) -GENFLAGS += $(firmware-genflags-y) - -CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing -O2 -CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls -mstrict-align -# enable -m(no-)save-restore option by CC_SUPPORT_SAVE_RESTORE -ifeq ($(CC_SUPPORT_SAVE_RESTORE),y) -CFLAGS += -mno-save-restore -endif -CFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA) -CFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL) -CFLAGS += $(RELAX_FLAG) -CFLAGS += $(GENFLAGS) -CFLAGS += $(platform-cflags-y) -CFLAGS += -fno-pie -no-pie -CFLAGS += $(firmware-cflags-y) - -CPPFLAGS += $(GENFLAGS) -CPPFLAGS += $(platform-cppflags-y) -CPPFLAGS += $(firmware-cppflags-y) - -ASFLAGS = -g -Wall -nostdlib -ASFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls -mstrict-align -# enable -m(no-)save-restore option by CC_SUPPORT_SAVE_RESTORE -ifeq ($(CC_SUPPORT_SAVE_RESTORE),y) -ASFLAGS += -mno-save-restore -endif -ASFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA) -ASFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL) -ASFLAGS += $(RELAX_FLAG) -ifneq ($(CC_IS_CLANG),y) -ifneq ($(RELAX_FLAG),) -ASFLAGS += -Wa,$(RELAX_FLAG) -endif -endif -ASFLAGS += $(GENFLAGS) -ASFLAGS += $(platform-asflags-y) -ASFLAGS += $(firmware-asflags-y) - -ARFLAGS = rcs - -ELFFLAGS += $(USE_LD_FLAG) -ELFFLAGS += -Wl,--build-id=none -Wl,-N -ELFFLAGS += $(platform-ldflags-y) -ELFFLAGS += $(firmware-ldflags-y) - -MERGEFLAGS += -r -ifeq ($(LD_IS_LLD),y) -MERGEFLAGS += -b elf -else -MERGEFLAGS += -b elf$(PLATFORM_RISCV_XLEN)-littleriscv -endif -MERGEFLAGS += -m elf$(PLATFORM_RISCV_XLEN)lriscv - -DTSCPPFLAGS = $(CPPFLAGS) -nostdinc -nostdlib -fno-builtin -D__DTS__ -x assembler-with-cpp - -# Setup functions for compilation -define dynamic_flags --I$(shell dirname $(2)) -D__OBJNAME__=$(subst -,_,$(shell basename $(1) .o)) -endef -merge_objs = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " MERGE $(subst $(build_dir)/,,$(1))"; \ - $(LD) $(MERGEFLAGS) $(2) -o $(1) -merge_deps = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " MERGE-DEP $(subst $(build_dir)/,,$(1))"; \ - cat $(2) > $(1) -copy_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " COPY $(subst $(build_dir)/,,$(1))"; \ - cp -f $(2) $(1) -inst_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -f $(2) $(1) -inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ - mkdir -p $(1)/$(3); \ - for file in $(4) ; do \ - rel_file=`echo $$file | sed -e 's@$(2)/$(subst $(install_firmware_path),platform,$(3))@@'`; \ - dest_file=$(1)"/"$(3)"/"`echo $$rel_file`; \ - dest_dir=`dirname $$dest_file`; \ - echo " INSTALL "$(3)"/"`echo $$rel_file`; \ - mkdir -p $$dest_dir; \ - cp -f $$file $$dest_file; \ - done \ - fi -inst_header_dir = $(CMD_PREFIX)mkdir -p $(1); \ - echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -rf $(2) $(1) -compile_cpp = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " CPP $(subst $(build_dir)/,,$(1))"; \ - $(CPP) $(CPPFLAGS) -x c $(2) | grep -v "\#" > $(1) -compile_cc_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " CC-DEP $(subst $(build_dir)/,,$(1))"; \ - printf %s `dirname $(1)`/ > $(1) && \ - $(CC) $(CFLAGS) $(call dynamic_flags,$(1),$(2)) \ - -MM $(2) >> $(1) || rm -f $(1) -compile_cc = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " CC $(subst $(build_dir)/,,$(1))"; \ - $(CC) $(CFLAGS) $(call dynamic_flags,$(1),$(2)) -c $(2) -o $(1) -compile_as_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " AS-DEP $(subst $(build_dir)/,,$(1))"; \ - printf %s `dirname $(1)`/ > $(1) && \ - $(AS) $(ASFLAGS) $(call dynamic_flags,$(1),$(2)) \ - -MM $(2) >> $(1) || rm -f $(1) -compile_as = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " AS $(subst $(build_dir)/,,$(1))"; \ - $(AS) $(ASFLAGS) $(call dynamic_flags,$(1),$(2)) -c $(2) -o $(1) -compile_elf = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " ELF $(subst $(build_dir)/,,$(1))"; \ - $(CC) $(CFLAGS) $(3) $(ELFFLAGS) -Wl,-T$(2) -o $(1) -compile_ar = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " AR $(subst $(build_dir)/,,$(1))"; \ - $(AR) $(ARFLAGS) $(1) $(2) -compile_objcopy = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " OBJCOPY $(subst $(build_dir)/,,$(1))"; \ - $(OBJCOPY) -S -O binary $(2) $(1) -compile_dts = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " DTC $(subst $(build_dir)/,,$(1))"; \ - $(CPP) $(DTSCPPFLAGS) $(2) | $(DTC) -O dtb -i `dirname $(2)` -o $(1) -compile_d2c = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " D2C $(subst $(build_dir)/,,$(1))"; \ - $(if $($(2)-varalign-$(3)),$(eval D2C_ALIGN_BYTES := $($(2)-varalign-$(3))),$(eval D2C_ALIGN_BYTES := $(4))) \ - $(if $($(2)-varprefix-$(3)),$(eval D2C_NAME_PREFIX := $($(2)-varprefix-$(3))),$(eval D2C_NAME_PREFIX := $(5))) \ - $(if $($(2)-padding-$(3)),$(eval D2C_PADDING_BYTES := $($(2)-padding-$(3))),$(eval D2C_PADDING_BYTES := 0)) \ - $(src_dir)/scripts/d2c.sh -i $(6) -a $(D2C_ALIGN_BYTES) -p $(D2C_NAME_PREFIX) -t $(D2C_PADDING_BYTES) > $(1) -compile_carray = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " CARRAY $(subst $(build_dir)/,,$(1))"; \ - $(eval CARRAY_VAR_LIST := $(carray-$(subst .c,,$(shell basename $(1)))-y)) \ - $(src_dir)/scripts/carray.sh -i $(2) -l "$(CARRAY_VAR_LIST)" > $(1) -compile_gen_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ - echo " GEN-DEP $(subst $(build_dir)/,,$(1))"; \ - echo "$(1:.dep=$(2)): $(3)" >> $(1) - -targets-y = $(build_dir)/lib/libsbi.a -ifdef PLATFORM -targets-y += $(platform_build_dir)/lib/libplatsbi.a -endif -targets-y += $(firmware-bins-path-y) - -# The default "make all" rule -.PHONY: all -all: $(targets-y) - -# Preserve all intermediate files -.SECONDARY: - -# Rules for lib/sbi sources -$(build_dir)/lib/libsbi.a: $(libsbi-objs-path-y) - $(call compile_ar,$@,$^) - -$(platform_build_dir)/lib/libplatsbi.a: $(libsbi-objs-path-y) $(libsbiutils-objs-path-y) $(platform-objs-path-y) - $(call compile_ar,$@,$^) - -$(build_dir)/%.dep: $(src_dir)/%.carray $(KCONFIG_CONFIG) - $(call compile_gen_dep,$@,.c,$< $(KCONFIG_CONFIG)) - $(call compile_gen_dep,$@,.o,$(@:.dep=.c)) - -$(build_dir)/%.c: $(src_dir)/%.carray - $(call compile_carray,$@,$<) - -$(build_dir)/%.dep: $(src_dir)/%.c $(KCONFIG_CONFIG) - $(call compile_cc_dep,$@,$<) - -$(build_dir)/%.o: $(src_dir)/%.c - $(call compile_cc,$@,$<) - -$(build_dir)/%.o: $(build_dir)/%.c - $(call compile_cc,$@,$<) - -ifeq ($(BUILD_INFO),y) -$(build_dir)/lib/sbi/sbi_init.o: $(libsbi_dir)/sbi_init.c FORCE - $(call compile_cc,$@,$<) -endif - -$(build_dir)/%.dep: $(src_dir)/%.S $(KCONFIG_CONFIG) - $(call compile_as_dep,$@,$<) - -$(build_dir)/%.o: $(src_dir)/%.S - $(call compile_as,$@,$<) - -# Rules for platform sources -$(platform_build_dir)/%.dep: $(platform_src_dir)/%.carray $(KCONFIG_CONFIG) - $(call compile_gen_dep,$@,.c,$< $(KCONFIG_CONFIG)) - $(call compile_gen_dep,$@,.o,$(@:.dep=.c)) - -$(platform_build_dir)/%.c: $(platform_src_dir)/%.carray - $(call compile_carray,$@,$<) - -$(platform_build_dir)/%.dep: $(platform_src_dir)/%.c $(KCONFIG_CONFIG) - $(call compile_cc_dep,$@,$<) - -$(platform_build_dir)/%.o: $(platform_src_dir)/%.c $(KCONFIG_CONFIG) - $(call compile_cc,$@,$<) - -$(platform_build_dir)/%.dep: $(platform_src_dir)/%.S - $(call compile_as_dep,$@,$<) - -$(platform_build_dir)/%.o: $(platform_src_dir)/%.S - $(call compile_as,$@,$<) - -$(platform_build_dir)/%.dep: $(platform_src_dir)/%.dts $(KCONFIG_CONFIG) - $(call compile_gen_dep,$@,.dtb,$< $(KCONFIG_CONFIG)) - $(call compile_gen_dep,$@,.c,$(@:.dep=.dtb)) - $(call compile_gen_dep,$@,.o,$(@:.dep=.c)) - -$(platform_build_dir)/%.c: $(platform_build_dir)/%.dtb - $(call compile_d2c,$@,platform,$(subst .dtb,.o,$(subst /,-,$(subst $(platform_build_dir)/,,$<))),16,dt,$<) - -$(platform_build_dir)/%.dtb: $(platform_src_dir)/%.dts - $(call compile_dts,$@,$<) - -# Rules for lib/utils and firmware sources -$(platform_build_dir)/%.bin: $(platform_build_dir)/%.elf - $(call compile_objcopy,$@,$<) - -$(platform_build_dir)/%.elf: $(platform_build_dir)/%.o $(platform_build_dir)/%.elf.ld $(platform_build_dir)/lib/libplatsbi.a - $(call compile_elf,$@,$@.ld,$< $(platform_build_dir)/lib/libplatsbi.a) - -$(platform_build_dir)/%.ld: $(src_dir)/%.ldS - $(call compile_cpp,$@,$<) - -$(platform_build_dir)/%.dep: $(src_dir)/%.carray $(KCONFIG_CONFIG) - $(call compile_gen_dep,$@,.c,$< $(KCONFIG_CONFIG)) - $(call compile_gen_dep,$@,.o,$(@:.dep=.c)) - -$(platform_build_dir)/%.c: $(src_dir)/%.carray - $(call compile_carray,$@,$<) - -$(platform_build_dir)/%.dep: $(src_dir)/%.c $(KCONFIG_CONFIG) - $(call compile_cc_dep,$@,$<) - -$(platform_build_dir)/%.o: $(src_dir)/%.c - $(call compile_cc,$@,$<) - -$(platform_build_dir)/%.dep: $(src_dir)/%.S $(KCONFIG_CONFIG) - $(call compile_as_dep,$@,$<) - -$(platform_build_dir)/%.o: $(src_dir)/%.S - $(call compile_as,$@,$<) - -# Rule for "make docs" -$(build_dir)/docs/latex/refman.pdf: $(build_dir)/docs/latex/refman.tex - $(CMD_PREFIX)mkdir -p $(build_dir)/docs - $(CMD_PREFIX)$(MAKE) -C $(build_dir)/docs/latex -$(build_dir)/docs/latex/refman.tex: $(build_dir)/docs/doxygen.cfg - $(CMD_PREFIX)mkdir -p $(build_dir)/docs - $(CMD_PREFIX)doxygen $(build_dir)/docs/doxygen.cfg -$(build_dir)/docs/doxygen.cfg: $(src_dir)/docs/doxygen.cfg - $(CMD_PREFIX)mkdir -p $(build_dir)/docs - $(CMD_PREFIX)cat docs/doxygen.cfg | sed -e "s#@@SRC_DIR@@#$(src_dir)#" -e "s#@@BUILD_DIR@@#$(build_dir)#" -e "s#@@OPENSBI_MAJOR@@#$(OPENSBI_VERSION_MAJOR)#" -e "s#@@OPENSBI_MINOR@@#$(OPENSBI_VERSION_MINOR)#" > $(build_dir)/docs/doxygen.cfg -.PHONY: docs -docs: $(build_dir)/docs/latex/refman.pdf - -# Dependency files should only be included after default Makefile rules -# They should not be included for any "xxxconfig" or "xxxclean" rule -all-deps-1 = $(if $(findstring config,$(MAKECMDGOALS)),,$(deps-y)) -all-deps-2 = $(if $(findstring clean,$(MAKECMDGOALS)),,$(all-deps-1)) --include $(all-deps-2) - -# Include external dependency of firmwares after default Makefile rules -include $(src_dir)/firmware/external_deps.mk - -# Convenient "make run" command for emulated platforms -.PHONY: run -run: all -ifneq ($(platform-runcmd),) - $(platform-runcmd) $(RUN_ARGS) -else -ifdef PLATFORM - @echo "Platform $(PLATFORM) doesn't specify a run command" - @false -else - @echo Run command only available when targeting a platform - @false -endif -endif - -install_targets-y = install_libsbi -ifdef PLATFORM -install_targets-y += install_libplatsbi -install_targets-y += install_firmwares -endif - -# Rule for "make install" -.PHONY: install -install: $(install_targets-y) - -.PHONY: install_libsbi -install_libsbi: $(build_dir)/lib/libsbi.a - $(call inst_header_dir,$(install_root_dir)/$(install_include_path),$(include_dir)/sbi) - $(call inst_file,$(install_root_dir)/$(install_lib_path)/libsbi.a,$(build_dir)/lib/libsbi.a) - -.PHONY: install_libplatsbi -install_libplatsbi: $(platform_build_dir)/lib/libplatsbi.a $(build_dir)/lib/libsbi.a - $(call inst_file,$(install_root_dir)/$(install_lib_path)/opensbi/$(platform_subdir)/lib/libplatsbi.a,$(platform_build_dir)/lib/libplatsbi.a) - -.PHONY: install_firmwares -install_firmwares: $(platform_build_dir)/lib/libplatsbi.a $(build_dir)/lib/libsbi.a $(firmware-bins-path-y) - $(call inst_file_list,$(install_root_dir),$(build_dir),$(install_firmware_path)/$(platform_subdir)/firmware,$(firmware-elfs-path-y)) - $(call inst_file_list,$(install_root_dir),$(build_dir),$(install_firmware_path)/$(platform_subdir)/firmware,$(firmware-bins-path-y)) - -.PHONY: install_docs -install_docs: $(build_dir)/docs/latex/refman.pdf - $(call inst_file,$(install_root_dir)/$(install_docs_path)/refman.pdf,$(build_dir)/docs/latex/refman.pdf) - -.PHONY: cscope -cscope: - $(CMD_PREFIX)find \ - "$(src_dir)/firmware" \ - "$(src_dir)/include" \ - "$(src_dir)/lib" \ - "$(platform_src_dir)" \ - -name "*.[chS]" -print > cscope.files - $(CMD_PREFIX)echo "$(KCONFIG_AUTOHEADER)" >> cscope.files - $(CMD_PREFIX)cscope -bkq -i cscope.files -f cscope.out - -# Rule for "make clean" -.PHONY: clean -clean: - $(CMD_PREFIX)mkdir -p $(build_dir) - $(if $(V), @echo " RM $(build_dir)/*.o") - $(CMD_PREFIX)find $(build_dir) -type f -name "*.o" -exec rm -rf {} + - $(if $(V), @echo " RM $(build_dir)/*.a") - $(CMD_PREFIX)find $(build_dir) -type f -name "*.a" -exec rm -rf {} + - $(if $(V), @echo " RM $(build_dir)/*.elf") - $(CMD_PREFIX)find $(build_dir) -type f -name "*.elf" -exec rm -rf {} + - $(if $(V), @echo " RM $(build_dir)/*.bin") - $(CMD_PREFIX)find $(build_dir) -type f -name "*.bin" -exec rm -rf {} + - $(if $(V), @echo " RM $(build_dir)/*.dtb") - $(CMD_PREFIX)find $(build_dir) -type f -name "*.dtb" -exec rm -rf {} + - -# Rule for "make distclean" -.PHONY: distclean -distclean: clean - $(CMD_PREFIX)mkdir -p $(build_dir) - $(if $(V), @echo " RM $(build_dir)/*.dep") - $(CMD_PREFIX)find $(build_dir) -type f -name "*.dep" -exec rm -rf {} + -ifeq ($(build_dir),$(CURDIR)/build) - $(if $(V), @echo " RM $(build_dir)") - $(CMD_PREFIX)rm -rf $(build_dir) -endif -ifeq ($(install_root_dir),$(install_root_dir_default)/usr) - $(if $(V), @echo " RM $(install_root_dir_default)") - $(CMD_PREFIX)rm -rf $(install_root_dir_default) -endif - $(if $(V), @echo " RM $(src_dir)/cscope*") - $(CMD_PREFIX)rm -f $(src_dir)/cscope* - -.PHONY: FORCE -FORCE: diff --git a/3rd/opensbi/README.md b/3rd/opensbi/README.md deleted file mode 100644 index 895bbf27a..000000000 --- a/3rd/opensbi/README.md +++ /dev/null @@ -1,383 +0,0 @@ -RISC-V Open Source Supervisor Binary Interface (OpenSBI) -======================================================== - -Copyright and License ---------------------- - -The OpenSBI project is copyright (c) 2019 Western Digital Corporation -or its affiliates and other contributors. - -It is distributed under the terms of the BSD 2-clause license -("Simplified BSD License" or "FreeBSD License", SPDX: *BSD-2-Clause*). -A copy of this license with OpenSBI copyright can be found in the file -[COPYING.BSD]. - -All source files in OpenSBI contain the 2-Clause BSD license SPDX short -identifier in place of the full license text. - -``` -SPDX-License-Identifier: BSD-2-Clause -``` - -This enables machine processing of license information based on the SPDX -License Identifiers that are available on the [SPDX] web site. - -OpenSBI source code also contains code reused from other projects as listed -below. The original license text of these projects is included in the source -files where the reused code is present. - -* The libfdt source code is disjunctively dual licensed - (GPL-2.0+ OR BSD-2-Clause). Some of this project code is used in OpenSBI - under the terms of the BSD 2-Clause license. Any contributions to this - code must be made under the terms of both licenses. - -See also the [third party notices] file for more information. - -Introduction ------------- - -The **RISC-V Supervisor Binary Interface (SBI)** is the recommended interface -between: - -1. A platform-specific firmware running in M-mode and a bootloader, a - hypervisor or a general-purpose OS executing in S-mode or HS-mode. -2. A hypervisor running in HS-mode and a bootloader or a general-purpose OS - executing in VS-mode. - -The *RISC-V SBI specification* is maintained as an independent project by the -RISC-V Foundation on [Github]. - -The goal of the OpenSBI project is to provide an open-source reference -implementation of the RISC-V SBI specifications for platform-specific firmwares -executing in M-mode (case 1 mentioned above). An OpenSBI implementation can be -easily extended by RISC-V platform and system-on-chip vendors to fit a -particular hardware configuration. - -The main component of OpenSBI is provided in the form of a platform-independent -static library **libsbi.a** implementing the SBI interface. A firmware or -bootloader implementation can link against this library to ensure conformance -with the SBI interface specifications. *libsbi.a* also defines an interface for -integrating with platform-specific operations provided by the platform firmware -implementation (e.g. console access functions, inter-processor interrupt -control, etc). - -To illustrate the use of the *libsbi.a* library, OpenSBI also provides a set of -platform-specific support examples. For each example, a platform-specific -static library *libplatsbi.a* can be compiled. This library implements -SBI call processing by integrating *libsbi.a* with the necessary -platform-dependent hardware manipulation functions. For all supported platforms, -OpenSBI also provides several runtime firmware examples built using the platform -*libplatsbi.a*. These example firmwares can be used to replace the legacy -*riscv-pk* bootloader (aka BBL) and enable the use of well-known bootloaders -such as [U-Boot]. - -Supported SBI version ---------------------- -Currently, OpenSBI fully supports SBI specification *v0.2*. OpenSBI also -supports Hart State Management (HSM) SBI extension starting from OpenSBI v0.7. -HSM extension allows S-mode software to boot all the harts a defined order -rather than legacy method of random booting of harts. As a result, many -required features such as CPU hotplug, kexec/kdump can also be supported easily -in S-mode. HSM extension in OpenSBI is implemented in a non-backward compatible -manner to reduce the maintenance burden and avoid confusion. That's why, any -S-mode software using OpenSBI will not be able to boot more than 1 hart if HSM -extension is not supported in S-mode. - -Linux kernel already supports SBI v0.2 and HSM SBI extension starting from -**v5.7-rc1**. If you are using an Linux kernel older than **5.7-rc1** or any -other S-mode software without HSM SBI extension, you should stick to OpenSBI -v0.6 to boot all the harts. For a UMP systems, it doesn't matter. - -N.B. Any S-mode boot loader (i.e. U-Boot) doesn't need to support HSM extension, -as it doesn't need to boot all the harts. The operating system should be -capable enough to bring up all other non-booting harts using HSM extension. - -Required Toolchain and Packages -------------------------------- - -OpenSBI can be compiled natively or cross-compiled on a x86 host. For -cross-compilation, you can build your own toolchain, download a prebuilt one -from the [Bootlin toolchain repository] or install a distribution-provided -toolchain; if you opt to use LLVM/Clang, most distribution toolchains will -support cross-compiling for RISC-V using the same toolchain as your native -LLVM/Clang toolchain due to LLVM's ability to support multiple backends in the -same binary, so is often an easy way to obtain a working cross-compilation -toolchain. - -Basically, we prefer toolchains with Position Independent Executable (PIE) -support like *riscv64-linux-gnu-gcc*, *riscv64-unknown-freebsd-gcc*, or -*Clang/LLVM* as they generate PIE firmware images that can run at arbitrary -address with appropriate alignment. If a bare-metal GNU toolchain (e.g. -*riscv64-unknown-elf-gcc*) is used, static linked firmware images are -generated instead. *Clang/LLVM* can still generate PIE images if a bare-metal -triple is used (e.g. *-target riscv64-unknown-elf*). - -Please note that only a 64-bit version of the toolchain is available in -the Bootlin toolchain repository for now. - -In addition to a toolchain, OpenSBI also requires the following packages on -the host: - -1. device-tree-compiler: The device tree compiler for compiling device - tree sources (DTS files). -2. python3: The python 3.0 (or compatible) language support for various - scripts. - -Building and Installing the OpenSBI Platform-Independent Library ----------------------------------------------------------------- - -The OpenSBI platform-independent static library *libsbi.a* can be compiled -natively or it can be cross-compiled on a host with a different base -architecture than RISC-V. - -For cross-compiling, the environment variable *CROSS_COMPILE* must be defined -to specify the name prefix of the RISC-V compiler toolchain executables, e.g. -*riscv64-linux-gnu-* if the gcc executable used is *riscv64-linux-gnu-gcc*. - -To build *libsbi.a* simply execute: -``` -make -``` - -All compiled binaries as well as the resulting *libsbi.a* static library file -will be placed in the *build/lib* directory. To specify an alternate build root -directory path, run: -``` -make O= -``` - -To generate files to be installed for using *libsbi.a* in other projects, run: -``` -make install -``` - -This will create the *install* directory with all necessary include files -copied under the *install/include* directory and the library file copied into -the *install/lib* directory. To specify an alternate installation root -directory path, run: -``` -make I= install -``` - -Building and Installing a Reference Platform Static Library and Firmware ------------------------------------------------------------------------- - -When the *PLATFORM=* argument is specified on the make command -line, the platform-specific static library *libplatsbi.a* and firmware examples -are built for the platform ** present in the directory -*platform* in the OpenSBI top directory. For example, to compile the platform -library and the firmware examples for the QEMU RISC-V *virt* machine, -** should be *generic*. - -To build *libsbi.a*, *libplatsbi.a* and the firmware for one of the supported -platforms, run: -``` -make PLATFORM= -``` - -An alternate build directory path can also be specified: -``` -make PLATFORM= O= -``` - -The platform-specific library *libplatsbi.a* will be generated in the -*build/platform//lib* directory. The platform firmware files -will be under the *build/platform//firmware* directory. -The compiled firmwares will be available in two different formats: an ELF file -and an expanded image file. - -To install *libsbi.a*, *libplatsbi.a*, and the compiled firmwares, run: -``` -make PLATFORM= install -``` - -This will copy the compiled platform-specific libraries and firmware files -under the *install/platform//* directory. An alternate -install root directory path can be specified as follows: -``` -make PLATFORM= I= install -``` - -In addition, platform-specific configuration options can be specified with the -top-level make command line. These options, such as *PLATFORM_* or -*FW_*, are platform-specific and described in more details in the -*docs/platform/.md* files and -*docs/firmware/.md* files. - -All OpenSBI platforms support Kconfig style build-time configuration. Users -can change the build-time configuration of a platform using a graphical -interface as follows: -``` -make PLATFORM= menuconfig -``` - -Alternately, an OpenSBI platform can have multiple default configurations -and users can select a custom default configuration as follows: -``` -make PLATFORM= PLATFORM_DEFCONFIG= -``` - -Building 32-bit / 64-bit OpenSBI Images ---------------------------------------- -By default, building OpenSBI generates 32-bit or 64-bit images based on the -supplied RISC-V cross-compile toolchain. For example if *CROSS_COMPILE* is set -to *riscv64-linux-gnu-*, 64-bit OpenSBI images will be generated. If building -32-bit OpenSBI images, *CROSS_COMPILE* should be set to a toolchain that is -pre-configured to generate 32-bit RISC-V codes, like *riscv32-linux-gnu-*. - -However it's possible to explicitly specify the image bits we want to build with -a given RISC-V toolchain. This can be done by setting the environment variable -*PLATFORM_RISCV_XLEN* to the desired width, for example: - -``` -export CROSS_COMPILE=riscv64-linux-gnu- -export PLATFORM_RISCV_XLEN=32 -``` - -will generate 32-bit OpenSBI images. And vice vesa. - -Building with Clang/LLVM ------------------------- - -OpenSBI can also be built with Clang/LLVM. To build with just Clang but keep -the default binutils (which will still use the *CROSS_COMPILE* prefix if -defined), override the *CC* make variable with: -``` -make CC=clang -``` - -To build with a full LLVM-based toolchain, not just Clang, enable the *LLVM* -option with: -``` -make LLVM=1 -``` - -When using Clang, *CROSS_COMPILE* often does not need to be defined unless -using GNU binutils with prefixed binary names. *PLATFORM_RISCV_XLEN* will be -used to infer a default triple to pass to Clang, so if *PLATFORM_RISCV_XLEN* -itself defaults to an undesired value then prefer setting that rather than the -full triple via *CROSS_COMPILE*. If *CROSS_COMPILE* is nonetheless defined, -rather than being used as a prefix for the executable name, it will instead be -passed via the `--target` option with the trailing `-` removed, so must be a -valid triple. - -These can also be mixed; for example using a GCC cross-compiler but LLVM -binutils would be: -``` -make CC=riscv64-linux-gnu-gcc LLVM=1 -``` - -These variables must be passed for all the make invocations described in this -document. - -NOTE: Using Clang with a `riscv*-linux-gnu` GNU binutils linker has been seen -to produce broken binaries with missing relocations; it is therefore currently -recommended that this combination be avoided or *FW_PIC=n* be used to disable -building OpenSBI as a position-independent binary. - -Building with timestamp and compiler info ------------------------------------------ - -When doing development, we may want to know the build time and compiler info -for debug purpose. OpenSBI can also be built with timestamp and compiler info. -To build with those info and print it out at boot time, we can just simply add -`BUILD_INFO=y`, like: -``` -make BUILD_INFO=y -``` - -But if you have used `BUILD_INFO=y`, and want to switch back to `BUILD_INFO=n`, -you must do -``` -make clean -``` -before the next build. - -NOTE: Using `BUILD_INFO=y` without specifying SOURCE_DATE_EPOCH will violate -[reproducible builds]. This definition is ONLY for development and debug -purpose, and should NOT be used in a product which follows "reproducible -builds". - -Contributing to OpenSBI ------------------------ - -The OpenSBI project encourages and welcomes contributions. Contributions should -follow the rules described in the OpenSBI [Contribution Guideline] document. -In particular, all patches sent should contain a Signed-off-by tag. - -The [Contributors List] document provides a list of individuals and -organizations actively contributing to the OpenSBI project. - -Documentation -------------- - -Detailed documentation of various aspects of OpenSBI can be found under the -*docs* directory. The documentation covers the following topics. - -* [Contribution Guideline]: Guideline for contributing code to OpenSBI project -* [Library Usage]: API documentation of OpenSBI static library *libsbi.a* -* [Platform Requirements]: Requirements for using OpenSBI on a platform -* [Platform Support Guide]: Guideline for implementing support for new platforms -* [Platform Documentation]: Documentation of the platforms currently supported. -* [Firmware Documentation]: Documentation for the different types of firmware - examples build supported by OpenSBI. -* [Domain Support]: Documentation for the OpenSBI domain support which helps - users achieve system-level partitioning using OpenSBI. - -OpenSBI source code is also well documented. For source level documentation, -doxygen style is used. Please refer to the [Doxygen manual] for details on this -format. - -Doxygen can be installed on Linux distributions using *.deb* packages using -the following command. -``` -sudo apt-get install doxygen doxygen-latex doxygen-doc doxygen-gui graphviz -``` - -For *.rpm* based Linux distributions, the following commands can be used. -``` -sudo yum install doxygen doxygen-latex doxywizard graphviz -``` -or -``` -sudo yum install doxygen doxygen-latex doxywizard graphviz -``` - -To build a consolidated *refman.pdf* of all documentation, run: -``` -make docs -``` -or -``` -make O= docs -``` - -the resulting *refman.pdf* will be available under the directory -*/docs/latex*. To install this file, run: -``` -make install_docs -``` -or -``` -make I= install_docs -``` - -*refman.pdf* will be installed under */docs*. - -[Github]: https://github.com/riscv/riscv-sbi-doc -[U-Boot]: https://www.denx.de/wiki/U-Boot/SourceCode -[Bootlin toolchain repository]: https://toolchains.bootlin.com/ -[COPYING.BSD]: COPYING.BSD -[SPDX]: http://spdx.org/licenses/ -[Contribution Guideline]: docs/contributing.md -[Contributors List]: CONTRIBUTORS.md -[Library Usage]: docs/library_usage.md -[Platform Requirements]: docs/platform_requirements.md -[Platform Support Guide]: docs/platform_guide.md -[Platform Documentation]: docs/platform/platform.md -[Firmware Documentation]: docs/firmware/fw.md -[Domain Support]: docs/domain_support.md -[Doxygen manual]: http://www.doxygen.nl/manual/index.html -[Kendryte standalone SDK]: https://github.com/kendryte/kendryte-standalone-sdk -[third party notices]: ThirdPartyNotices.md -[reproducible builds]: https://reproducible-builds.org diff --git a/3rd/opensbi/ThirdPartyNotices.md b/3rd/opensbi/ThirdPartyNotices.md deleted file mode 100644 index 1162d4361..000000000 --- a/3rd/opensbi/ThirdPartyNotices.md +++ /dev/null @@ -1,18 +0,0 @@ -Copyright (c) 2019 Western Digital Corporation or its affiliates. - -Third Party Notices -=================== - -This project includes or partly uses code from the following open source -software subject to the following open source licenses. - -libfdt ------- - -Copyright (C) 2016 Free Electrons -Copyright (C) 2016 NextThing Co. - -The libfdt source code is disjunctively dual licensed (GPL-2.0+ or -BSD-2-Clause). Some of this project code is used in OpenSBI under the terms of -the BSD 2-Clause license. The full text of this license can be found in the -file [COPYING.BSD](COPYING.BSD). diff --git a/3rd/opensbi/docs/contributing.md b/3rd/opensbi/docs/contributing.md deleted file mode 100644 index 78d909e47..000000000 --- a/3rd/opensbi/docs/contributing.md +++ /dev/null @@ -1,84 +0,0 @@ -OpenSBI Contribution Guideline -============================== - -All contributions to OpenSBI can be sent in the following ways: -1. Email patches to the OpenSBI mailing list at `opensbi@lists.infradead.org` -2. GitHub Pull Requests (PRs) to the [OpenSBI main repository] - -To join the OpenSBI mailing list, please visit the [OpenSBI infradead page]. - -The OpenSBI maintainers prefer patches via the OpenSBI mailing list -(option 1 above) so that they are visible to a wider audience. All -accepted patches on the OpenSBI mailing list will be taken by any of -the OpenSBI maintainers and merged into the [OpenSBI main repository] -using GitHub PRs. - -All contributed work must follow the following rules: -1. OpenSBI code should be written in accordance to the [Linux coding style]. -2. This project embraces the [Developer Certificate of Origin (DCO)] for -contributions. This means that you must agree to the following prior to -submitting patches: if you agree with this developer certificate you -acknowledge this by adding a Signed-off-by tag to your patch commit log. -Every submitted patch must have this tag. -3. A commit message must have a subject line, followed by a blank line, -followed by a description of the patch content. A blank line and the author -Signed-off-by tag must follow this description. -4. A commit subject line must start with a prefix followed by a ":". Common -prefixes are for example "lib:", "platform:", "firmware:", "docs:", "utils:" -and "top:". -5. Maintainers should use "Rebase and Merge" when using GitHub to merge pull -requests to avoid creating unnecessary merge commits. -6. Maintainers should avoid creating branches directly in the main -riscv/opensbi repository. Instead, prefer using a fork of the riscv/opensbi main -repository and branches within that fork to create pull requests. -7. A maintainer cannot merge his own pull requests in the riscv/opensbi main -repository. -8. A pull request must get at least one review from a maintainer. -9. A pull request must spend at least 24 hours in review to allow for other -developers to review. - ------------------------------------------------------------------------ - -Developer Certificate of Origin -Version 1.1 - -Copyright (C) 2004, 2006 The Linux Foundation and its contributors. -660 York Street, Suite 102, -San Francisco, CA 94110 USA - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - - -Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -(a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -(b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -(c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -(d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. - ------------------------------------------------------------------------ - -[OpenSBI main repository]: https://github.com/riscv/opensbi -[OpenSBI infradead page]: http://lists.infradead.org/mailman/listinfo/opensbi -[Linux coding style]: https://www.kernel.org/doc/html/v4.10/process/coding-style.html -[Developer Certificate of Origin (DCO)]: http://developercertificate.org/ diff --git a/3rd/opensbi/docs/domain_support.md b/3rd/opensbi/docs/domain_support.md deleted file mode 100644 index 8963b57e3..000000000 --- a/3rd/opensbi/docs/domain_support.md +++ /dev/null @@ -1,314 +0,0 @@ -OpenSBI Domain Support -====================== - -An OpenSBI domain is a system-level partition (subset) of underlying hardware -having its own memory regions (RAM and MMIO devices) and HARTs. The OpenSBI -will try to achieve secure isolation between domains using RISC-V platform -features such as PMP, ePMP, IOPMP, SiFive Shield, etc. - -Important entities which help implement OpenSBI domain support are: - -* **struct sbi_domain_memregion** - Representation of a domain memory region -* **struct sbi_hartmask** - Representation of domain HART set -* **struct sbi_domain** - Representation of a domain instance - -Each HART of a RISC-V platform must have an OpenSBI domain assigned to it. -The OpenSBI platform support is responsible for populating domains and -providing HART id to domain mapping. The OpenSBI domain support will by -default assign **the ROOT domain** to all HARTs of a RISC-V platform, so -it is not mandatory for the OpenSBI platform support to populate domains. - -Domain Memory Region --------------------- - -A domain memory region is represented by **struct sbi_domain_memregion** in -OpenSBI and has following details: - -* **order** - The size of a memory region is **2 ^ order** where **order** - must be **3 <= order <= __riscv_xlen** -* **base** - The base address of a memory region is **2 ^ order** - aligned start address -* **flags** - The flags of a memory region represent memory type (i.e. - RAM or MMIO) and allowed accesses (i.e. READ, WRITE, EXECUTE, etc.) - -Domain Instance ---------------- - -A domain instance is represented by **struct sbi_domain** in OpenSBI and -has following details: - -* **index** - Logical index of this domain -* **name** - Name of this domain -* **assigned_harts** - HARTs assigned to this domain -* **possible_harts** - HARTs possible in this domain -* **regions** - Array of memory regions terminated by a memory region - with order zero -* **boot_hartid** - HART id of the HART booting this domain. The domain - boot HART will be started at boot-time if boot HART is possible and - assigned for this domain. -* **next_addr** - Address of the next booting stage for this domain -* **next_arg1** - Arg1 (or 'a1' register) of the next booting stage for - this domain -* **next_mode** - Privilege mode of the next booting stage for this - domain. This can be either S-mode or U-mode. -* **system_reset_allowed** - Is domain allowed to reset the system? - -The memory regions represented by **regions** in **struct sbi_domain** have -following additional constraints to align with RISC-V PMP requirements: - -* A memory region to protect OpenSBI firmware from S-mode and U-mode - should always be present -* For two overlapping memory regions, one should be sub-region of another -* Two overlapping memory regions should not be of same size -* Two overlapping memory regions cannot have same flags -* Memory access checks on overlapping address should prefer smallest - overlapping memory region flags. - -ROOT Domain ------------ - -**The ROOT domain** is the default OpenSBI domain which is assigned by -default to all HARTs of a RISC-V platform. The OpenSBI domain support -will hand-craft **the ROOT domain** very early at boot-time in the -following manner: - -* **index** - Logical index of the ROOT domain is always zero -* **name** - Name of the ROOT domain is "root" -* **assigned_harts** - At boot-time all valid HARTs of a RISC-V platform - are assigned the ROOT domain which changes later based on OpenSBI - platform support -* **possible_harts** - All valid HARTs of a RISC-V platform are possible - HARTs of the ROOT domain -* **regions** - Two memory regions available to the ROOT domain: - **A)** A memory region to protect OpenSBI firmware from S-mode and U-mode - **B)** A memory region of **order=__riscv_xlen** allowing S-mode and - U-mode access to full memory address space -* **boot_hartid** - Coldboot HART is the HART booting the ROOT domain -* **next_addr** - Next booting stage address in coldboot HART scratch - space is the next address for the ROOT domain -* **next_arg1** - Next booting stage arg1 in coldboot HART scratch space - is the next arg1 for the ROOT domain -* **next_mode** - Next booting stage mode in coldboot HART scratch space - is the next mode for the ROOT domain -* **system_reset_allowed** - The ROOT domain is allowed to reset the system - -Domain Effects --------------- - -Few noteworthy effects of a system partitioned into domains are as follows: - -* At any point in time, a HART is running in exactly one OpenSBI domain context -* The SBI IPI and RFENCE calls from HART A are restricted to the HARTs in - domain assigned to HART A -* The SBI HSM calls which try to change/read state of HART B from HART A will - only work if both HART A and HART B are assigned same domain -* A HART running in S-mode or U-mode can only access memory based on the - memory regions of the domain assigned to the HART - -Domain Device Tree Bindings ---------------------------- - -The OpenSBI domains can be described in the **device tree (DT) blob** (or -flattened device tree) passed to the OpenSBI firmwares by the previous -booting stage. This allows OpenSBI platform support to parse and populate -OpenSBI domains from the device tree blob (or flattened device tree). - -### Domain Configuration Node - -All OpenSBI domain description related DT nodes should be under the domain -configuration DT node. The **/chosen** DT node is the preferred parent of -the domain configuration DT node. - -The DT properties of a domain configuration DT node are as follows: - -* **compatible** (Mandatory) - The compatible string of the domain - configuration. This DT property should have value *"opensbi,domain,config"* - -### Domain Memory Region Node - -The domain memory region DT node describes details of a memory region and -can be pointed by multiple domain instance DT nodes. The access permissions -of the memory region are specified separately in domain instance node. - -The DT properties of a domain memory region DT node are as follows: - -* **compatible** (Mandatory) - The compatible string of the domain memory - region. This DT property should have value *"opensbi,domain,memregion"* -* **base** (Mandatory) - The base address of the domain memory region. This - DT property should have a **2 ^ order** aligned 64 bit address (i.e. two - DT cells). -* **order** (Mandatory) - The order of the domain memory region. This DT - property should have a 32 bit value (i.e. one DT cell) in the range - **3 <= order <= __riscv_xlen**. -* **mmio** (Optional) - A boolean flag representing whether the domain - memory region is a memory-mapped I/O (MMIO) region. -* **devices** (Optional) - The list of device DT node phandles for devices - which fall under this domain memory region. - -### Domain Instance Node - -The domain instance DT node describes set of possible HARTs, set of memory -regions, and other details of a domain instance. - -The DT properties of a domain instance DT node are as follows: - -* **compatible** (Mandatory) - The compatible string of the domain instance. - This DT property should have value *"opensbi,domain,instance"* -* **possible-harts** (Optional) - The list of CPU DT node phandles for the - the domain instance. This list represents the possible HARTs of the - domain instance. -* **regions** (Optional) - The list of domain memory region DT node phandle - and access permissions for the domain instance. Each list entry is a pair - of DT node phandle and access permissions. The access permissions are - represented as a 32bit bitmask having bits: **readable** (BIT[0]), - **writeable** (BIT[1]), **executable** (BIT[2]), and **m-mode** (BIT[3]). -* **boot-hart** (Optional) - The DT node phandle of the HART booting the - domain instance. If coldboot HART is assigned to the domain instance then - this DT property is ignored and the coldboot HART is assumed to be the - boot HART of the domain instance. -* **next-arg1** (Optional) - The 64 bit next booting stage arg1 for the - domain instance. If this DT property is not available and coldboot HART - is not assigned to the domain instance then **0x0** is used as default - value. If this DT property is not available and coldboot HART is assigned - to the domain instance then **next booting stage arg1 of coldboot HART** - is used as default value. -* **next-addr** (Optional) - The 64 bit next booting stage address for the - domain instance. If this DT property is not available and coldboot HART - is not assigned to the domain instance then **0x0** is used as default - value. If this DT property is not available and coldboot HART is assigned - to the domain instance then **next booting stage address of coldboot HART** - is used as default value. -* **next-mode** (Optional) - The 32 bit next booting stage mode for the - domain instance. The possible values of this DT property are: **0x1** - (s-mode), and **0x0** (u-mode). If this DT property is not available - and coldboot HART is not assigned to the domain instance then **0x1** - is used as default value. If this DT property is not available and - coldboot HART is assigned to the domain instance then **next booting - stage mode of coldboot HART** is used as default value. -* **system-reset-allowed** (Optional) - A boolean flag representing - whether the domain instance is allowed to do system reset. - -### Assigning HART To Domain Instance - -By default, all HARTs are assigned to **the ROOT domain**. The OpenSBI -platform support can provide the HART to domain instance assignment using -platform specific callback. - -The HART to domain instance assignment can be parsed from the device tree -using optional DT property **opensbi,domain** in each CPU DT node. The -value of DT property **opensbi,domain** is the DT phandle of the domain -instance DT node. If **opensbi,domain** DT property is not specified then -corresponding HART is assigned to **the ROOT domain**. - -### Domain Configuration Only Accessible to OpenSBI - -The software running inside a domain instance should only be aware of -devices and hardware resources accessible to itself. - -To hide domain configuration from domain instances, the following should -be done: - -* The previous booting stage should preferably provide a separate device - tree for each domain instance and mention location of device tree in - respective domain instance DT nodes using **next-arg1** DT property. -* If domain assigned to a HART does not have separate device tree then - OpenSBI platform support should remove all domain configuration details - from the device tree passed by previous booting stage before passing it - to the next booting stage. - -### Example - -``` - chosen { - opensbi-domains { - compatible = "opensbi,domain,config"; - - tmem: tmem { - compatible = "opensbi,domain,memregion"; - base = <0x0 0x80100000>; - order = <20>; - }; - - tuart: tuart { - compatible = "opensbi,domain,memregion"; - base = <0x0 0x10011000>; - order = <12>; - mmio; - devices = <&uart1>; - }; - - allmem: allmem { - compatible = "opensbi,domain,memregion"; - base = <0x0 0x0>; - order = <64>; - }; - - tdomain: trusted-domain { - compatible = "opensbi,domain,instance"; - possible-harts = <&cpu0>; - regions = <&tmem 0x7>, <&tuart 0x7>; - boot-hart = <&cpu0>; - next-arg1 = <0x0 0x0>; - next-addr = <0x0 0x80100000>; - next-mode = <0x0>; - system-reset-allowed; - }; - - udomain: untrusted-domain { - compatible = "opensbi,domain,instance"; - possible-harts = <&cpu1 &cpu2 &cpu3 &cpu4>; - regions = <&tmem 0x0>, <&tuart 0x0>, <&allmem 0x7>; - }; - }; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - timebase-frequency = <10000000>; - - cpu0: cpu@0 { - device_type = "cpu"; - reg = <0x00>; - compatible = "riscv"; - opensbi-domain = <&tdomain>; - ... - }; - - cpu1: cpu@1 { - device_type = "cpu"; - reg = <0x01>; - compatible = "riscv"; - opensbi-domain = <&udomain>; - ... - }; - - cpu2: cpu@2 { - device_type = "cpu"; - reg = <0x02>; - compatible = "riscv"; - opensbi-domain = <&udomain>; - ... - }; - - cpu3: cpu@3 { - device_type = "cpu"; - reg = <0x03>; - compatible = "riscv"; - opensbi-domain = <&udomain>; - ... - }; - - cpu4: cpu@4 { - device_type = "cpu"; - reg = <0x04>; - compatible = "riscv"; - opensbi-domain = <&udomain>; - ... - }; - }; - - uart1: serial@10011000 { - ... - }; -``` diff --git a/3rd/opensbi/docs/doxygen.cfg b/3rd/opensbi/docs/doxygen.cfg deleted file mode 100644 index 82f31a7ae..000000000 --- a/3rd/opensbi/docs/doxygen.cfg +++ /dev/null @@ -1,2462 +0,0 @@ -# Doxyfile 1.8.13 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "RISC-V OpenSBI" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = "v@@OPENSBI_MAJOR@@.@@OPENSBI_MINOR@@" - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = "Open source implemenation of the supervisor binary interface" - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = @@BUILD_DIR@@/docs - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up -# to that level are automatically included in the table of contents, even if -# they do not have an id attribute. -# Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 0. -# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. - -TOC_INCLUDE_HEADINGS = 0 - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# If one adds a struct or class to a group and this option is enabled, then also -# any nested class or struct is added to the same group. By default this option -# is disabled and one has to add nested compounds explicitly via \ingroup. -# The default value is: NO. - -GROUP_NESTED_COMPOUNDS = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = NO - -# This flag is only useful for Objective-C code. If set to YES, local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO, only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = YES - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = YES - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. -# The default value is: NO. - -WARN_AS_ERROR = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING -# Note: If this tag is empty the current directory is searched. - -INPUT = @@SRC_DIR@@/README.md \ - @@SRC_DIR@@/docs/contributing.md \ - @@SRC_DIR@@/docs/platform_guide.md \ - @@SRC_DIR@@/docs/platform_requirements.md \ - @@SRC_DIR@@/docs/library_usage.md \ - @@SRC_DIR@@/docs/domain_support.md \ - @@SRC_DIR@@/docs/firmware \ - @@SRC_DIR@@/docs/platform \ - @@SRC_DIR@@/include \ - @@SRC_DIR@@/lib - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# read by doxygen. -# -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, -# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. - -FILE_PATTERNS = *.c \ - *.h \ - *.md - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = README.md - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the -# cost of reduced performance. This can be particularly helpful with template -# rich C++ code for which doxygen's built-in parser lacks the necessary type -# information. -# Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse-libclang=ON option for CMake. -# The default value is: NO. - -CLANG_ASSISTED_PARSING = NO - -# If clang assisted parsing is enabled you can provide the compiler with command -# line options that you would normally use when invoking the compiler. Note that -# the include paths will already be set by doxygen for the files and directories -# specified with INPUT and INCLUDE_PATH. -# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. - -CLANG_OPTIONS = - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = NO - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = YES - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /

.dts -# -# platform-objs-y +=
.o - -# Firmware load address configuration. This is mandatory. -FW_TEXT_START=0x80000000 - -# Optional parameter for path to external FDT -# FW_FDT_PATH="path to platform flattened device tree file" - -# -# Dynamic firmware configuration. -# Optional parameters are commented out. Uncomment and define these parameters -# as needed. -# -FW_DYNAMIC= - -# -# Jump firmware configuration. -# Optional parameters are commented out. Uncomment and define these parameters -# as needed. -# -FW_JUMP= -# This needs to be 4MB aligned for 32-bit support -# This needs to be 2MB aligned for 64-bit support -# ifeq ($(PLATFORM_RISCV_XLEN), 32) -# FW_JUMP_ADDR=0x80400000 -# else -# FW_JUMP_ADDR=0x80200000 -# endif -# FW_JUMP_FDT_ADDR=0x82200000 - -# -# Firmware with payload configuration. -# Optional parameters are commented out. Uncomment and define these parameters -# as needed. -# -FW_PAYLOAD= -# This needs to be 4MB aligned for 32-bit support -# This needs to be 2MB aligned for 64-bit support -ifeq ($(PLATFORM_RISCV_XLEN), 32) -FW_PAYLOAD_OFFSET=0x400000 -else -FW_PAYLOAD_OFFSET=0x200000 -endif -# FW_PAYLOAD_ALIGN=0x1000 -# FW_PAYLOAD_PATH="path to next boot stage binary image file" -# FW_PAYLOAD_FDT_ADDR=0x82200000 diff --git a/3rd/opensbi/platform/template/platform.c b/3rd/opensbi/platform/template/platform.c deleted file mode 100644 index f3802dad6..000000000 --- a/3rd/opensbi/platform/template/platform.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2019 Western Digital Corporation or its affiliates. - */ - -#include -#include -#include -#include - -/* - * Include these files as needed. - * See objects.mk PLATFORM_xxx configuration parameters. - */ -#include -#include -#include -#include - -#define PLATFORM_PLIC_ADDR 0xc000000 -#define PLATFORM_PLIC_NUM_SOURCES 128 -#define PLATFORM_HART_COUNT 4 -#define PLATFORM_CLINT_ADDR 0x2000000 -#define PLATFORM_ACLINT_MTIMER_FREQ 10000000 -#define PLATFORM_ACLINT_MSWI_ADDR (PLATFORM_CLINT_ADDR + \ - CLINT_MSWI_OFFSET) -#define PLATFORM_ACLINT_MTIMER_ADDR (PLATFORM_CLINT_ADDR + \ - CLINT_MTIMER_OFFSET) -#define PLATFORM_UART_ADDR 0x09000000 -#define PLATFORM_UART_INPUT_FREQ 10000000 -#define PLATFORM_UART_BAUDRATE 115200 - -static struct plic_data plic = { - .addr = PLATFORM_PLIC_ADDR, - .num_src = PLATFORM_PLIC_NUM_SOURCES, -}; - -static struct aclint_mswi_data mswi = { - .addr = PLATFORM_ACLINT_MSWI_ADDR, - .size = ACLINT_MSWI_SIZE, - .first_hartid = 0, - .hart_count = PLATFORM_HART_COUNT, -}; - -static struct aclint_mtimer_data mtimer = { - .mtime_freq = PLATFORM_ACLINT_MTIMER_FREQ, - .mtime_addr = PLATFORM_ACLINT_MTIMER_ADDR + - ACLINT_DEFAULT_MTIME_OFFSET, - .mtime_size = ACLINT_DEFAULT_MTIME_SIZE, - .mtimecmp_addr = PLATFORM_ACLINT_MTIMER_ADDR + - ACLINT_DEFAULT_MTIMECMP_OFFSET, - .mtimecmp_size = ACLINT_DEFAULT_MTIMECMP_SIZE, - .first_hartid = 0, - .hart_count = PLATFORM_HART_COUNT, - .has_64bit_mmio = TRUE, -}; - -/* - * Platform early initialization. - */ -static int platform_early_init(bool cold_boot) -{ - return 0; -} - -/* - * Platform final initialization. - */ -static int platform_final_init(bool cold_boot) -{ - return 0; -} - -/* - * Initialize the platform console. - */ -static int platform_console_init(void) -{ - /* Example if the generic UART8250 driver is used */ - return uart8250_init(PLATFORM_UART_ADDR, PLATFORM_UART_INPUT_FREQ, - PLATFORM_UART_BAUDRATE, 0, 1, 0); -} - -/* - * Initialize the platform interrupt controller for current HART. - */ -static int platform_irqchip_init(bool cold_boot) -{ - u32 hartid = current_hartid(); - int ret; - - /* Example if the generic PLIC driver is used */ - if (cold_boot) { - ret = plic_cold_irqchip_init(&plic); - if (ret) - return ret; - } - - return plic_warm_irqchip_init(&plic, 2 * hartid, 2 * hartid + 1); -} - -/* - * Initialize IPI for current HART. - */ -static int platform_ipi_init(bool cold_boot) -{ - int ret; - - /* Example if the generic ACLINT driver is used */ - if (cold_boot) { - ret = aclint_mswi_cold_init(&mswi); - if (ret) - return ret; - } - - return aclint_mswi_warm_init(); -} - -/* - * Initialize platform timer for current HART. - */ -static int platform_timer_init(bool cold_boot) -{ - int ret; - - /* Example if the generic ACLINT driver is used */ - if (cold_boot) { - ret = aclint_mtimer_cold_init(&mtimer, NULL); - if (ret) - return ret; - } - - return aclint_mtimer_warm_init(); -} - -/* - * Platform descriptor. - */ -const struct sbi_platform_operations platform_ops = { - .early_init = platform_early_init, - .final_init = platform_final_init, - .console_init = platform_console_init, - .irqchip_init = platform_irqchip_init, - .ipi_init = platform_ipi_init, - .timer_init = platform_timer_init -}; -const struct sbi_platform platform = { - .opensbi_version = OPENSBI_VERSION, - .platform_version = SBI_PLATFORM_VERSION(0x0, 0x00), - .name = "platform-name", - .features = SBI_PLATFORM_DEFAULT_FEATURES, - .hart_count = 1, - .hart_stack_size = SBI_PLATFORM_DEFAULT_HART_STACK_SIZE, - .platform_ops_addr = (unsigned long)&platform_ops -}; diff --git a/3rd/opensbi/scripts/Kconfiglib/LICENSE.txt b/3rd/opensbi/scripts/Kconfiglib/LICENSE.txt deleted file mode 100644 index 8b31efca2..000000000 --- a/3rd/opensbi/scripts/Kconfiglib/LICENSE.txt +++ /dev/null @@ -1,5 +0,0 @@ -Copyright (c) 2011-2019, Ulf Magnusson - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/3rd/opensbi/scripts/Kconfiglib/allnoconfig.py b/3rd/opensbi/scripts/Kconfiglib/allnoconfig.py deleted file mode 100755 index de90d8bf4..000000000 --- a/3rd/opensbi/scripts/Kconfiglib/allnoconfig.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2018-2019, Ulf Magnusson -# SPDX-License-Identifier: ISC - -""" -Writes a configuration file where as many symbols as possible are set to 'n'. - -The default output filename is '.config'. A different filename can be passed -in the KCONFIG_CONFIG environment variable. - -Usage for the Linux kernel: - - $ make [ARCH=] scriptconfig SCRIPT=Kconfiglib/allnoconfig.py -""" - -# See examples/allnoconfig_walk.py for another way to implement this script - -import kconfiglib - - -def main(): - kconf = kconfiglib.standard_kconfig(__doc__) - - # Avoid warnings that would otherwise get printed by Kconfiglib for the - # following: - # - # 1. Assigning a value to a symbol without a prompt, which never has any - # effect - # - # 2. Assigning values invalid for the type (only bool/tristate symbols - # accept 0/1/2, for n/m/y). The assignments will be ignored for other - # symbol types, which is what we want. - kconf.warn = False - for sym in kconf.unique_defined_syms: - sym.set_value(2 if sym.is_allnoconfig_y else 0) - kconf.warn = True - - kconf.load_allconfig("allno.config") - - print(kconf.write_config()) - - -if __name__ == "__main__": - main() diff --git a/3rd/opensbi/scripts/Kconfiglib/allyesconfig.py b/3rd/opensbi/scripts/Kconfiglib/allyesconfig.py deleted file mode 100755 index 90eb9b8d6..000000000 --- a/3rd/opensbi/scripts/Kconfiglib/allyesconfig.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2018-2019, Ulf Magnusson -# SPDX-License-Identifier: ISC - -""" -Writes a configuration file where as many symbols as possible are set to 'y'. - -The default output filename is '.config'. A different filename can be passed -in the KCONFIG_CONFIG environment variable. - -Usage for the Linux kernel: - - $ make [ARCH=] scriptconfig SCRIPT=Kconfiglib/allyesconfig.py -""" -import kconfiglib - - -def main(): - kconf = kconfiglib.standard_kconfig(__doc__) - - # See allnoconfig.py - kconf.warn = False - - # Try to set all symbols to 'y'. Dependencies might truncate the value down - # later, but this will at least give the highest possible value. - # - # Assigning 0/1/2 to non-bool/tristate symbols has no effect (int/hex - # symbols still take a string, because they preserve formatting). - for sym in kconf.unique_defined_syms: - # Set choice symbols to 'm'. This value will be ignored for choices in - # 'y' mode (the "normal" mode), which will instead just get their - # default selection, but will set all symbols in m-mode choices to 'm', - # which is as high as they can go. - # - # Here's a convoluted example of how you might get an m-mode choice - # even during allyesconfig: - # - # choice - # tristate "weird choice" - # depends on m - sym.set_value(1 if sym.choice else 2) - - # Set all choices to the highest possible mode - for choice in kconf.unique_choices: - choice.set_value(2) - - kconf.warn = True - - kconf.load_allconfig("allyes.config") - - print(kconf.write_config()) - - -if __name__ == "__main__": - main() diff --git a/3rd/opensbi/scripts/Kconfiglib/defconfig.py b/3rd/opensbi/scripts/Kconfiglib/defconfig.py deleted file mode 100755 index b1792731f..000000000 --- a/3rd/opensbi/scripts/Kconfiglib/defconfig.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2019, Ulf Magnusson -# SPDX-License-Identifier: ISC - -""" -Reads a specified configuration file, then writes a new configuration file. -This can be used to initialize the configuration from e.g. an arch-specific -configuration file. This input configuration file would usually be a minimal -configuration file, as generated by e.g. savedefconfig. - -The default output filename is '.config'. A different filename can be passed in -the KCONFIG_CONFIG environment variable. -""" -import argparse - -import kconfiglib - - -def main(): - parser = argparse.ArgumentParser( - formatter_class=argparse.RawDescriptionHelpFormatter, - description=__doc__) - - parser.add_argument( - "--kconfig", - default="Kconfig", - help="Top-level Kconfig file (default: Kconfig)") - - parser.add_argument( - "config", - metavar="CONFIGURATION", - help="Input configuration file") - - args = parser.parse_args() - - kconf = kconfiglib.Kconfig(args.kconfig, suppress_traceback=True) - print(kconf.load_config(args.config)) - print(kconf.write_config()) - - -if __name__ == "__main__": - main() diff --git a/3rd/opensbi/scripts/Kconfiglib/genconfig.py b/3rd/opensbi/scripts/Kconfiglib/genconfig.py deleted file mode 100755 index 62f065ba7..000000000 --- a/3rd/opensbi/scripts/Kconfiglib/genconfig.py +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2018-2019, Ulf Magnusson -# SPDX-License-Identifier: ISC - -""" -Generates a header file with #defines from the configuration, matching the -format of include/generated/autoconf.h in the Linux kernel. - -Optionally, also writes the configuration output as a .config file. See ---config-out. - -The --sync-deps, --file-list, and --env-list options generate information that -can be used to avoid needless rebuilds/reconfigurations. - -Before writing a header or configuration file, Kconfiglib compares the old -contents of the file against the new contents. If there's no change, the write -is skipped. This avoids updating file metadata like the modification time, and -might save work depending on your build setup. - -By default, the configuration is generated from '.config'. A different -configuration file can be passed in the KCONFIG_CONFIG environment variable. - -A custom header string can be inserted at the beginning of generated -configuration and header files by setting the KCONFIG_CONFIG_HEADER and -KCONFIG_AUTOHEADER_HEADER environment variables, respectively (this also works -for other scripts). The string is not automatically made a comment (this is by -design, to allow anything to be added), and no trailing newline is added, so -add '/* */', '#', and newlines as appropriate. - -See https://www.gnu.org/software/make/manual/make.html#Multi_002dLine for a -handy way to define multi-line variables in makefiles, for use with custom -headers. Remember to export the variable to the environment. -""" -import argparse -import os -import sys - -import kconfiglib - - -DEFAULT_SYNC_DEPS_PATH = "deps/" - - -def main(): - parser = argparse.ArgumentParser( - formatter_class=argparse.RawDescriptionHelpFormatter, - description=__doc__) - - parser.add_argument( - "--header-path", - metavar="HEADER_FILE", - help=""" -Path to write the generated header file to. If not specified, the path in the -environment variable KCONFIG_AUTOHEADER is used if it is set, and 'config.h' -otherwise. -""") - - parser.add_argument( - "--config-out", - metavar="CONFIG_FILE", - help=""" -Write the configuration to CONFIG_FILE. This is useful if you include .config -files in Makefiles, as the generated configuration file will be a full .config -file even if .config is outdated. The generated configuration matches what -olddefconfig would produce. If you use sync-deps, you can include -deps/auto.conf instead. --config-out is meant for cases where incremental build -information isn't needed. -""") - - parser.add_argument( - "--sync-deps", - metavar="OUTPUT_DIR", - nargs="?", - const=DEFAULT_SYNC_DEPS_PATH, - help=""" -Enable generation of symbol dependency information for incremental builds, -optionally specifying the output directory (default: {}). See the docstring of -Kconfig.sync_deps() in Kconfiglib for more information. -""".format(DEFAULT_SYNC_DEPS_PATH)) - - parser.add_argument( - "--file-list", - metavar="OUTPUT_FILE", - help=""" -Write a list of all Kconfig files to OUTPUT_FILE, with one file per line. The -paths are relative to $srctree (or to the current directory if $srctree is -unset). Files appear in the order they're 'source'd. -""") - - parser.add_argument( - "--env-list", - metavar="OUTPUT_FILE", - help=""" -Write a list of all environment variables referenced in Kconfig files to -OUTPUT_FILE, with one variable per line. Each line has the format NAME=VALUE. -Only environment variables referenced with the preprocessor $(VAR) syntax are -included, and not variables referenced with the older $VAR syntax (which is -only supported for backwards compatibility). -""") - - parser.add_argument( - "kconfig", - metavar="KCONFIG", - nargs="?", - default="Kconfig", - help="Top-level Kconfig file (default: Kconfig)") - - args = parser.parse_args() - - - kconf = kconfiglib.Kconfig(args.kconfig, suppress_traceback=True) - kconf.load_config() - - if args.header_path is None: - if "KCONFIG_AUTOHEADER" in os.environ: - kconf.write_autoconf() - else: - # Kconfiglib defaults to include/generated/autoconf.h to be - # compatible with the C tools. 'config.h' is used here instead for - # backwards compatibility. It's probably a saner default for tools - # as well. - kconf.write_autoconf("config.h") - else: - kconf.write_autoconf(args.header_path) - - if args.config_out is not None: - kconf.write_config(args.config_out, save_old=False) - - if args.sync_deps is not None: - kconf.sync_deps(args.sync_deps) - - if args.file_list is not None: - with _open_write(args.file_list) as f: - for path in kconf.kconfig_filenames: - f.write(path + "\n") - - if args.env_list is not None: - with _open_write(args.env_list) as f: - for env_var in kconf.env_vars: - f.write("{}={}\n".format(env_var, os.environ[env_var])) - - -def _open_write(path): - # Python 2/3 compatibility. io.open() is available on both, but makes - # write() expect 'unicode' strings on Python 2. - - if sys.version_info[0] < 3: - return open(path, "w") - return open(path, "w", encoding="utf-8") - - -if __name__ == "__main__": - main() diff --git a/3rd/opensbi/scripts/Kconfiglib/kconfiglib.py b/3rd/opensbi/scripts/Kconfiglib/kconfiglib.py deleted file mode 100644 index c67895ced..000000000 --- a/3rd/opensbi/scripts/Kconfiglib/kconfiglib.py +++ /dev/null @@ -1,7160 +0,0 @@ -# Copyright (c) 2011-2019, Ulf Magnusson -# SPDX-License-Identifier: ISC - -""" -Overview -======== - -Kconfiglib is a Python 2/3 library for scripting and extracting information -from Kconfig (https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt) -configuration systems. - -See the homepage at https://github.com/ulfalizer/Kconfiglib for a longer -overview. - -Since Kconfiglib 12.0.0, the library version is available in -kconfiglib.VERSION, which is a (, , ) tuple, e.g. -(12, 0, 0). - - -Using Kconfiglib on the Linux kernel with the Makefile targets -============================================================== - -For the Linux kernel, a handy interface is provided by the -scripts/kconfig/Makefile patch, which can be applied with either 'git am' or -the 'patch' utility: - - $ wget -qO- https://github.com/raw/ulfalizer/Kconfiglib/master/makefile.patch | git am - $ wget -qO- https://github.com/raw/ulfalizer/Kconfiglib/master/makefile.patch | patch -p1 - -Warning: Not passing -p1 to patch will cause the wrong file to be patched. - -Please tell me if the patch does not apply. It should be trivial to apply -manually, as it's just a block of text that needs to be inserted near the other -*conf: targets in scripts/kconfig/Makefile. - -Look further down for a motivation for the Makefile patch and for instructions -on how you can use Kconfiglib without it. - -If you do not wish to install Kconfiglib via pip, the Makefile patch is set up -so that you can also just clone Kconfiglib into the kernel root: - - $ git clone git://github.com/ulfalizer/Kconfiglib.git - $ git am Kconfiglib/makefile.patch (or 'patch -p1 < Kconfiglib/makefile.patch') - -Warning: The directory name Kconfiglib/ is significant in this case, because -it's added to PYTHONPATH by the new targets in makefile.patch. - -The targets added by the Makefile patch are described in the following -sections. - - -make kmenuconfig ----------------- - -This target runs the curses menuconfig interface with Python 3. As of -Kconfiglib 12.2.0, both Python 2 and Python 3 are supported (previously, only -Python 3 was supported, so this was a backport). - - -make guiconfig --------------- - -This target runs the Tkinter menuconfig interface. Both Python 2 and Python 3 -are supported. To change the Python interpreter used, pass -PYTHONCMD= to 'make'. The default is 'python'. - - -make [ARCH=] iscriptconfig --------------------------------- - -This target gives an interactive Python prompt where a Kconfig instance has -been preloaded and is available in 'kconf'. To change the Python interpreter -used, pass PYTHONCMD= to 'make'. The default is 'python'. - -To get a feel for the API, try evaluating and printing the symbols in -kconf.defined_syms, and explore the MenuNode menu tree starting at -kconf.top_node by following 'next' and 'list' pointers. - -The item contained in a menu node is found in MenuNode.item (note that this can -be one of the constants kconfiglib.MENU and kconfiglib.COMMENT), and all -symbols and choices have a 'nodes' attribute containing their menu nodes -(usually only one). Printing a menu node will print its item, in Kconfig -format. - -If you want to look up a symbol by name, use the kconf.syms dictionary. - - -make scriptconfig SCRIPT=