Age | Commit message (Collapse) | Author | Files | Lines |
|
flash_find_subpartition() accepts a pointer to a boolean variable
indicating ecc for a region of flash and passes the pointer directly
to flash_read_corrected() which actually only wants the value. This
has always worked probably because there has always been ECC on
sub partitions.
How there aren't any warnings triggered by this condition escapes me.
Fixes: 6c26bc7 ("libflash: move ffs_flash_read into libflash")
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Convert flashes from a static array which wastes memory and limits us.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Was causing boot failures on Garrison and Firestone (likely other
OpenPower platforms)
This reverts commit 74ba83462c64d6a987ed4785aee55309daf9ffb6.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
flash_read_corrected() assumes the passed blocklevel device is an
actual flash device. However the blocklevel flash abstraction supports
automatically reading ECC protected data so use that instead.
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Increase the max number of flash devices from 1 to 8.
With mambo bogusdisk, we can have many flash devices.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
wwhich -> which.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This change adds a few fwts patterns to the flash code, mostly as an
example of the annotations we have.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
...to make it consistent with rest of the includes from libflash.
Suggested-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Passing a flag on libffs init will register all regions of the flash with
ecc (as per the libffs partition information) as being ecc protected (or
not).
This saves the consumer needing to know or care about the presence of ecc.
Reviewed-By: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
The ecc 'memcpy' style functions return success or fail in terms of the ECC
enum. This doesn't really make sense, use true or false. As the result the
ecc enum doesn't need to be exposed anymore, which makes more sense, not
clear why it was exposed in the first place.
Convert some of the ecc #defines to static inlines, shouldn't make any
difference but feels safer.
Fix minor stylistic and typo issues.
Reviewed-By: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Copying the flash from the host fails :
# cat /dev/mtd0 > pnor
cat: /dev/mtd0: Input/output error
and the kernel logs :
[ 1357.866996] mtd mtd0: opal_flash_async_op(op=0) failed (rc -1)
It seems that the check on the parameters in the opal_flash_op() routine
are bit excessive and we fail to write or read the last block.
Here is a fix below which should be enough to catch an out of bounds
operation.
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Acked-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Converted all the libflash calls to use the blocklevel interface, modified all
callers to libflash to use the blocklevel interface.
This patch should introduce next to no functional change.
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Skiboot parses the ffs header in the nvram and writes a devicetree entry for
each partition that ffs returns. Skiboot doesn't need to do this as it exposes
access to the entirety of the nvram to linux so any user of the nvram within
linux can just read the ffs partition data themselves.
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
core/flash.c:271:14: error: variable 'flash' is used uninitialized whenever 'for' loop exits because its condition is false
[-Werror,-Wsometimes-uninitialized]
for (i = 0; i < ARRAY_SIZE(flashes); i++) {
^~~~~~~~~~~~~~~~~~~~~~~
core/flash.c:284:7: note: uninitialized use occurs here
if (!flash) {
^~~~~
core/flash.c:271:14: note: remove the condition if it is always true
for (i = 0; i < ARRAY_SIZE(flashes); i++) {
^~~~~~~~~~~~~~~~~~~~~~~
core/flash.c:257:21: note: initialize the variable 'flash' to silence this warning
struct flash *flash;
^
= NULL
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
(13:31:46) benh: stewart: flash_load_resources()
(13:31:53) benh: stewart: you hit the unlock at the bottom of the loop
(13:31:59) benh: stewart: at that point the list may be empty
(13:32:09) benh: stewart: and so another concurrent load can restart the thread
(13:32:15) benh: stewart: you end up with duplicate threads
(13:32:26) benh: stewart: in which case you can hit the assert
<patch goes here>
(13:34:27) benh: ie, never drop the lock with the queue empty
(13:34:29) benh: unless you know you will exit the job
(13:34:32) benh: otherwise you can have a duplicate job
(13:34:41) benh: -> kaboom
(13:36:29) benh: yeah the decision to exit the loop must be atomic with
the popping of the last element in the list
(13:36:43) benh: to match the decision to start the thread which is atomic
with the queuing of the first element
Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Implement start_preload_resource and resource_loaded platform functions
for astbmc machines (palmetto, habanero, firestone).
This means we start loading kernel and initramfs from flash much earlier
in boot, doing things like PCI init concurrently so that by the time
we go to boot the payload, it's already loaded.
Implementation is a simple queue with a job running on another CPU doing
the libflash calls.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Now that opal.h includes opal-api.h, there are a bunch of files that
include both but don't need to.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This moves away from using fsp_sync_msg in fsp_fetch_data and instead
using the platform hooks for start_preload_resource() to actually queue
up a load and having the plumbing for checking if a resource is loaded yet.
This gets rid of the "pollers called with locks held" warning we got
heaps of previously. You can now boot some FSP systems without getting
this warning at all.
This also sets the stage for starting load of LIDs much earlier to when
they're needed, improving boot time.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
No functional changes in what happens, just have two calls, one for
queueing preload the other for waiting until it has loaded.
future patches will introduce platform specific queueing.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
|
|
sparse spotted the problem :
core/flash.c:379:22: warning: odd constant _Bool cast (fffffffffffffff6 becomes 1)
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
We have the logic inverted here.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
BMC based systems contain a PNOR to provide flash storage. The host
normally has exclusive access to the PNOR, however the BMC may use IPMI
to request access to perform functions such as update the firmware.
Indicate to users of the flash that the device is busy by taking the
lock, and setting a per-flash busy flag, which causes flash operations
to return OPAL_BUSY.
Minor changes from Jeremy Kerr
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
|
|
BOOTKERNEL is now the name for the PNOR petition that will contain the
separate kernel, so that users do not confuse the bootloader kernel with
the final OS kernel.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
When checking paramters for errors we set rc, but then simply return
OPAL_HARDWARE in the error path.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
libflash is able to perform reads and writes across page boundaries, so
this restriction is not required.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This change adds a property in /chosen:
/chosen/ibm,system-flash
Containing the path to the system flash device. We move the
system-flash-specific setup to a new function to contain it in the one
place.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
We have ffs_flash_read to do optionally-ecc-ed reads of flash data.
However, this isn't really related to the ffs partitioning.
This change moves ffs_flash_read into libflash.c, named
flash_read_corrected. The function itself isn't changed.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Add ability to read CAPI microcode to load_resource() implementations. We use
the cfam chipid as the subid.
FSP load_resource() contains a map of cfam chipid to lid numbers.
PNOR load_resource() doesn't change, but requires a properly formatted
partition with EC values in the TOC matching the appropriate cfam chipid.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Add decoding, checking and correction of ECC enabled partitions in
pnor_load_resource().
Signed-off-by: Michael Neuling <mikey@neuling.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Add ecc parmenter to ffs_part_info() to indicate if the partition is ECC
protected or not. Fix all call sites.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
In the recent change:
commit 73b262e768529f152ec64b4418b0c31691bc15c3
Author: Jeremy Kerr <jk@ozlabs.org>
core/flash: port pnor_load_resource to flash code
Some code was moved around, but it was modified introducing a number of bugs.
Firstly the size check was moved to before the sub-partition determination.
This is incorrect as the size check is against the sub-partition not the full
partition.
Secondly, it introduced a return in the error path for sub-partitions. This
should be a goto to ensure the correct cleanup code is run.
Thirdly, subid is now set in the name lookup loop where it shouldn't be.
Fourthly, a check on the subid was removed unnecessarily.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Brown-paper-bag-acked-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
These were added in a8513d3f3e but I forgot the \n.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Since we want to prevent conflicts between PNOR and NVRAM, this change
moves the flash-nvram handling out of flash-nvram.c and into the generic
flash module. This way, the OPAL_FLASH_{READ,WRITE,ERASE} API won't
conflict with the OPAL_*_NVRAM api.
To do this, we use the flash_register function to look for an "NVRAM"
partition. If one is found, it is automatically registered as the system
NVRAM backend.
We also change the rhesus and astmbc platforms to use the common flash
code.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Since we have a flash device registered as the system flash, use this as
a generic load_resource backend.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
We'd like to enable access to the system PNOR, on platforms where its
present. This change introduces an API for global flash operations:
opal_flash_read
opal_flash_erase
opal_flash_write
- plus device-tree bindings to expose the flash details.
Since there are other components of the system that use the PNOR (NVRAM
and pnor_load_resource), upcoming changes will port this these over to
use the new interface.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|