EFI_STATUS
EFIAPI
LockBoxDxeLibInitialize (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
  EFI_STATUS    Status;
  VOID          *Interface;

  Status = LockBoxLibInitialize ();
  if (!EFI_ERROR (Status)) {
    if (QemuFwCfgS3Enabled ()) {
      //
      // When S3 enabled, the first driver run with this library linked will
      // have this library constructor to install LockBox protocol on the
      // ImageHandle. As other drivers may have gEfiLockBoxProtocolGuid
      // dependency, the first driver should run before them.
      //
      Status = gBS->LocateProtocol (&gEfiLockBoxProtocolGuid, NULL, &Interface);
      if (EFI_ERROR (Status)) {
        Status = gBS->InstallProtocolInterface (
                        &ImageHandle,
                        &gEfiLockBoxProtocolGuid,
                        EFI_NATIVE_INTERFACE,
                        NULL
                        );
        ASSERT_EFI_ERROR (Status);
      }
    }
  }

  return Status;
}
Beispiel #2
0
/**
  The Driver Entry Point.
  
  The function is the driver Entry point that will register the End-of-Dxe
  callback.

  @param ImageHandle   A handle for the image that is initializing this driver
  @param SystemTable   A pointer to the EFI system table

  @retval EFI_SUCCESS:              Driver initialized successfully
  @retval EFI_LOAD_ERROR:           Failed to Initialize or has been loaded
  @retval EFI_OUT_OF_RESOURCES      Could not allocate needed resources

**/
EFI_STATUS
EFIAPI
InstallEndOfDxeCallback (
  IN EFI_HANDLE           ImageHandle,
  IN EFI_SYSTEM_TABLE     *SystemTable
  )
{
  EFI_STATUS        Status;
  EFI_EVENT         EndOfDxeEvent;

  if (!QemuFwCfgS3Enabled()) {
    return EFI_LOAD_ERROR;
  }

  Status = gBS->InstallMultipleProtocolInterfaces (
                  &ImageHandle,
                  &gEfiLockBoxProtocolGuid, NULL,
                  NULL
                  );
  ASSERT_EFI_ERROR (Status);

  Status = gBS->CreateEventEx (
                  EVT_NOTIFY_SIGNAL,
                  TPL_CALLBACK,
                  OnEndOfDxe,
                  NULL, /* NotifyContext */
                  &gEfiEndOfDxeEventGroupGuid,
                  &EndOfDxeEvent
                  );
  ASSERT_EFI_ERROR (Status);
  return Status;
}
Beispiel #3
0
/**
  Perform Platform PEI initialization.

  @param  FileHandle      Handle of the file being invoked.
  @param  PeiServices     Describes the list of possible PEI Services.

  @return EFI_SUCCESS     The PEIM initialized successfully.

**/
EFI_STATUS
EFIAPI
InitializePlatform (
    IN       EFI_PEI_FILE_HANDLE  FileHandle,
    IN CONST EFI_PEI_SERVICES     **PeiServices
)
{
    EFI_STATUS    Status;

    DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));

    DebugDumpCmos ();

    XenDetect ();

    if (QemuFwCfgS3Enabled ()) {
        DEBUG ((EFI_D_INFO, "S3 support was detected on QEMU\n"));
        mS3Supported = TRUE;
        Status = PcdSetBoolS (PcdAcpiS3Enable, TRUE);
        ASSERT_EFI_ERROR (Status);
    }

    S3Verification ();
    BootModeInitialization ();
    AddressWidthInitialization ();
    MaxCpuCountInitialization ();

    PublishPeiMemory ();

    InitializeRamRegions ();

    if (mXen) {
        DEBUG ((EFI_D_INFO, "Xen was detected\n"));
        InitializeXen ();
    }

    //
    // Query Host Bridge DID
    //
    mHostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);

    if (mBootMode != BOOT_ON_S3_RESUME) {
        ReserveEmuVariableNvStore ();
        PeiFvInitialization ();
        MemMapInitialization ();
        NoexecDxeInitialization ();
    }

    MiscInitialization ();
    InstallFeatureControlCallback ();

    return EFI_SUCCESS;
}
Beispiel #4
0
/**
  Perform Platform PEI initialization.

  @param  FileHandle      Handle of the file being invoked.
  @param  PeiServices     Describes the list of possible PEI Services.

  @return EFI_SUCCESS     The PEIM initialized successfully.

**/
EFI_STATUS
EFIAPI
InitializePlatform (
  IN       EFI_PEI_FILE_HANDLE  FileHandle,
  IN CONST EFI_PEI_SERVICES     **PeiServices
  )
{
  DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));

  DebugDumpCmos ();

  XenDetect ();

  if (QemuFwCfgS3Enabled ()) {
    DEBUG ((EFI_D_INFO, "S3 support was detected on QEMU\n"));
    mS3Supported = TRUE;
  }

  BootModeInitialization ();

  PublishPeiMemory ();

  InitializeRamRegions ();

  if (mXen) {
    DEBUG ((EFI_D_INFO, "Xen was detected\n"));
    InitializeXen ();
  }

  //
  // Query Host Bridge DID
  //
  mHostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);

  if (mBootMode != BOOT_ON_S3_RESUME) {
    ReserveEmuVariableNvStore ();

    PeiFvInitialization ();

    MemMapInitialization ();
  }

  MiscInitialization ();

  return EFI_SUCCESS;
}