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