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