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