Ron mentioned he had strange hangs in pll_reset on various targets. This may be due to miscompilation of XIP objects which do not have _MAINBOBJECT defined. This issue was impossible to see on qemu because no such object existed. Introduce initram_printktest.c in the Qemu target, which will test for miscompilation and crash with a descriptive error message.
This has been build tested and runtime tested on Qemu, and with my compiler/linker combination it indeed crashes. gcc (GCC) 4.2.1 (SUSE Linux) GNU ld (GNU Binutils) 2.17.50.20070726-14 (SUSE Linux)
Trying with gcc-4.1 (GCC) 4.1.3 20070724 (prerelease) (SUSE Linux) and the linker above had exactly the same results.
Unless we manage to fix the bug uncovered by this patch, leaving the Qemu target in crashing state is the best thing we can do because this behaviour mirrors the state of all other targets.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
(don't forget "svn add ainboard/emulation/qemu-x86/initram_printktest.c" if you commit)
Index: LinuxBIOSv3-xiptest/mainboard/emulation/qemu-x86/initram.c =================================================================== --- LinuxBIOSv3-xiptest/mainboard/emulation/qemu-x86/initram.c (Revision 532) +++ LinuxBIOSv3-xiptest/mainboard/emulation/qemu-x86/initram.c (Arbeitskopie) @@ -2,6 +2,7 @@ * This file is part of the LinuxBIOS project. * * Copyright (C) 2007 Stefan Reinauer stepan@coresystems.de + * Copyright (C) 2007 Carl-Daniel Hailfinger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +22,8 @@
#include <console.h>
+int printktest(void); + /* printktest1() is here to increase the likelihood of main() not ending up at * the beginning of the file, so we can check whether the entry point at main() * was honored. @@ -39,6 +42,9 @@ printk(BIOS_INFO, "RAM init code started.\n"); printk(BIOS_INFO, "Nothing to do.\n"); printktest1(); + printk(BIOS_INFO, "Trying absolute call from non-_MAINOBJECT XIP code.\n"); + printktest(); + printk(BIOS_INFO, "Done.\n");
return 0; } Index: LinuxBIOSv3-xiptest/mainboard/emulation/qemu-x86/initram_printktest.c =================================================================== --- LinuxBIOSv3-xiptest/mainboard/emulation/qemu-x86/initram_printktest.c (Revision 0) +++ LinuxBIOSv3-xiptest/mainboard/emulation/qemu-x86/initram_printktest.c (Revision 0) @@ -0,0 +1,31 @@ +/* + * This file is part of the LinuxBIOS project. + * + * Copyright (C) 2007 Carl-Daniel Hailfinger + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <console.h> + +int printktest(void) +{ + /* If printk succeeds, it will print the message below. This is not a + * success message after a test, but a success message used as test. + * In case of compiler/linker bugs the printk call is likely to crash. + */ + printk(BIOS_INFO, "Absolute call successful.\n"); + + return 0; +} Index: LinuxBIOSv3-xiptest/mainboard/emulation/qemu-x86/Makefile =================================================================== --- LinuxBIOSv3-xiptest/mainboard/emulation/qemu-x86/Makefile (Revision 532) +++ LinuxBIOSv3-xiptest/mainboard/emulation/qemu-x86/Makefile (Arbeitskopie) @@ -40,5 +40,6 @@ # directory and is built from what was auto.c in v2. #
-INITRAM_OBJ = $(obj)/mainboard/$(MAINBOARDDIR)/initram.o +INITRAM_OBJ = $(obj)/mainboard/$(MAINBOARDDIR)/initram.o \ + $(obj)/mainboard/$(MAINBOARDDIR)/initram_printktest.o