]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h
OvmfPkg: Apply uncrustify changes
[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 #define LEGACY_INT_BUS 0
24 #define LEGACY_INT_DEV_PIIX4 0x01
25 #define LEGACY_INT_DEV_Q35 0x1f
26 #define LEGACY_INT_FUNC 0
27
28 #define PIRQN 0x00 // PIRQ Null
29 #define PIRQA 0x60
30 #define PIRQB 0x61
31 #define PIRQC 0x62
32 #define PIRQD 0x63
33 #define PIRQE 0x68
34 #define PIRQF 0x69
35 #define PIRQG 0x6A
36 #define PIRQH 0x6B
37
38 #define MAX_PIRQ_NUMBER 8
39
40 /**
41 Return the number of PIRQs supported by this chipset.
42
43 @param[in] This Pointer to LegacyInterrupt Protocol
44 @param[out] NumberPirqs The pointer to return the max IRQ number supported
45
46 @retval EFI_SUCCESS Max PIRQs successfully returned
47
48 **/
49 EFI_STATUS
50 EFIAPI
51 GetNumberPirqs (
52 IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
53 OUT UINT8 *NumberPirqs
54 );
55
56 /**
57 Return PCI location of this device.
58 $PIR table requires this info.
59
60 @param[in] This - Protocol instance pointer.
61 @param[out] Bus - PCI Bus
62 @param[out] Device - PCI Device
63 @param[out] Function - PCI Function
64
65 @retval EFI_SUCCESS Bus/Device/Function returned
66
67 **/
68 EFI_STATUS
69 EFIAPI
70 GetLocation (
71 IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
72 OUT UINT8 *Bus,
73 OUT UINT8 *Device,
74 OUT UINT8 *Function
75 );
76
77 /**
78 Read the given PIRQ register
79
80 @param[in] This Protocol instance pointer
81 @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc
82 @param[out] PirqData Value read
83
84 @retval EFI_SUCCESS Decoding change affected.
85 @retval EFI_INVALID_PARAMETER Invalid PIRQ number
86
87 **/
88 EFI_STATUS
89 EFIAPI
90 ReadPirq (
91 IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
92 IN UINT8 PirqNumber,
93 OUT UINT8 *PirqData
94 );
95
96 /**
97 Write the given PIRQ register
98
99 @param[in] This Protocol instance pointer
100 @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc
101 @param[out] PirqData Value to write
102
103 @retval EFI_SUCCESS Decoding change affected.
104 @retval EFI_INVALID_PARAMETER Invalid PIRQ number
105
106 **/
107 EFI_STATUS
108 EFIAPI
109 WritePirq (
110 IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
111 IN UINT8 PirqNumber,
112 IN UINT8 PirqData
113 );
114
115 #endif