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