]> git.proxmox.com Git - mirror_edk2.git/blob - PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.c
Refine the file/function comments to follow doxygen format
[mirror_edk2.git] / PcAtChipsetPkg / IsaAcpiDxe / IsaAcpi.c
1 /** @file
2 ISA ACPI Protocol Implementation
3
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
9
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.
12 **/
13
14 #include "PcatIsaAcpi.h"
15
16 //
17 // Platform specific data for the ISA devices that are present.in the platform
18 //
19
20 //
21 // COM 1 UART Controller
22 //
23 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom1DeviceResources[] = {
24 {EfiIsaAcpiResourceIo, 0, 0x3f8, 0x3ff},
25 {EfiIsaAcpiResourceInterrupt, 0, 4, 0},
26 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}
27 };
28
29 //
30 // COM 2 UART Controller
31 //
32 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom2DeviceResources[] = {
33 {EfiIsaAcpiResourceIo, 0, 0x2f8, 0x2ff},
34 {EfiIsaAcpiResourceInterrupt, 0, 3, 0},
35 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}
36 };
37
38 //
39 // PS/2 Keyboard Controller
40 //
41 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2KeyboardDeviceResources[] = {
42 {EfiIsaAcpiResourceIo, 0, 0x60, 0x64},
43 {EfiIsaAcpiResourceInterrupt, 0, 1, 0},
44 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}
45 };
46
47 //
48 // PS/2 Mouse Controller
49 //
50 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiPs2MouseDeviceResources[] = {
51 {EfiIsaAcpiResourceIo, 0, 0x60, 0x64},
52 {EfiIsaAcpiResourceInterrupt, 0, 12, 0},
53 {EfiIsaAcpiResourceEndOfList, 0, 0, 0}
54 };
55
56 //
57 // Floppy Disk Controller
58 //
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}
64 };
65
66 //
67 // Table of ISA Controllers
68 //
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
77 };
78
79 //
80 // ISA ACPI Protocol Functions
81 //
82 /**
83 Enumerate the ISA devices on the ISA bus.
84
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
88 **/
89 VOID
90 IsaDeviceLookup (
91 IN EFI_ISA_ACPI_DEVICE_ID *Device,
92 OUT EFI_ISA_ACPI_RESOURCE_LIST **IsaAcpiDevice,
93 OUT EFI_ISA_ACPI_RESOURCE_LIST **NextIsaAcpiDevice
94 )
95 {
96 UINTN Index;
97
98 *IsaAcpiDevice = NULL;
99 if (NextIsaAcpiDevice != NULL) {
100 *NextIsaAcpiDevice = NULL;
101 }
102 if (Device == NULL) {
103 Index = 0;
104 } else {
105 for(Index = 0; gPcatIsaAcpiDeviceList[Index].ResourceItem != NULL; Index++) {
106 if (Device->HID == gPcatIsaAcpiDeviceList[Index].Device.HID &&
107 Device->UID == gPcatIsaAcpiDeviceList[Index].Device.UID ) {
108 break;
109 }
110 }
111 if (gPcatIsaAcpiDeviceList[Index].ResourceItem == NULL) {
112 return;
113 }
114 *IsaAcpiDevice = &(gPcatIsaAcpiDeviceList[Index]);
115 Index++;
116 }
117 if (gPcatIsaAcpiDeviceList[Index].ResourceItem != NULL && NextIsaAcpiDevice != NULL) {
118 *NextIsaAcpiDevice = &(gPcatIsaAcpiDeviceList[Index]);
119 }
120 }
121
122 /**
123 Enumerate the ISA devices on the ISA bus
124
125
126 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
127 @param Device Point to device ID instance
128
129 @retval EFI_NOT_FOUND Can not found the next Isa device.
130 @retval EFI_SUCESS Success retrieve the next Isa device for enumration.
131
132 **/
133 EFI_STATUS
134 EFIAPI
135 IsaDeviceEnumerate (
136 IN EFI_ISA_ACPI_PROTOCOL *This,
137 OUT EFI_ISA_ACPI_DEVICE_ID **Device
138 )
139 {
140 EFI_ISA_ACPI_RESOURCE_LIST *IsaAcpiDevice;
141 EFI_ISA_ACPI_RESOURCE_LIST *NextIsaAcpiDevice;
142
143 IsaDeviceLookup (*Device, &IsaAcpiDevice, &NextIsaAcpiDevice);
144 if (NextIsaAcpiDevice == NULL) {
145 return EFI_NOT_FOUND;
146 }
147 *Device = &(NextIsaAcpiDevice->Device);
148 return EFI_SUCCESS;
149 }
150
151 /**
152 Set ISA device power
153
154
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
159
160 @return EFI_SUCCESS Sucess to change power status for isa device.
161 **/
162 EFI_STATUS
163 EFIAPI
164 IsaDeviceSetPower (
165 IN EFI_ISA_ACPI_PROTOCOL *This,
166 IN EFI_ISA_ACPI_DEVICE_ID *Device,
167 IN BOOLEAN OnOff
168 )
169 {
170 return EFI_SUCCESS;
171 }
172
173 /**
174 Get current resource for the specific ISA device.
175
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
179
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.
182 **/
183 EFI_STATUS
184 EFIAPI
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
189 )
190 {
191 IsaDeviceLookup (Device, ResourceList, NULL);
192 if (*ResourceList == NULL) {
193 return EFI_NOT_FOUND;
194 }
195 return EFI_SUCCESS;
196 }
197
198 /**
199 Get possible resource for the specific ISA device.
200
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
204
205 @retval EFI_SUCCESS Success to get resource instance for given isa device.
206 **/
207 EFI_STATUS
208 EFIAPI
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
213 )
214 {
215 return EFI_SUCCESS;
216 }
217
218 /**
219 Set resource for the specific ISA device.
220
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
224
225 @return EFI_SUCESS Success to set resource.
226
227 **/
228 EFI_STATUS
229 EFIAPI
230 IsaSetResource (
231 IN EFI_ISA_ACPI_PROTOCOL *This,
232 IN EFI_ISA_ACPI_DEVICE_ID *Device,
233 IN EFI_ISA_ACPI_RESOURCE_LIST *ResourceList
234 )
235 {
236 return EFI_SUCCESS;
237 }
238
239 /**
240 Enable/Disable the specific ISA device.
241
242 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
243 @param Device Point to device ID instance
244 @param Enable Enable/Disable
245
246 @return EFI_SUCESS Success to enable/disable.
247
248 **/
249 EFI_STATUS
250 EFIAPI
251 IsaEnableDevice (
252 IN EFI_ISA_ACPI_PROTOCOL *This,
253 IN EFI_ISA_ACPI_DEVICE_ID *Device,
254 IN BOOLEAN Enable
255 )
256 {
257 return EFI_SUCCESS;
258 }
259
260 /**
261 Initialize the specific ISA device.
262
263 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
264 @param Device Point to device ID instance
265
266 @return EFI_SUCESS Success to initialize.
267
268 **/
269 EFI_STATUS
270 EFIAPI
271 IsaInitDevice (
272 IN EFI_ISA_ACPI_PROTOCOL *This,
273 IN EFI_ISA_ACPI_DEVICE_ID *Device
274 )
275 {
276 return EFI_SUCCESS;
277 }
278
279
280 /**
281 Initialize the ISA interface.
282
283 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
284
285 @return EFI_SUCESS Success to initialize ISA interface.
286
287 **/
288 EFI_STATUS
289 EFIAPI
290 IsaInterfaceInit (
291 IN EFI_ISA_ACPI_PROTOCOL *This
292 )
293 {
294 return EFI_SUCCESS;
295 }