diff options
author | Cyril Bur <cyril.bur@au1.ibm.com> | 2017-12-01 14:53:07 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-11-30 23:45:45 -0600 |
commit | 92813a8bf9f3658dac5315c0c02025b74a8b0533 (patch) | |
tree | 3f06738611476b2cc7108ab5106a07027c3381d0 /hw/fsp | |
parent | ac685bccd8899b6021f6441551e845151a9a1b94 (diff) | |
download | skiboot-92813a8bf9f3658dac5315c0c02025b74a8b0533.zip skiboot-92813a8bf9f3658dac5315c0c02025b74a8b0533.tar.gz skiboot-92813a8bf9f3658dac5315c0c02025b74a8b0533.tar.bz2 |
nvram: Fix 'missing' nvram on FSP systems.
commit ba4d46fdd9eb ("console: Set log level from nvram") wants to read
from NVRAM rather early. This works fine on BMC based systems as
nvram_init() is actually synchronous. This is not true for FSP systems
and it turns out that the query for the console log level simply
queries blank nvram.
The simple fix is to wait for the NVRAM read to complete before
performing any query. Unfortunately it turns out that the fsp-nvram
code does not inform the generic NVRAM layer when the read is complete,
rather, it must be prompted to do so.
This patch addresses both these problems. This patch adds a check before
the first read of the NVRAM (for the console log level) that the read
has completed. The fsp-nvram code has been updated to inform the generic
layer as soon as the read completes.
The old prompt to the fsp-nvram code has been removed but a check to
ensure that the NVRAM has been loaded remains. It is conservative but
if the NVRAM is not done loading before the host is booted it will not
have an nvram device-tree node which means it won't be able to access
the NVRAM at all, ever, even after the NVRAM has loaded.
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/fsp')
-rw-r--r-- | hw/fsp/fsp-nvram.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/hw/fsp/fsp-nvram.c b/hw/fsp/fsp-nvram.c index 1b4990f..eef535c 100644 --- a/hw/fsp/fsp-nvram.c +++ b/hw/fsp/fsp-nvram.c @@ -203,6 +203,10 @@ static void fsp_nvram_rd_complete(struct fsp_msg *msg) */ } unlock(&fsp_nvram_lock); + nvram_read_complete(fsp_nvram_state == NVRAM_STATE_OPEN); + if (fsp_nvram_state != NVRAM_STATE_OPEN) + log_simple_error(&e_info(OPAL_RC_NVRAM_INIT), + "FSP: NVRAM not read, skipping init\n"); } static void fsp_nvram_send_read(void) @@ -428,27 +432,3 @@ int fsp_nvram_write(uint32_t offset, void *src, uint32_t size) return 0; } - -/* This is called right before starting the payload (Linux) to - * ensure the initial open & read of nvram has happened before - * we transfer control as the guest OS. This is necessary as - * Linux will not handle a OPAL_BUSY return properly and treat - * it as an error - */ -void fsp_nvram_wait_open(void) -{ - if (!fsp_present()) - return; - - while(fsp_nvram_state == NVRAM_STATE_OPENING) - opal_run_pollers(); - - if (!fsp_nvram_was_read) { - log_simple_error(&e_info(OPAL_RC_NVRAM_INIT), - "FSP: NVRAM not read, skipping init\n"); - nvram_read_complete(false); - return; - } - - nvram_read_complete(true); -} |