Subject: Re: [RFC PATCH v4 2/2] powerpc: gamecube/wii: early debugging using usbgecko

From: Albert Herranz <[email-masked]>
Date: Fri, 04 Dec 2009 17:54:05 +0100

Segher Boessenkool wrote:
>> +#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
>> +setup_usbgecko_bat:
>> +    /* prepare a BAT for early io */
>> +#if defined(CONFIG_GAMECUBE)
>> +    lis    r8, 0x0c00
>> +#elif defined(CONFIG_WII)
>> +    lis    r8, 0x0d00
>> +#else
>> +#error Invalid platform for USB Gecko based early debugging.
>> +#endif
> 
> A kernel with both CONFIG_WII and CONFIG_GAMECUBE works fine
> on either, right?  If so, could you please switch the two #ifs?
> A dual-platform kernel will be used on a Wii much more likely
> than on a GC.
> 

Nope, a GameCube kernel currently doesn't work on a Wii and the same the other way around.

But I can make that particular check a runtime check.
The idea would be to enclose that snippet in GAMECUBE_COMMON and check the PVR. If it is a Gekko (a fixed value) then we have a GameCube, otherwise we assume a Wii.

>> +    /*
>> +     * The virtual address used must match the virtual address
>> +     * associated to the fixmap entry FIX_EARLY_DEBUG_BASE.
>> +     */
>> +    lis    r11, 0xfffe    /* top 128K */
>> +    ori    r8, r8, 0x002a    /* uncached, guarded ,rw */
>> +    ori    r11, r11, 0x3    /* 128K */
> 
> I think you should clear Vp since the BAT mapping can survive until
> after user space is started; it won't hurt to remove it either way.
> So 2 instead of 3.  And put the meaning in the comment :-)

This BAT is re-setup again on MMU_init, way before starting userspace.
But I'll make it Vs=1, Vp=0 here too :)

> Looks fine otherwise.

Thanks.

> Segher

Cheers,
Albert