summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/StatusCode/Pei
diff options
context:
space:
mode:
Diffstat (limited to 'EdkModulePkg/Universal/StatusCode/Pei')
-rw-r--r--EdkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c151
-rw-r--r--EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c146
-rw-r--r--EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.h139
-rw-r--r--EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.msa111
-rw-r--r--EdkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c169
5 files changed, 0 insertions, 716 deletions
diff --git a/EdkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c b/EdkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c
deleted file mode 100644
index c49750b2dd..0000000000
--- a/EdkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/** @file
- Memory status code worker in PEI.
-
- 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: MemoryStatusCodeWorker.c
-
-**/
-
-#include "PeiStatusCode.h"
-
-/**
- Create one memory status code GUID'ed HOB, use PacketIndex
- to identify the packet.
-
- @param PacketIndex Index of records packet.
-
- @return Always return pointer of memory status code packet.
-
-**/
-STATIC
-MEMORY_STATUSCODE_PACKET_HEADER *
-CreateMemoryStatusCodePacket (
- UINT16 PacketIndex
- )
-{
- MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
-
- //
- // Build GUID'ed HOB with PCD defined size.
- //
- PacketHeader =
- (MEMORY_STATUSCODE_PACKET_HEADER *) BuildGuidHob (
- &gMemoryStatusCodeRecordGuid,
- PcdGet16 (PcdStatusCodeMemorySize) *
- 1024 +
- sizeof (MEMORY_STATUSCODE_PACKET_HEADER)
- );
- ASSERT (PacketHeader != NULL);
-
- PacketHeader->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024)/ sizeof (MEMORY_STATUSCODE_RECORD);
- PacketHeader->PacketIndex = PacketIndex;
- PacketHeader->RecordIndex = 0;
-
- return PacketHeader;
-}
-
-
-
-/**
- Initialize memory status code.
- Create one GUID'ed HOB with PCD defined size. If create required size
- GUID'ed HOB failed, then ASSERT().
-
- @return The function always return EFI_SUCCESS
-
-**/
-EFI_STATUS
-MemoryStatusCodeInitializeWorker (
- VOID
- )
-{
- //
- // Create first memory status code GUID'ed HOB.
- //
- CreateMemoryStatusCodePacket (0);
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Report status code into GUID'ed HOB..
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-MemoryStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance
- )
-{
-
- EFI_PEI_HOB_POINTERS Hob;
- MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
- MEMORY_STATUSCODE_RECORD *Record = NULL;
- UINT16 PacketIndex = 0;;
-
- //
- // Journal GUID'ed HOBs to find empty record entry, if found, then save status code in it.
- // otherwise, create a new GUID'ed HOB.
- //
- Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
- while (Hob.Raw != NULL) {
- PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *) GET_GUID_HOB_DATA (Hob.Guid);
-
- //
- // Check whether pccket is full or not.
- //
- if (PacketHeader->RecordIndex < PacketHeader->MaxRecordsNumber) {
- Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);
- Record = &Record[PacketHeader->RecordIndex++];
- break;
- }
- //
- // Cache number of found packet in PacketIndex.
- //
- PacketIndex++;
-
- Hob.Raw = GetNextGuidHob (&gMemoryStatusCodeRecordGuid, Hob.Raw);
- }
-
- if (NULL == Record) {
- //
- // In order to save status code , create new packet.
- //
- PacketHeader = CreateMemoryStatusCodePacket (PacketIndex);
-
- Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);
- Record = &Record[PacketHeader->RecordIndex++];
- }
-
- Record->CodeType = CodeType;
- Record->Instance = Instance;
- Record->Value = Value;
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c b/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c
deleted file mode 100644
index d47be70661..0000000000
--- a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c
+++ /dev/null
@@ -1,146 +0,0 @@
-
-/** @file
- Generic PeiStatusCode Module.
-
- 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: PeiStatusCode.c
-
-**/
-
-#include "PeiStatusCode.h"
-
-STATIC
-EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {
- ReportDispatcher
- };
-
-STATIC
-EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor = {
- EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
- &gEfiPeiStatusCodePpiGuid,
- &mStatusCodePpi
- };
-
-/**
- Report status code to all supported device.
-
-
- @param PeiServices
-
- @param CodeType Indicates the type of status code being reported.
- The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
- @param Value Describes the current status of a hardware or software entity.
- This includes information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance
- information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- @param Data This optional parameter may be used to pass additional data.
- Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
- The contents of this data type may have additional GUID-specific data. The standard GUIDs and
- their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
-
- @return Always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-ReportDispatcher (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
- SerialStatusCodeReportWorker (
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
- MemoryStatusCodeReportWorker (
- CodeType,
- Value,
- Instance
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
- OemHookStatusCodeReport (
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Initialize PEI status codes and publish the status code
- PPI.
-
- @param FfsHeader FV this PEIM was loaded from.
- @param PeiServices General purpose services available to every PEIM.
-
- @return The function always returns success.
-
-**/
-EFI_STATUS
-PeiStatusCodeDriverEntry (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
-
- //
- // Dispatch initialization request to sub-statuscode-devices.
- // If enable UseSerial, then initialize serial port.
- // if enable UseMemory, then initialize memory status code worker.
- // if enable UseOEM, then initialize Oem status code.
- //
- if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
- Status = SerialPortInitialize();
- ASSERT_EFI_ERROR (Status);
- }
- if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
- Status = MemoryStatusCodeInitializeWorker ();
- ASSERT_EFI_ERROR (Status);
- }
- if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
- Status = OemHookStatusCodeInitialize ();
- ASSERT_EFI_ERROR (Status);
- }
-
- //
- // Install PeiStatusCodePpi.
- // PeiServices use this Ppi to output status code.
- // use library
- Status = PeiServicesInstallPpi (&mStatusCodePpiDescriptor);
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
-
diff --git a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.h b/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.h
deleted file mode 100644
index 2a8e0dd5dc..0000000000
--- a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.h
+++ /dev/null
@@ -1,139 +0,0 @@
-
-/** @file
- Heade file of status code PEIM
-
- 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: PeiStatusCode.h
-
-**/
-
-#ifndef __PEI_STATUS_CODE_H__
-#define __PEI_STATUS_CODE_H__
-
-
-/**
- Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-SerialStatusCodeReportWorker (
- 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
- );
-
-
-/**
- Initialize memory status code.
- Create one GUID'ed HOB with PCD defined size. If create required size
- GUID'ed HOB failed, then ASSERT().
-
- @return The function always return EFI_SUCCESS
-
-**/
-EFI_STATUS
-MemoryStatusCodeInitializeWorker (
- VOID
- );
-
-/**
- Report status code into GUID'ed HOB.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-MemoryStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance
- );
-
-/**
- Report status code to all supported device.
-
-
- @param PeiServices
-
- @param Type Indicates the type of status code being reported.
- The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
- @param Value Describes the current status of a hardware or software entity.
- This includes information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance
- information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- @param Data This optional parameter may be used to pass additional data.
- Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
- The contents of this data type may have additional GUID-specific data. The standard GUIDs and
- their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
-
- @return Always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-ReportDispatcher (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE Type,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-#endif
diff --git a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.msa b/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.msa
deleted file mode 100644
index d0cd00d7fa..0000000000
--- a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.msa
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd" xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>PeiStatusCode</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>1EC0F53A-FDE0-4576-8F25-7A1A410F58EB</GuidValue>
- <Version>1.0</Version>
- <Abstract>Generic Status code Pei driver</Abstract>
- <Description>Customized output devices based on feature flags.</Description>
- <Copyright>Copyright (c) 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>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>PeiStatusCode</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>SerialPortLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeiServicesLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>OemHookStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeimEntryPoint</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>PeiStatusCode.h</Filename>
- <Filename>SerialStatusCodeWorker.c</Filename>
- <Filename>MemoryStausCodeWorker.c</Filename>
- <Filename>PeiStatusCode.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <PPIs>
- <Ppi Usage="ALWAYS_CONSUMED">
- <PpiCName>gEfiPeiStatusCodePpiGuid</PpiCName>
- </Ppi>
- </PPIs>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gMemoryStatusCodeRecordGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>PeiStatusCodeDriverEntry</ModuleEntryPoint>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseSerial</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseMemory</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseOEM</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdStatusCodeMemorySize</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c b/EdkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c
deleted file mode 100644
index 0e3f47e125..0000000000
--- a/EdkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c
+++ /dev/null
@@ -1,169 +0,0 @@
-
-/** @file
- Serial I/O status code reporting worker.
-
- 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: SerialStatusCodeWorker.c
-
-**/
-
-#include "PeiStatusCode.h"
-
-/**
- Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-SerialStatusCodeReportWorker (
- 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
- )
-{
- CHAR8 *Filename;
- CHAR8 *Description;
- CHAR8 *Format;
- CHAR8 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
- UINT32 ErrorLevel;
- UINT32 LineNumber;
- UINTN CharCount;
- VA_LIST Marker;
- EFI_DEBUG_INFO *DebugInfo;
-
- Buffer[0] = '\0';
-
- if (Data != NULL &&
- ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {
- //
- // Print ASSERT() information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "\n\rPEI_ASSERT!: %a (%d): %a\n\r",
- Filename,
- LineNumber,
- Description
- );
- } else if (Data != NULL &&
- ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
- //
- // Print DEBUG() information into output buffer.
- //
- CharCount = AsciiVSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- Format,
- Marker
- );
- } else if (Data != NULL &&
- CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&
- (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {
- //
- // Print specific data into output buffer.
- //
- DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);
- Marker = (VA_LIST) (DebugInfo + 1);
- Format = (CHAR8 *) (((UINT64 *) Marker) + 12);
-
- CharCount = AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
- //
- // Print ERROR information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "ERROR: C%x:V%x I%x",
- CodeType,
- Value,
- Instance
- );
-
- //
- // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.
- //
-
- if (CallerId != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),
- " %g",
- CallerId
- );
- }
-
- if (Data != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),
- " %x",
- Data
- );
- }
-
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),
- "\n\r"
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "PROGRESS CODE: V%x I%x\n\r",
- Value,
- Instance
- );
- } else {
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "Undefined: C%x:V%x I%x\n\r",
- CodeType,
- Value,
- Instance
- );
- }
-
- //
- // Callout to SerialPort Lib function to do print.
- //
- SerialPortWrite ((UINT8 *) Buffer, CharCount);
-
- return EFI_SUCCESS;
-}