[Skiboot] [RFC, PATCH 3/3] core/flash: Move flash NVRAM handling to new flash module
Joel Stanley
joel at jms.id.au
Mon Feb 9 12:09:40 AEDT 2015
On Fri, Feb 6, 2015 at 9:39 PM, Jeremy Kerr <jk at ozlabs.org> wrote:
> 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 at ozlabs.org>
Reviewed-by: Joel Stanley <joel at jms.id.au>
>
> ---
> core/Makefile.inc | 2
> core/flash-nvram.c | 76 --------------------------
> core/flash.c | 107 ++++++++++++++++++++++++++++++++++++--
> include/skiboot.h | 3 -
> platforms/astbmc/pnor.c | 41 ++------------
> platforms/rhesus/rhesus.c | 39 +------------
> 6 files changed, 116 insertions(+), 152 deletions(-)
> diff --git a/core/flash.c b/core/flash.c
> index e68b41e..d41eb01 100644
> --- a/core/flash.c
> +++ b/core/flash.c
> +static int flash_nvram_probe(struct flash *flash, struct ffs_handle *ffs)
> +{
> + uint32_t start, size, part;
> + int rc;
> +
> + prlog(PR_INFO, "FLASH: probing for NVRAM\n");
> +
> + rc = ffs_lookup_part(ffs, "NVRAM", &part);
> + if (rc) {
> + prlog(PR_WARNING, "FLASH: no NVRAM partition found\n");
> + return OPAL_HARDWARE;
> + }
> +
> + rc = ffs_part_info(ffs, part, NULL,
> + &start, &size, NULL);
> + if (rc) {
> + prlog(PR_ERR, "FLASH: Can't parse ffs info for NVRAM\n");
> + return OPAL_HARDWARE;
> + }
> +
> + nvram_flash = flash;
> + nvram_offset = start;
> + nvram_size = size;
> +
> + platform.nvram_info = flash_nvram_info;
> + platform.nvram_start_read = flash_nvram_start_read;
> + platform.nvram_write = flash_nvram_write;
Consider putting the callback registration in the platform definitions
themselves, so it's obvious when looking at a platform what it's
using.
> +
> + return 0;
> +}
> +
> +/* core flash support */
> +
More information about the Skiboot
mailing list