mirror of https://github.com/acidanthera/audk.git
1. add EdkSerialPortLibNull.inf
2. add StatusCode Dxe and Pei modules git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2877 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
3a10d47190
commit
ad1a179818
|
@ -9,7 +9,7 @@
|
|||
# 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.
|
||||
#
|
||||
|
@ -46,6 +46,20 @@
|
|||
PrintLib|${WORKSPACE}/MdePkg/Library/BasePrintLib/BasePrintLib.inf
|
||||
TimerLib|${WORKSPACE}/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
|
||||
UefiDecompressLib|${WORKSPACE}/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
|
||||
OemHookStatusCodeLib|${WORKSPACE}/IntelFrameworkModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
|
||||
SerialPortLib|${WORKSPACE}/IntelFrameworkModulePkg/Library/EdkSerialPortLibNull/EdkSerialPortLibNull.inf
|
||||
|
||||
[LibraryClasses.common.PEIM]
|
||||
HobLib|$(WORKSPACE)/MdePkg/Library/PeiHobLib/PeiHobLib.inf
|
||||
PeiServicesTablePointerLib|$(WORKSPACE)/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
|
||||
PcdLib|$(WORKSPACE)/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
|
||||
IoLib|$(WORKSPACE)/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf
|
||||
DebugLib|$(WORKSPACE)/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
PeimEntryPoint|$(WORKSPACE)/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
|
||||
PeiServicesLib|$(WORKSPACE)/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
|
||||
BaseMemoryLib|$(WORKSPACE)/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||
MemoryAllocationLib|$(WORKSPACE)/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
|
||||
ReportStatusCodeLib|$(WORKSPACE)/IntelFrameworkPkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_DRIVER]
|
||||
HobLib|${WORKSPACE}/MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||
|
@ -63,6 +77,19 @@
|
|||
FvbServiceLib|${WORKSPACE}/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf
|
||||
ReportStatusCodeLib|${WORKSPACE}/IntelFrameworkPkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
|
||||
HobLib|${WORKSPACE}/MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||
MemoryAllocationLib|${WORKSPACE}/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf
|
||||
PcdLib|${WORKSPACE}/MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
DxeServiceTableLib|${WORKSPACE}/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
|
||||
UefiBootServicesTableLib|${WORKSPACE}/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
|
||||
DebugLib|${WORKSPACE}/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
|
||||
UefiDriverEntryPoint|${WORKSPACE}/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
||||
UefiLib|${WORKSPACE}/MdePkg/Library/UefiLib/UefiLib.inf
|
||||
UefiRuntimeLib|${WORKSPACE}/MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
|
||||
UefiRuntimeServicesTableLib|${WORKSPACE}/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
|
||||
ReportStatusCodeLib|${WORKSPACE}/IntelFrameworkPkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd Section - list of all EDK II PCD Entries defined by this Platform
|
||||
|
@ -108,7 +135,11 @@
|
|||
PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000
|
||||
PcdPciExpressBaseAddress|gEfiMdePkgTokenSpaceGuid|0xE0000000
|
||||
PcdFSBClock|gEfiMdePkgTokenSpaceGuid|200000000
|
||||
|
||||
|
||||
[PcdsDynamic.common]
|
||||
PcdStatusCodeMemorySize|gEfiIntelFrameworkModulePkgTokenSpaceGuid|1
|
||||
PcdStatusCodeRuntimeMemorySize|gEfiIntelFrameworkModulePkgTokenSpaceGuid|4
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Components Section - list of all EDK II Modules needed by this Platform
|
||||
|
@ -123,3 +154,6 @@
|
|||
$(WORKSPACE)\IntelFrameworkModulePkg\Bus\Pci\IdeBus\Dxe\IdeBus.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Universal\DataHub\DataHub\Dxe\DataHub.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Universal\DataHub\DataHubStdErr\Dxe\DataHubStdErr.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Universal\DataHub\DataHubStdErr\Dxe\DataHubStdErr.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Universal\StatusCode\Dxe\DxeStatusCode.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Universal\StatusCode\Pei\PeiStatusCode.inf
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/**@file
|
||||
Common header file shared by all source files.
|
||||
|
||||
This file includes package header files, library classes and protocol, PPI & GUID definitions.
|
||||
|
||||
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.
|
||||
**/
|
||||
|
||||
#ifndef __COMMON_HEADER_H_
|
||||
#define __COMMON_HEADER_H_
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <PiPei.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/SerialPortLib.h>
|
||||
|
||||
#endif
|
|
@ -0,0 +1,59 @@
|
|||
#/** @file
|
||||
# Memory Status Code Library for UEFI drivers
|
||||
#
|
||||
# Lib to provide memory journal status code reporting Routines
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Defines Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = EdkSerialPortLibNull
|
||||
FILE_GUID = E4541241-8897-411a-91F8-7D7E45837146
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = SerialPortLib
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Sources Section - list of files that are required for the build to succeed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Sources.common]
|
||||
SerialPortLibNull.c
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package Dependency Section - list of Package files that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>EdkSerialPortLibNull</ModuleName>
|
||||
<ModuleType>PEIM</ModuleType>
|
||||
<GuidValue>E4541241-8897-411a-91F8-7D7E45837146</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Memory Status Code Library for UEFI drivers</Abstract>
|
||||
<Description>Lib to provide memory journal status code reporting Routines</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>EdkSerialPortLibNull</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_PRODUCED">
|
||||
<Keyword>SerialPortLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>SerialPortLibNull.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
|
@ -0,0 +1,85 @@
|
|||
/** @file
|
||||
Serial I/O Port library functions with no library constructor/destructor
|
||||
|
||||
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: SerialPortLibNull.c
|
||||
|
||||
**/
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <FrameworkPei.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/SerialPortLib.h>
|
||||
|
||||
/*
|
||||
|
||||
Programmed hardware of Serial port.
|
||||
|
||||
@return Always return EFI_UNSUPPORTED.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SerialPortInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Write data to serial device.
|
||||
|
||||
@param Buffer Point of data buffer which need to be writed.
|
||||
@param NumberOfBytes Number of output bytes which are cached in Buffer.
|
||||
|
||||
@retval 0 Write data failed.
|
||||
@retval !0 Actual number of bytes writed to serial device.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
SerialPortWrite (
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read data from serial device and save the datas in buffer.
|
||||
|
||||
@param Buffer Point of data buffer which need to be writed.
|
||||
@param NumberOfBytes Number of output bytes which are cached in Buffer.
|
||||
|
||||
@retval 0 Read data failed.
|
||||
@retval !0 Aactual number of bytes read from serial device.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
SerialPortRead (
|
||||
OUT UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,233 @@
|
|||
/** @file
|
||||
Status code driver for IA32/X64/EBC architecture.
|
||||
|
||||
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: DxeStatusCodeCommon.c
|
||||
|
||||
**/
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "DxeStatusCode.h"
|
||||
|
||||
|
||||
/**
|
||||
Report status code to all supported device.
|
||||
Calls into the workers which dispatches the platform specific
|
||||
listeners.
|
||||
|
||||
@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_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
|
||||
);
|
||||
|
||||
//
|
||||
// Declaration of status code protocol.
|
||||
//
|
||||
STATIC
|
||||
EFI_STATUS_CODE_PROTOCOL mEfiStatusCodeProtocol = {
|
||||
ReportDispatcher
|
||||
};
|
||||
|
||||
//
|
||||
// Delaration of DXE status code controller
|
||||
//
|
||||
DXE_STATUS_CODE_CONTROLLER gDxeStatusCode = {
|
||||
//
|
||||
// Initialize nest status as non nested.
|
||||
//
|
||||
0,
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Install the ReportStatusCode runtime service.
|
||||
|
||||
@param ImageHandle Image handle of the loaded driver
|
||||
@param SystemTable Pointer to the System Table
|
||||
|
||||
@return The function always returns success.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
DxeStatusCodeDriverEntry (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_HANDLE Handle = NULL;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Dispatch initialization request to supported devices
|
||||
//
|
||||
InitializationDispatcherWorker ();
|
||||
|
||||
//
|
||||
// Install Status Code Architectural Protocol implementation as defined in Tiano
|
||||
// Architecture Specification.
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Handle,
|
||||
&gEfiStatusCodeRuntimeProtocolGuid,
|
||||
&mEfiStatusCodeProtocol,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Report status code to all supported device.
|
||||
Calls into the workers which dispatches the platform specific
|
||||
listeners.
|
||||
|
||||
@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_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
|
||||
)
|
||||
{
|
||||
//
|
||||
// Use atom operation to avoid the reentant of report.
|
||||
// If current status is not zero, then the function is reentrancy.
|
||||
//
|
||||
if (1 == InterlockedCompareExchange32 (&gDxeStatusCode.StatusCodeNestStatus, 0, 1)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial) || FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
|
||||
SerialStatusCodeReportWorker (
|
||||
CodeType,
|
||||
Value,
|
||||
Instance,
|
||||
CallerId,
|
||||
Data
|
||||
);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
|
||||
RtMemoryStatusCodeReportWorker (
|
||||
gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],
|
||||
CodeType,
|
||||
Value,
|
||||
Instance
|
||||
);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
|
||||
DataHubStatusCodeReportWorker (
|
||||
CodeType,
|
||||
Value,
|
||||
Instance,
|
||||
CallerId,
|
||||
Data
|
||||
);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
||||
OemHookStatusCodeReport (
|
||||
CodeType,
|
||||
Value,
|
||||
Instance,
|
||||
CallerId,
|
||||
Data
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Restore the nest status of report
|
||||
//
|
||||
InterlockedCompareExchange32 (&gDxeStatusCode.StatusCodeNestStatus, 1, 0);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Virtual address change notification call back. It converts global pointer
|
||||
to virtual address.
|
||||
|
||||
@param Event Event whose notification function is being invoked.
|
||||
@param Context Pointer to the notification function's context, which is
|
||||
always zero in current implementation.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
VirtualAddressChangeCallBack (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
//
|
||||
// Convert memory status code table to virtual address;
|
||||
//
|
||||
EfiConvertPointer (
|
||||
0,
|
||||
(VOID **) &gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE]
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#/*++
|
||||
#
|
||||
# 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.dxs
|
||||
#
|
||||
# Abstract:
|
||||
#
|
||||
# Dependency expression source file.
|
||||
#
|
||||
#--*/
|
||||
#include <DxeDepex.h>
|
||||
|
||||
DEPENDENCY_START
|
||||
EFI_DATA_HUB_PROTOCOL_GUID AND EFI_CPU_IO_PROTOCOL_GUID
|
||||
DEPENDENCY_END
|
|
@ -0,0 +1,70 @@
|
|||
/**@file
|
||||
Common header file shared by all source files.
|
||||
|
||||
This file includes package header files, library classes and protocol, PPI & GUID definitions.
|
||||
|
||||
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.
|
||||
**/
|
||||
|
||||
#ifndef __COMMON_HEADER_H_
|
||||
#define __COMMON_HEADER_H_
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <FrameworkDxe.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Guid/StatusCode.h>
|
||||
#include <Protocol/DataHub.h>
|
||||
#include <Protocol/SerialIo.h>
|
||||
#include <Guid/MemoryStatusCodeRecord.h>
|
||||
#include <Protocol/StatusCode.h>
|
||||
#include <Guid/StatusCodeDataTypeId.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiRuntimeLib.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/OemHookStatusCodeLib.h>
|
||||
|
||||
//
|
||||
// Declaration for callback Event.
|
||||
//
|
||||
VOID
|
||||
EFIAPI
|
||||
VirtualAddressChangeCallBack (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
//
|
||||
// Declaration for original Entry Point.
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DxeStatusCodeDriverEntry (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,335 @@
|
|||
/** @file
|
||||
Data Hub status code worker in DXE.
|
||||
|
||||
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: DataHubStatusCodeWorker.c
|
||||
|
||||
**/
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "DxeStatusCode.h"
|
||||
|
||||
//
|
||||
// Initialize FIFO to cache records.
|
||||
//
|
||||
STATIC
|
||||
LIST_ENTRY mRecordsFifo = INITIALIZE_LIST_HEAD_VARIABLE (mRecordsFifo);
|
||||
STATIC
|
||||
LIST_ENTRY mRecordsBuffer = INITIALIZE_LIST_HEAD_VARIABLE (mRecordsBuffer);
|
||||
STATIC
|
||||
EFI_EVENT mLogDataHubEvent;
|
||||
//
|
||||
// Cache data hub protocol.
|
||||
//
|
||||
STATIC
|
||||
EFI_DATA_HUB_PROTOCOL *mDataHubProtocol;
|
||||
|
||||
|
||||
/**
|
||||
Return one DATAHUB_STATUSCODE_RECORD space.
|
||||
The size of free record pool would be extend, if the pool is empty.
|
||||
|
||||
|
||||
@retval NULL Can not allocate free memeory for record.
|
||||
@retval !NULL Point to buffer of record.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
DATAHUB_STATUSCODE_RECORD *
|
||||
AcquireRecordBuffer (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
DATAHUB_STATUSCODE_RECORD *Record;
|
||||
EFI_TPL CurrentTpl;
|
||||
LIST_ENTRY *Node;
|
||||
UINT32 Index;
|
||||
|
||||
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||
|
||||
if (!IsListEmpty (&mRecordsBuffer)) {
|
||||
Node = GetFirstNode (&mRecordsBuffer);
|
||||
RemoveEntryList (Node);
|
||||
|
||||
Record = _CR (Node, DATAHUB_STATUSCODE_RECORD, Node);
|
||||
} else {
|
||||
if (CurrentTpl > TPL_NOTIFY) {
|
||||
gBS->RestoreTPL (CurrentTpl);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gBS->RestoreTPL (CurrentTpl);
|
||||
Record = (DATAHUB_STATUSCODE_RECORD *) AllocateZeroPool (sizeof (DATAHUB_STATUSCODE_RECORD) * 16);
|
||||
if (NULL == Record) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||
for (Index = 1; Index < 16; Index++) {
|
||||
InsertTailList (&mRecordsBuffer, &Record[Index].Node);
|
||||
}
|
||||
}
|
||||
|
||||
Record->Signature = DATAHUB_STATUS_CODE_SIGNATURE;
|
||||
InsertTailList (&mRecordsFifo, &Record->Node);
|
||||
|
||||
gBS->RestoreTPL (CurrentTpl);
|
||||
|
||||
return Record;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieve one record from Records FIFO. The record would be removed from FIFO and
|
||||
release to free record buffer.
|
||||
|
||||
@return !NULL Point to record, which is ready to be logged.
|
||||
@return NULL the FIFO of record is empty.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
DATAHUB_STATUSCODE_RECORD *
|
||||
RetrieveRecord (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
DATAHUB_STATUSCODE_RECORD *Record = NULL;
|
||||
LIST_ENTRY *Node;
|
||||
EFI_TPL CurrentTpl;
|
||||
|
||||
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||
|
||||
if (!IsListEmpty (&mRecordsFifo)) {
|
||||
Node = GetFirstNode (&mRecordsFifo);
|
||||
Record = CR (Node, DATAHUB_STATUSCODE_RECORD, Node, DATAHUB_STATUS_CODE_SIGNATURE);
|
||||
|
||||
RemoveEntryList (&Record->Node);
|
||||
InsertTailList (&mRecordsBuffer, &Record->Node);
|
||||
Record->Signature = 0;
|
||||
}
|
||||
|
||||
gBS->RestoreTPL (CurrentTpl);
|
||||
|
||||
return Record;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Report status code into DataHub.
|
||||
|
||||
@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
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Can not acquire record buffer.
|
||||
@retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
|
||||
@retval EFI_SUCCESS Success to cache status code and signal log data event.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
DataHubStatusCodeReportWorker (
|
||||
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
|
||||
)
|
||||
{
|
||||
DATAHUB_STATUSCODE_RECORD *Record;
|
||||
UINT32 ErrorLevel;
|
||||
VA_LIST Marker;
|
||||
CHAR8 *Format;
|
||||
UINTN CharCount;
|
||||
|
||||
//
|
||||
// See whether in runtime phase or not.
|
||||
//
|
||||
if (EfiAtRuntime ()) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
Record = AcquireRecordBuffer ();
|
||||
if (Record == NULL) {
|
||||
//
|
||||
// There are no empty record buffer in private buffers
|
||||
//
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
//
|
||||
// Construct Data Hub Extended Data
|
||||
//
|
||||
Record->CodeType = CodeType;
|
||||
Record->Value = Value;
|
||||
Record->Instance = Instance;
|
||||
|
||||
if (CallerId != NULL) {
|
||||
CopyMem (&Record->CallerId, CallerId, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
if (Data != NULL) {
|
||||
if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
|
||||
CharCount = UnicodeVSPrintAsciiFormat (
|
||||
(CHAR16 *) Record->ExtendData,
|
||||
EFI_STATUS_CODE_DATA_MAX_SIZE,
|
||||
Format,
|
||||
Marker
|
||||
);
|
||||
//
|
||||
// Change record data type from DebugType to String Type.
|
||||
//
|
||||
CopyGuid (&Record->Data.Type, &gEfiStatusCodeDataTypeStringGuid);
|
||||
Record->Data.HeaderSize = Data->HeaderSize;
|
||||
Record->Data.Size = (UINT16) ((CharCount + 1) * sizeof (CHAR16));
|
||||
} else {
|
||||
//
|
||||
// Copy status code data header
|
||||
//
|
||||
CopyMem (&Record->Data, Data, sizeof (EFI_STATUS_CODE_DATA));
|
||||
|
||||
if (Data->Size > EFI_STATUS_CODE_DATA_MAX_SIZE) {
|
||||
Record->Data.Size = EFI_STATUS_CODE_DATA_MAX_SIZE;
|
||||
}
|
||||
CopyMem (Record->ExtendData, Data + 1, Record->Data.Size);
|
||||
}
|
||||
}
|
||||
|
||||
gBS->SignalEvent (mLogDataHubEvent);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The Event handler which will be notified to log data in Data Hub.
|
||||
|
||||
@param Event Instance of the EFI_EVENT to signal whenever data is
|
||||
available to be logged in the system.
|
||||
@param Context Context of the event.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
LogDataHubEventCallBack (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
DATAHUB_STATUSCODE_RECORD *Record;
|
||||
UINT32 Size;
|
||||
UINT64 DataRecordClass;
|
||||
|
||||
//
|
||||
// Log DataRecord in Data Hub.
|
||||
// Journal records fifo to find all record entry.
|
||||
//
|
||||
while (1) {
|
||||
Record = RetrieveRecord ();
|
||||
if (Record == NULL) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Add in the size of the header we added.
|
||||
//
|
||||
Size = sizeof (DATAHUB_STATUSCODE_RECORD) + (UINT32) Record->Data.Size;
|
||||
|
||||
if ((Record->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
|
||||
DataRecordClass = EFI_DATA_RECORD_CLASS_PROGRESS_CODE;
|
||||
} else if ((Record->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
|
||||
DataRecordClass = EFI_DATA_RECORD_CLASS_ERROR;
|
||||
} else if ((Record->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {
|
||||
DataRecordClass = EFI_DATA_RECORD_CLASS_DEBUG;
|
||||
} else {
|
||||
//
|
||||
// Should never get here.
|
||||
//
|
||||
DataRecordClass = EFI_DATA_RECORD_CLASS_DEBUG |
|
||||
EFI_DATA_RECORD_CLASS_ERROR |
|
||||
EFI_DATA_RECORD_CLASS_DATA |
|
||||
EFI_DATA_RECORD_CLASS_PROGRESS_CODE;
|
||||
}
|
||||
|
||||
//
|
||||
// Log DataRecord in Data Hub
|
||||
//
|
||||
|
||||
mDataHubProtocol->LogData (
|
||||
mDataHubProtocol,
|
||||
&gEfiStatusCodeGuid,
|
||||
&gEfiStatusCodeRuntimeProtocolGuid,
|
||||
DataRecordClass,
|
||||
Record,
|
||||
Size
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Initialize data hubstatus code.
|
||||
Create a data hub listener.
|
||||
|
||||
@return The function always return EFI_SUCCESS
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
DataHubStatusCodeInitializeWorker (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiDataHubProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &mDataHubProtocol
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Create a Notify Event to log data in Data Hub
|
||||
//
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
LogDataHubEventCallBack,
|
||||
NULL,
|
||||
&mLogDataHubEvent
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
/** @file
|
||||
Status Code Architectural Protocol implementation as defined in Tiano
|
||||
Architecture Specification.
|
||||
|
||||
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
|
||||
|
||||
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: DxeStatusCode.c
|
||||
|
||||
**/
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "DxeStatusCode.h"
|
||||
|
||||
/**
|
||||
|
||||
Dispatch initialization request to sub status code devices based on
|
||||
customized feature flags.
|
||||
|
||||
**/
|
||||
VOID
|
||||
InitializationDispatcherWorker (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_PEI_HOB_POINTERS Hob;
|
||||
EFI_STATUS Status;
|
||||
MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
|
||||
MEMORY_STATUSCODE_RECORD *Record;
|
||||
UINTN ExpectedPacketIndex = 0;
|
||||
UINTN Index;
|
||||
VOID *HobStart;
|
||||
|
||||
//
|
||||
// If enable UseSerial, then initialize serial port.
|
||||
// if enable UseRuntimeMemory, then initialize runtime memory status code worker.
|
||||
// if enable UseDataHub, then initialize data hub status code worker.
|
||||
//
|
||||
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
|
||||
Status = EfiSerialStatusCodeInitializeWorker ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
|
||||
Status = SerialPortInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
|
||||
Status = RtMemoryStatusCodeInitializeWorker ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
|
||||
Status = DataHubStatusCodeInitializeWorker ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
||||
Status = OemHookStatusCodeInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
//
|
||||
// Replay Status code which saved in GUID'ed HOB to all supported device.
|
||||
//
|
||||
|
||||
//
|
||||
// Journal GUID'ed HOBs to find all record entry, if found,
|
||||
// then output record to support replay device.
|
||||
//
|
||||
Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
|
||||
HobStart = Hob.Raw;
|
||||
while (Hob.Raw != NULL) {
|
||||
PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *) GET_GUID_HOB_DATA (Hob.Guid);
|
||||
if (PacketHeader->PacketIndex == ExpectedPacketIndex) {
|
||||
Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);
|
||||
for (Index = 0; Index < PacketHeader->RecordIndex; Index++) {
|
||||
//
|
||||
// Dispatch records to devices based on feature flag.
|
||||
//
|
||||
if (FeaturePcdGet (PcdStatusCodeReplayInSerial) &&
|
||||
(FeaturePcdGet (PcdStatusCodeUseHardSerial) ||
|
||||
FeaturePcdGet (PcdStatusCodeUseEfiSerial))) {
|
||||
SerialStatusCodeReportWorker (
|
||||
Record[Index].CodeType,
|
||||
Record[Index].Value,
|
||||
Record[Index].Instance,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory) &&
|
||||
FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
|
||||
RtMemoryStatusCodeReportWorker (
|
||||
gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],
|
||||
Record[Index].CodeType,
|
||||
Record[Index].Value,
|
||||
Record[Index].Instance
|
||||
);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeReplayInDataHub) &&
|
||||
FeaturePcdGet (PcdStatusCodeUseDataHub)) {
|
||||
DataHubStatusCodeReportWorker (
|
||||
Record[Index].CodeType,
|
||||
Record[Index].Value,
|
||||
Record[Index].Instance,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeReplayInOEM) &&
|
||||
FeaturePcdGet (PcdStatusCodeUseOEM)) {
|
||||
OemHookStatusCodeReport (
|
||||
Record[Index].CodeType,
|
||||
Record[Index].Value,
|
||||
Record[Index].Instance,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
}
|
||||
ExpectedPacketIndex++;
|
||||
|
||||
//
|
||||
// See whether there is gap of packet or not
|
||||
//
|
||||
if (NULL != HobStart) {
|
||||
HobStart = NULL;
|
||||
Hob.Raw = HobStart;
|
||||
continue;
|
||||
}
|
||||
} else if (HobStart != NULL) {
|
||||
//
|
||||
// Cache the found packet for improve the performance
|
||||
//
|
||||
HobStart = Hob.Raw;
|
||||
}
|
||||
|
||||
Hob.Raw = GetNextGuidHob (&gMemoryStatusCodeRecordGuid, Hob.Raw);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,245 @@
|
|||
/*++
|
||||
|
||||
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:
|
||||
|
||||
DxeStatusCode.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Header file of EFI DXE/RT Status Code.
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef __DXE_STATUS_CODE_H__
|
||||
#define __DXE_STATUS_CODE_H__
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
//
|
||||
// Data hub worker definition
|
||||
//
|
||||
#define MAX_NUMBER_DATAHUB_RECORDS 1000
|
||||
#define DATAHUB_BYTES_PER_RECORD EFI_STATUS_CODE_DATA_MAX_SIZE
|
||||
#define EMPTY_RECORD_TAG 0xFF
|
||||
#define DATAHUB_STATUS_CODE_SIGNATURE EFI_SIGNATURE_32 ('B', 'D', 'H', 'S')
|
||||
|
||||
//
|
||||
// Address type of pointer.
|
||||
// The point type always equal to PHYSICAL_MODE on IA32/X64/EBC architecture
|
||||
// Otherwise, VIRTUAL_MODE/PHYSICAL_MODE would be used on Ipf architecture,
|
||||
//
|
||||
typedef enum {
|
||||
PHYSICAL_MODE,
|
||||
VIRTUAL_MODE
|
||||
} PROCESSOR_MODE;
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Node;
|
||||
EFI_STATUS_CODE_TYPE CodeType;
|
||||
EFI_STATUS_CODE_VALUE Value;
|
||||
UINT32 Instance;
|
||||
EFI_GUID CallerId;
|
||||
EFI_STATUS_CODE_DATA Data;
|
||||
UINT8 ExtendData[EFI_STATUS_CODE_DATA_MAX_SIZE];
|
||||
} DATAHUB_STATUSCODE_RECORD;
|
||||
|
||||
|
||||
//
|
||||
// Runtime memory status code worker definition
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 RecordIndex;
|
||||
UINT32 NumberOfRecords;
|
||||
UINT32 MaxRecordsNumber;
|
||||
} RUNTIME_MEMORY_STATUSCODE_HEADER;
|
||||
|
||||
|
||||
typedef struct {
|
||||
//
|
||||
// Report operation nest status.
|
||||
// If it is set, then the report operation has nested.
|
||||
//
|
||||
UINT32 StatusCodeNestStatus;
|
||||
//
|
||||
// Runtime status code management header, the records buffer is following it.
|
||||
//
|
||||
RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable[2];
|
||||
} DXE_STATUS_CODE_CONTROLLER;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Dispatch initialization request to sub status code devices based on
|
||||
customized feature flags.
|
||||
|
||||
**/
|
||||
VOID
|
||||
InitializationDispatcherWorker (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Initialize serial status code worker.
|
||||
|
||||
@return The function always return EFI_SUCCESS
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EfiSerialStatusCodeInitializeWorker (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
|
||||
@retval EFI_SUCCESS Success to report status code to serial I/O.
|
||||
@retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
|
||||
|
||||
**/
|
||||
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 runtime memory status code.
|
||||
|
||||
@return The function always return EFI_SUCCESS
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
RtMemoryStatusCodeInitializeWorker (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Report status code into runtime memory. If the runtime pool is full, roll back to the
|
||||
first record and overwrite it.
|
||||
|
||||
@param RtMemoryStatusCodeTable
|
||||
Point to Runtime memory table header.
|
||||
|
||||
@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
|
||||
RtMemoryStatusCodeReportWorker (
|
||||
RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN UINT32 Instance
|
||||
);
|
||||
|
||||
/**
|
||||
Initialize data hubstatus code.
|
||||
Create a data hub listener.
|
||||
|
||||
@return The function always return EFI_SUCCESS
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
DataHubStatusCodeInitializeWorker (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Report status code into DataHub.
|
||||
|
||||
@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
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Can not acquire record buffer.
|
||||
@retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
|
||||
@retval EFI_SUCCESS Success to cache status code and signal log data event.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
DataHubStatusCodeReportWorker (
|
||||
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
|
||||
);
|
||||
|
||||
//
|
||||
// declaration of DXE status code controller.
|
||||
//
|
||||
extern DXE_STATUS_CODE_CONTROLLER gDxeStatusCode;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,170 @@
|
|||
#/** @file
|
||||
# DXE status code driver.
|
||||
#
|
||||
# Status Code Architectural Protocol implementation as defined in Tiano
|
||||
# Architecture Specification. This driver has limited functionality
|
||||
# at runtime and will not log to Data Hub at runtime.
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Defines Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = DxeStatusCode
|
||||
FILE_GUID = FEDE0A1B-BCA2-4A9F-BB2B-D9FD7DEC2E9F
|
||||
MODULE_TYPE = DXE_RUNTIME_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
ENTRY_POINT = InitializeDxeStatusCode
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 EBC
|
||||
#
|
||||
# VIRTUAL_ADDRESS_MAP_CALLBACK = VirtualAddressChangeCallBack
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Sources Section - list of files that are required for the build to succeed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Sources.common]
|
||||
SerialStatusCodeWorker.c
|
||||
RtMemoryStatusCodeWorker.c
|
||||
DataHubStatusCodeWorker.c
|
||||
DxeStatusCode.c
|
||||
DxeStatusCode.h
|
||||
CommonHeader.h
|
||||
EntryPoint.c
|
||||
|
||||
[Sources.Ia32]
|
||||
Common/StatusCode.dxs
|
||||
Common/DxeStatusCodeCommon.c
|
||||
|
||||
[Sources.X64]
|
||||
Common/StatusCode.dxs
|
||||
Common/DxeStatusCodeCommon.c
|
||||
|
||||
[Sources.EBC]
|
||||
Common/StatusCode.dxs
|
||||
Common/DxeStatusCodeCommon.c
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Includes Section - list of Include locations that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Includes]
|
||||
$(WORKSPACE)/MdePkg/Include/Library
|
||||
$(WORKSPACE)/IntelFrameworkModulePkg/Include
|
||||
$(WORKSPACE)/IntelFrameworkModulePkg/Include/Library
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package Dependency Section - list of Package files that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class Section - list of Library Classes that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[LibraryClasses]
|
||||
OemHookStatusCodeLib
|
||||
SerialPortLib
|
||||
UefiRuntimeLib
|
||||
MemoryAllocationLib
|
||||
UefiLib
|
||||
UefiBootServicesTableLib
|
||||
UefiDriverEntryPoint
|
||||
HobLib
|
||||
PcdLib
|
||||
PrintLib
|
||||
ReportStatusCodeLib
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
BaseLib
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Guid C Name Section - list of Guids that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Guids]
|
||||
gEfiStatusCodeGuid # SOMETIMES_CONSUMED
|
||||
gMemoryStatusCodeRecordGuid # SOMETIMES_CONSUMED
|
||||
gEfiStatusCodeDataTypeStringGuid # SOMETIMES_CONSUMED
|
||||
gEfiStatusCodeSpecificDataGuid # SOMETIMES_CONSUMED
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Protocol C Name Section - list of Protocol and Protocol Notify C Names
|
||||
# that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Protocols]
|
||||
gEfiStatusCodeRuntimeProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiDataHubProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
gEfiSerialIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd FEATURE_FLAG - list of PCDs that this module is coded for.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[PcdsFeatureFlag.common]
|
||||
PcdStatusCodeReplayInOEM|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdStatusCodeReplayInRuntimeMemory|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdStatusCodeReplayInDataHub|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdStatusCodeReplayInSerial|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdStatusCodeUseOEM|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdStatusCodeUseDataHub|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdStatusCodeUseRuntimeMemory|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdStatusCodeUseEfiSerial|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdStatusCodeUseHardSerial|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd DYNAMIC - list of PCDs that this module is coded for.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[PcdsDynamic.common]
|
||||
PcdStatusCodeRuntimeMemorySize|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
<?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>DxeStatusCode</ModuleName>
|
||||
<ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
|
||||
<GuidValue>FEDE0A1B-BCA2-4A9F-BB2B-D9FD7DEC2E9F</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>DXE status code driver.</Abstract>
|
||||
<Description>
|
||||
Status Code Architectural Protocol implementation as defined in Tiano
|
||||
Architecture Specification. This driver has limited functionality
|
||||
at runtime and will not log to Data Hub at runtime.
|
||||
</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>DxeStatusCode</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>ReportStatusCodeLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PrintLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PcdLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>HobLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiRuntimeLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>SerialPortLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>OemHookStatusCodeLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IPF">
|
||||
<Keyword>EdkDxeSalLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>DxeStatusCode.h</Filename>
|
||||
<Filename>DxeStatusCode.c</Filename>
|
||||
<Filename>DataHubStatusCodeWorker.c</Filename>
|
||||
<Filename>RtMemoryStatusCodeWorker.c</Filename>
|
||||
<Filename>SerialStatusCodeWorker.c</Filename>
|
||||
<Filename SupArchList="IA32">Common/DxeStatusCodeCommon.c</Filename>
|
||||
<Filename SupArchList="IA32">Common/StatusCode.dxs</Filename>
|
||||
<Filename SupArchList="X64">Common/DxeStatusCodeCommon.c</Filename>
|
||||
<Filename SupArchList="X64">Common/StatusCode.dxs</Filename>
|
||||
<Filename SupArchList="EBC">Common/DxeStatusCodeCommon.c</Filename>
|
||||
<Filename SupArchList="EBC">Common/StatusCode.dxs</Filename>
|
||||
<Filename SupArchList="IPF">Ipf/DxeStatusCodeIpf.c</Filename>
|
||||
<Filename SupArchList="IPF">Ipf/StatusCode.dxs</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5E0E9358-46B6-4AE2-8218-4AB8B9BBDCEC"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiExtendedSalStatusCodeServicesProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiSerialIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiDataHubProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiStatusCodeRuntimeProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Guids>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gMemoryStatusCodeRecordGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiStatusCodeDataTypeStringGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiStatusCodeGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>DxeStatusCodeDriverEntry</ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<SetVirtualAddressMapCallBack>VirtualAddressChangeCallBack</SetVirtualAddressMapCallBack>
|
||||
</Extern>
|
||||
</Externs>
|
||||
<PcdCoded>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdStatusCodeUseHardSerial</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdStatusCodeUseEfiSerial</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdStatusCodeUseRuntimeMemory</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdStatusCodeUseDataHub</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdStatusCodeUseOEM</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdStatusCodeReplayInSerial</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdStatusCodeReplayInDataHub</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdStatusCodeReplayInRuntimeMemory</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdStatusCodeReplayInOEM</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="DYNAMIC">
|
||||
<C_Name>PcdStatusCodeRuntimeMemorySize</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText/>
|
||||
</PcdEntry>
|
||||
</PcdCoded>
|
||||
</ModuleSurfaceArea>
|
|
@ -0,0 +1,59 @@
|
|||
/**@file
|
||||
Entry Point Source file.
|
||||
|
||||
This file contains the user entry point
|
||||
|
||||
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.
|
||||
**/
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
//
|
||||
// Event for Exit Boot Services Callback
|
||||
//
|
||||
STATIC EFI_EVENT mExitBootServicesEvent = NULL;
|
||||
|
||||
/**
|
||||
The user Entry Point for module DxeStatusCode. The user code starts with this function.
|
||||
|
||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param[in] SystemTable A pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS The entry point is executed successfully.
|
||||
@retval other Some error occurs when executing this entry point.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeDxeStatusCode(
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_SIGNAL_EXIT_BOOT_SERVICES,
|
||||
TPL_NOTIFY,
|
||||
VirtualAddressChangeCallBack,
|
||||
NULL,
|
||||
&mExitBootServicesEvent
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Call the original Entry Point
|
||||
//
|
||||
Status = DxeStatusCodeDriverEntry (ImageHandle, SystemTable);
|
||||
|
||||
return Status;
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
/** @file
|
||||
Runtime memory status code worker in DXE.
|
||||
|
||||
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: RtMemoryStatusCodeWorker.c
|
||||
|
||||
**/
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "DxeStatusCode.h"
|
||||
|
||||
/**
|
||||
Initialize runtime memory status code.
|
||||
|
||||
@return The function always return EFI_SUCCESS
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
RtMemoryStatusCodeInitializeWorker (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable;
|
||||
|
||||
//
|
||||
// Allocate runtime memory status code pool.
|
||||
//
|
||||
RtMemoryStatusCodeTable =
|
||||
(RUNTIME_MEMORY_STATUSCODE_HEADER *) AllocatePool (
|
||||
sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +
|
||||
PcdGet16 (PcdStatusCodeRuntimeMemorySize) *
|
||||
1024
|
||||
);
|
||||
|
||||
ASSERT (NULL != RtMemoryStatusCodeTable);
|
||||
|
||||
RtMemoryStatusCodeTable->RecordIndex = 0;
|
||||
RtMemoryStatusCodeTable->NumberOfRecords = 0;
|
||||
RtMemoryStatusCodeTable->MaxRecordsNumber =
|
||||
(PcdGet16 (PcdStatusCodeRuntimeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
|
||||
|
||||
gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE] = RtMemoryStatusCodeTable;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Report status code into runtime memory. If the runtime pool is full, roll back to the
|
||||
first record and overwrite it.
|
||||
|
||||
@param RtMemoryStatusCodeTable
|
||||
Point to Runtime memory table header.
|
||||
|
||||
@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
|
||||
RtMemoryStatusCodeReportWorker (
|
||||
RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,
|
||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||
IN EFI_STATUS_CODE_VALUE Value,
|
||||
IN UINT32 Instance
|
||||
)
|
||||
{
|
||||
MEMORY_STATUSCODE_RECORD *Record;
|
||||
|
||||
ASSERT (NULL != RtMemoryStatusCodeTable);
|
||||
|
||||
//
|
||||
// Locate current record buffer.
|
||||
//
|
||||
Record = (MEMORY_STATUSCODE_RECORD *) (RtMemoryStatusCodeTable + 1);
|
||||
Record = &Record[RtMemoryStatusCodeTable->RecordIndex++];
|
||||
|
||||
//
|
||||
// Save status code.
|
||||
//
|
||||
Record->CodeType = CodeType;
|
||||
Record->Value = Value;
|
||||
Record->Instance = Instance;
|
||||
|
||||
//
|
||||
// Record total number of records, we compare the number with max records number,
|
||||
// if it is bigger than the max number, then the roll back had happened, the record index points to
|
||||
// the first record. if it is less then max number, then the zero index is the first record.
|
||||
//
|
||||
RtMemoryStatusCodeTable->NumberOfRecords++;
|
||||
if (RtMemoryStatusCodeTable->RecordIndex == RtMemoryStatusCodeTable->MaxRecordsNumber) {
|
||||
//
|
||||
// Roll back record index.
|
||||
//
|
||||
RtMemoryStatusCodeTable->RecordIndex = 0;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
|
||||
/** @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 common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#include "DxeStatusCode.h"
|
||||
|
||||
STATIC
|
||||
EFI_SERIAL_IO_PROTOCOL *mSerialIoProtocol;
|
||||
|
||||
/**
|
||||
Initialize serial status code worker.
|
||||
|
||||
@return The function always return EFI_SUCCESS
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EfiSerialStatusCodeInitializeWorker (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiSerialIoProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &mSerialIoProtocol
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
|
||||
@retval EFI_SUCCESS Success to report status code to serial I/O.
|
||||
@retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
|
||||
|
||||
**/
|
||||
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;
|
||||
EFI_TPL CurrentTpl;
|
||||
|
||||
|
||||
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
|
||||
if (EfiAtRuntime ()) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||
gBS->RestoreTPL (CurrentTpl);
|
||||
|
||||
if (CurrentTpl > TPL_CALLBACK ) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
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\rDXE_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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
|
||||
//
|
||||
// Callout to SerialPort Lib function to do print.
|
||||
//
|
||||
SerialPortWrite ((UINT8 *) Buffer, CharCount);
|
||||
}
|
||||
if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
|
||||
mSerialIoProtocol->Write (
|
||||
mSerialIoProtocol,
|
||||
&CharCount,
|
||||
Buffer
|
||||
);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/**@file
|
||||
Common header file shared by all source files.
|
||||
|
||||
This file includes package header files, library classes and protocol, PPI & GUID definitions.
|
||||
|
||||
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.
|
||||
**/
|
||||
|
||||
#ifndef __COMMON_HEADER_H_
|
||||
#define __COMMON_HEADER_H_
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <FrameworkPei.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Guid/MemoryStatusCodeRecord.h>
|
||||
#include <Guid/StatusCodeDataTypeId.h>
|
||||
#include <Ppi/StatusCode.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <Library/OemHookStatusCodeLib.h>
|
||||
#include <Library/PeimEntryPoint.h>
|
||||
|
||||
#endif
|
|
@ -0,0 +1,156 @@
|
|||
/** @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 common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#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;
|
||||
}
|
|
@ -0,0 +1,151 @@
|
|||
|
||||
/** @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 common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#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;
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
|
||||
/** @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__
|
||||
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.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
|
|
@ -0,0 +1,140 @@
|
|||
#/** @file
|
||||
# Generic Status code Pei driver
|
||||
#
|
||||
# Customized output devices based on feature flags.
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Defines Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PeiStatusCode
|
||||
FILE_GUID = 1EC0F53A-FDE0-4576-8F25-7A1A410F58EB
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
ENTRY_POINT = PeiStatusCodeDriverEntry
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Sources Section - list of files that are required for the build to succeed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Sources.common]
|
||||
PeiStatusCode.c
|
||||
MemoryStausCodeWorker.c
|
||||
SerialStatusCodeWorker.c
|
||||
PeiStatusCode.h
|
||||
CommonHeader.h
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Includes Section - list of Include locations that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Includes]
|
||||
$(WORKSPACE)/MdePkg/Include/Library
|
||||
$(WORKSPACE)/IntelFrameworkPkg/Include
|
||||
$(WORKSPACE)/IntelFrameworkModulePkg/Include
|
||||
$(WORKSPACE)/IntelFrameworkModulePkg/Include/Library
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package Dependency Section - list of Package files that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class Section - list of Library Classes that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[LibraryClasses]
|
||||
PeimEntryPoint
|
||||
OemHookStatusCodeLib
|
||||
PeiServicesLib
|
||||
PcdLib
|
||||
HobLib
|
||||
SerialPortLib
|
||||
ReportStatusCodeLib
|
||||
PrintLib
|
||||
DebugLib
|
||||
BaseMemoryLib
|
||||
BaseLib
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Guid C Name Section - list of Guids that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Guids]
|
||||
gMemoryStatusCodeRecordGuid # SOMETIMES_CONSUMED
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# PPI C Name Section - list of PPI and PPI Notify C Names that this module
|
||||
# uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Ppis]
|
||||
gEfiPeiStatusCodePpiGuid # PPI ALWAYS_CONSUMED
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd FEATURE_FLAG - list of PCDs that this module is coded for.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[PcdsFeatureFlag.common]
|
||||
PcdStatusCodeUseOEM|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdStatusCodeUseMemory|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdStatusCodeUseSerial|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd DYNAMIC - list of PCDs that this module is coded for.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[PcdsDynamic.common]
|
||||
PcdStatusCodeMemorySize|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
<?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>
|
|
@ -0,0 +1,174 @@
|
|||
|
||||
/** @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 common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#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;
|
||||
}
|
Loading…
Reference in New Issue