[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] early printk support for microblaze



David McCullough wrote:
> Jivin John Williams lays it down ...
> 
>>Yasushi SHOJI wrote:
>>
>>>if you apply the patch it produce boot log like the above. note that
>>>the top part of boot log is duplicated. The reason I said was that I
>>>misunderstood what CON_PRINTBUFFER is for.
>>>
>>>it might be better to redirect early printk's out put to debug uart if
>>>the platform has one.  what do you think?
>>
>>OK, i'm slowly catching up!  Sorry, I'd never heard of early printk 
>>before - but a google search suggests it's a capability to use printk() 
>>before the kernel calls console_init(), is that right?
>>
>>What I don't understand, is why it is necessary?  Any printk() output 
>>that is sent before calling console_init() gets buffered, and is output 
>>eventually.
>>
>>Or should pre-console_init() printk's be output immediately, in case the 
>>kernel hangs/crashes before console_init()?
> 
> 
> Early printk is (from what I have seen) a hack for debugging new
> platforms that do not make it that far through the boot for
> CON_PRINTBUFFER to kick in.
> 
> It's always a bit messy IMO.
> 
> What you probably want is a config option.  If EARLY_PRINTK is set,
> don't set CON_PRINTBUFFER and have the two work it out so that you do
> not get the output twice.

OK, I think I see what's happening now.

Yashi - near the top of xmbserial.c there's already some debug output 
routines left-over from a while ago:

db_print(char *);
db_printnum(int);

They can be called from head.S - much earlier than printk will ever work.

However, if you are keen for early printk - is there a reasonably clean 
way to just modify xmb_serial, instead of introducing the new console 
driver early_printk.c?

The console output routines in xmb_serial.c should serve the purpose, 
you just need to point the kernel at them "earlier"...

How about in xmbserial.c:

void enable_early_printk(void)
{
	register_console(&xmbrs_console);
}

and similar for disable_early_printk()...

Then leave your #ifdef EARLY_PRINTK enable_early_printk() ... stuff in 
setup.c

Does that work?  enable_early_printk() could even copy and tweak the 
xmbrs_console object before registering it, if necessary (eg to change 
the CON_PRINTBUFFER option or whatever).

Cheers,

John

PS Once the dust settles on this early printk stuff we should move 
xmb_serial.[ch] into /drivers/char where they belong, and probably 
rename them to xul_serial in the process.

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@itee.uq.edu.au
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/