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