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