Unverified Commit 88b3f3ff authored by Tianfei zhang's avatar Tianfei zhang Committed by Xu Yilun
Browse files

fpga: dfl: check feature type before parse irq info



Previously the feature IDs defined are unique, no matter
which feature type. But currently we want to extend its
usage to have a per-type feature ID space, so this patch
adds feature type checking as well just before look into
feature ID for different features which have irq info.

Signed-off-by: default avatarTianfei zhang <tianfei.zhang@intel.com>
Reviewed-by: default avatarMatthew Gerlach <matthew.gerlach@linux.intel.com>
Acked-by: default avatarWu Hao <hao.wu@intel.com>
Acked-by: default avatarMoritz Fischer <mdf@kernel.org>
Link: https://lore.kernel.org/r/20220419032942.427429-2-tianfei.zhang@intel.com


Signed-off-by: default avatarXu Yilun <yilun.xu@intel.com>
parent 838a8438
Loading
Loading
Loading
Loading
+22 −16
Original line number Diff line number Diff line
@@ -940,9 +940,12 @@ static int parse_feature_irqs(struct build_feature_devs_info *binfo,
{
	void __iomem *base = binfo->ioaddr + ofst;
	unsigned int i, ibase, inr = 0;
	enum dfl_id_type type;
	int virq;
	u64 v;

	type = feature_dev_id_type(binfo->feature_dev);

	/*
	 * Ideally DFL framework should only read info from DFL header, but
	 * current version DFL only provides mmio resources information for
@@ -957,6 +960,7 @@ static int parse_feature_irqs(struct build_feature_devs_info *binfo,
	 * code will be added. But in order to be compatible to old version
	 * DFL, the driver may still fall back to these quirks.
	 */
	if (type == PORT_ID) {
		switch (fid) {
		case PORT_FEATURE_ID_UINT:
			v = readq(base + PORT_UINT_CAP);
@@ -968,11 +972,13 @@ static int parse_feature_irqs(struct build_feature_devs_info *binfo,
			ibase = FIELD_GET(PORT_ERROR_CAP_INT_VECT, v);
			inr = FIELD_GET(PORT_ERROR_CAP_SUPP_INT, v);
			break;
	case FME_FEATURE_ID_GLOBAL_ERR:
		}
	} else if (type == FME_ID) {
		if (fid == FME_FEATURE_ID_GLOBAL_ERR) {
			v = readq(base + FME_ERROR_CAP);
			ibase = FIELD_GET(FME_ERROR_CAP_INT_VECT, v);
			inr = FIELD_GET(FME_ERROR_CAP_SUPP_INT, v);
		break;
		}
	}

	if (!inr) {