Re: Si3112 S-ATA bug preventing use of udma5.

From: Roland Dreier
Date: Fri Apr 23 2004 - 21:32:57 EST


Brenden> Incase the link is down/broken, to fix the bug change line 269
Brenden> of drivers/ide/pci/siimage.c from:

Brenden> u32 speedt = 0;

Brenden> to: u16 speedt = 0;

Brenden> The crux of the problem is that the first arguent to OUTW
Brenden> (out WORD) was a doubleword. The arguments were getting
Brenden> all screwed up on the stack. The lower order 16-bit were
Brenden> being used in the second argument of OUTW, and the upper
Brenden> order word was being used as the whole first argument,
Brenden> which was always 0000.

Ben> Hrm... that's strange. I'd tend to think it's a bogus
Ben> definition of outw on this architecture (x86 ?) instead. an
Ben> u32 should be casted down to u16 without problem.

Assuming I'm reading the siimage.c code correctly, it's calling
default_hwif_mmiops() to set up its OUTW pointer, which sets the
function pointer to call

static void ide_mm_outw (u16 value, unsigned long port)
{
writew(value, port);
}

In asm-i386/io.h, we have

#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b))

Finally, siimage.c does

hwif->OUTW(speedt, addr);

and speedt is a u32 -- however, as you say, the compiler should just
cast speedt down to a u16. What am I missing?

- R.
-
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/