[coreboot] [PATCH] Factor out ROM size calculation from Config.lb
Carl-Daniel Hailfinger
c-d.hailfinger.devel.2006 at gmx.net
Tue Apr 21 01:15:45 CEST 2009
On 21.04.2009 00:56, Myles Watson wrote:
> On Sun, Apr 19, 2009 at 9:26 AM, Carl-Daniel Hailfinger
> <c-d.hailfinger.devel.2006 at gmx.net> wrote:
>
>> On 18.04.2009 23:56, Carl-Daniel Hailfinger wrote:
>>
>>> On 17.04.2009 23:38, Carl-Daniel Hailfinger wrote:
>>>
>>>
>>>> Thanks to Myles' patch adding support for include statements,
>>>> refactoring Config.lb became possible.
>>>>
>>>> Factor out ROM size calculation from Config.lb.
>>>> Only targets with USE_FAILOVER_IMAGE support are part of this patch, the
>>>> other targets will come as separate patch.
>>>>
>>>>
>>>>
>>> I have a new patch with 87 boards (with and without USE_FAILOVER_IMAGE),
>>> but it has to work around a parser bug. diffstat is
>>> 89 files changed, 209 insertions(+), 2415 deletions(-)
>>> A total of 2206 removed lines. Yay!
>>>
>>>
>> Abuild works for all changed boards.
>>
>> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
>>
>> Index: LinuxBIOSv2-Configlb_refactor2/src/nofailovercalculation.lb
>> ===================================================================
>> --- LinuxBIOSv2-Configlb_refactor2/src/nofailovercalculation.lb (Revision 0)
>> +++ LinuxBIOSv2-Configlb_refactor2/src/nofailovercalculation.lb (Revision 0)
>> @@ -0,0 +1,38 @@
>> +##
>> +## Compute the location and size of where this firmware image
>> +## (coreboot plus bootloader) will live in the boot rom chip.
>> +##
>> +if USE_FALLBACK_IMAGE
>> + default ROM_SECTION_SIZE = FALLBACK_SIZE
>> + default ROM_SECTION_OFFSET = ( ROM_SIZE - FALLBACK_SIZE )
>> +else
>> + default ROM_SECTION_SIZE = ( ROM_SIZE - FALLBACK_SIZE )
>> + default ROM_SECTION_OFFSET = 0
>> +end
>> +
>> +##
>> +## Compute the start location and size size of
>> +## The coreboot bootloader.
>> +##
>> +default PAYLOAD_SIZE = ( ROM_SECTION_SIZE - ROM_IMAGE_SIZE )
>> +default CONFIG_ROM_PAYLOAD_START = (0xffffffff - ROM_SIZE + ROM_SECTION_OFFSET + 1)
>> +
>> +##
>> +## Compute where this copy of coreboot will start in the boot rom
>> +##
>> +default _ROMBASE = ( CONFIG_ROM_PAYLOAD_START + PAYLOAD_SIZE )
>> +
>> +##
>> +## Compute a range of ROM that can cached to speed up coreboot,
>> +## execution speed.
>> +##
>> +## XIP_ROM_SIZE must be a power of 2.
>> +## XIP_ROM_BASE must be a multiple of XIP_ROM_SIZE
>> +##
>> +default XIP_ROM_SIZE = 64 * 1024
>> +default XIP_ROM_BASE = ( _ROMBASE - XIP_ROM_SIZE + ROM_IMAGE_SIZE )
>> +
>> +## This is needed to work around a parser bug.
>> +if USE_FALLBACK_IMAGE
>> +end
>> +
>>
> INSTANCE 0
> INCLUDE config/nofailovercalculation.lb
> Trying to find one of NUM, HEX_PREFIX, ID, "\\(", "!" on line 34:
>
>> ^
>>
> List of nearby tokens:
> (@945) NUM = '1024'
> (@950) DEFAULT = 'default'
> (@958) ID = 'XIP_ROM_BASE'
> (@971) EQ = '='
> (@973) ID = '_ROMBASE'
> (@982) "-" = '-'
> (@984) ID = 'XIP_ROM_SIZE'
> (@997) "[+]" = '+'
> (@999) ID = 'ROM_IMAGE_SIZE'
> (@1014) "||" = ''
> ===> ERROR: Could not parse file
> tyan/s2892/Config.lb:0
>
> I don't know why the parser is matching blank space with "||"
>
I had exactly his bug, but the "if USE_FALLBACK_IMAGE end" worked around
it. Took me hours to figure out that workaround. I was unable to fix the
parser.
> We could also remove that rule in config.g to get around it.
>
> I've tested serengeti for the failover portion and s2892 for the
> nofailover portion. ldoptions are exactly the same and they both boot
> the same.
>
> Acked-by: Myles Watson <mylesgw at gmail.com>
>
Yay, thanks!
I'll commit ASAP.
Regards,
Carl-Daniel
--
http://www.hailfinger.org/
More information about the coreboot
mailing list