]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/Library/I2CLibPei/I2CIoLibPei.h
b68bc1ed09ac409a8104a0da9e4e925e8f32b071
[mirror_edk2.git] / Vlv2TbltDevicePkg / Library / I2CLibPei / I2CIoLibPei.h
1 /** @file
2 Functions for access I2C MMIO register.
3
4 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef __I2C_IOLIB_PEI__
10
11 #define __I2C_IOLIB_PEI__
12 #include <PiPei.h>
13
14
15 /**
16 Reads an 8-bit MMIO register.
17
18 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
19 returned. This function must guarantee that all MMIO read and write
20 operations are serialized.
21
22 If 8-bit MMIO register operations are not supported, then ASSERT().
23
24 @param Address The MMIO register to read.
25
26 @return The value read.
27
28 **/
29
30 UINT8
31 EFIAPI
32 I2CLibPeiMmioRead8 (
33 IN UINTN Address
34 );
35
36
37 /**
38 Reads a 16-bit MMIO register.
39
40 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
41 returned. This function must guarantee that all MMIO read and write
42 operations are serialized.
43
44 If 16-bit MMIO register operations are not supported, then ASSERT().
45 If Address is not aligned on a 16-bit boundary, then ASSERT().
46
47 @param Address The MMIO register to read.
48
49 @return The value read.
50
51 **/
52 UINT16
53 EFIAPI
54 I2CLibPeiMmioRead16 (
55 IN UINTN Address
56 );
57
58
59 /**
60 Writes a 16-bit MMIO register.
61
62 Writes the 16-bit MMIO register specified by Address with the value specified
63 by Value and returns Value. This function must guarantee that all MMIO read
64 and write operations are serialized.
65
66 If 16-bit MMIO register operations are not supported, then ASSERT().
67 If Address is not aligned on a 16-bit boundary, then ASSERT().
68
69 @param Address The MMIO register to write.
70 @param Value The value to write to the MMIO register.
71
72 @return Value.
73
74 **/
75 UINT16
76 EFIAPI
77 I2CLibPeiMmioWrite16 (
78 IN UINTN Address,
79 IN UINT16 Value
80 );
81
82
83 /**
84 Reads a 32-bit MMIO register.
85
86 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
87 returned. This function must guarantee that all MMIO read and write
88 operations are serialized.
89
90 If 32-bit MMIO register operations are not supported, then ASSERT().
91 If Address is not aligned on a 32-bit boundary, then ASSERT().
92
93 @param Address The MMIO register to read.
94
95 @return The value read.
96
97 **/
98 UINT32
99 EFIAPI
100 I2CLibPeiMmioRead32 (
101 IN UINTN Address
102 );
103
104
105 /**
106 Writes a 32-bit MMIO register.
107
108 Writes the 32-bit MMIO register specified by Address with the value specified
109 by Value and returns Value. This function must guarantee that all MMIO read
110 and write operations are serialized.
111
112 If 32-bit MMIO register operations are not supported, then ASSERT().
113 If Address is not aligned on a 32-bit boundary, then ASSERT().
114
115 @param Address The MMIO register to write.
116 @param Value The value to write to the MMIO register.
117
118 @return Value.
119
120 **/
121 UINT32
122 EFIAPI
123 I2CLibPeiMmioWrite32 (
124 IN UINTN Address,
125 IN UINT32 Value
126 );
127
128
129 /**
130 OR a 32-bit MMIO register.
131
132 OR the 32-bit MMIO register specified by Address with the value specified
133 by Value and returns Value. This function must guarantee that all MMIO read
134 and write operations are serialized.
135
136 If 32-bit MMIO register operations are not supported, then ASSERT().
137 If Address is not aligned on a 32-bit boundary, then ASSERT().
138
139 @param Address The MMIO register to write OR.
140 @param Value The value to OR to the MMIO register.
141
142 @return Value.
143
144 **/
145 UINT32
146 EFIAPI
147 I2CLibPeiMmioOr32 (
148 IN UINTN Address,
149 IN UINT32 OrData
150 );
151
152
153 #endif