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