[coreboot] fmaptool: fmap_config.h: Base offset missing

Rolf Evers-Fischer embedded24 at evers-fischer.de
Tue Jun 21 13:13:11 CEST 2016


On Mon, 20 Jun 2016, Aaron Durbin wrote:

> On Thu, Jun 16, 2016 at 8:55 AM, Rolf Evers-Fischer
> <embedded24 at evers-fischer.de> wrote:
> > Hello,
> > my ApolloLake board was not able to find the "romstage" in the SPI memory,
> > because it searched in the wrong part of the memory.
> >
> > ___FMAP__COREBOOT_BASE was set to the relative offset within the parent
> > section, but rdev_readat needs the *absolute* address: There was a
> > mismatch.
> > However, I was able to fix this problem locally by adding an additional
> > fixed offset to fmap_top, like
> 
> Could you please provide an example fmd and the generated header file?
> 

This is the content of the fmd file:

FLASH 8M {
	WP_RO at 0x0 0x500000 {
		SI_DESC at 0x0 0x1000
		IFWI at 0x100000 0x1ff000
		RO_SECTION at 0x300000 0x200000 {
			RO_VPD at 0x0 0x4000
			FMAP at 0x4000 0x800
			RO_FRID at 0x4800 0x40
			RO_FRID_PAD at 0x4840 0x7c0
			COREBOOT(CBFS)@0x5000 0x17b000
			GBB at 0x180000 0x40000
			# logical boot partition 2. Remove with updated 
CSE
			SIGN_CSE at 0x1c0000 0x10000
		}
	}
	MISC_RW at 0x500000 0x1a000 {
		RW_MRC_CACHE at 0x0 0x10000
		RW_ELOG at 0x10000 0x4000
		RW_SHARED at 0x14000 0x4000 {
			SHARED_DATA at 0x0 0x2000
			VBLOCK_DEV at 0x2000 0x2000
		}
		RW_VPD at 0x18000 0x2000
	}
	RW_SECTION_A 0xf0000 {
		VBLOCK_A 64K
		FW_MAIN_A(CBFS) 768K
		RW_FWID_A 64
	}
	RW_SECTION_B 0xf0000 {
		VBLOCK_B 64K
		FW_MAIN_B(CBFS) 768K
		RW_FWID_B 64
	}
	DEVICE_EXTENSION at 0x77f000 0x80000
}

And this is the content of the generated fmap_config.h:

#ifndef FMAPTOOL_GENERATED_HEADER_H_
#define FMAPTOOL_GENERATED_HEADER_H_

#define FMAP_OFFSET 0x304000

#define ___FMAP__COREBOOT_BASE 0x5000
#define ___FMAP__COREBOOT_SIZE 0x17b000
#define ___FMAP__FW_MAIN_A_BASE 0x10000
#define ___FMAP__FW_MAIN_A_SIZE 0xc0000
#define ___FMAP__FW_MAIN_B_BASE 0x10000
#define ___FMAP__FW_MAIN_B_SIZE 0xc0000
#endif

There is a new commit, which may fix this problem. I'll test this commit 
right now: https://review.coreboot.org/15273

> >
> > diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
> > index aa652c2..f36a499 100644
> > --- a/src/lib/cbfs.c
> > +++ b/src/lib/cbfs.c
> > @@ -230,7 +230,7 @@ static int cbfs_master_header_props(struct cbfs_props *props
> >         if (bdev == NULL)
> >                 return -1;
> >
> > -       size_t fmap_top = ___FMAP__COREBOOT_BASE + ___FMAP__COREBOOT_SIZE;
> > +       size_t fmap_top = ___FMAP__COREBOOT_BASE + ___FMAP__COREBOOT_SIZE + 0x300000;
> >
> >         /* Find location of header using signed 32-bit offset from
> >          * end of CBFS region. */
> >
> >
> > But imho this shouldn't be a permanent solution!
> >
> > Therefore I suggest to modify the 'fmaptool' in such way that it outputs
> > the absolute address for (at least) ___FMAP__COREBOOT_BASE, because the
> > 'rdev_readat()' function  of the 'boot_device_ro()' needs it in this form.
> >
> > What is your opinion?
> >
> > Kind regards,
> >  Rolf
> >
> > --
> > coreboot mailing list: coreboot at coreboot.org
> > https://www.coreboot.org/mailman/listinfo/coreboot
> 



More information about the coreboot mailing list