]>
Commit | Line | Data |
---|---|---|
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 | AREA IoLibMmio, CODE, READONLY\r | |
15 | \r | |
16 | EXPORT MmioRead8Internal\r | |
17 | EXPORT MmioWrite8Internal\r | |
18 | EXPORT MmioRead16Internal\r | |
19 | EXPORT MmioWrite16Internal\r | |
20 | EXPORT MmioRead32Internal\r | |
21 | EXPORT MmioWrite32Internal\r | |
22 | EXPORT MmioRead64Internal\r | |
23 | EXPORT MmioWrite64Internal\r | |
24 | \r | |
25 | ;\r | |
26 | ; Reads an 8-bit MMIO register.\r | |
27 | ;\r | |
28 | ; Reads the 8-bit MMIO register specified by Address. The 8-bit read value is\r | |
29 | ; returned. This function must guarantee that all MMIO read and write\r | |
30 | ; operations are serialized.\r | |
31 | ;\r | |
32 | ; @param Address The MMIO register to read.\r | |
33 | ;\r | |
34 | ; @return The value read.\r | |
35 | ;\r | |
36 | MmioRead8Internal\r | |
37 | ldrb w0, [x0]\r | |
38 | dmb ld\r | |
39 | ret\r | |
40 | \r | |
41 | ;\r | |
42 | ; Writes an 8-bit MMIO register.\r | |
43 | ;\r | |
44 | ; Writes the 8-bit MMIO register specified by Address with the value specified\r | |
45 | ; by Value and returns Value. This function must guarantee that all MMIO read\r | |
46 | ; and write operations are serialized.\r | |
47 | ;\r | |
48 | ; @param Address The MMIO register to write.\r | |
49 | ; @param Value The value to write to the MMIO register.\r | |
50 | ;\r | |
51 | MmioWrite8Internal\r | |
52 | dmb st\r | |
53 | strb w1, [x0]\r | |
54 | ret\r | |
55 | \r | |
56 | ;\r | |
57 | ; Reads a 16-bit MMIO register.\r | |
58 | ;\r | |
59 | ; Reads the 16-bit MMIO register specified by Address. The 16-bit read value is\r | |
60 | ; returned. This function must guarantee that all MMIO read and write\r | |
61 | ; operations are serialized.\r | |
62 | ;\r | |
63 | ; @param Address The MMIO register to read.\r | |
64 | ;\r | |
65 | ; @return The value read.\r | |
66 | ;\r | |
67 | MmioRead16Internal\r | |
68 | ldrh w0, [x0]\r | |
69 | dmb ld\r | |
70 | ret\r | |
71 | \r | |
72 | ;\r | |
73 | ; Writes a 16-bit MMIO register.\r | |
74 | ;\r | |
75 | ; Writes the 16-bit MMIO register specified by Address with the value specified\r | |
76 | ; by Value and returns Value. This function must guarantee that all MMIO read\r | |
77 | ; and write operations are serialized.\r | |
78 | ;\r | |
79 | ; @param Address The MMIO register to write.\r | |
80 | ; @param Value The value to write to the MMIO register.\r | |
81 | ;\r | |
82 | MmioWrite16Internal\r | |
83 | dmb st\r | |
84 | strh w1, [x0]\r | |
85 | ret\r | |
86 | \r | |
87 | ;\r | |
88 | ; Reads a 32-bit MMIO register.\r | |
89 | ;\r | |
90 | ; Reads the 32-bit MMIO register specified by Address. The 32-bit read value is\r | |
91 | ; returned. This function must guarantee that all MMIO read and write\r | |
92 | ; operations are serialized.\r | |
93 | ;\r | |
94 | ; @param Address The MMIO register to read.\r | |
95 | ;\r | |
96 | ; @return The value read.\r | |
97 | ;\r | |
98 | MmioRead32Internal\r | |
99 | ldr w0, [x0]\r | |
100 | dmb ld\r | |
101 | ret\r | |
102 | \r | |
103 | ;\r | |
104 | ; Writes a 32-bit MMIO register.\r | |
105 | ;\r | |
106 | ; Writes the 32-bit MMIO register specified by Address with the value specified\r | |
107 | ; by Value and returns Value. This function must guarantee that all MMIO read\r | |
108 | ; and write operations are serialized.\r | |
109 | ;\r | |
110 | ; @param Address The MMIO register to write.\r | |
111 | ; @param Value The value to write to the MMIO register.\r | |
112 | ;\r | |
113 | MmioWrite32Internal\r | |
114 | dmb st\r | |
115 | str w1, [x0]\r | |
116 | ret\r | |
117 | \r | |
118 | ;\r | |
119 | ; Reads a 64-bit MMIO register.\r | |
120 | ;\r | |
121 | ; Reads the 64-bit MMIO register specified by Address. The 64-bit read value is\r | |
122 | ; returned. This function must guarantee that all MMIO read and write\r | |
123 | ; operations are serialized.\r | |
124 | ;\r | |
125 | ; @param Address The MMIO register to read.\r | |
126 | ;\r | |
127 | ; @return The value read.\r | |
128 | ;\r | |
129 | MmioRead64Internal\r | |
130 | ldr x0, [x0]\r | |
131 | dmb ld\r | |
132 | ret\r | |
133 | \r | |
134 | ;\r | |
135 | ; Writes a 64-bit MMIO register.\r | |
136 | ;\r | |
137 | ; Writes the 64-bit MMIO register specified by Address with the value specified\r | |
138 | ; by Value and returns Value. This function must guarantee that all MMIO read\r | |
139 | ; and write operations are serialized.\r | |
140 | ;\r | |
141 | ; @param Address The MMIO register to write.\r | |
142 | ; @param Value The value to write to the MMIO register.\r | |
143 | ;\r | |
144 | MmioWrite64Internal\r | |
145 | dmb st\r | |
146 | str x1, [x0]\r | |
147 | ret\r | |
148 | \r | |
149 | END\r |