]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/XenPlatformPei/Cmos.c
OvmfPkg: Import XENMEM_memory_map hypercall to Xen/memory.h
[mirror_edk2.git] / OvmfPkg / XenPlatformPei / Cmos.c
1 /** @file
2 PC/AT CMOS access routines
3
4 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2019, Citrix Systems, Inc.
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11
12 #include "Cmos.h"
13 #include "Library/IoLib.h"
14
15 /**
16 Reads 8-bits of CMOS data.
17
18 Reads the 8-bits of CMOS data at the location specified by Index.
19 The 8-bit read value is returned.
20
21 @param Index The CMOS location to read.
22
23 @return The value read.
24
25 **/
26 UINT8
27 EFIAPI
28 CmosRead8 (
29 IN UINTN Index
30 )
31 {
32 IoWrite8 (0x70, (UINT8) Index);
33 return IoRead8 (0x71);
34 }
35
36
37 /**
38 Writes 8-bits of CMOS data.
39
40 Writes 8-bits of CMOS data to the location specified by Index
41 with the value specified by Value and returns Value.
42
43 @param Index The CMOS location to write.
44 @param Value The value to write to CMOS.
45
46 @return The value written to CMOS.
47
48 **/
49 UINT8
50 EFIAPI
51 CmosWrite8 (
52 IN UINTN Index,
53 IN UINT8 Value
54 )
55 {
56 IoWrite8 (0x70, (UINT8) Index);
57 IoWrite8 (0x71, Value);
58 return Value;
59 }
60