aboutsummaryrefslogtreecommitdiff
path: root/external/opal-prd
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2016-09-15 09:52:32 +0800
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-09-16 16:21:45 +1000
commit925f03c184f42104a1ebd676f4d3c3d50b8a44b8 (patch)
treebc8aef4cea03564ab8bfd1aadb15f50d3382fcfd /external/opal-prd
parent3d41d2831a05d531f152e0f9c7fc223a82aee128 (diff)
downloadskiboot-925f03c184f42104a1ebd676f4d3c3d50b8a44b8.zip
skiboot-925f03c184f42104a1ebd676f4d3c3d50b8a44b8.tar.gz
skiboot-925f03c184f42104a1ebd676f4d3c3d50b8a44b8.tar.bz2
opal-prd: Fix error code from scom_read & scom_write
Currently, we always return a zero value from scom_read & scom_write, so the HBRT implementation has no way of detecting errors during scom operations. This change uses the actual return value from the scom operation from the kernel instead. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external/opal-prd')
-rw-r--r--external/opal-prd/hostboot-interface.h8
-rw-r--r--external/opal-prd/opal-prd.c17
2 files changed, 19 insertions, 6 deletions
diff --git a/external/opal-prd/hostboot-interface.h b/external/opal-prd/hostboot-interface.h
index 36d53a6..3e73ef8 100644
--- a/external/opal-prd/hostboot-interface.h
+++ b/external/opal-prd/hostboot-interface.h
@@ -46,6 +46,14 @@ enum MemoryError_t
#define HBRT_CAPS_SET1_OPAL 1
#define HBRT_CAPS_SET2_PHYP 2
+/* Capability flags */
+
+/**
+ * xscom_read and xscom_write return proper return codes on error.
+ * Previous implementations may have incorrectly ignored failures.
+ */
+#define HBRT_CAPS_OPAL_HAS_XSCOM_RC (1ul << 0)
+
struct host_interfaces {
/** Interface version. */
uint64_t interface_version;
diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c
index 245c957..56943c4 100644
--- a/external/opal-prd/opal-prd.c
+++ b/external/opal-prd/opal-prd.c
@@ -297,13 +297,14 @@ int hservice_scom_read(uint64_t chip_id, uint64_t addr, void *buf)
"failed: %m", chip_id, addr);
return 0;
}
+ rc = (int)scom.rc;
- pr_debug("SCOM: read: chip 0x%lx, addr 0x%lx, val 0x%lx",
- chip_id, addr, scom.data);
+ pr_debug("SCOM: read: chip 0x%lx, addr 0x%lx, val 0x%lx, rc %d",
+ chip_id, addr, scom.data, rc);
*(uint64_t *)buf = htobe64(scom.data);
- return 0;
+ return rc;
}
int hservice_scom_write(uint64_t chip_id, uint64_t addr,
@@ -322,11 +323,12 @@ int hservice_scom_write(uint64_t chip_id, uint64_t addr,
"failed: %m", chip_id, addr);
return 0;
}
+ rc = (int)scom.rc;
- pr_debug("SCOM: write: chip 0x%lx, addr 0x%lx, val 0x%lx",
- chip_id, addr, scom.data);
+ pr_debug("SCOM: write: chip 0x%lx, addr 0x%lx, val 0x%lx, rc %d",
+ chip_id, addr, scom.data, rc);
- return 0;
+ return rc;
}
uint64_t hservice_get_reserved_mem(const char *name, uint32_t instance)
@@ -651,6 +653,9 @@ int hservice_memory_error(uint64_t i_start_addr, uint64_t i_endAddr,
uint64_t hservice_get_interface_capabilities(uint64_t set)
{
+ if (set == HBRT_CAPS_SET1_OPAL)
+ return HBRT_CAPS_OPAL_HAS_XSCOM_RC;
+
return 0;
}