]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPei.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / NvmExpressPei / NvmExpressPei.h
index 0135eca6f0489d848442108a4e3cdacfc956359c..6b2e2f032621dbae83e6372a1149459cc7e1993e 100644 (file)
@@ -4,14 +4,7 @@
 \r
   Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>\r
 \r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions\r
-  of the BSD License which accompanies this distribution.  The\r
-  full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -25,6 +18,7 @@
 #include <Ppi/NvmExpressHostController.h>\r
 #include <Ppi/BlockIo.h>\r
 #include <Ppi/BlockIo2.h>\r
+#include <Ppi/StorageSecurityCommand.h>\r
 #include <Ppi/IoMmu.h>\r
 #include <Ppi/EndOfPeiPhase.h>\r
 \r
@@ -44,6 +38,7 @@ typedef struct _PEI_NVME_CONTROLLER_PRIVATE_DATA  PEI_NVME_CONTROLLER_PRIVATE_DA
 #include "NvmExpressPeiHci.h"\r
 #include "NvmExpressPeiPassThru.h"\r
 #include "NvmExpressPeiBlockIo.h"\r
+#include "NvmExpressPeiStorageSecurity.h"\r
 \r
 //\r
 // NVME PEI driver implementation related definitions\r
@@ -90,10 +85,15 @@ struct _PEI_NVME_NAMESPACE_INFO {
 struct _PEI_NVME_CONTROLLER_PRIVATE_DATA {\r
   UINT32                                    Signature;\r
   UINTN                                     MmioBase;\r
+  UINTN                                     DevicePathLength;\r
+  EFI_DEVICE_PATH_PROTOCOL                  *DevicePath;\r
+\r
   EFI_PEI_RECOVERY_BLOCK_IO_PPI             BlkIoPpi;\r
   EFI_PEI_RECOVERY_BLOCK_IO2_PPI            BlkIo2Ppi;\r
+  EDKII_PEI_STORAGE_SECURITY_CMD_PPI        StorageSecurityPpi;\r
   EFI_PEI_PPI_DESCRIPTOR                    BlkIoPpiList;\r
   EFI_PEI_PPI_DESCRIPTOR                    BlkIo2PpiList;\r
+  EFI_PEI_PPI_DESCRIPTOR                    StorageSecurityPpiList;\r
   EFI_PEI_NOTIFY_DESCRIPTOR                 EndOfPeiNotifyList;\r
 \r
   //\r
@@ -139,11 +139,13 @@ struct _PEI_NVME_CONTROLLER_PRIVATE_DATA {
   PEI_NVME_NAMESPACE_INFO                   *NamespaceInfo;\r
 };\r
 \r
-#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO(a)     \\r
+#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO(a)               \\r
   CR (a, PEI_NVME_CONTROLLER_PRIVATE_DATA, BlkIoPpi, NVME_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)\r
-#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2(a)    \\r
+#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2(a)              \\r
   CR (a, PEI_NVME_CONTROLLER_PRIVATE_DATA, BlkIo2Ppi, NVME_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)\r
-#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a)    \\r
+#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY(a)    \\r
+  CR (a, PEI_NVME_CONTROLLER_PRIVATE_DATA, StorageSecurityPpi, NVME_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)\r
+#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a)              \\r
   CR (a, PEI_NVME_CONTROLLER_PRIVATE_DATA, EndOfPeiNotifyList, NVME_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)\r
 \r
 \r
@@ -257,4 +259,83 @@ NvmePeimEndOfPei (
   IN VOID                       *Ppi\r
   );\r
 \r
+/**\r
+  Get the size of the current device path instance.\r
+\r
+  @param[in]  DevicePath             A pointer to the EFI_DEVICE_PATH_PROTOCOL\r
+                                     structure.\r
+  @param[out] InstanceSize           The size of the current device path instance.\r
+  @param[out] EntireDevicePathEnd    Indicate whether the instance is the last\r
+                                     one in the device path strucure.\r
+\r
+  @retval EFI_SUCCESS    The size of the current device path instance is fetched.\r
+  @retval Others         Fails to get the size of the current device path instance.\r
+\r
+**/\r
+EFI_STATUS\r
+GetDevicePathInstanceSize (\r
+  IN  EFI_DEVICE_PATH_PROTOCOL    *DevicePath,\r
+  OUT UINTN                       *InstanceSize,\r
+  OUT BOOLEAN                     *EntireDevicePathEnd\r
+  );\r
+\r
+/**\r
+  Check the validity of the device path of a NVM Express host controller.\r
+\r
+  @param[in] DevicePath          A pointer to the EFI_DEVICE_PATH_PROTOCOL\r
+                                 structure.\r
+  @param[in] DevicePathLength    The length of the device path.\r
+\r
+  @retval EFI_SUCCESS              The device path is valid.\r
+  @retval EFI_INVALID_PARAMETER    The device path is invalid.\r
+\r
+**/\r
+EFI_STATUS\r
+NvmeIsHcDevicePathValid (\r
+  IN EFI_DEVICE_PATH_PROTOCOL    *DevicePath,\r
+  IN UINTN                       DevicePathLength\r
+  );\r
+\r
+/**\r
+  Build the device path for an Nvm Express device with given namespace identifier\r
+  and namespace extended unique identifier.\r
+\r
+  @param[in]  Private              A pointer to the PEI_NVME_CONTROLLER_PRIVATE_DATA\r
+                                   data structure.\r
+  @param[in]  NamespaceId          The given namespace identifier.\r
+  @param[in]  NamespaceUuid        The given namespace extended unique identifier.\r
+  @param[out] DevicePathLength     The length of the device path in bytes specified\r
+                                   by DevicePath.\r
+  @param[out] DevicePath           The device path of Nvm Express device.\r
+\r
+  @retval EFI_SUCCESS              The operation succeeds.\r
+  @retval EFI_INVALID_PARAMETER    The parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES     The operation fails due to lack of resources.\r
+\r
+**/\r
+EFI_STATUS\r
+NvmeBuildDevicePath (\r
+  IN  PEI_NVME_CONTROLLER_PRIVATE_DATA    *Private,\r
+  IN  UINT32                              NamespaceId,\r
+  IN  UINT64                              NamespaceUuid,\r
+  OUT UINTN                               *DevicePathLength,\r
+  OUT EFI_DEVICE_PATH_PROTOCOL            **DevicePath\r
+  );\r
+\r
+/**\r
+  Determine if a specific NVM Express controller can be skipped for S3 phase.\r
+\r
+  @param[in]  HcDevicePath          Device path of the controller.\r
+  @param[in]  HcDevicePathLength    Length of the device path specified by\r
+                                    HcDevicePath.\r
+\r
+  @retval    The number of ports that need to be enumerated.\r
+\r
+**/\r
+BOOLEAN\r
+NvmeS3SkipThisController (\r
+  IN  EFI_DEVICE_PATH_PROTOCOL    *HcDevicePath,\r
+  IN  UINTN                       HcDevicePathLength\r
+  );\r
+\r
 #endif\r