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