VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c@ 80721

最後變更 在這個檔案從80721是 80721,由 vboxsync 提交於 6 年 前

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 13.3 KB
 
1/** @file
2 I/O Library for ARM.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
7
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10**/
11
12
13//
14// Include common header file for this module.
15//
16#include "BaseIoLibIntrinsicInternal.h"
17
18/**
19 Reads an 8-bit I/O port.
20
21 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
22 This function must guarantee that all I/O read and write operations are
23 serialized.
24
25 If 8-bit I/O port operations are not supported, then ASSERT().
26
27 @param Port The I/O port to read.
28
29 @return The value read.
30
31**/
32UINT8
33EFIAPI
34IoRead8 (
35 IN UINTN Port
36 )
37{
38 ASSERT (FALSE);
39 return 0;
40}
41
42/**
43 Writes an 8-bit I/O port.
44
45 Writes the 8-bit I/O port specified by Port with the value specified by Value
46 and returns Value. This function must guarantee that all I/O read and write
47 operations are serialized.
48
49 If 8-bit I/O port operations are not supported, then ASSERT().
50
51 @param Port The I/O port to write.
52 @param Value The value to write to the I/O port.
53
54 @return The value written the I/O port.
55
56**/
57UINT8
58EFIAPI
59IoWrite8 (
60 IN UINTN Port,
61 IN UINT8 Value
62 )
63{
64 ASSERT (FALSE);
65 return Value;
66}
67
68/**
69 Reads a 16-bit I/O port.
70
71 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
72 This function must guarantee that all I/O read and write operations are
73 serialized.
74
75 If 16-bit I/O port operations are not supported, then ASSERT().
76
77 @param Port The I/O port to read.
78
79 @return The value read.
80
81**/
82UINT16
83EFIAPI
84IoRead16 (
85 IN UINTN Port
86 )
87{
88 ASSERT (FALSE);
89 return 0;
90}
91
92/**
93 Writes a 16-bit I/O port.
94
95 Writes the 16-bit I/O port specified by Port with the value specified by Value
96 and returns Value. This function must guarantee that all I/O read and write
97 operations are serialized.
98
99 If 16-bit I/O port operations are not supported, then ASSERT().
100
101 @param Port The I/O port to write.
102 @param Value The value to write to the I/O port.
103
104 @return The value written the I/O port.
105
106**/
107UINT16
108EFIAPI
109IoWrite16 (
110 IN UINTN Port,
111 IN UINT16 Value
112 )
113{
114 ASSERT (FALSE);
115 return Value;
116}
117
118/**
119 Reads a 32-bit I/O port.
120
121 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
122 This function must guarantee that all I/O read and write operations are
123 serialized.
124
125 If 32-bit I/O port operations are not supported, then ASSERT().
126
127 @param Port The I/O port to read.
128
129 @return The value read.
130
131**/
132UINT32
133EFIAPI
134IoRead32 (
135 IN UINTN Port
136 )
137{
138 ASSERT (FALSE);
139 return 0;
140}
141
142/**
143 Writes a 32-bit I/O port.
144
145 Writes the 32-bit I/O port specified by Port with the value specified by Value
146 and returns Value. This function must guarantee that all I/O read and write
147 operations are serialized.
148
149 If 32-bit I/O port operations are not supported, then ASSERT().
150
151 @param Port The I/O port to write.
152 @param Value The value to write to the I/O port.
153
154 @return The value written the I/O port.
155
156**/
157UINT32
158EFIAPI
159IoWrite32 (
160 IN UINTN Port,
161 IN UINT32 Value
162 )
163{
164 ASSERT (FALSE);
165 return Value;
166}
167
168/**
169 Reads a 64-bit I/O port.
170
171 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
172 This function must guarantee that all I/O read and write operations are
173 serialized.
174
175 If 64-bit I/O port operations are not supported, then ASSERT().
176 If Port is not aligned on a 64-bit boundary, then ASSERT().
177
178 @param Port The I/O port to read.
179
180 @return The value read.
181
182**/
183UINT64
184EFIAPI
185IoRead64 (
186 IN UINTN Port
187 )
188{
189 ASSERT (FALSE);
190 return 0;
191}
192
193/**
194 Writes a 64-bit I/O port.
195
196 Writes the 64-bit I/O port specified by Port with the value specified by Value
197 and returns Value. This function must guarantee that all I/O read and write
198 operations are serialized.
199
200 If 64-bit I/O port operations are not supported, then ASSERT().
201 If Port is not aligned on a 64-bit boundary, then ASSERT().
202
203 @param Port The I/O port to write.
204 @param Value The value to write to the I/O port.
205
206 @return The value written to the I/O port.
207
208**/
209UINT64
210EFIAPI
211IoWrite64 (
212 IN UINTN Port,
213 IN UINT64 Value
214 )
215{
216 ASSERT (FALSE);
217 return 0;
218}
219
220/**
221 Reads an 8-bit I/O port fifo into a block of memory.
222
223 Reads the 8-bit I/O fifo port specified by Port.
224 The port is read Count times, and the read data is
225 stored in the provided Buffer.
226
227 This function must guarantee that all I/O read and write operations are
228 serialized.
229
230 If 8-bit I/O port operations are not supported, then ASSERT().
231
232 @param Port The I/O port to read.
233 @param Count The number of times to read I/O port.
234 @param Buffer The buffer to store the read data into.
235
236**/
237VOID
238EFIAPI
239IoReadFifo8 (
240 IN UINTN Port,
241 IN UINTN Count,
242 OUT VOID *Buffer
243 )
244{
245 ASSERT (FALSE);
246}
247
248/**
249 Writes a block of memory into an 8-bit I/O port fifo.
250
251 Writes the 8-bit I/O fifo port specified by Port.
252 The port is written Count times, and the write data is
253 retrieved from the provided Buffer.
254
255 This function must guarantee that all I/O write and write operations are
256 serialized.
257
258 If 8-bit I/O port operations are not supported, then ASSERT().
259
260 @param Port The I/O port to write.
261 @param Count The number of times to write I/O port.
262 @param Buffer The buffer to retrieve the write data from.
263
264**/
265VOID
266EFIAPI
267IoWriteFifo8 (
268 IN UINTN Port,
269 IN UINTN Count,
270 IN VOID *Buffer
271 )
272{
273 ASSERT (FALSE);
274}
275
276/**
277 Reads a 16-bit I/O port fifo into a block of memory.
278
279 Reads the 16-bit I/O fifo port specified by Port.
280 The port is read Count times, and the read data is
281 stored in the provided Buffer.
282
283 This function must guarantee that all I/O read and write operations are
284 serialized.
285
286 If 16-bit I/O port operations are not supported, then ASSERT().
287
288 @param Port The I/O port to read.
289 @param Count The number of times to read I/O port.
290 @param Buffer The buffer to store the read data into.
291
292**/
293VOID
294EFIAPI
295IoReadFifo16 (
296 IN UINTN Port,
297 IN UINTN Count,
298 OUT VOID *Buffer
299 )
300{
301 ASSERT (FALSE);
302}
303
304/**
305 Writes a block of memory into a 16-bit I/O port fifo.
306
307 Writes the 16-bit I/O fifo port specified by Port.
308 The port is written Count times, and the write data is
309 retrieved from the provided Buffer.
310
311 This function must guarantee that all I/O write and write operations are
312 serialized.
313
314 If 16-bit I/O port operations are not supported, then ASSERT().
315
316 @param Port The I/O port to write.
317 @param Count The number of times to write I/O port.
318 @param Buffer The buffer to retrieve the write data from.
319
320**/
321VOID
322EFIAPI
323IoWriteFifo16 (
324 IN UINTN Port,
325 IN UINTN Count,
326 IN VOID *Buffer
327 )
328{
329 ASSERT (FALSE);
330}
331
332/**
333 Reads a 32-bit I/O port fifo into a block of memory.
334
335 Reads the 32-bit I/O fifo port specified by Port.
336 The port is read Count times, and the read data is
337 stored in the provided Buffer.
338
339 This function must guarantee that all I/O read and write operations are
340 serialized.
341
342 If 32-bit I/O port operations are not supported, then ASSERT().
343
344 @param Port The I/O port to read.
345 @param Count The number of times to read I/O port.
346 @param Buffer The buffer to store the read data into.
347
348**/
349VOID
350EFIAPI
351IoReadFifo32 (
352 IN UINTN Port,
353 IN UINTN Count,
354 OUT VOID *Buffer
355 )
356{
357 ASSERT (FALSE);
358}
359
360/**
361 Writes a block of memory into a 32-bit I/O port fifo.
362
363 Writes the 32-bit I/O fifo port specified by Port.
364 The port is written Count times, and the write data is
365 retrieved from the provided Buffer.
366
367 This function must guarantee that all I/O write and write operations are
368 serialized.
369
370 If 32-bit I/O port operations are not supported, then ASSERT().
371
372 @param Port The I/O port to write.
373 @param Count The number of times to write I/O port.
374 @param Buffer The buffer to retrieve the write data from.
375
376**/
377VOID
378EFIAPI
379IoWriteFifo32 (
380 IN UINTN Port,
381 IN UINTN Count,
382 IN VOID *Buffer
383 )
384{
385 ASSERT (FALSE);
386}
387
388/**
389 Reads an 8-bit MMIO register.
390
391 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
392 returned. This function must guarantee that all MMIO read and write
393 operations are serialized.
394
395 If 8-bit MMIO register operations are not supported, then ASSERT().
396
397 @param Address The MMIO register to read.
398
399 @return The value read.
400
401**/
402UINT8
403EFIAPI
404MmioRead8 (
405 IN UINTN Address
406 )
407{
408 UINT8 Value;
409
410 Value = *(volatile UINT8*)Address;
411 return Value;
412}
413
414/**
415 Writes an 8-bit MMIO register.
416
417 Writes the 8-bit MMIO register specified by Address with the value specified
418 by Value and returns Value. This function must guarantee that all MMIO read
419 and write operations are serialized.
420
421 If 8-bit MMIO register operations are not supported, then ASSERT().
422
423 @param Address The MMIO register to write.
424 @param Value The value to write to the MMIO register.
425
426**/
427UINT8
428EFIAPI
429MmioWrite8 (
430 IN UINTN Address,
431 IN UINT8 Value
432 )
433{
434 *(volatile UINT8*)Address = Value;
435 return Value;
436}
437
438/**
439 Reads a 16-bit MMIO register.
440
441 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
442 returned. This function must guarantee that all MMIO read and write
443 operations are serialized.
444
445 If 16-bit MMIO register operations are not supported, then ASSERT().
446
447 @param Address The MMIO register to read.
448
449 @return The value read.
450
451**/
452UINT16
453EFIAPI
454MmioRead16 (
455 IN UINTN Address
456 )
457{
458 UINT16 Value;
459
460 ASSERT ((Address & 1) == 0);
461 Value = *(volatile UINT16*)Address;
462 return Value;
463}
464
465/**
466 Writes a 16-bit MMIO register.
467
468 Writes the 16-bit MMIO register specified by Address with the value specified
469 by Value and returns Value. This function must guarantee that all MMIO read
470 and write operations are serialized.
471
472 If 16-bit MMIO register operations are not supported, then ASSERT().
473
474 @param Address The MMIO register to write.
475 @param Value The value to write to the MMIO register.
476
477**/
478UINT16
479EFIAPI
480MmioWrite16 (
481 IN UINTN Address,
482 IN UINT16 Value
483 )
484{
485 ASSERT ((Address & 1) == 0);
486 *(volatile UINT16*)Address = Value;
487 return Value;
488}
489
490/**
491 Reads a 32-bit MMIO register.
492
493 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
494 returned. This function must guarantee that all MMIO read and write
495 operations are serialized.
496
497 If 32-bit MMIO register operations are not supported, then ASSERT().
498
499 @param Address The MMIO register to read.
500
501 @return The value read.
502
503**/
504UINT32
505EFIAPI
506MmioRead32 (
507 IN UINTN Address
508 )
509{
510 UINT32 Value;
511
512 ASSERT ((Address & 3) == 0);
513 Value = *(volatile UINT32*)Address;
514 return Value;
515}
516
517/**
518 Writes a 32-bit MMIO register.
519
520 Writes the 32-bit MMIO register specified by Address with the value specified
521 by Value and returns Value. This function must guarantee that all MMIO read
522 and write operations are serialized.
523
524 If 32-bit MMIO register operations are not supported, then ASSERT().
525
526 @param Address The MMIO register to write.
527 @param Value The value to write to the MMIO register.
528
529**/
530UINT32
531EFIAPI
532MmioWrite32 (
533 IN UINTN Address,
534 IN UINT32 Value
535 )
536{
537 ASSERT ((Address & 3) == 0);
538 *(volatile UINT32*)Address = Value;
539 return Value;
540}
541
542/**
543 Reads a 64-bit MMIO register.
544
545 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
546 returned. This function must guarantee that all MMIO read and write
547 operations are serialized.
548
549 If 64-bit MMIO register operations are not supported, then ASSERT().
550
551 @param Address The MMIO register to read.
552
553 @return The value read.
554
555**/
556UINT64
557EFIAPI
558MmioRead64 (
559 IN UINTN Address
560 )
561{
562 UINT64 Value;
563
564 ASSERT ((Address & 7) == 0);
565 Value = *(volatile UINT64*)Address;
566 return Value;
567}
568
569/**
570 Writes a 64-bit MMIO register.
571
572 Writes the 64-bit MMIO register specified by Address with the value specified
573 by Value and returns Value. This function must guarantee that all MMIO read
574 and write operations are serialized.
575
576 If 64-bit MMIO register operations are not supported, then ASSERT().
577
578 @param Address The MMIO register to write.
579 @param Value The value to write to the MMIO register.
580
581**/
582UINT64
583EFIAPI
584MmioWrite64 (
585 IN UINTN Address,
586 IN UINT64 Value
587 )
588{
589 ASSERT ((Address & 7) == 0);
590 *(volatile UINT64*)Address = Value;
591 return Value;
592}
593
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette