]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseIoLibIntrinsic/AArch64/ArmVirtMmio.asm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseIoLibIntrinsic / AArch64 / ArmVirtMmio.asm
CommitLineData
9095d37b
LG
1;\r
2; Copyright (c) 2014-2018, Linaro Limited. All rights reserved.\r
3;\r
9344f092 4; SPDX-License-Identifier: BSD-2-Clause-Patent\r
9095d37b
LG
5;\r
6\r
7\r
8AREA IoLibMmio, CODE, READONLY\r
9\r
10EXPORT MmioRead8Internal\r
11EXPORT MmioWrite8Internal\r
12EXPORT MmioRead16Internal\r
13EXPORT MmioWrite16Internal\r
14EXPORT MmioRead32Internal\r
15EXPORT MmioWrite32Internal\r
16EXPORT MmioRead64Internal\r
17EXPORT MmioWrite64Internal\r
18\r
19;\r
20; Reads an 8-bit MMIO register.\r
21;\r
22; Reads the 8-bit MMIO register specified by Address. The 8-bit read value is\r
23; returned. This function must guarantee that all MMIO read and write\r
24; operations are serialized.\r
25;\r
26; @param Address The MMIO register to read.\r
27;\r
28; @return The value read.\r
29;\r
30MmioRead8Internal\r
31 ldrb w0, [x0]\r
32 dmb ld\r
33 ret\r
34\r
35;\r
36; Writes an 8-bit MMIO register.\r
37;\r
38; Writes the 8-bit MMIO register specified by Address with the value specified\r
39; by Value and returns Value. This function must guarantee that all MMIO read\r
40; and write operations are serialized.\r
41;\r
42; @param Address The MMIO register to write.\r
43; @param Value The value to write to the MMIO register.\r
44;\r
45MmioWrite8Internal\r
46 dmb st\r
47 strb w1, [x0]\r
48 ret\r
49\r
50;\r
51; Reads a 16-bit MMIO register.\r
52;\r
53; Reads the 16-bit MMIO register specified by Address. The 16-bit read value is\r
54; returned. This function must guarantee that all MMIO read and write\r
55; operations are serialized.\r
56;\r
57; @param Address The MMIO register to read.\r
58;\r
59; @return The value read.\r
60;\r
61MmioRead16Internal\r
62 ldrh w0, [x0]\r
63 dmb ld\r
64 ret\r
65\r
66;\r
67; Writes a 16-bit MMIO register.\r
68;\r
69; Writes the 16-bit MMIO register specified by Address with the value specified\r
70; by Value and returns Value. This function must guarantee that all MMIO read\r
71; and write operations are serialized.\r
72;\r
73; @param Address The MMIO register to write.\r
74; @param Value The value to write to the MMIO register.\r
75;\r
76MmioWrite16Internal\r
77 dmb st\r
78 strh w1, [x0]\r
79 ret\r
80\r
81;\r
82; Reads a 32-bit MMIO register.\r
83;\r
84; Reads the 32-bit MMIO register specified by Address. The 32-bit read value is\r
85; returned. This function must guarantee that all MMIO read and write\r
86; operations are serialized.\r
87;\r
88; @param Address The MMIO register to read.\r
89;\r
90; @return The value read.\r
91;\r
92MmioRead32Internal\r
93 ldr w0, [x0]\r
94 dmb ld\r
95 ret\r
96\r
97;\r
98; Writes a 32-bit MMIO register.\r
99;\r
100; Writes the 32-bit MMIO register specified by Address with the value specified\r
101; by Value and returns Value. This function must guarantee that all MMIO read\r
102; and write operations are serialized.\r
103;\r
104; @param Address The MMIO register to write.\r
105; @param Value The value to write to the MMIO register.\r
106;\r
107MmioWrite32Internal\r
108 dmb st\r
109 str w1, [x0]\r
110 ret\r
111\r
112;\r
113; Reads a 64-bit MMIO register.\r
114;\r
115; Reads the 64-bit MMIO register specified by Address. The 64-bit read value is\r
116; returned. This function must guarantee that all MMIO read and write\r
117; operations are serialized.\r
118;\r
119; @param Address The MMIO register to read.\r
120;\r
121; @return The value read.\r
122;\r
123MmioRead64Internal\r
124 ldr x0, [x0]\r
125 dmb ld\r
126 ret\r
127\r
128;\r
129; Writes a 64-bit MMIO register.\r
130;\r
131; Writes the 64-bit MMIO register specified by Address with the value specified\r
132; by Value and returns Value. This function must guarantee that all MMIO read\r
133; and write operations are serialized.\r
134;\r
135; @param Address The MMIO register to write.\r
136; @param Value The value to write to the MMIO register.\r
137;\r
138MmioWrite64Internal\r
139 dmb st\r
140 str x1, [x0]\r
141 ret\r
142\r
143 END\r