]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/PlatformPei/Cmos.c
Create smbios table before ReadyToBoot event. For SMBIOS thunk driver, create/update...
[mirror_edk2.git] / OvmfPkg / PlatformPei / Cmos.c
1 /** @file
2 PC/AT CMOS access routines
3
4 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15
16 #include "Cmos.h"
17 #include "Library/IoLib.h"
18
19 /**
20 Reads 8-bits of CMOS data.
21
22 Reads the 8-bits of CMOS data at the location specified by Index.
23 The 8-bit read value is returned.
24
25 @param Index The CMOS location to read.
26
27 @return The value read.
28
29 **/
30 UINT8
31 EFIAPI
32 CmosRead8 (
33 IN UINTN Index
34 )
35 {
36 IoWrite8 (0x70, (UINT8) Index);
37 return IoRead8 (0x71);
38 }
39
40
41 /**
42 Writes 8-bits of CMOS data.
43
44 Writes 8-bits of CMOS data to the location specified by Index
45 with the value specified by Value and returns Value.
46
47 @param Index The CMOS location to write.
48 @param Value The value to write to CMOS.
49
50 @return The value written to CMOS.
51
52 **/
53 UINT8
54 EFIAPI
55 CmosWrite8 (
56 IN UINTN Index,
57 IN UINT8 Value
58 )
59 {
60 IoWrite8 (0x70, (UINT8) Index);
61 IoWrite8 (0x71, Value);
62 return Value;
63 }
64