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