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