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