2 ISA ACPI Protocol Implementation
4 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 #include "PcatIsaAcpi.h"
17 // Platform specific data for the ISA devices that are present.in the platform
21 // COM 1 UART Controller
23 GLOBAL_REMOVE_IF_UNREFERENCED
24 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom1DeviceResources
[] = {
25 {EfiIsaAcpiResourceIo
, 0, 0x3f8, 0x3ff},
26 {EfiIsaAcpiResourceInterrupt
, 0, 4, 0},
27 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
31 // COM 2 UART Controller
33 GLOBAL_REMOVE_IF_UNREFERENCED
34 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom2DeviceResources
[] = {
35 {EfiIsaAcpiResourceIo
, 0, 0x2f8, 0x2ff},
36 {EfiIsaAcpiResourceInterrupt
, 0, 3, 0},
37 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
41 // PS/2 Keyboard Controller
43 GLOBAL_REMOVE_IF_UNREFERENCED
44 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2KeyboardDeviceResources
[] = {
45 {EfiIsaAcpiResourceIo
, 0, 0x60, 0x64},
46 {EfiIsaAcpiResourceInterrupt
, 0, 1, 0},
47 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
51 // PS/2 Mouse Controller
53 GLOBAL_REMOVE_IF_UNREFERENCED
54 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2MouseDeviceResources
[] = {
55 {EfiIsaAcpiResourceIo
, 0, 0x60, 0x64},
56 {EfiIsaAcpiResourceInterrupt
, 0, 12, 0},
57 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
61 // Floppy Disk Controller
63 GLOBAL_REMOVE_IF_UNREFERENCED
64 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiFloppyResources
[] = {
65 {EfiIsaAcpiResourceIo
, 0, 0x3f0, 0x3f7},
66 {EfiIsaAcpiResourceInterrupt
, 0, 6, 0},
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},
68 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
71 GLOBAL_REMOVE_IF_UNREFERENCED
72 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiCom1Device
= {
73 {EISA_PNP_ID(0x501), 0}, mPcatIsaAcpiCom1DeviceResources
74 }; // COM 1 UART Controller
76 GLOBAL_REMOVE_IF_UNREFERENCED
77 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiCom2Device
= {
78 {EISA_PNP_ID(0x501), 1}, mPcatIsaAcpiCom2DeviceResources
79 }; // COM 2 UART Controller
81 GLOBAL_REMOVE_IF_UNREFERENCED
82 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiPs2KeyboardDevice
= {
83 {EISA_PNP_ID(0x303), 0}, mPcatIsaAcpiPs2KeyboardDeviceResources
84 }; // PS/2 Keyboard Controller
86 GLOBAL_REMOVE_IF_UNREFERENCED
87 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiPs2MouseDevice
= {
88 {EISA_PNP_ID(0x303), 1}, mPcatIsaAcpiPs2MouseDeviceResources
89 }; // PS/2 Mouse Controller
91 GLOBAL_REMOVE_IF_UNREFERENCED
92 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiFloppyADevice
= {
93 {EISA_PNP_ID(0x604), 0}, mPcatIsaAcpiFloppyResources
94 }; // Floppy Disk Controller A:
96 GLOBAL_REMOVE_IF_UNREFERENCED
97 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiFloppyBDevice
= {
98 {EISA_PNP_ID(0x604), 1}, mPcatIsaAcpiFloppyResources
99 }; // Floppy Disk Controller B:
102 // Table of ISA Controllers
104 EFI_ISA_ACPI_RESOURCE_LIST gPcatIsaAcpiDeviceList
[7] = {{{0, 0}, NULL
}};
107 Initialize gPcatIsaAcpiDeviceList.
110 InitializePcatIsaAcpiDeviceList (
117 if (PcdGetBool (PcdIsaAcpiCom1Enable
)) {
118 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiCom1Device
, sizeof(mPcatIsaAcpiCom1Device
));
121 if (PcdGetBool (PcdIsaAcpiCom2Enable
)) {
122 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiCom2Device
, sizeof(mPcatIsaAcpiCom2Device
));
125 if (PcdGetBool (PcdIsaAcpiPs2KeyboardEnable
)) {
126 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiPs2KeyboardDevice
, sizeof(mPcatIsaAcpiPs2KeyboardDevice
));
129 if (PcdGetBool (PcdIsaAcpiPs2MouseEnable
)) {
130 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiPs2MouseDevice
, sizeof(mPcatIsaAcpiPs2MouseDevice
));
133 if (PcdGetBool (PcdIsaAcpiFloppyAEnable
)) {
134 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiFloppyADevice
, sizeof(mPcatIsaAcpiFloppyADevice
));
137 if (PcdGetBool (PcdIsaAcpiFloppyBEnable
)) {
138 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiFloppyBDevice
, sizeof(mPcatIsaAcpiFloppyBDevice
));
144 // ISA ACPI Protocol Functions
147 Enumerate the ISA devices on the ISA bus.
149 @param Device Point to device ID instance
150 @param IsaAcpiDevice On return, point to resource data for Isa device
151 @param NextIsaAcpiDevice On return, point to resource data for next Isa device
155 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
156 OUT EFI_ISA_ACPI_RESOURCE_LIST
**IsaAcpiDevice
,
157 OUT EFI_ISA_ACPI_RESOURCE_LIST
**NextIsaAcpiDevice
162 *IsaAcpiDevice
= NULL
;
163 if (NextIsaAcpiDevice
!= NULL
) {
164 *NextIsaAcpiDevice
= NULL
;
166 if (Device
== NULL
) {
169 for(Index
= 0; gPcatIsaAcpiDeviceList
[Index
].ResourceItem
!= NULL
; Index
++) {
170 if (Device
->HID
== gPcatIsaAcpiDeviceList
[Index
].Device
.HID
&&
171 Device
->UID
== gPcatIsaAcpiDeviceList
[Index
].Device
.UID
) {
175 if (gPcatIsaAcpiDeviceList
[Index
].ResourceItem
== NULL
) {
178 *IsaAcpiDevice
= &(gPcatIsaAcpiDeviceList
[Index
]);
181 if (gPcatIsaAcpiDeviceList
[Index
].ResourceItem
!= NULL
&& NextIsaAcpiDevice
!= NULL
) {
182 *NextIsaAcpiDevice
= &(gPcatIsaAcpiDeviceList
[Index
]);
187 Enumerate the ISA devices on the ISA bus
190 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
191 @param Device Point to device ID instance
193 @retval EFI_NOT_FOUND Can not found the next Isa device.
194 @retval EFI_SUCCESS Success retrieve the next Isa device for enumration.
200 IN EFI_ISA_ACPI_PROTOCOL
*This
,
201 OUT EFI_ISA_ACPI_DEVICE_ID
**Device
204 EFI_ISA_ACPI_RESOURCE_LIST
*IsaAcpiDevice
;
205 EFI_ISA_ACPI_RESOURCE_LIST
*NextIsaAcpiDevice
;
207 IsaDeviceLookup (*Device
, &IsaAcpiDevice
, &NextIsaAcpiDevice
);
208 if (NextIsaAcpiDevice
== NULL
) {
209 return EFI_NOT_FOUND
;
211 *Device
= &(NextIsaAcpiDevice
->Device
);
219 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
220 @param Device Point to device ID instance
221 @param OnOff TRUE for setting isa device power on,
222 FALSE for setting isa device power off
224 @return EFI_SUCCESS Success to change power status for isa device.
229 IN EFI_ISA_ACPI_PROTOCOL
*This
,
230 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
238 Get current resource for the specific ISA device.
240 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
241 @param Device Point to device ID instance
242 @param ResourceList On return, point to resources instances for given isa device
244 @retval EFI_NOT_FOUND Can not found the resource instance for given isa device
245 @retval EFI_SUCCESS Success to get resource instance for given isa device.
249 IsaGetCurrentResource (
250 IN EFI_ISA_ACPI_PROTOCOL
*This
,
251 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
252 OUT EFI_ISA_ACPI_RESOURCE_LIST
**ResourceList
255 IsaDeviceLookup (Device
, ResourceList
, NULL
);
256 if (*ResourceList
== NULL
) {
257 return EFI_NOT_FOUND
;
263 Get possible resource for the specific ISA device.
265 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
266 @param Device Point to device ID instance
267 @param ResourceList On return, point to resources instances for given isa device
269 @retval EFI_SUCCESS Success to get resource instance for given isa device.
273 IsaGetPossibleResource (
274 IN EFI_ISA_ACPI_PROTOCOL
*This
,
275 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
276 OUT EFI_ISA_ACPI_RESOURCE_LIST
**ResourceList
283 Set resource for the specific ISA device.
285 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
286 @param Device Point to device ID instance
287 @param ResourceList Point to resources instances for given isa device
289 @return EFI_SUCCESS Success to set resource.
295 IN EFI_ISA_ACPI_PROTOCOL
*This
,
296 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
297 IN EFI_ISA_ACPI_RESOURCE_LIST
*ResourceList
304 Enable/Disable the specific ISA device.
306 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
307 @param Device Point to device ID instance
308 @param Enable Enable/Disable
310 @return EFI_SUCCESS Success to enable/disable.
316 IN EFI_ISA_ACPI_PROTOCOL
*This
,
317 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
325 Initialize the specific ISA device.
327 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
328 @param Device Point to device ID instance
330 @return EFI_SUCCESS Success to initialize.
336 IN EFI_ISA_ACPI_PROTOCOL
*This
,
337 IN EFI_ISA_ACPI_DEVICE_ID
*Device
345 Initialize the ISA interface.
347 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
349 @return EFI_SUCCESS Success to initialize ISA interface.
355 IN EFI_ISA_ACPI_PROTOCOL
*This