diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2018-10-09 00:32:32 -0700 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-10-31 16:49:21 +1100 |
commit | ae947a88fec95fb42816fbbbbb13784bbdd67cff (patch) | |
tree | 9e588887e1bf1b03fe4942d4b74cc93374817b63 /platforms | |
parent | 8b8dbd4e3353db19a5b2500a5602cf01873daf6e (diff) | |
download | skiboot-ae947a88fec95fb42816fbbbbb13784bbdd67cff.zip skiboot-ae947a88fec95fb42816fbbbbb13784bbdd67cff.tar.gz skiboot-ae947a88fec95fb42816fbbbbb13784bbdd67cff.tar.bz2 |
astbmc: Prefer ipmi-hiomap for PNOR access
[ Upstream commit b5edb1692b7f6af1a60758f4f63f52f795b5dba0 ]
If the IPMI command is not available, fall back to the mailbox
interface.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
[stewart: fix up mbox test]
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'platforms')
-rw-r--r-- | platforms/astbmc/common.c | 10 | ||||
-rw-r--r-- | platforms/astbmc/pnor.c | 42 |
2 files changed, 38 insertions, 14 deletions
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c index 68ea5d0..836b05c 100644 --- a/platforms/astbmc/common.c +++ b/platforms/astbmc/common.c @@ -120,11 +120,15 @@ static int astbmc_fru_init(void) void astbmc_init(void) { + /* Register the BT interface with the IPMI layer + * + * Initialise this first to enable PNOR access + */ + bt_init(); + /* Initialize PNOR/NVRAM */ pnor_init(); - /* Register the BT interface with the IPMI layer */ - bt_init(); /* Initialize elog */ elog_init(); ipmi_sel_init(); @@ -431,8 +435,6 @@ void astbmc_early_init(void) /* Setup UART and use it as console */ uart_init(); - mbox_init(); - prd_init(); } diff --git a/platforms/astbmc/pnor.c b/platforms/astbmc/pnor.c index 55784ee..d269476 100644 --- a/platforms/astbmc/pnor.c +++ b/platforms/astbmc/pnor.c @@ -18,6 +18,7 @@ #include <device.h> #include <console.h> #include <opal.h> +#include <libflash/ipmi-hiomap.h> #include <libflash/mbox-flash.h> #include <libflash/libflash.h> #include <libflash/libffs.h> @@ -26,16 +27,27 @@ #include "astbmc.h" +enum ast_flash_style { + raw_flash, + raw_mem, + ipmi_hiomap, + mbox_hiomap, +}; + int pnor_init(void) { struct spi_flash_ctrl *pnor_ctrl = NULL; struct blocklevel_device *bl = NULL; + enum ast_flash_style style; int rc; - bool do_mbox; - do_mbox = ast_lpc_fw_is_mbox(); - if (do_mbox) { - rc = mbox_flash_init(&bl); + if (ast_lpc_fw_needs_hiomap()) { + style = ipmi_hiomap; + rc = ipmi_hiomap_init(&bl); + if (rc) { + style = mbox_hiomap; + rc = mbox_flash_init(&bl); + } } else { /* Open controller and flash. If the LPC->AHB doesn't point to * the PNOR flash base we assume we're booting from BMC system @@ -43,10 +55,12 @@ int pnor_init(void) * FW reads & writes). */ - if (ast_lpc_fw_is_flash()) + if (ast_lpc_fw_maps_flash()) { + style = raw_flash; rc = ast_sf_open(AST_SF_TYPE_PNOR, &pnor_ctrl); - else { + } else { printf("PLAT: Memboot detected\n"); + style = raw_mem; rc = ast_sf_open(AST_SF_TYPE_MEM, &pnor_ctrl); } if (rc) { @@ -66,12 +80,20 @@ int pnor_init(void) if (!rc) return 0; - fail: +fail: if (bl) { - if (do_mbox) - mbox_flash_exit(bl); - else + switch (style) { + case raw_flash: + case raw_mem: flash_exit(bl); + break; + case ipmi_hiomap: + ipmi_hiomap_exit(bl); + break; + case mbox_hiomap: + mbox_flash_exit(bl); + break; + } } if (pnor_ctrl) ast_sf_close(pnor_ctrl); |