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