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