/* This function is the entry point of this Status Code PEIM. It initializes supported status code devices according to PCD settings, and installs Status Code PPI. */
EFI_STATUS EFIAPI StatusCodeHandlerPeiEntry(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
/* This function is the entry point of this Status Code PEIM. It initializes supported status code devices according to PCD settings, and installs Status Code PPI. */
EFI_STATUS EFIAPI StatusCodeHandlerPeiEntry(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
{
  EFI_STATUS               Status;
  EFI_PEI_RSC_HANDLER_PPI  *RscHandlerPpi;
  Status = PeiServicesLocatePpi (
             &gEfiPeiRscHandlerPpiGuid,
             0,
             NULL,
             (VOID **)&RscHandlerPpi
             );
  ASSERT_EFI_ERROR (Status);
  if (PcdGetBool (PcdStatusCodeUseSerial)) {
    Status = SerialPortInitialize ();
    ASSERT_EFI_ERROR (Status);
    Status = RscHandlerPpi->Register (SerialStatusCodeReportWorker);
    ASSERT_EFI_ERROR (Status);
  }
  if (PcdGetBool (PcdStatusCodeUseMemory)) {
    Status = MemoryStatusCodeInitializeWorker ();
    ASSERT_EFI_ERROR (Status);
    Status = RscHandlerPpi->Register (MemoryStatusCodeReportWorker);
    ASSERT_EFI_ERROR (Status);
  }
  return EFI_SUCCESS;
}