mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
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: Tianfei zhang <tianfei.zhang@intel.com> Reviewed-by: Matthew Gerlach <matthew.gerlach@linux.intel.com> Acked-by: Wu Hao <hao.wu@intel.com> Acked-by: Moritz Fischer <mdf@kernel.org> Link: https://lore.kernel.org/r/20220419032942.427429-2-tianfei.zhang@intel.com Signed-off-by: Xu Yilun <yilun.xu@intel.com>
This commit is contained in:
parent
838a84382a
commit
88b3f3ff38
1 changed files with 22 additions and 16 deletions
|
@ -940,9 +940,12 @@ static int parse_feature_irqs(struct build_feature_devs_info *binfo,
|
||||||
{
|
{
|
||||||
void __iomem *base = binfo->ioaddr + ofst;
|
void __iomem *base = binfo->ioaddr + ofst;
|
||||||
unsigned int i, ibase, inr = 0;
|
unsigned int i, ibase, inr = 0;
|
||||||
|
enum dfl_id_type type;
|
||||||
int virq;
|
int virq;
|
||||||
u64 v;
|
u64 v;
|
||||||
|
|
||||||
|
type = feature_dev_id_type(binfo->feature_dev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ideally DFL framework should only read info from DFL header, but
|
* Ideally DFL framework should only read info from DFL header, but
|
||||||
* current version DFL only provides mmio resources information for
|
* current version DFL only provides mmio resources information for
|
||||||
|
@ -957,22 +960,25 @@ static int parse_feature_irqs(struct build_feature_devs_info *binfo,
|
||||||
* code will be added. But in order to be compatible to old version
|
* code will be added. But in order to be compatible to old version
|
||||||
* DFL, the driver may still fall back to these quirks.
|
* DFL, the driver may still fall back to these quirks.
|
||||||
*/
|
*/
|
||||||
switch (fid) {
|
if (type == PORT_ID) {
|
||||||
case PORT_FEATURE_ID_UINT:
|
switch (fid) {
|
||||||
v = readq(base + PORT_UINT_CAP);
|
case PORT_FEATURE_ID_UINT:
|
||||||
ibase = FIELD_GET(PORT_UINT_CAP_FST_VECT, v);
|
v = readq(base + PORT_UINT_CAP);
|
||||||
inr = FIELD_GET(PORT_UINT_CAP_INT_NUM, v);
|
ibase = FIELD_GET(PORT_UINT_CAP_FST_VECT, v);
|
||||||
break;
|
inr = FIELD_GET(PORT_UINT_CAP_INT_NUM, v);
|
||||||
case PORT_FEATURE_ID_ERROR:
|
break;
|
||||||
v = readq(base + PORT_ERROR_CAP);
|
case PORT_FEATURE_ID_ERROR:
|
||||||
ibase = FIELD_GET(PORT_ERROR_CAP_INT_VECT, v);
|
v = readq(base + PORT_ERROR_CAP);
|
||||||
inr = FIELD_GET(PORT_ERROR_CAP_SUPP_INT, v);
|
ibase = FIELD_GET(PORT_ERROR_CAP_INT_VECT, v);
|
||||||
break;
|
inr = FIELD_GET(PORT_ERROR_CAP_SUPP_INT, v);
|
||||||
case FME_FEATURE_ID_GLOBAL_ERR:
|
break;
|
||||||
v = readq(base + FME_ERROR_CAP);
|
}
|
||||||
ibase = FIELD_GET(FME_ERROR_CAP_INT_VECT, v);
|
} else if (type == FME_ID) {
|
||||||
inr = FIELD_GET(FME_ERROR_CAP_SUPP_INT, v);
|
if (fid == FME_FEATURE_ID_GLOBAL_ERR) {
|
||||||
break;
|
v = readq(base + FME_ERROR_CAP);
|
||||||
|
ibase = FIELD_GET(FME_ERROR_CAP_INT_VECT, v);
|
||||||
|
inr = FIELD_GET(FME_ERROR_CAP_SUPP_INT, v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inr) {
|
if (!inr) {
|
||||||
|
|
Loading…
Reference in a new issue