Initial import.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
bbahnsen
2006-04-21 22:54:32 +00:00
commit 878ddf1fc3
2651 changed files with 624620 additions and 0 deletions

View File

@ -0,0 +1,188 @@
/*++
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:
RtMemoryStatusCode.c
Abstract:
EFI lib to provide memory journal status code reporting routines.
--*/
#include <Ppi/StatusCodeMemory.h>
//
// Global variables
//
PEI_STATUS_CODE_MEMORY_PPI mStatusCodeMemoryPpi = { 0, 0, 0, 0 };
//
// Function implementations
//
EFI_STATUS
RtMemoryReportStatusCode (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID * CallerId,
IN EFI_STATUS_CODE_DATA * Data OPTIONAL
)
/*++
Routine Description:
Log a status code to a memory journal. If no memory journal exists,
we will just return.
Arguments:
Same as ReportStatusCode AP
Returns:
EFI_SUCCESS This function always returns success
--*/
{
EFI_STATUS_CODE_ENTRY *CurrentEntry;
UINTN MaxEntry;
//
// We don't care to log debug codes.
//
if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {
return EFI_SUCCESS;
}
//
// Update the latest entry in the journal.
//
MaxEntry = mStatusCodeMemoryPpi.Length / sizeof (EFI_STATUS_CODE_ENTRY);
if (!MaxEntry) {
//
// If we don't have any entries, then we can return.
// This effectively means that no memory buffer was passed forward from PEI.
//
return EFI_SUCCESS;
}
CurrentEntry = (EFI_STATUS_CODE_ENTRY *) (UINTN) (mStatusCodeMemoryPpi.Address + (mStatusCodeMemoryPpi.LastEntry * sizeof (EFI_STATUS_CODE_ENTRY)));
mStatusCodeMemoryPpi.LastEntry = (mStatusCodeMemoryPpi.LastEntry + 1) % MaxEntry;
if (mStatusCodeMemoryPpi.LastEntry == mStatusCodeMemoryPpi.FirstEntry) {
mStatusCodeMemoryPpi.FirstEntry = (mStatusCodeMemoryPpi.FirstEntry + 1) % MaxEntry;
}
CurrentEntry->Type = CodeType;
CurrentEntry->Value = Value;
CurrentEntry->Instance = Instance;
return EFI_SUCCESS;
}
VOID
RtMemoryStatusCodeInitialize (
VOID
)
/*++
Routine Description:
Initialization routine.
Allocates heap space for storing Status Codes.
Installs a PPI to point to that heap space.
Installs a callback to switch to memory.
Installs a callback to
Arguments:
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
Returns:
None
--*/
{
EFI_HOB_GUID_TYPE *GuidHob;
PEI_STATUS_CODE_MEMORY_PPI **StatusCodeMemoryPpi;
GuidHob = GetFirstGuidHob (&gPeiStatusCodeMemoryPpiGuid);
if (GuidHob == NULL) {
return;
}
StatusCodeMemoryPpi = GET_GUID_HOB_DATA (GuidHob);
//
// Copy data to our structure since the HOB will go away at runtime
//
// BUGBUG: Virtualize for RT
//
mStatusCodeMemoryPpi.FirstEntry = (*StatusCodeMemoryPpi)->FirstEntry;
mStatusCodeMemoryPpi.LastEntry = (*StatusCodeMemoryPpi)->LastEntry;
mStatusCodeMemoryPpi.Address = (*StatusCodeMemoryPpi)->Address;
mStatusCodeMemoryPpi.Length = (*StatusCodeMemoryPpi)->Length;
}
VOID
PlaybackStatusCodes (
IN EFI_REPORT_STATUS_CODE ReportStatusCodeFunc
)
/*++
Routine Description:
Call the input ReportStatusCode function with every status code recorded in
the journal.
Arguments:
ReportStatusCode ReportStatusCode function to call.
Returns:
None
--*/
{
UINTN MaxEntry;
EFI_STATUS_CODE_ENTRY *CurrentEntry;
UINTN Counter;
if (ReportStatusCodeFunc == RtMemoryReportStatusCode) {
return ;
}
//
// Playback prior status codes to current listeners
//
MaxEntry = mStatusCodeMemoryPpi.Length / sizeof (EFI_STATUS_CODE_ENTRY);
for (Counter = mStatusCodeMemoryPpi.FirstEntry; Counter != mStatusCodeMemoryPpi.LastEntry; Counter++) {
//
// Check if we have to roll back to beginning of queue buffer
//
if (Counter == MaxEntry) {
Counter = 0;
}
//
// Play current entry
//
CurrentEntry = (EFI_STATUS_CODE_ENTRY *) (UINTN) (mStatusCodeMemoryPpi.Address + (Counter * sizeof (EFI_STATUS_CODE_ENTRY)));
ReportStatusCodeFunc (
CurrentEntry->Type,
CurrentEntry->Value,
CurrentEntry->Instance,
NULL,
NULL
);
}
}

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-->
<LibraryModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
<MbdLibHeader>
<BaseName>EdkRtMemoryStatusCodeLib</BaseName>
<Guid>1517564b-ab66-42b7-8903-731a95f314f9</Guid>
<Version>0</Version>
<Description>FIX ME!</Description>
<Copyright>Copyright (c) 2004 - 2005, Intel Corporation</Copyright>
<License>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</License>
<Created>2006-03-12 17:09</Created>
<Modified>2006-03-19 15:19</Modified>
</MbdLibHeader>
</LibraryModuleBuildDescription>

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-->
<LibraryModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
<MsaLibHeader>
<BaseName>EdkRtMemoryStatusCodeLib</BaseName>
<ModuleType>DXE_DRIVER</ModuleType>
<ComponentType>LIBRARY</ComponentType>
<Guid>1517564b-ab66-42b7-8903-731a95f314f9</Guid>
<Version>0</Version>
<Abstract>Component description file for the PEI library.</Abstract>
<Description>FIX ME!</Description>
<Copyright>Copyright (c) 2004 - 2005, Intel Corporation</Copyright>
<License>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</License>
<Specification>0</Specification>
<Created>2006-03-12 17:09</Created>
<Updated>2006-03-19 15:19</Updated>
</MsaLibHeader>
<LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_PRODUCED">EdkRtMemoryStatusCodeLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">DxeRuntimeDriverLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">ReportStatusCodeLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">PrintLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">HobLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>RtMemoryStatusCode.c</Filename>
</SourceFiles>
<Includes>
<PackageName>MdePkg</PackageName>
<PackageName>EdkModulePkg</PackageName>
</Includes>
</LibraryModuleSurfaceArea>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<project basedir="." default="EdkRtMemoryStatusCodeLib"><!--Apply external ANT tasks-->
<taskdef resource="GenBuild.tasks"/>
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<property environment="env"/>
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
<property name="MODULE_RELATIVE_PATH" value="Library\EdkRuntimeStatusCodeLib\RtMemoryStatusCode"/>
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
<target name="EdkRtMemoryStatusCodeLib">
<GenBuild baseName="EdkRtMemoryStatusCodeLib" mbdFilename="${MODULE_DIR}\RtMemoryStatusCode.mbd" msaFilename="${MODULE_DIR}\RtMemoryStatusCode.msa"/>
</target>
<target depends="EdkRtMemoryStatusCodeLib_clean" name="clean"/>
<target depends="EdkRtMemoryStatusCodeLib_cleanall" name="cleanall"/>
<target name="EdkRtMemoryStatusCodeLib_clean">
<OutputDirSetup baseName="EdkRtMemoryStatusCodeLib" mbdFilename="${MODULE_DIR}\RtMemoryStatusCode.mbd" msaFilename="${MODULE_DIR}\RtMemoryStatusCode.msa"/>
<if>
<available file="${DEST_DIR_OUTPUT}\EdkRtMemoryStatusCodeLib_build.xml"/>
<then>
<ant antfile="${DEST_DIR_OUTPUT}\EdkRtMemoryStatusCodeLib_build.xml" target="clean"/>
</then>
</if>
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
</target>
<target name="EdkRtMemoryStatusCodeLib_cleanall">
<OutputDirSetup baseName="EdkRtMemoryStatusCodeLib" mbdFilename="${MODULE_DIR}\RtMemoryStatusCode.mbd" msaFilename="${MODULE_DIR}\RtMemoryStatusCode.msa"/>
<if>
<available file="${DEST_DIR_OUTPUT}\EdkRtMemoryStatusCodeLib_build.xml"/>
<then>
<ant antfile="${DEST_DIR_OUTPUT}\EdkRtMemoryStatusCodeLib_build.xml" target="cleanall"/>
</then>
</if>
<delete dir="${DEST_DIR_OUTPUT}"/>
<delete dir="${DEST_DIR_DEBUG}"/>
<delete>
<fileset dir="${BIN_DIR}" includes="**EdkRtMemoryStatusCodeLib*"/>
</delete>
</target>
</project>