[U-Boot] [PATCH v3 2/2] mpc85xx: support for Freescale COM Express P2020

Kumar Gala galak at kernel.crashing.org
Sat Nov 19 17:13:30 CET 2011


>> If you look at current board/freescale/p1_p2_rdb/law.c it doesn't have PCI LAWs anymore.  I think for your example you just need an empty data structure:
>> 
>> 	struct law_entry law_table[] = {
>> 	};
>> 
>> this should hopefully make num_law_entries = 0;
>> 
>> 
>>> 
>>>>> +};
>>>>> +
>>>>> +int num_law_entries = ARRAY_SIZE(law_table);
> 
> Unfortunately, having a law_table with no entries causes a bug. A nasty
> bug which was hard to track down.
> 
> When law_table is empty, and when num_law_entries = 0, both variables
> exist in BSS only.
> 
> Both the law_table and num_law_entries are used in init_laws(), called
> from cpu_init_early_f(). This happens before BSS is initialized. Also
> before DDR is initialized.
> 
> And now you see the bug. The U-Boot hangs due to an invalid memory
> access. This is before the console is initialized, making it hard to
> track down.

Yeah, that's nasty.  need to think on this a bit to see if I can come up with any good answer.

> How do you suggest I work around this? A single redundant entry in the
> law_table works (the system boots).

For now I'd go with that and add a comment in law.c about it.

- k


More information about the U-Boot mailing list