Correct data conversion from pointer to integer.
[mirror_edk2.git] / PcAtChipsetPkg / IsaAcpiDxe / IsaAcpi.c
CommitLineData
c69dd9df 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12\r
13Module Name:\r
14\r
15 IsaAcpi.c\r
16 \r
17Abstract: \r
18 \r
19 ISA ACPI Protocol Implementation\r
20\r
21Revision History\r
22\r
23--*/\r
24\r
25#include "PcatIsaAcpi.h"\r
26\r
27//\r
28// Platform specific data for the ISA devices that are present.in the platform\r
29//\r
30\r
31//\r
32// COM 1 UART Controller\r
33//\r
e56dd2ce 34EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom1DeviceResources[] = {\r
c69dd9df 35 {EfiIsaAcpiResourceIo, 0, 0x3f8, 0x3ff},\r
36 {EfiIsaAcpiResourceInterrupt, 0, 4, 0},\r
37 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}\r
38};\r
39\r
40//\r
41// COM 2 UART Controller\r
42//\r
e56dd2ce 43EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom2DeviceResources[] = {\r
c69dd9df 44 {EfiIsaAcpiResourceIo, 0, 0x2f8, 0x2ff},\r
45 {EfiIsaAcpiResourceInterrupt, 0, 3, 0},\r
46 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}\r
47};\r
48\r
49//\r
50// PS/2 Keyboard Controller\r
51//\r
e56dd2ce 52EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2KeyboardDeviceResources[] = {\r
c69dd9df 53 {EfiIsaAcpiResourceIo, 0, 0x60, 0x64},\r
54 {EfiIsaAcpiResourceInterrupt, 0, 1, 0},\r
55 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}\r
56};\r
57\r
58//\r
59// PS/2 Mouse Controller\r
60//\r
e56dd2ce 61EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2MouseDeviceResources[] = {\r
c69dd9df 62 {EfiIsaAcpiResourceIo, 0, 0x60, 0x64},\r
63 {EfiIsaAcpiResourceInterrupt, 0, 12, 0},\r
64 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}\r
65};\r
66\r
67//\r
68// Floppy Disk Controller\r
69//\r
e56dd2ce 70EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiFloppyResources[] = {\r
c69dd9df 71 {EfiIsaAcpiResourceIo, 0, 0x3f0, 0x3f7},\r
72 {EfiIsaAcpiResourceInterrupt, 0, 6, 0},\r
73 {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
74 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}\r
75};\r
76\r
77//\r
78// Table of ISA Controllers\r
79//\r
80EFI_ISA_ACPI_RESOURCE_LIST gPcatIsaAcpiDeviceList[] = {\r
81 {{EISA_PNP_ID(0x501), 0}, mPcatIsaAcpiCom1DeviceResources }, // COM 1 UART Controller\r
82 {{EISA_PNP_ID(0x501), 1}, mPcatIsaAcpiCom2DeviceResources }, // COM 2 UART Controller\r
83 {{EISA_PNP_ID(0x303), 0}, mPcatIsaAcpiPs2KeyboardDeviceResources }, // PS/2 Keyboard Controller\r
84 {{EISA_PNP_ID(0x303), 1}, mPcatIsaAcpiPs2MouseDeviceResources }, // PS/2 Mouse Controller\r
85 {{EISA_PNP_ID(0x604), 0}, mPcatIsaAcpiFloppyResources }, // Floppy Disk Controller A:\r
86 {{EISA_PNP_ID(0x604), 1}, mPcatIsaAcpiFloppyResources }, // Floppy Disk Controller B:\r
87 {{0, 0}, NULL } // End if ISA Controllers\r
88};\r
89\r
90//\r
91// ISA ACPI Protocol Functions\r
92//\r
93VOID\r
94IsaDeviceLookup (\r
95 IN EFI_ISA_ACPI_DEVICE_ID *Device,\r
96 OUT EFI_ISA_ACPI_RESOURCE_LIST **IsaAcpiDevice,\r
97 OUT EFI_ISA_ACPI_RESOURCE_LIST **NextIsaAcpiDevice\r
98 )\r
99/*++\r
100\r
101Routine Description:\r
102 Enumerate the ISA devices on the ISA bus\r
103\r
104Arguments:\r
105\r
106Returns:\r
107\r
108--*/\r
109{\r
110 UINTN Index;\r
111\r
112 *IsaAcpiDevice = NULL;\r
113 if (NextIsaAcpiDevice != NULL) {\r
114 *NextIsaAcpiDevice = NULL;\r
115 }\r
116 if (Device == NULL) {\r
117 Index = 0;\r
118 } else {\r
119 for(Index = 0; gPcatIsaAcpiDeviceList[Index].ResourceItem != NULL; Index++) {\r
120 if (Device->HID == gPcatIsaAcpiDeviceList[Index].Device.HID && \r
121 Device->UID == gPcatIsaAcpiDeviceList[Index].Device.UID ) {\r
122 break;\r
123 }\r
124 }\r
125 if (gPcatIsaAcpiDeviceList[Index].ResourceItem == NULL) {\r
126 return;\r
127 }\r
128 *IsaAcpiDevice = &(gPcatIsaAcpiDeviceList[Index]);\r
129 Index++;\r
130 }\r
131 if (gPcatIsaAcpiDeviceList[Index].ResourceItem != NULL && NextIsaAcpiDevice != NULL) {\r
132 *NextIsaAcpiDevice = &(gPcatIsaAcpiDeviceList[Index]);\r
133 }\r
134}\r
135\r
136EFI_STATUS\r
137EFIAPI\r
138IsaDeviceEnumerate (\r
139 IN EFI_ISA_ACPI_PROTOCOL *This,\r
140 OUT EFI_ISA_ACPI_DEVICE_ID **Device\r
141 )\r
142/*++\r
143\r
144Routine Description:\r
145 Enumerate the ISA devices on the ISA bus\r
146\r
147Arguments:\r
148\r
149Returns:\r
150\r
151--*/\r
152{\r
153 EFI_ISA_ACPI_RESOURCE_LIST *IsaAcpiDevice;\r
154 EFI_ISA_ACPI_RESOURCE_LIST *NextIsaAcpiDevice;\r
155\r
156 IsaDeviceLookup (*Device, &IsaAcpiDevice, &NextIsaAcpiDevice);\r
157 if (NextIsaAcpiDevice == NULL) {\r
158 return EFI_NOT_FOUND;\r
159 }\r
160 *Device = &(NextIsaAcpiDevice->Device);\r
161 return EFI_SUCCESS;\r
162}\r
163\r
164EFI_STATUS\r
165EFIAPI\r
166IsaDeviceSetPower (\r
167 IN EFI_ISA_ACPI_PROTOCOL *This,\r
168 IN EFI_ISA_ACPI_DEVICE_ID *Device,\r
169 IN BOOLEAN OnOff\r
170 )\r
171/*++\r
172\r
173Routine Description:\r
174 Set ISA device power \r
175\r
176Arguments:\r
177\r
178Returns:\r
179\r
180--*/\r
181{\r
182 return EFI_SUCCESS;\r
183} \r
184\r
185EFI_STATUS\r
186EFIAPI\r
187IsaGetCurrentResource (\r
188 IN EFI_ISA_ACPI_PROTOCOL *This,\r
189 IN EFI_ISA_ACPI_DEVICE_ID *Device, \r
190 OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList\r
191 )\r
192/*++\r
193\r
194Routine Description:\r
195 Get current Resource of the specific ISA device\r
196\r
197Arguments:\r
198\r
199Returns:\r
200\r
201--*/\r
202{\r
203 IsaDeviceLookup (Device, ResourceList, NULL);\r
204 if (*ResourceList == NULL) {\r
205 return EFI_NOT_FOUND;\r
206 }\r
207 return EFI_SUCCESS;\r
208}\r
209\r
210EFI_STATUS\r
211EFIAPI\r
212IsaGetPossibleResource (\r
213 IN EFI_ISA_ACPI_PROTOCOL *This,\r
214 IN EFI_ISA_ACPI_DEVICE_ID *Device, \r
215 OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList\r
216 )\r
217/*++\r
218\r
219Routine Description:\r
220\r
221Arguments:\r
222\r
223Returns:\r
224\r
225--*/ \r
226{\r
227 return EFI_SUCCESS;\r
228}\r
229\r
230EFI_STATUS\r
231EFIAPI\r
232IsaSetResource (\r
233 IN EFI_ISA_ACPI_PROTOCOL *This,\r
234 IN EFI_ISA_ACPI_DEVICE_ID *Device, \r
235 IN EFI_ISA_ACPI_RESOURCE_LIST *ResourceList\r
236 )\r
237/*++\r
238\r
239Routine Description:\r
240\r
241Arguments:\r
242\r
243Returns:\r
244\r
245--*/\r
246{\r
247 return EFI_SUCCESS;\r
248}\r
249 \r
250EFI_STATUS\r
251EFIAPI\r
252IsaEnableDevice (\r
253 IN EFI_ISA_ACPI_PROTOCOL *This,\r
254 IN EFI_ISA_ACPI_DEVICE_ID *Device,\r
255 IN BOOLEAN Enable\r
256 )\r
257/*++\r
258\r
259Routine Description:\r
260\r
261Arguments:\r
262\r
263Returns:\r
264\r
265--*/\r
266{\r
267 return EFI_SUCCESS; \r
268}\r
269\r
270EFI_STATUS\r
271EFIAPI\r
272IsaInitDevice (\r
273 IN EFI_ISA_ACPI_PROTOCOL *This,\r
274 IN EFI_ISA_ACPI_DEVICE_ID *Device\r
275 )\r
276/*++\r
277\r
278Routine Description:\r
279\r
280Arguments:\r
281\r
282Returns:\r
283\r
284--*/\r
285{\r
286 return EFI_SUCCESS;\r
287}\r
288\r
289\r
290EFI_STATUS\r
291EFIAPI\r
292IsaInterfaceInit (\r
293 IN EFI_ISA_ACPI_PROTOCOL *This\r
294) \r
295/*++\r
296\r
297Routine Description:\r
298\r
299Arguments:\r
300\r
301Returns:\r
302\r
303--*/\r
304{\r
305 return EFI_SUCCESS;\r
306} \r