Cmos.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /** @file
  2. PC/AT CMOS access routines
  3. Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
  4. Copyright (c) 2019, Citrix Systems, Inc.
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #include "Cmos.h"
  8. #include "Library/IoLib.h"
  9. /**
  10. Reads 8-bits of CMOS data.
  11. Reads the 8-bits of CMOS data at the location specified by Index.
  12. The 8-bit read value is returned.
  13. @param Index The CMOS location to read.
  14. @return The value read.
  15. **/
  16. UINT8
  17. EFIAPI
  18. CmosRead8 (
  19. IN UINTN Index
  20. )
  21. {
  22. IoWrite8 (0x70, (UINT8)Index);
  23. return IoRead8 (0x71);
  24. }
  25. /**
  26. Writes 8-bits of CMOS data.
  27. Writes 8-bits of CMOS data to the location specified by Index
  28. with the value specified by Value and returns Value.
  29. @param Index The CMOS location to write.
  30. @param Value The value to write to CMOS.
  31. @return The value written to CMOS.
  32. **/
  33. UINT8
  34. EFIAPI
  35. CmosWrite8 (
  36. IN UINTN Index,
  37. IN UINT8 Value
  38. )
  39. {
  40. IoWrite8 (0x70, (UINT8)Index);
  41. IoWrite8 (0x71, Value);
  42. return Value;
  43. }