Improve printk documentation to match code realities.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
--- Index: LinuxBIOSv3/mainboard/adl/msm800sev/stage1.c =================================================================== --- LinuxBIOSv3/mainboard/adl/msm800sev/stage1.c (Revision 509) +++ LinuxBIOSv3/mainboard/adl/msm800sev/stage1.c (Arbeitskopie) @@ -36,6 +36,8 @@ #define SERIAL_DEV W83627HF_SP1 #define SERIAL_IOBASE 0x3f8
+/* printk will not yet output anything */ + void hardware_stage1(void) { void w83627hf_enable_serial(u8 dev, u8 serial, u16 iobase); @@ -51,5 +53,4 @@ */ cs5536_disable_internal_uart(); w83627hf_enable_serial(0x2e, SERIAL_DEV, SERIAL_IOBASE); - printk(BIOS_DEBUG, "Done %s\n", __FUNCTION__); } Index: LinuxBIOSv3/mainboard/emulation/qemu-x86/stage1.c =================================================================== --- LinuxBIOSv3/mainboard/emulation/qemu-x86/stage1.c (Revision 509) +++ LinuxBIOSv3/mainboard/emulation/qemu-x86/stage1.c (Arbeitskopie) @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-/* no printk allowed until hardware is ready; hardware is ready */ +/* printk will not yet output anything */
/** * start up hardware needed for stage1 Index: LinuxBIOSv3/lib/stage2.c =================================================================== --- LinuxBIOSv3/lib/stage2.c (Revision 509) +++ LinuxBIOSv3/lib/stage2.c (Arbeitskopie) @@ -37,7 +37,8 @@ * * Device Enumeration: in the dev_enumerate() phase. * - * TODO: Check whether this documentation is still correct. Improve it. + * TODO: + * - Check whether this documentation is still correct. Improve it. */ int stage2(void) { @@ -54,7 +55,13 @@
post_code(0x20);
- /* TODO: Explain why we use printk here although it is impossible */ + /* TODO: Explain why we use printk here although it is claimed to be + * impossible according to the documentation. The "has to be done + * before printk can be used" comment below seems to suggest the same. + * However, we already enable serial in arch/x86/stage1.c:stage1_main() + * when we call hardware_stage1(); uart_init(); console_init(); + * Why test the console again if it already is tested in stage 1? + */ printk(BIOS_NOTICE, console_test);
dev_init(); Index: LinuxBIOSv3/arch/x86/stage1.c =================================================================== --- LinuxBIOSv3/arch/x86/stage1.c (Revision 509) +++ LinuxBIOSv3/arch/x86/stage1.c (Arbeitskopie) @@ -102,14 +102,17 @@ }
// We have cache as ram running and can start executing code in C. - //
hardware_stage1();
// uart_init(); // initialize serial port - console_init(); // print banner
+ /* Exactly from now on we can use printk to the serial port. + * Celebrate this by printing a LB banner. + */ + console_init(); + if (bist!=0) { printk(BIOS_INFO, "BIST FAILED: %08x", bist); die("");
Carl-Daniel Hailfinger wrote:
Improve printk documentation to match code realities.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Acked-by: Corey Osgood corey.osgood@gmail.com
On 15.11.2007 18:49, Corey Osgood wrote:
Carl-Daniel Hailfinger wrote:
Improve printk documentation to match code realities.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Acked-by: Corey Osgood corey.osgood@gmail.com
Thanks, r510.
Regards, Carl-Daniel
Cleanup printk usage and documentation.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net ---
--- LinuxBIOSv3/device/device.c 2007-11-15 17:50:20.000000000 +0100 +++ LinuxBIOSv3/device/device.c 2007-11-15 20:41:32.000000000 +0100 @@ -692,14 +692,14 @@ * * Starting at the first device on the global device link list, * walk the list and call the device's phase1() method to do very - * early setup. phase1 should only be used for devices that CAN NOT use - * printk(), or that are part of making printk() work. + * early setup. */ void dev_phase1(void) { struct device *dev;
post_code(0x31); + printk(BIOS_DEBUG, "Phase 1: Very early setup...\n"); for (dev = all_devices; dev; dev = dev->next) { if (dev->ops && dev->ops->phase1_set_device_operations) { dev->ops->phase1_set_device_operations(dev); @@ -715,7 +715,7 @@ * * Starting at the first device on the global device link list, * walk the list and call the device's phase2() method to do - * early setup. You can use printk() in phase 2 methods. + * early setup. */ void dev_phase2(void) { @@ -729,7 +729,7 @@ printk(BIOS_SPEW, "Calling phase2 phase2_setup_scan_bus..."); dev->ops->phase2_setup_scan_bus(dev); - printk(BIOS_SPEW, " DONE"); + printk(BIOS_SPEW, " done"); } printk(BIOS_SPEW, "\n"); } --- LinuxBIOSv3/lib/stage2.c 2007-11-15 17:50:42.000000000 +0100 +++ LinuxBIOSv3/lib/stage2.c 2007-11-15 21:12:54.000000000 +0100 @@ -34,6 +34,7 @@ * LinuxBIOS is divided into pre-DRAM part and DRAM part. The stages before * this part are stage 0 and stage 1. This part contains stage 2, which * consists of phases 1 through 6. + * printk has been set up in stage 1 and is working. * * Device Enumeration: in the dev_enumerate() phase. * @@ -45,29 +46,11 @@ /* TODO: Add comment. */ void show_all_devs(void);
- static const char console_test[] = - "\n\nLinuxBIOS-" - LINUXBIOS_VERSION - LINUXBIOS_EXTRA_VERSION - " " - LINUXBIOS_BUILD - " booting...\n"; - post_code(0x20); - - /* TODO: Explain why we use printk here although it is claimed to be - * impossible according to the documentation. The "has to be done - * before printk can be used" comment below seems to suggest the same. - * However, we already enable serial in arch/x86/stage1.c:stage1_main() - * when we call hardware_stage1(); uart_init(); console_init(); - * Why test the console again if it already is tested in stage 1? - */ - printk(BIOS_NOTICE, console_test); - dev_init();
- /* Console init, also ANYTHING that has to be done - * before printk can be used. + /* Phase 1 was console init and making printk work. Both functions are + * now performed by stage 1 code. Phase 1 is now without purpose. */ post_code(0x30); dev_phase1();
On Thu, Nov 15, 2007 at 09:32:30PM +0100, Carl-Daniel Hailfinger wrote:
Cleanup printk usage and documentation.
Please add more text here to explain why the second console banner was dropped.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Acked-by: Uwe Hermann uwe@hermann-uwe.de
Uwe.
On 20.11.2007 19:13, Uwe Hermann wrote:
On Thu, Nov 15, 2007 at 09:32:30PM +0100, Carl-Daniel Hailfinger wrote:
Cleanup printk usage and documentation.
Please add more text here to explain why the second console banner was dropped.
Done.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Acked-by: Uwe Hermann uwe@hermann-uwe.de
Thanks, r512,
Regards, Carl-Daniel
On Thu, Nov 15, 2007 at 06:13:41PM +0100, Carl-Daniel Hailfinger wrote:
Improve printk documentation to match code realities.
Nak, for some hunks.
At some point I hope that LB printk will end up in the kernel message buffer. Then, we are able to handle anything from time zero, so let's not remove any printks. The tidying is good though!
//Peter
On 16.11.2007 01:17, Peter Stuge wrote:
On Thu, Nov 15, 2007 at 06:13:41PM +0100, Carl-Daniel Hailfinger wrote:
Improve printk documentation to match code realities.
Nak, for some hunks.
At some point I hope that LB printk will end up in the kernel message buffer. Then, we are able to handle anything from time zero, so let's not remove any printks. The tidying is good though!
printk() from time zero (to a buffer) will be enabled by one of my future patches. But right now the code should be consistent.
- printk(BIOS_DEBUG, "Done %s\n", __FUNCTION__);
Besides that, the only printk I removed will be directly followed by the LinuxBIOS banner about two instructions later and the printk itself is not as informative as I'd like. I will re-add a printk in that function with the late rprintk buffering patch.
Regards, Carl-Daniel