[Skiboot] [PATCH v3] flash: Move flash node under ibm, opal/flash/

Michael Neuling mikey at neuling.org
Wed Oct 19 16:18:00 AEDT 2016


On Wed, 2016-08-10 at 19:20 -0500, Jack Miller wrote:
> This changes the boot ABI, so it's only active for P9 and later systems,
> even though it's unrelated to hardware changes. There is an associated
> Linux change to properly search for this node as well.

We can't have backwards incompatible device tree changes!

We need to revert this.  This breaks existing Linux kernels.

Stewart, please revert e1e6d009860d0ef60f9daf7a0fbe15f869516bd0

I just spend an afternoon working out why my flash disappeared when I upgraded
skiboot.

Mikey

> This change properly specifies #address-cells for the flash node, so we
> can avoid DTC errors like
> 
> ---
> device tree: Warning (reg_format): "reg" property in /ibm,opal/flash at 0
> has invalid length (8 bytes) (#address-cells == 0, #size-cells == 0)
> ---
> 
> Base on a patch from Cyril Bur
> 
> Signed-off-by: Jack Miller <jack at codezen.org>
> ---
>  core/flash.c | 31 ++++++++++++++++++++++++-------
>  1 file changed, 24 insertions(+), 7 deletions(-)
> 
> diff --git a/core/flash.c b/core/flash.c
> index da435a0..6525523 100644
> --- a/core/flash.c
> +++ b/core/flash.c
> @@ -187,19 +187,36 @@ static int flash_nvram_probe(struct flash *flash, struct
> ffs_handle *ffs)
>  
>  static struct dt_node *flash_add_dt_node(struct flash *flash, int id)
>  {
> -	struct dt_node *flash_node;
> +	struct dt_node *flash_node, *flash_dir;
>  
> -	flash_node = dt_new_addr(opal_node, "flash", id);
> -	dt_add_property_strings(flash_node, "compatible", "ibm,opal-flash");
> +	/* Boot ABI on P9+, flash node is in ibm,opal/flash/flash at 0 */
> +
> +	if (proc_gen >= proc_gen_p9) {
> +		flash_dir = dt_new(opal_node, "flash");
> +		assert(flash_dir);
> +
> +		dt_add_property_cells(flash_dir, "#address-cells", 0);
> +		dt_add_property_cells(flash_dir, "#size-cells", 2);
> +
> +		flash_node = dt_new_addr(flash_dir, "flash", id);
> +		assert(flash_node);
> +
> +	/* <= P8, flash is ibm,opal/flash at 0, with legacy cell settings */
> +
> +	} else {
> +		flash_node = dt_new_addr(opal_node, "flash", id);
> +		assert(flash_node);
> +
> +		dt_add_property_cells(flash_node, "#address-cells", 1);
> +		dt_add_property_cells(flash_node, "#size-cells", 1);
> +	}
> +
> +	dt_add_property_string(flash_node, "compatible", "ibm,opal-flash");
>  	dt_add_property_cells(flash_node, "ibm,opal-id", id);
>  	dt_add_property_u64(flash_node, "reg", flash->size);
>  	dt_add_property_cells(flash_node, "ibm,flash-block-size",
>  			flash->block_size);
>  
> -	/* we fix to 32-bits */
> -	dt_add_property_cells(flash_node, "#address-cells", 1);
> -	dt_add_property_cells(flash_node, "#size-cells", 1);
> -
>  	return flash_node;
>  }
>  


More information about the Skiboot mailing list