ForceRecovery.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /** @file
  2. Application that sets a sticky bit to force recovery on next reset.
  3. Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #include <Uefi.h>
  7. #include <Library/UefiRuntimeServicesTableLib.h>
  8. #include <Library/QNCAccessLib.h>
  9. /**
  10. The user Entry Point for Application. The user code starts with this function
  11. as the real entry point for the application.
  12. @param[in] ImageHandle The firmware allocated handle for the EFI image.
  13. @param[in] SystemTable A pointer to the EFI System Table.
  14. @retval EFI_SUCCESS The entry point is executed successfully.
  15. @retval other Some error occurs when executing this entry point.
  16. **/
  17. EFI_STATUS
  18. EFIAPI
  19. UefiMain (
  20. IN EFI_HANDLE ImageHandle,
  21. IN EFI_SYSTEM_TABLE *SystemTable
  22. )
  23. {
  24. //
  25. // Set 'B_CFG_STICKY_RW_FORCE_RECOVERY' sticky bit so we know we need to do a recovery following warm reset
  26. //
  27. QNCAltPortWrite (
  28. QUARK_SCSS_SOC_UNIT_SB_PORT_ID,
  29. QUARK_SCSS_SOC_UNIT_CFG_STICKY_RW,
  30. QNCAltPortRead (QUARK_SCSS_SOC_UNIT_SB_PORT_ID, QUARK_SCSS_SOC_UNIT_CFG_STICKY_RW) | B_CFG_STICKY_RW_FORCE_RECOVERY
  31. );
  32. //
  33. // Do a warm reset
  34. //
  35. gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
  36. return EFI_SUCCESS;
  37. }