mirror of
https://github.com/rhboot/gnu-efi
synced 2026-08-26 00:26:04 -04:00
Initial commit gnu-efi_3.0r
This commit is contained in:
commit
46bd1f50de
129 changed files with 23112 additions and 0 deletions
279
gnu-efi-3.0/ChangeLog
Normal file
279
gnu-efi-3.0/ChangeLog
Normal file
|
|
@ -0,0 +1,279 @@
|
|||
2012-09-21 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* Change from Peter Jones <pjones@redhat.com>
|
||||
- EFI Block I/O protocol versions 2 and 3 provide more information
|
||||
regarding physical disk layout, including alingment offset at the
|
||||
beginning of the disk ("LowestAlignedLba"), logical block size
|
||||
("LogicalBlocksPerPhysicalBlock"), and optimal block transfer size
|
||||
("OptimalTransferLengthGranularity").
|
||||
* Release 3.0r
|
||||
|
||||
2012-04-30 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* Change from Matt Fleming <matt.fleming@intel.com>
|
||||
- The .reloc section is now 4096-byte boundary for x86_64.
|
||||
Without this patch the .reloc section will not adhere to
|
||||
the alignment value in the FileAlignment field (512 bytes by
|
||||
default) of the PE/COFF header. This results in a signed
|
||||
executable failing to boot in a secure boot environment.
|
||||
* Release 3.0q
|
||||
|
||||
2011-12-12 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* Changes from Fenghua Yu <fenghua.yu@intel.com>
|
||||
- This fixes redefined types compilation failure for tcc.c on x86_64 machines.
|
||||
* Release 3.0p
|
||||
|
||||
2011-11-15 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* Changes from Darren Hart <dvhart@linux.intel.com>
|
||||
- Conditionally assign toolchain binaries to allow overriding them.
|
||||
- Force a dependency on lib for gnuefi.
|
||||
* Release 3.0n
|
||||
|
||||
2011-08-23 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* Changes from Peter Jones <pjones@redhat.com>
|
||||
- Add guarantee 16-byte stack alignment on x86_64.
|
||||
- Add routine to make callbacks work.
|
||||
- Add apps/tcc.efi to test calling convention.
|
||||
* Release 3.0m
|
||||
|
||||
2011-07-22 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* Changed Makefiles from GPL to BSD.
|
||||
* Changes from Peter Jones <pjones@redhat.com>
|
||||
- Add ifdefs for ia64 to mirror ia32 and x86-64 so that
|
||||
one can build with GCC.
|
||||
- Add headers for PciIo.
|
||||
- Add the UEFI 2.x bits for EFI_BOOT_SERVICES
|
||||
- Add an ignore for .note.GNU-stack section in X86-64 linker maps.
|
||||
* Release 3.0l
|
||||
|
||||
2011-04-07 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* Change license from GPL to BSD.
|
||||
* Release 3.0j
|
||||
|
||||
2009-09-12 Julien BLACHE <jb@jblache.org>
|
||||
* Add support for FreeBSD.
|
||||
* Release 3.0i
|
||||
|
||||
2009-09-11 Julien BLACHE <jb@jblache.org>
|
||||
* Fix elf_ia32_efi.lds linker script to be compatible with the new
|
||||
linker behaviour. Patch from the RedHat bugzilla 492183.
|
||||
|
||||
2009-06-18 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* Release 3.0h
|
||||
|
||||
2008-11-06 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* Fix to not having any relocations at all.
|
||||
|
||||
2008-09-18 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* Use LIBDIR in makefiles
|
||||
* Add setjmp/longjmp
|
||||
* Fixes incorrect section attribute in crt0-efi-ia32.S
|
||||
* Adds value EfiResetShutdown to enum EFI_RESET_TYPE
|
||||
* Fixes a RAW warning in reloc_ia64.S
|
||||
* Adds the USB HCI device path structure in the headers
|
||||
patches were supplied by Peter Jones @ RedHat
|
||||
|
||||
2008-02-22 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* Added '-mno-red-zone' to x68_64 compiles.
|
||||
Patch provided by Mats Andersson.
|
||||
|
||||
2008-01-23 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* release 3.0e to support x86_64
|
||||
EFI calling convention, the stack should be aligned in 16 bytes
|
||||
to make it possible to use SSE2 in EFI boot services.
|
||||
This patch fixes this issue. Patch provided by Huang Ying from Intel.
|
||||
|
||||
2007-05-11 Nigel Croxon <nigel.croxon@hp.com>
|
||||
* release 3.0d to support x86_64 from Chandramouli Narayanan
|
||||
from Intel and based on 3.0c-1
|
||||
|
||||
2006-03-21 Stephane Eranian <eranian@hpl.hp.com>
|
||||
* merged patch to support gcc-4.1 submitted by
|
||||
Raymund Will from Novell/SuSE
|
||||
|
||||
2006-03-20 Stephane Eranian <eranian@hpl.hp.com>
|
||||
* updated ia-64 and ia-32 linker scripts to
|
||||
match latest gcc. The new gcc may put functions in
|
||||
.text* sections. patch submitted by H.J. Lu from Intel.
|
||||
|
||||
2004-11-19 Stephane Eranian <eranian@hpl.hp.com>
|
||||
* added patch to ignore .eh_frame section for IA-32. Patch
|
||||
submitted by Jim Wilson
|
||||
|
||||
2004-09-23 Stephane Eranian <eranian@hpl.hp.com>
|
||||
* added patch to discard unwind sections, newer toolchains
|
||||
complained about them. Patch submitted by Jesse Barnes from SGI.
|
||||
|
||||
2003-09-29 Stephane Eranian <eranian@hpl.hp.com>
|
||||
* updated elf_ia64_efi.lds to reflect new data sections
|
||||
created by gcc-3.3. Patch provided by Andreas Schwab from Suse.
|
||||
|
||||
2003-06-20 Stephane Eranian <eranian@hpl.hp.com>
|
||||
* updated elf_ia64_efi.lds and elf_ia32_efi.lds to include
|
||||
new types data sections produced by recent version of gcc-3.x
|
||||
|
||||
2002-02-22 Stephane Eranian <eranian@hpl.hp.com>
|
||||
* release 3.0a
|
||||
* modified both IA-64 and IA-32 loader scripts to add support for the
|
||||
new .rodata sections names (such as rodata.str2.8). Required
|
||||
for new versions of gcc3.x.
|
||||
|
||||
2001-06-20 Stephane Eranian <eranian@hpl.hp.com>
|
||||
* release 3.0
|
||||
* split gnu-efi package in two different packages: the libary+include+crt and the bootloader.
|
||||
* removed W2U() hack and related files to get from wide-char to unicode.
|
||||
* Use -fshort-wchar option for unicode.
|
||||
* restructured Makefiles now install under INSTALLROOT.
|
||||
|
||||
2001-04-06 Stephane Eranian <eranian@hpl.hp.com>
|
||||
|
||||
* incorporated patches from David and Michael Johnston at Intel
|
||||
to get the package to compile for IA-32 linux target.
|
||||
|
||||
* Fixed ELILO to compile for Ia-32 (does not execute yet, though):
|
||||
Makefile and start_kernel() function.
|
||||
|
||||
2001-04-06 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* Fixed config.c to
|
||||
get the timeout directive to do something. implemented the global
|
||||
root= directive.
|
||||
|
||||
* Fix the efi_main() to deal with the -C option properly
|
||||
|
||||
2001-04-05 Stephane Eranian <eranian@hpl.hp.com>
|
||||
|
||||
* update efi library to latest EFI toolkit 1.02 as distributed
|
||||
by Intel. Fixed header + library files to compile with GCC
|
||||
|
||||
* merged ELI and LILO (as of gnu-efi-1.1) together, mostly
|
||||
taking the config file feature of ELI.
|
||||
|
||||
* renamed LILO to ELILO to make the distinction
|
||||
|
||||
* restructured code to make it easier to understand and maintain
|
||||
|
||||
* fixed FPSWA driver checking and loading: we try all possible
|
||||
files and let the driver itself figure out if it is the most
|
||||
recent.
|
||||
* added support for compression (gzip) but keep support for plain
|
||||
ELF image. ELILO autodetects the format
|
||||
|
||||
* change the way the kernel is invoked. Now we call it in
|
||||
physical memory mode. This breaks the dependency between the
|
||||
kernel code and the loader. No more lilo_start.c madness.
|
||||
|
||||
* changed the way the boot_params are passed. We don't use the
|
||||
ZERO_PAGE_ADDR trick anymore. Instead we use EFI runtime memory.
|
||||
The address of the structure is passed to the kernel in r28
|
||||
by our convention.
|
||||
|
||||
* released as gnu-efi-2.0
|
||||
|
||||
2001-04-03 David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
* gnuefi/reloc_ia32.c (_relocate): Change return type from "void"
|
||||
to "int". Return error status if relocation fails for some
|
||||
reason.
|
||||
|
||||
* gnuefi/elf_ia32_efi.lds: Drop unneeded ".rel.reloc" section.
|
||||
|
||||
* gnuefi/crt0-efi-ia32.S (_start): Exit if _relocate() returns with
|
||||
non-zero exit status.
|
||||
|
||||
* inc/ia32/efibind.h [__GNUC__]: Force 8-byte alignment for 64-bit
|
||||
types as that is what EFI appears to be expecting, despite the
|
||||
"#pragma pack()" at the beginning of the file!
|
||||
|
||||
2001-03-29 David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
* gnuefi/reloc_ia32.c: Add a couple of defines to work around
|
||||
libc/efilib collision on uint64_t et al.
|
||||
(_relocate): Use ELF32_R_TYPE() instead of ELFW(R_TYPE)().
|
||||
|
||||
* gnuefi/crt0-efi-ia32.S (dummy): Add a dummy relocation entry.
|
||||
|
||||
2001-03-29 David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
* gnuefi/reloc_ia32.c: Add a couple of defines to work around
|
||||
libc/efilib collision on uint64_t et al.
|
||||
(_relocate): Use ELF32_R_TYPE() instead of ELFW(R_TYPE)().
|
||||
|
||||
* gnuefi/crt0-efi-ia32.S (dummy): Add a dummy relocation entry.
|
||||
|
||||
2000-10-26 David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
* gnuefi/elf_ia64_efi.lds: Mention .rela.sdata.
|
||||
|
||||
* Make.defaults (CFLAGS): Remove -nostdinc flags so we can pick
|
||||
up the C compiler's stdarg.h.
|
||||
|
||||
* inc/stdarg.h: Remove this file. It's not correct for gcc (nor
|
||||
most other optimizing compilers).
|
||||
|
||||
2000-10-10 Stephane Eranian <eranian@hpl.hp.com>
|
||||
|
||||
* cleaned up the error message and printing of those.
|
||||
* added support to load the FPSWA from a file in case support is not
|
||||
present in the firmware already
|
||||
* fixed split_args() to do the right thing when you have leading spaces
|
||||
before kernel name
|
||||
* changed the argify() function to rely on \0 instead of LoadOptionSize
|
||||
as the field seems to be broken with current firmware
|
||||
* bumped version to 1.0
|
||||
|
||||
2000-10-04 David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
* gnuefi/reloc_ia64.S: Reserve space for up to 750 function descriptors.
|
||||
|
||||
* gnuefi/elf_ia64_efi.lds: Add .sdata section for small data and
|
||||
put __gp in the "middle" of it.
|
||||
|
||||
* gnuefi/crt0-efi-ia64.S (_start): Use movl/add to load
|
||||
gp-relative addresses that could be out of the range of the addl
|
||||
offset.
|
||||
* gnuefi/reloc_ia64.S (_relocate): Ditto.
|
||||
|
||||
* apps/Makefile: Remove standard rules and include Make.rules instead.
|
||||
* lilo/Makefile: Ditto.
|
||||
|
||||
* Make.rules: New file.
|
||||
|
||||
2000-08-04 Stephane Eranian <eranian@hpl.hp.com>
|
||||
* released version 0.9
|
||||
* incorporated ACPI changes for Asuza by NEC < kouchi@hpc.bs1.fc.nec.co.jp>
|
||||
* added support for initrd (-i option) original ELI code from Bill Nottingham <notting@redhat.com>)
|
||||
* lots of cleanups
|
||||
* got rid of #ifdef LILO_DEBUG and uses macro instead
|
||||
* fix a few extra memory leaks in create_boot_params()
|
||||
* added exit capability just before starting the kernel
|
||||
|
||||
2000-06-22 David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
* gnuefi/elf_ia64_efi.lds: Add .srodata, .ctors, .IA64.unwind,
|
||||
.IA64.unwind_info to .data section and .rela.ctors to .rela
|
||||
section.
|
||||
|
||||
2000-04-03 David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
* lilo/lilo.c (LILO_VERSION): Up version number to 0.9.
|
||||
|
||||
* gnuefi/elf_ia64_efi.lds: Include .IA_64.unwind and
|
||||
.IA_64.unwind_info in .data segment to avoid EFI load error
|
||||
"ImageAddress: pointer outside of image" error due to the .dynsym
|
||||
relocations against these sections.
|
||||
|
||||
* ChangeLog: Moved from lilo/ChangeLogs.
|
||||
|
||||
* gnuefi/reloc_ia64.S: fixed typo: .space directive had constant
|
||||
100 hardcoded instead of using MAX_FUNCTION_DESCRIPTORS
|
||||
macro. Duh.
|
||||
|
||||
Fri Mar 17 15:19:18 PST 2000 Stephane Eranian <eranian@hpl.hp.com>
|
||||
|
||||
* Released 0.8
|
||||
* replace the getopt.c with new version free with better license
|
||||
* created a documentation file
|
||||
* fix a couple of memory leaks
|
||||
* code cleanups
|
||||
* created a separate directory for lilo in the gnu-efi package.
|
||||
* added support for the BOOT_IMAGE argument to kernel
|
||||
* default is to build natively now
|
||||
80
gnu-efi-3.0/Make.defaults
Normal file
80
gnu-efi-3.0/Make.defaults
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
#
|
||||
# Copyright (c) 1999-2007 Hewlett-Packard Development Company, L.P.
|
||||
# Contributed by David Mosberger <davidm@hpl.hp.com>
|
||||
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
# * Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
# #
|
||||
|
||||
#
|
||||
# Where to install the package. GNU-EFI will create and access
|
||||
# lib and include under the root
|
||||
#
|
||||
INSTALLROOT=/usr/local
|
||||
LIBDIR=lib
|
||||
|
||||
TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
|
||||
|
||||
HOSTARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
|
||||
ARCH := $(shell uname -m | sed s,i[3456789]86,ia32,)
|
||||
OS = $(shell uname -s)
|
||||
INCDIR = -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) -I$(TOPDIR)/inc/protocol
|
||||
CPPFLAGS = -DCONFIG_$(ARCH)
|
||||
CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants
|
||||
ASFLAGS = $(ARCH3264)
|
||||
LDFLAGS = -nostdlib
|
||||
INSTALL = install
|
||||
prefix = /usr/bin/
|
||||
|
||||
CC := $(prefix)gcc
|
||||
AS := $(prefix)as
|
||||
LD := $(prefix)ld
|
||||
AR := $(prefix)ar
|
||||
RANLIB := $(prefix)ranlib
|
||||
OBJCOPY := $(prefix)objcopy
|
||||
|
||||
ifeq ($(ARCH),ia64)
|
||||
CFLAGS += -mfixed-range=f32-f127
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH), ia32)
|
||||
ifeq ($(HOSTARCH), x86_64)
|
||||
ARCH3264 = -m32
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH), x86_64)
|
||||
CFLAGS += -mno-red-zone
|
||||
LIBDIR = lib
|
||||
ifeq ($(HOSTARCH), ia32)
|
||||
ARCH3264 = -m64
|
||||
endif
|
||||
endif
|
||||
46
gnu-efi-3.0/Make.rules
Normal file
46
gnu-efi-3.0/Make.rules
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#
|
||||
# Copyright (C) 1999-2007 Hewlett-Packard Co.
|
||||
# Contributed by David Mosberger <davidm@hpl.hp.com>
|
||||
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
# * Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
|
||||
%.efi: %.so
|
||||
$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
|
||||
-j .rela -j .reloc --target=$(FORMAT) $*.so $@
|
||||
|
||||
%.so: %.o
|
||||
$(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||
|
||||
70
gnu-efi-3.0/Makefile
Normal file
70
gnu-efi-3.0/Makefile
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
#
|
||||
# Copyright (C) 1999-2007 Hewlett-Packard Co.
|
||||
# Contributed by David Mosberger <davidm@hpl.hp.com>
|
||||
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
# * Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
|
||||
SRCDIR = .
|
||||
|
||||
VPATH = $(SRCDIR)
|
||||
|
||||
include $(SRCDIR)/Make.defaults
|
||||
|
||||
SUBDIRS = lib gnuefi inc apps
|
||||
gnuefi: lib
|
||||
|
||||
all: check_gcc $(SUBDIRS)
|
||||
|
||||
$(SUBDIRS):
|
||||
mkdir -p $@
|
||||
$(MAKE) -C $@ -f $(SRCDIR)/../$@/Makefile SRCDIR=$(SRCDIR)/../$@ ARCH=$(ARCH)
|
||||
|
||||
clean:
|
||||
rm -f *~
|
||||
@for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done
|
||||
|
||||
install:
|
||||
@for d in $(SUBDIRS); do $(MAKE) -C $$d install; done
|
||||
|
||||
.PHONY: $(SUBDIRS) clean depend
|
||||
|
||||
#
|
||||
# on both platforms you must use gcc 3.0 or higher
|
||||
#
|
||||
check_gcc:
|
||||
ifeq ($(GCC_VERSION),2)
|
||||
@echo "you need to use a version of gcc >= 3.0, you are using `$(CC) --version`"
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
include $(SRCDIR)/Make.rules
|
||||
30
gnu-efi-3.0/README.efilib
Normal file
30
gnu-efi-3.0/README.efilib
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
The files in the "lib" and "inc" subdirectories are using the EFI Application
|
||||
Toolkit distributed by Intel at http://developer.intel.com/technology/efi
|
||||
|
||||
This code is covered by the following agreement:
|
||||
|
||||
Copyright (c) 1998-2000 Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
and the following disclaimer in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE. THE EFI SPECIFICATION AND ALL OTHER INFORMATION
|
||||
ON THIS WEB SITE ARE PROVIDED "AS IS" WITH NO WARRANTIES, AND ARE SUBJECT
|
||||
TO CHANGE WITHOUT NOTICE.
|
||||
19
gnu-efi-3.0/README.elilo
Normal file
19
gnu-efi-3.0/README.elilo
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
IMPORTANT information related to the gnu-efi package
|
||||
----------------------------------------------------
|
||||
June 2001
|
||||
|
||||
As of version 3.0, the gnu-efi package is now split in two different packages:
|
||||
|
||||
-> gnu-efi-X.y: contains the EFI library, include files and crt0.
|
||||
|
||||
-> elilo-X.y : contains the ELILO bootloader.
|
||||
|
||||
Note that X.y don't need to match for both packages. However elilo-3.x
|
||||
requires at least gnu-efi-3.0. EFI support for x86_64 is provided in
|
||||
gnu-efi-3.0d.
|
||||
|
||||
Both packages can be downloaded from:
|
||||
|
||||
http://www.sf.net/projects/gnu-efi
|
||||
http://www.sf.net/projects/elilo
|
||||
398
gnu-efi-3.0/README.gnuefi
Normal file
398
gnu-efi-3.0/README.gnuefi
Normal file
|
|
@ -0,0 +1,398 @@
|
|||
-------------------------------------------------
|
||||
Building EFI Applications Using the GNU Toolchain
|
||||
-------------------------------------------------
|
||||
|
||||
David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
23 September 1999
|
||||
|
||||
|
||||
Copyright (c) 1999-2007 Hewlett-Packard Co.
|
||||
Copyright (c) 2006-2010 Intel Co.
|
||||
|
||||
Last update: 04/09/2007
|
||||
|
||||
* Introduction
|
||||
|
||||
This document has two parts: the first part describes how to develop
|
||||
EFI applications for IA-64,x86 and x86_64 using the GNU toolchain and the EFI
|
||||
development environment contained in this directory. The second part
|
||||
describes some of the more subtle aspects of how this development
|
||||
environment works.
|
||||
|
||||
|
||||
|
||||
* Part 1: Developing EFI Applications
|
||||
|
||||
|
||||
** Prerequisites:
|
||||
|
||||
To develop x86 and x86_64 EFI applications, the following tools are needed:
|
||||
|
||||
- gcc-3.0 or newer (gcc 2.7.2 is NOT sufficient!)
|
||||
As of gnu-efi-3.0b, the Redhat 8.0 toolchain is known to work,
|
||||
but the Redhat 9.0 toolchain is not currently supported.
|
||||
|
||||
- A version of "objcopy" that supports EFI applications. To
|
||||
check if your version includes EFI support, issue the
|
||||
command:
|
||||
|
||||
objcopy --help
|
||||
|
||||
and verify that the line "supported targets" contains the
|
||||
string "efi-app-ia32" and "efi-app-x86_64". The binutils release
|
||||
binutils-2.17.50.0.14 supports Intel64 EFI.
|
||||
|
||||
- For debugging purposes, it's useful to have a version of
|
||||
"objdump" that supports EFI applications as well. This
|
||||
allows inspect and disassemble EFI binaries.
|
||||
|
||||
To develop IA-64 EFI applications, the following tools are needed:
|
||||
|
||||
- A version of gcc newer than July 30th 1999 (older versions
|
||||
had problems with generating position independent code).
|
||||
As of gnu-efi-3.0b, gcc-3.1 is known to work well.
|
||||
|
||||
- A version of "objcopy" that supports EFI applications. To
|
||||
check if your version includes EFI support, issue the
|
||||
command:
|
||||
|
||||
objcopy --help
|
||||
|
||||
and verify that the line "supported targets" contains the
|
||||
string "efi-app-ia64".
|
||||
|
||||
- For debugging purposes, it's useful to have a version of
|
||||
"objdump" that supports EFI applications as well. This
|
||||
allows inspect and disassemble EFI binaries.
|
||||
|
||||
|
||||
** Directory Structure
|
||||
|
||||
This EFI development environment contains the following
|
||||
subdirectories:
|
||||
|
||||
inc: This directory contains the EFI-related include files. The
|
||||
files are taken from Intel's EFI source distribution, except
|
||||
that various fixes were applied to make it compile with the
|
||||
GNU toolchain.
|
||||
|
||||
lib: This directory contains the source code for Intel's EFI library.
|
||||
Again, the files are taken from Intel's EFI source
|
||||
distribution, with changes to make them compile with the GNU
|
||||
toolchain.
|
||||
|
||||
gnuefi: This directory contains the glue necessary to convert ELF64
|
||||
binaries to EFI binaries. Various runtime code bits, such as
|
||||
a self-relocator are included as well. This code has been
|
||||
contributed by the Hewlett-Packard Company and is distributed
|
||||
under the GNU GPL.
|
||||
|
||||
apps: This directory contains a few simple EFI test apps.
|
||||
|
||||
** Setup
|
||||
|
||||
It is necessary to edit the Makefile in the directory containing this
|
||||
README file before EFI applications can be built. Specifically, you
|
||||
should verify that macros CC, AS, LD, AR, RANLIB, and OBJCOPY point to
|
||||
the appropriate compiler, assembler, linker, ar, and ranlib binaries,
|
||||
respectively.
|
||||
|
||||
If you're working in a cross-development environment, be sure to set
|
||||
macro ARCH to the desired target architecture ("ia32" for x86, "x86_64" for
|
||||
x86_64 and "ia64" for IA-64). For convenience, this can also be done from
|
||||
the make command line (e.g., "make ARCH=ia64").
|
||||
|
||||
|
||||
** Building
|
||||
|
||||
To build the sample EFI applications provided in subdirectory "apps",
|
||||
simply invoke "make" in the toplevel directory (the directory
|
||||
containing this README file). This should build lib/libefi.a and
|
||||
gnuefi/libgnuefi.a first and then all the EFI applications such as a
|
||||
apps/t6.efi.
|
||||
|
||||
|
||||
** Running
|
||||
|
||||
Just copy the EFI application (e.g., apps/t6.efi) to the EFI
|
||||
filesystem, boot EFI, and then select "Invoke EFI application" to run
|
||||
the application you want to test. Alternatively, you can invoke the
|
||||
Intel-provided "nshell" application and then invoke your test binary
|
||||
via the command line interface that "nshell" provides.
|
||||
|
||||
|
||||
** Writing Your Own EFI Application
|
||||
|
||||
Suppose you have your own EFI application in a file called
|
||||
"apps/myefiapp.c". To get this application built by the GNU EFI build
|
||||
environment, simply add "myefiapp.efi" to macro TARGETS in
|
||||
apps/Makefile. Once this is done, invoke "make" in the top level
|
||||
directory. This should result in EFI application apps/myefiapp.efi,
|
||||
ready for execution.
|
||||
|
||||
The GNU EFI build environment allows to write EFI applications as
|
||||
described in Intel's EFI documentation, except for two differences:
|
||||
|
||||
- The EFI application's entry point is always called "efi_main". The
|
||||
declaration of this routine is:
|
||||
|
||||
EFI_STATUS efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab);
|
||||
|
||||
- UNICODE string literals must be written as W2U(L"Sample String")
|
||||
instead of just L"Sample String". The W2U() macro is defined in
|
||||
<efilib.h>. This header file also declares the function W2UCpy()
|
||||
which allows to convert a wide string into a UNICODE string and
|
||||
store the result in a programmer-supplied buffer.
|
||||
|
||||
- Calls to EFI services should be made via uefi_call_wrapper(). This
|
||||
ensures appropriate parameter passing for the architecture.
|
||||
|
||||
|
||||
* Part 2: Inner Workings
|
||||
|
||||
WARNING: This part contains all the gory detail of how the GNU EFI
|
||||
toolchain works. Normal users do not have to worry about such
|
||||
details. Reading this part incurs a definite risk of inducing severe
|
||||
headaches or other maladies.
|
||||
|
||||
The basic idea behind the GNU EFI build environment is to use the GNU
|
||||
toolchain to build a normal ELF binary that, at the end, is converted
|
||||
to an EFI binary. EFI binaries are really just PE32+ binaries. PE
|
||||
stands for "Portable Executable" and is the object file format
|
||||
Microsoft is using on its Windows platforms. PE is basically the COFF
|
||||
object file format with an MS-DOS2.0 compatible header slapped on in
|
||||
front of it. The "32" in PE32+ stands for 32 bits, meaning that PE32
|
||||
is a 32-bit object file format. The plus in "PE32+" indicates that
|
||||
this format has been hacked to allow loading a 4GB binary anywhere in
|
||||
a 64-bit address space (unlike ELF64, however, this is not a full
|
||||
64-bit object file format because the entire binary cannot span more
|
||||
than 4GB of address space). EFI binaries are plain PE32+ binaries
|
||||
except that the "subsystem id" differs from normal Windows binaries.
|
||||
There are two flavors of EFI binaries: "applications" and "drivers"
|
||||
and each has there own subsystem id and are identical otherwise. At
|
||||
present, the GNU EFI build environment supports the building of EFI
|
||||
applications only, though it would be trivial to generate drivers, as
|
||||
the only difference is the subsystem id. For more details on PE32+,
|
||||
see the spec at
|
||||
|
||||
http://msdn.microsoft.com/library/specs/msdn_pecoff.htm.
|
||||
|
||||
In theory, converting a suitable ELF64 binary to PE32+ is easy and
|
||||
could be accomplished with the "objcopy" utility by specifying option
|
||||
--target=efi-app-ia32 (x86) or --target=efi-app-ia64 (IA-64). But
|
||||
life never is that easy, so here some complicating factors:
|
||||
|
||||
(1) COFF sections are very different from ELF sections.
|
||||
|
||||
ELF binaries distinguish between program headers and sections.
|
||||
The program headers describe the memory segments that need to
|
||||
be loaded/initialized, whereas the sections describe what
|
||||
constitutes those segments. In COFF (and therefore PE32+) no
|
||||
such distinction is made. Thus, COFF sections need to be page
|
||||
aligned and have a size that is a multiple of the page size
|
||||
(4KB for EFI), whereas ELF allows sections at arbitrary
|
||||
addresses and with arbitrary sizes.
|
||||
|
||||
(2) EFI binaries should be relocatable.
|
||||
|
||||
Since EFI binaries are executed in physical mode, EFI cannot
|
||||
guarantee that a given binary can be loaded at its preferred
|
||||
address. EFI does _try_ to load a binary at it's preferred
|
||||
address, but if it can't do so, it will load it at another
|
||||
address and then relocate the binary using the contents of the
|
||||
.reloc section.
|
||||
|
||||
(3) On IA-64, the EFI entry point needs to point to a function
|
||||
descriptor, not to the code address of the entry point.
|
||||
|
||||
(4) The EFI specification assumes that wide characters use UNICODE
|
||||
encoding.
|
||||
|
||||
ANSI C does not specify the size or encoding that a wide
|
||||
character uses. These choices are "implementation defined".
|
||||
On most UNIX systems, the GNU toolchain uses a wchar_t that is
|
||||
4 bytes in size. The encoding used for such characters is
|
||||
(mostly) UCS4.
|
||||
|
||||
In the following sections, we address how the GNU EFI build
|
||||
environment addresses each of these issues.
|
||||
|
||||
|
||||
** (1) Accommodating COFF Sections
|
||||
|
||||
In order to satisfy the COFF constraint of page-sized and page-aligned
|
||||
sections, the GNU EFI build environment uses the special linker script
|
||||
in gnuefi/elf_$(ARCH)_efi.lds where $(ARCH) is the target architecture
|
||||
("ia32" for x86, "x86_64" for x86_64 and "ia64" for IA-64).
|
||||
This script is set up to create only eight COFF section, each page aligned
|
||||
and page sized.These eight sections are used to group together the much
|
||||
greater number of sections that are typically present in ELF object files.
|
||||
Specifically:
|
||||
|
||||
.hash
|
||||
Collects the ELF .hash info (this section _must_ be the first
|
||||
section in order to build a shared object file; the section is
|
||||
not actually loaded or used at runtime).
|
||||
|
||||
.text
|
||||
Collects all sections containing executable code.
|
||||
|
||||
.data
|
||||
Collects read-only and read-write data, literal string data,
|
||||
global offset tables, the uninitialized data segment (bss) and
|
||||
various other sections containing data.
|
||||
|
||||
The reason read-only data is placed here instead of the in
|
||||
.text is to make it possible to disassemble the .text section
|
||||
without getting garbage due to read-only data. Besides, since
|
||||
EFI binaries execute in physical mode, differences in page
|
||||
protection do not matter.
|
||||
|
||||
The reason the uninitialized data is placed in this section is
|
||||
that the EFI loader appears to be unable to handle sections
|
||||
that are allocated but not loaded from the binary.
|
||||
|
||||
.dynamic, .dynsym, .rela, .rel, .reloc
|
||||
These sections contains the dynamic information necessary to
|
||||
self-relocate the binary (see below).
|
||||
|
||||
A couple of more points worth noting about the linker script:
|
||||
|
||||
o On IA-64, the global pointer symbol (__gp) needs to be placed such
|
||||
that the _entire_ EFI binary can be addressed using the signed
|
||||
22-bit offset that the "addl" instruction affords. Specifically,
|
||||
this means that __gp should be placed at ImageBase + 0x200000.
|
||||
Strictly speaking, only a couple of symbols need to be addressable
|
||||
in this fashion, so with some care it should be possible to build
|
||||
binaries much larger than 4MB. To get a list of symbols that need
|
||||
to be addressable in this fashion, grep the assembly files in
|
||||
directory gnuefi for the string "@gprel".
|
||||
|
||||
o The link address (ImageBase) of the binary is (arbitrarily) set to
|
||||
zero. This could be set to something larger to increase the chance
|
||||
of EFI being able to load the binary without requiring relocation.
|
||||
However, a start address of 0 makes debugging a wee bit easier
|
||||
(great for those of us who can add, but not subtract... ;-).
|
||||
|
||||
o The relocation related sections (.dynamic, .rel, .rela, .reloc)
|
||||
cannot be placed inside .data because some tools in the GNU
|
||||
toolchain rely on the existence of these sections.
|
||||
|
||||
o Some sections in the ELF binary intentionally get dropped when
|
||||
building the EFI binary. Particularly noteworthy are the dynamic
|
||||
relocation sections for the .plabel and .reloc sections. It would
|
||||
be _wrong_ to include these sections in the EFI binary because it
|
||||
would result in .reloc and .plabel being relocated twice (once by
|
||||
the EFI loader and once by the self-relocator; see below for a
|
||||
description of the latter). Specifically, only the sections
|
||||
mentioned with the -j option in the final "objcopy" command are
|
||||
retained in the EFI binary (see apps/Makefile).
|
||||
|
||||
|
||||
** (2) Building Relocatable Binaries
|
||||
|
||||
ELF binaries are normally linked for a fixed load address and are thus
|
||||
not relocatable. The only kind of ELF object that is relocatable are
|
||||
shared objects ("shared libraries"). However, even those objects are
|
||||
usually not completely position independent and therefore require
|
||||
runtime relocation by the dynamic loader. For example, IA-64 binaries
|
||||
normally require relocation of the global offset table.
|
||||
|
||||
The approach to building relocatable binaries in the GNU EFI build
|
||||
environment is to:
|
||||
|
||||
(a) build an ELF shared object
|
||||
|
||||
(b) link it together with a self-relocator that takes care of
|
||||
applying the dynamic relocations that may be present in the
|
||||
ELF shared object
|
||||
|
||||
(c) convert the resulting image to an EFI binary
|
||||
|
||||
The self-relocator is of course architecture dependent. The x86
|
||||
version can be found in gnuefi/reloc_ia32.c, the x86_64 version
|
||||
can be found in gnuefi/reloc_x86_64.c and the IA-64 version can be
|
||||
found in gnuefi/reloc_ia64.S.
|
||||
|
||||
The self-relocator operates as follows: the startup code invokes it
|
||||
right after EFI has handed off control to the EFI binary at symbol
|
||||
"_start". Upon activation, the self-relocator searches the .dynamic
|
||||
section (whose starting address is given by symbol _DYNAMIC) for the
|
||||
dynamic relocation information, which can be found in the DT_REL,
|
||||
DT_RELSZ, and DT_RELENT entries of the dynamic table (DT_RELA,
|
||||
DT_RELASZ, and DT_RELAENT in the case of rela relocations, as is the
|
||||
case for IA-64). The dynamic relocation information points to the ELF
|
||||
relocation table. Once this table is found, the self-relocator walks
|
||||
through it, applying each relocation one by one. Since the EFI
|
||||
binaries are fully resolved shared objects, only a subset of all
|
||||
possible relocations need to be supported. Specifically, on x86 only
|
||||
the R_386_RELATIVE relocation is needed. On IA-64, the relocations
|
||||
R_IA64_DIR64LSB, R_IA64_REL64LSB, and R_IA64_FPTR64LSB are needed.
|
||||
Note that the R_IA64_FPTR64LSB relocation requires access to the
|
||||
dynamic symbol table. This is why the .dynsym section is included in
|
||||
the EFI binary. Another complication is that this relocation requires
|
||||
memory to hold the function descriptors (aka "procedure labels" or
|
||||
"plabels"). Each function descriptor uses 16 bytes of memory. The
|
||||
IA-64 self-relocator currently reserves a static memory area that can
|
||||
hold 100 of these descriptors. If the self-relocator runs out of
|
||||
space, it causes the EFI binary to fail with error code 5
|
||||
(EFI_BUFFER_TOO_SMALL). When this happens, the manifest constant
|
||||
MAX_FUNCTION_DESCRIPTORS in gnuefi/reloc_ia64.S should be increased
|
||||
and the application recompiled. An easy way to count the number of
|
||||
function descriptors required by an EFI application is to run the
|
||||
command:
|
||||
|
||||
objdump --dynamic-reloc example.so | fgrep FPTR64 | wc -l
|
||||
|
||||
assuming "example" is the name of the desired EFI application.
|
||||
|
||||
|
||||
** (3) Creating the Function Descriptor for the IA-64 EFI Binaries
|
||||
|
||||
As mentioned above, the IA-64 PE32+ format assumes that the entry
|
||||
point of the binary is a function descriptor. A function descriptors
|
||||
consists of two double words: the first one is the code entry point
|
||||
and the second is the global pointer that should be loaded before
|
||||
calling the entry point. Since the ELF toolchain doesn't know how to
|
||||
generate a function descriptor for the entry point, the startup code
|
||||
in gnuefi/crt0-efi-ia64.S crafts one manually by with the code:
|
||||
|
||||
.section .plabel, "a"
|
||||
_start_plabel:
|
||||
data8 _start
|
||||
data8 __gp
|
||||
|
||||
this places the procedure label for entry point _start in a section
|
||||
called ".plabel". Now, the only problem is that _start and __gp need
|
||||
to be relocated _before_ EFI hands control over to the EFI binary.
|
||||
Fortunately, PE32+ defines a section called ".reloc" that can achieve
|
||||
this. Thus, in addition to manually crafting the function descriptor,
|
||||
the startup code also crafts a ".reloc" section that has will cause
|
||||
the EFI loader to relocate the function descriptor before handing over
|
||||
control to the EFI binary (again, see the PECOFF spec mentioned above
|
||||
for details).
|
||||
|
||||
A final question may be why .plabel and .reloc need to go in their own
|
||||
COFF sections. The answer is simply: we need to be able to discard
|
||||
the relocation entries that are generated for these sections. By
|
||||
placing them in these sections, the relocations end up in sections
|
||||
".rela.plabel" and ".rela.reloc" which makes it easy to filter them
|
||||
out in the filter script. Also, the ".reloc" section needs to be in
|
||||
its own section so that the objcopy program can recognize it and can
|
||||
create the correct directory entries in the PE32+ binary.
|
||||
|
||||
|
||||
** (4) Convenient and Portable Generation of UNICODE String Literals
|
||||
|
||||
As of gnu-efi-3.0, we make use (and somewhat abuse) the gcc option
|
||||
that forces wide characters (WCHAR_T) to use short integers (2 bytes)
|
||||
instead of integers (4 bytes). This way we match the Unicode character
|
||||
size. By abuse, we mean that we rely on the fact that the regular ASCII
|
||||
characters are encoded the same way between (short) wide characters
|
||||
and Unicode and basically only use the first byte. This allows us
|
||||
to just use them interchangeably.
|
||||
|
||||
The gcc option to force short wide characters is : -fshort-wchar
|
||||
|
||||
* * * The End * * *
|
||||
70
gnu-efi-3.0/apps/Makefile
Normal file
70
gnu-efi-3.0/apps/Makefile
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
#
|
||||
# Copyright (C) 1999-2001 Hewlett-Packard Co.
|
||||
# Contributed by David Mosberger <davidm@hpl.hp.com>
|
||||
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
# * Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
|
||||
SRCDIR = .
|
||||
|
||||
VPATH = $(SRCDIR)
|
||||
|
||||
include $(SRCDIR)/../Make.defaults
|
||||
|
||||
TOPDIR = $(SRCDIR)/..
|
||||
|
||||
CDIR=$(TOPDIR)/..
|
||||
LINUX_HEADERS = /usr/src/sys/build
|
||||
CPPFLAGS += -D__KERNEL__ -I$(LINUX_HEADERS)/include
|
||||
CRTOBJS = ../gnuefi/crt0-efi-$(ARCH).o
|
||||
|
||||
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_efi.lds
|
||||
ifeq ($(ARCH),x86_64)
|
||||
ifneq (,$(findstring FreeBSD,$(OS)))
|
||||
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds
|
||||
endif
|
||||
endif
|
||||
|
||||
LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
|
||||
LOADLIBES = -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
|
||||
FORMAT = efi-app-$(ARCH)
|
||||
|
||||
TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi tcc.efi
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGETS) *~ *.o *.so
|
||||
|
||||
.PHONY: install
|
||||
|
||||
include $(SRCDIR)/../Make.rules
|
||||
32
gnu-efi-3.0/apps/printenv.c
Normal file
32
gnu-efi-3.0/apps/printenv.c
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
EFI_STATUS
|
||||
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
EFI_STATUS status;
|
||||
CHAR16 name[256], *val, fmt[20];
|
||||
EFI_GUID vendor;
|
||||
UINTN size;
|
||||
|
||||
InitializeLib(image, systab);
|
||||
|
||||
name[0] = 0;
|
||||
vendor = NullGuid;
|
||||
|
||||
Print(L"GUID Variable Name Value\n");
|
||||
Print(L"=================================== ==================== ========\n");
|
||||
|
||||
StrCpy(fmt, L"%.-35g %.-20s %s\n");
|
||||
while (1) {
|
||||
size = sizeof(name);
|
||||
status = uefi_call_wrapper(RT->GetNextVariableName, 3, &size, name, &vendor);
|
||||
if (status != EFI_SUCCESS)
|
||||
break;
|
||||
|
||||
val = LibGetVariable(name, &vendor);
|
||||
Print(fmt, &vendor, name, val);
|
||||
FreePool(val);
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
27
gnu-efi-3.0/apps/t.c
Normal file
27
gnu-efi-3.0/apps/t.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
static CHAR16 *
|
||||
a2u (char *str)
|
||||
{
|
||||
static CHAR16 mem[2048];
|
||||
int i;
|
||||
|
||||
for (i = 0; str[i]; ++i)
|
||||
mem[i] = (CHAR16) str[i];
|
||||
mem[i] = 0;
|
||||
return mem;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
|
||||
|
||||
InitializeLib(image_handle, systab);
|
||||
conout = systab->ConOut;
|
||||
uefi_call_wrapper(conout->OutputString, 2, conout, (CHAR16 *)L"Hello World!\n\r");
|
||||
uefi_call_wrapper(conout->OutputString, 2, conout, a2u("Hello World!\n\r"));
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
13
gnu-efi-3.0/apps/t2.c
Normal file
13
gnu-efi-3.0/apps/t2.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
EFI_STATUS
|
||||
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
|
||||
|
||||
conout = systab->ConOut;
|
||||
uefi_call_wrapper(conout->OutputString, 2, conout, L"Hello World!\n\r");
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
95
gnu-efi-3.0/apps/t3.c
Normal file
95
gnu-efi-3.0/apps/t3.c
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
EFI_STATUS
|
||||
efi_main(
|
||||
EFI_HANDLE image_handle,
|
||||
EFI_SYSTEM_TABLE *systab
|
||||
)
|
||||
{
|
||||
EFI_GUID loaded_image_protocol = LOADED_IMAGE_PROTOCOL;
|
||||
EFI_STATUS efi_status;
|
||||
EFI_LOADED_IMAGE *li;
|
||||
UINTN pat = PoolAllocationType;
|
||||
VOID *void_li_p;
|
||||
|
||||
InitializeLib(image_handle, systab);
|
||||
PoolAllocationType = 2; /* klooj */
|
||||
|
||||
Print(L"Hello World! (0xd=0x%x, 13=%d)\n", 13, 13);
|
||||
|
||||
Print(L"before InitializeLib(): PoolAllocationType=%d\n",
|
||||
pat);
|
||||
|
||||
Print(L" after InitializeLib(): PoolAllocationType=%d\n",
|
||||
PoolAllocationType);
|
||||
|
||||
/*
|
||||
* Locate loaded_image_handle instance.
|
||||
*/
|
||||
|
||||
Print(L"BS->HandleProtocol() ");
|
||||
|
||||
efi_status = uefi_call_wrapper(
|
||||
BS->HandleProtocol,
|
||||
3,
|
||||
image_handle,
|
||||
&loaded_image_protocol,
|
||||
&void_li_p);
|
||||
li = void_li_p;
|
||||
|
||||
Print(L"%xh (%r)\n", efi_status, efi_status);
|
||||
|
||||
if (efi_status != EFI_SUCCESS) {
|
||||
return efi_status;
|
||||
}
|
||||
|
||||
Print(L" li: %xh\n", li);
|
||||
|
||||
if (!li) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Print(L" li->Revision: %xh\n", li->Revision);
|
||||
Print(L" li->ParentHandle: %xh\n", li->ParentHandle);
|
||||
Print(L" li->SystemTable: %xh\n", li->SystemTable);
|
||||
Print(L" li->DeviceHandle: %xh\n", li->DeviceHandle);
|
||||
Print(L" li->FilePath: %xh\n", li->FilePath);
|
||||
Print(L" li->Reserved: %xh\n", li->Reserved);
|
||||
Print(L" li->LoadOptionsSize: %xh\n", li->LoadOptionsSize);
|
||||
Print(L" li->LoadOptions: %xh\n", li->LoadOptions);
|
||||
Print(L" li->ImageBase: %xh\n", li->ImageBase);
|
||||
Print(L" li->ImageSize: %xh\n", li->ImageSize);
|
||||
Print(L" li->ImageCodeType: %xh\n", li->ImageCodeType);
|
||||
Print(L" li->ImageDataType: %xh\n", li->ImageDataType);
|
||||
Print(L" li->Unload: %xh\n", li->Unload);
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
UINT32 Revision;
|
||||
EFI_HANDLE ParentHandle;
|
||||
struct _EFI_SYSTEM_TABLE *SystemTable;
|
||||
|
||||
// Source location of image
|
||||
EFI_HANDLE DeviceHandle;
|
||||
EFI_DEVICE_PATH *FilePath;
|
||||
VOID *Reserved;
|
||||
|
||||
// Images load options
|
||||
UINT32 LoadOptionsSize;
|
||||
VOID *LoadOptions;
|
||||
|
||||
// Location of where image was loaded
|
||||
VOID *ImageBase;
|
||||
UINT64 ImageSize;
|
||||
EFI_MEMORY_TYPE ImageCodeType;
|
||||
EFI_MEMORY_TYPE ImageDataType;
|
||||
|
||||
// If the driver image supports a dynamic unload request
|
||||
EFI_IMAGE_UNLOAD Unload;
|
||||
|
||||
} EFI_LOADED_IMAGE;
|
||||
#endif
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
13
gnu-efi-3.0/apps/t4.c
Normal file
13
gnu-efi-3.0/apps/t4.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
EFI_STATUS
|
||||
efi_main (EFI_HANDLE *image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
UINTN index;
|
||||
|
||||
uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut, L"Hello application started\r\n");
|
||||
uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut, L"\r\n\r\n\r\nHit any key to exit\r\n");
|
||||
uefi_call_wrapper(systab->BootServices->WaitForEvent, 3, 1, &systab->ConIn->WaitForKey, &index);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
13
gnu-efi-3.0/apps/t5.c
Normal file
13
gnu-efi-3.0/apps/t5.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
EFI_STATUS
|
||||
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
InitializeLib(image, systab);
|
||||
Print(L"HelloLib application started\n");
|
||||
Print(L"\n\n\nHit any key to exit this image\n");
|
||||
WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"\n\n");
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
43
gnu-efi-3.0/apps/t6.c
Normal file
43
gnu-efi-3.0/apps/t6.c
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
typedef EFI_STATUS (*foo_t)(EFI_HANDLE, EFI_GUID *, VOID **);
|
||||
typedef struct {
|
||||
unsigned long addr;
|
||||
unsigned long gp;
|
||||
} fdesc_t;
|
||||
|
||||
EFI_LOADED_IMAGE my_loaded;
|
||||
|
||||
EFI_STATUS
|
||||
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
EFI_LOADED_IMAGE *loaded_image = NULL;
|
||||
#if 0
|
||||
EFI_DEVICE_PATH *dev_path;
|
||||
#endif
|
||||
EFI_STATUS status;
|
||||
|
||||
InitializeLib(image, systab);
|
||||
status = uefi_call_wrapper(systab->BootServices->HandleProtocol,
|
||||
3,
|
||||
image,
|
||||
&LoadedImageProtocol,
|
||||
(void **) &loaded_image);
|
||||
if (EFI_ERROR(status)) {
|
||||
Print(L"handleprotocol: %r\n", status);
|
||||
}
|
||||
|
||||
#if 0
|
||||
BS->HandleProtocol(loaded_image->DeviceHandle, &DevicePathProtocol, (void **) &dev_path);
|
||||
|
||||
Print(L"Image device : %s\n", DevicePathToStr(dev_path));
|
||||
Print(L"Image file : %s\n", DevicePathToStr(loaded_image->FilePath));
|
||||
#endif
|
||||
Print(L"Image base : %lx\n", loaded_image->ImageBase);
|
||||
Print(L"Image size : %lx\n", loaded_image->ImageSize);
|
||||
Print(L"Load options size : %lx\n", loaded_image->LoadOptionsSize);
|
||||
Print(L"Load options : %s\n", loaded_image->LoadOptions);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
25
gnu-efi-3.0/apps/t7.c
Normal file
25
gnu-efi-3.0/apps/t7.c
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
EFI_STATUS
|
||||
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
EFI_INPUT_KEY efi_input_key;
|
||||
EFI_STATUS efi_status;
|
||||
|
||||
InitializeLib(image, systab);
|
||||
|
||||
Print(L"HelloLib application started\n");
|
||||
|
||||
Print(L"\n\n\nHit any key to exit this image\n");
|
||||
WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
|
||||
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"\n\n");
|
||||
|
||||
efi_status = uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, &efi_input_key);
|
||||
|
||||
Print(L"ScanCode: %xh UnicodeChar: %xh\n",
|
||||
efi_input_key.ScanCode, efi_input_key.UnicodeChar);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
442
gnu-efi-3.0/apps/tcc.c
Normal file
442
gnu-efi-3.0/apps/tcc.c
Normal file
|
|
@ -0,0 +1,442 @@
|
|||
/*
|
||||
* Test if our calling convention gymnastics actually work
|
||||
*/
|
||||
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
#ifdef __x86_64__
|
||||
#include <x86_64/pe.h>
|
||||
#include <x86_64/efibind.h>
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
asm volatile("out %0,%1" : : "a" ((uint8_t)a), "dN" (0x80));
|
||||
|
||||
extern void dump_stack(void);
|
||||
asm( ".globl dump_stack\n"
|
||||
"dump_stack:\n"
|
||||
" movq %rsp, %rdi\n"
|
||||
" jmp *dump_stack_helper@GOTPCREL(%rip)\n"
|
||||
".size dump_stack, .-dump_stack");
|
||||
|
||||
void dump_stack_helper(uint64_t rsp_val)
|
||||
{
|
||||
uint64_t *rsp = (uint64_t *)rsp_val;
|
||||
int x;
|
||||
|
||||
Print(L"%%rsp: 0x%08x%08x stack:\r\n",
|
||||
(rsp_val & 0xffffffff00000000) >>32,
|
||||
rsp_val & 0xffffffff);
|
||||
for (x = 0; x < 8; x++) {
|
||||
Print(L"%08x: ", ((uint64_t)rsp) & 0xffffffff);
|
||||
Print(L"%016x ", *rsp++);
|
||||
Print(L"%016x ", *rsp++);
|
||||
Print(L"%016x ", *rsp++);
|
||||
Print(L"%016x\r\n", *rsp++);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
EFI_STATUS EFI_FUNCTION test_failure_callback(void)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
EFI_STATUS test_failure(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_failure_callback, 0);
|
||||
}
|
||||
|
||||
EFI_STATUS EFI_FUNCTION test_call0_callback(void)
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS test_call0(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_call0_callback, 0);
|
||||
}
|
||||
|
||||
EFI_STATUS EFI_FUNCTION test_call1_callback(UINT32 a)
|
||||
{
|
||||
if (a != 0x12345678) {
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS test_call1(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_call1_callback, 1,0x12345678);
|
||||
}
|
||||
|
||||
EFI_STATUS EFI_FUNCTION test_call2_callback(UINT32 a, UINT32 b)
|
||||
{
|
||||
if (a != 0x12345678) {
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
if (b != 0x23456789) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS test_call2(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_call2_callback, 2,
|
||||
0x12345678, 0x23456789);
|
||||
}
|
||||
|
||||
EFI_STATUS EFI_FUNCTION test_call3_callback(UINT32 a, UINT32 b,
|
||||
UINT32 c)
|
||||
{
|
||||
if (a != 0x12345678)
|
||||
return EFI_LOAD_ERROR;
|
||||
if (b != 0x23456789)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
if (c != 0x3456789a)
|
||||
return EFI_UNSUPPORTED;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS test_call3(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_call3_callback, 3,
|
||||
0x12345678, 0x23456789, 0x3456789a);
|
||||
}
|
||||
|
||||
EFI_STATUS EFI_FUNCTION test_call4_callback(UINT32 a, UINT32 b,
|
||||
UINT32 c, UINT32 d)
|
||||
{
|
||||
if (a != 0x12345678)
|
||||
return EFI_LOAD_ERROR;
|
||||
if (b != 0x23456789)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
if (c != 0x3456789a)
|
||||
return EFI_UNSUPPORTED;
|
||||
if (d != 0x456789ab)
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS test_call4(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_call4_callback, 4,
|
||||
0x12345678, 0x23456789, 0x3456789a, 0x456789ab);
|
||||
}
|
||||
|
||||
EFI_STATUS EFI_FUNCTION test_call5_callback(UINT32 a, UINT32 b,
|
||||
UINT32 c, UINT32 d, UINT32 e)
|
||||
{
|
||||
if (a != 0x12345678)
|
||||
return EFI_LOAD_ERROR;
|
||||
if (b != 0x23456789)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
if (c != 0x3456789a)
|
||||
return EFI_UNSUPPORTED;
|
||||
if (d != 0x456789ab)
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
if (e != 0x56789abc)
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS test_call5(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_call5_callback, 5,
|
||||
0x12345678, 0x23456789, 0x3456789a, 0x456789ab, 0x56789abc);
|
||||
}
|
||||
|
||||
EFI_STATUS EFI_FUNCTION test_call6_callback(UINT32 a, UINT32 b,
|
||||
UINT32 c, UINT32 d, UINT32 e, UINT32 f)
|
||||
{
|
||||
if (a != 0x12345678)
|
||||
return EFI_LOAD_ERROR;
|
||||
if (b != 0x23456789)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
if (c != 0x3456789a)
|
||||
return EFI_UNSUPPORTED;
|
||||
if (d != 0x456789ab)
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
if (e != 0x56789abc)
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
if (f != 0x6789abcd)
|
||||
return EFI_NOT_READY;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS test_call6(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_call6_callback, 6,
|
||||
0x12345678, 0x23456789, 0x3456789a, 0x456789ab, 0x56789abc,
|
||||
0x6789abcd);
|
||||
}
|
||||
|
||||
EFI_STATUS EFI_FUNCTION test_call7_callback(UINT32 a, UINT32 b,
|
||||
UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g)
|
||||
{
|
||||
if (a != 0x12345678)
|
||||
return EFI_LOAD_ERROR;
|
||||
if (b != 0x23456789)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
if (c != 0x3456789a)
|
||||
return EFI_UNSUPPORTED;
|
||||
if (d != 0x456789ab)
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
if (e != 0x56789abc)
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
if (f != 0x6789abcd)
|
||||
return EFI_NOT_READY;
|
||||
if (g != 0x789abcde)
|
||||
return EFI_DEVICE_ERROR;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS test_call7(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_call7_callback, 7,
|
||||
0x12345678, 0x23456789, 0x3456789a, 0x456789ab,
|
||||
0x56789abc, 0x6789abcd, 0x789abcde);
|
||||
}
|
||||
|
||||
EFI_STATUS EFI_FUNCTION test_call8_callback(UINT32 a, UINT32 b,
|
||||
UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g, UINT32 h)
|
||||
{
|
||||
if (a != 0x12345678)
|
||||
return EFI_LOAD_ERROR;
|
||||
if (b != 0x23456789)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
if (c != 0x3456789a)
|
||||
return EFI_UNSUPPORTED;
|
||||
if (d != 0x456789ab)
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
if (e != 0x56789abc)
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
if (f != 0x6789abcd)
|
||||
return EFI_NOT_READY;
|
||||
if (g != 0x789abcde)
|
||||
return EFI_DEVICE_ERROR;
|
||||
if (h != 0x89abcdef)
|
||||
return EFI_WRITE_PROTECTED;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS test_call8(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_call8_callback, 8,
|
||||
0x12345678,
|
||||
0x23456789,
|
||||
0x3456789a,
|
||||
0x456789ab,
|
||||
0x56789abc,
|
||||
0x6789abcd,
|
||||
0x789abcde,
|
||||
0x89abcdef);
|
||||
}
|
||||
|
||||
EFI_STATUS EFI_FUNCTION test_call9_callback(UINT32 a, UINT32 b,
|
||||
UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g, UINT32 h, UINT32 i)
|
||||
{
|
||||
if (a != 0x12345678)
|
||||
return EFI_LOAD_ERROR;
|
||||
if (b != 0x23456789)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
if (c != 0x3456789a)
|
||||
return EFI_UNSUPPORTED;
|
||||
if (d != 0x456789ab)
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
if (e != 0x56789abc)
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
if (f != 0x6789abcd)
|
||||
return EFI_NOT_READY;
|
||||
if (g != 0x789abcde)
|
||||
return EFI_DEVICE_ERROR;
|
||||
if (h != 0x89abcdef)
|
||||
return EFI_WRITE_PROTECTED;
|
||||
if (i != 0x9abcdef0)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS test_call9(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_call9_callback, 9,
|
||||
0x12345678,
|
||||
0x23456789,
|
||||
0x3456789a,
|
||||
0x456789ab,
|
||||
0x56789abc,
|
||||
0x6789abcd,
|
||||
0x789abcde,
|
||||
0x89abcdef,
|
||||
0x9abcdef0);
|
||||
}
|
||||
|
||||
extern EFI_STATUS test_call10(void);
|
||||
EFI_STATUS EFI_FUNCTION test_call10_callback(UINT32 a, UINT32 b,
|
||||
UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g, UINT32 h, UINT32 i,
|
||||
UINT32 j)
|
||||
{
|
||||
if (a != 0x12345678)
|
||||
return EFI_LOAD_ERROR;
|
||||
if (b != 0x23456789)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
if (c != 0x3456789a)
|
||||
return EFI_UNSUPPORTED;
|
||||
if (d != 0x456789ab)
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
if (e != 0x56789abc)
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
if (f != 0x6789abcd)
|
||||
return EFI_NOT_READY;
|
||||
if (g != 0x789abcde)
|
||||
return EFI_DEVICE_ERROR;
|
||||
if (h != 0x89abcdef)
|
||||
return EFI_WRITE_PROTECTED;
|
||||
if (i != 0x9abcdef0)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
if (j != 0xabcdef01)
|
||||
return EFI_VOLUME_CORRUPTED;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS test_call10(void)
|
||||
{
|
||||
return uefi_call_wrapper(test_call10_callback, 10,
|
||||
0x12345678,
|
||||
0x23456789,
|
||||
0x3456789a,
|
||||
0x456789ab,
|
||||
0x56789abc,
|
||||
0x6789abcd,
|
||||
0x789abcde,
|
||||
0x89abcdef,
|
||||
0x9abcdef0,
|
||||
0xabcdef01);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
efi_main (EFI_HANDLE *image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
EFI_STATUS rc = EFI_SUCCESS;
|
||||
|
||||
InitializeLib(image, systab);
|
||||
PoolAllocationType = 2; /* klooj */
|
||||
|
||||
#ifndef __x86_64__
|
||||
uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut,
|
||||
L"This test is only valid on x86_64\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
asm volatile("out %0,%1" : : "a" ((uint8_t)0x14), "dN" (0x80));
|
||||
|
||||
Print(L"Hello\r\n");
|
||||
rc = test_failure();
|
||||
if (EFI_ERROR(rc)) {
|
||||
Print(L"Returning Failure works\n");
|
||||
} else {
|
||||
Print(L"Returning failure doesn't work.\r\n");
|
||||
Print(L"%%rax was 0x%016x, should have been 0x%016x\n",
|
||||
rc, EFI_UNSUPPORTED);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
rc = test_call0();
|
||||
if (!EFI_ERROR(rc)) {
|
||||
Print(L"0 args works just fine here.\r\n");
|
||||
} else {
|
||||
Print(L"0 args failed: 0x%016x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = test_call1();
|
||||
if (!EFI_ERROR(rc)) {
|
||||
Print(L"1 arg works just fine here.\r\n");
|
||||
} else {
|
||||
Print(L"1 arg failed: 0x%016x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = test_call2();
|
||||
if (!EFI_ERROR(rc)) {
|
||||
Print(L"2 args works just fine here.\r\n");
|
||||
} else {
|
||||
Print(L"2 args failed: 0x%016x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = test_call3();
|
||||
if (!EFI_ERROR(rc)) {
|
||||
Print(L"3 args works just fine here.\r\n");
|
||||
} else {
|
||||
Print(L"3 args failed: 0x%016x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = test_call4();
|
||||
if (!EFI_ERROR(rc)) {
|
||||
Print(L"4 args works just fine here.\r\n");
|
||||
} else {
|
||||
Print(L"4 args failed: 0x%016x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = test_call5();
|
||||
if (!EFI_ERROR(rc)) {
|
||||
Print(L"5 args works just fine here.\r\n");
|
||||
} else {
|
||||
Print(L"5 args failed: 0x%016x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = test_call6();
|
||||
if (!EFI_ERROR(rc)) {
|
||||
Print(L"6 args works just fine here.\r\n");
|
||||
} else {
|
||||
Print(L"6 args failed: 0x%016x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = test_call7();
|
||||
if (!EFI_ERROR(rc)) {
|
||||
Print(L"7 args works just fine here.\r\n");
|
||||
} else {
|
||||
Print(L"7 args failed: 0x%016x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = test_call8();
|
||||
if (!EFI_ERROR(rc)) {
|
||||
Print(L"8 args works just fine here.\r\n");
|
||||
} else {
|
||||
Print(L"8 args failed: 0x%016x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = test_call9();
|
||||
if (!EFI_ERROR(rc)) {
|
||||
Print(L"9 args works just fine here.\r\n");
|
||||
} else {
|
||||
Print(L"9 args failed: 0x%016x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = test_call10();
|
||||
if (!EFI_ERROR(rc)) {
|
||||
Print(L"10 args works just fine here.\r\n");
|
||||
} else {
|
||||
Print(L"10 args failed: 0x%016x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
9
gnu-efi-3.0/apps/tpause.c
Normal file
9
gnu-efi-3.0/apps/tpause.c
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
EFI_STATUS
|
||||
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
Print(L"Press `q' to quit, any other key to continue:\n");
|
||||
|
||||
}
|
||||
43
gnu-efi-3.0/apps/trivial.S
Normal file
43
gnu-efi-3.0/apps/trivial.S
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
.text
|
||||
.align 4
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
#if 0
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
pushl %ebx # save ebx
|
||||
movl 12(%ebp),%eax # eax <- systab
|
||||
movl 24(%eax),%ebx # ebx <- systab->FirmwareVendor
|
||||
pushl %ebx
|
||||
movl 44(%eax),%ebx # ebx <- systab->ConOut
|
||||
pushl %ebx
|
||||
movl 4(%ebx),%eax # eax <- conout->OutputString
|
||||
call *%eax
|
||||
movl -4(%ebp),%ebx # restore ebx
|
||||
leave
|
||||
ret
|
||||
|
||||
#else
|
||||
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
pushl %ebx
|
||||
call 0f
|
||||
0: popl %eax
|
||||
addl $hello-0b,%eax
|
||||
pushl %eax
|
||||
movl 12(%ebp),%eax # eax <- systab
|
||||
movl 44(%eax),%ebx # ebx <- systab->ConOut
|
||||
pushl %ebx
|
||||
movl 4(%ebx),%eax # eax <- conout->OutputString
|
||||
call *%eax
|
||||
movl -4(%ebp),%ebx
|
||||
leave
|
||||
ret
|
||||
|
||||
.section .rodata
|
||||
.align 2
|
||||
hello: .byte 'h',0,'e',0,'l',0,'l',0,'o',0,'\n',0,'\r',0,0,0
|
||||
|
||||
#endif
|
||||
155
gnu-efi-3.0/debian/changelog
Normal file
155
gnu-efi-3.0/debian/changelog
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
gnu-efi (3.0i-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
+ Support for FreeBSD (closes: #535696).
|
||||
|
||||
* debian/control:
|
||||
+ Make kfreebsd-amd64 a supported architecture.
|
||||
+ Build-depend on gcc-multilib on kfreebsd-amd64 too.
|
||||
* debian/rules:
|
||||
+ Add support for both kfreebsd-{i386,amd64}.
|
||||
+ Install FreeBSD x86_64 linker script on kfreebsd-amd64.
|
||||
+ Do not install ia64-specific headers on i386/amd64, do not install
|
||||
i386/amd64-specific headers on ia64.
|
||||
|
||||
-- Julien BLACHE <jblache@debian.org> Sat, 12 Sep 2009 11:38:57 +0200
|
||||
|
||||
gnu-efi (3.0h-1) unstable; urgency=low
|
||||
|
||||
* Clean up and recover from a broken NMU.
|
||||
|
||||
* debian/control:
|
||||
+ Bump Standards-Version to 3.8.3 (no changes).
|
||||
+ Added myself as uploader.
|
||||
|
||||
* gnuefi/elf_ia32_efi.lds:
|
||||
+ Fix linker script for elf-i386 (closes: #545202).
|
||||
|
||||
-- Julien BLACHE <jblache@debian.org> Fri, 11 Sep 2009 18:26:22 +0200
|
||||
|
||||
gnu-efi (3.0h-0.1) unstable; urgency=low
|
||||
|
||||
* NMU
|
||||
* New upstream version.
|
||||
* Bump to Standards-Version 3.8.2.
|
||||
* Add watch file.
|
||||
* Conflict with libc6-i386 (<= 2.9-18). closes: #533003.
|
||||
|
||||
-- Clint Adams <schizo@debian.org> Sun, 02 Aug 2009 12:06:40 -0400
|
||||
|
||||
gnu-efi (3.0e-3) unstable; urgency=low
|
||||
|
||||
* Non-maintainer upload with maintainer's consent.
|
||||
|
||||
* debian/rules:
|
||||
+ Move files from /emul/ia32-linux to /usr/lib32 (closes: #533003).
|
||||
|
||||
* debian/control:
|
||||
+ Bump Standards-Version to 3.8.1 (no changes).
|
||||
|
||||
-- Julien BLACHE <jblache@debian.org> Wed, 17 Jun 2009 16:41:26 +0200
|
||||
|
||||
gnu-efi (3.0e-2) unstable; urgency=low
|
||||
|
||||
* Fixes wrong lib when cross-building, Closes: #482077
|
||||
* Fixes x86_64 builds on i386, Closes: #482078
|
||||
* Acknowledge NMU, Closes: #473721
|
||||
|
||||
-- Nigel Croxon <nigel.croxon@hp.com> Wed, 04 Jun 2008 15:11:12 -0600
|
||||
|
||||
gnu-efi (3.0e-1.1) unstable; urgency=low
|
||||
|
||||
* Non-maintainer upload.
|
||||
* Fix installing below /emul/ia32-linux/usr/lib (not /usr/lib32) on
|
||||
AMD64. This closes: bug#473721.
|
||||
|
||||
-- Jonas Smedegaard <dr@jones.dk> Wed, 30 Apr 2008 01:22:35 +0200
|
||||
|
||||
gnu-efi (3.0e-1) unstable; urgency=low
|
||||
|
||||
* Fixes x86_64 clobbering registers
|
||||
* Added binutils >= 2.17.50.0.14, Closes: #461640
|
||||
* fixes installs parts of its build system, Closes: #439092
|
||||
|
||||
-- Nigel Croxon <nigel.croxon@hp.com> Mon, 31 Mar 2008 09:31:52 -0600
|
||||
|
||||
gnu-efi (3.0d-1) unstable; urgency=low
|
||||
|
||||
* new (sponsored) maintainer
|
||||
* Add patches to support x86_64 from C.Narayanan (Intel)
|
||||
with support on EFI 1.10 and UEFI 2.0 firmware.
|
||||
* new upstream version, Closes: #376000
|
||||
* fixes x86_64 elilo support, Closes: #438954
|
||||
* Added support for amd64, Closes: #383801
|
||||
|
||||
-- Nigel Croxon <nigel.croxon@hp.com> Wed, 21 Aug 2007 14:12:09 -0600
|
||||
|
||||
gnu-efi (3.0c-1) unstable; urgency=low
|
||||
|
||||
* new upstream version, described as a maintenance release for
|
||||
compatibility with current gcc and binutils versions
|
||||
|
||||
-- Bdale Garbee <bdale@gag.com> Fri, 24 Mar 2006 05:02:28 -0700
|
||||
|
||||
gnu-efi (3.0b-1) unstable; urgency=low
|
||||
|
||||
* new upstream version, closes: #341124
|
||||
* downgrade priority to optional, closes: #280646
|
||||
* fix lib/print.c to prevent printing garbage when items were passed on
|
||||
software stack, closes: #283842
|
||||
|
||||
-- Bdale Garbee <bdale@gag.com> Wed, 7 Dec 2005 20:55:46 -0800
|
||||
|
||||
gnu-efi (3.0a-4) unstable; urgency=low
|
||||
|
||||
* fix gcc path problem in Makefile exposed by build on i386, closes: #215050
|
||||
* merge patches from upstream to address linker problems on i386
|
||||
|
||||
-- Bdale Garbee <bdale@gag.com> Thu, 23 Oct 2003 19:53:19 -0600
|
||||
|
||||
gnu-efi (3.0a-3) unstable; urgency=low
|
||||
|
||||
* add i386 to the list of supported architectures
|
||||
|
||||
-- Bdale Garbee <bdale@gag.com> Mon, 6 Oct 2003 10:04:13 -0600
|
||||
|
||||
gnu-efi (3.0a-2) unstable; urgency=low
|
||||
|
||||
* patch to linker scripts from Matthew Wilcox <willy@debian.org> that
|
||||
allows compilation with GCC 3.3
|
||||
|
||||
-- Bdale Garbee <bdale@gag.com> Wed, 1 Oct 2003 13:52:51 -0600
|
||||
|
||||
gnu-efi (3.0a-1) unstable; urgency=low
|
||||
|
||||
* new upstream version. fixes linker scripts to work with recent compilers,
|
||||
so gnu-efi is buildable from source again.
|
||||
|
||||
-- Bdale Garbee <bdale@gag.com> Tue, 26 Feb 2002 20:50:35 -0700
|
||||
|
||||
gnu-efi (3.0-2) unstable; urgency=low
|
||||
|
||||
* change section to devel, since elilo is a separate package now and this
|
||||
package only provides libs that EFI applications link
|
||||
|
||||
-- Bdale Garbee <bdale@gag.com> Thu, 22 Nov 2001 10:28:15 -0700
|
||||
|
||||
gnu-efi (3.0-1) unstable; urgency=low
|
||||
|
||||
* new upstream version, no longer includes elilo which is now a separate
|
||||
package
|
||||
|
||||
-- Bdale Garbee <bdale@gag.com> Tue, 10 Jul 2001 13:18:50 -0600
|
||||
|
||||
gnu-efi (2.5-1) unstable; urgency=low
|
||||
|
||||
* newer upstream release, repackages to use real upstream source
|
||||
|
||||
-- Bdale Garbee <bdale@gag.com> Tue, 5 Jun 2001 22:51:58 -0600
|
||||
|
||||
gnu-efi (1.1-1) unstable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
-- Randolph Chung <tausq@debian.org> Mon, 15 Jan 2001 21:05:34 -0800
|
||||
|
||||
1
gnu-efi-3.0/debian/compat
Normal file
1
gnu-efi-3.0/debian/compat
Normal file
|
|
@ -0,0 +1 @@
|
|||
5
|
||||
16
gnu-efi-3.0/debian/control
Normal file
16
gnu-efi-3.0/debian/control
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Source: gnu-efi
|
||||
Section: devel
|
||||
Priority: optional
|
||||
Maintainer: Nigel Croxon <nigel.croxon@hp.com>
|
||||
Uploaders: Bdale Garbee <bdale@gag.com>, Julien BLACHE <jblache@debian.org>
|
||||
Build-Depends: debhelper (>> 5), binutils (>= 2.17.50.0.14), gcc-multilib [i386 amd64 kfreebsd-amd64]
|
||||
Standards-Version: 3.8.3
|
||||
|
||||
Package: gnu-efi
|
||||
Architecture: i386 ia64 amd64 kfreebsd-amd64
|
||||
Suggests: elilo
|
||||
Conflicts: libc6-i386 (<= 2.9-18)
|
||||
Description: Library for developing EFI applications
|
||||
GNU toolchain for building applications that can run in the environment
|
||||
presented by Intel's EFI (Extensible Firmware Interface). EFI is a firmware
|
||||
specification for the "BIOS" on ia64(IPF), IA-32(x86) and x86_64 systems.
|
||||
58
gnu-efi-3.0/debian/copyright
Normal file
58
gnu-efi-3.0/debian/copyright
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
This package was debianized by Nigel Croxon <nigel.croxon@hp.com> using sources
|
||||
obtained from
|
||||
|
||||
http://sourceforge.net/projects/gnu-efi
|
||||
|
||||
Copyright:
|
||||
|
||||
Copyright (c) 1999-2007 Hewlett-Packard Development Company, L.P.
|
||||
Contributed by David Mosberger <davidm@hpl.hp.com>
|
||||
Contributed by Stephane Eranian <eranian@hpl.hp.com>
|
||||
|
||||
GNU-EFI is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU-EFI is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU-EFI; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
|
||||
On a Debian system, the GPL can be found in /usr/share/common-licenses/GPL.
|
||||
|
||||
|
||||
The files in the "lib" and "inc" subdirectories are using the EFI Application
|
||||
Toolkit distributed by Intel at http://developer.intel.com/technology/efi
|
||||
|
||||
This code is covered by the following agreement:
|
||||
|
||||
Copyright (c) 1999-2007 Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE. THE EFI SPECIFICATION AND ALL OTHER INFORMATION
|
||||
ON THIS WEB SITE ARE PROVIDED "AS IS" WITH NO WARRANTIES, AND ARE SUBJECT
|
||||
TO CHANGE WITHOUT NOTICE.
|
||||
2
gnu-efi-3.0/debian/dirs
Normal file
2
gnu-efi-3.0/debian/dirs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
usr/include/efi
|
||||
usr/lib
|
||||
3
gnu-efi-3.0/debian/docs
Normal file
3
gnu-efi-3.0/debian/docs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
README.efilib
|
||||
README.gnuefi
|
||||
README.elilo
|
||||
109
gnu-efi-3.0/debian/rules
Executable file
109
gnu-efi-3.0/debian/rules
Executable file
|
|
@ -0,0 +1,109 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
buildarch := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
|
||||
ifneq (,$(findstring i386,$(buildarch)))
|
||||
efiarch := ia32
|
||||
else ifneq (,$(findstring amd64,$(buildarch)))
|
||||
efiarch := x86_64
|
||||
else
|
||||
efiarch := $(buildarch)
|
||||
endif
|
||||
|
||||
build: build-stamp
|
||||
build-stamp:
|
||||
dh_testdir
|
||||
|
||||
ifneq (,$(findstring amd64,$(buildarch)))
|
||||
mkdir build-ia32
|
||||
$(MAKE) -C build-ia32 -f ../Makefile SRCDIR=.. ARCH=ia32
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring i386,$(buildarch)))
|
||||
mkdir build-x86_64
|
||||
$(MAKE) -C build-x86_64 -f ../Makefile SRCDIR=.. ARCH=x86_64
|
||||
endif
|
||||
|
||||
$(MAKE)
|
||||
|
||||
touch build-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
[ ! -f Makefile ] || $(MAKE) clean
|
||||
rm -rf build-ia32 build-x86_64
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs -A
|
||||
|
||||
# gnu-efi files
|
||||
cp -r inc/* debian/gnu-efi/usr/include/efi/
|
||||
rm debian/gnu-efi/usr/include/efi/Makefile
|
||||
rm debian/gnu-efi/usr/include/efi/inc.mak
|
||||
rm debian/gnu-efi/usr/include/efi/make.inf
|
||||
rm debian/gnu-efi/usr/include/efi/makefile.hdr
|
||||
rm debian/gnu-efi/usr/include/efi/protocol/make.inf
|
||||
rm debian/gnu-efi/usr/include/efi/protocol/makefile.hdr
|
||||
rm debian/gnu-efi/usr/include/efi/protocol/readme.txt
|
||||
ifeq ($(buildarch),ia64)
|
||||
rm -rf debian/gnu-efi/usr/include/efi/ia32
|
||||
rm -rf debian/gnu-efi/usr/include/efi/x84_64
|
||||
else
|
||||
rm -rf debian/gnu-efi/usr/include/efi/ia64
|
||||
endif
|
||||
cp gnuefi/*.a debian/gnu-efi/usr/lib/
|
||||
ifeq ($(buildarch),kfreebsd-amd64)
|
||||
cp gnuefi/elf_$(efiarch)_fbsd_efi.lds debian/gnu-efi/usr/lib
|
||||
else
|
||||
cp gnuefi/elf_$(efiarch)_efi.lds debian/gnu-efi/usr/lib
|
||||
endif
|
||||
cp gnuefi/crt0-efi-$(efiarch).o debian/gnu-efi/usr/lib
|
||||
cp lib/*.a debian/gnu-efi/usr/lib/
|
||||
|
||||
ifneq (,$(findstring amd64,$(buildarch)))
|
||||
mkdir -p debian/gnu-efi/usr/lib32
|
||||
cp build-ia32/gnuefi/*.a debian/gnu-efi/usr/lib32/
|
||||
cp gnuefi/elf_ia32_efi.lds debian/gnu-efi/usr/lib32/
|
||||
cp build-ia32/gnuefi/crt0-efi-ia32.o debian/gnu-efi/usr/lib32/
|
||||
cp build-ia32/lib/*.a debian/gnu-efi/usr/lib32/
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring i386,$(buildarch)))
|
||||
mkdir -p debian/gnu-efi/usr/lib64
|
||||
cp build-x86_64/gnuefi/*.a debian/gnu-efi/usr/lib64/
|
||||
ifeq ($(buildarch),kfreebsd-i386)
|
||||
cp gnuefi/elf_x86_64_fbsd_efi.lds debian/gnu-efi/usr/lib64/
|
||||
else
|
||||
cp gnuefi/elf_x86_64_efi.lds debian/gnu-efi/usr/lib64/
|
||||
endif
|
||||
cp build-x86_64/gnuefi/crt0-efi-x86_64.o debian/gnu-efi/usr/lib64/
|
||||
cp build-x86_64/lib/*.a debian/gnu-efi/usr/lib64/
|
||||
endif
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installdocs -a
|
||||
dh_installchangelogs -a ChangeLog
|
||||
dh_link
|
||||
dh_strip
|
||||
dh_compress
|
||||
dh_fixperms
|
||||
dh_installdeb
|
||||
dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||
2
gnu-efi-3.0/debian/watch
Normal file
2
gnu-efi-3.0/debian/watch
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
version=3
|
||||
http://sf.net/gnu-efi/gnu-efi_(.+)\.orig\.tar\.gz
|
||||
72
gnu-efi-3.0/gnuefi/Makefile
Normal file
72
gnu-efi-3.0/gnuefi/Makefile
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#
|
||||
# Copyright (C) 1999-2001 Hewlett-Packard Co.
|
||||
# Contributed by David Mosberger <davidm@hpl.hp.com>
|
||||
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
# * Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
|
||||
SRCDIR = .
|
||||
|
||||
VPATH = $(SRCDIR)
|
||||
|
||||
include $(SRCDIR)/../Make.defaults
|
||||
|
||||
TOPDIR = $(SRCDIR)/..
|
||||
|
||||
CDIR=$(TOPDIR)/..
|
||||
FILES = reloc_$(ARCH) setjmp_$(ARCH)
|
||||
|
||||
OBJS = $(FILES:%=%.o)
|
||||
|
||||
TARGETS = crt0-efi-$(ARCH).o libgnuefi.a
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
libgnuefi.a: libgnuefi.a($(OBJS))
|
||||
|
||||
clean:
|
||||
rm -f $(TARGETS) *~ *.o $(OBJS)
|
||||
|
||||
install:
|
||||
mkdir -p $(INSTALLROOT)/$(LIBDIR)
|
||||
$(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)/$(LIBDIR)
|
||||
ifneq (,$(findstring FreeBSD,$(OS)))
|
||||
ifeq ($(ARCH),x86_64)
|
||||
$(INSTALL) -m 644 elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)/$(LIBDIR)
|
||||
else
|
||||
$(INSTALL) -m 644 elf_$(ARCH)_efi.lds $(INSTALLROOT)/$(LIBDIR)
|
||||
endif
|
||||
else
|
||||
$(INSTALL) -m 644 elf_$(ARCH)_efi.lds $(INSTALLROOT)/$(LIBDIR)
|
||||
endif
|
||||
|
||||
include $(SRCDIR)/../Make.rules
|
||||
76
gnu-efi-3.0/gnuefi/crt0-efi-ia32.S
Normal file
76
gnu-efi-3.0/gnuefi/crt0-efi-ia32.S
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/* crt0-efi-ia32.S - x86 EFI startup code.
|
||||
Copyright (C) 1999 Hewlett-Packard Co.
|
||||
Contributed by David Mosberger <davidm@hpl.hp.com>.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
* Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.text
|
||||
.align 4
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
|
||||
pushl 12(%ebp) # copy "image" argument
|
||||
pushl 8(%ebp) # copy "systab" argument
|
||||
|
||||
call 0f
|
||||
0: popl %eax
|
||||
movl %eax,%ebx
|
||||
|
||||
addl $ImageBase-0b,%eax # %eax = ldbase
|
||||
addl $_DYNAMIC-0b,%ebx # %ebx = _DYNAMIC
|
||||
|
||||
pushl %ebx # pass _DYNAMIC as second argument
|
||||
pushl %eax # pass ldbase as first argument
|
||||
call _relocate
|
||||
popl %ebx
|
||||
popl %ebx
|
||||
testl %eax,%eax
|
||||
jne .exit
|
||||
|
||||
call efi_main # call app with "image" and "systab" argument
|
||||
|
||||
.exit: leave
|
||||
ret
|
||||
|
||||
// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
|
||||
|
||||
.data
|
||||
dummy: .long 0
|
||||
|
||||
#define IMAGE_REL_ABSOLUTE 0
|
||||
.section .reloc
|
||||
.long dummy // Page RVA
|
||||
.long 10 // Block Size (2*4+2)
|
||||
.word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
|
||||
87
gnu-efi-3.0/gnuefi/crt0-efi-ia64.S
Normal file
87
gnu-efi-3.0/gnuefi/crt0-efi-ia64.S
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/* crt0-efi-ia64.S - IA-64 EFI startup code.
|
||||
Copyright (C) 1999 Hewlett-Packard Co.
|
||||
Contributed by David Mosberger <davidm@hpl.hp.com>.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
* Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
.text
|
||||
.psr abi64
|
||||
.psr lsb
|
||||
.lsb
|
||||
|
||||
.proc _start
|
||||
_start:
|
||||
alloc loc0=ar.pfs,2,2,2,0
|
||||
mov loc1=rp
|
||||
movl out0=@gprel(ImageBase) // out0 <- ImageBase (ldbase)
|
||||
;;
|
||||
add out0=out0,gp
|
||||
movl out1=@gprel(_DYNAMIC) // out1 <- _DYNAMIC
|
||||
;; // avoid WAW on CFM
|
||||
add out1=out1,gp
|
||||
br.call.sptk.few rp=_relocate
|
||||
.Lret0:
|
||||
cmp.ne p6,p0=r0,r8 // r8 == EFI_SUCCESS?
|
||||
(p6) br.cond.sptk.few .exit // no ->
|
||||
|
||||
.Lret1:
|
||||
|
||||
mov out0=in0 // image handle
|
||||
mov out1=in1 // systab
|
||||
br.call.sptk.few rp=efi_main
|
||||
.Lret2:
|
||||
.exit:
|
||||
mov ar.pfs=loc0
|
||||
mov rp=loc1
|
||||
;;
|
||||
br.ret.sptk.few rp
|
||||
|
||||
.endp _start
|
||||
|
||||
|
||||
// PE32+ wants a PLABEL, not the code address of the entry point:
|
||||
|
||||
.align 16
|
||||
.global _start_plabel
|
||||
.section .plabel, "a"
|
||||
_start_plabel:
|
||||
data8 _start
|
||||
data8 __gp
|
||||
|
||||
// hand-craft a .reloc section for the plabel:
|
||||
|
||||
#define IMAGE_REL_BASED_DIR64 10
|
||||
|
||||
.section .reloc, "a"
|
||||
data4 _start_plabel // Page RVA
|
||||
data4 12 // Block Size (2*4+2*2)
|
||||
data2 (IMAGE_REL_BASED_DIR64<<12) + 0 // reloc for plabel's entry point
|
||||
data2 (IMAGE_REL_BASED_DIR64<<12) + 8 // reloc for plabel's global pointer
|
||||
76
gnu-efi-3.0/gnuefi/crt0-efi-x86_64.S
Normal file
76
gnu-efi-3.0/gnuefi/crt0-efi-x86_64.S
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/* crt0-efi-x86_64.S - x86_64 EFI startup code.
|
||||
Copyright (C) 1999 Hewlett-Packard Co.
|
||||
Contributed by David Mosberger <davidm@hpl.hp.com>.
|
||||
Copyright (C) 2005 Intel Co.
|
||||
Contributed by Fenghua Yu <fenghua.yu@intel.com>.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
* Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
.text
|
||||
.align 4
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
subq $8, %rsp
|
||||
pushq %rcx
|
||||
pushq %rdx
|
||||
|
||||
0:
|
||||
lea ImageBase(%rip), %rdi
|
||||
lea _DYNAMIC(%rip), %rsi
|
||||
|
||||
popq %rcx
|
||||
popq %rdx
|
||||
pushq %rcx
|
||||
pushq %rdx
|
||||
call _relocate
|
||||
|
||||
popq %rdi
|
||||
popq %rsi
|
||||
|
||||
call efi_main
|
||||
addq $8, %rsp
|
||||
|
||||
.exit:
|
||||
ret
|
||||
|
||||
// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
|
||||
|
||||
.data
|
||||
dummy: .long 0
|
||||
|
||||
#define IMAGE_REL_ABSOLUTE 0
|
||||
.section .reloc, "a"
|
||||
label1:
|
||||
.long dummy-label1 // Page RVA
|
||||
.long 10 // Block Size (2*4+2)
|
||||
.word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
|
||||
|
||||
75
gnu-efi-3.0/gnuefi/elf_ia32_efi.lds
Normal file
75
gnu-efi-3.0/gnuefi/elf_ia32_efi.lds
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
|
||||
OUTPUT_ARCH(i386)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0;
|
||||
ImageBase = .;
|
||||
.hash : { *(.hash) } /* this MUST come first! */
|
||||
. = ALIGN(4096);
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.sdata :
|
||||
{
|
||||
*(.got.plt)
|
||||
*(.got)
|
||||
*(.srodata)
|
||||
*(.sdata)
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.data :
|
||||
{
|
||||
*(.rodata*)
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.data.*)
|
||||
*(.sdata)
|
||||
*(.got.plt)
|
||||
*(.got)
|
||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||
it all into .data: */
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.dynamic : { *(.dynamic) }
|
||||
. = ALIGN(4096);
|
||||
.rel :
|
||||
{
|
||||
*(.rel.data)
|
||||
*(.rel.data.*)
|
||||
*(.rel.got)
|
||||
*(.rel.stab)
|
||||
*(.data.rel.ro.local)
|
||||
*(.data.rel.local)
|
||||
*(.data.rel.ro)
|
||||
*(.data.rel*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.reloc : /* This is the PECOFF .reloc section! */
|
||||
{
|
||||
*(.reloc)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.dynsym : { *(.dynsym) }
|
||||
. = ALIGN(4096);
|
||||
.dynstr : { *(.dynstr) }
|
||||
. = ALIGN(4096);
|
||||
/DISCARD/ :
|
||||
{
|
||||
*(.rel.reloc)
|
||||
*(.eh_frame)
|
||||
*(.note.GNU-stack)
|
||||
}
|
||||
.comment 0 : { *(.comment) }
|
||||
}
|
||||
70
gnu-efi-3.0/gnuefi/elf_ia64_efi.lds
Normal file
70
gnu-efi-3.0/gnuefi/elf_ia64_efi.lds
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
OUTPUT_FORMAT("elf64-ia64-little")
|
||||
OUTPUT_ARCH(ia64)
|
||||
ENTRY(_start_plabel)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0;
|
||||
ImageBase = .;
|
||||
.hash : { *(.hash) } /* this MUST come first! */
|
||||
. = ALIGN(4096);
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
__gp = ALIGN (8) + 0x200000;
|
||||
.sdata :
|
||||
{
|
||||
*(.got.plt)
|
||||
*(.got)
|
||||
*(.srodata)
|
||||
*(.sdata)
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.data :
|
||||
{
|
||||
*(.rodata*)
|
||||
*(.ctors)
|
||||
*(.data*)
|
||||
*(.gnu.linkonce.d*)
|
||||
*(.plabel) /* data whose relocs we want to ignore */
|
||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||
it all into .data: */
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.dynamic : { *(.dynamic) }
|
||||
. = ALIGN(4096);
|
||||
.rela :
|
||||
{
|
||||
*(.rela.text)
|
||||
*(.rela.data*)
|
||||
*(.rela.sdata)
|
||||
*(.rela.got)
|
||||
*(.rela.gnu.linkonce.d*)
|
||||
*(.rela.stab)
|
||||
*(.rela.ctors)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.reloc : /* This is the PECOFF .reloc section! */
|
||||
{
|
||||
*(.reloc)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.dynsym : { *(.dynsym) }
|
||||
. = ALIGN(4096);
|
||||
.dynstr : { *(.dynstr) }
|
||||
/DISCARD/ :
|
||||
{
|
||||
*(.rela.plabel)
|
||||
*(.rela.reloc)
|
||||
*(.IA_64.unwind*)
|
||||
*(.IA64.unwind*)
|
||||
}
|
||||
}
|
||||
63
gnu-efi-3.0/gnuefi/elf_x86_64_efi.lds
Normal file
63
gnu-efi-3.0/gnuefi/elf_x86_64_efi.lds
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
|
||||
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
|
||||
OUTPUT_ARCH(i386:x86-64)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0;
|
||||
ImageBase = .;
|
||||
.hash : { *(.hash) } /* this MUST come first! */
|
||||
. = ALIGN(4096);
|
||||
.eh_frame :
|
||||
{
|
||||
*(.eh_frame)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.reloc :
|
||||
{
|
||||
*(.reloc)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.data :
|
||||
{
|
||||
*(.rodata*)
|
||||
*(.got.plt)
|
||||
*(.got)
|
||||
*(.data*)
|
||||
*(.sdata)
|
||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||
it all into .data: */
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
*(.rel.local)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.dynamic : { *(.dynamic) }
|
||||
. = ALIGN(4096);
|
||||
.rela :
|
||||
{
|
||||
*(.rela.data*)
|
||||
*(.rela.got)
|
||||
*(.rela.stab)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.dynsym : { *(.dynsym) }
|
||||
. = ALIGN(4096);
|
||||
.dynstr : { *(.dynstr) }
|
||||
. = ALIGN(4096);
|
||||
.ignored.reloc :
|
||||
{
|
||||
*(.rela.reloc)
|
||||
*(.eh_frame)
|
||||
*(.note.GNU-stack)
|
||||
}
|
||||
.comment 0 : { *(.comment) }
|
||||
}
|
||||
59
gnu-efi-3.0/gnuefi/elf_x86_64_fbsd_efi.lds
Normal file
59
gnu-efi-3.0/gnuefi/elf_x86_64_fbsd_efi.lds
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/* Same as elf_x86_64_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
|
||||
OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd")
|
||||
OUTPUT_ARCH(i386:x86-64)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0;
|
||||
ImageBase = .;
|
||||
.hash : { *(.hash) } /* this MUST come first! */
|
||||
. = ALIGN(4096);
|
||||
.eh_frame :
|
||||
{
|
||||
*(.eh_frame)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
.reloc :
|
||||
{
|
||||
*(.reloc)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.data :
|
||||
{
|
||||
*(.rodata*)
|
||||
*(.got.plt)
|
||||
*(.got)
|
||||
*(.data*)
|
||||
*(.sdata)
|
||||
/* the EFI loader doesn't seem to like a .bss section, so we stick
|
||||
it all into .data: */
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
*(.rel.local)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.dynamic : { *(.dynamic) }
|
||||
. = ALIGN(4096);
|
||||
.rela :
|
||||
{
|
||||
*(.rela.data*)
|
||||
*(.rela.got)
|
||||
*(.rela.stab)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
.dynsym : { *(.dynsym) }
|
||||
. = ALIGN(4096);
|
||||
.dynstr : { *(.dynstr) }
|
||||
. = ALIGN(4096);
|
||||
.ignored.reloc :
|
||||
{
|
||||
*(.rela.reloc)
|
||||
}
|
||||
}
|
||||
118
gnu-efi-3.0/gnuefi/reloc_ia32.c
Normal file
118
gnu-efi-3.0/gnuefi/reloc_ia32.c
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/* reloc_ia32.c - position independent x86 ELF shared object relocator
|
||||
Copyright (C) 1999 Hewlett-Packard Co.
|
||||
Contributed by David Mosberger <davidm@hpl.hp.com>.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
* Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <elf.h>
|
||||
#include <link.h> /* get _DYNAMIC decl and ElfW and ELFW macros */
|
||||
|
||||
#undef NULL
|
||||
#define uint64_t efi_uint64_t
|
||||
#define int64_t efi_int64_t
|
||||
#define uint32_t efi_uint32_t
|
||||
#define int32_t efi_int32_t
|
||||
#define uint16_t efi_uint16_t
|
||||
#define int16_t efi_int16_t
|
||||
#define uint8_t efi_uint8_t
|
||||
#define int8_t efi_int8_t
|
||||
|
||||
#undef NULL
|
||||
#define uint64_t efi_uint64_t
|
||||
#define int64_t efi_int64_t
|
||||
#define uint32_t efi_uint32_t
|
||||
#define int32_t efi_int32_t
|
||||
#define uint16_t efi_uint16_t
|
||||
#define int16_t efi_int16_t
|
||||
#define uint8_t efi_uint8_t
|
||||
#define int8_t efi_int8_t
|
||||
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
long relsz = 0, relent = 0;
|
||||
ElfW(Rel) *rel = 0;
|
||||
unsigned long *addr;
|
||||
int i;
|
||||
|
||||
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
|
||||
switch (dyn[i].d_tag) {
|
||||
case DT_REL:
|
||||
rel = (ElfW(Rel)*)
|
||||
((unsigned long)dyn[i].d_un.d_ptr
|
||||
+ ldbase);
|
||||
break;
|
||||
|
||||
case DT_RELSZ:
|
||||
relsz = dyn[i].d_un.d_val;
|
||||
break;
|
||||
|
||||
case DT_RELENT:
|
||||
relent = dyn[i].d_un.d_val;
|
||||
break;
|
||||
|
||||
case DT_RELA:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!rel && relent == 0)
|
||||
return EFI_SUCCESS;
|
||||
|
||||
if (!rel || relent == 0)
|
||||
return EFI_LOAD_ERROR;
|
||||
|
||||
while (relsz > 0) {
|
||||
/* apply the relocs */
|
||||
switch (ELF32_R_TYPE (rel->r_info)) {
|
||||
case R_386_NONE:
|
||||
break;
|
||||
|
||||
case R_386_RELATIVE:
|
||||
addr = (unsigned long *)
|
||||
(ldbase + rel->r_offset);
|
||||
*addr += ldbase;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
rel = (ElfW(Rel)*) ((char *) rel + relent);
|
||||
relsz -= relent;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
227
gnu-efi-3.0/gnuefi/reloc_ia64.S
Normal file
227
gnu-efi-3.0/gnuefi/reloc_ia64.S
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
/* reloc_ia64.S - position independent IA-64 ELF shared object relocator
|
||||
Copyright (C) 1999 Hewlett-Packard Co.
|
||||
Contributed by David Mosberger <davidm@hpl.hp.com>.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
* Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is written in assembly because the entire code needs to be position
|
||||
* independent. Note that the compiler does not generate code that's position
|
||||
* independent by itself because it relies on the global offset table being
|
||||
* relocated.
|
||||
*/
|
||||
.text
|
||||
.psr abi64
|
||||
.psr lsb
|
||||
.lsb
|
||||
|
||||
/*
|
||||
* This constant determines how many R_IA64_FPTR64LSB relocations we
|
||||
* can deal with. If you get EFI_BUFFER_TOO_SMALL errors, you may
|
||||
* need to increase this number.
|
||||
*/
|
||||
#define MAX_FUNCTION_DESCRIPTORS 750
|
||||
|
||||
#define ST_VALUE_OFF 8 /* offset of st_value in elf sym */
|
||||
|
||||
#define EFI_SUCCESS 0
|
||||
#define EFI_LOAD_ERROR 1
|
||||
#define EFI_BUFFER_TOO_SMALL 5
|
||||
|
||||
#define DT_NULL 0 /* Marks end of dynamic section */
|
||||
#define DT_RELA 7 /* Address of Rela relocs */
|
||||
#define DT_RELASZ 8 /* Total size of Rela relocs */
|
||||
#define DT_RELAENT 9 /* Size of one Rela reloc */
|
||||
#define DT_SYMTAB 6 /* Address of symbol table */
|
||||
#define DT_SYMENT 11 /* Size of one symbol table entry */
|
||||
|
||||
#define R_IA64_NONE 0
|
||||
#define R_IA64_REL64MSB 0x6e
|
||||
#define R_IA64_REL64LSB 0x6f
|
||||
#define R_IA64_DIR64MSB 0x26
|
||||
#define R_IA64_DIR64LSB 0x27
|
||||
#define R_IA64_FPTR64MSB 0x46
|
||||
#define R_IA64_FPTR64LSB 0x47
|
||||
|
||||
#define ldbase in0 /* load address (address of .text) */
|
||||
#define dyn in1 /* address of _DYNAMIC */
|
||||
|
||||
#define d_tag r16
|
||||
#define d_val r17
|
||||
#define rela r18
|
||||
#define relasz r19
|
||||
#define relaent r20
|
||||
#define addr r21
|
||||
#define r_info r22
|
||||
#define r_offset r23
|
||||
#define r_addend r24
|
||||
#define r_type r25
|
||||
#define r_sym r25 /* alias of r_type ! */
|
||||
#define fptr r26
|
||||
#define fptr_limit r27
|
||||
#define symtab f8
|
||||
#define syment f9
|
||||
#define ftmp f10
|
||||
|
||||
#define target r16
|
||||
#define val r17
|
||||
|
||||
#define NLOC 0
|
||||
|
||||
#define Pnull p6
|
||||
#define Prela p7
|
||||
#define Prelasz p8
|
||||
#define Prelaent p9
|
||||
#define Psymtab p10
|
||||
#define Psyment p11
|
||||
|
||||
#define Pnone p6
|
||||
#define Prel p7
|
||||
#define Pfptr p8
|
||||
|
||||
#define Pmore p6
|
||||
|
||||
#define Poom p6 /* out-of-memory */
|
||||
|
||||
.global _relocate
|
||||
.proc _relocate
|
||||
_relocate:
|
||||
alloc r2=ar.pfs,2,0,0,0
|
||||
movl fptr = @gprel(fptr_mem_base)
|
||||
;;
|
||||
add fptr = fptr, gp
|
||||
movl fptr_limit = @gprel(fptr_mem_limit)
|
||||
;;
|
||||
add fptr_limit = fptr_limit, gp
|
||||
|
||||
search_dynamic:
|
||||
ld8 d_tag = [dyn],8
|
||||
;;
|
||||
ld8 d_val = [dyn],8
|
||||
cmp.eq Pnull,p0 = DT_NULL,d_tag
|
||||
(Pnull) br.cond.sptk.few apply_relocs
|
||||
cmp.eq Prela,p0 = DT_RELA,d_tag
|
||||
cmp.eq Prelasz,p0 = DT_RELASZ,d_tag
|
||||
cmp.eq Psymtab,p0 = DT_SYMTAB,d_tag
|
||||
cmp.eq Psyment,p0 = DT_SYMENT,d_tag
|
||||
cmp.eq Prelaent,p0 = DT_RELAENT,d_tag
|
||||
;;
|
||||
(Prela) add rela = d_val, ldbase
|
||||
(Prelasz) mov relasz = d_val
|
||||
(Prelaent) mov relaent = d_val
|
||||
(Psymtab) add val = d_val, ldbase
|
||||
;;
|
||||
(Psyment) setf.sig syment = d_val
|
||||
;;
|
||||
(Psymtab) setf.sig symtab = val
|
||||
br.sptk.few search_dynamic
|
||||
|
||||
apply_loop:
|
||||
ld8 r_offset = [rela]
|
||||
add addr = 8,rela
|
||||
sub relasz = relasz,relaent
|
||||
;;
|
||||
|
||||
ld8 r_info = [addr],8
|
||||
;;
|
||||
ld8 r_addend = [addr]
|
||||
add target = ldbase, r_offset
|
||||
|
||||
add rela = rela,relaent
|
||||
extr.u r_type = r_info, 0, 32
|
||||
;;
|
||||
cmp.eq Pnone,p0 = R_IA64_NONE,r_type
|
||||
cmp.eq Prel,p0 = R_IA64_REL64LSB,r_type
|
||||
cmp.eq Pfptr,p0 = R_IA64_FPTR64LSB,r_type
|
||||
(Prel) br.cond.sptk.few apply_REL64
|
||||
;;
|
||||
cmp.eq Prel,p0 = R_IA64_DIR64LSB,r_type // treat DIR64 just like REL64
|
||||
|
||||
(Pnone) br.cond.sptk.few apply_relocs
|
||||
(Prel) br.cond.sptk.few apply_REL64
|
||||
(Pfptr) br.cond.sptk.few apply_FPTR64
|
||||
|
||||
mov r8 = EFI_LOAD_ERROR
|
||||
br.ret.sptk.few rp
|
||||
|
||||
apply_relocs:
|
||||
cmp.ltu Pmore,p0=0,relasz
|
||||
(Pmore) br.cond.sptk.few apply_loop
|
||||
|
||||
mov r8 = EFI_SUCCESS
|
||||
br.ret.sptk.few rp
|
||||
|
||||
apply_REL64:
|
||||
ld8 val = [target]
|
||||
;;
|
||||
add val = val,ldbase
|
||||
;;
|
||||
st8 [target] = val
|
||||
br.cond.sptk.few apply_relocs
|
||||
|
||||
// FPTR relocs are a bit more interesting: we need to lookup
|
||||
// the symbol's value in symtab, allocate 16 bytes of memory,
|
||||
// store the value in [target] in the first and the gp in the
|
||||
// second dword.
|
||||
apply_FPTR64:
|
||||
st8 [target] = fptr
|
||||
extr.u r_sym = r_info,32,32
|
||||
add target = 8,fptr
|
||||
;;
|
||||
|
||||
setf.sig ftmp = r_sym
|
||||
mov r8=EFI_BUFFER_TOO_SMALL
|
||||
;;
|
||||
cmp.geu Poom,p0 = fptr,fptr_limit
|
||||
|
||||
xma.lu ftmp = ftmp,syment,symtab
|
||||
(Poom) br.ret.sptk.few rp
|
||||
;;
|
||||
getf.sig addr = ftmp
|
||||
st8 [target] = gp
|
||||
;;
|
||||
add addr = ST_VALUE_OFF, addr
|
||||
;;
|
||||
ld8 val = [addr]
|
||||
;;
|
||||
add val = val,ldbase
|
||||
;;
|
||||
st8 [fptr] = val,16
|
||||
br.cond.sptk.few apply_relocs
|
||||
|
||||
.endp _relocate
|
||||
|
||||
.data
|
||||
.align 16
|
||||
fptr_mem_base:
|
||||
.space MAX_FUNCTION_DESCRIPTORS*16
|
||||
fptr_mem_limit:
|
||||
118
gnu-efi-3.0/gnuefi/reloc_x86_64.c
Normal file
118
gnu-efi-3.0/gnuefi/reloc_x86_64.c
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/* reloc_x86_64.c - position independent x86_64 ELF shared object relocator
|
||||
Copyright (C) 1999 Hewlett-Packard Co.
|
||||
Contributed by David Mosberger <davidm@hpl.hp.com>.
|
||||
Copyright (C) 2005 Intel Co.
|
||||
Contributed by Fenghua Yu <fenghua.yu@intel.com>.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
* Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <elf.h>
|
||||
#include <link.h> /* get _DYNAMIC decl and ElfW and ELFW macros */
|
||||
|
||||
|
||||
#undef NULL
|
||||
#define uint64_t efi_uint64_t
|
||||
#define int64_t efi_int64_t
|
||||
#define uint32_t efi_uint32_t
|
||||
#define int32_t efi_int32_t
|
||||
#define uint16_t efi_uint16_t
|
||||
#define int16_t efi_int16_t
|
||||
#define uint8_t efi_uint8_t
|
||||
#define int8_t efi_int8_t
|
||||
|
||||
#undef NULL
|
||||
#define uint64_t efi_uint64_t
|
||||
#define int64_t efi_int64_t
|
||||
#define uint32_t efi_uint32_t
|
||||
#define int32_t efi_int32_t
|
||||
#define uint16_t efi_uint16_t
|
||||
#define int16_t efi_int16_t
|
||||
#define uint8_t efi_uint8_t
|
||||
#define int8_t efi_int8_t
|
||||
|
||||
#include <efi.h>
|
||||
#include <efilib.h>
|
||||
|
||||
EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
|
||||
{
|
||||
long relsz = 0, relent = 0;
|
||||
ElfW(Rel) *rel = 0;
|
||||
unsigned long *addr;
|
||||
int i;
|
||||
|
||||
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
|
||||
switch (dyn[i].d_tag) {
|
||||
case DT_RELA:
|
||||
rel = (ElfW(Rel)*)
|
||||
((unsigned long)dyn[i].d_un.d_ptr
|
||||
+ ldbase);
|
||||
break;
|
||||
|
||||
case DT_RELASZ:
|
||||
relsz = dyn[i].d_un.d_val;
|
||||
break;
|
||||
|
||||
case DT_RELAENT:
|
||||
relent = dyn[i].d_un.d_val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!rel && relent == 0)
|
||||
return EFI_SUCCESS;
|
||||
|
||||
if (!rel || relent == 0)
|
||||
return EFI_LOAD_ERROR;
|
||||
|
||||
while (relsz > 0) {
|
||||
/* apply the relocs */
|
||||
switch (ELF64_R_TYPE (rel->r_info)) {
|
||||
case R_X86_64_NONE:
|
||||
break;
|
||||
|
||||
case R_X86_64_RELATIVE:
|
||||
addr = (unsigned long *)
|
||||
(ldbase + rel->r_offset);
|
||||
*addr += ldbase;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
rel = (ElfW(Rel)*) ((char *) rel + relent);
|
||||
relsz -= relent;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
87
gnu-efi-3.0/gnuefi/setjmp_ia32.S
Normal file
87
gnu-efi-3.0/gnuefi/setjmp_ia32.S
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* This is stolen from libc/x86/setjmp.S in the OSKit */
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
* C library -- _setjmp, _longjmp
|
||||
*
|
||||
* _longjmp(a,v)
|
||||
* will generate a "return(v)" from
|
||||
* the last call to
|
||||
* _setjmp(a)
|
||||
* by restoring registers from the stack,
|
||||
* The previous signal state is NOT restored.
|
||||
*
|
||||
*/
|
||||
|
||||
#define EXT_C(sym) sym
|
||||
#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x):
|
||||
|
||||
.file "setjmp.S"
|
||||
|
||||
.text
|
||||
|
||||
FUNCTION(setjmp)
|
||||
movl 4(%esp), %ecx /* fetch buffer */
|
||||
movl %ebx, 0(%ecx)
|
||||
movl %esi, 4(%ecx)
|
||||
movl %edi, 8(%ecx)
|
||||
movl %ebp, 12(%ecx) /* save frame pointer of caller */
|
||||
popl %edx
|
||||
movl %esp, 16(%ecx) /* save stack pointer of caller */
|
||||
movl %edx, 20(%ecx) /* save pc of caller */
|
||||
xorl %eax, %eax
|
||||
jmp *%edx
|
||||
|
||||
FUNCTION(longjmp)
|
||||
movl 8(%esp), %eax /* return(v) */
|
||||
movl 4(%esp), %ecx /* fetch buffer */
|
||||
movl 0(%ecx), %ebx
|
||||
movl 4(%ecx), %esi
|
||||
movl 8(%ecx), %edi
|
||||
movl 12(%ecx), %ebp
|
||||
movl 16(%ecx), %esp
|
||||
orl %eax, %eax
|
||||
jnz 0f
|
||||
incl %eax
|
||||
0: jmp *20(%ecx) /* done, return.... */
|
||||
2
gnu-efi-3.0/gnuefi/setjmp_ia64.S
Normal file
2
gnu-efi-3.0/gnuefi/setjmp_ia64.S
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
#warning not implemented
|
||||
56
gnu-efi-3.0/gnuefi/setjmp_x86_64.S
Normal file
56
gnu-efi-3.0/gnuefi/setjmp_x86_64.S
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define EXT_C(sym) sym
|
||||
#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x):
|
||||
|
||||
.file "setjmp.S"
|
||||
|
||||
.text
|
||||
|
||||
/*
|
||||
* int setjmp (jmp_buf env)
|
||||
*/
|
||||
FUNCTION(setjmp)
|
||||
pop %rsi /* Return address, and adjust the stack */
|
||||
xor %rax, %rax
|
||||
movq %rbx, 0(%rdi) /* RBX */
|
||||
movq %rsp, 8(%rdi) /* RSP */
|
||||
push %rsi
|
||||
movq %rbp, 16(%rdi) /* RBP */
|
||||
movq %r12, 24(%rdi) /* R12 */
|
||||
movq %r13, 32(%rdi) /* R13 */
|
||||
movq %r14, 40(%rdi) /* R14 */
|
||||
movq %r15, 48(%rdi) /* R15 */
|
||||
movq %rsi, 56(%rdi) /* RSI */
|
||||
ret
|
||||
|
||||
/*
|
||||
* int longjmp (jmp_buf env, int val)
|
||||
*/
|
||||
FUNCTION(longjmp)
|
||||
movl %esi, %eax
|
||||
movq (%rdi), %rbx
|
||||
movq 8(%rdi), %rsp
|
||||
movq 16(%rdi), %rbp
|
||||
movq 24(%rdi), %r12
|
||||
movq 32(%rdi), %r13
|
||||
movq 40(%rdi), %r14
|
||||
movq 48(%rdi), %r15
|
||||
jmp *56(%rdi)
|
||||
|
||||
27
gnu-efi-3.0/inc/Makefile
Normal file
27
gnu-efi-3.0/inc/Makefile
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
SRCDIR = .
|
||||
|
||||
VPATH = $(SRCDIR)
|
||||
|
||||
include $(SRCDIR)/../Make.defaults
|
||||
|
||||
TOPDIR = $(SRCDIR)/..
|
||||
|
||||
CDIR=$(TOPDIR)/..
|
||||
|
||||
all:
|
||||
|
||||
clean:
|
||||
|
||||
install:
|
||||
mkdir -p $(INSTALLROOT)/include/efi
|
||||
mkdir -p $(INSTALLROOT)/include/efi/protocol
|
||||
mkdir -p $(INSTALLROOT)/include/efi/$(ARCH)
|
||||
$(INSTALL) -m 644 *.h $(INSTALLROOT)/include/efi
|
||||
$(INSTALL) -m 644 protocol/*.h $(INSTALLROOT)/include/efi/protocol
|
||||
$(INSTALL) -m 644 $(ARCH)/*.h $(INSTALLROOT)/include/efi/$(ARCH)
|
||||
ifeq ($(ARCH),ia64)
|
||||
mkdir -p $(INSTALLROOT)/include/efi/protocol/ia64
|
||||
$(INSTALL) -m 644 protocol/ia64/*.h $(INSTALLROOT)/include/efi/protocol/ia64
|
||||
endif
|
||||
|
||||
include $(SRCDIR)/../Make.rules
|
||||
50
gnu-efi-3.0/inc/efi.h
Normal file
50
gnu-efi-3.0/inc/efi.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efi.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Public EFI header files
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Build flags on input
|
||||
// EFI32
|
||||
// EFI_DEBUG - Enable debugging code
|
||||
// EFI_NT_EMULATOR - Building for running under NT
|
||||
//
|
||||
|
||||
|
||||
#ifndef _EFI_INCLUDE_
|
||||
#define _EFI_INCLUDE_
|
||||
|
||||
#define EFI_FIRMWARE_VENDOR L"INTEL"
|
||||
#define EFI_FIRMWARE_MAJOR_REVISION 12
|
||||
#define EFI_FIRMWARE_MINOR_REVISION 33
|
||||
#define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) | (EFI_FIRMWARE_MINOR_REVISION))
|
||||
|
||||
#include "efibind.h"
|
||||
#include "efidef.h"
|
||||
#include "efidevp.h"
|
||||
#include "efipciio.h"
|
||||
#include "efiprot.h"
|
||||
#include "eficon.h"
|
||||
#include "efiser.h"
|
||||
#include "efi_nii.h"
|
||||
#include "efipxebc.h"
|
||||
#include "efinet.h"
|
||||
#include "efiapi.h"
|
||||
#include "efifs.h"
|
||||
#include "efierr.h"
|
||||
#include "efiui.h"
|
||||
|
||||
#endif
|
||||
74
gnu-efi-3.0/inc/efi_nii.h
Normal file
74
gnu-efi-3.0/inc/efi_nii.h
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#ifndef _EFI_NII_H
|
||||
#define _EFI_NII_H
|
||||
|
||||
/*++
|
||||
Copyright (c) 2000 Intel Corporation
|
||||
|
||||
Module name:
|
||||
efi_nii.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision history:
|
||||
2000-Feb-18 M(f)J GUID updated.
|
||||
Structure order changed for machine word alignment.
|
||||
Added StringId[4] to structure.
|
||||
|
||||
2000-Feb-14 M(f)J Genesis.
|
||||
--*/
|
||||
|
||||
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL \
|
||||
{ 0xE18541CD, 0xF755, 0x4f73, {0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29} }
|
||||
|
||||
#define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION 0x00010000
|
||||
|
||||
typedef enum {
|
||||
EfiNetworkInterfaceUndi = 1
|
||||
} EFI_NETWORK_INTERFACE_TYPE;
|
||||
|
||||
typedef struct {
|
||||
|
||||
UINT64 Revision;
|
||||
// Revision of the network interface identifier protocol interface.
|
||||
|
||||
UINT64 ID;
|
||||
// Address of the first byte of the identifying structure for this
|
||||
// network interface. This is set to zero if there is no structure.
|
||||
//
|
||||
// For PXE/UNDI this is the first byte of the !PXE structure.
|
||||
|
||||
UINT64 ImageAddr;
|
||||
// Address of the UNrelocated driver/ROM image. This is set
|
||||
// to zero if there is no driver/ROM image.
|
||||
//
|
||||
// For 16-bit UNDI, this is the first byte of the option ROM in
|
||||
// upper memory.
|
||||
//
|
||||
// For 32/64-bit S/W UNDI, this is the first byte of the EFI ROM
|
||||
// image.
|
||||
//
|
||||
// For H/W UNDI, this is set to zero.
|
||||
|
||||
UINT32 ImageSize;
|
||||
// Size of the UNrelocated driver/ROM image of this network interface.
|
||||
// This is set to zero if there is no driver/ROM image.
|
||||
|
||||
CHAR8 StringId[4];
|
||||
// 4 char ASCII string to go in class identifier (option 60) in DHCP
|
||||
// and Boot Server discover packets.
|
||||
// For EfiNetworkInterfaceUndi this field is "UNDI".
|
||||
// For EfiNetworkInterfaceSnp this field is "SNPN".
|
||||
|
||||
UINT8 Type;
|
||||
UINT8 MajorVer;
|
||||
UINT8 MinorVer;
|
||||
// Information to be placed into the PXE DHCP and Discover packets.
|
||||
// This is the network interface type and version number that will
|
||||
// be placed into DHCP option 94 (client network interface identifier).
|
||||
BOOLEAN Ipv6Supported;
|
||||
UINT8 IfNum; // interface number to be used with pxeid structure
|
||||
} EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE;
|
||||
|
||||
extern EFI_GUID NetworkInterfaceIdentifierProtocol;
|
||||
|
||||
#endif // _EFI_NII_H
|
||||
1743
gnu-efi-3.0/inc/efi_pxe.h
Normal file
1743
gnu-efi-3.0/inc/efi_pxe.h
Normal file
File diff suppressed because it is too large
Load diff
890
gnu-efi-3.0/inc/efiapi.h
Normal file
890
gnu-efi-3.0/inc/efiapi.h
Normal file
|
|
@ -0,0 +1,890 @@
|
|||
#ifndef _EFI_API_H
|
||||
#define _EFI_API_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efiapi.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Global EFI runtime & boot service interfaces
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// EFI Specification Revision
|
||||
//
|
||||
|
||||
#define EFI_SPECIFICATION_MAJOR_REVISION 1
|
||||
#define EFI_SPECIFICATION_MINOR_REVISION 02
|
||||
|
||||
//
|
||||
// Declare forward referenced data structures
|
||||
//
|
||||
|
||||
INTERFACE_DECL(_EFI_SYSTEM_TABLE);
|
||||
|
||||
//
|
||||
// EFI Memory
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ALLOCATE_PAGES) (
|
||||
IN EFI_ALLOCATE_TYPE Type,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN NoPages,
|
||||
OUT EFI_PHYSICAL_ADDRESS *Memory
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FREE_PAGES) (
|
||||
IN EFI_PHYSICAL_ADDRESS Memory,
|
||||
IN UINTN NoPages
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GET_MEMORY_MAP) (
|
||||
IN OUT UINTN *MemoryMapSize,
|
||||
IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,
|
||||
OUT UINTN *MapKey,
|
||||
OUT UINTN *DescriptorSize,
|
||||
OUT UINT32 *DescriptorVersion
|
||||
);
|
||||
|
||||
#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_ALLOCATE_POOL) (
|
||||
IN EFI_MEMORY_TYPE PoolType,
|
||||
IN UINTN Size,
|
||||
OUT VOID **Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FREE_POOL) (
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (
|
||||
IN UINTN MemoryMapSize,
|
||||
IN UINTN DescriptorSize,
|
||||
IN UINT32 DescriptorVersion,
|
||||
IN EFI_MEMORY_DESCRIPTOR *VirtualMap
|
||||
);
|
||||
|
||||
|
||||
#define EFI_OPTIONAL_PTR 0x00000001
|
||||
#define EFI_INTERNAL_FNC 0x00000002 // Pointer to internal runtime fnc
|
||||
#define EFI_INTERNAL_PTR 0x00000004 // Pointer to internal runtime data
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_CONVERT_POINTER) (
|
||||
IN UINTN DebugDisposition,
|
||||
IN OUT VOID **Address
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// EFI Events
|
||||
//
|
||||
|
||||
|
||||
|
||||
#define EVT_TIMER 0x80000000
|
||||
#define EVT_RUNTIME 0x40000000
|
||||
#define EVT_RUNTIME_CONTEXT 0x20000000
|
||||
|
||||
#define EVT_NOTIFY_WAIT 0x00000100
|
||||
#define EVT_NOTIFY_SIGNAL 0x00000200
|
||||
|
||||
#define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201
|
||||
#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
|
||||
|
||||
#define EVT_EFI_SIGNAL_MASK 0x000000FF
|
||||
#define EVT_EFI_SIGNAL_MAX 2
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EFI_EVENT_NOTIFY) (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_CREATE_EVENT) (
|
||||
IN UINT32 Type,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction,
|
||||
IN VOID *NotifyContext,
|
||||
OUT EFI_EVENT *Event
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
TimerCancel,
|
||||
TimerPeriodic,
|
||||
TimerRelative,
|
||||
TimerTypeMax
|
||||
} EFI_TIMER_DELAY;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SET_TIMER) (
|
||||
IN EFI_EVENT Event,
|
||||
IN EFI_TIMER_DELAY Type,
|
||||
IN UINT64 TriggerTime
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIGNAL_EVENT) (
|
||||
IN EFI_EVENT Event
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_WAIT_FOR_EVENT) (
|
||||
IN UINTN NumberOfEvents,
|
||||
IN EFI_EVENT *Event,
|
||||
OUT UINTN *Index
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_CLOSE_EVENT) (
|
||||
IN EFI_EVENT Event
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_CHECK_EVENT) (
|
||||
IN EFI_EVENT Event
|
||||
);
|
||||
|
||||
//
|
||||
// Task priority level
|
||||
//
|
||||
|
||||
#define TPL_APPLICATION 4
|
||||
#define TPL_CALLBACK 8
|
||||
#define TPL_NOTIFY 16
|
||||
#define TPL_HIGH_LEVEL 31
|
||||
|
||||
typedef
|
||||
EFI_TPL
|
||||
(EFIAPI *EFI_RAISE_TPL) (
|
||||
IN EFI_TPL NewTpl
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EFI_RESTORE_TPL) (
|
||||
IN EFI_TPL OldTpl
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// EFI platform varibles
|
||||
//
|
||||
|
||||
#define EFI_GLOBAL_VARIABLE \
|
||||
{ 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} }
|
||||
|
||||
// Variable attributes
|
||||
#define EFI_VARIABLE_NON_VOLATILE 0x00000001
|
||||
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
|
||||
#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
|
||||
|
||||
// Variable size limitation
|
||||
#define EFI_MAXIMUM_VARIABLE_SIZE 1024
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GET_VARIABLE) (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINT32 *Attributes OPTIONAL,
|
||||
IN OUT UINTN *DataSize,
|
||||
OUT VOID *Data
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (
|
||||
IN OUT UINTN *VariableNameSize,
|
||||
IN OUT CHAR16 *VariableName,
|
||||
IN OUT EFI_GUID *VendorGuid
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SET_VARIABLE) (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN UINT32 Attributes,
|
||||
IN UINTN DataSize,
|
||||
IN VOID *Data
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// EFI Time
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
UINT32 Resolution; // 1e-6 parts per million
|
||||
UINT32 Accuracy; // hertz
|
||||
BOOLEAN SetsToZero; // Set clears sub-second time
|
||||
} EFI_TIME_CAPABILITIES;
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GET_TIME) (
|
||||
OUT EFI_TIME *Time,
|
||||
OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SET_TIME) (
|
||||
IN EFI_TIME *Time
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GET_WAKEUP_TIME) (
|
||||
OUT BOOLEAN *Enabled,
|
||||
OUT BOOLEAN *Pending,
|
||||
OUT EFI_TIME *Time
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SET_WAKEUP_TIME) (
|
||||
IN BOOLEAN Enable,
|
||||
IN EFI_TIME *Time OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Image functions
|
||||
//
|
||||
|
||||
|
||||
// PE32+ Subsystem type for EFI images
|
||||
|
||||
#if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION)
|
||||
#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
|
||||
#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
|
||||
#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
|
||||
#endif
|
||||
|
||||
// PE32+ Machine type for EFI images
|
||||
|
||||
#if !defined(EFI_IMAGE_MACHINE_IA32)
|
||||
#define EFI_IMAGE_MACHINE_IA32 0x014c
|
||||
#endif
|
||||
|
||||
#if !defined(EFI_IMAGE_MACHINE_IA64)
|
||||
#define EFI_IMAGE_MACHINE_IA64 0x0200
|
||||
#endif
|
||||
|
||||
// Image Entry prototype
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_IMAGE_ENTRY_POINT) (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN struct _EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_IMAGE_LOAD) (
|
||||
IN BOOLEAN BootPolicy,
|
||||
IN EFI_HANDLE ParentImageHandle,
|
||||
IN EFI_DEVICE_PATH *FilePath,
|
||||
IN VOID *SourceBuffer OPTIONAL,
|
||||
IN UINTN SourceSize,
|
||||
OUT EFI_HANDLE *ImageHandle
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_IMAGE_START) (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
OUT UINTN *ExitDataSize,
|
||||
OUT CHAR16 **ExitData OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_EXIT) (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_STATUS ExitStatus,
|
||||
IN UINTN ExitDataSize,
|
||||
IN CHAR16 *ExitData OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_IMAGE_UNLOAD) (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
);
|
||||
|
||||
|
||||
// Image handle
|
||||
#define LOADED_IMAGE_PROTOCOL \
|
||||
{ 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
|
||||
|
||||
#define EFI_IMAGE_INFORMATION_REVISION 0x1000
|
||||
typedef struct {
|
||||
UINT32 Revision;
|
||||
EFI_HANDLE ParentHandle;
|
||||
struct _EFI_SYSTEM_TABLE *SystemTable;
|
||||
|
||||
// Source location of image
|
||||
EFI_HANDLE DeviceHandle;
|
||||
EFI_DEVICE_PATH *FilePath;
|
||||
VOID *Reserved;
|
||||
|
||||
// Images load options
|
||||
UINT32 LoadOptionsSize;
|
||||
VOID *LoadOptions;
|
||||
|
||||
// Location of where image was loaded
|
||||
VOID *ImageBase;
|
||||
UINT64 ImageSize;
|
||||
EFI_MEMORY_TYPE ImageCodeType;
|
||||
EFI_MEMORY_TYPE ImageDataType;
|
||||
|
||||
// If the driver image supports a dynamic unload request
|
||||
EFI_IMAGE_UNLOAD Unload;
|
||||
|
||||
} EFI_LOADED_IMAGE;
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_EXIT_BOOT_SERVICES) (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN UINTN MapKey
|
||||
);
|
||||
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_STALL) (
|
||||
IN UINTN Microseconds
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SET_WATCHDOG_TIMER) (
|
||||
IN UINTN Timeout,
|
||||
IN UINT64 WatchdogCode,
|
||||
IN UINTN DataSize,
|
||||
IN CHAR16 *WatchdogData OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_CONNECT_CONTROLLER) (
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE *DriverImageHandle OPTIONAL,
|
||||
IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL,
|
||||
IN BOOLEAN Recursive
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_DISCONNECT_CONTROLLER) (
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE DriverImageHandle OPTIONAL,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL
|
||||
);
|
||||
|
||||
#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
|
||||
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
|
||||
#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
|
||||
#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
|
||||
#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
|
||||
#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_OPEN_PROTOCOL) (
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_GUID *Protocol,
|
||||
OUT VOID **Interface OPTIONAL,
|
||||
IN EFI_HANDLE AgentHandle,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN UINT32 Attributes
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_CLOSE_PROTOCOL) (
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN EFI_HANDLE AgentHandle,
|
||||
IN EFI_HANDLE ControllerHandle
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
EFI_HANDLE AgentHandle;
|
||||
EFI_HANDLE ControllerHandle;
|
||||
UINT32 Attributes;
|
||||
UINT32 OpenCount;
|
||||
} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_GUID *Protocol,
|
||||
OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
|
||||
OUT UINTN *EntryCount
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
|
||||
IN EFI_HANDLE Handle,
|
||||
OUT EFI_GUID ***ProtocolBuffer,
|
||||
OUT UINTN *ProtocolBufferCount
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
AllHandles,
|
||||
ByRegisterNotify,
|
||||
ByProtocol
|
||||
} EFI_LOCATE_SEARCH_TYPE;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
|
||||
IN EFI_LOCATE_SEARCH_TYPE SearchType,
|
||||
IN EFI_GUID *Protocol OPTIONAL,
|
||||
IN VOID *SearchKey OPTIONAL,
|
||||
IN OUT UINTN *NoHandles,
|
||||
OUT EFI_HANDLE **Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LOCATE_PROTOCOL) (
|
||||
IN EFI_GUID *Protocol,
|
||||
IN VOID *Registration OPTIONAL,
|
||||
OUT VOID **Interface
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
|
||||
IN OUT EFI_HANDLE *Handle,
|
||||
...
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
|
||||
IN OUT EFI_HANDLE Handle,
|
||||
...
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_CALCULATE_CRC32) (
|
||||
IN VOID *Data,
|
||||
IN UINTN DataSize,
|
||||
OUT UINT32 *Crc32
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EFI_COPY_MEM) (
|
||||
IN VOID *Destination,
|
||||
IN VOID *Source,
|
||||
IN UINTN Length
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EFI_SET_MEM) (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN UINT8 Value
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_CREATE_EVENT_EX) (
|
||||
IN UINT32 Type,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
|
||||
IN const VOID *NotifyContext OPTIONAL,
|
||||
IN const EFI_GUID EventGroup OPTIONAL,
|
||||
OUT EFI_EVENT *Event
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
EfiResetCold,
|
||||
EfiResetWarm,
|
||||
EfiResetShutdown
|
||||
} EFI_RESET_TYPE;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_RESET_SYSTEM) (
|
||||
IN EFI_RESET_TYPE ResetType,
|
||||
IN EFI_STATUS ResetStatus,
|
||||
IN UINTN DataSize,
|
||||
IN CHAR16 *ResetData OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
|
||||
OUT UINT64 *Count
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
|
||||
OUT UINT32 *HighCount
|
||||
);
|
||||
|
||||
//
|
||||
// Protocol handler functions
|
||||
//
|
||||
|
||||
typedef enum {
|
||||
EFI_NATIVE_INTERFACE,
|
||||
EFI_PCODE_INTERFACE
|
||||
} EFI_INTERFACE_TYPE;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
|
||||
IN OUT EFI_HANDLE *Handle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN EFI_INTERFACE_TYPE InterfaceType,
|
||||
IN VOID *Interface
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN VOID *OldInterface,
|
||||
IN VOID *NewInterface
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN VOID *Interface
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_HANDLE_PROTOCOL) (
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_GUID *Protocol,
|
||||
OUT VOID **Interface
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
|
||||
IN EFI_GUID *Protocol,
|
||||
IN EFI_EVENT Event,
|
||||
OUT VOID **Registration
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LOCATE_HANDLE) (
|
||||
IN EFI_LOCATE_SEARCH_TYPE SearchType,
|
||||
IN EFI_GUID *Protocol OPTIONAL,
|
||||
IN VOID *SearchKey OPTIONAL,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT EFI_HANDLE *Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LOCATE_DEVICE_PATH) (
|
||||
IN EFI_GUID *Protocol,
|
||||
IN OUT EFI_DEVICE_PATH **DevicePath,
|
||||
OUT EFI_HANDLE *Device
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
|
||||
IN EFI_GUID *Guid,
|
||||
IN VOID *Table
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_RESERVED_SERVICE) (
|
||||
);
|
||||
|
||||
//
|
||||
// Standard EFI table header
|
||||
//
|
||||
|
||||
typedef struct _EFI_TABLE_HEARDER {
|
||||
UINT64 Signature;
|
||||
UINT32 Revision;
|
||||
UINT32 HeaderSize;
|
||||
UINT32 CRC32;
|
||||
UINT32 Reserved;
|
||||
} EFI_TABLE_HEADER;
|
||||
|
||||
|
||||
//
|
||||
// EFI Runtime Serivces Table
|
||||
//
|
||||
|
||||
#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552
|
||||
#define EFI_RUNTIME_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
|
||||
|
||||
typedef struct {
|
||||
EFI_TABLE_HEADER Hdr;
|
||||
|
||||
//
|
||||
// Time services
|
||||
//
|
||||
|
||||
EFI_GET_TIME GetTime;
|
||||
EFI_SET_TIME SetTime;
|
||||
EFI_GET_WAKEUP_TIME GetWakeupTime;
|
||||
EFI_SET_WAKEUP_TIME SetWakeupTime;
|
||||
|
||||
//
|
||||
// Virtual memory services
|
||||
//
|
||||
|
||||
EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
|
||||
EFI_CONVERT_POINTER ConvertPointer;
|
||||
|
||||
//
|
||||
// Variable serviers
|
||||
//
|
||||
|
||||
EFI_GET_VARIABLE GetVariable;
|
||||
EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
|
||||
EFI_SET_VARIABLE SetVariable;
|
||||
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
|
||||
EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
|
||||
EFI_RESET_SYSTEM ResetSystem;
|
||||
|
||||
} EFI_RUNTIME_SERVICES;
|
||||
|
||||
|
||||
//
|
||||
// EFI Boot Services Table
|
||||
//
|
||||
|
||||
#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
|
||||
#define EFI_BOOT_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
|
||||
|
||||
typedef struct _EFI_BOOT_SERVICES {
|
||||
|
||||
EFI_TABLE_HEADER Hdr;
|
||||
|
||||
//
|
||||
// Task priority functions
|
||||
//
|
||||
|
||||
EFI_RAISE_TPL RaiseTPL;
|
||||
EFI_RESTORE_TPL RestoreTPL;
|
||||
|
||||
//
|
||||
// Memory functions
|
||||
//
|
||||
|
||||
EFI_ALLOCATE_PAGES AllocatePages;
|
||||
EFI_FREE_PAGES FreePages;
|
||||
EFI_GET_MEMORY_MAP GetMemoryMap;
|
||||
EFI_ALLOCATE_POOL AllocatePool;
|
||||
EFI_FREE_POOL FreePool;
|
||||
|
||||
//
|
||||
// Event & timer functions
|
||||
//
|
||||
|
||||
EFI_CREATE_EVENT CreateEvent;
|
||||
EFI_SET_TIMER SetTimer;
|
||||
EFI_WAIT_FOR_EVENT WaitForEvent;
|
||||
EFI_SIGNAL_EVENT SignalEvent;
|
||||
EFI_CLOSE_EVENT CloseEvent;
|
||||
EFI_CHECK_EVENT CheckEvent;
|
||||
|
||||
//
|
||||
// Protocol handler functions
|
||||
//
|
||||
|
||||
EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
|
||||
EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
|
||||
EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
|
||||
EFI_HANDLE_PROTOCOL HandleProtocol;
|
||||
EFI_HANDLE_PROTOCOL PCHandleProtocol;
|
||||
EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
|
||||
EFI_LOCATE_HANDLE LocateHandle;
|
||||
EFI_LOCATE_DEVICE_PATH LocateDevicePath;
|
||||
EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
|
||||
|
||||
//
|
||||
// Image functions
|
||||
//
|
||||
|
||||
EFI_IMAGE_LOAD LoadImage;
|
||||
EFI_IMAGE_START StartImage;
|
||||
EFI_EXIT Exit;
|
||||
EFI_IMAGE_UNLOAD UnloadImage;
|
||||
EFI_EXIT_BOOT_SERVICES ExitBootServices;
|
||||
|
||||
//
|
||||
// Misc functions
|
||||
//
|
||||
|
||||
EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
|
||||
EFI_STALL Stall;
|
||||
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
|
||||
|
||||
//
|
||||
// DriverSupport Services
|
||||
//
|
||||
|
||||
EFI_CONNECT_CONTROLLER ConnectController;
|
||||
EFI_DISCONNECT_CONTROLLER DisconnectController;
|
||||
|
||||
//
|
||||
// Open and Close Protocol Services
|
||||
//
|
||||
EFI_OPEN_PROTOCOL OpenProtocol;
|
||||
EFI_CLOSE_PROTOCOL CloseProtocol;
|
||||
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
|
||||
|
||||
//
|
||||
// Library Services
|
||||
//
|
||||
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
|
||||
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
|
||||
EFI_LOCATE_PROTOCOL LocateProtocol;
|
||||
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
|
||||
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
|
||||
|
||||
//
|
||||
// 32-bit CRC Services
|
||||
//
|
||||
EFI_CALCULATE_CRC32 CalculateCrc32;
|
||||
|
||||
//
|
||||
// Misc Services
|
||||
//
|
||||
EFI_COPY_MEM CopyMem;
|
||||
EFI_SET_MEM SetMem;
|
||||
EFI_CREATE_EVENT_EX CreateEventEx;
|
||||
} EFI_BOOT_SERVICES;
|
||||
|
||||
|
||||
//
|
||||
// EFI Configuration Table and GUID definitions
|
||||
//
|
||||
|
||||
#define MPS_TABLE_GUID \
|
||||
{ 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
#define ACPI_TABLE_GUID \
|
||||
{ 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
#define ACPI_20_TABLE_GUID \
|
||||
{ 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
|
||||
|
||||
#define SMBIOS_TABLE_GUID \
|
||||
{ 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
#define SAL_SYSTEM_TABLE_GUID \
|
||||
{ 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
|
||||
typedef struct _EFI_CONFIGURATION_TABLE {
|
||||
EFI_GUID VendorGuid;
|
||||
VOID *VendorTable;
|
||||
} EFI_CONFIGURATION_TABLE;
|
||||
|
||||
|
||||
//
|
||||
// EFI System Table
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
|
||||
#define EFI_SYSTEM_TABLE_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
|
||||
|
||||
typedef struct _EFI_SYSTEM_TABLE {
|
||||
EFI_TABLE_HEADER Hdr;
|
||||
|
||||
CHAR16 *FirmwareVendor;
|
||||
UINT32 FirmwareRevision;
|
||||
|
||||
EFI_HANDLE ConsoleInHandle;
|
||||
SIMPLE_INPUT_INTERFACE *ConIn;
|
||||
|
||||
EFI_HANDLE ConsoleOutHandle;
|
||||
SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut;
|
||||
|
||||
EFI_HANDLE StandardErrorHandle;
|
||||
SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr;
|
||||
|
||||
EFI_RUNTIME_SERVICES *RuntimeServices;
|
||||
EFI_BOOT_SERVICES *BootServices;
|
||||
|
||||
UINTN NumberOfTableEntries;
|
||||
EFI_CONFIGURATION_TABLE *ConfigurationTable;
|
||||
|
||||
} EFI_SYSTEM_TABLE;
|
||||
|
||||
#endif
|
||||
|
||||
302
gnu-efi-3.0/inc/eficon.h
Normal file
302
gnu-efi-3.0/inc/eficon.h
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
#ifndef _EFI_CON_H
|
||||
#define _EFI_CON_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
eficon.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI console protocols
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Text output protocol
|
||||
//
|
||||
|
||||
#define SIMPLE_TEXT_OUTPUT_PROTOCOL \
|
||||
{ 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
INTERFACE_DECL(_SIMPLE_TEXT_OUTPUT_INTERFACE);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_RESET) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_OUTPUT_STRING) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN CHAR16 *String
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_TEST_STRING) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN CHAR16 *String
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_QUERY_MODE) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN UINTN ModeNumber,
|
||||
OUT UINTN *Columns,
|
||||
OUT UINTN *Rows
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_SET_MODE) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN UINTN ModeNumber
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN UINTN Attribute
|
||||
);
|
||||
|
||||
#define EFI_BLACK 0x00
|
||||
#define EFI_BLUE 0x01
|
||||
#define EFI_GREEN 0x02
|
||||
#define EFI_CYAN (EFI_BLUE | EFI_GREEN)
|
||||
#define EFI_RED 0x04
|
||||
#define EFI_MAGENTA (EFI_BLUE | EFI_RED)
|
||||
#define EFI_BROWN (EFI_GREEN | EFI_RED)
|
||||
#define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED)
|
||||
#define EFI_BRIGHT 0x08
|
||||
#define EFI_DARKGRAY (EFI_BRIGHT)
|
||||
#define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT)
|
||||
#define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT)
|
||||
#define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT)
|
||||
#define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT)
|
||||
#define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT)
|
||||
#define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT)
|
||||
#define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)
|
||||
|
||||
#define EFI_TEXT_ATTR(f,b) ((f) | ((b) << 4))
|
||||
|
||||
#define EFI_BACKGROUND_BLACK 0x00
|
||||
#define EFI_BACKGROUND_BLUE 0x10
|
||||
#define EFI_BACKGROUND_GREEN 0x20
|
||||
#define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)
|
||||
#define EFI_BACKGROUND_RED 0x40
|
||||
#define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)
|
||||
#define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
|
||||
#define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_CLEAR_SCREEN) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN UINTN Column,
|
||||
IN UINTN Row
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TEXT_ENABLE_CURSOR) (
|
||||
IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This,
|
||||
IN BOOLEAN Enable
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
INT32 MaxMode;
|
||||
// current settings
|
||||
INT32 Mode;
|
||||
INT32 Attribute;
|
||||
INT32 CursorColumn;
|
||||
INT32 CursorRow;
|
||||
BOOLEAN CursorVisible;
|
||||
} SIMPLE_TEXT_OUTPUT_MODE;
|
||||
|
||||
typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE {
|
||||
EFI_TEXT_RESET Reset;
|
||||
|
||||
EFI_TEXT_OUTPUT_STRING OutputString;
|
||||
EFI_TEXT_TEST_STRING TestString;
|
||||
|
||||
EFI_TEXT_QUERY_MODE QueryMode;
|
||||
EFI_TEXT_SET_MODE SetMode;
|
||||
EFI_TEXT_SET_ATTRIBUTE SetAttribute;
|
||||
|
||||
EFI_TEXT_CLEAR_SCREEN ClearScreen;
|
||||
EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;
|
||||
EFI_TEXT_ENABLE_CURSOR EnableCursor;
|
||||
|
||||
// Current mode
|
||||
SIMPLE_TEXT_OUTPUT_MODE *Mode;
|
||||
} SIMPLE_TEXT_OUTPUT_INTERFACE;
|
||||
|
||||
//
|
||||
// Define's for required EFI Unicode Box Draw character
|
||||
//
|
||||
|
||||
#define BOXDRAW_HORIZONTAL 0x2500
|
||||
#define BOXDRAW_VERTICAL 0x2502
|
||||
#define BOXDRAW_DOWN_RIGHT 0x250c
|
||||
#define BOXDRAW_DOWN_LEFT 0x2510
|
||||
#define BOXDRAW_UP_RIGHT 0x2514
|
||||
#define BOXDRAW_UP_LEFT 0x2518
|
||||
#define BOXDRAW_VERTICAL_RIGHT 0x251c
|
||||
#define BOXDRAW_VERTICAL_LEFT 0x2524
|
||||
#define BOXDRAW_DOWN_HORIZONTAL 0x252c
|
||||
#define BOXDRAW_UP_HORIZONTAL 0x2534
|
||||
#define BOXDRAW_VERTICAL_HORIZONTAL 0x253c
|
||||
|
||||
#define BOXDRAW_DOUBLE_HORIZONTAL 0x2550
|
||||
#define BOXDRAW_DOUBLE_VERTICAL 0x2551
|
||||
#define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552
|
||||
#define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553
|
||||
#define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554
|
||||
|
||||
#define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555
|
||||
#define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556
|
||||
#define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557
|
||||
|
||||
#define BOXDRAW_UP_RIGHT_DOUBLE 0x2558
|
||||
#define BOXDRAW_UP_DOUBLE_RIGHT 0x2559
|
||||
#define BOXDRAW_DOUBLE_UP_RIGHT 0x255a
|
||||
|
||||
#define BOXDRAW_UP_LEFT_DOUBLE 0x255b
|
||||
#define BOXDRAW_UP_DOUBLE_LEFT 0x255c
|
||||
#define BOXDRAW_DOUBLE_UP_LEFT 0x255d
|
||||
|
||||
#define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e
|
||||
#define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f
|
||||
#define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560
|
||||
|
||||
#define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561
|
||||
#define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562
|
||||
#define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563
|
||||
|
||||
#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564
|
||||
#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565
|
||||
#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566
|
||||
|
||||
#define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567
|
||||
#define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568
|
||||
#define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569
|
||||
|
||||
#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a
|
||||
#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b
|
||||
#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c
|
||||
|
||||
//
|
||||
// EFI Required Block Elements Code Chart
|
||||
//
|
||||
|
||||
#define BLOCKELEMENT_FULL_BLOCK 0x2588
|
||||
#define BLOCKELEMENT_LIGHT_SHADE 0x2591
|
||||
//
|
||||
// EFI Required Geometric Shapes Code Chart
|
||||
//
|
||||
|
||||
#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2
|
||||
#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba
|
||||
#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc
|
||||
#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4
|
||||
|
||||
//
|
||||
// EFI Required Arrow shapes
|
||||
//
|
||||
|
||||
#define ARROW_UP 0x2191
|
||||
#define ARROW_DOWN 0x2193
|
||||
|
||||
//
|
||||
// Text input protocol
|
||||
//
|
||||
|
||||
#define SIMPLE_TEXT_INPUT_PROTOCOL \
|
||||
{ 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
INTERFACE_DECL(_SIMPLE_INPUT_INTERFACE);
|
||||
|
||||
typedef struct {
|
||||
UINT16 ScanCode;
|
||||
CHAR16 UnicodeChar;
|
||||
} EFI_INPUT_KEY;
|
||||
|
||||
//
|
||||
// Baseline unicode control chars
|
||||
//
|
||||
|
||||
#define CHAR_NULL 0x0000
|
||||
#define CHAR_BACKSPACE 0x0008
|
||||
#define CHAR_TAB 0x0009
|
||||
#define CHAR_LINEFEED 0x000A
|
||||
#define CHAR_CARRIAGE_RETURN 0x000D
|
||||
|
||||
//
|
||||
// Scan codes for base line keys
|
||||
//
|
||||
|
||||
#define SCAN_NULL 0x0000
|
||||
#define SCAN_UP 0x0001
|
||||
#define SCAN_DOWN 0x0002
|
||||
#define SCAN_RIGHT 0x0003
|
||||
#define SCAN_LEFT 0x0004
|
||||
#define SCAN_HOME 0x0005
|
||||
#define SCAN_END 0x0006
|
||||
#define SCAN_INSERT 0x0007
|
||||
#define SCAN_DELETE 0x0008
|
||||
#define SCAN_PAGE_UP 0x0009
|
||||
#define SCAN_PAGE_DOWN 0x000A
|
||||
#define SCAN_F1 0x000B
|
||||
#define SCAN_F2 0x000C
|
||||
#define SCAN_F3 0x000D
|
||||
#define SCAN_F4 0x000E
|
||||
#define SCAN_F5 0x000F
|
||||
#define SCAN_F6 0x0010
|
||||
#define SCAN_F7 0x0011
|
||||
#define SCAN_F8 0x0012
|
||||
#define SCAN_F9 0x0013
|
||||
#define SCAN_F10 0x0014
|
||||
#define SCAN_ESC 0x0017
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_INPUT_RESET) (
|
||||
IN struct _SIMPLE_INPUT_INTERFACE *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_INPUT_READ_KEY) (
|
||||
IN struct _SIMPLE_INPUT_INTERFACE *This,
|
||||
OUT EFI_INPUT_KEY *Key
|
||||
);
|
||||
|
||||
typedef struct _SIMPLE_INPUT_INTERFACE {
|
||||
EFI_INPUT_RESET Reset;
|
||||
EFI_INPUT_READ_KEY ReadKeyStroke;
|
||||
EFI_EVENT WaitForKey;
|
||||
} SIMPLE_INPUT_INTERFACE;
|
||||
|
||||
#endif
|
||||
|
||||
110
gnu-efi-3.0/inc/efidebug.h
Normal file
110
gnu-efi-3.0/inc/efidebug.h
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
#ifndef _EFI_DEBUG_H
|
||||
#define _EFI_DEBUG_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efidebug.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI library debug functions
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
extern UINTN EFIDebug;
|
||||
|
||||
#if EFI_DEBUG
|
||||
|
||||
#define DBGASSERT(a) DbgAssert(__FILE__, __LINE__, #a)
|
||||
#define DEBUG(a) DbgPrint a
|
||||
|
||||
#else
|
||||
|
||||
#define DBGASSERT(a)
|
||||
#define DEBUG(a)
|
||||
|
||||
#endif
|
||||
|
||||
#if EFI_DEBUG_CLEAR_MEMORY
|
||||
|
||||
#define DBGSETMEM(a,l) SetMem(a,l,(CHAR8)BAD_POINTER)
|
||||
|
||||
#else
|
||||
|
||||
#define DBGSETMEM(a,l)
|
||||
|
||||
#endif
|
||||
|
||||
#define D_INIT 0x00000001 // Initialization style messages
|
||||
#define D_WARN 0x00000002 // Warnings
|
||||
#define D_LOAD 0x00000004 // Load events
|
||||
#define D_FS 0x00000008 // EFI File system
|
||||
#define D_POOL 0x00000010 // Alloc & Free's
|
||||
#define D_PAGE 0x00000020 // Alloc & Free's
|
||||
#define D_INFO 0x00000040 // Verbose
|
||||
#define D_VAR 0x00000100 // Variable
|
||||
#define D_PARSE 0x00000200 // Command parsing
|
||||
#define D_BM 0x00000400 // Boot manager
|
||||
#define D_BLKIO 0x00001000 // BlkIo Driver
|
||||
#define D_BLKIO_ULTRA 0x00002000 // BlkIo Driver
|
||||
#define D_NET 0x00004000 // SNI Driver
|
||||
#define D_NET_ULTRA 0x00008000 // SNI Driver
|
||||
#define D_TXTIN 0x00010000 // Simple Input Driver
|
||||
#define D_TXTOUT 0x00020000 // Simple Text Output Driver
|
||||
#define D_ERROR_ATA 0x00040000 // ATA error messages
|
||||
#define D_ERROR 0x80000000 // Error
|
||||
|
||||
#define D_RESERVED 0x7fffC880 // Bits not reserved above
|
||||
|
||||
//
|
||||
// Current Debug level of the system, value of EFIDebug
|
||||
//
|
||||
//#define EFI_DBUG_MASK (D_ERROR | D_WARN | D_LOAD | D_BLKIO | D_INIT)
|
||||
#define EFI_DBUG_MASK (D_ERROR)
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#if EFI_DEBUG
|
||||
|
||||
#define ASSERT(a) if(!(a)) DBGASSERT(a)
|
||||
#define ASSERT_LOCKED(l) if(!(l)->Lock) DBGASSERT(l not locked)
|
||||
#define ASSERT_STRUCT(p,t) DBGASSERT(t not structure), p
|
||||
|
||||
#else
|
||||
|
||||
#define ASSERT(a)
|
||||
#define ASSERT_LOCKED(l)
|
||||
#define ASSERT_STRUCT(p,t)
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Prototypes
|
||||
//
|
||||
|
||||
INTN
|
||||
DbgAssert (
|
||||
CHAR8 *file,
|
||||
INTN lineno,
|
||||
CHAR8 *string
|
||||
);
|
||||
|
||||
INTN
|
||||
DbgPrint (
|
||||
INTN mask,
|
||||
CHAR8 *format,
|
||||
...
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
196
gnu-efi-3.0/inc/efidef.h
Normal file
196
gnu-efi-3.0/inc/efidef.h
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
#ifndef _EFI_DEF_H
|
||||
#define _EFI_DEF_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efidef.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI definitions
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
typedef UINT16 CHAR16;
|
||||
typedef UINT8 CHAR8;
|
||||
typedef UINT8 BOOLEAN;
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE ((BOOLEAN) 1)
|
||||
#define FALSE ((BOOLEAN) 0)
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((VOID *) 0)
|
||||
#endif
|
||||
|
||||
typedef UINTN EFI_STATUS;
|
||||
typedef UINT64 EFI_LBA;
|
||||
typedef UINTN EFI_TPL;
|
||||
typedef VOID *EFI_HANDLE;
|
||||
typedef VOID *EFI_EVENT;
|
||||
|
||||
|
||||
//
|
||||
// Prototype argument decoration for EFI parameters to indicate
|
||||
// their direction
|
||||
//
|
||||
// IN - argument is passed into the function
|
||||
// OUT - argument (pointer) is returned from the function
|
||||
// OPTIONAL - argument is optional
|
||||
//
|
||||
|
||||
#ifndef IN
|
||||
#define IN
|
||||
#define OUT
|
||||
#define OPTIONAL
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// A GUID
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
UINT32 Data1;
|
||||
UINT16 Data2;
|
||||
UINT16 Data3;
|
||||
UINT8 Data4[8];
|
||||
} EFI_GUID;
|
||||
|
||||
|
||||
//
|
||||
// Time
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
UINT16 Year; // 1998 - 20XX
|
||||
UINT8 Month; // 1 - 12
|
||||
UINT8 Day; // 1 - 31
|
||||
UINT8 Hour; // 0 - 23
|
||||
UINT8 Minute; // 0 - 59
|
||||
UINT8 Second; // 0 - 59
|
||||
UINT8 Pad1;
|
||||
UINT32 Nanosecond; // 0 - 999,999,999
|
||||
INT16 TimeZone; // -1440 to 1440 or 2047
|
||||
UINT8 Daylight;
|
||||
UINT8 Pad2;
|
||||
} EFI_TIME;
|
||||
|
||||
// Bit definitions for EFI_TIME.Daylight
|
||||
#define EFI_TIME_ADJUST_DAYLIGHT 0x01
|
||||
#define EFI_TIME_IN_DAYLIGHT 0x02
|
||||
|
||||
// Value definition for EFI_TIME.TimeZone
|
||||
#define EFI_UNSPECIFIED_TIMEZONE 0x07FF
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Networking
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
UINT8 Addr[4];
|
||||
} EFI_IPv4_ADDRESS;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Addr[16];
|
||||
} EFI_IPv6_ADDRESS;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Addr[32];
|
||||
} EFI_MAC_ADDRESS;
|
||||
|
||||
//
|
||||
// Memory
|
||||
//
|
||||
|
||||
typedef UINT64 EFI_PHYSICAL_ADDRESS;
|
||||
typedef UINT64 EFI_VIRTUAL_ADDRESS;
|
||||
|
||||
typedef enum {
|
||||
AllocateAnyPages,
|
||||
AllocateMaxAddress,
|
||||
AllocateAddress,
|
||||
MaxAllocateType
|
||||
} EFI_ALLOCATE_TYPE;
|
||||
|
||||
//Preseve the attr on any range supplied.
|
||||
//ConventialMemory must have WB,SR,SW when supplied.
|
||||
//When allocating from ConventialMemory always make it WB,SR,SW
|
||||
//When returning to ConventialMemory always make it WB,SR,SW
|
||||
//When getting the memory map, or on RT for runtime types
|
||||
|
||||
|
||||
typedef enum {
|
||||
EfiReservedMemoryType,
|
||||
EfiLoaderCode,
|
||||
EfiLoaderData,
|
||||
EfiBootServicesCode,
|
||||
EfiBootServicesData,
|
||||
EfiRuntimeServicesCode,
|
||||
EfiRuntimeServicesData,
|
||||
EfiConventionalMemory,
|
||||
EfiUnusableMemory,
|
||||
EfiACPIReclaimMemory,
|
||||
EfiACPIMemoryNVS,
|
||||
EfiMemoryMappedIO,
|
||||
EfiMemoryMappedIOPortSpace,
|
||||
EfiPalCode,
|
||||
EfiMaxMemoryType
|
||||
} EFI_MEMORY_TYPE;
|
||||
|
||||
// possible caching types for the memory range
|
||||
#define EFI_MEMORY_UC 0x0000000000000001
|
||||
#define EFI_MEMORY_WC 0x0000000000000002
|
||||
#define EFI_MEMORY_WT 0x0000000000000004
|
||||
#define EFI_MEMORY_WB 0x0000000000000008
|
||||
#define EFI_MEMORY_UCE 0x0000000000000010
|
||||
|
||||
// physical memory protection on range
|
||||
#define EFI_MEMORY_WP 0x0000000000001000
|
||||
#define EFI_MEMORY_RP 0x0000000000002000
|
||||
#define EFI_MEMORY_XP 0x0000000000004000
|
||||
|
||||
// range requires a runtime mapping
|
||||
#define EFI_MEMORY_RUNTIME 0x8000000000000000
|
||||
|
||||
#define EFI_MEMORY_DESCRIPTOR_VERSION 1
|
||||
typedef struct {
|
||||
UINT32 Type; // Field size is 32 bits followed by 32 bit pad
|
||||
UINT32 Pad;
|
||||
EFI_PHYSICAL_ADDRESS PhysicalStart; // Field size is 64 bits
|
||||
EFI_VIRTUAL_ADDRESS VirtualStart; // Field size is 64 bits
|
||||
UINT64 NumberOfPages; // Field size is 64 bits
|
||||
UINT64 Attribute; // Field size is 64 bits
|
||||
} EFI_MEMORY_DESCRIPTOR;
|
||||
|
||||
//
|
||||
// International Language
|
||||
//
|
||||
|
||||
typedef UINT8 ISO_639_2;
|
||||
#define ISO_639_2_ENTRY_SIZE 3
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#define EFI_PAGE_SIZE 4096
|
||||
#define EFI_PAGE_MASK 0xFFF
|
||||
#define EFI_PAGE_SHIFT 12
|
||||
|
||||
#define EFI_SIZE_TO_PAGES(a) \
|
||||
( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) )
|
||||
|
||||
#endif
|
||||
402
gnu-efi-3.0/inc/efidevp.h
Normal file
402
gnu-efi-3.0/inc/efidevp.h
Normal file
|
|
@ -0,0 +1,402 @@
|
|||
#ifndef _DEVPATH_H
|
||||
#define _DEVPATH_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
devpath.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Defines for parsing the EFI Device Path structures
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Device Path structures - Section C
|
||||
//
|
||||
|
||||
typedef struct _EFI_DEVICE_PATH {
|
||||
UINT8 Type;
|
||||
UINT8 SubType;
|
||||
UINT8 Length[2];
|
||||
} EFI_DEVICE_PATH;
|
||||
|
||||
#define EFI_DP_TYPE_MASK 0x7F
|
||||
#define EFI_DP_TYPE_UNPACKED 0x80
|
||||
|
||||
//#define END_DEVICE_PATH_TYPE 0xff
|
||||
#define END_DEVICE_PATH_TYPE 0x7f
|
||||
//#define END_DEVICE_PATH_TYPE_UNPACKED 0x7f
|
||||
|
||||
#define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
|
||||
#define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01
|
||||
#define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH))
|
||||
|
||||
|
||||
#define DP_IS_END_TYPE(a)
|
||||
#define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
|
||||
|
||||
#define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK )
|
||||
#define DevicePathSubType(a) ( (a)->SubType )
|
||||
#define DevicePathNodeLength(a) ( ((a)->Length[0]) | ((a)->Length[1] << 8) )
|
||||
#define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a)))
|
||||
//#define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE_UNPACKED )
|
||||
#define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE )
|
||||
#define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
|
||||
#define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) )
|
||||
#define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED )
|
||||
|
||||
|
||||
#define SetDevicePathNodeLength(a,l) { \
|
||||
(a)->Length[0] = (UINT8) (l); \
|
||||
(a)->Length[1] = (UINT8) ((l) >> 8); \
|
||||
}
|
||||
|
||||
#define SetDevicePathEndNode(a) { \
|
||||
(a)->Type = END_DEVICE_PATH_TYPE; \
|
||||
(a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
|
||||
(a)->Length[0] = sizeof(EFI_DEVICE_PATH); \
|
||||
(a)->Length[1] = 0; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
#define HARDWARE_DEVICE_PATH 0x01
|
||||
|
||||
#define HW_PCI_DP 0x01
|
||||
typedef struct _PCI_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT8 Function;
|
||||
UINT8 Device;
|
||||
} PCI_DEVICE_PATH;
|
||||
|
||||
#define HW_PCCARD_DP 0x02
|
||||
typedef struct _PCCARD_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT8 SocketNumber;
|
||||
} PCCARD_DEVICE_PATH;
|
||||
|
||||
#define HW_MEMMAP_DP 0x03
|
||||
typedef struct _MEMMAP_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 MemoryType;
|
||||
EFI_PHYSICAL_ADDRESS StartingAddress;
|
||||
EFI_PHYSICAL_ADDRESS EndingAddress;
|
||||
} MEMMAP_DEVICE_PATH;
|
||||
|
||||
#define HW_VENDOR_DP 0x04
|
||||
typedef struct _VENDOR_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
EFI_GUID Guid;
|
||||
} VENDOR_DEVICE_PATH;
|
||||
|
||||
#define UNKNOWN_DEVICE_GUID \
|
||||
{ 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} }
|
||||
|
||||
typedef struct _UKNOWN_DEVICE_VENDOR_DP {
|
||||
VENDOR_DEVICE_PATH DevicePath;
|
||||
UINT8 LegacyDriveLetter;
|
||||
} UNKNOWN_DEVICE_VENDOR_DEVICE_PATH;
|
||||
|
||||
#define HW_CONTROLLER_DP 0x05
|
||||
typedef struct _CONTROLLER_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Controller;
|
||||
} CONTROLLER_DEVICE_PATH;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
#define ACPI_DEVICE_PATH 0x02
|
||||
|
||||
#define ACPI_DP 0x01
|
||||
typedef struct _ACPI_HID_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 HID;
|
||||
UINT32 UID;
|
||||
} ACPI_HID_DEVICE_PATH;
|
||||
|
||||
#define EXPANDED_ACPI_DP 0x02
|
||||
typedef struct _EXPANDED_ACPI_HID_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 HID;
|
||||
UINT32 UID;
|
||||
UINT32 CID;
|
||||
UINT8 HidStr[1];
|
||||
} EXPANDED_ACPI_HID_DEVICE_PATH;
|
||||
|
||||
//
|
||||
// EISA ID Macro
|
||||
// EISA ID Definition 32-bits
|
||||
// bits[15:0] - three character compressed ASCII EISA ID.
|
||||
// bits[31:16] - binary number
|
||||
// Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
|
||||
//
|
||||
#define PNP_EISA_ID_CONST 0x41d0
|
||||
#define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16))
|
||||
#define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
|
||||
|
||||
#define PNP_EISA_ID_MASK 0xffff
|
||||
#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
|
||||
/*
|
||||
*
|
||||
*/
|
||||
#define MESSAGING_DEVICE_PATH 0x03
|
||||
|
||||
#define MSG_ATAPI_DP 0x01
|
||||
typedef struct _ATAPI_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT8 PrimarySecondary;
|
||||
UINT8 SlaveMaster;
|
||||
UINT16 Lun;
|
||||
} ATAPI_DEVICE_PATH;
|
||||
|
||||
#define MSG_SCSI_DP 0x02
|
||||
typedef struct _SCSI_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT16 Pun;
|
||||
UINT16 Lun;
|
||||
} SCSI_DEVICE_PATH;
|
||||
|
||||
#define MSG_FIBRECHANNEL_DP 0x03
|
||||
typedef struct _FIBRECHANNEL_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Reserved;
|
||||
UINT64 WWN;
|
||||
UINT64 Lun;
|
||||
} FIBRECHANNEL_DEVICE_PATH;
|
||||
|
||||
#define MSG_1394_DP 0x04
|
||||
typedef struct _F1394_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Reserved;
|
||||
UINT64 Guid;
|
||||
} F1394_DEVICE_PATH;
|
||||
|
||||
#define MSG_USB_DP 0x05
|
||||
typedef struct _USB_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT8 Port;
|
||||
UINT8 Endpoint;
|
||||
} USB_DEVICE_PATH;
|
||||
|
||||
#define MSG_USB_CLASS_DP 0x0F
|
||||
typedef struct _USB_CLASS_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT16 VendorId;
|
||||
UINT16 ProductId;
|
||||
UINT8 DeviceClass;
|
||||
UINT8 DeviceSubclass;
|
||||
UINT8 DeviceProtocol;
|
||||
} USB_CLASS_DEVICE_PATH;
|
||||
|
||||
#define MSG_I2O_DP 0x06
|
||||
typedef struct _I2O_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Tid;
|
||||
} I2O_DEVICE_PATH;
|
||||
|
||||
#define MSG_MAC_ADDR_DP 0x0b
|
||||
typedef struct _MAC_ADDR_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
EFI_MAC_ADDRESS MacAddress;
|
||||
UINT8 IfType;
|
||||
} MAC_ADDR_DEVICE_PATH;
|
||||
|
||||
#define MSG_IPv4_DP 0x0c
|
||||
typedef struct _IPv4_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
EFI_IPv4_ADDRESS LocalIpAddress;
|
||||
EFI_IPv4_ADDRESS RemoteIpAddress;
|
||||
UINT16 LocalPort;
|
||||
UINT16 RemotePort;
|
||||
UINT16 Protocol;
|
||||
BOOLEAN StaticIpAddress;
|
||||
} IPv4_DEVICE_PATH;
|
||||
|
||||
#define MSG_IPv6_DP 0x0d
|
||||
typedef struct _IPv6_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
EFI_IPv6_ADDRESS LocalIpAddress;
|
||||
EFI_IPv6_ADDRESS RemoteIpAddress;
|
||||
UINT16 LocalPort;
|
||||
UINT16 RemotePort;
|
||||
UINT16 Protocol;
|
||||
BOOLEAN StaticIpAddress;
|
||||
} IPv6_DEVICE_PATH;
|
||||
|
||||
#define MSG_INFINIBAND_DP 0x09
|
||||
typedef struct _INFINIBAND_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Reserved;
|
||||
UINT64 NodeGuid;
|
||||
UINT64 IocGuid;
|
||||
UINT64 DeviceId;
|
||||
} INFINIBAND_DEVICE_PATH;
|
||||
|
||||
#define MSG_UART_DP 0x0e
|
||||
typedef struct _UART_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 Reserved;
|
||||
UINT64 BaudRate;
|
||||
UINT8 DataBits;
|
||||
UINT8 Parity;
|
||||
UINT8 StopBits;
|
||||
} UART_DEVICE_PATH;
|
||||
|
||||
#define MSG_VENDOR_DP 0x0A
|
||||
/* Use VENDOR_DEVICE_PATH struct */
|
||||
|
||||
#define DEVICE_PATH_MESSAGING_PC_ANSI \
|
||||
{ 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
#define DEVICE_PATH_MESSAGING_VT_100 \
|
||||
{ 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
|
||||
|
||||
#define MEDIA_DEVICE_PATH 0x04
|
||||
|
||||
#define MEDIA_HARDDRIVE_DP 0x01
|
||||
typedef struct _HARDDRIVE_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 PartitionNumber;
|
||||
UINT64 PartitionStart;
|
||||
UINT64 PartitionSize;
|
||||
UINT8 Signature[16];
|
||||
UINT8 MBRType;
|
||||
UINT8 SignatureType;
|
||||
} HARDDRIVE_DEVICE_PATH;
|
||||
|
||||
#define MBR_TYPE_PCAT 0x01
|
||||
#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
|
||||
|
||||
#define SIGNATURE_TYPE_MBR 0x01
|
||||
#define SIGNATURE_TYPE_GUID 0x02
|
||||
|
||||
#define MEDIA_CDROM_DP 0x02
|
||||
typedef struct _CDROM_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT32 BootEntry;
|
||||
UINT64 PartitionStart;
|
||||
UINT64 PartitionSize;
|
||||
} CDROM_DEVICE_PATH;
|
||||
|
||||
#define MEDIA_VENDOR_DP 0x03
|
||||
/* Use VENDOR_DEVICE_PATH struct */
|
||||
|
||||
#define MEDIA_FILEPATH_DP 0x04
|
||||
typedef struct _FILEPATH_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
CHAR16 PathName[1];
|
||||
} FILEPATH_DEVICE_PATH;
|
||||
|
||||
#define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)
|
||||
|
||||
#define MEDIA_PROTOCOL_DP 0x05
|
||||
typedef struct _MEDIA_PROTOCOL_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
EFI_GUID Protocol;
|
||||
} MEDIA_PROTOCOL_DEVICE_PATH;
|
||||
|
||||
|
||||
#define BBS_DEVICE_PATH 0x05
|
||||
#define BBS_BBS_DP 0x01
|
||||
typedef struct _BBS_BBS_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
UINT16 DeviceType;
|
||||
UINT16 StatusFlag;
|
||||
CHAR8 String[1];
|
||||
} BBS_BBS_DEVICE_PATH;
|
||||
|
||||
/* DeviceType definitions - from BBS specification */
|
||||
#define BBS_TYPE_FLOPPY 0x01
|
||||
#define BBS_TYPE_HARDDRIVE 0x02
|
||||
#define BBS_TYPE_CDROM 0x03
|
||||
#define BBS_TYPE_PCMCIA 0x04
|
||||
#define BBS_TYPE_USB 0x05
|
||||
#define BBS_TYPE_EMBEDDED_NETWORK 0x06
|
||||
#define BBS_TYPE_DEV 0x80
|
||||
#define BBS_TYPE_UNKNOWN 0xFF
|
||||
|
||||
typedef union {
|
||||
EFI_DEVICE_PATH DevPath;
|
||||
PCI_DEVICE_PATH Pci;
|
||||
PCCARD_DEVICE_PATH PcCard;
|
||||
MEMMAP_DEVICE_PATH MemMap;
|
||||
VENDOR_DEVICE_PATH Vendor;
|
||||
UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor;
|
||||
CONTROLLER_DEVICE_PATH Controller;
|
||||
ACPI_HID_DEVICE_PATH Acpi;
|
||||
|
||||
ATAPI_DEVICE_PATH Atapi;
|
||||
SCSI_DEVICE_PATH Scsi;
|
||||
FIBRECHANNEL_DEVICE_PATH FibreChannel;
|
||||
|
||||
F1394_DEVICE_PATH F1394;
|
||||
USB_DEVICE_PATH Usb;
|
||||
USB_CLASS_DEVICE_PATH UsbClass;
|
||||
I2O_DEVICE_PATH I2O;
|
||||
MAC_ADDR_DEVICE_PATH MacAddr;
|
||||
IPv4_DEVICE_PATH Ipv4;
|
||||
IPv6_DEVICE_PATH Ipv6;
|
||||
INFINIBAND_DEVICE_PATH InfiniBand;
|
||||
UART_DEVICE_PATH Uart;
|
||||
|
||||
HARDDRIVE_DEVICE_PATH HardDrive;
|
||||
CDROM_DEVICE_PATH CD;
|
||||
|
||||
FILEPATH_DEVICE_PATH FilePath;
|
||||
MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol;
|
||||
|
||||
BBS_BBS_DEVICE_PATH Bbs;
|
||||
|
||||
} EFI_DEV_PATH;
|
||||
|
||||
typedef union {
|
||||
EFI_DEVICE_PATH *DevPath;
|
||||
PCI_DEVICE_PATH *Pci;
|
||||
PCCARD_DEVICE_PATH *PcCard;
|
||||
MEMMAP_DEVICE_PATH *MemMap;
|
||||
VENDOR_DEVICE_PATH *Vendor;
|
||||
UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor;
|
||||
CONTROLLER_DEVICE_PATH *Controller;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
|
||||
ATAPI_DEVICE_PATH *Atapi;
|
||||
SCSI_DEVICE_PATH *Scsi;
|
||||
FIBRECHANNEL_DEVICE_PATH *FibreChannel;
|
||||
|
||||
F1394_DEVICE_PATH *F1394;
|
||||
USB_DEVICE_PATH *Usb;
|
||||
USB_CLASS_DEVICE_PATH *UsbClass;
|
||||
I2O_DEVICE_PATH *I2O;
|
||||
MAC_ADDR_DEVICE_PATH *MacAddr;
|
||||
IPv4_DEVICE_PATH *Ipv4;
|
||||
IPv6_DEVICE_PATH *Ipv6;
|
||||
INFINIBAND_DEVICE_PATH *InfiniBand;
|
||||
UART_DEVICE_PATH *Uart;
|
||||
|
||||
HARDDRIVE_DEVICE_PATH *HardDrive;
|
||||
|
||||
FILEPATH_DEVICE_PATH *FilePath;
|
||||
MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol;
|
||||
|
||||
CDROM_DEVICE_PATH *CD;
|
||||
BBS_BBS_DEVICE_PATH *Bbs;
|
||||
|
||||
} EFI_DEV_PATH_PTR;
|
||||
|
||||
|
||||
#endif
|
||||
60
gnu-efi-3.0/inc/efierr.h
Normal file
60
gnu-efi-3.0/inc/efierr.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#ifndef _EFI_ERR_H
|
||||
#define _EFI_ERR_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efierr.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI error codes
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
#define EFIWARN(a) (a)
|
||||
#define EFI_ERROR(a) (((INTN) a) < 0)
|
||||
|
||||
|
||||
#define EFI_SUCCESS 0
|
||||
#define EFI_LOAD_ERROR EFIERR(1)
|
||||
#define EFI_INVALID_PARAMETER EFIERR(2)
|
||||
#define EFI_UNSUPPORTED EFIERR(3)
|
||||
#define EFI_BAD_BUFFER_SIZE EFIERR(4)
|
||||
#define EFI_BUFFER_TOO_SMALL EFIERR(5)
|
||||
#define EFI_NOT_READY EFIERR(6)
|
||||
#define EFI_DEVICE_ERROR EFIERR(7)
|
||||
#define EFI_WRITE_PROTECTED EFIERR(8)
|
||||
#define EFI_OUT_OF_RESOURCES EFIERR(9)
|
||||
#define EFI_VOLUME_CORRUPTED EFIERR(10)
|
||||
#define EFI_VOLUME_FULL EFIERR(11)
|
||||
#define EFI_NO_MEDIA EFIERR(12)
|
||||
#define EFI_MEDIA_CHANGED EFIERR(13)
|
||||
#define EFI_NOT_FOUND EFIERR(14)
|
||||
#define EFI_ACCESS_DENIED EFIERR(15)
|
||||
#define EFI_NO_RESPONSE EFIERR(16)
|
||||
#define EFI_NO_MAPPING EFIERR(17)
|
||||
#define EFI_TIMEOUT EFIERR(18)
|
||||
#define EFI_NOT_STARTED EFIERR(19)
|
||||
#define EFI_ALREADY_STARTED EFIERR(20)
|
||||
#define EFI_ABORTED EFIERR(21)
|
||||
#define EFI_ICMP_ERROR EFIERR(22)
|
||||
#define EFI_TFTP_ERROR EFIERR(23)
|
||||
#define EFI_PROTOCOL_ERROR EFIERR(24)
|
||||
|
||||
#define EFI_WARN_UNKOWN_GLYPH EFIWARN(1)
|
||||
#define EFI_WARN_DELETE_FAILURE EFIWARN(2)
|
||||
#define EFI_WARN_WRITE_FAILURE EFIWARN(3)
|
||||
#define EFI_WARN_BUFFER_TOO_SMALL EFIWARN(4)
|
||||
|
||||
#endif
|
||||
|
||||
116
gnu-efi-3.0/inc/efifs.h
Normal file
116
gnu-efi-3.0/inc/efifs.h
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
#ifndef _EFI_FS_H
|
||||
#define _EFI_FS_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efifs.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI File System structures
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
//
|
||||
// EFI Partition header (normaly starts in LBA 1)
|
||||
//
|
||||
|
||||
#define EFI_PARTITION_SIGNATURE 0x5053595320494249
|
||||
#define EFI_PARTITION_REVISION 0x00010001
|
||||
#define MIN_EFI_PARTITION_BLOCK_SIZE 512
|
||||
#define EFI_PARTITION_LBA 1
|
||||
|
||||
typedef struct _EFI_PARTITION_HEADER {
|
||||
EFI_TABLE_HEADER Hdr;
|
||||
UINT32 DirectoryAllocationNumber;
|
||||
UINT32 BlockSize;
|
||||
EFI_LBA FirstUsableLba;
|
||||
EFI_LBA LastUsableLba;
|
||||
EFI_LBA UnusableSpace;
|
||||
EFI_LBA FreeSpace;
|
||||
EFI_LBA RootFile;
|
||||
EFI_LBA SecutiryFile;
|
||||
} EFI_PARTITION_HEADER;
|
||||
|
||||
|
||||
//
|
||||
// File header
|
||||
//
|
||||
|
||||
#define EFI_FILE_HEADER_SIGNATURE 0x454c494620494249
|
||||
#define EFI_FILE_HEADER_REVISION 0x00010000
|
||||
#define EFI_FILE_STRING_SIZE 260
|
||||
|
||||
typedef struct _EFI_FILE_HEADER {
|
||||
EFI_TABLE_HEADER Hdr;
|
||||
UINT32 Class;
|
||||
UINT32 LBALOffset;
|
||||
EFI_LBA Parent;
|
||||
UINT64 FileSize;
|
||||
UINT64 FileAttributes;
|
||||
EFI_TIME FileCreateTime;
|
||||
EFI_TIME FileModificationTime;
|
||||
EFI_GUID VendorGuid;
|
||||
CHAR16 FileString[EFI_FILE_STRING_SIZE];
|
||||
} EFI_FILE_HEADER;
|
||||
|
||||
|
||||
//
|
||||
// Return the file's first LBAL which is in the same
|
||||
// logical block as the file header
|
||||
//
|
||||
|
||||
#define EFI_FILE_LBAL(a) ((EFI_LBAL *) (((CHAR8 *) (a)) + (a)->LBALOffset))
|
||||
|
||||
#define EFI_FILE_CLASS_FREE_SPACE 1
|
||||
#define EFI_FILE_CLASS_EMPTY 2
|
||||
#define EFI_FILE_CLASS_NORMAL 3
|
||||
|
||||
|
||||
//
|
||||
// Logical Block Address List - the fundemental block
|
||||
// description structure
|
||||
//
|
||||
|
||||
#define EFI_LBAL_SIGNATURE 0x4c41424c20494249
|
||||
#define EFI_LBAL_REVISION 0x00010000
|
||||
|
||||
typedef struct _EFI_LBAL {
|
||||
EFI_TABLE_HEADER Hdr;
|
||||
UINT32 Class;
|
||||
EFI_LBA Parent;
|
||||
EFI_LBA Next;
|
||||
UINT32 ArraySize;
|
||||
UINT32 ArrayCount;
|
||||
} EFI_LBAL;
|
||||
|
||||
// Array size
|
||||
#define EFI_LBAL_ARRAY_SIZE(lbal,offs,blks) \
|
||||
(((blks) - (offs) - (lbal)->Hdr.HeaderSize) / sizeof(EFI_RL))
|
||||
|
||||
//
|
||||
// Logical Block run-length
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
EFI_LBA Start;
|
||||
UINT64 Length;
|
||||
} EFI_RL;
|
||||
|
||||
//
|
||||
// Return the run-length structure from an LBAL header
|
||||
//
|
||||
|
||||
#define EFI_LBAL_RL(a) ((EFI_RL*) (((CHAR8 *) (a)) + (a)->Hdr.HeaderSize))
|
||||
|
||||
#endif
|
||||
|
||||
68
gnu-efi-3.0/inc/efigpt.h
Normal file
68
gnu-efi-3.0/inc/efigpt.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#ifndef _EFI_GPT_H
|
||||
#define _EFI_GPT_H
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
EfiGpt.h
|
||||
|
||||
Abstract:
|
||||
Include file for EFI partitioning scheme
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#define PRIMARY_PART_HEADER_LBA 1
|
||||
|
||||
typedef struct {
|
||||
EFI_TABLE_HEADER Header;
|
||||
EFI_LBA MyLBA;
|
||||
EFI_LBA AlternateLBA;
|
||||
EFI_LBA FirstUsableLBA;
|
||||
EFI_LBA LastUsableLBA;
|
||||
EFI_GUID DiskGUID;
|
||||
EFI_LBA PartitionEntryLBA;
|
||||
UINT32 NumberOfPartitionEntries;
|
||||
UINT32 SizeOfPartitionEntry;
|
||||
UINT32 PartitionEntryArrayCRC32;
|
||||
} EFI_PARTITION_TABLE_HEADER;
|
||||
|
||||
#define EFI_PTAB_HEADER_ID "EFI PART"
|
||||
|
||||
typedef struct {
|
||||
EFI_GUID PartitionTypeGUID;
|
||||
EFI_GUID UniquePartitionGUID;
|
||||
EFI_LBA StartingLBA;
|
||||
EFI_LBA EndingLBA;
|
||||
UINT64 Attributes;
|
||||
CHAR16 PartitionName[36];
|
||||
} EFI_PARTITION_ENTRY;
|
||||
|
||||
//
|
||||
// EFI Partition Attributes
|
||||
//
|
||||
#define EFI_PART_USED_BY_EFI 0x0000000000000001
|
||||
#define EFI_PART_REQUIRED_TO_FUNCTION 0x0000000000000002
|
||||
#define EFI_PART_USED_BY_OS 0x0000000000000004
|
||||
#define EFI_PART_REQUIRED_BY_OS 0x0000000000000008
|
||||
#define EFI_PART_BACKUP_REQUIRED 0x0000000000000010
|
||||
#define EFI_PART_USER_DATA 0x0000000000000020
|
||||
#define EFI_PART_CRITICAL_USER_DATA 0x0000000000000040
|
||||
#define EFI_PART_REDUNDANT_PARTITION 0x0000000000000080
|
||||
|
||||
#define EFI_PART_TYPE_UNUSED_GUID \
|
||||
{ 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }
|
||||
|
||||
#define EFI_PART_TYPE_EFI_SYSTEM_PART_GUID \
|
||||
{ 0xc12a7328, 0xf81f, 0x11d2, {0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} }
|
||||
|
||||
#define EFI_PART_TYPE_LEGACY_MBR_GUID \
|
||||
{ 0x024dee41, 0x33e7, 0x11d3, {0x9d, 0x69, 0x00, 0x08, 0xc7, 0x81, 0xf3, 0x9f} }
|
||||
|
||||
#endif
|
||||
|
||||
880
gnu-efi-3.0/inc/efilib.h
Normal file
880
gnu-efi-3.0/inc/efilib.h
Normal file
|
|
@ -0,0 +1,880 @@
|
|||
#ifndef _EFILIB_INCLUDE_
|
||||
#define _EFILIB_INCLUDE_
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 2000 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efilib.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI library functions
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "efidebug.h"
|
||||
#include "efipart.h"
|
||||
#include "efilibplat.h"
|
||||
#include "efilink.h"
|
||||
#include "efirtlib.h"
|
||||
#include "pci22.h"
|
||||
#include "libsmbios.h"
|
||||
|
||||
//
|
||||
// Public read-only data in the EFI library
|
||||
//
|
||||
|
||||
extern EFI_SYSTEM_TABLE *ST;
|
||||
extern EFI_BOOT_SERVICES *BS;
|
||||
extern EFI_RUNTIME_SERVICES *RT;
|
||||
|
||||
extern EFI_GUID DevicePathProtocol;
|
||||
extern EFI_GUID LoadedImageProtocol;
|
||||
extern EFI_GUID TextInProtocol;
|
||||
extern EFI_GUID TextOutProtocol;
|
||||
extern EFI_GUID BlockIoProtocol;
|
||||
extern EFI_GUID DiskIoProtocol;
|
||||
extern EFI_GUID FileSystemProtocol;
|
||||
extern EFI_GUID LoadFileProtocol;
|
||||
extern EFI_GUID DeviceIoProtocol;
|
||||
extern EFI_GUID VariableStoreProtocol;
|
||||
extern EFI_GUID LegacyBootProtocol;
|
||||
extern EFI_GUID UnicodeCollationProtocol;
|
||||
extern EFI_GUID SerialIoProtocol;
|
||||
extern EFI_GUID VgaClassProtocol;
|
||||
extern EFI_GUID TextOutSpliterProtocol;
|
||||
extern EFI_GUID ErrorOutSpliterProtocol;
|
||||
extern EFI_GUID TextInSpliterProtocol;
|
||||
extern EFI_GUID SimpleNetworkProtocol;
|
||||
extern EFI_GUID PxeBaseCodeProtocol;
|
||||
extern EFI_GUID PxeCallbackProtocol;
|
||||
extern EFI_GUID NetworkInterfaceIdentifierProtocol;
|
||||
extern EFI_GUID UiProtocol;
|
||||
extern EFI_GUID InternalShellProtocol;
|
||||
extern EFI_GUID PciIoProtocol;
|
||||
|
||||
extern EFI_GUID EfiGlobalVariable;
|
||||
extern EFI_GUID GenericFileInfo;
|
||||
extern EFI_GUID FileSystemInfo;
|
||||
extern EFI_GUID FileSystemVolumeLabelInfo;
|
||||
extern EFI_GUID PcAnsiProtocol;
|
||||
extern EFI_GUID Vt100Protocol;
|
||||
extern EFI_GUID NullGuid;
|
||||
extern EFI_GUID UnknownDevice;
|
||||
|
||||
extern EFI_GUID EfiPartTypeSystemPartitionGuid;
|
||||
extern EFI_GUID EfiPartTypeLegacyMbrGuid;
|
||||
|
||||
extern EFI_GUID MpsTableGuid;
|
||||
extern EFI_GUID AcpiTableGuid;
|
||||
extern EFI_GUID SMBIOSTableGuid;
|
||||
extern EFI_GUID SalSystemTableGuid;
|
||||
|
||||
//
|
||||
// EFI Variable strings
|
||||
//
|
||||
#define LOAD_OPTION_ACTIVE 0x00000001
|
||||
|
||||
#define VarLanguageCodes L"LangCodes"
|
||||
#define VarLanguage L"Lang"
|
||||
#define VarTimeout L"Timeout"
|
||||
#define VarConsoleInp L"ConIn"
|
||||
#define VarConsoleOut L"ConOut"
|
||||
#define VarErrorOut L"ErrOut"
|
||||
#define VarBootOption L"Boot%04x"
|
||||
#define VarBootOrder L"BootOrder"
|
||||
#define VarBootNext L"BootNext"
|
||||
#define VarBootCurrent L"BootCurrent"
|
||||
#define VarDriverOption L"Driver%04x"
|
||||
#define VarDriverOrder L"DriverOrder"
|
||||
#define VarConsoleInpDev L"ConInDev"
|
||||
#define VarConsoleOutDev L"ConOutDev"
|
||||
#define VarErrorOutDev L"ErrOutDev"
|
||||
|
||||
#define LanguageCodeEnglish "eng"
|
||||
|
||||
extern EFI_DEVICE_PATH RootDevicePath[];
|
||||
extern EFI_DEVICE_PATH EndDevicePath[];
|
||||
extern EFI_DEVICE_PATH EndInstanceDevicePath[];
|
||||
|
||||
//
|
||||
// Other public data in the EFI library
|
||||
//
|
||||
|
||||
extern EFI_MEMORY_TYPE PoolAllocationType;
|
||||
|
||||
//
|
||||
// STATIC - Name is internal to the module
|
||||
// INTERNAL - Name is internal to the component (i.e., directory)
|
||||
// BOOTSERVCE - Name of a boot service function
|
||||
//
|
||||
|
||||
#define STATIC
|
||||
#define INTERNAL
|
||||
#define BOOTSERVICE
|
||||
|
||||
//
|
||||
// Prototypes
|
||||
//
|
||||
|
||||
VOID
|
||||
InitializeLib (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
VOID
|
||||
InitializeUnicodeSupport (
|
||||
CHAR8 *LangCode
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIDebugVariable (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
SetCrc (
|
||||
IN OUT EFI_TABLE_HEADER *Hdr
|
||||
);
|
||||
|
||||
VOID
|
||||
SetCrcAltSize (
|
||||
IN UINTN Size,
|
||||
IN OUT EFI_TABLE_HEADER *Hdr
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
CheckCrc (
|
||||
IN UINTN MaxSize,
|
||||
IN OUT EFI_TABLE_HEADER *Hdr
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
CheckCrcAltSize (
|
||||
IN UINTN MaxSize,
|
||||
IN UINTN Size,
|
||||
IN OUT EFI_TABLE_HEADER *Hdr
|
||||
);
|
||||
|
||||
UINT32
|
||||
CalculateCrc (
|
||||
UINT8 *pt,
|
||||
UINTN Size
|
||||
);
|
||||
|
||||
VOID
|
||||
ZeroMem (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
VOID
|
||||
SetMem (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN UINT8 Value
|
||||
);
|
||||
|
||||
VOID
|
||||
CopyMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
INTN
|
||||
CompareMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
INTN
|
||||
StrCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2
|
||||
);
|
||||
|
||||
INTN
|
||||
StrnCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
INTN
|
||||
StriCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2
|
||||
);
|
||||
|
||||
VOID
|
||||
StrLwr (
|
||||
IN CHAR16 *Str
|
||||
);
|
||||
|
||||
VOID
|
||||
StrUpr (
|
||||
IN CHAR16 *Str
|
||||
);
|
||||
|
||||
VOID
|
||||
StrCpy (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
);
|
||||
|
||||
VOID
|
||||
StrCat (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
);
|
||||
|
||||
UINTN
|
||||
StrLen (
|
||||
IN CHAR16 *s1
|
||||
);
|
||||
|
||||
UINTN
|
||||
StrSize (
|
||||
IN CHAR16 *s1
|
||||
);
|
||||
|
||||
CHAR16 *
|
||||
StrDuplicate (
|
||||
IN CHAR16 *Src
|
||||
);
|
||||
|
||||
UINTN
|
||||
strlena (
|
||||
IN CHAR8 *s1
|
||||
);
|
||||
|
||||
UINTN
|
||||
strcmpa (
|
||||
IN CHAR8 *s1,
|
||||
IN CHAR8 *s2
|
||||
);
|
||||
|
||||
UINTN
|
||||
strncmpa (
|
||||
IN CHAR8 *s1,
|
||||
IN CHAR8 *s2,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
UINTN
|
||||
xtoi (
|
||||
CHAR16 *str
|
||||
);
|
||||
|
||||
UINTN
|
||||
Atoi (
|
||||
CHAR16 *str
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
MetaMatch (
|
||||
IN CHAR16 *String,
|
||||
IN CHAR16 *Pattern
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
MetaiMatch (
|
||||
IN CHAR16 *String,
|
||||
IN CHAR16 *Pattern
|
||||
);
|
||||
|
||||
UINT64
|
||||
LShiftU64 (
|
||||
IN UINT64 Operand,
|
||||
IN UINTN Count
|
||||
);
|
||||
|
||||
UINT64
|
||||
RShiftU64 (
|
||||
IN UINT64 Operand,
|
||||
IN UINTN Count
|
||||
);
|
||||
|
||||
UINT64
|
||||
MultU64x32 (
|
||||
IN UINT64 Multiplicand,
|
||||
IN UINTN Multiplier
|
||||
);
|
||||
|
||||
UINT64
|
||||
DivU64x32 (
|
||||
IN UINT64 Dividend,
|
||||
IN UINTN Divisor,
|
||||
OUT UINTN *Remainder OPTIONAL
|
||||
);
|
||||
|
||||
VOID
|
||||
InitializeLock (
|
||||
IN OUT FLOCK *Lock,
|
||||
IN EFI_TPL Priority
|
||||
);
|
||||
|
||||
VOID
|
||||
AcquireLock (
|
||||
IN FLOCK *Lock
|
||||
);
|
||||
|
||||
VOID
|
||||
ReleaseLock (
|
||||
IN FLOCK *Lock
|
||||
);
|
||||
|
||||
|
||||
INTN
|
||||
CompareGuid(
|
||||
IN EFI_GUID *Guid1,
|
||||
IN EFI_GUID *Guid2
|
||||
);
|
||||
|
||||
VOID *
|
||||
AllocatePool (
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
VOID *
|
||||
AllocateZeroPool (
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
VOID *
|
||||
ReallocatePool (
|
||||
IN VOID *OldPool,
|
||||
IN UINTN OldSize,
|
||||
IN UINTN NewSize
|
||||
);
|
||||
|
||||
VOID
|
||||
FreePool (
|
||||
IN VOID *p
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
Output (
|
||||
IN CHAR16 *Str
|
||||
);
|
||||
|
||||
VOID
|
||||
Input (
|
||||
IN CHAR16 *Prompt OPTIONAL,
|
||||
OUT CHAR16 *InStr,
|
||||
IN UINTN StrLen
|
||||
);
|
||||
|
||||
VOID
|
||||
IInput (
|
||||
IN SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut,
|
||||
IN SIMPLE_INPUT_INTERFACE *ConIn,
|
||||
IN CHAR16 *Prompt OPTIONAL,
|
||||
OUT CHAR16 *InStr,
|
||||
IN UINTN StrLen
|
||||
);
|
||||
|
||||
UINTN
|
||||
Print (
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
);
|
||||
|
||||
UINTN
|
||||
SPrint (
|
||||
OUT CHAR16 *Str,
|
||||
IN UINTN StrSize,
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
);
|
||||
|
||||
CHAR16 *
|
||||
PoolPrint (
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
CHAR16 *str;
|
||||
UINTN len;
|
||||
UINTN maxlen;
|
||||
} POOL_PRINT;
|
||||
|
||||
CHAR16 *
|
||||
CatPrint (
|
||||
IN OUT POOL_PRINT *Str,
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
);
|
||||
|
||||
UINTN
|
||||
PrintAt (
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
);
|
||||
|
||||
UINTN
|
||||
IPrint (
|
||||
IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out,
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
);
|
||||
|
||||
UINTN
|
||||
IPrintAt (
|
||||
IN SIMPLE_TEXT_OUTPUT_INTERFACE *Out,
|
||||
IN UINTN Column,
|
||||
IN UINTN Row,
|
||||
IN CHAR16 *fmt,
|
||||
...
|
||||
);
|
||||
|
||||
UINTN
|
||||
APrint (
|
||||
IN CHAR8 *fmt,
|
||||
...
|
||||
);
|
||||
|
||||
VOID
|
||||
ValueToHex (
|
||||
IN CHAR16 *Buffer,
|
||||
IN UINT64 v
|
||||
);
|
||||
|
||||
VOID
|
||||
ValueToString (
|
||||
IN CHAR16 *Buffer,
|
||||
IN BOOLEAN Comma,
|
||||
IN INT64 v
|
||||
);
|
||||
|
||||
VOID
|
||||
TimeToString (
|
||||
OUT CHAR16 *Buffer,
|
||||
IN EFI_TIME *Time
|
||||
);
|
||||
|
||||
VOID
|
||||
GuidToString (
|
||||
OUT CHAR16 *Buffer,
|
||||
IN EFI_GUID *Guid
|
||||
);
|
||||
|
||||
VOID
|
||||
StatusToString (
|
||||
OUT CHAR16 *Buffer,
|
||||
EFI_STATUS Status
|
||||
);
|
||||
|
||||
VOID
|
||||
DumpHex (
|
||||
IN UINTN Indent,
|
||||
IN UINTN Offset,
|
||||
IN UINTN DataSize,
|
||||
IN VOID *UserData
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
GrowBuffer(
|
||||
IN OUT EFI_STATUS *Status,
|
||||
IN OUT VOID **Buffer,
|
||||
IN UINTN BufferSize
|
||||
);
|
||||
|
||||
EFI_MEMORY_DESCRIPTOR *
|
||||
LibMemoryMap (
|
||||
OUT UINTN *NoEntries,
|
||||
OUT UINTN *MapKey,
|
||||
OUT UINTN *DescriptorSize,
|
||||
OUT UINT32 *DescriptorVersion
|
||||
);
|
||||
|
||||
VOID *
|
||||
LibGetVariable (
|
||||
IN CHAR16 *Name,
|
||||
IN EFI_GUID *VendorGuid
|
||||
);
|
||||
|
||||
VOID *
|
||||
LibGetVariableAndSize (
|
||||
IN CHAR16 *Name,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINTN *VarSize
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibDeleteVariable (
|
||||
IN CHAR16 *VarName,
|
||||
IN EFI_GUID *VarGuid
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibInsertToTailOfBootOrder (
|
||||
IN UINT16 BootOption,
|
||||
IN BOOLEAN OnlyInsertIfEmpty
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibLocateProtocol (
|
||||
IN EFI_GUID *ProtocolGuid,
|
||||
OUT VOID **Interface
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibLocateHandle (
|
||||
IN EFI_LOCATE_SEARCH_TYPE SearchType,
|
||||
IN EFI_GUID *Protocol OPTIONAL,
|
||||
IN VOID *SearchKey OPTIONAL,
|
||||
IN OUT UINTN *NoHandles,
|
||||
OUT EFI_HANDLE **Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibLocateHandleByDiskSignature (
|
||||
IN UINT8 MBRType,
|
||||
IN UINT8 SignatureType,
|
||||
IN VOID *Signature,
|
||||
IN OUT UINTN *NoHandles,
|
||||
OUT EFI_HANDLE **Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibInstallProtocolInterfaces (
|
||||
IN OUT EFI_HANDLE *Handle,
|
||||
...
|
||||
);
|
||||
|
||||
VOID
|
||||
LibUninstallProtocolInterfaces (
|
||||
IN EFI_HANDLE Handle,
|
||||
...
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibReinstallProtocolInterfaces (
|
||||
IN OUT EFI_HANDLE *Handle,
|
||||
...
|
||||
);
|
||||
|
||||
EFI_EVENT
|
||||
LibCreateProtocolNotifyEvent (
|
||||
IN EFI_GUID *ProtocolGuid,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction,
|
||||
IN VOID *NotifyContext,
|
||||
OUT VOID *Registration
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
WaitForSingleEvent (
|
||||
IN EFI_EVENT Event,
|
||||
IN UINT64 Timeout OPTIONAL
|
||||
);
|
||||
|
||||
VOID
|
||||
WaitForEventWithTimeout (
|
||||
IN EFI_EVENT Event,
|
||||
IN UINTN Timeout,
|
||||
IN UINTN Row,
|
||||
IN UINTN Column,
|
||||
IN CHAR16 *String,
|
||||
IN EFI_INPUT_KEY TimeoutKey,
|
||||
OUT EFI_INPUT_KEY *Key
|
||||
);
|
||||
|
||||
EFI_FILE_HANDLE
|
||||
LibOpenRoot (
|
||||
IN EFI_HANDLE DeviceHandle
|
||||
);
|
||||
|
||||
EFI_FILE_INFO *
|
||||
LibFileInfo (
|
||||
IN EFI_FILE_HANDLE FHand
|
||||
);
|
||||
|
||||
EFI_FILE_SYSTEM_INFO *
|
||||
LibFileSystemInfo (
|
||||
IN EFI_FILE_HANDLE FHand
|
||||
);
|
||||
|
||||
EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *
|
||||
LibFileSystemVolumeLabelInfo (
|
||||
IN EFI_FILE_HANDLE FHand
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
ValidMBR(
|
||||
IN MASTER_BOOT_RECORD *Mbr,
|
||||
IN EFI_BLOCK_IO *BlkIo
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
LibMatchDevicePaths (
|
||||
IN EFI_DEVICE_PATH *Multi,
|
||||
IN EFI_DEVICE_PATH *Single
|
||||
);
|
||||
|
||||
EFI_DEVICE_PATH *
|
||||
LibDuplicateDevicePathInstance (
|
||||
IN EFI_DEVICE_PATH *DevPath
|
||||
);
|
||||
|
||||
EFI_DEVICE_PATH *
|
||||
DevicePathFromHandle (
|
||||
IN EFI_HANDLE Handle
|
||||
);
|
||||
|
||||
EFI_DEVICE_PATH *
|
||||
DevicePathInstance (
|
||||
IN OUT EFI_DEVICE_PATH **DevicePath,
|
||||
OUT UINTN *Size
|
||||
);
|
||||
|
||||
UINTN
|
||||
DevicePathInstanceCount (
|
||||
IN EFI_DEVICE_PATH *DevicePath
|
||||
);
|
||||
|
||||
EFI_DEVICE_PATH *
|
||||
AppendDevicePath (
|
||||
IN EFI_DEVICE_PATH *Src1,
|
||||
IN EFI_DEVICE_PATH *Src2
|
||||
);
|
||||
|
||||
EFI_DEVICE_PATH *
|
||||
AppendDevicePathNode (
|
||||
IN EFI_DEVICE_PATH *Src1,
|
||||
IN EFI_DEVICE_PATH *Src2
|
||||
);
|
||||
|
||||
EFI_DEVICE_PATH*
|
||||
AppendDevicePathInstance (
|
||||
IN EFI_DEVICE_PATH *Src,
|
||||
IN EFI_DEVICE_PATH *Instance
|
||||
);
|
||||
|
||||
EFI_DEVICE_PATH *
|
||||
FileDevicePath (
|
||||
IN EFI_HANDLE Device OPTIONAL,
|
||||
IN CHAR16 *FileName
|
||||
);
|
||||
|
||||
UINTN
|
||||
DevicePathSize (
|
||||
IN EFI_DEVICE_PATH *DevPath
|
||||
);
|
||||
|
||||
EFI_DEVICE_PATH *
|
||||
DuplicateDevicePath (
|
||||
IN EFI_DEVICE_PATH *DevPath
|
||||
);
|
||||
|
||||
EFI_DEVICE_PATH *
|
||||
UnpackDevicePath (
|
||||
IN EFI_DEVICE_PATH *DevPath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibDevicePathToInterface (
|
||||
IN EFI_GUID *Protocol,
|
||||
IN EFI_DEVICE_PATH *FilePath,
|
||||
OUT VOID **Interface
|
||||
);
|
||||
|
||||
CHAR16 *
|
||||
DevicePathToStr (
|
||||
EFI_DEVICE_PATH *DevPath
|
||||
);
|
||||
|
||||
//
|
||||
// BugBug: I need my own include files
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 Register;
|
||||
UINT8 Function;
|
||||
UINT8 Device;
|
||||
UINT8 Bus;
|
||||
UINT32 Reserved;
|
||||
} EFI_ADDRESS;
|
||||
|
||||
typedef union {
|
||||
UINT64 Address;
|
||||
EFI_ADDRESS EfiAddress;
|
||||
} EFI_PCI_ADDRESS_UNION;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
PciFindDeviceClass (
|
||||
IN OUT EFI_PCI_ADDRESS_UNION *Address,
|
||||
IN UINT8 BaseClass,
|
||||
IN UINT8 SubClass
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
PciFindDevice (
|
||||
IN OUT EFI_PCI_ADDRESS_UNION *DeviceAddress,
|
||||
IN UINT16 VendorId,
|
||||
IN UINT16 DeviceId,
|
||||
IN OUT PCI_TYPE00 *Pci
|
||||
);
|
||||
|
||||
//
|
||||
// SIMPLE_READ_FILE object used to access files
|
||||
//
|
||||
|
||||
typedef VOID *SIMPLE_READ_FILE;
|
||||
|
||||
EFI_STATUS
|
||||
OpenSimpleReadFile (
|
||||
IN BOOLEAN BootPolicy,
|
||||
IN VOID *SourceBuffer OPTIONAL,
|
||||
IN UINTN SourceSize,
|
||||
IN OUT EFI_DEVICE_PATH **FilePath,
|
||||
OUT EFI_HANDLE *DeviceHandle,
|
||||
OUT SIMPLE_READ_FILE *SimpleReadHandle
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
ReadSimpleReadFile (
|
||||
IN SIMPLE_READ_FILE SimpleReadHandle,
|
||||
IN UINTN Offset,
|
||||
IN OUT UINTN *ReadSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
CloseSimpleReadFile (
|
||||
IN SIMPLE_READ_FILE SimpleReadHandle
|
||||
);
|
||||
|
||||
VOID
|
||||
InitializeGuid (
|
||||
VOID
|
||||
);
|
||||
|
||||
UINT8
|
||||
DecimaltoBCD(
|
||||
IN UINT8 DecValue
|
||||
);
|
||||
|
||||
UINT8
|
||||
BCDtoDecimal(
|
||||
IN UINT8 BcdValue
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibGetSystemConfigurationTable(
|
||||
IN EFI_GUID *TableGuid,
|
||||
IN OUT VOID **Table
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
LibIsValidTextGraphics (
|
||||
IN CHAR16 Graphic,
|
||||
OUT CHAR8 *PcAnsi, OPTIONAL
|
||||
OUT CHAR8 *Ascii OPTIONAL
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
IsValidAscii (
|
||||
IN CHAR16 Ascii
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
IsValidEfiCntlChar (
|
||||
IN CHAR16 c
|
||||
);
|
||||
|
||||
CHAR16 *
|
||||
LibGetUiString (
|
||||
IN EFI_HANDLE Handle,
|
||||
IN UI_STRING_TYPE StringType,
|
||||
IN ISO_639_2 *LangCode,
|
||||
IN BOOLEAN ReturnDevicePathStrOnMismatch
|
||||
);
|
||||
|
||||
CHAR8*
|
||||
LibGetSmbiosString (
|
||||
IN SMBIOS_STRUCTURE_POINTER *Smbios,
|
||||
IN UINT16 StringNumber
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibGetSmbiosSystemGuidAndSerialNumber (
|
||||
IN EFI_GUID *SystemGuid,
|
||||
OUT CHAR8 **SystemSerialNumber
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
InitializeGlobalIoDevice (
|
||||
IN EFI_DEVICE_PATH *DevicePath,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN CHAR8 *ErrorStr,
|
||||
OUT EFI_DEVICE_IO_INTERFACE **GlobalIoFncs
|
||||
);
|
||||
|
||||
UINT32
|
||||
ReadPort (
|
||||
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
|
||||
IN EFI_IO_WIDTH Width,
|
||||
IN UINTN Port
|
||||
);
|
||||
|
||||
UINT32
|
||||
WritePort (
|
||||
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
|
||||
IN EFI_IO_WIDTH Width,
|
||||
IN UINTN Port,
|
||||
IN UINTN Data
|
||||
);
|
||||
|
||||
UINT32
|
||||
ReadPciConfig (
|
||||
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
|
||||
IN EFI_IO_WIDTH Width,
|
||||
IN UINTN Port
|
||||
);
|
||||
|
||||
UINT32
|
||||
WritePciConfig (
|
||||
IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
|
||||
IN EFI_IO_WIDTH Width,
|
||||
IN UINTN Port,
|
||||
IN UINTN Data
|
||||
);
|
||||
|
||||
extern EFI_DEVICE_IO_INTERFACE *GlobalIoFncs;
|
||||
|
||||
#define outp(_Port, _DataByte) (UINT8)WritePort(GlobalIoFncs, IO_UINT8, (UINTN)_Port, (UINTN)_DataByte)
|
||||
#define inp(_Port) (UINT8)ReadPort(GlobalIoFncs, IO_UINT8, (UINTN)_Port)
|
||||
#define outpw(_Port, _DataByte) (UINT16)WritePort(GlobalIoFncs, IO_UINT16, (UINTN)_Port, (UINTN)_DataByte)
|
||||
#define inpw(_Port) (UINT16)ReadPort(GlobalIoFncs, IO_UINT16, (UINTN)_Port)
|
||||
#define outpd(_Port, _DataByte) (UINT32)WritePort(GlobalIoFncs, IO_UINT32, (UINTN)_Port, (UINTN)_DataByte)
|
||||
#define inpd(_Port) (UINT32)ReadPort(GlobalIoFncs, IO_UINT32, (UINTN)_Port)
|
||||
|
||||
#define writepci8(_Addr, _DataByte) (UINT8)WritePciConfig(GlobalIoFncs, IO_UINT8, (UINTN)_Addr, (UINTN)_DataByte)
|
||||
#define readpci8(_Addr) (UINT8)ReadPciConfig(GlobalIoFncs, IO_UINT8, (UINTN)_Addr)
|
||||
#define writepci16(_Addr, _DataByte) (UINT16)WritePciConfig(GlobalIoFncs, IO_UINT16, (UINTN)_Addr, (UINTN)_DataByte)
|
||||
#define readpci16(_Addr) (UINT16)ReadPciConfig(GlobalIoFncs, IO_UINT16, (UINTN)_Addr)
|
||||
#define writepci32(_Addr, _DataByte) (UINT32)WritePciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr, (UINTN)_DataByte)
|
||||
#define readpci32(_Addr) (UINT32)ReadPciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr)
|
||||
|
||||
#define Pause() WaitForSingleEvent (ST->ConIn->WaitForKey, 0)
|
||||
#define Port80(_PostCode) GlobalIoFncs->Io.Write (GlobalIoFncs, IO_UINT16, (UINT64)0x80, 1, &(_PostCode))
|
||||
|
||||
#endif
|
||||
177
gnu-efi-3.0/inc/efilink.h
Normal file
177
gnu-efi-3.0/inc/efilink.h
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
#ifndef _EFI_LINK_H
|
||||
#define _EFI_LINK_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
link.h (renamed efilink.h to avoid conflicts)
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI link list macro's
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef EFI_NT_EMUL
|
||||
|
||||
//
|
||||
// List entry - doubly linked list
|
||||
//
|
||||
|
||||
typedef struct _LIST_ENTRY {
|
||||
struct _LIST_ENTRY *Flink;
|
||||
struct _LIST_ENTRY *Blink;
|
||||
} LIST_ENTRY;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// VOID
|
||||
// InitializeListHead(
|
||||
// LIST_ENTRY *ListHead
|
||||
// );
|
||||
//
|
||||
|
||||
#define InitializeListHead(ListHead) \
|
||||
(ListHead)->Flink = ListHead; \
|
||||
(ListHead)->Blink = ListHead;
|
||||
|
||||
//
|
||||
// BOOLEAN
|
||||
// IsListEmpty(
|
||||
// PLIST_ENTRY ListHead
|
||||
// );
|
||||
//
|
||||
|
||||
#define IsListEmpty(ListHead) \
|
||||
((ListHead)->Flink == (ListHead))
|
||||
|
||||
//
|
||||
// VOID
|
||||
// RemoveEntryList(
|
||||
// PLIST_ENTRY Entry
|
||||
// );
|
||||
//
|
||||
|
||||
#define _RemoveEntryList(Entry) { \
|
||||
LIST_ENTRY *_Blink, *_Flink; \
|
||||
_Flink = (Entry)->Flink; \
|
||||
_Blink = (Entry)->Blink; \
|
||||
_Blink->Flink = _Flink; \
|
||||
_Flink->Blink = _Blink; \
|
||||
}
|
||||
|
||||
#if EFI_DEBUG
|
||||
#define RemoveEntryList(Entry) \
|
||||
_RemoveEntryList(Entry); \
|
||||
(Entry)->Flink = (LIST_ENTRY *) BAD_POINTER; \
|
||||
(Entry)->Blink = (LIST_ENTRY *) BAD_POINTER;
|
||||
#else
|
||||
#define RemoveEntryList(Entry) \
|
||||
_RemoveEntryList(Entry);
|
||||
#endif
|
||||
|
||||
//
|
||||
// VOID
|
||||
// InsertTailList(
|
||||
// PLIST_ENTRY ListHead,
|
||||
// PLIST_ENTRY Entry
|
||||
// );
|
||||
//
|
||||
|
||||
#define InsertTailList(ListHead,Entry) {\
|
||||
LIST_ENTRY *_ListHead, *_Blink; \
|
||||
_ListHead = (ListHead); \
|
||||
_Blink = _ListHead->Blink; \
|
||||
(Entry)->Flink = _ListHead; \
|
||||
(Entry)->Blink = _Blink; \
|
||||
_Blink->Flink = (Entry); \
|
||||
_ListHead->Blink = (Entry); \
|
||||
}
|
||||
|
||||
//
|
||||
// VOID
|
||||
// InsertHeadList(
|
||||
// PLIST_ENTRY ListHead,
|
||||
// PLIST_ENTRY Entry
|
||||
// );
|
||||
//
|
||||
|
||||
#define InsertHeadList(ListHead,Entry) {\
|
||||
LIST_ENTRY *_ListHead, *_Flink; \
|
||||
_ListHead = (ListHead); \
|
||||
_Flink = _ListHead->Flink; \
|
||||
(Entry)->Flink = _Flink; \
|
||||
(Entry)->Blink = _ListHead; \
|
||||
_Flink->Blink = (Entry); \
|
||||
_ListHead->Flink = (Entry); \
|
||||
}
|
||||
|
||||
// VOID
|
||||
// SwapListEntries(
|
||||
// PLIST_ENTRY Entry1,
|
||||
// PLIST_ENTRY Entry2
|
||||
// );
|
||||
//
|
||||
// Put Entry2 before Entry1
|
||||
//
|
||||
#define SwapListEntries(Entry1,Entry2) {\
|
||||
LIST_ENTRY *Entry1Flink, *Entry1Blink; \
|
||||
LIST_ENTRY *Entry2Flink, *Entry2Blink; \
|
||||
Entry2Flink = (Entry2)->Flink; \
|
||||
Entry2Blink = (Entry2)->Blink; \
|
||||
Entry1Flink = (Entry1)->Flink; \
|
||||
Entry1Blink = (Entry1)->Blink; \
|
||||
Entry2Blink->Flink = Entry2Flink; \
|
||||
Entry2Flink->Blink = Entry2Blink; \
|
||||
(Entry2)->Flink = Entry1; \
|
||||
(Entry2)->Blink = Entry1Blink; \
|
||||
Entry1Blink->Flink = (Entry2); \
|
||||
(Entry1)->Blink = (Entry2); \
|
||||
}
|
||||
|
||||
//
|
||||
// EFI_FIELD_OFFSET - returns the byte offset to a field within a structure
|
||||
//
|
||||
|
||||
#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))
|
||||
|
||||
//
|
||||
// CONTAINING_RECORD - returns a pointer to the structure
|
||||
// from one of it's elements.
|
||||
//
|
||||
|
||||
#define _CR(Record, TYPE, Field) \
|
||||
((TYPE *) ( (CHAR8 *)(Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
|
||||
|
||||
#if EFI_DEBUG
|
||||
#define CR(Record, TYPE, Field, Sig) \
|
||||
_CR(Record, TYPE, Field)->Signature != Sig ? \
|
||||
(TYPE *) ASSERT_STRUCT(_CR(Record, TYPE, Field), Record) : \
|
||||
_CR(Record, TYPE, Field)
|
||||
#else
|
||||
#define CR(Record, TYPE, Field, Signature) \
|
||||
_CR(Record, TYPE, Field)
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// A lock structure
|
||||
//
|
||||
|
||||
typedef struct _FLOCK {
|
||||
EFI_TPL Tpl;
|
||||
EFI_TPL OwnerTpl;
|
||||
UINTN Lock;
|
||||
} FLOCK;
|
||||
|
||||
#endif
|
||||
|
||||
340
gnu-efi-3.0/inc/efinet.h
Normal file
340
gnu-efi-3.0/inc/efinet.h
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
#ifndef _EFINET_H
|
||||
#define _EFINET_H
|
||||
|
||||
|
||||
/*++
|
||||
Copyright (c) 1999 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
efinet.h
|
||||
|
||||
Abstract:
|
||||
EFI Simple Network protocol
|
||||
|
||||
Revision History
|
||||
--*/
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Simple Network Protocol
|
||||
//
|
||||
|
||||
#define EFI_SIMPLE_NETWORK_PROTOCOL \
|
||||
{ 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
|
||||
|
||||
|
||||
INTERFACE_DECL(_EFI_SIMPLE_NETWORK);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
//
|
||||
// Total number of frames received. Includes frames with errors and
|
||||
// dropped frames.
|
||||
//
|
||||
UINT64 RxTotalFrames;
|
||||
|
||||
//
|
||||
// Number of valid frames received and copied into receive buffers.
|
||||
//
|
||||
UINT64 RxGoodFrames;
|
||||
|
||||
//
|
||||
// Number of frames below the minimum length for the media.
|
||||
// This would be <64 for ethernet.
|
||||
//
|
||||
UINT64 RxUndersizeFrames;
|
||||
|
||||
//
|
||||
// Number of frames longer than the maxminum length for the
|
||||
// media. This would be >1500 for ethernet.
|
||||
//
|
||||
UINT64 RxOversizeFrames;
|
||||
|
||||
//
|
||||
// Valid frames that were dropped because receive buffers were full.
|
||||
//
|
||||
UINT64 RxDroppedFrames;
|
||||
|
||||
//
|
||||
// Number of valid unicast frames received and not dropped.
|
||||
//
|
||||
UINT64 RxUnicastFrames;
|
||||
|
||||
//
|
||||
// Number of valid broadcast frames received and not dropped.
|
||||
//
|
||||
UINT64 RxBroadcastFrames;
|
||||
|
||||
//
|
||||
// Number of valid mutlicast frames received and not dropped.
|
||||
//
|
||||
UINT64 RxMulticastFrames;
|
||||
|
||||
//
|
||||
// Number of frames w/ CRC or alignment errors.
|
||||
//
|
||||
UINT64 RxCrcErrorFrames;
|
||||
|
||||
//
|
||||
// Total number of bytes received. Includes frames with errors
|
||||
// and dropped frames.
|
||||
//
|
||||
UINT64 RxTotalBytes;
|
||||
|
||||
//
|
||||
// Transmit statistics.
|
||||
//
|
||||
UINT64 TxTotalFrames;
|
||||
UINT64 TxGoodFrames;
|
||||
UINT64 TxUndersizeFrames;
|
||||
UINT64 TxOversizeFrames;
|
||||
UINT64 TxDroppedFrames;
|
||||
UINT64 TxUnicastFrames;
|
||||
UINT64 TxBroadcastFrames;
|
||||
UINT64 TxMulticastFrames;
|
||||
UINT64 TxCrcErrorFrames;
|
||||
UINT64 TxTotalBytes;
|
||||
|
||||
//
|
||||
// Number of collisions detection on this subnet.
|
||||
//
|
||||
UINT64 Collisions;
|
||||
|
||||
//
|
||||
// Number of frames destined for unsupported protocol.
|
||||
//
|
||||
UINT64 UnsupportedProtocol;
|
||||
|
||||
} EFI_NETWORK_STATISTICS;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef enum {
|
||||
EfiSimpleNetworkStopped,
|
||||
EfiSimpleNetworkStarted,
|
||||
EfiSimpleNetworkInitialized,
|
||||
EfiSimpleNetworkMaxState
|
||||
} EFI_SIMPLE_NETWORK_STATE;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01
|
||||
#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02
|
||||
#define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04
|
||||
#define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
#define MAX_MCAST_FILTER_CNT 16
|
||||
typedef struct {
|
||||
UINT32 State;
|
||||
UINT32 HwAddressSize;
|
||||
UINT32 MediaHeaderSize;
|
||||
UINT32 MaxPacketSize;
|
||||
UINT32 NvRamSize;
|
||||
UINT32 NvRamAccessSize;
|
||||
UINT32 ReceiveFilterMask;
|
||||
UINT32 ReceiveFilterSetting;
|
||||
UINT32 MaxMCastFilterCount;
|
||||
UINT32 MCastFilterCount;
|
||||
EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT];
|
||||
EFI_MAC_ADDRESS CurrentAddress;
|
||||
EFI_MAC_ADDRESS BroadcastAddress;
|
||||
EFI_MAC_ADDRESS PermanentAddress;
|
||||
UINT8 IfType;
|
||||
BOOLEAN MacAddressChangeable;
|
||||
BOOLEAN MultipleTxSupported;
|
||||
BOOLEAN MediaPresentSupported;
|
||||
BOOLEAN MediaPresent;
|
||||
} EFI_SIMPLE_NETWORK_MODE;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_START) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_STOP) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This,
|
||||
IN UINTN ExtraRxBufferSize OPTIONAL,
|
||||
IN UINTN ExtraTxBufferSize OPTIONAL
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_RESET) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This,
|
||||
IN UINT32 Enable,
|
||||
IN UINT32 Disable,
|
||||
IN BOOLEAN ResetMCastFilter,
|
||||
IN UINTN MCastFilterCnt OPTIONAL,
|
||||
IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This,
|
||||
IN BOOLEAN Reset,
|
||||
IN EFI_MAC_ADDRESS *New OPTIONAL
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This,
|
||||
IN BOOLEAN Reset,
|
||||
IN OUT UINTN *StatisticsSize OPTIONAL,
|
||||
OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This,
|
||||
IN BOOLEAN IPv6,
|
||||
IN EFI_IP_ADDRESS *IP,
|
||||
OUT EFI_MAC_ADDRESS *MAC
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This,
|
||||
IN BOOLEAN ReadWrite,
|
||||
IN UINTN Offset,
|
||||
IN UINTN BufferSize,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This,
|
||||
OUT UINT32 *InterruptStatus OPTIONAL,
|
||||
OUT VOID **TxBuf OPTIONAL
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This,
|
||||
IN UINTN HeaderSize,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer,
|
||||
IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
|
||||
IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,
|
||||
IN UINT16 *Protocol OPTIONAL
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) (
|
||||
IN struct _EFI_SIMPLE_NETWORK *This,
|
||||
OUT UINTN *HeaderSize OPTIONAL,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer,
|
||||
OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
|
||||
OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
|
||||
OUT UINT16 *Protocol OPTIONAL
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
#define EFI_SIMPLE_NETWORK_INTERFACE_REVISION 0x00010000
|
||||
|
||||
typedef struct _EFI_SIMPLE_NETWORK {
|
||||
UINT64 Revision;
|
||||
EFI_SIMPLE_NETWORK_START Start;
|
||||
EFI_SIMPLE_NETWORK_STOP Stop;
|
||||
EFI_SIMPLE_NETWORK_INITIALIZE Initialize;
|
||||
EFI_SIMPLE_NETWORK_RESET Reset;
|
||||
EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown;
|
||||
EFI_SIMPLE_NETWORK_RECEIVE_FILTERS ReceiveFilters;
|
||||
EFI_SIMPLE_NETWORK_STATION_ADDRESS StationAddress;
|
||||
EFI_SIMPLE_NETWORK_STATISTICS Statistics;
|
||||
EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC MCastIpToMac;
|
||||
EFI_SIMPLE_NETWORK_NVDATA NvData;
|
||||
EFI_SIMPLE_NETWORK_GET_STATUS GetStatus;
|
||||
EFI_SIMPLE_NETWORK_TRANSMIT Transmit;
|
||||
EFI_SIMPLE_NETWORK_RECEIVE Receive;
|
||||
EFI_EVENT WaitForPacket;
|
||||
EFI_SIMPLE_NETWORK_MODE *Mode;
|
||||
} EFI_SIMPLE_NETWORK;
|
||||
|
||||
#endif /* _EFINET_H */
|
||||
61
gnu-efi-3.0/inc/efipart.h
Normal file
61
gnu-efi-3.0/inc/efipart.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
#ifndef _EFI_PART_H
|
||||
#define _EFI_PART_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efipart.h
|
||||
|
||||
Abstract:
|
||||
Info about disk partitions and Master Boot Records
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#define EFI_PARTITION 0xef
|
||||
#define MBR_SIZE 512
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
UINT8 BootIndicator;
|
||||
UINT8 StartHead;
|
||||
UINT8 StartSector;
|
||||
UINT8 StartTrack;
|
||||
UINT8 OSIndicator;
|
||||
UINT8 EndHead;
|
||||
UINT8 EndSector;
|
||||
UINT8 EndTrack;
|
||||
UINT8 StartingLBA[4];
|
||||
UINT8 SizeInLBA[4];
|
||||
} MBR_PARTITION_RECORD;
|
||||
|
||||
#define EXTRACT_UINT32(D) (UINT32)(D[0] | (D[1] << 8) | (D[2] << 16) | (D[3] << 24))
|
||||
|
||||
#define MBR_SIGNATURE 0xaa55
|
||||
#define MIN_MBR_DEVICE_SIZE 0x80000
|
||||
#define MBR_ERRATA_PAD 0x40000 // 128 MB
|
||||
|
||||
#define MAX_MBR_PARTITIONS 4
|
||||
typedef struct {
|
||||
UINT8 BootStrapCode[440];
|
||||
UINT8 UniqueMbrSignature[4];
|
||||
UINT8 Unknown[2];
|
||||
MBR_PARTITION_RECORD Partition[MAX_MBR_PARTITIONS];
|
||||
UINT16 Signature;
|
||||
} MASTER_BOOT_RECORD;
|
||||
#pragma pack()
|
||||
|
||||
|
||||
#endif
|
||||
219
gnu-efi-3.0/inc/efipciio.h
Normal file
219
gnu-efi-3.0/inc/efipciio.h
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
#ifndef _EFI_PCI_IO_H
|
||||
#define _EFI_PCI_IO_H
|
||||
|
||||
#define EFI_PCI_IO_PROTOCOL \
|
||||
{ 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x02, 0x9a} }
|
||||
|
||||
INTERFACE_DECL(_EFI_PCI_IO);
|
||||
|
||||
typedef enum {
|
||||
EfiPciIoWidthUint8,
|
||||
EfiPciIoWidthUint16,
|
||||
EfiPciIoWidthUint32,
|
||||
EfiPciIoWidthUint64,
|
||||
EfiPciIoWidthFifoUint8,
|
||||
EfiPciIoWidthFifoUint16,
|
||||
EfiPciIoWidthFifoUint32,
|
||||
EfiPciIoWidthFifoUint64,
|
||||
EfiPciIoWidthFillUint8,
|
||||
EfiPciIoWidthFillUint16,
|
||||
EfiPciIoWidthFillUint32,
|
||||
EfiPciIoWidthFillUint64,
|
||||
EfiPciIoWidthMaximum
|
||||
} EFI_PCI_IO_PROTOCOL_WIDTH;
|
||||
|
||||
#define EFI_PCI_IO_PASS_THROUGH_BAR 0xff
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINT64 Mask,
|
||||
IN UINT64 Value,
|
||||
IN UINT64 Delay,
|
||||
OUT UINT64 *Result
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
EFI_PCI_IO_PROTOCOL_IO_MEM Read;
|
||||
EFI_PCI_IO_PROTOCOL_IO_MEM Write;
|
||||
} EFI_PCI_IO_PROTOCOL_ACCESS;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT32 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
EFI_PCI_IO_PROTOCOL_CONFIG Read;
|
||||
EFI_PCI_IO_PROTOCOL_CONFIG Write;
|
||||
} EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 DestBarIndex,
|
||||
IN UINT64 DestOffset,
|
||||
IN UINT8 SrcBarIndex,
|
||||
IN UINT64 SrcOffset,
|
||||
IN UINTN Count
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
EfiPciIoOperationBusMasterRead,
|
||||
EfiPciIoOperationBusMasterWrite,
|
||||
EfiPciIoOperationBusMasterCommonBuffer,
|
||||
EfiPciIoOperationMaximum
|
||||
} EFI_PCI_IO_PROTOCOL_OPERATION;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_MAP) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,
|
||||
IN VOID *HostAddress,
|
||||
IN OUT UINTN *NumberOfBytes,
|
||||
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
|
||||
OUT VOID **Mapping
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
IN VOID *Mapping
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
IN EFI_ALLOCATE_TYPE Type,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN Pages,
|
||||
OUT VOID **HostAddress,
|
||||
IN UINT64 Attributes
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
IN UINTN Pages,
|
||||
IN VOID *HostAddress
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH) (
|
||||
IN struct _EFI_PCI_IO *This
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
OUT UINTN *SegmentNumber,
|
||||
OUT UINTN *BusNumber,
|
||||
OUT UINTN *DeviceNumber,
|
||||
OUT UINTN *FunctionNumber
|
||||
);
|
||||
|
||||
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002
|
||||
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004
|
||||
#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008
|
||||
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010
|
||||
#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020
|
||||
#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040
|
||||
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080
|
||||
#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100
|
||||
#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200
|
||||
#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400
|
||||
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800
|
||||
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000
|
||||
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000
|
||||
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000
|
||||
#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000
|
||||
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000
|
||||
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000
|
||||
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000
|
||||
|
||||
typedef enum {
|
||||
EfiPciIoAttributeOperationGet,
|
||||
EfiPciIoAttributeOperationSet,
|
||||
EfiPciIoAttributeOperationEnable,
|
||||
EfiPciIoAttributeOperationDisable,
|
||||
EfiPciIoAttributeOperationSupported,
|
||||
EfiPciIoAttributeOperationMaximum
|
||||
} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
|
||||
IN UINT64 Attributes,
|
||||
OUT UINT64 *Result OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
IN UINT8 BarIndex,
|
||||
OUT UINT64 *Supports OPTIONAL,
|
||||
OUT VOID **Resources OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES) (
|
||||
IN struct _EFI_PCI_IO *This,
|
||||
IN UINT64 Attributes,
|
||||
IN UINT8 BarIndex,
|
||||
IN OUT UINT64 *Offset,
|
||||
IN OUT UINT64 *Length
|
||||
);
|
||||
|
||||
typedef struct _EFI_PCI_IO {
|
||||
EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollMem;
|
||||
EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollIo;
|
||||
EFI_PCI_IO_PROTOCOL_ACCESS Mem;
|
||||
EFI_PCI_IO_PROTOCOL_ACCESS Io;
|
||||
EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci;
|
||||
EFI_PCI_IO_PROTOCOL_COPY_MEM CopyMem;
|
||||
EFI_PCI_IO_PROTOCOL_MAP Map;
|
||||
EFI_PCI_IO_PROTOCOL_UNMAP Unmap;
|
||||
EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
|
||||
EFI_PCI_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
|
||||
EFI_PCI_IO_PROTOCOL_FLUSH Flush;
|
||||
EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation;
|
||||
EFI_PCI_IO_PROTOCOL_ATTRIBUTES Attributes;
|
||||
EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES GetBarAttributes;
|
||||
EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES SetBarAttributes;
|
||||
UINT64 RomSize;
|
||||
VOID *RomImage;
|
||||
} EFI_PCI_IO;
|
||||
|
||||
#endif /* _EFI_PCI_IO_H */
|
||||
736
gnu-efi-3.0/inc/efiprot.h
Normal file
736
gnu-efi-3.0/inc/efiprot.h
Normal file
|
|
@ -0,0 +1,736 @@
|
|||
#ifndef _EFI_PROT_H
|
||||
#define _EFI_PROT_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efiprot.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI Protocols
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// FPSWA library protocol
|
||||
//
|
||||
#define FPSWA_PROTOCOL \
|
||||
{ 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
//
|
||||
// Device Path protocol
|
||||
//
|
||||
|
||||
#define DEVICE_PATH_PROTOCOL \
|
||||
{ 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
|
||||
//
|
||||
// Block IO protocol
|
||||
//
|
||||
|
||||
#define BLOCK_IO_PROTOCOL \
|
||||
{ 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
#define EFI_BLOCK_IO_INTERFACE_REVISION 0x00010000
|
||||
#define EFI_BLOCK_IO_INTERFACE_REVISION2 0x00020001
|
||||
#define EFI_BLOCK_IO_INTERFACE_REVISION3 ((2<<16) | 31)
|
||||
|
||||
INTERFACE_DECL(_EFI_BLOCK_IO);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_BLOCK_RESET) (
|
||||
IN struct _EFI_BLOCK_IO *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_BLOCK_READ) (
|
||||
IN struct _EFI_BLOCK_IO *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_BLOCK_WRITE) (
|
||||
IN struct _EFI_BLOCK_IO *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_BLOCK_FLUSH) (
|
||||
IN struct _EFI_BLOCK_IO *This
|
||||
);
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT32 MediaId;
|
||||
BOOLEAN RemovableMedia;
|
||||
BOOLEAN MediaPresent;
|
||||
|
||||
BOOLEAN LogicalPartition;
|
||||
BOOLEAN ReadOnly;
|
||||
BOOLEAN WriteCaching;
|
||||
|
||||
UINT32 BlockSize;
|
||||
UINT32 IoAlign;
|
||||
|
||||
EFI_LBA LastBlock;
|
||||
|
||||
/* revision 2 */
|
||||
EFI_LBA LowestAlignedLba;
|
||||
UINT32 LogicalBlocksPerPhysicalBlock;
|
||||
/* revision 3 */
|
||||
UINT32 OptimalTransferLengthGranularity;
|
||||
} EFI_BLOCK_IO_MEDIA;
|
||||
|
||||
typedef struct _EFI_BLOCK_IO {
|
||||
UINT64 Revision;
|
||||
|
||||
EFI_BLOCK_IO_MEDIA *Media;
|
||||
|
||||
EFI_BLOCK_RESET Reset;
|
||||
EFI_BLOCK_READ ReadBlocks;
|
||||
EFI_BLOCK_WRITE WriteBlocks;
|
||||
EFI_BLOCK_FLUSH FlushBlocks;
|
||||
|
||||
} EFI_BLOCK_IO;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Disk Block IO protocol
|
||||
//
|
||||
|
||||
#define DISK_IO_PROTOCOL \
|
||||
{ 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
#define EFI_DISK_IO_INTERFACE_REVISION 0x00010000
|
||||
|
||||
INTERFACE_DECL(_EFI_DISK_IO);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_DISK_READ) (
|
||||
IN struct _EFI_DISK_IO *This,
|
||||
IN UINT32 MediaId,
|
||||
IN UINT64 Offset,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_DISK_WRITE) (
|
||||
IN struct _EFI_DISK_IO *This,
|
||||
IN UINT32 MediaId,
|
||||
IN UINT64 Offset,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
typedef struct _EFI_DISK_IO {
|
||||
UINT64 Revision;
|
||||
EFI_DISK_READ ReadDisk;
|
||||
EFI_DISK_WRITE WriteDisk;
|
||||
} EFI_DISK_IO;
|
||||
|
||||
|
||||
//
|
||||
// Simple file system protocol
|
||||
//
|
||||
|
||||
#define SIMPLE_FILE_SYSTEM_PROTOCOL \
|
||||
{ 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
INTERFACE_DECL(_EFI_FILE_IO_INTERFACE);
|
||||
INTERFACE_DECL(_EFI_FILE_HANDLE);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_VOLUME_OPEN) (
|
||||
IN struct _EFI_FILE_IO_INTERFACE *This,
|
||||
OUT struct _EFI_FILE_HANDLE **Root
|
||||
);
|
||||
|
||||
#define EFI_FILE_IO_INTERFACE_REVISION 0x00010000
|
||||
|
||||
typedef struct _EFI_FILE_IO_INTERFACE {
|
||||
UINT64 Revision;
|
||||
EFI_VOLUME_OPEN OpenVolume;
|
||||
} EFI_FILE_IO_INTERFACE;
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FILE_OPEN) (
|
||||
IN struct _EFI_FILE_HANDLE *File,
|
||||
OUT struct _EFI_FILE_HANDLE **NewHandle,
|
||||
IN CHAR16 *FileName,
|
||||
IN UINT64 OpenMode,
|
||||
IN UINT64 Attributes
|
||||
);
|
||||
|
||||
// Open modes
|
||||
#define EFI_FILE_MODE_READ 0x0000000000000001
|
||||
#define EFI_FILE_MODE_WRITE 0x0000000000000002
|
||||
#define EFI_FILE_MODE_CREATE 0x8000000000000000
|
||||
|
||||
// File attributes
|
||||
#define EFI_FILE_READ_ONLY 0x0000000000000001
|
||||
#define EFI_FILE_HIDDEN 0x0000000000000002
|
||||
#define EFI_FILE_SYSTEM 0x0000000000000004
|
||||
#define EFI_FILE_RESERVIED 0x0000000000000008
|
||||
#define EFI_FILE_DIRECTORY 0x0000000000000010
|
||||
#define EFI_FILE_ARCHIVE 0x0000000000000020
|
||||
#define EFI_FILE_VALID_ATTR 0x0000000000000037
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FILE_CLOSE) (
|
||||
IN struct _EFI_FILE_HANDLE *File
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FILE_DELETE) (
|
||||
IN struct _EFI_FILE_HANDLE *File
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FILE_READ) (
|
||||
IN struct _EFI_FILE_HANDLE *File,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FILE_WRITE) (
|
||||
IN struct _EFI_FILE_HANDLE *File,
|
||||
IN OUT UINTN *BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FILE_SET_POSITION) (
|
||||
IN struct _EFI_FILE_HANDLE *File,
|
||||
IN UINT64 Position
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FILE_GET_POSITION) (
|
||||
IN struct _EFI_FILE_HANDLE *File,
|
||||
OUT UINT64 *Position
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FILE_GET_INFO) (
|
||||
IN struct _EFI_FILE_HANDLE *File,
|
||||
IN EFI_GUID *InformationType,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FILE_SET_INFO) (
|
||||
IN struct _EFI_FILE_HANDLE *File,
|
||||
IN EFI_GUID *InformationType,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_FILE_FLUSH) (
|
||||
IN struct _EFI_FILE_HANDLE *File
|
||||
);
|
||||
|
||||
|
||||
|
||||
#define EFI_FILE_HANDLE_REVISION 0x00010000
|
||||
typedef struct _EFI_FILE_HANDLE {
|
||||
UINT64 Revision;
|
||||
EFI_FILE_OPEN Open;
|
||||
EFI_FILE_CLOSE Close;
|
||||
EFI_FILE_DELETE Delete;
|
||||
EFI_FILE_READ Read;
|
||||
EFI_FILE_WRITE Write;
|
||||
EFI_FILE_GET_POSITION GetPosition;
|
||||
EFI_FILE_SET_POSITION SetPosition;
|
||||
EFI_FILE_GET_INFO GetInfo;
|
||||
EFI_FILE_SET_INFO SetInfo;
|
||||
EFI_FILE_FLUSH Flush;
|
||||
} EFI_FILE, *EFI_FILE_HANDLE;
|
||||
|
||||
|
||||
//
|
||||
// File information types
|
||||
//
|
||||
|
||||
#define EFI_FILE_INFO_ID \
|
||||
{ 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
typedef struct {
|
||||
UINT64 Size;
|
||||
UINT64 FileSize;
|
||||
UINT64 PhysicalSize;
|
||||
EFI_TIME CreateTime;
|
||||
EFI_TIME LastAccessTime;
|
||||
EFI_TIME ModificationTime;
|
||||
UINT64 Attribute;
|
||||
CHAR16 FileName[1];
|
||||
} EFI_FILE_INFO;
|
||||
|
||||
//
|
||||
// The FileName field of the EFI_FILE_INFO data structure is variable length.
|
||||
// Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to
|
||||
// be the size of the data structure without the FileName field. The following macro
|
||||
// computes this size correctly no matter how big the FileName array is declared.
|
||||
// This is required to make the EFI_FILE_INFO data structure ANSI compilant.
|
||||
//
|
||||
|
||||
#define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName)
|
||||
|
||||
#define EFI_FILE_SYSTEM_INFO_ID \
|
||||
{ 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
typedef struct {
|
||||
UINT64 Size;
|
||||
BOOLEAN ReadOnly;
|
||||
UINT64 VolumeSize;
|
||||
UINT64 FreeSpace;
|
||||
UINT32 BlockSize;
|
||||
CHAR16 VolumeLabel[1];
|
||||
} EFI_FILE_SYSTEM_INFO;
|
||||
|
||||
//
|
||||
// The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length.
|
||||
// Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs
|
||||
// to be the size of the data structure without the VolumeLable field. The following macro
|
||||
// computes this size correctly no matter how big the VolumeLable array is declared.
|
||||
// This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant.
|
||||
//
|
||||
|
||||
#define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel)
|
||||
|
||||
#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \
|
||||
{ 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
|
||||
|
||||
typedef struct {
|
||||
CHAR16 VolumeLabel[1];
|
||||
} EFI_FILE_SYSTEM_VOLUME_LABEL_INFO;
|
||||
|
||||
#define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel)
|
||||
|
||||
//
|
||||
// Load file protocol
|
||||
//
|
||||
|
||||
|
||||
#define LOAD_FILE_PROTOCOL \
|
||||
{ 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
|
||||
|
||||
INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_LOAD_FILE) (
|
||||
IN struct _EFI_LOAD_FILE_INTERFACE *This,
|
||||
IN EFI_DEVICE_PATH *FilePath,
|
||||
IN BOOLEAN BootPolicy,
|
||||
IN OUT UINTN *BufferSize,
|
||||
IN VOID *Buffer OPTIONAL
|
||||
);
|
||||
|
||||
typedef struct _EFI_LOAD_FILE_INTERFACE {
|
||||
EFI_LOAD_FILE LoadFile;
|
||||
} EFI_LOAD_FILE_INTERFACE;
|
||||
|
||||
|
||||
//
|
||||
// Device IO protocol
|
||||
//
|
||||
|
||||
#define DEVICE_IO_PROTOCOL \
|
||||
{ 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE);
|
||||
|
||||
typedef enum {
|
||||
IO_UINT8,
|
||||
IO_UINT16,
|
||||
IO_UINT32,
|
||||
IO_UINT64,
|
||||
//
|
||||
// Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO
|
||||
//
|
||||
MMIO_COPY_UINT8,
|
||||
MMIO_COPY_UINT16,
|
||||
MMIO_COPY_UINT32,
|
||||
MMIO_COPY_UINT64
|
||||
} EFI_IO_WIDTH;
|
||||
|
||||
#define EFI_PCI_ADDRESS(_bus,_dev,_func) \
|
||||
( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) )
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_DEVICE_IO) (
|
||||
IN struct _EFI_DEVICE_IO_INTERFACE *This,
|
||||
IN EFI_IO_WIDTH Width,
|
||||
IN UINT64 Address,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
EFI_DEVICE_IO Read;
|
||||
EFI_DEVICE_IO Write;
|
||||
} EFI_IO_ACCESS;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PCI_DEVICE_PATH) (
|
||||
IN struct _EFI_DEVICE_IO_INTERFACE *This,
|
||||
IN UINT64 Address,
|
||||
IN OUT EFI_DEVICE_PATH **PciDevicePath
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
EfiBusMasterRead,
|
||||
EfiBusMasterWrite,
|
||||
EfiBusMasterCommonBuffer
|
||||
} EFI_IO_OPERATION_TYPE;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_IO_MAP) (
|
||||
IN struct _EFI_DEVICE_IO_INTERFACE *This,
|
||||
IN EFI_IO_OPERATION_TYPE Operation,
|
||||
IN EFI_PHYSICAL_ADDRESS *HostAddress,
|
||||
IN OUT UINTN *NumberOfBytes,
|
||||
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
|
||||
OUT VOID **Mapping
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_IO_UNMAP) (
|
||||
IN struct _EFI_DEVICE_IO_INTERFACE *This,
|
||||
IN VOID *Mapping
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_IO_ALLOCATE_BUFFER) (
|
||||
IN struct _EFI_DEVICE_IO_INTERFACE *This,
|
||||
IN EFI_ALLOCATE_TYPE Type,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN Pages,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *HostAddress
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_IO_FLUSH) (
|
||||
IN struct _EFI_DEVICE_IO_INTERFACE *This
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_IO_FREE_BUFFER) (
|
||||
IN struct _EFI_DEVICE_IO_INTERFACE *This,
|
||||
IN UINTN Pages,
|
||||
IN EFI_PHYSICAL_ADDRESS HostAddress
|
||||
);
|
||||
|
||||
typedef struct _EFI_DEVICE_IO_INTERFACE {
|
||||
EFI_IO_ACCESS Mem;
|
||||
EFI_IO_ACCESS Io;
|
||||
EFI_IO_ACCESS Pci;
|
||||
EFI_IO_MAP Map;
|
||||
EFI_PCI_DEVICE_PATH PciDevicePath;
|
||||
EFI_IO_UNMAP Unmap;
|
||||
EFI_IO_ALLOCATE_BUFFER AllocateBuffer;
|
||||
EFI_IO_FLUSH Flush;
|
||||
EFI_IO_FREE_BUFFER FreeBuffer;
|
||||
} EFI_DEVICE_IO_INTERFACE;
|
||||
|
||||
|
||||
//
|
||||
// Unicode Collation protocol
|
||||
//
|
||||
|
||||
#define UNICODE_COLLATION_PROTOCOL \
|
||||
{ 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
#define UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff)
|
||||
|
||||
INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE);
|
||||
|
||||
typedef
|
||||
INTN
|
||||
(EFIAPI *EFI_UNICODE_STRICOLL) (
|
||||
IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_UNICODE_METAIMATCH) (
|
||||
IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
|
||||
IN CHAR16 *String,
|
||||
IN CHAR16 *Pattern
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EFI_UNICODE_STRLWR) (
|
||||
IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
|
||||
IN OUT CHAR16 *Str
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EFI_UNICODE_STRUPR) (
|
||||
IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
|
||||
IN OUT CHAR16 *Str
|
||||
);
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(EFIAPI *EFI_UNICODE_FATTOSTR) (
|
||||
IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
|
||||
IN UINTN FatSize,
|
||||
IN CHAR8 *Fat,
|
||||
OUT CHAR16 *String
|
||||
);
|
||||
|
||||
typedef
|
||||
BOOLEAN
|
||||
(EFIAPI *EFI_UNICODE_STRTOFAT) (
|
||||
IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
|
||||
IN CHAR16 *String,
|
||||
IN UINTN FatSize,
|
||||
OUT CHAR8 *Fat
|
||||
);
|
||||
|
||||
|
||||
typedef struct _EFI_UNICODE_COLLATION_INTERFACE {
|
||||
|
||||
// general
|
||||
EFI_UNICODE_STRICOLL StriColl;
|
||||
EFI_UNICODE_METAIMATCH MetaiMatch;
|
||||
EFI_UNICODE_STRLWR StrLwr;
|
||||
EFI_UNICODE_STRUPR StrUpr;
|
||||
|
||||
// for supporting fat volumes
|
||||
EFI_UNICODE_FATTOSTR FatToStr;
|
||||
EFI_UNICODE_STRTOFAT StrToFat;
|
||||
|
||||
CHAR8 *SupportedLanguages;
|
||||
} EFI_UNICODE_COLLATION_INTERFACE;
|
||||
|
||||
/* Graphics output protocol */
|
||||
#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
|
||||
{ \
|
||||
0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \
|
||||
}
|
||||
|
||||
typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
|
||||
|
||||
typedef struct {
|
||||
UINT32 RedMask;
|
||||
UINT32 GreenMask;
|
||||
UINT32 BlueMask;
|
||||
UINT32 ReservedMask;
|
||||
} EFI_PIXEL_BITMASK;
|
||||
|
||||
typedef enum {
|
||||
PixelRedGreenBlueReserved8BitPerColor,
|
||||
PixelBlueGreenRedReserved8BitPerColor,
|
||||
PixelBitMask,
|
||||
PixelBltOnly,
|
||||
PixelFormatMax
|
||||
} EFI_GRAPHICS_PIXEL_FORMAT;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Version;
|
||||
UINT32 HorizontalResolution;
|
||||
UINT32 VerticalResolution;
|
||||
EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
|
||||
EFI_PIXEL_BITMASK PixelInformation;
|
||||
UINT32 PixelsPerScanLine;
|
||||
} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
|
||||
|
||||
/**
|
||||
Return the current video mode information.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ModeNumber The mode number to return information on.
|
||||
@param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
|
||||
@param Info A pointer to callee allocated buffer that returns information about ModeNumber.
|
||||
|
||||
@retval EFI_SUCCESS Mode information returned.
|
||||
@retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.
|
||||
@retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.
|
||||
@retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
|
||||
@retval EFI_INVALID_PARAMETER One of the input args was NULL.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
|
||||
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
|
||||
IN UINT32 ModeNumber,
|
||||
OUT UINTN *SizeOfInfo,
|
||||
OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Return the current video mode information.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ModeNumber The mode number to be set.
|
||||
|
||||
@retval EFI_SUCCESS Graphics mode was changed.
|
||||
@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
|
||||
@retval EFI_UNSUPPORTED ModeNumber is not supported by this device.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
|
||||
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
|
||||
IN UINT32 ModeNumber
|
||||
)
|
||||
;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Blue;
|
||||
UINT8 Green;
|
||||
UINT8 Red;
|
||||
UINT8 Reserved;
|
||||
} EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
|
||||
|
||||
typedef union {
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
|
||||
UINT32 Raw;
|
||||
} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
|
||||
|
||||
typedef enum {
|
||||
EfiBltVideoFill,
|
||||
EfiBltVideoToBltBuffer,
|
||||
EfiBltBufferToVideo,
|
||||
EfiBltVideoToVideo,
|
||||
EfiGraphicsOutputBltOperationMax
|
||||
} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
|
||||
|
||||
/**
|
||||
The following table defines actions for BltOperations:
|
||||
|
||||
<B>EfiBltVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
|
||||
directly to every pixel of the video display rectangle
|
||||
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
|
||||
Only one pixel will be used from the BltBuffer. Delta is NOT used.
|
||||
|
||||
<B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
|
||||
(SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
|
||||
the BltBuffer rectangle (DestinationX, DestinationY )
|
||||
(DestinationX + Width, DestinationY + Height). If DestinationX or
|
||||
DestinationY is not zero then Delta must be set to the length in bytes
|
||||
of a row in the BltBuffer.
|
||||
|
||||
<B>EfiBltBufferToVideo</B> - Write data from the BltBuffer rectangle
|
||||
(SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
|
||||
video display rectangle (DestinationX, DestinationY)
|
||||
(DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
|
||||
not zero then Delta must be set to the length in bytes of a row in the
|
||||
BltBuffer.
|
||||
|
||||
<B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
|
||||
(SourceX + Width, SourceY + Height) .to the video display rectangle
|
||||
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
|
||||
The BltBuffer and Delta are not used in this mode.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param BltBuffer Buffer containing data to blit into video buffer. This
|
||||
buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||
@param BltOperation Operation to perform on BlitBuffer and video memory
|
||||
@param SourceX X coordinate of source for the BltBuffer.
|
||||
@param SourceY Y coordinate of source for the BltBuffer.
|
||||
@param DestinationX X coordinate of destination for the BltBuffer.
|
||||
@param DestinationY Y coordinate of destination for the BltBuffer.
|
||||
@param Width Width of rectangle in BltBuffer in pixels.
|
||||
@param Height Hight of rectangle in BltBuffer in pixels.
|
||||
@param Delta OPTIONAL
|
||||
|
||||
@retval EFI_SUCCESS The Blt operation completed.
|
||||
@retval EFI_INVALID_PARAMETER BltOperation is not valid.
|
||||
@retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
|
||||
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
|
||||
IN UINTN SourceX,
|
||||
IN UINTN SourceY,
|
||||
IN UINTN DestinationX,
|
||||
IN UINTN DestinationY,
|
||||
IN UINTN Width,
|
||||
IN UINTN Height,
|
||||
IN UINTN Delta OPTIONAL
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
UINT32 MaxMode;
|
||||
UINT32 Mode;
|
||||
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
|
||||
UINTN SizeOfInfo;
|
||||
EFI_PHYSICAL_ADDRESS FrameBufferBase;
|
||||
UINTN FrameBufferSize;
|
||||
} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
|
||||
|
||||
struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
|
||||
};
|
||||
#endif
|
||||
|
||||
463
gnu-efi-3.0/inc/efipxebc.h
Normal file
463
gnu-efi-3.0/inc/efipxebc.h
Normal file
|
|
@ -0,0 +1,463 @@
|
|||
#ifndef _EFIPXEBC_H
|
||||
#define _EFIPXEBC_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efipxebc.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI PXE Base Code Protocol
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// PXE Base Code protocol
|
||||
//
|
||||
|
||||
#define EFI_PXE_BASE_CODE_PROTOCOL \
|
||||
{ 0x03c4e603, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
|
||||
|
||||
INTERFACE_DECL(_EFI_PXE_BASE_CODE);
|
||||
|
||||
#define DEFAULT_TTL 4
|
||||
#define DEFAULT_ToS 0
|
||||
//
|
||||
// Address definitions
|
||||
//
|
||||
|
||||
typedef union {
|
||||
UINT32 Addr[4];
|
||||
EFI_IPv4_ADDRESS v4;
|
||||
EFI_IPv6_ADDRESS v6;
|
||||
} EFI_IP_ADDRESS;
|
||||
|
||||
typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
|
||||
|
||||
//
|
||||
// Packet definitions
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
UINT8 BootpOpcode;
|
||||
UINT8 BootpHwType;
|
||||
UINT8 BootpHwAddrLen;
|
||||
UINT8 BootpGateHops;
|
||||
UINT32 BootpIdent;
|
||||
UINT16 BootpSeconds;
|
||||
UINT16 BootpFlags;
|
||||
UINT8 BootpCiAddr[4];
|
||||
UINT8 BootpYiAddr[4];
|
||||
UINT8 BootpSiAddr[4];
|
||||
UINT8 BootpGiAddr[4];
|
||||
UINT8 BootpHwAddr[16];
|
||||
UINT8 BootpSrvName[64];
|
||||
UINT8 BootpBootFile[128];
|
||||
UINT32 DhcpMagik;
|
||||
UINT8 DhcpOptions[56];
|
||||
} EFI_PXE_BASE_CODE_DHCPV4_PACKET;
|
||||
|
||||
// TBD in EFI v1.1
|
||||
//typedef struct {
|
||||
// UINT8 reserved;
|
||||
//} EFI_PXE_BASE_CODE_DHCPV6_PACKET;
|
||||
|
||||
typedef union {
|
||||
UINT8 Raw[1472];
|
||||
EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4;
|
||||
// EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6;
|
||||
} EFI_PXE_BASE_CODE_PACKET;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Code;
|
||||
UINT16 Checksum;
|
||||
union {
|
||||
UINT32 reserved;
|
||||
UINT32 Mtu;
|
||||
UINT32 Pointer;
|
||||
struct {
|
||||
UINT16 Identifier;
|
||||
UINT16 Sequence;
|
||||
} Echo;
|
||||
} u;
|
||||
UINT8 Data[494];
|
||||
} EFI_PXE_BASE_CODE_ICMP_ERROR;
|
||||
|
||||
typedef struct {
|
||||
UINT8 ErrorCode;
|
||||
CHAR8 ErrorString[127];
|
||||
} EFI_PXE_BASE_CODE_TFTP_ERROR;
|
||||
|
||||
//
|
||||
// IP Receive Filter definitions
|
||||
//
|
||||
#define EFI_PXE_BASE_CODE_MAX_IPCNT 8
|
||||
typedef struct {
|
||||
UINT8 Filters;
|
||||
UINT8 IpCnt;
|
||||
UINT16 reserved;
|
||||
EFI_IP_ADDRESS IpList[EFI_PXE_BASE_CODE_MAX_IPCNT];
|
||||
} EFI_PXE_BASE_CODE_IP_FILTER;
|
||||
|
||||
#define EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP 0x0001
|
||||
#define EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST 0x0002
|
||||
#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS 0x0004
|
||||
#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST 0x0008
|
||||
|
||||
//
|
||||
// ARP Cache definitions
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
EFI_IP_ADDRESS IpAddr;
|
||||
EFI_MAC_ADDRESS MacAddr;
|
||||
} EFI_PXE_BASE_CODE_ARP_ENTRY;
|
||||
|
||||
typedef struct {
|
||||
EFI_IP_ADDRESS IpAddr;
|
||||
EFI_IP_ADDRESS SubnetMask;
|
||||
EFI_IP_ADDRESS GwAddr;
|
||||
} EFI_PXE_BASE_CODE_ROUTE_ENTRY;
|
||||
|
||||
//
|
||||
// UDP definitions
|
||||
//
|
||||
|
||||
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP 0x0001
|
||||
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT 0x0002
|
||||
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP 0x0004
|
||||
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT 0x0008
|
||||
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER 0x0010
|
||||
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT 0x0020
|
||||
|
||||
//
|
||||
// Discover() definitions
|
||||
//
|
||||
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP 0
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS 1
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_INTEL_LCM 2
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_DOSUNDI 3
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_NEC_ESMPRO 4
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_WSoD 5
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_LCCM 6
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_CA_UNICENTER_TNG 7
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_HP_OPENVIEW 8
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_9 9
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_10 10
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_11 11
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_NOT_USED_12 12
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_INSTALL 13
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_BOOT 14
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_REMBO 15
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_BEOBOOT 16
|
||||
//
|
||||
// 17 through 32767 are reserved
|
||||
// 32768 through 65279 are for vendor use
|
||||
// 65280 through 65534 are reserved
|
||||
//
|
||||
#define EFI_PXE_BASE_CODE_BOOT_TYPE_PXETEST 65535
|
||||
|
||||
#define EFI_PXE_BASE_CODE_BOOT_LAYER_MASK 0x7FFF
|
||||
#define EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL 0x0000
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT16 Type;
|
||||
BOOLEAN AcceptAnyResponse;
|
||||
UINT8 Reserved;
|
||||
EFI_IP_ADDRESS IpAddr;
|
||||
} EFI_PXE_BASE_CODE_SRVLIST;
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN UseMCast;
|
||||
BOOLEAN UseBCast;
|
||||
BOOLEAN UseUCast;
|
||||
BOOLEAN MustUseList;
|
||||
EFI_IP_ADDRESS ServerMCastIp;
|
||||
UINT16 IpCnt;
|
||||
EFI_PXE_BASE_CODE_SRVLIST SrvList[1];
|
||||
} EFI_PXE_BASE_CODE_DISCOVER_INFO;
|
||||
|
||||
//
|
||||
// Mtftp() definitions
|
||||
//
|
||||
|
||||
typedef enum {
|
||||
EFI_PXE_BASE_CODE_TFTP_FIRST,
|
||||
EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
|
||||
EFI_PXE_BASE_CODE_TFTP_READ_FILE,
|
||||
EFI_PXE_BASE_CODE_TFTP_WRITE_FILE,
|
||||
EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY,
|
||||
EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE,
|
||||
EFI_PXE_BASE_CODE_MTFTP_READ_FILE,
|
||||
EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY,
|
||||
EFI_PXE_BASE_CODE_MTFTP_LAST
|
||||
} EFI_PXE_BASE_CODE_TFTP_OPCODE;
|
||||
|
||||
typedef struct {
|
||||
EFI_IP_ADDRESS MCastIp;
|
||||
EFI_PXE_BASE_CODE_UDP_PORT CPort;
|
||||
EFI_PXE_BASE_CODE_UDP_PORT SPort;
|
||||
UINT16 ListenTimeout;
|
||||
UINT16 TransmitTimeout;
|
||||
} EFI_PXE_BASE_CODE_MTFTP_INFO;
|
||||
|
||||
//
|
||||
// PXE Base Code Mode structure
|
||||
//
|
||||
|
||||
#define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8
|
||||
#define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN Started;
|
||||
BOOLEAN Ipv6Available;
|
||||
BOOLEAN Ipv6Supported;
|
||||
BOOLEAN UsingIpv6;
|
||||
BOOLEAN BisSupported;
|
||||
BOOLEAN BisDetected;
|
||||
BOOLEAN AutoArp;
|
||||
BOOLEAN SendGUID;
|
||||
BOOLEAN DhcpDiscoverValid;
|
||||
BOOLEAN DhcpAckReceived;
|
||||
BOOLEAN ProxyOfferReceived;
|
||||
BOOLEAN PxeDiscoverValid;
|
||||
BOOLEAN PxeReplyReceived;
|
||||
BOOLEAN PxeBisReplyReceived;
|
||||
BOOLEAN IcmpErrorReceived;
|
||||
BOOLEAN TftpErrorReceived;
|
||||
BOOLEAN MakeCallbacks;
|
||||
UINT8 TTL;
|
||||
UINT8 ToS;
|
||||
EFI_IP_ADDRESS StationIp;
|
||||
EFI_IP_ADDRESS SubnetMask;
|
||||
EFI_PXE_BASE_CODE_PACKET DhcpDiscover;
|
||||
EFI_PXE_BASE_CODE_PACKET DhcpAck;
|
||||
EFI_PXE_BASE_CODE_PACKET ProxyOffer;
|
||||
EFI_PXE_BASE_CODE_PACKET PxeDiscover;
|
||||
EFI_PXE_BASE_CODE_PACKET PxeReply;
|
||||
EFI_PXE_BASE_CODE_PACKET PxeBisReply;
|
||||
EFI_PXE_BASE_CODE_IP_FILTER IpFilter;
|
||||
UINT32 ArpCacheEntries;
|
||||
EFI_PXE_BASE_CODE_ARP_ENTRY ArpCache[EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES];
|
||||
UINT32 RouteTableEntries;
|
||||
EFI_PXE_BASE_CODE_ROUTE_ENTRY RouteTable[EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES];
|
||||
EFI_PXE_BASE_CODE_ICMP_ERROR IcmpError;
|
||||
EFI_PXE_BASE_CODE_TFTP_ERROR TftpError;
|
||||
} EFI_PXE_BASE_CODE_MODE;
|
||||
|
||||
//
|
||||
// PXE Base Code Interface Function definitions
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_START) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This,
|
||||
IN BOOLEAN UseIpv6
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_STOP) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_DHCP) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This,
|
||||
IN BOOLEAN SortOffers
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_DISCOVER) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This,
|
||||
IN UINT16 Type,
|
||||
IN UINT16 *Layer,
|
||||
IN BOOLEAN UseBis,
|
||||
IN OUT EFI_PXE_BASE_CODE_DISCOVER_INFO *Info OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_MTFTP) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This,
|
||||
IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
|
||||
IN OUT VOID *BufferPtr OPTIONAL,
|
||||
IN BOOLEAN Overwrite,
|
||||
IN OUT UINTN *BufferSize,
|
||||
IN UINTN *BlockSize OPTIONAL,
|
||||
IN EFI_IP_ADDRESS *ServerIp,
|
||||
IN UINT8 *Filename,
|
||||
IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL,
|
||||
IN BOOLEAN DontUseBuffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_UDP_WRITE) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This,
|
||||
IN UINT16 OpFlags,
|
||||
IN EFI_IP_ADDRESS *DestIp,
|
||||
IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort,
|
||||
IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL
|
||||
IN EFI_IP_ADDRESS *SrcIp, OPTIONAL
|
||||
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
|
||||
IN UINTN *HeaderSize, OPTIONAL
|
||||
IN VOID *HeaderPtr, OPTIONAL
|
||||
IN UINTN *BufferSize,
|
||||
IN VOID *BufferPtr
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_UDP_READ) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This,
|
||||
IN UINT16 OpFlags,
|
||||
IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL
|
||||
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL
|
||||
IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL
|
||||
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
|
||||
IN UINTN *HeaderSize, OPTIONAL
|
||||
IN VOID *HeaderPtr, OPTIONAL
|
||||
IN OUT UINTN *BufferSize,
|
||||
IN VOID *BufferPtr
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_SET_IP_FILTER) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This,
|
||||
IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_ARP) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This,
|
||||
IN EFI_IP_ADDRESS *IpAddr,
|
||||
IN EFI_MAC_ADDRESS *MacAddr OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_SET_PARAMETERS) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This,
|
||||
IN BOOLEAN *NewAutoArp, OPTIONAL
|
||||
IN BOOLEAN *NewSendGUID, OPTIONAL
|
||||
IN UINT8 *NewTTL, OPTIONAL
|
||||
IN UINT8 *NewToS, OPTIONAL
|
||||
IN BOOLEAN *NewMakeCallback OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_SET_STATION_IP) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This,
|
||||
IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL
|
||||
IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_PXE_BASE_CODE_SET_PACKETS) (
|
||||
IN struct _EFI_PXE_BASE_CODE *This,
|
||||
BOOLEAN *NewDhcpDiscoverValid, OPTIONAL
|
||||
BOOLEAN *NewDhcpAckReceived, OPTIONAL
|
||||
BOOLEAN *NewProxyOfferReceived, OPTIONAL
|
||||
BOOLEAN *NewPxeDiscoverValid, OPTIONAL
|
||||
BOOLEAN *NewPxeReplyReceived, OPTIONAL
|
||||
BOOLEAN *NewPxeBisReplyReceived,OPTIONAL
|
||||
IN EFI_PXE_BASE_CODE_PACKET *NewDhcpDiscover, OPTIONAL
|
||||
IN EFI_PXE_BASE_CODE_PACKET *NewDhcpAck, OPTIONAL
|
||||
IN EFI_PXE_BASE_CODE_PACKET *NewProxyOffer, OPTIONAL
|
||||
IN EFI_PXE_BASE_CODE_PACKET *NewPxeDiscover, OPTIONAL
|
||||
IN EFI_PXE_BASE_CODE_PACKET *NewPxeReply, OPTIONAL
|
||||
IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply OPTIONAL
|
||||
);
|
||||
|
||||
//
|
||||
// PXE Base Code Protocol structure
|
||||
//
|
||||
|
||||
#define EFI_PXE_BASE_CODE_INTERFACE_REVISION 0x00010000
|
||||
|
||||
typedef struct _EFI_PXE_BASE_CODE {
|
||||
UINT64 Revision;
|
||||
EFI_PXE_BASE_CODE_START Start;
|
||||
EFI_PXE_BASE_CODE_STOP Stop;
|
||||
EFI_PXE_BASE_CODE_DHCP Dhcp;
|
||||
EFI_PXE_BASE_CODE_DISCOVER Discover;
|
||||
EFI_PXE_BASE_CODE_MTFTP Mtftp;
|
||||
EFI_PXE_BASE_CODE_UDP_WRITE UdpWrite;
|
||||
EFI_PXE_BASE_CODE_UDP_READ UdpRead;
|
||||
EFI_PXE_BASE_CODE_SET_IP_FILTER SetIpFilter;
|
||||
EFI_PXE_BASE_CODE_ARP Arp;
|
||||
EFI_PXE_BASE_CODE_SET_PARAMETERS SetParameters;
|
||||
EFI_PXE_BASE_CODE_SET_STATION_IP SetStationIp;
|
||||
EFI_PXE_BASE_CODE_SET_PACKETS SetPackets;
|
||||
EFI_PXE_BASE_CODE_MODE *Mode;
|
||||
} EFI_PXE_BASE_CODE;
|
||||
|
||||
//
|
||||
// Call Back Definitions
|
||||
//
|
||||
|
||||
#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL \
|
||||
{ 0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
//
|
||||
// Revision Number
|
||||
//
|
||||
|
||||
#define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION 0x00010000
|
||||
|
||||
INTERFACE_DECL(_EFI_PXE_BASE_CODE_CALLBACK);
|
||||
|
||||
typedef enum {
|
||||
EFI_PXE_BASE_CODE_FUNCTION_FIRST,
|
||||
EFI_PXE_BASE_CODE_FUNCTION_DHCP,
|
||||
EFI_PXE_BASE_CODE_FUNCTION_DISCOVER,
|
||||
EFI_PXE_BASE_CODE_FUNCTION_MTFTP,
|
||||
EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE,
|
||||
EFI_PXE_BASE_CODE_FUNCTION_UDP_READ,
|
||||
EFI_PXE_BASE_CODE_FUNCTION_ARP,
|
||||
EFI_PXE_BASE_CODE_FUNCTION_IGMP,
|
||||
EFI_PXE_BASE_CODE_PXE_FUNCTION_LAST
|
||||
} EFI_PXE_BASE_CODE_FUNCTION;
|
||||
|
||||
typedef enum {
|
||||
EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST,
|
||||
EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
|
||||
EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT,
|
||||
EFI_PXE_BASE_CODE_CALLBACK_STATUS_LAST
|
||||
} EFI_PXE_BASE_CODE_CALLBACK_STATUS;
|
||||
|
||||
typedef
|
||||
EFI_PXE_BASE_CODE_CALLBACK_STATUS
|
||||
(EFIAPI *EFI_PXE_CALLBACK) (
|
||||
IN struct _EFI_PXE_BASE_CODE_CALLBACK *This,
|
||||
IN EFI_PXE_BASE_CODE_FUNCTION Function,
|
||||
IN BOOLEAN Received,
|
||||
IN UINT32 PacketLen,
|
||||
IN EFI_PXE_BASE_CODE_PACKET *Packet OPTIONAL
|
||||
);
|
||||
|
||||
typedef struct _EFI_PXE_BASE_CODE_CALLBACK {
|
||||
UINT64 Revision;
|
||||
EFI_PXE_CALLBACK Callback;
|
||||
} EFI_PXE_BASE_CODE_CALLBACK;
|
||||
|
||||
#endif /* _EFIPXEBC_H */
|
||||
141
gnu-efi-3.0/inc/efirtlib.h
Normal file
141
gnu-efi-3.0/inc/efirtlib.h
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
#ifndef _EFI_RT_LIB_INCLUDE_
|
||||
#define _EFI_RT_LIB_INCLUDE_
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efilib.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI Runtime library functions
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "efidebug.h"
|
||||
#include "efipart.h"
|
||||
#include "efilibplat.h"
|
||||
|
||||
|
||||
VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtZeroMem (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtSetMem (
|
||||
IN VOID *Buffer,
|
||||
IN UINTN Size,
|
||||
IN UINT8 Value
|
||||
);
|
||||
|
||||
VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtCopyMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
INTN
|
||||
RUNTIMEFUNCTION
|
||||
RtCompareMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
INTN
|
||||
RUNTIMEFUNCTION
|
||||
RtStrCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtStrCpy (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
);
|
||||
|
||||
VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtStrCat (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
);
|
||||
|
||||
UINTN
|
||||
RUNTIMEFUNCTION
|
||||
RtStrLen (
|
||||
IN CHAR16 *s1
|
||||
);
|
||||
|
||||
UINTN
|
||||
RUNTIMEFUNCTION
|
||||
RtStrSize (
|
||||
IN CHAR16 *s1
|
||||
);
|
||||
|
||||
INTN
|
||||
RUNTIMEFUNCTION
|
||||
RtCompareGuid (
|
||||
IN EFI_GUID *Guid1,
|
||||
IN EFI_GUID *Guid2
|
||||
);
|
||||
|
||||
UINT8
|
||||
RUNTIMEFUNCTION
|
||||
RtDecimaltoBCD(
|
||||
IN UINT8 BcdValue
|
||||
);
|
||||
|
||||
UINT8
|
||||
RUNTIMEFUNCTION
|
||||
RtBCDtoDecimal(
|
||||
IN UINT8 BcdValue
|
||||
);
|
||||
|
||||
//
|
||||
// Virtual mapping transition support. (Only used during
|
||||
// the virtual address change transisition)
|
||||
//
|
||||
|
||||
VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtLibEnableVirtualMappings (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtConvertList (
|
||||
IN UINTN DebugDisposition,
|
||||
IN OUT LIST_ENTRY *ListHead
|
||||
);
|
||||
|
||||
VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtAcquireLock (
|
||||
IN FLOCK *Lock
|
||||
);
|
||||
|
||||
VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtReleaseLock (
|
||||
IN FLOCK *Lock
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
132
gnu-efi-3.0/inc/efiser.h
Normal file
132
gnu-efi-3.0/inc/efiser.h
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
#ifndef _EFI_SER_H
|
||||
#define _EFI_SER_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efiser.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI serial protocol
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Serial protocol
|
||||
//
|
||||
|
||||
#define SERIAL_IO_PROTOCOL \
|
||||
{ 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD} }
|
||||
|
||||
INTERFACE_DECL(_SERIAL_IO_INTERFACE);
|
||||
|
||||
typedef enum {
|
||||
DefaultParity,
|
||||
NoParity,
|
||||
EvenParity,
|
||||
OddParity,
|
||||
MarkParity,
|
||||
SpaceParity
|
||||
} EFI_PARITY_TYPE;
|
||||
|
||||
typedef enum {
|
||||
DefaultStopBits,
|
||||
OneStopBit, // 1 stop bit
|
||||
OneFiveStopBits, // 1.5 stop bits
|
||||
TwoStopBits // 2 stop bits
|
||||
} EFI_STOP_BITS_TYPE;
|
||||
|
||||
#define EFI_SERIAL_CLEAR_TO_SEND 0x0010 // RO
|
||||
#define EFI_SERIAL_DATA_SET_READY 0x0020 // RO
|
||||
#define EFI_SERIAL_RING_INDICATE 0x0040 // RO
|
||||
#define EFI_SERIAL_CARRIER_DETECT 0x0080 // RO
|
||||
#define EFI_SERIAL_REQUEST_TO_SEND 0x0002 // WO
|
||||
#define EFI_SERIAL_DATA_TERMINAL_READY 0x0001 // WO
|
||||
#define EFI_SERIAL_INPUT_BUFFER_EMPTY 0x0100 // RO
|
||||
#define EFI_SERIAL_OUTPUT_BUFFER_EMPTY 0x0200 // RO
|
||||
#define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE 0x1000 // RW
|
||||
#define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE 0x2000 // RW
|
||||
#define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x4000 // RW
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SERIAL_RESET) (
|
||||
IN struct _SERIAL_IO_INTERFACE *This
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SERIAL_SET_ATTRIBUTES) (
|
||||
IN struct _SERIAL_IO_INTERFACE *This,
|
||||
IN UINT64 BaudRate,
|
||||
IN UINT32 ReceiveFifoDepth,
|
||||
IN UINT32 Timeout,
|
||||
IN EFI_PARITY_TYPE Parity,
|
||||
IN UINT8 DataBits,
|
||||
IN EFI_STOP_BITS_TYPE StopBits
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SERIAL_SET_CONTROL_BITS) (
|
||||
IN struct _SERIAL_IO_INTERFACE *This,
|
||||
IN UINT32 Control
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SERIAL_GET_CONTROL_BITS) (
|
||||
IN struct _SERIAL_IO_INTERFACE *This,
|
||||
OUT UINT32 *Control
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SERIAL_WRITE) (
|
||||
IN struct _SERIAL_IO_INTERFACE *This,
|
||||
IN OUT UINTN *BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SERIAL_READ) (
|
||||
IN struct _SERIAL_IO_INTERFACE *This,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
UINT32 ControlMask;
|
||||
|
||||
// current Attributes
|
||||
UINT32 Timeout;
|
||||
UINT64 BaudRate;
|
||||
UINT32 ReceiveFifoDepth;
|
||||
UINT32 DataBits;
|
||||
UINT32 Parity;
|
||||
UINT32 StopBits;
|
||||
} SERIAL_IO_MODE;
|
||||
|
||||
#define SERIAL_IO_INTERFACE_REVISION 0x00010000
|
||||
|
||||
typedef struct _SERIAL_IO_INTERFACE {
|
||||
UINT32 Revision;
|
||||
EFI_SERIAL_RESET Reset;
|
||||
EFI_SERIAL_SET_ATTRIBUTES SetAttributes;
|
||||
EFI_SERIAL_SET_CONTROL_BITS SetControl;
|
||||
EFI_SERIAL_GET_CONTROL_BITS GetControl;
|
||||
EFI_SERIAL_WRITE Write;
|
||||
EFI_SERIAL_READ Read;
|
||||
|
||||
SERIAL_IO_MODE *Mode;
|
||||
} SERIAL_IO_INTERFACE;
|
||||
|
||||
#endif
|
||||
|
||||
33
gnu-efi-3.0/inc/efistdarg.h
Normal file
33
gnu-efi-3.0/inc/efistdarg.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef _EFISTDARG_H_
|
||||
#define _EFISTDARG_H_
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
devpath.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Defines for parsing the EFI Device Path structures
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
#ifdef __GNUC__
|
||||
#include "stdarg.h"
|
||||
#else
|
||||
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(UINTN) - 1) & ~(sizeof(UINTN) - 1) )
|
||||
|
||||
typedef CHAR8 * va_list;
|
||||
|
||||
#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
|
||||
#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
|
||||
#define va_end(ap) ( ap = (va_list)0 )
|
||||
#endif
|
||||
|
||||
#endif /* _INC_STDARG */
|
||||
54
gnu-efi-3.0/inc/efiui.h
Normal file
54
gnu-efi-3.0/inc/efiui.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#ifndef _EFI_UI_H
|
||||
#define _EFI_UI_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 200 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
EfiUi.h
|
||||
|
||||
Abstract:
|
||||
Protocol used to build User Interface (UI) stuff.
|
||||
|
||||
This protocol is just data. It is a multi dimentional array.
|
||||
For each string there is an array of UI_STRING_ENTRY. Each string
|
||||
is for a different language translation of the same string. The list
|
||||
is terminated by a NULL UiString. There can be any number of
|
||||
UI_STRING_ENTRY arrays. A NULL array terminates the list. A NULL array
|
||||
entry contains all zeros.
|
||||
|
||||
Thus the shortest possible EFI_UI_PROTOCOL has three UI_STRING_ENTRY.
|
||||
The String, it's NULL terminator, and the NULL terminator for the entire
|
||||
thing.
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#define EFI_UI_PROTOCOL \
|
||||
{ 0x32dd7981, 0x2d27, 0x11d4, {0xbc, 0x8b, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
|
||||
|
||||
|
||||
typedef enum {
|
||||
UiDeviceString,
|
||||
UiVendorString,
|
||||
UiMaxString
|
||||
} UI_STRING_TYPE;
|
||||
|
||||
typedef struct {
|
||||
ISO_639_2 *LangCode;
|
||||
CHAR16 *UiString;
|
||||
} UI_STRING_ENTRY;
|
||||
|
||||
#define EFI_UI_VERSION 0x00010000
|
||||
|
||||
typedef struct _UI_INTERFACE {
|
||||
UINT32 Version;
|
||||
UI_STRING_ENTRY *Entry;
|
||||
} UI_INTERFACE;
|
||||
|
||||
|
||||
#endif
|
||||
282
gnu-efi-3.0/inc/ia32/efibind.h
Normal file
282
gnu-efi-3.0/inc/ia32/efibind.h
Normal file
|
|
@ -0,0 +1,282 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efefind.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI to compile bindings
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef __GNUC__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
//
|
||||
// Basic int types of various widths
|
||||
//
|
||||
|
||||
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
|
||||
|
||||
// No ANSI C 1999/2000 stdint.h integer width declarations
|
||||
|
||||
#if defined(_MSC_EXTENSIONS)
|
||||
|
||||
// Use Microsoft C compiler integer width declarations
|
||||
|
||||
typedef unsigned __int64 uint64_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#elif defined(__GNUC__)
|
||||
typedef unsigned long long uint64_t __attribute__((aligned (8)));
|
||||
typedef long long int64_t __attribute__((aligned (8)));
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#elif defined(UNIX_LP64)
|
||||
|
||||
/* Use LP64 programming model from C_FLAGS for integer width declarations */
|
||||
|
||||
typedef unsigned long uint64_t;
|
||||
typedef long int64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#else
|
||||
|
||||
/* Assume P64 programming model from C_FLAGS for integer width declarations */
|
||||
|
||||
typedef unsigned long long uint64_t __attribute__((aligned (8)));
|
||||
typedef long long int64_t __attribute__((aligned (8)));
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Basic EFI types of various widths
|
||||
//
|
||||
|
||||
#ifndef __WCHAR_TYPE__
|
||||
# define __WCHAR_TYPE__ short
|
||||
#endif
|
||||
|
||||
typedef uint64_t UINT64;
|
||||
typedef int64_t INT64;
|
||||
|
||||
#ifndef _BASETSD_H_
|
||||
typedef uint32_t UINT32;
|
||||
typedef int32_t INT32;
|
||||
#endif
|
||||
|
||||
typedef uint16_t UINT16;
|
||||
typedef int16_t INT16;
|
||||
typedef uint8_t UINT8;
|
||||
typedef int8_t INT8;
|
||||
typedef __WCHAR_TYPE__ WCHAR;
|
||||
|
||||
#undef VOID
|
||||
#define VOID void
|
||||
|
||||
|
||||
typedef int32_t INTN;
|
||||
typedef uint32_t UINTN;
|
||||
|
||||
#ifdef EFI_NT_EMULATOR
|
||||
#define POST_CODE(_Data)
|
||||
#else
|
||||
#ifdef EFI_DEBUG
|
||||
#define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al
|
||||
#else
|
||||
#define POST_CODE(_Data)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define EFIERR(a) (0x80000000 | a)
|
||||
#define EFI_ERROR_MASK 0x80000000
|
||||
#define EFIERR_OEM(a) (0xc0000000 | a)
|
||||
|
||||
|
||||
#define BAD_POINTER 0xFBFBFBFB
|
||||
#define MAX_ADDRESS 0xFFFFFFFF
|
||||
|
||||
#ifdef EFI_NT_EMULATOR
|
||||
#define BREAKPOINT() __asm { int 3 }
|
||||
#else
|
||||
#define BREAKPOINT() while (TRUE); // Make it hang on Bios[Dbg]32
|
||||
#endif
|
||||
|
||||
//
|
||||
// Pointers must be aligned to these address to function
|
||||
//
|
||||
|
||||
#define MIN_ALIGNMENT_SIZE 4
|
||||
|
||||
#define ALIGN_VARIABLE(Value ,Adjustment) \
|
||||
(UINTN)Adjustment = 0; \
|
||||
if((UINTN)Value % MIN_ALIGNMENT_SIZE) \
|
||||
(UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \
|
||||
Value = (UINTN)Value + (UINTN)Adjustment
|
||||
|
||||
|
||||
//
|
||||
// Define macros to build data structure signatures from characters.
|
||||
//
|
||||
|
||||
#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
|
||||
#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))
|
||||
#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))
|
||||
//
|
||||
// To export & import functions in the EFI emulator environment
|
||||
//
|
||||
|
||||
#ifdef EFI_NT_EMULATOR
|
||||
#define EXPORTAPI __declspec( dllexport )
|
||||
#else
|
||||
#define EXPORTAPI
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// EFIAPI - prototype calling convention for EFI function pointers
|
||||
// BOOTSERVICE - prototype for implementation of a boot service interface
|
||||
// RUNTIMESERVICE - prototype for implementation of a runtime service interface
|
||||
// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service
|
||||
// RUNTIME_CODE - pragma macro for declaring runtime code
|
||||
//
|
||||
|
||||
#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options
|
||||
#ifdef _MSC_EXTENSIONS
|
||||
#define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler
|
||||
#else
|
||||
#define EFIAPI // Substitute expresion to force C calling convention
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BOOTSERVICE
|
||||
//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a
|
||||
//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a
|
||||
#define RUNTIMESERVICE
|
||||
#define RUNTIMEFUNCTION
|
||||
|
||||
|
||||
#define RUNTIME_CODE(a) alloc_text("rtcode", a)
|
||||
#define BEGIN_RUNTIME_DATA() data_seg("rtdata")
|
||||
#define END_RUNTIME_DATA() data_seg("")
|
||||
|
||||
#define VOLATILE volatile
|
||||
|
||||
#define MEMORY_FENCE()
|
||||
|
||||
#ifdef EFI_NT_EMULATOR
|
||||
|
||||
//
|
||||
// To help ensure proper coding of integrated drivers, they are
|
||||
// compiled as DLLs. In NT they require a dll init entry pointer.
|
||||
// The macro puts a stub entry point into the DLL so it will load.
|
||||
//
|
||||
|
||||
#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
|
||||
UINTN \
|
||||
__stdcall \
|
||||
_DllMainCRTStartup ( \
|
||||
UINTN Inst, \
|
||||
UINTN reason_for_call, \
|
||||
VOID *rserved \
|
||||
) \
|
||||
{ \
|
||||
return 1; \
|
||||
} \
|
||||
\
|
||||
int \
|
||||
EXPORTAPI \
|
||||
__cdecl \
|
||||
InitializeDriver ( \
|
||||
void *ImageHandle, \
|
||||
void *SystemTable \
|
||||
) \
|
||||
{ \
|
||||
return InitFunction(ImageHandle, SystemTable); \
|
||||
}
|
||||
|
||||
|
||||
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
|
||||
(_if)->LoadInternal(type, name, NULL)
|
||||
|
||||
#else // EFI_NT_EMULATOR
|
||||
|
||||
//
|
||||
// When build similiar to FW, then link everything together as
|
||||
// one big module.
|
||||
//
|
||||
|
||||
#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
|
||||
UINTN \
|
||||
InitializeDriver ( \
|
||||
VOID *ImageHandle, \
|
||||
VOID *SystemTable \
|
||||
) \
|
||||
{ \
|
||||
return InitFunction(ImageHandle, \
|
||||
SystemTable); \
|
||||
} \
|
||||
\
|
||||
EFI_STATUS efi_main( \
|
||||
EFI_HANDLE image, \
|
||||
EFI_SYSTEM_TABLE *systab \
|
||||
) __attribute__((weak, \
|
||||
alias ("InitializeDriver")));
|
||||
|
||||
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
|
||||
(_if)->LoadInternal(type, name, entry)
|
||||
|
||||
#endif // EFI_FW_NT
|
||||
|
||||
//
|
||||
// Some compilers don't support the forward reference construct:
|
||||
// typedef struct XXXXX
|
||||
//
|
||||
// The following macro provide a workaround for such cases.
|
||||
//
|
||||
#ifdef NO_INTERFACE_DECL
|
||||
#define INTERFACE_DECL(x)
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define INTERFACE_DECL(x) struct x
|
||||
#else
|
||||
#define INTERFACE_DECL(x) typedef struct x
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* No efi call wrapper for IA32 architecture */
|
||||
#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
|
||||
#define EFI_FUNCTION
|
||||
|
||||
#ifdef _MSC_EXTENSIONS
|
||||
#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP
|
||||
#endif
|
||||
|
||||
26
gnu-efi-3.0/inc/ia32/efilibplat.h
Normal file
26
gnu-efi-3.0/inc/ia32/efilibplat.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efilibplat.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI to compile bindings
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
VOID
|
||||
InitializeLibPlatform (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
591
gnu-efi-3.0/inc/ia32/pe.h
Normal file
591
gnu-efi-3.0/inc/ia32/pe.h
Normal file
|
|
@ -0,0 +1,591 @@
|
|||
/*
|
||||
PE32+ header file
|
||||
*/
|
||||
#ifndef _PE_H
|
||||
#define _PE_H
|
||||
|
||||
#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ
|
||||
#define IMAGE_OS2_SIGNATURE 0x454E // NE
|
||||
#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE
|
||||
#define IMAGE_NT_SIGNATURE 0x00004550 // PE00
|
||||
#define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED
|
||||
|
||||
|
||||
typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header
|
||||
UINT16 e_magic; // Magic number
|
||||
UINT16 e_cblp; // Bytes on last page of file
|
||||
UINT16 e_cp; // Pages in file
|
||||
UINT16 e_crlc; // Relocations
|
||||
UINT16 e_cparhdr; // Size of header in paragraphs
|
||||
UINT16 e_minalloc; // Minimum extra paragraphs needed
|
||||
UINT16 e_maxalloc; // Maximum extra paragraphs needed
|
||||
UINT16 e_ss; // Initial (relative) SS value
|
||||
UINT16 e_sp; // Initial SP value
|
||||
UINT16 e_csum; // Checksum
|
||||
UINT16 e_ip; // Initial IP value
|
||||
UINT16 e_cs; // Initial (relative) CS value
|
||||
UINT16 e_lfarlc; // File address of relocation table
|
||||
UINT16 e_ovno; // Overlay number
|
||||
UINT16 e_res[4]; // Reserved words
|
||||
UINT16 e_oemid; // OEM identifier (for e_oeminfo)
|
||||
UINT16 e_oeminfo; // OEM information; e_oemid specific
|
||||
UINT16 e_res2[10]; // Reserved words
|
||||
UINT32 e_lfanew; // File address of new exe header
|
||||
} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
|
||||
|
||||
typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header
|
||||
UINT16 ne_magic; // Magic number
|
||||
UINT8 ne_ver; // Version number
|
||||
UINT8 ne_rev; // Revision number
|
||||
UINT16 ne_enttab; // Offset of Entry Table
|
||||
UINT16 ne_cbenttab; // Number of bytes in Entry Table
|
||||
UINT32 ne_crc; // Checksum of whole file
|
||||
UINT16 ne_flags; // Flag UINT16
|
||||
UINT16 ne_autodata; // Automatic data segment number
|
||||
UINT16 ne_heap; // Initial heap allocation
|
||||
UINT16 ne_stack; // Initial stack allocation
|
||||
UINT32 ne_csip; // Initial CS:IP setting
|
||||
UINT32 ne_sssp; // Initial SS:SP setting
|
||||
UINT16 ne_cseg; // Count of file segments
|
||||
UINT16 ne_cmod; // Entries in Module Reference Table
|
||||
UINT16 ne_cbnrestab; // Size of non-resident name table
|
||||
UINT16 ne_segtab; // Offset of Segment Table
|
||||
UINT16 ne_rsrctab; // Offset of Resource Table
|
||||
UINT16 ne_restab; // Offset of resident name table
|
||||
UINT16 ne_modtab; // Offset of Module Reference Table
|
||||
UINT16 ne_imptab; // Offset of Imported Names Table
|
||||
UINT32 ne_nrestab; // Offset of Non-resident Names Table
|
||||
UINT16 ne_cmovent; // Count of movable entries
|
||||
UINT16 ne_align; // Segment alignment shift count
|
||||
UINT16 ne_cres; // Count of resource segments
|
||||
UINT8 ne_exetyp; // Target Operating system
|
||||
UINT8 ne_flagsothers; // Other .EXE flags
|
||||
UINT16 ne_pretthunks; // offset to return thunks
|
||||
UINT16 ne_psegrefbytes; // offset to segment ref. bytes
|
||||
UINT16 ne_swaparea; // Minimum code swap area size
|
||||
UINT16 ne_expver; // Expected Windows version number
|
||||
} IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
|
||||
|
||||
//
|
||||
// File header format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_FILE_HEADER {
|
||||
UINT16 Machine;
|
||||
UINT16 NumberOfSections;
|
||||
UINT32 TimeDateStamp;
|
||||
UINT32 PointerToSymbolTable;
|
||||
UINT32 NumberOfSymbols;
|
||||
UINT16 SizeOfOptionalHeader;
|
||||
UINT16 Characteristics;
|
||||
} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
|
||||
|
||||
#define IMAGE_SIZEOF_FILE_HEADER 20
|
||||
|
||||
#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file.
|
||||
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references).
|
||||
#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file.
|
||||
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file.
|
||||
#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed.
|
||||
#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine.
|
||||
#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file
|
||||
#define IMAGE_FILE_SYSTEM 0x1000 // System File.
|
||||
#define IMAGE_FILE_DLL 0x2000 // File is a DLL.
|
||||
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed.
|
||||
|
||||
#define IMAGE_FILE_MACHINE_UNKNOWN 0
|
||||
#define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386.
|
||||
#define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian
|
||||
#define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian
|
||||
#define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP
|
||||
#define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian
|
||||
#define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine
|
||||
//
|
||||
// Directory format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_DATA_DIRECTORY {
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 Size;
|
||||
} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
|
||||
|
||||
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
|
||||
|
||||
//
|
||||
// Optional header format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_OPTIONAL_HEADER {
|
||||
//
|
||||
// Standard fields.
|
||||
//
|
||||
|
||||
UINT16 Magic;
|
||||
UINT8 MajorLinkerVersion;
|
||||
UINT8 MinorLinkerVersion;
|
||||
UINT32 SizeOfCode;
|
||||
UINT32 SizeOfInitializedData;
|
||||
UINT32 SizeOfUninitializedData;
|
||||
UINT32 AddressOfEntryPoint;
|
||||
UINT32 BaseOfCode;
|
||||
UINT32 BaseOfData;
|
||||
|
||||
//
|
||||
// NT additional fields.
|
||||
//
|
||||
|
||||
UINT32 ImageBase;
|
||||
UINT32 SectionAlignment;
|
||||
UINT32 FileAlignment;
|
||||
UINT16 MajorOperatingSystemVersion;
|
||||
UINT16 MinorOperatingSystemVersion;
|
||||
UINT16 MajorImageVersion;
|
||||
UINT16 MinorImageVersion;
|
||||
UINT16 MajorSubsystemVersion;
|
||||
UINT16 MinorSubsystemVersion;
|
||||
UINT32 Reserved1;
|
||||
UINT32 SizeOfImage;
|
||||
UINT32 SizeOfHeaders;
|
||||
UINT32 CheckSum;
|
||||
UINT16 Subsystem;
|
||||
UINT16 DllCharacteristics;
|
||||
UINT32 SizeOfStackReserve;
|
||||
UINT32 SizeOfStackCommit;
|
||||
UINT32 SizeOfHeapReserve;
|
||||
UINT32 SizeOfHeapCommit;
|
||||
UINT32 LoaderFlags;
|
||||
UINT32 NumberOfRvaAndSizes;
|
||||
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
|
||||
} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
|
||||
|
||||
typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
|
||||
UINT16 Magic;
|
||||
UINT8 MajorLinkerVersion;
|
||||
UINT8 MinorLinkerVersion;
|
||||
UINT32 SizeOfCode;
|
||||
UINT32 SizeOfInitializedData;
|
||||
UINT32 SizeOfUninitializedData;
|
||||
UINT32 AddressOfEntryPoint;
|
||||
UINT32 BaseOfCode;
|
||||
UINT32 BaseOfData;
|
||||
UINT32 BaseOfBss;
|
||||
UINT32 GprMask;
|
||||
UINT32 CprMask[4];
|
||||
UINT32 GpValue;
|
||||
} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER;
|
||||
|
||||
#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
|
||||
#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
|
||||
#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
|
||||
|
||||
#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
|
||||
#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
|
||||
|
||||
typedef struct _IMAGE_NT_HEADERS {
|
||||
UINT32 Signature;
|
||||
IMAGE_FILE_HEADER FileHeader;
|
||||
IMAGE_OPTIONAL_HEADER OptionalHeader;
|
||||
} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
|
||||
|
||||
typedef struct _IMAGE_ROM_HEADERS {
|
||||
IMAGE_FILE_HEADER FileHeader;
|
||||
IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
|
||||
} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS;
|
||||
|
||||
#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \
|
||||
((UINT32)ntheader + \
|
||||
FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \
|
||||
((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \
|
||||
))
|
||||
|
||||
|
||||
// Subsystem Values
|
||||
|
||||
#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem.
|
||||
#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem.
|
||||
#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem.
|
||||
#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem.
|
||||
#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem.
|
||||
#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix character subsystem.
|
||||
|
||||
|
||||
// Directory Entries
|
||||
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table
|
||||
#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String
|
||||
#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP)
|
||||
#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory
|
||||
|
||||
//
|
||||
// Section header format.
|
||||
//
|
||||
|
||||
#define IMAGE_SIZEOF_SHORT_NAME 8
|
||||
|
||||
typedef struct _IMAGE_SECTION_HEADER {
|
||||
UINT8 Name[IMAGE_SIZEOF_SHORT_NAME];
|
||||
union {
|
||||
UINT32 PhysicalAddress;
|
||||
UINT32 VirtualSize;
|
||||
} Misc;
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 SizeOfRawData;
|
||||
UINT32 PointerToRawData;
|
||||
UINT32 PointerToRelocations;
|
||||
UINT32 PointerToLinenumbers;
|
||||
UINT16 NumberOfRelocations;
|
||||
UINT16 NumberOfLinenumbers;
|
||||
UINT32 Characteristics;
|
||||
} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
|
||||
|
||||
#define IMAGE_SIZEOF_SECTION_HEADER 40
|
||||
|
||||
#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved.
|
||||
|
||||
#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code.
|
||||
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data.
|
||||
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data.
|
||||
|
||||
#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved.
|
||||
#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information.
|
||||
#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image.
|
||||
#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat.
|
||||
|
||||
#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 //
|
||||
#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 //
|
||||
#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 //
|
||||
#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 //
|
||||
#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified.
|
||||
#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 //
|
||||
#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 //
|
||||
|
||||
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded.
|
||||
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable.
|
||||
#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable.
|
||||
#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable.
|
||||
#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable.
|
||||
#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable.
|
||||
#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable.
|
||||
|
||||
//
|
||||
// Symbol format.
|
||||
//
|
||||
|
||||
|
||||
#define IMAGE_SIZEOF_SYMBOL 18
|
||||
|
||||
//
|
||||
// Section values.
|
||||
//
|
||||
// Symbols have a section number of the section in which they are
|
||||
// defined. Otherwise, section numbers have the following meanings:
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is undefined or is common.
|
||||
#define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an absolute value.
|
||||
#define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a special debug item.
|
||||
|
||||
//
|
||||
// Type (fundamental) values.
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_TYPE_NULL 0 // no type.
|
||||
#define IMAGE_SYM_TYPE_VOID 1 //
|
||||
#define IMAGE_SYM_TYPE_CHAR 2 // type character.
|
||||
#define IMAGE_SYM_TYPE_SHORT 3 // type short integer.
|
||||
#define IMAGE_SYM_TYPE_INT 4 //
|
||||
#define IMAGE_SYM_TYPE_LONG 5 //
|
||||
#define IMAGE_SYM_TYPE_FLOAT 6 //
|
||||
#define IMAGE_SYM_TYPE_DOUBLE 7 //
|
||||
#define IMAGE_SYM_TYPE_STRUCT 8 //
|
||||
#define IMAGE_SYM_TYPE_UNION 9 //
|
||||
#define IMAGE_SYM_TYPE_ENUM 10 // enumeration.
|
||||
#define IMAGE_SYM_TYPE_MOE 11 // member of enumeration.
|
||||
#define IMAGE_SYM_TYPE_BYTE 12 //
|
||||
#define IMAGE_SYM_TYPE_WORD 13 //
|
||||
#define IMAGE_SYM_TYPE_UINT 14 //
|
||||
#define IMAGE_SYM_TYPE_DWORD 15 //
|
||||
|
||||
//
|
||||
// Type (derived) values.
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_DTYPE_NULL 0 // no derived type.
|
||||
#define IMAGE_SYM_DTYPE_POINTER 1 // pointer.
|
||||
#define IMAGE_SYM_DTYPE_FUNCTION 2 // function.
|
||||
#define IMAGE_SYM_DTYPE_ARRAY 3 // array.
|
||||
|
||||
//
|
||||
// Storage classes.
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
|
||||
#define IMAGE_SYM_CLASS_NULL 0
|
||||
#define IMAGE_SYM_CLASS_AUTOMATIC 1
|
||||
#define IMAGE_SYM_CLASS_EXTERNAL 2
|
||||
#define IMAGE_SYM_CLASS_STATIC 3
|
||||
#define IMAGE_SYM_CLASS_REGISTER 4
|
||||
#define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
|
||||
#define IMAGE_SYM_CLASS_LABEL 6
|
||||
#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
|
||||
#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
|
||||
#define IMAGE_SYM_CLASS_ARGUMENT 9
|
||||
#define IMAGE_SYM_CLASS_STRUCT_TAG 10
|
||||
#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
|
||||
#define IMAGE_SYM_CLASS_UNION_TAG 12
|
||||
#define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
|
||||
#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
|
||||
#define IMAGE_SYM_CLASS_ENUM_TAG 15
|
||||
#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
|
||||
#define IMAGE_SYM_CLASS_REGISTER_PARAM 17
|
||||
#define IMAGE_SYM_CLASS_BIT_FIELD 18
|
||||
#define IMAGE_SYM_CLASS_BLOCK 100
|
||||
#define IMAGE_SYM_CLASS_FUNCTION 101
|
||||
#define IMAGE_SYM_CLASS_END_OF_STRUCT 102
|
||||
#define IMAGE_SYM_CLASS_FILE 103
|
||||
// new
|
||||
#define IMAGE_SYM_CLASS_SECTION 104
|
||||
#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
|
||||
|
||||
// type packing constants
|
||||
|
||||
#define N_BTMASK 017
|
||||
#define N_TMASK 060
|
||||
#define N_TMASK1 0300
|
||||
#define N_TMASK2 0360
|
||||
#define N_BTSHFT 4
|
||||
#define N_TSHIFT 2
|
||||
|
||||
// MACROS
|
||||
|
||||
//
|
||||
// Communal selection types.
|
||||
//
|
||||
|
||||
#define IMAGE_COMDAT_SELECT_NODUPLICATES 1
|
||||
#define IMAGE_COMDAT_SELECT_ANY 2
|
||||
#define IMAGE_COMDAT_SELECT_SAME_SIZE 3
|
||||
#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
|
||||
#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
|
||||
|
||||
#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
|
||||
#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
|
||||
#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
|
||||
|
||||
|
||||
//
|
||||
// Relocation format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_RELOCATION {
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 SymbolTableIndex;
|
||||
UINT16 Type;
|
||||
} IMAGE_RELOCATION;
|
||||
|
||||
#define IMAGE_SIZEOF_RELOCATION 10
|
||||
|
||||
//
|
||||
// I386 relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary
|
||||
#define IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address
|
||||
#define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address
|
||||
#define IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address
|
||||
#define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included
|
||||
#define IMAGE_REL_I386_SEG12 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
|
||||
#define IMAGE_REL_I386_SECTION 012
|
||||
#define IMAGE_REL_I386_SECREL 013
|
||||
#define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address
|
||||
|
||||
//
|
||||
// MIPS relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is absolute, no relocation is necessary
|
||||
#define IMAGE_REL_MIPS_REFHALF 01
|
||||
#define IMAGE_REL_MIPS_REFWORD 02
|
||||
#define IMAGE_REL_MIPS_JMPADDR 03
|
||||
#define IMAGE_REL_MIPS_REFHI 04
|
||||
#define IMAGE_REL_MIPS_REFLO 05
|
||||
#define IMAGE_REL_MIPS_GPREL 06
|
||||
#define IMAGE_REL_MIPS_LITERAL 07
|
||||
#define IMAGE_REL_MIPS_SECTION 012
|
||||
#define IMAGE_REL_MIPS_SECREL 013
|
||||
#define IMAGE_REL_MIPS_REFWORDNB 042
|
||||
#define IMAGE_REL_MIPS_PAIR 045
|
||||
|
||||
//
|
||||
// Alpha Relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_ALPHA_ABSOLUTE 0x0
|
||||
#define IMAGE_REL_ALPHA_REFLONG 0x1
|
||||
#define IMAGE_REL_ALPHA_REFQUAD 0x2
|
||||
#define IMAGE_REL_ALPHA_GPREL32 0x3
|
||||
#define IMAGE_REL_ALPHA_LITERAL 0x4
|
||||
#define IMAGE_REL_ALPHA_LITUSE 0x5
|
||||
#define IMAGE_REL_ALPHA_GPDISP 0x6
|
||||
#define IMAGE_REL_ALPHA_BRADDR 0x7
|
||||
#define IMAGE_REL_ALPHA_HINT 0x8
|
||||
#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9
|
||||
#define IMAGE_REL_ALPHA_REFHI 0xA
|
||||
#define IMAGE_REL_ALPHA_REFLO 0xB
|
||||
#define IMAGE_REL_ALPHA_PAIR 0xC
|
||||
#define IMAGE_REL_ALPHA_MATCH 0xD
|
||||
#define IMAGE_REL_ALPHA_SECTION 0xE
|
||||
#define IMAGE_REL_ALPHA_SECREL 0xF
|
||||
#define IMAGE_REL_ALPHA_REFLONGNB 0x10
|
||||
|
||||
//
|
||||
// IBM PowerPC relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP
|
||||
#define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address
|
||||
#define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address
|
||||
#define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2 (branch absolute)
|
||||
#define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address
|
||||
#define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load doubleword)
|
||||
#define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted left 2 (branch relative)
|
||||
#define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted left 2 (br cond relative)
|
||||
#define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base
|
||||
#define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted left 2 (load doubleword)
|
||||
|
||||
#define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base
|
||||
#define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an image sectionhdr)
|
||||
#define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number
|
||||
#define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction iff symbol is glue code
|
||||
#define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address is TOC restore instruction
|
||||
|
||||
#define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in IMAGE_RELOCATION.Type
|
||||
|
||||
// Flag bits in IMAGE_RELOCATION.TYPE
|
||||
|
||||
#define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than adding it
|
||||
#define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict branch taken
|
||||
#define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict branch not taken
|
||||
#define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data in toc)
|
||||
|
||||
//
|
||||
// Based relocation format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_BASE_RELOCATION {
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 SizeOfBlock;
|
||||
// UINT16 TypeOffset[1];
|
||||
} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION;
|
||||
|
||||
#define IMAGE_SIZEOF_BASE_RELOCATION 8
|
||||
|
||||
//
|
||||
// Based relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_BASED_ABSOLUTE 0
|
||||
#define IMAGE_REL_BASED_HIGH 1
|
||||
#define IMAGE_REL_BASED_LOW 2
|
||||
#define IMAGE_REL_BASED_HIGHLOW 3
|
||||
#define IMAGE_REL_BASED_HIGHADJ 4
|
||||
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
|
||||
#define IMAGE_REL_BASED_IA64_IMM64 9
|
||||
#define IMAGE_REL_BASED_DIR64 10
|
||||
|
||||
//
|
||||
// Line number format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_LINENUMBER {
|
||||
union {
|
||||
UINT32 SymbolTableIndex; // Symbol table index of function name if Linenumber is 0.
|
||||
UINT32 VirtualAddress; // Virtual address of line number.
|
||||
} Type;
|
||||
UINT16 Linenumber; // Line number.
|
||||
} IMAGE_LINENUMBER;
|
||||
|
||||
#define IMAGE_SIZEOF_LINENUMBER 6
|
||||
|
||||
//
|
||||
// Archive format.
|
||||
//
|
||||
|
||||
#define IMAGE_ARCHIVE_START_SIZE 8
|
||||
#define IMAGE_ARCHIVE_START "!<arch>\n"
|
||||
#define IMAGE_ARCHIVE_END "`\n"
|
||||
#define IMAGE_ARCHIVE_PAD "\n"
|
||||
#define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
|
||||
#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
|
||||
|
||||
typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
|
||||
UINT8 Name[16]; // File member name - `/' terminated.
|
||||
UINT8 Date[12]; // File member date - decimal.
|
||||
UINT8 UserID[6]; // File member user id - decimal.
|
||||
UINT8 GroupID[6]; // File member group id - decimal.
|
||||
UINT8 Mode[8]; // File member mode - octal.
|
||||
UINT8 Size[10]; // File member size - decimal.
|
||||
UINT8 EndHeader[2]; // String to end header.
|
||||
} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
|
||||
|
||||
#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
|
||||
|
||||
//
|
||||
// DLL support.
|
||||
//
|
||||
|
||||
//
|
||||
// Export Format
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_EXPORT_DIRECTORY {
|
||||
UINT32 Characteristics;
|
||||
UINT32 TimeDateStamp;
|
||||
UINT16 MajorVersion;
|
||||
UINT16 MinorVersion;
|
||||
UINT32 Name;
|
||||
UINT32 Base;
|
||||
UINT32 NumberOfFunctions;
|
||||
UINT32 NumberOfNames;
|
||||
UINT32 *AddressOfFunctions;
|
||||
UINT32 *AddressOfNames;
|
||||
UINT32 *AddressOfNameOrdinals;
|
||||
} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
|
||||
|
||||
//
|
||||
// Import Format
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_IMPORT_BY_NAME {
|
||||
UINT16 Hint;
|
||||
UINT8 Name[1];
|
||||
} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME;
|
||||
|
||||
typedef struct _IMAGE_THUNK_DATA {
|
||||
union {
|
||||
UINT32 Function;
|
||||
UINT32 Ordinal;
|
||||
PIMAGE_IMPORT_BY_NAME AddressOfData;
|
||||
} u1;
|
||||
} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA;
|
||||
|
||||
#define IMAGE_ORDINAL_FLAG 0x80000000
|
||||
#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
|
||||
#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
|
||||
|
||||
typedef struct _IMAGE_IMPORT_DESCRIPTOR {
|
||||
UINT32 Characteristics;
|
||||
UINT32 TimeDateStamp;
|
||||
UINT32 ForwarderChain;
|
||||
UINT32 Name;
|
||||
PIMAGE_THUNK_DATA FirstThunk;
|
||||
} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR;
|
||||
|
||||
#endif
|
||||
223
gnu-efi-3.0/inc/ia64/efibind.h
Normal file
223
gnu-efi-3.0/inc/ia64/efibind.h
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efefind.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI to compile bindings
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
//
|
||||
// Basic int types of various widths
|
||||
//
|
||||
|
||||
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
|
||||
|
||||
// No ANSI C 1999/2000 stdint.h integer width declarations
|
||||
|
||||
#ifdef _MSC_EXTENSIONS
|
||||
// Use Microsoft C compiler integer width declarations
|
||||
|
||||
typedef unsigned __int64 uint64_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int8 int8_t;
|
||||
#elif defined(UNIX_LP64)
|
||||
// Use LP64 programming model from C_FLAGS for integer width declarations
|
||||
|
||||
typedef unsigned long uint64_t;
|
||||
typedef long int64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#else
|
||||
// Assume P64 programming model from C_FLAGS for integer width declarations
|
||||
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef long long int64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Basic EFI types of various widths
|
||||
//
|
||||
#ifndef __WCHAR_TYPE__
|
||||
# define __WCHAR_TYPE__ short
|
||||
#endif
|
||||
|
||||
|
||||
typedef uint64_t UINT64;
|
||||
typedef int64_t INT64;
|
||||
typedef uint32_t UINT32;
|
||||
typedef int32_t INT32;
|
||||
typedef uint16_t UINT16;
|
||||
typedef int16_t INT16;
|
||||
typedef uint8_t UINT8;
|
||||
typedef int8_t INT8;
|
||||
typedef __WCHAR_TYPE__ WCHAR;
|
||||
|
||||
|
||||
#undef VOID
|
||||
#define VOID void
|
||||
|
||||
|
||||
typedef int64_t INTN;
|
||||
typedef uint64_t UINTN;
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// BugBug: Code to debug
|
||||
//
|
||||
#define BIT63 0x8000000000000000
|
||||
|
||||
#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63)
|
||||
#define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) )
|
||||
|
||||
//
|
||||
// Macro's with casts make this much easier to use and read.
|
||||
//
|
||||
#define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port)))
|
||||
#define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data))
|
||||
//
|
||||
// BugBug: End Debug Code!!!
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
#define EFIERR(a) (0x8000000000000000 | a)
|
||||
#define EFI_ERROR_MASK 0x8000000000000000
|
||||
#define EFIERR_OEM(a) (0xc000000000000000 | a)
|
||||
|
||||
#define BAD_POINTER 0xFBFBFBFBFBFBFBFB
|
||||
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
|
||||
|
||||
#define BREAKPOINT() while (TRUE)
|
||||
|
||||
//
|
||||
// Pointers must be aligned to these address to function
|
||||
// you will get an alignment fault if this value is less than 8
|
||||
//
|
||||
#define MIN_ALIGNMENT_SIZE 8
|
||||
|
||||
#define ALIGN_VARIABLE(Value , Adjustment) \
|
||||
(UINTN) Adjustment = 0; \
|
||||
if((UINTN)Value % MIN_ALIGNMENT_SIZE) \
|
||||
(UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \
|
||||
Value = (UINTN)Value + (UINTN)Adjustment
|
||||
|
||||
//
|
||||
// Define macros to create data structure signatures.
|
||||
//
|
||||
|
||||
#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
|
||||
#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))
|
||||
#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))
|
||||
//
|
||||
// To export & import functions in the EFI emulator environment
|
||||
//
|
||||
|
||||
#define EXPORTAPI
|
||||
|
||||
//
|
||||
// EFIAPI - prototype calling convention for EFI function pointers
|
||||
// BOOTSERVICE - prototype for implementation of a boot service interface
|
||||
// RUNTIMESERVICE - prototype for implementation of a runtime service interface
|
||||
// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service
|
||||
// RUNTIME_CODE - pragma macro for declaring runtime code
|
||||
//
|
||||
|
||||
#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options
|
||||
#ifdef _MSC_EXTENSIONS
|
||||
#define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler
|
||||
#else
|
||||
#define EFIAPI // Substitute expresion to force C calling convention
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BOOTSERVICE
|
||||
#define RUNTIMESERVICE
|
||||
#define RUNTIMEFUNCTION
|
||||
|
||||
#define RUNTIME_CODE(a) alloc_text("rtcode", a)
|
||||
#define BEGIN_RUNTIME_DATA() data_seg("rtdata")
|
||||
#define END_RUNTIME_DATA() data_seg("")
|
||||
|
||||
#define VOLATILE volatile
|
||||
|
||||
//
|
||||
// BugBug: Need to find out if this is portable accross compliers.
|
||||
//
|
||||
#ifdef __GNUC__
|
||||
#define MEMORY_FENCE() __asm__ __volatile__ ("mf.a" ::: "memory")
|
||||
#else
|
||||
void __mf (void);
|
||||
#pragma intrinsic (__mf)
|
||||
#define MEMORY_FENCE() __mf()
|
||||
#endif
|
||||
//
|
||||
// When build similiar to FW, then link everything together as
|
||||
// one big module.
|
||||
//
|
||||
|
||||
#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
|
||||
UINTN \
|
||||
InitializeDriver ( \
|
||||
VOID *ImageHandle, \
|
||||
VOID *SystemTable \
|
||||
) \
|
||||
{ \
|
||||
return InitFunction(ImageHandle, \
|
||||
SystemTable); \
|
||||
} \
|
||||
\
|
||||
EFI_STATUS efi_main( \
|
||||
EFI_HANDLE image, \
|
||||
EFI_SYSTEM_TABLE *systab \
|
||||
) __attribute__((weak, \
|
||||
alias ("InitializeDriver")));
|
||||
|
||||
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
|
||||
(_if)->LoadInternal(type, name, entry)
|
||||
|
||||
//
|
||||
// Some compilers don't support the forward reference construct:
|
||||
// typedef struct XXXXX
|
||||
//
|
||||
// The following macro provide a workaround for such cases.
|
||||
//
|
||||
#ifdef NO_INTERFACE_DECL
|
||||
#define INTERFACE_DECL(x)
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define INTERFACE_DECL(x) struct x
|
||||
#else
|
||||
#define INTERFACE_DECL(x) typedef struct x
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* No efi call wrapper for IA32 architecture */
|
||||
#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
|
||||
#define EFI_FUNCTION
|
||||
80
gnu-efi-3.0/inc/ia64/efilibplat.h
Normal file
80
gnu-efi-3.0/inc/ia64/efilibplat.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
#ifndef _EFI_LIB_PLAT_H
|
||||
#define _EFI_LIB_PLAT_H
|
||||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efilibplat.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI to compile bindings
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "salproc.h"
|
||||
|
||||
|
||||
VOID
|
||||
InitializeLibPlatform (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
VOID
|
||||
LibInitSalAndPalProc(
|
||||
OUT PLABEL *SalPlabel,
|
||||
OUT UINT64 *PalEntry
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibGetSalIoPortMapping (
|
||||
OUT UINT64 *IoPortMapping
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibGetSalIpiBlock (
|
||||
OUT UINT64 *IpiBlock
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibGetSalWakeupVector (
|
||||
OUT UINT64 *WakeVector
|
||||
);
|
||||
|
||||
VOID *
|
||||
LibSearchSalSystemTable (
|
||||
IN UINT8 EntryType
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
LibSalProc (
|
||||
IN UINT64 Arg1,
|
||||
IN UINT64 Arg2,
|
||||
IN UINT64 Arg3,
|
||||
IN UINT64 Arg4,
|
||||
IN UINT64 Arg5,
|
||||
IN UINT64 Arg6,
|
||||
IN UINT64 Arg7,
|
||||
IN UINT64 Arg8,
|
||||
OUT rArg *Results OPTIONAL
|
||||
);
|
||||
|
||||
VOID
|
||||
LibPalProc (
|
||||
IN UINT64 Arg1,
|
||||
IN UINT64 Arg2,
|
||||
IN UINT64 Arg3,
|
||||
IN UINT64 Arg4,
|
||||
OUT rArg *Results OPTIONAL
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
597
gnu-efi-3.0/inc/ia64/pe.h
Normal file
597
gnu-efi-3.0/inc/ia64/pe.h
Normal file
|
|
@ -0,0 +1,597 @@
|
|||
/*
|
||||
PE32+ header file
|
||||
*/
|
||||
#ifndef _PE_H
|
||||
#define _PE_H
|
||||
|
||||
#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ
|
||||
#define IMAGE_OS2_SIGNATURE 0x454E // NE
|
||||
#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE
|
||||
#define IMAGE_NT_SIGNATURE 0x00004550 // PE00
|
||||
#define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED
|
||||
|
||||
/*****************************************************************************
|
||||
* The following stuff comes from winnt.h from the ia64sdk, plus the Plabel for
|
||||
* loading EM executables.
|
||||
*****************************************************************************/
|
||||
//
|
||||
// Intel IA64 specific
|
||||
//
|
||||
|
||||
#define IMAGE_REL_BASED_IA64_IMM64 9
|
||||
#define IMAGE_REL_BASED_IA64_DIR64 10
|
||||
|
||||
struct Plabel {
|
||||
UINT64 EntryPoint;
|
||||
UINT64 NewGP;
|
||||
};
|
||||
|
||||
typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header
|
||||
UINT16 e_magic; // Magic number
|
||||
UINT16 e_cblp; // Bytes on last page of file
|
||||
UINT16 e_cp; // Pages in file
|
||||
UINT16 e_crlc; // Relocations
|
||||
UINT16 e_cparhdr; // Size of header in paragraphs
|
||||
UINT16 e_minalloc; // Minimum extra paragraphs needed
|
||||
UINT16 e_maxalloc; // Maximum extra paragraphs needed
|
||||
UINT16 e_ss; // Initial (relative) SS value
|
||||
UINT16 e_sp; // Initial SP value
|
||||
UINT16 e_csum; // Checksum
|
||||
UINT16 e_ip; // Initial IP value
|
||||
UINT16 e_cs; // Initial (relative) CS value
|
||||
UINT16 e_lfarlc; // File address of relocation table
|
||||
UINT16 e_ovno; // Overlay number
|
||||
UINT16 e_res[4]; // Reserved words
|
||||
UINT16 e_oemid; // OEM identifier (for e_oeminfo)
|
||||
UINT16 e_oeminfo; // OEM information; e_oemid specific
|
||||
UINT16 e_res2[10]; // Reserved words
|
||||
UINT32 e_lfanew; // File address of new exe header
|
||||
} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
|
||||
|
||||
typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header
|
||||
UINT16 ne_magic; // Magic number
|
||||
UINT8 ne_ver; // Version number
|
||||
UINT8 ne_rev; // Revision number
|
||||
UINT16 ne_enttab; // Offset of Entry Table
|
||||
UINT16 ne_cbenttab; // Number of bytes in Entry Table
|
||||
UINT32 ne_crc; // Checksum of whole file
|
||||
UINT16 ne_flags; // Flag UINT16
|
||||
UINT16 ne_autodata; // Automatic data segment number
|
||||
UINT16 ne_heap; // Initial heap allocation
|
||||
UINT16 ne_stack; // Initial stack allocation
|
||||
UINT32 ne_csip; // Initial CS:IP setting
|
||||
UINT32 ne_sssp; // Initial SS:SP setting
|
||||
UINT16 ne_cseg; // Count of file segments
|
||||
UINT16 ne_cmod; // Entries in Module Reference Table
|
||||
UINT16 ne_cbnrestab; // Size of non-resident name table
|
||||
UINT16 ne_segtab; // Offset of Segment Table
|
||||
UINT16 ne_rsrctab; // Offset of Resource Table
|
||||
UINT16 ne_restab; // Offset of resident name table
|
||||
UINT16 ne_modtab; // Offset of Module Reference Table
|
||||
UINT16 ne_imptab; // Offset of Imported Names Table
|
||||
UINT32 ne_nrestab; // Offset of Non-resident Names Table
|
||||
UINT16 ne_cmovent; // Count of movable entries
|
||||
UINT16 ne_align; // Segment alignment shift count
|
||||
UINT16 ne_cres; // Count of resource segments
|
||||
UINT8 ne_exetyp; // Target Operating system
|
||||
UINT8 ne_flagsothers; // Other .EXE flags
|
||||
UINT16 ne_pretthunks; // offset to return thunks
|
||||
UINT16 ne_psegrefbytes; // offset to segment ref. bytes
|
||||
UINT16 ne_swaparea; // Minimum code swap area size
|
||||
UINT16 ne_expver; // Expected Windows version number
|
||||
} IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
|
||||
|
||||
//
|
||||
// File header format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_FILE_HEADER {
|
||||
UINT16 Machine;
|
||||
UINT16 NumberOfSections;
|
||||
UINT32 TimeDateStamp;
|
||||
UINT32 PointerToSymbolTable;
|
||||
UINT32 NumberOfSymbols;
|
||||
UINT16 SizeOfOptionalHeader;
|
||||
UINT16 Characteristics;
|
||||
} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
|
||||
|
||||
#define IMAGE_SIZEOF_FILE_HEADER 20
|
||||
|
||||
#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file.
|
||||
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references).
|
||||
#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file.
|
||||
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file.
|
||||
#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed.
|
||||
#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine.
|
||||
#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file
|
||||
#define IMAGE_FILE_SYSTEM 0x1000 // System File.
|
||||
#define IMAGE_FILE_DLL 0x2000 // File is a DLL.
|
||||
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed.
|
||||
|
||||
#define IMAGE_FILE_MACHINE_UNKNOWN 0
|
||||
#define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386.
|
||||
#define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian
|
||||
#define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian
|
||||
#define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP
|
||||
#define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian
|
||||
#define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine
|
||||
//
|
||||
// Directory format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_DATA_DIRECTORY {
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 Size;
|
||||
} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
|
||||
|
||||
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
|
||||
|
||||
|
||||
typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
|
||||
UINT16 Magic;
|
||||
UINT8 MajorLinkerVersion;
|
||||
UINT8 MinorLinkerVersion;
|
||||
UINT32 SizeOfCode;
|
||||
UINT32 SizeOfInitializedData;
|
||||
UINT32 SizeOfUninitializedData;
|
||||
UINT32 AddressOfEntryPoint;
|
||||
UINT32 BaseOfCode;
|
||||
UINT32 BaseOfData;
|
||||
UINT32 BaseOfBss;
|
||||
UINT32 GprMask;
|
||||
UINT32 CprMask[4];
|
||||
UINT32 GpValue;
|
||||
} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER;
|
||||
|
||||
typedef struct _IMAGE_OPTIONAL_HEADER {
|
||||
UINT16 Magic;
|
||||
UINT8 MajorLinkerVersion;
|
||||
UINT8 MinorLinkerVersion;
|
||||
UINT32 SizeOfCode;
|
||||
UINT32 SizeOfInitializedData;
|
||||
UINT32 SizeOfUninitializedData;
|
||||
UINT32 AddressOfEntryPoint;
|
||||
UINT32 BaseOfCode;
|
||||
// UINT32 BaseOfData;
|
||||
UINT64 ImageBase;
|
||||
UINT32 SectionAlignment;
|
||||
UINT32 FileAlignment;
|
||||
UINT16 MajorOperatingSystemVersion;
|
||||
UINT16 MinorOperatingSystemVersion;
|
||||
UINT16 MajorImageVersion;
|
||||
UINT16 MinorImageVersion;
|
||||
UINT16 MajorSubsystemVersion;
|
||||
UINT16 MinorSubsystemVersion;
|
||||
UINT32 Win32VersionValue;
|
||||
UINT32 SizeOfImage;
|
||||
UINT32 SizeOfHeaders;
|
||||
UINT32 CheckSum;
|
||||
UINT16 Subsystem;
|
||||
UINT16 DllCharacteristics;
|
||||
UINT64 SizeOfStackReserve;
|
||||
UINT64 SizeOfStackCommit;
|
||||
UINT64 SizeOfHeapReserve;
|
||||
UINT64 SizeOfHeapCommit;
|
||||
UINT32 LoaderFlags;
|
||||
UINT32 NumberOfRvaAndSizes;
|
||||
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
|
||||
} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
|
||||
|
||||
|
||||
#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
|
||||
#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
|
||||
#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
|
||||
#define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 244
|
||||
|
||||
#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
|
||||
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
|
||||
#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
|
||||
|
||||
typedef struct _IMAGE_NT_HEADERS {
|
||||
UINT32 Signature;
|
||||
IMAGE_FILE_HEADER FileHeader;
|
||||
IMAGE_OPTIONAL_HEADER OptionalHeader;
|
||||
} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
|
||||
|
||||
typedef struct _IMAGE_ROM_HEADERS {
|
||||
IMAGE_FILE_HEADER FileHeader;
|
||||
IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
|
||||
} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS;
|
||||
|
||||
#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \
|
||||
((UINT32)ntheader + \
|
||||
FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \
|
||||
((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \
|
||||
))
|
||||
|
||||
|
||||
// Subsystem Values
|
||||
|
||||
#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem.
|
||||
#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem.
|
||||
#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem.
|
||||
#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem.
|
||||
#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem.
|
||||
#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix character subsystem.
|
||||
|
||||
|
||||
// Directory Entries
|
||||
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table
|
||||
#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String
|
||||
#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP)
|
||||
#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory
|
||||
|
||||
//
|
||||
// Section header format.
|
||||
//
|
||||
|
||||
#define IMAGE_SIZEOF_SHORT_NAME 8
|
||||
|
||||
typedef struct _IMAGE_SECTION_HEADER {
|
||||
UINT8 Name[IMAGE_SIZEOF_SHORT_NAME];
|
||||
union {
|
||||
UINT32 PhysicalAddress;
|
||||
UINT32 VirtualSize;
|
||||
} Misc;
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 SizeOfRawData;
|
||||
UINT32 PointerToRawData;
|
||||
UINT32 PointerToRelocations;
|
||||
UINT32 PointerToLinenumbers;
|
||||
UINT16 NumberOfRelocations;
|
||||
UINT16 NumberOfLinenumbers;
|
||||
UINT32 Characteristics;
|
||||
} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
|
||||
|
||||
#define IMAGE_SIZEOF_SECTION_HEADER 40
|
||||
|
||||
#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved.
|
||||
|
||||
#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code.
|
||||
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data.
|
||||
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data.
|
||||
|
||||
#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved.
|
||||
#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information.
|
||||
#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image.
|
||||
#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat.
|
||||
|
||||
#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 //
|
||||
#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 //
|
||||
#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 //
|
||||
#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 //
|
||||
#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified.
|
||||
#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 //
|
||||
#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 //
|
||||
|
||||
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded.
|
||||
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable.
|
||||
#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable.
|
||||
#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable.
|
||||
#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable.
|
||||
#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable.
|
||||
#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable.
|
||||
|
||||
//
|
||||
// Symbol format.
|
||||
//
|
||||
|
||||
|
||||
#define IMAGE_SIZEOF_SYMBOL 18
|
||||
|
||||
//
|
||||
// Section values.
|
||||
//
|
||||
// Symbols have a section number of the section in which they are
|
||||
// defined. Otherwise, section numbers have the following meanings:
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is undefined or is common.
|
||||
#define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an absolute value.
|
||||
#define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a special debug item.
|
||||
|
||||
//
|
||||
// Type (fundamental) values.
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_TYPE_NULL 0 // no type.
|
||||
#define IMAGE_SYM_TYPE_VOID 1 //
|
||||
#define IMAGE_SYM_TYPE_CHAR 2 // type character.
|
||||
#define IMAGE_SYM_TYPE_SHORT 3 // type short integer.
|
||||
#define IMAGE_SYM_TYPE_INT 4 //
|
||||
#define IMAGE_SYM_TYPE_LONG 5 //
|
||||
#define IMAGE_SYM_TYPE_FLOAT 6 //
|
||||
#define IMAGE_SYM_TYPE_DOUBLE 7 //
|
||||
#define IMAGE_SYM_TYPE_STRUCT 8 //
|
||||
#define IMAGE_SYM_TYPE_UNION 9 //
|
||||
#define IMAGE_SYM_TYPE_ENUM 10 // enumeration.
|
||||
#define IMAGE_SYM_TYPE_MOE 11 // member of enumeration.
|
||||
#define IMAGE_SYM_TYPE_BYTE 12 //
|
||||
#define IMAGE_SYM_TYPE_WORD 13 //
|
||||
#define IMAGE_SYM_TYPE_UINT 14 //
|
||||
#define IMAGE_SYM_TYPE_DWORD 15 //
|
||||
|
||||
//
|
||||
// Type (derived) values.
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_DTYPE_NULL 0 // no derived type.
|
||||
#define IMAGE_SYM_DTYPE_POINTER 1 // pointer.
|
||||
#define IMAGE_SYM_DTYPE_FUNCTION 2 // function.
|
||||
#define IMAGE_SYM_DTYPE_ARRAY 3 // array.
|
||||
|
||||
//
|
||||
// Storage classes.
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
|
||||
#define IMAGE_SYM_CLASS_NULL 0
|
||||
#define IMAGE_SYM_CLASS_AUTOMATIC 1
|
||||
#define IMAGE_SYM_CLASS_EXTERNAL 2
|
||||
#define IMAGE_SYM_CLASS_STATIC 3
|
||||
#define IMAGE_SYM_CLASS_REGISTER 4
|
||||
#define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
|
||||
#define IMAGE_SYM_CLASS_LABEL 6
|
||||
#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
|
||||
#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
|
||||
#define IMAGE_SYM_CLASS_ARGUMENT 9
|
||||
#define IMAGE_SYM_CLASS_STRUCT_TAG 10
|
||||
#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
|
||||
#define IMAGE_SYM_CLASS_UNION_TAG 12
|
||||
#define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
|
||||
#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
|
||||
#define IMAGE_SYM_CLASS_ENUM_TAG 15
|
||||
#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
|
||||
#define IMAGE_SYM_CLASS_REGISTER_PARAM 17
|
||||
#define IMAGE_SYM_CLASS_BIT_FIELD 18
|
||||
#define IMAGE_SYM_CLASS_BLOCK 100
|
||||
#define IMAGE_SYM_CLASS_FUNCTION 101
|
||||
#define IMAGE_SYM_CLASS_END_OF_STRUCT 102
|
||||
#define IMAGE_SYM_CLASS_FILE 103
|
||||
// new
|
||||
#define IMAGE_SYM_CLASS_SECTION 104
|
||||
#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
|
||||
|
||||
// type packing constants
|
||||
|
||||
#define N_BTMASK 017
|
||||
#define N_TMASK 060
|
||||
#define N_TMASK1 0300
|
||||
#define N_TMASK2 0360
|
||||
#define N_BTSHFT 4
|
||||
#define N_TSHIFT 2
|
||||
|
||||
// MACROS
|
||||
|
||||
//
|
||||
// Communal selection types.
|
||||
//
|
||||
|
||||
#define IMAGE_COMDAT_SELECT_NODUPLICATES 1
|
||||
#define IMAGE_COMDAT_SELECT_ANY 2
|
||||
#define IMAGE_COMDAT_SELECT_SAME_SIZE 3
|
||||
#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
|
||||
#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
|
||||
|
||||
#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
|
||||
#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
|
||||
#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
|
||||
|
||||
|
||||
//
|
||||
// Relocation format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_RELOCATION {
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 SymbolTableIndex;
|
||||
UINT16 Type;
|
||||
} IMAGE_RELOCATION;
|
||||
|
||||
#define IMAGE_SIZEOF_RELOCATION 10
|
||||
|
||||
//
|
||||
// I386 relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary
|
||||
#define IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address
|
||||
#define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address
|
||||
#define IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address
|
||||
#define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included
|
||||
#define IMAGE_REL_I386_SEG12 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
|
||||
#define IMAGE_REL_I386_SECTION 012
|
||||
#define IMAGE_REL_I386_SECREL 013
|
||||
#define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address
|
||||
|
||||
//
|
||||
// MIPS relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is absolute, no relocation is necessary
|
||||
#define IMAGE_REL_MIPS_REFHALF 01
|
||||
#define IMAGE_REL_MIPS_REFWORD 02
|
||||
#define IMAGE_REL_MIPS_JMPADDR 03
|
||||
#define IMAGE_REL_MIPS_REFHI 04
|
||||
#define IMAGE_REL_MIPS_REFLO 05
|
||||
#define IMAGE_REL_MIPS_GPREL 06
|
||||
#define IMAGE_REL_MIPS_LITERAL 07
|
||||
#define IMAGE_REL_MIPS_SECTION 012
|
||||
#define IMAGE_REL_MIPS_SECREL 013
|
||||
#define IMAGE_REL_MIPS_REFWORDNB 042
|
||||
#define IMAGE_REL_MIPS_PAIR 045
|
||||
|
||||
//
|
||||
// Alpha Relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_ALPHA_ABSOLUTE 0x0
|
||||
#define IMAGE_REL_ALPHA_REFLONG 0x1
|
||||
#define IMAGE_REL_ALPHA_REFQUAD 0x2
|
||||
#define IMAGE_REL_ALPHA_GPREL32 0x3
|
||||
#define IMAGE_REL_ALPHA_LITERAL 0x4
|
||||
#define IMAGE_REL_ALPHA_LITUSE 0x5
|
||||
#define IMAGE_REL_ALPHA_GPDISP 0x6
|
||||
#define IMAGE_REL_ALPHA_BRADDR 0x7
|
||||
#define IMAGE_REL_ALPHA_HINT 0x8
|
||||
#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9
|
||||
#define IMAGE_REL_ALPHA_REFHI 0xA
|
||||
#define IMAGE_REL_ALPHA_REFLO 0xB
|
||||
#define IMAGE_REL_ALPHA_PAIR 0xC
|
||||
#define IMAGE_REL_ALPHA_MATCH 0xD
|
||||
#define IMAGE_REL_ALPHA_SECTION 0xE
|
||||
#define IMAGE_REL_ALPHA_SECREL 0xF
|
||||
#define IMAGE_REL_ALPHA_REFLONGNB 0x10
|
||||
|
||||
//
|
||||
// IBM PowerPC relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP
|
||||
#define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address
|
||||
#define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address
|
||||
#define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2 (branch absolute)
|
||||
#define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address
|
||||
#define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load doubleword)
|
||||
#define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted left 2 (branch relative)
|
||||
#define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted left 2 (br cond relative)
|
||||
#define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base
|
||||
#define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted left 2 (load doubleword)
|
||||
|
||||
#define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base
|
||||
#define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an image sectionhdr)
|
||||
#define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number
|
||||
#define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction iff symbol is glue code
|
||||
#define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address is TOC restore instruction
|
||||
|
||||
#define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in IMAGE_RELOCATION.Type
|
||||
|
||||
// Flag bits in IMAGE_RELOCATION.TYPE
|
||||
|
||||
#define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than adding it
|
||||
#define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict branch taken
|
||||
#define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict branch not taken
|
||||
#define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data in toc)
|
||||
|
||||
//
|
||||
// Based relocation format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_BASE_RELOCATION {
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 SizeOfBlock;
|
||||
// UINT16 TypeOffset[1];
|
||||
} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION;
|
||||
|
||||
#define IMAGE_SIZEOF_BASE_RELOCATION 8
|
||||
|
||||
//
|
||||
// Based relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_BASED_ABSOLUTE 0
|
||||
#define IMAGE_REL_BASED_HIGH 1
|
||||
#define IMAGE_REL_BASED_LOW 2
|
||||
#define IMAGE_REL_BASED_HIGHLOW 3
|
||||
#define IMAGE_REL_BASED_HIGHADJ 4
|
||||
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
|
||||
#define IMAGE_REL_BASED_IA64_IMM64 9
|
||||
#define IMAGE_REL_BASED_DIR64 10
|
||||
|
||||
//
|
||||
// Line number format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_LINENUMBER {
|
||||
union {
|
||||
UINT32 SymbolTableIndex; // Symbol table index of function name if Linenumber is 0.
|
||||
UINT32 VirtualAddress; // Virtual address of line number.
|
||||
} Type;
|
||||
UINT16 Linenumber; // Line number.
|
||||
} IMAGE_LINENUMBER;
|
||||
|
||||
#define IMAGE_SIZEOF_LINENUMBER 6
|
||||
|
||||
//
|
||||
// Archive format.
|
||||
//
|
||||
|
||||
#define IMAGE_ARCHIVE_START_SIZE 8
|
||||
#define IMAGE_ARCHIVE_START "!<arch>\n"
|
||||
#define IMAGE_ARCHIVE_END "`\n"
|
||||
#define IMAGE_ARCHIVE_PAD "\n"
|
||||
#define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
|
||||
#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
|
||||
|
||||
typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
|
||||
UINT8 Name[16]; // File member name - `/' terminated.
|
||||
UINT8 Date[12]; // File member date - decimal.
|
||||
UINT8 UserID[6]; // File member user id - decimal.
|
||||
UINT8 GroupID[6]; // File member group id - decimal.
|
||||
UINT8 Mode[8]; // File member mode - octal.
|
||||
UINT8 Size[10]; // File member size - decimal.
|
||||
UINT8 EndHeader[2]; // String to end header.
|
||||
} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
|
||||
|
||||
#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
|
||||
|
||||
//
|
||||
// DLL support.
|
||||
//
|
||||
|
||||
//
|
||||
// Export Format
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_EXPORT_DIRECTORY {
|
||||
UINT32 Characteristics;
|
||||
UINT32 TimeDateStamp;
|
||||
UINT16 MajorVersion;
|
||||
UINT16 MinorVersion;
|
||||
UINT32 Name;
|
||||
UINT32 Base;
|
||||
UINT32 NumberOfFunctions;
|
||||
UINT32 NumberOfNames;
|
||||
UINT32 AddressOfFunctions;
|
||||
UINT32 AddressOfNames;
|
||||
UINT32 AddressOfNameOrdinals;
|
||||
} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
|
||||
|
||||
//
|
||||
// Import Format
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_IMPORT_BY_NAME {
|
||||
UINT16 Hint;
|
||||
UINT8 Name[1];
|
||||
} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME;
|
||||
|
||||
typedef struct _IMAGE_THUNK_DATA {
|
||||
union {
|
||||
UINT32 Function;
|
||||
UINT32 Ordinal;
|
||||
PIMAGE_IMPORT_BY_NAME AddressOfData;
|
||||
} u1;
|
||||
} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA;
|
||||
|
||||
#define IMAGE_ORDINAL_FLAG 0x80000000
|
||||
#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
|
||||
#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
|
||||
|
||||
typedef struct _IMAGE_IMPORT_DESCRIPTOR {
|
||||
UINT32 Characteristics;
|
||||
UINT32 TimeDateStamp;
|
||||
UINT32 ForwarderChain;
|
||||
UINT32 Name;
|
||||
PIMAGE_THUNK_DATA FirstThunk;
|
||||
} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR;
|
||||
|
||||
#endif
|
||||
264
gnu-efi-3.0/inc/ia64/salproc.h
Normal file
264
gnu-efi-3.0/inc/ia64/salproc.h
Normal file
|
|
@ -0,0 +1,264 @@
|
|||
#ifndef _SAL_PROC_H
|
||||
#define _SAL_PROC_H
|
||||
//
|
||||
//
|
||||
//Copyright (c) 1999 Intel Corporation
|
||||
//
|
||||
//Module Name:
|
||||
//
|
||||
// SalProc.h
|
||||
//
|
||||
//Abstract:
|
||||
//
|
||||
// Main SAL interface routins for IA-64 calls.
|
||||
//
|
||||
//
|
||||
//Revision History
|
||||
//
|
||||
//
|
||||
|
||||
// return value that mimicks r8,r9,r10 & r11 registers
|
||||
typedef struct {
|
||||
UINT64 p0;
|
||||
UINT64 p1;
|
||||
UINT64 p2;
|
||||
UINT64 p3;
|
||||
} rArg;
|
||||
|
||||
#define SAL_PCI_CONFIG_READ 0x01000010
|
||||
#define SAL_PCI_CONFIG_WRITE 0x01000011
|
||||
|
||||
typedef VOID (*PFN)();
|
||||
typedef rArg (*PFN_SAL_PROC)(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64);
|
||||
typedef rArg (*PFN_SAL_CALLBACK)(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64);
|
||||
|
||||
typedef struct _PLABEL {
|
||||
UINT64 ProcEntryPoint;
|
||||
UINT64 GP;
|
||||
} PLABEL;
|
||||
|
||||
typedef struct tagIA32_BIOS_REGISTER_STATE {
|
||||
|
||||
// general registers
|
||||
UINT32 eax;
|
||||
UINT32 ecx;
|
||||
UINT32 edx;
|
||||
UINT32 ebx;
|
||||
|
||||
// stack registers
|
||||
UINT32 esp;
|
||||
UINT32 ebp;
|
||||
UINT32 esi;
|
||||
UINT32 edi;
|
||||
|
||||
// eflags
|
||||
UINT32 eflags;
|
||||
|
||||
// instruction pointer
|
||||
UINT32 eip;
|
||||
|
||||
UINT16 cs;
|
||||
UINT16 ds;
|
||||
UINT16 es;
|
||||
UINT16 fs;
|
||||
UINT16 gs;
|
||||
UINT16 ss;
|
||||
|
||||
// Reserved
|
||||
UINT32 Reserved1;
|
||||
UINT64 Reserved2;
|
||||
} IA32_BIOS_REGISTER_STATE;
|
||||
|
||||
VOID EFIInitMsg(VOID);
|
||||
|
||||
EFI_STATUS
|
||||
PlRegisterAndStartTimer(
|
||||
IN UINTN Period
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
PlDeRegisterAndCancelTimer(VOID);
|
||||
|
||||
VOID
|
||||
SalProc (
|
||||
IN UINT64 Arg1,
|
||||
IN UINT64 Arg2,
|
||||
IN UINT64 Arg3,
|
||||
IN UINT64 Arg4,
|
||||
IN UINT64 Arg5,
|
||||
IN UINT64 Arg6,
|
||||
IN UINT64 Arg7,
|
||||
IN UINT64 Arg8,
|
||||
OUT rArg *Results OPTIONAL
|
||||
);
|
||||
|
||||
VOID
|
||||
SalCallBack (
|
||||
IN UINT64 Arg1,
|
||||
IN UINT64 Arg2,
|
||||
IN UINT64 Arg3,
|
||||
IN UINT64 Arg4,
|
||||
IN UINT64 Arg5,
|
||||
IN UINT64 Arg6,
|
||||
IN UINT64 Arg7,
|
||||
IN UINT64 Arg8,
|
||||
OUT rArg *Results OPTIONAL
|
||||
);
|
||||
|
||||
VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtSalCallBack (
|
||||
IN UINT64 Arg1,
|
||||
IN UINT64 Arg2,
|
||||
IN UINT64 Arg3,
|
||||
IN UINT64 Arg4,
|
||||
IN UINT64 Arg5,
|
||||
IN UINT64 Arg6,
|
||||
IN UINT64 Arg7,
|
||||
IN UINT64 Arg8,
|
||||
OUT rArg *Results OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
extern PLABEL RtGlobalSalProcEntry;
|
||||
extern PLABEL RtGlobalSALCallBack;
|
||||
|
||||
#pragma pack(1)
|
||||
//
|
||||
// SAL System Table
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT16 Revision;
|
||||
UINT16 EntryCount;
|
||||
UINT8 CheckSum;
|
||||
UINT8 Reserved[7];
|
||||
UINT16 SALA_Ver;
|
||||
UINT16 SALB_Ver;
|
||||
UINT8 OemId[32];
|
||||
UINT8 ProductID[32];
|
||||
UINT8 Reserved2[8];
|
||||
} SAL_SYSTEM_TABLE_HDR;
|
||||
|
||||
#define SAL_ST_ENTRY_POINT 0
|
||||
#define SAL_ST_MEMORY_DESCRIPTOR 1
|
||||
#define SAL_ST_PLATFORM_FEATURES 2
|
||||
#define SAL_ST_TR_USAGE 3
|
||||
#define SAL_ST_PTC 4
|
||||
#define SAL_ST_AP_WAKEUP 5
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type; // Type == 0
|
||||
UINT8 Reserved[7];
|
||||
UINT64 PalProcEntry;
|
||||
UINT64 SalProcEntry;
|
||||
UINT64 GlobalDataPointer;
|
||||
UINT64 Reserved2[2];
|
||||
} SAL_ST_ENTRY_POINT_DESCRIPTOR;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type; // Type == 1
|
||||
UINT8 NeedVirtualRegistration;
|
||||
UINT8 MemoryAttributes;
|
||||
UINT8 PageAccessRights;
|
||||
UINT8 SupportedAttributes;
|
||||
UINT8 Reserved;
|
||||
UINT16 MemoryType;
|
||||
UINT64 PhysicalMemoryAddress;
|
||||
UINT32 Length;
|
||||
UINT32 Reserved1;
|
||||
UINT64 OemReserved;
|
||||
} SAL_ST_MEMORY_DESCRIPTOR_ENTRY;
|
||||
|
||||
//
|
||||
// MemoryType info
|
||||
//
|
||||
#define SAL_SAPIC_IPI_BLOCK 0x0002
|
||||
#define SAL_IO_PORT_MAPPING 0x0003
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type; // Type == 2
|
||||
UINT8 PlatformFeatures;
|
||||
UINT8 Reserved[14];
|
||||
} SAL_ST_MEMORY_DECRIPTOR;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type; // Type == 3
|
||||
UINT8 TRType;
|
||||
UINT8 TRNumber;
|
||||
UINT8 Reserved[5];
|
||||
UINT64 VirtualAddress;
|
||||
UINT64 EncodedPageSize;
|
||||
UINT64 Reserved1;
|
||||
} SAL_ST_TR_DECRIPTOR;
|
||||
|
||||
typedef struct {
|
||||
UINT64 NumberOfProcessors;
|
||||
UINT64 LocalIDRegister;
|
||||
} SAL_COHERENCE_DOMAIN_INFO;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type; // Type == 4
|
||||
UINT8 Reserved[3];
|
||||
UINT32 NumberOfDomains;
|
||||
SAL_COHERENCE_DOMAIN_INFO *DomainInformation;
|
||||
} SAL_ST_CACHE_COHERENCE_DECRIPTOR;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type; // Type == 5
|
||||
UINT8 WakeUpType;
|
||||
UINT8 Reserved[6];
|
||||
UINT64 ExternalInterruptVector;
|
||||
} SAL_ST_AP_WAKEUP_DECRIPTOR;
|
||||
|
||||
typedef struct {
|
||||
SAL_SYSTEM_TABLE_HDR Header;
|
||||
SAL_ST_ENTRY_POINT_DESCRIPTOR Entry0;
|
||||
} SAL_SYSTEM_TABLE_ASCENDING_ORDER;
|
||||
|
||||
#define FIT_ENTRY_PTR (0x100000000 - 32) // 4GB - 24
|
||||
#define FIT_PALA_ENTRY (0x100000000 - 48) // 4GB - 32
|
||||
#define FIT_PALB_TYPE 01
|
||||
|
||||
typedef struct {
|
||||
UINT64 Address;
|
||||
UINT8 Size[3];
|
||||
UINT8 Reserved;
|
||||
UINT16 Revision;
|
||||
UINT8 Type:7;
|
||||
UINT8 CheckSumValid:1;
|
||||
UINT8 CheckSum;
|
||||
} FIT_ENTRY;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
typedef
|
||||
rArg
|
||||
(*CALL_SAL_PROC)(
|
||||
IN UINT64 Arg1,
|
||||
IN UINT64 Arg2,
|
||||
IN UINT64 Arg3,
|
||||
IN UINT64 Arg4,
|
||||
IN UINT64 Arg5,
|
||||
IN UINT64 Arg6,
|
||||
IN UINT64 Arg7,
|
||||
IN UINT64 Arg8
|
||||
);
|
||||
|
||||
typedef
|
||||
rArg
|
||||
(*CALL_PAL_PROC)(
|
||||
IN UINT64 Arg1,
|
||||
IN UINT64 Arg2,
|
||||
IN UINT64 Arg3,
|
||||
IN UINT64 Arg4
|
||||
);
|
||||
|
||||
extern CALL_SAL_PROC GlobalSalProc;
|
||||
extern CALL_PAL_PROC GlobalPalProc;
|
||||
extern PLABEL SalProcPlabel;
|
||||
extern PLABEL PalProcPlabel;
|
||||
|
||||
#endif
|
||||
|
||||
20
gnu-efi-3.0/inc/inc.mak
Normal file
20
gnu-efi-3.0/inc/inc.mak
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
|
||||
INC_DEPS = $(INC_DEPS) \
|
||||
efi.h \
|
||||
efiapi.h \
|
||||
efibind.h \
|
||||
eficon.h \
|
||||
efidebug.h \
|
||||
efidef.h \
|
||||
efidevp.h \
|
||||
efierr.h \
|
||||
efifs.h \
|
||||
efilib.h \
|
||||
efipart.h \
|
||||
efipciio.h \
|
||||
efiprot.h \
|
||||
efipxe.h \
|
||||
efivar.h \
|
||||
pe.h \
|
||||
stdarg.h
|
||||
132
gnu-efi-3.0/inc/libsmbios.h
Normal file
132
gnu-efi-3.0/inc/libsmbios.h
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
#ifndef _LIB_SMBIOS_H
|
||||
#define _LIB_SMBIOS_H
|
||||
/*++
|
||||
|
||||
Copyright (c) 2000 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
LibSmbios.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Lib include for SMBIOS services. Used to get system serial number and GUID
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Define SMBIOS tables.
|
||||
//
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UINT8 AnchorString[4];
|
||||
UINT8 EntryPointStructureChecksum;
|
||||
UINT8 EntryPointLength;
|
||||
UINT8 MajorVersion;
|
||||
UINT8 MinorVersion;
|
||||
UINT16 MaxStructureSize;
|
||||
UINT8 EntryPointRevision;
|
||||
UINT8 FormattedArea[5];
|
||||
UINT8 IntermediateAnchorString[5];
|
||||
UINT8 IntermediateChecksum;
|
||||
UINT16 TableLength;
|
||||
UINT32 TableAddress;
|
||||
UINT16 NumberOfSmbiosStructures;
|
||||
UINT8 SmbiosBcdRevision;
|
||||
} SMBIOS_STRUCTURE_TABLE;
|
||||
|
||||
//
|
||||
// Please note that SMBIOS structures can be odd byte aligned since the
|
||||
// unformated section of each record is a set of arbitrary size strings.
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 Handle[2];
|
||||
} SMBIOS_HEADER;
|
||||
|
||||
typedef UINT8 SMBIOS_STRING;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Vendor;
|
||||
SMBIOS_STRING BiosVersion;
|
||||
UINT8 BiosSegment[2];
|
||||
SMBIOS_STRING BiosReleaseDate;
|
||||
UINT8 BiosSize;
|
||||
UINT8 BiosCharacteristics[8];
|
||||
} SMBIOS_TYPE0;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Manufacturer;
|
||||
SMBIOS_STRING ProductName;
|
||||
SMBIOS_STRING Version;
|
||||
SMBIOS_STRING SerialNumber;
|
||||
|
||||
//
|
||||
// always byte copy this data to prevent alignment faults!
|
||||
//
|
||||
EFI_GUID Uuid;
|
||||
|
||||
UINT8 WakeUpType;
|
||||
} SMBIOS_TYPE1;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Manufacturer;
|
||||
SMBIOS_STRING ProductName;
|
||||
SMBIOS_STRING Version;
|
||||
SMBIOS_STRING SerialNumber;
|
||||
} SMBIOS_TYPE2;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Manufacturer;
|
||||
UINT8 Type;
|
||||
SMBIOS_STRING Version;
|
||||
SMBIOS_STRING SerialNumber;
|
||||
SMBIOS_STRING AssetTag;
|
||||
UINT8 BootupState;
|
||||
UINT8 PowerSupplyState;
|
||||
UINT8 ThermalState;
|
||||
UINT8 SecurityStatus;
|
||||
UINT8 OemDefined[4];
|
||||
} SMBIOS_TYPE3;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 Socket;
|
||||
UINT8 ProcessorType;
|
||||
UINT8 ProcessorFamily;
|
||||
SMBIOS_STRING ProcessorManufacture;
|
||||
UINT8 ProcessorId[8];
|
||||
SMBIOS_STRING ProcessorVersion;
|
||||
UINT8 Voltage;
|
||||
UINT8 ExternalClock[2];
|
||||
UINT8 MaxSpeed[2];
|
||||
UINT8 CurrentSpeed[2];
|
||||
UINT8 Status;
|
||||
UINT8 ProcessorUpgrade;
|
||||
UINT8 L1CacheHandle[2];
|
||||
UINT8 L2CacheHandle[2];
|
||||
UINT8 L3CacheHandle[2];
|
||||
} SMBIOS_TYPE4;
|
||||
|
||||
typedef union {
|
||||
SMBIOS_HEADER *Hdr;
|
||||
SMBIOS_TYPE0 *Type0;
|
||||
SMBIOS_TYPE1 *Type1;
|
||||
SMBIOS_TYPE2 *Type2;
|
||||
SMBIOS_TYPE3 *Type3;
|
||||
SMBIOS_TYPE4 *Type4;
|
||||
UINT8 *Raw;
|
||||
} SMBIOS_STRUCTURE_POINTER;
|
||||
#pragma pack()
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
30
gnu-efi-3.0/inc/make.inf
Normal file
30
gnu-efi-3.0/inc/make.inf
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#
|
||||
#
|
||||
#
|
||||
|
||||
[sources]
|
||||
efi.h
|
||||
efiapi.h
|
||||
eficon.h
|
||||
efidebug.h
|
||||
efidef.h
|
||||
efidevp.h
|
||||
efierr.h
|
||||
efifs.h
|
||||
efilib.h
|
||||
efipart.h
|
||||
efipciio.h
|
||||
efiprot.h
|
||||
efipxebc.h
|
||||
efistdarg.h
|
||||
efinet.h
|
||||
|
||||
[ia32sources]
|
||||
efibind.h
|
||||
pe.h
|
||||
efilibplat.h
|
||||
|
||||
[ia64sources]
|
||||
efibind.h
|
||||
pe.h
|
||||
efilibplat.h
|
||||
45
gnu-efi-3.0/inc/makefile.hdr
Normal file
45
gnu-efi-3.0/inc/makefile.hdr
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
#
|
||||
# This is a machine generated file - DO NOT EDIT
|
||||
# Generated by genmake.exe
|
||||
# Generated from make.inf
|
||||
# Copyright (c) 1998 Intel Corporation
|
||||
#
|
||||
|
||||
INC_DEPS = $(INC_DEPS) \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efi.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efiapi.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\eficon.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efidebug.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efidef.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efidevp.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efierr.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efifs.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efilib.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efipart.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efipciio.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efiprot.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efipxebc.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efistdarg.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\efinet.h \
|
||||
|
||||
|
||||
!IF "$(PROCESSOR)" == "Ia32"
|
||||
INC_DEPS = $(INC_DEPS) \
|
||||
$(SDK_INSTALL_DIR)\include\efi\Ia32\efibind.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\Ia32\pe.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\Ia32\efilibplat.h \
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(PROCESSOR)" == "Ia64"
|
||||
INC_DEPS = $(INC_DEPS) \
|
||||
$(SDK_INSTALL_DIR)\include\efi\Ia64\efibind.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\Ia64\pe.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\Ia64\efilibplat.h \
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
193
gnu-efi-3.0/inc/pci22.h
Normal file
193
gnu-efi-3.0/inc/pci22.h
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
#ifndef _PCI22_H
|
||||
#define _PCI22_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
pci22.h
|
||||
|
||||
Abstract:
|
||||
Support for PCI 2.2 standard.
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifdef SOFT_SDV
|
||||
#define PCI_MAX_BUS 1
|
||||
#else
|
||||
#define PCI_MAX_BUS 255
|
||||
#endif
|
||||
|
||||
#define PCI_MAX_DEVICE 31
|
||||
#define PCI_MAX_FUNC 7
|
||||
|
||||
//
|
||||
// Command
|
||||
//
|
||||
#define PCI_VGA_PALETTE_SNOOP_DISABLED 0x20
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UINT16 VendorId;
|
||||
UINT16 DeviceId;
|
||||
UINT16 Command;
|
||||
UINT16 Status;
|
||||
UINT8 RevisionID;
|
||||
UINT8 ClassCode[3];
|
||||
UINT8 CacheLineSize;
|
||||
UINT8 LaytencyTimer;
|
||||
UINT8 HeaderType;
|
||||
UINT8 BIST;
|
||||
} PCI_DEVICE_INDEPENDENT_REGION;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Bar[6];
|
||||
UINT32 CISPtr;
|
||||
UINT16 SubsystemVendorID;
|
||||
UINT16 SubsystemID;
|
||||
UINT32 ExpansionRomBar;
|
||||
UINT32 Reserved[2];
|
||||
UINT8 InterruptLine;
|
||||
UINT8 InterruptPin;
|
||||
UINT8 MinGnt;
|
||||
UINT8 MaxLat;
|
||||
} PCI_DEVICE_HEADER_TYPE_REGION;
|
||||
|
||||
typedef struct {
|
||||
PCI_DEVICE_INDEPENDENT_REGION Hdr;
|
||||
PCI_DEVICE_HEADER_TYPE_REGION Device;
|
||||
} PCI_TYPE00;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Bar[2];
|
||||
UINT8 PrimaryBus;
|
||||
UINT8 SecondaryBus;
|
||||
UINT8 SubordinateBus;
|
||||
UINT8 SecondaryLatencyTimer;
|
||||
UINT8 IoBase;
|
||||
UINT8 IoLimit;
|
||||
UINT16 SecondaryStatus;
|
||||
UINT16 MemoryBase;
|
||||
UINT16 MemoryLimit;
|
||||
UINT16 PrefetchableMemoryBase;
|
||||
UINT16 PrefetchableMemoryLimit;
|
||||
UINT32 PrefetchableBaseUpper32;
|
||||
UINT32 PrefetchableLimitUpper32;
|
||||
UINT16 IoBaseUpper16;
|
||||
UINT16 IoLimitUpper16;
|
||||
UINT32 Reserved;
|
||||
UINT32 ExpansionRomBAR;
|
||||
UINT8 InterruptLine;
|
||||
UINT8 InterruptPin;
|
||||
UINT16 BridgeControl;
|
||||
} PCI_BRIDGE_CONTROL_REGISTER;
|
||||
|
||||
#define PCI_CLASS_DISPLAY_CTRL 0x03
|
||||
#define PCI_CLASS_VGA 0x00
|
||||
|
||||
#define PCI_CLASS_BRIDGE 0x06
|
||||
#define PCI_CLASS_ISA 0x01
|
||||
#define PCI_CLASS_ISA_POSITIVE_DECODE 0x80
|
||||
|
||||
#define PCI_CLASS_NETWORK 0x02
|
||||
#define PCI_CLASS_ETHERNET 0x00
|
||||
|
||||
#define HEADER_TYPE_DEVICE 0x00
|
||||
#define HEADER_TYPE_PCI_TO_PCI_BRIDGE 0x01
|
||||
#define HEADER_TYPE_MULTI_FUNCTION 0x80
|
||||
#define HEADER_LAYOUT_CODE 0x7f
|
||||
|
||||
#define IS_PCI_BRIDGE(_p) ((((_p)->Hdr.HeaderType) & HEADER_LAYOUT_CODE) == HEADER_TYPE_PCI_TO_PCI_BRIDGE)
|
||||
#define IS_PCI_MULTI_FUNC(_p) (((_p)->Hdr.HeaderType) & HEADER_TYPE_MULTI_FUNCTION)
|
||||
|
||||
typedef struct {
|
||||
PCI_DEVICE_INDEPENDENT_REGION Hdr;
|
||||
PCI_BRIDGE_CONTROL_REGISTER Bridge;
|
||||
} PCI_TYPE01;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Register;
|
||||
UINT8 Function;
|
||||
UINT8 Device;
|
||||
UINT8 Bus;
|
||||
UINT8 Reserved[4];
|
||||
} DEFIO_PCI_ADDR;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Reg : 8;
|
||||
UINT32 Func : 3;
|
||||
UINT32 Dev : 5;
|
||||
UINT32 Bus : 8;
|
||||
UINT32 Reserved: 7;
|
||||
UINT32 Enable : 1;
|
||||
} PCI_CONFIG_ACCESS_CF8;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#define EFI_ROOT_BRIDGE_LIST 'eprb'
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
UINT16 BridgeNumber;
|
||||
UINT16 PrimaryBus;
|
||||
UINT16 SubordinateBus;
|
||||
|
||||
EFI_DEVICE_PATH *DevicePath;
|
||||
|
||||
LIST_ENTRY Link;
|
||||
} PCI_ROOT_BRIDGE_ENTRY;
|
||||
|
||||
|
||||
#define PCI_EXPANSION_ROM_HEADER_SIGNATURE 0xaa55
|
||||
#define EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE 0x0EF1
|
||||
#define PCI_DATA_STRUCTURE_SIGNATURE EFI_SIGNATURE_32('P','C','I','R')
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UINT16 Signature; // 0xaa55
|
||||
UINT8 Reserved[0x16];
|
||||
UINT16 PcirOffset;
|
||||
} PCI_EXPANSION_ROM_HEADER;
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT16 Signature; // 0xaa55
|
||||
UINT16 InitializationSize;
|
||||
UINT16 EfiSignature; // 0x0EF1
|
||||
UINT16 EfiSubsystem;
|
||||
UINT16 EfiMachineType;
|
||||
UINT8 Reserved[0x0A];
|
||||
UINT16 EfiImageHeaderOffset;
|
||||
UINT16 PcirOffset;
|
||||
} EFI_PCI_EXPANSION_ROM_HEADER;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature; // "PCIR"
|
||||
UINT16 VendorId;
|
||||
UINT16 DeviceId;
|
||||
UINT16 Reserved0;
|
||||
UINT16 Length;
|
||||
UINT8 Revision;
|
||||
UINT8 ClassCode[3];
|
||||
UINT16 ImageLength;
|
||||
UINT16 CodeRevision;
|
||||
UINT8 CodeType;
|
||||
UINT8 Indicator;
|
||||
UINT16 Reserved1;
|
||||
} PCI_DATA_STRUCTURE;
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
32
gnu-efi-3.0/inc/protocol/adapterdebug.h
Normal file
32
gnu-efi-3.0/inc/protocol/adapterdebug.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef _ADAPTER_DEBUG_H
|
||||
#define _ADAPTER_DEBUG_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
AdapterDebug.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Protocol to debug the EDD 3.0 enablement of BIOS option ROMs
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
// {82F86881-282B-11d4-BC7D-0080C73C8881}
|
||||
#define ADAPTER_DEBUG_PROTOCOL \
|
||||
{ 0x82f86881, 0x282b, 0x11d4, {0xbc, 0x7d, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
|
||||
|
||||
//
|
||||
// This protocol points to the BIOS_LEGACY_DRIVE data structure
|
||||
// see edd.h for more details
|
||||
//
|
||||
|
||||
#endif
|
||||
|
||||
32
gnu-efi-3.0/inc/protocol/eficonsplit.h
Normal file
32
gnu-efi-3.0/inc/protocol/eficonsplit.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef _EFI_CONFORK_H
|
||||
#define _EFI_CONFORK_H
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
|
||||
//
|
||||
// ConOut Forker Protocol
|
||||
//
|
||||
|
||||
#define TEXT_OUT_SPLITER_PROTOCOL \
|
||||
{ 0x56d830a0, 0x7e7a, 0x11d3, {0xbb, 0xa0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
#define ERROR_OUT_SPLITER_PROTOCOL \
|
||||
{ 0xf0ba9039, 0x68f1, 0x425e, {0xaa, 0x7f, 0xd9, 0xaa, 0xf9, 0x1b, 0x82, 0xa1}}
|
||||
|
||||
#define TEXT_IN_SPLITER_PROTOCOL \
|
||||
{ 0xf9a3c550, 0x7fb5, 0x11d3, {0xbb, 0xa0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
#endif
|
||||
210
gnu-efi-3.0/inc/protocol/efidbg.h
Normal file
210
gnu-efi-3.0/inc/protocol/efidbg.h
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2000
|
||||
* Intel Corporation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
*
|
||||
* This product includes software developed by Intel Corporation and
|
||||
* its contributors.
|
||||
*
|
||||
* 4. Neither the name of Intel Corporation or its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS''
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _EFIDBG_H_
|
||||
#define _EFIDBG_H_
|
||||
|
||||
#include "eficontext.h"
|
||||
#include "efiser.h"
|
||||
|
||||
typedef struct _DEBUGPORT_16550_CONFIG_DATA {
|
||||
UINT32 PortAddress;
|
||||
UINT64 BaudRate;
|
||||
UINT32 ReceiveFifoDepth;
|
||||
UINT32 Timeout;
|
||||
UINT8 Parity;
|
||||
UINT8 DataBits;
|
||||
UINT8 StopBits;
|
||||
UINT32 ControlMask;
|
||||
BOOLEAN RtsCtsEnable; // RTS, CTS control
|
||||
} DEBUGPORT_16550_CONFIG_DATA;
|
||||
|
||||
typedef struct _DEBUGPORT_16550_DEVICE_PATH {
|
||||
EFI_DEVICE_PATH Header;
|
||||
DEBUGPORT_16550_CONFIG_DATA ConfigData;
|
||||
} DEBUGPORT_16550_DEVICE_PATH;
|
||||
|
||||
typedef union {
|
||||
EFI_DEVICE_PATH DevPath;
|
||||
DEBUGPORT_16550_DEVICE_PATH Uart;
|
||||
// add new types of debugport device paths to this union...
|
||||
} DEBUGPORT_DEV_PATH;
|
||||
|
||||
|
||||
//
|
||||
// Debug Support protocol {2755590C-6F3C-42FA-9EA4-A3BA543CDA25}
|
||||
//
|
||||
|
||||
#define DEBUG_SUPPORT_PROTOCOL \
|
||||
{ 0x2755590C, 0x6F3C, 0x42fa, 0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 }
|
||||
|
||||
|
||||
typedef UINTN EXCEPTION_TYPE;
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(*EXCEPTION_HANDLER) (
|
||||
IN EXCEPTION_TYPE ExceptionType,
|
||||
IN SYSTEM_CONTEXT *SystemContext
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_REGISTER_TIMER_TICK_CALLBACK) (
|
||||
IN struct _EFI_DEBUG_SUPPORT_INTERFACE *This,
|
||||
IN EXCEPTION_HANDLER TimerTickCallback
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_REGISTER_EXCEPTION_HANDLER) (
|
||||
IN struct _EFI_DEBUG_SUPPORT_INTERFACE *This,
|
||||
IN EXCEPTION_HANDLER ExceptionHandler,
|
||||
IN EXCEPTION_TYPE ExceptionType
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_IP_CALL_TRACE) (
|
||||
IN struct _EFI_DEBUG_SUPPORT_INTERFACE *This
|
||||
);
|
||||
|
||||
|
||||
#define EFI_DEBUG_SUPPORT_INTERFACE_REVISION 0x00010000
|
||||
|
||||
typedef struct _EFI_DEBUG_SUPPORT_INTERFACE {
|
||||
UINT32 Revision;
|
||||
EFI_REGISTER_TIMER_TICK_CALLBACK RegisterTimerTickCallback;
|
||||
EFI_REGISTER_EXCEPTION_HANDLER RegisterExceptionHandler;
|
||||
EFI_IP_CALL_TRACE IpCallTrace;
|
||||
} EFI_DEBUG_SUPPORT_INTERFACE;
|
||||
|
||||
|
||||
//
|
||||
// Debugport io protocol {EBA4E8D2-3858-41EC-A281-2647BA9660D0}
|
||||
//
|
||||
|
||||
#define DEBUGPORT_IO_PROTOCOL \
|
||||
{ 0XEBA4E8D2, 0X3858, 0X41EC, 0XA2, 0X81, 0X26, 0X47, 0XBA, 0X96, 0X60, 0XD0 }
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_DEBUGPORT_IO_RESET) (
|
||||
IN struct _EFI_DEBUGPORT_IO_INTERFACE *This
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_DEBUGPORT_IO_READ) (
|
||||
IN struct _EFI_DEBUGPORT_IO_INTERFACE *This,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_DEBUGPORT_IO_WRITE) (
|
||||
IN struct _EFI_DEBUGPORT_IO_INTERFACE *This,
|
||||
IN OUT UINTN *BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
#define EFI_DEBUGPORT_IO_INTERFACE_REVISION 0x00010000
|
||||
|
||||
typedef struct _EFI_DEBUGPORT_IO_INTERFACE {
|
||||
UINT32 Revision;
|
||||
EFI_DEBUGPORT_IO_READ Read;
|
||||
EFI_DEBUGPORT_IO_WRITE Write;
|
||||
EFI_DEBUGPORT_IO_RESET Reset;
|
||||
} EFI_DEBUGPORT_IO_INTERFACE;
|
||||
|
||||
|
||||
//
|
||||
// Debugport UART16550 control protocol {628EA978-4C26-4605-BC02-A42A496917DD}
|
||||
//
|
||||
|
||||
#define DEBUGPORT_UART16550_CONTROL_PROTOCOL \
|
||||
{ 0X628EA978, 0X4C26, 0X4605, 0XBC, 0X2, 0XA4, 0X2A, 0X49, 0X69, 0X17, 0XDD }
|
||||
|
||||
// Note: The definitions for EFI_PARITY_TYPE, EFI_STOP_BITS_TYPE, and
|
||||
// SERIAL_IO_MODE are included from efiser.h
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_UART16550_SET_ATTRIBUTES) (
|
||||
IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE *This,
|
||||
IN UINT64 BaudRate,
|
||||
IN UINT32 ReceiveFifoDepth,
|
||||
IN UINT32 Timeout,
|
||||
IN EFI_PARITY_TYPE Parity,
|
||||
IN UINT8 DataBits,
|
||||
IN EFI_STOP_BITS_TYPE StopBits
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_UART16550_SET_CONTROL_BITS) (
|
||||
IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE *This,
|
||||
IN UINT32 Control
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_UART16550_GET_CONTROL_BITS) (
|
||||
IN struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE *This,
|
||||
OUT UINT32 *Control
|
||||
);
|
||||
|
||||
#define EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE_REVISION 0x00010000
|
||||
|
||||
typedef struct _EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE {
|
||||
UINT32 Revision;
|
||||
EFI_UART16550_SET_ATTRIBUTES SetAttributes;
|
||||
EFI_UART16550_SET_CONTROL_BITS SetControl;
|
||||
EFI_UART16550_GET_CONTROL_BITS GetControl;
|
||||
DEBUGPORT_16550_CONFIG_DATA *Mode;
|
||||
} EFI_DEBUGPORT_UART16550_CONTROL_INTERFACE;
|
||||
|
||||
|
||||
#define DEVICE_PATH_DEBUGPORT DEBUGPORT_IO_PROTOCOL
|
||||
|
||||
#endif /* _EFIDBG_H_ */
|
||||
133
gnu-efi-3.0/inc/protocol/efivar.h
Normal file
133
gnu-efi-3.0/inc/protocol/efivar.h
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
|
||||
//
|
||||
// The variable store protocol interface is specific to the reference
|
||||
// implementation. The initialization code adds variable store devices
|
||||
// to the system, and the FW connects to the devices to provide the
|
||||
// variable store interfaces through these devices.
|
||||
//
|
||||
|
||||
//
|
||||
// Variable Store Device protocol
|
||||
//
|
||||
|
||||
#define VARIABLE_STORE_PROTOCOL \
|
||||
{ 0xf088cd91, 0xa046, 0x11d2, {0x8e, 0x42, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
|
||||
|
||||
INTERFACE_DECL(_EFI_VARIABLE_STORE);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_STORE_CLEAR) (
|
||||
IN struct _EFI_VARIABLE_STORE *This,
|
||||
IN UINTN BankNo,
|
||||
IN OUT VOID *Scratch
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_STORE_READ) (
|
||||
IN struct _EFI_VARIABLE_STORE *This,
|
||||
IN UINTN BankNo,
|
||||
IN UINTN Offset,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_STORE_UPDATE) (
|
||||
IN struct _EFI_VARIABLE_STORE *This,
|
||||
IN UINTN BankNo,
|
||||
IN UINTN Offset,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_STORE_SIZE) (
|
||||
IN struct _EFI_VARIABLE_STORE *This,
|
||||
IN UINTN NoBanks
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_TRANSACTION_UPDATE) (
|
||||
IN struct _EFI_VARIABLE_STORE *This,
|
||||
IN UINTN BankNo,
|
||||
IN VOID *NewContents
|
||||
);
|
||||
|
||||
typedef struct _EFI_VARIABLE_STORE {
|
||||
|
||||
//
|
||||
// Number of banks and bank size
|
||||
//
|
||||
|
||||
UINT32 Attributes;
|
||||
UINT32 BankSize;
|
||||
UINT32 NoBanks;
|
||||
|
||||
//
|
||||
// Functions to access the storage banks
|
||||
//
|
||||
|
||||
EFI_STORE_CLEAR ClearStore;
|
||||
EFI_STORE_READ ReadStore;
|
||||
EFI_STORE_UPDATE UpdateStore;
|
||||
EFI_STORE_SIZE SizeStore OPTIONAL;
|
||||
EFI_TRANSACTION_UPDATE TransactionUpdate OPTIONAL;
|
||||
|
||||
} EFI_VARIABLE_STORE;
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// ClearStore() - A function to clear the requested storage bank. A cleared
|
||||
// bank contains all "on" bits.
|
||||
//
|
||||
// ReadStore() - Read data from the requested store.
|
||||
//
|
||||
// UpdateStore() - Updates data on the requested store. The FW will only
|
||||
// ever issue updates to clear bits in the store. Updates must be
|
||||
// performed in LSb to MSb order of the update buffer.
|
||||
//
|
||||
// SizeStore() - An optional function for non-runtime stores that can be
|
||||
// dynamically sized. The FW will only ever increase or decrease the store
|
||||
// by 1 banksize at a time, and it is always adding or removing a bank from
|
||||
// the end of the store.
|
||||
//
|
||||
// By default the FW will update variables and storage banks in an
|
||||
// "atomic" manner by keeping 1 old copy of the data during an update,
|
||||
// and recovering appropiately if the power is lost during the middle
|
||||
// of an operation. To do this the FW needs to have multiple banks
|
||||
// of storage dedicated to its use. If that's not possible, the driver
|
||||
// can implement an atomic bank update function and the FW will allow
|
||||
// 1 bank in this case. (It will allow any number of banks,
|
||||
// but it won't require an "extra" bank to provide its bank transaction
|
||||
// function).
|
||||
//
|
||||
// TransactionUpdate() - An optional function that can clear & update an
|
||||
// entire bank in an "atomic" fashion. If the operation fails in the
|
||||
// middle the driver is responsible for having either the previous copy
|
||||
// of the bank's data or the new copy. A copy that's partially written
|
||||
// is not valid as internal data settings may get lost. Supply this
|
||||
// function only when needed.
|
||||
//
|
||||
|
||||
208
gnu-efi-3.0/inc/protocol/ia64/eficontext.h
Normal file
208
gnu-efi-3.0/inc/protocol/ia64/eficontext.h
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2000
|
||||
* Intel Corporation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
*
|
||||
* This product includes software developed by Intel Corporation and
|
||||
* its contributors.
|
||||
*
|
||||
* 4. Neither the name of Intel Corporation or its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS''
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _EFICONTEXT_H_
|
||||
#define _EFICONTEXT_H_
|
||||
|
||||
|
||||
//
|
||||
// IA-64 processor exception types
|
||||
//
|
||||
#define EXCPT_ALT_DTLB 4
|
||||
#define EXCPT_DNESTED_TLB 5
|
||||
#define EXCPT_BREAKPOINT 11
|
||||
#define EXCPT_EXTERNAL_INTERRUPT 12
|
||||
#define EXCPT_GEN_EXCEPT 24
|
||||
#define EXCPT_NAT_CONSUMPTION 26
|
||||
#define EXCPT_DEBUG_EXCEPT 29
|
||||
#define EXCPT_UNALIGNED_ACCESS 30
|
||||
#define EXCPT_FP_FAULT 32
|
||||
#define EXCPT_FP_TRAP 33
|
||||
#define EXCPT_TAKEN_BRANCH 35
|
||||
#define EXCPT_SINGLE_STEP 36
|
||||
|
||||
//
|
||||
// IA-64 processor context definition - must be 512 byte aligned!!!
|
||||
//
|
||||
typedef
|
||||
struct {
|
||||
UINT64 reserved; // necessary to preserve alignment for the correct bits in UNAT and to insure F2 is 16 byte aligned...
|
||||
|
||||
UINT64 r1;
|
||||
UINT64 r2;
|
||||
UINT64 r3;
|
||||
UINT64 r4;
|
||||
UINT64 r5;
|
||||
UINT64 r6;
|
||||
UINT64 r7;
|
||||
UINT64 r8;
|
||||
UINT64 r9;
|
||||
UINT64 r10;
|
||||
UINT64 r11;
|
||||
UINT64 r12;
|
||||
UINT64 r13;
|
||||
UINT64 r14;
|
||||
UINT64 r15;
|
||||
UINT64 r16;
|
||||
UINT64 r17;
|
||||
UINT64 r18;
|
||||
UINT64 r19;
|
||||
UINT64 r20;
|
||||
UINT64 r21;
|
||||
UINT64 r22;
|
||||
UINT64 r23;
|
||||
UINT64 r24;
|
||||
UINT64 r25;
|
||||
UINT64 r26;
|
||||
UINT64 r27;
|
||||
UINT64 r28;
|
||||
UINT64 r29;
|
||||
UINT64 r30;
|
||||
UINT64 r31;
|
||||
|
||||
UINT64 f2[2];
|
||||
UINT64 f3[2];
|
||||
UINT64 f4[2];
|
||||
UINT64 f5[2];
|
||||
UINT64 f6[2];
|
||||
UINT64 f7[2];
|
||||
UINT64 f8[2];
|
||||
UINT64 f9[2];
|
||||
UINT64 f10[2];
|
||||
UINT64 f11[2];
|
||||
UINT64 f12[2];
|
||||
UINT64 f13[2];
|
||||
UINT64 f14[2];
|
||||
UINT64 f15[2];
|
||||
UINT64 f16[2];
|
||||
UINT64 f17[2];
|
||||
UINT64 f18[2];
|
||||
UINT64 f19[2];
|
||||
UINT64 f20[2];
|
||||
UINT64 f21[2];
|
||||
UINT64 f22[2];
|
||||
UINT64 f23[2];
|
||||
UINT64 f24[2];
|
||||
UINT64 f25[2];
|
||||
UINT64 f26[2];
|
||||
UINT64 f27[2];
|
||||
UINT64 f28[2];
|
||||
UINT64 f29[2];
|
||||
UINT64 f30[2];
|
||||
UINT64 f31[2];
|
||||
|
||||
UINT64 pr;
|
||||
|
||||
UINT64 b0;
|
||||
UINT64 b1;
|
||||
UINT64 b2;
|
||||
UINT64 b3;
|
||||
UINT64 b4;
|
||||
UINT64 b5;
|
||||
UINT64 b6;
|
||||
UINT64 b7;
|
||||
|
||||
// application registers
|
||||
UINT64 ar_rsc;
|
||||
UINT64 ar_bsp;
|
||||
UINT64 ar_bspstore;
|
||||
UINT64 ar_rnat;
|
||||
|
||||
UINT64 ar_fcr;
|
||||
|
||||
UINT64 ar_eflag;
|
||||
UINT64 ar_csd;
|
||||
UINT64 ar_ssd;
|
||||
UINT64 ar_cflg;
|
||||
UINT64 ar_fsr;
|
||||
UINT64 ar_fir;
|
||||
UINT64 ar_fdr;
|
||||
|
||||
UINT64 ar_ccv;
|
||||
|
||||
UINT64 ar_unat;
|
||||
|
||||
UINT64 ar_fpsr;
|
||||
|
||||
UINT64 ar_pfs;
|
||||
UINT64 ar_lc;
|
||||
UINT64 ar_ec;
|
||||
|
||||
// control registers
|
||||
UINT64 cr_dcr;
|
||||
UINT64 cr_itm;
|
||||
UINT64 cr_iva;
|
||||
UINT64 cr_pta;
|
||||
UINT64 cr_ipsr;
|
||||
UINT64 cr_isr;
|
||||
UINT64 cr_iip;
|
||||
UINT64 cr_ifa;
|
||||
UINT64 cr_itir;
|
||||
UINT64 cr_iipa;
|
||||
UINT64 cr_ifs;
|
||||
UINT64 cr_iim;
|
||||
UINT64 cr_iha;
|
||||
|
||||
// debug registers
|
||||
UINT64 dbr0;
|
||||
UINT64 dbr1;
|
||||
UINT64 dbr2;
|
||||
UINT64 dbr3;
|
||||
UINT64 dbr4;
|
||||
UINT64 dbr5;
|
||||
UINT64 dbr6;
|
||||
UINT64 dbr7;
|
||||
|
||||
UINT64 ibr0;
|
||||
UINT64 ibr1;
|
||||
UINT64 ibr2;
|
||||
UINT64 ibr3;
|
||||
UINT64 ibr4;
|
||||
UINT64 ibr5;
|
||||
UINT64 ibr6;
|
||||
UINT64 ibr7;
|
||||
|
||||
// virtual registers
|
||||
UINT64 int_nat; // nat bits for R1-R31
|
||||
|
||||
} SYSTEM_CONTEXT;
|
||||
|
||||
#endif /* _EFI_CONTEXT_H_ */
|
||||
27
gnu-efi-3.0/inc/protocol/intload.h
Normal file
27
gnu-efi-3.0/inc/protocol/intload.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1999 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
intload
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI support for loading internally linked in apps
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _INTERNAL_LOAD_INCLUDE_
|
||||
#define _INTERNAL_LOAD_INCLUDE_
|
||||
|
||||
// {D65A6B8C-71E5-4df0-A909-F0D2992B5AA9}
|
||||
#define INTERNAL_SHELL_GUID \
|
||||
{ 0xd65a6b8c, 0x71e5, 0x4df0, {0xa9, 0x09, 0xf0, 0xd2, 0x99, 0x2b, 0x5a, 0xa9} }
|
||||
|
||||
|
||||
#endif
|
||||
119
gnu-efi-3.0/inc/protocol/legacyboot.h
Normal file
119
gnu-efi-3.0/inc/protocol/legacyboot.h
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1999 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
legacyboot
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI support for legacy boot
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _LEGACY_BOOT_INCLUDE_
|
||||
#define _LEGACY_BOOT_INCLUDE_
|
||||
|
||||
#define LEGACY_BOOT_PROTOCOL \
|
||||
{ 0x376e5eb2, 0x30e4, 0x11d3, { 0xba, 0xe5, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
//
|
||||
// BBS 1.01 (See Appendix A) IPL and BCV Table Entry Data structure.
|
||||
// Seg:Off pointers have been converted to EFI pointers in this data structure
|
||||
// This is the structure that also maps to the EFI device path for the boot selection
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 DeviceType;
|
||||
UINT16 StatusFlag;
|
||||
UINT32 Reserved;
|
||||
VOID *BootHandler; // Not an EFI entry point
|
||||
CHAR8 *DescString;
|
||||
} BBS_TABLE_ENTRY;
|
||||
#pragma pack()
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *LEGACY_BOOT_CALL) (
|
||||
IN EFI_DEVICE_PATH *DevicePath
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// BBS support functions
|
||||
// PnP Call numbers and BiosSelector hidden in implementation
|
||||
//
|
||||
|
||||
typedef enum {
|
||||
IplRelative,
|
||||
BcvRelative
|
||||
} BBS_TYPE;
|
||||
|
||||
INTERFACE_DECL(_LEGACY_BOOT_INTERFACE);
|
||||
|
||||
//
|
||||
// == PnP Function 0x60 then BbsVersion == 0x0101 if this call fails then BbsVersion == 0x0000
|
||||
//
|
||||
|
||||
//
|
||||
// == PnP Function 0x61
|
||||
//
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *GET_DEVICE_COUNT) (
|
||||
IN struct _LEGACY_BOOT_INTERFACE *This,
|
||||
IN BBS_TYPE *TableType,
|
||||
OUT UINTN *DeviceCount,
|
||||
OUT UINTN *MaxCount
|
||||
);
|
||||
|
||||
//
|
||||
// == PnP Function 0x62
|
||||
//
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *GET_PRIORITY_AND_TABLE) (
|
||||
IN struct _LEGACY_BOOT_INTERFACE *This,
|
||||
IN BBS_TYPE *TableType,
|
||||
IN OUT UINTN *PrioritySize, // MaxCount * sizeof(UINT8)
|
||||
OUT UINTN *Priority,
|
||||
IN OUT UINTN *TableSize, // MaxCount * sizeof(BBS_TABLE_ENTRY)
|
||||
OUT BBS_TABLE_ENTRY *TableEntrySize
|
||||
);
|
||||
|
||||
//
|
||||
// == PnP Function 0x63
|
||||
//
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *SET_PRIORITY) (
|
||||
IN struct _LEGACY_BOOT_INTERFACE *This,
|
||||
IN BBS_TYPE *TableType,
|
||||
IN OUT UINTN *PrioritySize,
|
||||
OUT UINTN *Priority
|
||||
);
|
||||
|
||||
typedef struct _LEGACY_BOOT_INTERFACE {
|
||||
LEGACY_BOOT_CALL BootIt;
|
||||
|
||||
//
|
||||
// New functions to allow BBS booting to be configured from EFI
|
||||
//
|
||||
UINTN BbsVersion; // Currently 0x0101
|
||||
GET_DEVICE_COUNT GetDeviceCount;
|
||||
GET_PRIORITY_AND_TABLE GetPriorityAndTable;
|
||||
SET_PRIORITY SetPriority;
|
||||
} LEGACY_BOOT_INTERFACE;
|
||||
|
||||
EFI_STATUS
|
||||
PlInitializeLegacyBoot (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
13
gnu-efi-3.0/inc/protocol/make.inf
Normal file
13
gnu-efi-3.0/inc/protocol/make.inf
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#
|
||||
#
|
||||
#
|
||||
|
||||
[sources]
|
||||
efivar.h
|
||||
legacyboot.h
|
||||
VgaClass.h
|
||||
intload.h
|
||||
|
||||
[ia32sources]
|
||||
|
||||
[ia64sources]
|
||||
29
gnu-efi-3.0/inc/protocol/makefile.hdr
Normal file
29
gnu-efi-3.0/inc/protocol/makefile.hdr
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
#
|
||||
# This is a machine generated file - DO NOT EDIT
|
||||
# Generated by genmake.exe
|
||||
# Generated from make.inf
|
||||
# Copyright (c) 1998 Intel Corporation
|
||||
#
|
||||
|
||||
INC_DEPS = $(INC_DEPS) \
|
||||
$(SDK_INSTALL_DIR)\include\efi\protocol\efivar.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\protocol\legacyboot.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\protocol\vgaclass.h \
|
||||
$(SDK_INSTALL_DIR)\include\efi\protocol\efidbg.h \
|
||||
|
||||
|
||||
!IF "$(PROCESSOR)" == "Ia32"
|
||||
INC_DEPS = $(INC_DEPS) \
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(PROCESSOR)" == "Ia64"
|
||||
INC_DEPS = $(INC_DEPS) \
|
||||
$(SDK_INSTALL_DIR)\include\efi\protocol\$(PROCESSOR)\eficontext.h \
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
121
gnu-efi-3.0/inc/protocol/piflash64.h
Normal file
121
gnu-efi-3.0/inc/protocol/piflash64.h
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
#ifndef _PIFLASH64_H
|
||||
#define _PIFLASH64_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
PIflash64.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Iflash64.efi protocol to abstract iflash from
|
||||
the system.
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Guid that identifies the IFLASH protocol
|
||||
//
|
||||
#define IFLASH64_PROTOCOL_PROTOCOL \
|
||||
{ 0x65cba110, 0x74ab, 0x11d3, 0xbb, 0x89, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 };
|
||||
|
||||
//
|
||||
// Unlock FLASH from StartAddress to EndAddress and return a LockKey
|
||||
//
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *UNLOCK_FLASH_API)(
|
||||
IN struct _IFLASH64_PROTOCOL_INTERFACE *This
|
||||
);
|
||||
|
||||
//
|
||||
// Lock the flash represented by the LockKey
|
||||
//
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *LOCK_FLASH_API)(
|
||||
IN struct _IFLASH64_PROTOCOL_INTERFACE *This
|
||||
);
|
||||
|
||||
//
|
||||
// Status callback for a utility like IFLASH64
|
||||
//
|
||||
// Token would map to a list like Ted proposed. The utility has no idea what
|
||||
// happens on the other side.
|
||||
// ErrorStatus - Level of Error or success. Independent of Token. If you
|
||||
// don't know the token you will at least know pass or fail.
|
||||
// String - Optional extra information about the error. Could be used for
|
||||
// debug or future expansion
|
||||
//
|
||||
// Attributes - Options screen attributes for String. Could allow the string to be different colors.
|
||||
//
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *UTILITY_PROGRESS_API)(
|
||||
IN struct _IFLASH64_PROTOCOL_INTERFACE *This,
|
||||
IN UINTN Token,
|
||||
IN EFI_STATUS ErrorStatus,
|
||||
IN CHAR16 *String, OPTIONAL
|
||||
IN UINTN *Attributes OPTIONAL
|
||||
);
|
||||
|
||||
//
|
||||
// Token Values
|
||||
//
|
||||
// IFlash64 Token Codes
|
||||
#define IFLASH_TOKEN_IFLASHSTART 0xB0 // IFlash64 has started
|
||||
#define IFLASH_TOKEN_READINGFILE 0xB1 // Reading File
|
||||
#define IFLASH_TOKEN_INITVPP 0xB2 // Initializing Vpp
|
||||
#define IFLASH_TOKEN_DISABLEVPP 0x10 // Disable Vpp
|
||||
#define IFLASH_TOKEN_FLASHUNLOCK 0xB3 // Unlocking FLASH Devices
|
||||
#define IFLASH_TOKEN_FLASHERASE 0xB4 // Erasing FLASH Devices
|
||||
#define IFLASH_TOKEN_FLASHPROGRAM 0xB5 // Programming FLASH
|
||||
#define IFLASH_TOKEN_FLASHVERIFY 0xB6 // Verifying FLASH
|
||||
#define IFLASH_TOKEN_UPDATESUCCES 0xB7 // FLASH Updage Success!
|
||||
|
||||
#define IFLASH_TOKEN_PROGRESS_READINGFILE 0x11 // % Reading File
|
||||
#define IFLASH_TOKEN_PROGRESS_FLASHUNLOCK 0x13 // % Unlocking FLASH Devices
|
||||
#define IFLASH_TOKEN_PROGRESS_FLASHERASE 0x14 // % Erasing FLASH Devices
|
||||
#define IFLASH_TOKEN_PROGRESS_FLASHPROGRAM 0x15 // % Programming FLASH
|
||||
#define IFLASH_TOKEN_PROGRESS_FLASHVERIFY 0x16 // % Verifying FLASH
|
||||
|
||||
#define IFLASH_TOKEN_READINGFILE_ER 0xB8 // File Read Error
|
||||
#define IFLASH_TOKEN_INITVPP_ER 0xB9 // Initialization of IFB Error
|
||||
#define IFLASH_TOKEN_FLASHUNLOCK_ER 0xBA // FLASH Unlock Error
|
||||
#define IFLASH_TOKEN_FLASHERASE_ER 0xBB // FLASH Erase Error
|
||||
#define IFLASH_TOKEN_FLASHVERIFY_ER 0xBC // FLASH Verify Error
|
||||
#define IFLASH_TOKEN_FLASHPROG_ER 0xBD // FLASH Program Error
|
||||
|
||||
#define IFLASH_TABLE_END 0x00
|
||||
|
||||
//
|
||||
// If this number changes one of the existing API's has changes
|
||||
//
|
||||
#define IFLASH_PI_MAJOR_VERSION 0x01
|
||||
|
||||
//
|
||||
// This number changes when new APIs or data variables get added to the end
|
||||
// of the data structure
|
||||
//
|
||||
#define IFLASH_PI_MINOR_VERSION 0x01
|
||||
|
||||
typedef struct _IFLASH64_PROTOCOL_INTERFACE {
|
||||
UINT32 MajorVersion;
|
||||
UINT32 MinorVersion;
|
||||
UNLOCK_FLASH_API UnlockFlash;
|
||||
LOCK_FLASH_API LockFlash;
|
||||
UTILITY_PROGRESS_API Progress;
|
||||
|
||||
//
|
||||
// Future expansion goes here
|
||||
//
|
||||
|
||||
} IFLASH64_PROTOCOL_INTERFACE;
|
||||
|
||||
|
||||
#endif
|
||||
3
gnu-efi-3.0/inc/protocol/readme.txt
Normal file
3
gnu-efi-3.0/inc/protocol/readme.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
The protocol directory contains non Architectural
|
||||
Protocols that span the FW, Platform, or application
|
||||
space.
|
||||
95
gnu-efi-3.0/inc/protocol/vgaclass.h
Normal file
95
gnu-efi-3.0/inc/protocol/vgaclass.h
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
#ifndef _VGA_CLASS_H
|
||||
#define _VGA_CLASS_H
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1999 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
VgaClass.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Vga Mini port binding to Vga Class protocol
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// VGA Device Structure
|
||||
//
|
||||
|
||||
// {0E3D6310-6FE4-11d3-BB81-0080C73C8881}
|
||||
#define VGA_CLASS_DRIVER_PROTOCOL \
|
||||
{ 0xe3d6310, 0x6fe4, 0x11d3, {0xbb, 0x81, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(* INIT_VGA_CARD) (
|
||||
IN UINTN VgaMode,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
UINTN MaxColumns;
|
||||
UINTN MaxRows;
|
||||
} MAX_CONSOLE_GEOMETRY;
|
||||
|
||||
#define VGA_CON_OUT_DEV_SIGNATURE EFI_SIGNATURE_32('c','v','g','a')
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
EFI_HANDLE Handle;
|
||||
SIMPLE_TEXT_OUTPUT_INTERFACE ConOut;
|
||||
SIMPLE_TEXT_OUTPUT_MODE ConOutMode;
|
||||
EFI_DEVICE_PATH *DevicePath;
|
||||
|
||||
UINT8 *Buffer;
|
||||
EFI_DEVICE_IO_INTERFACE *DeviceIo;
|
||||
|
||||
//
|
||||
// Video Card Context
|
||||
//
|
||||
INIT_VGA_CARD InitVgaCard;
|
||||
VOID *VgaCardContext;
|
||||
MAX_CONSOLE_GEOMETRY *Geometry;
|
||||
//
|
||||
// Video buffer normally 0xb8000
|
||||
//
|
||||
UINT64 VideoBuffer;
|
||||
|
||||
//
|
||||
// Clear Screen & Default Attribute
|
||||
//
|
||||
UINT32 Attribute;
|
||||
|
||||
//
|
||||
// -1 means search for active VGA device
|
||||
//
|
||||
EFI_PCI_ADDRESS_UNION Pci;
|
||||
} VGA_CON_OUT_DEV;
|
||||
|
||||
#define VGA_CON_OUT_DEV_FROM_THIS(a) CR(a, VGA_CON_OUT_DEV, ConOut, VGA_CON_OUT_DEV_SIGNATURE)
|
||||
|
||||
//
|
||||
// Vga Class Driver Protocol.
|
||||
// GUID defined in EFI Lib
|
||||
//
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *INSTALL_VGA_DRIVER) (
|
||||
IN VGA_CON_OUT_DEV *ConOutDev
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
UINT32 Version;
|
||||
INSTALL_VGA_DRIVER InstallGenericVgaDriver;
|
||||
} INSTALL_VGA_DRIVER_INTERFACE;
|
||||
|
||||
#endif
|
||||
|
||||
41
gnu-efi-3.0/inc/romload.h
Normal file
41
gnu-efi-3.0/inc/romload.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef _EFI_ROMLOAD_H
|
||||
#define _EFI_ROMLOAD_H
|
||||
|
||||
#define ROM_SIGNATURE 0xaa55
|
||||
#define PCIDS_SIGNATURE "PCIR"
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
typedef struct
|
||||
{
|
||||
UINT8 Pcids_Sig[4];
|
||||
UINT16 VendId;
|
||||
UINT16 DevId;
|
||||
UINT16 Vpd_Off;
|
||||
UINT16 Size;
|
||||
UINT8 Rev;
|
||||
UINT8 Class_Code[3];
|
||||
UINT16 Image_Len;
|
||||
UINT16 Rev_Lvl;
|
||||
UINT8 Code_Type;
|
||||
UINT8 Indi;
|
||||
UINT16 Rsvd;
|
||||
}PciDataStructure;
|
||||
typedef struct
|
||||
{
|
||||
UINT16 Size;
|
||||
UINT32 Header_Sig;
|
||||
UINT16 SubSystem;
|
||||
UINT16 MachineType;
|
||||
UINT8 Resvd[10];
|
||||
UINT16 EfiOffset;
|
||||
}ArchData;
|
||||
typedef struct
|
||||
{
|
||||
UINT16 Rom_Sig;
|
||||
ArchData Arch_Data;
|
||||
UINT16 Pcids_Off;
|
||||
UINT8 resvd[38];
|
||||
}RomHeader;
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
285
gnu-efi-3.0/inc/x86_64/efibind.h
Normal file
285
gnu-efi-3.0/inc/x86_64/efibind.h
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efefind.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI to compile bindings
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
#ifndef X86_64_EFI_BIND
|
||||
#define X86_64_EFI_BIND
|
||||
#ifndef __GNUC__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
//
|
||||
// Basic int types of various widths
|
||||
//
|
||||
|
||||
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
|
||||
|
||||
// No ANSI C 1999/2000 stdint.h integer width declarations
|
||||
|
||||
#if defined(_MSC_EXTENSIONS)
|
||||
|
||||
// Use Microsoft C compiler integer width declarations
|
||||
|
||||
typedef unsigned __int64 uint64_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#elif defined(__GNUC__)
|
||||
typedef unsigned long long uint64_t __attribute__((aligned (8)));
|
||||
typedef long long int64_t __attribute__((aligned (8)));
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#elif defined(UNIX_LP64)
|
||||
|
||||
/* Use LP64 programming model from C_FLAGS for integer width declarations */
|
||||
|
||||
typedef unsigned long uint64_t;
|
||||
typedef long int64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#else
|
||||
|
||||
/* Assume P64 programming model from C_FLAGS for integer width declarations */
|
||||
|
||||
typedef unsigned long long uint64_t __attribute__((aligned (8)));
|
||||
typedef long long int64_t __attribute__((aligned (8)));
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef char int8_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Basic EFI types of various widths
|
||||
//
|
||||
|
||||
#ifndef __WCHAR_TYPE__
|
||||
# define __WCHAR_TYPE__ short
|
||||
#endif
|
||||
|
||||
typedef uint64_t UINT64;
|
||||
typedef int64_t INT64;
|
||||
|
||||
#ifndef _BASETSD_H_
|
||||
typedef uint32_t UINT32;
|
||||
typedef int32_t INT32;
|
||||
#endif
|
||||
|
||||
typedef uint16_t UINT16;
|
||||
typedef int16_t INT16;
|
||||
typedef uint8_t UINT8;
|
||||
typedef int8_t INT8;
|
||||
typedef __WCHAR_TYPE__ WCHAR;
|
||||
|
||||
#undef VOID
|
||||
#define VOID void
|
||||
|
||||
|
||||
typedef int64_t INTN;
|
||||
typedef uint64_t UINTN;
|
||||
|
||||
#ifdef EFI_NT_EMULATOR
|
||||
#define POST_CODE(_Data)
|
||||
#else
|
||||
#ifdef EFI_DEBUG
|
||||
#define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al
|
||||
#else
|
||||
#define POST_CODE(_Data)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define EFIERR(a) (0x8000000000000000 | a)
|
||||
#define EFI_ERROR_MASK 0x8000000000000000
|
||||
#define EFIERR_OEM(a) (0xc000000000000000 | a)
|
||||
|
||||
|
||||
#define BAD_POINTER 0xFBFBFBFBFBFBFBFB
|
||||
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
|
||||
|
||||
#ifdef EFI_NT_EMULATOR
|
||||
#define BREAKPOINT() __asm { int 3 }
|
||||
#else
|
||||
#define BREAKPOINT() while (TRUE); // Make it hang on Bios[Dbg]32
|
||||
#endif
|
||||
|
||||
//
|
||||
// Pointers must be aligned to these address to function
|
||||
//
|
||||
|
||||
#define MIN_ALIGNMENT_SIZE 4
|
||||
|
||||
#define ALIGN_VARIABLE(Value ,Adjustment) \
|
||||
(UINTN)Adjustment = 0; \
|
||||
if((UINTN)Value % MIN_ALIGNMENT_SIZE) \
|
||||
(UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \
|
||||
Value = (UINTN)Value + (UINTN)Adjustment
|
||||
|
||||
|
||||
//
|
||||
// Define macros to build data structure signatures from characters.
|
||||
//
|
||||
|
||||
#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
|
||||
#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))
|
||||
#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))
|
||||
//
|
||||
// To export & import functions in the EFI emulator environment
|
||||
//
|
||||
|
||||
#ifdef EFI_NT_EMULATOR
|
||||
#define EXPORTAPI __declspec( dllexport )
|
||||
#else
|
||||
#define EXPORTAPI
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// EFIAPI - prototype calling convention for EFI function pointers
|
||||
// BOOTSERVICE - prototype for implementation of a boot service interface
|
||||
// RUNTIMESERVICE - prototype for implementation of a runtime service interface
|
||||
// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service
|
||||
// RUNTIME_CODE - pragma macro for declaring runtime code
|
||||
//
|
||||
|
||||
#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options
|
||||
#ifdef _MSC_EXTENSIONS
|
||||
#define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler
|
||||
#else
|
||||
#define EFIAPI // Substitute expresion to force C calling convention
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BOOTSERVICE
|
||||
//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a
|
||||
//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a
|
||||
#define RUNTIMESERVICE
|
||||
#define RUNTIMEFUNCTION
|
||||
|
||||
|
||||
#define RUNTIME_CODE(a) alloc_text("rtcode", a)
|
||||
#define BEGIN_RUNTIME_DATA() data_seg("rtdata")
|
||||
#define END_RUNTIME_DATA() data_seg("")
|
||||
|
||||
#define VOLATILE volatile
|
||||
|
||||
#define MEMORY_FENCE()
|
||||
|
||||
#ifdef EFI_NT_EMULATOR
|
||||
|
||||
//
|
||||
// To help ensure proper coding of integrated drivers, they are
|
||||
// compiled as DLLs. In NT they require a dll init entry pointer.
|
||||
// The macro puts a stub entry point into the DLL so it will load.
|
||||
//
|
||||
|
||||
#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
|
||||
UINTN \
|
||||
__stdcall \
|
||||
_DllMainCRTStartup ( \
|
||||
UINTN Inst, \
|
||||
UINTN reason_for_call, \
|
||||
VOID *rserved \
|
||||
) \
|
||||
{ \
|
||||
return 1; \
|
||||
} \
|
||||
\
|
||||
int \
|
||||
EXPORTAPI \
|
||||
__cdecl \
|
||||
InitializeDriver ( \
|
||||
void *ImageHandle, \
|
||||
void *SystemTable \
|
||||
) \
|
||||
{ \
|
||||
return InitFunction(ImageHandle, SystemTable); \
|
||||
}
|
||||
|
||||
|
||||
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
|
||||
(_if)->LoadInternal(type, name, NULL)
|
||||
|
||||
#else // EFI_NT_EMULATOR
|
||||
|
||||
//
|
||||
// When build similiar to FW, then link everything together as
|
||||
// one big module.
|
||||
//
|
||||
|
||||
#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
|
||||
UINTN \
|
||||
InitializeDriver ( \
|
||||
VOID *ImageHandle, \
|
||||
VOID *SystemTable \
|
||||
) \
|
||||
{ \
|
||||
return InitFunction(ImageHandle, \
|
||||
SystemTable); \
|
||||
} \
|
||||
\
|
||||
EFI_STATUS efi_main( \
|
||||
EFI_HANDLE image, \
|
||||
EFI_SYSTEM_TABLE *systab \
|
||||
) __attribute__((weak, \
|
||||
alias ("InitializeDriver")));
|
||||
|
||||
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
|
||||
(_if)->LoadInternal(type, name, entry)
|
||||
|
||||
#endif // EFI_FW_NT
|
||||
|
||||
//
|
||||
// Some compilers don't support the forward reference construct:
|
||||
// typedef struct XXXXX
|
||||
//
|
||||
// The following macro provide a workaround for such cases.
|
||||
//
|
||||
#ifdef NO_INTERFACE_DECL
|
||||
#define INTERFACE_DECL(x)
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define INTERFACE_DECL(x) struct x
|
||||
#else
|
||||
#define INTERFACE_DECL(x) typedef struct x
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* for x86_64, EFI_FUNCTION_WRAPPER must be defined */
|
||||
UINTN uefi_call_wrapper(void *func, unsigned long va_num, ...);
|
||||
#define EFI_FUNCTION __attribute__((ms_abi))
|
||||
|
||||
#ifdef _MSC_EXTENSIONS
|
||||
#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
26
gnu-efi-3.0/inc/x86_64/efilibplat.h
Normal file
26
gnu-efi-3.0/inc/x86_64/efilibplat.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
efilibplat.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI to compile bindings
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
VOID
|
||||
InitializeLibPlatform (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
|
||||
591
gnu-efi-3.0/inc/x86_64/pe.h
Normal file
591
gnu-efi-3.0/inc/x86_64/pe.h
Normal file
|
|
@ -0,0 +1,591 @@
|
|||
/*
|
||||
PE32+ header file
|
||||
*/
|
||||
#ifndef _PE_H
|
||||
#define _PE_H
|
||||
|
||||
#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ
|
||||
#define IMAGE_OS2_SIGNATURE 0x454E // NE
|
||||
#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE
|
||||
#define IMAGE_NT_SIGNATURE 0x00004550 // PE00
|
||||
#define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED
|
||||
|
||||
|
||||
typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header
|
||||
UINT16 e_magic; // Magic number
|
||||
UINT16 e_cblp; // Bytes on last page of file
|
||||
UINT16 e_cp; // Pages in file
|
||||
UINT16 e_crlc; // Relocations
|
||||
UINT16 e_cparhdr; // Size of header in paragraphs
|
||||
UINT16 e_minalloc; // Minimum extra paragraphs needed
|
||||
UINT16 e_maxalloc; // Maximum extra paragraphs needed
|
||||
UINT16 e_ss; // Initial (relative) SS value
|
||||
UINT16 e_sp; // Initial SP value
|
||||
UINT16 e_csum; // Checksum
|
||||
UINT16 e_ip; // Initial IP value
|
||||
UINT16 e_cs; // Initial (relative) CS value
|
||||
UINT16 e_lfarlc; // File address of relocation table
|
||||
UINT16 e_ovno; // Overlay number
|
||||
UINT16 e_res[4]; // Reserved words
|
||||
UINT16 e_oemid; // OEM identifier (for e_oeminfo)
|
||||
UINT16 e_oeminfo; // OEM information; e_oemid specific
|
||||
UINT16 e_res2[10]; // Reserved words
|
||||
UINT32 e_lfanew; // File address of new exe header
|
||||
} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
|
||||
|
||||
typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header
|
||||
UINT16 ne_magic; // Magic number
|
||||
UINT8 ne_ver; // Version number
|
||||
UINT8 ne_rev; // Revision number
|
||||
UINT16 ne_enttab; // Offset of Entry Table
|
||||
UINT16 ne_cbenttab; // Number of bytes in Entry Table
|
||||
UINT32 ne_crc; // Checksum of whole file
|
||||
UINT16 ne_flags; // Flag UINT16
|
||||
UINT16 ne_autodata; // Automatic data segment number
|
||||
UINT16 ne_heap; // Initial heap allocation
|
||||
UINT16 ne_stack; // Initial stack allocation
|
||||
UINT32 ne_csip; // Initial CS:IP setting
|
||||
UINT32 ne_sssp; // Initial SS:SP setting
|
||||
UINT16 ne_cseg; // Count of file segments
|
||||
UINT16 ne_cmod; // Entries in Module Reference Table
|
||||
UINT16 ne_cbnrestab; // Size of non-resident name table
|
||||
UINT16 ne_segtab; // Offset of Segment Table
|
||||
UINT16 ne_rsrctab; // Offset of Resource Table
|
||||
UINT16 ne_restab; // Offset of resident name table
|
||||
UINT16 ne_modtab; // Offset of Module Reference Table
|
||||
UINT16 ne_imptab; // Offset of Imported Names Table
|
||||
UINT32 ne_nrestab; // Offset of Non-resident Names Table
|
||||
UINT16 ne_cmovent; // Count of movable entries
|
||||
UINT16 ne_align; // Segment alignment shift count
|
||||
UINT16 ne_cres; // Count of resource segments
|
||||
UINT8 ne_exetyp; // Target Operating system
|
||||
UINT8 ne_flagsothers; // Other .EXE flags
|
||||
UINT16 ne_pretthunks; // offset to return thunks
|
||||
UINT16 ne_psegrefbytes; // offset to segment ref. bytes
|
||||
UINT16 ne_swaparea; // Minimum code swap area size
|
||||
UINT16 ne_expver; // Expected Windows version number
|
||||
} IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
|
||||
|
||||
//
|
||||
// File header format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_FILE_HEADER {
|
||||
UINT16 Machine;
|
||||
UINT16 NumberOfSections;
|
||||
UINT32 TimeDateStamp;
|
||||
UINT32 PointerToSymbolTable;
|
||||
UINT32 NumberOfSymbols;
|
||||
UINT16 SizeOfOptionalHeader;
|
||||
UINT16 Characteristics;
|
||||
} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
|
||||
|
||||
#define IMAGE_SIZEOF_FILE_HEADER 20
|
||||
|
||||
#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file.
|
||||
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references).
|
||||
#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file.
|
||||
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file.
|
||||
#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed.
|
||||
#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine.
|
||||
#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file
|
||||
#define IMAGE_FILE_SYSTEM 0x1000 // System File.
|
||||
#define IMAGE_FILE_DLL 0x2000 // File is a DLL.
|
||||
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed.
|
||||
|
||||
#define IMAGE_FILE_MACHINE_UNKNOWN 0
|
||||
#define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386.
|
||||
#define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian
|
||||
#define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian
|
||||
#define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP
|
||||
#define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian
|
||||
#define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine
|
||||
//
|
||||
// Directory format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_DATA_DIRECTORY {
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 Size;
|
||||
} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
|
||||
|
||||
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
|
||||
|
||||
//
|
||||
// Optional header format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_OPTIONAL_HEADER {
|
||||
//
|
||||
// Standard fields.
|
||||
//
|
||||
|
||||
UINT16 Magic;
|
||||
UINT8 MajorLinkerVersion;
|
||||
UINT8 MinorLinkerVersion;
|
||||
UINT32 SizeOfCode;
|
||||
UINT32 SizeOfInitializedData;
|
||||
UINT32 SizeOfUninitializedData;
|
||||
UINT32 AddressOfEntryPoint;
|
||||
UINT32 BaseOfCode;
|
||||
UINT32 BaseOfData;
|
||||
|
||||
//
|
||||
// NT additional fields.
|
||||
//
|
||||
|
||||
UINT32 ImageBase;
|
||||
UINT32 SectionAlignment;
|
||||
UINT32 FileAlignment;
|
||||
UINT16 MajorOperatingSystemVersion;
|
||||
UINT16 MinorOperatingSystemVersion;
|
||||
UINT16 MajorImageVersion;
|
||||
UINT16 MinorImageVersion;
|
||||
UINT16 MajorSubsystemVersion;
|
||||
UINT16 MinorSubsystemVersion;
|
||||
UINT32 Reserved1;
|
||||
UINT32 SizeOfImage;
|
||||
UINT32 SizeOfHeaders;
|
||||
UINT32 CheckSum;
|
||||
UINT16 Subsystem;
|
||||
UINT16 DllCharacteristics;
|
||||
UINT32 SizeOfStackReserve;
|
||||
UINT32 SizeOfStackCommit;
|
||||
UINT32 SizeOfHeapReserve;
|
||||
UINT32 SizeOfHeapCommit;
|
||||
UINT32 LoaderFlags;
|
||||
UINT32 NumberOfRvaAndSizes;
|
||||
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
|
||||
} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
|
||||
|
||||
typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
|
||||
UINT16 Magic;
|
||||
UINT8 MajorLinkerVersion;
|
||||
UINT8 MinorLinkerVersion;
|
||||
UINT32 SizeOfCode;
|
||||
UINT32 SizeOfInitializedData;
|
||||
UINT32 SizeOfUninitializedData;
|
||||
UINT32 AddressOfEntryPoint;
|
||||
UINT32 BaseOfCode;
|
||||
UINT32 BaseOfData;
|
||||
UINT32 BaseOfBss;
|
||||
UINT32 GprMask;
|
||||
UINT32 CprMask[4];
|
||||
UINT32 GpValue;
|
||||
} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER;
|
||||
|
||||
#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
|
||||
#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
|
||||
#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
|
||||
|
||||
#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
|
||||
#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
|
||||
|
||||
typedef struct _IMAGE_NT_HEADERS {
|
||||
UINT32 Signature;
|
||||
IMAGE_FILE_HEADER FileHeader;
|
||||
IMAGE_OPTIONAL_HEADER OptionalHeader;
|
||||
} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
|
||||
|
||||
typedef struct _IMAGE_ROM_HEADERS {
|
||||
IMAGE_FILE_HEADER FileHeader;
|
||||
IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
|
||||
} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS;
|
||||
|
||||
#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \
|
||||
((UINT32)ntheader + \
|
||||
FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \
|
||||
((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \
|
||||
))
|
||||
|
||||
|
||||
// Subsystem Values
|
||||
|
||||
#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem.
|
||||
#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem.
|
||||
#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem.
|
||||
#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem.
|
||||
#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem.
|
||||
#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix character subsystem.
|
||||
|
||||
|
||||
// Directory Entries
|
||||
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table
|
||||
#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String
|
||||
#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP)
|
||||
#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory
|
||||
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory
|
||||
|
||||
//
|
||||
// Section header format.
|
||||
//
|
||||
|
||||
#define IMAGE_SIZEOF_SHORT_NAME 8
|
||||
|
||||
typedef struct _IMAGE_SECTION_HEADER {
|
||||
UINT8 Name[IMAGE_SIZEOF_SHORT_NAME];
|
||||
union {
|
||||
UINT32 PhysicalAddress;
|
||||
UINT32 VirtualSize;
|
||||
} Misc;
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 SizeOfRawData;
|
||||
UINT32 PointerToRawData;
|
||||
UINT32 PointerToRelocations;
|
||||
UINT32 PointerToLinenumbers;
|
||||
UINT16 NumberOfRelocations;
|
||||
UINT16 NumberOfLinenumbers;
|
||||
UINT32 Characteristics;
|
||||
} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
|
||||
|
||||
#define IMAGE_SIZEOF_SECTION_HEADER 40
|
||||
|
||||
#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved.
|
||||
|
||||
#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code.
|
||||
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data.
|
||||
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data.
|
||||
|
||||
#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved.
|
||||
#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information.
|
||||
#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image.
|
||||
#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat.
|
||||
|
||||
#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 //
|
||||
#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 //
|
||||
#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 //
|
||||
#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 //
|
||||
#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified.
|
||||
#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 //
|
||||
#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 //
|
||||
|
||||
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded.
|
||||
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable.
|
||||
#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable.
|
||||
#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable.
|
||||
#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable.
|
||||
#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable.
|
||||
#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable.
|
||||
|
||||
//
|
||||
// Symbol format.
|
||||
//
|
||||
|
||||
|
||||
#define IMAGE_SIZEOF_SYMBOL 18
|
||||
|
||||
//
|
||||
// Section values.
|
||||
//
|
||||
// Symbols have a section number of the section in which they are
|
||||
// defined. Otherwise, section numbers have the following meanings:
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is undefined or is common.
|
||||
#define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an absolute value.
|
||||
#define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a special debug item.
|
||||
|
||||
//
|
||||
// Type (fundamental) values.
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_TYPE_NULL 0 // no type.
|
||||
#define IMAGE_SYM_TYPE_VOID 1 //
|
||||
#define IMAGE_SYM_TYPE_CHAR 2 // type character.
|
||||
#define IMAGE_SYM_TYPE_SHORT 3 // type short integer.
|
||||
#define IMAGE_SYM_TYPE_INT 4 //
|
||||
#define IMAGE_SYM_TYPE_LONG 5 //
|
||||
#define IMAGE_SYM_TYPE_FLOAT 6 //
|
||||
#define IMAGE_SYM_TYPE_DOUBLE 7 //
|
||||
#define IMAGE_SYM_TYPE_STRUCT 8 //
|
||||
#define IMAGE_SYM_TYPE_UNION 9 //
|
||||
#define IMAGE_SYM_TYPE_ENUM 10 // enumeration.
|
||||
#define IMAGE_SYM_TYPE_MOE 11 // member of enumeration.
|
||||
#define IMAGE_SYM_TYPE_BYTE 12 //
|
||||
#define IMAGE_SYM_TYPE_WORD 13 //
|
||||
#define IMAGE_SYM_TYPE_UINT 14 //
|
||||
#define IMAGE_SYM_TYPE_DWORD 15 //
|
||||
|
||||
//
|
||||
// Type (derived) values.
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_DTYPE_NULL 0 // no derived type.
|
||||
#define IMAGE_SYM_DTYPE_POINTER 1 // pointer.
|
||||
#define IMAGE_SYM_DTYPE_FUNCTION 2 // function.
|
||||
#define IMAGE_SYM_DTYPE_ARRAY 3 // array.
|
||||
|
||||
//
|
||||
// Storage classes.
|
||||
//
|
||||
|
||||
#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
|
||||
#define IMAGE_SYM_CLASS_NULL 0
|
||||
#define IMAGE_SYM_CLASS_AUTOMATIC 1
|
||||
#define IMAGE_SYM_CLASS_EXTERNAL 2
|
||||
#define IMAGE_SYM_CLASS_STATIC 3
|
||||
#define IMAGE_SYM_CLASS_REGISTER 4
|
||||
#define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
|
||||
#define IMAGE_SYM_CLASS_LABEL 6
|
||||
#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
|
||||
#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
|
||||
#define IMAGE_SYM_CLASS_ARGUMENT 9
|
||||
#define IMAGE_SYM_CLASS_STRUCT_TAG 10
|
||||
#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
|
||||
#define IMAGE_SYM_CLASS_UNION_TAG 12
|
||||
#define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
|
||||
#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
|
||||
#define IMAGE_SYM_CLASS_ENUM_TAG 15
|
||||
#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
|
||||
#define IMAGE_SYM_CLASS_REGISTER_PARAM 17
|
||||
#define IMAGE_SYM_CLASS_BIT_FIELD 18
|
||||
#define IMAGE_SYM_CLASS_BLOCK 100
|
||||
#define IMAGE_SYM_CLASS_FUNCTION 101
|
||||
#define IMAGE_SYM_CLASS_END_OF_STRUCT 102
|
||||
#define IMAGE_SYM_CLASS_FILE 103
|
||||
// new
|
||||
#define IMAGE_SYM_CLASS_SECTION 104
|
||||
#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
|
||||
|
||||
// type packing constants
|
||||
|
||||
#define N_BTMASK 017
|
||||
#define N_TMASK 060
|
||||
#define N_TMASK1 0300
|
||||
#define N_TMASK2 0360
|
||||
#define N_BTSHFT 4
|
||||
#define N_TSHIFT 2
|
||||
|
||||
// MACROS
|
||||
|
||||
//
|
||||
// Communal selection types.
|
||||
//
|
||||
|
||||
#define IMAGE_COMDAT_SELECT_NODUPLICATES 1
|
||||
#define IMAGE_COMDAT_SELECT_ANY 2
|
||||
#define IMAGE_COMDAT_SELECT_SAME_SIZE 3
|
||||
#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
|
||||
#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
|
||||
|
||||
#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
|
||||
#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
|
||||
#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
|
||||
|
||||
|
||||
//
|
||||
// Relocation format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_RELOCATION {
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 SymbolTableIndex;
|
||||
UINT16 Type;
|
||||
} IMAGE_RELOCATION;
|
||||
|
||||
#define IMAGE_SIZEOF_RELOCATION 10
|
||||
|
||||
//
|
||||
// I386 relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary
|
||||
#define IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address
|
||||
#define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address
|
||||
#define IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address
|
||||
#define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included
|
||||
#define IMAGE_REL_I386_SEG12 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
|
||||
#define IMAGE_REL_I386_SECTION 012
|
||||
#define IMAGE_REL_I386_SECREL 013
|
||||
#define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address
|
||||
|
||||
//
|
||||
// MIPS relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is absolute, no relocation is necessary
|
||||
#define IMAGE_REL_MIPS_REFHALF 01
|
||||
#define IMAGE_REL_MIPS_REFWORD 02
|
||||
#define IMAGE_REL_MIPS_JMPADDR 03
|
||||
#define IMAGE_REL_MIPS_REFHI 04
|
||||
#define IMAGE_REL_MIPS_REFLO 05
|
||||
#define IMAGE_REL_MIPS_GPREL 06
|
||||
#define IMAGE_REL_MIPS_LITERAL 07
|
||||
#define IMAGE_REL_MIPS_SECTION 012
|
||||
#define IMAGE_REL_MIPS_SECREL 013
|
||||
#define IMAGE_REL_MIPS_REFWORDNB 042
|
||||
#define IMAGE_REL_MIPS_PAIR 045
|
||||
|
||||
//
|
||||
// Alpha Relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_ALPHA_ABSOLUTE 0x0
|
||||
#define IMAGE_REL_ALPHA_REFLONG 0x1
|
||||
#define IMAGE_REL_ALPHA_REFQUAD 0x2
|
||||
#define IMAGE_REL_ALPHA_GPREL32 0x3
|
||||
#define IMAGE_REL_ALPHA_LITERAL 0x4
|
||||
#define IMAGE_REL_ALPHA_LITUSE 0x5
|
||||
#define IMAGE_REL_ALPHA_GPDISP 0x6
|
||||
#define IMAGE_REL_ALPHA_BRADDR 0x7
|
||||
#define IMAGE_REL_ALPHA_HINT 0x8
|
||||
#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9
|
||||
#define IMAGE_REL_ALPHA_REFHI 0xA
|
||||
#define IMAGE_REL_ALPHA_REFLO 0xB
|
||||
#define IMAGE_REL_ALPHA_PAIR 0xC
|
||||
#define IMAGE_REL_ALPHA_MATCH 0xD
|
||||
#define IMAGE_REL_ALPHA_SECTION 0xE
|
||||
#define IMAGE_REL_ALPHA_SECREL 0xF
|
||||
#define IMAGE_REL_ALPHA_REFLONGNB 0x10
|
||||
|
||||
//
|
||||
// IBM PowerPC relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP
|
||||
#define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address
|
||||
#define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address
|
||||
#define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2 (branch absolute)
|
||||
#define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address
|
||||
#define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load doubleword)
|
||||
#define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted left 2 (branch relative)
|
||||
#define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted left 2 (br cond relative)
|
||||
#define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base
|
||||
#define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted left 2 (load doubleword)
|
||||
|
||||
#define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base
|
||||
#define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an image sectionhdr)
|
||||
#define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number
|
||||
#define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction iff symbol is glue code
|
||||
#define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address is TOC restore instruction
|
||||
|
||||
#define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in IMAGE_RELOCATION.Type
|
||||
|
||||
// Flag bits in IMAGE_RELOCATION.TYPE
|
||||
|
||||
#define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than adding it
|
||||
#define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict branch taken
|
||||
#define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict branch not taken
|
||||
#define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data in toc)
|
||||
|
||||
//
|
||||
// Based relocation format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_BASE_RELOCATION {
|
||||
UINT32 VirtualAddress;
|
||||
UINT32 SizeOfBlock;
|
||||
// UINT16 TypeOffset[1];
|
||||
} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION;
|
||||
|
||||
#define IMAGE_SIZEOF_BASE_RELOCATION 8
|
||||
|
||||
//
|
||||
// Based relocation types.
|
||||
//
|
||||
|
||||
#define IMAGE_REL_BASED_ABSOLUTE 0
|
||||
#define IMAGE_REL_BASED_HIGH 1
|
||||
#define IMAGE_REL_BASED_LOW 2
|
||||
#define IMAGE_REL_BASED_HIGHLOW 3
|
||||
#define IMAGE_REL_BASED_HIGHADJ 4
|
||||
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
|
||||
#define IMAGE_REL_BASED_IA64_IMM64 9
|
||||
#define IMAGE_REL_BASED_DIR64 10
|
||||
|
||||
//
|
||||
// Line number format.
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_LINENUMBER {
|
||||
union {
|
||||
UINT32 SymbolTableIndex; // Symbol table index of function name if Linenumber is 0.
|
||||
UINT32 VirtualAddress; // Virtual address of line number.
|
||||
} Type;
|
||||
UINT16 Linenumber; // Line number.
|
||||
} IMAGE_LINENUMBER;
|
||||
|
||||
#define IMAGE_SIZEOF_LINENUMBER 6
|
||||
|
||||
//
|
||||
// Archive format.
|
||||
//
|
||||
|
||||
#define IMAGE_ARCHIVE_START_SIZE 8
|
||||
#define IMAGE_ARCHIVE_START "!<arch>\n"
|
||||
#define IMAGE_ARCHIVE_END "`\n"
|
||||
#define IMAGE_ARCHIVE_PAD "\n"
|
||||
#define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
|
||||
#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
|
||||
|
||||
typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
|
||||
UINT8 Name[16]; // File member name - `/' terminated.
|
||||
UINT8 Date[12]; // File member date - decimal.
|
||||
UINT8 UserID[6]; // File member user id - decimal.
|
||||
UINT8 GroupID[6]; // File member group id - decimal.
|
||||
UINT8 Mode[8]; // File member mode - octal.
|
||||
UINT8 Size[10]; // File member size - decimal.
|
||||
UINT8 EndHeader[2]; // String to end header.
|
||||
} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
|
||||
|
||||
#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
|
||||
|
||||
//
|
||||
// DLL support.
|
||||
//
|
||||
|
||||
//
|
||||
// Export Format
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_EXPORT_DIRECTORY {
|
||||
UINT32 Characteristics;
|
||||
UINT32 TimeDateStamp;
|
||||
UINT16 MajorVersion;
|
||||
UINT16 MinorVersion;
|
||||
UINT32 Name;
|
||||
UINT32 Base;
|
||||
UINT32 NumberOfFunctions;
|
||||
UINT32 NumberOfNames;
|
||||
UINT32 *AddressOfFunctions;
|
||||
UINT32 *AddressOfNames;
|
||||
UINT32 *AddressOfNameOrdinals;
|
||||
} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
|
||||
|
||||
//
|
||||
// Import Format
|
||||
//
|
||||
|
||||
typedef struct _IMAGE_IMPORT_BY_NAME {
|
||||
UINT16 Hint;
|
||||
UINT8 Name[1];
|
||||
} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME;
|
||||
|
||||
typedef struct _IMAGE_THUNK_DATA {
|
||||
union {
|
||||
UINT32 Function;
|
||||
UINT32 Ordinal;
|
||||
PIMAGE_IMPORT_BY_NAME AddressOfData;
|
||||
} u1;
|
||||
} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA;
|
||||
|
||||
#define IMAGE_ORDINAL_FLAG 0x80000000
|
||||
#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
|
||||
#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
|
||||
|
||||
typedef struct _IMAGE_IMPORT_DESCRIPTOR {
|
||||
UINT32 Characteristics;
|
||||
UINT32 TimeDateStamp;
|
||||
UINT32 ForwarderChain;
|
||||
UINT32 Name;
|
||||
PIMAGE_THUNK_DATA FirstThunk;
|
||||
} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR;
|
||||
|
||||
#endif
|
||||
80
gnu-efi-3.0/lib/Makefile
Normal file
80
gnu-efi-3.0/lib/Makefile
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
#
|
||||
# Copyright (C) 1999-2001 Hewlett-Packard Co.
|
||||
# Contributed by David Mosberger <davidm@hpl.hp.com>
|
||||
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
# * Neither the name of Hewlett-Packard Co. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
|
||||
SRCDIR = .
|
||||
|
||||
VPATH = $(SRCDIR)
|
||||
|
||||
include $(SRCDIR)/../Make.defaults
|
||||
|
||||
TOPDIR = $(SRCDIR)/..
|
||||
|
||||
CDIR = $(TOPDIR)/..
|
||||
FILES = boxdraw smbios console crc data debug dpath \
|
||||
error event guid hand hw init lock \
|
||||
misc print sread str \
|
||||
runtime/rtlock runtime/efirtlib runtime/rtstr runtime/vm runtime/rtdata \
|
||||
$(ARCH)/initplat $(ARCH)/math
|
||||
|
||||
ifeq ($(ARCH),ia64)
|
||||
FILES += $(ARCH)/salpal $(ARCH)/palproc
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
FILES += $(ARCH)/callwrap $(ARCH)/efi_stub
|
||||
endif
|
||||
|
||||
OBJS = $(FILES:%=%.o)
|
||||
|
||||
SUBDIRS = ia32 x86_64 ia64 runtime
|
||||
|
||||
all: libsubdirs libefi.a
|
||||
|
||||
libsubdirs:
|
||||
for sdir in $(SUBDIRS); do mkdir -p $$sdir; done
|
||||
|
||||
libefi.a: libefi.a($(OBJS))
|
||||
|
||||
clean:
|
||||
rm -f libefi.a *~ $(OBJS) */*.o
|
||||
|
||||
install: libefi.a
|
||||
mkdir -p $(INSTALLROOT)/$(LIBDIR)
|
||||
$(INSTALL) -m 644 libefi.a $(INSTALLROOT)/$(LIBDIR)
|
||||
|
||||
include $(SRCDIR)/../Make.rules
|
||||
|
||||
.PHONY: libsubdirs
|
||||
173
gnu-efi-3.0/lib/boxdraw.c
Normal file
173
gnu-efi-3.0/lib/boxdraw.c
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
BoxDraw.c
|
||||
|
||||
Abstract:
|
||||
Lib functions to support Box Draw Unicode code pages.
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
typedef struct {
|
||||
CHAR16 Unicode;
|
||||
CHAR8 PcAnsi;
|
||||
CHAR8 Ascii;
|
||||
} UNICODE_TO_CHAR;
|
||||
|
||||
|
||||
//
|
||||
// This list is used to define the valid extend chars.
|
||||
// It also provides a mapping from Unicode to PCANSI or
|
||||
// ASCII. The ASCII mapping we just made up.
|
||||
//
|
||||
//
|
||||
|
||||
STATIC UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[] = {
|
||||
{ BOXDRAW_HORIZONTAL, 0xc4, L'-'},
|
||||
{ BOXDRAW_VERTICAL, 0xb3, L'|'},
|
||||
{ BOXDRAW_DOWN_RIGHT, 0xda, L'/'},
|
||||
{ BOXDRAW_DOWN_LEFT, 0xbf, L'\\'},
|
||||
{ BOXDRAW_UP_RIGHT, 0xc0, L'\\'},
|
||||
{ BOXDRAW_UP_LEFT, 0xd9, L'/'},
|
||||
{ BOXDRAW_VERTICAL_RIGHT, 0xc3, L'|'},
|
||||
{ BOXDRAW_VERTICAL_LEFT, 0xb4, L'|'},
|
||||
{ BOXDRAW_DOWN_HORIZONTAL, 0xc2, L'+'},
|
||||
{ BOXDRAW_UP_HORIZONTAL, 0xc1, L'+'},
|
||||
{ BOXDRAW_VERTICAL_HORIZONTAL, 0xc5, L'+'},
|
||||
{ BOXDRAW_DOUBLE_HORIZONTAL, 0xcd, L'-'},
|
||||
{ BOXDRAW_DOUBLE_VERTICAL, 0xba, L'|'},
|
||||
{ BOXDRAW_DOWN_RIGHT_DOUBLE, 0xd5, L'/'},
|
||||
{ BOXDRAW_DOWN_DOUBLE_RIGHT, 0xd6, L'/'},
|
||||
{ BOXDRAW_DOUBLE_DOWN_RIGHT, 0xc9, L'/'},
|
||||
{ BOXDRAW_DOWN_LEFT_DOUBLE, 0xb8, L'\\'},
|
||||
{ BOXDRAW_DOWN_DOUBLE_LEFT, 0xb7, L'\\'},
|
||||
{ BOXDRAW_DOUBLE_DOWN_LEFT, 0xbb, L'\\'},
|
||||
{ BOXDRAW_UP_RIGHT_DOUBLE, 0xd4, L'\\'},
|
||||
{ BOXDRAW_UP_DOUBLE_RIGHT, 0xd3, L'\\'},
|
||||
{ BOXDRAW_DOUBLE_UP_RIGHT, 0xc8, L'\\'},
|
||||
{ BOXDRAW_UP_LEFT_DOUBLE, 0xbe, L'/'},
|
||||
{ BOXDRAW_UP_DOUBLE_LEFT, 0xbd, L'/'},
|
||||
{ BOXDRAW_DOUBLE_UP_LEFT, 0xbc, L'/'},
|
||||
{ BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0xc6, L'|'},
|
||||
{ BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0xc7, L'|'},
|
||||
{ BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0xcc, L'|'},
|
||||
{ BOXDRAW_VERTICAL_LEFT_DOUBLE, 0xb5, L'|'},
|
||||
{ BOXDRAW_VERTICAL_DOUBLE_LEFT, 0xb6, L'|'},
|
||||
{ BOXDRAW_DOUBLE_VERTICAL_LEFT, 0xb9, L'|'},
|
||||
{ BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0xd1, L'+'},
|
||||
{ BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0xd2, L'+'},
|
||||
{ BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0xcb, L'+'},
|
||||
{ BOXDRAW_UP_HORIZONTAL_DOUBLE, 0xcf, L'+'},
|
||||
{ BOXDRAW_UP_DOUBLE_HORIZONTAL, 0xd0, L'+'},
|
||||
{ BOXDRAW_DOUBLE_UP_HORIZONTAL, 0xca, L'+'},
|
||||
{ BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0xd8, L'+'},
|
||||
{ BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0xd7, L'+'},
|
||||
{ BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0xce, L'+'},
|
||||
|
||||
{ BLOCKELEMENT_FULL_BLOCK, 0xdb, L'*'},
|
||||
{ BLOCKELEMENT_LIGHT_SHADE, 0xb0, L'+'},
|
||||
|
||||
{ GEOMETRICSHAPE_UP_TRIANGLE, 0x1e, L'^'},
|
||||
{ GEOMETRICSHAPE_RIGHT_TRIANGLE, 0x10, L'>'},
|
||||
{ GEOMETRICSHAPE_DOWN_TRIANGLE, 0x1f, L'v'},
|
||||
{ GEOMETRICSHAPE_LEFT_TRIANGLE, 0x11, L'<'},
|
||||
|
||||
/* BugBug: Left Arrow is an ESC. We can not make it print
|
||||
on a PCANSI terminal. If we can make left arrow
|
||||
come out on PC ANSI we can add it back.
|
||||
|
||||
{ ARROW_LEFT, 0x1b, L'<'},
|
||||
*/
|
||||
|
||||
{ ARROW_UP, 0x18, L'^'},
|
||||
|
||||
/* BugBut: Took out left arrow so right has to go too.
|
||||
{ ARROW_RIGHT, 0x1a, L'>'},
|
||||
*/
|
||||
{ ARROW_DOWN, 0x19, L'v'},
|
||||
|
||||
{ 0x0000, 0x00 }
|
||||
};
|
||||
|
||||
|
||||
BOOLEAN
|
||||
LibIsValidTextGraphics (
|
||||
IN CHAR16 Graphic,
|
||||
OUT CHAR8 *PcAnsi, OPTIONAL
|
||||
OUT CHAR8 *Ascii OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Detects if a Unicode char is for Box Drawing text graphics.
|
||||
|
||||
Arguments:
|
||||
|
||||
Grphic - Unicode char to test.
|
||||
|
||||
PcAnsi - Optional pointer to return PCANSI equivalent of Graphic.
|
||||
|
||||
Asci - Optional pointer to return Ascii equivalent of Graphic.
|
||||
|
||||
Returns:
|
||||
|
||||
TRUE if Gpaphic is a supported Unicode Box Drawing character.
|
||||
|
||||
--*/{
|
||||
UNICODE_TO_CHAR *Table;
|
||||
|
||||
if ((((Graphic & 0xff00) != 0x2500) && ((Graphic & 0xff00) != 0x2100))) {
|
||||
|
||||
//
|
||||
// Unicode drawing code charts are all in the 0x25xx range,
|
||||
// arrows are 0x21xx
|
||||
//
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (Table = UnicodeToPcAnsiOrAscii; Table->Unicode != 0x0000; Table++) {
|
||||
if (Graphic == Table->Unicode) {
|
||||
if (PcAnsi) {
|
||||
*PcAnsi = Table->PcAnsi;
|
||||
}
|
||||
if (Ascii) {
|
||||
*Ascii = Table->Ascii;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsValidAscii (
|
||||
IN CHAR16 Ascii
|
||||
)
|
||||
{
|
||||
if ((Ascii >= 0x20) && (Ascii <= 0x7f)) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsValidEfiCntlChar (
|
||||
IN CHAR16 c
|
||||
)
|
||||
{
|
||||
if (c == CHAR_NULL || c == CHAR_BACKSPACE || c == CHAR_LINEFEED || c == CHAR_CARRIAGE_RETURN) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
104
gnu-efi-3.0/lib/console.c
Normal file
104
gnu-efi-3.0/lib/console.c
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
console.c
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
Output (
|
||||
IN CHAR16 *Str
|
||||
)
|
||||
// Write a string to the console at the current cursor location
|
||||
{
|
||||
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, Str);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
Input (
|
||||
IN CHAR16 *Prompt OPTIONAL,
|
||||
OUT CHAR16 *InStr,
|
||||
IN UINTN StrLen
|
||||
)
|
||||
// Input a string at the current cursor location, for StrLen
|
||||
{
|
||||
IInput (
|
||||
ST->ConOut,
|
||||
ST->ConIn,
|
||||
Prompt,
|
||||
InStr,
|
||||
StrLen
|
||||
);
|
||||
}
|
||||
|
||||
VOID
|
||||
IInput (
|
||||
IN SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut,
|
||||
IN SIMPLE_INPUT_INTERFACE *ConIn,
|
||||
IN CHAR16 *Prompt OPTIONAL,
|
||||
OUT CHAR16 *InStr,
|
||||
IN UINTN StrLen
|
||||
)
|
||||
// Input a string at the current cursor location, for StrLen
|
||||
{
|
||||
EFI_INPUT_KEY Key;
|
||||
EFI_STATUS Status;
|
||||
UINTN Len;
|
||||
|
||||
if (Prompt) {
|
||||
ConOut->OutputString (ConOut, Prompt);
|
||||
}
|
||||
|
||||
Len = 0;
|
||||
for (; ;) {
|
||||
WaitForSingleEvent (ConIn->WaitForKey, 0);
|
||||
|
||||
Status = uefi_call_wrapper(ConIn->ReadKeyStroke, 2, ConIn, &Key);
|
||||
if (EFI_ERROR(Status)) {
|
||||
DEBUG((D_ERROR, "Input: error return from ReadKey %x\n", Status));
|
||||
break;
|
||||
}
|
||||
|
||||
if (Key.UnicodeChar == '\n' ||
|
||||
Key.UnicodeChar == '\r') {
|
||||
break;
|
||||
}
|
||||
|
||||
if (Key.UnicodeChar == '\b') {
|
||||
if (Len) {
|
||||
uefi_call_wrapper(ConOut->OutputString, 2, ConOut, L"\b \b");
|
||||
Len -= 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Key.UnicodeChar >= ' ') {
|
||||
if (Len < StrLen-1) {
|
||||
InStr[Len] = Key.UnicodeChar;
|
||||
|
||||
InStr[Len+1] = 0;
|
||||
uefi_call_wrapper(ConOut->OutputString, 2, ConOut, &InStr[Len]);
|
||||
|
||||
Len += 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
InStr[Len] = 0;
|
||||
}
|
||||
218
gnu-efi-3.0/lib/crc.c
Normal file
218
gnu-efi-3.0/lib/crc.c
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
crc.c
|
||||
|
||||
Abstract:
|
||||
|
||||
CRC32 functions
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
|
||||
UINT32 CRCTable[256] = {
|
||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
|
||||
0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
|
||||
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
|
||||
0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
|
||||
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
|
||||
0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
|
||||
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C,
|
||||
0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
|
||||
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
|
||||
0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
|
||||
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106,
|
||||
0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
||||
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D,
|
||||
0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
|
||||
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
|
||||
0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
|
||||
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7,
|
||||
0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
|
||||
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA,
|
||||
0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
|
||||
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
|
||||
0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
|
||||
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84,
|
||||
0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
||||
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
|
||||
0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
|
||||
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E,
|
||||
0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
|
||||
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55,
|
||||
0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
|
||||
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28,
|
||||
0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
|
||||
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
|
||||
0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
|
||||
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
|
||||
0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
||||
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69,
|
||||
0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
|
||||
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC,
|
||||
0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
|
||||
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693,
|
||||
0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
|
||||
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
|
||||
};
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
SetCrc (
|
||||
IN OUT EFI_TABLE_HEADER *Hdr
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Updates the CRC32 value in the table header
|
||||
|
||||
Arguments:
|
||||
|
||||
Hdr - The table to update
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
SetCrcAltSize (Hdr->HeaderSize, Hdr);
|
||||
}
|
||||
|
||||
VOID
|
||||
SetCrcAltSize (
|
||||
IN UINTN Size,
|
||||
IN OUT EFI_TABLE_HEADER *Hdr
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Updates the CRC32 value in the table header
|
||||
|
||||
Arguments:
|
||||
|
||||
Hdr - The table to update
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
Hdr->CRC32 = 0;
|
||||
Hdr->CRC32 = CalculateCrc((UINT8 *)Hdr, Size);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CheckCrc (
|
||||
IN UINTN MaxSize,
|
||||
IN OUT EFI_TABLE_HEADER *Hdr
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Checks the CRC32 value in the table header
|
||||
|
||||
Arguments:
|
||||
|
||||
Hdr - The table to check
|
||||
|
||||
Returns:
|
||||
|
||||
TRUE if the CRC is OK in the table
|
||||
|
||||
--*/
|
||||
{
|
||||
return CheckCrcAltSize (MaxSize, Hdr->HeaderSize, Hdr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CheckCrcAltSize (
|
||||
IN UINTN MaxSize,
|
||||
IN UINTN Size,
|
||||
IN OUT EFI_TABLE_HEADER *Hdr
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Checks the CRC32 value in the table header
|
||||
|
||||
Arguments:
|
||||
|
||||
Hdr - The table to check
|
||||
|
||||
Returns:
|
||||
|
||||
TRUE if the CRC is OK in the table
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT32 Crc;
|
||||
UINT32 OrgCrc;
|
||||
BOOLEAN f;
|
||||
|
||||
if (Size == 0) {
|
||||
//
|
||||
// If header size is 0 CRC will pass so return FALSE here
|
||||
//
|
||||
return FALSE;
|
||||
}
|
||||
if (MaxSize && Size > MaxSize) {
|
||||
DEBUG((D_ERROR, "CheckCrc32: Size > MaxSize\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// clear old crc from header
|
||||
OrgCrc = Hdr->CRC32;
|
||||
Hdr->CRC32 = 0;
|
||||
Crc = CalculateCrc((UINT8 *)Hdr, Size);
|
||||
|
||||
// set restults
|
||||
Hdr->CRC32 = OrgCrc;
|
||||
|
||||
// return status
|
||||
f = OrgCrc == (UINT32) Crc;
|
||||
if (!f) {
|
||||
DEBUG((D_ERROR, "CheckCrc32: Crc check failed\n"));
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
UINT32
|
||||
CalculateCrc (
|
||||
UINT8 *pt,
|
||||
UINTN Size
|
||||
)
|
||||
{
|
||||
UINTN Crc;
|
||||
|
||||
// compute crc
|
||||
Crc = 0xffffffff;
|
||||
while (Size) {
|
||||
Crc = (Crc >> 8) ^ CRCTable[(UINT8) Crc ^ *pt];
|
||||
pt += 1;
|
||||
Size -= 1;
|
||||
}
|
||||
Crc = Crc ^ 0xffffffff;
|
||||
return (UINT32)Crc;
|
||||
}
|
||||
157
gnu-efi-3.0/lib/data.c
Normal file
157
gnu-efi-3.0/lib/data.c
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
data.c
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI library global data
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
//
|
||||
// LibInitialized - TRUE once InitializeLib() is called for the first time
|
||||
//
|
||||
|
||||
BOOLEAN LibInitialized = FALSE;
|
||||
|
||||
//
|
||||
// ST - pointer to the EFI system table
|
||||
//
|
||||
|
||||
EFI_SYSTEM_TABLE *ST;
|
||||
|
||||
//
|
||||
// BS - pointer to the boot services table
|
||||
//
|
||||
|
||||
EFI_BOOT_SERVICES *BS;
|
||||
|
||||
|
||||
//
|
||||
// Default pool allocation type
|
||||
//
|
||||
|
||||
EFI_MEMORY_TYPE PoolAllocationType = EfiBootServicesData;
|
||||
|
||||
//
|
||||
// Unicode collation functions that are in use
|
||||
//
|
||||
|
||||
EFI_UNICODE_COLLATION_INTERFACE LibStubUnicodeInterface = {
|
||||
LibStubStriCmp,
|
||||
LibStubMetaiMatch,
|
||||
LibStubStrLwrUpr,
|
||||
LibStubStrLwrUpr,
|
||||
NULL, // FatToStr
|
||||
NULL, // StrToFat
|
||||
NULL // SupportedLanguages
|
||||
};
|
||||
|
||||
EFI_UNICODE_COLLATION_INTERFACE *UnicodeInterface = &LibStubUnicodeInterface;
|
||||
|
||||
//
|
||||
// Root device path
|
||||
//
|
||||
|
||||
EFI_DEVICE_PATH RootDevicePath[] = {
|
||||
{END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, {END_DEVICE_PATH_LENGTH,0}}
|
||||
};
|
||||
|
||||
EFI_DEVICE_PATH EndDevicePath[] = {
|
||||
{END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, {END_DEVICE_PATH_LENGTH, 0}}
|
||||
};
|
||||
|
||||
EFI_DEVICE_PATH EndInstanceDevicePath[] = {
|
||||
{END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, {END_DEVICE_PATH_LENGTH, 0}}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// EFI IDs
|
||||
//
|
||||
|
||||
EFI_GUID EfiGlobalVariable = EFI_GLOBAL_VARIABLE;
|
||||
EFI_GUID NullGuid = { 0,0,0,{0,0,0,0,0,0,0,0} };
|
||||
|
||||
//
|
||||
// Protocol IDs
|
||||
//
|
||||
|
||||
EFI_GUID DevicePathProtocol = DEVICE_PATH_PROTOCOL;
|
||||
EFI_GUID LoadedImageProtocol = LOADED_IMAGE_PROTOCOL;
|
||||
EFI_GUID TextInProtocol = SIMPLE_TEXT_INPUT_PROTOCOL;
|
||||
EFI_GUID TextOutProtocol = SIMPLE_TEXT_OUTPUT_PROTOCOL;
|
||||
EFI_GUID BlockIoProtocol = BLOCK_IO_PROTOCOL;
|
||||
EFI_GUID DiskIoProtocol = DISK_IO_PROTOCOL;
|
||||
EFI_GUID FileSystemProtocol = SIMPLE_FILE_SYSTEM_PROTOCOL;
|
||||
EFI_GUID LoadFileProtocol = LOAD_FILE_PROTOCOL;
|
||||
EFI_GUID DeviceIoProtocol = DEVICE_IO_PROTOCOL;
|
||||
EFI_GUID UnicodeCollationProtocol = UNICODE_COLLATION_PROTOCOL;
|
||||
EFI_GUID SerialIoProtocol = SERIAL_IO_PROTOCOL;
|
||||
EFI_GUID SimpleNetworkProtocol = EFI_SIMPLE_NETWORK_PROTOCOL;
|
||||
EFI_GUID PxeBaseCodeProtocol = EFI_PXE_BASE_CODE_PROTOCOL;
|
||||
EFI_GUID PxeCallbackProtocol = EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL;
|
||||
EFI_GUID NetworkInterfaceIdentifierProtocol = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL;
|
||||
EFI_GUID UiProtocol = EFI_UI_PROTOCOL;
|
||||
EFI_GUID PciIoProtocol = EFI_PCI_IO_PROTOCOL;
|
||||
//
|
||||
// File system information IDs
|
||||
//
|
||||
|
||||
EFI_GUID GenericFileInfo = EFI_FILE_INFO_ID;
|
||||
EFI_GUID FileSystemInfo = EFI_FILE_SYSTEM_INFO_ID;
|
||||
EFI_GUID FileSystemVolumeLabelInfo = EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID;
|
||||
|
||||
//
|
||||
// Reference implementation public protocol IDs
|
||||
//
|
||||
|
||||
EFI_GUID InternalShellProtocol = INTERNAL_SHELL_GUID;
|
||||
EFI_GUID VariableStoreProtocol = VARIABLE_STORE_PROTOCOL;
|
||||
EFI_GUID LegacyBootProtocol = LEGACY_BOOT_PROTOCOL;
|
||||
EFI_GUID VgaClassProtocol = VGA_CLASS_DRIVER_PROTOCOL;
|
||||
|
||||
EFI_GUID TextOutSpliterProtocol = TEXT_OUT_SPLITER_PROTOCOL;
|
||||
EFI_GUID ErrorOutSpliterProtocol = ERROR_OUT_SPLITER_PROTOCOL;
|
||||
EFI_GUID TextInSpliterProtocol = TEXT_IN_SPLITER_PROTOCOL;
|
||||
/* Added for GOP support */
|
||||
EFI_GUID GraphicsOutputProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
|
||||
|
||||
EFI_GUID AdapterDebugProtocol = ADAPTER_DEBUG_PROTOCOL;
|
||||
|
||||
//
|
||||
// Device path media protocol IDs
|
||||
//
|
||||
EFI_GUID PcAnsiProtocol = DEVICE_PATH_MESSAGING_PC_ANSI;
|
||||
EFI_GUID Vt100Protocol = DEVICE_PATH_MESSAGING_VT_100;
|
||||
|
||||
//
|
||||
// EFI GPT Partition Type GUIDs
|
||||
//
|
||||
EFI_GUID EfiPartTypeSystemPartitionGuid = EFI_PART_TYPE_EFI_SYSTEM_PART_GUID;
|
||||
EFI_GUID EfiPartTypeLegacyMbrGuid = EFI_PART_TYPE_LEGACY_MBR_GUID;
|
||||
|
||||
|
||||
//
|
||||
// Reference implementation Vendor Device Path Guids
|
||||
//
|
||||
EFI_GUID UnknownDevice = UNKNOWN_DEVICE_GUID;
|
||||
|
||||
//
|
||||
// Configuration Table GUIDs
|
||||
//
|
||||
|
||||
EFI_GUID MpsTableGuid = MPS_TABLE_GUID;
|
||||
EFI_GUID AcpiTableGuid = ACPI_TABLE_GUID;
|
||||
EFI_GUID SMBIOSTableGuid = SMBIOS_TABLE_GUID;
|
||||
EFI_GUID SalSystemTableGuid = SAL_SYSTEM_TABLE_GUID;
|
||||
43
gnu-efi-3.0/lib/debug.c
Normal file
43
gnu-efi-3.0/lib/debug.c
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
debug.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Debug library functions
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Declare runtime functions
|
||||
//
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
INTN
|
||||
DbgAssert (
|
||||
IN CHAR8 *FileName,
|
||||
IN INTN LineNo,
|
||||
IN CHAR8 *Description
|
||||
)
|
||||
{
|
||||
DbgPrint (D_ERROR, (CHAR8 *)"%EASSERT FAILED: %a(%d): %a%N\n", FileName, LineNo, Description);
|
||||
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
|
||||
1035
gnu-efi-3.0/lib/dpath.c
Normal file
1035
gnu-efi-3.0/lib/dpath.c
Normal file
File diff suppressed because it is too large
Load diff
76
gnu-efi-3.0/lib/error.c
Normal file
76
gnu-efi-3.0/lib/error.c
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 1998 Intel Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
error.c
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
|
||||
struct {
|
||||
EFI_STATUS Code;
|
||||
WCHAR *Desc;
|
||||
} ErrorCodeTable[] = {
|
||||
{ EFI_SUCCESS, L"Success"},
|
||||
{ EFI_LOAD_ERROR, L"Load Error"},
|
||||
{ EFI_INVALID_PARAMETER, L"Invalid Parameter"},
|
||||
{ EFI_UNSUPPORTED, L"Unsupported"},
|
||||
{ EFI_BAD_BUFFER_SIZE, L"Bad Buffer Size"},
|
||||
{ EFI_BUFFER_TOO_SMALL, L"Buffer Too Small"},
|
||||
{ EFI_NOT_READY, L"Not Ready"},
|
||||
{ EFI_DEVICE_ERROR, L"Device Error"},
|
||||
{ EFI_WRITE_PROTECTED, L"Write Protected"},
|
||||
{ EFI_OUT_OF_RESOURCES, L"Out of Resources"},
|
||||
{ EFI_VOLUME_CORRUPTED, L"Volume Corrupt"},
|
||||
{ EFI_VOLUME_FULL, L"Volume Full"},
|
||||
{ EFI_NO_MEDIA, L"No Media"},
|
||||
{ EFI_MEDIA_CHANGED, L"Media changed"},
|
||||
{ EFI_NOT_FOUND, L"Not Found"},
|
||||
{ EFI_ACCESS_DENIED, L"Access Denied"},
|
||||
{ EFI_NO_RESPONSE, L"No Response"},
|
||||
{ EFI_NO_MAPPING, L"No mapping"},
|
||||
{ EFI_TIMEOUT, L"Time out"},
|
||||
{ EFI_NOT_STARTED, L"Not started"},
|
||||
{ EFI_ALREADY_STARTED, L"Already started"},
|
||||
{ EFI_ABORTED, L"Aborted"},
|
||||
{ EFI_ICMP_ERROR, L"ICMP Error"},
|
||||
{ EFI_TFTP_ERROR, L"TFTP Error"},
|
||||
{ EFI_PROTOCOL_ERROR, L"Protocol Error"},
|
||||
|
||||
// warnings
|
||||
{ EFI_WARN_UNKOWN_GLYPH, L"Warning Unknown Glyph"},
|
||||
{ EFI_WARN_DELETE_FAILURE, L"Warning Delete Failure"},
|
||||
{ EFI_WARN_WRITE_FAILURE, L"Warning Write Failure"},
|
||||
{ EFI_WARN_BUFFER_TOO_SMALL, L"Warning Buffer Too Small"},
|
||||
{ 0, NULL}
|
||||
} ;
|
||||
|
||||
|
||||
VOID
|
||||
StatusToString (
|
||||
OUT CHAR16 *Buffer,
|
||||
IN EFI_STATUS Status
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; ErrorCodeTable[Index].Desc; Index +=1) {
|
||||
if (ErrorCodeTable[Index].Code == Status) {
|
||||
StrCpy (Buffer, ErrorCodeTable[Index].Desc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SPrint (Buffer, 0, L"%X", Status);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue