PciPlatform.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /** @file
  2. *
  3. * Copyright (c) 2016, Hisilicon Limited. All rights reserved.
  4. * Copyright (c) 2016, Linaro Limited. All rights reserved.
  5. *
  6. * This program and the accompanying materials
  7. * are 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. #ifndef PCI_PLATFORM_H_
  16. #define PCI_PLATFORM_H_
  17. #include <Library/DebugLib.h>
  18. #include <Library/BaseLib.h>
  19. #include <Library/UefiLib.h>
  20. #include <Protocol/PciPlatform.h>
  21. //
  22. // Global variables for Option ROMs
  23. //
  24. #define NULL_ROM_FILE_GUID \
  25. { \
  26. 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \
  27. }
  28. typedef struct {
  29. EFI_GUID FileName;
  30. UINTN Segment;
  31. UINTN Bus;
  32. UINTN Device;
  33. UINTN Function;
  34. UINT16 VendorId;
  35. UINT16 DeviceId;
  36. } PCI_OPTION_ROM_TABLE;
  37. #define INVALID 0xBD
  38. typedef struct {
  39. EFI_HANDLE PciPlatformHandle;
  40. EFI_PCI_PLATFORM_PROTOCOL PciPlatform;
  41. } PCI_PLATFORM_PRIVATE_DATA;
  42. extern PCI_PLATFORM_PRIVATE_DATA mPciPrivateData;
  43. EFI_STATUS
  44. EFIAPI
  45. PhaseNotify (
  46. IN EFI_PCI_PLATFORM_PROTOCOL *This,
  47. IN EFI_HANDLE HostBridge,
  48. IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase,
  49. IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase
  50. )
  51. /*++
  52. Routine Description:
  53. Perform initialization by the phase indicated.
  54. Arguments:
  55. This - Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
  56. HostBridge - The associated PCI host bridge handle.
  57. Phase - The phase of the PCI controller enumeration.
  58. ChipsetPhase - Defines the execution phase of the PCI chipset driver.
  59. Returns:
  60. EFI_SUCCESS - Must return with success.
  61. --*/
  62. ;
  63. EFI_STATUS
  64. EFIAPI
  65. PlatformPrepController (
  66. IN EFI_PCI_PLATFORM_PROTOCOL *This,
  67. IN EFI_HANDLE HostBridge,
  68. IN EFI_HANDLE RootBridge,
  69. IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
  70. IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase,
  71. IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase
  72. )
  73. /*++
  74. Routine Description:
  75. The PlatformPrepController() function can be used to notify the platform driver so that
  76. it can perform platform-specific actions. No specific actions are required.
  77. Several notification points are defined at this time. More synchronization points may be
  78. added as required in the future. The PCI bus driver calls the platform driver twice for
  79. every PCI controller-once before the PCI Host Bridge Resource Allocation Protocol driver
  80. is notified, and once after the PCI Host Bridge Resource Allocation Protocol driver has
  81. been notified.
  82. This member function may not perform any error checking on the input parameters. It also
  83. does not return any error codes. If this member function detects any error condition, it
  84. needs to handle those errors on its own because there is no way to surface any errors to
  85. the caller.
  86. Arguments:
  87. This - Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
  88. HostBridge - The associated PCI host bridge handle.
  89. RootBridge - The associated PCI root bridge handle.
  90. PciAddress - The address of the PCI device on the PCI bus.
  91. Phase - The phase of the PCI controller enumeration.
  92. ChipsetPhase - Defines the execution phase of the PCI chipset driver.
  93. Returns:
  94. EFI_SUCCESS - The function completed successfully.
  95. --*/
  96. ;
  97. EFI_STATUS
  98. EFIAPI
  99. GetPlatformPolicy (
  100. IN EFI_PCI_PLATFORM_PROTOCOL *This,
  101. OUT EFI_PCI_PLATFORM_POLICY *PciPolicy
  102. )
  103. /*++
  104. Routine Description:
  105. Set the PciPolicy as EFI_RESERVE_ISA_IO_NO_ALIAS | EFI_RESERVE_VGA_IO_NO_ALIAS.
  106. Arguments:
  107. This - The pointer to the Protocol itself.
  108. PciPolicy - the returned Policy.
  109. Returns:
  110. EFI_UNSUPPORTED - Function not supported.
  111. EFI_INVALID_PARAMETER - Invalid PciPolicy value.
  112. --*/
  113. ;
  114. EFI_STATUS
  115. EFIAPI
  116. GetPciRom (
  117. IN EFI_PCI_PLATFORM_PROTOCOL *This,
  118. IN EFI_HANDLE PciHandle,
  119. OUT VOID **RomImage,
  120. OUT UINTN *RomSize
  121. )
  122. /*++
  123. Routine Description:
  124. Return a PCI ROM image for the onboard device represented by PciHandle.
  125. Arguments:
  126. This - Protocol instance pointer.
  127. PciHandle - PCI device to return the ROM image for.
  128. RomImage - PCI Rom Image for onboard device.
  129. RomSize - Size of RomImage in bytes.
  130. Returns:
  131. EFI_SUCCESS - RomImage is valid.
  132. EFI_NOT_FOUND - No RomImage.
  133. --*/
  134. ;
  135. #endif