From: Kumar Gala Date: Sat, 19 Nov 2011 10:13:30 -0600 Subject: [U-Boot] [PATCH v3 2/2] mpc85xx: support for Freescale COM Express P2020 In-Reply-To: <20111119013111.GA14404@ovro.caltech.edu> References: <1320959487-27606-1-git-send-email-iws@ovro.caltech.edu> <1320959487-27606-3-git-send-email-iws@ovro.caltech.edu> <9C248D64-15CB-4B71-9C6B-5559F18B5546@kernel.crashing.org> <20111111165343.GA32482@ovro.caltech.edu> <7E6D2CBC-F8D4-4D51-852F-A978558955EA@kernel.crashing.org> <20111119013111.GA14404@ovro.caltech.edu> Message-ID: <2D71FE7D-098F-424A-8AF0-C19396DAA07C@kernel.crashing.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de >> 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