]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h
OvmfPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / OvmfPkg / Csm / CsmSupportLib / LegacyInterrupt.h
1 /** @file
2 Legacy Region Support
3
4 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef _LEGACY_INTERRUPT_H_
11 #define _LEGACY_INTERRUPT_H_
12
13 #include <PiDxe.h>
14
15 #include <Protocol/LegacyInterrupt.h>
16
17 #include <Library/PcdLib.h>
18 #include <Library/PciLib.h>
19 #include <Library/DebugLib.h>
20 #include <Library/UefiBootServicesTableLib.h>
21 #include <OvmfPlatforms.h>
22
23
24 #define LEGACY_INT_BUS 0
25 #define LEGACY_INT_DEV_PIIX4 0x01
26 #define LEGACY_INT_DEV_Q35 0x1f
27 #define LEGACY_INT_FUNC 0
28
29 #define PIRQN 0x00 // PIRQ Null
30 #define PIRQA 0x60
31 #define PIRQB 0x61
32 #define PIRQC 0x62
33 #define PIRQD 0x63
34 #define PIRQE 0x68
35 #define PIRQF 0x69
36 #define PIRQG 0x6A
37 #define PIRQH 0x6B
38
39 #define MAX_PIRQ_NUMBER 8
40
41 /**
42 Return the number of PIRQs supported by this chipset.
43
44 @param[in] This Pointer to LegacyInterrupt Protocol
45 @param[out] NumberPirqs The pointer to return the max IRQ number supported
46
47 @retval EFI_SUCCESS Max PIRQs successfully returned
48
49 **/
50 EFI_STATUS
51 EFIAPI
52 GetNumberPirqs (
53 IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
54 OUT UINT8 *NumberPirqs
55 );
56
57 /**
58 Return PCI location of this device.
59 $PIR table requires this info.
60
61 @param[in] This - Protocol instance pointer.
62 @param[out] Bus - PCI Bus
63 @param[out] Device - PCI Device
64 @param[out] Function - PCI Function
65
66 @retval EFI_SUCCESS Bus/Device/Function returned
67
68 **/
69 EFI_STATUS
70 EFIAPI
71 GetLocation (
72 IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
73 OUT UINT8 *Bus,
74 OUT UINT8 *Device,
75 OUT UINT8 *Function
76 );
77
78 /**
79 Read the given PIRQ register
80
81 @param[in] This Protocol instance pointer
82 @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc
83 @param[out] PirqData Value read
84
85 @retval EFI_SUCCESS Decoding change affected.
86 @retval EFI_INVALID_PARAMETER Invalid PIRQ number
87
88 **/
89 EFI_STATUS
90 EFIAPI
91 ReadPirq (
92 IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
93 IN UINT8 PirqNumber,
94 OUT UINT8 *PirqData
95 );
96
97 /**
98 Write the given PIRQ register
99
100 @param[in] This Protocol instance pointer
101 @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc
102 @param[out] PirqData Value to write
103
104 @retval EFI_SUCCESS Decoding change affected.
105 @retval EFI_INVALID_PARAMETER Invalid PIRQ number
106
107 **/
108 EFI_STATUS
109 EFIAPI
110 WritePirq (
111 IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
112 IN UINT8 PirqNumber,
113 IN UINT8 PirqData
114 );
115
116 #endif
117