Re: [PATCH] x86: usb debug port early console
From: Eric W. Biederman
Date: Wed Jul 23 2008 - 23:02:53 EST
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> writes:
> On Wed, 23 Jul 2008 12:52:20 -0700
> Yinghai Lu <yhlu.kernel@xxxxxxxxx> wrote:
>
>>
>>
>> based on work from Eric, and add some timeout so don't dead loop when debug
> device
>> is not installed
>>
>>
>> ...
>>
>> +static void dbgp_mdelay(int ms)
>> +{
>> + int i;
>> + while (ms--) {
>> + for (i = 0; i < 1000; i++)
>> + outb(0x1, 0x80);
>> + }
>> +}
>
> hm. port 80 has a guaranteed one microsecond?
It usually longer, but it is in the 1 microsecond ballpark, accurate
enough to be a usable delay before we have anything else.
> Why not udelay()/mdelay()/etc?
This code runs ages before udelay and mdelay work. Certainly before
calibrate delay is called, so the normal kernel delay routines don't
come anywhere close and an out to port 0x80 comes.
>> +static void dbgp_breath(void)
>> +{
>> + /* Sleep to give the debug port a chance to breathe */
>> +}
>
> I expect the compiler will optimise away any calls to this.
It is documentation that is if it might be a good idea to not hit the
hardware there.
Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/