]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.c
PcAtChipsetPkg: Fix typing errors
[mirror_edk2.git] / PcAtChipsetPkg / IsaAcpiDxe / IsaAcpi.c
... / ...
CommitLineData
1/** @file\r
2 ISA ACPI Protocol Implementation\r
3\r
4Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials \r
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12**/\r
13\r
14#include "PcatIsaAcpi.h"\r
15\r
16//\r
17// Platform specific data for the ISA devices that are present.in the platform\r
18//\r
19\r
20//\r
21// COM 1 UART Controller\r
22//\r
23GLOBAL_REMOVE_IF_UNREFERENCED\r
24EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom1DeviceResources[] = {\r
25 {EfiIsaAcpiResourceIo, 0, 0x3f8, 0x3ff},\r
26 {EfiIsaAcpiResourceInterrupt, 0, 4, 0},\r
27 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}\r
28};\r
29\r
30//\r
31// COM 2 UART Controller\r
32//\r
33GLOBAL_REMOVE_IF_UNREFERENCED\r
34EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom2DeviceResources[] = {\r
35 {EfiIsaAcpiResourceIo, 0, 0x2f8, 0x2ff},\r
36 {EfiIsaAcpiResourceInterrupt, 0, 3, 0},\r
37 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}\r
38};\r
39\r
40//\r
41// PS/2 Keyboard Controller\r
42//\r
43GLOBAL_REMOVE_IF_UNREFERENCED\r
44EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2KeyboardDeviceResources[] = {\r
45 {EfiIsaAcpiResourceIo, 0, 0x60, 0x64},\r
46 {EfiIsaAcpiResourceInterrupt, 0, 1, 0},\r
47 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}\r
48};\r
49\r
50//\r
51// PS/2 Mouse Controller\r
52//\r
53GLOBAL_REMOVE_IF_UNREFERENCED\r
54EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2MouseDeviceResources[] = {\r
55 {EfiIsaAcpiResourceIo, 0, 0x60, 0x64},\r
56 {EfiIsaAcpiResourceInterrupt, 0, 12, 0},\r
57 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}\r
58};\r
59\r
60//\r
61// Floppy Disk Controller\r
62//\r
63GLOBAL_REMOVE_IF_UNREFERENCED\r
64EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiFloppyResources[] = {\r
65 {EfiIsaAcpiResourceIo, 0, 0x3f0, 0x3f7},\r
66 {EfiIsaAcpiResourceInterrupt, 0, 6, 0},\r
67 {EfiIsaAcpiResourceDma, EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_COMPATIBLE | EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8 | EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE, 2, 0},\r
68 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}\r
69};\r
70\r
71GLOBAL_REMOVE_IF_UNREFERENCED\r
72EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiCom1Device = {\r
73 {EISA_PNP_ID(0x501), 0}, mPcatIsaAcpiCom1DeviceResources\r
74}; // COM 1 UART Controller\r
75\r
76GLOBAL_REMOVE_IF_UNREFERENCED\r
77EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiCom2Device = {\r
78 {EISA_PNP_ID(0x501), 1}, mPcatIsaAcpiCom2DeviceResources\r
79}; // COM 2 UART Controller\r
80\r
81GLOBAL_REMOVE_IF_UNREFERENCED\r
82EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiPs2KeyboardDevice = {\r
83 {EISA_PNP_ID(0x303), 0}, mPcatIsaAcpiPs2KeyboardDeviceResources\r
84}; // PS/2 Keyboard Controller\r
85\r
86GLOBAL_REMOVE_IF_UNREFERENCED\r
87EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiPs2MouseDevice = {\r
88 {EISA_PNP_ID(0x303), 1}, mPcatIsaAcpiPs2MouseDeviceResources\r
89}; // PS/2 Mouse Controller\r
90\r
91GLOBAL_REMOVE_IF_UNREFERENCED\r
92EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiFloppyADevice = {\r
93 {EISA_PNP_ID(0x604), 0}, mPcatIsaAcpiFloppyResources\r
94}; // Floppy Disk Controller A:\r
95\r
96GLOBAL_REMOVE_IF_UNREFERENCED\r
97EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiFloppyBDevice = {\r
98 {EISA_PNP_ID(0x604), 1}, mPcatIsaAcpiFloppyResources\r
99}; // Floppy Disk Controller B:\r
100\r
101//\r
102// Table of ISA Controllers\r
103//\r
104EFI_ISA_ACPI_RESOURCE_LIST gPcatIsaAcpiDeviceList[7] = {{{0, 0}, NULL}};\r
105\r
106/**\r
107 Initialize gPcatIsaAcpiDeviceList.\r
108**/\r
109VOID\r
110InitializePcatIsaAcpiDeviceList (\r
111 VOID\r
112 )\r
113{\r
114 UINTN Index;\r
115\r
116 Index = 0;\r
117 if (PcdGetBool (PcdIsaAcpiCom1Enable)) {\r
118 CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiCom1Device, sizeof(mPcatIsaAcpiCom1Device));\r
119 Index++;\r
120 }\r
121 if (PcdGetBool (PcdIsaAcpiCom2Enable)) {\r
122 CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiCom2Device, sizeof(mPcatIsaAcpiCom2Device));\r
123 Index++;\r
124 }\r
125 if (PcdGetBool (PcdIsaAcpiPs2KeyboardEnable)) {\r
126 CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiPs2KeyboardDevice, sizeof(mPcatIsaAcpiPs2KeyboardDevice));\r
127 Index++;\r
128 }\r
129 if (PcdGetBool (PcdIsaAcpiPs2MouseEnable)) {\r
130 CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiPs2MouseDevice, sizeof(mPcatIsaAcpiPs2MouseDevice));\r
131 Index++;\r
132 }\r
133 if (PcdGetBool (PcdIsaAcpiFloppyAEnable)) {\r
134 CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiFloppyADevice, sizeof(mPcatIsaAcpiFloppyADevice));\r
135 Index++;\r
136 }\r
137 if (PcdGetBool (PcdIsaAcpiFloppyBEnable)) {\r
138 CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiFloppyBDevice, sizeof(mPcatIsaAcpiFloppyBDevice));\r
139 Index++;\r
140 }\r
141}\r
142\r
143//\r
144// ISA ACPI Protocol Functions\r
145//\r
146/**\r
147 Enumerate the ISA devices on the ISA bus.\r
148\r
149 @param Device Point to device ID instance \r
150 @param IsaAcpiDevice On return, point to resource data for Isa device\r
151 @param NextIsaAcpiDevice On return, point to resource data for next Isa device\r
152**/\r
153VOID\r
154IsaDeviceLookup (\r
155 IN EFI_ISA_ACPI_DEVICE_ID *Device,\r
156 OUT EFI_ISA_ACPI_RESOURCE_LIST **IsaAcpiDevice,\r
157 OUT EFI_ISA_ACPI_RESOURCE_LIST **NextIsaAcpiDevice\r
158 )\r
159{\r
160 UINTN Index;\r
161\r
162 *IsaAcpiDevice = NULL;\r
163 if (NextIsaAcpiDevice != NULL) {\r
164 *NextIsaAcpiDevice = NULL;\r
165 }\r
166 if (Device == NULL) {\r
167 Index = 0;\r
168 } else {\r
169 for(Index = 0; gPcatIsaAcpiDeviceList[Index].ResourceItem != NULL; Index++) {\r
170 if (Device->HID == gPcatIsaAcpiDeviceList[Index].Device.HID && \r
171 Device->UID == gPcatIsaAcpiDeviceList[Index].Device.UID ) {\r
172 break;\r
173 }\r
174 }\r
175 if (gPcatIsaAcpiDeviceList[Index].ResourceItem == NULL) {\r
176 return;\r
177 }\r
178 *IsaAcpiDevice = &(gPcatIsaAcpiDeviceList[Index]);\r
179 Index++;\r
180 }\r
181 if (gPcatIsaAcpiDeviceList[Index].ResourceItem != NULL && NextIsaAcpiDevice != NULL) {\r
182 *NextIsaAcpiDevice = &(gPcatIsaAcpiDeviceList[Index]);\r
183 }\r
184}\r
185\r
186/**\r
187 Enumerate the ISA devices on the ISA bus\r
188\r
189\r
190 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL\r
191 @param Device Point to device ID instance \r
192\r
193 @retval EFI_NOT_FOUND Can not found the next Isa device.\r
194 @retval EFI_SUCCESS Success retrieve the next Isa device for enumration.\r
195\r
196**/\r
197EFI_STATUS\r
198EFIAPI\r
199IsaDeviceEnumerate (\r
200 IN EFI_ISA_ACPI_PROTOCOL *This,\r
201 OUT EFI_ISA_ACPI_DEVICE_ID **Device\r
202 )\r
203{\r
204 EFI_ISA_ACPI_RESOURCE_LIST *IsaAcpiDevice;\r
205 EFI_ISA_ACPI_RESOURCE_LIST *NextIsaAcpiDevice;\r
206\r
207 IsaDeviceLookup (*Device, &IsaAcpiDevice, &NextIsaAcpiDevice);\r
208 if (NextIsaAcpiDevice == NULL) {\r
209 return EFI_NOT_FOUND;\r
210 }\r
211 *Device = &(NextIsaAcpiDevice->Device);\r
212 return EFI_SUCCESS;\r
213}\r
214\r
215/**\r
216 Set ISA device power\r
217\r
218\r
219 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL\r
220 @param Device Point to device ID instance \r
221 @param OnOff TRUE for setting isa device power on,\r
222 FALSE for setting isa device power off\r
223\r
224 @return EFI_SUCCESS Success to change power status for isa device.\r
225**/\r
226EFI_STATUS\r
227EFIAPI\r
228IsaDeviceSetPower (\r
229 IN EFI_ISA_ACPI_PROTOCOL *This,\r
230 IN EFI_ISA_ACPI_DEVICE_ID *Device,\r
231 IN BOOLEAN OnOff\r
232 )\r
233{\r
234 return EFI_SUCCESS;\r
235} \r
236\r
237/**\r
238 Get current resource for the specific ISA device.\r
239\r
240 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL\r
241 @param Device Point to device ID instance \r
242 @param ResourceList On return, point to resources instances for given isa device\r
243\r
244 @retval EFI_NOT_FOUND Can not found the resource instance for given isa device\r
245 @retval EFI_SUCCESS Success to get resource instance for given isa device.\r
246**/\r
247EFI_STATUS\r
248EFIAPI\r
249IsaGetCurrentResource (\r
250 IN EFI_ISA_ACPI_PROTOCOL *This,\r
251 IN EFI_ISA_ACPI_DEVICE_ID *Device, \r
252 OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList\r
253 )\r
254{\r
255 IsaDeviceLookup (Device, ResourceList, NULL);\r
256 if (*ResourceList == NULL) {\r
257 return EFI_NOT_FOUND;\r
258 }\r
259 return EFI_SUCCESS;\r
260}\r
261\r
262/**\r
263 Get possible resource for the specific ISA device.\r
264 \r
265 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL\r
266 @param Device Point to device ID instance \r
267 @param ResourceList On return, point to resources instances for given isa device\r
268\r
269 @retval EFI_SUCCESS Success to get resource instance for given isa device.\r
270**/\r
271EFI_STATUS\r
272EFIAPI\r
273IsaGetPossibleResource (\r
274 IN EFI_ISA_ACPI_PROTOCOL *This,\r
275 IN EFI_ISA_ACPI_DEVICE_ID *Device, \r
276 OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList\r
277 )\r
278{\r
279 return EFI_SUCCESS;\r
280}\r
281\r
282/**\r
283 Set resource for the specific ISA device.\r
284\r
285 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL\r
286 @param Device Point to device ID instance \r
287 @param ResourceList Point to resources instances for given isa device\r
288\r
289 @return EFI_SUCCESS Success to set resource.\r
290\r
291**/\r
292EFI_STATUS\r
293EFIAPI\r
294IsaSetResource (\r
295 IN EFI_ISA_ACPI_PROTOCOL *This,\r
296 IN EFI_ISA_ACPI_DEVICE_ID *Device, \r
297 IN EFI_ISA_ACPI_RESOURCE_LIST *ResourceList\r
298 )\r
299{\r
300 return EFI_SUCCESS;\r
301}\r
302 \r
303/**\r
304 Enable/Disable the specific ISA device.\r
305\r
306 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL\r
307 @param Device Point to device ID instance \r
308 @param Enable Enable/Disable\r
309\r
310 @return EFI_SUCCESS Success to enable/disable.\r
311\r
312**/\r
313EFI_STATUS\r
314EFIAPI\r
315IsaEnableDevice (\r
316 IN EFI_ISA_ACPI_PROTOCOL *This,\r
317 IN EFI_ISA_ACPI_DEVICE_ID *Device,\r
318 IN BOOLEAN Enable\r
319 )\r
320{\r
321 return EFI_SUCCESS; \r
322}\r
323\r
324/**\r
325 Initialize the specific ISA device.\r
326\r
327 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL\r
328 @param Device Point to device ID instance \r
329\r
330 @return EFI_SUCCESS Success to initialize.\r
331\r
332**/\r
333EFI_STATUS\r
334EFIAPI\r
335IsaInitDevice (\r
336 IN EFI_ISA_ACPI_PROTOCOL *This,\r
337 IN EFI_ISA_ACPI_DEVICE_ID *Device\r
338 )\r
339{\r
340 return EFI_SUCCESS;\r
341}\r
342\r
343\r
344/**\r
345 Initialize the ISA interface.\r
346\r
347 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL\r
348\r
349 @return EFI_SUCCESS Success to initialize ISA interface.\r
350\r
351**/\r
352EFI_STATUS\r
353EFIAPI\r
354IsaInterfaceInit (\r
355 IN EFI_ISA_ACPI_PROTOCOL *This\r
356) \r
357{\r
358 return EFI_SUCCESS;\r
359} \r