Skip to content

Commit 261da50

Browse files
matthew-gerlachRuss Weight
authored andcommitted
fpga: dfl: export fme and port error DFH revision to sysfs
With Intel OFS, the definition of the port error bits have changed to reflect the transition from CCI-P to AXI-S TLP. Export the DFH revision to sysfs so that user space can properly decode the port errors. Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
1 parent 3aacea9 commit 261da50

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

drivers/fpga/dfl-afu-error.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,24 @@ static ssize_t first_malformed_req_show(struct device *dev,
178178
}
179179
static DEVICE_ATTR_RO(first_malformed_req);
180180

181+
static ssize_t revision_show(struct device *dev, struct device_attribute *attr, char *buf)
182+
{
183+
void __iomem *base;
184+
u64 dfh;
185+
186+
base = dfl_get_feature_ioaddr_by_id(dev, PORT_FEATURE_ID_ERROR);
187+
188+
dfh = readq(base);
189+
190+
return sprintf(buf, "%lld\n", FIELD_GET(DFH_REVISION, dfh));
191+
}
192+
static DEVICE_ATTR_RO(revision);
193+
181194
static struct attribute *port_err_attrs[] = {
182195
&dev_attr_errors.attr,
183196
&dev_attr_first_error.attr,
184197
&dev_attr_first_malformed_req.attr,
198+
&dev_attr_revision.attr,
185199
NULL,
186200
};
187201

drivers/fpga/dfl-fme-error.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,19 @@ static ssize_t next_error_show(struct device *dev,
279279
}
280280
static DEVICE_ATTR_RO(next_error);
281281

282+
static ssize_t revision_show(struct device *dev, struct device_attribute *attr, char *buf)
283+
{
284+
void __iomem *base;
285+
u64 dfh;
286+
287+
base = dfl_get_feature_ioaddr_by_id(dev, FME_FEATURE_ID_GLOBAL_ERR);
288+
289+
dfh = readq(base);
290+
291+
return sprintf(buf, "%lld\n", FIELD_GET(DFH_REVISION, dfh));
292+
}
293+
static DEVICE_ATTR_RO(revision);
294+
282295
static struct attribute *fme_global_err_attrs[] = {
283296
&dev_attr_pcie0_errors.attr,
284297
&dev_attr_pcie1_errors.attr,
@@ -288,6 +301,7 @@ static struct attribute *fme_global_err_attrs[] = {
288301
&dev_attr_fme_errors.attr,
289302
&dev_attr_first_error.attr,
290303
&dev_attr_next_error.attr,
304+
&dev_attr_revision.attr,
291305
NULL,
292306
};
293307

0 commit comments

Comments
 (0)