]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Legacy8259.h
Update the Guid Value of Ext SCSI Pass Thru Protocol
[mirror_edk2.git] / MdePkg / Include / Protocol / Legacy8259.h
CommitLineData
878ddf1f 1/** @file\r
2 This protocol abstracts the 8259 interrupt controller. This includes\r
3 PCI IRQ routing need to program the PCI Interrupt Line register.\r
4\r
5 Copyright (c) 2006, Intel Corporation \r
6 All rights reserved. This program and the accompanying materials \r
7 are licensed and made available under the terms and conditions of the BSD License \r
8 which accompanies this distribution. The full text of the license may be found at \r
9 http://opensource.org/licenses/bsd-license.php \r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
13\r
14 Module Name: Legacy8259.h\r
15\r
16 @par Revision Reference:\r
17 This protocol is defined in Framework for EFI Compatibility Support Module spec\r
18 Version 0.96\r
19\r
20**/\r
21\r
22#ifndef _EFI_LEGACY_8259_H\r
23#define _EFI_LEGACY_8259_H\r
24\r
25#define EFI_LEGACY_8259_PROTOCOL_GUID \\r
26 { \\r
27 0x38321dba, 0x4fe0, 0x4e17, {0x8a, 0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1 } \\r
28 }\r
29\r
30typedef struct _EFI_LEGACY_8259_PROTOCOL EFI_LEGACY_8259_PROTOCOL;\r
31\r
32typedef enum {\r
33 Efi8259Irq0,\r
34 Efi8259Irq1,\r
35 Efi8259Irq2,\r
36 Efi8259Irq3,\r
37 Efi8259Irq4,\r
38 Efi8259Irq5,\r
39 Efi8259Irq6,\r
40 Efi8259Irq7,\r
41 Efi8259Irq8,\r
42 Efi8259Irq9,\r
43 Efi8259Irq10,\r
44 Efi8259Irq11,\r
45 Efi8259Irq12,\r
46 Efi8259Irq13,\r
47 Efi8259Irq14,\r
48 Efi8259Irq15,\r
49 Efi8259IrqMax\r
50} EFI_8259_IRQ;\r
51\r
52typedef enum {\r
53 Efi8259LegacyMode,\r
54 Efi8259ProtectedMode,\r
55 Efi8259MaxMode\r
56} EFI_8259_MODE;\r
57\r
58/**\r
59 Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for\r
60 the legacy mode mask and the protected mode mask. The base address for the 8259\r
61 is different for legacy and protected mode, so two masks are required.\r
62\r
0647c9ad
LG
63 @param This Protocol instance pointer.\r
64 @param MasterBase The base vector for the Master PIC in the 8259 controller\r
65 @param Slavebase The base vector for the Master PIC in the 8259 controller\r
878ddf1f 66\r
0647c9ad
LG
67 @retval EFI_SUCCESS The new bases were programmed\r
68 @retval EFI_DEVICE_ERROR A device erro occured programming the vector bases\r
878ddf1f 69\r
70**/\r
71typedef\r
72EFI_STATUS\r
73(EFIAPI *EFI_LEGACY_8259_SET_VECTOR_BASE) (\r
74 IN EFI_LEGACY_8259_PROTOCOL *This,\r
75 IN UINT8 MasterBase,\r
76 IN UINT8 SlaveBase\r
77 )\r
78;\r
79\r
80/**\r
81 Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for\r
82 the legacy mode mask and the protected mode mask. The base address for the 8259\r
83 is different for legacy and protected mode, so two masks are required.\r
84\r
0647c9ad
LG
85 @param This Protocol instance pointer.\r
86 @param LegacyMask Bit 0 is Irq0 - Bit 15 is Irq15\r
87 @param LegacyEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15\r
88 @param ProtectedMask Bit 0 is Irq0 - Bit 15 is Irq15\r
89 @param ProtectedEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15\r
878ddf1f 90\r
0647c9ad
LG
91 @retval EFI_SUCCESS 8259 status returned\r
92 @retval EFI_DEVICE_ERROR Error reading 8259\r
878ddf1f 93\r
94**/\r
95typedef\r
96EFI_STATUS\r
97(EFIAPI *EFI_LEGACY_8259_GET_MASK) (\r
98 IN EFI_LEGACY_8259_PROTOCOL *This,\r
99 OUT UINT16 *LegacyMask, OPTIONAL\r
100 OUT UINT16 *LegacyEdgeLevel, OPTIONAL\r
101 OUT UINT16 *ProtectedMask, OPTIONAL\r
102 OUT UINT16 *ProtectedEdgeLevel OPTIONAL\r
103 )\r
104;\r
105\r
106/**\r
107 Set the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for\r
108 the legacy mode mask and the protected mode mask. The base address for the 8259\r
109 is different for legacy and protected mode, so two masks are required.\r
110 Also set the edge/level masks.\r
111\r
0647c9ad
LG
112 @param This Protocol instance pointer.\r
113 @param LegacyMask Bit 0 is Irq0 - Bit 15 is Irq15\r
114 @param LegacyEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15\r
115 @param ProtectedMask Bit 0 is Irq0 - Bit 15 is Irq15\r
116 @param ProtectedEdgeLevel Bit 0 is Irq0 - Bit 15 is Irq15\r
878ddf1f 117\r
0647c9ad
LG
118 @retval EFI_SUCCESS 8259 status returned\r
119 @retval EFI_DEVICE_ERROR Error reading 8259\r
878ddf1f 120\r
121**/\r
122typedef\r
123EFI_STATUS\r
124(EFIAPI *EFI_LEGACY_8259_SET_MASK) (\r
125 IN EFI_LEGACY_8259_PROTOCOL *This,\r
126 IN UINT16 *LegacyMask, OPTIONAL\r
127 IN UINT16 *LegacyEdgeLevel, OPTIONAL\r
128 IN UINT16 *ProtectedMask, OPTIONAL\r
129 IN UINT16 *ProtectedEdgeLevel OPTIONAL\r
130 )\r
131;\r
132\r
133/**\r
134 Set the 8259 mode of operation. The base address for the 8259 is different for\r
135 legacy and protected mode. The legacy mode requires the master 8259 to have a\r
136 master base of 0x08 and the slave base of 0x70. The protected mode base locations\r
137 are not defined. Interrupts must be masked by the caller before this function\r
138 is called. The interrupt mask from the current mode is saved. The interrupt \r
139 mask for the new mode is Mask, or if Mask does not exist the previously saved\r
140 mask is used.\r
141\r
0647c9ad
LG
142 @param This Protocol instance pointer.\r
143 @param Mode Mode of operation. i.e. real mode or protected mode\r
144 @param Mask Optional interupt mask for the new mode.\r
145 @param EdgeLevel Optional trigger mask for the new mode.\r
878ddf1f 146\r
0647c9ad
LG
147 @retval EFI_SUCCESS 8259 programmed\r
148 @retval EFI_DEVICE_ERROR Error writting to 8259\r
878ddf1f 149\r
150**/\r
151typedef\r
152EFI_STATUS\r
153(EFIAPI *EFI_LEGACY_8259_SET_MODE) (\r
154 IN EFI_LEGACY_8259_PROTOCOL *This,\r
155 IN EFI_8259_MODE Mode,\r
156 IN UINT16 *Mask, OPTIONAL\r
157 IN UINT16 *EdgeLevel OPTIONAL\r
158 )\r
159;\r
160\r
161/**\r
162 Convert from IRQ to processor interrupt vector number.\r
163\r
0647c9ad
LG
164 @param This Protocol instance pointer.\r
165 @param Irq 8259 IRQ0 - IRQ15\r
166 @param Vector Processor vector number that matches Irq\r
878ddf1f 167\r
0647c9ad
LG
168 @retval EFI_SUCCESS The Vector matching Irq is returned\r
169 @retval EFI_INVALID_PARAMETER Irq not valid\r
878ddf1f 170\r
171**/\r
172typedef\r
173EFI_STATUS\r
174(EFIAPI *EFI_LEGACY_8259_GET_VECTOR) (\r
175 IN EFI_LEGACY_8259_PROTOCOL *This,\r
176 IN EFI_8259_IRQ Irq,\r
177 OUT UINT8 *Vector\r
178 )\r
179;\r
180\r
181/**\r
182 Enable Irq by unmasking interrupt in 8259\r
183\r
0647c9ad
LG
184 @param This Protocol instance pointer.\r
185 @param Irq 8259 IRQ0 - IRQ15\r
186 @param LevelTriggered TRUE if level triggered. FALSE if edge triggered.\r
878ddf1f 187\r
0647c9ad
LG
188 @retval EFI_SUCCESS Irq enabled on 8259\r
189 @retval EFI_INVALID_PARAMETER Irq not valid\r
878ddf1f 190\r
191**/\r
192typedef\r
193EFI_STATUS\r
194(EFIAPI *EFI_LEGACY_8259_ENABLE_IRQ) (\r
195 IN EFI_LEGACY_8259_PROTOCOL *This,\r
196 IN EFI_8259_IRQ Irq,\r
197 IN BOOLEAN LevelTriggered\r
198 )\r
199;\r
200\r
201/**\r
202 Disable Irq by masking interrupt in 8259\r
203\r
0647c9ad
LG
204 @param This Protocol instance pointer.\r
205 @param Irq 8259 IRQ0 - IRQ15\r
878ddf1f 206\r
0647c9ad
LG
207 @retval EFI_SUCCESS Irq disabled on 8259\r
208 @retval EFI_INVALID_PARAMETER Irq not valid\r
878ddf1f 209\r
210**/\r
211typedef\r
212EFI_STATUS\r
213(EFIAPI *EFI_LEGACY_8259_DISABLE_IRQ) (\r
214 IN EFI_LEGACY_8259_PROTOCOL *This,\r
215 IN EFI_8259_IRQ Irq\r
216 )\r
217;\r
218\r
219/**\r
220 PciHandle represents a PCI config space of a PCI function. Vector \r
221 represents Interrupt Pin (from PCI config space) and it is the data\r
222 that is programmed into the Interrupt Line (from the PCI config space)\r
223 register.\r
224\r
0647c9ad
LG
225 @param This Protocol instance pointer.\r
226 @param PciHandle PCI function to return vector for\r
227 @param Vector Vector for fucntion that matches\r
878ddf1f 228\r
0647c9ad
LG
229 @retval EFI_SUCCESS A valid Vector is returned\r
230 @retval EFI_INVALID_PARAMETER PciHandle not valid\r
878ddf1f 231\r
232**/\r
233typedef\r
234EFI_STATUS\r
235(EFIAPI *EFI_LEGACY_8259_GET_INTERRUPT_LINE) (\r
236 IN EFI_LEGACY_8259_PROTOCOL *This,\r
237 IN EFI_HANDLE PciHandle,\r
238 OUT UINT8 *Vector\r
239 )\r
240;\r
241\r
242/**\r
243 Send an EOI to 8259\r
244\r
0647c9ad
LG
245 @param This Protocol instance pointer.\r
246 @param Irq 8259 IRQ0 - IRQ15\r
878ddf1f 247\r
0647c9ad
LG
248 @retval EFI_SUCCESS EOI successfully sent to 8259\r
249 @retval EFI_INVALID_PARAMETER Irq not valid\r
878ddf1f 250\r
251**/\r
252typedef\r
253EFI_STATUS\r
254(EFIAPI *EFI_LEGACY_8259_END_OF_INTERRUPT) (\r
255 IN EFI_LEGACY_8259_PROTOCOL *This,\r
256 IN EFI_8259_IRQ Irq\r
257 )\r
258;\r
259\r
260/**\r
261 @par Protocol Description:\r
262 Abstracts the 8259 and APIC hardware control between EFI usage and \r
263 Compatibility16 usage.\r
264\r
265 @param SetVectorBase\r
266 Sets the vector bases for master and slave PICs. \r
267\r
268 @param GetMask\r
269 Gets IRQ and edge/level masks for 16-bit real mode and 32-bit protected mode. \r
270\r
271 @param SetMask\r
272 Sets the IRQ and edge\level masks for 16-bit real mode and 32-bit protected mode.\r
273\r
274 @param SetMode\r
275 Sets PIC mode to 16-bit real mode or 32-bit protected mode.\r
276\r
277 @param GetVector\r
278 Gets the base vector assigned to an IRQ.\r
279\r
280 @param EnableIrq\r
281 Enables an IRQ. \r
282\r
283 @param DisableIrq\r
284 Disables an IRQ.\r
285\r
286 @param GetInterruptLine\r
287 Gets an IRQ that is assigned to a PCI device. \r
288\r
289 @param EndOfInterrupt\r
290 Issues the end of interrupt command. \r
291\r
292**/\r
293struct _EFI_LEGACY_8259_PROTOCOL {\r
294 EFI_LEGACY_8259_SET_VECTOR_BASE SetVectorBase;\r
295 EFI_LEGACY_8259_GET_MASK GetMask;\r
296 EFI_LEGACY_8259_SET_MASK SetMask;\r
297 EFI_LEGACY_8259_SET_MODE SetMode;\r
298 EFI_LEGACY_8259_GET_VECTOR GetVector;\r
299 EFI_LEGACY_8259_ENABLE_IRQ EnableIrq;\r
300 EFI_LEGACY_8259_DISABLE_IRQ DisableIrq;\r
301 EFI_LEGACY_8259_GET_INTERRUPT_LINE GetInterruptLine;\r
302 EFI_LEGACY_8259_END_OF_INTERRUPT EndOfInterrupt;\r
303};\r
304\r
305extern EFI_GUID gEfiLegacy8259ProtocolGuid;\r
306\r
307#endif\r