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