PlatformCmosAccessLib.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /** @file
  2. Platform CMOS Access Library.
  3. @copyright
  4. Copyright 2015 - 2021 Intel Corporation. <BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #include <Library/IoLib.h>
  8. #include <Library/PlatformCmosAccessLib.h>
  9. #include <Platform.h>
  10. #include <Uefi.h>
  11. #include <PiPei.h>
  12. #include <Library/PchInfoLib.h>
  13. #include <Register/PchRegsPcr.h>
  14. #include <Library/PeiServicesLib.h>
  15. #include <Ppi/DynamicSiLibraryPpi.h>
  16. #include <Library/DebugLib.h>
  17. /**
  18. Return the platform CMOS entries.
  19. @param [out] EnryCount Number of platform CMOS entries.
  20. @return Platform CMOS entries.
  21. **/
  22. CMOS_ENTRY *
  23. EFIAPI
  24. PlatformCmosGetEntry (
  25. OUT UINTN *EntryCount
  26. )
  27. {
  28. *EntryCount = 0;
  29. return NULL;
  30. }
  31. /**
  32. Return the NMI enable status.
  33. **/
  34. BOOLEAN
  35. EFIAPI
  36. PlatformCmosGetNmiState (
  37. VOID
  38. )
  39. {
  40. volatile UINT32 Data32;
  41. BOOLEAN Nmi;
  42. Data32 = 0;
  43. EFI_STATUS Status = EFI_SUCCESS;
  44. DYNAMIC_SI_LIBARY_PPI *DynamicSiLibraryPpi = NULL;
  45. Status = PeiServicesLocatePpi (&gDynamicSiLibraryPpiGuid, 0, NULL, (VOID **) &DynamicSiLibraryPpi);
  46. if (EFI_ERROR (Status)) {
  47. ASSERT_EFI_ERROR (Status);
  48. return FALSE;
  49. }
  50. //
  51. // Preserve NMI bit setting
  52. //
  53. if ((DynamicSiLibraryPpi->ReadNmiEn ())& B_PCH_IO_NMI_EN_NMI_EN) {
  54. Nmi = TRUE;
  55. }
  56. else
  57. Nmi = FALSE;
  58. return Nmi;
  59. }