]>
Commit | Line | Data |
---|---|---|
ba9f8351 | 1 | /** @file\r |
2 | Internal include file of DXE CPU IO2 Library.\r | |
9095d37b LG |
3 | \r |
4 | Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
61e1deec LD |
5 | Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\r |
6 | \r | |
9344f092 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
ba9f8351 | 8 | \r |
9 | **/\r | |
10 | \r | |
11 | #ifndef _DXE_CPUIO2_LIB_INTERNAL_H_\r | |
12 | #define _DXE_CPUIO2_LIB_INTERNAL_H_\r | |
13 | \r | |
14 | #include <PiDxe.h>\r | |
15 | \r | |
16 | #include <Protocol/CpuIo2.h>\r | |
17 | \r | |
18 | #include <Library/IoLib.h>\r | |
19 | #include <Library/UefiBootServicesTableLib.h>\r | |
20 | #include <Library/DebugLib.h>\r | |
21 | #include <Library/BaseLib.h>\r | |
22 | \r | |
23 | \r | |
24 | /**\r | |
25 | Reads registers in the EFI CPU I/O space.\r | |
26 | \r | |
27 | Reads the I/O port specified by Port with registers width specified by Width.\r | |
61e1deec LD |
28 | The read value is returned.\r |
29 | \r | |
ba9f8351 | 30 | This function must guarantee that all I/O read and write operations are serialized.\r |
61e1deec | 31 | If such operations are not supported, then ASSERT().\r |
ba9f8351 | 32 | \r |
33 | @param Port The base address of the I/O operation.\r | |
34 | The caller is responsible for aligning the Address if required.\r | |
35 | @param Width The width of the I/O operation.\r | |
36 | \r | |
37 | @return Data read from registers in the EFI CPU I/O space.\r | |
38 | \r | |
39 | **/\r | |
40 | UINT64\r | |
41 | EFIAPI\r | |
42 | IoReadWorker (\r | |
61e1deec LD |
43 | IN UINTN Port,\r |
44 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width\r | |
ba9f8351 | 45 | );\r |
46 | \r | |
47 | /**\r | |
48 | Writes registers in the EFI CPU I/O space.\r | |
49 | \r | |
50 | Writes the I/O port specified by Port with registers width and value specified by Width\r | |
61e1deec LD |
51 | and Data respectively. Data is returned.\r |
52 | \r | |
ba9f8351 | 53 | This function must guarantee that all I/O read and write operations are serialized.\r |
61e1deec | 54 | If such operations are not supported, then ASSERT().\r |
ba9f8351 | 55 | \r |
56 | @param Port The base address of the I/O operation.\r | |
57 | The caller is responsible for aligning the Address if required.\r | |
58 | @param Width The width of the I/O operation.\r | |
59 | @param Data The value to write to the I/O port.\r | |
60 | \r | |
00b7cc0f | 61 | @return The parameter of Data.\r |
ba9f8351 | 62 | \r |
63 | **/\r | |
64 | UINT64\r | |
65 | EFIAPI\r | |
66 | IoWriteWorker (\r | |
61e1deec LD |
67 | IN UINTN Port,\r |
68 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
69 | IN UINT64 Data\r | |
70 | );\r | |
71 | \r | |
72 | /**\r | |
73 | Reads registers in the EFI CPU I/O space.\r | |
74 | \r | |
75 | Reads the I/O port specified by Port with registers width specified by Width.\r | |
76 | The port is read Count times, and the read data is stored in the provided Buffer.\r | |
77 | \r | |
78 | This function must guarantee that all I/O read and write operations are serialized.\r | |
79 | If such operations are not supported, then ASSERT().\r | |
80 | \r | |
81 | @param Port The base address of the I/O operation.\r | |
82 | The caller is responsible for aligning the Address if required.\r | |
83 | @param Width The width of the I/O operation.\r | |
84 | @param Count The number of times to read I/O port.\r | |
85 | @param Buffer The buffer to store the read data into.\r | |
86 | \r | |
87 | **/\r | |
88 | VOID\r | |
89 | EFIAPI\r | |
90 | IoReadFifoWorker (\r | |
91 | IN UINTN Port,\r | |
92 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
93 | IN UINTN Count,\r | |
94 | IN VOID *Buffer\r | |
95 | );\r | |
96 | \r | |
97 | /**\r | |
98 | Writes registers in the EFI CPU I/O space.\r | |
99 | \r | |
100 | Writes the I/O port specified by Port with registers width specified by Width.\r | |
101 | The port is written Count times, and the write data is retrieved from the provided Buffer.\r | |
102 | \r | |
103 | This function must guarantee that all I/O read and write operations are serialized.\r | |
104 | If such operations are not supported, then ASSERT().\r | |
105 | \r | |
106 | @param Port The base address of the I/O operation.\r | |
107 | The caller is responsible for aligning the Address if required.\r | |
108 | @param Width The width of the I/O operation.\r | |
109 | @param Count The number of times to write I/O port.\r | |
110 | @param Buffer The buffer to store the read data into.\r | |
111 | \r | |
112 | **/\r | |
113 | VOID\r | |
114 | EFIAPI\r | |
115 | IoWriteFifoWorker (\r | |
116 | IN UINTN Port,\r | |
117 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
118 | IN UINTN Count,\r | |
119 | IN VOID *Buffer\r | |
ba9f8351 | 120 | );\r |
121 | \r | |
122 | /**\r | |
123 | Reads memory-mapped registers in the EFI system memory space.\r | |
124 | \r | |
125 | Reads the MMIO registers specified by Address with registers width specified by Width.\r | |
126 | The read value is returned. If such operations are not supported, then ASSERT().\r | |
127 | This function must guarantee that all MMIO read and write operations are serialized.\r | |
128 | \r | |
129 | @param Address The MMIO register to read.\r | |
130 | The caller is responsible for aligning the Address if required.\r | |
131 | @param Width The width of the I/O operation.\r | |
132 | \r | |
133 | @return Data read from registers in the EFI system memory space.\r | |
134 | \r | |
135 | **/\r | |
136 | UINT64\r | |
137 | EFIAPI\r | |
138 | MmioReadWorker (\r | |
139 | IN UINTN Address,\r | |
140 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width\r | |
141 | );\r | |
142 | \r | |
143 | /**\r | |
144 | Writes memory-mapped registers in the EFI system memory space.\r | |
145 | \r | |
146 | Writes the MMIO registers specified by Address with registers width and value specified by Width\r | |
147 | and Data respectively. Data is returned. If such operations are not supported, then ASSERT().\r | |
148 | This function must guarantee that all MMIO read and write operations are serialized.\r | |
149 | \r | |
150 | @param Address The MMIO register to read.\r | |
151 | The caller is responsible for aligning the Address if required.\r | |
152 | @param Width The width of the I/O operation.\r | |
153 | @param Data The value to write to the I/O port.\r | |
9095d37b | 154 | \r |
ba9f8351 | 155 | @return Data read from registers in the EFI system memory space.\r |
156 | \r | |
157 | **/\r | |
158 | UINT64\r | |
159 | EFIAPI\r | |
160 | MmioWriteWorker (\r | |
161 | IN UINTN Address,\r | |
162 | IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r | |
163 | IN UINT64 Data\r | |
164 | );\r | |
165 | \r | |
166 | #endif\r |