VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/8259InterruptControllerDxe/8259.h@ 98412

Last change on this file since 98412 was 80721, checked in by vboxsync, 6 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 6.7 KB
Line 
1/** @file
2 Driver implementing the Tiano Legacy 8259 Protocol
3
4Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR>
5SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#ifndef _8259_H__
10#define _8259_H__
11
12#include <Protocol/Legacy8259.h>
13#include <Protocol/PciIo.h>
14
15#include <Library/UefiBootServicesTableLib.h>
16#include <Library/DebugLib.h>
17#include <Library/IoLib.h>
18#include <Library/BaseLib.h>
19#include <Library/PcdLib.h>
20
21#include <IndustryStandard/Pci.h>
22
23// 8259 Hardware definitions
24
25#define LEGACY_MODE_BASE_VECTOR_MASTER 0x08
26#define LEGACY_MODE_BASE_VECTOR_SLAVE 0x70
27
28#define PROTECTED_MODE_BASE_VECTOR_MASTER 0x68
29#define PROTECTED_MODE_BASE_VECTOR_SLAVE 0x70
30
31#define LEGACY_8259_CONTROL_REGISTER_MASTER 0x20
32#define LEGACY_8259_MASK_REGISTER_MASTER 0x21
33#define LEGACY_8259_CONTROL_REGISTER_SLAVE 0xA0
34#define LEGACY_8259_MASK_REGISTER_SLAVE 0xA1
35#define LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_MASTER 0x4D0
36#define LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_SLAVE 0x4D1
37
38#define LEGACY_8259_EOI 0x20
39
40// Protocol Function Prototypes
41
42/**
43 Sets the base address for the 8259 master and slave PICs.
44
45 @param[in] This Indicates the EFI_LEGACY_8259_PROTOCOL instance.
46 @param[in] MasterBase Interrupt vectors for IRQ0-IRQ7.
47 @param[in] SlaveBase Interrupt vectors for IRQ8-IRQ15.
48
49 @retval EFI_SUCCESS The 8259 PIC was programmed successfully.
50 @retval EFI_DEVICE_ERROR There was an error while writing to the 8259 PIC.
51
52**/
53EFI_STATUS
54EFIAPI
55Interrupt8259SetVectorBase (
56 IN EFI_LEGACY_8259_PROTOCOL *This,
57 IN UINT8 MasterBase,
58 IN UINT8 SlaveBase
59 );
60
61/**
62 Gets the current 16-bit real mode and 32-bit protected-mode IRQ masks.
63
64 @param[in] This Indicates the EFI_LEGACY_8259_PROTOCOL instance.
65 @param[out] LegacyMask 16-bit mode interrupt mask for IRQ0-IRQ15.
66 @param[out] LegacyEdgeLevel 16-bit mode edge/level mask for IRQ-IRQ15.
67 @param[out] ProtectedMask 32-bit mode interrupt mask for IRQ0-IRQ15.
68 @param[out] ProtectedEdgeLevel 32-bit mode edge/level mask for IRQ0-IRQ15.
69
70 @retval EFI_SUCCESS The 8259 PIC was programmed successfully.
71 @retval EFI_DEVICE_ERROR There was an error while reading the 8259 PIC.
72
73**/
74EFI_STATUS
75EFIAPI
76Interrupt8259GetMask (
77 IN EFI_LEGACY_8259_PROTOCOL *This,
78 OUT UINT16 *LegacyMask, OPTIONAL
79 OUT UINT16 *LegacyEdgeLevel, OPTIONAL
80 OUT UINT16 *ProtectedMask, OPTIONAL
81 OUT UINT16 *ProtectedEdgeLevel OPTIONAL
82 );
83
84/**
85 Sets the current 16-bit real mode and 32-bit protected-mode IRQ masks.
86
87 @param[in] This Indicates the EFI_LEGACY_8259_PROTOCOL instance.
88 @param[in] LegacyMask 16-bit mode interrupt mask for IRQ0-IRQ15.
89 @param[in] LegacyEdgeLevel 16-bit mode edge/level mask for IRQ-IRQ15.
90 @param[in] ProtectedMask 32-bit mode interrupt mask for IRQ0-IRQ15.
91 @param[in] ProtectedEdgeLevel 32-bit mode edge/level mask for IRQ0-IRQ15.
92
93 @retval EFI_SUCCESS The 8259 PIC was programmed successfully.
94 @retval EFI_DEVICE_ERROR There was an error while writing the 8259 PIC.
95
96**/
97EFI_STATUS
98EFIAPI
99Interrupt8259SetMask (
100 IN EFI_LEGACY_8259_PROTOCOL *This,
101 IN UINT16 *LegacyMask, OPTIONAL
102 IN UINT16 *LegacyEdgeLevel, OPTIONAL
103 IN UINT16 *ProtectedMask, OPTIONAL
104 IN UINT16 *ProtectedEdgeLevel OPTIONAL
105 );
106
107/**
108 Sets the mode of the PICs.
109
110 @param[in] This Indicates the EFI_LEGACY_8259_PROTOCOL instance.
111 @param[in] Mode 16-bit real or 32-bit protected mode.
112 @param[in] Mask The value with which to set the interrupt mask.
113 @param[in] EdgeLevel The value with which to set the edge/level mask.
114
115 @retval EFI_SUCCESS The mode was set successfully.
116 @retval EFI_INVALID_PARAMETER The mode was not set.
117
118**/
119EFI_STATUS
120EFIAPI
121Interrupt8259SetMode (
122 IN EFI_LEGACY_8259_PROTOCOL *This,
123 IN EFI_8259_MODE Mode,
124 IN UINT16 *Mask, OPTIONAL
125 IN UINT16 *EdgeLevel OPTIONAL
126 );
127
128/**
129 Translates the IRQ into a vector.
130
131 @param[in] This Indicates the EFI_LEGACY_8259_PROTOCOL instance.
132 @param[in] Irq IRQ0-IRQ15.
133 @param[out] Vector The vector that is assigned to the IRQ.
134
135 @retval EFI_SUCCESS The Vector that matches Irq was returned.
136 @retval EFI_INVALID_PARAMETER Irq is not valid.
137
138**/
139EFI_STATUS
140EFIAPI
141Interrupt8259GetVector (
142 IN EFI_LEGACY_8259_PROTOCOL *This,
143 IN EFI_8259_IRQ Irq,
144 OUT UINT8 *Vector
145 );
146
147/**
148 Enables the specified IRQ.
149
150 @param[in] This Indicates the EFI_LEGACY_8259_PROTOCOL instance.
151 @param[in] Irq IRQ0-IRQ15.
152 @param[in] LevelTriggered 0 = Edge triggered; 1 = Level triggered.
153
154 @retval EFI_SUCCESS The Irq was enabled on the 8259 PIC.
155 @retval EFI_INVALID_PARAMETER The Irq is not valid.
156
157**/
158EFI_STATUS
159EFIAPI
160Interrupt8259EnableIrq (
161 IN EFI_LEGACY_8259_PROTOCOL *This,
162 IN EFI_8259_IRQ Irq,
163 IN BOOLEAN LevelTriggered
164 );
165
166/**
167 Disables the specified IRQ.
168
169 @param[in] This Indicates the EFI_LEGACY_8259_PROTOCOL instance.
170 @param[in] Irq IRQ0-IRQ15.
171
172 @retval EFI_SUCCESS The Irq was disabled on the 8259 PIC.
173 @retval EFI_INVALID_PARAMETER The Irq is not valid.
174
175**/
176EFI_STATUS
177EFIAPI
178Interrupt8259DisableIrq (
179 IN EFI_LEGACY_8259_PROTOCOL *This,
180 IN EFI_8259_IRQ Irq
181 );
182
183/**
184 Reads the PCI configuration space to get the interrupt number that is assigned to the card.
185
186 @param[in] This Indicates the EFI_LEGACY_8259_PROTOCOL instance.
187 @param[in] PciHandle PCI function for which to return the vector.
188 @param[out] Vector IRQ number that corresponds to the interrupt line.
189
190 @retval EFI_SUCCESS The interrupt line value was read successfully.
191
192**/
193EFI_STATUS
194EFIAPI
195Interrupt8259GetInterruptLine (
196 IN EFI_LEGACY_8259_PROTOCOL *This,
197 IN EFI_HANDLE PciHandle,
198 OUT UINT8 *Vector
199 );
200
201/**
202 Issues the End of Interrupt (EOI) commands to PICs.
203
204 @param[in] This Indicates the EFI_LEGACY_8259_PROTOCOL instance.
205 @param[in] Irq The interrupt for which to issue the EOI command.
206
207 @retval EFI_SUCCESS The EOI command was issued.
208 @retval EFI_INVALID_PARAMETER The Irq is not valid.
209
210**/
211EFI_STATUS
212EFIAPI
213Interrupt8259EndOfInterrupt (
214 IN EFI_LEGACY_8259_PROTOCOL *This,
215 IN EFI_8259_IRQ Irq
216 );
217
218#endif
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette