├── ASPMEnabler ├── gnu-efi │ ├── lib │ │ ├── arm │ │ │ ├── efi_stub.S │ │ │ ├── edk2asm.h │ │ │ ├── setjmp.S │ │ │ ├── mullu.S │ │ │ ├── initplat.c │ │ │ ├── llsl.S │ │ │ ├── llsr.S │ │ │ ├── ldivmod.S │ │ │ └── math.c │ │ ├── ia32 │ │ │ ├── efi_stub.S │ │ │ ├── initplat.c │ │ │ └── setjmp.S │ │ ├── aarch64 │ │ │ ├── efi_stub.S │ │ │ ├── initplat.c │ │ │ ├── setjmp.S │ │ │ └── math.c │ │ ├── mips64el │ │ │ ├── efi_stub.S │ │ │ ├── initplat.c │ │ │ ├── math.c │ │ │ └── setjmp.S │ │ ├── x86_64 │ │ │ ├── initplat.c │ │ │ ├── setjmp.S │ │ │ └── callwrap.c │ │ ├── exit.c │ │ ├── ia64 │ │ │ ├── initplat.c │ │ │ ├── palproc.h │ │ │ └── math.c │ │ ├── debug.c │ │ ├── runtime │ │ │ ├── rtdata.c │ │ │ ├── rtlock.c │ │ │ ├── efirtlib.c │ │ │ └── vm.c │ │ ├── lock.c │ │ ├── lib.h │ │ ├── console.c │ │ ├── error.c │ │ ├── Makefile.orig │ │ ├── Makefile │ │ ├── hw.c │ │ └── event.c │ ├── inc │ │ ├── protocol │ │ │ ├── readme.txt │ │ │ ├── make.inf │ │ │ ├── intload.h │ │ │ ├── adapterdebug.h │ │ │ ├── eficonsplit.h │ │ │ ├── makefile.hdr │ │ │ ├── vgaclass.h │ │ │ └── legacyboot.h │ │ ├── efisetjmp.h │ │ ├── ia32 │ │ │ ├── efisetjmp_arch.h │ │ │ └── efilibplat.h │ │ ├── aarch64 │ │ │ ├── efilibplat.h │ │ │ └── efisetjmp_arch.h │ │ ├── arm │ │ │ ├── efilibplat.h │ │ │ └── efisetjmp_arch.h │ │ ├── mips64el │ │ │ ├── efilibplat.h │ │ │ └── efisetjmp_arch.h │ │ ├── x86_64 │ │ │ ├── efilibplat.h │ │ │ └── efisetjmp_arch.h │ │ ├── make.inf │ │ ├── eficompiler.h │ │ ├── efistdarg.h │ │ ├── inc.mak │ │ ├── Makefile │ │ ├── romload.h │ │ ├── ia64 │ │ │ ├── efisetjmp_arch.h │ │ │ └── efilibplat.h │ │ ├── efi.h │ │ ├── efipart.h │ │ ├── makefile.hdr │ │ ├── efiui.h │ │ ├── efigpt.h │ │ ├── efishellparm.h │ │ ├── efierr.h │ │ ├── efishellintf.h │ │ ├── efi_nii.h │ │ ├── efifs.h │ │ ├── efirtlib.h │ │ ├── libsmbios.h │ │ └── efipoint.h │ ├── apps │ │ ├── tpause.c │ │ ├── exit.c │ │ ├── t2.c │ │ ├── t5.c │ │ ├── t8.c │ │ ├── t4.c │ │ ├── setjmp.c │ │ ├── t.c │ │ ├── t7.c │ │ ├── printenv.c │ │ ├── drv0.h │ │ ├── trivial.S │ │ ├── t6.c │ │ ├── unsetdbg.c │ │ ├── setdbg.c │ │ ├── drv0_use.c │ │ ├── debughook.c │ │ ├── t3.c │ │ ├── modelist.c │ │ ├── Makefile │ │ ├── bltgrid.c │ │ └── route80h.c │ ├── README.elilo │ ├── README.git │ ├── gnuefi │ │ ├── elf_arm_efi.lds │ │ ├── elf_aarch64_efi.lds │ │ ├── elf_mips64el_efi.lds │ │ ├── elf_x86_64_fbsd_efi.lds │ │ ├── elf_x86_64_efi.lds │ │ ├── elf_ia64_efi.lds │ │ ├── elf_ia32_efi.lds │ │ ├── elf_ia32_fbsd_efi.lds │ │ ├── crt0-efi-x86_64.S │ │ ├── crt0-efi-ia32.S │ │ ├── Makefile │ │ ├── crt0-efi-ia64.S │ │ ├── reloc_arm.c │ │ ├── reloc_aarch64.c │ │ ├── reloc_x86_64.c │ │ ├── reloc_ia32.c │ │ └── reloc_mips64el.c │ ├── README.efilib │ └── Make.rules ├── acpi_checksum.h ├── .vs │ └── msvc │ │ ├── gnu-efi.vcxproj.user │ │ ├── ASPMEnabler.vcxproj.user │ │ └── ASPMEnabler.vcxproj.filters ├── acpi_checksum.c ├── README.md ├── LICENSE ├── listacpi.h ├── listacpi.c └── ASPMEnabler.sln ├── README.md └── aspm.py /ASPMEnabler/gnu-efi/lib/arm/efi_stub.S: -------------------------------------------------------------------------------- 1 | /* This stub is a stub to make the build happy */ 2 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/ia32/efi_stub.S: -------------------------------------------------------------------------------- 1 | /* This stub is a stub to make the build happy */ 2 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/aarch64/efi_stub.S: -------------------------------------------------------------------------------- 1 | /* This stub is a stub to make the build happy */ 2 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/mips64el/efi_stub.S: -------------------------------------------------------------------------------- 1 | /* This stub is a stub to make the build happy */ 2 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/arm/edk2asm.h: -------------------------------------------------------------------------------- 1 | 2 | #define ASM_PFX(x) x 3 | #define GCC_ASM_EXPORT(x) \ 4 | .globl x ; \ 5 | .type x, %function 6 | 7 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/protocol/readme.txt: -------------------------------------------------------------------------------- 1 | The protocol directory contains non Architectural 2 | Protocols that span the FW, Platform, or application 3 | space. -------------------------------------------------------------------------------- /ASPMEnabler/acpi_checksum.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef __ACPI_CHECKSUM_H__ 3 | #define __ACPI_CHECKSUM_H__ 4 | 5 | UINT8 AcpiChecksum(UINT8* TablePtr, UINT32 size); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/protocol/make.inf: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # 4 | 5 | [sources] 6 | efivar.h 7 | legacyboot.h 8 | VgaClass.h 9 | intload.h 10 | 11 | [ia32sources] 12 | 13 | [ia64sources] 14 | -------------------------------------------------------------------------------- /ASPMEnabler/.vs/msvc/gnu-efi.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ASPMEnabler/.vs/msvc/ASPMEnabler.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/tpause.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_STATUS 5 | efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) 6 | { 7 | Print(L"Press `q' to quit, any other key to continue:\n"); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/exit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_STATUS 5 | efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) 6 | { 7 | InitializeLib(image_handle, systab); 8 | 9 | Exit(EFI_SUCCESS, 0, NULL); 10 | 11 | return EFI_UNSUPPORTED; 12 | } 13 | -------------------------------------------------------------------------------- /ASPMEnabler/acpi_checksum.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "acpi_checksum.h" 4 | 5 | // return 0 if checksum passes 6 | UINT8 AcpiChecksum(UINT8 *TablePtr, UINT32 size) 7 | { 8 | UINT8 ChkSum = 0; 9 | 10 | for (; size > 0; --size, ++TablePtr) 11 | { 12 | ChkSum += (*TablePtr); 13 | } 14 | 15 | return ChkSum; 16 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ASPM 2 | 3 | `aspm.py` is a re-implementation of the `enable_aspm.sh` script originally written by Luis R. Rodriguez. 4 | 5 | `ASPMEnabler` is an EFI executable that patches the FADT ACPI table, based on S0ixEnabler by James Swineson. 6 | 7 | For more information please see this blog post: [https://z8.re/blog/aspm](https://z8.re/blog/aspm) -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efisetjmp.h: -------------------------------------------------------------------------------- 1 | #ifndef GNU_EFI_SETJMP_H 2 | #define GNU_EFI_SETJMP_H 3 | 4 | #include "eficompiler.h" 5 | #include "efisetjmp_arch.h" 6 | 7 | extern UINTN setjmp(jmp_buf env) __attribute__((returns_twice)); 8 | extern VOID longjmp(jmp_buf env, UINTN value) __attribute__((noreturn)); 9 | 10 | #endif /* GNU_EFI_SETJMP_H */ 11 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/ia32/efisetjmp_arch.h: -------------------------------------------------------------------------------- 1 | #ifndef GNU_EFI_IA32_SETJMP_H 2 | #define GNU_EFI_IA32_SETJMP_H 3 | 4 | #define JMPBUF_ALIGN 4 5 | 6 | typedef struct { 7 | UINT32 Ebx; 8 | UINT32 Esi; 9 | UINT32 Edi; 10 | UINT32 Ebp; 11 | UINT32 Esp; 12 | UINT32 Eip; 13 | } ALIGN(JMPBUF_ALIGN) jmp_buf[1]; 14 | 15 | #endif /* GNU_EFI_IA32_SETJMP_H */ 16 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/t2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_STATUS 5 | efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) 6 | { 7 | SIMPLE_TEXT_OUTPUT_INTERFACE *conout; 8 | 9 | InitializeLib(image, systab); 10 | conout = systab->ConOut; 11 | uefi_call_wrapper(conout->OutputString, 2, conout, L"Hello World!\n\r"); 12 | 13 | return EFI_SUCCESS; 14 | } 15 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/aarch64/efilibplat.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | efilibplat.h 8 | 9 | Abstract: 10 | 11 | EFI to compile bindings 12 | 13 | 14 | 15 | 16 | Revision History 17 | 18 | --*/ 19 | 20 | VOID 21 | InitializeLibPlatform ( 22 | IN EFI_HANDLE ImageHandle, 23 | IN EFI_SYSTEM_TABLE *SystemTable 24 | ); 25 | 26 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/arm/efilibplat.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | efilibplat.h 8 | 9 | Abstract: 10 | 11 | EFI to compile bindings 12 | 13 | 14 | 15 | 16 | Revision History 17 | 18 | --*/ 19 | 20 | VOID 21 | InitializeLibPlatform ( 22 | IN EFI_HANDLE ImageHandle, 23 | IN EFI_SYSTEM_TABLE *SystemTable 24 | ); 25 | 26 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/mips64el/efilibplat.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | efilibplat.h 8 | 9 | Abstract: 10 | 11 | EFI to compile bindings 12 | 13 | 14 | 15 | 16 | Revision History 17 | 18 | --*/ 19 | 20 | VOID 21 | InitializeLibPlatform ( 22 | IN EFI_HANDLE ImageHandle, 23 | IN EFI_SYSTEM_TABLE *SystemTable 24 | ); 25 | 26 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/ia32/efilibplat.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | efilibplat.h 8 | 9 | Abstract: 10 | 11 | EFI to compile bindings 12 | 13 | 14 | 15 | 16 | Revision History 17 | 18 | --*/ 19 | 20 | VOID 21 | InitializeLibPlatform ( 22 | IN EFI_HANDLE ImageHandle, 23 | IN EFI_SYSTEM_TABLE *SystemTable 24 | ); 25 | 26 | 27 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/x86_64/efilibplat.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | efilibplat.h 8 | 9 | Abstract: 10 | 11 | EFI to compile bindings 12 | 13 | 14 | 15 | 16 | Revision History 17 | 18 | --*/ 19 | 20 | VOID 21 | InitializeLibPlatform ( 22 | IN EFI_HANDLE ImageHandle, 23 | IN EFI_SYSTEM_TABLE *SystemTable 24 | ); 25 | 26 | 27 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/ia32/initplat.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | initplat.c 8 | 9 | Abstract: 10 | 11 | 12 | 13 | 14 | Revision History 15 | 16 | --*/ 17 | 18 | #include "lib.h" 19 | 20 | VOID 21 | InitializeLibPlatform ( 22 | IN EFI_HANDLE ImageHandle EFI_UNUSED, 23 | IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED 24 | ) 25 | { 26 | } 27 | 28 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/x86_64/initplat.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | initplat.c 8 | 9 | Abstract: 10 | 11 | 12 | 13 | 14 | Revision History 15 | 16 | --*/ 17 | 18 | #include "lib.h" 19 | 20 | VOID 21 | InitializeLibPlatform ( 22 | IN EFI_HANDLE ImageHandle EFI_UNUSED, 23 | IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED 24 | ) 25 | { 26 | } 27 | 28 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/t5.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_STATUS 5 | efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) 6 | { 7 | InitializeLib(image, systab); 8 | Print(L"HelloLib application started\n"); 9 | Print(L"\n\n\nHit any key to exit this image\n"); 10 | WaitForSingleEvent(ST->ConIn->WaitForKey, 0); 11 | uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"\n\n"); 12 | return EFI_SUCCESS; 13 | } 14 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/exit.c: -------------------------------------------------------------------------------- 1 | #include "lib.h" 2 | 3 | VOID 4 | Exit( 5 | IN EFI_STATUS ExitStatus, 6 | IN UINTN ExitDataSize, 7 | IN CHAR16 *ExitData OPTIONAL 8 | ) 9 | { 10 | uefi_call_wrapper(BS->Exit, 11 | 4, 12 | LibImageHandle, 13 | ExitStatus, 14 | ExitDataSize, 15 | ExitData); 16 | 17 | // Uh oh, Exit() returned?! 18 | for (;;) { } 19 | } 20 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/arm/efisetjmp_arch.h: -------------------------------------------------------------------------------- 1 | #ifndef GNU_EFI_ARM_SETJMP_H 2 | #define GNU_EFI_ARM_SETJMP_H 3 | 4 | #define JMPBUF_ALIGN 4 5 | 6 | typedef struct { 7 | UINT32 R3; // A copy of R13 8 | UINT32 R4; 9 | UINT32 R5; 10 | UINT32 R6; 11 | UINT32 R7; 12 | UINT32 R8; 13 | UINT32 R9; 14 | UINT32 R10; 15 | UINT32 R11; 16 | UINT32 R12; 17 | UINT32 R13; 18 | UINT32 R14; 19 | } ALIGN(JMPBUF_ALIGN) jmp_buf[1]; 20 | 21 | #endif /* GNU_EFI_ARM_SETJMP_H */ 22 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/x86_64/efisetjmp_arch.h: -------------------------------------------------------------------------------- 1 | #ifndef GNU_EFI_X86_64_SETJMP_H 2 | #define GNU_EFI_X86_64_SETJMP_H 3 | 4 | #define JMPBUF_ALIGN 8 5 | 6 | typedef struct { 7 | UINT64 Rbx; 8 | UINT64 Rsp; 9 | UINT64 Rbp; 10 | 11 | UINT64 Rdi; 12 | UINT64 Rsi; 13 | UINT64 R12; 14 | UINT64 R13; 15 | UINT64 R14; 16 | UINT64 R15; 17 | UINT64 Rip; 18 | UINT64 MxCsr; 19 | UINT8 XmmBuffer[160]; // XMM6 - XMM15 20 | } ALIGN(JMPBUF_ALIGN) jmp_buf[1]; 21 | 22 | #endif /* GNU_EFI_X86_64_SETJMP_H */ 23 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/t8.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_STATUS 5 | efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) 6 | { 7 | INTN Argc, i; 8 | CHAR16 **Argv; 9 | 10 | InitializeLib(ImageHandle, SystemTable); 11 | Argc = GetShellArgcArgv(ImageHandle, &Argv); 12 | 13 | Print(L"Hello World, started with Argc=%d\n", Argc); 14 | for (i = 0 ; i < Argc ; ++i) 15 | Print(L" Argv[%d] = '%s'\n", i, Argv[i]); 16 | 17 | Print(L"Bye.\n"); 18 | return EFI_SUCCESS; 19 | } 20 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/make.inf: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # 4 | 5 | [sources] 6 | efi.h 7 | efiapi.h 8 | eficon.h 9 | efidebug.h 10 | efidef.h 11 | efidevp.h 12 | efierr.h 13 | efifs.h 14 | efilib.h 15 | efipart.h 16 | efipciio.h 17 | efiprot.h 18 | efipxebc.h 19 | efistdarg.h 20 | efinet.h 21 | efiip.h 22 | efiudp.h 23 | efitcp.h 24 | 25 | [ia32sources] 26 | efibind.h 27 | pe.h 28 | efilibplat.h 29 | 30 | [ia64sources] 31 | efibind.h 32 | pe.h 33 | efilibplat.h 34 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/protocol/intload.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1999 Intel Corporation 4 | 5 | Module Name: 6 | 7 | intload 8 | 9 | Abstract: 10 | 11 | EFI support for loading internally linked in apps 12 | 13 | 14 | 15 | Revision History 16 | 17 | --*/ 18 | 19 | #ifndef _INTERNAL_LOAD_INCLUDE_ 20 | #define _INTERNAL_LOAD_INCLUDE_ 21 | 22 | // {D65A6B8C-71E5-4df0-A909-F0D2992B5AA9} 23 | #define INTERNAL_SHELL_GUID \ 24 | { 0xd65a6b8c, 0x71e5, 0x4df0, {0xa9, 0x09, 0xf0, 0xd2, 0x99, 0x2b, 0x5a, 0xa9} } 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/t4.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_STATUS 5 | efi_main (EFI_HANDLE *image, EFI_SYSTEM_TABLE *systab) 6 | { 7 | UINTN index; 8 | 9 | InitializeLib(image, systab); 10 | uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut, L"Hello application started\r\n"); 11 | uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut, L"\r\n\r\n\r\nHit any key to exit\r\n"); 12 | uefi_call_wrapper(systab->BootServices->WaitForEvent, 3, 1, &systab->ConIn->WaitForKey, &index); 13 | return EFI_SUCCESS; 14 | } 15 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/setjmp.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | EFI_STATUS 7 | efi_main( 8 | EFI_HANDLE image_handle, 9 | EFI_SYSTEM_TABLE *systab 10 | ) 11 | { 12 | jmp_buf env; 13 | int rc; 14 | 15 | InitializeLib(image_handle, systab); 16 | rc = setjmp(env); 17 | Print(L"setjmp() = %d\n", rc); 18 | 19 | if (rc == 3) { 20 | Print(L"3 worked\n"); 21 | longjmp(env, 0); 22 | return 0; 23 | } 24 | 25 | if (rc == 1) { 26 | Print(L"0 got to be one yay\n"); 27 | return 0; 28 | } 29 | 30 | longjmp(env, 3); 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/ia64/initplat.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1999 Intel Corporation 4 | 5 | Module Name: 6 | 7 | initplat.c 8 | 9 | Abstract: 10 | 11 | Functions to make SAL and PAL proc calls 12 | 13 | Revision History 14 | 15 | --*/ 16 | #include "lib.h" 17 | 18 | //#include "palproc.h" 19 | 20 | VOID 21 | InitializeLibPlatform ( 22 | IN EFI_HANDLE ImageHandle EFI_UNUSED, 23 | IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED 24 | ) 25 | { 26 | PLABEL SalPlabel; 27 | UINT64 PalEntry; 28 | 29 | LibInitSalAndPalProc (&SalPlabel, &PalEntry); 30 | } 31 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/eficompiler.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2016 Pete Batard 4 | 5 | Module Name: 6 | 7 | eficompiler.h 8 | 9 | Abstract: 10 | 11 | Compiler specific adjustments 12 | 13 | --*/ 14 | 15 | #ifdef _MSC_EXTENSIONS 16 | #define EFI_UNUSED 17 | #else 18 | #define EFI_UNUSED __attribute__((__unused__)) 19 | #endif 20 | 21 | #ifdef _MSC_EXTENSIONS 22 | #define ALIGN(x) __declspec(align(x)) 23 | #else 24 | #define ALIGN(x) __attribute__((__aligned__(x))) 25 | #endif 26 | 27 | /* Also add a catch-all on __attribute__() for MS compilers */ 28 | #ifdef _MSC_EXTENSIONS 29 | #define __attribute__(x) 30 | #endif 31 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/aarch64/efisetjmp_arch.h: -------------------------------------------------------------------------------- 1 | #ifndef GNU_EFI_AARCH64_SETJMP_H 2 | #define GNU_EFI_AARCH64_SETJMP_H 3 | 4 | #define JMPBUF_ALIGN 8 5 | 6 | typedef struct { 7 | /* GP regs */ 8 | UINT64 X19; 9 | UINT64 X20; 10 | UINT64 X21; 11 | UINT64 X22; 12 | UINT64 X23; 13 | UINT64 X24; 14 | UINT64 X25; 15 | UINT64 X26; 16 | UINT64 X27; 17 | UINT64 X28; 18 | UINT64 FP; 19 | UINT64 LR; 20 | UINT64 IP0; 21 | 22 | /* FP regs */ 23 | UINT64 D8; 24 | UINT64 D9; 25 | UINT64 D10; 26 | UINT64 D11; 27 | UINT64 D12; 28 | UINT64 D13; 29 | UINT64 D14; 30 | UINT64 D15; 31 | } ALIGN(JMPBUF_ALIGN) jmp_buf[1]; 32 | 33 | #endif /* GNU_EFI_AARCH64_SETJMP_H */ 34 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efistdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFISTDARG_H_ 2 | #define _EFISTDARG_H_ 3 | 4 | /*++ 5 | 6 | Copyright (c) 1998 Intel Corporation 7 | 8 | Module Name: 9 | 10 | devpath.h 11 | 12 | Abstract: 13 | 14 | Defines for parsing the EFI Device Path structures 15 | 16 | 17 | 18 | Revision History 19 | 20 | --*/ 21 | 22 | #ifndef GNU_EFI_USE_EXTERNAL_STDARG 23 | typedef __builtin_va_list va_list; 24 | 25 | # define va_start(v,l) __builtin_va_start(v,l) 26 | # define va_end(v) __builtin_va_end(v) 27 | # define va_arg(v,l) __builtin_va_arg(v,l) 28 | # define va_copy(d,s) __builtin_va_copy(d,s) 29 | #else 30 | # include 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/protocol/adapterdebug.h: -------------------------------------------------------------------------------- 1 | #ifndef _ADAPTER_DEBUG_H 2 | #define _ADAPTER_DEBUG_H 3 | 4 | /*++ 5 | 6 | Copyright (c) 1999 Intel Corporation 7 | 8 | Module Name: 9 | 10 | AdapterDebug.h 11 | 12 | Abstract: 13 | 14 | Protocol to debug the EDD 3.0 enablement of BIOS option ROMs 15 | 16 | 17 | 18 | Revision History 19 | 20 | --*/ 21 | 22 | // {82F86881-282B-11d4-BC7D-0080C73C8881} 23 | #define ADAPTER_DEBUG_PROTOCOL \ 24 | { 0x82f86881, 0x282b, 0x11d4, {0xbc, 0x7d, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } 25 | 26 | // 27 | // This protocol points to the BIOS_LEGACY_DRIVE data structure 28 | // see edd.h for more details 29 | // 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/debug.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | debug.c 8 | 9 | Abstract: 10 | 11 | Debug library functions 12 | 13 | 14 | 15 | Revision History 16 | 17 | --*/ 18 | 19 | #include "lib.h" 20 | 21 | 22 | 23 | // 24 | // Declare runtime functions 25 | // 26 | 27 | // 28 | // 29 | // 30 | 31 | INTN 32 | DbgAssert ( 33 | IN CONST CHAR8 *FileName, 34 | IN INTN LineNo, 35 | IN CONST CHAR8 *Description 36 | ) 37 | { 38 | DbgPrint (D_ERROR, (CHAR8 *)"%EASSERT FAILED: %a(%d): %a%N\n", FileName, LineNo, Description); 39 | 40 | BREAKPOINT(); 41 | return 0; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/t.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static CHAR16 * 5 | a2u (char *str) 6 | { 7 | static CHAR16 mem[2048]; 8 | int i; 9 | 10 | for (i = 0; str[i]; ++i) 11 | mem[i] = (CHAR16) str[i]; 12 | mem[i] = 0; 13 | return mem; 14 | } 15 | 16 | EFI_STATUS 17 | efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) 18 | { 19 | SIMPLE_TEXT_OUTPUT_INTERFACE *conout; 20 | 21 | InitializeLib(image_handle, systab); 22 | conout = systab->ConOut; 23 | uefi_call_wrapper(conout->OutputString, 2, conout, (CHAR16 *)L"Hello World!\n\r"); 24 | uefi_call_wrapper(conout->OutputString, 2, conout, a2u("Hello World!\n\r")); 25 | 26 | return EFI_SUCCESS; 27 | } 28 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/mips64el/efisetjmp_arch.h: -------------------------------------------------------------------------------- 1 | #ifndef GNU_EFI_MIPS64EL_SETJMP_H 2 | #define GNU_EFI_MIPS64EL_SETJMP_H 3 | 4 | #define JMPBUF_ALIGN 8 5 | 6 | typedef struct { 7 | /* GP regs */ 8 | UINT64 RA; 9 | UINT64 SP; 10 | UINT64 FP; 11 | UINT64 GP; 12 | UINT64 S0; 13 | UINT64 S1; 14 | UINT64 S2; 15 | UINT64 S3; 16 | UINT64 S4; 17 | UINT64 S5; 18 | UINT64 S6; 19 | UINT64 S7; 20 | 21 | #ifdef __mips_hard_float 22 | /* FP regs */ 23 | UINT64 F24; 24 | UINT64 F25; 25 | UINT64 F26; 26 | UINT64 F27; 27 | UINT64 F28; 28 | UINT64 F29; 29 | UINT64 F30; 30 | UINT64 F31; 31 | #endif 32 | } ALIGN(JMPBUF_ALIGN) jmp_buf[1]; 33 | 34 | #endif /* GNU_EFI_MIPS64EL_SETJMP_H */ 35 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/protocol/eficonsplit.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFI_CONFORK_H 2 | #define _EFI_CONFORK_H 3 | /*++ 4 | 5 | Copyright (c) 1999 Intel Corporation 6 | 7 | Module Name: 8 | 9 | Abstract: 10 | 11 | 12 | 13 | Revision History 14 | 15 | --*/ 16 | 17 | 18 | 19 | // 20 | // ConOut Forker Protocol 21 | // 22 | 23 | #define TEXT_OUT_SPLITER_PROTOCOL \ 24 | { 0x56d830a0, 0x7e7a, 0x11d3, {0xbb, 0xa0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 25 | 26 | #define ERROR_OUT_SPLITER_PROTOCOL \ 27 | { 0xf0ba9039, 0x68f1, 0x425e, {0xaa, 0x7f, 0xd9, 0xaa, 0xf9, 0x1b, 0x82, 0xa1}} 28 | 29 | #define TEXT_IN_SPLITER_PROTOCOL \ 30 | { 0xf9a3c550, 0x7fb5, 0x11d3, {0xbb, 0xa0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/README.elilo: -------------------------------------------------------------------------------- 1 | 2 | IMPORTANT information related to the gnu-efi package 3 | ---------------------------------------------------- 4 | June 2001 5 | 6 | As of version 3.0, the gnu-efi package is now split in two different packages: 7 | 8 | -> gnu-efi-X.y: contains the EFI library, include files and crt0. 9 | 10 | -> elilo-X.y : contains the ELILO bootloader. 11 | 12 | Note that X.y don't need to match for both packages. However elilo-3.x 13 | requires at least gnu-efi-3.0. EFI support for x86_64 is provided in 14 | gnu-efi-3.0d. 15 | 16 | Both packages can be downloaded from: 17 | 18 | http://www.sf.net/projects/gnu-efi 19 | http://www.sf.net/projects/elilo 20 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/t7.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_STATUS 5 | efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) 6 | { 7 | EFI_INPUT_KEY efi_input_key; 8 | EFI_STATUS efi_status; 9 | 10 | InitializeLib(image, systab); 11 | 12 | Print(L"HelloLib application started\n"); 13 | 14 | Print(L"\n\n\nHit any key to exit this image\n"); 15 | WaitForSingleEvent(ST->ConIn->WaitForKey, 0); 16 | 17 | uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"\n\n"); 18 | 19 | efi_status = uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, &efi_input_key); 20 | 21 | Print(L"ScanCode: %xh UnicodeChar: %xh CallRtStatus: %x\n", 22 | efi_input_key.ScanCode, efi_input_key.UnicodeChar, efi_status); 23 | 24 | return EFI_SUCCESS; 25 | } 26 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/protocol/makefile.hdr: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # This is a machine generated file - DO NOT EDIT 4 | # Generated by genmake.exe 5 | # Generated from make.inf 6 | # Copyright (c) 1998 Intel Corporation 7 | # 8 | 9 | INC_DEPS = $(INC_DEPS) \ 10 | $(SDK_INSTALL_DIR)\include\efi\protocol\efivar.h \ 11 | $(SDK_INSTALL_DIR)\include\efi\protocol\legacyboot.h \ 12 | $(SDK_INSTALL_DIR)\include\efi\protocol\vgaclass.h \ 13 | $(SDK_INSTALL_DIR)\include\efi\protocol\efidbg.h \ 14 | 15 | 16 | !IF "$(PROCESSOR)" == "Ia32" 17 | INC_DEPS = $(INC_DEPS) \ 18 | 19 | 20 | !ENDIF 21 | 22 | 23 | !IF "$(PROCESSOR)" == "Ia64" 24 | INC_DEPS = $(INC_DEPS) \ 25 | $(SDK_INSTALL_DIR)\include\efi\protocol\$(PROCESSOR)\eficontext.h \ 26 | 27 | 28 | !ENDIF 29 | 30 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/README.git: -------------------------------------------------------------------------------- 1 | README.git 2 | 3 | Generating releases from git a very simple process; 4 | 5 | 1) Edit the file "Makefile". Changing the "VERSION" line to the new version. 6 | 2) Do a "git commit" just for the version number change. 7 | 3) Then do a "make test-archive". 8 | That will make a file in the current directory gnu-efi-$VERSION.tar.bz2 , 9 | with its top level directory gnu-efi-$VERSION/ and the source tree under that. 10 | 11 | Once you've tested that and you're sure it's what you want to release, 12 | 4) Do "make archive", which will tag a release in git and generate a 13 | final tarball from it. 14 | 15 | You then push to the archive, being sure to include the tag: 16 | 5) "git push origin master:master --tags" 17 | 18 | And upload the archive wherever it's supposed to go. 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/inc.mak: -------------------------------------------------------------------------------- 1 | 2 | 3 | INC_DEPS = $(INC_DEPS) \ 4 | efi.h \ 5 | efiapi.h \ 6 | efibind.h \ 7 | eficon.h \ 8 | efidebug.h \ 9 | efidef.h \ 10 | efidevp.h \ 11 | efierr.h \ 12 | efifs.h \ 13 | efilib.h \ 14 | efipart.h \ 15 | efipciio.h \ 16 | efiprot.h \ 17 | efipxe.h \ 18 | efivar.h \ 19 | pe.h \ 20 | efiip.h \ 21 | efiudp.h \ 22 | efitcp.h \ 23 | stdarg.h 24 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/arm/setjmp.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. 3 | * This program and the accompanying materials are licensed and made 4 | * available under the terms and conditions of the BSD License which 5 | * accompanies this distribution. The full text of the license may 6 | * be found at http://opensource.org/licenses/bsd-license.php. 7 | * 8 | * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" 9 | * BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 10 | * EXPRESS OR IMPLIED. 11 | */ 12 | .text 13 | .arm 14 | .globl setjmp 15 | .type setjmp, %function 16 | setjmp: 17 | mov r3, r13 18 | stmia r0, {r3-r12,r14} 19 | eor r0, r0, r0 20 | bx lr 21 | 22 | .globl longjmp 23 | .type longjmp, %function 24 | longjmp: 25 | ldmia r0, {r3-r12,r14} 26 | -------------------------------------------------------------------------------- /ASPMEnabler/README.md: -------------------------------------------------------------------------------- 1 | # ASPMEnabler 2 | 3 | Patches the FADT ACPI table and overrides the bit which signals that the mainboard does not correctly support ASPM. 4 | 5 | This tool is based on [S0ixEnabler](https://github.com/Jamesits/S0ixEnabler) by James Swineson. 6 | 7 | ## Requirements 8 | 9 | * UEFI firmware (some old EFI firmwares might be supported as well) 10 | 11 | ## Usage 12 | 13 | Run `ASPMEnabler.efi` either manually or automatically before your OS loads. 14 | 15 | ## Building 16 | 17 | Requirements: 18 | 19 | * Windows and Visual Studio 2017 or higher 20 | * C++ desktop development tools 21 | * MSVC C++ build tools (for the architecture you need) 22 | * MSVC C++ Spectre-mitigated libs (for the architecture you need) 23 | 24 | Open `ASPMEnabler.sln` in Visual Studio, make sure that your build is set to "Release" and click "Build Solution". -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/Makefile: -------------------------------------------------------------------------------- 1 | SRCDIR = . 2 | 3 | VPATH = $(SRCDIR) 4 | 5 | include $(SRCDIR)/../Make.defaults 6 | 7 | TOPDIR = $(SRCDIR)/.. 8 | 9 | CDIR=$(TOPDIR)/.. 10 | 11 | all: 12 | 13 | clean: 14 | 15 | install: 16 | mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi 17 | mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/protocol 18 | mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH) 19 | $(INSTALL) -m 644 $(SRCDIR)/*.h $(INSTALLROOT)$(PREFIX)/include/efi 20 | $(INSTALL) -m 644 $(SRCDIR)/protocol/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol 21 | $(INSTALL) -m 644 $(SRCDIR)/$(ARCH)/*.h $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH) 22 | ifeq ($(ARCH),ia64) 23 | mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/protocol/ia64 24 | $(INSTALL) -m 644 $(SRCDIR)/protocol/ia64/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol/ia64 25 | endif 26 | 27 | include $(SRCDIR)/../Make.rules 28 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/printenv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_STATUS 5 | efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) 6 | { 7 | EFI_STATUS status; 8 | CHAR16 name[256], *val, fmt[20]; 9 | EFI_GUID vendor; 10 | UINTN size; 11 | 12 | InitializeLib(image, systab); 13 | 14 | name[0] = 0; 15 | vendor = NullGuid; 16 | 17 | Print(L"GUID Variable Name Value\n"); 18 | Print(L"=================================== ==================== ========\n"); 19 | 20 | StrCpy(fmt, L"%.-35g %.-20s %s\n"); 21 | while (1) { 22 | size = sizeof(name); 23 | status = uefi_call_wrapper(RT->GetNextVariableName, 3, &size, name, &vendor); 24 | if (status != EFI_SUCCESS) 25 | break; 26 | 27 | val = LibGetVariable(name, &vendor); 28 | Print(fmt, &vendor, name, val); 29 | FreePool(val); 30 | } 31 | return EFI_SUCCESS; 32 | } 33 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/drv0.h: -------------------------------------------------------------------------------- 1 | #ifndef _GNU_EFI_APPS_DRV0_H_ 2 | #define _GNU_EFI_APPS_DRV0_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* UEFI naming conventions */ 9 | #define GNU_EFI_APPS_DRV0_PROTOCOL_GUID \ 10 | { 0xe4dcafd0, 0x586c, 0x4b3d, {0x86, 0xe7, 0x28, 0xde, 0x7f, 0xcc, 0x04, 0xb9} } 11 | 12 | INTERFACE_DECL(_GNU_EFI_APPS_DRV0_PROTOCOL); 13 | 14 | typedef 15 | EFI_STATUS 16 | (EFIAPI *GNU_EFI_APPS_DRV0_SAY_HELLO) ( 17 | IN const CHAR16 *HelloWho 18 | ); 19 | 20 | typedef 21 | EFI_STATUS 22 | (EFIAPI *GNU_EFI_APPS_DRV0_GET_NUMBER_OF_HELLO) ( 23 | OUT UINTN *NumberOfHello 24 | ); 25 | 26 | typedef struct _GNU_EFI_APPS_DRV0_PROTOCOL { 27 | GNU_EFI_APPS_DRV0_SAY_HELLO SayHello; 28 | GNU_EFI_APPS_DRV0_GET_NUMBER_OF_HELLO GetNumberOfHello; 29 | } GNU_EFI_APPS_DRV0_PROTOCOL; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/romload.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFI_ROMLOAD_H 2 | #define _EFI_ROMLOAD_H 3 | 4 | #define ROM_SIGNATURE 0xaa55 5 | #define PCIDS_SIGNATURE "PCIR" 6 | #pragma pack(push) 7 | #pragma pack(1) 8 | typedef struct 9 | { 10 | UINT8 Pcids_Sig[4]; 11 | UINT16 VendId; 12 | UINT16 DevId; 13 | UINT16 Vpd_Off; 14 | UINT16 Size; 15 | UINT8 Rev; 16 | UINT8 Class_Code[3]; 17 | UINT16 Image_Len; 18 | UINT16 Rev_Lvl; 19 | UINT8 Code_Type; 20 | UINT8 Indi; 21 | UINT16 Rsvd; 22 | }PciDataStructure; 23 | typedef struct 24 | { 25 | UINT16 Size; 26 | UINT32 Header_Sig; 27 | UINT16 SubSystem; 28 | UINT16 MachineType; 29 | UINT8 Resvd[10]; 30 | UINT16 EfiOffset; 31 | }ArchData; 32 | typedef struct 33 | { 34 | UINT16 Rom_Sig; 35 | ArchData Arch_Data; 36 | UINT16 Pcids_Off; 37 | UINT8 resvd[38]; 38 | }RomHeader; 39 | #pragma pack(pop) 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/x86_64/setjmp.S: -------------------------------------------------------------------------------- 1 | .text 2 | .globl setjmp 3 | #ifndef __MINGW32__ 4 | .type setjmp, @function 5 | #else 6 | .def setjmp; .scl 2; .type 32; .endef 7 | #endif 8 | setjmp: 9 | pop %rsi 10 | movq %rbx,0x00(%rdi) 11 | movq %rsp,0x08(%rdi) 12 | push %rsi 13 | movq %rbp,0x10(%rdi) 14 | movq %r12,0x18(%rdi) 15 | movq %r13,0x20(%rdi) 16 | movq %r14,0x28(%rdi) 17 | movq %r15,0x30(%rdi) 18 | movq %rsi,0x38(%rdi) 19 | xor %rax,%rax 20 | ret 21 | 22 | .globl longjmp 23 | #ifndef __MINGW32__ 24 | .type longjmp, @function 25 | #else 26 | .def longjmp; .scl 2; .type 32; .endef 27 | #endif 28 | longjmp: 29 | movl %esi, %eax 30 | movq 0x00(%rdi), %rbx 31 | movq 0x08(%rdi), %rsp 32 | movq 0x10(%rdi), %rbp 33 | movq 0x18(%rdi), %r12 34 | movq 0x20(%rdi), %r13 35 | movq 0x28(%rdi), %r14 36 | movq 0x30(%rdi), %r15 37 | xor %rdx,%rdx 38 | mov $1,%rcx 39 | cmp %rax,%rdx 40 | cmove %rcx,%rax 41 | jmp *0x38(%rdi) 42 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/ia64/efisetjmp_arch.h: -------------------------------------------------------------------------------- 1 | #ifndef GNU_EFI_IA64_SETJMP_H 2 | #define GNU_EFI_IA64_SETJMP_H 3 | 4 | #define JMPBUF_ALIGN 0x10 5 | 6 | typedef struct { 7 | UINT64 F2[2]; 8 | UINT64 F3[2]; 9 | UINT64 F4[2]; 10 | UINT64 F5[2]; 11 | UINT64 F16[2]; 12 | UINT64 F17[2]; 13 | UINT64 F18[2]; 14 | UINT64 F19[2]; 15 | UINT64 F20[2]; 16 | UINT64 F21[2]; 17 | UINT64 F22[2]; 18 | UINT64 F23[2]; 19 | UINT64 F24[2]; 20 | UINT64 F25[2]; 21 | UINT64 F26[2]; 22 | UINT64 F27[2]; 23 | UINT64 F28[2]; 24 | UINT64 F29[2]; 25 | UINT64 F30[2]; 26 | UINT64 F31[2]; 27 | UINT64 R4; 28 | UINT64 R5; 29 | UINT64 R6; 30 | UINT64 R7; 31 | UINT64 SP; 32 | UINT64 BR0; 33 | UINT64 BR1; 34 | UINT64 BR2; 35 | UINT64 BR3; 36 | UINT64 BR4; 37 | UINT64 BR5; 38 | UINT64 InitialUNAT; 39 | UINT64 AfterSpillUNAT; 40 | UINT64 PFS; 41 | UINT64 BSP; 42 | UINT64 Predicates; 43 | UINT64 LoopCount; 44 | UINT64 FPSR; 45 | } ALIGN(JMPBUF_ALIGN) jmp_buf[1]; 46 | 47 | #endif /* GNU_EFI_IA64_SETJMP_H */ 48 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/aarch64/initplat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copright (C) 2014 Linaro Ltd. 3 | * Author: Ard Biesheuvel 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice and this list of conditions, without modification. 10 | * 2. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * Alternatively, this software may be distributed under the terms of the 14 | * GNU General Public License as published by the Free Software Foundation; 15 | * either version 2 of the License, or (at your option) any later version. 16 | */ 17 | 18 | #include "lib.h" 19 | 20 | VOID 21 | InitializeLibPlatform ( 22 | IN EFI_HANDLE ImageHandle EFI_UNUSED, 23 | IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED 24 | ) 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/mips64el/initplat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copright (C) 2014 Linaro Ltd. 3 | * Author: Ard Biesheuvel 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice and this list of conditions, without modification. 10 | * 2. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * Alternatively, this software may be distributed under the terms of the 14 | * GNU General Public License as published by the Free Software Foundation; 15 | * either version 2 of the License, or (at your option) any later version. 16 | */ 17 | 18 | #include "lib.h" 19 | 20 | VOID 21 | InitializeLibPlatform ( 22 | IN EFI_HANDLE ImageHandle EFI_UNUSED, 23 | IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED 24 | ) 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/trivial.S: -------------------------------------------------------------------------------- 1 | .text 2 | .align 4 3 | 4 | .globl _start 5 | _start: 6 | #if 0 7 | pushl %ebp 8 | movl %esp,%ebp 9 | pushl %ebx # save ebx 10 | movl 12(%ebp),%eax # eax <- systab 11 | movl 24(%eax),%ebx # ebx <- systab->FirmwareVendor 12 | pushl %ebx 13 | movl 44(%eax),%ebx # ebx <- systab->ConOut 14 | pushl %ebx 15 | movl 4(%ebx),%eax # eax <- conout->OutputString 16 | call *%eax 17 | movl -4(%ebp),%ebx # restore ebx 18 | leave 19 | ret 20 | 21 | #else 22 | 23 | pushl %ebp 24 | movl %esp,%ebp 25 | pushl %ebx 26 | call 0f 27 | 0: popl %eax 28 | addl $hello-0b,%eax 29 | pushl %eax 30 | movl 12(%ebp),%eax # eax <- systab 31 | movl 44(%eax),%ebx # ebx <- systab->ConOut 32 | pushl %ebx 33 | movl 4(%ebx),%eax # eax <- conout->OutputString 34 | call *%eax 35 | movl -4(%ebp),%ebx 36 | leave 37 | ret 38 | 39 | .section .rodata 40 | .align 2 41 | hello: .byte 'h',0,'e',0,'l',0,'l',0,'o',0,'\n',0,'\r',0,0,0 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/arm/mullu.S: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | # 3 | # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
4 | # 5 | # This program and the accompanying materials 6 | # are licensed and made available under the terms and conditions of the BSD License 7 | # which accompanies this distribution. The full text of the license may be found at 8 | # http://opensource.org/licenses/bsd-license.php 9 | # 10 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | # 13 | #------------------------------------------------------------------------------ 14 | 15 | #include "edk2asm.h" 16 | 17 | .text 18 | GCC_ASM_EXPORT(__aeabi_lmul) 19 | # 20 | #INT64 21 | #EFIAPI 22 | #__aeabi_lmul ( 23 | # IN INT64 Multiplicand 24 | # IN INT64 Multiplier 25 | # ); 26 | # 27 | ASM_PFX(__aeabi_lmul): 28 | stmdb sp!, {lr} 29 | mov lr, r0 30 | umull r0, ip, r2, lr 31 | mla r1, r2, r1, ip 32 | mla r1, r3, lr, r1 33 | ldmia sp!, {pc} 34 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/arm/initplat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copright (C) 2014 Linaro Ltd. 3 | * Author: Ard Biesheuvel 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice and this list of conditions, without modification. 10 | * 2. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * Alternatively, this software may be distributed under the terms of the 14 | * GNU General Public License as published by the Free Software Foundation; 15 | * either version 2 of the License, or (at your option) any later version. 16 | */ 17 | 18 | #include "lib.h" 19 | 20 | VOID 21 | InitializeLibPlatform ( 22 | IN EFI_HANDLE ImageHandle EFI_UNUSED, 23 | IN EFI_SYSTEM_TABLE *SystemTable EFI_UNUSED 24 | ) 25 | { 26 | } 27 | 28 | #ifdef __GNUC__ 29 | void __div0(void) 30 | { 31 | // TODO handle divide by zero fault 32 | while (1); 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/ia32/setjmp.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. 3 | * This program and the accompanying materials are licensed and made 4 | available 5 | * under the terms and conditions of the BSD License which accompanies 6 | this 7 | * distribution. The full text of the license may be found at 8 | * http://opensource.org/licenses/bsd-license.php. 9 | * 10 | * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" 11 | BASIS, 12 | * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 13 | * IMPLIED. 14 | */ 15 | .text 16 | .globl setjmp 17 | #ifndef __MINGW32__ 18 | .type setjmp, @function 19 | #else 20 | .def setjmp; .scl 2; .type 32; .endef 21 | #endif 22 | setjmp: 23 | pop %ecx 24 | movl (%esp), %edx 25 | movl %ebx, (%edx) 26 | movl %esi, 4(%edx) 27 | movl %edi, 8(%edx) 28 | movl %ebp, 12(%edx) 29 | movl %esp, 16(%edx) 30 | xorl %eax, %eax 31 | jmp *%ecx 32 | 33 | .globl longjmp 34 | #ifndef __MINGW32__ 35 | .type longjmp, @function 36 | #else 37 | .def longjmp; .scl 2; .type 32; .endef 38 | #endif 39 | longjmp: 40 | pop %eax 41 | pop %edx 42 | pop %eax 43 | movl (%edx), %ebx 44 | movl 4(%edx), %esi 45 | movl 8(%edx), %edi 46 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/arm/llsl.S: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | # 3 | # Copyright (c) 2013, ARM. All rights reserved.
4 | # 5 | # This program and the accompanying materials 6 | # are licensed and made available under the terms and conditions of the BSD License 7 | # which accompanies this distribution. The full text of the license may be found at 8 | # http://opensource.org/licenses/bsd-license.php 9 | # 10 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | # 13 | #------------------------------------------------------------------------------ 14 | 15 | #include "edk2asm.h" 16 | 17 | .text 18 | .align 2 19 | GCC_ASM_EXPORT(__aeabi_llsl) 20 | 21 | # 22 | #VOID 23 | #EFIAPI 24 | #__aeabi_llsl ( 25 | # IN VOID *Destination, 26 | # IN VOID *Source, 27 | # IN UINT32 Size 28 | # ); 29 | # 30 | ASM_PFX(__aeabi_llsl): 31 | subs r3,r2,#0x20 32 | bpl 1f 33 | rsb r3,r2,#0x20 34 | lsl r1,r1,r2 35 | orr r1,r1,r0,lsr r3 36 | lsl r0,r0,r2 37 | bx lr 38 | 1: 39 | lsl r1,r0,r3 40 | mov r0,#0 41 | bx lr 42 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/arm/llsr.S: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | # 3 | # Copyright (c) 2013, ARM. All rights reserved.
4 | # 5 | # This program and the accompanying materials 6 | # are licensed and made available under the terms and conditions of the BSD License 7 | # which accompanies this distribution. The full text of the license may be found at 8 | # http://opensource.org/licenses/bsd-license.php 9 | # 10 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | # 13 | #------------------------------------------------------------------------------ 14 | 15 | #include "edk2asm.h" 16 | 17 | .text 18 | .align 2 19 | GCC_ASM_EXPORT(__aeabi_llsr) 20 | 21 | # 22 | #VOID 23 | #EFIAPI 24 | #__aeabi_llsr ( 25 | # IN VOID *Destination, 26 | # IN VOID *Source, 27 | # IN UINT32 Size 28 | # ); 29 | # 30 | ASM_PFX(__aeabi_llsr): 31 | subs r3,r2,#0x20 32 | bpl 1f 33 | rsb r3,r2,#0x20 34 | lsr r0,r0,r2 35 | orr r0,r0,r1,lsl r3 36 | lsr r1,r1,r2 37 | bx lr 38 | 1: 39 | lsr r0,r1,r3 40 | mov r1,#0 41 | bx lr 42 | -------------------------------------------------------------------------------- /ASPMEnabler/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 James Swineson 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 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. 8 | 9 | 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. -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/t6.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | typedef EFI_STATUS (*foo_t)(EFI_HANDLE, EFI_GUID *, VOID **); 5 | typedef struct { 6 | unsigned long addr; 7 | unsigned long gp; 8 | } fdesc_t; 9 | 10 | EFI_LOADED_IMAGE my_loaded; 11 | 12 | EFI_STATUS 13 | efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) 14 | { 15 | EFI_LOADED_IMAGE *loaded_image = NULL; 16 | #if 0 17 | EFI_DEVICE_PATH *dev_path; 18 | #endif 19 | EFI_STATUS status; 20 | 21 | InitializeLib(image, systab); 22 | status = uefi_call_wrapper(systab->BootServices->HandleProtocol, 23 | 3, 24 | image, 25 | &LoadedImageProtocol, 26 | (void **) &loaded_image); 27 | if (EFI_ERROR(status)) { 28 | Print(L"handleprotocol: %r\n", status); 29 | } 30 | 31 | #if 0 32 | BS->HandleProtocol(loaded_image->DeviceHandle, &DevicePathProtocol, (void **) &dev_path); 33 | 34 | Print(L"Image device : %s\n", DevicePathToStr(dev_path)); 35 | Print(L"Image file : %s\n", DevicePathToStr(loaded_image->FilePath)); 36 | #endif 37 | Print(L"Image base : %lx\n", loaded_image->ImageBase); 38 | Print(L"Image size : %lx\n", loaded_image->ImageSize); 39 | Print(L"Load options size : %lx\n", loaded_image->LoadOptionsSize); 40 | Print(L"Load options : %s\n", loaded_image->LoadOptions); 41 | 42 | return EFI_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efi.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | efi.h 8 | 9 | Abstract: 10 | 11 | Public EFI header files 12 | 13 | 14 | 15 | Revision History 16 | 17 | --*/ 18 | 19 | 20 | // Add a predefined macro to detect usage of the library 21 | #ifndef _GNU_EFI 22 | #define _GNU_EFI 23 | #endif 24 | 25 | // 26 | // Build flags on input 27 | // EFI32 28 | // EFI_DEBUG - Enable debugging code 29 | // EFI_NT_EMULATOR - Building for running under NT 30 | // 31 | 32 | 33 | #ifndef _EFI_INCLUDE_ 34 | #define _EFI_INCLUDE_ 35 | 36 | #define EFI_FIRMWARE_VENDOR L"INTEL" 37 | #define EFI_FIRMWARE_MAJOR_REVISION 12 38 | #define EFI_FIRMWARE_MINOR_REVISION 33 39 | #define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) | (EFI_FIRMWARE_MINOR_REVISION)) 40 | 41 | #include "efibind.h" 42 | #include "eficompiler.h" 43 | #include "efidef.h" 44 | #include "efidevp.h" 45 | #include "efipciio.h" 46 | #include "efiprot.h" 47 | #include "eficon.h" 48 | #include "efiser.h" 49 | #include "efi_nii.h" 50 | #include "efipxebc.h" 51 | #include "efinet.h" 52 | #include "efiapi.h" 53 | #include "efifs.h" 54 | #include "efierr.h" 55 | #include "efiui.h" 56 | #include "efiip.h" 57 | #include "efiudp.h" 58 | #include "efitcp.h" 59 | #include "efipoint.h" 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/runtime/rtdata.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | data.c 8 | 9 | Abstract: 10 | 11 | EFI library global data 12 | 13 | 14 | 15 | Revision History 16 | 17 | --*/ 18 | 19 | #include "lib.h" 20 | 21 | 22 | // 23 | // These globals are runtime globals 24 | // 25 | // N.B. The Microsoft C compiler will only put the data in the 26 | // right data section if it is explicitly initialized.. 27 | // 28 | 29 | #ifndef __GNUC__ 30 | #pragma BEGIN_RUNTIME_DATA() 31 | #endif 32 | 33 | // 34 | // RT - pointer to the runtime table 35 | // 36 | 37 | EFI_RUNTIME_SERVICES *RT; 38 | 39 | // 40 | // LibStandalone - TRUE if lib is linked in as part of the firmware. 41 | // N.B. The EFI fw sets this value directly 42 | // 43 | 44 | BOOLEAN LibFwInstance; 45 | 46 | // 47 | // EFIDebug - Debug mask 48 | // 49 | 50 | UINTN EFIDebug = EFI_DBUG_MASK; 51 | 52 | // 53 | // LibRuntimeDebugOut - Runtime Debug Output device 54 | // 55 | 56 | SIMPLE_TEXT_OUTPUT_INTERFACE *LibRuntimeDebugOut; 57 | 58 | // 59 | // LibRuntimeRaiseTPL, LibRuntimeRestoreTPL - pointers to Runtime functions from the 60 | // Boot Services Table 61 | // 62 | 63 | EFI_RAISE_TPL LibRuntimeRaiseTPL = NULL; 64 | EFI_RESTORE_TPL LibRuntimeRestoreTPL = NULL; 65 | 66 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/elf_arm_efi.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") 2 | OUTPUT_ARCH(arm) 3 | ENTRY(_start) 4 | SECTIONS 5 | { 6 | .text 0x0 : { 7 | _text = .; 8 | *(.text.head) 9 | *(.text) 10 | *(.text.*) 11 | *(.gnu.linkonce.t.*) 12 | *(.srodata) 13 | *(.rodata*) 14 | . = ALIGN(16); 15 | } 16 | _etext = .; 17 | _text_size = . - _text; 18 | .dynamic : { *(.dynamic) } 19 | .data : 20 | { 21 | _data = .; 22 | *(.sdata) 23 | *(.data) 24 | *(.data1) 25 | *(.data.*) 26 | *(.got.plt) 27 | *(.got) 28 | 29 | /* the EFI loader doesn't seem to like a .bss section, so we stick 30 | it all into .data: */ 31 | . = ALIGN(16); 32 | _bss = .; 33 | *(.sbss) 34 | *(.scommon) 35 | *(.dynbss) 36 | *(.bss) 37 | *(.bss.*) 38 | *(COMMON) 39 | . = ALIGN(16); 40 | _bss_end = .; 41 | } 42 | 43 | .rel.dyn : { *(.rel.dyn) } 44 | .rel.plt : { *(.rel.plt) } 45 | .rel.got : { *(.rel.got) } 46 | .rel.data : { *(.rel.data) *(.rel.data*) } 47 | _edata = .; 48 | _data_size = . - _etext; 49 | 50 | . = ALIGN(4096); 51 | .dynsym : { *(.dynsym) } 52 | . = ALIGN(4096); 53 | .dynstr : { *(.dynstr) } 54 | . = ALIGN(4096); 55 | .note.gnu.build-id : { *(.note.gnu.build-id) } 56 | /DISCARD/ : 57 | { 58 | *(.rel.reloc) 59 | *(.eh_frame) 60 | *(.note.GNU-stack) 61 | } 62 | .comment 0 : { *(.comment) } 63 | } 64 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efipart.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFI_PART_H 2 | #define _EFI_PART_H 3 | 4 | /*++ 5 | 6 | Copyright (c) 1998 Intel Corporation 7 | 8 | Module Name: 9 | 10 | efipart.h 11 | 12 | Abstract: 13 | Info about disk partitions and Master Boot Records 14 | 15 | 16 | 17 | 18 | Revision History 19 | 20 | --*/ 21 | 22 | // 23 | // 24 | // 25 | 26 | #define EFI_PARTITION 0xef 27 | #define MBR_SIZE 512 28 | 29 | #pragma pack(1) 30 | 31 | typedef struct { 32 | UINT8 BootIndicator; 33 | UINT8 StartHead; 34 | UINT8 StartSector; 35 | UINT8 StartTrack; 36 | UINT8 OSIndicator; 37 | UINT8 EndHead; 38 | UINT8 EndSector; 39 | UINT8 EndTrack; 40 | UINT8 StartingLBA[4]; 41 | UINT8 SizeInLBA[4]; 42 | } MBR_PARTITION_RECORD; 43 | 44 | #define EXTRACT_UINT32(D) (UINT32)(D[0] | (D[1] << 8) | (D[2] << 16) | (D[3] << 24)) 45 | 46 | #define MBR_SIGNATURE 0xaa55 47 | #define MIN_MBR_DEVICE_SIZE 0x80000 48 | #define MBR_ERRATA_PAD 0x40000 // 128 MB 49 | 50 | #define MAX_MBR_PARTITIONS 4 51 | typedef struct { 52 | UINT8 BootStrapCode[440]; 53 | UINT8 UniqueMbrSignature[4]; 54 | UINT8 Unknown[2]; 55 | MBR_PARTITION_RECORD Partition[MAX_MBR_PARTITIONS]; 56 | UINT16 Signature; 57 | } MASTER_BOOT_RECORD; 58 | #pragma pack() 59 | 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/elf_aarch64_efi.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") 2 | OUTPUT_ARCH(aarch64) 3 | ENTRY(_start) 4 | SECTIONS 5 | { 6 | .text 0x0 : { 7 | _text = .; 8 | *(.text.head) 9 | *(.text) 10 | *(.text.*) 11 | *(.gnu.linkonce.t.*) 12 | *(.srodata) 13 | *(.rodata*) 14 | . = ALIGN(16); 15 | } 16 | _etext = .; 17 | _text_size = . - _text; 18 | .dynamic : { *(.dynamic) } 19 | .data : ALIGN(4096) 20 | { 21 | _data = .; 22 | *(.sdata) 23 | *(.data) 24 | *(.data1) 25 | *(.data.*) 26 | *(.got.plt) 27 | *(.got) 28 | 29 | /* the EFI loader doesn't seem to like a .bss section, so we stick 30 | it all into .data: */ 31 | . = ALIGN(16); 32 | _bss = .; 33 | *(.sbss) 34 | *(.scommon) 35 | *(.dynbss) 36 | *(.bss) 37 | *(COMMON) 38 | . = ALIGN(16); 39 | _bss_end = .; 40 | } 41 | 42 | .rela.dyn : { *(.rela.dyn) } 43 | .rela.plt : { *(.rela.plt) } 44 | .rela.got : { *(.rela.got) } 45 | .rela.data : { *(.rela.data) *(.rela.data*) } 46 | . = ALIGN(512); 47 | _edata = .; 48 | _data_size = . - _data; 49 | 50 | . = ALIGN(4096); 51 | .dynsym : { *(.dynsym) } 52 | . = ALIGN(4096); 53 | .dynstr : { *(.dynstr) } 54 | . = ALIGN(4096); 55 | .note.gnu.build-id : { *(.note.gnu.build-id) } 56 | /DISCARD/ : 57 | { 58 | *(.rel.reloc) 59 | *(.eh_frame) 60 | *(.note.GNU-stack) 61 | } 62 | .comment 0 : { *(.comment) } 63 | } 64 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/ia64/efilibplat.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFI_LIB_PLAT_H 2 | #define _EFI_LIB_PLAT_H 3 | /*++ 4 | 5 | Copyright (c) 1998 Intel Corporation 6 | 7 | Module Name: 8 | 9 | efilibplat.h 10 | 11 | Abstract: 12 | 13 | EFI to compile bindings 14 | 15 | 16 | 17 | Revision History 18 | 19 | --*/ 20 | 21 | #include "salproc.h" 22 | 23 | 24 | VOID 25 | InitializeLibPlatform ( 26 | IN EFI_HANDLE ImageHandle, 27 | IN EFI_SYSTEM_TABLE *SystemTable 28 | ); 29 | 30 | VOID 31 | LibInitSalAndPalProc( 32 | OUT PLABEL *SalPlabel, 33 | OUT UINT64 *PalEntry 34 | ); 35 | 36 | EFI_STATUS 37 | LibGetSalIoPortMapping ( 38 | OUT UINT64 *IoPortMapping 39 | ); 40 | 41 | EFI_STATUS 42 | LibGetSalIpiBlock ( 43 | OUT UINT64 *IpiBlock 44 | ); 45 | 46 | EFI_STATUS 47 | LibGetSalWakeupVector ( 48 | OUT UINT64 *WakeVector 49 | ); 50 | 51 | VOID * 52 | LibSearchSalSystemTable ( 53 | IN UINT8 EntryType 54 | ); 55 | 56 | 57 | VOID 58 | LibSalProc ( 59 | IN UINT64 Arg1, 60 | IN UINT64 Arg2, 61 | IN UINT64 Arg3, 62 | IN UINT64 Arg4, 63 | IN UINT64 Arg5, 64 | IN UINT64 Arg6, 65 | IN UINT64 Arg7, 66 | IN UINT64 Arg8, 67 | OUT rArg *Results OPTIONAL 68 | ); 69 | 70 | VOID 71 | LibPalProc ( 72 | IN UINT64 Arg1, 73 | IN UINT64 Arg2, 74 | IN UINT64 Arg3, 75 | IN UINT64 Arg4, 76 | OUT rArg *Results OPTIONAL 77 | ); 78 | 79 | #endif 80 | 81 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/elf_mips64el_efi.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("elf64-tradlittlemips", "elf64-tradbigmips", "elf64-tradlittlemips") 2 | OUTPUT_ARCH(mips) 3 | ENTRY(_start) 4 | SECTIONS 5 | { 6 | .text 0x0 : { 7 | _text = .; 8 | *(.text.head) 9 | *(.text) 10 | *(.text.*) 11 | *(.gnu.linkonce.t.*) 12 | *(.srodata) 13 | *(.rodata*) 14 | . = ALIGN(16); 15 | } 16 | _etext = .; 17 | _text_size = . - _text; 18 | .dynamic : { *(.dynamic) } 19 | .data : 20 | { 21 | _data = .; 22 | *(.sdata) 23 | *(.data) 24 | *(.data1) 25 | *(.data.*) 26 | *(.got.plt) 27 | HIDDEN (_gp = ALIGN (16) + 0x7ff0); 28 | *(.got) 29 | 30 | /* the EFI loader doesn't seem to like a .bss section, so we stick 31 | it all into .data: */ 32 | . = ALIGN(16); 33 | _bss = .; 34 | *(.sbss) 35 | *(.scommon) 36 | *(.dynbss) 37 | *(.bss) 38 | *(COMMON) 39 | . = ALIGN(16); 40 | _bss_end = .; 41 | } 42 | 43 | .rel.dyn : { *(.rel.dyn) } 44 | .rel.plt : { *(.rel.plt) } 45 | .rel.got : { *(.rel.got) } 46 | .rel.data : { *(.rel.data) *(.rel.data*) } 47 | _edata = .; 48 | _data_size = . - _etext; 49 | 50 | . = ALIGN(4096); 51 | .dynsym : { *(.dynsym) } 52 | . = ALIGN(4096); 53 | .dynstr : { *(.dynstr) } 54 | . = ALIGN(4096); 55 | .note.gnu.build-id : { *(.note.gnu.build-id) } 56 | /DISCARD/ : 57 | { 58 | *(.rel.reloc) 59 | *(.eh_frame) 60 | *(.MIPS.abiflags) 61 | *(.note.GNU-stack) 62 | } 63 | .comment 0 : { *(.comment) } 64 | } 65 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/ia64/palproc.h: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // Copyright (c) 1996-99 Intel Corp. 4 | // 5 | // 6 | //Module Name: 7 | // 8 | // palproc.h 9 | // 10 | //Abstract: 11 | // 12 | // This module contains generic macros for an IA64 assembly writer. 13 | // 14 | // 15 | //Revision History 16 | // 17 | 18 | #ifndef _PALPROC_H 19 | #define _PALPROC_H 20 | 21 | #define PROCEDURE_ENTRY(name) .##text; \ 22 | .##type name, @function; \ 23 | .##global name; \ 24 | .##proc name; \ 25 | name: 26 | 27 | #define PROCEDURE_EXIT(name) .##endp name 28 | 29 | // Note: use of NESTED_SETUP requires number of locals (l) >= 3 30 | 31 | #define NESTED_SETUP(i,l,o,r) \ 32 | alloc loc1=ar##.##pfs,i,l,o,r ;\ 33 | mov loc0=b0 34 | 35 | #define NESTED_RETURN \ 36 | mov b0=loc0 ;\ 37 | mov ar##.##pfs=loc1 ;;\ 38 | br##.##ret##.##dpnt b0;; 39 | 40 | 41 | // defines needed in palproc.s 42 | 43 | #define PAL_MC_CLEAR_LOG 0x0015 44 | #define PAL_MC_DRAIN 0x0016 45 | #define PAL_MC_EXPECTED 0x0017 46 | #define PAL_MC_DYNAMIC_STATE 0x0018 47 | #define PAL_MC_ERROR_INFO 0x0019 48 | #define PAL_MC_RESUME 0x001a 49 | #define PAL_MC_REGISTER_MEM 0x001b 50 | 51 | #endif // _PALPROC_H 52 | -------------------------------------------------------------------------------- /ASPMEnabler/listacpi.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef __LISTACPI_H__ 3 | #define __LISTACPI_H__ 4 | 5 | typedef struct { 6 | CHAR8 Signature[8]; 7 | UINT8 Checksum; 8 | UINT8 OemId[6]; 9 | UINT8 Revision; 10 | UINT32 RsdtAddress; 11 | UINT32 Length; 12 | UINT64 XsdtAddress; 13 | UINT8 ExtendedChecksum; 14 | UINT8 Reserved[3]; 15 | } EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER; 16 | 17 | 18 | // XSDT is the main System Description Table. 19 | // There are many kinds of SDT. An SDT may be split into two parts - 20 | // A common header and a data section which is different for each table. 21 | typedef struct { 22 | CHAR8 Signature[4]; 23 | UINT32 Length; 24 | UINT8 Revision; 25 | UINT8 Checksum; 26 | CHAR8 OemId[6]; 27 | CHAR8 OemTableId[8]; 28 | UINT32 OemRevision; 29 | UINT32 CreatorId; 30 | UINT32 CreatorRevision; 31 | } EFI_ACPI_SDT_HEADER; 32 | 33 | 34 | #define EFI_ACPI_TABLE_GUID \ 35 | { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }} 36 | #define EFI_ACPI_20_TABLE_GUID \ 37 | { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }} 38 | 39 | #define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION 0x02 40 | 41 | UINTN 42 | myStrnCmpA(CHAR8* s1, CHAR8* s2, UINTN len); 43 | 44 | VOID 45 | Ascii2UnicodeStr(CHAR8* String, CHAR16* UniString, UINT8 length); 46 | 47 | int 48 | ParseRSDP(EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER* Rsdp, CHAR16* GuidStr); 49 | 50 | VOID 51 | Guid2String(CHAR16* Buffer, EFI_GUID* Guid); 52 | 53 | #endif -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/elf_x86_64_fbsd_efi.lds: -------------------------------------------------------------------------------- 1 | /* Same as elf_x86_64_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */ 2 | OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd") 3 | OUTPUT_ARCH(i386:x86-64) 4 | ENTRY(_start) 5 | SECTIONS 6 | { 7 | . = 0; 8 | ImageBase = .; 9 | /* .hash and/or .gnu.hash MUST come first! */ 10 | .hash : { *(.hash) } 11 | .gnu.hash : { *(.gnu.hash) } 12 | . = ALIGN(4096); 13 | .eh_frame : 14 | { 15 | *(.eh_frame) 16 | } 17 | . = ALIGN(4096); 18 | .text : 19 | { 20 | _text = .; 21 | *(.text) 22 | . = ALIGN(16); 23 | } 24 | _etext = .; 25 | _text_size = . - _text; 26 | .reloc : 27 | { 28 | *(.reloc) 29 | } 30 | . = ALIGN(4096); 31 | .data : 32 | { 33 | _data = .; 34 | *(.rodata*) 35 | *(.got.plt) 36 | *(.got) 37 | *(.data*) 38 | *(.sdata) 39 | /* the EFI loader doesn't seem to like a .bss section, so we stick 40 | it all into .data: */ 41 | *(.sbss) 42 | *(.scommon) 43 | *(.dynbss) 44 | *(.bss) 45 | *(COMMON) 46 | *(.rel.local) 47 | } 48 | .note.gnu.build-id : { *(.note.gnu.build-id) } 49 | 50 | . = ALIGN(4096); 51 | .dynamic : { *(.dynamic) } 52 | . = ALIGN(4096); 53 | .rela : 54 | { 55 | *(.rela.data*) 56 | *(.rela.got) 57 | *(.rela.stab) 58 | } 59 | _edata = .; 60 | _data_size = . - _etext; 61 | . = ALIGN(4096); 62 | .dynsym : { *(.dynsym) } 63 | . = ALIGN(4096); 64 | .dynstr : { *(.dynstr) } 65 | . = ALIGN(4096); 66 | .ignored.reloc : 67 | { 68 | *(.rela.reloc) 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/ia64/math.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | math.c 8 | 9 | Abstract: 10 | 11 | 12 | 13 | 14 | Revision History 15 | 16 | --*/ 17 | 18 | #include "lib.h" 19 | 20 | 21 | // 22 | // Declare runtime functions 23 | // 24 | 25 | #ifdef RUNTIME_CODE 26 | #ifndef __GNUC__ 27 | #pragma RUNTIME_CODE(LShiftU64) 28 | #pragma RUNTIME_CODE(RShiftU64) 29 | #pragma RUNTIME_CODE(MultU64x32) 30 | #pragma RUNTIME_CODE(DivU64x32) 31 | #endif 32 | #endif 33 | 34 | // 35 | // 36 | // 37 | 38 | 39 | 40 | 41 | UINT64 42 | LShiftU64 ( 43 | IN UINT64 Operand, 44 | IN UINTN Count 45 | ) 46 | // Left shift 64bit by 32bit and get a 64bit result 47 | { 48 | return Operand << Count; 49 | } 50 | 51 | UINT64 52 | RShiftU64 ( 53 | IN UINT64 Operand, 54 | IN UINTN Count 55 | ) 56 | // Right shift 64bit by 32bit and get a 64bit result 57 | { 58 | return Operand >> Count; 59 | } 60 | 61 | 62 | UINT64 63 | MultU64x32 ( 64 | IN UINT64 Multiplicand, 65 | IN UINTN Multiplier 66 | ) 67 | // Multiple 64bit by 32bit and get a 64bit result 68 | { 69 | return Multiplicand * Multiplier; 70 | } 71 | 72 | UINT64 73 | DivU64x32 ( 74 | IN UINT64 Dividend, 75 | IN UINTN Divisor, 76 | OUT UINTN *Remainder OPTIONAL 77 | ) 78 | // divide 64bit by 32bit and get a 64bit result 79 | // N.B. only works for 31bit divisors!! 80 | { 81 | ASSERT (Divisor != 0); 82 | 83 | if (Remainder) { 84 | *Remainder = Dividend % Divisor; 85 | } 86 | 87 | return Dividend / Divisor; 88 | } 89 | -------------------------------------------------------------------------------- /ASPMEnabler/.vs/msvc/ASPMEnabler.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {b1c3b304-e868-4b07-988c-36ad7bc57300} 14 | 15 | 16 | 17 | 18 | Resource Files 19 | 20 | 21 | 22 | 23 | Source Files 24 | 25 | 26 | Source Files 27 | 28 | 29 | Source Files 30 | 31 | 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/makefile.hdr: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # This is a machine generated file - DO NOT EDIT 4 | # Generated by genmake.exe 5 | # Generated from make.inf 6 | # Copyright (c) 1998 Intel Corporation 7 | # 8 | 9 | INC_DEPS = $(INC_DEPS) \ 10 | $(SDK_INSTALL_DIR)\include\efi\efi.h \ 11 | $(SDK_INSTALL_DIR)\include\efi\efiapi.h \ 12 | $(SDK_INSTALL_DIR)\include\efi\eficon.h \ 13 | $(SDK_INSTALL_DIR)\include\efi\efidebug.h \ 14 | $(SDK_INSTALL_DIR)\include\efi\efidef.h \ 15 | $(SDK_INSTALL_DIR)\include\efi\efidevp.h \ 16 | $(SDK_INSTALL_DIR)\include\efi\efierr.h \ 17 | $(SDK_INSTALL_DIR)\include\efi\efifs.h \ 18 | $(SDK_INSTALL_DIR)\include\efi\efilib.h \ 19 | $(SDK_INSTALL_DIR)\include\efi\efipart.h \ 20 | $(SDK_INSTALL_DIR)\include\efi\efipciio.h \ 21 | $(SDK_INSTALL_DIR)\include\efi\efiprot.h \ 22 | $(SDK_INSTALL_DIR)\include\efi\efipxebc.h \ 23 | $(SDK_INSTALL_DIR)\include\efi\efistdarg.h \ 24 | $(SDK_INSTALL_DIR)\include\efi\efinet.h \ 25 | $(SDK_INSTALL_DIR)\include\efi\efiip.h \ 26 | $(SDK_INSTALL_DIR)\include\efi\efiudp.h \ 27 | $(SDK_INSTALL_DIR)\include\efi\efitcp.h \ 28 | 29 | 30 | !IF "$(PROCESSOR)" == "Ia32" 31 | INC_DEPS = $(INC_DEPS) \ 32 | $(SDK_INSTALL_DIR)\include\efi\Ia32\efibind.h \ 33 | $(SDK_INSTALL_DIR)\include\efi\Ia32\pe.h \ 34 | $(SDK_INSTALL_DIR)\include\efi\Ia32\efilibplat.h \ 35 | 36 | 37 | !ENDIF 38 | 39 | 40 | !IF "$(PROCESSOR)" == "Ia64" 41 | INC_DEPS = $(INC_DEPS) \ 42 | $(SDK_INSTALL_DIR)\include\efi\Ia64\efibind.h \ 43 | $(SDK_INSTALL_DIR)\include\efi\Ia64\pe.h \ 44 | $(SDK_INSTALL_DIR)\include\efi\Ia64\efilibplat.h \ 45 | 46 | 47 | !ENDIF 48 | 49 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/README.efilib: -------------------------------------------------------------------------------- 1 | 2 | The files in the "lib" and "inc" subdirectories are using the EFI Application 3 | Toolkit distributed by Intel at http://developer.intel.com/technology/efi 4 | 5 | This code is covered by the following agreement: 6 | 7 | Copyright (c) 1998-2000 Intel Corporation 8 | 9 | Redistribution and use in source and binary forms, with or without modification, are permitted 10 | provided that the following conditions are met: 11 | 12 | Redistributions of source code must retain the above copyright notice, this list of conditions and 13 | the following disclaimer. 14 | 15 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions 16 | and the following disclaimer in the documentation and/or other materials provided with the 17 | distribution. 18 | 19 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 20 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. THE EFI SPECIFICATION AND ALL OTHER INFORMATION 29 | ON THIS WEB SITE ARE PROVIDED "AS IS" WITH NO WARRANTIES, AND ARE SUBJECT 30 | TO CHANGE WITHOUT NOTICE. 31 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/aarch64/setjmp.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. 3 | * This program and the accompanying materials are licensed and made 4 | available 5 | * under the terms and conditions of the BSD License which accompanies 6 | this 7 | * distribution. The full text of the license may be found at 8 | * http://opensource.org/licenses/bsd-license.php. 9 | * 10 | * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" 11 | BASIS, 12 | * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 13 | * IMPLIED. 14 | */ 15 | .text 16 | .p2align 3 17 | 18 | #define GPR_LAYOUT \ 19 | REG_PAIR (x19, x20, 0); \ 20 | REG_PAIR (x21, x22, 16); \ 21 | REG_PAIR (x23, x24, 32); \ 22 | REG_PAIR (x25, x26, 48); \ 23 | REG_PAIR (x27, x28, 64); \ 24 | REG_PAIR (x29, x30, 80); \ 25 | REG_ONE (x16, 96) 26 | 27 | #define FPR_LAYOUT \ 28 | REG_PAIR(d8, d9, 112); \ 29 | REG_PAIR(d10, d11, 128); \ 30 | REG_PAIR(d12, d13, 144); \ 31 | REG_PAIR(d14, d15, 160); 32 | 33 | #define REG_PAIR(REG1, REG2, OFFS) stp REG1, REG2, [x0, OFFS] 34 | #define REG_ONE(REG1, OFFS) str REG1, [x0, OFFS] 35 | 36 | .globl setjmp 37 | .type setjmp, @function 38 | setjmp: 39 | mov x16, sp 40 | GPR_LAYOUT 41 | FPR_LAYOUT 42 | mov w0, #0 43 | ret 44 | 45 | #undef REG_PAIR 46 | #undef REG_ONE 47 | 48 | #define REG_PAIR(REG1, REG2, OFFS) ldp REG1, REG2, [x0, OFFS] 49 | #define REG_ONE(REG1, OFFS) ldr REG1, [x0, OFFS] 50 | 51 | .globl longjmp 52 | .type longjmp, @function 53 | longjmp: 54 | GPR_LAYOUT 55 | FPR_LAYOUT 56 | mov sp, x16 57 | cmp w1, #0 58 | mov w0, #1 59 | csel w0, w1, w0, ne 60 | br x30 61 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/elf_x86_64_efi.lds: -------------------------------------------------------------------------------- 1 | /* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */ 2 | OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") 3 | OUTPUT_ARCH(i386:x86-64) 4 | ENTRY(_start) 5 | SECTIONS 6 | { 7 | . = 0; 8 | ImageBase = .; 9 | /* .hash and/or .gnu.hash MUST come first! */ 10 | .hash : { *(.hash) } 11 | .gnu.hash : { *(.gnu.hash) } 12 | . = ALIGN(4096); 13 | .eh_frame : 14 | { 15 | *(.eh_frame) 16 | } 17 | . = ALIGN(4096); 18 | .text : 19 | { 20 | _text = .; 21 | *(.text) 22 | *(.text.*) 23 | *(.gnu.linkonce.t.*) 24 | . = ALIGN(16); 25 | } 26 | _etext = .; 27 | _text_size = . - _text; 28 | . = ALIGN(4096); 29 | .reloc : 30 | { 31 | *(.reloc) 32 | } 33 | . = ALIGN(4096); 34 | .data : 35 | { 36 | _data = .; 37 | *(.rodata*) 38 | *(.got.plt) 39 | *(.got) 40 | *(.data*) 41 | *(.sdata) 42 | /* the EFI loader doesn't seem to like a .bss section, so we stick 43 | it all into .data: */ 44 | *(.sbss) 45 | *(.scommon) 46 | *(.dynbss) 47 | *(.bss) 48 | *(COMMON) 49 | *(.rel.local) 50 | } 51 | .note.gnu.build-id : { *(.note.gnu.build-id) } 52 | 53 | _edata = .; 54 | _data_size = . - _etext; 55 | . = ALIGN(4096); 56 | .dynamic : { *(.dynamic) } 57 | . = ALIGN(4096); 58 | .rela : 59 | { 60 | *(.rela.data*) 61 | *(.rela.got) 62 | *(.rela.stab) 63 | } 64 | . = ALIGN(4096); 65 | .dynsym : { *(.dynsym) } 66 | . = ALIGN(4096); 67 | .dynstr : { *(.dynstr) } 68 | . = ALIGN(4096); 69 | .ignored.reloc : 70 | { 71 | *(.rela.reloc) 72 | *(.eh_frame) 73 | *(.note.GNU-stack) 74 | } 75 | .comment 0 : { *(.comment) } 76 | } 77 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efiui.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFI_UI_H 2 | #define _EFI_UI_H 3 | 4 | /*++ 5 | 6 | Copyright (c) 200 Intel Corporation 7 | 8 | Module Name: 9 | 10 | EfiUi.h 11 | 12 | Abstract: 13 | Protocol used to build User Interface (UI) stuff. 14 | 15 | This protocol is just data. It is a multi dimentional array. 16 | For each string there is an array of UI_STRING_ENTRY. Each string 17 | is for a different language translation of the same string. The list 18 | is terminated by a NULL UiString. There can be any number of 19 | UI_STRING_ENTRY arrays. A NULL array terminates the list. A NULL array 20 | entry contains all zeros. 21 | 22 | Thus the shortest possible EFI_UI_PROTOCOL has three UI_STRING_ENTRY. 23 | The String, it's NULL terminator, and the NULL terminator for the entire 24 | thing. 25 | 26 | 27 | Revision History 28 | 29 | --*/ 30 | 31 | #define EFI_UI_INTERFACE_PROTOCOL_GUID \ 32 | { 0x32dd7981, 0x2d27, 0x11d4, {0xbc, 0x8b, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } 33 | #define EFI_UI_PROTOCOL EFI_UI_INTERFACE_PROTOCOL_GUID 34 | 35 | 36 | typedef enum { 37 | UiDeviceString, 38 | UiVendorString, 39 | UiMaxString 40 | } UI_STRING_TYPE; 41 | 42 | typedef struct { 43 | ISO_639_2 *LangCode; 44 | CHAR16 *UiString; 45 | } UI_STRING_ENTRY; 46 | 47 | #define EFI_UI_INTERFACE_PROTOCOL_VERSION 0x00010000 48 | #define EFI_UI_VERSION EFI_UI_INTERFACE_PROTOCOL_VERSION 49 | 50 | typedef struct _EFI_UI_INTERFACE_PROTOCOL { 51 | UINT32 Version; 52 | UI_STRING_ENTRY *Entry; 53 | } EFI_UI_INTERFACE_PROTOCOL; 54 | 55 | typedef struct _EFI_UI_INTERFACE_PROTOCOL _UI_INTERFACE; 56 | typedef EFI_UI_INTERFACE_PROTOCOL UI_INTERFACE; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/arm/ldivmod.S: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
4 | // 5 | // This program and the accompanying materials 6 | // are licensed and made available under the terms and conditions of the BSD License 7 | // which accompanies this distribution. The full text of the license may be found at 8 | // http://opensource.org/licenses/bsd-license.php 9 | // 10 | // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | // 13 | //------------------------------------------------------------------------------ 14 | 15 | 16 | #include "edk2asm.h" 17 | 18 | .text 19 | .align 2 20 | GCC_ASM_EXPORT(__aeabi_ldivmod) 21 | 22 | // 23 | // A pair of (unsigned) long longs is returned in {{r0, r1}, {r2, r3}}, 24 | // the quotient in {r0, r1}, and the remainder in {r2, r3}. 25 | // 26 | //__value_in_regs lldiv_t 27 | //EFIAPI 28 | //__aeabi_ldivmod ( 29 | // IN UINT64 Dividen 30 | // IN UINT64 Divisor 31 | // )// 32 | // 33 | 34 | ASM_PFX(__aeabi_ldivmod): 35 | push {r4,lr} 36 | asrs r4,r1,#1 37 | eor r4,r4,r3,LSR #1 38 | bpl L_Test1 39 | rsbs r0,r0,#0 40 | rsc r1,r1,#0 41 | L_Test1: 42 | tst r3,r3 43 | bpl L_Test2 44 | rsbs r2,r2,#0 45 | rsc r3,r3,#0 46 | L_Test2: 47 | bl ASM_PFX(__aeabi_uldivmod) 48 | tst r4,#0x40000000 49 | beq L_Test3 50 | rsbs r0,r0,#0 51 | rsc r1,r1,#0 52 | L_Test3: 53 | tst r4,#0x80000000 54 | beq L_Exit 55 | rsbs r2,r2,#0 56 | rsc r3,r3,#0 57 | L_Exit: 58 | pop {r4,pc} 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/elf_ia64_efi.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("elf64-ia64-little") 2 | OUTPUT_ARCH(ia64) 3 | ENTRY(_start_plabel) 4 | SECTIONS 5 | { 6 | . = 0; 7 | ImageBase = .; 8 | /* .hash and/or .gnu.hash MUST come first! */ 9 | .hash : { *(.hash) } 10 | .gnu.hash : { *(.gnu.hash) } 11 | . = ALIGN(4096); 12 | .text : 13 | { 14 | _text = .; 15 | *(.text) 16 | *(.text.*) 17 | *(.gnu.linkonce.t.*) 18 | . = ALIGN(16); 19 | } 20 | _etext = .; 21 | _text_size = . - _text; 22 | . = ALIGN(4096); 23 | __gp = ALIGN (8) + 0x200000; 24 | .sdata : 25 | { 26 | _data = .; 27 | *(.got.plt) 28 | *(.got) 29 | *(.srodata) 30 | *(.sdata) 31 | *(.sbss) 32 | *(.scommon) 33 | } 34 | . = ALIGN(4096); 35 | .data : 36 | { 37 | *(.rodata*) 38 | *(.ctors) 39 | *(.data*) 40 | *(.gnu.linkonce.d*) 41 | *(.plabel) /* data whose relocs we want to ignore */ 42 | /* the EFI loader doesn't seem to like a .bss section, so we stick 43 | it all into .data: */ 44 | *(.dynbss) 45 | *(.bss) 46 | *(COMMON) 47 | } 48 | .note.gnu.build-id : { *(.note.gnu.build-id) } 49 | 50 | . = ALIGN(4096); 51 | .dynamic : { *(.dynamic) } 52 | . = ALIGN(4096); 53 | .rela : 54 | { 55 | *(.rela.text) 56 | *(.rela.data*) 57 | *(.rela.sdata) 58 | *(.rela.got) 59 | *(.rela.gnu.linkonce.d*) 60 | *(.rela.stab) 61 | *(.rela.ctors) 62 | } 63 | _edata = .; 64 | _data_size = . - _etext; 65 | . = ALIGN(4096); 66 | .reloc : /* This is the PECOFF .reloc section! */ 67 | { 68 | *(.reloc) 69 | } 70 | . = ALIGN(4096); 71 | .dynsym : { *(.dynsym) } 72 | . = ALIGN(4096); 73 | .dynstr : { *(.dynstr) } 74 | /DISCARD/ : 75 | { 76 | *(.rela.plabel) 77 | *(.rela.reloc) 78 | *(.IA_64.unwind*) 79 | *(.IA64.unwind*) 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/aarch64/math.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copright (C) 2014 Linaro Ltd. 3 | * Author: Ard Biesheuvel 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice and this list of conditions, without modification. 10 | * 2. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * Alternatively, this software may be distributed under the terms of the 14 | * GNU General Public License as published by the Free Software Foundation; 15 | * either version 2 of the License, or (at your option) any later version. 16 | */ 17 | 18 | #include "lib.h" 19 | 20 | UINT64 21 | LShiftU64 ( 22 | IN UINT64 Operand, 23 | IN UINTN Count 24 | ) 25 | // Left shift 64bit by 32bit and get a 64bit result 26 | { 27 | return Operand << Count; 28 | } 29 | 30 | UINT64 31 | RShiftU64 ( 32 | IN UINT64 Operand, 33 | IN UINTN Count 34 | ) 35 | // Right shift 64bit by 32bit and get a 64bit result 36 | { 37 | return Operand >> Count; 38 | } 39 | 40 | 41 | UINT64 42 | MultU64x32 ( 43 | IN UINT64 Multiplicand, 44 | IN UINTN Multiplier 45 | ) 46 | // Multiple 64bit by 32bit and get a 64bit result 47 | { 48 | return Multiplicand * Multiplier; 49 | } 50 | 51 | UINT64 52 | DivU64x32 ( 53 | IN UINT64 Dividend, 54 | IN UINTN Divisor, 55 | OUT UINTN *Remainder OPTIONAL 56 | ) 57 | // divide 64bit by 32bit and get a 64bit result 58 | // N.B. only works for 31bit divisors!! 59 | { 60 | if (Remainder) 61 | *Remainder = Dividend % Divisor; 62 | return Dividend / Divisor; 63 | } 64 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/mips64el/math.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copright (C) 2014 Linaro Ltd. 3 | * Author: Ard Biesheuvel 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice and this list of conditions, without modification. 10 | * 2. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * Alternatively, this software may be distributed under the terms of the 14 | * GNU General Public License as published by the Free Software Foundation; 15 | * either version 2 of the License, or (at your option) any later version. 16 | */ 17 | 18 | #include "lib.h" 19 | 20 | UINT64 21 | LShiftU64 ( 22 | IN UINT64 Operand, 23 | IN UINTN Count 24 | ) 25 | // Left shift 64bit by 32bit and get a 64bit result 26 | { 27 | return Operand << Count; 28 | } 29 | 30 | UINT64 31 | RShiftU64 ( 32 | IN UINT64 Operand, 33 | IN UINTN Count 34 | ) 35 | // Right shift 64bit by 32bit and get a 64bit result 36 | { 37 | return Operand >> Count; 38 | } 39 | 40 | 41 | UINT64 42 | MultU64x32 ( 43 | IN UINT64 Multiplicand, 44 | IN UINTN Multiplier 45 | ) 46 | // Multiple 64bit by 32bit and get a 64bit result 47 | { 48 | return Multiplicand * Multiplier; 49 | } 50 | 51 | UINT64 52 | DivU64x32 ( 53 | IN UINT64 Dividend, 54 | IN UINTN Divisor, 55 | OUT UINTN *Remainder OPTIONAL 56 | ) 57 | // divide 64bit by 32bit and get a 64bit result 58 | // N.B. only works for 31bit divisors!! 59 | { 60 | if (Remainder) 61 | *Remainder = Dividend % Divisor; 62 | return Dividend / Divisor; 63 | } 64 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/elf_ia32_efi.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") 2 | OUTPUT_ARCH(i386) 3 | ENTRY(_start) 4 | SECTIONS 5 | { 6 | . = 0; 7 | ImageBase = .; 8 | /* .hash and/or .gnu.hash MUST come first! */ 9 | .hash : { *(.hash) } 10 | .gnu.hash : { *(.gnu.hash) } 11 | . = ALIGN(4096); 12 | .text : 13 | { 14 | _text = .; 15 | *(.text) 16 | *(.text.*) 17 | *(.gnu.linkonce.t.*) 18 | . = ALIGN(16); 19 | } 20 | _etext = .; 21 | _text_size = . - _text; 22 | . = ALIGN(4096); 23 | .sdata : 24 | { 25 | _data = .; 26 | *(.got.plt) 27 | *(.got) 28 | *(.srodata) 29 | *(.sdata) 30 | *(.sbss) 31 | *(.scommon) 32 | } 33 | . = ALIGN(4096); 34 | .data : 35 | { 36 | *(.rodata*) 37 | *(.data) 38 | *(.data1) 39 | *(.data.*) 40 | *(.sdata) 41 | *(.got.plt) 42 | *(.got) 43 | /* the EFI loader doesn't seem to like a .bss section, so we stick 44 | it all into .data: */ 45 | *(.sbss) 46 | *(.scommon) 47 | *(.dynbss) 48 | *(.bss) 49 | *(COMMON) 50 | } 51 | .note.gnu.build-id : { *(.note.gnu.build-id) } 52 | 53 | . = ALIGN(4096); 54 | .dynamic : { *(.dynamic) } 55 | . = ALIGN(4096); 56 | .rel : 57 | { 58 | *(.rel.data) 59 | *(.rel.data.*) 60 | *(.rel.got) 61 | *(.rel.stab) 62 | *(.data.rel.ro.local) 63 | *(.data.rel.local) 64 | *(.data.rel.ro) 65 | *(.data.rel*) 66 | } 67 | _edata = .; 68 | _data_size = . - _etext; 69 | . = ALIGN(4096); 70 | .reloc : /* This is the PECOFF .reloc section! */ 71 | { 72 | *(.reloc) 73 | } 74 | . = ALIGN(4096); 75 | .dynsym : { *(.dynsym) } 76 | . = ALIGN(4096); 77 | .dynstr : { *(.dynstr) } 78 | . = ALIGN(4096); 79 | /DISCARD/ : 80 | { 81 | *(.rel.reloc) 82 | *(.eh_frame) 83 | *(.note.GNU-stack) 84 | } 85 | .comment 0 : { *(.comment) } 86 | } 87 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/elf_ia32_fbsd_efi.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd") 2 | OUTPUT_ARCH(i386) 3 | ENTRY(_start) 4 | SECTIONS 5 | { 6 | . = 0; 7 | ImageBase = .; 8 | /* .hash and/or .gnu.hash MUST come first! */ 9 | .hash : { *(.hash) } 10 | .gnu.hash : { *(.gnu.hash) } 11 | . = ALIGN(4096); 12 | .text : 13 | { 14 | _text = .; 15 | *(.text) 16 | *(.text.*) 17 | *(.gnu.linkonce.t.*) 18 | . = ALIGN(16); 19 | } 20 | _etext = .; 21 | _text_size = . - _text; 22 | . = ALIGN(4096); 23 | .sdata : 24 | { 25 | _data = .; 26 | *(.got.plt) 27 | *(.got) 28 | *(.srodata) 29 | *(.sdata) 30 | *(.sbss) 31 | *(.scommon) 32 | } 33 | . = ALIGN(4096); 34 | .data : 35 | { 36 | *(.rodata*) 37 | *(.data) 38 | *(.data1) 39 | *(.data.*) 40 | *(.sdata) 41 | *(.got.plt) 42 | *(.got) 43 | /* the EFI loader doesn't seem to like a .bss section, so we stick 44 | it all into .data: */ 45 | *(.sbss) 46 | *(.scommon) 47 | *(.dynbss) 48 | *(.bss) 49 | *(COMMON) 50 | } 51 | .note.gnu.build-id : { *(.note.gnu.build-id) } 52 | 53 | . = ALIGN(4096); 54 | .dynamic : { *(.dynamic) } 55 | . = ALIGN(4096); 56 | .rel : 57 | { 58 | *(.rel.data) 59 | *(.rel.data.*) 60 | *(.rel.got) 61 | *(.rel.stab) 62 | *(.data.rel.ro.local) 63 | *(.data.rel.local) 64 | *(.data.rel.ro) 65 | *(.data.rel*) 66 | } 67 | _edata = .; 68 | _data_size = . - _etext; 69 | . = ALIGN(4096); 70 | .reloc : /* This is the PECOFF .reloc section! */ 71 | { 72 | *(.reloc) 73 | } 74 | . = ALIGN(4096); 75 | .dynsym : { *(.dynsym) } 76 | . = ALIGN(4096); 77 | .dynstr : { *(.dynstr) } 78 | . = ALIGN(4096); 79 | /DISCARD/ : 80 | { 81 | *(.rel.reloc) 82 | *(.eh_frame) 83 | *(.note.GNU-stack) 84 | } 85 | .comment 0 : { *(.comment) } 86 | } 87 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/x86_64/callwrap.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Convert SysV calling convention to EFI x86_64 calling convention 3 | * 4 | * Copyright (C) 2007-2010 Intel Corp 5 | * Bibo Mao 6 | * Chandramouli Narayanan 7 | * Huang Ying 8 | * 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions 13 | * are met: 14 | * 15 | * - Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * - Redistributions in binary form must reproduce the above 18 | * copyright notice, this list of conditions and the following 19 | * disclaimer in the documentation and/or other materials 20 | * provided with the distribution. 21 | * - Neither the name of Hewlett-Packard Co. nor the names of its 22 | * contributors may be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 26 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 27 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 30 | * BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 31 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 32 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 33 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 35 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 36 | * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 | * SUCH DAMAGE. 38 | */ 39 | 40 | /* uefi_call_wrapper() is a macro in efibind.h */ 41 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/arm/math.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copright (C) 2014 Linaro Ltd. 3 | * Author: Ard Biesheuvel 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice and this list of conditions, without modification. 10 | * 2. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * Alternatively, this software may be distributed under the terms of the 14 | * GNU General Public License as published by the Free Software Foundation; 15 | * either version 2 of the License, or (at your option) any later version. 16 | */ 17 | 18 | #include "lib.h" 19 | 20 | UINT64 21 | LShiftU64 ( 22 | IN UINT64 Operand, 23 | IN UINTN Count 24 | ) 25 | // Left shift 64bit by 32bit and get a 64bit result 26 | { 27 | return Operand << Count; 28 | } 29 | 30 | UINT64 31 | RShiftU64 ( 32 | IN UINT64 Operand, 33 | IN UINTN Count 34 | ) 35 | // Right shift 64bit by 32bit and get a 64bit result 36 | { 37 | return Operand >> Count; 38 | } 39 | 40 | 41 | UINT64 42 | MultU64x32 ( 43 | IN UINT64 Multiplicand, 44 | IN UINTN Multiplier 45 | ) 46 | // Multiply 64bit by 32bit and get a 64bit result 47 | { 48 | return Multiplicand * Multiplier; 49 | } 50 | 51 | UINT64 52 | DivU64x32 ( 53 | IN UINT64 Dividend, 54 | IN UINTN Divisor, 55 | OUT UINTN *Remainder OPTIONAL 56 | ) 57 | { 58 | /* 59 | * GCC turns a division into a multiplication and shift with precalculated 60 | * constants if the divisor is constant and the dividend fits into a 32 bit 61 | * variable. Otherwise, it will turn this into calls into the 32-bit div 62 | * library functions. 63 | */ 64 | if (Remainder) 65 | *Remainder = Dividend % Divisor; 66 | return Dividend / Divisor; 67 | } 68 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/runtime/rtlock.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | lock.c 8 | 9 | Abstract: 10 | 11 | Implements FLOCK 12 | 13 | 14 | 15 | Revision History 16 | 17 | --*/ 18 | 19 | 20 | #include "lib.h" 21 | 22 | 23 | 24 | #ifndef __GNUC__ 25 | #pragma RUNTIME_CODE(RtAcquireLock) 26 | #endif 27 | VOID 28 | RtAcquireLock ( 29 | IN FLOCK *Lock 30 | ) 31 | /*++ 32 | 33 | Routine Description: 34 | 35 | Raising to the task priority level of the mutual exclusion 36 | lock, and then acquires ownership of the lock. 37 | 38 | Arguments: 39 | 40 | Lock - The lock to acquire 41 | 42 | Returns: 43 | 44 | Lock owned 45 | 46 | --*/ 47 | { 48 | if (BS) { 49 | if (BS->RaiseTPL != NULL) { 50 | Lock->OwnerTpl = uefi_call_wrapper(BS->RaiseTPL, 1, Lock->Tpl); 51 | } 52 | } 53 | else { 54 | if (LibRuntimeRaiseTPL != NULL) { 55 | Lock->OwnerTpl = LibRuntimeRaiseTPL(Lock->Tpl); 56 | } 57 | } 58 | Lock->Lock += 1; 59 | ASSERT (Lock->Lock == 1); 60 | } 61 | 62 | 63 | #ifndef __GNUC__ 64 | #pragma RUNTIME_CODE(RtAcquireLock) 65 | #endif 66 | VOID 67 | RtReleaseLock ( 68 | IN FLOCK *Lock 69 | ) 70 | /*++ 71 | 72 | Routine Description: 73 | 74 | Releases ownership of the mutual exclusion lock, and 75 | restores the previous task priority level. 76 | 77 | Arguments: 78 | 79 | Lock - The lock to release 80 | 81 | Returns: 82 | 83 | Lock unowned 84 | 85 | --*/ 86 | { 87 | EFI_TPL Tpl; 88 | 89 | Tpl = Lock->OwnerTpl; 90 | ASSERT(Lock->Lock == 1); 91 | Lock->Lock -= 1; 92 | if (BS) { 93 | if (BS->RestoreTPL != NULL) { 94 | uefi_call_wrapper(BS->RestoreTPL, 1, Tpl); 95 | } 96 | } 97 | else { 98 | if (LibRuntimeRestoreTPL != NULL) { 99 | LibRuntimeRestoreTPL(Tpl); 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/lock.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | lock.c 8 | 9 | Abstract: 10 | 11 | Implements FLOCK 12 | 13 | 14 | 15 | Revision History 16 | 17 | --*/ 18 | 19 | 20 | #include "lib.h" 21 | 22 | 23 | VOID 24 | InitializeLock ( 25 | IN OUT FLOCK *Lock, 26 | IN EFI_TPL Priority 27 | ) 28 | /*++ 29 | 30 | Routine Description: 31 | 32 | Initialize a basic mutual exclusion lock. Each lock 33 | provides mutual exclusion access at it's task priority 34 | level. Since there is no-premption (at any TPL) or 35 | multiprocessor support, acquiring the lock only consists 36 | of raising to the locks TPL. 37 | 38 | Note on a debug build the lock is acquired and released 39 | to help ensure proper usage. 40 | 41 | Arguments: 42 | 43 | Lock - The FLOCK structure to initialize 44 | 45 | Priority - The task priority level of the lock 46 | 47 | 48 | Returns: 49 | 50 | An initialized F Lock structure. 51 | 52 | --*/ 53 | { 54 | Lock->Tpl = Priority; 55 | Lock->OwnerTpl = 0; 56 | Lock->Lock = 0; 57 | } 58 | 59 | 60 | VOID 61 | AcquireLock ( 62 | IN FLOCK *Lock 63 | ) 64 | /*++ 65 | 66 | Routine Description: 67 | 68 | Raising to the task priority level of the mutual exclusion 69 | lock, and then acquires ownership of the lock. 70 | 71 | Arguments: 72 | 73 | Lock - The lock to acquire 74 | 75 | Returns: 76 | 77 | Lock owned 78 | 79 | --*/ 80 | { 81 | RtAcquireLock (Lock); 82 | } 83 | 84 | 85 | VOID 86 | ReleaseLock ( 87 | IN FLOCK *Lock 88 | ) 89 | /*++ 90 | 91 | Routine Description: 92 | 93 | Releases ownership of the mutual exclusion lock, and 94 | restores the previous task priority level. 95 | 96 | Arguments: 97 | 98 | Lock - The lock to release 99 | 100 | Returns: 101 | 102 | Lock unowned 103 | 104 | --*/ 105 | { 106 | RtReleaseLock (Lock); 107 | } 108 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/unsetdbg.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_GUID GRUB_EFI_GRUB_VARIABLE_GUID = {0x91376aff,0xcba6,0x42be,{0x94,0x9d,0x06,0xfd,0xe8,0x11,0x28,0xe8}}; 5 | EFI_GUID SHIM_GUID = {0x605dab50,0xe046,0x4300,{0xab,0xb6,0x3d,0xd8,0x10,0xdd,0x8b,0x23}}; 6 | 7 | char grubenv[] = "# GRUB Environment Block\n\ 8 | debug=all\n\ 9 | #############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################"; 10 | 11 | EFI_STATUS 12 | efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) 13 | { 14 | EFI_STATUS status; 15 | UINT8 data = 1; 16 | InitializeLib(image, systab); 17 | 18 | status = RT->SetVariable(L"SHIM_DEBUG", &SHIM_GUID, 19 | EFI_VARIABLE_NON_VOLATILE | 20 | EFI_VARIABLE_BOOTSERVICE_ACCESS | 21 | EFI_VARIABLE_RUNTIME_ACCESS, 22 | 0, &data); 23 | if (EFI_ERROR(status)) 24 | Print(L"SetVariable failed: %r\n", status); 25 | 26 | #if 0 27 | status = RT->SetVariable(L"GRUB_ENV", &SHIM_GUID, 28 | EFI_VARIABLE_NON_VOLATILE | 29 | EFI_VARIABLE_BOOTSERVICE_ACCESS | 30 | EFI_VARIABLE_RUNTIME_ACCESS, 31 | sizeof(grubenv)-1, grubenv); 32 | if (EFI_ERROR(status)) 33 | Print(L"SetVariable(GRUB_ENV) failed: %r\n", status); 34 | #endif 35 | 36 | return EFI_SUCCESS; 37 | } 38 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/setdbg.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_GUID GRUB_EFI_GRUB_VARIABLE_GUID = {0x91376aff,0xcba6,0x42be,{0x94,0x9d,0x06,0xfd,0xe8,0x11,0x28,0xe8}}; 5 | EFI_GUID SHIM_GUID = {0x605dab50,0xe046,0x4300,{0xab,0xb6,0x3d,0xd8,0x10,0xdd,0x8b,0x23}}; 6 | 7 | char grubenv[] = "# GRUB Environment Block\n\ 8 | debug=tcp,http,net\n\ 9 | ####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################"; 10 | 11 | EFI_STATUS 12 | efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) 13 | { 14 | EFI_STATUS status; 15 | InitializeLib(image, systab); 16 | #if 0 17 | UINT8 data = 1; 18 | 19 | status = RT->SetVariable(L"SHIM_DEBUG", &SHIM_GUID, 20 | EFI_VARIABLE_NON_VOLATILE | 21 | EFI_VARIABLE_BOOTSERVICE_ACCESS | 22 | EFI_VARIABLE_RUNTIME_ACCESS, 23 | sizeof(data), &data); 24 | if (EFI_ERROR(status)) 25 | Print(L"SetVariable failed: %r\n", status); 26 | #endif 27 | 28 | status = RT->SetVariable(L"GRUB_ENV", &SHIM_GUID, 29 | EFI_VARIABLE_NON_VOLATILE | 30 | EFI_VARIABLE_BOOTSERVICE_ACCESS | 31 | EFI_VARIABLE_RUNTIME_ACCESS, 32 | sizeof(grubenv)-1, grubenv); 33 | if (EFI_ERROR(status)) 34 | Print(L"SetVariable(GRUB_ENV) failed: %r\n", status); 35 | 36 | return EFI_SUCCESS; 37 | } 38 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/lib.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | lib.h 8 | 9 | Abstract: 10 | 11 | EFI library header files 12 | 13 | 14 | 15 | Revision History 16 | 17 | --*/ 18 | 19 | #ifdef __GNUC__ 20 | #pragma GCC visibility push(hidden) 21 | #endif 22 | 23 | #include "efi.h" 24 | #include "efilib.h" 25 | #include "efirtlib.h" 26 | 27 | // 28 | // Include non architectural protocols 29 | // 30 | #include "efivar.h" 31 | #include "legacyboot.h" 32 | #include "intload.h" 33 | #include "vgaclass.h" 34 | #include "eficonsplit.h" 35 | #include "adapterdebug.h" 36 | #include "intload.h" 37 | 38 | #include "efigpt.h" 39 | #include "libsmbios.h" 40 | 41 | // 42 | // Prototypes 43 | // 44 | 45 | VOID 46 | InitializeGuid ( 47 | VOID 48 | ); 49 | 50 | INTN EFIAPI 51 | LibStubStriCmp ( 52 | IN EFI_UNICODE_COLLATION_INTERFACE *This, 53 | IN CHAR16 *S1, 54 | IN CHAR16 *S2 55 | ); 56 | 57 | BOOLEAN EFIAPI 58 | LibStubMetaiMatch ( 59 | IN EFI_UNICODE_COLLATION_INTERFACE *This, 60 | IN CHAR16 *String, 61 | IN CHAR16 *Pattern 62 | ); 63 | 64 | VOID EFIAPI 65 | LibStubStrLwrUpr ( 66 | IN EFI_UNICODE_COLLATION_INTERFACE *This, 67 | IN CHAR16 *Str 68 | ); 69 | 70 | BOOLEAN 71 | LibMatchDevicePaths ( 72 | IN EFI_DEVICE_PATH *Multi, 73 | IN EFI_DEVICE_PATH *Single 74 | ); 75 | 76 | EFI_DEVICE_PATH * 77 | LibDuplicateDevicePathInstance ( 78 | IN EFI_DEVICE_PATH *DevPath 79 | ); 80 | 81 | 82 | // 83 | // Globals 84 | // 85 | extern BOOLEAN LibInitialized; 86 | extern BOOLEAN LibFwInstance; 87 | extern EFI_HANDLE LibImageHandle; 88 | extern SIMPLE_TEXT_OUTPUT_INTERFACE *LibRuntimeDebugOut; 89 | extern EFI_UNICODE_COLLATION_INTERFACE *UnicodeInterface; 90 | extern EFI_UNICODE_COLLATION_INTERFACE LibStubUnicodeInterface; 91 | extern EFI_RAISE_TPL LibRuntimeRaiseTPL; 92 | extern EFI_RESTORE_TPL LibRuntimeRestoreTPL; 93 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/mips64el/setjmp.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. 3 | * Copright (c) 2017 Lemote Co. 4 | * Author: Heiher 5 | * 6 | * This program and the accompanying materials are licensed and made 7 | available 8 | * under the terms and conditions of the BSD License which accompanies 9 | this 10 | * distribution. The full text of the license may be found at 11 | * http://opensource.org/licenses/bsd-license.php. 12 | * 13 | * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" 14 | BASIS, 15 | * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 16 | * IMPLIED. 17 | */ 18 | .text 19 | .p2align 3 20 | 21 | .globl setjmp 22 | .type setjmp, @function 23 | setjmp: 24 | sd $ra, 0x00($a0) 25 | sd $sp, 0x08($a0) 26 | sd $fp, 0x10($a0) 27 | sd $gp, 0x18($a0) 28 | 29 | sd $s0, 0x20($a0) 30 | sd $s1, 0x28($a0) 31 | sd $s2, 0x30($a0) 32 | sd $s3, 0x38($a0) 33 | sd $s4, 0x40($a0) 34 | sd $s5, 0x48($a0) 35 | sd $s6, 0x50($a0) 36 | sd $s7, 0x58($a0) 37 | 38 | #ifdef __mips_hard_float 39 | mfc0 $v0, $12 40 | ext $v0, $v0, 29, 1 41 | beqz $v0, 1f 42 | 43 | s.d $f24, 0x60($a0) 44 | s.d $f25, 0x68($a0) 45 | s.d $f26, 0x70($a0) 46 | s.d $f27, 0x78($a0) 47 | s.d $f28, 0x80($a0) 48 | s.d $f29, 0x88($a0) 49 | s.d $f30, 0x90($a0) 50 | s.d $f31, 0x98($a0) 51 | 52 | 1: 53 | #endif 54 | move $v0, $zero 55 | jr $ra 56 | 57 | .globl longjmp 58 | .type longjmp, @function 59 | longjmp: 60 | ld $ra, 0x00($a0) 61 | ld $sp, 0x08($a0) 62 | ld $fp, 0x10($a0) 63 | ld $gp, 0x18($a0) 64 | 65 | ld $s0, 0x20($a0) 66 | ld $s1, 0x28($a0) 67 | ld $s2, 0x30($a0) 68 | ld $s3, 0x38($a0) 69 | ld $s4, 0x40($a0) 70 | ld $s5, 0x48($a0) 71 | ld $s6, 0x50($a0) 72 | ld $s7, 0x58($a0) 73 | 74 | #ifdef __mips_hard_float 75 | mfc0 $v0, $12 76 | ext $v0, $v0, 29, 1 77 | beqz $v0, 1f 78 | 79 | l.d $f24, 0x60($a0) 80 | l.d $f25, 0x68($a0) 81 | l.d $f26, 0x70($a0) 82 | l.d $f27, 0x78($a0) 83 | l.d $f28, 0x80($a0) 84 | l.d $f29, 0x88($a0) 85 | l.d $f30, 0x90($a0) 86 | l.d $f31, 0x98($a0) 87 | 88 | 1: 89 | #endif 90 | li $v0, 1 91 | movn $v0, $a1, $a1 92 | jr $ra 93 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efigpt.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFI_GPT_H 2 | #define _EFI_GPT_H 3 | /*++ 4 | 5 | Copyright (c) 1998 Intel Corporation 6 | 7 | Module Name: 8 | 9 | EfiGpt.h 10 | 11 | Abstract: 12 | Include file for EFI partitioning scheme 13 | 14 | 15 | 16 | Revision History 17 | 18 | --*/ 19 | 20 | #define PRIMARY_PART_HEADER_LBA 1 21 | 22 | typedef struct { 23 | EFI_TABLE_HEADER Header; 24 | EFI_LBA MyLBA; 25 | EFI_LBA AlternateLBA; 26 | EFI_LBA FirstUsableLBA; 27 | EFI_LBA LastUsableLBA; 28 | EFI_GUID DiskGUID; 29 | EFI_LBA PartitionEntryLBA; 30 | UINT32 NumberOfPartitionEntries; 31 | UINT32 SizeOfPartitionEntry; 32 | UINT32 PartitionEntryArrayCRC32; 33 | } EFI_PARTITION_TABLE_HEADER; 34 | 35 | #define EFI_PTAB_HEADER_ID "EFI PART" 36 | 37 | typedef struct { 38 | EFI_GUID PartitionTypeGUID; 39 | EFI_GUID UniquePartitionGUID; 40 | EFI_LBA StartingLBA; 41 | EFI_LBA EndingLBA; 42 | UINT64 Attributes; 43 | CHAR16 PartitionName[36]; 44 | } EFI_PARTITION_ENTRY; 45 | 46 | // 47 | // EFI Partition Attributes 48 | // 49 | #define EFI_PART_USED_BY_EFI 0x0000000000000001 50 | #define EFI_PART_REQUIRED_TO_FUNCTION 0x0000000000000002 51 | #define EFI_PART_USED_BY_OS 0x0000000000000004 52 | #define EFI_PART_REQUIRED_BY_OS 0x0000000000000008 53 | #define EFI_PART_BACKUP_REQUIRED 0x0000000000000010 54 | #define EFI_PART_USER_DATA 0x0000000000000020 55 | #define EFI_PART_CRITICAL_USER_DATA 0x0000000000000040 56 | #define EFI_PART_REDUNDANT_PARTITION 0x0000000000000080 57 | 58 | #define EFI_PART_TYPE_UNUSED_GUID \ 59 | { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} } 60 | 61 | #define EFI_PART_TYPE_EFI_SYSTEM_PART_GUID \ 62 | { 0xc12a7328, 0xf81f, 0x11d2, {0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} } 63 | 64 | #define EFI_PART_TYPE_LEGACY_MBR_GUID \ 65 | { 0x024dee41, 0x33e7, 0x11d3, {0x9d, 0x69, 0x00, 0x08, 0xc7, 0x81, 0xf3, 0x9f} } 66 | 67 | #endif 68 | 69 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efishellparm.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | EFI_SHELL_PARAMETERS_PROTOCOL as defined in the UEFI Shell 2.0 specification. 3 | 4 | Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | /* 15 | * This is based on ShellPkg/Include/Protocol/EfiShellParameters.h from EDK II. 16 | */ 17 | 18 | #ifndef __EFI_SHELL_PARAMETERS_PROTOCOL__ 19 | #define __EFI_SHELL_PARAMETERS_PROTOCOL__ 20 | 21 | 22 | // EDK2's ShellBase.h 23 | typedef VOID *SHELL_FILE_HANDLE; 24 | 25 | #define EFI_SHELL_PARAMETERS_PROTOCOL_GUID \ 26 | { \ 27 | 0x752f3136, 0x4e16, 0x4fdc, { 0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca } \ 28 | } 29 | 30 | typedef struct _EFI_SHELL_PARAMETERS_PROTOCOL { 31 | /// 32 | /// Points to an Argc-element array of points to NULL-terminated strings containing 33 | /// the command-line parameters. The first entry in the array is always the full file 34 | /// path of the executable. Any quotation marks that were used to preserve 35 | /// whitespace have been removed. 36 | /// 37 | CHAR16 **Argv; 38 | 39 | /// 40 | /// The number of elements in the Argv array. 41 | /// 42 | UINTN Argc; 43 | 44 | /// 45 | /// The file handle for the standard input for this executable. This may be different 46 | /// from the ConInHandle in EFI_SYSTEM_TABLE. 47 | /// 48 | SHELL_FILE_HANDLE StdIn; 49 | 50 | /// 51 | /// The file handle for the standard output for this executable. This may be different 52 | /// from the ConOutHandle in EFI_SYSTEM_TABLE. 53 | /// 54 | SHELL_FILE_HANDLE StdOut; 55 | 56 | /// 57 | /// The file handle for the standard error output for this executable. This may be 58 | /// different from the StdErrHandle in EFI_SYSTEM_TABLE. 59 | /// 60 | SHELL_FILE_HANDLE StdErr; 61 | } EFI_SHELL_PARAMETERS_PROTOCOL; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/drv0_use.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 David Decotigny 3 | * 4 | * See drv0.c for an example session. 5 | */ 6 | 7 | #include 8 | #include 9 | #include "drv0.h" 10 | 11 | 12 | static EFI_GUID GnuEfiAppsDrv0ProtocolGuid 13 | = GNU_EFI_APPS_DRV0_PROTOCOL_GUID; 14 | 15 | 16 | static 17 | EFI_STATUS 18 | PlayWithGnuEfiAppsDrv0Protocol(IN EFI_HANDLE DrvHandle) { 19 | EFI_STATUS Status; 20 | GNU_EFI_APPS_DRV0_PROTOCOL *drv = NULL; 21 | UINTN NumberOfHello = 0; 22 | 23 | Status = uefi_call_wrapper(BS->OpenProtocol, 6, 24 | DrvHandle, 25 | &GnuEfiAppsDrv0ProtocolGuid, 26 | (void**)&drv, 27 | DrvHandle, 28 | NULL, 29 | EFI_OPEN_PROTOCOL_GET_PROTOCOL); 30 | if (EFI_ERROR(Status)) { 31 | Print(L"Cannot open proto: %d\n", Status); 32 | return Status; 33 | } 34 | 35 | Status = uefi_call_wrapper(drv->SayHello, 2, L"Sample UEFI Driver"); 36 | if (EFI_ERROR(Status)) { 37 | Print(L"Cannot call SayHello: %d\n", Status); 38 | } 39 | 40 | Status = uefi_call_wrapper(drv->GetNumberOfHello, 2, &NumberOfHello); 41 | if (EFI_ERROR(Status)) { 42 | Print(L"Cannot call GetNumberOfHello: %d\n", Status); 43 | } else { 44 | Print(L"Hello was called %d time(s).\n", NumberOfHello); 45 | } 46 | 47 | return EFI_SUCCESS; 48 | } 49 | 50 | 51 | EFI_STATUS 52 | efi_main (EFI_HANDLE Image, EFI_SYSTEM_TABLE *SysTab) 53 | { 54 | EFI_STATUS Status; 55 | EFI_HANDLE *Handles = NULL; 56 | UINTN i, NoHandles = 0; 57 | 58 | InitializeLib(Image, SysTab); 59 | 60 | Status = LibLocateHandle(ByProtocol, &GnuEfiAppsDrv0ProtocolGuid, 61 | NULL, &NoHandles, &Handles); 62 | if (EFI_ERROR(Status)) { 63 | Print(L"Error looking up handles for proto: %d\n", Status); 64 | return Status; 65 | } 66 | 67 | for (i = 0 ; i < NoHandles ; ++i) 68 | { 69 | Print(L"Playing with driver instance %d...\n", i); 70 | Status = PlayWithGnuEfiAppsDrv0Protocol(Handles[i]); 71 | if (EFI_ERROR(Status)) 72 | Print(L"Error playing with instance %d, skipping\n", i); 73 | } 74 | 75 | if (Handles) 76 | FreePool(Handles); 77 | 78 | return EFI_SUCCESS; 79 | } 80 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/protocol/vgaclass.h: -------------------------------------------------------------------------------- 1 | #ifndef _VGA_CLASS_H 2 | #define _VGA_CLASS_H 3 | 4 | /*++ 5 | 6 | Copyright (c) 1999 Intel Corporation 7 | 8 | Module Name: 9 | 10 | VgaClass.h 11 | 12 | Abstract: 13 | 14 | Vga Mini port binding to Vga Class protocol 15 | 16 | 17 | 18 | Revision History 19 | 20 | --*/ 21 | 22 | // 23 | // VGA Device Structure 24 | // 25 | 26 | // {0E3D6310-6FE4-11d3-BB81-0080C73C8881} 27 | #define VGA_CLASS_DRIVER_PROTOCOL \ 28 | { 0xe3d6310, 0x6fe4, 0x11d3, {0xbb, 0x81, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } 29 | 30 | typedef 31 | EFI_STATUS 32 | (* INIT_VGA_CARD) ( 33 | IN UINTN VgaMode, 34 | IN VOID *Context 35 | ); 36 | 37 | typedef struct { 38 | UINTN MaxColumns; 39 | UINTN MaxRows; 40 | } MAX_CONSOLE_GEOMETRY; 41 | 42 | #define VGA_CON_OUT_DEV_SIGNATURE EFI_SIGNATURE_32('c','v','g','a') 43 | typedef struct { 44 | UINTN Signature; 45 | 46 | EFI_HANDLE Handle; 47 | SIMPLE_TEXT_OUTPUT_INTERFACE ConOut; 48 | SIMPLE_TEXT_OUTPUT_MODE ConOutMode; 49 | EFI_DEVICE_PATH *DevicePath; 50 | 51 | UINT8 *Buffer; 52 | EFI_DEVICE_IO_INTERFACE *DeviceIo; 53 | 54 | // 55 | // Video Card Context 56 | // 57 | INIT_VGA_CARD InitVgaCard; 58 | VOID *VgaCardContext; 59 | MAX_CONSOLE_GEOMETRY *Geometry; 60 | // 61 | // Video buffer normally 0xb8000 62 | // 63 | UINT64 VideoBuffer; 64 | 65 | // 66 | // Clear Screen & Default Attribute 67 | // 68 | UINT32 Attribute; 69 | 70 | // 71 | // -1 means search for active VGA device 72 | // 73 | EFI_PCI_ADDRESS_UNION Pci; 74 | } VGA_CON_OUT_DEV; 75 | 76 | #define VGA_CON_OUT_DEV_FROM_THIS(a) CR(a, VGA_CON_OUT_DEV, ConOut, VGA_CON_OUT_DEV_SIGNATURE) 77 | 78 | // 79 | // Vga Class Driver Protocol. 80 | // GUID defined in EFI Lib 81 | // 82 | 83 | typedef 84 | EFI_STATUS 85 | (EFIAPI *INSTALL_VGA_DRIVER) ( 86 | IN VGA_CON_OUT_DEV *ConOutDev 87 | ); 88 | 89 | typedef struct { 90 | UINT32 Version; 91 | INSTALL_VGA_DRIVER InstallGenericVgaDriver; 92 | } INSTALL_VGA_DRIVER_INTERFACE; 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efierr.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFI_ERR_H 2 | #define _EFI_ERR_H 3 | 4 | /*++ 5 | 6 | Copyright (c) 1998 Intel Corporation 7 | 8 | Module Name: 9 | 10 | efierr.h 11 | 12 | Abstract: 13 | 14 | EFI error codes 15 | 16 | 17 | 18 | 19 | Revision History 20 | 21 | --*/ 22 | 23 | 24 | #define EFIWARN(a) (a) 25 | #define EFI_ERROR(a) (((INTN) a) < 0) 26 | 27 | 28 | #define EFI_SUCCESS 0 29 | #define EFI_LOAD_ERROR EFIERR(1) 30 | #define EFI_INVALID_PARAMETER EFIERR(2) 31 | #define EFI_UNSUPPORTED EFIERR(3) 32 | #define EFI_BAD_BUFFER_SIZE EFIERR(4) 33 | #define EFI_BUFFER_TOO_SMALL EFIERR(5) 34 | #define EFI_NOT_READY EFIERR(6) 35 | #define EFI_DEVICE_ERROR EFIERR(7) 36 | #define EFI_WRITE_PROTECTED EFIERR(8) 37 | #define EFI_OUT_OF_RESOURCES EFIERR(9) 38 | #define EFI_VOLUME_CORRUPTED EFIERR(10) 39 | #define EFI_VOLUME_FULL EFIERR(11) 40 | #define EFI_NO_MEDIA EFIERR(12) 41 | #define EFI_MEDIA_CHANGED EFIERR(13) 42 | #define EFI_NOT_FOUND EFIERR(14) 43 | #define EFI_ACCESS_DENIED EFIERR(15) 44 | #define EFI_NO_RESPONSE EFIERR(16) 45 | #define EFI_NO_MAPPING EFIERR(17) 46 | #define EFI_TIMEOUT EFIERR(18) 47 | #define EFI_NOT_STARTED EFIERR(19) 48 | #define EFI_ALREADY_STARTED EFIERR(20) 49 | #define EFI_ABORTED EFIERR(21) 50 | #define EFI_ICMP_ERROR EFIERR(22) 51 | #define EFI_TFTP_ERROR EFIERR(23) 52 | #define EFI_PROTOCOL_ERROR EFIERR(24) 53 | #define EFI_INCOMPATIBLE_VERSION EFIERR(25) 54 | #define EFI_SECURITY_VIOLATION EFIERR(26) 55 | #define EFI_CRC_ERROR EFIERR(27) 56 | #define EFI_END_OF_MEDIA EFIERR(28) 57 | #define EFI_END_OF_FILE EFIERR(31) 58 | #define EFI_INVALID_LANGUAGE EFIERR(32) 59 | #define EFI_COMPROMISED_DATA EFIERR(33) 60 | 61 | #define EFI_WARN_UNKOWN_GLYPH EFIWARN(1) 62 | #define EFI_WARN_UNKNOWN_GLYPH EFIWARN(1) 63 | #define EFI_WARN_DELETE_FAILURE EFIWARN(2) 64 | #define EFI_WARN_WRITE_FAILURE EFIWARN(3) 65 | #define EFI_WARN_BUFFER_TOO_SMALL EFIWARN(4) 66 | 67 | #endif 68 | 69 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/debughook.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_STATUS 5 | GetVariableAttr(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner, 6 | UINT32 *attributes) 7 | { 8 | EFI_STATUS efi_status; 9 | 10 | *len = 0; 11 | 12 | efi_status = uefi_call_wrapper(RT->GetVariable, 5, var, &owner, 13 | NULL, len, NULL); 14 | if (efi_status != EFI_BUFFER_TOO_SMALL) 15 | return efi_status; 16 | 17 | *data = AllocateZeroPool(*len); 18 | if (!*data) 19 | return EFI_OUT_OF_RESOURCES; 20 | 21 | efi_status = uefi_call_wrapper(RT->GetVariable, 5, var, &owner, 22 | attributes, len, *data); 23 | 24 | if (efi_status != EFI_SUCCESS) { 25 | FreePool(*data); 26 | *data = NULL; 27 | } 28 | return efi_status; 29 | } 30 | 31 | EFI_STATUS 32 | GetVariable(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner) 33 | { 34 | return GetVariableAttr(var, data, len, owner, NULL); 35 | } 36 | 37 | EFI_GUID DUMMY_GUID = 38 | {0x55aad538, 0x8f82, 0x4e2a, {0xa4,0xf0,0xbe, 0x59, 0x13, 0xb6, 0x5f, 0x1e}}; 39 | 40 | #if defined(__clang__) 41 | # define _OPTNONE __attribute__((optnone)) 42 | #else 43 | # define _OPTNONE __attribute__((__optimize__("0"))) 44 | #endif 45 | 46 | static _OPTNONE void 47 | DebugHook(void) 48 | { 49 | EFI_GUID guid = DUMMY_GUID; 50 | UINT8 *data = NULL; 51 | UINTN dataSize = 0; 52 | EFI_STATUS efi_status; 53 | register volatile unsigned long long x = 0; 54 | extern char _text, _data; 55 | 56 | if (x) 57 | return; 58 | 59 | efi_status = GetVariable(L"DUMMY_DEBUG", &data, &dataSize, guid); 60 | if (EFI_ERROR(efi_status)) { 61 | return; 62 | } 63 | 64 | Print(L"add-symbol-file /usr/lib/debug/boot/efi/debughook.debug " 65 | L"0x%08x -s .data 0x%08x\n", &_text, &_data); 66 | 67 | Print(L"Pausing for debugger attachment.\n"); 68 | Print(L"To disable this, remove the EFI variable DUMMY_DEBUG-%g .\n", 69 | &guid); 70 | x = 1; 71 | while (x++) { 72 | /* Make this so it can't /totally/ DoS us. */ 73 | #if defined(__x86_64__) || defined(__i386__) || defined(__i686__) 74 | if (x > 4294967294ULL) 75 | break; 76 | __asm__ __volatile__("pause"); 77 | #elif defined(__aarch64__) 78 | if (x > 1000) 79 | break; 80 | __asm__ __volatile__("wfi"); 81 | #else 82 | if (x > 12000) 83 | break; 84 | uefi_call_wrapper(BS->Stall, 1, 5000); 85 | #endif 86 | } 87 | x = 1; 88 | } 89 | 90 | 91 | EFI_STATUS 92 | efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) 93 | { 94 | InitializeLib(image, systab); 95 | DebugHook(); 96 | return EFI_SUCCESS; 97 | } 98 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/console.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | console.c 8 | 9 | Abstract: 10 | 11 | 12 | 13 | 14 | Revision History 15 | 16 | --*/ 17 | 18 | #include "lib.h" 19 | 20 | 21 | 22 | VOID 23 | Output ( 24 | IN CHAR16 *Str 25 | ) 26 | // Write a string to the console at the current cursor location 27 | { 28 | uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, Str); 29 | } 30 | 31 | 32 | VOID 33 | Input ( 34 | IN CHAR16 *Prompt OPTIONAL, 35 | OUT CHAR16 *InStr, 36 | IN UINTN StrLen 37 | ) 38 | // Input a string at the current cursor location, for StrLen 39 | { 40 | IInput ( 41 | ST->ConOut, 42 | ST->ConIn, 43 | Prompt, 44 | InStr, 45 | StrLen 46 | ); 47 | } 48 | 49 | VOID 50 | IInput ( 51 | IN SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut, 52 | IN SIMPLE_INPUT_INTERFACE *ConIn, 53 | IN CHAR16 *Prompt OPTIONAL, 54 | OUT CHAR16 *InStr, 55 | IN UINTN StrLen 56 | ) 57 | // Input a string at the current cursor location, for StrLen 58 | { 59 | EFI_INPUT_KEY Key; 60 | EFI_STATUS Status; 61 | UINTN Len; 62 | 63 | if (Prompt) { 64 | ConOut->OutputString (ConOut, Prompt); 65 | } 66 | 67 | Len = 0; 68 | for (; ;) { 69 | WaitForSingleEvent (ConIn->WaitForKey, 0); 70 | 71 | Status = uefi_call_wrapper(ConIn->ReadKeyStroke, 2, ConIn, &Key); 72 | if (EFI_ERROR(Status)) { 73 | DEBUG((D_ERROR, "Input: error return from ReadKey %x\n", Status)); 74 | break; 75 | } 76 | 77 | if (Key.UnicodeChar == '\n' || 78 | Key.UnicodeChar == '\r') { 79 | break; 80 | } 81 | 82 | if (Key.UnicodeChar == '\b') { 83 | if (Len) { 84 | uefi_call_wrapper(ConOut->OutputString, 2, ConOut, L"\b \b"); 85 | Len -= 1; 86 | } 87 | continue; 88 | } 89 | 90 | if (Key.UnicodeChar >= ' ') { 91 | if (Len < StrLen-1) { 92 | InStr[Len] = Key.UnicodeChar; 93 | 94 | InStr[Len+1] = 0; 95 | uefi_call_wrapper(ConOut->OutputString, 2, ConOut, &InStr[Len]); 96 | 97 | Len += 1; 98 | } 99 | continue; 100 | } 101 | } 102 | 103 | InStr[Len] = 0; 104 | } 105 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/crt0-efi-x86_64.S: -------------------------------------------------------------------------------- 1 | /* crt0-efi-x86_64.S - x86_64 EFI startup code. 2 | Copyright (C) 1999 Hewlett-Packard Co. 3 | Contributed by David Mosberger . 4 | Copyright (C) 2005 Intel Co. 5 | Contributed by Fenghua Yu . 6 | 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions 11 | are met: 12 | 13 | * Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | * Redistributions in binary form must reproduce the above 16 | copyright notice, this list of conditions and the following 17 | disclaimer in the documentation and/or other materials 18 | provided with the distribution. 19 | * Neither the name of Hewlett-Packard Co. nor the names of its 20 | contributors may be used to endorse or promote products derived 21 | from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 24 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 28 | BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 29 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 30 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 31 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 33 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 34 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 | SUCH DAMAGE. 36 | */ 37 | .text 38 | .align 4 39 | 40 | .globl _start 41 | _start: 42 | subq $8, %rsp 43 | pushq %rcx 44 | pushq %rdx 45 | 46 | 0: 47 | lea ImageBase(%rip), %rdi 48 | lea _DYNAMIC(%rip), %rsi 49 | 50 | popq %rcx 51 | popq %rdx 52 | pushq %rcx 53 | pushq %rdx 54 | call _relocate 55 | 56 | popq %rdi 57 | popq %rsi 58 | 59 | call efi_main 60 | addq $8, %rsp 61 | 62 | .exit: 63 | ret 64 | 65 | // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: 66 | 67 | .data 68 | dummy: .long 0 69 | 70 | #define IMAGE_REL_ABSOLUTE 0 71 | .section .reloc, "a" 72 | label1: 73 | .long dummy-label1 // Page RVA 74 | .long 10 // Block Size (2*4+2) 75 | .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy 76 | 77 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/Make.rules: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 1999-2007 Hewlett-Packard Co. 3 | # Contributed by David Mosberger 4 | # Contributed by Stephane Eranian 5 | # 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 12 | # * Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # * Redistributions in binary form must reproduce the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer in the documentation and/or other materials 17 | # provided with the distribution. 18 | # * Neither the name of Hewlett-Packard Co. nor the names of its 19 | # contributors may be used to endorse or promote products derived 20 | # from this software without specific prior written permission. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 27 | # BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 28 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 32 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 33 | # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 | # SUCH DAMAGE. 35 | # 36 | 37 | %.efi: %.so 38 | $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ 39 | -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ 40 | -j .reloc $(FORMAT) $*.so $@ 41 | 42 | %.efi.debug: %.so 43 | $(OBJCOPY) -j .debug_info -j .debug_abbrev -j .debug_aranges \ 44 | -j .debug_line -j .debug_str -j .debug_ranges \ 45 | -j .note.gnu.build-id \ 46 | $(FORMAT) $*.so $@ 47 | 48 | %.so: %.o 49 | $(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES) 50 | 51 | %.o: %.c 52 | $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ 53 | 54 | %.s: %.c 55 | $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -S $< -o $@ 56 | 57 | %.i: %.c 58 | $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -E $< -o $@ 59 | 60 | %.o: %.S 61 | $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ 62 | 63 | %.s: %.S 64 | $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -E $< -o $@ 65 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/runtime/efirtlib.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1999 Intel Corporation 4 | 5 | Module Name: 6 | 7 | EfiRtLib.h 8 | 9 | Abstract: 10 | 11 | EFI Runtime library functions 12 | 13 | 14 | 15 | Revision History 16 | 17 | --*/ 18 | 19 | #include "efi.h" 20 | #include "efilib.h" 21 | #include "efirtlib.h" 22 | 23 | #ifndef __GNUC__ 24 | #pragma RUNTIME_CODE(RtZeroMem) 25 | #endif 26 | VOID 27 | RUNTIMEFUNCTION 28 | RtZeroMem ( 29 | IN VOID *Buffer, 30 | IN UINTN Size 31 | ) 32 | { 33 | INT8 *pt; 34 | 35 | pt = Buffer; 36 | while (Size--) { 37 | *(pt++) = 0; 38 | } 39 | } 40 | 41 | #ifndef __GNUC__ 42 | #pragma RUNTIME_CODE(RtSetMem) 43 | #endif 44 | VOID 45 | RUNTIMEFUNCTION 46 | RtSetMem ( 47 | IN VOID *Buffer, 48 | IN UINTN Size, 49 | IN UINT8 Value 50 | ) 51 | { 52 | INT8 *pt; 53 | 54 | pt = Buffer; 55 | while (Size--) { 56 | *(pt++) = Value; 57 | } 58 | } 59 | 60 | #ifndef __GNUC__ 61 | #pragma RUNTIME_CODE(RtCopyMem) 62 | #endif 63 | VOID 64 | RUNTIMEFUNCTION 65 | RtCopyMem ( 66 | IN VOID *Dest, 67 | IN CONST VOID *Src, 68 | IN UINTN len 69 | ) 70 | { 71 | CHAR8 *d; 72 | CONST CHAR8 *s = Src; 73 | d = Dest; 74 | while (len--) { 75 | *(d++) = *(s++); 76 | } 77 | } 78 | 79 | #ifndef __GNUC__ 80 | #pragma RUNTIME_CODE(RtCompareMem) 81 | #endif 82 | INTN 83 | RUNTIMEFUNCTION 84 | RtCompareMem ( 85 | IN CONST VOID *Dest, 86 | IN CONST VOID *Src, 87 | IN UINTN len 88 | ) 89 | { 90 | CONST CHAR8 *d = Dest, *s = Src; 91 | while (len--) { 92 | if (*d != *s) { 93 | return *d - *s; 94 | } 95 | 96 | d += 1; 97 | s += 1; 98 | } 99 | 100 | return 0; 101 | } 102 | 103 | #ifndef __GNUC__ 104 | #pragma RUNTIME_CODE(RtCompareGuid) 105 | #endif 106 | INTN 107 | RUNTIMEFUNCTION 108 | RtCompareGuid ( 109 | IN EFI_GUID *Guid1, 110 | IN EFI_GUID *Guid2 111 | ) 112 | /*++ 113 | 114 | Routine Description: 115 | 116 | Compares to GUIDs 117 | 118 | Arguments: 119 | 120 | Guid1 - guid to compare 121 | Guid2 - guid to compare 122 | 123 | Returns: 124 | = 0 if Guid1 == Guid2 125 | 126 | --*/ 127 | { 128 | INT32 *g1, *g2, r; 129 | 130 | // 131 | // Compare 32 bits at a time 132 | // 133 | 134 | g1 = (INT32 *) Guid1; 135 | g2 = (INT32 *) Guid2; 136 | 137 | r = g1[0] - g2[0]; 138 | r |= g1[1] - g2[1]; 139 | r |= g1[2] - g2[2]; 140 | r |= g1[3] - g2[3]; 141 | 142 | return r; 143 | } 144 | 145 | 146 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/error.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | error.c 8 | 9 | Abstract: 10 | 11 | 12 | 13 | 14 | Revision History 15 | 16 | --*/ 17 | 18 | #include "lib.h" 19 | 20 | 21 | struct { 22 | EFI_STATUS Code; 23 | WCHAR *Desc; 24 | } ErrorCodeTable[] = { 25 | { EFI_SUCCESS, L"Success"}, 26 | { EFI_LOAD_ERROR, L"Load Error"}, 27 | { EFI_INVALID_PARAMETER, L"Invalid Parameter"}, 28 | { EFI_UNSUPPORTED, L"Unsupported"}, 29 | { EFI_BAD_BUFFER_SIZE, L"Bad Buffer Size"}, 30 | { EFI_BUFFER_TOO_SMALL, L"Buffer Too Small"}, 31 | { EFI_NOT_READY, L"Not Ready"}, 32 | { EFI_DEVICE_ERROR, L"Device Error"}, 33 | { EFI_WRITE_PROTECTED, L"Write Protected"}, 34 | { EFI_OUT_OF_RESOURCES, L"Out of Resources"}, 35 | { EFI_VOLUME_CORRUPTED, L"Volume Corrupt"}, 36 | { EFI_VOLUME_FULL, L"Volume Full"}, 37 | { EFI_NO_MEDIA, L"No Media"}, 38 | { EFI_MEDIA_CHANGED, L"Media changed"}, 39 | { EFI_NOT_FOUND, L"Not Found"}, 40 | { EFI_ACCESS_DENIED, L"Access Denied"}, 41 | { EFI_NO_RESPONSE, L"No Response"}, 42 | { EFI_NO_MAPPING, L"No mapping"}, 43 | { EFI_TIMEOUT, L"Time out"}, 44 | { EFI_NOT_STARTED, L"Not started"}, 45 | { EFI_ALREADY_STARTED, L"Already started"}, 46 | { EFI_ABORTED, L"Aborted"}, 47 | { EFI_ICMP_ERROR, L"ICMP Error"}, 48 | { EFI_TFTP_ERROR, L"TFTP Error"}, 49 | { EFI_PROTOCOL_ERROR, L"Protocol Error"}, 50 | { EFI_INCOMPATIBLE_VERSION, L"Incompatible Version"}, 51 | { EFI_SECURITY_VIOLATION, L"Security Policy Violation"}, 52 | { EFI_CRC_ERROR, L"CRC Error"}, 53 | { EFI_END_OF_MEDIA, L"End of Media"}, 54 | { EFI_END_OF_FILE, L"End of File"}, 55 | { EFI_INVALID_LANGUAGE, L"Invalid Languages"}, 56 | { EFI_COMPROMISED_DATA, L"Compromised Data"}, 57 | 58 | // warnings 59 | { EFI_WARN_UNKNOWN_GLYPH, L"Warning Unknown Glyph"}, 60 | { EFI_WARN_DELETE_FAILURE, L"Warning Delete Failure"}, 61 | { EFI_WARN_WRITE_FAILURE, L"Warning Write Failure"}, 62 | { EFI_WARN_BUFFER_TOO_SMALL, L"Warning Buffer Too Small"}, 63 | { 0, NULL} 64 | } ; 65 | 66 | 67 | VOID 68 | StatusToString ( 69 | OUT CHAR16 *Buffer, 70 | IN EFI_STATUS Status 71 | ) 72 | { 73 | UINTN Index; 74 | 75 | for (Index = 0; ErrorCodeTable[Index].Desc; Index +=1) { 76 | if (ErrorCodeTable[Index].Code == Status) { 77 | StrCpy (Buffer, ErrorCodeTable[Index].Desc); 78 | return; 79 | } 80 | } 81 | 82 | SPrint (Buffer, 0, L"%X", Status); 83 | } 84 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/crt0-efi-ia32.S: -------------------------------------------------------------------------------- 1 | /* crt0-efi-ia32.S - x86 EFI startup code. 2 | Copyright (C) 1999 Hewlett-Packard Co. 3 | Contributed by David Mosberger . 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials 16 | provided with the distribution. 17 | * Neither the name of Hewlett-Packard Co. nor the names of its 18 | contributors may be used to endorse or promote products derived 19 | from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 22 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 23 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 26 | BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 27 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 31 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 32 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 | SUCH DAMAGE. 34 | */ 35 | 36 | .text 37 | .align 4 38 | 39 | .globl _start 40 | _start: 41 | pushl %ebp 42 | movl %esp,%ebp 43 | 44 | pushl 12(%ebp) # copy "image" argument 45 | pushl 8(%ebp) # copy "systab" argument 46 | 47 | call 0f 48 | 0: popl %eax 49 | movl %eax,%ebx 50 | 51 | addl $ImageBase-0b,%eax # %eax = ldbase 52 | addl $_DYNAMIC-0b,%ebx # %ebx = _DYNAMIC 53 | 54 | pushl %ebx # pass _DYNAMIC as second argument 55 | pushl %eax # pass ldbase as first argument 56 | call _relocate 57 | popl %ebx 58 | popl %ebx 59 | testl %eax,%eax 60 | jne .exit 61 | 62 | call efi_main # call app with "image" and "systab" argument 63 | 64 | .exit: leave 65 | ret 66 | 67 | // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: 68 | 69 | .data 70 | dummy: .long 0 71 | 72 | #define IMAGE_REL_ABSOLUTE 0 73 | .section .reloc 74 | .long dummy // Page RVA 75 | .long 10 // Block Size (2*4+2) 76 | .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy 77 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efishellintf.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | SHELL_INTERFACE_PROTOCOL from EDK shell (no spec). 3 | 4 | Shell Interface - additional information (over image_info) provided 5 | to an application started by the shell. 6 | 7 | ConIo provides a file-style interface to the console. 8 | 9 | The shell interface's and data (including ConIo) are only valid during 10 | the applications Entry Point. Once the application returns from it's 11 | entry point the data is freed by the invoking shell. 12 | 13 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
14 | This program and the accompanying materials 15 | are licensed and made available under the terms and conditions of the BSD License 16 | which accompanies this distribution. The full text of the license may be found at 17 | http://opensource.org/licenses/bsd-license.php 18 | 19 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 20 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 21 | 22 | **/ 23 | /* 24 | * This is based on ShellPkg/Include/Protocol/EfiShellInterface.h from EDK II. 25 | */ 26 | 27 | #ifndef _SHELLINTERFACE_H_ 28 | #define _SHELLINTERFACE_H_ 29 | 30 | 31 | #define SHELL_INTERFACE_PROTOCOL_GUID \ 32 | { \ 33 | 0x47c7b223, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \ 34 | } 35 | 36 | /// 37 | /// Bit definitions for EFI_SHELL_ARG_INFO 38 | /// 39 | typedef enum { 40 | ARG_NO_ATTRIB = 0x0, 41 | ARG_IS_QUOTED = 1<<0, 42 | ARG_PARTIALLY_QUOTED = 1<<1, 43 | ARG_FIRST_HALF_QUOTED = 1<<2, 44 | ARG_FIRST_CHAR_IS_ESC = 1<<3 45 | } EFI_SHELL_ARG_INFO_TYPES; 46 | 47 | /// 48 | /// Attributes for an argument. 49 | /// 50 | typedef struct _EFI_SHELL_ARG_INFO { 51 | UINT32 Attributes; 52 | } EFI_SHELL_ARG_INFO; 53 | 54 | /// 55 | /// This protocol provides access to additional information about a shell application. 56 | /// 57 | typedef struct { 58 | /// 59 | /// Handle back to original image handle & image information. 60 | /// 61 | EFI_HANDLE ImageHandle; 62 | EFI_LOADED_IMAGE *Info; 63 | 64 | /// 65 | /// Parsed arg list converted more C-like format. 66 | /// 67 | CHAR16 **Argv; 68 | UINTN Argc; 69 | 70 | /// 71 | /// Storage for file redirection args after parsing. 72 | /// 73 | CHAR16 **RedirArgv; 74 | UINTN RedirArgc; 75 | 76 | /// 77 | /// A file style handle for console io. 78 | /// 79 | EFI_FILE *StdIn; 80 | EFI_FILE *StdOut; 81 | EFI_FILE *StdErr; 82 | 83 | /// 84 | /// List of attributes for each argument. 85 | /// 86 | EFI_SHELL_ARG_INFO *ArgInfo; 87 | 88 | /// 89 | /// Whether we are echoing. 90 | /// 91 | BOOLEAN EchoOn; 92 | } EFI_SHELL_INTERFACE; 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /ASPMEnabler/listacpi.c: -------------------------------------------------------------------------------- 1 | // https://blog.fpmurphy.com/2015/01/list-acpi-tables-from-uefi-shell.html 2 | // Copyright (c) 2015 Finnbarr P. Murphy. All rights reserved. 3 | // Display list of ACPI tables 4 | // License: BSD License 5 | 6 | #include 7 | #include 8 | #include "listacpi.h" 9 | 10 | UINTN 11 | myStrnCmpA(CHAR8* s1, CHAR8* s2, UINTN len) 12 | { 13 | while (*s1 && len) { 14 | if (*s1 != *s2) { 15 | break; 16 | } 17 | s1 += 1; 18 | s2 += 1; 19 | len -= 1; 20 | } 21 | 22 | return len ? *s1 - *s2 : 0; 23 | } 24 | 25 | 26 | VOID 27 | Ascii2UnicodeStr(CHAR8* String, CHAR16* UniString, UINT8 length) 28 | { 29 | int len = length; 30 | 31 | while (*String != '\0' && len > 0) { 32 | *(UniString++) = (CHAR16) * (String++); 33 | len--; 34 | } 35 | *UniString = '\0'; 36 | } 37 | 38 | 39 | int 40 | ParseRSDP(EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER* Rsdp, CHAR16* GuidStr) 41 | { 42 | EFI_ACPI_SDT_HEADER* Xsdt, * Entry; 43 | CHAR16 SigStr[20], OemStr[20]; 44 | UINT32 EntryCount; 45 | UINT64* EntryPtr; 46 | int Index; 47 | 48 | Print(L"\n\nACPI GUID: %s\n", GuidStr); 49 | Ascii2UnicodeStr((CHAR8*)(Rsdp->OemId), OemStr, 6); 50 | Print(L"\nFound RSDP. Version: %d OEM ID: %s\n", (int)(Rsdp->Revision), OemStr); 51 | 52 | if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION) { 53 | Xsdt = (EFI_ACPI_SDT_HEADER*)(Rsdp->XsdtAddress); 54 | } 55 | else { 56 | Print(L"ERROR: No XSDT table found.\n"); 57 | return 1; 58 | } 59 | 60 | if (myStrnCmpA("XSDT", (CHAR8*)(VOID*)(Xsdt->Signature), 4)) { 61 | Print(L"ERROR: Invalid XSDT table found.\n"); 62 | return 1; 63 | } 64 | 65 | Ascii2UnicodeStr((CHAR8*)(Xsdt->OemId), OemStr, 6); 66 | EntryCount = (Xsdt->Length - sizeof(EFI_ACPI_SDT_HEADER)) / sizeof(UINT64); 67 | Print(L"Found XSDT. OEM ID: %s Entry Count: %d\n\n", OemStr, EntryCount); 68 | 69 | EntryPtr = (UINT64*)(Xsdt + 1); 70 | for (Index = 0; Index < EntryCount; Index++, EntryPtr++) { 71 | Entry = (EFI_ACPI_SDT_HEADER*)((UINTN)(*EntryPtr)); 72 | Ascii2UnicodeStr((CHAR8*)(Entry->Signature), SigStr, 4); 73 | Ascii2UnicodeStr((CHAR8*)(Entry->OemId), OemStr, 6); 74 | Print(L"Found ACPI table: %s Version: %d OEM ID: %s\n", SigStr, (int)(Entry->Revision), OemStr); 75 | } 76 | 77 | return 0; 78 | } 79 | 80 | 81 | VOID 82 | Guid2String(CHAR16* Buffer, EFI_GUID* Guid) 83 | { 84 | SPrint(Buffer, 0, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", 85 | Guid->Data1, 86 | Guid->Data2, 87 | Guid->Data3, 88 | Guid->Data4[0], 89 | Guid->Data4[1], 90 | Guid->Data4[2], 91 | Guid->Data4[3], 92 | Guid->Data4[4], 93 | Guid->Data4[5], 94 | Guid->Data4[6], 95 | Guid->Data4[7]); 96 | } 97 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 1999-2001 Hewlett-Packard Co. 3 | # Contributed by David Mosberger 4 | # Contributed by Stephane Eranian 5 | # 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 12 | # * Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # * Redistributions in binary form must reproduce the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer in the documentation and/or other materials 17 | # provided with the distribution. 18 | # * Neither the name of Hewlett-Packard Co. nor the names of its 19 | # contributors may be used to endorse or promote products derived 20 | # from this software without specific prior written permission. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 27 | # BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 28 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 32 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 33 | # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 | # SUCH DAMAGE. 35 | # 36 | 37 | SRCDIR = . 38 | 39 | VPATH = $(SRCDIR) 40 | 41 | include $(SRCDIR)/../Make.defaults 42 | 43 | TOPDIR = $(SRCDIR)/.. 44 | 45 | CDIR=$(TOPDIR)/.. 46 | FILES = reloc_$(ARCH) 47 | 48 | OBJS = $(FILES:%=%.o) 49 | 50 | # on aarch64, avoid jump tables before all relocations have been processed 51 | reloc_aarch64.o: CFLAGS += -fno-jump-tables 52 | 53 | TARGETS = crt0-efi-$(ARCH).o libgnuefi.a 54 | 55 | all: $(TARGETS) 56 | 57 | libgnuefi.a: $(OBJS) 58 | $(AR) $(ARFLAGS) $@ $^ 59 | 60 | 61 | clean: 62 | rm -f $(TARGETS) *~ *.o $(OBJS) 63 | 64 | install: 65 | mkdir -p $(INSTALLROOT)$(LIBDIR) 66 | $(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)$(LIBDIR) 67 | ifneq (,$(findstring FreeBSD,$(OS))) 68 | ifeq ($(ARCH),x86_64) 69 | $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)$(LIBDIR) 70 | else 71 | $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR) 72 | endif 73 | else 74 | $(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR) 75 | endif 76 | 77 | include $(SRCDIR)/../Make.rules 78 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/runtime/vm.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | vm.c 8 | 9 | Abstract: 10 | 11 | EFI Hell to remap runtime address into the new virual address space 12 | that was registered by the OS for RT calls. 13 | 14 | So the code image needs to be relocated. All pointers need to be 15 | manually fixed up since the address map changes. 16 | 17 | GOOD LUCK NOT HAVING BUGS IN YOUR CODE! PLEASE TEST A LOT. MAKE SURE 18 | EXIT BOOTSERVICES OVER WRITES ALL BOOTSERVICE MEMORY & DATA SPACES WHEN 19 | YOU TEST. 20 | 21 | Revision History 22 | 23 | --*/ 24 | 25 | #include "lib.h" 26 | 27 | #ifndef __GNUC__ 28 | #pragma RUNTIME_CODE(RtLibEnableVirtualMappings) 29 | #endif 30 | VOID 31 | RUNTIMEFUNCTION 32 | RtLibEnableVirtualMappings ( 33 | VOID 34 | ) 35 | { 36 | EFI_CONVERT_POINTER ConvertPointer; 37 | 38 | // 39 | // If this copy of the lib is linked into the firmware, then 40 | // do not update the pointers yet. 41 | // 42 | 43 | if (!LibFwInstance) { 44 | 45 | // 46 | // Different components are updating to the new virtual 47 | // mappings at differnt times. The only function that 48 | // is safe to call at this notification is ConvertAddress 49 | // 50 | 51 | ConvertPointer = RT->ConvertPointer; 52 | 53 | // 54 | // Fix any pointers that the lib created, that may be needed 55 | // during runtime. 56 | // 57 | 58 | ConvertPointer (EFI_INTERNAL_PTR, (VOID **)&RT); 59 | ConvertPointer (EFI_OPTIONAL_PTR, (VOID **)&LibRuntimeDebugOut); 60 | 61 | ConvertPointer (EFI_INTERNAL_PTR, (VOID **)&LibRuntimeRaiseTPL); 62 | ConvertPointer (EFI_INTERNAL_PTR, (VOID **)&LibRuntimeRestoreTPL); 63 | 64 | // that was it :^) 65 | } 66 | } 67 | 68 | 69 | #ifndef __GNUC__ 70 | #pragma RUNTIME_CODE(RtConvertList) 71 | #endif 72 | VOID 73 | RUNTIMEFUNCTION 74 | RtConvertList ( 75 | IN UINTN DebugDisposition, 76 | IN OUT LIST_ENTRY *ListHead 77 | ) 78 | { 79 | LIST_ENTRY *Link; 80 | LIST_ENTRY *NextLink; 81 | EFI_CONVERT_POINTER ConvertPointer; 82 | 83 | ConvertPointer = RT->ConvertPointer; 84 | 85 | // 86 | // Convert all the Flink & Blink pointers in the list 87 | // 88 | 89 | Link = ListHead; 90 | do { 91 | NextLink = Link->Flink; 92 | 93 | ConvertPointer ( 94 | Link->Flink == ListHead ? DebugDisposition : 0, 95 | (VOID **)&Link->Flink 96 | ); 97 | 98 | ConvertPointer ( 99 | Link->Blink == ListHead ? DebugDisposition : 0, 100 | (VOID **)&Link->Blink 101 | ); 102 | 103 | Link = NextLink; 104 | } while (Link != ListHead); 105 | } 106 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efi_nii.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFI_NII_H 2 | #define _EFI_NII_H 3 | 4 | /*++ 5 | Copyright (c) 2000 Intel Corporation 6 | 7 | Module name: 8 | efi_nii.h 9 | 10 | Abstract: 11 | 12 | Revision history: 13 | 2000-Feb-18 M(f)J GUID updated. 14 | Structure order changed for machine word alignment. 15 | Added StringId[4] to structure. 16 | 17 | 2000-Feb-14 M(f)J Genesis. 18 | --*/ 19 | 20 | #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID \ 21 | { 0xE18541CD, 0xF755, 0x4f73, {0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29} } 22 | 23 | #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION 0x00010000 24 | #define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION 25 | 26 | typedef enum { 27 | EfiNetworkInterfaceUndi = 1 28 | } EFI_NETWORK_INTERFACE_TYPE; 29 | 30 | typedef struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL { 31 | 32 | UINT64 Revision; 33 | // Revision of the network interface identifier protocol interface. 34 | 35 | UINT64 ID; 36 | // Address of the first byte of the identifying structure for this 37 | // network interface. This is set to zero if there is no structure. 38 | // 39 | // For PXE/UNDI this is the first byte of the !PXE structure. 40 | 41 | UINT64 ImageAddr; 42 | // Address of the UNrelocated driver/ROM image. This is set 43 | // to zero if there is no driver/ROM image. 44 | // 45 | // For 16-bit UNDI, this is the first byte of the option ROM in 46 | // upper memory. 47 | // 48 | // For 32/64-bit S/W UNDI, this is the first byte of the EFI ROM 49 | // image. 50 | // 51 | // For H/W UNDI, this is set to zero. 52 | 53 | UINT32 ImageSize; 54 | // Size of the UNrelocated driver/ROM image of this network interface. 55 | // This is set to zero if there is no driver/ROM image. 56 | 57 | CHAR8 StringId[4]; 58 | // 4 char ASCII string to go in class identifier (option 60) in DHCP 59 | // and Boot Server discover packets. 60 | // For EfiNetworkInterfaceUndi this field is "UNDI". 61 | // For EfiNetworkInterfaceSnp this field is "SNPN". 62 | 63 | UINT8 Type; 64 | UINT8 MajorVer; 65 | UINT8 MinorVer; 66 | // Information to be placed into the PXE DHCP and Discover packets. 67 | // This is the network interface type and version number that will 68 | // be placed into DHCP option 94 (client network interface identifier). 69 | BOOLEAN Ipv6Supported; 70 | UINT8 IfNum; // interface number to be used with pxeid structure 71 | } EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL, EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE; 72 | 73 | // Note: Because it conflicted with the EDK2 struct name, the 74 | // 'EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL' GUID definition, 75 | // from older versions of gnu-efi, is now obsoleted. 76 | // Use 'EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID' instead. 77 | 78 | #endif // _EFI_NII_H 79 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/t3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | EFI_STATUS 5 | efi_main( 6 | EFI_HANDLE image_handle, 7 | EFI_SYSTEM_TABLE *systab 8 | ) 9 | { 10 | EFI_GUID loaded_image_protocol = LOADED_IMAGE_PROTOCOL; 11 | EFI_STATUS efi_status; 12 | EFI_LOADED_IMAGE *li; 13 | UINTN pat = PoolAllocationType; 14 | VOID *void_li_p; 15 | 16 | InitializeLib(image_handle, systab); 17 | PoolAllocationType = 2; /* klooj */ 18 | 19 | Print(L"Hello World! (0xd=0x%x, 13=%d)\n", 13, 13); 20 | 21 | Print(L"before InitializeLib(): PoolAllocationType=%d\n", 22 | pat); 23 | 24 | Print(L" after InitializeLib(): PoolAllocationType=%d\n", 25 | PoolAllocationType); 26 | 27 | /* 28 | * Locate loaded_image_handle instance. 29 | */ 30 | 31 | Print(L"BS->HandleProtocol() "); 32 | 33 | efi_status = uefi_call_wrapper( 34 | BS->HandleProtocol, 35 | 3, 36 | image_handle, 37 | &loaded_image_protocol, 38 | &void_li_p); 39 | li = void_li_p; 40 | 41 | Print(L"%xh (%r)\n", efi_status, efi_status); 42 | 43 | if (efi_status != EFI_SUCCESS) { 44 | return efi_status; 45 | } 46 | 47 | Print(L" li: %xh\n", li); 48 | 49 | if (!li) { 50 | return EFI_UNSUPPORTED; 51 | } 52 | 53 | Print(L" li->Revision: %xh\n", li->Revision); 54 | Print(L" li->ParentHandle: %xh\n", li->ParentHandle); 55 | Print(L" li->SystemTable: %xh\n", li->SystemTable); 56 | Print(L" li->DeviceHandle: %xh\n", li->DeviceHandle); 57 | Print(L" li->FilePath: %xh\n", li->FilePath); 58 | Print(L" li->Reserved: %xh\n", li->Reserved); 59 | Print(L" li->LoadOptionsSize: %xh\n", li->LoadOptionsSize); 60 | Print(L" li->LoadOptions: %xh\n", li->LoadOptions); 61 | Print(L" li->ImageBase: %xh\n", li->ImageBase); 62 | Print(L" li->ImageSize: %xh\n", li->ImageSize); 63 | Print(L" li->ImageCodeType: %xh\n", li->ImageCodeType); 64 | Print(L" li->ImageDataType: %xh\n", li->ImageDataType); 65 | Print(L" li->Unload: %xh\n", li->Unload); 66 | 67 | #if 0 68 | typedef struct { 69 | UINT32 Revision; 70 | EFI_HANDLE ParentHandle; 71 | struct _EFI_SYSTEM_TABLE *SystemTable; 72 | 73 | // Source location of image 74 | EFI_HANDLE DeviceHandle; 75 | EFI_DEVICE_PATH *FilePath; 76 | VOID *Reserved; 77 | 78 | // Images load options 79 | UINT32 LoadOptionsSize; 80 | VOID *LoadOptions; 81 | 82 | // Location of where image was loaded 83 | VOID *ImageBase; 84 | UINT64 ImageSize; 85 | EFI_MEMORY_TYPE ImageCodeType; 86 | EFI_MEMORY_TYPE ImageDataType; 87 | 88 | // If the driver image supports a dynamic unload request 89 | EFI_IMAGE_UNLOAD Unload; 90 | 91 | } EFI_LOADED_IMAGE; 92 | #endif 93 | 94 | return EFI_SUCCESS; 95 | } 96 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/modelist.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern EFI_GUID GraphicsOutputProtocol; 5 | 6 | static void 7 | print_modes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) 8 | { 9 | int i, imax; 10 | EFI_STATUS rc; 11 | 12 | if (gop->Mode) { 13 | imax = gop->Mode->MaxMode; 14 | Print(L"GOP reports MaxMode %d\n", imax); 15 | } else { 16 | Print(L"gop->Mode is NULL\n"); 17 | imax = 1; 18 | } 19 | 20 | for (i = 0; i < imax; i++) { 21 | EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info; 22 | UINTN SizeOfInfo; 23 | rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo, 24 | &info); 25 | if (EFI_ERROR(rc) && rc == EFI_NOT_STARTED) { 26 | Print(L"gop->QueryMode() returned %r\n", rc); 27 | Print(L"Trying to start GOP with SetMode().\n"); 28 | rc = uefi_call_wrapper(gop->SetMode, 2, gop, 29 | gop->Mode ? gop->Mode->Mode : 0); 30 | rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, 31 | &SizeOfInfo, &info); 32 | } 33 | 34 | if (EFI_ERROR(rc)) { 35 | Print(L"%d: Bad response from QueryMode: %r (%d)\n", 36 | i, rc, rc); 37 | continue; 38 | } 39 | Print(L"%c%d: %dx%d ", 40 | (gop->Mode && 41 | CompareMem(info,gop->Mode->Info,sizeof(*info)) == 0 42 | ) ? '*' : ' ', 43 | i, info->HorizontalResolution, info->VerticalResolution); 44 | switch(info->PixelFormat) { 45 | case PixelRedGreenBlueReserved8BitPerColor: 46 | Print(L"RGBR"); 47 | break; 48 | case PixelBlueGreenRedReserved8BitPerColor: 49 | Print(L"BGRR"); 50 | break; 51 | case PixelBitMask: 52 | Print(L"R:%08x G:%08x B:%08x X:%08x", 53 | info->PixelInformation.RedMask, 54 | info->PixelInformation.GreenMask, 55 | info->PixelInformation.BlueMask, 56 | info->PixelInformation.ReservedMask); 57 | break; 58 | case PixelBltOnly: 59 | Print(L"(blt only)"); 60 | break; 61 | default: 62 | Print(L"(Invalid pixel format)"); 63 | break; 64 | } 65 | Print(L" pitch %d\n", info->PixelsPerScanLine); 66 | } 67 | } 68 | 69 | static EFI_STATUS 70 | SetWatchdog(UINTN seconds) 71 | { 72 | EFI_STATUS rc; 73 | rc = uefi_call_wrapper(BS->SetWatchdogTimer, 4, seconds, 0x1ffff, 74 | 0, NULL); 75 | if (EFI_ERROR(rc)) { 76 | CHAR16 Buffer[64]; 77 | StatusToString(Buffer, rc); 78 | Print(L"Bad response from QueryMode: %s (%d)\n", Buffer, rc); 79 | } 80 | return rc; 81 | } 82 | 83 | EFI_STATUS 84 | efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) 85 | { 86 | EFI_STATUS rc; 87 | EFI_GRAPHICS_OUTPUT_PROTOCOL *gop; 88 | 89 | InitializeLib(image_handle, systab); 90 | 91 | SetWatchdog(10); 92 | 93 | rc = LibLocateProtocol(&GraphicsOutputProtocol, (void **)&gop); 94 | if (EFI_ERROR(rc)) { 95 | Print(L"Could not locate GOP: %r\n", rc); 96 | return rc; 97 | } 98 | 99 | if (!gop) { 100 | Print(L"LocateProtocol(GOP, &gop) returned %r but GOP is NULL\n", rc); 101 | return EFI_UNSUPPORTED; 102 | } 103 | 104 | print_modes(gop); 105 | 106 | SetWatchdog(0); 107 | return EFI_SUCCESS; 108 | } 109 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/crt0-efi-ia64.S: -------------------------------------------------------------------------------- 1 | /* crt0-efi-ia64.S - IA-64 EFI startup code. 2 | Copyright (C) 1999 Hewlett-Packard Co. 3 | Contributed by David Mosberger . 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials 16 | provided with the distribution. 17 | * Neither the name of Hewlett-Packard Co. nor the names of its 18 | contributors may be used to endorse or promote products derived 19 | from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 22 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 23 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 26 | BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 27 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 31 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 32 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 | SUCH DAMAGE. 34 | */ 35 | .text 36 | .psr abi64 37 | .psr lsb 38 | .lsb 39 | 40 | .proc _start 41 | _start: 42 | alloc loc0=ar.pfs,2,2,2,0 43 | mov loc1=rp 44 | movl out0=@gprel(ImageBase) // out0 <- ImageBase (ldbase) 45 | ;; 46 | add out0=out0,gp 47 | movl out1=@gprel(_DYNAMIC) // out1 <- _DYNAMIC 48 | ;; // avoid WAW on CFM 49 | add out1=out1,gp 50 | br.call.sptk.few rp=_relocate 51 | .Lret0: 52 | cmp.ne p6,p0=r0,r8 // r8 == EFI_SUCCESS? 53 | (p6) br.cond.sptk.few .exit // no -> 54 | 55 | .Lret1: 56 | 57 | mov out0=in0 // image handle 58 | mov out1=in1 // systab 59 | br.call.sptk.few rp=efi_main 60 | .Lret2: 61 | .exit: 62 | mov ar.pfs=loc0 63 | mov rp=loc1 64 | ;; 65 | br.ret.sptk.few rp 66 | 67 | .endp _start 68 | 69 | 70 | // PE32+ wants a PLABEL, not the code address of the entry point: 71 | 72 | .align 16 73 | .global _start_plabel 74 | .section .plabel, "a" 75 | _start_plabel: 76 | data8 _start 77 | data8 __gp 78 | 79 | // hand-craft a .reloc section for the plabel: 80 | 81 | #define IMAGE_REL_BASED_DIR64 10 82 | 83 | .section .reloc, "a" 84 | data4 _start_plabel // Page RVA 85 | data4 12 // Block Size (2*4+2*2) 86 | data2 (IMAGE_REL_BASED_DIR64<<12) + 0 // reloc for plabel's entry point 87 | data2 (IMAGE_REL_BASED_DIR64<<12) + 8 // reloc for plabel's global pointer 88 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/protocol/legacyboot.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1999 Intel Corporation 4 | 5 | Module Name: 6 | 7 | legacyboot 8 | 9 | Abstract: 10 | 11 | EFI support for legacy boot 12 | 13 | 14 | 15 | Revision History 16 | 17 | --*/ 18 | 19 | #ifndef _LEGACY_BOOT_INCLUDE_ 20 | #define _LEGACY_BOOT_INCLUDE_ 21 | 22 | #define LEGACY_BOOT_PROTOCOL \ 23 | { 0x376e5eb2, 0x30e4, 0x11d3, { 0xba, 0xe5, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } 24 | 25 | #pragma pack(1) 26 | 27 | // 28 | // BBS 1.01 (See Appendix A) IPL and BCV Table Entry Data structure. 29 | // Seg:Off pointers have been converted to EFI pointers in this data structure 30 | // This is the structure that also maps to the EFI device path for the boot selection 31 | // 32 | typedef struct { 33 | UINT16 DeviceType; 34 | UINT16 StatusFlag; 35 | UINT32 Reserved; 36 | VOID *BootHandler; // Not an EFI entry point 37 | CHAR8 *DescString; 38 | } BBS_TABLE_ENTRY; 39 | #pragma pack() 40 | 41 | typedef 42 | EFI_STATUS 43 | (EFIAPI *LEGACY_BOOT_CALL) ( 44 | IN EFI_DEVICE_PATH *DevicePath 45 | ); 46 | 47 | 48 | // 49 | // BBS support functions 50 | // PnP Call numbers and BiosSelector hidden in implementation 51 | // 52 | 53 | typedef enum { 54 | IplRelative, 55 | BcvRelative 56 | } BBS_TYPE; 57 | 58 | INTERFACE_DECL(_LEGACY_BOOT_INTERFACE); 59 | 60 | // 61 | // == PnP Function 0x60 then BbsVersion == 0x0101 if this call fails then BbsVersion == 0x0000 62 | // 63 | 64 | // 65 | // == PnP Function 0x61 66 | // 67 | typedef 68 | EFI_STATUS 69 | (EFIAPI *GET_DEVICE_COUNT) ( 70 | IN struct _LEGACY_BOOT_INTERFACE *This, 71 | IN BBS_TYPE *TableType, 72 | OUT UINTN *DeviceCount, 73 | OUT UINTN *MaxCount 74 | ); 75 | 76 | // 77 | // == PnP Function 0x62 78 | // 79 | typedef 80 | EFI_STATUS 81 | (EFIAPI *GET_PRIORITY_AND_TABLE) ( 82 | IN struct _LEGACY_BOOT_INTERFACE *This, 83 | IN BBS_TYPE *TableType, 84 | IN OUT UINTN *PrioritySize, // MaxCount * sizeof(UINT8) 85 | OUT UINTN *Priority, 86 | IN OUT UINTN *TableSize, // MaxCount * sizeof(BBS_TABLE_ENTRY) 87 | OUT BBS_TABLE_ENTRY *TableEntrySize 88 | ); 89 | 90 | // 91 | // == PnP Function 0x63 92 | // 93 | typedef 94 | EFI_STATUS 95 | (EFIAPI *SET_PRIORITY) ( 96 | IN struct _LEGACY_BOOT_INTERFACE *This, 97 | IN BBS_TYPE *TableType, 98 | IN OUT UINTN *PrioritySize, 99 | OUT UINTN *Priority 100 | ); 101 | 102 | typedef struct _LEGACY_BOOT_INTERFACE { 103 | LEGACY_BOOT_CALL BootIt; 104 | 105 | // 106 | // New functions to allow BBS booting to be configured from EFI 107 | // 108 | UINTN BbsVersion; // Currently 0x0101 109 | GET_DEVICE_COUNT GetDeviceCount; 110 | GET_PRIORITY_AND_TABLE GetPriorityAndTable; 111 | SET_PRIORITY SetPriority; 112 | } LEGACY_BOOT_INTERFACE; 113 | 114 | EFI_STATUS 115 | PlInitializeLegacyBoot ( 116 | VOID 117 | ); 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efifs.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFI_FS_H 2 | #define _EFI_FS_H 3 | 4 | /*++ 5 | 6 | Copyright (c) 1998 Intel Corporation 7 | 8 | Module Name: 9 | 10 | efifs.h 11 | 12 | Abstract: 13 | 14 | EFI File System structures 15 | 16 | 17 | 18 | Revision History 19 | 20 | --*/ 21 | 22 | 23 | // 24 | // EFI Partition header (normaly starts in LBA 1) 25 | // 26 | 27 | #define EFI_PARTITION_SIGNATURE 0x5053595320494249 28 | #define EFI_PARTITION_REVISION 0x00010001 29 | #define MIN_EFI_PARTITION_BLOCK_SIZE 512 30 | #define EFI_PARTITION_LBA 1 31 | 32 | typedef struct _EFI_PARTITION_HEADER { 33 | EFI_TABLE_HEADER Hdr; 34 | UINT32 DirectoryAllocationNumber; 35 | UINT32 BlockSize; 36 | EFI_LBA FirstUsableLba; 37 | EFI_LBA LastUsableLba; 38 | EFI_LBA UnusableSpace; 39 | EFI_LBA FreeSpace; 40 | EFI_LBA RootFile; 41 | EFI_LBA SecutiryFile; 42 | } EFI_PARTITION_HEADER; 43 | 44 | 45 | // 46 | // File header 47 | // 48 | 49 | #define EFI_FILE_HEADER_SIGNATURE 0x454c494620494249 50 | #define EFI_FILE_HEADER_REVISION 0x00010000 51 | #define EFI_FILE_STRING_SIZE 260 52 | 53 | typedef struct _EFI_FILE_HEADER { 54 | EFI_TABLE_HEADER Hdr; 55 | UINT32 Class; 56 | UINT32 LBALOffset; 57 | EFI_LBA Parent; 58 | UINT64 FileSize; 59 | UINT64 FileAttributes; 60 | EFI_TIME FileCreateTime; 61 | EFI_TIME FileModificationTime; 62 | EFI_GUID VendorGuid; 63 | CHAR16 FileString[EFI_FILE_STRING_SIZE]; 64 | } EFI_FILE_HEADER; 65 | 66 | 67 | // 68 | // Return the file's first LBAL which is in the same 69 | // logical block as the file header 70 | // 71 | 72 | #define EFI_FILE_LBAL(a) ((EFI_LBAL *) (((CHAR8 *) (a)) + (a)->LBALOffset)) 73 | 74 | #define EFI_FILE_CLASS_FREE_SPACE 1 75 | #define EFI_FILE_CLASS_EMPTY 2 76 | #define EFI_FILE_CLASS_NORMAL 3 77 | 78 | 79 | // 80 | // Logical Block Address List - the fundemental block 81 | // description structure 82 | // 83 | 84 | #define EFI_LBAL_SIGNATURE 0x4c41424c20494249 85 | #define EFI_LBAL_REVISION 0x00010000 86 | 87 | typedef struct _EFI_LBAL { 88 | EFI_TABLE_HEADER Hdr; 89 | UINT32 Class; 90 | EFI_LBA Parent; 91 | EFI_LBA Next; 92 | UINT32 ArraySize; 93 | UINT32 ArrayCount; 94 | } EFI_LBAL; 95 | 96 | // Array size 97 | #define EFI_LBAL_ARRAY_SIZE(lbal,offs,blks) \ 98 | (((blks) - (offs) - (lbal)->Hdr.HeaderSize) / sizeof(EFI_RL)) 99 | 100 | // 101 | // Logical Block run-length 102 | // 103 | 104 | typedef struct { 105 | EFI_LBA Start; 106 | UINT64 Length; 107 | } EFI_RL; 108 | 109 | // 110 | // Return the run-length structure from an LBAL header 111 | // 112 | 113 | #define EFI_LBAL_RL(a) ((EFI_RL*) (((CHAR8 *) (a)) + (a)->Hdr.HeaderSize)) 114 | 115 | #endif 116 | 117 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/Makefile.orig: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 1999-2001 Hewlett-Packard Co. 3 | # Contributed by David Mosberger 4 | # Contributed by Stephane Eranian 5 | # 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 12 | # * Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # * Redistributions in binary form must reproduce the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer in the documentation and/or other materials 17 | # provided with the distribution. 18 | # * Neither the name of Hewlett-Packard Co. nor the names of its 19 | # contributors may be used to endorse or promote products derived 20 | # from this software without specific prior written permission. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 27 | # BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 28 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 32 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 33 | # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 | # SUCH DAMAGE. 35 | # 36 | 37 | SRCDIR = . 38 | 39 | VPATH = $(SRCDIR) 40 | 41 | include $(SRCDIR)/../Make.defaults 42 | 43 | TOPDIR = $(SRCDIR)/.. 44 | 45 | CDIR = $(TOPDIR)/.. 46 | FILES = boxdraw smbios console crc data debug dpath \ 47 | error event guid hand hw init lock \ 48 | misc print sread str cmdline \ 49 | runtime/rtlock runtime/efirtlib runtime/rtstr runtime/vm runtime/rtdata \ 50 | $(ARCH)/initplat $(ARCH)/math 51 | 52 | ifeq ($(ARCH),ia64) 53 | FILES += $(ARCH)/salpal $(ARCH)/palproc 54 | endif 55 | 56 | ifeq ($(ARCH),x86_64) 57 | FILES += $(ARCH)/callwrap $(ARCH)/efi_stub 58 | endif 59 | 60 | ifeq ($(ARCH),arm) 61 | FILES += $(ARCH)/lib1funcs $(ARCH)/div64 62 | endif 63 | 64 | OBJS = $(FILES:%=%.o) 65 | 66 | SUBDIRS = ia32 x86_64 ia64 aarch64 arm runtime 67 | 68 | LIBDIRINSTALL = $(INSTALLROOT)$(LIBDIR) 69 | 70 | all: libsubdirs libefi.a 71 | 72 | .PHONY: libsubdirs 73 | libsubdirs: 74 | for sdir in $(SUBDIRS); do mkdir -p $$sdir; done 75 | 76 | libefi.a: $(patsubst %,libefi.a(%),$(OBJS)) 77 | 78 | clean: 79 | rm -f libefi.a *~ $(OBJS) */*.o 80 | 81 | $(LIBDIRINSTALL): 82 | mkdir -p $@ 83 | 84 | $(LIBDIRINSTALL)/libefi.a: libefi.a | $(LIBDIRINSTALL) 85 | $(INSTALL) -m 644 $< $(dir $@) 86 | 87 | install: $(LIBDIRINSTALL)/libefi.a 88 | 89 | include $(SRCDIR)/../Make.rules 90 | 91 | .PHONY: libsubdirs 92 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/reloc_arm.c: -------------------------------------------------------------------------------- 1 | /* reloc_arm.c - position independent x86 ELF shared object relocator 2 | Copyright (C) 2014 Linaro Ltd. 3 | Copyright (C) 1999 Hewlett-Packard Co. 4 | Contributed by David Mosberger . 5 | 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | 12 | * Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | * Redistributions in binary form must reproduce the above 15 | copyright notice, this list of conditions and the following 16 | disclaimer in the documentation and/or other materials 17 | provided with the distribution. 18 | * Neither the name of Hewlett-Packard Co. nor the names of its 19 | contributors may be used to endorse or promote products derived 20 | from this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 27 | BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 28 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 32 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 33 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 | SUCH DAMAGE. 35 | */ 36 | 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | EFI_STATUS _relocate (long ldbase, Elf32_Dyn *dyn, 43 | EFI_HANDLE image EFI_UNUSED, 44 | EFI_SYSTEM_TABLE *systab EFI_UNUSED) 45 | { 46 | long relsz = 0, relent = 0; 47 | Elf32_Rel *rel = 0; 48 | unsigned long *addr; 49 | int i; 50 | 51 | for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { 52 | switch (dyn[i].d_tag) { 53 | case DT_REL: 54 | rel = (Elf32_Rel*) 55 | ((unsigned long)dyn[i].d_un.d_ptr 56 | + ldbase); 57 | break; 58 | 59 | case DT_RELSZ: 60 | relsz = dyn[i].d_un.d_val; 61 | break; 62 | 63 | case DT_RELENT: 64 | relent = dyn[i].d_un.d_val; 65 | break; 66 | 67 | default: 68 | break; 69 | } 70 | } 71 | 72 | if (!rel && relent == 0) 73 | return EFI_SUCCESS; 74 | 75 | if (!rel || relent == 0) 76 | return EFI_LOAD_ERROR; 77 | 78 | while (relsz > 0) { 79 | /* apply the relocs */ 80 | switch (ELF32_R_TYPE (rel->r_info)) { 81 | case R_ARM_NONE: 82 | break; 83 | 84 | case R_ARM_RELATIVE: 85 | addr = (unsigned long *) 86 | (ldbase + rel->r_offset); 87 | *addr += ldbase; 88 | break; 89 | 90 | default: 91 | break; 92 | } 93 | rel = (Elf32_Rel*) ((char *) rel + relent); 94 | relsz -= relent; 95 | } 96 | return EFI_SUCCESS; 97 | } 98 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 1999-2001 Hewlett-Packard Co. 3 | # Contributed by David Mosberger 4 | # Contributed by Stephane Eranian 5 | # 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 12 | # * Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # * Redistributions in binary form must reproduce the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer in the documentation and/or other materials 17 | # provided with the distribution. 18 | # * Neither the name of Hewlett-Packard Co. nor the names of its 19 | # contributors may be used to endorse or promote products derived 20 | # from this software without specific prior written permission. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 27 | # BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 28 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 32 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 33 | # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 | # SUCH DAMAGE. 35 | # 36 | 37 | SRCDIR = . 38 | 39 | VPATH = $(SRCDIR) 40 | 41 | include $(SRCDIR)/../Make.defaults 42 | 43 | TOPDIR = $(SRCDIR)/.. 44 | 45 | CDIR = $(TOPDIR)/.. 46 | FILES = boxdraw smbios console crc data debug dpath \ 47 | error event exit guid hand hw init lock \ 48 | misc print sread str cmdline \ 49 | runtime/rtlock runtime/efirtlib runtime/rtstr runtime/vm runtime/rtdata \ 50 | $(ARCH)/initplat $(ARCH)/math $(ARCH)/setjmp 51 | 52 | ifeq ($(ARCH),ia64) 53 | FILES += $(ARCH)/salpal $(ARCH)/palproc 54 | endif 55 | 56 | ifeq ($(ARCH),x86_64) 57 | FILES += $(ARCH)/callwrap $(ARCH)/efi_stub 58 | endif 59 | 60 | ifeq ($(ARCH),arm) 61 | FILES += $(ARCH)/uldiv $(ARCH)/ldivmod $(ARCH)/div $(ARCH)/llsl $(ARCH)/llsr \ 62 | $(ARCH)/mullu 63 | endif 64 | 65 | OBJS = $(FILES:%=%.o) 66 | 67 | SUBDIRS = ia32 x86_64 ia64 aarch64 arm mips64el runtime 68 | 69 | LIBDIRINSTALL = $(INSTALLROOT)$(LIBDIR) 70 | 71 | all: libsubdirs libefi.a 72 | 73 | .PHONY: libsubdirs 74 | libsubdirs: 75 | for sdir in $(SUBDIRS); do mkdir -p $$sdir; done 76 | 77 | libefi.a: $(OBJS) 78 | $(AR) $(ARFLAGS) $@ $^ 79 | 80 | clean: 81 | rm -f libefi.a *~ $(OBJS) */*.o 82 | 83 | $(LIBDIRINSTALL): 84 | mkdir -p $@ 85 | 86 | $(LIBDIRINSTALL)/libefi.a: libefi.a | $(LIBDIRINSTALL) 87 | $(INSTALL) -m 644 $< $(dir $@) 88 | 89 | install: $(LIBDIRINSTALL)/libefi.a 90 | 91 | include $(SRCDIR)/../Make.rules 92 | 93 | .PHONY: libsubdirs 94 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/reloc_aarch64.c: -------------------------------------------------------------------------------- 1 | /* reloc_aarch64.c - position independent x86 ELF shared object relocator 2 | Copyright (C) 2014 Linaro Ltd. 3 | Copyright (C) 1999 Hewlett-Packard Co. 4 | Contributed by David Mosberger . 5 | 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | 12 | * Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | * Redistributions in binary form must reproduce the above 15 | copyright notice, this list of conditions and the following 16 | disclaimer in the documentation and/or other materials 17 | provided with the distribution. 18 | * Neither the name of Hewlett-Packard Co. nor the names of its 19 | contributors may be used to endorse or promote products derived 20 | from this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 27 | BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 28 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 32 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 33 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 | SUCH DAMAGE. 35 | */ 36 | 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | EFI_STATUS _relocate (long ldbase, Elf64_Dyn *dyn, 43 | EFI_HANDLE image EFI_UNUSED, 44 | EFI_SYSTEM_TABLE *systab EFI_UNUSED) 45 | { 46 | long relsz = 0, relent = 0; 47 | Elf64_Rela *rel = 0; 48 | unsigned long *addr; 49 | int i; 50 | 51 | for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { 52 | switch (dyn[i].d_tag) { 53 | case DT_RELA: 54 | rel = (Elf64_Rela*) 55 | ((unsigned long)dyn[i].d_un.d_ptr 56 | + ldbase); 57 | break; 58 | 59 | case DT_RELASZ: 60 | relsz = dyn[i].d_un.d_val; 61 | break; 62 | 63 | case DT_RELAENT: 64 | relent = dyn[i].d_un.d_val; 65 | break; 66 | 67 | default: 68 | break; 69 | } 70 | } 71 | 72 | if (!rel && relent == 0) 73 | return EFI_SUCCESS; 74 | 75 | if (!rel || relent == 0) 76 | return EFI_LOAD_ERROR; 77 | 78 | while (relsz > 0) { 79 | /* apply the relocs */ 80 | switch (ELF64_R_TYPE (rel->r_info)) { 81 | case R_AARCH64_NONE: 82 | break; 83 | 84 | case R_AARCH64_RELATIVE: 85 | addr = (unsigned long *) 86 | (ldbase + rel->r_offset); 87 | *addr = ldbase + rel->r_addend; 88 | break; 89 | 90 | default: 91 | break; 92 | } 93 | rel = (Elf64_Rela*) ((char *) rel + relent); 94 | relsz -= relent; 95 | } 96 | return EFI_SUCCESS; 97 | } 98 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/reloc_x86_64.c: -------------------------------------------------------------------------------- 1 | /* reloc_x86_64.c - position independent x86_64 ELF shared object relocator 2 | Copyright (C) 1999 Hewlett-Packard Co. 3 | Contributed by David Mosberger . 4 | Copyright (C) 2005 Intel Co. 5 | Contributed by Fenghua Yu . 6 | 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions 11 | are met: 12 | 13 | * Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | * Redistributions in binary form must reproduce the above 16 | copyright notice, this list of conditions and the following 17 | disclaimer in the documentation and/or other materials 18 | provided with the distribution. 19 | * Neither the name of Hewlett-Packard Co. nor the names of its 20 | contributors may be used to endorse or promote products derived 21 | from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 24 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 28 | BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 29 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 30 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 31 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 33 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 34 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 | SUCH DAMAGE. 36 | */ 37 | 38 | #include 39 | #include 40 | 41 | #include 42 | 43 | EFI_STATUS _relocate (long ldbase, Elf64_Dyn *dyn, 44 | EFI_HANDLE image EFI_UNUSED, 45 | EFI_SYSTEM_TABLE *systab EFI_UNUSED) 46 | { 47 | long relsz = 0, relent = 0; 48 | Elf64_Rel *rel = 0; 49 | unsigned long *addr; 50 | int i; 51 | 52 | for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { 53 | switch (dyn[i].d_tag) { 54 | case DT_RELA: 55 | rel = (Elf64_Rel*) 56 | ((unsigned long)dyn[i].d_un.d_ptr 57 | + ldbase); 58 | break; 59 | 60 | case DT_RELASZ: 61 | relsz = dyn[i].d_un.d_val; 62 | break; 63 | 64 | case DT_RELAENT: 65 | relent = dyn[i].d_un.d_val; 66 | break; 67 | 68 | default: 69 | break; 70 | } 71 | } 72 | 73 | if (!rel && relent == 0) 74 | return EFI_SUCCESS; 75 | 76 | if (!rel || relent == 0) 77 | return EFI_LOAD_ERROR; 78 | 79 | while (relsz > 0) { 80 | /* apply the relocs */ 81 | switch (ELF64_R_TYPE (rel->r_info)) { 82 | case R_X86_64_NONE: 83 | break; 84 | 85 | case R_X86_64_RELATIVE: 86 | addr = (unsigned long *) 87 | (ldbase + rel->r_offset); 88 | *addr += ldbase; 89 | break; 90 | 91 | default: 92 | break; 93 | } 94 | rel = (Elf64_Rel*) ((char *) rel + relent); 95 | relsz -= relent; 96 | } 97 | return EFI_SUCCESS; 98 | } 99 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efirtlib.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFI_RT_LIB_INCLUDE_ 2 | #define _EFI_RT_LIB_INCLUDE_ 3 | /*++ 4 | 5 | Copyright (c) 1998 Intel Corporation 6 | 7 | Module Name: 8 | 9 | efilib.h 10 | 11 | Abstract: 12 | 13 | EFI Runtime library functions 14 | 15 | 16 | 17 | Revision History 18 | 19 | --*/ 20 | 21 | #include "efidebug.h" 22 | #include "efipart.h" 23 | #include "efilibplat.h" 24 | 25 | 26 | VOID 27 | RUNTIMEFUNCTION 28 | RtZeroMem ( 29 | IN VOID *Buffer, 30 | IN UINTN Size 31 | ); 32 | 33 | VOID 34 | RUNTIMEFUNCTION 35 | RtSetMem ( 36 | IN VOID *Buffer, 37 | IN UINTN Size, 38 | IN UINT8 Value 39 | ); 40 | 41 | VOID 42 | RUNTIMEFUNCTION 43 | RtCopyMem ( 44 | IN VOID *Dest, 45 | IN CONST VOID *Src, 46 | IN UINTN len 47 | ); 48 | 49 | INTN 50 | RUNTIMEFUNCTION 51 | RtCompareMem ( 52 | IN CONST VOID *Dest, 53 | IN CONST VOID *Src, 54 | IN UINTN len 55 | ); 56 | 57 | INTN 58 | RUNTIMEFUNCTION 59 | RtStrCmp ( 60 | IN CONST CHAR16 *s1, 61 | IN CONST CHAR16 *s2 62 | ); 63 | 64 | 65 | VOID 66 | RUNTIMEFUNCTION 67 | RtStrCpy ( 68 | IN CHAR16 *Dest, 69 | IN CONST CHAR16 *Src 70 | ); 71 | 72 | VOID 73 | RUNTIMEFUNCTION 74 | RtStrnCpy ( 75 | IN CHAR16 *Dest, 76 | IN CONST CHAR16 *Src, 77 | IN UINTN Len 78 | ); 79 | 80 | CHAR16 * 81 | RUNTIMEFUNCTION 82 | RtStpCpy ( 83 | IN CHAR16 *Dest, 84 | IN CONST CHAR16 *Src 85 | ); 86 | 87 | CHAR16 * 88 | RUNTIMEFUNCTION 89 | RtStpnCpy ( 90 | IN CHAR16 *Dest, 91 | IN CONST CHAR16 *Src, 92 | IN UINTN Len 93 | ); 94 | 95 | VOID 96 | RUNTIMEFUNCTION 97 | RtStrCat ( 98 | IN CHAR16 *Dest, 99 | IN CONST CHAR16 *Src 100 | ); 101 | 102 | VOID 103 | RUNTIMEFUNCTION 104 | RtStrnCat ( 105 | IN CHAR16 *Dest, 106 | IN CONST CHAR16 *Src, 107 | IN UINTN Len 108 | ); 109 | 110 | UINTN 111 | RUNTIMEFUNCTION 112 | RtStrLen ( 113 | IN CONST CHAR16 *s1 114 | ); 115 | 116 | UINTN 117 | RUNTIMEFUNCTION 118 | RtStrnLen ( 119 | IN CONST CHAR16 *s1, 120 | IN UINTN Len 121 | ); 122 | 123 | UINTN 124 | RUNTIMEFUNCTION 125 | RtStrSize ( 126 | IN CONST CHAR16 *s1 127 | ); 128 | 129 | INTN 130 | RUNTIMEFUNCTION 131 | RtCompareGuid ( 132 | IN EFI_GUID *Guid1, 133 | IN EFI_GUID *Guid2 134 | ); 135 | 136 | UINT8 137 | RUNTIMEFUNCTION 138 | RtDecimaltoBCD( 139 | IN UINT8 BcdValue 140 | ); 141 | 142 | UINT8 143 | RUNTIMEFUNCTION 144 | RtBCDtoDecimal( 145 | IN UINT8 BcdValue 146 | ); 147 | 148 | // 149 | // Virtual mapping transition support. (Only used during 150 | // the virtual address change transisition) 151 | // 152 | 153 | VOID 154 | RUNTIMEFUNCTION 155 | RtLibEnableVirtualMappings ( 156 | VOID 157 | ); 158 | 159 | VOID 160 | RUNTIMEFUNCTION 161 | RtConvertList ( 162 | IN UINTN DebugDisposition, 163 | IN OUT LIST_ENTRY *ListHead 164 | ); 165 | 166 | VOID 167 | RUNTIMEFUNCTION 168 | RtAcquireLock ( 169 | IN FLOCK *Lock 170 | ); 171 | 172 | VOID 173 | RUNTIMEFUNCTION 174 | RtReleaseLock ( 175 | IN FLOCK *Lock 176 | ); 177 | 178 | 179 | #endif 180 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/reloc_ia32.c: -------------------------------------------------------------------------------- 1 | /* reloc_ia32.c - position independent x86 ELF shared object relocator 2 | Copyright (C) 1999 Hewlett-Packard Co. 3 | Contributed by David Mosberger . 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials 16 | provided with the distribution. 17 | * Neither the name of Hewlett-Packard Co. nor the names of its 18 | contributors may be used to endorse or promote products derived 19 | from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 22 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 23 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 26 | BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 27 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 31 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 32 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 | SUCH DAMAGE. 34 | */ 35 | 36 | #include 37 | #include 38 | 39 | #include 40 | 41 | EFI_STATUS _relocate (long ldbase, Elf32_Dyn *dyn, 42 | EFI_HANDLE image EFI_UNUSED, 43 | EFI_SYSTEM_TABLE *systab EFI_UNUSED) 44 | { 45 | long relsz = 0, relent = 0; 46 | Elf32_Rel *rel = 0; 47 | unsigned long *addr; 48 | int i; 49 | 50 | for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { 51 | switch (dyn[i].d_tag) { 52 | case DT_REL: 53 | rel = (Elf32_Rel*) 54 | ((unsigned long)dyn[i].d_un.d_ptr 55 | + ldbase); 56 | break; 57 | 58 | case DT_RELSZ: 59 | relsz = dyn[i].d_un.d_val; 60 | break; 61 | 62 | case DT_RELENT: 63 | relent = dyn[i].d_un.d_val; 64 | break; 65 | 66 | case DT_RELA: 67 | break; 68 | 69 | default: 70 | break; 71 | } 72 | } 73 | 74 | if (!rel && relent == 0) 75 | return EFI_SUCCESS; 76 | 77 | if (!rel || relent == 0) 78 | return EFI_LOAD_ERROR; 79 | 80 | while (relsz > 0) { 81 | /* apply the relocs */ 82 | switch (ELF32_R_TYPE (rel->r_info)) { 83 | case R_386_NONE: 84 | break; 85 | 86 | case R_386_RELATIVE: 87 | addr = (unsigned long *) 88 | (ldbase + rel->r_offset); 89 | *addr += ldbase; 90 | break; 91 | 92 | default: 93 | break; 94 | } 95 | rel = (Elf32_Rel*) ((char *) rel + relent); 96 | relsz -= relent; 97 | } 98 | return EFI_SUCCESS; 99 | } 100 | -------------------------------------------------------------------------------- /aspm.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | from enum import Enum 3 | 4 | class ASPM(Enum): 5 | ASPM_DISABLED = 0b00 6 | ASPM_L0s_ONLY = 0b01 7 | ASPM_L1_ONLY = 0b10 8 | ASPM_L1_AND_L0s = 0b11 9 | 10 | root_complex = "00:1c.4" 11 | endpoint = "05:00.0" 12 | value_to_set = ASPM.ASPM_L1_AND_L0s 13 | 14 | def get_device_name(addr): 15 | p = subprocess.Popen([ 16 | "lspci", 17 | "-s", 18 | addr, 19 | ], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 20 | return p.communicate()[0].splitlines()[0].decode() 21 | 22 | def read_all_bytes(device): 23 | all_bytes = bytearray() 24 | device_name = get_device_name(device) 25 | p = subprocess.Popen([ 26 | "lspci", 27 | "-s", 28 | device, 29 | "-xxx" 30 | ], stdout= subprocess.PIPE, stderr=subprocess.PIPE) 31 | ret = p.communicate() 32 | ret = ret[0].decode() 33 | for line in ret.splitlines(): 34 | if not device_name in line and ": " in line: 35 | all_bytes.extend(bytearray.fromhex(line.split(": ")[1])) 36 | if len(all_bytes) < 256: 37 | print(f"Expected 256 bytes, only got {len(all_bytes)} bytes!") 38 | print(f"Are you running this as root?") 39 | exit() 40 | return all_bytes 41 | 42 | def find_byte_to_patch(bytes, pos): 43 | print(f"{hex(pos)} points to {hex(bytes[pos])}") 44 | pos = bytes[pos] 45 | print(f"Value at {hex(pos)} is {hex(bytes[pos])}") 46 | if bytes[pos] != 0x10: 47 | print("Value is not 0x10!") 48 | print("Reading the next byte...") 49 | pos += 0x1 50 | return find_byte_to_patch(bytes, pos) 51 | else: 52 | print(f"Found the byte at: {hex(pos)}") 53 | print("Adding 0x10 to the register...") 54 | pos += 0x10 55 | print(f"Final register reads: {hex(bytes[pos])}") 56 | return pos 57 | 58 | def patch_byte(device, position, value): 59 | subprocess.Popen([ 60 | "setpci", 61 | "-s", 62 | device, 63 | f"{hex(position)}.B={hex(value)}" 64 | ]).communicate() 65 | 66 | def patch_device(addr): 67 | print(get_device_name(addr)) 68 | endpoint_bytes = read_all_bytes(addr) 69 | byte_position_to_patch = find_byte_to_patch(endpoint_bytes, 0x34) 70 | 71 | print(f"Position of byte to patch: {hex(byte_position_to_patch)}") 72 | print(f"Byte is set to {hex(endpoint_bytes[byte_position_to_patch])}") 73 | print(f"-> {ASPM(int(endpoint_bytes[byte_position_to_patch]) & 0b11).name}") 74 | 75 | if int(endpoint_bytes[byte_position_to_patch]) & 0b11 != value_to_set.value: 76 | print("Value doesn't match the one we want, setting it!") 77 | 78 | patched_byte = int(endpoint_bytes[byte_position_to_patch]) 79 | patched_byte = patched_byte >> 2 80 | patched_byte = patched_byte << 2 81 | patched_byte = patched_byte | value_to_set.value 82 | 83 | patch_byte(addr, byte_position_to_patch, patched_byte) 84 | new_bytes = read_all_bytes(addr) 85 | print(f"Byte is now set to {hex(new_bytes[byte_position_to_patch])}") 86 | print(f"-> {ASPM(int(new_bytes[byte_position_to_patch]) & 0b11).name}") 87 | else: 88 | print("Nothing to patch!") 89 | 90 | def main(): 91 | patch_device(root_complex) 92 | patch_device(endpoint) 93 | 94 | 95 | if __name__ == "__main__": 96 | main() 97 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 1999-2001 Hewlett-Packard Co. 3 | # Contributed by David Mosberger 4 | # Contributed by Stephane Eranian 5 | # 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 12 | # * Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # * Redistributions in binary form must reproduce the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer in the documentation and/or other materials 17 | # provided with the distribution. 18 | # * Neither the name of Hewlett-Packard Co. nor the names of its 19 | # contributors may be used to endorse or promote products derived 20 | # from this software without specific prior written permission. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 27 | # BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 28 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 32 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 33 | # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 | # SUCH DAMAGE. 35 | # 36 | 37 | SRCDIR = . 38 | 39 | VPATH = $(SRCDIR) 40 | 41 | include $(SRCDIR)/../Make.defaults 42 | 43 | TOPDIR = $(SRCDIR)/.. 44 | 45 | CDIR=$(TOPDIR)/.. 46 | LINUX_HEADERS = /usr/src/sys/build 47 | CPPFLAGS += -D__KERNEL__ -I$(LINUX_HEADERS)/include 48 | CRTOBJS = ../gnuefi/crt0-efi-$(ARCH).o 49 | 50 | LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_efi.lds 51 | ifneq (,$(findstring FreeBSD,$(OS))) 52 | LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds 53 | endif 54 | 55 | LDFLAGS += -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS) 56 | 57 | LOADLIBES += -lefi -lgnuefi 58 | LOADLIBES += $(LIBGCC) 59 | LOADLIBES += -T $(LDSCRIPT) 60 | 61 | TARGET_APPS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi \ 62 | printenv.efi t7.efi t8.efi tcc.efi modelist.efi \ 63 | route80h.efi drv0_use.efi AllocPages.efi exit.efi \ 64 | FreePages.efi setjmp.efi debughook.efi debughook.efi.debug \ 65 | bltgrid.efi lfbgrid.efi setdbg.efi unsetdbg.efi 66 | TARGET_BSDRIVERS = drv0.efi 67 | TARGET_RTDRIVERS = 68 | 69 | ifneq ($(HAVE_EFI_OBJCOPY),) 70 | 71 | FORMAT := --target efi-app-$(ARCH) 72 | $(TARGET_BSDRIVERS): FORMAT=--target efi-bsdrv-$(ARCH) 73 | $(TARGET_RTDRIVERS): FORMAT=--target efi-rtdrv-$(ARCH) 74 | 75 | else 76 | 77 | SUBSYSTEM := 0xa 78 | $(TARGET_BSDRIVERS): SUBSYSTEM = 0xb 79 | $(TARGET_RTDRIVERS): SUBSYSTEM = 0xc 80 | 81 | FORMAT := -O binary 82 | LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM) 83 | 84 | endif 85 | 86 | TARGETS = $(TARGET_APPS) $(TARGET_BSDRIVERS) $(TARGET_RTDRIVERS) 87 | 88 | all: $(TARGETS) 89 | 90 | clean: 91 | rm -f $(TARGETS) *~ *.o *.so 92 | 93 | .PHONY: install 94 | 95 | include $(SRCDIR)/../Make.rules 96 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/bltgrid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern EFI_GUID GraphicsOutputProtocol; 5 | 6 | static void 7 | fill_boxes(UINT32 *PixelBuffer, UINT32 Width, UINT32 Height) 8 | { 9 | UINT32 y, x = 0; 10 | /* 11 | * This assums BGRR, but it doesn't really matter; we pick red and 12 | * green so it'll just be blue/green if the pixel format is backwards. 13 | */ 14 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL Red = {0, 0, 0xff, 0}, 15 | Green = {0, 0xff, 0, 0}, 16 | *Color; 17 | 18 | for (y = 0; y < Height; y++) { 19 | Color = ((y / 32) % 2 == 0) ? &Red : &Green; 20 | for (x = 0; x < Width; x++) { 21 | if (x % 32 == 0 && x != 0) 22 | Color = (Color == &Red) ? &Green : &Red; 23 | PixelBuffer[y * Width + x] = *(UINT32 *)Color; 24 | } 25 | } 26 | } 27 | 28 | static void 29 | draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) 30 | { 31 | int i, imax; 32 | EFI_STATUS rc; 33 | EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info; 34 | UINTN NumPixels; 35 | UINT32 *PixelBuffer; 36 | UINT32 BufferSize; 37 | 38 | if (gop->Mode) { 39 | imax = gop->Mode->MaxMode; 40 | } else { 41 | Print(L"gop->Mode is NULL\n"); 42 | return; 43 | } 44 | 45 | for (i = 0; i < imax; i++) { 46 | UINTN SizeOfInfo; 47 | rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo, 48 | &info); 49 | if (EFI_ERROR(rc) && rc == EFI_NOT_STARTED) { 50 | Print(L"gop->QueryMode() returned %r\n", rc); 51 | Print(L"Trying to start GOP with SetMode().\n"); 52 | rc = uefi_call_wrapper(gop->SetMode, 2, gop, 53 | gop->Mode ? gop->Mode->Mode : 0); 54 | rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, 55 | &SizeOfInfo, &info); 56 | } 57 | 58 | if (EFI_ERROR(rc)) { 59 | Print(L"%d: Bad response from QueryMode: %r (%d)\n", 60 | i, rc, rc); 61 | continue; 62 | } 63 | 64 | if (CompareMem(info, gop->Mode->Info, sizeof (*info))) 65 | continue; 66 | 67 | NumPixels = info->VerticalResolution * info->HorizontalResolution; 68 | BufferSize = NumPixels * sizeof(UINT32); 69 | 70 | PixelBuffer = AllocatePool(BufferSize); 71 | if (!PixelBuffer) { 72 | Print(L"Allocation of 0x%08lx bytes failed.\n", 73 | sizeof(UINT32) * NumPixels); 74 | return; 75 | } 76 | 77 | fill_boxes(PixelBuffer, 78 | info->HorizontalResolution, info->VerticalResolution); 79 | 80 | uefi_call_wrapper(gop->Blt, 10, gop, 81 | (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)PixelBuffer, 82 | EfiBltBufferToVideo, 83 | 0, 0, 0, 0, 84 | info->HorizontalResolution, 85 | info->VerticalResolution, 86 | 0); 87 | return; 88 | } 89 | Print(L"Never found the active video mode?\n"); 90 | } 91 | 92 | static EFI_STATUS 93 | SetWatchdog(UINTN seconds) 94 | { 95 | EFI_STATUS rc; 96 | rc = uefi_call_wrapper(BS->SetWatchdogTimer, 4, seconds, 0x1ffff, 97 | 0, NULL); 98 | if (EFI_ERROR(rc)) { 99 | CHAR16 Buffer[64]; 100 | StatusToString(Buffer, rc); 101 | Print(L"Bad response from QueryMode: %s (%d)\n", Buffer, rc); 102 | } 103 | return rc; 104 | } 105 | 106 | EFI_STATUS 107 | efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) 108 | { 109 | EFI_STATUS rc; 110 | EFI_GRAPHICS_OUTPUT_PROTOCOL *gop; 111 | 112 | InitializeLib(image_handle, systab); 113 | 114 | SetWatchdog(10); 115 | 116 | rc = LibLocateProtocol(&GraphicsOutputProtocol, (void **)&gop); 117 | if (EFI_ERROR(rc)) { 118 | Print(L"Could not locate GOP: %r\n", rc); 119 | return rc; 120 | } 121 | 122 | if (!gop) { 123 | Print(L"LocateProtocol(GOP, &gop) returned %r but GOP is NULL\n", rc); 124 | return EFI_UNSUPPORTED; 125 | } 126 | 127 | draw_boxes(gop); 128 | 129 | SetWatchdog(0); 130 | return EFI_SUCCESS; 131 | } 132 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/libsmbios.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIB_SMBIOS_H 2 | #define _LIB_SMBIOS_H 3 | /*++ 4 | 5 | Copyright (c) 2000 Intel Corporation 6 | 7 | Module Name: 8 | 9 | LibSmbios.h 10 | 11 | Abstract: 12 | 13 | Lib include for SMBIOS services. Used to get system serial number and GUID 14 | 15 | Revision History 16 | 17 | --*/ 18 | 19 | // 20 | // Define SMBIOS tables. 21 | // 22 | #pragma pack(1) 23 | typedef struct { 24 | UINT8 AnchorString[4]; 25 | UINT8 EntryPointStructureChecksum; 26 | UINT8 EntryPointLength; 27 | UINT8 MajorVersion; 28 | UINT8 MinorVersion; 29 | UINT16 MaxStructureSize; 30 | UINT8 EntryPointRevision; 31 | UINT8 FormattedArea[5]; 32 | UINT8 IntermediateAnchorString[5]; 33 | UINT8 IntermediateChecksum; 34 | UINT16 TableLength; 35 | UINT32 TableAddress; 36 | UINT16 NumberOfSmbiosStructures; 37 | UINT8 SmbiosBcdRevision; 38 | } SMBIOS_STRUCTURE_TABLE; 39 | 40 | // 41 | // Please note that SMBIOS structures can be odd byte aligned since the 42 | // unformated section of each record is a set of arbitrary size strings. 43 | // 44 | 45 | typedef struct { 46 | UINT8 Type; 47 | UINT8 Length; 48 | UINT8 Handle[2]; 49 | } SMBIOS_HEADER; 50 | 51 | typedef UINT8 SMBIOS_STRING; 52 | 53 | typedef struct { 54 | SMBIOS_HEADER Hdr; 55 | SMBIOS_STRING Vendor; 56 | SMBIOS_STRING BiosVersion; 57 | UINT8 BiosSegment[2]; 58 | SMBIOS_STRING BiosReleaseDate; 59 | UINT8 BiosSize; 60 | UINT8 BiosCharacteristics[8]; 61 | } SMBIOS_TYPE0; 62 | 63 | typedef struct { 64 | SMBIOS_HEADER Hdr; 65 | SMBIOS_STRING Manufacturer; 66 | SMBIOS_STRING ProductName; 67 | SMBIOS_STRING Version; 68 | SMBIOS_STRING SerialNumber; 69 | 70 | // 71 | // always byte copy this data to prevent alignment faults! 72 | // 73 | EFI_GUID Uuid; 74 | 75 | UINT8 WakeUpType; 76 | } SMBIOS_TYPE1; 77 | 78 | typedef struct { 79 | SMBIOS_HEADER Hdr; 80 | SMBIOS_STRING Manufacturer; 81 | SMBIOS_STRING ProductName; 82 | SMBIOS_STRING Version; 83 | SMBIOS_STRING SerialNumber; 84 | } SMBIOS_TYPE2; 85 | 86 | typedef struct { 87 | SMBIOS_HEADER Hdr; 88 | SMBIOS_STRING Manufacturer; 89 | UINT8 Type; 90 | SMBIOS_STRING Version; 91 | SMBIOS_STRING SerialNumber; 92 | SMBIOS_STRING AssetTag; 93 | UINT8 BootupState; 94 | UINT8 PowerSupplyState; 95 | UINT8 ThermalState; 96 | UINT8 SecurityStatus; 97 | UINT8 OemDefined[4]; 98 | } SMBIOS_TYPE3; 99 | 100 | typedef struct { 101 | SMBIOS_HEADER Hdr; 102 | UINT8 Socket; 103 | UINT8 ProcessorType; 104 | UINT8 ProcessorFamily; 105 | SMBIOS_STRING ProcessorManufacture; 106 | UINT8 ProcessorId[8]; 107 | SMBIOS_STRING ProcessorVersion; 108 | UINT8 Voltage; 109 | UINT8 ExternalClock[2]; 110 | UINT8 MaxSpeed[2]; 111 | UINT8 CurrentSpeed[2]; 112 | UINT8 Status; 113 | UINT8 ProcessorUpgrade; 114 | UINT8 L1CacheHandle[2]; 115 | UINT8 L2CacheHandle[2]; 116 | UINT8 L3CacheHandle[2]; 117 | } SMBIOS_TYPE4; 118 | 119 | typedef union { 120 | SMBIOS_HEADER *Hdr; 121 | SMBIOS_TYPE0 *Type0; 122 | SMBIOS_TYPE1 *Type1; 123 | SMBIOS_TYPE2 *Type2; 124 | SMBIOS_TYPE3 *Type3; 125 | SMBIOS_TYPE4 *Type4; 126 | UINT8 *Raw; 127 | } SMBIOS_STRUCTURE_POINTER; 128 | #pragma pack() 129 | 130 | 131 | #endif 132 | 133 | -------------------------------------------------------------------------------- /ASPMEnabler/ASPMEnabler.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27004.2006 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASPMEnabler", ".vs\msvc\ASPMEnabler.vcxproj", "{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {3135D563-9596-4584-9ED6-616ADEC52974} = {3135D563-9596-4584-9ED6-616ADEC52974} 9 | EndProjectSection 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gnu-efi", ".vs\msvc\gnu-efi.vcxproj", "{3135D563-9596-4584-9ED6-616ADEC52974}" 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|arm = Debug|arm 16 | Debug|aa64 = Debug|aa64 17 | Debug|ia32 = Debug|ia32 18 | Debug|x64 = Debug|x64 19 | Release|arm = Release|arm 20 | Release|aa64 = Release|aa64 21 | Release|ia32 = Release|ia32 22 | Release|x64 = Release|x64 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|arm.ActiveCfg = Debug|ARM 26 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|arm.Build.0 = Debug|ARM 27 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|aa64.ActiveCfg = Debug|ARM64 28 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|aa64.Build.0 = Debug|ARM64 29 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|ia32.ActiveCfg = Debug|Win32 30 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|ia32.Build.0 = Debug|Win32 31 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|x64.ActiveCfg = Debug|x64 32 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|x64.Build.0 = Debug|x64 33 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|arm.ActiveCfg = Release|ARM 34 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|arm.Build.0 = Release|ARM 35 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|aa64.ActiveCfg = Release|ARM64 36 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|aa64.Build.0 = Release|ARM64 37 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|ia32.ActiveCfg = Release|Win32 38 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|ia32.Build.0 = Release|Win32 39 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|x64.ActiveCfg = Release|x64 40 | {DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|x64.Build.0 = Release|x64 41 | {3135D563-9596-4584-9ED6-616ADEC52974}.Debug|arm.ActiveCfg = Debug|ARM 42 | {3135D563-9596-4584-9ED6-616ADEC52974}.Debug|arm.Build.0 = Debug|ARM 43 | {3135D563-9596-4584-9ED6-616ADEC52974}.Debug|aa64.ActiveCfg = Debug|ARM64 44 | {3135D563-9596-4584-9ED6-616ADEC52974}.Debug|aa64.Build.0 = Debug|ARM64 45 | {3135D563-9596-4584-9ED6-616ADEC52974}.Debug|ia32.ActiveCfg = Debug|Win32 46 | {3135D563-9596-4584-9ED6-616ADEC52974}.Debug|ia32.Build.0 = Debug|Win32 47 | {3135D563-9596-4584-9ED6-616ADEC52974}.Debug|x64.ActiveCfg = Debug|x64 48 | {3135D563-9596-4584-9ED6-616ADEC52974}.Debug|x64.Build.0 = Debug|x64 49 | {3135D563-9596-4584-9ED6-616ADEC52974}.Release|arm.ActiveCfg = Release|ARM 50 | {3135D563-9596-4584-9ED6-616ADEC52974}.Release|arm.Build.0 = Release|ARM 51 | {3135D563-9596-4584-9ED6-616ADEC52974}.Release|aa64.ActiveCfg = Release|ARM64 52 | {3135D563-9596-4584-9ED6-616ADEC52974}.Release|aa64.Build.0 = Release|ARM64 53 | {3135D563-9596-4584-9ED6-616ADEC52974}.Release|ia32.ActiveCfg = Release|Win32 54 | {3135D563-9596-4584-9ED6-616ADEC52974}.Release|ia32.Build.0 = Release|Win32 55 | {3135D563-9596-4584-9ED6-616ADEC52974}.Release|x64.ActiveCfg = Release|x64 56 | {3135D563-9596-4584-9ED6-616ADEC52974}.Release|x64.Build.0 = Release|x64 57 | EndGlobalSection 58 | GlobalSection(SolutionProperties) = preSolution 59 | HideSolutionNode = FALSE 60 | EndGlobalSection 61 | GlobalSection(ExtensibilityGlobals) = postSolution 62 | SolutionGuid = {376E6530-5878-4CF4-AFB7-123F799056A2} 63 | EndGlobalSection 64 | EndGlobal 65 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/gnuefi/reloc_mips64el.c: -------------------------------------------------------------------------------- 1 | /* reloc_mips64el.c - position independent MIPS64 ELF shared object relocator 2 | Copyright (C) 2014 Linaro Ltd. 3 | Copyright (C) 1999 Hewlett-Packard Co. 4 | Contributed by David Mosberger . 5 | Copyright (C) 2017 Lemote Co. 6 | Contributed by Heiher 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 14 | * Redistributions of source code must retain the above copyright 15 | notice, this list of conditions and the following disclaimer. 16 | * Redistributions in binary form must reproduce the above 17 | copyright notice, this list of conditions and the following 18 | disclaimer in the documentation and/or other materials 19 | provided with the distribution. 20 | * Neither the name of Hewlett-Packard Co. nor the names of its 21 | contributors may be used to endorse or promote products derived 22 | from this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 25 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 26 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 27 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 29 | BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 30 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 31 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 32 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 34 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 35 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 | SUCH DAMAGE. 37 | */ 38 | 39 | #include 40 | #include 41 | 42 | #include 43 | 44 | EFI_STATUS _relocate (long ldbase, Elf64_Dyn *dyn, 45 | EFI_HANDLE image EFI_UNUSED, 46 | EFI_SYSTEM_TABLE *systab EFI_UNUSED) 47 | { 48 | long relsz = 0, relent = 0, gotsz = 0; 49 | Elf64_Rel *rel = 0; 50 | unsigned long *addr = 0; 51 | int i; 52 | 53 | for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { 54 | switch (dyn[i].d_tag) { 55 | case DT_REL: 56 | rel = (Elf64_Rel*) 57 | ((unsigned long)dyn[i].d_un.d_ptr 58 | + ldbase); 59 | break; 60 | 61 | case DT_RELSZ: 62 | relsz = dyn[i].d_un.d_val; 63 | break; 64 | 65 | case DT_RELENT: 66 | relent = dyn[i].d_un.d_val; 67 | break; 68 | 69 | case DT_PLTGOT: 70 | addr = (unsigned long *) 71 | ((unsigned long)dyn[i].d_un.d_ptr 72 | + ldbase); 73 | break; 74 | 75 | case DT_MIPS_LOCAL_GOTNO: 76 | gotsz = dyn[i].d_un.d_val; 77 | break; 78 | 79 | default: 80 | break; 81 | } 82 | } 83 | 84 | if ((!rel && relent == 0) && (!addr && gotsz == 0)) 85 | return EFI_SUCCESS; 86 | 87 | if ((!rel && relent != 0) || (!addr && gotsz != 0)) 88 | return EFI_LOAD_ERROR; 89 | 90 | while (gotsz > 0) { 91 | *addr += ldbase; 92 | addr += 1; 93 | gotsz --; 94 | } 95 | 96 | while (relsz > 0) { 97 | /* apply the relocs */ 98 | switch (ELF64_R_TYPE (swap_uint64 (rel->r_info))) { 99 | case R_MIPS_NONE: 100 | break; 101 | 102 | case (R_MIPS_64 << 8) | R_MIPS_REL32: 103 | addr = (unsigned long *) 104 | (ldbase + rel->r_offset); 105 | *addr += ldbase; 106 | break; 107 | 108 | default: 109 | break; 110 | } 111 | rel = (Elf64_Rel*) ((char *) rel + relent); 112 | relsz -= relent; 113 | } 114 | return EFI_SUCCESS; 115 | } 116 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/inc/efipoint.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014 by John Cronin 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | * THE SOFTWARE. 20 | */ 21 | 22 | #ifndef _EFI_POINT_H 23 | #define _EFI_POINT_H 24 | 25 | #define EFI_SIMPLE_POINTER_PROTOCOL_GUID \ 26 | { 0x31878c87, 0xb75, 0x11d5, { 0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } 27 | 28 | INTERFACE_DECL(_EFI_SIMPLE_POINTER); 29 | 30 | typedef struct { 31 | INT32 RelativeMovementX; 32 | INT32 RelativeMovementY; 33 | INT32 RelativeMovementZ; 34 | BOOLEAN LeftButton; 35 | BOOLEAN RightButton; 36 | } EFI_SIMPLE_POINTER_STATE; 37 | 38 | typedef struct { 39 | UINT64 ResolutionX; 40 | UINT64 ResolutionY; 41 | UINT64 ResolutionZ; 42 | BOOLEAN LeftButton; 43 | BOOLEAN RightButton; 44 | } EFI_SIMPLE_POINTER_MODE; 45 | 46 | typedef 47 | EFI_STATUS 48 | (EFIAPI *EFI_SIMPLE_POINTER_RESET) ( 49 | IN struct _EFI_SIMPLE_POINTER *This, 50 | IN BOOLEAN ExtendedVerification 51 | ); 52 | 53 | typedef 54 | EFI_STATUS 55 | (EFIAPI *EFI_SIMPLE_POINTER_GET_STATE) ( 56 | IN struct _EFI_SIMPLE_POINTER *This, 57 | IN OUT EFI_SIMPLE_POINTER_STATE *State 58 | ); 59 | 60 | typedef struct _EFI_SIMPLE_POINTER { 61 | EFI_SIMPLE_POINTER_RESET Reset; 62 | EFI_SIMPLE_POINTER_GET_STATE GetState; 63 | EFI_EVENT WaitForInput; 64 | EFI_SIMPLE_POINTER_MODE *Mode; 65 | } EFI_SIMPLE_POINTER_PROTOCOL; 66 | 67 | #define EFI_ABSOLUTE_POINTER_PROTOCOL_GUID \ 68 | { 0x8D59D32B, 0xC655, 0x4AE9, { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 } } 69 | 70 | INTERFACE_DECL(_EFI_ABSOLUTE_POINTER_PROTOCOL); 71 | 72 | typedef struct { 73 | UINT64 AbsoluteMinX; 74 | UINT64 AbsoluteMinY; 75 | UINT64 AbsoluteMinZ; 76 | UINT64 AbsoluteMaxX; 77 | UINT64 AbsoluteMaxY; 78 | UINT64 AbsoluteMaxZ; 79 | UINT32 Attributes; 80 | } EFI_ABSOLUTE_POINTER_MODE; 81 | 82 | typedef struct { 83 | UINT64 CurrentX; 84 | UINT64 CurrentY; 85 | UINT64 CurrentZ; 86 | UINT32 ActiveButtons; 87 | } EFI_ABSOLUTE_POINTER_STATE; 88 | 89 | #define EFI_ABSP_SupportsAltActive 0x00000001 90 | #define EFI_ABSP_SupportsPressureAsZ 0x00000002 91 | #define EFI_ABSP_TouchActive 0x00000001 92 | #define EFI_ABS_AltActive 0x00000002 93 | 94 | typedef 95 | EFI_STATUS 96 | (EFIAPI *EFI_ABSOLUTE_POINTER_RESET) ( 97 | IN struct _EFI_ABSOLUTE_POINTER_PROTOCOL *This, 98 | IN BOOLEAN ExtendedVerification 99 | ); 100 | 101 | typedef 102 | EFI_STATUS 103 | (EFIAPI *EFI_ABSOLUTE_POINTER_GET_STATE) ( 104 | IN struct _EFI_ABSOLUTE_POINTER_PROTOCOL *This, 105 | IN OUT EFI_ABSOLUTE_POINTER_STATE *State 106 | ); 107 | 108 | typedef struct _EFI_ABSOLUTE_POINTER_PROTOCOL { 109 | EFI_ABSOLUTE_POINTER_RESET Reset; 110 | EFI_ABSOLUTE_POINTER_GET_STATE GetState; 111 | EFI_EVENT WaitForInput; 112 | EFI_ABSOLUTE_POINTER_MODE *Mode; 113 | } EFI_ABSOLUTE_POINTER_PROTOCOL; 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/apps/route80h.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* this example program changes the Reserved Page Route (RPR) bit on ICH10's General 5 | * Control And Status Register (GCS) from LPC to PCI. In practical terms, it routes 6 | * outb to port 80h to the PCI bus. */ 7 | 8 | #define GCS_OFFSET_ADDR 0x3410 9 | #define GCS_RPR_SHIFT 2 10 | #define GCS_RPR_PCI 1 11 | #define GCS_RPR_LPC 0 12 | 13 | #define VENDOR_ID_INTEL 0x8086 14 | #define DEVICE_ID_LPCIF 0x3a16 15 | #define DEVICE_ID_COUGARPOINT_LPCIF 0x1c56 16 | 17 | static EFI_HANDLE ImageHandle; 18 | 19 | typedef struct { 20 | uint16_t vendor_id; /* 00-01 */ 21 | uint16_t device_id; /* 02-03 */ 22 | char pad[0xEB]; /* 04-EF */ 23 | uint32_t rcba; /* F0-F3 */ 24 | uint32_t reserved[3]; /* F4-FF */ 25 | } lpcif_t; 26 | 27 | static inline void set_bit(volatile uint32_t *flag, int bit, int value) 28 | { 29 | uint32_t val = *flag; 30 | Print(L"current value is 0x%2x\n", val); 31 | 32 | if (value) { 33 | val |= (1 << bit); 34 | } else { 35 | val &= ~(1 << bit); 36 | } 37 | Print(L"setting value to 0x%2x\n", val); 38 | *flag = val; 39 | val = *flag; 40 | Print(L"new value is 0x%2x\n", val); 41 | } 42 | 43 | static int is_device(EFI_PCI_IO *pciio, uint16_t vendor_id, uint16_t device_id) 44 | { 45 | lpcif_t lpcif; 46 | EFI_STATUS rc; 47 | 48 | rc = uefi_call_wrapper(pciio->Pci.Read, 5, pciio, EfiPciIoWidthUint16, 0, 2, &lpcif); 49 | if (EFI_ERROR(rc)) 50 | return 0; 51 | 52 | if (vendor_id == lpcif.vendor_id && device_id == lpcif.device_id) 53 | return 1; 54 | return 0; 55 | } 56 | 57 | static EFI_STATUS find_pci_device(uint16_t vendor_id, uint16_t device_id, 58 | EFI_PCI_IO **pciio) 59 | { 60 | EFI_STATUS rc; 61 | EFI_HANDLE *Handles; 62 | UINTN NoHandles, i; 63 | 64 | if (!pciio) 65 | return EFI_INVALID_PARAMETER; 66 | 67 | rc = LibLocateHandle(ByProtocol, &PciIoProtocol, NULL, &NoHandles, 68 | &Handles); 69 | if (EFI_ERROR(rc)) 70 | return rc; 71 | 72 | for (i = 0; i < NoHandles; i++) { 73 | void *pciio_tmp = NULL; 74 | rc = uefi_call_wrapper(BS->OpenProtocol, 6, Handles[i], 75 | &PciIoProtocol, &pciio_tmp, ImageHandle, 76 | NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); 77 | if (EFI_ERROR(rc)) 78 | continue; 79 | *pciio = pciio_tmp; 80 | if (!is_device(*pciio, vendor_id, device_id)) { 81 | *pciio = NULL; 82 | continue; 83 | } 84 | 85 | return EFI_SUCCESS; 86 | } 87 | return EFI_NOT_FOUND; 88 | } 89 | 90 | EFI_STATUS 91 | efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) 92 | { 93 | InitializeLib(image_handle, systab); 94 | EFI_PCI_IO *pciio = NULL; 95 | lpcif_t lpcif; 96 | EFI_STATUS rc = EFI_SUCCESS; 97 | struct { 98 | uint16_t vendor; 99 | uint16_t device; 100 | } devices[] = { 101 | { VENDOR_ID_INTEL, DEVICE_ID_LPCIF }, 102 | { VENDOR_ID_INTEL, DEVICE_ID_COUGARPOINT_LPCIF }, 103 | { 0, 0 } 104 | }; 105 | int i; 106 | 107 | ImageHandle = image_handle; 108 | for (i = 0; devices[i].vendor != 0; i++) { 109 | rc = find_pci_device(devices[i].vendor, devices[i].device, &pciio); 110 | if (EFI_ERROR(rc)) 111 | continue; 112 | } 113 | 114 | if (rc == EFI_NOT_FOUND) { 115 | Print(L"Device not found.\n"); 116 | return rc; 117 | } else if (EFI_ERROR(rc)) { 118 | return rc; 119 | } 120 | 121 | rc = uefi_call_wrapper(pciio->Pci.Read, 5, pciio, EfiPciIoWidthUint32, 122 | EFI_FIELD_OFFSET(lpcif_t, rcba), 1, &lpcif.rcba); 123 | if (EFI_ERROR(rc)) 124 | return rc; 125 | if (!(lpcif.rcba & 1)) { 126 | Print(L"rcrb is not mapped, cannot route port 80h\n"); 127 | return EFI_UNSUPPORTED; 128 | } 129 | lpcif.rcba &= ~1UL; 130 | 131 | Print(L"rcba: 0x%8x\n", lpcif.rcba, lpcif.rcba); 132 | set_bit((uint32_t *)(intptr_t)(lpcif.rcba + GCS_OFFSET_ADDR), 133 | GCS_RPR_SHIFT, GCS_RPR_PCI); 134 | 135 | return EFI_SUCCESS; 136 | } 137 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/hw.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | hw.c 8 | 9 | Abstract: 10 | 11 | Debug library functions for Hardware IO access 12 | 13 | 14 | 15 | Revision History 16 | 17 | --*/ 18 | 19 | #include "lib.h" 20 | 21 | 22 | EFI_STATUS 23 | InitializeGlobalIoDevice ( 24 | IN EFI_DEVICE_PATH *DevicePath, 25 | IN EFI_GUID *Protocol, 26 | IN CHAR8 *ErrorStr EFI_UNUSED, 27 | OUT EFI_DEVICE_IO_INTERFACE **GlobalIoFncs 28 | ) 29 | /*++ 30 | 31 | Routine Description: 32 | 33 | Check to see if DevicePath exists for a given Protocol. Return Error if it 34 | exists. Return GlobalIoFuncs set match the DevicePath 35 | 36 | Arguments: 37 | 38 | DevicePath - to operate on 39 | Protocol - to check the DevicePath against 40 | ErrorStr - ASCII string to display on error 41 | GlobalIoFncs - Returned with DeviceIoProtocol for the DevicePath 42 | 43 | Returns: 44 | 45 | Pass or Fail based on wether GlobalIoFncs where found 46 | 47 | --*/ 48 | { 49 | EFI_STATUS Status; 50 | EFI_HANDLE Handle; 51 | 52 | // 53 | // Check to see if this device path already has Protocol on it. 54 | // if so we are loading recursivly and should exit with an error 55 | // 56 | Status = uefi_call_wrapper(BS->LocateDevicePath, 3, Protocol, &DevicePath, &Handle); 57 | if (!EFI_ERROR(Status)) { 58 | DEBUG ((D_INIT, "Device Already Loaded for %a device\n", ErrorStr)); 59 | return EFI_LOAD_ERROR; 60 | } 61 | 62 | Status = uefi_call_wrapper(BS->LocateDevicePath, 3, &DeviceIoProtocol, &DevicePath, &Handle); 63 | if (!EFI_ERROR(Status)) { 64 | Status = uefi_call_wrapper(BS->HandleProtocol, 3, Handle, &DeviceIoProtocol, (VOID*)GlobalIoFncs); 65 | } 66 | 67 | ASSERT (!EFI_ERROR(Status)); 68 | return Status; 69 | } 70 | 71 | UINT32 72 | ReadPort ( 73 | IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 74 | IN EFI_IO_WIDTH Width, 75 | IN UINTN Port 76 | ) 77 | { 78 | UINT32 Data; 79 | EFI_STATUS Status EFI_UNUSED; 80 | 81 | Status = uefi_call_wrapper(GlobalIoFncs->Io.Read, 5, GlobalIoFncs, Width, (UINT64)Port, 1, &Data); 82 | ASSERT(!EFI_ERROR(Status)); 83 | return Data; 84 | } 85 | 86 | UINT32 87 | WritePort ( 88 | IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 89 | IN EFI_IO_WIDTH Width, 90 | IN UINTN Port, 91 | IN UINTN Data 92 | ) 93 | { 94 | EFI_STATUS Status EFI_UNUSED; 95 | 96 | Status = uefi_call_wrapper(GlobalIoFncs->Io.Write, 5, GlobalIoFncs, Width, (UINT64)Port, 1, &Data); 97 | ASSERT(!EFI_ERROR(Status)); 98 | return (UINT32)Data; 99 | } 100 | 101 | UINT32 102 | ReadPciConfig ( 103 | IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 104 | IN EFI_IO_WIDTH Width, 105 | IN UINTN Address 106 | ) 107 | { 108 | UINT32 Data; 109 | EFI_STATUS Status EFI_UNUSED; 110 | 111 | Status = uefi_call_wrapper(GlobalIoFncs->Pci.Read, 5, GlobalIoFncs, Width, (UINT64)Address, 1, &Data); 112 | ASSERT(!EFI_ERROR(Status)); 113 | return Data; 114 | } 115 | 116 | UINT32 117 | WritePciConfig ( 118 | IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs, 119 | IN EFI_IO_WIDTH Width, 120 | IN UINTN Address, 121 | IN UINTN Data 122 | ) 123 | { 124 | EFI_STATUS Status EFI_UNUSED; 125 | 126 | Status = uefi_call_wrapper(GlobalIoFncs->Pci.Write, 5, GlobalIoFncs, Width, (UINT64)Address, 1, &Data); 127 | ASSERT(!EFI_ERROR(Status)); 128 | return (UINT32)Data; 129 | } 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /ASPMEnabler/gnu-efi/lib/event.c: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1998 Intel Corporation 4 | 5 | Module Name: 6 | 7 | event.c 8 | 9 | Abstract: 10 | 11 | 12 | 13 | 14 | Revision History 15 | 16 | --*/ 17 | 18 | #include "lib.h" 19 | 20 | 21 | EFI_EVENT 22 | LibCreateProtocolNotifyEvent ( 23 | IN EFI_GUID *ProtocolGuid, 24 | IN EFI_TPL NotifyTpl, 25 | IN EFI_EVENT_NOTIFY NotifyFunction, 26 | IN VOID *NotifyContext, 27 | OUT VOID *Registration 28 | ) 29 | { 30 | EFI_STATUS Status; 31 | EFI_EVENT Event; 32 | 33 | // 34 | // Create the event 35 | // 36 | 37 | Status = uefi_call_wrapper( 38 | BS->CreateEvent, 39 | 5, 40 | EVT_NOTIFY_SIGNAL, 41 | NotifyTpl, 42 | NotifyFunction, 43 | NotifyContext, 44 | &Event 45 | ); 46 | if ( EFI_ERROR( Status ) ) return NULL ; 47 | ASSERT (!EFI_ERROR(Status)); 48 | 49 | // 50 | // Register for protocol notifactions on this event 51 | // 52 | 53 | Status = uefi_call_wrapper( 54 | BS->RegisterProtocolNotify, 55 | 3, 56 | ProtocolGuid, 57 | Event, 58 | Registration 59 | ); 60 | if ( EFI_ERROR( Status ) ) return NULL ; 61 | ASSERT (!EFI_ERROR(Status)); 62 | 63 | // 64 | // Kick the event so we will perform an initial pass of 65 | // current installed drivers 66 | // 67 | 68 | uefi_call_wrapper(BS->SignalEvent, 1, Event); 69 | return Event; 70 | } 71 | 72 | 73 | EFI_STATUS 74 | WaitForSingleEvent ( 75 | IN EFI_EVENT Event, 76 | IN UINT64 Timeout OPTIONAL 77 | ) 78 | { 79 | EFI_STATUS Status; 80 | UINTN Index; 81 | EFI_EVENT TimerEvent; 82 | EFI_EVENT WaitList[2]; 83 | 84 | if (Timeout) { 85 | // 86 | // Create a timer event 87 | // 88 | 89 | Status = uefi_call_wrapper(BS->CreateEvent, 5, EVT_TIMER, 0, NULL, NULL, &TimerEvent); 90 | if (!EFI_ERROR(Status)) { 91 | 92 | // 93 | // Set the timer event 94 | // 95 | 96 | uefi_call_wrapper(BS->SetTimer, 3, TimerEvent, TimerRelative, Timeout); 97 | 98 | // 99 | // Wait for the original event or the timer 100 | // 101 | 102 | WaitList[0] = Event; 103 | WaitList[1] = TimerEvent; 104 | Status = uefi_call_wrapper(BS->WaitForEvent, 3, 2, WaitList, &Index); 105 | uefi_call_wrapper(BS->CloseEvent, 1, TimerEvent); 106 | 107 | // 108 | // If the timer expired, change the return to timed out 109 | // 110 | 111 | if (!EFI_ERROR(Status) && Index == 1) { 112 | Status = EFI_TIMEOUT; 113 | } 114 | } 115 | 116 | } else { 117 | 118 | // 119 | // No timeout... just wait on the event 120 | // 121 | 122 | Status = uefi_call_wrapper(BS->WaitForEvent, 3, 1, &Event, &Index); 123 | ASSERT (!EFI_ERROR(Status)); 124 | ASSERT (Index == 0); 125 | } 126 | 127 | return Status; 128 | } 129 | 130 | VOID 131 | WaitForEventWithTimeout ( 132 | IN EFI_EVENT Event, 133 | IN UINTN Timeout, 134 | IN UINTN Row, 135 | IN UINTN Column, 136 | IN CHAR16 *String, 137 | IN EFI_INPUT_KEY TimeoutKey, 138 | OUT EFI_INPUT_KEY *Key 139 | ) 140 | { 141 | EFI_STATUS Status; 142 | 143 | do { 144 | PrintAt (Column, Row, String, Timeout); 145 | Status = WaitForSingleEvent (Event, 10000000); 146 | if (Status == EFI_SUCCESS) { 147 | if (!EFI_ERROR(uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, Key))) { 148 | return; 149 | } 150 | } 151 | } while (Timeout > 0); 152 | CopyMem(Key, &TimeoutKey, sizeof(EFI_INPUT_KEY)); 153 | } 154 | 155 | --------------------------------------------------------------------------------