Re: [PATCH 18/56] microblaze_v2: early_printk support

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

 



Make sense.
I'll add it.

Thanks,
M
> On Sun, 2008-05-04 at 13:41 +0200, monstr@xxxxxxxxx wrote:
> 
>> +++ b/arch/microblaze/kernel/early_printk.c
> 
>> +static void early_printk_putc(char c)
>> +{
>> +	while (ioread32(STATUS) & (1<<3));
>> +	iowrite32((c & 0xff), TX_FIFO);
>> +}
> 
> The while() loop needs a retry counter - if you configure
> EARLY_PRINTK_BASE_ADDRESS wrongly and it points to memory or anything
> that is not a uartlite, the loop spins forever and you get silent
> lockup.  Not nice behaviour from debug code :)
> 
> Here's my current implementation:
> 
> static void early_printk_putc(char c)
> {
>         /* Limit how many times we'll spin waiting for TX FIFO status.
>            This will prevent lockups if the base address is incorrectly
> set, or
>            any other issue on the UARTLITE.
> 
>            This limit is pretty arbitrary, unless we are at about 10
> baud 
>            we'll never timeout on a working UART. */
> 
>         unsigned retries=10000;
>         while (retries-- && (ioread32(STATUS) & (1<<3)))
>                 ;
> 
>         /* Only attempt the iowrite if we didn't timeout */
>         if(retries)
>                 iowrite32((c & 0xff), TX_FIFO);
> }
> 
> Cheers
> 
> John
> 
> 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux