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