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