1) Check in Pei/Dxe status code;
2) OemHookStatusCodeLib and SerialPortLib class and null instance; 3) Remove all referenced code from EdkModulePkg,EdkNt32Pkg. 4) Add Nt32OemHookStatusCodeLib. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1067 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
145
EdkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c
Normal file
145
EdkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/** @file
|
||||
Memory status code worker in PEI.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
Module Name: MemoryStatusCodeWorker.c
|
||||
|
||||
**/
|
||||
|
||||
/**
|
||||
Create one memory status code GUID'ed HOB, use PacketIndex
|
||||
to identify the packet.
|
||||
|
||||
@param PacketIndex Index of records packet.
|
||||
|
||||
@return The function always return EFI_SUCCESS
|
||||
|
||||
**/
|
||||
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<6E><73> 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 <20><>Related Definitions<6E><73> 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;
|
||||
}
|
176
EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c
Normal file
176
EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c
Normal file
@@ -0,0 +1,176 @@
|
||||
|
||||
/** @file
|
||||
Generic PeiStatusCode Module.
|
||||
|
||||
// Copyright (c) 2006, Intel Corporation. All rights reserved.
|
||||
// This software and associated documentation (if any) is furnished
|
||||
// under a license and may only be used or copied in accordance
|
||||
// with the terms of the license. Except as permitted by such
|
||||
// license, no part of this software or documentation may be
|
||||
// reproduced, stored in a retrieval system, or transmitted in any
|
||||
// form or by any means without the express written consent of
|
||||
// Intel Corporation.
|
||||
|
||||
Module Name: PeiStatusCode.c
|
||||
|
||||
**/
|
||||
|
||||
#include "PeiStatusCode.h"
|
||||
|
||||
/**
|
||||
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 <20><>Related Definitions<6E><73> 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.
|
||||
**/
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {
|
||||
ReportDispatcher
|
||||
};
|
||||
|
||||
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 <20><>Related Definitions<6E><73> 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.
|
||||
**/
|
||||
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
|
||||
EFIAPI
|
||||
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)) {
|
||||
SerialPortInitialize();
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
|
||||
MemoryStatusCodeInitializeWorker ();
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
||||
OemHookStatusCodeInitialize ();
|
||||
}
|
||||
|
||||
//
|
||||
// Install PeiStatusCodePpi.
|
||||
// PeiServices use this Ppi to output status code.
|
||||
// use library
|
||||
Status = PeiServicesInstallPpi (&mStatusCodePpiDescriptor);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
100
EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.h
Normal file
100
EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.h
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
/** @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<6E><73> 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 <20><>Related Definitions<6E><73> 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<6E><73> 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 <20><>Related Definitions<6E><73> 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
|
||||
);
|
||||
|
||||
#endif
|
115
EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.msa
Normal file
115
EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.msa
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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 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 software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.</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>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>SerialStatusCodeWorker.c</Filename>
|
||||
<Filename>MemoryStausCodeWorker.c</Filename>
|
||||
<Filename>PeiStatusCode.c</Filename>
|
||||
<Filename>PeiStatusCode.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674"/>
|
||||
</PackageDependencies>
|
||||
<PPIs>
|
||||
<Ppi Usage="ALWAYS_CONSUMED">
|
||||
<PpiCName>gEfiPeiStatusCodePpiGuid</PpiCName>
|
||||
</Ppi>
|
||||
</PPIs>
|
||||
<Guids>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gMemoryStatusCodeRecordGuid</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>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdStatusCodeUseMemory</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdStatusCodeUseOEM</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="DYNAMIC">
|
||||
<C_Name>PcdStatusCodeMemorySize</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
</PcdCoded>
|
||||
</ModuleSurfaceArea>
|
147
EdkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c
Normal file
147
EdkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c
Normal file
@@ -0,0 +1,147 @@
|
||||
|
||||
/** @file
|
||||
Serial I/O status code reporting worker.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.
|
||||
This software and associated documentation (if any) is furnished
|
||||
under a license and may only be used or copied in accordance
|
||||
with the terms of the license. Except as permitted by such
|
||||
license, no part of this software or documentation may be
|
||||
reproduced, stored in a retrieval system, or transmitted in any
|
||||
form or by any means without the express written consent of
|
||||
Intel Corporation.
|
||||
|
||||
Module Name: SerialStatusCodeWorker.c
|
||||
|
||||
**/
|
||||
|
||||
/**
|
||||
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<6E><73> 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 <20><>Related Definitions<6E><73> 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) {
|
||||
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 (Buffer, CharCount);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user