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