Home | History | Annotate | Download | only in Pei
      1 /** @file
      2   Report Status Code Handler PEIM which produces general handlers and hook them
      3   onto the PEI status code router.
      4 
      5   Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
      6   This program and the accompanying materials
      7   are licensed and made available under the terms and conditions of the BSD License
      8   which accompanies this distribution.  The full text of the license may be found at
      9   http://opensource.org/licenses/bsd-license.php
     10 
     11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 
     14 **/
     15 
     16 #include "StatusCodeHandlerPei.h"
     17 
     18 /**
     19   Entry point of Status Code PEIM.
     20 
     21   This function is the entry point of this Status Code PEIM.
     22   It initializes supported status code devices according to PCD settings,
     23   and installs Status Code PPI.
     24 
     25   @param  FileHandle  Handle of the file being invoked.
     26   @param  PeiServices Describes the list of possible PEI Services.
     27 
     28   @retval EFI_SUCESS  The entry point of DXE IPL PEIM executes successfully.
     29 
     30 **/
     31 EFI_STATUS
     32 EFIAPI
     33 StatusCodeHandlerPeiEntry (
     34   IN       EFI_PEI_FILE_HANDLE  FileHandle,
     35   IN CONST EFI_PEI_SERVICES     **PeiServices
     36   )
     37 {
     38   EFI_STATUS                  Status;
     39   EFI_PEI_RSC_HANDLER_PPI     *RscHandlerPpi;
     40 
     41   Status = PeiServicesLocatePpi (
     42              &gEfiPeiRscHandlerPpiGuid,
     43              0,
     44              NULL,
     45              (VOID **) &RscHandlerPpi
     46              );
     47   ASSERT_EFI_ERROR (Status);
     48 
     49   //
     50   // Dispatch initialization request to sub-statuscode-devices.
     51   // If enable UseSerial, then initialize serial port.
     52   // if enable UseMemory, then initialize memory status code worker.
     53   //
     54   if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
     55     Status = SerialPortInitialize();
     56     ASSERT_EFI_ERROR (Status);
     57     Status = RscHandlerPpi->Register (SerialStatusCodeReportWorker);
     58     ASSERT_EFI_ERROR (Status);
     59   }
     60   if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
     61     Status = MemoryStatusCodeInitializeWorker ();
     62     ASSERT_EFI_ERROR (Status);
     63     Status = RscHandlerPpi->Register (MemoryStatusCodeReportWorker);
     64     ASSERT_EFI_ERROR (Status);
     65   }
     66 
     67   return EFI_SUCCESS;
     68 }
     69 
     70