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