]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
MdeModulePkg/PciHostBridge: Move declaration of mIoMmu to header file
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciHostBridgeDxe / PciRootBridge.h
index 2915981ea5536f9773052114bf84fac3039690c3..e8513c906f82a5b462ed85a9226cb54323aaa98e 100644 (file)
@@ -2,7 +2,7 @@
 \r
   The PCI Root Bridge header file.\r
 \r
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -23,7 +23,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //\r
 // Driver Consumed Protocol Prototypes\r
 //\r
-#include <Protocol/Metronome.h>\r
 #include <Protocol/CpuIo2.h>\r
 #include <Protocol/DevicePath.h>\r
 #include <Protocol/PciRootBridgeIo.h>\r
@@ -34,6 +33,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/PciSegmentLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/TimerLib.h>\r
 #include "PciHostResource.h"\r
 \r
 \r
@@ -72,6 +73,7 @@ typedef struct {
   PCI_ROOT_BRIDGE_APERTURE          MemAbove4G;\r
   PCI_ROOT_BRIDGE_APERTURE          PMemAbove4G;\r
   BOOLEAN                           DmaAbove4G;\r
+  BOOLEAN                           NoExtendedConfigSpace;\r
   VOID                              *ConfigBuffer;\r
   EFI_DEVICE_PATH_PROTOCOL          *DevicePath;\r
   CHAR16                            *DevicePathStr;\r
@@ -86,20 +88,16 @@ typedef struct {
 #define ROOT_BRIDGE_FROM_LINK(a) CR (a, PCI_ROOT_BRIDGE_INSTANCE, Link, PCI_ROOT_BRIDGE_SIGNATURE)\r
 \r
 /**\r
+  Construct the Pci Root Bridge instance.\r
 \r
-  Construct the Pci Root Bridge Io protocol.\r
-\r
-  @param Protocol          -  Protocol to initialize.\r
-  @param HostBridgeHandle  -  Handle to the HostBridge.\r
-\r
-  @retval EFI_SUCCESS  -  Success.\r
-  @retval Others       -  Fail.\r
+  @param Bridge            The root bridge instance.\r
 \r
+  @return The pointer to PCI_ROOT_BRIDGE_INSTANCE just created\r
+          or NULL if creation fails.\r
 **/\r
 PCI_ROOT_BRIDGE_INSTANCE *\r
 CreateRootBridge (\r
-  IN PCI_ROOT_BRIDGE       *Bridge,\r
-  IN EFI_HANDLE            HostBridgeHandle\r
+  IN PCI_ROOT_BRIDGE       *Bridge\r
   );\r
 \r
 //\r
@@ -359,30 +357,25 @@ RootBridgeIoPciWrite (
 ;\r
 \r
 /**\r
-\r
   Provides the PCI controller-specific address needed to access\r
   system memory for DMA.\r
 \r
-  @param This           -  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
-  @param Operation      -  Indicate if the bus master is going to read or write\r
-                           to system memory.\r
-  @param HostAddress    -  The system memory address to map on the PCI controller.\r
-  @param NumberOfBytes  -  On input the number of bytes to map.\r
-                           On output the number of bytes that were mapped.\r
-  @param DeviceAddress  -  The resulting map address for the bus master PCI\r
-                           controller to use to access the system memory's HostAddress.\r
-  @param Mapping        -  The value to pass to Unmap() when the bus master DMA\r
-                           operation is complete.\r
-\r
-  @retval EFI_SUCCESS            -  Success.\r
-  @retval EFI_INVALID_PARAMETER  -  Invalid parameters found.\r
-  @retval EFI_UNSUPPORTED        -  The HostAddress cannot be mapped as a common\r
-                            @retval buffer.\r
-  @retval EFI_DEVICE_ERROR       -  The System hardware could not map the requested\r
-                            @retval address.\r
-  @retval EFI_OUT_OF_RESOURCES   -  The request could not be completed due to\r
-                            @retval lack of resources.\r
-\r
+  @param This           A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param Operation      Indicate if the bus master is going to read or write\r
+                        to system memory.\r
+  @param HostAddress    The system memory address to map on the PCI controller.\r
+  @param NumberOfBytes  On input the number of bytes to map.\r
+                        On output the number of bytes that were mapped.\r
+  @param DeviceAddress  The resulting map address for the bus master PCI\r
+                        controller to use to access the system memory's HostAddress.\r
+  @param Mapping        The value to pass to Unmap() when the bus master DMA\r
+                        operation is complete.\r
+\r
+  @retval EFI_SUCCESS            Success.\r
+  @retval EFI_INVALID_PARAMETER  Invalid parameters found.\r
+  @retval EFI_UNSUPPORTED        The HostAddress cannot be mapped as a common buffer.\r
+  @retval EFI_DEVICE_ERROR       The System hardware could not map the requested address.\r
+  @retval EFI_OUT_OF_RESOURCES   The request could not be completed due to lack of resources.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -397,18 +390,21 @@ RootBridgeIoMap (
 ;\r
 \r
 /**\r
-\r
   Completes the Map() operation and releases any corresponding resources.\r
 \r
-  @param This     -  Pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.\r
-  Mapping  -  The value returned from Map() operation.\r
+  The Unmap() function completes the Map() operation and releases any\r
+  corresponding resources.\r
+  If the operation was an EfiPciOperationBusMasterWrite or\r
+  EfiPciOperationBusMasterWrite64, the data is committed to the target system\r
+  memory.\r
+  Any resources used for the mapping are freed.\r
 \r
-  @retval EFI_SUCCESS            -  The range was unmapped successfully.\r
-  @retval EFI_INVALID_PARAMETER  -  Mapping is not a value that was returned\r
-                            @retval by Map operation.\r
-  @retval EFI_DEVICE_ERROR       -  The data was not committed to the target\r
-                            @retval system memory.\r
+  @param[in] This      A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param[in] Mapping   The mapping value returned from Map().\r
 \r
+  @retval EFI_SUCCESS            The range was unmapped.\r
+  @retval EFI_INVALID_PARAMETER  Mapping is not a value that was returned by Map().\r
+  @retval EFI_DEVICE_ERROR       The data was not committed to the target system memory.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -419,22 +415,30 @@ RootBridgeIoUnmap (
 ;\r
 \r
 /**\r
-\r
-  Allocates pages that are suitable for a common buffer mapping.\r
-\r
-  @param This         -  Pointer to EFI_ROOT_BRIDGE_IO_PROTOCOL instance.\r
-  @param Type         -  Not used and can be ignored.\r
-  @param MemoryType   -  Type of memory to allocate.\r
-  @param Pages        -  Number of pages to allocate.\r
-  @param HostAddress  -  Pointer to store the base system memory address\r
-                         of the allocated range.\r
-  @param Attributes   -  Requested bit mask of attributes of the allocated\r
-                         range.\r
-\r
-  @retval EFI_SUCCESS            -  The requested memory range were allocated.\r
-  @retval EFI_INVALID_PARAMETER  -  Invalid parameter found.\r
-  @retval EFI_UNSUPPORTED        -  Attributes is unsupported.\r
-\r
+  Allocates pages that are suitable for an EfiPciOperationBusMasterCommonBuffer\r
+  or EfiPciOperationBusMasterCommonBuffer64 mapping.\r
+\r
+  @param This        A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param Type        This parameter is not used and must be ignored.\r
+  @param MemoryType  The type of memory to allocate, EfiBootServicesData or\r
+                     EfiRuntimeServicesData.\r
+  @param Pages       The number of pages to allocate.\r
+  @param HostAddress A pointer to store the base system memory address of the\r
+                     allocated range.\r
+  @param Attributes  The requested bit mask of attributes for the allocated\r
+                     range. Only the attributes\r
+                     EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE,\r
+                     EFI_PCI_ATTRIBUTE_MEMORY_CACHED, and\r
+                     EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE may be used with this\r
+                     function.\r
+\r
+  @retval EFI_SUCCESS            The requested memory pages were allocated.\r
+  @retval EFI_INVALID_PARAMETER  MemoryType is invalid.\r
+  @retval EFI_INVALID_PARAMETER  HostAddress is NULL.\r
+  @retval EFI_UNSUPPORTED        Attributes is unsupported. The only legal\r
+                                 attribute bits are MEMORY_WRITE_COMBINE,\r
+                                 MEMORY_CACHED, and DUAL_ADDRESS_CYCLE.\r
+  @retval EFI_OUT_OF_RESOURCES   The memory pages could not be allocated.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -491,19 +495,26 @@ RootBridgeIoFlush (
 ;\r
 \r
 /**\r
-\r
-  Get the attributes that a PCI root bridge supports and\r
-  the attributes the PCI root bridge is currently using.\r
-\r
-  @param This        -  Pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL\r
-                        instance.\r
-  @param Supports    -  A pointer to the mask of attributes that\r
-                        this PCI root bridge supports.\r
-  @param Attributes  -  A pointer to the mask of attributes that\r
-                        this PCI root bridge is currently using.\r
-  @retval EFI_SUCCESS            -  Success.\r
-  @retval EFI_INVALID_PARAMETER  -  Invalid parameter found.\r
-\r
+  Gets the attributes that a PCI root bridge supports setting with\r
+  SetAttributes(), and the attributes that a PCI root bridge is currently\r
+  using.\r
+\r
+  The GetAttributes() function returns the mask of attributes that this PCI\r
+  root bridge supports and the mask of attributes that the PCI root bridge is\r
+  currently using.\r
+\r
+  @param This        A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param Supported   A pointer to the mask of attributes that this PCI root\r
+                     bridge supports setting with SetAttributes().\r
+  @param Attributes  A pointer to the mask of attributes that this PCI root\r
+                     bridge is currently using.\r
+\r
+  @retval  EFI_SUCCESS           If Supports is not NULL, then the attributes\r
+                                 that the PCI root bridge supports is returned\r
+                                 in Supports. If Attributes is not NULL, then\r
+                                 the attributes that the PCI root bridge is\r
+                                 currently using is returned in Attributes.\r
+  @retval  EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -542,10 +553,10 @@ RootBridgeIoSetAttributes (
 /**\r
 \r
   Retrieves the current resource settings of this PCI root bridge\r
-  in the form of a set of ACPI 2.0 resource descriptor.\r
+  in the form of a set of ACPI resource descriptor.\r
 \r
   @param This       -  Pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.\r
-  @param Resources  -  Pointer to the ACPI 2.0 resource descriptor that\r
+  @param Resources  -  Pointer to the resource descriptor that\r
                        describe the current configuration of this PCI root\r
                        bridge.\r
 \r
@@ -562,7 +573,5 @@ RootBridgeIoConfiguration (
   )\r
 ;\r
 \r
-\r
-extern EFI_METRONOME_ARCH_PROTOCOL *mMetronome;\r
 extern EFI_CPU_IO2_PROTOCOL         *mCpuIo;\r
 #endif\r