]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.S
MdePkg: Clean up source files
[mirror_edk2.git] / MdePkg / Library / BaseIoLibIntrinsic / AArch64 / ArmVirtMmio.S
1 #
2 # Copyright (c) 2014-2018, Linaro Limited. All rights reserved.
3 #
4 # This program and the accompanying materials are licensed and made available
5 # under the terms and conditions of the BSD License which accompanies this
6 # distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php
8 #
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 #
12 #
13
14 .text
15 .align 3
16
17 GCC_ASM_EXPORT(MmioRead8Internal)
18 GCC_ASM_EXPORT(MmioWrite8Internal)
19 GCC_ASM_EXPORT(MmioRead16Internal)
20 GCC_ASM_EXPORT(MmioWrite16Internal)
21 GCC_ASM_EXPORT(MmioRead32Internal)
22 GCC_ASM_EXPORT(MmioWrite32Internal)
23 GCC_ASM_EXPORT(MmioRead64Internal)
24 GCC_ASM_EXPORT(MmioWrite64Internal)
25
26 //
27 // Reads an 8-bit MMIO register.
28 //
29 // Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
30 // returned. This function must guarantee that all MMIO read and write
31 // operations are serialized.
32 //
33 // @param Address The MMIO register to read.
34 //
35 // @return The value read.
36 //
37 ASM_PFX(MmioRead8Internal):
38 ldrb w0, [x0]
39 dmb ld
40 ret
41
42 //
43 // Writes an 8-bit MMIO register.
44 //
45 // Writes the 8-bit MMIO register specified by Address with the value specified
46 // by Value and returns Value. This function must guarantee that all MMIO read
47 // and write operations are serialized.
48 //
49 // @param Address The MMIO register to write.
50 // @param Value The value to write to the MMIO register.
51 //
52 ASM_PFX(MmioWrite8Internal):
53 dmb st
54 strb w1, [x0]
55 ret
56
57 //
58 // Reads a 16-bit MMIO register.
59 //
60 // Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
61 // returned. This function must guarantee that all MMIO read and write
62 // operations are serialized.
63 //
64 // @param Address The MMIO register to read.
65 //
66 // @return The value read.
67 //
68 ASM_PFX(MmioRead16Internal):
69 ldrh w0, [x0]
70 dmb ld
71 ret
72
73 //
74 // Writes a 16-bit MMIO register.
75 //
76 // Writes the 16-bit MMIO register specified by Address with the value specified
77 // by Value and returns Value. This function must guarantee that all MMIO read
78 // and write operations are serialized.
79 //
80 // @param Address The MMIO register to write.
81 // @param Value The value to write to the MMIO register.
82 //
83 ASM_PFX(MmioWrite16Internal):
84 dmb st
85 strh w1, [x0]
86 ret
87
88 //
89 // Reads a 32-bit MMIO register.
90 //
91 // Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
92 // returned. This function must guarantee that all MMIO read and write
93 // operations are serialized.
94 //
95 // @param Address The MMIO register to read.
96 //
97 // @return The value read.
98 //
99 ASM_PFX(MmioRead32Internal):
100 ldr w0, [x0]
101 dmb ld
102 ret
103
104 //
105 // Writes a 32-bit MMIO register.
106 //
107 // Writes the 32-bit MMIO register specified by Address with the value specified
108 // by Value and returns Value. This function must guarantee that all MMIO read
109 // and write operations are serialized.
110 //
111 // @param Address The MMIO register to write.
112 // @param Value The value to write to the MMIO register.
113 //
114 ASM_PFX(MmioWrite32Internal):
115 dmb st
116 str w1, [x0]
117 ret
118
119 //
120 // Reads a 64-bit MMIO register.
121 //
122 // Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
123 // returned. This function must guarantee that all MMIO read and write
124 // operations are serialized.
125 //
126 // @param Address The MMIO register to read.
127 //
128 // @return The value read.
129 //
130 ASM_PFX(MmioRead64Internal):
131 ldr x0, [x0]
132 dmb ld
133 ret
134
135 //
136 // Writes a 64-bit MMIO register.
137 //
138 // Writes the 64-bit MMIO register specified by Address with the value specified
139 // by Value and returns Value. This function must guarantee that all MMIO read
140 // and write operations are serialized.
141 //
142 // @param Address The MMIO register to write.
143 // @param Value The value to write to the MMIO register.
144 //
145 ASM_PFX(MmioWrite64Internal):
146 dmb st
147 str x1, [x0]
148 ret