Commit Graph

106 Commits

Author SHA1 Message Date
Callum Farmer
9e47db1193 Add C++ extern C header markers
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Moody Liu
1de5094978 riscv64: adjust type definitions
CHAR8 needs to be defined while BOOLEAN should be removed
here to prevent typedef conflicts

Signed-off-by: Moody Liu <mooodyhunter@outlook.com>
2023-05-13 17:57:24 +01:00
b'Nigel Croxon
bc46fbdc84 Merge /u/gmbr3/gnu-efi/ branch TRUEFALSE into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/49/
2023-04-17 11:39:01 +00:00
b'Nigel Croxon
dcced03469 Merge /u/gmbr3/gnu-efi/ branch CHAR16 into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/48/
2023-04-17 11:38:41 +00:00
b'Nigel Croxon
362ef3db04 Merge /u/gmbr3/gnu-efi/ branch nullptr into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/46/
2023-04-17 11:37:07 +00:00
b'Nigel Croxon
e0e1f53ce2 Merge /u/gmbr3/gnu-efi/ branch pkgconf2 into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/45/
2023-04-17 11:36:22 +00:00
b'Nigel Croxon
7219aba42c Merge /u/yetist/gnu-efi/ branch dev-master into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/33/
2023-04-17 11:35:08 +00:00
Callum Farmer
2a599ea133 Make TRUE/FALSE compatible with C23/C++
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-15 14:45:19 +01:00
Callum Farmer
056bdaa53e Make VOID a typedef
'void' is a type so VOID can be typedef instead of
 a '#define' to improve compiler output

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-13 14:32:37 +01:00
Callum Farmer
189200d0b0 Make WCHAR and CHAR16 identical
And actually use wchar_t
gnu-efi already uses L string literals which are of type
wchar_t

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-08 20:07:13 +01:00
Callum Farmer
d0900861c2 Make NULL compatible with C23/C++
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-07 14:13:43 +01:00
Callum Farmer
63a9a4d4c0 Add pkgconfig file
Also add EXEC_PREFIX and INCLUDEDIR variables

This was requested by fwupd-efi, to be able
to retrieve the version number of gnu-efi
so we can detect features

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-07 13:51:28 +01:00
Callum Farmer
8efd8cde75 Use C/C++ boolean when available
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-04 14:20:31 +01:00
Peter Jones
14899d899b Make CHAR8 and similar be defined the same way edk2 does it.
Signed-off-by: Peter Jones <pjones@redhat.com>
2023-03-28 08:39:26 -04:00
bmeng@tinylab.org
0f9c15fe4f riscv: Update SPDX license identifiers
The whole gnu-efi project is licensed under BSD license, see [1].
However some of the RISC-V codes have conflict license identifiers:

- Some mention GPL-2.0+ in the SPDX license part, but the long license
  header indicates it's actually BSD and GPL-2.0+ dual-licensed
- Some mention GPL-2.0+ in the SPDX license part only
- Some do not have any license indication

To have a matching license with the whole project, this commit updates
all RISC-V codes to have the correct SPDX license identifiers
(GPL-2.0+ or BSD dual-license).

Link: https://sourceforge.net/p/gnu-efi/ [1]
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-03-08 10:32:49 -05:00
Xiaotian Wu
1ba13fdfd0 Add PE machine type definitions for the LoongArch
See https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types

Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
2023-01-04 10:31:26 +08:00
b'Nigel Croxon
c2102ae059 Merge /u/mingtaoxt/gnu-efi/ branch master into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/29/
2022-11-16 20:56:17 +00:00
Dwight Engen
4a566dd746 aarch64: fix setjmp overrun
The assembly code uses fixed offsets into the jmp_buf and leaves an 8 byte
gap between the GPRs and the FPRs, but the jmp_buf structure was not laid
out to account for this so the code would overrun the jmp_buf by 8 bytes.

Found-by: Oskar Engen <oskar.engen@gmail.com>
Signed-off-by: Dwight Engen <dwight.engen@gmail.com>
2022-09-28 12:01:29 -04:00
Fabrice Fontaine
6b28563584 Handle __mips64
Handle __mips64 to avoid a build failure since
b1c7a1c5f2

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-07-25 10:36:14 -04:00
zhoumingtao
5849eacdce use jr instead of jirl
jirl -> jr
2022-07-07 15:16:10 +08:00
zhoumingtao
e7db4418b1 Add support for LoongArch64 architecture 2021-12-30 15:39:47 +08:00
Pete Batard
b136460925 riscv64: finalize efibind.h
There's little reason not to derive the RISCV64 version of efibind.h
from the AARCH64 version, especially as the current version is missing
required macros such as EFI_DRIVER_ENTRY_POINT() which breaks the
compilation of some drivers.

The only major difference we introduce from AARCH64 is to consider
that any toolchain that supports RISCV64 is modern enough to support
<stdint.h>. Also, as we preserve the added definition for BOOLEAN,
we guard it with an ifndef in anticipation of MSVC RISCV64 support.

We validated these changes by confirming that they now allow gnu-efi
to be used to compile a set of UEFI drivers for RISCV64.
2021-08-19 12:21:14 -04:00
Alfonso Sánchez-Beato
fbbbf47e5c Add definitions for the EFI device tree table
Add definitions for the EFI device tree table, as specified in UEFI
specification 2.9 (March 2021).

Signed-off-by: Alfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>
2021-07-16 16:36:46 +02:00
Heinrich Schuchardt
df31239ac5 riscv64: provide efisetjmp_arch.h
efisetjmp_arch.h is required for 'make apps'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-23 22:56:29 +02:00
Heinrich Schuchardt
b5f98d40fe riscv64: missing EFI_FUNCTION
Add missing definition. It is needed for 'make apps'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-23 22:56:29 +02:00
Nigel Croxon
860b1c8cbe efiapi.h: add RISC-V machine type definitions
These values are from the UEFI specification version 2.9.

Signed-off-by: David Michael <fedora.dm0@...>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2021-06-23 09:37:54 -04:00
b'Nigel Croxon
9e7e6822b7 Merge /u/xypron/gnu-efi/ branch GCC_visibility into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/20/
2021-05-17 14:20:24 +00:00
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