[Skiboot] [PATCH v2 2/6] libffs: add the offset of the TOC to partition entry addresses

Cyril Bur cyril.bur at au1.ibm.com
Fri May 22 14:31:17 AEST 2015


On Fri, 2015-05-22 at 12:01 +1000, Alistair Popple wrote:
> Comment below.
> 
> On Thu, 14 May 2015 12:02:35 Cyril Bur wrote:
> > The accessor for ffs partition entries should be adding the offset of the
> > TOC to the absolute address of the partition entries as the TOC is not
> > necessarily at 0 within in the flash.
> > 
> > Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
> > ---
> >  libflash/libffs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libflash/libffs.c b/libflash/libffs.c
> > index 1f5cd94..55e6895 100644
> > --- a/libflash/libffs.c
> > +++ b/libflash/libffs.c
> > @@ -244,7 +244,7 @@ static struct ffs_entry *ffs_get_part(struct ffs_handle
> > *ffs, uint32_t index, if (index > ffs->hdr.entry_count)
> >  		return NULL;
> >  	if (out_offset)
> > -		*out_offset = offset;
> > +		*out_offset = ffs->toc_offset + offset;
> >  	return (struct ffs_entry *)(ffs->cache + offset);
> 
> You update out_offset to toc_offset + offset but still return the cached entry 
> at offset. This assumes ffs->cache starts at toc_offset, does it?
> 

Yep, in ffs_open_flash() the cache gets read by:
flash_read(chip, toc_offset, f->cache, f->cached_size);
so already at toc_offset.

> If so:
> 
> Reviewed-by: Alistair Popple <alistair at popple.id.au>
> 
> >  }
> 




More information about the Skiboot mailing list