EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

EdkCompatibilityPkg/Foundation/Framework/Protocol/Legacy8259/Legacy8259.h

Go to the documentation of this file.
00001 /*++
00002 
00003 Copyright (c) 1999 - 2006, Intel Corporation. All rights reserved.<BR>
00004 This program and the accompanying materials
00005 are licensed and made available under the terms and conditions of the BSD License
00006 which accompanies this distribution.  The full text of the license may be found at
00007 http://opensource.org/licenses/bsd-license.php
00008 
00009 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00010 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00011 
00012 
00013 Module Name:
00014 
00015   Legacy8259.h
00016     
00017 Abstract:
00018 
00019   This protocol abstracts the 8259 interrupt controller. This includes
00020   PCI IRQ routing need to program the PCI Interrupt Line register.
00021 
00022 Revision History
00023 
00024   The EFI Legacy 8259 Protocol is compliant with CSM spec 0.96.
00025 
00026 --*/
00027 
00028 #ifndef _EFI_LEGACY_8259_H
00029 #define _EFI_LEGACY_8259_H
00030 
00031 #define EFI_LEGACY_8259_PROTOCOL_GUID \
00032   { \
00033     0x38321dba, 0x4fe0, 0x4e17, {0x8a, 0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1} \
00034   }
00035 
00036 EFI_FORWARD_DECLARATION (EFI_LEGACY_8259_PROTOCOL);
00037 
00038 typedef enum {
00039   Efi8259Irq0,
00040   Efi8259Irq1,
00041   Efi8259Irq2,
00042   Efi8259Irq3,
00043   Efi8259Irq4,
00044   Efi8259Irq5,
00045   Efi8259Irq6,
00046   Efi8259Irq7,
00047   Efi8259Irq8,
00048   Efi8259Irq9,
00049   Efi8259Irq10,
00050   Efi8259Irq11,
00051   Efi8259Irq12,
00052   Efi8259Irq13,
00053   Efi8259Irq14,
00054   Efi8259Irq15,
00055   Efi8259IrqMax
00056 } EFI_8259_IRQ;
00057 
00058 typedef enum {
00059   Efi8259LegacyMode,
00060   Efi8259ProtectedMode,
00061   Efi8259MaxMode
00062 } EFI_8259_MODE;
00063 
00064 typedef
00065 EFI_STATUS
00066 (EFIAPI *EFI_LEGACY_8259_SET_VECTOR_BASE) (
00067   IN EFI_LEGACY_8259_PROTOCOL           * This,
00068   IN  UINT8                             MasterBase,
00069   IN  UINT8                             SlaveBase
00070   )
00071 /*++
00072 
00073   Routine Description:
00074     Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
00075     the legacy mode mask and the protected mode mask. The base address for the 8259
00076     is different for legacy and protected mode, so two masks are required.
00077 
00078   Arguments:
00079     This          - Protocol instance pointer.
00080     MasterBase    - The base vector for the Master PIC in the 8259 controller
00081     Slavebase     - The base vector for the Master PIC in the 8259 controller
00082 
00083   Returns:
00084     EFI_SUCCESS       - The new bases were programmed
00085     EFI_DEVICE_ERROR  - A device erro occured programming the vector bases
00086 
00087 --*/
00088 ;
00089 
00090 typedef
00091 EFI_STATUS
00092 (EFIAPI *EFI_LEGACY_8259_GET_MASK) (
00093   IN EFI_LEGACY_8259_PROTOCOL           * This,
00094   OUT UINT16                            *LegacyMask, OPTIONAL
00095   OUT UINT16                            *LegacyEdgeLevel, OPTIONAL
00096   OUT UINT16                            *ProtectedMask, OPTIONAL
00097   OUT UINT16                            *ProtectedEdgeLevel OPTIONAL
00098   )
00099 /*++
00100 
00101   Routine Description:
00102     Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
00103     the legacy mode mask and the protected mode mask. The base address for the 8259
00104     is different for legacy and protected mode, so two masks are required.
00105 
00106   Arguments:
00107     This               - Protocol instance pointer.
00108     LegacyMask         - Bit 0 is Irq0 - Bit 15 is Irq15
00109     LegacyEdgeLevel    - Bit 0 is Irq0 - Bit 15 is Irq15
00110     ProtectedMask      - Bit 0 is Irq0 - Bit 15 is Irq15
00111     ProtectedEdgeLevel - Bit 0 is Irq0 - Bit 15 is Irq15
00112 
00113   Returns:
00114     EFI_SUCCESS       - 8259 status returned
00115     EFI_DEVICE_ERROR  - Error reading 8259
00116 
00117 --*/
00118 ;
00119 
00120 typedef
00121 EFI_STATUS
00122 (EFIAPI *EFI_LEGACY_8259_SET_MASK) (
00123   IN EFI_LEGACY_8259_PROTOCOL           * This,
00124   IN  UINT16                            *LegacyMask, OPTIONAL
00125   IN  UINT16                            *LegacyEdgeLevel, OPTIONAL
00126   IN  UINT16                            *ProtectedMask, OPTIONAL
00127   IN  UINT16                            *ProtectedEdgeLevel OPTIONAL
00128   )
00129 /*++
00130 
00131   Routine Description:
00132     Set the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
00133     the legacy mode mask and the protected mode mask. The base address for the 8259
00134     is different for legacy and protected mode, so two masks are required.
00135     Also set the edge/level masks.
00136 
00137   Arguments:
00138     This               - Protocol instance pointer.
00139     LegacyMask         - Bit 0 is Irq0 - Bit 15 is Irq15
00140     LegacyEdgeLevel    - Bit 0 is Irq0 - Bit 15 is Irq15
00141     ProtectedMask      - Bit 0 is Irq0 - Bit 15 is Irq15
00142     ProtectedEdgeLevel - Bit 0 is Irq0 - Bit 15 is Irq15
00143 
00144   Returns:
00145     EFI_SUCCESS       - 8259 status returned
00146     EFI_DEVICE_ERROR  - Error reading 8259
00147 
00148 --*/
00149 ;
00150 
00151 typedef
00152 EFI_STATUS
00153 (EFIAPI *EFI_LEGACY_8259_SET_MODE) (
00154   IN EFI_LEGACY_8259_PROTOCOL         * This,
00155   IN  EFI_8259_MODE                   Mode,
00156   IN  UINT16                          *Mask, OPTIONAL
00157   IN  UINT16                          *EdgeLevel OPTIONAL
00158   )
00159 /*++
00160 
00161   Routine Description:
00162     Set the 8259 mode of operation. The base address for the 8259 is different for
00163     legacy and protected mode. The legacy mode requires the master 8259 to have a
00164     master base of 0x08 and the slave base of 0x70. The protected mode base locations
00165     are not defined. Interrupts must be masked by the caller before this function
00166     is called. The interrupt mask from the current mode is saved. The interrupt 
00167     mask for the new mode is Mask, or if Mask does not exist the previously saved
00168     mask is used.
00169 
00170 
00171   Arguments:
00172     This      - Protocol instance pointer.
00173     Mode      - Mode of operation. i.e. real mode or protected mode
00174     Mask      - Optional interupt mask for the new mode.
00175     EdgeLevel - Optional trigger mask for the new mode.
00176 
00177   Returns:
00178     EFI_SUCCESS       - 8259 programmed
00179     EFI_DEVICE_ERROR  - Error writting to 8259
00180 
00181 --*/
00182 ;
00183 
00184 typedef
00185 EFI_STATUS
00186 (EFIAPI *EFI_LEGACY_8259_GET_VECTOR) (
00187   IN EFI_LEGACY_8259_PROTOCOL           * This,
00188   IN  EFI_8259_IRQ                      Irq,
00189   OUT UINT8                             *Vector
00190   )
00191 /*++
00192 
00193   Routine Description:
00194     Convert from IRQ to processor interrupt vector number.
00195 
00196   Arguments:
00197     This    - Protocol instance pointer.
00198     Irq     - 8259 IRQ0 - IRQ15
00199     Vector  - Processor vector number that matches Irq
00200 
00201   Returns:
00202     EFI_SUCCESS           - The Vector matching Irq is returned
00203     EFI_INVALID_PARAMETER - Irq not valid
00204 
00205 --*/
00206 ;
00207 
00208 typedef
00209 EFI_STATUS
00210 (EFIAPI *EFI_LEGACY_8259_ENABLE_IRQ) (
00211   IN EFI_LEGACY_8259_PROTOCOL           * This,
00212   IN  EFI_8259_IRQ                      Irq,
00213   IN  BOOLEAN                           LevelTriggered
00214   )
00215 /*++
00216 
00217   Routine Description:
00218     Enable Irq by unmasking interrupt in 8259
00219 
00220   Arguments:
00221     This           - Protocol instance pointer.
00222     Irq            - 8259 IRQ0 - IRQ15
00223     LevelTriggered - TRUE if level triggered.  FALSE if edge triggered.
00224 
00225   Returns:
00226     EFI_SUCCESS           - Irq enabled on 8259
00227     EFI_INVALID_PARAMETER - Irq not valid
00228 
00229 --*/
00230 ;
00231 
00232 typedef
00233 EFI_STATUS
00234 (EFIAPI *EFI_LEGACY_8259_DISABLE_IRQ) (
00235   IN EFI_LEGACY_8259_PROTOCOL           * This,
00236   IN  EFI_8259_IRQ                      Irq
00237   )
00238 /*++
00239 
00240   Routine Description:
00241     Disable Irq by masking interrupt in 8259
00242 
00243   Arguments:
00244     This    - Protocol instance pointer.
00245     Irq     - 8259 IRQ0 - IRQ15
00246 
00247   Returns:
00248     EFI_SUCCESS           - Irq disabled on 8259
00249     EFI_INVALID_PARAMETER - Irq not valid
00250 
00251 --*/
00252 ;
00253 
00254 typedef
00255 EFI_STATUS
00256 (EFIAPI *EFI_LEGACY_8259_GET_INTERRUPT_LINE) (
00257   IN EFI_LEGACY_8259_PROTOCOL           * This,
00258   IN  EFI_HANDLE                        PciHandle,
00259   OUT UINT8                             *Vector
00260   )
00261 /*++
00262 
00263   Routine Description:
00264     PciHandle represents a PCI config space of a PCI function. Vector 
00265     represents Interrupt Pin (from PCI config space) and it is the data
00266     that is programmed into the Interrupt Line (from the PCI config space)
00267     register.
00268 
00269   Arguments:
00270     This      - Protocol instance pointer.
00271     PciHandle - PCI function to return vector for 
00272     Vector    - Vector for fucntion that matches 
00273 
00274   Returns:
00275     EFI_SUCCESS           - A valid Vector is returned
00276     EFI_INVALID_PARAMETER - PciHandle not valid
00277 
00278 --*/
00279 ;
00280 
00281 typedef
00282 EFI_STATUS
00283 (EFIAPI *EFI_LEGACY_8259_END_OF_INTERRUPT) (
00284   IN EFI_LEGACY_8259_PROTOCOL           * This,
00285   IN  EFI_8259_IRQ                      Irq
00286   )
00287 /*++
00288 
00289   Routine Description:
00290     Send an EOI to 8259
00291 
00292   Arguments:
00293     This    - Protocol instance pointer.
00294     Irq     - 8259 IRQ0 - IRQ15
00295 
00296   Returns:
00297     EFI_SUCCESS           - EOI successfully sent to 8259
00298     EFI_INVALID_PARAMETER - Irq not valid
00299 
00300 --*/
00301 ;
00302 
00303 struct _EFI_LEGACY_8259_PROTOCOL {
00304   EFI_LEGACY_8259_SET_VECTOR_BASE     SetVectorBase;
00305   EFI_LEGACY_8259_GET_MASK            GetMask;
00306   EFI_LEGACY_8259_SET_MASK            SetMask;
00307   EFI_LEGACY_8259_SET_MODE            SetMode;
00308   EFI_LEGACY_8259_GET_VECTOR          GetVector;
00309   EFI_LEGACY_8259_ENABLE_IRQ          EnableIrq;
00310   EFI_LEGACY_8259_DISABLE_IRQ         DisableIrq;
00311   EFI_LEGACY_8259_GET_INTERRUPT_LINE  GetInterruptLine;
00312   EFI_LEGACY_8259_END_OF_INTERRUPT    EndOfInterrupt;
00313 };
00314 
00315 extern EFI_GUID gEfiLegacy8259ProtocolGuid;
00316 
00317 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines