2 ISA ACPI Protocol Implementation
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
8 #include "PcatIsaAcpi.h"
11 // Platform specific data for the ISA devices that are present.in the platform
15 // COM 1 UART Controller
17 GLOBAL_REMOVE_IF_UNREFERENCED
18 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom1DeviceResources
[] = {
19 {EfiIsaAcpiResourceIo
, 0, 0x3f8, 0x3ff},
20 {EfiIsaAcpiResourceInterrupt
, 0, 4, 0},
21 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
25 // COM 2 UART Controller
27 GLOBAL_REMOVE_IF_UNREFERENCED
28 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom2DeviceResources
[] = {
29 {EfiIsaAcpiResourceIo
, 0, 0x2f8, 0x2ff},
30 {EfiIsaAcpiResourceInterrupt
, 0, 3, 0},
31 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
35 // PS/2 Keyboard Controller
37 GLOBAL_REMOVE_IF_UNREFERENCED
38 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2KeyboardDeviceResources
[] = {
39 {EfiIsaAcpiResourceIo
, 0, 0x60, 0x64},
40 {EfiIsaAcpiResourceInterrupt
, 0, 1, 0},
41 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
45 // PS/2 Mouse Controller
47 GLOBAL_REMOVE_IF_UNREFERENCED
48 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2MouseDeviceResources
[] = {
49 {EfiIsaAcpiResourceIo
, 0, 0x60, 0x64},
50 {EfiIsaAcpiResourceInterrupt
, 0, 12, 0},
51 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
55 // Floppy Disk Controller
57 GLOBAL_REMOVE_IF_UNREFERENCED
58 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiFloppyResources
[] = {
59 {EfiIsaAcpiResourceIo
, 0, 0x3f0, 0x3f7},
60 {EfiIsaAcpiResourceInterrupt
, 0, 6, 0},
61 {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},
62 {EfiIsaAcpiResourceEndOfList
, 0, 0, 0}
65 GLOBAL_REMOVE_IF_UNREFERENCED
66 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiCom1Device
= {
67 {EISA_PNP_ID(0x501), 0}, mPcatIsaAcpiCom1DeviceResources
68 }; // COM 1 UART Controller
70 GLOBAL_REMOVE_IF_UNREFERENCED
71 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiCom2Device
= {
72 {EISA_PNP_ID(0x501), 1}, mPcatIsaAcpiCom2DeviceResources
73 }; // COM 2 UART Controller
75 GLOBAL_REMOVE_IF_UNREFERENCED
76 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiPs2KeyboardDevice
= {
77 {EISA_PNP_ID(0x303), 0}, mPcatIsaAcpiPs2KeyboardDeviceResources
78 }; // PS/2 Keyboard Controller
80 GLOBAL_REMOVE_IF_UNREFERENCED
81 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiPs2MouseDevice
= {
82 {EISA_PNP_ID(0x303), 1}, mPcatIsaAcpiPs2MouseDeviceResources
83 }; // PS/2 Mouse Controller
85 GLOBAL_REMOVE_IF_UNREFERENCED
86 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiFloppyADevice
= {
87 {EISA_PNP_ID(0x604), 0}, mPcatIsaAcpiFloppyResources
88 }; // Floppy Disk Controller A:
90 GLOBAL_REMOVE_IF_UNREFERENCED
91 EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiFloppyBDevice
= {
92 {EISA_PNP_ID(0x604), 1}, mPcatIsaAcpiFloppyResources
93 }; // Floppy Disk Controller B:
96 // Table of ISA Controllers
98 EFI_ISA_ACPI_RESOURCE_LIST gPcatIsaAcpiDeviceList
[7] = {{{0, 0}, NULL
}};
101 Initialize gPcatIsaAcpiDeviceList.
104 InitializePcatIsaAcpiDeviceList (
111 if (PcdGetBool (PcdIsaAcpiCom1Enable
)) {
112 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiCom1Device
, sizeof(mPcatIsaAcpiCom1Device
));
115 if (PcdGetBool (PcdIsaAcpiCom2Enable
)) {
116 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiCom2Device
, sizeof(mPcatIsaAcpiCom2Device
));
119 if (PcdGetBool (PcdIsaAcpiPs2KeyboardEnable
)) {
120 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiPs2KeyboardDevice
, sizeof(mPcatIsaAcpiPs2KeyboardDevice
));
123 if (PcdGetBool (PcdIsaAcpiPs2MouseEnable
)) {
124 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiPs2MouseDevice
, sizeof(mPcatIsaAcpiPs2MouseDevice
));
127 if (PcdGetBool (PcdIsaAcpiFloppyAEnable
)) {
128 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiFloppyADevice
, sizeof(mPcatIsaAcpiFloppyADevice
));
131 if (PcdGetBool (PcdIsaAcpiFloppyBEnable
)) {
132 CopyMem (&gPcatIsaAcpiDeviceList
[Index
], &mPcatIsaAcpiFloppyBDevice
, sizeof(mPcatIsaAcpiFloppyBDevice
));
138 // ISA ACPI Protocol Functions
141 Enumerate the ISA devices on the ISA bus.
143 @param Device Point to device ID instance
144 @param IsaAcpiDevice On return, point to resource data for Isa device
145 @param NextIsaAcpiDevice On return, point to resource data for next Isa device
149 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
150 OUT EFI_ISA_ACPI_RESOURCE_LIST
**IsaAcpiDevice
,
151 OUT EFI_ISA_ACPI_RESOURCE_LIST
**NextIsaAcpiDevice
156 *IsaAcpiDevice
= NULL
;
157 if (NextIsaAcpiDevice
!= NULL
) {
158 *NextIsaAcpiDevice
= NULL
;
160 if (Device
== NULL
) {
163 for(Index
= 0; gPcatIsaAcpiDeviceList
[Index
].ResourceItem
!= NULL
; Index
++) {
164 if (Device
->HID
== gPcatIsaAcpiDeviceList
[Index
].Device
.HID
&&
165 Device
->UID
== gPcatIsaAcpiDeviceList
[Index
].Device
.UID
) {
169 if (gPcatIsaAcpiDeviceList
[Index
].ResourceItem
== NULL
) {
172 *IsaAcpiDevice
= &(gPcatIsaAcpiDeviceList
[Index
]);
175 if (gPcatIsaAcpiDeviceList
[Index
].ResourceItem
!= NULL
&& NextIsaAcpiDevice
!= NULL
) {
176 *NextIsaAcpiDevice
= &(gPcatIsaAcpiDeviceList
[Index
]);
181 Enumerate the ISA devices on the ISA bus
184 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
185 @param Device Point to device ID instance
187 @retval EFI_NOT_FOUND Can not found the next Isa device.
188 @retval EFI_SUCCESS Success retrieve the next Isa device for enumration.
194 IN EFI_ISA_ACPI_PROTOCOL
*This
,
195 OUT EFI_ISA_ACPI_DEVICE_ID
**Device
198 EFI_ISA_ACPI_RESOURCE_LIST
*IsaAcpiDevice
;
199 EFI_ISA_ACPI_RESOURCE_LIST
*NextIsaAcpiDevice
;
201 IsaDeviceLookup (*Device
, &IsaAcpiDevice
, &NextIsaAcpiDevice
);
202 if (NextIsaAcpiDevice
== NULL
) {
203 return EFI_NOT_FOUND
;
205 *Device
= &(NextIsaAcpiDevice
->Device
);
213 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
214 @param Device Point to device ID instance
215 @param OnOff TRUE for setting isa device power on,
216 FALSE for setting isa device power off
218 @return EFI_SUCCESS Success to change power status for isa device.
223 IN EFI_ISA_ACPI_PROTOCOL
*This
,
224 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
232 Get current resource for the specific ISA device.
234 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
235 @param Device Point to device ID instance
236 @param ResourceList On return, point to resources instances for given isa device
238 @retval EFI_NOT_FOUND Can not found the resource instance for given isa device
239 @retval EFI_SUCCESS Success to get resource instance for given isa device.
243 IsaGetCurrentResource (
244 IN EFI_ISA_ACPI_PROTOCOL
*This
,
245 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
246 OUT EFI_ISA_ACPI_RESOURCE_LIST
**ResourceList
249 IsaDeviceLookup (Device
, ResourceList
, NULL
);
250 if (*ResourceList
== NULL
) {
251 return EFI_NOT_FOUND
;
257 Get possible resource for the specific ISA device.
259 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
260 @param Device Point to device ID instance
261 @param ResourceList On return, point to resources instances for given isa device
263 @retval EFI_SUCCESS Success to get resource instance for given isa device.
267 IsaGetPossibleResource (
268 IN EFI_ISA_ACPI_PROTOCOL
*This
,
269 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
270 OUT EFI_ISA_ACPI_RESOURCE_LIST
**ResourceList
277 Set resource for the specific ISA device.
279 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
280 @param Device Point to device ID instance
281 @param ResourceList Point to resources instances for given isa device
283 @return EFI_SUCCESS Success to set resource.
289 IN EFI_ISA_ACPI_PROTOCOL
*This
,
290 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
291 IN EFI_ISA_ACPI_RESOURCE_LIST
*ResourceList
298 Enable/Disable the specific ISA device.
300 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
301 @param Device Point to device ID instance
302 @param Enable Enable/Disable
304 @return EFI_SUCCESS Success to enable/disable.
310 IN EFI_ISA_ACPI_PROTOCOL
*This
,
311 IN EFI_ISA_ACPI_DEVICE_ID
*Device
,
319 Initialize the specific ISA device.
321 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
322 @param Device Point to device ID instance
324 @return EFI_SUCCESS Success to initialize.
330 IN EFI_ISA_ACPI_PROTOCOL
*This
,
331 IN EFI_ISA_ACPI_DEVICE_ID
*Device
339 Initialize the ISA interface.
341 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
343 @return EFI_SUCCESS Success to initialize ISA interface.
349 IN EFI_ISA_ACPI_PROTOCOL
*This