]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
ShellPkg: acpiview: Make '-h' option not require a parameter
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / GenericBdsLib / InternalBdsLib.h
index cb11b6e02d42791ea6c774585d00a65b1dadeb97..131b4fabfe80d1659acde3ecb421a4970be589c8 100644 (file)
@@ -1,55 +1,49 @@
 /** @file\r
   BDS library definition, include the file and data structure\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #ifndef _INTERNAL_BDS_LIB_H_\r
 #define _INTERNAL_BDS_LIB_H_\r
 \r
-#include <PiDxe.h>\r
+#include <FrameworkDxe.h>\r
 \r
-#include <IndustryStandard/Pci22.h>\r
+#include <IndustryStandard/Pci.h>\r
+#include <IndustryStandard/PeImage.h>\r
 \r
 #include <Protocol/BlockIo.h>\r
 #include <Protocol/LoadedImage.h>\r
 #include <Protocol/Cpu.h>\r
 #include <Protocol/SimpleFileSystem.h>\r
+#include <Protocol/LoadFile.h>\r
 #include <Protocol/DebugPort.h>\r
 #include <Protocol/DevicePath.h>\r
 #include <Protocol/SimpleTextIn.h>\r
 #include <Protocol/LegacyBios.h>\r
 #include <Protocol/SimpleTextOut.h>\r
 #include <Protocol/SimpleNetwork.h>\r
-#include <Protocol/DevicePathToText.h>\r
 #include <Protocol/FirmwareVolume2.h>\r
 #include <Protocol/PciIo.h>\r
-#include <Protocol/AcpiS3Save.h>\r
-#include <Protocol/Performance.h>\r
-#include <Protocol/FirmwareVolumeDispatch.h>\r
 #include <Protocol/OEMBadging.h>\r
-#include <Protocol/ConsoleControl.h>\r
 #include <Protocol/GraphicsOutput.h>\r
 #include <Protocol/UgaDraw.h>\r
 #include <Protocol/HiiFont.h>\r
 #include <Protocol/HiiImage.h>\r
-\r
+#include <Protocol/UsbIo.h>\r
+#include <Protocol/BootLogo.h>\r
 \r
 #include <Guid/MemoryTypeInformation.h>\r
 #include <Guid/FileInfo.h>\r
 #include <Guid/GlobalVariable.h>\r
 #include <Guid/PcAnsi.h>\r
-#include <Guid/ShellFile.h>\r
-#include <Guid/GenericPlatformVariable.h>\r
-#include <Guid/Bmp.h>\r
+#include <Guid/BdsLibHii.h>\r
+#include <Guid/HdBootVariable.h>\r
+#include <Guid/LastEnumLang.h>\r
+#include <Guid/LegacyDevOrder.h>\r
+#include <Guid/StatusCodeDataTypeVariable.h>\r
 \r
 #include <Library/PrintLib.h>\r
 #include <Library/DebugLib.h>\r
@@ -64,43 +58,115 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/DevicePathLib.h>\r
 #include <Library/PerformanceLib.h>\r
 #include <Library/PcdLib.h>\r
-#include <Library/IfrSupportLib.h>\r
 #include <Library/PeCoffGetEntryPointLib.h>\r
 #include <Library/GenericBdsLib.h>\r
 #include <Library/TimerLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/DxeServicesLib.h>\r
-\r
-#define PERFORMANCE_SIGNATURE   SIGNATURE_32 ('P', 'e', 'r', 'f')\r
-#define PERF_TOKEN_SIZE         28\r
-#define PERF_TOKEN_LENGTH       (PERF_TOKEN_SIZE - 1)\r
-#define PERF_PEI_ENTRY_MAX_NUM  50\r
-\r
-typedef struct {\r
-  CHAR8   Token[PERF_TOKEN_SIZE];\r
-  UINT32  Duration;\r
-} PERF_DATA;\r
-\r
-typedef struct {\r
-  UINT64        BootToOs;\r
-  UINT64        S3Resume;\r
-  UINT32        S3EntryNum;\r
-  PERF_DATA     S3Entry[PERF_PEI_ENTRY_MAX_NUM];\r
-  UINT64        CpuFreq;\r
-  UINT64        BDSRaw;\r
-  UINT32        Count;\r
-  UINT32        Signiture;\r
-} PERF_HEADER;\r
+#include <Library/ReportStatusCodeLib.h>\r
+#include <Library/BmpSupportLib.h>\r
+\r
+#if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)\r
+    #if defined (MDE_CPU_EBC)\r
+        //\r
+        // Uefi specification only defines the default boot file name for IA32, X64\r
+        // and IPF processor, so need define boot file name for EBC architecture here.\r
+        //\r
+        #define EFI_REMOVABLE_MEDIA_FILE_NAME L"\\EFI\\BOOT\\BOOTEBC.EFI"\r
+    #else\r
+        #error "Can not determine the default boot file name for unknown processor type!"\r
+    #endif\r
+#endif\r
 \r
 /**\r
+  Get the headers (dos, image, optional header) from an image\r
+\r
+  @param  Device                SimpleFileSystem device handle\r
+  @param  FileName              File name for the image\r
+  @param  DosHeader             Pointer to dos header\r
+  @param  Hdr                   The buffer in which to return the PE32, PE32+, or TE header.\r
+\r
+  @retval EFI_SUCCESS           Successfully get the machine type.\r
+  @retval EFI_NOT_FOUND         The file is not found.\r
+  @retval EFI_LOAD_ERROR        File is not a valid image file.\r
 \r
-  Allocates a block of memory and writes performance data of booting into it.\r
-  OS can processing these record.\r
-  \r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BdsLibGetImageHeader (\r
+  IN  EFI_HANDLE                  Device,\r
+  IN  CHAR16                      *FileName,\r
+  OUT EFI_IMAGE_DOS_HEADER        *DosHeader,\r
+  OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION   Hdr\r
+  );\r
+\r
+/**\r
+  This routine adjust the memory information for different memory type and\r
+  save them into the variables for next boot.\r
 **/\r
 VOID\r
-WriteBootToOsPerformanceData (\r
+BdsSetMemoryTypeInformationVariable (\r
   VOID\r
   );\r
 \r
+/**\r
+  Validate the EFI Boot#### or Driver#### variable (VendorGuid/Name)\r
+\r
+  @param  Variable              Boot#### variable data.\r
+  @param  VariableSize          Returns the size of the EFI variable that was read\r
+\r
+  @retval TRUE                  The variable data is correct.\r
+  @retval FALSE                 The variable data is corrupted.\r
+\r
+**/\r
+BOOLEAN\r
+ValidateOption (\r
+  UINT8                     *Variable,\r
+  UINTN                     VariableSize\r
+  );\r
+\r
+/**\r
+  Set the variable and report the error through status code upon failure.\r
+\r
+  @param  VariableName           A Null-terminated string that is the name of the vendor's variable.\r
+                                 Each VariableName is unique for each VendorGuid. VariableName must\r
+                                 contain 1 or more characters. If VariableName is an empty string,\r
+                                 then EFI_INVALID_PARAMETER is returned.\r
+  @param  VendorGuid             A unique identifier for the vendor.\r
+  @param  Attributes             Attributes bitmask to set for the variable.\r
+  @param  DataSize               The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE,\r
+                                 EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or\r
+                                 EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero\r
+                                 causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is\r
+                                 set, then a SetVariable() call with a DataSize of zero will not cause any change to\r
+                                 the variable value (the timestamp associated with the variable may be updated however\r
+                                 even if no new data value is provided,see the description of the\r
+                                 EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not\r
+                                 be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).\r
+  @param  Data                   The contents for the variable.\r
+\r
+  @retval EFI_SUCCESS            The firmware has successfully stored the variable and its data as\r
+                                 defined by the Attributes.\r
+  @retval EFI_INVALID_PARAMETER  An invalid combination of attribute bits, name, and GUID was supplied, or the\r
+                                 DataSize exceeds the maximum allowed.\r
+  @retval EFI_INVALID_PARAMETER  VariableName is an empty string.\r
+  @retval EFI_OUT_OF_RESOURCES   Not enough storage is available to hold the variable and its data.\r
+  @retval EFI_DEVICE_ERROR       The variable could not be retrieved due to a hardware error.\r
+  @retval EFI_WRITE_PROTECTED    The variable in question is read-only.\r
+  @retval EFI_WRITE_PROTECTED    The variable in question cannot be deleted.\r
+  @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\r
+                                 or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo\r
+                                 does NOT pass the validation check carried out by the firmware.\r
+\r
+  @retval EFI_NOT_FOUND          The variable trying to be updated or deleted was not found.\r
+**/\r
+EFI_STATUS\r
+SetVariableAndReportStatusCodeOnError (\r
+  IN CHAR16     *VariableName,\r
+  IN EFI_GUID   *VendorGuid,\r
+  IN UINT32     Attributes,\r
+  IN UINTN      DataSize,\r
+  IN VOID       *Data\r
+  );\r
+\r
 #endif // _BDS_LIB_H_\r