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:
163
EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.c
Normal file
163
EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.c
Normal file
@@ -0,0 +1,163 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
DataHubStdErr.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Data Hub filter driver that takes DEBUG () info from Data Hub and writes it
|
||||
to StdErr if it exists.
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
|
||||
EFI_DATA_HUB_PROTOCOL *mDataHub = NULL;
|
||||
|
||||
EFI_EVENT mDataHubStdErrEvent;
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
DataHubStdErrEventHandler (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Event handler registered with the Data Hub to parse EFI_DEBUG_CODE. This
|
||||
handler reads the Data Hub and sends any DEBUG info to StdErr.
|
||||
|
||||
Arguments:
|
||||
Event - The event that occured, not used
|
||||
Context - DataHub Protocol Pointer
|
||||
|
||||
Returns:
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DATA_HUB_PROTOCOL *DataHub;
|
||||
EFI_DATA_RECORD_HEADER *Record;
|
||||
DATA_HUB_STATUS_CODE_DATA_RECORD *DataRecord;
|
||||
UINT64 Mtc;
|
||||
EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto;
|
||||
INT32 OldAttribute;
|
||||
|
||||
DataHub = (EFI_DATA_HUB_PROTOCOL *) Context;
|
||||
|
||||
//
|
||||
// If StdErr is not yet initialized just return a DEBUG print in the BDS
|
||||
// after consoles are connect will make sure data gets flushed properly
|
||||
// when StdErr is availible.
|
||||
//
|
||||
if (gST == NULL) {
|
||||
return ;
|
||||
}
|
||||
|
||||
if (gST->StdErr == NULL) {
|
||||
return ;
|
||||
}
|
||||
//
|
||||
// Mtc of zero means return the next record that has not been read by the
|
||||
// event handler.
|
||||
//
|
||||
Mtc = 0;
|
||||
do {
|
||||
Status = DataHub->GetNextRecord (DataHub, &Mtc, &mDataHubStdErrEvent, &Record);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if (CompareGuid (&Record->DataRecordGuid, &gEfiStatusCodeGuid)) {
|
||||
DataRecord = (DATA_HUB_STATUS_CODE_DATA_RECORD *) (((CHAR8 *) Record) + Record->HeaderSize);
|
||||
|
||||
if (DataRecord->Data.HeaderSize > 0) {
|
||||
if (CompareGuid (&DataRecord->Data.Type, &gEfiStatusCodeDataTypeDebugGuid)) {
|
||||
//
|
||||
// If the Data record is from a DEBUG () then send it to Standard Error
|
||||
//
|
||||
Sto = gST->StdErr;
|
||||
OldAttribute = Sto->Mode->Attribute;
|
||||
Sto->SetAttribute (Sto, EFI_TEXT_ATTR (EFI_MAGENTA, EFI_BLACK));
|
||||
Sto->OutputString (Sto, (CHAR16 *) (DataRecord + 1));
|
||||
Sto->SetAttribute (Sto, OldAttribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while ((Mtc != 0) && !EFI_ERROR (Status));
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DataHubStdErrInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Register an event handler with the Data Hub to parse EFI_DEBUG_CODE. This
|
||||
handler reads the Data Hub and sends any DEBUG info to StdErr.
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - Image handle of this driver.
|
||||
SystemTable - Pointer to EFI system table.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The event handler was registered.
|
||||
EFI_OUT_OF_RESOURCES - The event hadler was not registered due to lack of
|
||||
system resources.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT64 DataClass;
|
||||
|
||||
gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID **) &mDataHub);
|
||||
//
|
||||
// Should never fail due to Depex grammer.
|
||||
//
|
||||
ASSERT (mDataHub != NULL);
|
||||
|
||||
//
|
||||
// Create an event and register it with the filter driver
|
||||
//
|
||||
Status = gBS->CreateEvent (
|
||||
EFI_EVENT_NOTIFY_SIGNAL,
|
||||
EFI_TPL_CALLBACK,
|
||||
DataHubStdErrEventHandler,
|
||||
mDataHub,
|
||||
&mDataHubStdErrEvent
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
DataClass = EFI_DATA_RECORD_CLASS_DEBUG | EFI_DATA_RECORD_CLASS_ERROR;
|
||||
Status = mDataHub->RegisterFilterDriver (
|
||||
mDataHub,
|
||||
mDataHubStdErrEvent,
|
||||
EFI_TPL_CALLBACK,
|
||||
DataClass,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->CloseEvent (mDataHubStdErrEvent);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
DataHubStdErr.dxs
|
||||
|
||||
Abstract:
|
||||
|
||||
Dependency expression source file.
|
||||
|
||||
--*/
|
||||
#include <AutoGen.h>
|
||||
#include <DxeDepex.h>
|
||||
|
||||
|
||||
DEPENDENCY_START
|
||||
EFI_DATA_HUB_PROTOCOL_GUID
|
||||
DEPENDENCY_END
|
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>DataHubStdErr</BaseName>
|
||||
<Guid>CA515306-00CE-4032-874E-11B755FF6866</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
|
||||
<License>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
</License>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-19 15:19</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>BaseLib</Library>
|
||||
</Libraries>
|
||||
<BuildOptions ToolChain="MSFT">
|
||||
<ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>
|
||||
</BuildOptions>
|
||||
</ModuleBuildDescription>
|
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>DataHubStdErr</BaseName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>CA515306-00CE-4032-874E-11B755FF6866</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for DiskIo module.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
|
||||
<License>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
</License>
|
||||
<Specification>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-19 15:19</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>DataHubStdErr.c</Filename>
|
||||
<Filename>DataHubStdErr.dxs</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">DataHub</Protocol>
|
||||
</Protocols>
|
||||
<Guids>
|
||||
<GuidEntry Usage="SOMETIMES_CONSUMED">
|
||||
<C_Name>StatusCode</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="SOMETIMES_CONSUMED">
|
||||
<C_Name>StatusCodeDataTypeDebug</C_Name>
|
||||
</GuidEntry>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>DataHubStdErrInitialize</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
47
EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/build.xml
Normal file
47
EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/build.xml
Normal 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="DataHubStdErr"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Universal\DataHub\DataHubStdErr\Dxe"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="DataHubStdErr">
|
||||
<GenBuild baseName="DataHubStdErr" mbdFilename="${MODULE_DIR}\DataHubStdErr.mbd" msaFilename="${MODULE_DIR}\DataHubStdErr.msa"/>
|
||||
</target>
|
||||
<target depends="DataHubStdErr_clean" name="clean"/>
|
||||
<target depends="DataHubStdErr_cleanall" name="cleanall"/>
|
||||
<target name="DataHubStdErr_clean">
|
||||
<OutputDirSetup baseName="DataHubStdErr" mbdFilename="${MODULE_DIR}\DataHubStdErr.mbd" msaFilename="${MODULE_DIR}\DataHubStdErr.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\DataHubStdErr_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\DataHubStdErr_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="DataHubStdErr_cleanall">
|
||||
<OutputDirSetup baseName="DataHubStdErr" mbdFilename="${MODULE_DIR}\DataHubStdErr.mbd" msaFilename="${MODULE_DIR}\DataHubStdErr.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\DataHubStdErr_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\DataHubStdErr_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**DataHubStdErr*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
Reference in New Issue
Block a user