Home | History | Annotate | Download | only in CsmSupportLib
      1 /** @file
      2   Legacy Region Support
      3 
      4   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
      5 
      6   This program and the accompanying materials are
      7   licensed and made available under the terms and conditions of the BSD License
      8   which accompanies this distribution.  The full text of the license may be found at
      9   http://opensource.org/licenses/bsd-license.php
     10 
     11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 
     14 **/
     15 
     16 #ifndef _LEGACY_INTERRUPT_H_
     17 #define _LEGACY_INTERRUPT_H_
     18 
     19 #include <PiDxe.h>
     20 
     21 #include <Protocol/LegacyInterrupt.h>
     22 
     23 #include <Library/PcdLib.h>
     24 #include <Library/PciLib.h>
     25 #include <Library/DebugLib.h>
     26 #include <Library/UefiBootServicesTableLib.h>
     27 #include <OvmfPlatforms.h>
     28 
     29 
     30 #define LEGACY_INT_BUS  0
     31 #define LEGACY_INT_DEV_PIIX4  0x01
     32 #define LEGACY_INT_DEV_Q35    0x1f
     33 #define LEGACY_INT_FUNC 0
     34 
     35 #define PIRQN           0x00  // PIRQ Null
     36 #define PIRQA           0x60
     37 #define PIRQB           0x61
     38 #define PIRQC           0x62
     39 #define PIRQD           0x63
     40 #define PIRQE           0x68
     41 #define PIRQF           0x69
     42 #define PIRQG           0x6A
     43 #define PIRQH           0x6B
     44 
     45 #define MAX_PIRQ_NUMBER 8
     46 
     47 /**
     48   Return the number of PIRQs supported by this chipset.
     49 
     50   @param[in]  This         Pointer to LegacyInterrupt Protocol
     51   @param[out] NumberPirqs  The pointer to return the max IRQ number supported
     52 
     53   @retval EFI_SUCCESS   Max PIRQs successfully returned
     54 
     55 **/
     56 EFI_STATUS
     57 EFIAPI
     58 GetNumberPirqs (
     59   IN  EFI_LEGACY_INTERRUPT_PROTOCOL  *This,
     60   OUT UINT8                          *NumberPirqs
     61   );
     62 
     63 /**
     64   Return PCI location of this device.
     65   $PIR table requires this info.
     66 
     67   @param[in]   This                - Protocol instance pointer.
     68   @param[out]  Bus                 - PCI Bus
     69   @param[out]  Device              - PCI Device
     70   @param[out]  Function            - PCI Function
     71 
     72   @retval  EFI_SUCCESS   Bus/Device/Function returned
     73 
     74 **/
     75 EFI_STATUS
     76 EFIAPI
     77 GetLocation (
     78   IN  EFI_LEGACY_INTERRUPT_PROTOCOL  *This,
     79   OUT UINT8                          *Bus,
     80   OUT UINT8                          *Device,
     81   OUT UINT8                          *Function
     82   );
     83 
     84 /**
     85   Read the given PIRQ register
     86 
     87   @param[in]  This        Protocol instance pointer
     88   @param[in]  PirqNumber  The Pirq register 0 = A, 1 = B etc
     89   @param[out] PirqData    Value read
     90 
     91   @retval EFI_SUCCESS   Decoding change affected.
     92   @retval EFI_INVALID_PARAMETER   Invalid PIRQ number
     93 
     94 **/
     95 EFI_STATUS
     96 EFIAPI
     97 ReadPirq (
     98   IN  EFI_LEGACY_INTERRUPT_PROTOCOL  *This,
     99   IN  UINT8                          PirqNumber,
    100   OUT UINT8                          *PirqData
    101   );
    102 
    103 /**
    104   Write the given PIRQ register
    105 
    106   @param[in]  This        Protocol instance pointer
    107   @param[in]  PirqNumber  The Pirq register 0 = A, 1 = B etc
    108   @param[out] PirqData    Value to write
    109 
    110   @retval EFI_SUCCESS   Decoding change affected.
    111   @retval EFI_INVALID_PARAMETER   Invalid PIRQ number
    112 
    113 **/
    114 EFI_STATUS
    115 EFIAPI
    116 WritePirq (
    117   IN  EFI_LEGACY_INTERRUPT_PROTOCOL  *This,
    118   IN  UINT8                          PirqNumber,
    119   IN  UINT8                          PirqData
    120   );
    121 
    122 #endif
    123 
    124