]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.h
MdeModulePkg/NvmExpressPei: Use PCI_DEVICE_PPI to manage Nvme device
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / NvmExpressPei / NvmExpressPei.h
index 78a6b7016503b8a19d678c2d50fd7fef9122275f..12a7624099c0696bfbcb0aedad34bc658170dcea 100644 (file)
@@ -14,6 +14,7 @@
 #include <PiPei.h>\r
 \r
 #include <IndustryStandard/Nvme.h>\r
+#include <IndustryStandard/Pci.h>\r
 \r
 #include <Ppi/NvmExpressHostController.h>\r
 #include <Ppi/BlockIo.h>\r
@@ -22,6 +23,7 @@
 #include <Ppi/NvmExpressPassThru.h>\r
 #include <Ppi/IoMmu.h>\r
 #include <Ppi/EndOfPeiPhase.h>\r
+#include <Ppi/PciDevice.h>\r
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/PeiServicesLib.h>\r
@@ -29,6 +31,7 @@
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/IoLib.h>\r
 #include <Library/TimerLib.h>\r
+#include <Library/DevicePathLib.h>\r
 \r
 //\r
 // Structure forward declarations\r
 typedef struct _PEI_NVME_NAMESPACE_INFO           PEI_NVME_NAMESPACE_INFO;\r
 typedef struct _PEI_NVME_CONTROLLER_PRIVATE_DATA  PEI_NVME_CONTROLLER_PRIVATE_DATA;\r
 \r
+/**\r
+  Macro that checks whether device is a NVMHCI Interface.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a NVMHCI Interface.\r
+  @retval FALSE   Device is not a NVMHCI Interface.\r
+\r
+**/\r
+#define IS_PCI_NVMHCI(_p)  IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_SOLID_STATE, PCI_IF_MASS_STORAGE_SOLID_STATE_ENTERPRISE_NVMHCI)\r
+\r
 #include "NvmExpressPeiHci.h"\r
 #include "NvmExpressPeiPassThru.h"\r
 #include "NvmExpressPeiBlockIo.h"\r
@@ -345,4 +359,44 @@ NvmeS3SkipThisController (
   IN  UINTN                     HcDevicePathLength\r
   );\r
 \r
+/**\r
+  Callback for EDKII_PCI_DEVICE_PPI installation.\r
+\r
+  @param[in] PeiServices         Pointer to PEI Services Table.\r
+  @param[in] NotifyDescriptor    Pointer to the descriptor for the Notification\r
+                                 event that caused this function to execute.\r
+  @param[in] Ppi                 Pointer to the PPI data associated with this function.\r
+\r
+  @retval EFI_SUCCESS            The function completes successfully\r
+  @retval Others                 Cannot initialize Nvme controller from given PCI_DEVICE_PPI\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+NvmePciDevicePpiInstallationCallback (\r
+  IN EFI_PEI_SERVICES           **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,\r
+  IN VOID                       *Ppi\r
+  );\r
+\r
+/**\r
+  Callback for EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI installation.\r
+\r
+  @param[in] PeiServices         Pointer to PEI Services Table.\r
+  @param[in] NotifyDescriptor    Pointer to the descriptor for the Notification\r
+                                 event that caused this function to execute.\r
+  @param[in] Ppi                 Pointer to the PPI data associated with this function.\r
+\r
+  @retval EFI_SUCCESS            The function completes successfully\r
+  @retval Others                 Cannot initialize Nvme controller from given EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+NvmeHostControllerPpiInstallationCallback (\r
+  IN EFI_PEI_SERVICES           **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,\r
+  IN VOID                       *Ppi\r
+  );\r
+\r
 #endif\r