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