2 ISA ACPI Protocol Implementation
4 Copyright (c) 2006 - 2010, 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 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom1DeviceResources
[] = {
24 {EfiIsaAcpiResourceIo
, 0, 0x3f8, 0x3ff},
25 {EfiIsaAcpiResourceInterrupt
, 0, 4, 0},
26 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
30 // COM 2 UART Controller
32 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom2DeviceResources
[] = {
33 {EfiIsaAcpiResourceIo
, 0, 0x2f8, 0x2ff},
34 {EfiIsaAcpiResourceInterrupt
, 0, 3, 0},
35 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
39 // PS/2 Keyboard Controller
41 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2KeyboardDeviceResources
[] = {
42 {EfiIsaAcpiResourceIo
, 0, 0x60, 0x64},
43 {EfiIsaAcpiResourceInterrupt
, 0, 1, 0},
44 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
48 // PS/2 Mouse Controller
50 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2MouseDeviceResources
[] = {
51 {EfiIsaAcpiResourceIo
, 0, 0x60, 0x64},
52 {EfiIsaAcpiResourceInterrupt
, 0, 12, 0},
53 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
57 // Floppy Disk Controller
59 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiFloppyResources
[] = {
60 {EfiIsaAcpiResourceIo
, 0, 0x3f0, 0x3f7},
61 {EfiIsaAcpiResourceInterrupt
, 0, 6, 0},
62 {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},
63 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
67 // Table of ISA Controllers
69 EFI_ISA_ACPI_RESOURCE_LIST gPcatIsaAcpiDeviceList
[] = {
70 {{EISA_PNP_ID(0x501), 0}, mPcatIsaAcpiCom1DeviceResources
}, // COM 1 UART Controller
71 {{EISA_PNP_ID(0x501), 1}, mPcatIsaAcpiCom2DeviceResources
}, // COM 2 UART Controller
72 {{EISA_PNP_ID(0x303), 0}, mPcatIsaAcpiPs2KeyboardDeviceResources
}, // PS/2 Keyboard Controller
73 {{EISA_PNP_ID(0x303), 1}, mPcatIsaAcpiPs2MouseDeviceResources
}, // PS/2 Mouse Controller
74 {{EISA_PNP_ID(0x604), 0}, mPcatIsaAcpiFloppyResources
}, // Floppy Disk Controller A:
75 {{EISA_PNP_ID(0x604), 1}, mPcatIsaAcpiFloppyResources
}, // Floppy Disk Controller B:
76 {{0, 0}, NULL
} // End if ISA Controllers
80 // ISA ACPI Protocol Functions
83 Enumerate the ISA devices on the ISA bus.
85 @param Device Point to device ID instance
86 @param IsaAcpiDevice On return, point to resource data for Isa device
87 @param NextIsaAcpiDevice On return, point to resource data for next Isa device
91 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
92 OUT EFI_ISA_ACPI_RESOURCE_LIST
**IsaAcpiDevice
,
93 OUT EFI_ISA_ACPI_RESOURCE_LIST
**NextIsaAcpiDevice
98 *IsaAcpiDevice
= NULL
;
99 if (NextIsaAcpiDevice
!= NULL
) {
100 *NextIsaAcpiDevice
= NULL
;
102 if (Device
== NULL
) {
105 for(Index
= 0; gPcatIsaAcpiDeviceList
[Index
].ResourceItem
!= NULL
; Index
++) {
106 if (Device
->HID
== gPcatIsaAcpiDeviceList
[Index
].Device
.HID
&&
107 Device
->UID
== gPcatIsaAcpiDeviceList
[Index
].Device
.UID
) {
111 if (gPcatIsaAcpiDeviceList
[Index
].ResourceItem
== NULL
) {
114 *IsaAcpiDevice
= &(gPcatIsaAcpiDeviceList
[Index
]);
117 if (gPcatIsaAcpiDeviceList
[Index
].ResourceItem
!= NULL
&& NextIsaAcpiDevice
!= NULL
) {
118 *NextIsaAcpiDevice
= &(gPcatIsaAcpiDeviceList
[Index
]);
123 Enumerate the ISA devices on the ISA bus
126 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
127 @param Device Point to device ID instance
129 @retval EFI_NOT_FOUND Can not found the next Isa device.
130 @retval EFI_SUCESS Success retrieve the next Isa device for enumration.
136 IN EFI_ISA_ACPI_PROTOCOL
*This
,
137 OUT EFI_ISA_ACPI_DEVICE_ID
**Device
140 EFI_ISA_ACPI_RESOURCE_LIST
*IsaAcpiDevice
;
141 EFI_ISA_ACPI_RESOURCE_LIST
*NextIsaAcpiDevice
;
143 IsaDeviceLookup (*Device
, &IsaAcpiDevice
, &NextIsaAcpiDevice
);
144 if (NextIsaAcpiDevice
== NULL
) {
145 return EFI_NOT_FOUND
;
147 *Device
= &(NextIsaAcpiDevice
->Device
);
155 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
156 @param Device Point to device ID instance
157 @param OnOff TRUE for setting isa device power on,
158 FALSE for setting isa device power off
160 @return EFI_SUCCESS Sucess to change power status for isa device.
165 IN EFI_ISA_ACPI_PROTOCOL
*This
,
166 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
174 Get current resource for the specific ISA device.
176 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
177 @param Device Point to device ID instance
178 @param ResourceList On return, point to resources instances for given isa device
180 @retval EFI_NOT_FOUND Can not found the resource instance for given isa device
181 @retval EFI_SUCCESS Success to get resource instance for given isa device.
185 IsaGetCurrentResource (
186 IN EFI_ISA_ACPI_PROTOCOL
*This
,
187 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
188 OUT EFI_ISA_ACPI_RESOURCE_LIST
**ResourceList
191 IsaDeviceLookup (Device
, ResourceList
, NULL
);
192 if (*ResourceList
== NULL
) {
193 return EFI_NOT_FOUND
;
199 Get possible resource for the specific ISA device.
201 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
202 @param Device Point to device ID instance
203 @param ResourceList On return, point to resources instances for given isa device
205 @retval EFI_SUCCESS Success to get resource instance for given isa device.
209 IsaGetPossibleResource (
210 IN EFI_ISA_ACPI_PROTOCOL
*This
,
211 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
212 OUT EFI_ISA_ACPI_RESOURCE_LIST
**ResourceList
219 Set resource for the specific ISA device.
221 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
222 @param Device Point to device ID instance
223 @param ResourceList Point to resources instances for given isa device
225 @return EFI_SUCESS Success to set resource.
231 IN EFI_ISA_ACPI_PROTOCOL
*This
,
232 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
233 IN EFI_ISA_ACPI_RESOURCE_LIST
*ResourceList
240 Enable/Disable the specific ISA device.
242 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
243 @param Device Point to device ID instance
244 @param Enable Enable/Disable
246 @return EFI_SUCESS Success to enable/disable.
252 IN EFI_ISA_ACPI_PROTOCOL
*This
,
253 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
261 Initialize the specific ISA device.
263 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
264 @param Device Point to device ID instance
266 @return EFI_SUCESS Success to initialize.
272 IN EFI_ISA_ACPI_PROTOCOL
*This
,
273 IN EFI_ISA_ACPI_DEVICE_ID
*Device
281 Initialize the ISA interface.
283 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
285 @return EFI_SUCESS Success to initialize ISA interface.
291 IN EFI_ISA_ACPI_PROTOCOL
*This