Re: remove efibind.h cruft

2021-07-26 Thread Mark Kettenis
> Date: Mon, 26 Jul 2021 18:45:31 +1000
> From: Jonathan Gray 
> 
> Follow what was done with riscv64 and replace efibind.h with just the
> defines we need.
> 
> Tested on armv7 arm64 and amd64 (bootx64).

ok kettenis@
 
> Index: sys/stand/efi/include/amd64/efibind.h
> ===
> RCS file: /cvs/src/sys/stand/efi/include/amd64/efibind.h,v
> retrieving revision 1.2
> diff -u -p -r1.2 efibind.h
> --- sys/stand/efi/include/amd64/efibind.h 4 Jun 2021 00:09:34 -   
> 1.2
> +++ sys/stand/efi/include/amd64/efibind.h 26 Jul 2021 05:39:34 -
> @@ -1,271 +1,22 @@
> -/* $FreeBSD: head/sys/boot/efi/include/amd64/efibind.h 279038 2015-02-20 
> 01:40:55Z imp $ */
> -/*++
> +/* Public Domain. */
>  
> -Copyright (c)  1999 - 2003 Intel Corporation. All rights reserved
> -This software and associated documentation (if any) is furnished
> -under a license and may only be used or copied in accordance
> -with the terms of the license. Except as permitted by such
> -license, no part of this software or documentation may be
> -reproduced, stored in a retrieval system, or transmitted in any
> -form or by any means without the express written consent of
> -Intel Corporation.
> -
> -Module Name:
> -
> -efefind.h
> -
> -Abstract:
> -
> -EFI to compile bindings
> -
> -
> -
> -
> -Revision History
> -
> ---*/
> -
> -#pragma pack()
> -
> -
> -#if defined(__FreeBSD__) || defined(__OpenBSD__)
>  #include 
> -#else
> -//
> -// Basic int types of various widths
> -//
> -
> -#if (__STDC_VERSION__ < 199901L )
> -
> -// No ANSI C 1999/2000 stdint.h integer width declarations
> -
> -#if _MSC_EXTENSIONS
> -
> -// Use Microsoft C compiler integer width declarations
> -
> -typedef unsigned __int64uint64_t;
> -typedef __int64 int64_t;
> -typedef unsigned __int32uint32_t;
> -typedef __int32 int32_t;
> -typedef unsigned short  uint16_t;
> -typedef short   int16_t;
> -typedef unsigned char   uint8_t;
> -typedef charint8_t;
> -#else
> -#ifdef UNIX_LP64
> -
> -// Use LP64 programming model from C_FLAGS for integer width 
> declarations
> -
> -typedef unsigned long   uint64_t;
> -typedef longint64_t;
> -typedef unsigned intuint32_t;
> -typedef int int32_t;
> -typedef unsigned short  uint16_t;
> -typedef short   int16_t;
> -typedef unsigned char   uint8_t;
> -typedef charint8_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 intuint32_t;
> -typedef int int32_t;
> -typedef unsigned short  uint16_t;
> -typedef short   int16_t;
> -typedef unsigned char   uint8_t;
> -typedef charint8_t;
> -#endif
> -#endif
> -#endif
> -#endif   /* __FreeBSD__ || __OpenBSD__ */
> -
> -//
> -// 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_tINT64;
> -
> -#ifndef _BASETSD_H_
> -typedef uint32_t   UINT32;
> -typedef int32_tINT32;
> -#endif
> -
> -typedef uint16_t   UINT16;
> -typedef int16_tINT16;
> -typedef uint8_tUINT8;
> -typedef int8_t INT8;
> -
> -#endif
> -
> -#undef VOID
> -#define VOIDvoid
> -
> -
> -typedef int64_tINTN;
> -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)   (0x8000 | a)
> -#define EFI_ERROR_MASK  0x8000
> -#define EFIERR_OEM(a)   (0xc000 | a)
> -
> -
> -#define BAD_POINTER 0xFBFBFBFBFBFBFBFB
> -#define MAX_ADDRESS 0x
> -
> -#define BREAKPOINT()__asm { int 3 }
> -
> -//
> -// 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 signatur

remove efibind.h cruft

2021-07-26 Thread Jonathan Gray
Follow what was done with riscv64 and replace efibind.h with just the
defines we need.

Tested on armv7 arm64 and amd64 (bootx64).

Index: sys/stand/efi/include/amd64/efibind.h
===
RCS file: /cvs/src/sys/stand/efi/include/amd64/efibind.h,v
retrieving revision 1.2
diff -u -p -r1.2 efibind.h
--- sys/stand/efi/include/amd64/efibind.h   4 Jun 2021 00:09:34 -   
1.2
+++ sys/stand/efi/include/amd64/efibind.h   26 Jul 2021 05:39:34 -
@@ -1,271 +1,22 @@
-/* $FreeBSD: head/sys/boot/efi/include/amd64/efibind.h 279038 2015-02-20 
01:40:55Z imp $ */
-/*++
+/* Public Domain. */
 
-Copyright (c)  1999 - 2003 Intel Corporation. All rights reserved
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-Module Name:
-
-efefind.h
-
-Abstract:
-
-EFI to compile bindings
-
-
-
-
-Revision History
-
---*/
-
-#pragma pack()
-
-
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
 #include 
-#else
-//
-// Basic int types of various widths
-//
-
-#if (__STDC_VERSION__ < 199901L )
-
-// No ANSI C 1999/2000 stdint.h integer width declarations
-
-#if _MSC_EXTENSIONS
-
-// Use Microsoft C compiler integer width declarations
-
-typedef unsigned __int64uint64_t;
-typedef __int64 int64_t;
-typedef unsigned __int32uint32_t;
-typedef __int32 int32_t;
-typedef unsigned short  uint16_t;
-typedef short   int16_t;
-typedef unsigned char   uint8_t;
-typedef charint8_t;
-#else
-#ifdef UNIX_LP64
-
-// Use LP64 programming model from C_FLAGS for integer width 
declarations
-
-typedef unsigned long   uint64_t;
-typedef longint64_t;
-typedef unsigned intuint32_t;
-typedef int int32_t;
-typedef unsigned short  uint16_t;
-typedef short   int16_t;
-typedef unsigned char   uint8_t;
-typedef charint8_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 intuint32_t;
-typedef int int32_t;
-typedef unsigned short  uint16_t;
-typedef short   int16_t;
-typedef unsigned char   uint8_t;
-typedef charint8_t;
-#endif
-#endif
-#endif
-#endif /* __FreeBSD__ || __OpenBSD__ */
-
-//
-// 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_tINT64;
-
-#ifndef _BASETSD_H_
-typedef uint32_t   UINT32;
-typedef int32_tINT32;
-#endif
-
-typedef uint16_t   UINT16;
-typedef int16_tINT16;
-typedef uint8_tUINT8;
-typedef int8_t INT8;
-
-#endif
-
-#undef VOID
-#define VOIDvoid
-
-
-typedef int64_tINTN;
-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)   (0x8000 | a)
-#define EFI_ERROR_MASK  0x8000
-#define EFIERR_OEM(a)   (0xc000 | a)
-
-
-#define BAD_POINTER 0xFBFBFBFBFBFBFBFB
-#define MAX_ADDRESS 0x
-
-#define BREAKPOINT()__asm { int 3 }
-
-//
-// 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))
-
-//
-// EFIAPI - prototype calling convention for EFI function pointers
-// BOOTSERVICE - prototype for i