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