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