LegacyInterrupt.h 2.8 KB

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