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