VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Library/PlatformInitLib/Cmos.c

Last change on this file was 99404, checked in by vboxsync, 2 years ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1/** @file
2 PC/AT CMOS access routines
3
4 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include <Library/PlatformInitLib.h>
10#include <Library/DebugLib.h>
11#include "Library/IoLib.h"
12
13/**
14 Reads 8-bits of CMOS data.
15
16 Reads the 8-bits of CMOS data at the location specified by Index.
17 The 8-bit read value is returned.
18
19 @param Index The CMOS location to read.
20
21 @return The value read.
22
23**/
24UINT8
25EFIAPI
26PlatformCmosRead8 (
27 IN UINTN Index
28 )
29{
30 IoWrite8 (0x70, (UINT8)Index);
31 return IoRead8 (0x71);
32}
33
34/**
35 Writes 8-bits of CMOS data.
36
37 Writes 8-bits of CMOS data to the location specified by Index
38 with the value specified by Value and returns Value.
39
40 @param Index The CMOS location to write.
41 @param Value The value to write to CMOS.
42
43 @return The value written to CMOS.
44
45**/
46UINT8
47EFIAPI
48PlatformCmosWrite8 (
49 IN UINTN Index,
50 IN UINT8 Value
51 )
52{
53 IoWrite8 (0x70, (UINT8)Index);
54 IoWrite8 (0x71, Value);
55 return Value;
56}
57
58/**
59 Dump the CMOS content
60 */
61VOID
62EFIAPI
63PlatformDebugDumpCmos (
64 VOID
65 )
66{
67 UINT32 Loop;
68
69 DEBUG ((DEBUG_INFO, "CMOS:\n"));
70
71 for (Loop = 0; Loop < 0x80; Loop++) {
72 if ((Loop % 0x10) == 0) {
73 DEBUG ((DEBUG_INFO, "%02x:", Loop));
74 }
75
76 DEBUG ((DEBUG_INFO, " %02x", PlatformCmosRead8 (Loop)));
77 if ((Loop % 0x10) == 0xf) {
78 DEBUG ((DEBUG_INFO, "\n"));
79 }
80 }
81}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette