aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2023-11-22 02:58:20 +0000
committerWarner Losh <imp@FreeBSD.org>2023-11-22 02:58:20 +0000
commit7a1bc422d109a7cee56dcfbac616eda613c1c43e (patch)
treea53c3e7d371320a0b037bd8c778db37a2b8e80f7
parent9fc0ff9d85b1497b45a4c6d74e0bc7eea9dcf37b (diff)
downloadsrc-7a1bc422d109a7cee56dcfbac616eda613c1c43e.tar.gz
src-7a1bc422d109a7cee56dcfbac616eda613c1c43e.zip
stand/efi: Consolidate integer types
We have no need for 5 different copies of these. Sponsored by: Netflix Reviewed by: rcm, kevans, andrew Differential Revision: https://reviews.freebsd.org/D42699
-rw-r--r--stand/efi/include/amd64/efibind.h83
-rw-r--r--stand/efi/include/arm/efibind.h35
-rw-r--r--stand/efi/include/arm64/efibind.h76
-rw-r--r--stand/efi/include/efi.h31
-rw-r--r--stand/efi/include/i386/efibind.h83
-rw-r--r--stand/efi/include/riscv/efibind.h76
-rw-r--r--stand/efi/loader/main.c1
7 files changed, 31 insertions, 354 deletions
diff --git a/stand/efi/include/amd64/efibind.h b/stand/efi/include/amd64/efibind.h
index 2f900786fb9d..d005ade221c4 100644
--- a/stand/efi/include/amd64/efibind.h
+++ b/stand/efi/include/amd64/efibind.h
@@ -26,89 +26,6 @@ Revision History
#pragma pack()
-
-#ifdef __FreeBSD__
-#include <sys/stdint.h>
-#else
-//
-// Basic int types of various widths
-//
-
-#if (__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 short uint16_t;
- typedef short int16_t;
- typedef unsigned char uint8_t;
- typedef char int8_t;
- #else
- #ifdef 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
-#endif
-#endif /* __FreeBSD__ */
-
-//
-// Basic EFI types of various widths
-//
-
-#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */
-#define ACPI_USE_SYSTEM_INTTYPES 1 /* Tell ACPI we've defined types */
-
-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;
-
-#endif
-
-#undef VOID
-#define VOID void
-
-
-typedef int64_t INTN;
-typedef uint64_t UINTN;
-
#ifdef EFI_NT_EMULATOR
#define POST_CODE(_Data)
#else
diff --git a/stand/efi/include/arm/efibind.h b/stand/efi/include/arm/efibind.h
index 8bc9f4b56eb2..a08d26ac84c4 100644
--- a/stand/efi/include/arm/efibind.h
+++ b/stand/efi/include/arm/efibind.h
@@ -40,41 +40,6 @@ Abstract:
#endif
-#ifdef __FreeBSD__
-#include <sys/stdint.h>
-#else
-//
-// Assume standard IA-32 alignment.
-// BugBug: Need to check portability of long long
-//
-typedef unsigned long long uint64_t;
-typedef long long int64_t;
-typedef unsigned int uint32_t;
-typedef int int32_t;
-typedef unsigned short uint16_t;
-typedef short int16_t;
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-#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;
-
-#undef VOID
-#define VOID void
-
-//
-// Native integer size in stdint.h
-//
-typedef uint32_t UINTN;
-typedef int32_t INTN;
-
#define EFIERR(a) (0x80000000 | a)
#define EFI_ERROR_MASK 0x80000000
#define EFIERR_OEM(a) (0xc0000000 | a)
diff --git a/stand/efi/include/arm64/efibind.h b/stand/efi/include/arm64/efibind.h
index 4fdfd9f21386..417da1b4d4ff 100644
--- a/stand/efi/include/arm64/efibind.h
+++ b/stand/efi/include/arm64/efibind.h
@@ -26,82 +26,6 @@ Revision History
#pragma pack()
-
-#ifdef __FreeBSD__
-#include <sys/stdint.h>
-#else
-//
-// Basic int types of various widths
-//
-
-#if (__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;
- #else
- #ifdef 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
-#endif
-#endif /* __FreeBSD__ */
-
-//
-// Basic EFI types of various widths
-//
-
-
-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;
-
-
-#undef VOID
-#define VOID void
-
-
-typedef int64_t INTN;
-typedef uint64_t UINTN;
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// BugBug: Code to debug
//
diff --git a/stand/efi/include/efi.h b/stand/efi/include/efi.h
index 20776dcee2fc..b603c3a78205 100644
--- a/stand/efi/include/efi.h
+++ b/stand/efi/include/efi.h
@@ -39,6 +39,37 @@ Revision History
#define EFI_FIRMWARE_MINOR_REVISION 62
#define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) | (EFI_FIRMWARE_MINOR_REVISION))
+//
+// Basic EFI types of various widths.
+//
+
+#include <stdint.h>
+#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */
+#define ACPI_USE_SYSTEM_INTTYPES 1 /* Tell ACPI we've defined types */
+
+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;
+
+#ifdef __LP64__
+typedef int64_t INTN;
+typedef uint64_t UINTN;
+#else
+typedef int32_t INTN;
+typedef uint32_t UINTN;
+#endif
+
+#endif
+
+#undef VOID
+#define VOID void
+
+
#include "efibind.h"
#include "efidef.h"
#include "efidevp.h"
diff --git a/stand/efi/include/i386/efibind.h b/stand/efi/include/i386/efibind.h
index 6123a98d1b9b..e4cbceae8216 100644
--- a/stand/efi/include/i386/efibind.h
+++ b/stand/efi/include/i386/efibind.h
@@ -26,89 +26,6 @@ Revision History
#pragma pack()
-
-#ifdef __FreeBSD__
-#include <sys/stdint.h>
-#else
-//
-// Basic int types of various widths
-//
-
-#if (__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 short uint16_t;
- typedef short int16_t;
- typedef unsigned char uint8_t;
- typedef char int8_t;
- #else
- #ifdef 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
-#endif
-#endif /* __FreeBSD__ */
-
-//
-// Basic EFI types of various widths
-//
-
-#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine, use those */
-#define ACPI_USE_SYSTEM_INTTYPES 1 /* Tell ACPI we've defined types */
-
-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;
-
-#endif
-
-#undef VOID
-#define VOID void
-
-
-typedef int32_t INTN;
-typedef uint32_t UINTN;
-
#ifdef EFI_NT_EMULATOR
#define POST_CODE(_Data)
#else
diff --git a/stand/efi/include/riscv/efibind.h b/stand/efi/include/riscv/efibind.h
index 4fdfd9f21386..417da1b4d4ff 100644
--- a/stand/efi/include/riscv/efibind.h
+++ b/stand/efi/include/riscv/efibind.h
@@ -26,82 +26,6 @@ Revision History
#pragma pack()
-
-#ifdef __FreeBSD__
-#include <sys/stdint.h>
-#else
-//
-// Basic int types of various widths
-//
-
-#if (__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;
- #else
- #ifdef 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
-#endif
-#endif /* __FreeBSD__ */
-
-//
-// Basic EFI types of various widths
-//
-
-
-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;
-
-
-#undef VOID
-#define VOID void
-
-
-typedef int64_t INTN;
-typedef uint64_t UINTN;
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// BugBug: Code to debug
//
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index a650abb3b68c..d6ba7ec3da44 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -60,7 +60,6 @@
#include "efizfs.h"
#include "framebuffer.h"
-#define ACPI_USE_SYSTEM_INTTYPES 1
#include "platform/acfreebsd.h"
#include "acconfig.h"
#define ACPI_SYSTEM_XFACE