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