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