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