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