Commit Graph

129 Commits

Author SHA1 Message Date
Ard Biesheuvel
fa506bd242 ARM: hide 'hidden' pragma for hosted build
The hidden visibility #pragma in inc/arm/efibind.h was meant to inform
the compiler that symbols with external linkage are never exported from
shared libraries [and thus never preempted] when executing in UEFI context
(since UEFI does not support shared libraries). This allows the compiler to
generate relative symbol references instead of GOT entries, which is much more
efficient since the latter need to be relocated before invoking the entry
point of the UEFI app.

However, as it turns out, this pragma is leaking into other code that does
not run in UEFI context, but simply needs to access data structures that
UEFI defines. So make the pragma dependent on whether we are building with
-ffreestanding, which is only used for bare metal code such as UEFI.

Last-Update: 2018-08-24

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Elder versions of sbsigntool failed to build on armhf without the patch,
cf. https://launchpad.net/ubuntu/+source/gnu-efi/3.0.8-0ubuntu1~16.04.1
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-05-08 11:40:21 +00:00
Peter Jones
69df7422b1 Add EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID.
Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-05-08 11:07:25 +00:00
b'Nigel Croxon
3676bc353c Merge /u/xypron/gnu-efi/ branch riscv64 into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/17/
2021-04-05 14:13:03 +00:00
b'Nigel Croxon
2a1200f36f Merge /u/kagurazakakotor/gnu-efi/ branch shell-protocol into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/13/
2021-04-05 14:11:15 +00:00
b'Nigel Croxon
2cdf05814d Merge /u/kagurazakakotor/gnu-efi/ branch protocol-header into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/12/
2021-04-05 14:10:15 +00:00
Heinrich Schuchardt
b95f138fa1 Initial support for RISCV64
Add the RISCV64 architecture

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-04-01 17:17:33 +02:00
Pete Batard
b39be0d5a9 Define UnicodeSPrint/UnicodeVSPrint as our main SPrint/VSPrint calls
Per https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/PrintLib.h
those are the names used by EDK2, so make these our official names as well.

For compatibility with older gnu-efi versions, also keep SPrint and VSPrint defined.
2021-03-08 15:00:14 -05:00
Pete Batard
2458595367 Use EFI_FILE_SYSTEM_VOLUME_LABEL rather than EFI_FILE_SYSTEM_VOLUME_LABEL_INFO
Per https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Guid/FileSystemVolumeLabelInfo.h
the EDK2 uses EFI_FILE_SYSTEM_VOLUME_LABEL and EFI_FILE_SYSTEM_VOLUME_LABEL_ID rather
than EFI_FILE_SYSTEM_VOLUME_LABEL_INFO and EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID.

We redefine those to the proper EDK2 names, while also adding defines for compatibility.
2021-03-08 14:59:46 -05:00
Pete Batard
6c77f27793 Define BASE_CR as a duplicate of the _CR macro
Per https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Base.h#L867
the EDK2 uses BASE_CR and not _CR, so make sure gnu-efi defines it too.
2021-03-08 14:59:02 -05:00
Pete Batard
b1c7a1c5f2 Remove the need for other include paths besides <gnu-efi>/inc
Having to add specific arch include paths and then <gnu-efi>/lib
to be able to use gnu-efi in an application is annoying.

This patch ensures that the library itself takes care of including
the relevant headers, and that one needs only to add <gnu-efi>/inc
in their include path to be able to use gnu-efi.
2021-02-18 10:15:22 -05:00
Pete Batard
70bced02ed Always define HAVE_USE_MS_ABI for MSVC compilers
Obviously, it makes little sense not to have it unconditionally defined there.
2021-02-18 10:13:46 -05:00
Pete Batard
0247cb7cd4 Add AsciiPrint and AsciiVSPrint
Per https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/PrintLib.h
AsciiPrint() is the official name of APrint() so declare it as such and define
an APrint alias for compatibility.

Also add an AsciiVSPrint() to print a formatted ASCII string to a buffer using
a va_list. AsciiPrint() too is defined in EDK2's PrintLib.h, though our implementation
just invokes the Unicode version and then converts the buffer to ASCII.
2021-02-18 10:11:44 -05:00
Pete Batard
ebdde0bc4b Always prefer the external <stdarg.h> for MSVC compilation
The __builtin_va_###() intrinsics apply only to GCC-like compilers and
MSVC's <stdarg.h> works just fine with gnu-efi.
Without this patch, one has to define GNU_EFI_USE_EXTERNAL_STDARG to
make gnu-efi work with a Microsoft toolchain, which is annoying...
2021-02-18 10:09:07 -05:00
Jiaqing Zhao
6c04004f63
Add EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL definitions
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2020-11-15 15:26:19 +08:00
Jiaqing Zhao
773f30af29
Move EFI_SHELL_PARAMETERS_PROTOCOL related definitions to efishell.h
As EFI_SHELL_PARAMETERS_PROTOCOL is also defined in UEFI Shell Spec,
put it together with EFI_SHELL_PROTOCOL.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2020-11-15 15:15:18 +08:00
Jiaqing Zhao
2b26c8112f
Add EFI_SHELL_PROTOCOL definitions
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2020-11-15 15:12:25 +08:00
Kagurazaka Kotori
ce0bd62f5c
Add Device Path Utilities Protocol support
Signed-off-by: Kagurazaka Kotori <kagurazakakotori@gmail.com>
2020-07-23 15:44:12 +08:00
Kagurazaka Kotori
7cc4f3a20c
Replace Pause() macro with new library function
Key input should be consumed to prevent WaitForKey event from being
always triggered and potential buffer overflow.
This fixes issue #26.

Signed-off-by: Kagurazaka Kotori <kagurazakakotori@gmail.com>
2020-07-22 17:49:07 +08:00
Kagurazaka Kotori
b82e6b6f5b
Add Simple Text Input Ex Protocol support
Signed-off-by: Kagurazaka Kotori <kagurazakakotori@gmail.com>
2020-07-21 16:05:43 +08:00
Pete Batard
d857a968f4 Add SMBIOS 3.0 table support
Also fix some small whitespace issues.
2020-05-11 11:03:35 -04:00
Nigel Croxon
9b63de7db6 Re-add back the original symbol, typeo.
Fix breaking code by restoring original typeo in efierr.h
EFI_WARN_UNKOWN_GLYPH definition.

Fixes: commit 5d0d538c25

Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2020-01-16 14:35:56 -05:00
Alexander von Gluck IV
6685cd0002 efibind: Fix usage of efi headers from C++ code
* __STDC_VERSION__ is undefined when headers are called from C++
  code resulting in not using stdint.h and efibind.h
  "making a guess" on what they are. extern "C" will not define
  __STDC_VERSION__.
* Always leverage stdint.h on C++.
* Honestly, gnu-efi should always use stdint.h, or find a better
  way to detect it. (or platforms without it need to catch up to 2007)
2019-11-27 17:03:49 -06:00
Nigel Croxon
8b2da2c224 Revert "efilink: fix build with gcc 4.8"
Breaks gcc builds with '-nostdinc' flag.

The fix in 1a53d8f88a
(Fix for problem with undeclared intptr_t type), which is also merged
fixes the same problem, without causing breakage.

This reverts commit 6335e5c697.
2019-10-28 07:45:38 -04:00
Nigel Croxon
3e4d5c7990 Merge /u/lslrt/gnu-efi/ branch exclude_efisetjmp into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/8/
2019-05-16 20:31:59 +00:00
leo
486ba3c3bd Do not include efisetjmp.h on efi.h
People than really want to use efisetjmp implementation can include
the header on their own.

Signed-off-by: leo <leo.sartre@geebol.fr>
2019-05-15 05:32:24 +02:00
leo
238358c6df efiapi.h: fix EventGroup parameter of EFI_CREATE_EVENT_EX prototype
From UEFI specifications, this parameter is a pointer, see
https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf
page 148 for reference.

Signed-off-by: leo <leo.sartre@geebol.fr>
2019-05-14 07:44:28 +02:00
Nigel Croxon
7604ff2629 Merge /u/esben/gnu-efi/ branch intptr-t-fix into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/5/
2019-03-22 18:02:34 +00:00
Nigel Croxon
99c1436dc9 Merge /u/ffontaine35/gnu-efi/ branch master into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/3/
2019-03-22 18:01:07 +00:00
Nigel Croxon
5b74db0e15 Redefine jmp_buf to comply with C calling convention.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2019-03-15 09:32:06 -04:00
Esben Haabendal
1a53d8f88a Fix for problem with undeclared intptr_t type
When building gnu-efi with old compilers with pre C90 compilers:

In file included from gnu-efi-3.0.9/lib/../inc/efilib.h:25:0,
                 from gnu-efi-3.0.9/lib/lib.h:24,
                 from gnu-efi-3.0.9/lib/dpath.c:25:
gnu-efi-3.0.9/lib/dpath.c: In function 'FileDevicePath':
gnu-efi-3.0.9/lib/../inc/efilink.h:145:47: error: 'intptr_t' undeclared (first use in this function)
 #define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(intptr_t)(&(((TYPE *) 0)->Field)))

Problem introduced with commit a46a62b12b
(Fix some types gcc doesn't like).

Avoid this by adding intptr_t (and uintptr_t) typedefs for builds that does
not include stdint.h.

Signed-off-by: Esben Haabendal <esben@esben1.localdomain>
2019-03-15 12:09:50 +01:00
Fabrice Fontaine
6335e5c697 efilink: fix build with gcc 4.8
intptr_t is undefined without an include on stdint.h

Fixes:
 - http://autobuild.buildroot.org/results/a0ca37b5ed27af445344e3ac49dc87bb17512c50

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-01-18 22:12:38 +01:00
Nigel Croxon
d34132e62f * Fixed typeo lib/error.c EFI_WARN_UNKNOWN_GLYPH definition.
On couple of locations in runtime string library (rtstr.c)
there are calls to non-runtime variant of StrLen function.
* Another issue is with formatting 1394 paths.
The F1394_DEVICE_PATH::Guid is formatted as %g, but 1394
GUID is 8 byte integer, not EFI_GUID and therefore should
be formatted as e.g. %016lx (as edk2 does).
* Beyond what's mentioned above, changed the format of the
harddrive path, so it's in line with edk2 format and spec
(2.7 errata A, chapter 10.6.1.6, table 102).

Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
Signed-off-by: manison <manison@users.sf.net>
2019-01-09 07:03:46 -05:00
Nigel Croxon
5d0d538c25 Fix typeo in efierr.h EFI_WARN_UNKNOWN_GLYPH definition.
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
Signed-off-by: manison <manison@users.sf.net>
2019-01-08 11:19:25 -05:00
Peter Jones
9485c65f6d gnu-efi: add some more common string functions.
This adds bounded string helper functions:

StrnLen()
StrnCpy()
StrnCat()
StpnCpy()

And the unbounded function StpCpy().

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
28b487d1ae Fix typedef of EFI_PXE_BASE_CODE
Commit 751cbce3 fixed up a bunch of types to better match the edk2
definitions and the names in the UEFI Spec, but while doing so
inadvertantly defined things thusly:

  INTERFACE_DECL(_EFI_PXE_BASE_CODE_PROTOCOL);
  ...
  typedef struct _EFI_PXE_BASE_CODE_PROTOCOL {
  ...
  } EFI_PXE_BASE_CODE_PROTOCOL;
  ...
  typedef struct _EFI_PXE_BASE_CODE_PROTOCOL _EFI_PXE_BASE_CODE;
  typedef struct EFI_PXE_BASE_CODE_PROTOCOL EFI_PXE_BASE_CODE;

Because EFI_BASE_CODE_PROTOCOL is declared with a typedef, and is
therefore in the type namespace rather than the struct namespace, this
results in EFI_PXE_BASE_CODE being a forward declaration of an
incomplete type.  The net result is that code which dereferences any
field in the struct, even with the correct names, will not correctly
build.

This patch changes both _EFI_PXE_BASE_CODE and EFI_PXE_BASE_CODE
typedefs to inherit from struct _EFI_PXE_BASE_CODE_PROTOCOL.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
a46a62b12b Fix some types gcc doesn't like
Most of these come from building on i386 with -Wextra, but they're still
incorrect everywhere else; they just happen to have identical typedefs
at other places, so the compiler doesn't care.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:22 -04:00
Nigel Croxon
787b53a66c Add EFI_DRIVER_ENTRY_POINT support for MSVC/ARM64
Similar to what we do for other MSVC architectures.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-11-06 09:34:14 -05:00
Nigel Croxon
39ce220cb6 Make sure stdint.h is always used with MSVC on ARM/ARM64, since all
the versions of Visual Studio that support ARM or ARM64 have that
header. Without this, uint64_t would be defined to unsigned long,
which is 32-bits in the Microsoft world.

Also fix aarch64/initplat.c so that memset/memcpy only apply
to gcc. Otherwise MSVC throws an error for __SIZE_TYPE__.

Updating this patch to v2, since it turns out MSVC will also emit
memset and memcpy intrinsics that we can use an implementation for.
This is true for both ARM and ARM64.
To make this work, I'm defining __SIZE_TYPE__ to UINTN if not
already defined.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-11-06 09:26:05 -05:00
Nigel Croxon
bf07e81417 Declare EFI_PXE_BASE_CODE correctly
EFI_PXE_BASE_CODE was redefined in the early commit(*) to match the
definition in EDK2. However, EFI_PXE_BASE_CODE wasn't declared
correctly. Since EFI_PXE_BASE_CODE_PROTOCOL is already an alias of
"struct _EFI_PXE_BASE_CODE_PROTOCOL", the additional struct in front of
EFI_PXE_BASE_CODE_PROTOCOL actually confused the compiler and caused
build fail. Remove the redundant struct to avoid confusion.

*751cbce3f640c7 Update global protocol GUIDs definitions to match EDK2

Signed-off-by: Gary Lin <glin@suse.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-06-14 08:05:45 -04:00
Nigel Croxon
08b72e8d99 This typedef is already defined with the structure and can
generate an error ("typedef redefinition is only available
in C11") with Clang.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-05-30 19:36:55 -04:00
Nigel Croxon
574b48d8e4 This is mere refactoring of the code and is not linked to any
specific issue.

I think ARM's DivU64x32() would be better located along MultU64x32()
and other calls in ARM's math.c, as having it in a header seems weird,
even with the goal of inlining it. I doubt there's much performance
to be lost from having it non-inline in math.c and it should make the
code breakdown more logical.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-03-30 18:04:42 -04:00
Nigel Croxon
d3e46ee9cb x86-64/efibind: sanitize ms-abi cpp conditionals
Signed-off-by: David Decotigny <ddecotig@gmail.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-03-10 16:03:59 -05:00
Nigel Croxon
79f4f38d15 Version checks in inc/x86_64/efibind.h for ms_abi support gives
false negative for clang.

Signed-off-by: toazzz < toal193@users.sf.net>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-02-20 14:29:53 -05:00
Nigel Croxon
3f8935c3d0 add-Exit - Add Exit() library function which calls BS->Exit()
Signed-off-by: Jonathon Reinhart <jonathon.reinhart@gmail.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-02-17 16:30:28 -05:00
Nigel Croxon
787cb7fcd8 fix clang support.
Tested:
  make all apps + tests apps/ on x86_64
  make CC=clang all apps + tests apps/ on x86_64

Signed-off-by: David Decotigny <ddecotig@gmail.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-02-17 16:24:26 -05:00
Nigel Croxon
4d326eae7d Allow gcc to emit warnings for unsafe usage of setjmp/longjmp
Patch to allow gcc to emit warnings for unsafe usage of setjmp/long

Signed-off-by: David Decotigny <gdaviddecotigny@users.sf.net>
Signed-off-by: Nigel Croxon <noxorc@mac.com>
2017-01-08 07:11:24 -05:00
Nigel Croxon
3f234f5b6f Add support for 64 bit MIPS
This is a patch to add support for 64-bit MIPS.

Signed-off-by: Hev heiher <heiher@users.sf.net>
Signed-off-by: Nigel Croxon <noxorc@mac.com>
2017-01-08 07:04:52 -05:00
Nigel Croxon
fa1b977962 GCC 4.8 (and others) const warnings
Calling the various Print functions picked up some warnings in my
project (using GCC 4.8 and 4.9 at the moment):
warning: passing argument 1 of Print discards const qualifier from
pointer target type [enabled by default]

Signed-off-by: Nigel Croxon <noxorc@mac.com>
Signed-off-by: Justinian <justinian@users.sf.net>
2017-01-08 06:52:33 -05:00
Nigel Croxon
b14cc9cb4f Add Debugger protocol support.
Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-09-15 14:38:51 -04:00
Nigel Croxon
447ad9aa3a Add EBC (EFI Byte Code) protocol support.
Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-09-15 14:34:56 -04:00
Nigel Croxon
c108e118da Add support for PCI Root Bridge I/O protocol.
PCI Root Bridge I/O protocol is used by PCI Bus Driver to perform
PCI Memory, PCI I/O, and PCI Configuration cycles on a
PCI Root Bridge. It also provides services to perform different
types of bus mastering DMA.

V2 - Scratch that - there already exists an efipciio.h with most
of these definitions. Let me remove this patch and propose a new
one that will amend what's already there.
OK, here's a better version that adds the required definition in
efipciio.h. Note that EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL and
EFI_PCI_IO_PROTOCOL are two different protocols.

V3 - Pete, There are now two defines of EFI_PCI_ADDRESS.
Please repost with your define removed.
Nigel, Sorry about that. Here's v3.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-09-15 12:50:48 -04:00
Nigel Croxon
9cdd67da85 Bridge more gaps between EDK and gnu-efi
This patch adds a few more items to facilitate porting
from EDK to gnu-efi.
It also adds updated PE machine types and fixes a discrepancy
for EVT_EFI_SIGNAL_MAX.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-09-15 11:41:45 -04:00
Nigel Croxon
751cbce3f6 Update global protocol GUIDs definitions to match EDK2
This patch introduces the use of the EDK2 names for the global GUID
variables, to allow for easier code conversion between EDK2 and
gnu-efi. All the existing GUID global variables have also been
aliased for backwards compatibility.

The patch also completes some of the earlier work with regards to
protocol struct definitions to also match the EDK2, with the
following caveat:
Because some of gnu-efi GUID macro definitions were declared with
the name that the EDK2 uses for the protocol struct itself, we have
to immediately deprecate the following GUID data aliases:
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
EFI_SIMPLE_NETWORK_PROTOCOL
EFI_PCI_IO_PROTOCOL
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL
This means that existing code using one of the above will break
on compilation. To mitigate this, explicit warnings have been
placed at the location where a developer will look for breakage,
detailing how they should amend their code.

The KnownGuids short labels in guid.c were also updated/amended
in a manner that should be a bit more consistent (though I have
no idea what the EDK2 does here, since I haven't looked at the
actual EDK2 source).

Finally, besides clean up (typo, whitespaces, duplicate removal),
we introduce the _GNU_EFI macro, in efi.h, to allow for conditional
selection of specific gnu-efi API calls, in code that may be
compiled with either EDK2 or gnu-efi.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-18 08:42:11 -04:00
Nigel Croxon
7993cbcc72 Add support for some UEFI 2.0 protocols
* DevicePath[To|From]Text
* BlockIo2
* DiskIo2
* Ex calls for Simple File System

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-16 10:18:58 -04:00
Nigel Croxon
1b10394e06 This patch is a follow up to 8118d08727
and completes the renaming of structs, defines, and typedefs to match
the naming convention from the latest UEFI specifications.

This should make it easier for people to switch between EDK2 and
gnu-efi compilation.

The original names are #defined or typedef'd to the new names for
backwards compatibility. Also some whitespace cleanup was applied.

Note 1: From what I could see of the EDK API documentation,
structs are being aliased to their old names using typedef rather
than #define, so that's what I used. I altered some of the #define
from 8118d0 accordingly

Note 2: I also think it might be more helpful for users to keep
the backwards compatibility defs close to their declaration
(e.g. old GUID def right after current GUID declaration), rather
than in a separate section as was done in 8118d0, so that's what
I did in this patch.

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-15 10:41:40 -04:00
Nigel Croxon
ef81c051c9 Add GUID for SMBIOS 3 entry point structure.
64 bit entry point structure has a different GUID
from the existing 32 bit version.

Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-12 10:43:25 -04:00
Nigel Croxon
cae022d6e4 This patch adds definitions to efiprot.h for
EFI_EDID_ACTIVE_PROTOCOL
     EFI_EDID_DISCOVERED_PROTOCOL
     EFI_EDID_OVERRIDE_PROTOCOL
It also adds the matching global variables to libefi.

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-07-08 10:56:31 -04:00
Nigel Croxon
b2c4db065f I did a quick review of the MS x86_64 calling convention for floating
point and as far as I can tell it agrees with the UEFI spec.
The attached patch removes -mno-mmx and -mno-sse for x86_64 and adds
a new Print target, "%f", to print float and double types.

It seems to compile for ia32, although I'm not sure why - shouldn't
it be throwing errors because the new function FloatToStr() in print.c
accepts a float, yet I left -no-sse for ARCH=ia32? A better solution
might be to add -msoft-float for targets where the floating point
calling convention doesn't match the UEFI spec. As I'm not familiar
with UEFI on ia32, I didn't make any changes to it.

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-06-17 10:07:25 -04:00
Nigel Croxon
8118d08727 Protocol struct/type/define renaming to match spec naming convention.
This patch renames a number of structs, defines, and typedefs to match
the naming convention in the UEFI specification. For example, it renames
DRIVER_BINDING_PROTOCOL (preprocessor GUID define) to
EFI_DRIVER_BINDING_PROTOCOL_GUID, and renames EFI_DRIVER_BINDING (protocol
interface) to EFI_DRIVER_BINDING_PROTOCOL.

The original names are all #defined to the new names for backwards
compatibility, so nothing should be broken.

Included in this patch are renames for all the types/defines for the
following protocols:
EFI_DRIVER_BINDING_PROTOCOL
EFI_COMPONENT_NAME_PROTOCOL
EFI_COMPONENT_NAME2_PROTOCOL
EFI_LOADED_IMAGE_PROTOCOL

If you accept this patch I'll work on adjusting all the other protocols
to match the spec as well, as time allows. Moving to the spec's naming
convention makes the code clearer and improves portability with EDK2.

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-05-10 13:07:19 -04:00
Nigel Croxon
63213a7b4e This patch adds protocol definitions (and the corresponding global
EFI_GUID instances) for EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL,
EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL, and
EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL, used in the driver
binding search procedure to select which driver to connect when
multiple drivers' Supported() functions indicate support for
the same controller.

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-05-03 14:13:43 -04:00
Nigel Croxon
6605c16fc8 This patch simply duplicates the use of /ENTRY option being passed to
the MSVC ARM linker, to specify the entry point, as is already the case
for ia32 and x86_64.

Required to enable the compilation of ARM drivers with MSVC, without
having to manually specify the entry point.

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-04-07 08:50:00 -04:00
Nigel Croxon
58e6955b44 The following fixes a couple GCC specifics for the ARM platform,
that MSVC compilers will complain about (such as Visual Studio
2015 with ARM target).

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-28 09:00:57 -04:00
Nigel Croxon
5ff74ecae8 Commit 3dd05c and subsequent ones introduced the use of the GNU
specific __attribute__((__unused__)), which breaks MSVC compilation...

I'll use this as a reminder that gnu-efi is compiled with more than
GNU toolchains, and that contributors might want to be careful about
adding GNU-specific extensions...

This patch does the following:
Create a new eficompiler.h header that sets all compiler-specific
options and extensions
Create a new EFI_UNUSED macro to be used in lieu of
__attribute__((__unused__)) and applies it to the relevant sources
Move the ALIGN(x) macro, previously defined in efisetjmp.h to the new header

Oh, and it also fixes a bunch of trailing whitespaces (because my code
editor is set to do just that by default).

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-25 13:32:54 -04:00
Nigel Croxon
9b0fe34e20 Add support for EFI_RNG_PROTOCOL to the library.
Signed-off-by: Daniel Roy <danielbroy@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-21 11:37:28 -04:00
Nigel Croxon
3b31a5e394 Moved LOADED_IMAGE_PROTOCOL definitions into efiprot.h,
with other protocol definitions.

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-17 09:50:15 -04:00
Nigel Croxon
8c29617e0b Added definitions for EFI HASH PROTOCOL
Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-17 09:31:29 -04:00
Nigel Croxon
883702e813 Add definitions for EFI_COMPONENT_NAME_PROTOCOL and EFI_COMPONENT_NAME2_PROTOCOL
Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-15 14:52:12 -04:00
Nigel Croxon
0f78eb65fe Global GUID for DRIVER_BINDING_PROTOCOL
Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-10 09:32:52 -05:00
Nigel Croxon
533a042d00 Add definitions for EFI_DRIVER_BINDING_PROTOCOL
Signed-off-by: Nathan Blythe <nblythe@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-09 10:10:58 -05:00
Nigel Croxon
333bf05da9 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v2] ARM/AARCH64: define C99 types explicitly when building against
older standard

This adds support for the C99 uintXX_t types when building for
older versions of the standard, like the other architectures
already implement.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-01-07 09:40:50 -05:00
Nigel Croxon
d119b0d759 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 2/2] Replace ARM arithmetic support routines
with EDK2 versions.

Replace the incomplete GPL licensed ARM arithmetic support routines
with the ones from the EDK2 project. These cover long long multiplication
and long long logical shift as well.

Also remove the special case for small dividends in DivU64x32: we can
simply let the compiler handle this, and emit calls to the support
routines where appropriate.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-12-23 08:33:02 -05:00
Nigel Croxon
9ce3546d05 From: Pete Batard <pete@akeo.ie>
Subject: [PATCH] Fix MSVC breakage due to GNU align extensions in setjmp

* __attribute__((__aligned__(x))), which is used in setjmp, is GNU only => use a macro instead

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-09-23 10:03:31 -04:00
Nigel Croxon
0b5f181a36 From: Pete Batard <pete@akeo.ie>
Date: Wed, 16 Sep 2015 18:26:28 +0100
Subject: [PATCH] Fix VS2015 warnings

* Currently, Visual Studio 2015 generates a lot of warnings such as:
  gnu-efi\inc\efipciio.h(7): warning C4091: 'typedef ': ignored on left of '_EFI_PCI_IO' when no variable is declared
* To address this, gnu-efi should define the INTERFACE_DECL() for MS compilers as it does for GNU

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-09-17 08:22:39 -04:00
Nigel Croxon
fbcdcf56e8 Add the missing URI device path to the unions.
Signed-off-by: Gary Ching-Pang Lin <chinpang@gmail.com>
SIgned-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-08-19 07:28:45 -04:00
Nigel Croxon
ad7f0d4ba2 From: Gary Ching-Pang Lin <chingpang@gmail.com>
Date: Mon, 17 Aug 2015 17:00:11 +0800
Subject: [PATCH] Add URI Device Path

Add the definition of URI Device Path according to UEFI 2.4c.

Signed-off-by: Gary Ching-Pang Lin <chingpang@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-08-17 16:00:33 -04:00
Nigel Croxon
dae0b4b0b0 Turns out we actually need setjmp in one of gnu-efi's prominent
users, and it seems to make more sense to put it here than in
the application.

All of these are derived from the Tiano code, but I re-wrote the
x86_64 one because we use the ELF psABI calling conventions instead
of the MS ABI calling conventions.  Which is to say you probably
shouldn't setjmp()/longjmp() between functions with EFIAPI (aka
__attribute__((ms_abi))) and those without.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-05-14 12:20:51 -04:00
Nigel Croxon
ce7098fb52 Enable out-of-tree building
This patch enables building gnu-efi outside of the source tree.
That in turn enables building for multiple architectures in parallel.

The build directory is controlled by the OBJDIR make variable.  It
defaults to the value of ARCH, and can be overridden from the command
line.

This patch also cleans up some doubled slashes between INSTALLROOT
and PREFIX.

Signed-off-by: Jonathan Boeing <jonathan.n.boeing@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-02-19 11:22:45 -05:00
Nigel Croxon
09027207f7 From: Pete Batard <pete@akeo.ie>
Date: Wed, 10 Dec 2014 21:08:34 +0000
Subject: [PATCH] fixes for MSVC compilation

These fixes are needed to address the following error and warnings when compiling the library part
using Visual Studio 2013 Community Edition (as in https://github.com/pbatard/uefi-simple):
* "lib\x86_64\math.c(49): error C4235: nonstandard extension used : '_asm' keyword not supported
  on this architecture"
* "lib\print.c(98): error C2059: syntax error : '('" due to placement of EFIAPI macro
* "lib\cmdline.c(94): warning C4090: 'function' : different 'const' qualifiers"
* "lib\smbios.c(25): warning C4068: unknown pragma"
* Also update macro definitions in "inc\<arch>\efibind.h" for MSVC

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-01-05 13:13:22 -05:00
Nigel Croxon
530d68ba19 The gnu-efi-3.0 toplevel subdirectory is really annoying. Kill it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-25 10:09:50 -05:00