[v3,11/11] astbmc: Fail SFC init if SIO is unavailable

Message ID 20181009073237.16251-12-andrew@aj.id.au
State Accepted
Headers show
  • Add and integrate an IPMI flash implementation
Related show


Context Check Description
snowpatch_ozlabs/make_check success Test make_check on branch master
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied

Commit Message

Andrew Jeffery Oct. 9, 2018, 7:32 a.m.
If SuperIO is unavailable then the driver cannot perform accesses on
which it currently depends. Test for SuperIO availability during
initialsation and bail out immediately if it is absent.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
 hw/ast-bmc/ast-sf-ctrl.c | 3 +++
 1 file changed, 3 insertions(+)


diff --git a/hw/ast-bmc/ast-sf-ctrl.c b/hw/ast-bmc/ast-sf-ctrl.c
index 32fc63ae33d6..11eb30f5619e 100644
--- a/hw/ast-bmc/ast-sf-ctrl.c
+++ b/hw/ast-bmc/ast-sf-ctrl.c
@@ -948,6 +948,9 @@  int ast_sf_open(uint8_t type, struct spi_flash_ctrl **ctrl)
 	struct ast_sf_ctrl *ct;
 #ifdef __SKIBOOT__
 	uint32_t hicr7;
+	if (!ast_sio_is_enabled())
+		return -ENODEV;
 #endif /* __SKIBOOT__ */
 	if (type != AST_SF_TYPE_PNOR && type != AST_SF_TYPE_BMC