2 Driver implementing the Tiano Legacy 8259 Protocol
4 Copyright (c) 2005 - 2009, Intel Corporation
5 All rights reserved. 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
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.
18 #include <FrameworkDxe.h>
20 #include <Protocol/Legacy8259.h>
21 #include <Protocol/PciIo.h>
23 #include <Library/UefiBootServicesTableLib.h>
24 #include <Library/DebugLib.h>
25 #include <Library/IoLib.h>
26 #include <Library/BaseLib.h>
28 #include <IndustryStandard/Pci22.h>
30 // 8259 Hardware definitions
32 #define LEGACY_MODE_BASE_VECTOR_MASTER 0x08
33 #define LEGACY_MODE_BASE_VECTOR_SLAVE 0x70
35 #define PROTECTED_MODE_BASE_VECTOR_MASTER 0x68
36 #define PROTECTED_MODE_BASE_VECTOR_SLAVE 0x70
38 #define LEGACY_8259_CONTROL_REGISTER_MASTER 0x20
39 #define LEGACY_8259_MASK_REGISTER_MASTER 0x21
40 #define LEGACY_8259_CONTROL_REGISTER_SLAVE 0xA0
41 #define LEGACY_8259_MASK_REGISTER_SLAVE 0xA1
42 #define LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_MASTER 0x4D0
43 #define LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_SLAVE 0x4D1
45 #define LEGACY_8259_EOI 0x20
48 // Protocol Function Prototypes
52 Interrupt8259SetVectorBase (
53 IN EFI_LEGACY_8259_PROTOCOL
*This
,
60 Interrupt8259GetMask (
61 IN EFI_LEGACY_8259_PROTOCOL
*This
,
62 OUT UINT16
*LegacyMask
, OPTIONAL
63 OUT UINT16
*LegacyEdgeLevel
, OPTIONAL
64 OUT UINT16
*ProtectedMask
, OPTIONAL
65 OUT UINT16
*ProtectedEdgeLevel OPTIONAL
70 Interrupt8259SetMask (
71 IN EFI_LEGACY_8259_PROTOCOL
*This
,
72 IN UINT16
*LegacyMask
, OPTIONAL
73 IN UINT16
*LegacyEdgeLevel
, OPTIONAL
74 IN UINT16
*ProtectedMask
, OPTIONAL
75 IN UINT16
*ProtectedEdgeLevel OPTIONAL
80 Interrupt8259SetMode (
81 IN EFI_LEGACY_8259_PROTOCOL
*This
,
82 IN EFI_8259_MODE Mode
,
83 IN UINT16
*Mask
, OPTIONAL
84 IN UINT16
*EdgeLevel OPTIONAL
89 Interrupt8259GetVector (
90 IN EFI_LEGACY_8259_PROTOCOL
*This
,
97 Interrupt8259EnableIrq (
98 IN EFI_LEGACY_8259_PROTOCOL
*This
,
100 IN BOOLEAN LevelTriggered
105 Interrupt8259DisableIrq (
106 IN EFI_LEGACY_8259_PROTOCOL
*This
,
112 Interrupt8259GetInterruptLine (
113 IN EFI_LEGACY_8259_PROTOCOL
*This
,
114 IN EFI_HANDLE PciHandle
,
120 Interrupt8259EndOfInterrupt (
121 IN EFI_LEGACY_8259_PROTOCOL
*This
,