summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Universal/DataHubStdErrDxe
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2007-07-18 14:24:10 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2007-07-18 14:24:10 +0000
commit69b26c155a943267c38b0d770e8a83dfc82ef189 (patch)
treef5107c55282f79f11493b2b9b5caef0eb2f0456e /IntelFrameworkModulePkg/Universal/DataHubStdErrDxe
parenta0741b93e128587b8f2b033f0efcbd5b900dc904 (diff)
downloadedk2-platforms-69b26c155a943267c38b0d770e8a83dfc82ef189.tar.xz
Adjust directory structures.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3322 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Universal/DataHubStdErrDxe')
-rw-r--r--IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErr.c181
-rw-r--r--IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErrDxe.inf108
-rw-r--r--IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErrDxe.msa73
3 files changed, 362 insertions, 0 deletions
diff --git a/IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErr.c b/IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErr.c
new file mode 100644
index 0000000000..5a762e09e9
--- /dev/null
+++ b/IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErr.c
@@ -0,0 +1,181 @@
+/*++
+
+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.
+
+--*/
+
+//
+// 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 <Guid/StatusCodeDataTypeId.h>
+#include <Protocol/DataHub.h>
+#include <Protocol/SimpleTextOut.h>
+//
+// The Library classes this module consumes
+//
+#include <Library/DebugLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+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_OUTPUT_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 (
+ EVT_NOTIFY_SIGNAL,
+ 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,
+ TPL_CALLBACK,
+ DataClass,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ gBS->CloseEvent (mDataHubStdErrEvent);
+ }
+
+ return Status;
+}
diff --git a/IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErrDxe.inf b/IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErrDxe.inf
new file mode 100644
index 0000000000..e4dc6469bf
--- /dev/null
+++ b/IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErrDxe.inf
@@ -0,0 +1,108 @@
+#/** @file
+# Component description file for Data Hub filter driver.
+#
+# This driver takes DEBUG () info from Data Hub and writes it to StdErr if it exists.
+# Copyright (c) 2006 - 2007, 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 = DataHubStdErrDxe
+ FILE_GUID = CA515306-00CE-4032-874E-11B755FF6866
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ EDK_RELEASE_VERSION = 0x00020000
+ EFI_SPECIFICATION_VERSION = 0x00020000
+
+ ENTRY_POINT = DataHubStdErrInitialize
+
+#
+# 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]
+ DataHubStdErr.c
+
+################################################################################
+#
+# 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]
+ UefiBootServicesTableLib
+ BaseMemoryLib
+ UefiDriverEntryPoint
+ DebugLib
+
+
+################################################################################
+#
+# Guid C Name Section - list of Guids that this module uses or produces.
+#
+################################################################################
+
+[Guids]
+ gEfiStatusCodeDataTypeDebugGuid # SOMETIMES_CONSUMED
+ gEfiStatusCodeGuid # SOMETIMES_CONSUMED
+
+
+################################################################################
+#
+# Protocol C Name Section - list of Protocol and Protocol Notify C Names
+# that this module uses or produces.
+#
+################################################################################
+
+[Protocols]
+ gEfiDataHubProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+
+
+################################################################################
+#
+# Dependency Expression Section - list of Dependency expressions that are required for
+# this module.
+#
+################################################################################
+
+[Depex]
+ gEfiDataHubProtocolGuid
+
diff --git a/IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErrDxe.msa b/IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErrDxe.msa
new file mode 100644
index 0000000000..b1d4c6114d
--- /dev/null
+++ b/IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErrDxe.msa
@@ -0,0 +1,73 @@
+<?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>DataHubStdErr</ModuleName>
+ <ModuleType>DXE_DRIVER</ModuleType>
+ <GuidValue>CA515306-00CE-4032-874E-11B755FF6866</GuidValue>
+ <Version>1.0</Version>
+ <Abstract>Component description file for Data Hub filter driver.</Abstract>
+ <Description>This driver takes DEBUG () info from Data Hub and writes it to StdErr if it exists.</Description>
+ <Copyright>Copyright (c) 2006 - 2007, 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>DataHubStdErr</OutputFileBasename>
+ </ModuleDefinitions>
+ <LibraryClassDefinitions>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>DebugLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiDriverEntryPoint</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>BaseMemoryLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiBootServicesTableLib</Keyword>
+ </LibraryClass>
+ </LibraryClassDefinitions>
+ <SourceFiles>
+ <Filename>DataHubStdErr.c</Filename>
+ <Filename>DataHubStdErr.dxs</Filename>
+ </SourceFiles>
+ <PackageDependencies>
+ <Package PackageGuid="1E73767F-8F52-4603-AEB4-F29B510B6766"/>
+ <Package PackageGuid="2759ded5-bb57-4b06-af4f-c398fa552719"/>
+ <Package PackageGuid="88894582-7553-4822-B484-624E24B6DECF"/>
+ </PackageDependencies>
+ <Protocols>
+ <Protocol Usage="ALWAYS_CONSUMED">
+ <ProtocolCName>gEfiDataHubProtocolGuid</ProtocolCName>
+ </Protocol>
+ </Protocols>
+ <DataHubs>
+ <DataHubRecord Usage="SOMETIMES_CONSUMED">
+ <DataHubCName>DATA_HUB_STATUS_CODE_DATA_RECORD</DataHubCName>
+ <HelpText>DEBUG() data that is recorded in status code data hub will be sent to Standard Error.</HelpText>
+ </DataHubRecord>
+ </DataHubs>
+ <Guids>
+ <GuidCNames Usage="SOMETIMES_CONSUMED">
+ <GuidCName>gEfiStatusCodeGuid</GuidCName>
+ </GuidCNames>
+ <GuidCNames Usage="SOMETIMES_CONSUMED">
+ <GuidCName>gEfiStatusCodeDataTypeDebugGuid</GuidCName>
+ </GuidCNames>
+ </Guids>
+ <Externs>
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
+ <Extern>
+ <ModuleEntryPoint>DataHubStdErrInitialize</ModuleEntryPoint>
+ </Extern>
+ </Externs>
+</ModuleSurfaceArea>