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