The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=43b8edb320519c9887a5d953c4cf8a91f0ca8d14

commit 43b8edb320519c9887a5d953c4cf8a91f0ca8d14
Author:     Warner Losh <[email protected]>
AuthorDate: 2025-11-16 17:36:36 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2025-11-16 18:29:03 +0000

    stand: Cut over to using the EDK2 files
    
    Remove the old EFI SDK files that we've been nursing along for too many
    years. Replace them with files from EDK2 edk2-stable202502 and tweak the
    interfaces we need to tweak. Mostly include different things or change
    the names of the protocols that no longer have old-school compat names.
    
    I gave up in the middle of env.c, too damn tedious to find all those new
    GUIDs. Also, many of the guids were mystery meat, most likely from the
    EDK2 sources, but just not the Include subdirectory. Need to investigate
    those. And the memory info? Is it just an oboslete thing, or embedded
    knowledge of EDK2.
    
    Delete the now-redundant copies of things in Guid and Protocol. I
    debated keeping ZeroGuid.h, but EDK2 has moved on from when I snagged it
    years ago (or maybe I just invented it out of whole cloth: edk2 does
    radically different things today and I didn't do the git deep-dive to
    find out).
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D53655
---
 stand/common/gfx_fb.c                          |    3 +-
 stand/defs.mk                                  |    1 +
 stand/efi/acpica/acpi_detect.c                 |    3 +-
 stand/efi/boot1/Makefile                       |    2 +-
 stand/efi/boot1/boot1.c                        |    3 +
 stand/efi/include/Guid/MemoryTypeInformation.h |   36 -
 stand/efi/include/Guid/MtcVendor.h             |   31 -
 stand/efi/include/Guid/ZeroGuid.h              |   25 -
 stand/efi/include/Protocol/EdidActive.h        |   52 --
 stand/efi/include/Protocol/EdidDiscovered.h    |   50 -
 stand/efi/include/Protocol/EdidOverride.h      |   67 --
 stand/efi/include/Protocol/Http.h              |  522 -----------
 stand/efi/include/Protocol/Ip4Config2.h        |  323 -------
 stand/efi/include/Protocol/ServiceBinding.h    |   94 --
 stand/efi/include/efi.h                        |   69 +-
 stand/efi/include/efi_driver_utils.h           |    7 +-
 stand/efi/include/efiapi.h                     | 1195 ------------------------
 stand/efi/include/eficon.h                     |  526 -----------
 stand/efi/include/efidebug.h                   |  117 ---
 stand/efi/include/efidef.h                     |  223 -----
 stand/efi/include/efidevp.h                    |  510 ----------
 stand/efi/include/efierr.h                     |   67 --
 stand/efi/include/efifpswa.h                   |   39 -
 stand/efi/include/efifs.h                      |  122 ---
 stand/efi/include/efigop.h                     |  120 ---
 stand/efi/include/efiip.h                      |  459 ---------
 stand/efi/include/efilib.h                     |    4 +-
 stand/efi/include/efinet.h                     |  347 -------
 stand/efi/include/efipart.h                    |   68 --
 stand/efi/include/efipoint.h                   |  115 ---
 stand/efi/include/efiprot.h                    |  662 -------------
 stand/efi/include/efipxebc.h                   |  471 ----------
 stand/efi/include/efirng.h                     |   50 -
 stand/efi/include/efiser.h                     |  138 ---
 stand/efi/include/efistdarg.h                  |   38 -
 stand/efi/include/efitcp.h                     |  391 --------
 stand/efi/include/efiudp.h                     |  272 ------
 stand/efi/include/efiuga.h                     |  167 ----
 stand/efi/include/efizfs.h                     |    7 +
 stand/efi/libefi/Makefile                      |    2 +-
 stand/efi/libefi/devpath.c                     |    4 +-
 stand/efi/libefi/efi_driver_utils.c            |   11 +-
 stand/efi/libefi/eficom.c                      |    3 +-
 stand/efi/libefi/efienv.c                      |    1 +
 stand/efi/libefi/efihttp.c                     |    1 -
 stand/efi/libefi/efinet.c                      |    3 +-
 stand/efi/libefi/efipart.c                     |    3 +-
 stand/efi/libefi/env.c                         |  243 +++--
 stand/efi/loader/Makefile                      |    1 +
 stand/efi/loader/efi_main.c                    |    2 +
 stand/efi/loader/framebuffer.c                 |   11 +-
 stand/efi/loader/main.c                        |   31 +-
 52 files changed, 285 insertions(+), 7427 deletions(-)

diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c
index 3de0a8b631ee..eb41c51c50b6 100644
--- a/stand/common/gfx_fb.c
+++ b/stand/common/gfx_fb.c
@@ -98,6 +98,7 @@
 #if defined(EFI)
 #include <efi.h>
 #include <efilib.h>
+#include <Protocol/GraphicsOutput.h>
 #else
 #include <vbe.h>
 #endif
@@ -855,7 +856,7 @@ gfxfb_blt(void *BltBuffer, GFXFB_BLT_OPERATION BltOperation,
        int rv;
 #if defined(EFI)
        EFI_STATUS status;
-       EFI_GRAPHICS_OUTPUT *gop = gfx_state.tg_private;
+       EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = gfx_state.tg_private;
        EFI_TPL tpl;
 
        /*
diff --git a/stand/defs.mk b/stand/defs.mk
index eb4133b604eb..54149f5f7b9e 100644
--- a/stand/defs.mk
+++ b/stand/defs.mk
@@ -38,6 +38,7 @@ MK_UBSAN:=    no
 WARNS?=                1
 
 BOOTSRC=       ${SRCTOP}/stand
+EDK2INC=       ${SYSDIR}/contrib/edk2/Include
 EFISRC=                ${BOOTSRC}/efi
 EFIINC=                ${EFISRC}/include
 # For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is
diff --git a/stand/efi/acpica/acpi_detect.c b/stand/efi/acpica/acpi_detect.c
index 1f15a882ff9d..ca15f9d8dadc 100644
--- a/stand/efi/acpica/acpi_detect.c
+++ b/stand/efi/acpica/acpi_detect.c
@@ -27,12 +27,13 @@
 
 #include <machine/_inttypes.h>
 #include <efi.h>
+#include <Guid/Acpi.h>
 #include <acpi.h>
 #include "acpi_detect.h"
 
 /* For ACPI rsdp discovery. */
 EFI_GUID acpi = ACPI_TABLE_GUID;
-EFI_GUID acpi20 = ACPI_20_TABLE_GUID;
+EFI_GUID acpi20 = EFI_ACPI_TABLE_GUID;
 ACPI_TABLE_RSDP *rsdp;
 
 void
diff --git a/stand/efi/boot1/Makefile b/stand/efi/boot1/Makefile
index e2966e813504..c9f04546b56b 100644
--- a/stand/efi/boot1/Makefile
+++ b/stand/efi/boot1/Makefile
@@ -44,7 +44,7 @@ CFLAGS.zfs_module.c+= -include ${ZFSOSINC}/spl/sys/ccompile.h
 CFLAGS+=       -DEFI_ZFS_BOOT
 .endif
 
-CFLAGS+=       -I${EFIINC}
+CFLAGS+=       -I${EFIINC} -I${EDK2INC}
 CFLAGS+=       -I${EFIINCMD}
 CFLAGS+=       -I${SYSDIR}/contrib/dev/acpica/include
 CFLAGS+=       -DEFI_UFS_BOOT
diff --git a/stand/efi/boot1/boot1.c b/stand/efi/boot1/boot1.c
index 8228044b3be3..cad43206aa6a 100644
--- a/stand/efi/boot1/boot1.c
+++ b/stand/efi/boot1/boot1.c
@@ -296,12 +296,14 @@ efi_exit(EFI_STATUS s)
 
        BS->FreePages(heap, EFI_SIZE_TO_PAGES(heapsize));
        BS->Exit(IH, s, 0, NULL);
+       __unreachable();
 }
 
 void
 exit(int error)
 {
        efi_exit(errno_to_efi_status(error));
+       __unreachable();
 }
 
 /*
@@ -320,6 +322,7 @@ efi_panic(EFI_STATUS s, const char *fmt, ...)
        printf("\n");
 
        efi_exit(s);
+       __unreachable();
 }
 
 int getchar(void)
diff --git a/stand/efi/include/Guid/MemoryTypeInformation.h 
b/stand/efi/include/Guid/MemoryTypeInformation.h
deleted file mode 100644
index be9c4b5177a9..000000000000
--- a/stand/efi/include/Guid/MemoryTypeInformation.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/** @file
-  This file defines:
-  * Memory Type Information GUID for HOB and Variable.
-  * Memory Type Information Variable Name.
-  * Memory Type Information GUID HOB data structure.
-
-  The memory type information HOB and variable can
-  be used to store the information for each memory type in Variable or HOB.
-
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available 
under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __MEMORY_TYPE_INFORMATION_GUID_H__
-#define __MEMORY_TYPE_INFORMATION_GUID_H__
-
-#define EFI_MEMORY_TYPE_INFORMATION_GUID \
-  { 0x4c19049f,0x4137,0x4dd3, { 0x9c,0x10,0x8b,0x97,0xa8,0x3f,0xfd,0xfa } }
-
-#define EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME "MemoryTypeInformation"
-
-extern EFI_GUID gEfiMemoryTypeInformationGuid;
-
-typedef struct {
-  UINT32  Type;             ///< EFI memory type defined in UEFI specification.
-  UINT32  NumberOfPages;    ///< The pages of this type memory.
-} EFI_MEMORY_TYPE_INFORMATION;
-
-#endif
diff --git a/stand/efi/include/Guid/MtcVendor.h 
b/stand/efi/include/Guid/MtcVendor.h
deleted file mode 100644
index 3aa774f55477..000000000000
--- a/stand/efi/include/Guid/MtcVendor.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/** @file
-  GUID is for MTC variable.
-
-Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available 
under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __MTC_VENDOR_GUID_H__
-#define __MTC_VENDOR_GUID_H__
-
-//
-// Vendor GUID of the variable for the high part of monotonic counter (UINT32).
-//
-#define MTC_VENDOR_GUID \
-  { 0xeb704011, 0x1402, 0x11d3, { 0x8e, 0x77, 0x0, 0xa0, 0xc9, 0x69, 0x72, 
0x3b } }
-
-//
-// Name of the variable for the high part of monotonic counter
-//
-#define MTC_VARIABLE_NAME "MTC"
-
-extern EFI_GUID gMtcVendorGuid;
-
-#endif
diff --git a/stand/efi/include/Guid/ZeroGuid.h 
b/stand/efi/include/Guid/ZeroGuid.h
deleted file mode 100644
index 6de8c3821f5f..000000000000
--- a/stand/efi/include/Guid/ZeroGuid.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file
-  GUID has all zero values.
-
-Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available 
under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __ZERO_GUID_H__
-#define __ZERO_GUID_H__
-
-#define ZERO_GUID \
-  { \
-    0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} \
-  }
-
-extern EFI_GUID gZeroGuid;
-
-#endif
diff --git a/stand/efi/include/Protocol/EdidActive.h 
b/stand/efi/include/Protocol/EdidActive.h
deleted file mode 100644
index 1f6ff052a91c..000000000000
--- a/stand/efi/include/Protocol/EdidActive.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/** @file
-  EDID Active Protocol from the UEFI 2.0 specification.
-
-  Placed on the video output device child handle that is actively displaying 
output.
-
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-  This program and the accompanying materials
-  are licensed and made available under the terms and conditions of the BSD 
License
-  which accompanies this distribution.  The full text of the license may be 
found at
-  http://opensource.org/licenses/bsd-license.php
-
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __EDID_ACTIVE_H__
-#define __EDID_ACTIVE_H__
-
-#define EFI_EDID_ACTIVE_PROTOCOL_GUID \
-  { \
-    0xbd8c1056, 0x9f36, 0x44ec, {0x92, 0xa8, 0xa6, 0x33, 0x7f, 0x81, 0x79, 
0x86 } \
-  }
-
-///
-/// This protocol contains the EDID information for an active video output 
device. This is either the
-/// EDID information retrieved from the EFI_EDID_OVERRIDE_PROTOCOL if an 
override is
-/// available, or an identical copy of the EDID information from the
-/// EFI_EDID_DISCOVERED_PROTOCOL if no overrides are available.
-///
-typedef struct {
-  ///
-  /// The size, in bytes, of the Edid buffer. 0 if no EDID information
-  /// is available from the video output device. Otherwise, it must be a
-  /// minimum of 128 bytes.
-  ///
-  UINT32   SizeOfEdid;
-
-  ///
-  /// A pointer to a read-only array of bytes that contains the EDID
-  /// information for an active video output device. This pointer is
-  /// NULL if no EDID information is available for the video output
-  /// device. The minimum size of a valid Edid buffer is 128 bytes.
-  /// EDID information is defined in the E-EDID EEPROM
-  /// specification published by VESA (www.vesa.org).
-  ///
-  UINT8    *Edid;
-} EFI_EDID_ACTIVE_PROTOCOL;
-
-extern EFI_GUID gEfiEdidActiveProtocolGuid;
-
-#endif
diff --git a/stand/efi/include/Protocol/EdidDiscovered.h 
b/stand/efi/include/Protocol/EdidDiscovered.h
deleted file mode 100644
index c10b6ee89a82..000000000000
--- a/stand/efi/include/Protocol/EdidDiscovered.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
-  EDID Discovered Protocol from the UEFI 2.0 specification.
-
-  This protocol is placed on the video output device child handle. It 
represents
-  the EDID information being used for the output device represented by the 
child handle.
-
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-  This program and the accompanying materials
-  are licensed and made available under the terms and conditions of the BSD 
License
-  which accompanies this distribution.  The full text of the license may be 
found at
-  http://opensource.org/licenses/bsd-license.php
-
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __EDID_DISCOVERED_H__
-#define __EDID_DISCOVERED_H__
-
-#define EFI_EDID_DISCOVERED_PROTOCOL_GUID \
-  { \
-    0x1c0c34f6, 0xd380, 0x41fa, {0xa0, 0x49, 0x8a, 0xd0, 0x6c, 0x1a, 0x66, 
0xaa } \
-  }
-
-///
-/// This protocol contains the EDID information retrieved from a video output 
device.
-///
-typedef struct {
-  ///
-  /// The size, in bytes, of the Edid buffer. 0 if no EDID information
-  /// is available from the video output device. Otherwise, it must be a
-  /// minimum of 128 bytes.
-  ///
-  UINT32   SizeOfEdid;
-
-  ///
-  /// A pointer to a read-only array of bytes that contains the EDID
-  /// information for an active video output device. This pointer is
-  /// NULL if no EDID information is available for the video output
-  /// device. The minimum size of a valid Edid buffer is 128 bytes.
-  /// EDID information is defined in the E-EDID EEPROM
-  /// specification published by VESA (www.vesa.org).
-  ///
-  UINT8    *Edid;
-} EFI_EDID_DISCOVERED_PROTOCOL;
-
-extern EFI_GUID gEfiEdidDiscoveredProtocolGuid;
-
-#endif
diff --git a/stand/efi/include/Protocol/EdidOverride.h 
b/stand/efi/include/Protocol/EdidOverride.h
deleted file mode 100644
index 450c95641fce..000000000000
--- a/stand/efi/include/Protocol/EdidOverride.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/** @file
-  EDID Override Protocol from the UEFI 2.0 specification.
-
-  Allow platform to provide EDID information to the producer of the Graphics 
Output
-  protocol.
-
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-  This program and the accompanying materials
-  are licensed and made available under the terms and conditions of the BSD 
License
-  which accompanies this distribution.  The full text of the license may be 
found at
-  http://opensource.org/licenses/bsd-license.php
-
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __EDID_OVERRIDE_H__
-#define __EDID_OVERRIDE_H__
-
-#define EFI_EDID_OVERRIDE_PROTOCOL_GUID \
-  { \
-    0x48ecb431, 0xfb72, 0x45c0, {0xa9, 0x22, 0xf4, 0x58, 0xfe, 0x4, 0xb, 0xd5 
} \
-  }
-
-typedef struct _EFI_EDID_OVERRIDE_PROTOCOL EFI_EDID_OVERRIDE_PROTOCOL;
-
-#define EFI_EDID_OVERRIDE_DONT_OVERRIDE   0x01
-#define EFI_EDID_OVERRIDE_ENABLE_HOT_PLUG 0x02
-
-/**
-  Returns policy information and potentially a replacement EDID for the 
specified video output device.
-
-  @param  This              The EFI_EDID_OVERRIDE_PROTOCOL instance.
-  @param  ChildHandle       A child handle produced by the Graphics Output EFI
-                            driver that represents a video output device.
-  @param  Attributes        The attributes associated with ChildHandle video 
output device.
-  @param  EdidSize          A pointer to the size, in bytes, of the Edid 
buffer.
-  @param  Edid              A pointer to callee allocated buffer that contains 
the EDID that
-                            should be used for ChildHandle. A value of NULL
-                            represents no EDID override for ChildHandle.
-
-  @retval EFI_SUCCESS       Valid overrides returned for ChildHandle.
-  @retval EFI_UNSUPPORTED   ChildHandle has no overrides.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID)(
-  IN  EFI_EDID_OVERRIDE_PROTOCOL          *This,
-  IN  EFI_HANDLE                          *ChildHandle,
-  OUT UINT32                              *Attributes,
-  IN OUT UINTN                            *EdidSize,
-  IN OUT UINT8                            **Edid
-  );
-
-///
-/// This protocol is produced by the platform to allow the platform to provide
-/// EDID information to the producer of the Graphics Output protocol.
-///
-struct _EFI_EDID_OVERRIDE_PROTOCOL {
-  EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID   GetEdid;
-};
-
-extern EFI_GUID gEfiEdidOverrideProtocolGuid;
-
-#endif
diff --git a/stand/efi/include/Protocol/Http.h 
b/stand/efi/include/Protocol/Http.h
deleted file mode 100644
index c88cc9f78847..000000000000
--- a/stand/efi/include/Protocol/Http.h
+++ /dev/null
@@ -1,522 +0,0 @@
-/** @file
-  This file defines the EFI HTTP Protocol interface. It is split into
-  the following two main sections:
-  HTTP Service Binding Protocol (HTTPSB)
-  HTTP Protocol (HTTP)
-
-  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
-  (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP<BR>
-  This program and the accompanying materials
-  are licensed and made available under the terms and conditions of the BSD 
License
-  which accompanies this distribution. The full text of the license may be 
found at
-  http://opensource.org/licenses/bsd-license.php
-
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-  @par Revision Reference:
-  This Protocol is introduced in UEFI Specification 2.5
-
-**/
-
-#ifndef __EFI_HTTP_PROTOCOL_H__
-#define __EFI_HTTP_PROTOCOL_H__
-
-#define EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID \
-  { \
-    0xbdc8e6af, 0xd9bc, 0x4379, {0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 
0x1c } \
-  }
-
-#define EFI_HTTP_PROTOCOL_GUID \
-  { \
-    0x7a59b29b, 0x910b, 0x4171, {0x82, 0x42, 0xa8, 0x5a, 0x0d, 0xf2, 0x5b, 
0x5b } \
-  }
-
-typedef struct _EFI_HTTP_PROTOCOL EFI_HTTP_PROTOCOL;
-
-///
-/// EFI_HTTP_VERSION
-///
-typedef enum {
-  HttpVersion10,
-  HttpVersion11,
-  HttpVersionUnsupported
-} EFI_HTTP_VERSION;
-
-///
-/// EFI_HTTP_METHOD
-///
-typedef enum {
-  HttpMethodGet,
-  HttpMethodPost,
-  HttpMethodPatch,
-  HttpMethodOptions,
-  HttpMethodConnect,
-  HttpMethodHead,
-  HttpMethodPut,
-  HttpMethodDelete,
-  HttpMethodTrace,
-  HttpMethodMax
-} EFI_HTTP_METHOD;
-
-///
-/// EFI_HTTP_STATUS_CODE
-///
-typedef enum {
-  HTTP_STATUS_UNSUPPORTED_STATUS = 0,
-  HTTP_STATUS_100_CONTINUE,
-  HTTP_STATUS_101_SWITCHING_PROTOCOLS,
-  HTTP_STATUS_200_OK,
-  HTTP_STATUS_201_CREATED,
-  HTTP_STATUS_202_ACCEPTED,
-  HTTP_STATUS_203_NON_AUTHORITATIVE_INFORMATION,
-  HTTP_STATUS_204_NO_CONTENT,
-  HTTP_STATUS_205_RESET_CONTENT,
-  HTTP_STATUS_206_PARTIAL_CONTENT,
-  HTTP_STATUS_300_MULTIPLE_CHOICES,
-  HTTP_STATUS_301_MOVED_PERMANENTLY,
-  HTTP_STATUS_302_FOUND,
-  HTTP_STATUS_303_SEE_OTHER,
-  HTTP_STATUS_304_NOT_MODIFIED,
-  HTTP_STATUS_305_USE_PROXY,
-  HTTP_STATUS_307_TEMPORARY_REDIRECT,
-  HTTP_STATUS_400_BAD_REQUEST,
-  HTTP_STATUS_401_UNAUTHORIZED,
-  HTTP_STATUS_402_PAYMENT_REQUIRED,
-  HTTP_STATUS_403_FORBIDDEN,
-  HTTP_STATUS_404_NOT_FOUND,
-  HTTP_STATUS_405_METHOD_NOT_ALLOWED,
-  HTTP_STATUS_406_NOT_ACCEPTABLE,
-  HTTP_STATUS_407_PROXY_AUTHENTICATION_REQUIRED,
-  HTTP_STATUS_408_REQUEST_TIME_OUT,
-  HTTP_STATUS_409_CONFLICT,
-  HTTP_STATUS_410_GONE,
-  HTTP_STATUS_411_LENGTH_REQUIRED,
-  HTTP_STATUS_412_PRECONDITION_FAILED,
-  HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE,
-  HTTP_STATUS_414_REQUEST_URI_TOO_LARGE,
-  HTTP_STATUS_415_UNSUPPORTED_MEDIA_TYPE,
-  HTTP_STATUS_416_REQUESTED_RANGE_NOT_SATISFIED,
-  HTTP_STATUS_417_EXPECTATION_FAILED,
-  HTTP_STATUS_500_INTERNAL_SERVER_ERROR,
-  HTTP_STATUS_501_NOT_IMPLEMENTED,
-  HTTP_STATUS_502_BAD_GATEWAY,
-  HTTP_STATUS_503_SERVICE_UNAVAILABLE,
-  HTTP_STATUS_504_GATEWAY_TIME_OUT,
-  HTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED,
-  HTTP_STATUS_308_PERMANENT_REDIRECT
-} EFI_HTTP_STATUS_CODE;
-
-///
-/// EFI_HTTPv4_ACCESS_POINT
-///
-typedef struct {
-  ///
-  /// Set to TRUE to instruct the EFI HTTP instance to use the default address
-  /// information in every TCP connection made by this instance. In addition, 
when set
-  /// to TRUE, LocalAddress and LocalSubnet are ignored.
-  ///
-  BOOLEAN                       UseDefaultAddress;
-  ///
-  /// If UseDefaultAddress is set to FALSE, this defines the local IP address 
to be
-  /// used in every TCP connection opened by this instance.
-  ///
-  EFI_IPv4_ADDRESS              LocalAddress;
-  ///
-  /// If UseDefaultAddress is set to FALSE, this defines the local subnet to 
be used
-  /// in every TCP connection opened by this instance.
-  ///
-  EFI_IPv4_ADDRESS              LocalSubnet;
-  ///
-  /// This defines the local port to be used in
-  /// every TCP connection opened by this instance.
-  ///
-  UINT16                        LocalPort;
-} EFI_HTTPv4_ACCESS_POINT;
-
-///
-/// EFI_HTTPv6_ACCESS_POINT
-///
-typedef struct {
-  ///
-  /// Local IP address to be used in every TCP connection opened by this 
instance.
-  ///
-  EFI_IPv6_ADDRESS              LocalAddress;
-  ///
-  /// Local port to be used in every TCP connection opened by this instance.
-  ///
-  UINT16                        LocalPort;
-} EFI_HTTPv6_ACCESS_POINT;
-
-///
-/// EFI_HTTP_CONFIG_DATA_ACCESS_POINT
-///
-
-
-typedef struct {
-  ///
-  /// HTTP version that this instance will support.
-  ///
-  EFI_HTTP_VERSION                   HttpVersion;
-  ///
-  /// Time out (in milliseconds) when blocking for requests.
-  ///
-  UINT32                             TimeOutMillisec;
-  ///
-  /// Defines behavior of EFI DNS and TCP protocols consumed by this instance. 
If
-  /// FALSE, this instance will use EFI_DNS4_PROTOCOL and EFI_TCP4_PROTOCOL. 
If TRUE,
-  /// this instance will use EFI_DNS6_PROTOCOL and EFI_TCP6_PROTOCOL.
-  ///
-  BOOLEAN                            LocalAddressIsIPv6;
-
-  union {
-    ///
-    /// When LocalAddressIsIPv6 is FALSE, this points to the local address, 
subnet, and
-    /// port used by the underlying TCP protocol.
-    ///
-    EFI_HTTPv4_ACCESS_POINT          *IPv4Node;
-    ///
-    /// When LocalAddressIsIPv6 is TRUE, this points to the local IPv6 address 
and port
-    /// used by the underlying TCP protocol.
-    ///
-    EFI_HTTPv6_ACCESS_POINT          *IPv6Node;
-  } AccessPoint;
-} EFI_HTTP_CONFIG_DATA;
-
-///
-/// EFI_HTTP_REQUEST_DATA
-///
-typedef struct {
-  ///
-  /// The HTTP method (e.g. GET, POST) for this HTTP Request.
-  ///
-  EFI_HTTP_METHOD               Method;
-  ///
-  /// The URI of a remote host. From the information in this field, the HTTP 
instance
-  /// will be able to determine whether to use HTTP or HTTPS and will also be 
able to
-  /// determine the port number to use. If no port number is specified, port 
80 (HTTP)
-  /// is assumed. See RFC 3986 for more details on URI syntax.
-  ///
-  CHAR16                        *Url;
-} EFI_HTTP_REQUEST_DATA;
-
-///
-/// EFI_HTTP_RESPONSE_DATA
-///
-typedef struct {
-  ///
-  /// Response status code returned by the remote host.
-  ///
-  EFI_HTTP_STATUS_CODE          StatusCode;
-} EFI_HTTP_RESPONSE_DATA;
-
-///
-/// EFI_HTTP_HEADER
-///
-typedef struct {
-  ///
-  /// Null terminated string which describes a field name. See RFC 2616 
Section 14 for
-  /// detailed information about field names.
-  ///
-  CHAR8                         *FieldName;
-  ///
-  /// Null terminated string which describes the corresponding field value. 
See RFC 2616
-  /// Section 14 for detailed information about field values.
-  ///
-  CHAR8                         *FieldValue;
-} EFI_HTTP_HEADER;
-
-///
-/// EFI_HTTP_MESSAGE
-///
-typedef struct {
-  ///
-  /// HTTP message data.
-  ///
-  union {
-    ///
-    /// When the token is used to send a HTTP request, Request is a pointer to 
storage that
-    /// contains such data as URL and HTTP method.
-    ///
-    EFI_HTTP_REQUEST_DATA       *Request;
-    ///
-    /// When used to await a response, Response points to storage containing 
HTTP response
-    /// status code.
-    ///
-    EFI_HTTP_RESPONSE_DATA      *Response;
-  } Data;
-  ///
-  /// Number of HTTP header structures in Headers list. On request, this count 
is
-  /// provided by the caller. On response, this count is provided by the HTTP 
driver.
-  ///
-  UINTN                         HeaderCount;
-  ///
-  /// Array containing list of HTTP headers. On request, this array is 
populated by the
-  /// caller. On response, this array is allocated and populated by the HTTP 
driver. It
-  /// is the responsibility of the caller to free this memory on both request 
and
-  /// response.
-  ///
-  EFI_HTTP_HEADER               *Headers;
-  ///
-  /// Length in bytes of the HTTP body. This can be zero depending on the 
HttpMethod type.
-  ///
-  UINTN                         BodyLength;
-  ///
-  /// Body associated with the HTTP request or response. This can be NULL 
depending on
-  /// the HttpMethod type.
-  ///
-  VOID                          *Body;
-} EFI_HTTP_MESSAGE;
-
-
-///
-/// EFI_HTTP_TOKEN
-///
-typedef struct {
-  ///
-  /// This Event will be signaled after the Status field is updated by the EFI 
HTTP
-  /// Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL. The Task 
Priority
-  /// Level (TPL) of Event must be lower than or equal to TPL_CALLBACK.
-  ///
-  EFI_EVENT                     Event;
-  ///
-  /// Status will be set to one of the following value if the HTTP request is
-  /// successfully sent or if an unexpected error occurs:
-  ///   EFI_SUCCESS:      The HTTP request was successfully sent to the remote 
host.
-  ///   EFI_HTTP_ERROR:   The response message was successfully received but 
contains a
-  ///                     HTTP error. The response status code is returned in 
token.
-  ///   EFI_ABORTED:      The HTTP request was cancelled by the caller and 
removed from
-  ///                     the transmit queue.
-  ///   EFI_TIMEOUT:      The HTTP request timed out before reaching the 
remote host.
-  ///   EFI_DEVICE_ERROR: An unexpected system or network error occurred.
-  ///
-  EFI_STATUS                    Status;
-  ///
-  /// Pointer to storage containing HTTP message data.
-  ///
-  EFI_HTTP_MESSAGE              *Message;
-} EFI_HTTP_TOKEN;
-
-/**
-  Returns the operational parameters for the current HTTP child instance.
-
-  The GetModeData() function is used to read the current mode data (operational
-  parameters) for this HTTP protocol instance.
-
-  @param[in]  This                Pointer to EFI_HTTP_PROTOCOL instance.
-  @param[out] HttpConfigData      Point to buffer for operational parameters 
of this
-                                  HTTP instance. It is the responsibility of 
the caller
-                                  to allocate the memory for HttpConfigData and
-                                  
HttpConfigData->AccessPoint.IPv6Node/IPv4Node. In fact,
-                                  it is recommended to allocate sufficient 
memory to record
-                                  IPv6Node since it is big enough for all 
possibilities.
-
-  @retval EFI_SUCCESS             Operation succeeded.
-  @retval EFI_INVALID_PARAMETER   This is NULL.
-                                  HttpConfigData is NULL.
-                                  HttpConfigData->AccessPoint.IPv4Node or
-                                  HttpConfigData->AccessPoint.IPv6Node is NULL.
-  @retval EFI_NOT_STARTED         This EFI HTTP Protocol instance has not been 
started.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_HTTP_GET_MODE_DATA)(
-  IN  EFI_HTTP_PROTOCOL         *This,
-  OUT EFI_HTTP_CONFIG_DATA      *HttpConfigData
-  );
-
-/**
-  Initialize or brutally reset the operational parameters for this EFI HTTP 
instance.
-
-  The Configure() function does the following:
-  When HttpConfigData is not NULL Initialize this EFI HTTP instance by 
configuring
-  timeout, local address, port, etc.
-  When HttpConfigData is NULL, reset this EFI HTTP instance by closing all 
active
-  connections with remote hosts, canceling all asynchronous tokens, and flush 
request
-  and response buffers without informing the appropriate hosts.
-
-  No other EFI HTTP function can be executed by this instance until the 
Configure()
-  function is executed and returns successfully.
-
-  @param[in]  This                Pointer to EFI_HTTP_PROTOCOL instance.
-  @param[in]  HttpConfigData      Pointer to the configure data to configure 
the instance.
-
-  @retval EFI_SUCCESS             Operation succeeded.
-  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
-                                  This is NULL.
-                                  HttpConfigData->LocalAddressIsIPv6 is FALSE 
and
-                                  HttpConfigData->AccessPoint.IPv4Node is NULL.
-                                  HttpConfigData->LocalAddressIsIPv6 is TRUE 
and
-                                  HttpConfigData->AccessPoint.IPv6Node is NULL.
-  @retval EFI_ALREADY_STARTED     Reinitialize this HTTP instance without 
calling
-                                  Configure() with NULL to reset it.
-  @retval EFI_DEVICE_ERROR        An unexpected system or network error 
occurred.
-  @retval EFI_OUT_OF_RESOURCES    Could not allocate enough system resources 
when
-                                  executing Configure().
-  @retval EFI_UNSUPPORTED         One or more options in ConfigData are not 
supported
-                                  in the implementation.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_HTTP_CONFIGURE)(
-  IN  EFI_HTTP_PROTOCOL         *This,
-  IN  EFI_HTTP_CONFIG_DATA      *HttpConfigData OPTIONAL
-  );
-
-/**
-  The Request() function queues an HTTP request to this HTTP instance,
-  similar to Transmit() function in the EFI TCP driver. When the HTTP request 
is sent
-  successfully, or if there is an error, Status in token will be updated and 
Event will
-  be signaled.
-
-  @param[in]  This                Pointer to EFI_HTTP_PROTOCOL instance.
-  @param[in]  Token               Pointer to storage containing HTTP request 
token.
-
-  @retval EFI_SUCCESS             Outgoing data was processed.
-  @retval EFI_NOT_STARTED         This EFI HTTP Protocol instance has not been 
started.
-  @retval EFI_DEVICE_ERROR        An unexpected system or network error 
occurred.
-  @retval EFI_TIMEOUT             Data was dropped out of the transmit or 
receive queue.
-  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
-                                  This is NULL.
-                                  Token is NULL.
-                                  Token->Message is NULL.
-                                  Token->Message->Body is not NULL,
-                                  Token->Message->BodyLength is non-zero, and
-                                  Token->Message->Data is NULL, but a previous 
call to
-                                  Request()has not been completed successfully.
-  @retval EFI_OUT_OF_RESOURCES    Could not allocate enough system resources.
-  @retval EFI_UNSUPPORTED         The HTTP method is not supported in current 
implementation.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_HTTP_REQUEST) (
-  IN  EFI_HTTP_PROTOCOL         *This,
-  IN  EFI_HTTP_TOKEN            *Token
-  );
-
-/**
-  Abort an asynchronous HTTP request or response token.
-
-  The Cancel() function aborts a pending HTTP request or response transaction. 
If
-  Token is not NULL and the token is in transmit or receive queues when it is 
being
-  cancelled, its Token->Status will be set to EFI_ABORTED and then 
Token->Event will
-  be signaled. If the token is not in one of the queues, which usually means 
that the
-  asynchronous operation has completed, EFI_NOT_FOUND is returned. If Token is 
NULL,
-  all asynchronous tokens issued by Request() or Response() will be aborted.
-
-  @param[in]  This                Pointer to EFI_HTTP_PROTOCOL instance.
-  @param[in]  Token               Point to storage containing HTTP request or 
response
-                                  token.
-
-  @retval EFI_SUCCESS             Request and Response queues are successfully 
flushed.
-  @retval EFI_INVALID_PARAMETER   This is NULL.
-  @retval EFI_NOT_STARTED         This instance hasn't been configured.
-  @retval EFI_NOT_FOUND           The asynchronous request or response token 
is not
-                                  found.
-  @retval EFI_UNSUPPORTED         The implementation does not support this 
function.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_HTTP_CANCEL)(
-  IN  EFI_HTTP_PROTOCOL         *This,
-  IN  EFI_HTTP_TOKEN            *Token
-  );
-
-/**
-  The Response() function queues an HTTP response to this HTTP instance, 
similar to
-  Receive() function in the EFI TCP driver. When the HTTP Response is received 
successfully,
-  or if there is an error, Status in token will be updated and Event will be 
signaled.
-
-  The HTTP driver will queue a receive token to the underlying TCP instance. 
When data
-  is received in the underlying TCP instance, the data will be parsed and 
Token will
-  be populated with the response data. If the data received from the remote 
host
-  contains an incomplete or invalid HTTP header, the HTTP driver will continue 
waiting
-  (asynchronously) for more data to be sent from the remote host before 
signaling
-  Event in Token.
-
-  It is the responsibility of the caller to allocate a buffer for Body and 
specify the
-  size in BodyLength. If the remote host provides a response that contains a 
content
-  body, up to BodyLength bytes will be copied from the receive buffer into 
Body and
-  BodyLength will be updated with the amount of bytes received and copied to 
Body. This
-  allows the client to download a large file in chunks instead of into one 
contiguous
-  block of memory. Similar to HTTP request, if Body is not NULL and BodyLength 
is
-  non-zero and all other fields are NULL or 0, the HTTP driver will queue a 
receive
-  token to underlying TCP instance. If data arrives in the receive buffer, up 
to
-  BodyLength bytes of data will be copied to Body. The HTTP driver will then 
update
-  BodyLength with the amount of bytes received and copied to Body.
-
-  If the HTTP driver does not have an open underlying TCP connection with the 
host
-  specified in the response URL, Request() will return EFI_ACCESS_DENIED. This 
is
-  consistent with RFC 2616 recommendation that HTTP clients should attempt to 
maintain
-  an open TCP connection between client and host.
-
-  @param[in]  This                Pointer to EFI_HTTP_PROTOCOL instance.
-  @param[in]  Token               Pointer to storage containing HTTP response 
token.
-
-  @retval EFI_SUCCESS             Allocation succeeded.
-  @retval EFI_NOT_STARTED         This EFI HTTP Protocol instance has not been
-                                  initialized.
-  @retval EFI_INVALID_PARAMETER   One or more of the following conditions is 
TRUE:
-                                  This is NULL.
-                                  Token is NULL.
-                                  Token->Message->Headers is NULL.
-                                  Token->Message is NULL.
-                                  Token->Message->Body is not NULL,
-                                  Token->Message->BodyLength is non-zero, and
-                                  Token->Message->Data is NULL, but a previous 
call to
-                                  Response() has not been completed 
successfully.
-  @retval EFI_OUT_OF_RESOURCES    Could not allocate enough system resources.
-  @retval EFI_ACCESS_DENIED       An open TCP connection is not present with 
the host
-                                  specified by response URL.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_HTTP_RESPONSE) (
-  IN  EFI_HTTP_PROTOCOL         *This,
-  IN  EFI_HTTP_TOKEN            *Token
-  );
-
-/**
-  The Poll() function can be used by network drivers and applications to 
increase the
-  rate that data packets are moved between the communication devices and the 
transmit
-  and receive queues.
-
-  In some systems, the periodic timer event in the managed network driver may 
not poll
-  the underlying communications device fast enough to transmit and/or receive 
all data
-  packets without missing incoming packets or dropping outgoing packets. 
Drivers and
-  applications that are experiencing packet loss should try calling the Poll() 
function
-  more often.
-
-  @param[in]  This                Pointer to EFI_HTTP_PROTOCOL instance.
-
-  @retval EFI_SUCCESS             Incoming or outgoing data was processed..
-  @retval EFI_DEVICE_ERROR        An unexpected system or network error 
occurred
-  @retval EFI_INVALID_PARAMETER   This is NULL.
-  @retval EFI_NOT_READY           No incoming or outgoing data is processed.
-  @retval EFI_NOT_STARTED         This EFI HTTP Protocol instance has not been 
started.
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_HTTP_POLL) (
-  IN  EFI_HTTP_PROTOCOL         *This
-  );
-
-///
-/// The EFI HTTP protocol is designed to be used by EFI drivers and 
applications to
*** 7491 LINES SKIPPED ***

Reply via email to