Commit | Line | Data |
---|---|---|
11f43dfd | 1 | /** @file\r |
2 | High-level Io/Mmio functions.\r | |
3 | \r | |
4 | All assertions for bit field operations are handled bit field functions in the\r | |
5 | Base Library.\r | |
6 | \r | |
9095d37b | 7 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
11f43dfd | 9 | \r |
11f43dfd | 10 | **/\r |
11 | \r | |
11f43dfd | 12 | #include <PiPei.h>\r |
c892d846 | 13 | \r |
11f43dfd | 14 | #include <Library/IoLib.h>\r |
15 | #include <Library/DebugLib.h>\r | |
16 | #include <Library/BaseLib.h>\r | |
17 | #include <Library/PeiServicesTablePointerLib.h>\r | |
18 | \r | |
19 | /**\r | |
62991af2 | 20 | Reads an 8-bit I/O port, performs a bitwise OR, and writes the\r |
11f43dfd | 21 | result back to the 8-bit I/O port.\r |
22 | \r | |
62991af2 | 23 | Reads the 8-bit I/O port specified by Port, performs a bitwise OR\r |
11f43dfd | 24 | between the read result and the value specified by OrData, and writes the\r |
25 | result to the 8-bit I/O port specified by Port. The value written to the I/O\r | |
26 | port is returned. This function must guarantee that all I/O read and write\r | |
27 | operations are serialized.\r | |
28 | \r | |
29 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
30 | \r | |
31 | @param Port The I/O port to write.\r | |
32 | @param OrData The value to OR with the read value from the I/O port.\r | |
33 | \r | |
34 | @return The value written back to the I/O port.\r | |
35 | \r | |
36 | **/\r | |
37 | UINT8\r | |
38 | EFIAPI\r | |
39 | IoOr8 (\r | |
2f88bd3a MK |
40 | IN UINTN Port,\r |
41 | IN UINT8 OrData\r | |
11f43dfd | 42 | )\r |
43 | {\r | |
2f88bd3a | 44 | return IoWrite8 (Port, (UINT8)(IoRead8 (Port) | OrData));\r |
11f43dfd | 45 | }\r |
46 | \r | |
47 | /**\r | |
48 | Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back\r | |
49 | to the 8-bit I/O port.\r | |
50 | \r | |
51 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r | |
52 | the read result and the value specified by AndData, and writes the result to\r | |
53 | the 8-bit I/O port specified by Port. The value written to the I/O port is\r | |
54 | returned. This function must guarantee that all I/O read and write operations\r | |
55 | are serialized.\r | |
56 | \r | |
57 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
58 | \r | |
59 | @param Port The I/O port to write.\r | |
60 | @param AndData The value to AND with the read value from the I/O port.\r | |
61 | \r | |
62 | @return The value written back to the I/O port.\r | |
63 | \r | |
64 | **/\r | |
65 | UINT8\r | |
66 | EFIAPI\r | |
67 | IoAnd8 (\r | |
2f88bd3a MK |
68 | IN UINTN Port,\r |
69 | IN UINT8 AndData\r | |
11f43dfd | 70 | )\r |
71 | {\r | |
2f88bd3a | 72 | return IoWrite8 (Port, (UINT8)(IoRead8 (Port) & AndData));\r |
11f43dfd | 73 | }\r |
74 | \r | |
75 | /**\r | |
9095d37b | 76 | Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 77 | OR, and writes the result back to the 8-bit I/O port.\r |
11f43dfd | 78 | \r |
79 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r | |
80 | the read result and the value specified by AndData, performs a bitwise OR\r | |
81 | between the result of the AND operation and the value specified by OrData,\r | |
82 | and writes the result to the 8-bit I/O port specified by Port. The value\r | |
83 | written to the I/O port is returned. This function must guarantee that all\r | |
84 | I/O read and write operations are serialized.\r | |
85 | \r | |
86 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
87 | \r | |
88 | @param Port The I/O port to write.\r | |
89 | @param AndData The value to AND with the read value from the I/O port.\r | |
90 | @param OrData The value to OR with the result of the AND operation.\r | |
91 | \r | |
92 | @return The value written back to the I/O port.\r | |
93 | \r | |
94 | **/\r | |
95 | UINT8\r | |
96 | EFIAPI\r | |
97 | IoAndThenOr8 (\r | |
2f88bd3a MK |
98 | IN UINTN Port,\r |
99 | IN UINT8 AndData,\r | |
100 | IN UINT8 OrData\r | |
11f43dfd | 101 | )\r |
102 | {\r | |
2f88bd3a | 103 | return IoWrite8 (Port, (UINT8)((IoRead8 (Port) & AndData) | OrData));\r |
11f43dfd | 104 | }\r |
105 | \r | |
106 | /**\r | |
107 | Reads a bit field of an I/O register.\r | |
108 | \r | |
109 | Reads the bit field in an 8-bit I/O register. The bit field is specified by\r | |
110 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
111 | \r | |
112 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
113 | If StartBit is greater than 7, then ASSERT().\r | |
114 | If EndBit is greater than 7, then ASSERT().\r | |
115 | If EndBit is less than StartBit, then ASSERT().\r | |
116 | \r | |
117 | @param Port The I/O port to read.\r | |
118 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
119 | Range 0..7.\r | |
120 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
121 | Range 0..7.\r | |
122 | \r | |
80f0c0c4 | 123 | @return The value read.\r |
11f43dfd | 124 | \r |
125 | **/\r | |
126 | UINT8\r | |
127 | EFIAPI\r | |
128 | IoBitFieldRead8 (\r | |
2f88bd3a MK |
129 | IN UINTN Port,\r |
130 | IN UINTN StartBit,\r | |
131 | IN UINTN EndBit\r | |
11f43dfd | 132 | )\r |
133 | {\r | |
134 | return BitFieldRead8 (IoRead8 (Port), StartBit, EndBit);\r | |
135 | }\r | |
136 | \r | |
137 | /**\r | |
138 | Writes a bit field to an I/O register.\r | |
139 | \r | |
140 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
141 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
9095d37b | 142 | register are preserved. The value written to the I/O port is returned.\r |
11f43dfd | 143 | \r |
144 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
145 | If StartBit is greater than 7, then ASSERT().\r | |
146 | If EndBit is greater than 7, then ASSERT().\r | |
147 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 148 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 149 | \r |
150 | @param Port The I/O port to write.\r | |
151 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
152 | Range 0..7.\r | |
153 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
154 | Range 0..7.\r | |
2fc59a00 | 155 | @param Value The new value of the bit field.\r |
11f43dfd | 156 | \r |
157 | @return The value written back to the I/O port.\r | |
158 | \r | |
159 | **/\r | |
160 | UINT8\r | |
161 | EFIAPI\r | |
162 | IoBitFieldWrite8 (\r | |
2f88bd3a MK |
163 | IN UINTN Port,\r |
164 | IN UINTN StartBit,\r | |
165 | IN UINTN EndBit,\r | |
166 | IN UINT8 Value\r | |
11f43dfd | 167 | )\r |
168 | {\r | |
169 | return IoWrite8 (\r | |
170 | Port,\r | |
171 | BitFieldWrite8 (IoRead8 (Port), StartBit, EndBit, Value)\r | |
172 | );\r | |
173 | }\r | |
174 | \r | |
175 | /**\r | |
176 | Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the\r | |
177 | result back to the bit field in the 8-bit port.\r | |
178 | \r | |
62991af2 | 179 | Reads the 8-bit I/O port specified by Port, performs a bitwise OR\r |
11f43dfd | 180 | between the read result and the value specified by OrData, and writes the\r |
181 | result to the 8-bit I/O port specified by Port. The value written to the I/O\r | |
182 | port is returned. This function must guarantee that all I/O read and write\r | |
183 | operations are serialized. Extra left bits in OrData are stripped.\r | |
184 | \r | |
185 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
186 | If StartBit is greater than 7, then ASSERT().\r | |
187 | If EndBit is greater than 7, then ASSERT().\r | |
188 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 189 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 190 | \r |
191 | @param Port The I/O port to write.\r | |
192 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
193 | Range 0..7.\r | |
194 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
195 | Range 0..7.\r | |
196 | @param OrData The value to OR with the read value from the I/O port.\r | |
197 | \r | |
198 | @return The value written back to the I/O port.\r | |
199 | \r | |
200 | **/\r | |
201 | UINT8\r | |
202 | EFIAPI\r | |
203 | IoBitFieldOr8 (\r | |
2f88bd3a MK |
204 | IN UINTN Port,\r |
205 | IN UINTN StartBit,\r | |
206 | IN UINTN EndBit,\r | |
207 | IN UINT8 OrData\r | |
11f43dfd | 208 | )\r |
209 | {\r | |
210 | return IoWrite8 (\r | |
211 | Port,\r | |
212 | BitFieldOr8 (IoRead8 (Port), StartBit, EndBit, OrData)\r | |
213 | );\r | |
214 | }\r | |
215 | \r | |
216 | /**\r | |
217 | Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the\r | |
218 | result back to the bit field in the 8-bit port.\r | |
219 | \r | |
220 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r | |
221 | the read result and the value specified by AndData, and writes the result to\r | |
222 | the 8-bit I/O port specified by Port. The value written to the I/O port is\r | |
223 | returned. This function must guarantee that all I/O read and write operations\r | |
224 | are serialized. Extra left bits in AndData are stripped.\r | |
225 | \r | |
226 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
227 | If StartBit is greater than 7, then ASSERT().\r | |
228 | If EndBit is greater than 7, then ASSERT().\r | |
229 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 230 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 231 | \r |
232 | @param Port The I/O port to write.\r | |
233 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
234 | Range 0..7.\r | |
235 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
236 | Range 0..7.\r | |
237 | @param AndData The value to AND with the read value from the I/O port.\r | |
238 | \r | |
239 | @return The value written back to the I/O port.\r | |
240 | \r | |
241 | **/\r | |
242 | UINT8\r | |
243 | EFIAPI\r | |
244 | IoBitFieldAnd8 (\r | |
2f88bd3a MK |
245 | IN UINTN Port,\r |
246 | IN UINTN StartBit,\r | |
247 | IN UINTN EndBit,\r | |
248 | IN UINT8 AndData\r | |
11f43dfd | 249 | )\r |
250 | {\r | |
251 | return IoWrite8 (\r | |
252 | Port,\r | |
253 | BitFieldAnd8 (IoRead8 (Port), StartBit, EndBit, AndData)\r | |
254 | );\r | |
255 | }\r | |
256 | \r | |
257 | /**\r | |
258 | Reads a bit field in an 8-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 259 | bitwise OR, and writes the result back to the bit field in the\r |
11f43dfd | 260 | 8-bit port.\r |
261 | \r | |
262 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 263 | by a bitwise OR between the read result and the value specified by\r |
11f43dfd | 264 | AndData, and writes the result to the 8-bit I/O port specified by Port. The\r |
265 | value written to the I/O port is returned. This function must guarantee that\r | |
266 | all I/O read and write operations are serialized. Extra left bits in both\r | |
267 | AndData and OrData are stripped.\r | |
268 | \r | |
269 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
270 | If StartBit is greater than 7, then ASSERT().\r | |
271 | If EndBit is greater than 7, then ASSERT().\r | |
272 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
273 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
274 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
11f43dfd | 275 | \r |
276 | @param Port The I/O port to write.\r | |
277 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
278 | Range 0..7.\r | |
279 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
280 | Range 0..7.\r | |
281 | @param AndData The value to AND with the read value from the I/O port.\r | |
282 | @param OrData The value to OR with the result of the AND operation.\r | |
283 | \r | |
284 | @return The value written back to the I/O port.\r | |
285 | \r | |
286 | **/\r | |
287 | UINT8\r | |
288 | EFIAPI\r | |
289 | IoBitFieldAndThenOr8 (\r | |
2f88bd3a MK |
290 | IN UINTN Port,\r |
291 | IN UINTN StartBit,\r | |
292 | IN UINTN EndBit,\r | |
293 | IN UINT8 AndData,\r | |
294 | IN UINT8 OrData\r | |
11f43dfd | 295 | )\r |
296 | {\r | |
297 | return IoWrite8 (\r | |
298 | Port,\r | |
299 | BitFieldAndThenOr8 (IoRead8 (Port), StartBit, EndBit, AndData, OrData)\r | |
300 | );\r | |
301 | }\r | |
302 | \r | |
303 | /**\r | |
62991af2 | 304 | Reads a 16-bit I/O port, performs a bitwise OR, and writes the\r |
11f43dfd | 305 | result back to the 16-bit I/O port.\r |
306 | \r | |
62991af2 | 307 | Reads the 16-bit I/O port specified by Port, performs a bitwise OR\r |
11f43dfd | 308 | between the read result and the value specified by OrData, and writes the\r |
309 | result to the 16-bit I/O port specified by Port. The value written to the I/O\r | |
310 | port is returned. This function must guarantee that all I/O read and write\r | |
311 | operations are serialized.\r | |
312 | \r | |
313 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 314 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 315 | \r |
316 | @param Port The I/O port to write.\r | |
317 | @param OrData The value to OR with the read value from the I/O port.\r | |
318 | \r | |
319 | @return The value written back to the I/O port.\r | |
320 | \r | |
321 | **/\r | |
322 | UINT16\r | |
323 | EFIAPI\r | |
324 | IoOr16 (\r | |
2f88bd3a MK |
325 | IN UINTN Port,\r |
326 | IN UINT16 OrData\r | |
11f43dfd | 327 | )\r |
328 | {\r | |
2f88bd3a | 329 | return IoWrite16 (Port, (UINT16)(IoRead16 (Port) | OrData));\r |
11f43dfd | 330 | }\r |
331 | \r | |
332 | /**\r | |
333 | Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back\r | |
334 | to the 16-bit I/O port.\r | |
335 | \r | |
336 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r | |
337 | the read result and the value specified by AndData, and writes the result to\r | |
338 | the 16-bit I/O port specified by Port. The value written to the I/O port is\r | |
339 | returned. This function must guarantee that all I/O read and write operations\r | |
340 | are serialized.\r | |
341 | \r | |
342 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 343 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
9095d37b | 344 | \r |
11f43dfd | 345 | @param Port The I/O port to write.\r |
346 | @param AndData The value to AND with the read value from the I/O port.\r | |
347 | \r | |
348 | @return The value written back to the I/O port.\r | |
349 | \r | |
350 | **/\r | |
351 | UINT16\r | |
352 | EFIAPI\r | |
353 | IoAnd16 (\r | |
2f88bd3a MK |
354 | IN UINTN Port,\r |
355 | IN UINT16 AndData\r | |
11f43dfd | 356 | )\r |
357 | {\r | |
2f88bd3a | 358 | return IoWrite16 (Port, (UINT16)(IoRead16 (Port) & AndData));\r |
11f43dfd | 359 | }\r |
360 | \r | |
361 | /**\r | |
9095d37b | 362 | Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 363 | OR, and writes the result back to the 16-bit I/O port.\r |
11f43dfd | 364 | \r |
365 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r | |
366 | the read result and the value specified by AndData, performs a bitwise OR\r | |
367 | between the result of the AND operation and the value specified by OrData,\r | |
368 | and writes the result to the 16-bit I/O port specified by Port. The value\r | |
369 | written to the I/O port is returned. This function must guarantee that all\r | |
370 | I/O read and write operations are serialized.\r | |
371 | \r | |
372 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 373 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
9095d37b | 374 | \r |
11f43dfd | 375 | @param Port The I/O port to write.\r |
376 | @param AndData The value to AND with the read value from the I/O port.\r | |
377 | @param OrData The value to OR with the result of the AND operation.\r | |
378 | \r | |
379 | @return The value written back to the I/O port.\r | |
380 | \r | |
381 | **/\r | |
382 | UINT16\r | |
383 | EFIAPI\r | |
384 | IoAndThenOr16 (\r | |
2f88bd3a MK |
385 | IN UINTN Port,\r |
386 | IN UINT16 AndData,\r | |
387 | IN UINT16 OrData\r | |
11f43dfd | 388 | )\r |
389 | {\r | |
2f88bd3a | 390 | return IoWrite16 (Port, (UINT16)((IoRead16 (Port) & AndData) | OrData));\r |
11f43dfd | 391 | }\r |
392 | \r | |
393 | /**\r | |
394 | Reads a bit field of an I/O register.\r | |
395 | \r | |
396 | Reads the bit field in a 16-bit I/O register. The bit field is specified by\r | |
397 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
398 | \r | |
399 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 400 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 401 | If StartBit is greater than 15, then ASSERT().\r |
402 | If EndBit is greater than 15, then ASSERT().\r | |
403 | If EndBit is less than StartBit, then ASSERT().\r | |
404 | \r | |
405 | @param Port The I/O port to read.\r | |
406 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
407 | Range 0..15.\r | |
408 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
409 | Range 0..15.\r | |
410 | \r | |
80f0c0c4 | 411 | @return The value read.\r |
11f43dfd | 412 | \r |
413 | **/\r | |
414 | UINT16\r | |
415 | EFIAPI\r | |
416 | IoBitFieldRead16 (\r | |
2f88bd3a MK |
417 | IN UINTN Port,\r |
418 | IN UINTN StartBit,\r | |
419 | IN UINTN EndBit\r | |
11f43dfd | 420 | )\r |
421 | {\r | |
422 | return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit);\r | |
423 | }\r | |
424 | \r | |
425 | /**\r | |
426 | Writes a bit field to an I/O register.\r | |
427 | \r | |
428 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
429 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
430 | register are preserved. The value written to the I/O port is returned. Extra\r | |
431 | left bits in Value are stripped.\r | |
432 | \r | |
433 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 434 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 435 | If StartBit is greater than 15, then ASSERT().\r |
436 | If EndBit is greater than 15, then ASSERT().\r | |
437 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 438 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 439 | \r |
440 | @param Port The I/O port to write.\r | |
441 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
442 | Range 0..15.\r | |
443 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
444 | Range 0..15.\r | |
2fc59a00 | 445 | @param Value The new value of the bit field.\r |
11f43dfd | 446 | \r |
447 | @return The value written back to the I/O port.\r | |
448 | \r | |
449 | **/\r | |
450 | UINT16\r | |
451 | EFIAPI\r | |
452 | IoBitFieldWrite16 (\r | |
2f88bd3a MK |
453 | IN UINTN Port,\r |
454 | IN UINTN StartBit,\r | |
455 | IN UINTN EndBit,\r | |
456 | IN UINT16 Value\r | |
11f43dfd | 457 | )\r |
458 | {\r | |
459 | return IoWrite16 (\r | |
460 | Port,\r | |
461 | BitFieldWrite16 (IoRead16 (Port), StartBit, EndBit, Value)\r | |
462 | );\r | |
463 | }\r | |
464 | \r | |
465 | /**\r | |
466 | Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the\r | |
467 | result back to the bit field in the 16-bit port.\r | |
468 | \r | |
62991af2 | 469 | Reads the 16-bit I/O port specified by Port, performs a bitwise OR\r |
11f43dfd | 470 | between the read result and the value specified by OrData, and writes the\r |
471 | result to the 16-bit I/O port specified by Port. The value written to the I/O\r | |
472 | port is returned. This function must guarantee that all I/O read and write\r | |
473 | operations are serialized. Extra left bits in OrData are stripped.\r | |
474 | \r | |
475 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 476 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 477 | If StartBit is greater than 15, then ASSERT().\r |
478 | If EndBit is greater than 15, then ASSERT().\r | |
479 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 480 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 481 | \r |
482 | @param Port The I/O port to write.\r | |
483 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
484 | Range 0..15.\r | |
485 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
486 | Range 0..15.\r | |
487 | @param OrData The value to OR with the read value from the I/O port.\r | |
488 | \r | |
489 | @return The value written back to the I/O port.\r | |
490 | \r | |
491 | **/\r | |
492 | UINT16\r | |
493 | EFIAPI\r | |
494 | IoBitFieldOr16 (\r | |
2f88bd3a MK |
495 | IN UINTN Port,\r |
496 | IN UINTN StartBit,\r | |
497 | IN UINTN EndBit,\r | |
498 | IN UINT16 OrData\r | |
11f43dfd | 499 | )\r |
500 | {\r | |
501 | return IoWrite16 (\r | |
502 | Port,\r | |
503 | BitFieldOr16 (IoRead16 (Port), StartBit, EndBit, OrData)\r | |
504 | );\r | |
505 | }\r | |
506 | \r | |
507 | /**\r | |
508 | Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the\r | |
509 | result back to the bit field in the 16-bit port.\r | |
510 | \r | |
511 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r | |
512 | the read result and the value specified by AndData, and writes the result to\r | |
513 | the 16-bit I/O port specified by Port. The value written to the I/O port is\r | |
514 | returned. This function must guarantee that all I/O read and write operations\r | |
515 | are serialized. Extra left bits in AndData are stripped.\r | |
516 | \r | |
517 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 518 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 519 | If StartBit is greater than 15, then ASSERT().\r |
520 | If EndBit is greater than 15, then ASSERT().\r | |
521 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 522 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 523 | \r |
524 | @param Port The I/O port to write.\r | |
525 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
526 | Range 0..15.\r | |
527 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
528 | Range 0..15.\r | |
529 | @param AndData The value to AND with the read value from the I/O port.\r | |
530 | \r | |
531 | @return The value written back to the I/O port.\r | |
532 | \r | |
533 | **/\r | |
534 | UINT16\r | |
535 | EFIAPI\r | |
536 | IoBitFieldAnd16 (\r | |
2f88bd3a MK |
537 | IN UINTN Port,\r |
538 | IN UINTN StartBit,\r | |
539 | IN UINTN EndBit,\r | |
540 | IN UINT16 AndData\r | |
11f43dfd | 541 | )\r |
542 | {\r | |
543 | return IoWrite16 (\r | |
544 | Port,\r | |
545 | BitFieldAnd16 (IoRead16 (Port), StartBit, EndBit, AndData)\r | |
546 | );\r | |
547 | }\r | |
548 | \r | |
549 | /**\r | |
550 | Reads a bit field in a 16-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 551 | bitwise OR, and writes the result back to the bit field in the\r |
11f43dfd | 552 | 16-bit port.\r |
553 | \r | |
554 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 555 | by a bitwise OR between the read result and the value specified by\r |
11f43dfd | 556 | AndData, and writes the result to the 16-bit I/O port specified by Port. The\r |
557 | value written to the I/O port is returned. This function must guarantee that\r | |
558 | all I/O read and write operations are serialized. Extra left bits in both\r | |
559 | AndData and OrData are stripped.\r | |
560 | \r | |
561 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 562 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 563 | If StartBit is greater than 15, then ASSERT().\r |
564 | If EndBit is greater than 15, then ASSERT().\r | |
565 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
566 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
567 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
11f43dfd | 568 | \r |
569 | @param Port The I/O port to write.\r | |
570 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
571 | Range 0..15.\r | |
572 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
573 | Range 0..15.\r | |
574 | @param AndData The value to AND with the read value from the I/O port.\r | |
575 | @param OrData The value to OR with the result of the AND operation.\r | |
576 | \r | |
577 | @return The value written back to the I/O port.\r | |
578 | \r | |
579 | **/\r | |
580 | UINT16\r | |
581 | EFIAPI\r | |
582 | IoBitFieldAndThenOr16 (\r | |
2f88bd3a MK |
583 | IN UINTN Port,\r |
584 | IN UINTN StartBit,\r | |
585 | IN UINTN EndBit,\r | |
586 | IN UINT16 AndData,\r | |
587 | IN UINT16 OrData\r | |
11f43dfd | 588 | )\r |
589 | {\r | |
590 | return IoWrite16 (\r | |
591 | Port,\r | |
592 | BitFieldAndThenOr16 (IoRead16 (Port), StartBit, EndBit, AndData, OrData)\r | |
593 | );\r | |
594 | }\r | |
595 | \r | |
596 | /**\r | |
62991af2 | 597 | Reads a 32-bit I/O port, performs a bitwise OR, and writes the\r |
11f43dfd | 598 | result back to the 32-bit I/O port.\r |
599 | \r | |
62991af2 | 600 | Reads the 32-bit I/O port specified by Port, performs a bitwise OR\r |
11f43dfd | 601 | between the read result and the value specified by OrData, and writes the\r |
602 | result to the 32-bit I/O port specified by Port. The value written to the I/O\r | |
603 | port is returned. This function must guarantee that all I/O read and write\r | |
604 | operations are serialized.\r | |
605 | \r | |
606 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 607 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 608 | \r |
609 | @param Port The I/O port to write.\r | |
610 | @param OrData The value to OR with the read value from the I/O port.\r | |
611 | \r | |
612 | @return The value written back to the I/O port.\r | |
613 | \r | |
614 | **/\r | |
615 | UINT32\r | |
616 | EFIAPI\r | |
617 | IoOr32 (\r | |
2f88bd3a MK |
618 | IN UINTN Port,\r |
619 | IN UINT32 OrData\r | |
11f43dfd | 620 | )\r |
621 | {\r | |
622 | return IoWrite32 (Port, IoRead32 (Port) | OrData);\r | |
623 | }\r | |
624 | \r | |
625 | /**\r | |
626 | Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back\r | |
627 | to the 32-bit I/O port.\r | |
628 | \r | |
629 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r | |
630 | the read result and the value specified by AndData, and writes the result to\r | |
631 | the 32-bit I/O port specified by Port. The value written to the I/O port is\r | |
632 | returned. This function must guarantee that all I/O read and write operations\r | |
633 | are serialized.\r | |
634 | \r | |
635 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 636 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 637 | \r |
638 | @param Port The I/O port to write.\r | |
639 | @param AndData The value to AND with the read value from the I/O port.\r | |
640 | \r | |
641 | @return The value written back to the I/O port.\r | |
642 | \r | |
643 | **/\r | |
644 | UINT32\r | |
645 | EFIAPI\r | |
646 | IoAnd32 (\r | |
2f88bd3a MK |
647 | IN UINTN Port,\r |
648 | IN UINT32 AndData\r | |
11f43dfd | 649 | )\r |
650 | {\r | |
651 | return IoWrite32 (Port, IoRead32 (Port) & AndData);\r | |
652 | }\r | |
653 | \r | |
654 | /**\r | |
9095d37b | 655 | Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 656 | OR, and writes the result back to the 32-bit I/O port.\r |
11f43dfd | 657 | \r |
658 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r | |
659 | the read result and the value specified by AndData, performs a bitwise OR\r | |
660 | between the result of the AND operation and the value specified by OrData,\r | |
661 | and writes the result to the 32-bit I/O port specified by Port. The value\r | |
662 | written to the I/O port is returned. This function must guarantee that all\r | |
663 | I/O read and write operations are serialized.\r | |
664 | \r | |
665 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 666 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 667 | \r |
668 | @param Port The I/O port to write.\r | |
669 | @param AndData The value to AND with the read value from the I/O port.\r | |
670 | @param OrData The value to OR with the result of the AND operation.\r | |
671 | \r | |
672 | @return The value written back to the I/O port.\r | |
673 | \r | |
674 | **/\r | |
675 | UINT32\r | |
676 | EFIAPI\r | |
677 | IoAndThenOr32 (\r | |
2f88bd3a MK |
678 | IN UINTN Port,\r |
679 | IN UINT32 AndData,\r | |
680 | IN UINT32 OrData\r | |
11f43dfd | 681 | )\r |
682 | {\r | |
683 | return IoWrite32 (Port, (IoRead32 (Port) & AndData) | OrData);\r | |
684 | }\r | |
685 | \r | |
686 | /**\r | |
687 | Reads a bit field of an I/O register.\r | |
688 | \r | |
689 | Reads the bit field in a 32-bit I/O register. The bit field is specified by\r | |
690 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
691 | \r | |
692 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 693 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 694 | If StartBit is greater than 31, then ASSERT().\r |
695 | If EndBit is greater than 31, then ASSERT().\r | |
696 | If EndBit is less than StartBit, then ASSERT().\r | |
697 | \r | |
698 | @param Port The I/O port to read.\r | |
699 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
700 | Range 0..31.\r | |
701 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
702 | Range 0..31.\r | |
703 | \r | |
80f0c0c4 | 704 | @return The value read.\r |
11f43dfd | 705 | \r |
706 | **/\r | |
707 | UINT32\r | |
708 | EFIAPI\r | |
709 | IoBitFieldRead32 (\r | |
2f88bd3a MK |
710 | IN UINTN Port,\r |
711 | IN UINTN StartBit,\r | |
712 | IN UINTN EndBit\r | |
11f43dfd | 713 | )\r |
714 | {\r | |
715 | return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit);\r | |
716 | }\r | |
717 | \r | |
718 | /**\r | |
719 | Writes a bit field to an I/O register.\r | |
720 | \r | |
721 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
722 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
723 | register are preserved. The value written to the I/O port is returned. Extra\r | |
724 | left bits in Value are stripped.\r | |
725 | \r | |
726 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 727 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 728 | If StartBit is greater than 31, then ASSERT().\r |
729 | If EndBit is greater than 31, then ASSERT().\r | |
730 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 731 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 732 | \r |
733 | @param Port The I/O port to write.\r | |
734 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
735 | Range 0..31.\r | |
736 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
737 | Range 0..31.\r | |
2fc59a00 | 738 | @param Value The new value of the bit field.\r |
11f43dfd | 739 | \r |
740 | @return The value written back to the I/O port.\r | |
741 | \r | |
742 | **/\r | |
743 | UINT32\r | |
744 | EFIAPI\r | |
745 | IoBitFieldWrite32 (\r | |
2f88bd3a MK |
746 | IN UINTN Port,\r |
747 | IN UINTN StartBit,\r | |
748 | IN UINTN EndBit,\r | |
749 | IN UINT32 Value\r | |
11f43dfd | 750 | )\r |
751 | {\r | |
752 | return IoWrite32 (\r | |
753 | Port,\r | |
754 | BitFieldWrite32 (IoRead32 (Port), StartBit, EndBit, Value)\r | |
755 | );\r | |
756 | }\r | |
757 | \r | |
758 | /**\r | |
759 | Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the\r | |
760 | result back to the bit field in the 32-bit port.\r | |
761 | \r | |
62991af2 | 762 | Reads the 32-bit I/O port specified by Port, performs a bitwise OR\r |
11f43dfd | 763 | between the read result and the value specified by OrData, and writes the\r |
764 | result to the 32-bit I/O port specified by Port. The value written to the I/O\r | |
765 | port is returned. This function must guarantee that all I/O read and write\r | |
766 | operations are serialized. Extra left bits in OrData are stripped.\r | |
767 | \r | |
768 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 769 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 770 | If StartBit is greater than 31, then ASSERT().\r |
771 | If EndBit is greater than 31, then ASSERT().\r | |
772 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 773 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 774 | \r |
775 | @param Port The I/O port to write.\r | |
776 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
777 | Range 0..31.\r | |
778 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
779 | Range 0..31.\r | |
780 | @param OrData The value to OR with the read value from the I/O port.\r | |
781 | \r | |
782 | @return The value written back to the I/O port.\r | |
783 | \r | |
784 | **/\r | |
785 | UINT32\r | |
786 | EFIAPI\r | |
787 | IoBitFieldOr32 (\r | |
2f88bd3a MK |
788 | IN UINTN Port,\r |
789 | IN UINTN StartBit,\r | |
790 | IN UINTN EndBit,\r | |
791 | IN UINT32 OrData\r | |
11f43dfd | 792 | )\r |
793 | {\r | |
794 | return IoWrite32 (\r | |
795 | Port,\r | |
796 | BitFieldOr32 (IoRead32 (Port), StartBit, EndBit, OrData)\r | |
797 | );\r | |
798 | }\r | |
799 | \r | |
800 | /**\r | |
801 | Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the\r | |
802 | result back to the bit field in the 32-bit port.\r | |
803 | \r | |
804 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r | |
805 | the read result and the value specified by AndData, and writes the result to\r | |
806 | the 32-bit I/O port specified by Port. The value written to the I/O port is\r | |
807 | returned. This function must guarantee that all I/O read and write operations\r | |
808 | are serialized. Extra left bits in AndData are stripped.\r | |
809 | \r | |
810 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 811 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 812 | If StartBit is greater than 31, then ASSERT().\r |
813 | If EndBit is greater than 31, then ASSERT().\r | |
814 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 815 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 816 | \r |
817 | @param Port The I/O port to write.\r | |
818 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
819 | Range 0..31.\r | |
820 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
821 | Range 0..31.\r | |
822 | @param AndData The value to AND with the read value from the I/O port.\r | |
823 | \r | |
824 | @return The value written back to the I/O port.\r | |
825 | \r | |
826 | **/\r | |
827 | UINT32\r | |
828 | EFIAPI\r | |
829 | IoBitFieldAnd32 (\r | |
2f88bd3a MK |
830 | IN UINTN Port,\r |
831 | IN UINTN StartBit,\r | |
832 | IN UINTN EndBit,\r | |
833 | IN UINT32 AndData\r | |
11f43dfd | 834 | )\r |
835 | {\r | |
836 | return IoWrite32 (\r | |
837 | Port,\r | |
838 | BitFieldAnd32 (IoRead32 (Port), StartBit, EndBit, AndData)\r | |
839 | );\r | |
840 | }\r | |
841 | \r | |
842 | /**\r | |
843 | Reads a bit field in a 32-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 844 | bitwise OR, and writes the result back to the bit field in the\r |
11f43dfd | 845 | 32-bit port.\r |
846 | \r | |
847 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 848 | by a bitwise OR between the read result and the value specified by\r |
11f43dfd | 849 | AndData, and writes the result to the 32-bit I/O port specified by Port. The\r |
850 | value written to the I/O port is returned. This function must guarantee that\r | |
851 | all I/O read and write operations are serialized. Extra left bits in both\r | |
852 | AndData and OrData are stripped.\r | |
853 | \r | |
854 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 855 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 856 | If StartBit is greater than 31, then ASSERT().\r |
857 | If EndBit is greater than 31, then ASSERT().\r | |
858 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
859 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
860 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
11f43dfd | 861 | \r |
862 | @param Port The I/O port to write.\r | |
863 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
864 | Range 0..31.\r | |
865 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
866 | Range 0..31.\r | |
867 | @param AndData The value to AND with the read value from the I/O port.\r | |
868 | @param OrData The value to OR with the result of the AND operation.\r | |
869 | \r | |
870 | @return The value written back to the I/O port.\r | |
871 | \r | |
872 | **/\r | |
873 | UINT32\r | |
874 | EFIAPI\r | |
875 | IoBitFieldAndThenOr32 (\r | |
2f88bd3a MK |
876 | IN UINTN Port,\r |
877 | IN UINTN StartBit,\r | |
878 | IN UINTN EndBit,\r | |
879 | IN UINT32 AndData,\r | |
880 | IN UINT32 OrData\r | |
11f43dfd | 881 | )\r |
882 | {\r | |
883 | return IoWrite32 (\r | |
884 | Port,\r | |
885 | BitFieldAndThenOr32 (IoRead32 (Port), StartBit, EndBit, AndData, OrData)\r | |
886 | );\r | |
887 | }\r | |
888 | \r | |
889 | /**\r | |
62991af2 | 890 | Reads a 64-bit I/O port, performs a bitwise OR, and writes the\r |
11f43dfd | 891 | result back to the 64-bit I/O port.\r |
892 | \r | |
62991af2 | 893 | Reads the 64-bit I/O port specified by Port, performs a bitwise OR\r |
11f43dfd | 894 | between the read result and the value specified by OrData, and writes the\r |
895 | result to the 64-bit I/O port specified by Port. The value written to the I/O\r | |
896 | port is returned. This function must guarantee that all I/O read and write\r | |
897 | operations are serialized.\r | |
898 | \r | |
899 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 900 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 901 | \r |
902 | @param Port The I/O port to write.\r | |
903 | @param OrData The value to OR with the read value from the I/O port.\r | |
904 | \r | |
905 | @return The value written back to the I/O port.\r | |
906 | \r | |
907 | **/\r | |
908 | UINT64\r | |
909 | EFIAPI\r | |
910 | IoOr64 (\r | |
2f88bd3a MK |
911 | IN UINTN Port,\r |
912 | IN UINT64 OrData\r | |
11f43dfd | 913 | )\r |
914 | {\r | |
915 | return IoWrite64 (Port, IoRead64 (Port) | OrData);\r | |
916 | }\r | |
917 | \r | |
918 | /**\r | |
919 | Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back\r | |
920 | to the 64-bit I/O port.\r | |
921 | \r | |
922 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r | |
923 | the read result and the value specified by AndData, and writes the result to\r | |
924 | the 64-bit I/O port specified by Port. The value written to the I/O port is\r | |
925 | returned. This function must guarantee that all I/O read and write operations\r | |
926 | are serialized.\r | |
927 | \r | |
928 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 929 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 930 | \r |
931 | @param Port The I/O port to write.\r | |
932 | @param AndData The value to AND with the read value from the I/O port.\r | |
933 | \r | |
934 | @return The value written back to the I/O port.\r | |
935 | \r | |
936 | **/\r | |
937 | UINT64\r | |
938 | EFIAPI\r | |
939 | IoAnd64 (\r | |
2f88bd3a MK |
940 | IN UINTN Port,\r |
941 | IN UINT64 AndData\r | |
11f43dfd | 942 | )\r |
943 | {\r | |
944 | return IoWrite64 (Port, IoRead64 (Port) & AndData);\r | |
945 | }\r | |
946 | \r | |
947 | /**\r | |
9095d37b | 948 | Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 949 | OR, and writes the result back to the 64-bit I/O port.\r |
11f43dfd | 950 | \r |
951 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r | |
952 | the read result and the value specified by AndData, performs a bitwise OR\r | |
953 | between the result of the AND operation and the value specified by OrData,\r | |
954 | and writes the result to the 64-bit I/O port specified by Port. The value\r | |
955 | written to the I/O port is returned. This function must guarantee that all\r | |
956 | I/O read and write operations are serialized.\r | |
957 | \r | |
958 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 959 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 960 | \r |
961 | @param Port The I/O port to write.\r | |
962 | @param AndData The value to AND with the read value from the I/O port.\r | |
963 | @param OrData The value to OR with the result of the AND operation.\r | |
964 | \r | |
965 | @return The value written back to the I/O port.\r | |
966 | \r | |
967 | **/\r | |
968 | UINT64\r | |
969 | EFIAPI\r | |
970 | IoAndThenOr64 (\r | |
2f88bd3a MK |
971 | IN UINTN Port,\r |
972 | IN UINT64 AndData,\r | |
973 | IN UINT64 OrData\r | |
11f43dfd | 974 | )\r |
975 | {\r | |
976 | return IoWrite64 (Port, (IoRead64 (Port) & AndData) | OrData);\r | |
977 | }\r | |
978 | \r | |
979 | /**\r | |
980 | Reads a bit field of an I/O register.\r | |
981 | \r | |
982 | Reads the bit field in a 64-bit I/O register. The bit field is specified by\r | |
983 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
984 | \r | |
985 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 986 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 987 | If StartBit is greater than 63, then ASSERT().\r |
988 | If EndBit is greater than 63, then ASSERT().\r | |
989 | If EndBit is less than StartBit, then ASSERT().\r | |
990 | \r | |
991 | @param Port The I/O port to read.\r | |
992 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
993 | Range 0..63.\r | |
994 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
995 | Range 0..63.\r | |
996 | \r | |
997 | @return The value read.\r | |
998 | \r | |
999 | **/\r | |
1000 | UINT64\r | |
1001 | EFIAPI\r | |
1002 | IoBitFieldRead64 (\r | |
2f88bd3a MK |
1003 | IN UINTN Port,\r |
1004 | IN UINTN StartBit,\r | |
1005 | IN UINTN EndBit\r | |
11f43dfd | 1006 | )\r |
1007 | {\r | |
1008 | return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit);\r | |
1009 | }\r | |
1010 | \r | |
1011 | /**\r | |
1012 | Writes a bit field to an I/O register.\r | |
1013 | \r | |
1014 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
1015 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
1016 | register are preserved. The value written to the I/O port is returned. Extra\r | |
1017 | left bits in Value are stripped.\r | |
1018 | \r | |
1019 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1020 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 1021 | If StartBit is greater than 63, then ASSERT().\r |
1022 | If EndBit is greater than 63, then ASSERT().\r | |
1023 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1024 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1025 | \r |
1026 | @param Port The I/O port to write.\r | |
1027 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1028 | Range 0..63.\r | |
1029 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1030 | Range 0..63.\r | |
2fc59a00 | 1031 | @param Value The new value of the bit field.\r |
11f43dfd | 1032 | \r |
1033 | @return The value written back to the I/O port.\r | |
1034 | \r | |
1035 | **/\r | |
1036 | UINT64\r | |
1037 | EFIAPI\r | |
1038 | IoBitFieldWrite64 (\r | |
2f88bd3a MK |
1039 | IN UINTN Port,\r |
1040 | IN UINTN StartBit,\r | |
1041 | IN UINTN EndBit,\r | |
1042 | IN UINT64 Value\r | |
11f43dfd | 1043 | )\r |
1044 | {\r | |
1045 | return IoWrite64 (\r | |
1046 | Port,\r | |
1047 | BitFieldWrite64 (IoRead64 (Port), StartBit, EndBit, Value)\r | |
1048 | );\r | |
1049 | }\r | |
1050 | \r | |
1051 | /**\r | |
1052 | Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the\r | |
1053 | result back to the bit field in the 64-bit port.\r | |
1054 | \r | |
62991af2 | 1055 | Reads the 64-bit I/O port specified by Port, performs a bitwise OR\r |
11f43dfd | 1056 | between the read result and the value specified by OrData, and writes the\r |
1057 | result to the 64-bit I/O port specified by Port. The value written to the I/O\r | |
1058 | port is returned. This function must guarantee that all I/O read and write\r | |
1059 | operations are serialized. Extra left bits in OrData are stripped.\r | |
1060 | \r | |
1061 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1062 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 1063 | If StartBit is greater than 63, then ASSERT().\r |
1064 | If EndBit is greater than 63, then ASSERT().\r | |
1065 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1066 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1067 | \r |
1068 | @param Port The I/O port to write.\r | |
1069 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1070 | Range 0..63.\r | |
1071 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1072 | Range 0..63.\r | |
1073 | @param OrData The value to OR with the read value from the I/O port.\r | |
1074 | \r | |
1075 | @return The value written back to the I/O port.\r | |
1076 | \r | |
1077 | **/\r | |
1078 | UINT64\r | |
1079 | EFIAPI\r | |
1080 | IoBitFieldOr64 (\r | |
2f88bd3a MK |
1081 | IN UINTN Port,\r |
1082 | IN UINTN StartBit,\r | |
1083 | IN UINTN EndBit,\r | |
1084 | IN UINT64 OrData\r | |
11f43dfd | 1085 | )\r |
1086 | {\r | |
1087 | return IoWrite64 (\r | |
1088 | Port,\r | |
1089 | BitFieldOr64 (IoRead64 (Port), StartBit, EndBit, OrData)\r | |
1090 | );\r | |
1091 | }\r | |
1092 | \r | |
1093 | /**\r | |
1094 | Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the\r | |
1095 | result back to the bit field in the 64-bit port.\r | |
1096 | \r | |
1097 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r | |
1098 | the read result and the value specified by AndData, and writes the result to\r | |
1099 | the 64-bit I/O port specified by Port. The value written to the I/O port is\r | |
1100 | returned. This function must guarantee that all I/O read and write operations\r | |
1101 | are serialized. Extra left bits in AndData are stripped.\r | |
1102 | \r | |
1103 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1104 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 1105 | If StartBit is greater than 63, then ASSERT().\r |
1106 | If EndBit is greater than 63, then ASSERT().\r | |
1107 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1108 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1109 | \r |
1110 | @param Port The I/O port to write.\r | |
1111 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1112 | Range 0..63.\r | |
1113 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1114 | Range 0..63.\r | |
1115 | @param AndData The value to AND with the read value from the I/O port.\r | |
1116 | \r | |
1117 | @return The value written back to the I/O port.\r | |
1118 | \r | |
1119 | **/\r | |
1120 | UINT64\r | |
1121 | EFIAPI\r | |
1122 | IoBitFieldAnd64 (\r | |
2f88bd3a MK |
1123 | IN UINTN Port,\r |
1124 | IN UINTN StartBit,\r | |
1125 | IN UINTN EndBit,\r | |
1126 | IN UINT64 AndData\r | |
11f43dfd | 1127 | )\r |
1128 | {\r | |
1129 | return IoWrite64 (\r | |
1130 | Port,\r | |
1131 | BitFieldAnd64 (IoRead64 (Port), StartBit, EndBit, AndData)\r | |
1132 | );\r | |
1133 | }\r | |
1134 | \r | |
1135 | /**\r | |
1136 | Reads a bit field in a 64-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 1137 | bitwise OR, and writes the result back to the bit field in the\r |
11f43dfd | 1138 | 64-bit port.\r |
1139 | \r | |
1140 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 1141 | by a bitwise OR between the read result and the value specified by\r |
11f43dfd | 1142 | AndData, and writes the result to the 64-bit I/O port specified by Port. The\r |
1143 | value written to the I/O port is returned. This function must guarantee that\r | |
1144 | all I/O read and write operations are serialized. Extra left bits in both\r | |
1145 | AndData and OrData are stripped.\r | |
1146 | \r | |
1147 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1148 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 1149 | If StartBit is greater than 63, then ASSERT().\r |
1150 | If EndBit is greater than 63, then ASSERT().\r | |
1151 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
1152 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
1153 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
11f43dfd | 1154 | \r |
1155 | @param Port The I/O port to write.\r | |
1156 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1157 | Range 0..63.\r | |
1158 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1159 | Range 0..63.\r | |
1160 | @param AndData The value to AND with the read value from the I/O port.\r | |
1161 | @param OrData The value to OR with the result of the AND operation.\r | |
1162 | \r | |
1163 | @return The value written back to the I/O port.\r | |
1164 | \r | |
1165 | **/\r | |
1166 | UINT64\r | |
1167 | EFIAPI\r | |
1168 | IoBitFieldAndThenOr64 (\r | |
2f88bd3a MK |
1169 | IN UINTN Port,\r |
1170 | IN UINTN StartBit,\r | |
1171 | IN UINTN EndBit,\r | |
1172 | IN UINT64 AndData,\r | |
1173 | IN UINT64 OrData\r | |
11f43dfd | 1174 | )\r |
1175 | {\r | |
1176 | return IoWrite64 (\r | |
1177 | Port,\r | |
1178 | BitFieldAndThenOr64 (IoRead64 (Port), StartBit, EndBit, AndData, OrData)\r | |
1179 | );\r | |
1180 | }\r | |
1181 | \r | |
1182 | /**\r | |
62991af2 | 1183 | Reads an 8-bit MMIO register, performs a bitwise OR, and writes the\r |
11f43dfd | 1184 | result back to the 8-bit MMIO register.\r |
1185 | \r | |
9095d37b | 1186 | Reads the 8-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1187 | OR between the read result and the value specified by OrData, and\r |
11f43dfd | 1188 | writes the result to the 8-bit MMIO register specified by Address. The value\r |
1189 | written to the MMIO register is returned. This function must guarantee that\r | |
1190 | all MMIO read and write operations are serialized.\r | |
1191 | \r | |
1192 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1193 | \r | |
1194 | @param Address The MMIO register to write.\r | |
1195 | @param OrData The value to OR with the read value from the MMIO register.\r | |
1196 | \r | |
1197 | @return The value written back to the MMIO register.\r | |
1198 | \r | |
1199 | **/\r | |
1200 | UINT8\r | |
1201 | EFIAPI\r | |
1202 | MmioOr8 (\r | |
2f88bd3a MK |
1203 | IN UINTN Address,\r |
1204 | IN UINT8 OrData\r | |
11f43dfd | 1205 | )\r |
1206 | {\r | |
2f88bd3a | 1207 | return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) | OrData));\r |
11f43dfd | 1208 | }\r |
1209 | \r | |
1210 | /**\r | |
1211 | Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result\r | |
1212 | back to the 8-bit MMIO register.\r | |
1213 | \r | |
1214 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
1215 | between the read result and the value specified by AndData, and writes the\r | |
1216 | result to the 8-bit MMIO register specified by Address. The value written to\r | |
1217 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1218 | read and write operations are serialized.\r | |
1219 | \r | |
1220 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1221 | \r | |
1222 | @param Address The MMIO register to write.\r | |
1223 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1224 | \r | |
1225 | @return The value written back to the MMIO register.\r | |
1226 | \r | |
1227 | **/\r | |
1228 | UINT8\r | |
1229 | EFIAPI\r | |
1230 | MmioAnd8 (\r | |
2f88bd3a MK |
1231 | IN UINTN Address,\r |
1232 | IN UINT8 AndData\r | |
11f43dfd | 1233 | )\r |
1234 | {\r | |
2f88bd3a | 1235 | return MmioWrite8 (Address, (UINT8)(MmioRead8 (Address) & AndData));\r |
11f43dfd | 1236 | }\r |
1237 | \r | |
1238 | /**\r | |
9095d37b | 1239 | Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 1240 | OR, and writes the result back to the 8-bit MMIO register.\r |
11f43dfd | 1241 | \r |
1242 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
1243 | between the read result and the value specified by AndData, performs a\r | |
1244 | bitwise OR between the result of the AND operation and the value specified by\r | |
1245 | OrData, and writes the result to the 8-bit MMIO register specified by\r | |
1246 | Address. The value written to the MMIO register is returned. This function\r | |
1247 | must guarantee that all MMIO read and write operations are serialized.\r | |
1248 | \r | |
1249 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1250 | \r | |
1251 | \r | |
1252 | @param Address The MMIO register to write.\r | |
1253 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1254 | @param OrData The value to OR with the result of the AND operation.\r | |
1255 | \r | |
1256 | @return The value written back to the MMIO register.\r | |
1257 | \r | |
1258 | **/\r | |
1259 | UINT8\r | |
1260 | EFIAPI\r | |
1261 | MmioAndThenOr8 (\r | |
2f88bd3a MK |
1262 | IN UINTN Address,\r |
1263 | IN UINT8 AndData,\r | |
1264 | IN UINT8 OrData\r | |
11f43dfd | 1265 | )\r |
1266 | {\r | |
2f88bd3a | 1267 | return MmioWrite8 (Address, (UINT8)((MmioRead8 (Address) & AndData) | OrData));\r |
11f43dfd | 1268 | }\r |
1269 | \r | |
1270 | /**\r | |
1271 | Reads a bit field of a MMIO register.\r | |
1272 | \r | |
1273 | Reads the bit field in an 8-bit MMIO register. The bit field is specified by\r | |
1274 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
1275 | \r | |
1276 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1277 | If StartBit is greater than 7, then ASSERT().\r | |
1278 | If EndBit is greater than 7, then ASSERT().\r | |
1279 | If EndBit is less than StartBit, then ASSERT().\r | |
1280 | \r | |
58380e9c | 1281 | @param Address The MMIO register to read.\r |
11f43dfd | 1282 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1283 | Range 0..7.\r | |
1284 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1285 | Range 0..7.\r | |
1286 | \r | |
1287 | @return The value read.\r | |
1288 | \r | |
1289 | **/\r | |
1290 | UINT8\r | |
1291 | EFIAPI\r | |
1292 | MmioBitFieldRead8 (\r | |
2f88bd3a MK |
1293 | IN UINTN Address,\r |
1294 | IN UINTN StartBit,\r | |
1295 | IN UINTN EndBit\r | |
11f43dfd | 1296 | )\r |
1297 | {\r | |
1298 | return BitFieldRead8 (MmioRead8 (Address), StartBit, EndBit);\r | |
1299 | }\r | |
1300 | \r | |
1301 | /**\r | |
1302 | Writes a bit field to a MMIO register.\r | |
1303 | \r | |
1304 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
1305 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
1306 | MMIO register are preserved. The new value of the 8-bit register is returned.\r | |
1307 | \r | |
1308 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1309 | If StartBit is greater than 7, then ASSERT().\r | |
1310 | If EndBit is greater than 7, then ASSERT().\r | |
1311 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1312 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1313 | \r |
58380e9c | 1314 | @param Address The MMIO register to write.\r |
11f43dfd | 1315 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1316 | Range 0..7.\r | |
1317 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1318 | Range 0..7.\r | |
2fc59a00 | 1319 | @param Value The new value of the bit field.\r |
11f43dfd | 1320 | \r |
1321 | @return The value written back to the MMIO register.\r | |
1322 | \r | |
1323 | **/\r | |
1324 | UINT8\r | |
1325 | EFIAPI\r | |
1326 | MmioBitFieldWrite8 (\r | |
2f88bd3a MK |
1327 | IN UINTN Address,\r |
1328 | IN UINTN StartBit,\r | |
1329 | IN UINTN EndBit,\r | |
1330 | IN UINT8 Value\r | |
11f43dfd | 1331 | )\r |
1332 | {\r | |
1333 | return MmioWrite8 (\r | |
1334 | Address,\r | |
1335 | BitFieldWrite8 (MmioRead8 (Address), StartBit, EndBit, Value)\r | |
1336 | );\r | |
1337 | }\r | |
1338 | \r | |
1339 | /**\r | |
1340 | Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and\r | |
1341 | writes the result back to the bit field in the 8-bit MMIO register.\r | |
1342 | \r | |
9095d37b | 1343 | Reads the 8-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1344 | OR between the read result and the value specified by OrData, and\r |
11f43dfd | 1345 | writes the result to the 8-bit MMIO register specified by Address. The value\r |
1346 | written to the MMIO register is returned. This function must guarantee that\r | |
1347 | all MMIO read and write operations are serialized. Extra left bits in OrData\r | |
1348 | are stripped.\r | |
1349 | \r | |
1350 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1351 | If StartBit is greater than 7, then ASSERT().\r | |
1352 | If EndBit is greater than 7, then ASSERT().\r | |
1353 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1354 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1355 | \r |
58380e9c | 1356 | @param Address The MMIO register to write.\r |
11f43dfd | 1357 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1358 | Range 0..7.\r | |
1359 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1360 | Range 0..7.\r | |
1361 | @param OrData The value to OR with read value from the MMIO register.\r | |
1362 | \r | |
1363 | @return The value written back to the MMIO register.\r | |
1364 | \r | |
1365 | **/\r | |
1366 | UINT8\r | |
1367 | EFIAPI\r | |
1368 | MmioBitFieldOr8 (\r | |
2f88bd3a MK |
1369 | IN UINTN Address,\r |
1370 | IN UINTN StartBit,\r | |
1371 | IN UINTN EndBit,\r | |
1372 | IN UINT8 OrData\r | |
11f43dfd | 1373 | )\r |
1374 | {\r | |
1375 | return MmioWrite8 (\r | |
1376 | Address,\r | |
1377 | BitFieldOr8 (MmioRead8 (Address), StartBit, EndBit, OrData)\r | |
1378 | );\r | |
1379 | }\r | |
1380 | \r | |
1381 | /**\r | |
1382 | Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and\r | |
1383 | writes the result back to the bit field in the 8-bit MMIO register.\r | |
1384 | \r | |
1385 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
1386 | between the read result and the value specified by AndData, and writes the\r | |
1387 | result to the 8-bit MMIO register specified by Address. The value written to\r | |
1388 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1389 | read and write operations are serialized. Extra left bits in AndData are\r | |
1390 | stripped.\r | |
1391 | \r | |
1392 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1393 | If StartBit is greater than 7, then ASSERT().\r | |
1394 | If EndBit is greater than 7, then ASSERT().\r | |
1395 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1396 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1397 | \r |
58380e9c | 1398 | @param Address The MMIO register to write.\r |
11f43dfd | 1399 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1400 | Range 0..7.\r | |
1401 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1402 | Range 0..7.\r | |
1403 | @param AndData The value to AND with read value from the MMIO register.\r | |
1404 | \r | |
1405 | @return The value written back to the MMIO register.\r | |
1406 | \r | |
1407 | **/\r | |
1408 | UINT8\r | |
1409 | EFIAPI\r | |
1410 | MmioBitFieldAnd8 (\r | |
2f88bd3a MK |
1411 | IN UINTN Address,\r |
1412 | IN UINTN StartBit,\r | |
1413 | IN UINTN EndBit,\r | |
1414 | IN UINT8 AndData\r | |
11f43dfd | 1415 | )\r |
1416 | {\r | |
1417 | return MmioWrite8 (\r | |
1418 | Address,\r | |
1419 | BitFieldAnd8 (MmioRead8 (Address), StartBit, EndBit, AndData)\r | |
1420 | );\r | |
1421 | }\r | |
1422 | \r | |
1423 | /**\r | |
1424 | Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 1425 | by a bitwise OR, and writes the result back to the bit field in the\r |
11f43dfd | 1426 | 8-bit MMIO register.\r |
1427 | \r | |
1428 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 1429 | followed by a bitwise OR between the read result and the value\r |
11f43dfd | 1430 | specified by AndData, and writes the result to the 8-bit MMIO register\r |
1431 | specified by Address. The value written to the MMIO register is returned.\r | |
1432 | This function must guarantee that all MMIO read and write operations are\r | |
1433 | serialized. Extra left bits in both AndData and OrData are stripped.\r | |
1434 | \r | |
1435 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1436 | If StartBit is greater than 7, then ASSERT().\r | |
1437 | If EndBit is greater than 7, then ASSERT().\r | |
1438 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
1439 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
1440 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
11f43dfd | 1441 | \r |
58380e9c | 1442 | @param Address The MMIO register to write.\r |
11f43dfd | 1443 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1444 | Range 0..7.\r | |
1445 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1446 | Range 0..7.\r | |
1447 | @param AndData The value to AND with read value from the MMIO register.\r | |
1448 | @param OrData The value to OR with the result of the AND operation.\r | |
1449 | \r | |
1450 | @return The value written back to the MMIO register.\r | |
1451 | \r | |
1452 | **/\r | |
1453 | UINT8\r | |
1454 | EFIAPI\r | |
1455 | MmioBitFieldAndThenOr8 (\r | |
2f88bd3a MK |
1456 | IN UINTN Address,\r |
1457 | IN UINTN StartBit,\r | |
1458 | IN UINTN EndBit,\r | |
1459 | IN UINT8 AndData,\r | |
1460 | IN UINT8 OrData\r | |
11f43dfd | 1461 | )\r |
1462 | {\r | |
1463 | return MmioWrite8 (\r | |
1464 | Address,\r | |
1465 | BitFieldAndThenOr8 (MmioRead8 (Address), StartBit, EndBit, AndData, OrData)\r | |
1466 | );\r | |
1467 | }\r | |
1468 | \r | |
1469 | /**\r | |
62991af2 | 1470 | Reads a 16-bit MMIO register, performs a bitwise OR, and writes the\r |
11f43dfd | 1471 | result back to the 16-bit MMIO register.\r |
1472 | \r | |
9095d37b | 1473 | Reads the 16-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1474 | OR between the read result and the value specified by OrData, and\r |
11f43dfd | 1475 | writes the result to the 16-bit MMIO register specified by Address. The value\r |
1476 | written to the MMIO register is returned. This function must guarantee that\r | |
1477 | all MMIO read and write operations are serialized.\r | |
1478 | \r | |
1479 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1480 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 1481 | \r |
1482 | @param Address The MMIO register to write.\r | |
1483 | @param OrData The value to OR with the read value from the MMIO register.\r | |
1484 | \r | |
1485 | @return The value written back to the MMIO register.\r | |
1486 | \r | |
1487 | **/\r | |
1488 | UINT16\r | |
1489 | EFIAPI\r | |
1490 | MmioOr16 (\r | |
2f88bd3a MK |
1491 | IN UINTN Address,\r |
1492 | IN UINT16 OrData\r | |
11f43dfd | 1493 | )\r |
1494 | {\r | |
2f88bd3a | 1495 | return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) | OrData));\r |
11f43dfd | 1496 | }\r |
1497 | \r | |
1498 | /**\r | |
1499 | Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result\r | |
1500 | back to the 16-bit MMIO register.\r | |
1501 | \r | |
1502 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
1503 | between the read result and the value specified by AndData, and writes the\r | |
1504 | result to the 16-bit MMIO register specified by Address. The value written to\r | |
1505 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1506 | read and write operations are serialized.\r | |
1507 | \r | |
1508 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1509 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 1510 | \r |
1511 | @param Address The MMIO register to write.\r | |
1512 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1513 | \r | |
1514 | @return The value written back to the MMIO register.\r | |
1515 | \r | |
1516 | **/\r | |
1517 | UINT16\r | |
1518 | EFIAPI\r | |
1519 | MmioAnd16 (\r | |
2f88bd3a MK |
1520 | IN UINTN Address,\r |
1521 | IN UINT16 AndData\r | |
11f43dfd | 1522 | )\r |
1523 | {\r | |
2f88bd3a | 1524 | return MmioWrite16 (Address, (UINT16)(MmioRead16 (Address) & AndData));\r |
11f43dfd | 1525 | }\r |
1526 | \r | |
1527 | /**\r | |
9095d37b | 1528 | Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 1529 | OR, and writes the result back to the 16-bit MMIO register.\r |
11f43dfd | 1530 | \r |
1531 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
1532 | between the read result and the value specified by AndData, performs a\r | |
1533 | bitwise OR between the result of the AND operation and the value specified by\r | |
1534 | OrData, and writes the result to the 16-bit MMIO register specified by\r | |
1535 | Address. The value written to the MMIO register is returned. This function\r | |
1536 | must guarantee that all MMIO read and write operations are serialized.\r | |
1537 | \r | |
1538 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1539 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 1540 | \r |
1541 | @param Address The MMIO register to write.\r | |
1542 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1543 | @param OrData The value to OR with the result of the AND operation.\r | |
1544 | \r | |
1545 | @return The value written back to the MMIO register.\r | |
1546 | \r | |
1547 | **/\r | |
1548 | UINT16\r | |
1549 | EFIAPI\r | |
1550 | MmioAndThenOr16 (\r | |
2f88bd3a MK |
1551 | IN UINTN Address,\r |
1552 | IN UINT16 AndData,\r | |
1553 | IN UINT16 OrData\r | |
11f43dfd | 1554 | )\r |
1555 | {\r | |
2f88bd3a | 1556 | return MmioWrite16 (Address, (UINT16)((MmioRead16 (Address) & AndData) | OrData));\r |
11f43dfd | 1557 | }\r |
1558 | \r | |
1559 | /**\r | |
1560 | Reads a bit field of a MMIO register.\r | |
1561 | \r | |
1562 | Reads the bit field in a 16-bit MMIO register. The bit field is specified by\r | |
1563 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
1564 | \r | |
1565 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1566 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 1567 | If StartBit is greater than 15, then ASSERT().\r |
1568 | If EndBit is greater than 15, then ASSERT().\r | |
1569 | If EndBit is less than StartBit, then ASSERT().\r | |
1570 | \r | |
58380e9c | 1571 | @param Address The MMIO register to read.\r |
11f43dfd | 1572 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1573 | Range 0..15.\r | |
1574 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1575 | Range 0..15.\r | |
1576 | \r | |
80f0c0c4 | 1577 | @return The value read.\r |
11f43dfd | 1578 | \r |
1579 | **/\r | |
1580 | UINT16\r | |
1581 | EFIAPI\r | |
1582 | MmioBitFieldRead16 (\r | |
2f88bd3a MK |
1583 | IN UINTN Address,\r |
1584 | IN UINTN StartBit,\r | |
1585 | IN UINTN EndBit\r | |
11f43dfd | 1586 | )\r |
1587 | {\r | |
1588 | return BitFieldRead16 (MmioRead16 (Address), StartBit, EndBit);\r | |
1589 | }\r | |
1590 | \r | |
1591 | /**\r | |
1592 | Writes a bit field to a MMIO register.\r | |
1593 | \r | |
1594 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
1595 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
1596 | MMIO register are preserved. The new value of the 16-bit register is returned.\r | |
1597 | \r | |
1598 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1599 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 1600 | If StartBit is greater than 15, then ASSERT().\r |
1601 | If EndBit is greater than 15, then ASSERT().\r | |
1602 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1603 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1604 | \r |
58380e9c | 1605 | @param Address The MMIO register to write.\r |
11f43dfd | 1606 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1607 | Range 0..15.\r | |
1608 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1609 | Range 0..15.\r | |
2fc59a00 | 1610 | @param Value The new value of the bit field.\r |
11f43dfd | 1611 | \r |
1612 | @return The value written back to the MMIO register.\r | |
1613 | \r | |
1614 | **/\r | |
1615 | UINT16\r | |
1616 | EFIAPI\r | |
1617 | MmioBitFieldWrite16 (\r | |
2f88bd3a MK |
1618 | IN UINTN Address,\r |
1619 | IN UINTN StartBit,\r | |
1620 | IN UINTN EndBit,\r | |
1621 | IN UINT16 Value\r | |
11f43dfd | 1622 | )\r |
1623 | {\r | |
1624 | return MmioWrite16 (\r | |
1625 | Address,\r | |
1626 | BitFieldWrite16 (MmioRead16 (Address), StartBit, EndBit, Value)\r | |
1627 | );\r | |
1628 | }\r | |
1629 | \r | |
1630 | /**\r | |
1631 | Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and\r | |
1632 | writes the result back to the bit field in the 16-bit MMIO register.\r | |
1633 | \r | |
9095d37b | 1634 | Reads the 16-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1635 | OR between the read result and the value specified by OrData, and\r |
11f43dfd | 1636 | writes the result to the 16-bit MMIO register specified by Address. The value\r |
1637 | written to the MMIO register is returned. This function must guarantee that\r | |
1638 | all MMIO read and write operations are serialized. Extra left bits in OrData\r | |
1639 | are stripped.\r | |
1640 | \r | |
1641 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1642 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 1643 | If StartBit is greater than 15, then ASSERT().\r |
1644 | If EndBit is greater than 15, then ASSERT().\r | |
1645 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1646 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1647 | \r |
58380e9c | 1648 | @param Address The MMIO register to write.\r |
11f43dfd | 1649 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1650 | Range 0..15.\r | |
1651 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1652 | Range 0..15.\r | |
1653 | @param OrData The value to OR with read value from the MMIO register.\r | |
1654 | \r | |
1655 | @return The value written back to the MMIO register.\r | |
1656 | \r | |
1657 | **/\r | |
1658 | UINT16\r | |
1659 | EFIAPI\r | |
1660 | MmioBitFieldOr16 (\r | |
2f88bd3a MK |
1661 | IN UINTN Address,\r |
1662 | IN UINTN StartBit,\r | |
1663 | IN UINTN EndBit,\r | |
1664 | IN UINT16 OrData\r | |
11f43dfd | 1665 | )\r |
1666 | {\r | |
1667 | return MmioWrite16 (\r | |
1668 | Address,\r | |
1669 | BitFieldOr16 (MmioRead16 (Address), StartBit, EndBit, OrData)\r | |
1670 | );\r | |
1671 | }\r | |
1672 | \r | |
1673 | /**\r | |
1674 | Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and\r | |
1675 | writes the result back to the bit field in the 16-bit MMIO register.\r | |
1676 | \r | |
1677 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
1678 | between the read result and the value specified by AndData, and writes the\r | |
1679 | result to the 16-bit MMIO register specified by Address. The value written to\r | |
1680 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1681 | read and write operations are serialized. Extra left bits in AndData are\r | |
1682 | stripped.\r | |
1683 | \r | |
1684 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1685 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 1686 | If StartBit is greater than 15, then ASSERT().\r |
1687 | If EndBit is greater than 15, then ASSERT().\r | |
1688 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1689 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1690 | \r |
58380e9c | 1691 | @param Address The MMIO register to write.\r |
11f43dfd | 1692 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1693 | Range 0..15.\r | |
1694 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1695 | Range 0..15.\r | |
1696 | @param AndData The value to AND with read value from the MMIO register.\r | |
1697 | \r | |
1698 | @return The value written back to the MMIO register.\r | |
1699 | \r | |
1700 | **/\r | |
1701 | UINT16\r | |
1702 | EFIAPI\r | |
1703 | MmioBitFieldAnd16 (\r | |
2f88bd3a MK |
1704 | IN UINTN Address,\r |
1705 | IN UINTN StartBit,\r | |
1706 | IN UINTN EndBit,\r | |
1707 | IN UINT16 AndData\r | |
11f43dfd | 1708 | )\r |
1709 | {\r | |
1710 | return MmioWrite16 (\r | |
1711 | Address,\r | |
1712 | BitFieldAnd16 (MmioRead16 (Address), StartBit, EndBit, AndData)\r | |
1713 | );\r | |
1714 | }\r | |
1715 | \r | |
1716 | /**\r | |
1717 | Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 1718 | by a bitwise OR, and writes the result back to the bit field in the\r |
11f43dfd | 1719 | 16-bit MMIO register.\r |
1720 | \r | |
1721 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 1722 | followed by a bitwise OR between the read result and the value\r |
11f43dfd | 1723 | specified by AndData, and writes the result to the 16-bit MMIO register\r |
1724 | specified by Address. The value written to the MMIO register is returned.\r | |
1725 | This function must guarantee that all MMIO read and write operations are\r | |
1726 | serialized. Extra left bits in both AndData and OrData are stripped.\r | |
1727 | \r | |
1728 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1729 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
11f43dfd | 1730 | If StartBit is greater than 15, then ASSERT().\r |
1731 | If EndBit is greater than 15, then ASSERT().\r | |
1732 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
1733 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
1734 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
11f43dfd | 1735 | \r |
58380e9c | 1736 | @param Address The MMIO register to write.\r |
11f43dfd | 1737 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1738 | Range 0..15.\r | |
1739 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1740 | Range 0..15.\r | |
1741 | @param AndData The value to AND with read value from the MMIO register.\r | |
1742 | @param OrData The value to OR with the result of the AND operation.\r | |
1743 | \r | |
1744 | @return The value written back to the MMIO register.\r | |
1745 | \r | |
1746 | **/\r | |
1747 | UINT16\r | |
1748 | EFIAPI\r | |
1749 | MmioBitFieldAndThenOr16 (\r | |
2f88bd3a MK |
1750 | IN UINTN Address,\r |
1751 | IN UINTN StartBit,\r | |
1752 | IN UINTN EndBit,\r | |
1753 | IN UINT16 AndData,\r | |
1754 | IN UINT16 OrData\r | |
11f43dfd | 1755 | )\r |
1756 | {\r | |
1757 | return MmioWrite16 (\r | |
1758 | Address,\r | |
1759 | BitFieldAndThenOr16 (MmioRead16 (Address), StartBit, EndBit, AndData, OrData)\r | |
1760 | );\r | |
1761 | }\r | |
1762 | \r | |
1763 | /**\r | |
62991af2 | 1764 | Reads a 32-bit MMIO register, performs a bitwise OR, and writes the\r |
11f43dfd | 1765 | result back to the 32-bit MMIO register.\r |
1766 | \r | |
9095d37b | 1767 | Reads the 32-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1768 | OR between the read result and the value specified by OrData, and\r |
11f43dfd | 1769 | writes the result to the 32-bit MMIO register specified by Address. The value\r |
1770 | written to the MMIO register is returned. This function must guarantee that\r | |
1771 | all MMIO read and write operations are serialized.\r | |
1772 | \r | |
1773 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1774 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 1775 | \r |
1776 | @param Address The MMIO register to write.\r | |
1777 | @param OrData The value to OR with the read value from the MMIO register.\r | |
1778 | \r | |
1779 | @return The value written back to the MMIO register.\r | |
1780 | \r | |
1781 | **/\r | |
1782 | UINT32\r | |
1783 | EFIAPI\r | |
1784 | MmioOr32 (\r | |
2f88bd3a MK |
1785 | IN UINTN Address,\r |
1786 | IN UINT32 OrData\r | |
11f43dfd | 1787 | )\r |
1788 | {\r | |
1789 | return MmioWrite32 (Address, MmioRead32 (Address) | OrData);\r | |
1790 | }\r | |
1791 | \r | |
1792 | /**\r | |
1793 | Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result\r | |
1794 | back to the 32-bit MMIO register.\r | |
1795 | \r | |
1796 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
1797 | between the read result and the value specified by AndData, and writes the\r | |
1798 | result to the 32-bit MMIO register specified by Address. The value written to\r | |
1799 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1800 | read and write operations are serialized.\r | |
1801 | \r | |
1802 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1803 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 1804 | \r |
1805 | @param Address The MMIO register to write.\r | |
1806 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1807 | \r | |
1808 | @return The value written back to the MMIO register.\r | |
1809 | \r | |
1810 | **/\r | |
1811 | UINT32\r | |
1812 | EFIAPI\r | |
1813 | MmioAnd32 (\r | |
2f88bd3a MK |
1814 | IN UINTN Address,\r |
1815 | IN UINT32 AndData\r | |
11f43dfd | 1816 | )\r |
1817 | {\r | |
1818 | return MmioWrite32 (Address, MmioRead32 (Address) & AndData);\r | |
1819 | }\r | |
1820 | \r | |
1821 | /**\r | |
9095d37b | 1822 | Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 1823 | OR, and writes the result back to the 32-bit MMIO register.\r |
11f43dfd | 1824 | \r |
1825 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
1826 | between the read result and the value specified by AndData, performs a\r | |
1827 | bitwise OR between the result of the AND operation and the value specified by\r | |
1828 | OrData, and writes the result to the 32-bit MMIO register specified by\r | |
1829 | Address. The value written to the MMIO register is returned. This function\r | |
1830 | must guarantee that all MMIO read and write operations are serialized.\r | |
1831 | \r | |
1832 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1833 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 1834 | \r |
1835 | @param Address The MMIO register to write.\r | |
1836 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1837 | @param OrData The value to OR with the result of the AND operation.\r | |
1838 | \r | |
1839 | @return The value written back to the MMIO register.\r | |
1840 | \r | |
1841 | **/\r | |
1842 | UINT32\r | |
1843 | EFIAPI\r | |
1844 | MmioAndThenOr32 (\r | |
2f88bd3a MK |
1845 | IN UINTN Address,\r |
1846 | IN UINT32 AndData,\r | |
1847 | IN UINT32 OrData\r | |
11f43dfd | 1848 | )\r |
1849 | {\r | |
1850 | return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData);\r | |
1851 | }\r | |
1852 | \r | |
1853 | /**\r | |
1854 | Reads a bit field of a MMIO register.\r | |
1855 | \r | |
1856 | Reads the bit field in a 32-bit MMIO register. The bit field is specified by\r | |
1857 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
1858 | \r | |
1859 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1860 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 1861 | If StartBit is greater than 31, then ASSERT().\r |
1862 | If EndBit is greater than 31, then ASSERT().\r | |
1863 | If EndBit is less than StartBit, then ASSERT().\r | |
1864 | \r | |
58380e9c | 1865 | @param Address The MMIO register to read.\r |
11f43dfd | 1866 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1867 | Range 0..31.\r | |
1868 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1869 | Range 0..31.\r | |
1870 | \r | |
1871 | @return The value read.\r | |
1872 | \r | |
1873 | **/\r | |
1874 | UINT32\r | |
1875 | EFIAPI\r | |
1876 | MmioBitFieldRead32 (\r | |
2f88bd3a MK |
1877 | IN UINTN Address,\r |
1878 | IN UINTN StartBit,\r | |
1879 | IN UINTN EndBit\r | |
11f43dfd | 1880 | )\r |
1881 | {\r | |
1882 | return BitFieldRead32 (MmioRead32 (Address), StartBit, EndBit);\r | |
1883 | }\r | |
1884 | \r | |
1885 | /**\r | |
1886 | Writes a bit field to a MMIO register.\r | |
1887 | \r | |
1888 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
1889 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
1890 | MMIO register are preserved. The new value of the 32-bit register is returned.\r | |
1891 | \r | |
1892 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1893 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 1894 | If StartBit is greater than 31, then ASSERT().\r |
1895 | If EndBit is greater than 31, then ASSERT().\r | |
1896 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1897 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1898 | \r |
58380e9c | 1899 | @param Address The MMIO register to write.\r |
11f43dfd | 1900 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1901 | Range 0..31.\r | |
1902 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1903 | Range 0..31.\r | |
2fc59a00 | 1904 | @param Value The new value of the bit field.\r |
11f43dfd | 1905 | \r |
1906 | @return The value written back to the MMIO register.\r | |
1907 | \r | |
1908 | **/\r | |
1909 | UINT32\r | |
1910 | EFIAPI\r | |
1911 | MmioBitFieldWrite32 (\r | |
2f88bd3a MK |
1912 | IN UINTN Address,\r |
1913 | IN UINTN StartBit,\r | |
1914 | IN UINTN EndBit,\r | |
1915 | IN UINT32 Value\r | |
11f43dfd | 1916 | )\r |
1917 | {\r | |
1918 | return MmioWrite32 (\r | |
1919 | Address,\r | |
1920 | BitFieldWrite32 (MmioRead32 (Address), StartBit, EndBit, Value)\r | |
1921 | );\r | |
1922 | }\r | |
1923 | \r | |
1924 | /**\r | |
1925 | Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and\r | |
1926 | writes the result back to the bit field in the 32-bit MMIO register.\r | |
1927 | \r | |
9095d37b | 1928 | Reads the 32-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1929 | OR between the read result and the value specified by OrData, and\r |
11f43dfd | 1930 | writes the result to the 32-bit MMIO register specified by Address. The value\r |
1931 | written to the MMIO register is returned. This function must guarantee that\r | |
1932 | all MMIO read and write operations are serialized. Extra left bits in OrData\r | |
1933 | are stripped.\r | |
1934 | \r | |
1935 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1936 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 1937 | If StartBit is greater than 31, then ASSERT().\r |
1938 | If EndBit is greater than 31, then ASSERT().\r | |
1939 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1940 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1941 | \r |
58380e9c | 1942 | @param Address The MMIO register to write.\r |
11f43dfd | 1943 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1944 | Range 0..31.\r | |
1945 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1946 | Range 0..31.\r | |
1947 | @param OrData The value to OR with read value from the MMIO register.\r | |
1948 | \r | |
1949 | @return The value written back to the MMIO register.\r | |
1950 | \r | |
1951 | **/\r | |
1952 | UINT32\r | |
1953 | EFIAPI\r | |
1954 | MmioBitFieldOr32 (\r | |
2f88bd3a MK |
1955 | IN UINTN Address,\r |
1956 | IN UINTN StartBit,\r | |
1957 | IN UINTN EndBit,\r | |
1958 | IN UINT32 OrData\r | |
11f43dfd | 1959 | )\r |
1960 | {\r | |
1961 | return MmioWrite32 (\r | |
1962 | Address,\r | |
1963 | BitFieldOr32 (MmioRead32 (Address), StartBit, EndBit, OrData)\r | |
1964 | );\r | |
1965 | }\r | |
1966 | \r | |
1967 | /**\r | |
1968 | Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and\r | |
1969 | writes the result back to the bit field in the 32-bit MMIO register.\r | |
1970 | \r | |
1971 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
1972 | between the read result and the value specified by AndData, and writes the\r | |
1973 | result to the 32-bit MMIO register specified by Address. The value written to\r | |
1974 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1975 | read and write operations are serialized. Extra left bits in AndData are\r | |
1976 | stripped.\r | |
1977 | \r | |
1978 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 1979 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 1980 | If StartBit is greater than 31, then ASSERT().\r |
1981 | If EndBit is greater than 31, then ASSERT().\r | |
1982 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1983 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 1984 | \r |
58380e9c | 1985 | @param Address The MMIO register to write.\r |
11f43dfd | 1986 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
1987 | Range 0..31.\r | |
1988 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1989 | Range 0..31.\r | |
1990 | @param AndData The value to AND with read value from the MMIO register.\r | |
1991 | \r | |
1992 | @return The value written back to the MMIO register.\r | |
1993 | \r | |
1994 | **/\r | |
1995 | UINT32\r | |
1996 | EFIAPI\r | |
1997 | MmioBitFieldAnd32 (\r | |
2f88bd3a MK |
1998 | IN UINTN Address,\r |
1999 | IN UINTN StartBit,\r | |
2000 | IN UINTN EndBit,\r | |
2001 | IN UINT32 AndData\r | |
11f43dfd | 2002 | )\r |
2003 | {\r | |
2004 | return MmioWrite32 (\r | |
2005 | Address,\r | |
2006 | BitFieldAnd32 (MmioRead32 (Address), StartBit, EndBit, AndData)\r | |
2007 | );\r | |
2008 | }\r | |
2009 | \r | |
2010 | /**\r | |
2011 | Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 2012 | by a bitwise OR, and writes the result back to the bit field in the\r |
11f43dfd | 2013 | 32-bit MMIO register.\r |
2014 | \r | |
2015 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 2016 | followed by a bitwise OR between the read result and the value\r |
11f43dfd | 2017 | specified by AndData, and writes the result to the 32-bit MMIO register\r |
2018 | specified by Address. The value written to the MMIO register is returned.\r | |
2019 | This function must guarantee that all MMIO read and write operations are\r | |
2020 | serialized. Extra left bits in both AndData and OrData are stripped.\r | |
2021 | \r | |
2022 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 2023 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
11f43dfd | 2024 | If StartBit is greater than 31, then ASSERT().\r |
2025 | If EndBit is greater than 31, then ASSERT().\r | |
2026 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
2027 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
2028 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
11f43dfd | 2029 | \r |
58380e9c | 2030 | @param Address The MMIO register to write.\r |
11f43dfd | 2031 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
2032 | Range 0..31.\r | |
2033 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2034 | Range 0..31.\r | |
2035 | @param AndData The value to AND with read value from the MMIO register.\r | |
2036 | @param OrData The value to OR with the result of the AND operation.\r | |
2037 | \r | |
2038 | @return The value written back to the MMIO register.\r | |
2039 | \r | |
2040 | **/\r | |
2041 | UINT32\r | |
2042 | EFIAPI\r | |
2043 | MmioBitFieldAndThenOr32 (\r | |
2f88bd3a MK |
2044 | IN UINTN Address,\r |
2045 | IN UINTN StartBit,\r | |
2046 | IN UINTN EndBit,\r | |
2047 | IN UINT32 AndData,\r | |
2048 | IN UINT32 OrData\r | |
11f43dfd | 2049 | )\r |
2050 | {\r | |
2051 | return MmioWrite32 (\r | |
2052 | Address,\r | |
2053 | BitFieldAndThenOr32 (MmioRead32 (Address), StartBit, EndBit, AndData, OrData)\r | |
2054 | );\r | |
2055 | }\r | |
2056 | \r | |
2057 | /**\r | |
62991af2 | 2058 | Reads a 64-bit MMIO register, performs a bitwise OR, and writes the\r |
11f43dfd | 2059 | result back to the 64-bit MMIO register.\r |
2060 | \r | |
9095d37b | 2061 | Reads the 64-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 2062 | OR between the read result and the value specified by OrData, and\r |
11f43dfd | 2063 | writes the result to the 64-bit MMIO register specified by Address. The value\r |
2064 | written to the MMIO register is returned. This function must guarantee that\r | |
2065 | all MMIO read and write operations are serialized.\r | |
2066 | \r | |
2067 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 2068 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 2069 | \r |
2070 | @param Address The MMIO register to write.\r | |
2071 | @param OrData The value to OR with the read value from the MMIO register.\r | |
2072 | \r | |
2073 | @return The value written back to the MMIO register.\r | |
2074 | \r | |
2075 | **/\r | |
2076 | UINT64\r | |
2077 | EFIAPI\r | |
2078 | MmioOr64 (\r | |
2f88bd3a MK |
2079 | IN UINTN Address,\r |
2080 | IN UINT64 OrData\r | |
11f43dfd | 2081 | )\r |
2082 | {\r | |
2083 | return MmioWrite64 (Address, MmioRead64 (Address) | OrData);\r | |
2084 | }\r | |
2085 | \r | |
2086 | /**\r | |
2087 | Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result\r | |
2088 | back to the 64-bit MMIO register.\r | |
2089 | \r | |
2090 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
2091 | between the read result and the value specified by AndData, and writes the\r | |
2092 | result to the 64-bit MMIO register specified by Address. The value written to\r | |
2093 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
2094 | read and write operations are serialized.\r | |
2095 | \r | |
2096 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 2097 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 2098 | \r |
2099 | @param Address The MMIO register to write.\r | |
2100 | @param AndData The value to AND with the read value from the MMIO register.\r | |
2101 | \r | |
2102 | @return The value written back to the MMIO register.\r | |
2103 | \r | |
2104 | **/\r | |
2105 | UINT64\r | |
2106 | EFIAPI\r | |
2107 | MmioAnd64 (\r | |
2f88bd3a MK |
2108 | IN UINTN Address,\r |
2109 | IN UINT64 AndData\r | |
11f43dfd | 2110 | )\r |
2111 | {\r | |
2112 | return MmioWrite64 (Address, MmioRead64 (Address) & AndData);\r | |
2113 | }\r | |
2114 | \r | |
2115 | /**\r | |
9095d37b | 2116 | Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 2117 | OR, and writes the result back to the 64-bit MMIO register.\r |
11f43dfd | 2118 | \r |
2119 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
2120 | between the read result and the value specified by AndData, performs a\r | |
2121 | bitwise OR between the result of the AND operation and the value specified by\r | |
2122 | OrData, and writes the result to the 64-bit MMIO register specified by\r | |
2123 | Address. The value written to the MMIO register is returned. This function\r | |
2124 | must guarantee that all MMIO read and write operations are serialized.\r | |
2125 | \r | |
2126 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 2127 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 2128 | \r |
2129 | @param Address The MMIO register to write.\r | |
2130 | @param AndData The value to AND with the read value from the MMIO register.\r | |
2131 | @param OrData The value to OR with the result of the AND operation.\r | |
2132 | \r | |
2133 | @return The value written back to the MMIO register.\r | |
2134 | \r | |
2135 | **/\r | |
2136 | UINT64\r | |
2137 | EFIAPI\r | |
2138 | MmioAndThenOr64 (\r | |
2f88bd3a MK |
2139 | IN UINTN Address,\r |
2140 | IN UINT64 AndData,\r | |
2141 | IN UINT64 OrData\r | |
11f43dfd | 2142 | )\r |
2143 | {\r | |
2144 | return MmioWrite64 (Address, (MmioRead64 (Address) & AndData) | OrData);\r | |
2145 | }\r | |
2146 | \r | |
2147 | /**\r | |
2148 | Reads a bit field of a MMIO register.\r | |
2149 | \r | |
2150 | Reads the bit field in a 64-bit MMIO register. The bit field is specified by\r | |
2151 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
2152 | \r | |
2153 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 2154 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 2155 | If StartBit is greater than 63, then ASSERT().\r |
2156 | If EndBit is greater than 63, then ASSERT().\r | |
2157 | If EndBit is less than StartBit, then ASSERT().\r | |
2158 | \r | |
58380e9c | 2159 | @param Address The MMIO register to read.\r |
11f43dfd | 2160 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
2161 | Range 0..63.\r | |
2162 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2163 | Range 0..63.\r | |
2164 | \r | |
2165 | @return The value read.\r | |
2166 | \r | |
2167 | **/\r | |
2168 | UINT64\r | |
2169 | EFIAPI\r | |
2170 | MmioBitFieldRead64 (\r | |
2f88bd3a MK |
2171 | IN UINTN Address,\r |
2172 | IN UINTN StartBit,\r | |
2173 | IN UINTN EndBit\r | |
11f43dfd | 2174 | )\r |
2175 | {\r | |
2176 | return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit);\r | |
2177 | }\r | |
2178 | \r | |
2179 | /**\r | |
2180 | Writes a bit field to a MMIO register.\r | |
2181 | \r | |
2182 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
2183 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
2184 | MMIO register are preserved. The new value of the 64-bit register is returned.\r | |
2185 | \r | |
2186 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 2187 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 2188 | If StartBit is greater than 63, then ASSERT().\r |
2189 | If EndBit is greater than 63, then ASSERT().\r | |
2190 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2191 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 2192 | \r |
58380e9c | 2193 | @param Address The MMIO register to write.\r |
11f43dfd | 2194 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
2195 | Range 0..63.\r | |
2196 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2197 | Range 0..63.\r | |
2fc59a00 | 2198 | @param Value The new value of the bit field.\r |
11f43dfd | 2199 | \r |
2200 | @return The value written back to the MMIO register.\r | |
2201 | \r | |
2202 | **/\r | |
2203 | UINT64\r | |
2204 | EFIAPI\r | |
2205 | MmioBitFieldWrite64 (\r | |
2f88bd3a MK |
2206 | IN UINTN Address,\r |
2207 | IN UINTN StartBit,\r | |
2208 | IN UINTN EndBit,\r | |
2209 | IN UINT64 Value\r | |
11f43dfd | 2210 | )\r |
2211 | {\r | |
2212 | return MmioWrite64 (\r | |
2213 | Address,\r | |
2214 | BitFieldWrite64 (MmioRead64 (Address), StartBit, EndBit, Value)\r | |
2215 | );\r | |
2216 | }\r | |
2217 | \r | |
2218 | /**\r | |
2219 | Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and\r | |
2220 | writes the result back to the bit field in the 64-bit MMIO register.\r | |
2221 | \r | |
9095d37b | 2222 | Reads the 64-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 2223 | OR between the read result and the value specified by OrData, and\r |
11f43dfd | 2224 | writes the result to the 64-bit MMIO register specified by Address. The value\r |
2225 | written to the MMIO register is returned. This function must guarantee that\r | |
2226 | all MMIO read and write operations are serialized. Extra left bits in OrData\r | |
2227 | are stripped.\r | |
2228 | \r | |
2229 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 2230 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 2231 | If StartBit is greater than 63, then ASSERT().\r |
2232 | If EndBit is greater than 63, then ASSERT().\r | |
2233 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2234 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 2235 | \r |
2236 | @param Address MMIO register to write.\r | |
2237 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2238 | Range 0..63.\r | |
2239 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2240 | Range 0..63.\r | |
2241 | @param OrData The value to OR with read value from the MMIO register.\r | |
2242 | \r | |
2243 | @return The value written back to the MMIO register.\r | |
2244 | \r | |
2245 | **/\r | |
2246 | UINT64\r | |
2247 | EFIAPI\r | |
2248 | MmioBitFieldOr64 (\r | |
2f88bd3a MK |
2249 | IN UINTN Address,\r |
2250 | IN UINTN StartBit,\r | |
2251 | IN UINTN EndBit,\r | |
2252 | IN UINT64 OrData\r | |
11f43dfd | 2253 | )\r |
2254 | {\r | |
2255 | return MmioWrite64 (\r | |
2256 | Address,\r | |
2257 | BitFieldOr64 (MmioRead64 (Address), StartBit, EndBit, OrData)\r | |
2258 | );\r | |
2259 | }\r | |
2260 | \r | |
2261 | /**\r | |
2262 | Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and\r | |
2263 | writes the result back to the bit field in the 64-bit MMIO register.\r | |
2264 | \r | |
2265 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
2266 | between the read result and the value specified by AndData, and writes the\r | |
2267 | result to the 64-bit MMIO register specified by Address. The value written to\r | |
2268 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
2269 | read and write operations are serialized. Extra left bits in AndData are\r | |
2270 | stripped.\r | |
2271 | \r | |
2272 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 2273 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 2274 | If StartBit is greater than 63, then ASSERT().\r |
2275 | If EndBit is greater than 63, then ASSERT().\r | |
2276 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2277 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
11f43dfd | 2278 | \r |
2279 | @param Address MMIO register to write.\r | |
2280 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2281 | Range 0..63.\r | |
2282 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2283 | Range 0..63.\r | |
2284 | @param AndData The value to AND with read value from the MMIO register.\r | |
2285 | \r | |
2286 | @return The value written back to the MMIO register.\r | |
2287 | \r | |
2288 | **/\r | |
2289 | UINT64\r | |
2290 | EFIAPI\r | |
2291 | MmioBitFieldAnd64 (\r | |
2f88bd3a MK |
2292 | IN UINTN Address,\r |
2293 | IN UINTN StartBit,\r | |
2294 | IN UINTN EndBit,\r | |
2295 | IN UINT64 AndData\r | |
11f43dfd | 2296 | )\r |
2297 | {\r | |
2298 | return MmioWrite64 (\r | |
2299 | Address,\r | |
2300 | BitFieldAnd64 (MmioRead64 (Address), StartBit, EndBit, AndData)\r | |
2301 | );\r | |
2302 | }\r | |
2303 | \r | |
2304 | /**\r | |
2305 | Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 2306 | by a bitwise OR, and writes the result back to the bit field in the\r |
11f43dfd | 2307 | 64-bit MMIO register.\r |
2308 | \r | |
2309 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 2310 | followed by a bitwise OR between the read result and the value\r |
11f43dfd | 2311 | specified by AndData, and writes the result to the 64-bit MMIO register\r |
2312 | specified by Address. The value written to the MMIO register is returned.\r | |
2313 | This function must guarantee that all MMIO read and write operations are\r | |
2314 | serialized. Extra left bits in both AndData and OrData are stripped.\r | |
2315 | \r | |
2316 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
80f0c0c4 | 2317 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
11f43dfd | 2318 | If StartBit is greater than 63, then ASSERT().\r |
2319 | If EndBit is greater than 63, then ASSERT().\r | |
2320 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
2321 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
2322 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
11f43dfd | 2323 | \r |
58380e9c | 2324 | @param Address The MMIO register to write.\r |
11f43dfd | 2325 | @param StartBit The ordinal of the least significant bit in the bit field.\r |
2326 | Range 0..63.\r | |
2327 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2328 | Range 0..63.\r | |
2329 | @param AndData The value to AND with read value from the MMIO register.\r | |
2330 | @param OrData The value to OR with the result of the AND operation.\r | |
2331 | \r | |
2332 | @return The value written back to the MMIO register.\r | |
2333 | \r | |
2334 | **/\r | |
2335 | UINT64\r | |
2336 | EFIAPI\r | |
2337 | MmioBitFieldAndThenOr64 (\r | |
2f88bd3a MK |
2338 | IN UINTN Address,\r |
2339 | IN UINTN StartBit,\r | |
2340 | IN UINTN EndBit,\r | |
2341 | IN UINT64 AndData,\r | |
2342 | IN UINT64 OrData\r | |
11f43dfd | 2343 | )\r |
2344 | {\r | |
2345 | return MmioWrite64 (\r | |
2346 | Address,\r | |
2347 | BitFieldAndThenOr64 (MmioRead64 (Address), StartBit, EndBit, AndData, OrData)\r | |
2348 | );\r | |
2349 | }\r |