summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/StatusCode
diff options
context:
space:
mode:
authorbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>2006-04-21 22:54:32 +0000
committerbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>2006-04-21 22:54:32 +0000
commit878ddf1fc3540a715f63594ed22b6929e881afb4 (patch)
treec56c44dac138137b510e1fba7c3efe5e4d84bea2 /EdkModulePkg/Universal/StatusCode
downloadedk2-878ddf1fc3540a715f63594ed22b6929e881afb4.zip
edk2-878ddf1fc3540a715f63594ed22b6929e881afb4.tar.gz
edk2-878ddf1fc3540a715f63594ed22b6929e881afb4.tar.bz2
Initial import.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Universal/StatusCode')
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/DebugAssert.c231
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ia32/Ia32StatusCode.c75
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ia32/Ia32StatusCode.dxs26
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ipf/IpfStatusCode.c126
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ipf/IpfStatusCode.dxs27
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.c172
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.h64
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.mbd55
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.msa77
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/build.xml47
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/x64/x64StatusCode.c75
-rw-r--r--EdkModulePkg/Universal/StatusCode/RuntimeDxe/x64/x64StatusCode.dxs27
12 files changed, 1002 insertions, 0 deletions
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/DebugAssert.c b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/DebugAssert.c
new file mode 100644
index 0000000..75f0ed1
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/DebugAssert.c
@@ -0,0 +1,231 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ DebugAssert.c
+
+Abstract:
+
+ Produce EfiDebugAssertProtocol to enable EfiUtilityLib to function.
+ The EfiUtilityLib is used by the EFI shell!
+
+--*/
+
+#include "StatusCode.h"
+
+EFI_STATUS
+EFIAPI
+StatusCodeDebugAssert (
+ IN EFI_DEBUG_ASSERT_PROTOCOL *This,
+ IN CHAR8 *FileName,
+ IN INTN LineNumber,
+ IN CHAR8 *Description
+ );
+
+EFI_STATUS
+EFIAPI
+StatusCodeDebugPrint (
+ IN EFI_DEBUG_ASSERT_PROTOCOL *This,
+ IN UINTN ErrorLevel,
+ IN CHAR8 *Format,
+ IN VA_LIST Marker
+ );
+
+EFI_STATUS
+EFIAPI
+StatusCodePostCode (
+ IN EFI_DEBUG_ASSERT_PROTOCOL * This,
+ IN UINT16 PostCode,
+ IN CHAR8 *PostCodeString OPTIONAL
+ );
+
+EFI_STATUS
+EFIAPI
+StatusCodeGetErrorLevel (
+ IN EFI_DEBUG_ASSERT_PROTOCOL *This,
+ IN UINTN *ErrorLevel
+ );
+
+EFI_STATUS
+EFIAPI
+StatusCodeSetErrorLevel (
+ IN EFI_DEBUG_ASSERT_PROTOCOL *This,
+ IN UINTN ErrorLevel
+ );
+
+//
+// Protocol instance, there can be only one.
+//
+EFI_HANDLE mHandle = NULL;
+EFI_DEBUG_ASSERT_PROTOCOL mDebugAssertProtocol = {
+ StatusCodeDebugAssert,
+ StatusCodeDebugPrint,
+ StatusCodePostCode,
+ StatusCodeGetErrorLevel,
+ StatusCodeSetErrorLevel
+};
+
+//
+// Function implementations
+//
+EFI_STATUS
+EFIAPI
+StatusCodeDebugAssert (
+ IN EFI_DEBUG_ASSERT_PROTOCOL *This,
+ IN CHAR8 *FileName,
+ IN INTN LineNumber,
+ IN CHAR8 *Description
+ )
+/*++
+
+Routine Description:
+
+ Worker function for ASSERT (). If Error Logging hub is loaded log ASSERT
+ information. If Error Logging hub is not loaded CpuBreakpoint ().
+
+Arguments:
+
+ This - Protocol instance.
+ FileName - File name of failing routine.
+ LineNumber - Line number of failing ASSERT().
+ Description - Description, usually the assertion,
+
+Returns:
+
+ EFI_SUCCESS The function always completes successfully.
+
+--*/
+{
+ DebugAssert (FileName, LineNumber, Description);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+StatusCodeDebugPrint (
+ IN EFI_DEBUG_ASSERT_PROTOCOL *This,
+ IN UINTN ErrorLevel,
+ IN CHAR8 *Format,
+ IN VA_LIST Marker
+ )
+/*++
+
+Routine Description:
+
+ Worker function for DEBUG (). If Error Logging hub is loaded log ASSERT
+ information. If Error Logging hub is not loaded do nothing.
+
+Arguments:
+
+ This - Protocol Instance.
+ ErrorLevel - If error level is set do the debug print.
+ Format - String to use for the print, followed by Print arguments.
+
+Returns:
+
+ EFI_SUCCESS The function always completes successfully.
+
+--*/
+{
+ CHAR8 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
+
+ AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);
+ DebugPrint (ErrorLevel, Buffer);
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+StatusCodeGetErrorLevel (
+ IN EFI_DEBUG_ASSERT_PROTOCOL *This,
+ IN UINTN *ErrorLevel
+ )
+{
+ *ErrorLevel = PcdGet32(PcdDebugPrintErrorLevel);
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+StatusCodeSetErrorLevel (
+ IN EFI_DEBUG_ASSERT_PROTOCOL *This,
+ IN UINTN ErrorLevel
+ )
+{
+ return EFI_UNSUPPORTED;
+}
+
+EFI_STATUS
+EFIAPI
+StatusCodePostCode (
+ IN EFI_DEBUG_ASSERT_PROTOCOL * This,
+ IN UINT16 PostCode,
+ IN CHAR8 *PostCodeString OPTIONAL
+ )
+/*++
+
+Routine Description:
+
+ Write the code to IO ports 80 and 81.
+
+Arguments:
+
+ This - Protocol Instance.
+ PostCode - Code to write
+ PostCodeString - String, currently ignored.
+
+Returns:
+
+ EFI_SUCCESS The function always completes successfully.
+
+--*/
+{
+ IoWrite8 (0x80, (UINT8) (PostCode & 0xff));
+ IoWrite8 (0x81, (UINT8) (PostCode >> 8));
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+InstallStatusCodeDebugAssert (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Install the status code debug assert protocol
+
+Arguments:
+
+ None
+
+Returns:
+
+ Results of call to InstallProtocolInterface.
+
+--*/
+{
+
+ DEBUG_CODE (
+ gBS->InstallProtocolInterface (
+ &mHandle,
+ &gEfiDebugAssertProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mDebugAssertProtocol
+ );
+ );
+
+ return EFI_SUCCESS;
+}
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ia32/Ia32StatusCode.c b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ia32/Ia32StatusCode.c
new file mode 100644
index 0000000..d2e1009
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ia32/Ia32StatusCode.c
@@ -0,0 +1,75 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ Ia32StatusCode.c
+
+Abstract:
+
+ Installs the ReportStatusCode runtime service.
+
+--*/
+
+#include "StatusCode.h"
+
+//
+//
+//
+EFI_HANDLE gStatusCodeHandle = NULL;
+
+const EFI_STATUS_CODE_PROTOCOL gStatusCodeInstance = {
+ StatusCodeReportStatusCode
+};
+
+//
+// Define the driver entry point
+//
+EFI_STATUS
+EFIAPI
+InstallStatusCode (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ Install the ReportStatusCode runtime service.
+
+Arguments:
+
+ ImageHandle Image handle of the loaded driver
+ SystemTable Pointer to the System Table
+
+Returns:
+
+ EFI_SUCCESS The function always returns success.
+
+--*/
+{
+ EFI_STATUS Status;
+
+ //
+ // Initialize RT status code
+ //
+ InitializeStatusCode (ImageHandle, SystemTable);
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &gStatusCodeHandle,
+ &gEfiStatusCodeRuntimeProtocolGuid,
+ &gStatusCodeInstance,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ia32/Ia32StatusCode.dxs b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ia32/Ia32StatusCode.dxs
new file mode 100644
index 0000000..6371258
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ia32/Ia32StatusCode.dxs
@@ -0,0 +1,26 @@
+#/*++
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+# Ia32StatusCode.dxs
+#
+# Abstract:
+#
+# Dependency expression source file.
+#
+#--*/
+#include <AutoGen.h>
+#include <DxeDepex.h>
+
+DEPENDENCY_START
+ EFI_DATA_HUB_PROTOCOL_GUID AND EFI_CPU_IO_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ipf/IpfStatusCode.c b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ipf/IpfStatusCode.c
new file mode 100644
index 0000000..62564c0
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ipf/IpfStatusCode.c
@@ -0,0 +1,126 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ IpfStatusCode.c
+
+Abstract:
+
+ Contains the IPF installation function and an ESAL entry.
+
+--*/
+
+#include "StatusCode.h"
+
+SAL_RETURN_REGS
+ReportStatusCodeEsalServicesClassCommonEntry (
+ IN UINT64 FunctionId,
+ IN UINT64 Arg2,
+ IN UINT64 Arg3,
+ IN UINT64 Arg4,
+ IN UINT64 Arg5,
+ IN UINT64 Arg6,
+ IN UINT64 Arg7,
+ IN UINT64 Arg8,
+ IN SAL_EXTENDED_SAL_PROC ExtendedSalProc,
+ IN BOOLEAN VirtualMode,
+ IN VOID *Global
+ )
+/*++
+
+Routine Description:
+
+ Main entry for Extended SAL ReportStatusCode Services
+
+Arguments:
+
+ FunctionId Function Id which needed to be called
+ Arg2 Efi status code type
+ Arg3 Efi status code value
+ Arg4 Instance number
+ Arg5 Caller Id
+ Arg6 Efi status code data
+ Arg7 Not used
+ Arg8 Not used
+ ExtendedSalProc Esal Proc pointer
+ VirtualMode If this function is called in virtual mode
+ Global This module's global variable pointer
+
+Returns:
+
+ SAL_RETURN_REGS
+
+--*/
+{
+ SAL_RETURN_REGS ReturnVal;
+
+ switch (FunctionId) {
+
+ case ReportStatusCodeService:
+ ReturnVal.Status = StatusCodeReportStatusCode (
+ (EFI_STATUS_CODE_TYPE) Arg2,
+ (EFI_STATUS_CODE_VALUE) Arg3,
+ (UINT32) Arg4,
+ (EFI_GUID *) Arg5,
+ (EFI_STATUS_CODE_DATA *) Arg6
+ );
+ break;
+
+ default:
+ ReturnVal.Status = EFI_SAL_INVALID_ARGUMENT;
+ break;
+ }
+
+ return ReturnVal;
+}
+
+EFI_STATUS
+EFIAPI
+InstallStatusCode (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ Install the ReportStatusCode runtime service.
+
+Arguments:
+
+ ImageHandle Image handle of the loaded driver
+ SystemTable Pointer to the System Table
+
+Returns:
+
+ EFI_SUCCESS The function always returns success.
+
+--*/
+{
+ //
+ // Initialize RT status code
+ //
+ InitializeStatusCode (ImageHandle, SystemTable);
+
+ //
+ // Initialize ESAL capabilities
+ //
+ RegisterEsalClass (
+ &gEfiExtendedSalStatusCodeServicesProtocolGuid,
+ NULL,
+ ReportStatusCodeEsalServicesClassCommonEntry,
+ StatusCode,
+ NULL
+ );
+
+ return EFI_SUCCESS;
+}
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ipf/IpfStatusCode.dxs b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ipf/IpfStatusCode.dxs
new file mode 100644
index 0000000..aaa3efe
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/Ipf/IpfStatusCode.dxs
@@ -0,0 +1,27 @@
+#/*++
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+# IpfStatusCode.dxs
+#
+# Abstract:
+#
+# Dependency expression source file.
+#
+#--*/
+
+#include <AutoGen.h>
+#include <DxeDepex.h>
+
+DEPENDENCY_START
+ EFI_DATA_HUB_PROTOCOL_GUID AND EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID
+DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.c b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.c
new file mode 100644
index 0000000..13b6426
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.c
@@ -0,0 +1,172 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ StatusCode.c
+
+Abstract:
+
+ Status Code Architectural Protocol implementation as defined in Tiano
+ Architecture Specification.
+
+ This driver also depends on the DataHub, and will log all status code info
+ to the DataHub. Fatal Errors are Printed to Standard Error (StdErr) and not
+ logged to the data hub (If you crash what good is the data in the data hub).
+
+ This driver has limited functionality at runtime and will not log to Data Hub
+ at runtime.
+
+ Notes:
+ This driver assumes the following ReportStatusCode strategy:
+ PEI -> uses PeiReportStatusCode
+ DXE IPL -> uses PeiReportStatusCode
+ early DXE -> uses PeiReportStatusCode via HOB
+ DXE -> This driver
+ RT -> This driver
+
+--*/
+
+#include "StatusCode.h"
+
+EFI_LOCK mStatusCodeLock;
+BOOLEAN mStatusCodeFlag = FALSE;
+
+//
+// Function implemenations
+//
+
+
+EFI_STATUS
+EFIAPI
+StatusCodeReportStatusCode (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+/*++
+
+Routine Description:
+
+ Calls into the platform library which dispatches the platform specific
+ listeners. For NT environments we still call back into PEI because the
+ ReportStatusCode functionality requires Win32 services and is built into
+ the SecMain.exe utility.
+
+Arguments:
+
+ (See Tiano Runtime Specification)
+
+Returns:
+
+ None
+
+--*/
+{
+ EFI_STATUS Status;
+
+ //
+ // Acquire the lock required to update mStatusCodeFlag
+ //
+ Status = EfiAcquireLockOrFail (&mStatusCodeLock);
+ if (EFI_ERROR (Status)) {
+ //
+ // Check for reentrancy of the lock
+ //
+ return EFI_DEVICE_ERROR;
+ }
+ //
+ // Check to see if we are already in the middle of a ReportStatusCode()
+ //
+ if (mStatusCodeFlag) {
+ EfiReleaseLock (&mStatusCodeLock);
+ return EFI_DEVICE_ERROR;
+ }
+ //
+ // Set the flag to show we are in the middle of a ReportStatusCode()
+ //
+ mStatusCodeFlag = TRUE;
+
+ //
+ // Release the lock for updating mStatusCodeFlag
+ //
+ EfiReleaseLock (&mStatusCodeLock);
+
+ //
+ // Go do the work required to report a status code
+ //
+ RtPlatformReportStatusCode (CodeType, Value, Instance, CallerId, Data);
+
+ //
+ // Acquire the lock required to update mStatusCodeFlag
+ //
+ Status = EfiAcquireLockOrFail (&mStatusCodeLock);
+ if (EFI_ERROR (Status)) {
+ //
+ // Check for reentrancy of the lock
+ //
+ return EFI_DEVICE_ERROR;
+ }
+ //
+ // Clear the flag to show we are no longer in the middle of a ReportStatusCode()
+ //
+ mStatusCodeFlag = FALSE;
+
+ //
+ // Release the lock for updating mStatusCodeFlag
+ //
+ EfiReleaseLock (&mStatusCodeLock);
+
+ return EFI_SUCCESS;
+}
+//
+// Protocol instance, there can be only one.
+//
+EFI_STATUS
+InitializeStatusCode (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ Install Driver to produce Report Status Code Arch Protocol
+
+Arguments:
+
+ (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
+
+Returns:
+
+ EFI_SUCCESS - Logging Hub protocol installed
+ Other - No protocol installed, unload driver.
+
+--*/
+{
+
+ EfiInitializeLock (&mStatusCodeLock, EFI_TPL_HIGH_LEVEL);
+
+ //
+ // Call the platform hook to initialize the different listeners.
+ //
+ RtPlatformStatusCodeInitialize ();
+
+ //
+ // Register a protocol that EfiUtilityLib can use to implement DEBUG () and ASSERT ()
+ // Macros.
+ //
+ InstallStatusCodeDebugAssert ();
+
+ return EFI_SUCCESS;
+}
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.h b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.h
new file mode 100644
index 0000000..cb4a4d9
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.h
@@ -0,0 +1,64 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ StatusCode.h
+
+Abstract:
+
+ EFI DXE/RT Status Code include file.
+
+--*/
+
+#ifndef _EFI_RUNTIME_STATUS_CODE_H_
+#define _EFI_RUNTIME_STATUS_CODE_H_
+
+//
+// Function prototypes
+//
+
+EFI_STATUS
+EFIAPI
+StatusCodeReportStatusCode (
+ IN EFI_STATUS_CODE_TYPE CodeType,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID * CallerId,
+ IN EFI_STATUS_CODE_DATA * Data OPTIONAL
+ )
+;
+
+EFI_STATUS
+InitializeStatusCode (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+EFI_STATUS
+InstallStatusCodeDebugAssert (
+ VOID
+ )
+;
+
+//
+// Driver entry point
+//
+EFI_STATUS
+EFIAPI
+InstallStatusCode (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+#endif
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.mbd b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.mbd
new file mode 100644
index 0000000..923914a
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.mbd
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+-->
+<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
+ <MbdHeader>
+ <BaseName>StatusCode</BaseName>
+ <Guid>9F455D3B-2B8A-4c06-960B-A71B9714B9CD</Guid>
+ <Version>0</Version>
+ <Description>FIX ME!</Description>
+ <Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
+ <License>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ </License>
+ <Created>2006-03-12 17:09</Created>
+ <Modified>2006-03-19 15:19</Modified>
+ </MbdHeader>
+ <Libraries>
+ <Library>UefiBootServicesTableLib</Library>
+ <Library>BaseLib</Library>
+ <Library>EdkDxeRuntimeDriverLib</Library>
+ <Library>UefiDriverEntryPoint</Library>
+ <Library>UefiLib</Library>
+ <Library>BasePrintLib</Library>
+ <Library>BaseDebugLibReportStatusCode</Library>
+ <Library>EdkRtPlatformStatusCodeLib</Library>
+ <Library>DxeIoLibCpuIo</Library>
+ <Library>BaseMemoryLib</Library>
+ <Library>DxeReportStatusCodeLib</Library>
+ <Library>EdkRtMemoryStatusCodeLib</Library>
+ <Library>EdkBsDataHubStatusCodeLib</Library>
+ <Library>DxeHobLib</Library>
+ <Library>DxeMemoryAllocationLib</Library>
+ <Library>EdkMemoryStatusCodeLib</Library>
+
+ <Arch ArchType="IPF">
+ <Library>EdkDxeSalLib</Library>
+ </Arch>
+ </Libraries>
+ <BuildOptions ToolChain="MSFT">
+ <ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>
+ </BuildOptions>
+</ModuleBuildDescription>
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.msa b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.msa
new file mode 100644
index 0000000..b0d888b
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.msa
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+-->
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
+ <MsaHeader>
+ <BaseName>StatusCode</BaseName>
+ <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
+ <ComponentType>RT_DRIVER</ComponentType>
+ <Guid>9F455D3B-2B8A-4c06-960B-A71B9714B9CD</Guid>
+ <Version>0</Version>
+ <Abstract>Component description file for DiskIo module.</Abstract>
+ <Description>FIX ME!</Description>
+ <Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
+ <License>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ </License>
+ <Specification>0</Specification>
+ <Created>2006-03-12 17:09</Created>
+ <Updated>2006-03-19 15:19</Updated>
+ </MsaHeader>
+ <LibraryClassDefinitions>
+ <LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">DxeRuntimeDriverLib</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">PrintLib</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">IoLib</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">EdkRtPlatformStatusCodeLib</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">EdkDxeSalLib</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">PcdLib</LibraryClass>
+ </LibraryClassDefinitions>
+ <SourceFiles>
+ <Filename>DebugAssert.c</Filename>
+ <Filename>StatusCode.c</Filename>
+ <Filename>StatusCode.h</Filename>
+ <Arch ArchType="IA32">
+ <Filename>Ia32\Ia32StatusCode.c</Filename>
+ <Filename>Ia32\Ia32StatusCode.dxs</Filename>
+ </Arch>
+ <Arch ArchType="X64">
+ <Filename>x64\x64StatusCode.c</Filename>
+ <Filename>x64\x64StatusCode.dxs</Filename>
+ </Arch>
+ <Arch ArchType="IPF">
+ <Filename>Ipf\IpfStatusCode.c</Filename>
+ <Filename>Ipf\IpfStatusCode.dxs</Filename>
+ </Arch>
+ </SourceFiles>
+ <Includes>
+ <PackageName>MdePkg</PackageName>
+ <PackageName>EdkModulePkg</PackageName>
+ </Includes>
+ <Protocols>
+ <Protocol Usage="ALWAYS_CONSUMED">DebugAssert</Protocol>
+ <Protocol Usage="ALWAYS_CONSUMED">ExtendedSalStatusCodeServices</Protocol>
+ </Protocols>
+ <Externs>
+ <Extern>
+ <ModuleEntryPoint>InstallStatusCode</ModuleEntryPoint>
+ </Extern>
+ </Externs>
+</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/build.xml b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/build.xml
new file mode 100644
index 0000000..994d073
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/build.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
+<project basedir="." default="StatusCode"><!--Apply external ANT tasks-->
+ <taskdef resource="GenBuild.tasks"/>
+ <taskdef resource="net/sf/antcontrib/antlib.xml"/>
+ <property environment="env"/>
+ <property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
+ <import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
+ <property name="MODULE_RELATIVE_PATH" value="Universal\StatusCode\RuntimeDxe"/>
+ <property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
+ <property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
+ <target name="StatusCode">
+ <GenBuild baseName="StatusCode" mbdFilename="${MODULE_DIR}\StatusCode.mbd" msaFilename="${MODULE_DIR}\StatusCode.msa"/>
+ </target>
+ <target depends="StatusCode_clean" name="clean"/>
+ <target depends="StatusCode_cleanall" name="cleanall"/>
+ <target name="StatusCode_clean">
+ <OutputDirSetup baseName="StatusCode" mbdFilename="${MODULE_DIR}\StatusCode.mbd" msaFilename="${MODULE_DIR}\StatusCode.msa"/>
+ <if>
+ <available file="${DEST_DIR_OUTPUT}\StatusCode_build.xml"/>
+ <then>
+ <ant antfile="${DEST_DIR_OUTPUT}\StatusCode_build.xml" target="clean"/>
+ </then>
+ </if>
+ <delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
+ </target>
+ <target name="StatusCode_cleanall">
+ <OutputDirSetup baseName="StatusCode" mbdFilename="${MODULE_DIR}\StatusCode.mbd" msaFilename="${MODULE_DIR}\StatusCode.msa"/>
+ <if>
+ <available file="${DEST_DIR_OUTPUT}\StatusCode_build.xml"/>
+ <then>
+ <ant antfile="${DEST_DIR_OUTPUT}\StatusCode_build.xml" target="cleanall"/>
+ </then>
+ </if>
+ <delete dir="${DEST_DIR_OUTPUT}"/>
+ <delete dir="${DEST_DIR_DEBUG}"/>
+ <delete>
+ <fileset dir="${BIN_DIR}" includes="**StatusCode*"/>
+ </delete>
+ </target>
+</project> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/x64/x64StatusCode.c b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/x64/x64StatusCode.c
new file mode 100644
index 0000000..4c8ad0c
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/x64/x64StatusCode.c
@@ -0,0 +1,75 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ x64StatusCode.c
+
+Abstract:
+
+ Installs the ReportStatusCode runtime service.
+
+--*/
+
+#include "StatusCode.h"
+
+//
+//
+//
+EFI_HANDLE gStatusCodeHandle = NULL;
+
+const EFI_STATUS_CODE_PROTOCOL gStatusCodeInstance = {
+ StatusCodeReportStatusCode
+};
+
+//
+// Define the driver entry point
+//
+EFI_STATUS
+EFIAPI
+InstallStatusCode (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+/*++
+
+Routine Description:
+
+ Install the ReportStatusCode runtime service.
+
+Arguments:
+
+ ImageHandle Image handle of the loaded driver
+ SystemTable Pointer to the System Table
+
+Returns:
+
+ EFI_SUCCESS The function always returns success.
+
+--*/
+{
+ EFI_STATUS Status;
+
+ //
+ // Initialize RT status code
+ //
+ InitializeStatusCode (ImageHandle, SystemTable);
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &gStatusCodeHandle,
+ &gEfiStatusCodeRuntimeProtocolGuid,
+ &gStatusCodeInstance,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/EdkModulePkg/Universal/StatusCode/RuntimeDxe/x64/x64StatusCode.dxs b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/x64/x64StatusCode.dxs
new file mode 100644
index 0000000..74cf23e
--- /dev/null
+++ b/EdkModulePkg/Universal/StatusCode/RuntimeDxe/x64/x64StatusCode.dxs
@@ -0,0 +1,27 @@
+#/*++
+#
+# Copyright (c) 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+# x64StatusCode.dxs
+#
+# Abstract:
+#
+# Dependency expression source file.
+#
+#--*/
+
+#include <AutoGen.h>
+#include <DxeDepex.h>
+
+DEPENDENCY_START
+ EFI_DATA_HUB_PROTOCOL_GUID AND EFI_CPU_IO_PROTOCOL_GUID
+DEPENDENCY_END