From c51e33b6a7b21ea3cc1230838d95d5428396be3b Mon Sep 17 00:00:00 2001
From: Xin Tian <tianx@yunsilicon.com>
Date: Thu, 20 Mar 2025 15:33:54 +0800
Subject: [PATCH] libxscale: Match dev by vid and did

Match dev by vid and did.

Signed-off-by: Xin Tian <tianx@yunsilicon.com>
---
 providers/xscale/xscale.c | 20 +++++++++++++++-----
 providers/xscale/xscale.h | 18 ++++++++++++++++++
 2 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/providers/xscale/xscale.c b/providers/xscale/xscale.c
index e6792b9..e24cfd2 100644
--- a/providers/xscale/xscale.c
+++ b/providers/xscale/xscale.c
@@ -23,10 +23,6 @@
 #include "wqe.h"
 #include "xsc_hsi.h"
 
-#ifndef PCI_VENDOR_ID_MELLANOX
-#define PCI_VENDOR_ID_MELLANOX			0x15b3
-#endif
-
 #ifndef CPU_OR
 #define CPU_OR(x, y, z) do {} while (0)
 #endif
@@ -35,9 +31,23 @@
 #define CPU_EQUAL(x, y) 1
 #endif
 
-#define HCA(v, d) VERBS_PCI_MATCH(PCI_VENDOR_ID_##v, d, NULL)
 static const struct verbs_match_ent hca_table[] = {
 	VERBS_MODALIAS_MATCH("*xscale*", NULL),
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MC_PF_DEV_ID, NULL),
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MC_VF_DEV_ID, NULL),
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MC_PF_DEV_ID_DIAMOND, NULL),
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MC_PF_DEV_ID_DIAMOND_NEXT, NULL),
+
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MF_HOST_PF_DEV_ID, NULL),
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MF_HOST_VF_DEV_ID, NULL),
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MF_SOC_PF_DEV_ID, NULL),
+
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MS_PF_DEV_ID, NULL),
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MS_VF_DEV_ID, NULL),
+
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MV_HOST_PF_DEV_ID, NULL),
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MV_HOST_VF_DEV_ID, NULL),
+	VERBS_PCI_MATCH(XSC_PCI_VENDOR_ID, XSC_MV_SOC_PF_DEV_ID, NULL),
 	{}
 };
 
diff --git a/providers/xscale/xscale.h b/providers/xscale/xscale.h
index 0aee472..c6cc9f7 100644
--- a/providers/xscale/xscale.h
+++ b/providers/xscale/xscale.h
@@ -171,6 +171,24 @@ struct xsc_spinlock {
 	int				need_lock;
 };
 
+#define XSC_PCI_VENDOR_ID		0x1f67
+
+#define XSC_MC_PF_DEV_ID		0x1011
+#define XSC_MC_VF_DEV_ID		0x1012
+#define XSC_MC_PF_DEV_ID_DIAMOND	0x1021
+#define XSC_MC_PF_DEV_ID_DIAMOND_NEXT	0x1023
+
+#define XSC_MF_HOST_PF_DEV_ID		0x1051
+#define XSC_MF_HOST_VF_DEV_ID		0x1052
+#define XSC_MF_SOC_PF_DEV_ID		0x1053
+
+#define XSC_MS_PF_DEV_ID		0x1111
+#define XSC_MS_VF_DEV_ID		0x1112
+
+#define XSC_MV_HOST_PF_DEV_ID		0x1151
+#define XSC_MV_HOST_VF_DEV_ID		0x1152
+#define XSC_MV_SOC_PF_DEV_ID		0x1153
+
 /* PAGE_SHIFT determines the page size */
 
 #define PAGE_SHIFT	12
-- 
2.25.1

