On 2021-12-09 6:46 p.m., Ted Bullock wrote:
> On 2021-12-06 4:21 p.m., Ted Bullock wrote:
> I think that there is an bug triggered by endian code here:
> 
>> radeondrm0: RV100
>> BIOS signature incorrect 0 0
> 
> in sys/dev/pci/drm/radeon/radeon_bios.c:840
> 
> if (rdev->bios[0] != 0x55 || rdev->bios[1] != 0xaa) {
>       printk("BIOS signature incorrect %x %x\n", rdev->bios[0], 
> rdev->bios[1]);
>               goto free_bios;
> }
> 
> I'm pretty sure that on sparc those bytes aren't going to be reporting
> the same information as on a little endian machine. Or am I crazy and
> wrong...
> 

Indeed, I'm correct about there being an endian bug here.

I wrote some testing printfs to determine the code path since I'm still
an uneducated peasant who doesn't understand ddb.  At least part of the
problem for this card/system, starts with the following code:

function: radeon_read_bios in sys/dev/pci/drm/radeon/radeon_bios.c:157

I added a test around the memcpy where the cards bios is copied to a
buffer rdev->bios and printed the first 8 bytes.

        printk("radeon bios header: %x %x %x %x %x %x %x %x\n",
                bios[0],
                bios[1],
                bios[2],
                bios[3],
                bios[4],
                bios[5],
                bios[6],
                bios[7]);

        rdev->bios = kmalloc(size, GFP_KERNEL);
        memcpy(rdev->bios, bios, size);

        printk("buffered bios header: %x %x %x %x %x %x %x %x\n",
                rdev->bios[0],
                rdev->bios[1],
                rdev->bios[2],
                rdev->bios[3],
                rdev->bios[4],
                rdev->bios[5],
                rdev->bios[6],
                rdev->bios[7]);

On the following boot I see this:

Rebooting with command: boot
Boot device: disk  File and args:
OpenBSD IEEE 1275 Bootblock 2.1
..>> OpenBSD BOOT 1.22
Trying bsd...

<SNIP>

radeondrm0: RV100
radeon bios header: 55 aa 34 0 0 0 0 0
buffered bios header: 0 0 0 0 0 34 aa 55
BIOS signature incorrect 0 0
[drm] *ERROR* radeon: ring test failed (scratch(0x15E4)=0xCAFEDEAD)
[drm] *ERROR* radeon: cp isn't working (-22).
drm:pid0:r100_startup *ERROR* failed initializing CP (-22).
drm:pid0:r100_init *ERROR* Disabling GPU acceleration
[drm] *ERROR* Wait for CP idle timeout, shutting down CP.
Failed to wait GUI idle while programming pipes. Bad things might happen.
radeondrm0: 1280x1024, 8bpp
wsdisplay1 at radeondrm0 mux 1
wsdisplay1: screen 0 added (std, sun emulation)
Bogus possible_clones: [ENCODER:45:TMDS-45] possible_clones=0x6 (full encoder 
mask=0x7)
Bogus possible_clones: [ENCODER:46:TV-46] possible_clones=0x5 (full encoder 
mask=0x7)
Bogus possible_clones: [ENCODER:48:DAC-48] possible_clones=0x3 (full encoder 
mask=0x7)

Thoughts folks? This is clearly going to impact all big endian + radeon gear.

Actually, I bet that the macppc platform has the same problem too.


-- 
Ted Bullock <tbull...@comlore.com>

Reply via email to