1 /** @file
2   This protocol abstracts the PIRQ programming from the generic EFI Compatibility Support Modules (CSMs).
3 
4 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 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   @par Revision Reference:
14   This protocol is defined in Framework for the EFI Compatibility Support Module specification.
15   Version 0.97.
16 
17 **/
18 
19 #ifndef _EFI_LEGACY_INTERRUPT_H_
20 #define _EFI_LEGACY_INTERRUPT_H_
21 
22 
23 #define EFI_LEGACY_INTERRUPT_PROTOCOL_GUID \
24   { \
25     0x31ce593d, 0x108a, 0x485d, {0xad, 0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe } \
26   }
27 
28 typedef struct _EFI_LEGACY_INTERRUPT_PROTOCOL EFI_LEGACY_INTERRUPT_PROTOCOL;
29 
30 /**
31   Get the number of PIRQs this hardware supports.
32 
33   @param  This                  The protocol instance pointer.
34   @param  NumberPirsq           The number of PIRQs that are supported.
35 
36   @retval EFI_SUCCESS           The number of PIRQs was returned successfully.
37 
38 **/
39 typedef
40 EFI_STATUS
41 (EFIAPI *EFI_LEGACY_INTERRUPT_GET_NUMBER_PIRQS)(
42   IN EFI_LEGACY_INTERRUPT_PROTOCOL            *This,
43   OUT UINT8                                   *NumberPirqs
44   );
45 
46 /**
47   Gets the PCI location associated with this protocol.
48 
49   @param  This                  The Protocol instance pointer.
50   @param  Bus                   The PCI Bus.
51   @param  Device                The PCI Device.
52   @param  Function              The PCI Function.
53 
54   @retval EFI_SUCCESS           The Bus, Device, and Function were returned successfully.
55 
56 **/
57 typedef
58 EFI_STATUS
59 (EFIAPI *EFI_LEGACY_INTERRUPT_GET_LOCATION)(
60   IN EFI_LEGACY_INTERRUPT_PROTOCOL            *This,
61   OUT UINT8                                   *Bus,
62   OUT UINT8                                   *Device,
63   OUT UINT8                                   *Function
64   );
65 
66 /**
67   Read the PIRQ register and return the data
68 
69   @param  This                  The protocol instance pointer.
70   @param  PirqNumber            The PIRQ register to read.
71   @param  PirqData              The data read.
72 
73   @retval EFI_SUCCESS           The data was read.
74   @retval EFI_INVALID_PARAMETER Invalid PIRQ number.
75 
76 **/
77 typedef
78 EFI_STATUS
79 (EFIAPI *EFI_LEGACY_INTERRUPT_READ_PIRQ)(
80   IN EFI_LEGACY_INTERRUPT_PROTOCOL           *This,
81   IN  UINT8                                  PirqNumber,
82   OUT UINT8                                  *PirqData
83   );
84 
85 /**
86   Write the specified PIRQ register with the given data.
87 
88   @param  This                  The protocol instance pointer.
89   @param  PirqNumber            A PIRQ register to read.
90   @param  PirqData              The data to write.
91 
92   @retval EFI_SUCCESS           The PIRQ was programmed.
93   @retval EFI_INVALID_PARAMETER Invalid PIRQ number.
94 
95 **/
96 typedef
97 EFI_STATUS
98 (EFIAPI *EFI_LEGACY_INTERRUPT_WRITE_PIRQ)(
99   IN EFI_LEGACY_INTERRUPT_PROTOCOL           *This,
100   IN  UINT8                                  PirqNumber,
101   IN UINT8                                   PirqData
102   );
103 
104 struct _EFI_LEGACY_INTERRUPT_PROTOCOL {
105   ///
106   ///   Gets the number of PIRQs supported.
107   ///
108   EFI_LEGACY_INTERRUPT_GET_NUMBER_PIRQS GetNumberPirqs;
109 
110   ///
111   /// Gets the PCI bus, device, and function that is associated with this protocol.
112   ///
113   EFI_LEGACY_INTERRUPT_GET_LOCATION     GetLocation;
114 
115   ///
116   /// Reads the indicated PIRQ register.
117   ///
118   EFI_LEGACY_INTERRUPT_READ_PIRQ        ReadPirq;
119 
120   ///
121   /// Writes to the indicated PIRQ register.
122   ///
123   EFI_LEGACY_INTERRUPT_WRITE_PIRQ       WritePirq;
124 };
125 
126 extern EFI_GUID gEfiLegacyInterruptProtocolGuid;
127 
128 #endif
129