fff068a0dfad24e9fee025743573c38a2645c2b1
[mirror_edk2.git] / PcAtChipsetPkg / 8259InterruptControllerDxe / 8259.h
1 /** @file
2 Driver implementing the Tiano Legacy 8259 Protocol
3
4 Copyright (c) 2005 - 2009, 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
15 #ifndef _8259_H__
16 #define _8259_H__
17
18 #include <FrameworkDxe.h>
19
20 #include <Protocol/Legacy8259.h>
21 #include <Protocol/PciIo.h>
22
23 #include <Library/UefiBootServicesTableLib.h>
24 #include <Library/DebugLib.h>
25 #include <Library/IoLib.h>
26 #include <Library/BaseLib.h>
27 #include <Library/PcdLib.h>
28
29 #include <IndustryStandard/Pci.h>
30
31 // 8259 Hardware definitions
32
33 #define LEGACY_MODE_BASE_VECTOR_MASTER 0x08
34 #define LEGACY_MODE_BASE_VECTOR_SLAVE 0x70
35
36 #define PROTECTED_MODE_BASE_VECTOR_MASTER 0x68
37 #define PROTECTED_MODE_BASE_VECTOR_SLAVE 0x70
38
39 #define LEGACY_8259_CONTROL_REGISTER_MASTER 0x20
40 #define LEGACY_8259_MASK_REGISTER_MASTER 0x21
41 #define LEGACY_8259_CONTROL_REGISTER_SLAVE 0xA0
42 #define LEGACY_8259_MASK_REGISTER_SLAVE 0xA1
43 #define LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_MASTER 0x4D0
44 #define LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_SLAVE 0x4D1
45
46 #define LEGACY_8259_EOI 0x20
47
48 // Protocol Function Prototypes
49
50
51 EFI_STATUS
52 EFIAPI
53 Interrupt8259SetVectorBase (
54 IN EFI_LEGACY_8259_PROTOCOL *This,
55 IN UINT8 MasterBase,
56 IN UINT8 SlaveBase
57 );
58
59 EFI_STATUS
60 EFIAPI
61 Interrupt8259GetMask (
62 IN EFI_LEGACY_8259_PROTOCOL *This,
63 OUT UINT16 *LegacyMask, OPTIONAL
64 OUT UINT16 *LegacyEdgeLevel, OPTIONAL
65 OUT UINT16 *ProtectedMask, OPTIONAL
66 OUT UINT16 *ProtectedEdgeLevel OPTIONAL
67 );
68
69 EFI_STATUS
70 EFIAPI
71 Interrupt8259SetMask (
72 IN EFI_LEGACY_8259_PROTOCOL *This,
73 IN UINT16 *LegacyMask, OPTIONAL
74 IN UINT16 *LegacyEdgeLevel, OPTIONAL
75 IN UINT16 *ProtectedMask, OPTIONAL
76 IN UINT16 *ProtectedEdgeLevel OPTIONAL
77 );
78
79 EFI_STATUS
80 EFIAPI
81 Interrupt8259SetMode (
82 IN EFI_LEGACY_8259_PROTOCOL *This,
83 IN EFI_8259_MODE Mode,
84 IN UINT16 *Mask, OPTIONAL
85 IN UINT16 *EdgeLevel OPTIONAL
86 );
87
88 EFI_STATUS
89 EFIAPI
90 Interrupt8259GetVector (
91 IN EFI_LEGACY_8259_PROTOCOL *This,
92 IN EFI_8259_IRQ Irq,
93 OUT UINT8 *Vector
94 );
95
96 EFI_STATUS
97 EFIAPI
98 Interrupt8259EnableIrq (
99 IN EFI_LEGACY_8259_PROTOCOL *This,
100 IN EFI_8259_IRQ Irq,
101 IN BOOLEAN LevelTriggered
102 );
103
104 EFI_STATUS
105 EFIAPI
106 Interrupt8259DisableIrq (
107 IN EFI_LEGACY_8259_PROTOCOL *This,
108 IN EFI_8259_IRQ Irq
109 );
110
111 EFI_STATUS
112 EFIAPI
113 Interrupt8259GetInterruptLine (
114 IN EFI_LEGACY_8259_PROTOCOL *This,
115 IN EFI_HANDLE PciHandle,
116 OUT UINT8 *Vector
117 );
118
119 EFI_STATUS
120 EFIAPI
121 Interrupt8259EndOfInterrupt (
122 IN EFI_LEGACY_8259_PROTOCOL *This,
123 IN EFI_8259_IRQ Irq
124 );
125
126 #endif