/* If this translation is successful, then that namespace ID is returned in NamespaceId, and EFI_SUCCESS is returned */
EFI_STATUS EFIAPI NvmExpressGetNamespace(IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINT32 *NamespaceId)
/* If this translation is successful, then that namespace ID is returned in NamespaceId, and EFI_SUCCESS is returned */
EFI_STATUS EFIAPI NvmExpressGetNamespace(IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINT32 *NamespaceId)
{
  NVME_NAMESPACE_DEVICE_PATH    *Node;
  NVME_CONTROLLER_PRIVATE_DATA  *Private;
  if ((This == NULL) || (DevicePath == NULL) || (NamespaceId == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  if (DevicePath->Type != MESSAGING_DEVICE_PATH) {
    return EFI_UNSUPPORTED;
  }
  Node    = (NVME_NAMESPACE_DEVICE_PATH *)DevicePath;
  Private = NVME_CONTROLLER_PRIVATE_DATA_FROM_PASS_THRU (This);
  if (DevicePath->SubType == MSG_NVME_NAMESPACE_DP) {
    if (DevicePathNodeLength (DevicePath) != sizeof (NVME_NAMESPACE_DEVICE_PATH)) {
      return EFI_NOT_FOUND;
    }
    if ((Node->NamespaceId == 0) ||
        (Node->NamespaceId > Private->ControllerData->Nn))
    {
      return EFI_NOT_FOUND;
    }
    *NamespaceId = Node->NamespaceId;
    return EFI_SUCCESS;
  } else {
    return EFI_UNSUPPORTED;
  }
}