Add in more library for ECP.
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 28 Jun 2007 07:12:34 +0000 (07:12 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 28 Jun 2007 07:12:34 +0000 (07:12 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2833 6f19259b-4bc3-4df7-8a09-765794883524

28 files changed:
EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/Include/MemoryStatusCodeLib.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/Include/SimpleCpuIoLib.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/MemoryStatusCode/MemoryStatusCode.c [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/MemoryStatusCode/MemoryStatusCode.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/MemoryStatusCode/MemoryStatusCode.inf [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsDataHubStatusCode/BsDataHubStatusCode.c [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsDataHubStatusCode/BsDataHubStatusCode.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsDataHubStatusCode/BsDataHubStatusCode.inf [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsSerialStatusCode/BsSerialStatusCode.c [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsSerialStatusCode/BsSerialStatusCode.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsSerialStatusCode/BsSerialStatusCode.inf [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/BsDataHubStatusCodeLib.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/BsSerialStatusCodeLib.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtLedStatusCodeLib.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtMemoryStatusCodeLib.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtPlatformStatusCodeLib.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtPort80StatusCodeLib.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.c [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.inf [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtMemoryStatusCode/RtMemoryStatusCode.c [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtMemoryStatusCode/RtMemoryStatusCode.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtMemoryStatusCode/RtMemoryStatusCode.inf [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPlatformStatusCode/Nt32/RtPlatformStatusCode.c [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPlatformStatusCode/Nt32/RtPlatformStatusCode.inf [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPort80StatusCode/RtPort80StatusCode.c [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPort80StatusCode/RtPort80StatusCode.h [new file with mode: 0644]
EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPort80StatusCode/RtPort80StatusCode.inf [new file with mode: 0644]

diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/Include/MemoryStatusCodeLib.h b/EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/Include/MemoryStatusCodeLib.h
new file mode 100644 (file)
index 0000000..b2ed83b
--- /dev/null
@@ -0,0 +1,60 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2005, Intel Corporation                                                         \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
+\r
+Module Name:\r
+\r
+  MemoryStatusCodeLib.h\r
+\r
+Abstract:\r
+\r
+  Lib to provide memory status code reporting.\r
+\r
+--*/\r
+\r
+#ifndef _PEI_MEMORY_STATUS_CODE_LIB_H_\r
+#define _PEI_MEMORY_STATUS_CODE_LIB_H_\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include "Tiano.h"\r
+#include "Pei.h"\r
+\r
+//\r
+// Publicly exported data\r
+//\r
+extern BOOLEAN  mRunningFromMemory;\r
+\r
+//\r
+// Initialization function\r
+//\r
+VOID\r
+MemoryInitializeStatusCode (\r
+  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r
+  IN EFI_PEI_SERVICES          **PeiServices\r
+  )\r
+;\r
+\r
+//\r
+// Status code reporting function\r
+//\r
+EFI_STATUS\r
+MemoryReportStatusCode (\r
+  IN EFI_PEI_SERVICES         **PeiServices,\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+;\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/Include/SimpleCpuIoLib.h b/EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/Include/SimpleCpuIoLib.h
new file mode 100644 (file)
index 0000000..ca666de
--- /dev/null
@@ -0,0 +1,93 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2007, Intel Corporation                                                         \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
+\r
+Module Name:\r
+\r
+  SimpleCpuIoLib.h\r
+\r
+Abstract:\r
+\r
+  Light weight monolithic Cpu Io Lib to support PEI Modules.\r
+\r
+--*/\r
+\r
+#ifndef _PEI_SIMPLE_CPU_IO_LIB_H_\r
+#define _PEI_SIMPLE_CPU_IO_LIB_H_\r
+\r
+//\r
+//  Base IO Class Functions\r
+//\r
+UINT8\r
+IoRead8 (\r
+  IN  UINT64  Address\r
+  )\r
+;\r
+\r
+UINT16\r
+IoRead16 (\r
+  IN  UINT64  Address\r
+  )\r
+;\r
+\r
+UINT32\r
+IoRead32 (\r
+  IN  UINT64  Address\r
+  )\r
+;\r
+\r
+VOID\r
+IoWrite8 (\r
+  IN  UINT64  Address,\r
+  IN  UINT8   Data\r
+  )\r
+;\r
+\r
+VOID\r
+IoWrite16 (\r
+  IN  UINT64  Address,\r
+  IN  UINT16  Data\r
+  )\r
+;\r
+\r
+VOID\r
+IoWrite32 (\r
+  IN  UINT64  Address,\r
+  IN  UINT32  Data\r
+  )\r
+;\r
+\r
+UINT32\r
+MemRead32 (\r
+  IN  UINT64  Address\r
+  )\r
+;\r
+\r
+UINT64\r
+MemRead64 (\r
+  IN  UINT64  Address\r
+  )\r
+;\r
+\r
+VOID\r
+MemWrite32 (\r
+  IN  UINT64  Address,\r
+  IN  UINT32  Data\r
+  )\r
+;\r
+\r
+VOID\r
+MemWrite64 (\r
+  IN  UINT64  Address,\r
+  IN  UINT64  Data\r
+  )\r
+;\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/MemoryStatusCode/MemoryStatusCode.c b/EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/MemoryStatusCode/MemoryStatusCode.c
new file mode 100644 (file)
index 0000000..be82428
--- /dev/null
@@ -0,0 +1,521 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2006, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  MemoryStatusCode.c\r
+   \r
+Abstract:\r
+\r
+  Lib to provide memory journal status code reporting Routines.\r
+\r
+--*/\r
+\r
+#include "MemoryStatusCode.h"\r
+#include "PeiLib.h"\r
+#include "MonoStatusCode.h"\r
+\r
+//\r
+// Global variable.  Not accessible while running from flash.\r
+// After we relocate ourselves into memory, we update this\r
+// and use it to determine if we are running from flash or memory.\r
+//\r
+BOOLEAN                       mRunningFromMemory = FALSE;\r
+\r
+//\r
+// Global variable used to replace the PPI once we start running from memory.\r
+//\r
+PEI_STATUS_CODE_MEMORY_PPI    mStatusCodeMemoryPpi = { 0, 0, 0, 0 };\r
+\r
+//\r
+// PPI descriptor for the MonoStatusCode PEIM, see MonoStatusCode.c\r
+//\r
+extern EFI_PEI_PPI_DESCRIPTOR mPpiListStatusCode;\r
+\r
+VOID\r
+EFIAPI\r
+MemoryInitializeStatusCode (\r
+  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r
+  IN EFI_PEI_SERVICES          **PeiServices\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Initialization routine.\r
+  Allocates heap space for storing Status Codes.\r
+  Installs a PPI to point to that heap space.\r
+  Installs a callback to switch to memory.\r
+  Installs a callback to \r
+\r
+Arguments: \r
+\r
+  FfsHeader   - FV this PEIM was loaded from.\r
+  PeiServices - General purpose services available to every PEIM.\r
+\r
+Returns: \r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                  Status;\r
+  MEMORY_STATUS_CODE_INSTANCE *PrivateData;\r
+  PEI_STATUS_CODE_MEMORY_PPI  *StatusCodeMemoryPpi;\r
+  PEI_STATUS_CODE_PPI         *ReportStatusCodePpi;\r
+  EFI_PHYSICAL_ADDRESS        Buffer;\r
+  VOID                        *StartPointer;\r
+  UINTN                       Length;\r
+  UINTN                       LastEntry;\r
+  EFI_PEI_PPI_DESCRIPTOR      *ReportStatusCodeDescriptor;\r
+  EFI_PEI_PPI_DESCRIPTOR      *StatusCodeMemoryDescriptor;\r
+\r
+  //\r
+  // Determine if we are being called after relocation into memory.\r
+  //\r
+  if (!mRunningFromMemory) {\r
+    //\r
+    // If we are not running from memory, we need to allocate some heap and\r
+    // install the PPI\r
+    //\r
+    //\r
+    // Allocate heap storage for the journal\r
+    //\r
+    Status = (*PeiServices)->AllocatePool (\r
+                              PeiServices,\r
+                              PEI_STATUS_CODE_HEAP_LENGTH,\r
+                              &StartPointer\r
+                              );\r
+\r
+    //\r
+    // This is not a required feature to boot.\r
+    //\r
+    if (EFI_ERROR (Status)) {\r
+      return ;\r
+    }\r
+    //\r
+    // Allocate heap storage for private data\r
+    // The private data contains the FFS header for this PEIM,\r
+    // a PPI containing information about the status code journal, and\r
+    // a notification for the LoadFile service, to relocate the PEIM into\r
+    // memory.\r
+    //\r
+    Status = (*PeiServices)->AllocatePool (\r
+                              PeiServices,\r
+                              sizeof (MEMORY_STATUS_CODE_INSTANCE),\r
+                              &PrivateData\r
+                              );\r
+\r
+    //\r
+    // This is not a required feature to boot.\r
+    //\r
+    if (EFI_ERROR (Status)) {\r
+      return ;\r
+    }\r
+    //\r
+    // Update the contents of the private data.\r
+    //\r
+    PrivateData->Signature                      = MEMORY_STATUS_CODE_SIGNATURE;\r
+    PrivateData->This = PrivateData;\r
+    PrivateData->FfsHeader = FfsHeader;\r
+    PrivateData->PpiDescriptor.Flags = (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);\r
+    PrivateData->PpiDescriptor.Guid = &gPeiStatusCodeMemoryPpiGuid;\r
+    PrivateData->PpiDescriptor.Ppi = &PrivateData->StatusCodeMemoryPpi;\r
+    PrivateData->StatusCodeMemoryPpi.FirstEntry = 0;\r
+    PrivateData->StatusCodeMemoryPpi.LastEntry = 0;\r
+    PrivateData->StatusCodeMemoryPpi.Address = (EFI_PHYSICAL_ADDRESS) (UINTN) StartPointer;\r
+    PrivateData->StatusCodeMemoryPpi.Length = PEI_STATUS_CODE_HEAP_LENGTH;\r
+#if (PI_SPECIFICATION_VERSION < 0x00010000)\r
+    PrivateData->NotifyDescriptor.Flags =\r
+      (\r
+        EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK |\r
+        EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST\r
+      );\r
+    PrivateData->NotifyDescriptor.Guid    = &gPeiFvFileLoaderPpiGuid;\r
+    PrivateData->NotifyDescriptor.Notify  = LoadImageCallback;\r
+#endif\r
+    //\r
+    // Publish the PPI\r
+    //\r
+    Status = (*PeiServices)->InstallPpi (PeiServices, &PrivateData->PpiDescriptor);\r
+    if (EFI_ERROR (Status)) {\r
+      return ;\r
+    }\r
+    //\r
+    // Post a callback to relocate to memory\r
+    //\r
+#if (PI_SPECIFICATION_VERSION < 0x00010000)\r
+    Status = (**PeiServices).NotifyPpi (PeiServices, &PrivateData->NotifyDescriptor);\r
+    if (EFI_ERROR (Status)) {\r
+      return ;\r
+    }\r
+#endif\r
+  } else {\r
+    //\r
+    // If we are running from memory, we need to copy from the heap to a RT\r
+    // memory buffer.\r
+    //\r
+    //\r
+    // Locate Journal\r
+    //\r
+    Status = (*PeiServices)->LocatePpi (\r
+                              PeiServices,\r
+                              &gPeiStatusCodeMemoryPpiGuid,\r
+                              0,\r
+                              &StatusCodeMemoryDescriptor,\r
+                              &StatusCodeMemoryPpi\r
+                              );\r
+    if (EFI_ERROR (Status)) {\r
+      return ;\r
+    }\r
+    //\r
+    // Get private data\r
+    //\r
+    PrivateData = MEMORY_STATUS_CODE_FROM_DESCRIPTOR_THIS (StatusCodeMemoryDescriptor);\r
+\r
+    //\r
+    // At this point, we need to fix up any addresses that we have as the heap\r
+    // has moved.\r
+    //\r
+    PrivateData->PpiDescriptor.Ppi  = &PrivateData->StatusCodeMemoryPpi;\r
+    PrivateData->PpiDescriptor.Guid = &gPeiStatusCodeMemoryPpiGuid;\r
+    PrivateData->StatusCodeMemoryPpi.Address = PrivateData->StatusCodeMemoryPpi.Address +\r
+      (UINTN) PrivateData - (UINTN) PrivateData->This;\r
+    PrivateData->This                     = PrivateData;\r
+#if (PI_SPECIFICATION_VERSION < 0x00010000)\r
+    PrivateData->NotifyDescriptor.Guid    = &gPeiFvFileLoaderPpiGuid;\r
+    PrivateData->NotifyDescriptor.Notify  = LoadImageCallback;\r
+#endif\r
+\r
+    //\r
+    // Allocate RT memory.\r
+    //\r
+    Status = (*PeiServices)->AllocatePages (\r
+                              PeiServices,\r
+                              EfiRuntimeServicesData,\r
+                              PEI_STATUS_CODE_RT_PAGES,\r
+                              &Buffer\r
+                              );\r
+    if (EFI_ERROR (Status)) {\r
+      return ;\r
+    }\r
+\r
+    DEBUG_CODE (\r
+      EfiCommonLibZeroMem ((VOID *) (UINTN) Buffer, PEI_STATUS_CODE_RT_LENGTH);\r
+    )\r
+    //\r
+    // Copy the heap to the allocated memory.\r
+    // Unwind the rolling queue to start at 0 in the new space.  We need to do\r
+    // this because the new queue is much bigger than the heap allocation.\r
+    //\r
+    if (PEI_STATUS_CODE_RT_LENGTH <= PEI_STATUS_CODE_HEAP_LENGTH) {\r
+      return ;\r
+    }\r
+\r
+    if (StatusCodeMemoryPpi->LastEntry >= StatusCodeMemoryPpi->FirstEntry) {\r
+      LastEntry = StatusCodeMemoryPpi->LastEntry - StatusCodeMemoryPpi->FirstEntry;\r
+      StartPointer = (VOID *) ((UINTN) StatusCodeMemoryPpi->Address + (StatusCodeMemoryPpi->FirstEntry * sizeof (EFI_STATUS_CODE_ENTRY)));\r
+      Length = (StatusCodeMemoryPpi->LastEntry - StatusCodeMemoryPpi->FirstEntry) * sizeof (EFI_STATUS_CODE_ENTRY);\r
+      (*PeiServices)->CopyMem ((VOID *) (UINTN) Buffer, StartPointer, Length);\r
+    } else {\r
+      //\r
+      // The last entry will be the new last entry after moving heap to buffer\r
+      //\r
+      LastEntry = (PEI_STATUS_CODE_MAX_HEAP_ENTRY - StatusCodeMemoryPpi->FirstEntry) + StatusCodeMemoryPpi->LastEntry;\r
+      //\r
+      // Copy from the first entry to the end of the heap\r
+      //\r
+      StartPointer = (VOID *) ((UINTN) StatusCodeMemoryPpi->Address + (StatusCodeMemoryPpi->FirstEntry * sizeof (EFI_STATUS_CODE_ENTRY)));\r
+      Length = PEI_STATUS_CODE_HEAP_LENGTH - (StatusCodeMemoryPpi->FirstEntry * sizeof (EFI_STATUS_CODE_ENTRY));\r
+      (*PeiServices)->CopyMem ((VOID *) (UINTN) Buffer, StartPointer, Length);\r
+      //\r
+      // Copy from the start to the heap to the last entry\r
+      //\r
+      StartPointer = (VOID *) (UINTN) StatusCodeMemoryPpi->Address;\r
+      (*PeiServices)->CopyMem (\r
+                        (VOID *) (UINTN) (Buffer + Length),\r
+                        StartPointer,\r
+                        (StatusCodeMemoryPpi->LastEntry * sizeof (EFI_STATUS_CODE_ENTRY))\r
+                        );\r
+    };\r
+\r
+    //\r
+    // Update the PPI to NULL, so it will not be used.\r
+    //\r
+    StatusCodeMemoryPpi->FirstEntry = 0;\r
+    StatusCodeMemoryPpi->LastEntry  = 0;\r
+    StatusCodeMemoryPpi->Address    = 0;\r
+    StatusCodeMemoryPpi->Length     = 0;\r
+\r
+    //\r
+    // Update in memory version of PPI that will be used.\r
+    //\r
+    mStatusCodeMemoryPpi.FirstEntry = 0;\r
+    mStatusCodeMemoryPpi.LastEntry  = LastEntry;\r
+    mStatusCodeMemoryPpi.Address    = (EFI_PHYSICAL_ADDRESS) (UINTN) Buffer;\r
+    mStatusCodeMemoryPpi.Length     = PEI_STATUS_CODE_RT_LENGTH;\r
+\r
+    //\r
+    // Reinstall the report status code function\r
+    //\r
+    //\r
+    // Locate status code PPI\r
+    //\r
+    Status = (*PeiServices)->LocatePpi (\r
+                              PeiServices,\r
+                              &gPeiStatusCodePpiGuid,\r
+                              0,\r
+                              &ReportStatusCodeDescriptor,\r
+                              &ReportStatusCodePpi\r
+                              );\r
+    if (EFI_ERROR (Status)) {\r
+      return ;\r
+    }\r
+    //\r
+    // Reinstall the ReportStatusCode interface using the memory-based\r
+    // descriptor\r
+    //\r
+    Status = (*PeiServices)->ReInstallPpi (\r
+                              PeiServices,\r
+                              ReportStatusCodeDescriptor,\r
+                              &mPpiListStatusCode\r
+                              );\r
+    if (EFI_ERROR (Status)) {\r
+      EFI_BREAKPOINT ();\r
+      return ;\r
+    }\r
+    //\r
+    // Publish a GUIDed HOB that contains a pointer to the status code PPI\r
+    // structure.  This is a bit of a short cut as I just used the PPI GUID to\r
+    // identify the HOB.  This HOB is caught by the DXE status code memory\r
+    // listener and used to find the journal.\r
+    //\r
+    StatusCodeMemoryPpi = &mStatusCodeMemoryPpi;\r
+    Status = PeiBuildHobGuidData (\r
+              PeiServices,\r
+              &gPeiStatusCodeMemoryPpiGuid,\r
+              &StatusCodeMemoryPpi,\r
+              sizeof (VOID *)\r
+              );\r
+    if (EFI_ERROR (Status)) {\r
+      EFI_BREAKPOINT ();\r
+      return ;\r
+    }\r
+  }\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+MemoryReportStatusCode (\r
+  IN EFI_PEI_SERVICES         **PeiServices,\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId ,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Provide a memory status code\r
+\r
+Arguments:\r
+\r
+  Same as ReportStatusCode PPI\r
+    \r
+Returns:\r
+\r
+  EFI_SUCCESS   This function always returns success\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                  Status;\r
+  PEI_STATUS_CODE_MEMORY_PPI  *StatusCodeMemoryPpi;\r
+  EFI_STATUS_CODE_ENTRY       *CurrentEntry;\r
+  UINTN                       LastEntry;\r
+  MEMORY_STATUS_CODE_INSTANCE *PrivateData;\r
+  EFI_PEI_PPI_DESCRIPTOR      *StatusCodeMemoryDescriptor;\r
+\r
+  //\r
+  // We don't care to log debug codes.\r
+  //\r
+  if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
+  if (!mRunningFromMemory) {\r
+    //\r
+    // If we are called from DXE and have not been reinstalled into memory, we\r
+    // can no longer locate the journal, so we can no longer log status codes.\r
+    //\r
+    if (!PeiServices) {\r
+      return EFI_SUCCESS;\r
+    }\r
+    //\r
+    // Locate Journal\r
+    //\r
+    Status = (*PeiServices)->LocatePpi (\r
+                              PeiServices,\r
+                              &gPeiStatusCodeMemoryPpiGuid,\r
+                              0,\r
+                              &StatusCodeMemoryDescriptor,\r
+                              &StatusCodeMemoryPpi\r
+                              );\r
+    if (EFI_ERROR (Status)) {\r
+      return EFI_SUCCESS;\r
+    }\r
+    //\r
+    // Determine the last entry in the journal.\r
+    // This is needed to properly implement the rolling queue.\r
+    //\r
+    LastEntry = PEI_STATUS_CODE_MAX_HEAP_ENTRY;\r
+\r
+    //\r
+    // Get private data\r
+    //\r
+    PrivateData = MEMORY_STATUS_CODE_FROM_DESCRIPTOR_THIS (StatusCodeMemoryDescriptor);\r
+\r
+    //\r
+    // Once memory gets installed, heap gets moved to real memory.\r
+    // We need to fix up the pointers to match the move.\r
+    //\r
+    PrivateData->PpiDescriptor.Ppi  = &PrivateData->StatusCodeMemoryPpi;\r
+    PrivateData->PpiDescriptor.Guid = &gPeiStatusCodeMemoryPpiGuid;\r
+    PrivateData->StatusCodeMemoryPpi.Address = PrivateData->StatusCodeMemoryPpi.Address +\r
+      (UINTN) PrivateData - (UINTN) PrivateData->This;\r
+    PrivateData->This                     = PrivateData;\r
+#if (PI_SPECIFICATION_VERSION < 0x00010000)\r
+    PrivateData->NotifyDescriptor.Guid    = &gPeiFvFileLoaderPpiGuid;\r
+    PrivateData->NotifyDescriptor.Notify  = LoadImageCallback;\r
+#endif\r
+    StatusCodeMemoryPpi                   = PrivateData->PpiDescriptor.Ppi;\r
+  } else {\r
+    //\r
+    // Use global/memory copy of the PPI\r
+    //\r
+    StatusCodeMemoryPpi = &mStatusCodeMemoryPpi;\r
+\r
+    //\r
+    // Determine the last entry in the journal.\r
+    // This is needed to properly implement the rolling queue.\r
+    //\r
+    LastEntry = PEI_STATUS_CODE_MAX_RT_ENTRY;\r
+  }\r
+  //\r
+  // Return if we are using a cleared PPI somehow\r
+  //\r
+  if (!StatusCodeMemoryPpi->Address || !StatusCodeMemoryPpi->Length) {\r
+    return EFI_SUCCESS;\r
+  }\r
+  //\r
+  // Update the latest entry in the journal (may actually be first due to rolling\r
+  // queue).\r
+  //\r
+  CurrentEntry = (EFI_STATUS_CODE_ENTRY *) (UINTN) (StatusCodeMemoryPpi->Address + (StatusCodeMemoryPpi->LastEntry * sizeof (EFI_STATUS_CODE_ENTRY)));\r
+\r
+  StatusCodeMemoryPpi->LastEntry = (StatusCodeMemoryPpi->LastEntry + 1) % LastEntry;\r
+  if (StatusCodeMemoryPpi->LastEntry == StatusCodeMemoryPpi->FirstEntry) {\r
+    StatusCodeMemoryPpi->FirstEntry = (StatusCodeMemoryPpi->FirstEntry + 1) % LastEntry;\r
+  }\r
+\r
+  CurrentEntry->Type      = CodeType;\r
+  CurrentEntry->Value     = Value;\r
+  CurrentEntry->Instance  = Instance;\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r
+#if (PI_SPECIFICATION_VERSION < 0x00010000)\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+LoadImageCallback (\r
+  IN EFI_PEI_SERVICES           **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,\r
+  IN VOID                       *Ppi\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Relocate the PEIM into memory.\r
+\r
+  Once load protocol becomes available, relocate our PEIM into memory.\r
+  The primary benefit is to eliminate the blackout window that we would have in\r
+  the memory log between the end of PEI and the status code DXE driver taking\r
+  control.  If we don't do this, we cannot determine where our memory journal\r
+  is located and cannot function.\r
+\r
+  A second benefit is speed optimization throughout DXE.\r
+\r
+Arguments:\r
+\r
+  PeiServices      - General purpose services available to every PEIM.\r
+  NotifyDescriptor - Information about the notify event.\r
+  Ppi              - Context\r
+    \r
+Returns:\r
+\r
+  EFI_SUCCESS   This function always returns success.\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                  Status;\r
+  EFI_PHYSICAL_ADDRESS        ImageAddress;\r
+  EFI_PHYSICAL_ADDRESS        EntryPoint;\r
+  UINT64                      ImageSize;\r
+  MEMORY_STATUS_CODE_INSTANCE *PrivateData;\r
+\r
+  //\r
+  // Relocate to memory\r
+  //\r
+  if (!mRunningFromMemory) {\r
+    //\r
+    // Use the callback descriptor to get the FfsHeader\r
+    //\r
+    PrivateData = MEMORY_STATUS_CODE_FROM_NOTIFY_THIS (NotifyDescriptor);\r
+\r
+    Status = ((EFI_PEI_FV_FILE_LOADER_PPI *) Ppi)->FvLoadFile (\r
+                                                    Ppi,\r
+                                                    PrivateData->FfsHeader,\r
+                                                    &ImageAddress,\r
+                                                    &ImageSize,\r
+                                                    &EntryPoint\r
+                                                    );\r
+    if (EFI_ERROR (Status)) {\r
+      return EFI_SUCCESS;\r
+    }\r
+    //\r
+    // Set the flag in the loaded image that indicates the PEIM is executing\r
+    // from memory.\r
+    //\r
+#ifdef EFI_NT_EMULATOR\r
+    //\r
+    // For NT32, we should also relocate image here, because if the DLL\r
+    // is already load, we will NOT load it twice. This feature is added to\r
+    // prevent loading driver twice in DXE phase cause system crash.\r
+    //\r
+    * (BOOLEAN *) ((UINTN) &mRunningFromMemory + (UINTN) EntryPoint - (UINTN) InstallMonoStatusCode) = TRUE;\r
+#else\r
+    * (BOOLEAN *) ((UINTN) &mRunningFromMemory + (UINTN) EntryPoint - (UINTN) InstallMonoStatusCode) = TRUE;\r
+#endif\r
+    Status = ((EFI_PEIM_ENTRY_POINT )(UINTN) EntryPoint) (PrivateData->FfsHeader, PeiServices);\r
+    if (EFI_ERROR (Status)) {\r
+      return EFI_SUCCESS;\r
+    }\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+#endif\r
+\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/MemoryStatusCode/MemoryStatusCode.h b/EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/MemoryStatusCode/MemoryStatusCode.h
new file mode 100644 (file)
index 0000000..b6660b0
--- /dev/null
@@ -0,0 +1,103 @@
+/*++\r
+\r
+Copyright (c) 2004, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  MemoryStatusCode.h\r
+   \r
+Abstract:\r
+\r
+  Lib to provide status code reporting via memory.\r
+\r
+--*/\r
+\r
+#ifndef _PEI_MEMORY_STATUS_CODE_H_\r
+#define _PEI_MEMORY_STATUS_CODE_H_\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include "Tiano.h"\r
+#include "Pei.h"\r
+#include "SimpleCpuIoLib.h"\r
+#include "EfiCommonLib.h"\r
+\r
+//\r
+// Produced PPI\r
+//\r
+#include EFI_PPI_PRODUCER (StatusCodeMemory)\r
+#include EFI_PPI_PRODUCER (StatusCode)\r
+\r
+//\r
+// Ppi Consumed For Notification\r
+//\r
+#include EFI_PPI_CONSUMER (MemoryDiscovered)\r
+#if (PI_SPECIFICATION_VERSION < 0x00010000)\r
+#include EFI_PPI_CONSUMER (LoadFile)\r
+#endif\r
+//\r
+// Private data\r
+//\r
+//\r
+// Define the amount of heap to use before memory is allocated\r
+//\r
+#define PEI_STATUS_CODE_HEAP_LENGTH     512\r
+#define PEI_STATUS_CODE_MAX_HEAP_ENTRY  (PEI_STATUS_CODE_HEAP_LENGTH / sizeof (EFI_STATUS_CODE_ENTRY))\r
+\r
+//\r
+// Define the number of 4K pages of BS memory to allocate (1MB)\r
+//\r
+#define PEI_STATUS_CODE_RT_PAGES      (128)\r
+#define PEI_STATUS_CODE_RT_LENGTH     (PEI_STATUS_CODE_RT_PAGES * 1024 * 4)\r
+#define PEI_STATUS_CODE_MAX_RT_ENTRY  (PEI_STATUS_CODE_RT_LENGTH / sizeof (EFI_STATUS_CODE_ENTRY))\r
+\r
+//\r
+// Define a private data structure\r
+//\r
+#define MEMORY_STATUS_CODE_SIGNATURE  EFI_SIGNATURE_32 ('M', 'S', 'C', 'S')\r
+\r
+typedef struct _MEMORY_STATUS_CODE_INSTANCE {\r
+  UINT32                              Signature;\r
+  struct _MEMORY_STATUS_CODE_INSTANCE *This;\r
+  EFI_FFS_FILE_HEADER                 *FfsHeader;\r
+  EFI_PEI_PPI_DESCRIPTOR              PpiDescriptor;\r
+  PEI_STATUS_CODE_MEMORY_PPI          StatusCodeMemoryPpi;\r
+#if (PI_SPECIFICATION_VERSION < 0x00010000)\r
+  EFI_PEI_NOTIFY_DESCRIPTOR           NotifyDescriptor;\r
+#endif\r
+} MEMORY_STATUS_CODE_INSTANCE;\r
+\r
+#define MEMORY_STATUS_CODE_FROM_DESCRIPTOR_THIS(a) \\r
+  PEI_CR (a, \\r
+          MEMORY_STATUS_CODE_INSTANCE, \\r
+          PpiDescriptor, \\r
+          MEMORY_STATUS_CODE_SIGNATURE \\r
+      )\r
+#define MEMORY_STATUS_CODE_FROM_NOTIFY_THIS(a) \\r
+  PEI_CR (a, \\r
+          MEMORY_STATUS_CODE_INSTANCE, \\r
+          NotifyDescriptor, \\r
+          MEMORY_STATUS_CODE_SIGNATURE \\r
+      )\r
+\r
+//\r
+// Private function declarations\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+LoadImageCallback (\r
+  IN EFI_PEI_SERVICES           **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,\r
+  IN VOID                       *Ppi\r
+  )\r
+;\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/MemoryStatusCode/MemoryStatusCode.inf b/EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/MemoryStatusCode/MemoryStatusCode.inf
new file mode 100644 (file)
index 0000000..2db56d6
--- /dev/null
@@ -0,0 +1,50 @@
+#/*++\r
+#\r
+# Copyright (c) 2004, Intel Corporation                                                         \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
+# \r
+#  Module Name:\r
+#\r
+#    MemoryStatusCode.inf\r
+#\r
+#  Abstract:\r
+#\r
+#    Library producing a memory status code functionality.\r
+#\r
+#--*/\r
+\r
+[defines]\r
+BASE_NAME            = MemoryStatusCodeLib\r
+COMPONENT_TYPE       = LIBRARY\r
+\r
+[sources.common]\r
+  MemoryStatusCode.c\r
+  MemoryStatusCode.h\r
+\r
+[includes.common]\r
+  $(EDK_SOURCE)\Foundation\r
+  $(EDK_SOURCE)\Foundation\Framework\r
+  $(EDK_SOURCE)\Foundation\Efi\r
+  .\r
+  $(EDK_SOURCE)\Foundation\Include\r
+  $(EDK_SOURCE)\Foundation\Efi\Include\r
+  $(EDK_SOURCE)\Foundation\Framework\Include\r
+  $(EDK_SOURCE)\Foundation\Include\IndustryStandard\r
+  $(EDK_SOURCE)\Foundation\Core\Dxe\r
+  $(EDK_SOURCE)\Foundation\Library\Dxe\Include\r
+  $(EDK_SOURCE)\Foundation\Include\Pei\r
+  $(EDK_SOURCE)\Foundation\Library\Pei\Include\r
+  $(EDK_SOURCE)\Sample\Platform\Generic\MonoStatusCode\Pei\r
+  $(EDK_SOURCE)\Sample\Platform\Generic\MonoStatusCode\Library\Pei\Include\r
+\r
+[libraries.platform]\r
+  EdkPpiLib\r
+  EdkFrameworkPpiLib\r
+\r
+[nmake.common]\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsDataHubStatusCode/BsDataHubStatusCode.c b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsDataHubStatusCode/BsDataHubStatusCode.c
new file mode 100644 (file)
index 0000000..e950126
--- /dev/null
@@ -0,0 +1,491 @@
+/*++\r
+\r
+Copyright (c)  2004 - 2006, Intel Corporation                                                         \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
+\r
+Module Name:\r
+\r
+  BsDataHubStatusCode.c\r
+\r
+Abstract:\r
+\r
+  This implements a status code listener that logs status codes into the data\r
+  hub.  This is only active during non-runtime DXE.\r
+  The status codes are recorded in a extensiable buffer, and a event is signalled \r
+  to log them to the data hub. The recorder is the producer of the status code in\r
+  buffer and the event notify function the consummer.\r
+\r
+--*/\r
+\r
+#include "BsDataHubStatusCode.h"\r
+\r
+//\r
+// Globals only work at BootService Time. NOT at Runtime!\r
+//\r
+static EFI_DATA_HUB_PROTOCOL  *mDataHub;\r
+static EFI_LIST_ENTRY         *mRecordHead;\r
+static EFI_LIST_ENTRY         *mRecordTail;\r
+static INTN                   mRecordNum = 0;\r
+static EFI_EVENT              mLogDataHubEvent;\r
+static EFI_LOCK               mStatusCodeReportLock = EFI_INITIALIZE_LOCK_VARIABLE(EFI_TPL_HIGH_LEVEL);\r
+static BOOLEAN                mEventHandlerActive   = FALSE;\r
+\r
+\r
+STATUS_CODE_RECORD_LIST *\r
+AllocateRecordBuffer (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Allocate a new record list node and initialize it.\r
+  Inserting the node into the list isn't the task of this function.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  A pointer to the new allocated node or NULL if non available\r
+\r
+--*/\r
+{\r
+  STATUS_CODE_RECORD_LIST *DataBuffer;\r
+\r
+  DataBuffer = NULL;\r
+\r
+  gBS->AllocatePool (EfiBootServicesData, sizeof (STATUS_CODE_RECORD_LIST), &DataBuffer);\r
+  if (DataBuffer == NULL) {\r
+    return NULL;\r
+  }\r
+\r
+  EfiCommonLibZeroMem (DataBuffer, sizeof (STATUS_CODE_RECORD_LIST));\r
+  DataBuffer->Signature = BS_DATA_HUB_STATUS_CODE_SIGNATURE;\r
+\r
+  return DataBuffer;\r
+}\r
+\r
+DATA_HUB_STATUS_CODE_DATA_RECORD *\r
+AquireEmptyRecordBuffer (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Acquire an empty record buffer from the record list if there's free node,\r
+  or allocate one new node and insert it to the list if the list is full and\r
+  the function isn't run in EFI_TPL_HIGH_LEVEL.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  Pointer to new record buffer. NULL if none available.\r
+\r
+--*/\r
+{\r
+  EFI_TPL                 OldTpl;\r
+  STATUS_CODE_RECORD_LIST *DataBuffer;\r
+\r
+  DataBuffer = NULL;\r
+\r
+  //\r
+  // This function must be reentrant because an event with higher priority may interrupt it\r
+  // and also report status code.\r
+  //\r
+  EfiAcquireLock (&mStatusCodeReportLock);\r
+  if (mRecordTail != mRecordHead->ForwardLink) {\r
+    if (mRecordNum != 0) {\r
+      mRecordHead = mRecordHead->ForwardLink;\r
+    }\r
+    DataBuffer = CR (mRecordHead, STATUS_CODE_RECORD_LIST, Link, BS_DATA_HUB_STATUS_CODE_SIGNATURE);\r
+    mRecordNum++;\r
+    EfiReleaseLock (&mStatusCodeReportLock);\r
+\r
+    //\r
+    // Initalize the record buffer is the responsibility of the producer,\r
+    // because the consummer is in a lock so must keep it short.\r
+    //\r
+    EfiCommonLibZeroMem (&DataBuffer->RecordBuffer[0], BYTES_PER_BUFFER);\r
+  } else if (mRecordNum < MAX_RECORD_NUM) {\r
+    //\r
+    // The condition of "mRecordNum < MAX_RECORD_NUM" is not promised,\r
+    // because mRecodeNum may be increased out of this lock.\r
+    //\r
+    EfiReleaseLock (&mStatusCodeReportLock);\r
+\r
+    //\r
+    // Can't allocate additional buffer in EFI_TPL_HIGH_LEVEL.\r
+    // Reporting too many status code in EFI_TPL_HIGH_LEVEL may cause status code lost.\r
+    //\r
+    OldTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);\r
+    if (OldTpl == EFI_TPL_HIGH_LEVEL) {\r
+      return NULL;\r
+    }\r
+    gBS->RestoreTPL (OldTpl);\r
+    DataBuffer = AllocateRecordBuffer ();\r
+    if (DataBuffer == NULL) {\r
+      return NULL;\r
+    }\r
+    EfiAcquireLock (&mStatusCodeReportLock);\r
+    InsertHeadList (mRecordHead, &DataBuffer->Link);\r
+    mRecordHead = mRecordHead->ForwardLink;\r
+    mRecordNum++;\r
+    EfiReleaseLock (&mStatusCodeReportLock);\r
+  } else {\r
+    EfiReleaseLock (&mStatusCodeReportLock);\r
+    return NULL;\r
+  }\r
+\r
+  return (DATA_HUB_STATUS_CODE_DATA_RECORD *) DataBuffer->RecordBuffer;\r
+}\r
+\r
+EFI_STATUS\r
+ReleaseRecordBuffer (\r
+  IN  STATUS_CODE_RECORD_LIST  *RecordBuffer\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Release a buffer in the list, remove some nodes to keep the list inital length.\r
+\r
+Arguments:\r
+\r
+  RecordBuffer          - Buffer to release\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS           - If DataRecord is valid\r
+  EFI_UNSUPPORTED       - The record list has empty\r
+\r
+--*/\r
+{\r
+  ASSERT (RecordBuffer != NULL);\r
+\r
+  //\r
+  // The consummer needn't to be reentrient and the producer won't do any meaningful thing\r
+  // when consummer is logging records.\r
+  //\r
+  if (mRecordNum <= 0) {\r
+    return EFI_UNSUPPORTED;\r
+  } else if (mRecordNum > INITIAL_RECORD_NUM) {\r
+    mRecordTail = mRecordTail->ForwardLink;\r
+    RemoveEntryList (&RecordBuffer->Link);\r
+    mRecordNum--;\r
+    gBS->FreePool (RecordBuffer);\r
+  } else {\r
+    if (mRecordNum != 1) {\r
+      mRecordTail = mRecordTail->ForwardLink;\r
+    }\r
+    mRecordNum--;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+EFI_BOOTSERVICE\r
+EFI_STATUS\r
+EFIAPI\r
+BsDataHubReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Boot service report status code listener.  This function logs the status code\r
+  into the data hub.\r
+\r
+Arguments:\r
+\r
+  Same as gRT->ReportStatusCode (See Tiano Runtime Specification)\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  DATA_HUB_STATUS_CODE_DATA_RECORD  *DataHub;\r
+  UINT32                            ErrorLevel;\r
+  VA_LIST                           Marker;\r
+  CHAR8                             *Format;\r
+  UINTN                             Index;\r
+  CHAR16                            FormatBuffer[BYTES_PER_RECORD];\r
+\r
+  DataHub = NULL;\r
+\r
+  if (EfiAtRuntime ()) {\r
+    //\r
+    // For now all we do is post code at runtime\r
+    //\r
+    return EFI_SUCCESS;\r
+  }\r
+  //\r
+  // If we had an error while in our event handler, then do nothing so\r
+  // that we don't get in an endless loop.\r
+  //\r
+  if (mEventHandlerActive) {\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
+  DataHub = (DATA_HUB_STATUS_CODE_DATA_RECORD *) AquireEmptyRecordBuffer ();\r
+  if (DataHub == NULL) {\r
+    //\r
+    // There are no empty record buffer in private buffers\r
+    //\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+  //\r
+  // Construct Data Hub Extended Data\r
+  //\r
+  DataHub->CodeType = CodeType;\r
+  DataHub->Value    = Value;\r
+  DataHub->Instance = Instance;\r
+\r
+  if (CallerId != NULL) {\r
+    EfiCopyMem (&DataHub->CallerId, CallerId, sizeof (EFI_GUID));\r
+  } else {\r
+    EfiZeroMem (&DataHub->CallerId, sizeof (EFI_GUID));\r
+  }\r
+\r
+  if (Data == NULL) {\r
+    EfiZeroMem (&DataHub->Data, sizeof (EFI_STATUS_CODE_DATA));\r
+  } else {\r
+    //\r
+    // Copy generic Header\r
+    //\r
+    EfiCopyMem (&DataHub->Data, Data, sizeof (EFI_STATUS_CODE_DATA));\r
+\r
+    if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {\r
+      //\r
+      // Convert Ascii Format string to Unicode.\r
+      //\r
+      for (Index = 0; Format[Index] != '\0' && Index < (BYTES_PER_RECORD - 1); Index += 1) {\r
+        FormatBuffer[Index] = (CHAR16) Format[Index];\r
+      }\r
+\r
+      FormatBuffer[Index] = L'\0';\r
+\r
+      //\r
+      // Put processed string into the buffer\r
+      //\r
+      Index = VSPrint (\r
+                (UINT16 *) (DataHub + 1),\r
+                BYTES_PER_RECORD - (sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD)),\r
+                FormatBuffer,\r
+                Marker\r
+                );\r
+\r
+      //\r
+      // DATA_HUB_STATUS_CODE_DATA_RECORD followed by VSPrint String Buffer\r
+      //\r
+      DataHub->Data.Size = (UINT16) (Index * sizeof (CHAR16));\r
+\r
+    } else {\r
+      //\r
+      // Default behavior is to copy optional data\r
+      //\r
+      if (Data->Size > (BYTES_PER_RECORD - sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD))) {\r
+        DataHub->Data.Size = (UINT16) (BYTES_PER_RECORD - sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD));\r
+      }\r
+\r
+      EfiCopyMem (DataHub + 1, Data + 1, DataHub->Data.Size);\r
+    }\r
+  }\r
+\r
+  gBS->SignalEvent (mLogDataHubEvent);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+LogDataHubEventHandler (\r
+  IN  EFI_EVENT     Event,\r
+  IN  VOID          *Context\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  The Event handler which will be notified to log data in Data Hub.\r
+\r
+Arguments:\r
+\r
+  Event     -   Instance of the EFI_EVENT to signal whenever data is\r
+                available to be logged in the system.\r
+  Context   -   Context of the event.\r
+\r
+Returns:\r
+\r
+  None.\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                        Status;\r
+  DATA_HUB_STATUS_CODE_DATA_RECORD  *DataRecord;\r
+  UINTN                             Size;\r
+  UINT64                            DataRecordClass;\r
+  EFI_LIST_ENTRY                    *Link;\r
+  STATUS_CODE_RECORD_LIST           *BufferEntry;\r
+\r
+  //\r
+  // Set our global flag so we don't recurse if we get an error here.\r
+  //\r
+  mEventHandlerActive = TRUE;\r
+  \r
+  //\r
+  // Log DataRecord in Data Hub.\r
+  // If there are multiple DataRecords, Log all of them.\r
+  //\r
+  Link = mRecordTail;\r
+\r
+  while (mRecordNum != 0) {\r
+    BufferEntry = CR (Link, STATUS_CODE_RECORD_LIST, Link, BS_DATA_HUB_STATUS_CODE_SIGNATURE);\r
+    DataRecord  = (DATA_HUB_STATUS_CODE_DATA_RECORD *) (BufferEntry->RecordBuffer);\r
+    Link        = Link->ForwardLink;\r
+\r
+    //\r
+    // Add in the size of the header we added.\r
+    //\r
+    Size = sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD) + DataRecord->Data.Size;\r
+\r
+    if ((DataRecord->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
+      DataRecordClass = EFI_DATA_RECORD_CLASS_PROGRESS_CODE;\r
+    } else if ((DataRecord->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {\r
+      DataRecordClass = EFI_DATA_RECORD_CLASS_ERROR;\r
+    } else if ((DataRecord->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
+      DataRecordClass = EFI_DATA_RECORD_CLASS_DEBUG;\r
+    } else {\r
+      //\r
+      // Should never get here.\r
+      //\r
+      DataRecordClass = EFI_DATA_RECORD_CLASS_DEBUG |\r
+        EFI_DATA_RECORD_CLASS_ERROR |\r
+        EFI_DATA_RECORD_CLASS_DATA |\r
+        EFI_DATA_RECORD_CLASS_PROGRESS_CODE;\r
+    }\r
+\r
+    if (((DataRecord->Instance & EFI_D_ERROR) != 0) &&\r
+        (((DataRecord->Instance & EFI_D_POOL) != 0) || ((DataRecord->Instance & EFI_D_PAGE) != 0))\r
+        ) {\r
+      //\r
+      // If memory error, do not call LogData ().\r
+      //\r
+      ErrorPrint (L"ERROR", "Memory Error\n");\r
+      Status = EFI_OUT_OF_RESOURCES;\r
+    } else {\r
+      //\r
+      // We don't log EFI_D_POOL and EFI_D_PAGE debug info to datahub\r
+      // to avoid recursive logging due to the memory allocation in datahub\r
+      //\r
+      if (DataRecordClass != EFI_DATA_RECORD_CLASS_DEBUG ||\r
+          ((DataRecord->Instance & EFI_D_POOL) == 0 && (DataRecord->Instance & EFI_D_PAGE) == 0)) {\r
+        //\r
+        // Log DataRecord in Data Hub\r
+        //\r
+        Status = mDataHub->LogData (\r
+                             mDataHub,\r
+                             &gEfiStatusCodeGuid,\r
+                             &gEfiStatusCodeRuntimeProtocolGuid,\r
+                             DataRecordClass,\r
+                             DataRecord,\r
+                             (UINT32) Size\r
+                             );\r
+      }\r
+    }\r
+\r
+    ReleaseRecordBuffer (BufferEntry);\r
+  }\r
+\r
+  mEventHandlerActive = FALSE;\r
+\r
+  return ;\r
+}\r
+\r
+EFI_BOOTSERVICE\r
+EFI_STATUS\r
+BsDataHubInitializeStatusCode (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Install a data hub listener.\r
+\r
+Arguments:\r
+\r
+  (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS - Logging Hub protocol installed\r
+  Other       - No protocol installed, unload driver.\r
+\r
+--*/\r
+{\r
+  EFI_STATUS              Status;\r
+  STATUS_CODE_RECORD_LIST *DataBuffer;\r
+  UINTN                   Index1;\r
+\r
+  DataBuffer = NULL;\r
+\r
+  Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, &mDataHub);\r
+  //\r
+  // Should never fail due to dependency grammer\r
+  //\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  //\r
+  // Initialize a record list with length not greater than INITIAL_RECORD_NUM.\r
+  // If no buffer can be allocated, return EFI_OUT_OF_RESOURCES.\r
+  //\r
+  DataBuffer = AllocateRecordBuffer ();\r
+  if (DataBuffer == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+  mRecordHead = &DataBuffer->Link;\r
+  mRecordTail = mRecordHead;\r
+  InitializeListHead (mRecordHead);\r
+  \r
+  for (Index1 = 1; Index1 < INITIAL_RECORD_NUM; Index1++) {\r
+    DataBuffer = AllocateRecordBuffer ();\r
+    if (DataBuffer == NULL) {\r
+      break;\r
+    }\r
+    InsertHeadList (mRecordHead, &DataBuffer->Link);\r
+  }\r
+\r
+\r
+  //\r
+  // Create a Notify Event to log data in Data Hub\r
+  //\r
+  Status = gBS->CreateEvent (\r
+                  EFI_EVENT_NOTIFY_SIGNAL,\r
+                  EFI_TPL_CALLBACK,\r
+                  LogDataHubEventHandler,\r
+                  NULL,\r
+                  &mLogDataHubEvent\r
+                  );\r
+\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsDataHubStatusCode/BsDataHubStatusCode.h b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsDataHubStatusCode/BsDataHubStatusCode.h
new file mode 100644 (file)
index 0000000..7f5d026
--- /dev/null
@@ -0,0 +1,156 @@
+/*++\r
+\r
+Copyright (c)  2004 - 2006, Intel Corporation                                                         \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
+\r
+Module Name:\r
+\r
+  BsDataHubStatusCode.h\r
+\r
+Abstract:\r
+\r
+  Header for the status code data hub logging component\r
+\r
+--*/\r
+\r
+#ifndef _EFI_BS_DATA_HUB_STATUS_CODE_H_\r
+#define _EFI_BS_DATA_HUB_STATUS_CODE_H_\r
+\r
+\r
+// Statements that include other files.\r
+//\r
+#include "Tiano.h"\r
+#include "EfiCommonLib.h"\r
+#include "EfiRuntimeLib.h"\r
+#include "EfiPrintLib.h"\r
+#include "EfiStatusCode.h"\r
+\r
+//\r
+// Dependent protocols\r
+//\r
+#include EFI_PROTOCOL_DEPENDENCY (DataHub)\r
+\r
+//\r
+// Consumed protocols\r
+//\r
+#include EFI_ARCH_PROTOCOL_CONSUMER (StatusCode)\r
+\r
+//\r
+// GUID definitions\r
+//\r
+#include EFI_GUID_DEFINITION (StatusCode)\r
+#include EFI_GUID_DEFINITION (StatusCodeCallerId)\r
+#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)\r
+\r
+//\r
+// Private data declarations\r
+//\r
+#define MAX_RECORD_NUM                    1000\r
+#define INITIAL_RECORD_NUM                20\r
+#define BYTES_PER_RECORD                  EFI_STATUS_CODE_DATA_MAX_SIZE\r
+#define BYTES_PER_BUFFER                  (BYTES_PER_RECORD * sizeof (UINT8))\r
+\r
+#define BS_DATA_HUB_STATUS_CODE_SIGNATURE EFI_SIGNATURE_32 ('B', 'D', 'H', 'S')\r
+\r
+typedef struct {\r
+  UINTN           Signature;\r
+  EFI_LIST_ENTRY  Link;\r
+  UINT8           RecordBuffer[BYTES_PER_RECORD];\r
+} STATUS_CODE_RECORD_LIST;\r
+\r
+//\r
+// Function prototypes\r
+//\r
+STATUS_CODE_RECORD_LIST *\r
+AllocateRecordBuffer (\r
+  VOID\r
+  );\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Allocate a new record list node and initialize it.\r
+  Inserting the node into the list isn't the task of this function.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  A pointer to the new allocated node or NULL if non available\r
+\r
+--*/\r
+\r
+DATA_HUB_STATUS_CODE_DATA_RECORD *\r
+AquireEmptyRecordBuffer (\r
+  VOID\r
+  );\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Acquire an empty record buffer from the record list if there's free node,\r
+  or allocate one new node and insert it to the list if the list is full and\r
+  the function isn't run in EFI_TPL_HIGH_LEVEL.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  Pointer to new record buffer. NULL if none available.\r
+\r
+--*/\r
+\r
+EFI_STATUS\r
+ReleaseRecordBuffer (\r
+  IN  STATUS_CODE_RECORD_LIST  *RecordBuffer\r
+  );\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Release a buffer in the list, remove some nodes to keep the list inital length.\r
+Arguments:\r
+\r
+  RecordBuffer          - Buffer to release\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS           - If DataRecord is valid\r
+  EFI_UNSUPPORTED       - The record list has empty\r
+\r
+--*/\r
+\r
+void\r
+EFIAPI\r
+LogDataHubEventHandler (\r
+  IN  EFI_EVENT     Event,\r
+  IN  VOID          *Context\r
+  );\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  The Event handler which will be notified to log data in Data Hub.\r
+\r
+Arguments:\r
+\r
+  Event     -   Instance of the EFI_EVENT to signal whenever data is\r
+                available to be logged in the system.\r
+  Context   -   Context of the event.\r
+\r
+Returns:\r
+\r
+  None.\r
+\r
+--*/\r
+#endif
\ No newline at end of file
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsDataHubStatusCode/BsDataHubStatusCode.inf b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsDataHubStatusCode/BsDataHubStatusCode.inf
new file mode 100644 (file)
index 0000000..b5a1ba9
--- /dev/null
@@ -0,0 +1,45 @@
+#/*++\r
+#\r
+# Copyright (c) 2004, Intel Corporation                                                         \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
+# \r
+#  Module Name:\r
+#\r
+#    BsDataHubStatusCode.inf\r
+#\r
+#  Abstract:\r
+#\r
+#    Library producing a data hub logger for status code functionality.\r
+#\r
+#--*/\r
+\r
+[defines]\r
+BASE_NAME            = BsDataHubStatusCodeLib\r
+COMPONENT_TYPE       = LIBRARY\r
+\r
+[sources.common]\r
+  BsDataHubStatusCode.c\r
+  BsDataHubStatusCode.h\r
+\r
+[includes.common]\r
+  $(EDK_SOURCE)\Foundation\r
+  $(EDK_SOURCE)\Foundation\Framework\r
+  $(EDK_SOURCE)\Foundation\Efi\r
+  .\r
+  $(EDK_SOURCE)\Foundation\Include\r
+  $(EDK_SOURCE)\Foundation\Efi\Include\r
+  $(EDK_SOURCE)\Foundation\Framework\Include\r
+  $(EDK_SOURCE)\Foundation\Include\IndustryStandard\r
+  $(EDK_SOURCE)\Foundation\Core\Dxe\r
+  $(EDK_SOURCE)\Foundation\Library\Dxe\Include\r
+\r
+[libraries.common]\r
+  PrintLib\r
+\r
+[nmake.common]\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsSerialStatusCode/BsSerialStatusCode.c b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsSerialStatusCode/BsSerialStatusCode.c
new file mode 100644 (file)
index 0000000..483064d
--- /dev/null
@@ -0,0 +1,2374 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2005, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  BsSerialStatusCode.c\r
+   \r
+Abstract:\r
+\r
+  Lib to provide Serial I/O status code reporting Routines.\r
+\r
+--*/\r
+\r
+#include "BsSerialStatusCode.h"\r
+\r
+//\r
+// All of the lookup tables are only needed in debug.\r
+//\r
+#ifdef EFI_DEBUG\r
+\r
+typedef struct {\r
+  UINT32  Value;\r
+  CHAR8   *Token;\r
+} STATUS_CODE_LOOKUP_TABLE;\r
+\r
+STATUS_CODE_LOOKUP_TABLE  mSeverityToken[] = {\r
+  {\r
+    EFI_ERROR_MINOR,\r
+    "ERROR_MINOR"\r
+  },\r
+  {\r
+    EFI_ERROR_MAJOR,\r
+    "ERROR_MAJOR"\r
+  },\r
+  {\r
+    EFI_ERROR_UNRECOVERED,\r
+    "ERROR_UNRECOVERED"\r
+  },\r
+  {\r
+    EFI_ERROR_UNCONTAINED,\r
+    "ERROR_UNCONTAINED"\r
+  },\r
+  {\r
+    0xFFFFFFFF,\r
+    "ERROR_UNRECOGNIZED"\r
+  }\r
+};\r
+STATUS_CODE_LOOKUP_TABLE  mClassSubClassToken[] = {\r
+  {\r
+    EFI_COMPUTING_UNIT_UNSPECIFIED,\r
+    "COMPUTING_UNIT_UNSPECIFIED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR,\r
+    "COMPUTING_UNIT_HOST_PROCESSOR"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_FIRMWARE_PROCESSOR,\r
+    "COMPUTING_UNIT_FIRMWARE_PROCESSOR"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_IO_PROCESSOR,\r
+    "COMPUTING_UNIT_IO_PROCESSOR"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CACHE,\r
+    "COMPUTING_UNIT_CACHE"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY,\r
+    "COMPUTING_UNIT_MEMORY"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CHIPSET,\r
+    "COMPUTING_UNIT_CHIPSET"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_UNSPECIFIED,\r
+    "PERIPHERAL_UNSPECIFIED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD,\r
+    "PERIPHERAL_KEYBOARD"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE,\r
+    "PERIPHERAL_MOUSE"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LOCAL_CONSOLE,\r
+    "PERIPHERAL_LOCAL_CONSOLE"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOTE_CONSOLE,\r
+    "PERIPHERAL_REMOTE_CONSOLE"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_SERIAL_PORT,\r
+    "PERIPHERAL_SERIAL_PORT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_PARALLEL_PORT,\r
+    "PERIPHERAL_PARALLEL_PORT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_FIXED_MEDIA,\r
+    "PERIPHERAL_FIXED_MEDIA"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOVABLE_MEDIA,\r
+    "PERIPHERAL_REMOVABLE_MEDIA"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_INPUT,\r
+    "PERIPHERAL_AUDIO_INPUT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_OUTPUT,\r
+    "PERIPHERAL_AUDIO_OUTPUT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LCD_DEVICE,\r
+    "PERIPHERAL_LCD_DEVICE"\r
+  },\r
+  {\r
+    EFI_IO_BUS_UNSPECIFIED,\r
+    "IO_BUS_UNSPECIFIED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI,\r
+    "IO_BUS_PCI"\r
+  },\r
+  {\r
+    EFI_IO_BUS_USB,\r
+    "IO_BUS_USB"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IBA,\r
+    "IO_BUS_IBA"\r
+  },\r
+  {\r
+    EFI_IO_BUS_AGP,\r
+    "IO_BUS_AGP"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PC_CARD,\r
+    "IO_BUS_PC_CARD"\r
+  },\r
+  {\r
+    EFI_IO_BUS_LPC,\r
+    "IO_BUS_LPC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SCSI,\r
+    "IO_BUS_SCSI"\r
+  },\r
+  {\r
+    EFI_IO_BUS_ATA_ATAPI,\r
+    "IO_BUS_ATA_ATAPI"\r
+  },\r
+  {\r
+    EFI_IO_BUS_FC,\r
+    "IO_BUS_FC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IP_NETWORK,\r
+    "IO_BUS_IP_NETWORK"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SMBUS,\r
+    "IO_BUS_SMBUS"\r
+  },\r
+  {\r
+    EFI_IO_BUS_I2C,\r
+    "IO_BUS_I2C"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_UNSPECIFIED,\r
+    "SOFTWARE_UNSPECIFIED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SEC,\r
+    "SOFTWARE_EFI_SEC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_CORE,\r
+    "SOFTWARE_EFI_PEI_CORE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_MODULE,\r
+    "SOFTWARE_EFI_PEI_MODULE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_CORE,\r
+    "SOFTWARE_EFI_DXE_CORE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_BOOT_SERVICE,\r
+    "SOFTWARE_EFI_BOOT_SERVICE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_RUNTIME_SERVICE,\r
+    "SOFTWARE_EFI_RUNTIME_SERVICE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_BS_DRIVER,\r
+    "SOFTWARE_DXE_BS_DRIVER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_RT_DRIVER,\r
+    "SOFTWARE_DXE_RT_DRIVER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SMM_DRIVER,\r
+    "SOFTWARE_SMM_DRIVER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_RT,\r
+    "SOFTWARE_RT"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_AL,\r
+    "SOFTWARE_AL"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_APPLICATION,\r
+    "SOFTWARE_EFI_APPLICATION"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_OS_LOADER,\r
+    "SOFTWARE_EFI_OS_LOADER"\r
+  },\r
+  {\r
+    0xFFFFFFFF,\r
+    "ERROR_UNRECOGNIZED"\r
+  }\r
+};\r
+\r
+STATUS_CODE_LOOKUP_TABLE  mOperationToken[] = {\r
+  {\r
+    EFI_COMPUTING_UNIT_UNSPECIFIED | EFI_CU_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_UNSPECIFIED | EFI_CU_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_UNSPECIFIED | EFI_CU_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_UNSPECIFIED | EFI_CU_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_UNSPECIFIED | EFI_CU_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INVALID_TYPE,\r
+    "INVALID_TYPE"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INVALID_SPEED,\r
+    "INVALID_SPEED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MISMATCH,\r
+    "MISMATCH"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_TIMER_EXPIRED,\r
+    "TIMER_EXPIRED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST,\r
+    "SELF_TEST"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INTERNAL,\r
+    "INTERNAL"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_THERMAL,\r
+    "THERMAL"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_LOW_VOLTAGE,\r
+    "LOW_VOLTAGE"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_HIGH_VOLTAGE,\r
+    "HIGH_VOLTAGE"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_CACHE,\r
+    "CACHE"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MICROCODE_UPDATE,\r
+    "MICROCODE_UPDATE"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_NO_MICROCODE_UPDATE,\r
+    "NO_MICROCODE_UPDATE"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_CORRECTABLE,\r
+    "1XECC"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_UNCORRECTABLE,\r
+    "2XECC"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_FIRMWARE_PROCESSOR | EFI_CU_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_FIRMWARE_PROCESSOR | EFI_CU_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_FIRMWARE_PROCESSOR | EFI_CU_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_FIRMWARE_PROCESSOR | EFI_CU_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_FIRMWARE_PROCESSOR | EFI_CU_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_IO_PROCESSOR | EFI_CU_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_IO_PROCESSOR | EFI_CU_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_IO_PROCESSOR | EFI_CU_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_IO_PROCESSOR | EFI_CU_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_IO_PROCESSOR | EFI_CU_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CACHE | EFI_CU_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CACHE | EFI_CU_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CACHE | EFI_CU_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CACHE | EFI_CU_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CACHE | EFI_CU_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CACHE | EFI_CU_CACHE_EC_INVALID_TYPE,\r
+    "INVALID_TYPE"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CACHE | EFI_CU_CACHE_EC_INVALID_SPEED,\r
+    "INVALID_SPEED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CACHE | EFI_CU_CACHE_EC_INVALID_SIZE,\r
+    "INVALID_SIZE"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_TYPE,\r
+    "INVALID_TYPE"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SPEED,\r
+    "INVALID_SPEED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_CORRECTABLE,\r
+    "1XECC"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UNCORRECTABLE,\r
+    "2XECC"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_SPD_FAIL,\r
+    "SPD_FAIL"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SIZE,\r
+    "INVALID_SIZE"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH,\r
+    "MISMATCH"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_S3_RESUME_FAIL,\r
+    "S3_RESUME_FAIL"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UPDATE_FAIL,\r
+    "UPDATE_FAIL"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_COMPUTING_UNIT_CHIPSET | EFI_CU_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_UNSPECIFIED | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_UNSPECIFIED | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_UNSPECIFIED | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_UNSPECIFIED | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_UNSPECIFIED | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_UNSPECIFIED | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_UNSPECIFIED | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_UNSPECIFIED | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_UNSPECIFIED | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_UNSPECIFIED | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_EC_LOCKED,\r
+    "LOCKED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_EC_STUCK_KEY,\r
+    "STUCK_KEY"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_MOUSE | EFI_P_MOUSE_EC_LOCKED,\r
+    "LOCKED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_SERIAL_PORT | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_SERIAL_PORT | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_SERIAL_PORT | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_SERIAL_PORT | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_SERIAL_PORT | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_SERIAL_PORT | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_SERIAL_PORT | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_SERIAL_PORT | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_SERIAL_PORT | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_SERIAL_PORT | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_PARALLEL_PORT | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_PARALLEL_PORT | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_PARALLEL_PORT | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_PARALLEL_PORT | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_PARALLEL_PORT | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_PARALLEL_PORT | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_PARALLEL_PORT | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_PARALLEL_PORT | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_PARALLEL_PORT | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_PARALLEL_PORT | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_INPUT | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_INPUT | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_INPUT | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_INPUT | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_INPUT | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_INPUT | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_INPUT | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_INPUT | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_INPUT | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_INPUT | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_OUTPUT | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_OUTPUT | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_OUTPUT | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_OUTPUT | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_OUTPUT | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_OUTPUT | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_OUTPUT | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_OUTPUT | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_OUTPUT | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_AUDIO_OUTPUT | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LCD_DEVICE | EFI_P_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LCD_DEVICE | EFI_P_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LCD_DEVICE | EFI_P_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LCD_DEVICE | EFI_P_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LCD_DEVICE | EFI_P_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LCD_DEVICE | EFI_P_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LCD_DEVICE | EFI_P_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LCD_DEVICE | EFI_P_EC_INPUT_ERROR,\r
+    "INPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LCD_DEVICE | EFI_P_EC_OUTPUT_ERROR,\r
+    "OUTPUT_ERROR"\r
+  },\r
+  {\r
+    EFI_PERIPHERAL_LCD_DEVICE | EFI_P_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_UNSPECIFIED | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_UNSPECIFIED | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_UNSPECIFIED | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_UNSPECIFIED | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_UNSPECIFIED | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_UNSPECIFIED | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_UNSPECIFIED | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_UNSPECIFIED | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_UNSPECIFIED | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_UNSPECIFIED | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_PCI_EC_PERR,\r
+    "PERR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PCI | EFI_IOB_PCI_EC_SERR,\r
+    "SERR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_USB | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_USB | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_USB | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_USB | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_USB | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_USB | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_USB | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_USB | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_USB | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_USB | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IBA | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IBA | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IBA | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IBA | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IBA | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IBA | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IBA | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IBA | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IBA | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IBA | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_AGP | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_AGP | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_AGP | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_AGP | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_AGP | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_AGP | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_AGP | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_AGP | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_AGP | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_AGP | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PC_CARD | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PC_CARD | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PC_CARD | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PC_CARD | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PC_CARD | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PC_CARD | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PC_CARD | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PC_CARD | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PC_CARD | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_PC_CARD | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_LPC | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_LPC | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_LPC | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_LPC | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_LPC | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_LPC | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_LPC | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_LPC | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_LPC | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_LPC | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SCSI | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SCSI | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SCSI | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SCSI | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SCSI | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SCSI | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SCSI | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SCSI | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SCSI | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SCSI | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_FC | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_FC | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_FC | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_FC | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_FC | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_FC | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_FC | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_FC | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_FC | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_FC | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IP_NETWORK | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IP_NETWORK | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IP_NETWORK | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IP_NETWORK | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IP_NETWORK | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IP_NETWORK | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IP_NETWORK | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IP_NETWORK | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IP_NETWORK | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_IP_NETWORK | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SMBUS | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SMBUS | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SMBUS | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SMBUS | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SMBUS | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SMBUS | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SMBUS | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SMBUS | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SMBUS | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_SMBUS | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_IO_BUS_I2C | EFI_IOB_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_IO_BUS_I2C | EFI_IOB_EC_DISABLED,\r
+    "DISABLED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_I2C | EFI_IOB_EC_NOT_SUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_I2C | EFI_IOB_EC_NOT_DETECTED,\r
+    "NOT_DETECTED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_I2C | EFI_IOB_EC_NOT_CONFIGURED,\r
+    "NOT_CONFIGURED"\r
+  },\r
+  {\r
+    EFI_IO_BUS_I2C | EFI_IOB_EC_INTERFACE_ERROR,\r
+    "INTERFACE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_I2C | EFI_IOB_EC_CONTROLLER_ERROR,\r
+    "CONTROLLER_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_I2C | EFI_IOB_EC_READ_ERROR,\r
+    "READ_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_I2C | EFI_IOB_EC_WRITE_ERROR,\r
+    "WRITE_ERROR"\r
+  },\r
+  {\r
+    EFI_IO_BUS_I2C | EFI_IOB_EC_RESOURCE_CONFLICT,\r
+    "RESOURCE_CONFLICT"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SEC | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SEC | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SEC | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SEC | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SEC | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SEC | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SEC | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SEC | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SEC | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_CORE | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_CORE | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_CORE | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_CORE | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_CORE | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_CORE | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_CORE | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_CORE | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_CORE | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_MODULE | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_MODULE | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_MODULE | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_MODULE | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_MODULE | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_MODULE | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_MODULE | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_MODULE | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_PEI_MODULE | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_CORE | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_CORE | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_CORE | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_CORE | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_CORE | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_CORE | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_CORE | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_CORE | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_CORE | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_RT | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_RT | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_RT | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_RT | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_RT | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_RT | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_RT | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_RT | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_RT | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_AL | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_AL | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_AL | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_AL | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_AL | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_AL | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_AL | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_AL | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_AL | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_APPLICATION | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_APPLICATION | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_APPLICATION | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_APPLICATION | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_APPLICATION | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_APPLICATION | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_APPLICATION | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_APPLICATION | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_APPLICATION | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_OS_LOADER | EFI_SW_EC_NON_SPECIFIC,\r
+    "NON_SPECIFIC"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_OS_LOADER | EFI_SW_EC_LOAD_ERROR,\r
+    "LOAD_ERROR"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_OS_LOADER | EFI_SW_EC_INVALID_PARAMETER,\r
+    "INVALID_PARAMETER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_OS_LOADER | EFI_SW_EC_UNSUPPORTED,\r
+    "NOT_SUPPORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_OS_LOADER | EFI_SW_EC_INVALID_BUFFER,\r
+    "INVALID_BUFFER"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_OS_LOADER | EFI_SW_EC_OUT_OF_RESOURCES,\r
+    "OUT_OF_RESOURCES"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_OS_LOADER | EFI_SW_EC_ABORTED,\r
+    "ABORTED"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_OS_LOADER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE,\r
+    "ILLEGAL_SOFTWARE_STATE"\r
+  },\r
+  {\r
+    EFI_SOFTWARE_EFI_OS_LOADER | EFI_SW_EC_ILLEGAL_HARDWARE_STATE,\r
+    "ILLEGAL_HARDWARE_STATE"\r
+  },\r
+  {\r
+    0xFFFFFFFF,\r
+    "ERROR_UNRECOGNIZED"\r
+  }\r
+};\r
+\r
+#endif\r
+//\r
+// Private function declarations\r
+//\r
+//\r
+// Match is only needed for debug.\r
+//\r
+#ifdef EFI_DEBUG\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+MatchString (\r
+  IN  STATUS_CODE_LOOKUP_TABLE  *Table,\r
+  IN  UINT32                    Value,\r
+  OUT CHAR8                     **Token\r
+  );\r
+#endif\r
+//\r
+// Function implemenations\r
+//\r
+//\r
+// Match is only needed for debug.\r
+//\r
+#ifdef EFI_DEBUG\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+MatchString (\r
+  IN  STATUS_CODE_LOOKUP_TABLE  *Table,\r
+  IN  UINT32                    Value,\r
+  OUT CHAR8                     **Token\r
+  )\r
+/*++\r
+\r
+Routine Description: \r
+\r
+  Search the input table for a matching value and return the token associated\r
+  with that value.  Well formed tables will have the last value == 0 and will \r
+  return a default token.\r
+\r
+Arguments:  \r
+\r
+  Table     Pointer to first entry in an array of table entries.\r
+  Value     Value to look up.\r
+  Token     String to return.\r
+\r
+Returns:  \r
+\r
+  EFI_SUCCESS   The function always returns success.\r
+\r
+--*/\r
+{\r
+  UINTN Current;\r
+\r
+  ASSERT (Table);\r
+  ASSERT (Token);\r
+\r
+  Current = 0;\r
+  *Token  = 0;\r
+\r
+  while (!*Token) {\r
+    //\r
+    // Found token if values match or current entry is the last entry.\r
+    //\r
+    if ((Table[Current].Value == (-1)) || (Table[Current].Value == Value)) {\r
+      *Token = Table[Current].Token;\r
+    }\r
+\r
+    Current++;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+#endif\r
+\r
+VOID\r
+BsSerialInitializeStatusCode (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Initialize Serial Port\r
+\r
+    The Baud Rate Divisor registers are programmed and the LCR \r
+    is used to configure the communications format. Hard coded\r
+    UART config comes from globals in DebugSerialPlatform lib.\r
+\r
+Arguments: \r
+\r
+  Unused\r
+\r
+Returns: \r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  UINTN Divisor;\r
+  UINT8 OutputData;\r
+  UINT8 Data;\r
+\r
+  //\r
+  // Some init is done by the platform status code initialization.\r
+  //\r
+  //\r
+  // Map 5..8 to 0..3\r
+  //\r
+  Data = (UINT8) (gData - (UINT8) 5);\r
+\r
+  //\r
+  // Calculate divisor for baud generator\r
+  //\r
+  Divisor = 115200 / gBps;\r
+\r
+  //\r
+  // Set communications format\r
+  //\r
+  OutputData = (UINT8) ((DLAB << 7) | ((gBreakSet << 6) | ((gParity << 3) | ((gStop << 2) | Data))));\r
+  IoWrite8 (gComBase + LCR_OFFSET, OutputData);\r
+\r
+  //\r
+  // Configure baud rate\r
+  //\r
+  IoWrite8 (gComBase + BAUD_HIGH_OFFSET, (UINT8) (Divisor >> 8));\r
+  IoWrite8 (gComBase + BAUD_LOW_OFFSET, (UINT8) (Divisor & 0xff));\r
+\r
+  //\r
+  // Switch back to bank 0\r
+  //\r
+  OutputData = (UINT8) ((~DLAB << 7) | ((gBreakSet << 6) | ((gParity << 3) | ((gStop << 2) | Data))));\r
+  IoWrite8 (gComBase + LCR_OFFSET, OutputData);\r
+}\r
+\r
+VOID\r
+DebugSerialWrite (\r
+  IN UINT8  Character\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ DebugSerialWrite - Outputs a character to the Serial port\r
+\r
+  Repeatedly polls the TXRDY bit of the Line Status Register\r
+  until the Transmitter Holding Register is empty.  The character\r
+  is then written to the Serial port.\r
+\r
+Arguments:\r
+\r
+  Character   - Character to write\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  UINT8 Data;\r
+\r
+  //\r
+  // Wait for the serail port to be ready.\r
+  //\r
+  do {\r
+    Data = IoRead8 (gComBase + LSR_OFFSET);\r
+  } while ((Data & LSR_TXRDY) == 0);\r
+\r
+  IoWrite8 (gComBase, Character);\r
+}\r
+\r
+VOID\r
+DebugSerialPrint (\r
+  IN UINT8    *OutputString\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Prints a string to the Serial port\r
+\r
+Arguments:\r
+\r
+  OutputString - Ascii string to print to serial port.\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  Status = EFI_SUCCESS;\r
+\r
+  for (; *OutputString != 0; OutputString++) {\r
+    DebugSerialWrite (*OutputString);\r
+  }\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BsSerialReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Provide a serial port print\r
+\r
+Arguments:\r
+\r
+    \r
+Returns:\r
+\r
+  Status -  EFI_SUCCESS if the interface could be successfully\r
+            installed\r
+\r
+--*/\r
+{\r
+  CHAR8   Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE * 3];\r
+  UINT32  LineNumber;\r
+  CHAR8   *Filename;\r
+  CHAR8   *Description;\r
+  CHAR8   *Format;\r
+  VA_LIST Marker;\r
+  UINT32  ErrorLevel;\r
+  UINTN   CharCount;\r
+\r
+  Buffer[0] = '\0';\r
+\r
+  if (ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {\r
+    //\r
+    // Processes ASSERT ()\r
+    //\r
+    ASPrint (\r
+      Buffer,\r
+      EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+      "\nDXE_ASSERT!: %a (%d): %a\n",\r
+      Filename,\r
+      LineNumber,\r
+      Description\r
+      );\r
+\r
+  } else if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {\r
+    //\r
+    // Process DEBUG () macro to Serial\r
+    //\r
+    AvSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);\r
+\r
+  } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {\r
+    //\r
+    // Process Errors\r
+    //\r
+    CharCount = ASPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "ERROR: C%x:V%x I%x", CodeType, Value, Instance);\r
+    //\r
+    // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.\r
+    //\r
+    if (CallerId) {\r
+      CharCount += ASPrint (\r
+                    &Buffer[CharCount - 1],\r
+                    (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                    " %g",\r
+                    CallerId\r
+                    );\r
+    }\r
+\r
+    if (Data) {\r
+      CharCount += ASPrint (\r
+                    &Buffer[CharCount - 1],\r
+                    (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                    " %x",\r
+                    Data\r
+                    );\r
+    }\r
+\r
+    CharCount += ASPrint (\r
+                  &Buffer[CharCount - 1],\r
+                  (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                  "\n"\r
+                  );\r
+\r
+  }\r
+\r
+  if (Buffer[0] != '\0') {\r
+    //\r
+    // Callout to platform Lib function to do print.\r
+    //\r
+    DebugSerialPrint (Buffer);\r
+  }\r
+  //\r
+  // Debug code to display human readable code information.\r
+  //\r
+#ifdef EFI_DEBUG\r
+  {\r
+    CHAR8 *SeverityToken;\r
+    CHAR8 *SubClassToken;\r
+    CHAR8 *OperationToken;\r
+\r
+    if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {\r
+      //\r
+      // Get the severity token\r
+      //\r
+      MatchString (\r
+        mSeverityToken,\r
+        (CodeType & EFI_STATUS_CODE_SEVERITY_MASK),\r
+        &SeverityToken\r
+        );\r
+\r
+      //\r
+      // Get the Class/SubClass token\r
+      //\r
+      MatchString (\r
+        mClassSubClassToken,\r
+        (Value & (EFI_STATUS_CODE_CLASS_MASK | EFI_STATUS_CODE_SUBCLASS_MASK)),\r
+        &SubClassToken\r
+        );\r
+\r
+      //\r
+      // Get the operation token\r
+      //\r
+      MatchString (\r
+        mOperationToken,\r
+        (Value & (EFI_STATUS_CODE_CLASS_MASK | EFI_STATUS_CODE_SUBCLASS_MASK | EFI_STATUS_CODE_OPERATION_MASK)),\r
+        &OperationToken\r
+        );\r
+\r
+      //\r
+      // Concatenate the instance\r
+      //\r
+      ASPrint (\r
+        Buffer,\r
+        EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+        "%a:%a:%a:%d\n",\r
+        SeverityToken,\r
+        SubClassToken,\r
+        OperationToken,\r
+        Instance\r
+        );\r
+\r
+      DebugSerialPrint (Buffer);\r
+    }\r
+  }\r
+#endif\r
+\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsSerialStatusCode/BsSerialStatusCode.h b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsSerialStatusCode/BsSerialStatusCode.h
new file mode 100644 (file)
index 0000000..6316547
--- /dev/null
@@ -0,0 +1,90 @@
+/*++\r
+\r
+Copyright (c) 2004, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  BsSerialStatusCode.h\r
+   \r
+Abstract:\r
+\r
+  Lib to provide Serial I/O status code routines.  This uses the PEI library\r
+  print functions.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_BS_SERIAL_STATUS_CODE_H_\r
+#define _EFI_BS_SERIAL_STATUS_CODE_H_\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include "Tiano.h"\r
+#include "Pei.h"\r
+#include "PeiLib.h"\r
+#include "EfiRuntimeLib.h"\r
+#include "BsSerialStatusCodeLib.h"\r
+\r
+//\r
+// GUID consumed\r
+//\r
+#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)\r
+\r
+//\r
+// ---------------------------------------------\r
+// UART Register Offsets\r
+// ---------------------------------------------\r
+//\r
+#define BAUD_LOW_OFFSET   0x00\r
+#define BAUD_HIGH_OFFSET  0x01\r
+#define IER_OFFSET        0x01\r
+#define LCR_SHADOW_OFFSET 0x01\r
+#define FCR_SHADOW_OFFSET 0x02\r
+#define IR_CONTROL_OFFSET 0x02\r
+#define FCR_OFFSET        0x02\r
+#define EIR_OFFSET        0x02\r
+#define BSR_OFFSET        0x03\r
+#define LCR_OFFSET        0x03\r
+#define MCR_OFFSET        0x04\r
+#define LSR_OFFSET        0x05\r
+#define MSR_OFFSET        0x06\r
+\r
+//\r
+// ---------------------------------------------\r
+// UART Register Bit Defines\r
+// ---------------------------------------------\r
+//\r
+#define LSR_TXRDY 0x20\r
+#define LSR_RXDA  0x01\r
+#define DLAB      0x01\r
+\r
+//\r
+// Globals for Serial Port settings\r
+//\r
+extern UINT16 gComBase;\r
+extern UINTN  gBps;\r
+extern UINT8  gData;\r
+extern UINT8  gStop;\r
+extern UINT8  gParity;\r
+extern UINT8  gBreakSet;\r
+\r
+VOID\r
+DebugSerialPrint (\r
+  IN UINT8    *OutputString\r
+  )\r
+;\r
+\r
+VOID\r
+DebugSerialWrite (\r
+  IN UINT8  Character\r
+  )\r
+;\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsSerialStatusCode/BsSerialStatusCode.inf b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/BsSerialStatusCode/BsSerialStatusCode.inf
new file mode 100644 (file)
index 0000000..0407fb0
--- /dev/null
@@ -0,0 +1,47 @@
+#/*++\r
+#\r
+# Copyright (c) 2004, Intel Corporation                                                         \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
+# \r
+#  Module Name:\r
+#\r
+#    BsSerialStatusCode.inf\r
+#\r
+#  Abstract:\r
+#\r
+#    Library producing a serial port status code functionality.\r
+#\r
+#--*/\r
+\r
+[defines]\r
+BASE_NAME            = BsSerialStatusCodeLib\r
+COMPONENT_TYPE       = LIBRARY\r
+\r
+[sources.common]\r
+  BsSerialStatusCode.c\r
+  BsSerialStatusCode.h\r
+\r
+[includes.common]\r
+  $(EDK_SOURCE)\Foundation\Framework\r
+  $(EDK_SOURCE)\Foundation\r
+  $(EDK_SOURCE)\Foundation\Efi\r
+  .\r
+  ..\Include\r
+  $(EDK_SOURCE)\Foundation\Include\r
+  $(EDK_SOURCE)\Foundation\Efi\Include\r
+  $(EDK_SOURCE)\Foundation\Framework\Include\r
+  $(EDK_SOURCE)\Foundation\Include\IndustryStandard\r
+  $(EDK_SOURCE)\Foundation\Core\Dxe\r
+  $(EDK_SOURCE)\Foundation\Library\Dxe\Include\r
+  $(EDK_SOURCE)\Foundation\Include\Pei\r
+  $(EDK_SOURCE)\Foundation\Library\Pei\Include\r
+\r
+[libraries.platform]\r
+\r
+[nmake.common]\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/BsDataHubStatusCodeLib.h b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/BsDataHubStatusCodeLib.h
new file mode 100644 (file)
index 0000000..6d6dfcd
--- /dev/null
@@ -0,0 +1,53 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2005, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  BsDataHubStatusCodeLib.h\r
+   \r
+Abstract:\r
+\r
+  Lib to provide data hub status code reporting.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_BS_DATA_HUB_STATUS_CODE_LIB_H_\r
+#define _EFI_BS_DATA_HUB_STATUS_CODE_LIB_H_\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include "Tiano.h"\r
+\r
+//\r
+// Initialization function\r
+//\r
+VOID\r
+BsDataHubInitializeStatusCode (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+;\r
+\r
+//\r
+// Status code reporting function\r
+//\r
+EFI_STATUS\r
+BsDataHubReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+;\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/BsSerialStatusCodeLib.h b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/BsSerialStatusCodeLib.h
new file mode 100644 (file)
index 0000000..e0403cb
--- /dev/null
@@ -0,0 +1,53 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2005, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  BsSerialStatusCodeLib.h\r
+   \r
+Abstract:\r
+\r
+  Lib to provide Serial I/O status code reporting.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_BS_SERIAL_STATUS_CODE_LIB_H_\r
+#define _EFI_BS_SERIAL_STATUS_CODE_LIB_H_\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include "Tiano.h"\r
+\r
+//\r
+// Initialization function\r
+//\r
+VOID\r
+BsSerialInitializeStatusCode (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+;\r
+\r
+//\r
+// Status code reporting function\r
+//\r
+EFI_STATUS\r
+BsSerialReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+;\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtLedStatusCodeLib.h b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtLedStatusCodeLib.h
new file mode 100644 (file)
index 0000000..378d5dc
--- /dev/null
@@ -0,0 +1,49 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2005, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  RtLedStatusCodeLib.h\r
+   \r
+Abstract:\r
+\r
+  Lib to provide status code reporting via LED.\r
+\r
+--*/\r
+\r
+#ifndef _RT_LED_STATUS_CODE_H_\r
+#define _RT_LED_STATUS_CODE_H_\r
+\r
+#include "Tiano.h"\r
+\r
+//\r
+// Initialization function\r
+//\r
+VOID\r
+RtLedInitializeStatusCode (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+;\r
+\r
+//\r
+// Status code reporting function\r
+//\r
+EFI_STATUS\r
+RtLedReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+;\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtMemoryStatusCodeLib.h b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtMemoryStatusCodeLib.h
new file mode 100644 (file)
index 0000000..3dadc1d
--- /dev/null
@@ -0,0 +1,72 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2005, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  RtMemoryStatusCodeLib.h\r
+   \r
+Abstract:\r
+\r
+  Lib to provide memory status code reporting.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_RT_MEMORY_STATUS_CODE_LIB_H_\r
+#define _EFI_RT_MEMORY_STATUS_CODE_LIB_H_\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include "Tiano.h"\r
+\r
+//\r
+// Initialization function\r
+//\r
+VOID\r
+RtMemoryInitializeStatusCode (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+;\r
+\r
+//\r
+// Status code reporting function\r
+//\r
+EFI_STATUS\r
+RtMemoryReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+;\r
+\r
+//\r
+// Playback all prior status codes to a listener\r
+//\r
+typedef\r
+EFI_STATUS\r
+(*PLATFORM_REPORT_STATUS_CODE) (\r
+  IN EFI_STATUS_CODE_TYPE     Type,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId OPTIONAL,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  );\r
+\r
+VOID\r
+PlaybackStatusCodes (\r
+  IN PLATFORM_REPORT_STATUS_CODE  ReportStatusCode\r
+  )\r
+;\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtPlatformStatusCodeLib.h b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtPlatformStatusCodeLib.h
new file mode 100644 (file)
index 0000000..6979aa1
--- /dev/null
@@ -0,0 +1,54 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2005, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  RtPlatformStatusCodeLib.h\r
+   \r
+Abstract:\r
+\r
+  Lib to provide platform implementations necessary for the Monolithic status\r
+  code to work.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_PLATFORM_STATUS_CODE_LIB_H_\r
+#define _EFI_PLATFORM_STATUS_CODE_LIB_H_\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include "Tiano.h"\r
+\r
+//\r
+// Initialization function\r
+//\r
+VOID\r
+RtPlatformInitializeStatusCode (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+;\r
+\r
+//\r
+// Status code reporting function\r
+//\r
+EFI_STATUS\r
+RtPlatformReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+;\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtPort80StatusCodeLib.h b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/Include/RtPort80StatusCodeLib.h
new file mode 100644 (file)
index 0000000..9c57ffb
--- /dev/null
@@ -0,0 +1,43 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2005, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  RtPort80StatusCodeLib.h\r
+   \r
+Abstract:\r
+\r
+  Lib to provide status code reporting via port 80.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_PORT_80_STATUS_CODE_H_\r
+#define _EFI_PORT_80_STATUS_CODE_H_\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include "Tiano.h"\r
+\r
+//\r
+// Status code reporting function\r
+//\r
+EFI_STATUS\r
+RtPort80ReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+;\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.c b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.c
new file mode 100644 (file)
index 0000000..a92e281
--- /dev/null
@@ -0,0 +1,366 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2006, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  RtLedStatusCode.c\r
+   \r
+Abstract:\r
+\r
+  Lib to provide LED status code reporting Routines.\r
+\r
+  In general you should use PPI's, but some times a monolithic driver\r
+  is better. The best justification for monolithic code is debug.\r
+\r
+--*/\r
+\r
+#include "RtLedStatusCode.h"\r
+\r
+//\r
+// Prepare the data to initialize LPC chipset for Server Io Configuration\r
+// This is hardcoded init value and would vary from platform to platform.\r
+//\r
+static SIO_INIT_DATA  mSioInitData[] = {\r
+  //\r
+  // Program magic values in ServerI/O configuration registers\r
+  //\r
+  {\r
+    REG_SERVERIO_CNF1,\r
+    0x19\r
+  },\r
+  {\r
+    REG_SERVERIO_CNF2,\r
+    0x22\r
+  },\r
+  {\r
+    REG_SERVERIO_CNF3,\r
+    0x76\r
+  },\r
+  {\r
+    REG_SERVERIO_CNF4,\r
+    0x26\r
+  },\r
+  //\r
+  // Force the parallel port to be disabled, override reg 30 setting\r
+  //\r
+  {\r
+    REG_SERVERIO_CNF6,\r
+    0x02\r
+  },\r
+  //\r
+  // Select GPIO device and setup GPIO base address\r
+  //\r
+  {\r
+    REG_LOGICAL_DEVICE,\r
+    SIO_GPIO\r
+  },\r
+  {\r
+    ACTIVATE,\r
+    LOGICAL_DEVICE_OFF\r
+  },\r
+  {\r
+    BASE_ADDRESS_HIGH,\r
+    SIO_GPIO_HIGH\r
+  },\r
+  {\r
+    BASE_ADDRESS_LOW,\r
+    SIO_GPIO_LOW\r
+  },\r
+  {\r
+    ACTIVATE,\r
+    LOGICAL_DEVICE_ON\r
+  },\r
+  //\r
+  // Select DLED STB, post code LED, ZZ_POST_CLK_LED_L\r
+  //\r
+  {\r
+    GPIO_GPSEL,\r
+    0x43\r
+  },\r
+  //\r
+  // Push pull output enable\r
+  //\r
+  {\r
+    GPIO_GPCFG1,\r
+    PUSH_PULL | OUTPUT_BUFFER_EN\r
+  },\r
+  //\r
+  // Disable Event IRQ routing\r
+  //\r
+  {\r
+    GPIO_GPEVR,\r
+    GPIO_EVENT_OFF\r
+  },\r
+  //\r
+  // Select DLED STB, ZZ_POST_DATA_LED_L\r
+  //\r
+  {\r
+    GPIO_GPSEL,\r
+    0x54\r
+  },\r
+  //\r
+  // Push pull output enable\r
+  //\r
+  {\r
+    GPIO_GPCFG1,\r
+    PUSH_PULL | OUTPUT_BUFFER_EN\r
+  },\r
+  //\r
+  // Disable Event IRQ routing\r
+  //\r
+  {\r
+    GPIO_GPEVR,\r
+    GPIO_EVENT_OFF\r
+  },\r
+  //\r
+  // Select Select ACPI_MODE_IND_L\r
+  //\r
+  {\r
+    GPIO_GPSEL,\r
+    0x63\r
+  },\r
+  //\r
+  // Push pull output enable\r
+  //\r
+  {\r
+    GPIO_GPCFG1,\r
+    PUSH_PULL | OUTPUT_BUFFER_EN\r
+  },\r
+\r
+  {\r
+    0xff,\r
+    0xff\r
+  }\r
+};\r
+\r
+VOID\r
+RtLedInitializeStatusCode (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Initialization routine. Initializes LPC47817 to configure GPIO for LED\r
+\r
+Arguments: \r
+\r
+  None\r
+\r
+Returns: \r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  UINT8   OutputData;\r
+  UINT16  ConfigPort;\r
+  UINT16  DataPort;\r
+  UINT32  Index;\r
+\r
+  //\r
+  // hard code for sio init\r
+  //\r
+  ConfigPort  = CONFIG_PORT0;\r
+  DataPort    = DATA_PORT0;\r
+\r
+  //\r
+  // Initialize Sio from table to enable SererIoCfg and GPIO\r
+  //\r
+  Index = 0;\r
+  while ((mSioInitData[Index]).RegAddress != 0xff) {\r
+    OutputData = (UINT8) mSioInitData[Index].RegAddress;\r
+\r
+    IoWrite8 (ConfigPort, OutputData);\r
+\r
+    OutputData = (UINT8) mSioInitData[Index].RegValue;\r
+    IoWrite8 (DataPort, OutputData);\r
+\r
+    Index++;\r
+  }\r
+\r
+  return ;\r
+}\r
+\r
+BOOLEAN\r
+CodeTypeToProgressCode (\r
+  IN  EFI_STATUS_CODE_TYPE    CodeType,\r
+  IN  EFI_STATUS_CODE_VALUE   Value,\r
+  OUT UINT8                   *PostCode\r
+  )\r
+{\r
+  //\r
+  // Convert Value to an 8 bit post code\r
+  //\r
+  if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE)) {\r
+    *PostCode = (UINT8) (((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5);\r
+    *PostCode |= (UINT8) (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f);\r
+    return TRUE;\r
+  }\r
+\r
+  return FALSE;\r
+}\r
+\r
+VOID\r
+SendDataToPort (\r
+  IN  UINT8   Data,\r
+  IN  UINT16  DataOffset\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Writes the data to control LED output at desired port\r
+\r
+Arguments: \r
+\r
+  Data        -   Data in bit0 is the relevant data\r
+  DataOffset  -   Port address to access GPIO54\r
+\r
+Returns: \r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  UINT8 PinData;\r
+\r
+  //\r
+  // Read current Pin State of GPIO54\r
+  //\r
+  PinData = IoRead8 (DataOffset);\r
+\r
+  //\r
+  // Set GPIO54 pin to zero\r
+  //\r
+  PinData &= 0xEF;\r
+\r
+  if (Data & 0x01) {\r
+    //\r
+    // Set GPIO54 pin to 1 if data is 1\r
+    // otherwise it will be set to 0\r
+    //\r
+    PinData |= LED_MASK_BIT;\r
+  }\r
+\r
+  IoWrite8 (DataOffset, PinData);\r
+}\r
+\r
+VOID\r
+StrobeData (\r
+  IN  UINT16  StrobeOffset\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Controls the strobe to move the value from LSB to MSB in steps.\r
+\r
+Arguments: \r
+\r
+  StrobeOffset  -   Port address to access GPIO43. This pin controls the shifting\r
+                    of bit value from LSB to MSB\r
+\r
+Returns: \r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  UINT8 StrobeData;\r
+\r
+  StrobeData = IoRead8 (StrobeOffset);\r
+\r
+  //\r
+  // Make bit 3 of data to be zero\r
+  //\r
+  StrobeData &= 0xF7;\r
+\r
+  IoWrite8 (StrobeOffset, StrobeData);\r
+\r
+  //\r
+  // Make bit 3 as 1 to perform the strobe to shift the data in 74HCT164\r
+  //\r
+  StrobeData |= STROBE_MASK_BIT;\r
+\r
+  IoWrite8 (StrobeOffset, StrobeData);\r
+}\r
+\r
+VOID\r
+SendDataToLed (\r
+  UINT8                   Data\r
+  )\r
+{\r
+  UINT16  GpioBase;\r
+  UINT16  DataOffset;\r
+  UINT16  StrobeOffset;\r
+  UINTN   Index;\r
+  UINTN   DataBitPosition;\r
+  UINT8   TempData;\r
+\r
+  GpioBase        = GPIO_BASE (SIO_GPIO_HIGH, SIO_GPIO_LOW);\r
+\r
+  DataOffset      = (UINT16) (GpioBase + LED_DATA_OFFSET);\r
+\r
+  StrobeOffset    = (UINT16) (GpioBase + LED_STROBE_OFFSET);\r
+\r
+  DataBitPosition = 7;\r
+\r
+  Data            = (UINT8) (~Data);\r
+\r
+  TempData        = Data;\r
+\r
+  for (Index = 0; Index < 8; Index++) {\r
+    SendDataToPort ((UINT8) (TempData >> DataBitPosition), DataOffset);\r
+    StrobeData (StrobeOffset);\r
+    DataBitPosition--;\r
+  }\r
+  //\r
+  // To fix 5 Volt leakage problem\r
+  //\r
+  SendDataToPort (0, DataOffset);\r
+\r
+}\r
+\r
+EFI_STATUS\r
+RtLedReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Provide a LED status code\r
+\r
+Arguments:\r
+\r
+  Same as ReportStatusCode PPI\r
+    \r
+Returns:\r
+\r
+  Status -  EFI_SUCCESS if the interface could be successfully\r
+            installed\r
+\r
+--*/\r
+{\r
+  UINT8 ProgressCode;\r
+\r
+  if (CodeTypeToProgressCode (CodeType, Value, &ProgressCode)) {\r
+    SendDataToLed (ProgressCode);\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.h b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.h
new file mode 100644 (file)
index 0000000..e21169c
--- /dev/null
@@ -0,0 +1,89 @@
+/*++\r
+\r
+Copyright (c) 2004, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  RtLedStatusCode.h\r
+   \r
+Abstract:\r
+\r
+  Lib to provide status code reporting via LED.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_LED_STATUS_CODE_H_\r
+#define _EFI_LED_STATUS_CODE_H_\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include "Tiano.h"\r
+#include "EfiCommonLib.h"\r
+#include "EfiRuntimeLib.h"\r
+#include "EfiStatusCode.h"\r
+\r
+//\r
+// SIOINIT data\r
+//\r
+typedef struct {\r
+  UINT8 RegAddress;\r
+  UINT8 RegValue;\r
+} SIO_INIT_DATA;\r
+\r
+#define LED_DATA_OFFSET   0x0E\r
+#define LED_STROBE_OFFSET 0x0A\r
+\r
+#define LED_MASK_BIT      0x10\r
+#define STROBE_MASK_BIT   0x08\r
+\r
+#define GPIO_BASE(a, b)   (UINT16) ((a << 8) | (b))\r
+\r
+#define SIO_GPIO_HIGH     0x08\r
+#define SIO_GPIO_LOW      0x00\r
+\r
+#define CONFIG_PORT0      0x2E\r
+#define DATA_PORT0        0x2F\r
+\r
+//\r
+// logical device in  NSPC87417\r
+//\r
+#define SIO_GPIO  0x7\r
+\r
+//\r
+// Global register in NSPC87417\r
+//\r
+#define REG_LOGICAL_DEVICE  0x07\r
+\r
+#define REG_SERVERIO_CNF1   0x21\r
+#define REG_SERVERIO_CNF2   0x22\r
+#define REG_SERVERIO_CNF3   0x23\r
+#define REG_SERVERIO_CNF4   0x24\r
+#define REG_SERVERIO_CNF6   0x26\r
+\r
+#define ACTIVATE            0x30\r
+#define LOGICAL_DEVICE_ON   0x01\r
+#define LOGICAL_DEVICE_OFF  0x00\r
+#define BASE_ADDRESS_HIGH   0x60\r
+#define BASE_ADDRESS_LOW    0x61\r
+\r
+//\r
+// Register for GPIO\r
+//\r
+#define GPIO_GPSEL        0xF0\r
+\r
+#define GPIO_GPCFG1       0xF1\r
+#define PUSH_PULL         0x02\r
+#define OUTPUT_BUFFER_EN  0x01\r
+\r
+#define GPIO_GPEVR        0xF2\r
+#define GPIO_EVENT_OFF    0x00\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.inf b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtLedStatusCode/RtLedStatusCode.inf
new file mode 100644 (file)
index 0000000..8a2c6f5
--- /dev/null
@@ -0,0 +1,44 @@
+#/*++\r
+#\r
+# Copyright (c) 2004, Intel Corporation                                                         \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
+# \r
+#  Module Name:\r
+#\r
+#    RtLedStatusCode.inf\r
+#\r
+#  Abstract:\r
+#\r
+#    Library producing a LED status code functionality.\r
+#\r
+#--*/\r
+\r
+[defines]\r
+BASE_NAME            = RtLedStatusCodeLib\r
+COMPONENT_TYPE       = LIBRARY\r
+\r
+[sources.common]\r
+  RtLedStatusCode.c\r
+  RtLedStatusCode.h\r
+\r
+[includes.common]\r
+  $(EDK_SOURCE)\Foundation\r
+  $(EDK_SOURCE)\Foundation\Framework\r
+  $(EDK_SOURCE)\Foundation\Efi\r
+  .\r
+  $(EDK_SOURCE)\Foundation\Include\r
+  $(EDK_SOURCE)\Foundation\Efi\Include\r
+  $(EDK_SOURCE)\Foundation\Framework\Include\r
+  $(EDK_SOURCE)\Foundation\Include\IndustryStandard\r
+  $(EDK_SOURCE)\Foundation\Core\Dxe\r
+  $(EDK_SOURCE)\Foundation\Library\Dxe\Include\r
+\r
+[libraries.platform]\r
+\r
+[nmake.common]\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtMemoryStatusCode/RtMemoryStatusCode.c b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtMemoryStatusCode/RtMemoryStatusCode.c
new file mode 100644 (file)
index 0000000..28b5af5
--- /dev/null
@@ -0,0 +1,203 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2006, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  RtMemoryStatusCode.c\r
+   \r
+Abstract:\r
+\r
+  EFI lib to provide memory journal status code reporting routines.\r
+\r
+--*/\r
+\r
+#include "RtMemoryStatusCode.h"\r
+\r
+//\r
+// Global variables\r
+//\r
+PEI_STATUS_CODE_MEMORY_PPI  mStatusCodeMemoryPpi = { 0, 0, 0, 0 };\r
+\r
+//\r
+// Function implementations\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+RtMemoryReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Log a status code to a memory journal.  If no memory journal exists, \r
+  we will just return.\r
+\r
+Arguments:\r
+\r
+  Same as ReportStatusCode AP\r
+    \r
+Returns:\r
+\r
+  EFI_SUCCESS   This function always returns success\r
+\r
+--*/\r
+{\r
+  EFI_STATUS_CODE_ENTRY *CurrentEntry;\r
+  UINTN                 MaxEntry;\r
+\r
+  //\r
+  // We don't care to log debug codes.\r
+  //\r
+  if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
+    return EFI_SUCCESS;\r
+  }\r
+  //\r
+  // Update the latest entry in the journal.\r
+  //\r
+  MaxEntry = mStatusCodeMemoryPpi.Length / sizeof (EFI_STATUS_CODE_ENTRY);\r
+  if (!MaxEntry) {\r
+    //\r
+    // If we don't have any entries, then we can return.\r
+    // This effectively means that no memory buffer was passed forward from PEI.\r
+    //\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
+  CurrentEntry = (EFI_STATUS_CODE_ENTRY *) (UINTN) (mStatusCodeMemoryPpi.Address + (mStatusCodeMemoryPpi.LastEntry * sizeof (EFI_STATUS_CODE_ENTRY)));\r
+\r
+  mStatusCodeMemoryPpi.LastEntry = (mStatusCodeMemoryPpi.LastEntry + 1) % MaxEntry;\r
+  if (mStatusCodeMemoryPpi.LastEntry == mStatusCodeMemoryPpi.FirstEntry) {\r
+    mStatusCodeMemoryPpi.FirstEntry = (mStatusCodeMemoryPpi.FirstEntry + 1) % MaxEntry;\r
+  }\r
+\r
+  CurrentEntry->Type      = CodeType;\r
+  CurrentEntry->Value     = Value;\r
+  CurrentEntry->Instance  = Instance;\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+RtMemoryInitializeStatusCode (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Initialization routine.\r
+  Allocates heap space for storing Status Codes.\r
+  Installs a PPI to point to that heap space.\r
+  Installs a callback to switch to memory.\r
+  Installs a callback to \r
+\r
+Arguments: \r
+\r
+  (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
+\r
+Returns: \r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                  Status;\r
+  VOID                        *HobList;\r
+  PEI_STATUS_CODE_MEMORY_PPI  **StatusCodeMemoryPpi;\r
+\r
+  //\r
+  // Locate the HOB that contains the PPI structure for the memory journal\r
+  // We don't check for more than one.\r
+  //\r
+  EfiLibGetSystemConfigurationTable (\r
+    &gEfiHobListGuid,\r
+    &HobList\r
+    );\r
+  Status = GetNextGuidHob (\r
+            &HobList,\r
+            &gPeiStatusCodeMemoryPpiGuid,\r
+            (VOID **) &StatusCodeMemoryPpi,\r
+            NULL\r
+            );\r
+  if (EFI_ERROR (Status)) {\r
+    return ;\r
+  }\r
+  //\r
+  // Copy data to our structure since the HOB will go away at runtime\r
+  //\r
+  // BUGBUG: Virtualize for RT\r
+  //\r
+  mStatusCodeMemoryPpi.FirstEntry = (*StatusCodeMemoryPpi)->FirstEntry;\r
+  mStatusCodeMemoryPpi.LastEntry  = (*StatusCodeMemoryPpi)->LastEntry;\r
+  mStatusCodeMemoryPpi.Address    = (*StatusCodeMemoryPpi)->Address;\r
+  mStatusCodeMemoryPpi.Length     = (*StatusCodeMemoryPpi)->Length;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+PlaybackStatusCodes (\r
+  IN EFI_REPORT_STATUS_CODE   ReportStatusCode\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Call the input ReportStatusCode function with every status code recorded in\r
+  the journal.\r
+\r
+Arguments: \r
+\r
+  ReportStatusCode    ReportStatusCode function to call.\r
+\r
+Returns: \r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  UINTN                 MaxEntry;\r
+  EFI_STATUS_CODE_ENTRY *CurrentEntry;\r
+  UINTN                 Counter;\r
+\r
+  if (ReportStatusCode == RtMemoryReportStatusCode) {\r
+    return ;\r
+  }\r
+  //\r
+  // Playback prior status codes to current listeners\r
+  //\r
+  MaxEntry = mStatusCodeMemoryPpi.Length / sizeof (EFI_STATUS_CODE_ENTRY);\r
+  for (Counter = mStatusCodeMemoryPpi.FirstEntry; Counter != mStatusCodeMemoryPpi.LastEntry; Counter++) {\r
+    //\r
+    // Check if we have to roll back to beginning of queue buffer\r
+    //\r
+    if (Counter == MaxEntry) {\r
+      Counter = 0;\r
+    }\r
+    //\r
+    // Play current entry\r
+    //\r
+    CurrentEntry = (EFI_STATUS_CODE_ENTRY *) (UINTN) (mStatusCodeMemoryPpi.Address + (Counter * sizeof (EFI_STATUS_CODE_ENTRY)));\r
+    ReportStatusCode (\r
+      CurrentEntry->Type,\r
+      CurrentEntry->Value,\r
+      CurrentEntry->Instance,\r
+      NULL,\r
+      NULL\r
+      );\r
+  }\r
+}\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtMemoryStatusCode/RtMemoryStatusCode.h b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtMemoryStatusCode/RtMemoryStatusCode.h
new file mode 100644 (file)
index 0000000..15db58c
--- /dev/null
@@ -0,0 +1,45 @@
+/*++\r
+\r
+Copyright (c) 2004, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  RtMemoryStatusCode.h\r
+   \r
+Abstract:\r
+\r
+  EFI library to provide status code reporting via a memory journal.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_RT_MEMORY_STATUS_CODE_H_\r
+#define _EFI_RT_MEMORY_STATUS_CODE_H_\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include "Tiano.h"\r
+#include "Pei.h"\r
+#include "TianoCommon.h"\r
+#include "EfiRuntimeLib.h"\r
+#include "EfiHobLib.h"\r
+#include "RtPlatformStatusCodeLib.h"\r
+\r
+//\r
+// Consumed protocols\r
+//\r
+#include EFI_PPI_CONSUMER (StatusCodeMemory)\r
+\r
+//\r
+// Consumed GUID\r
+//\r
+#include EFI_GUID_DEFINITION (Hob)\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtMemoryStatusCode/RtMemoryStatusCode.inf b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtMemoryStatusCode/RtMemoryStatusCode.inf
new file mode 100644 (file)
index 0000000..a5c2846
--- /dev/null
@@ -0,0 +1,49 @@
+#/*++\r
+#\r
+# Copyright (c) 2004, Intel Corporation                                                         \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
+# \r
+#  Module Name:\r
+#\r
+#    RtMemoryStatusCode.inf\r
+#\r
+#  Abstract:\r
+#\r
+#    Library producing a memory status code functionality.\r
+#\r
+#--*/\r
+\r
+[defines]\r
+BASE_NAME            = RtMemoryStatusCodeLib\r
+COMPONENT_TYPE       = LIBRARY\r
+\r
+[sources.common]\r
+  RtMemoryStatusCode.c\r
+  RtMemoryStatusCode.h\r
+\r
+[includes.common]\r
+  $(EDK_SOURCE)\Foundation\r
+  $(EDK_SOURCE)\Foundation\Framework\r
+  $(EDK_SOURCE)\Foundation\Efi\r
+  .\r
+  ..\Include\r
+  $(EDK_SOURCE)\Foundation\Include\r
+  $(EDK_SOURCE)\Foundation\Efi\Include\r
+  $(EDK_SOURCE)\Foundation\Framework\Include\r
+  $(EDK_SOURCE)\Foundation\Include\IndustryStandard\r
+  $(EDK_SOURCE)\Foundation\Core\Dxe\r
+  $(EDK_SOURCE)\Foundation\Library\Dxe\Include\r
+  $(EDK_SOURCE)\Foundation\Include\Pei\r
+  $(EDK_SOURCE)\Foundation\Library\Pei\Include\r
+\r
+\r
+[libraries.platform]\r
+  EdkPpiLib\r
+\r
+[nmake.common]\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPlatformStatusCode/Nt32/RtPlatformStatusCode.c b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPlatformStatusCode/Nt32/RtPlatformStatusCode.c
new file mode 100644 (file)
index 0000000..46aedad
--- /dev/null
@@ -0,0 +1,144 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2006, Intel Corporation                                                         \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
+\r
+Module Name:\r
+\r
+  RtPlatformStatusCode.c \r
+   \r
+Abstract:\r
+\r
+  Contains NT32 specific implementations required to use status codes.\r
+\r
+--*/\r
+\r
+//\r
+// Statements that include other files.\r
+//\r
+#include "Tiano.h"\r
+#include "EfiCommonLib.h"\r
+#include "EfiRuntimeLib.h"\r
+#include "EfiStatusCode.h"\r
+#include "EfiHobLib.h"\r
+#include "RtMemoryStatusCodeLib.h"\r
+#include "BsDataHubStatusCodeLib.h"\r
+\r
+//\r
+// Consumed protocols\r
+//\r
+#include EFI_ARCH_PROTOCOL_CONSUMER (StatusCode)\r
+\r
+//\r
+// GUID definitions\r
+//\r
+#include EFI_GUID_DEFINITION (Hob)\r
+\r
+//\r
+// Globals only work at BootService Time. NOT at Runtime!\r
+//\r
+EFI_REPORT_STATUS_CODE  mPeiReportStatusCode;\r
+\r
+//\r
+// Function implementations\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+RtPlatformReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Call all status code listeners in the MonoStatusCode.\r
+\r
+Arguments:\r
+\r
+  Same as ReportStatusCode service\r
+  \r
+Returns:\r
+\r
+  EFI_SUCCESS     Always returns success.\r
+\r
+--*/\r
+{\r
+  RtMemoryReportStatusCode (CodeType, Value, Instance, CallerId, Data);\r
+  if (EfiAtRuntime ()) {\r
+    //\r
+    // For now all we do is post code at runtime\r
+    //\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
+  BsDataHubReportStatusCode (CodeType, Value, Instance, CallerId, Data);\r
+\r
+  //\r
+  // Call back into PEI to get status codes.  This is because SecMain contains\r
+  // status code that reports to Win32.\r
+  //\r
+  if (mPeiReportStatusCode != NULL) {\r
+    return mPeiReportStatusCode (CodeType, Value, Instance, CallerId, Data);\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+RtPlatformInitializeStatusCode (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Initialize the status code listeners.\r
+\r
+Arguments:\r
+\r
+  (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  EFI_STATUS  Status;\r
+  VOID        *HobList;\r
+  VOID        *Pointer;\r
+\r
+  RtMemoryInitializeStatusCode (ImageHandle, SystemTable);\r
+  BsDataHubInitializeStatusCode (ImageHandle, SystemTable);\r
+\r
+  //\r
+  // Play any prior status codes to the data hub.\r
+  //\r
+  PlaybackStatusCodes (BsDataHubReportStatusCode);\r
+\r
+  //\r
+  // If PEI has a ReportStatusCode callback find it and use it before StdErr\r
+  // is connected.\r
+  //\r
+  mPeiReportStatusCode  = NULL;\r
+\r
+  Status                = EfiLibGetSystemConfigurationTable (&gEfiHobListGuid, &HobList);\r
+  if (!EFI_ERROR (Status)) {\r
+    Status = GetNextGuidHob (&HobList, &gEfiStatusCodeRuntimeProtocolGuid, &Pointer, NULL);\r
+    if (!EFI_ERROR (Status)) {\r
+      mPeiReportStatusCode = (EFI_REPORT_STATUS_CODE) (*(UINTN *) Pointer);\r
+    }\r
+  }\r
+}\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPlatformStatusCode/Nt32/RtPlatformStatusCode.inf b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPlatformStatusCode/Nt32/RtPlatformStatusCode.inf
new file mode 100644 (file)
index 0000000..a76c09c
--- /dev/null
@@ -0,0 +1,47 @@
+#/*++\r
+#\r
+# Copyright (c) 2004, Intel Corporation                                                         \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
+# \r
+#  Module Name:\r
+#\r
+#    RtPlatformStatusCode.inf\r
+#\r
+#  Abstract:\r
+#\r
+#    Library selecting the listeners for the platform\r
+#\r
+#--*/\r
+\r
+[defines]\r
+BASE_NAME            = RtPlatformStatusCodeLib\r
+COMPONENT_TYPE       = LIBRARY\r
+\r
+[sources.common]\r
+  RtPlatformStatusCode.c\r
+\r
+[includes.common]\r
+  $(EDK_SOURCE)\Foundation\Framework\r
+  $(EDK_SOURCE)\Foundation\r
+  $(EDK_SOURCE)\Foundation\Efi\r
+  .\r
+  ..\..\Include\r
+  $(EDK_SOURCE)\Foundation\Include\r
+  $(EDK_SOURCE)\Foundation\Efi\Include\r
+  $(EDK_SOURCE)\Foundation\Framework\Include\r
+  $(EDK_SOURCE)\Foundation\Include\IndustryStandard\r
+  $(EDK_SOURCE)\Foundation\Core\Dxe\r
+  $(EDK_SOURCE)\Foundation\Library\Dxe\Include\r
+\r
+[libraries.common]\r
+  HobLib\r
+  RtMemoryStatusCodeLib\r
+  BsDataHubStatusCodeLib\r
+\r
+[nmake.common]\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPort80StatusCode/RtPort80StatusCode.c b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPort80StatusCode/RtPort80StatusCode.c
new file mode 100644 (file)
index 0000000..24f3aa4
--- /dev/null
@@ -0,0 +1,63 @@
+/*++\r
+\r
+Copyright (c) 2004 - 2007, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  RtPort80StatusCode.c\r
+   \r
+Abstract:\r
+\r
+  Lib to provide port 80 status code reporting Routines. This routine\r
+  does not use PPI's but is monolithic.\r
+\r
+  In general you should use PPI's, but some times a monolithic driver\r
+  is better. The best justification for monolithic code is debug.\r
+\r
+--*/\r
+\r
+#include "RtPort80StatusCode.h"\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+RtPort80ReportStatusCode (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 * CallerId,\r
+  IN EFI_STATUS_CODE_DATA     * Data OPTIONAL\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Provide a port 80 status code\r
+\r
+Arguments:\r
+\r
+  Same as ReportStatusCode PPI\r
+    \r
+Returns:\r
+\r
+  EFI_SUCCESS   Always returns success.\r
+\r
+--*/\r
+{\r
+  UINT8 Port80Code;\r
+\r
+  //\r
+  // Progress or error code, Output Port 80h card\r
+  //\r
+  if (CodeTypeToPostCode (CodeType, Value, &Port80Code)) {\r
+    IoWrite8 (0x80, Port80Code);\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPort80StatusCode/RtPort80StatusCode.h b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPort80StatusCode/RtPort80StatusCode.h
new file mode 100644 (file)
index 0000000..c9bcf21
--- /dev/null
@@ -0,0 +1,33 @@
+/*++\r
+\r
+Copyright (c) 2004, Intel Corporation                                                         \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
+\r
+Module Name:\r
+  \r
+  RtPort80StatusCode.h\r
+   \r
+Abstract:\r
+\r
+  Lib to provide status code reporting via port 80.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_PORT_80_STATUS_CODE_H_\r
+#define _EFI_PORT_80_STATUS_CODE_H_\r
+\r
+//\r
+// Statements that include other files\r
+//\r
+#include "Tiano.h"\r
+#include "EfiCommonLib.h"\r
+#include "EfiRuntimeLib.h"\r
+#include "EfiStatusCode.h"\r
+\r
+#endif\r
diff --git a/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPort80StatusCode/RtPort80StatusCode.inf b/EdkCompatibilityPkg/Sample/Platform/Generic/RuntimeDxe/StatusCode/Lib/RtPort80StatusCode/RtPort80StatusCode.inf
new file mode 100644 (file)
index 0000000..b572c20
--- /dev/null
@@ -0,0 +1,44 @@
+#/*++\r
+#\r
+# Copyright (c) 2004, Intel Corporation                                                         \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
+# \r
+#  Module Name:\r
+#\r
+#    RtPort80StatusCode.inf\r
+#\r
+#  Abstract:\r
+#\r
+#    Library producing a port 80 status code functionality.\r
+#\r
+#--*/\r
+\r
+[defines]\r
+BASE_NAME            = RtPort80StatusCodeLib\r
+COMPONENT_TYPE       = LIBRARY\r
+\r
+[sources.common]\r
+  RtPort80StatusCode.c\r
+  RtPort80StatusCode.h\r
+\r
+[includes.common]\r
+  $(EDK_SOURCE)\Foundation\r
+  $(EDK_SOURCE)\Foundation\Framework\r
+  $(EDK_SOURCE)\Foundation\Efi\r
+  .\r
+  $(EDK_SOURCE)\Foundation\Include\r
+  $(EDK_SOURCE)\Foundation\Efi\Include\r
+  $(EDK_SOURCE)\Foundation\Framework\Include\r
+  $(EDK_SOURCE)\Foundation\Include\IndustryStandard\r
+  $(EDK_SOURCE)\Foundation\Core\Dxe\r
+  $(EDK_SOURCE)\Foundation\Library\Dxe\Include\r
+\r
+[libraries.platform]\r
+\r
+[nmake.common]\r