[haiku-development] generic ide adapter - bus timeouts

sorry, posted this to the kernel-dev list on sourceforge, but thought
this was the right place...

I've been having a poke around the IDE / ATA subsystem.  My ALI based
ATI Xpress2 motherboard spits and complains about IDE timeouts, even
when DMA is disabled.  So I decided to have a look at what the BSD's
do for the chipset.

As it turns out there's a whole world of hurt that makes a "generic
ide" driver generic.  As one can see by looking at
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/ata/ata-chipset.c
As it seems the majority of chipset specific changes are related to
enabling UDMA modes, detecting cables, SATA, and setting up how the
interrupts are used for DMA.

I decided to hack up the promise_tx2 driver to make an ali-ata driver.
It only really needs 4 pci config writes to enable some features (at
least that's what I thought for starters):

ata_ali_chipinit()...
/* use device interrupt as byte count end */
pci_write_config(dev, 0x4a, pci_read_config(dev, 0x4a, 1) | 0x20, 1);

/* enable cable detection and UDMA support on newer chips */
pci_write_config(dev, 0x4b, pci_read_config(dev, 0x4b, 1) | 0x09, 1);

/* enable ATAPI UDMA mode */
pci_write_config(dev, 0x53, pci_read_config(dev, 0x53, 1) | 0x01, 1);

ata_ali_allocate()...
/* older chips can't do 48bit DMA transfers */
 if (ctlr->chip->chiprev <= 0xc4)
     ch->flags |= ATA_NO_48BIT_DMA;

ata_ali_setmode()...
well never got this far!

So I got into looking at the IDE bus manager, and I must admit, it's a
tangled maze of wires, that after a hard day's work with embedded C, I
really don't have the energy to de-tangle.  After a few attempts I
came to realise that the promise_tx2 module isn't even being loaded,
and probed.  Anyone know why?  (this is even before my mods)...  I'll
probably just move my changes one of the other drivers as they seem to
be probed during init time...

Additionally, what is the plan for the generic_ide driver?  Are we to
make 40-odd mini modules to support each chipset individually? or
should be we thinking towards incorporating the same level of chipset
specific modification to the generic ide driver?

PS.  It took me 2 days to find the "generic_ide" driver in /generic I
wasn't amused! :)

Is there any documentation on the IDE subsystem?  silly question I know!...

Euan

Other related posts: