From 9fbf943fc137d3f7f3172cbf4ef42594b0e28679 Mon Sep 17 00:00:00 2001
From: yshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Date: Fri, 21 Jul 2006 14:28:01 +0000
Subject: [PATCH] 1) Check in Pei/Dxe status code; 2) OemHookStatusCodeLib and
 SerialPortLib class and null instance; 3) Remove all referenced code from
 EdkModulePkg,EdkNt32Pkg. 4) Add Nt32OemHookStatusCodeLib.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1069 6f19259b-4bc3-4df7-8a09-765794883524
---
 .../Pei/MonoStatusCode/MonoStatusCode.c       | 150 ----------------
 .../Pei/MonoStatusCode/MonoStatusCode.dxs     |  28 ---
 .../Pei/MonoStatusCode/MonoStatusCode.h       | 111 ------------
 .../Pei/MonoStatusCode/MonoStatusCode.msa     |  81 ---------
 .../Pei/MonoStatusCode/PlatformStatusCode.c   | 164 ------------------
 5 files changed, 534 deletions(-)
 delete mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.c
 delete mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.dxs
 delete mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.h
 delete mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.msa
 delete mode 100644 EdkNt32Pkg/Pei/MonoStatusCode/PlatformStatusCode.c

diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.c b/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.c
deleted file mode 100644
index 27c73f576e..0000000000
--- a/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*++
-
-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:
-
-  MonoStatusCode.c
-
-Abstract:
-
-  PEIM to provide the status code functionality, to aid in system debug.
-  It includes output to 0x80 port and/or to serial port.  
-  This PEIM is monolithic. Different platform should provide different library.
-
---*/
-
-#include "MonoStatusCode.h"
-
-//
-// Module globals
-//
-// 
-EFI_PEI_PROGRESS_CODE_PPI     mStatusCodePpi      = { PlatformReportStatusCode };
-
-EFI_PEI_PPI_DESCRIPTOR  mPpiListStatusCode = {
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-  &gEfiPeiStatusCodePpiGuid,
-  &mStatusCodePpi
-};
-
-//
-// Function implemenations
-//
-EFI_STATUS
-EFIAPI
-TranslateDxeStatusCodeToPeiStatusCode (
-  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:
-
-  Translate from a DXE status code interface into a PEI-callable
-  interface, making the PEI the least common denominator..
-
-Arguments:
-
-  Same as DXE ReportStatusCode RT service
-  
-Returns:
-
-  None
-
---*/
-{
-  return PlatformReportStatusCode (NULL, CodeType, Value, Instance, CallerId, Data);
-}
-
-EFI_STATUS
-EFIAPI
-InitializeDxeReportStatusCode (
-  IN EFI_PEI_SERVICES       **PeiServices
-  )
-/*++
-
-Routine Description:
-
-  Build a hob describing the status code listener that has been installed.
-  This will be used by DXE code until a runtime status code listener is 
-  installed.
-
-Arguments:
-
-  PeiServices      - General purpose services available to every PEIM.
-    
-Returns:
-
-  Status -  EFI_SUCCESS if the interface could be successfully
-            installed
-
---*/
-{
-  VOID        *Instance;
-  VOID        *HobData;
-
-  Instance = (VOID *) (UINTN) TranslateDxeStatusCodeToPeiStatusCode;
-
-  HobData = BuildGuidDataHob (
-              &gEfiStatusCodeRuntimeProtocolGuid,
-              &Instance,
-              sizeof (VOID *)
-              );
-
-  ASSERT (HobData != NULL);
-  return EFI_SUCCESS;
-}
-
-VOID
-EFIAPI
-InitializeMonoStatusCode (
-  IN EFI_FFS_FILE_HEADER       *FfsHeader,
-  IN EFI_PEI_SERVICES          **PeiServices
-  )
-/*++
-
-Routine Description:
-
-  Initialize the platform status codes and publish the platform status code 
-  PPI.
-
-Arguments:
-
-  FfsHeader   - FV this PEIM was loaded from.
-  PeiServices - General purpose services available to every PEIM.
-    
-Returns:
-
-  Status -  EFI_SUCCESS
-
---*/
-{
-  EFI_STATUS  Status;
-
-  //
-  // Initialize status code listeners.
-  //
-  PlatformInitializeStatusCode (FfsHeader, PeiServices);
-
-  //
-  // Publish the status code capability to other modules
-  //
-  Status = (*PeiServices)->InstallPpi (PeiServices, &mPpiListStatusCode);
-
-  ASSERT_EFI_ERROR (Status);
-
-  DEBUG ((EFI_D_ERROR, "\nMono Status Code PEIM Loaded\n"));
-
-  return ;
-}
diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.dxs b/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.dxs
deleted file mode 100644
index 3c86da0c63..0000000000
--- a/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.dxs
+++ /dev/null
@@ -1,28 +0,0 @@
-/*++
-
-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:
-
-  MonoStatusCode.dxs
-
-Abstract:
-
-  Dependency expression file for monolithic Status Code PEIM.
-  
---*/  
-#include <AutoGen.h>
-#include <PeimDepex.h>
-
-DEPENDENCY_START
-   TRUE
-DEPENDENCY_END
-
-
diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.h b/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.h
deleted file mode 100644
index 38a9022558..0000000000
--- a/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*++
-
-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:
-  
-  MonoStatusCode.h
-   
-Abstract:
-
-  Monolithic single PEIM to provide the status code functionality.
-  The PEIM is a blend of libraries that correspond to the different status code
-  listeners that a platform installs.
-
---*/
-
-#ifndef _MONO_STATUS_CODE_H_
-#define _MONO_STATUS_CODE_H_
-
-//
-// Platform specific function Declarations.  These must be implemented in a
-// subdirectory named PlatformName in a file named PlatformStatusCode.c.
-// See D845GRG\PlatformStatusCode.c for an example of a simple status code
-// implementation.
-// See Nt32\PlatformStatusCode.c for an example of a status code implementation
-// that relocates itself into memory.
-//
-//
-// This is the driver entry point and must be defined.
-//
-EFI_STATUS
-EFIAPI
-InstallMonoStatusCode (
-  IN EFI_FFS_FILE_HEADER       *FfsHeader,
-  IN EFI_PEI_SERVICES          **PeiServices
-  )
-;
-
-//
-// This is the platform function to initialize the listeners desired by the
-// platform.
-//
-VOID
-PlatformInitializeStatusCode (
-  IN EFI_FFS_FILE_HEADER       *FfsHeader,
-  IN EFI_PEI_SERVICES          **PeiServices
-  )
-;
-
-//
-// This is the platform function that calls all of the listeners desired by the
-// platform.
-//
-EFI_STATUS
-EFIAPI
-PlatformReportStatusCode (
-  IN EFI_PEI_SERVICES         **PeiServices,
-  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
-  )
-;
-
-//
-// Platform independent function Declarations
-//
-//
-// Initialize the status code listeners and publish the status code PPI.
-//
-VOID
-EFIAPI
-InitializeMonoStatusCode (
-  IN EFI_FFS_FILE_HEADER       *FfsHeader,
-  IN EFI_PEI_SERVICES          **PeiServices
-  )
-;
-
-//
-// Convert a DXE status code call into a PEI status code call.
-//
-EFI_STATUS
-EFIAPI
-TranslateDxeStatusCodeToPeiStatusCode (
-  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
-  )
-;
-
-//
-// Publish a HOB that contains the listener to be used by DXE.
-//
-EFI_STATUS
-EFIAPI
-InitializeDxeReportStatusCode (
-  IN EFI_PEI_SERVICES       **PeiServices
-  )
-;
-
-#endif
diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.msa b/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.msa
deleted file mode 100644
index b56436db27..0000000000
--- a/EdkNt32Pkg/Pei/MonoStatusCode/MonoStatusCode.msa
+++ /dev/null
@@ -1,81 +0,0 @@
-<?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">
-  <MsaHeader>
-    <ModuleName>MonoStatusCode</ModuleName>
-    <ModuleType>PEIM</ModuleType>
-    <GuidValue>1501614E-0E6C-4ef4-8B8F-C276CDFB646F</GuidValue>
-    <Version>1.0</Version>
-    <Abstract>Mono status code driver</Abstract>
-    <Description>
-      PEIM to provide the status code functionality, to aid in system debug.
-      It includes output to 0x80 port and/or to serial port.  
-      This PEIM is monolithic. Different platform should provide different library.
-    </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>MonoStatusCode</OutputFileBasename>
-  </ModuleDefinitions>
-  <LibraryClassDefinitions>
-    <LibraryClass Usage="ALWAYS_CONSUMED">
-      <Keyword>DebugLib</Keyword>
-    </LibraryClass>
-    <LibraryClass Usage="ALWAYS_CONSUMED">
-      <Keyword>PeimEntryPoint</Keyword>
-    </LibraryClass>
-    <LibraryClass Usage="ALWAYS_CONSUMED">
-      <Keyword>EdkMemoryStatusCodeLib</Keyword>
-    </LibraryClass>
-    <LibraryClass Usage="ALWAYS_CONSUMED">
-      <Keyword>HobLib</Keyword>
-    </LibraryClass>
-  </LibraryClassDefinitions>
-  <SourceFiles>
-    <Filename>MonoStatusCode.dxs</Filename>
-    <Filename>MonoStatusCode.h</Filename>
-    <Filename>MonoStatusCode.c</Filename>
-    <Filename>PlatformStatusCode.c</Filename>
-  </SourceFiles>
-  <PackageDependencies>
-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
-    <Package PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674"/>
-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>
-  </PackageDependencies>
-  <Protocols>
-    <Protocol Usage="SOMETIMES_CONSUMED">
-      <ProtocolCName>gEfiStatusCodeRuntimeProtocolGuid</ProtocolCName>
-    </Protocol>
-  </Protocols>
-  <PPIs>
-    <Ppi Usage="ALWAYS_CONSUMED">
-      <PpiCName>gEfiPeiStatusCodePpiGuid</PpiCName>
-    </Ppi>
-    <Ppi Usage="SOMETIMES_CONSUMED">
-      <PpiCName>gEfiPeiFvFileLoaderPpiGuid</PpiCName>
-    </Ppi>
-  </PPIs>
-  <Externs>
-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
-    <Extern>
-      <ModuleEntryPoint>InstallMonoStatusCode</ModuleEntryPoint>
-    </Extern>
-  </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Pei/MonoStatusCode/PlatformStatusCode.c b/EdkNt32Pkg/Pei/MonoStatusCode/PlatformStatusCode.c
deleted file mode 100644
index 919ab05ee7..0000000000
--- a/EdkNt32Pkg/Pei/MonoStatusCode/PlatformStatusCode.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*++
-
-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:
-
-  PlatformStatusCode.c 
-   
-Abstract:
-
-  Contains NT32 specific implementations required to use status codes.
-
---*/
-
-#include "MonoStatusCode.h"
-
-
-BOOLEAN gRunningFromMemory = FALSE;
-//
-// Platform definitions
-//
-EFI_PEI_REPORT_STATUS_CODE  mSecReportStatusCode = NULL;
-
-extern EFI_PEI_PROGRESS_CODE_PPI  mStatusCodePpi;
-
-//
-// Function implementations
-//
-EFI_STATUS
-EFIAPI
-PlatformReportStatusCode (
-  IN EFI_PEI_SERVICES         **PeiServices,
-  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:
-
-  Call all status code listeners in the MonoStatusCode.
-
-Arguments:
-
-  Same as ReportStatusCode service
-  
-Returns:
-
-  EFI_SUCCESS     Always returns success.
-
---*/
-{
-  if (mSecReportStatusCode != NULL) {
-    mSecReportStatusCode (PeiServices, CodeType, Value, Instance, CallerId, Data);
-  }
-  MemoryReportStatusCode (CodeType, Value, Instance, CallerId, Data);
-  return EFI_SUCCESS;
-}
-
-VOID
-PlatformInitializeStatusCode (
-  IN EFI_FFS_FILE_HEADER       *FfsHeader,
-  IN EFI_PEI_SERVICES          **PeiServices
-  )
-/*++
-
-Routine Description:
-
-  Initialize the status code listeners.  This consists of locating the 
-  listener produced by SecMain.exe.
-
-Arguments:
-
-  FfsHeader   - FV this PEIM was loaded from.
-  PeiServices - General purpose services available to every PEIM.
-
-Returns:
-
-  None
-
---*/
-{
-  EFI_STATUS                  Status;
-  EFI_PEI_PROGRESS_CODE_PPI   *ReportStatusCodePpi;
-  EFI_PEI_PPI_DESCRIPTOR      *ReportStatusCodeDescriptor;
-
-  //
-  // Cache the existing status code listener installed by the SEC core.
-  // We should actually do a heap allocate, install a PPI, etc, but since we
-  // know that we are running from a DLL, we can use global variables, and
-  // directly update the status code PPI descriptor
-  //
-  //
-  // Locate SEC status code PPI
-  //
-  Status = (*PeiServices)->LocatePpi (
-                            PeiServices,
-                            &gEfiPeiStatusCodePpiGuid,
-                            0,
-                            &ReportStatusCodeDescriptor,
-                            &ReportStatusCodePpi
-                            );
-  if (EFI_ERROR (Status)) {
-    return ;
-  }
-
-  mSecReportStatusCode            = ReportStatusCodePpi->ReportStatusCode;
-  ReportStatusCodeDescriptor->Ppi = &mStatusCodePpi;
-
-  //
-  // Always initialize memory status code listener.
-  //
-  MemoryStatusCodeInitialize (FfsHeader, PeiServices);
-
-}
-
-EFI_STATUS
-EFIAPI
-InstallMonoStatusCode (
-  IN EFI_FFS_FILE_HEADER       *FfsHeader,
-  IN EFI_PEI_SERVICES          **PeiServices
-  )
-/*++
-
-Routine Description:
-
-  Install the PEIM.  Publish the DXE callback as well.
-
-Arguments:
-
-  FfsHeader   - FV this PEIM was loaded from.
-  PeiServices - General purpose services available to every PEIM.
-
-Returns:
-
-  EFI_SUCCESS   The function always returns success.
-
---*/
-{
-  if (!gRunningFromMemory) {
-    //
-    // First pass, running from flash, initialize everything
-    //
-    InitializeMonoStatusCode (FfsHeader, PeiServices);
-  } else {
-    //
-    // Second pass, running from memory, initialize memory listener and
-    // publish the DXE listener in a HOB.
-    //
-    MemoryStatusCodeInitialize (FfsHeader, PeiServices);
-    InitializeDxeReportStatusCode (PeiServices);
-  }
-
-  return EFI_SUCCESS;
-}