Subject: CMD0646
To: None <port-sparc@netbsd.org>
From: Chris Torek <nospam@elf.eng.bsdi.com>
List: port-sparc
Date: 12/16/2001 04:42:49
The following notes (from my BSDi PCI-IDE driver) may prove useful...
/*
* All APIO modes (through mode 4 at least) are always supported;
* MDMA modes 2 and 1 are supported. The 646 and 646U specs do
* not explicitly exclude mode 0 but the 646U2 spec does. For
* safety I have not set the mode-0 bit here at all, but perhaps
* we can set it on rev 0 and 3 (646 and 646U respectively).
*
* UltraDMA is supported at modes 2, 1, and/or 0 depending on
* clock speed, but revs before the 646U2 (rev 5) get it wrong,
* so we must not enable it there. (It works only on certain
* drives and then perhaps only with extra external hardware.
* Experimentally, it always failed for me on an Ultra10.)
*/
sc->sc_apiomask = (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | 1;
sc->sc_mdmamask = (1 << 2) | (1 << 1);
/*
* Calculate length of clock cycle, in ns, and set UltraDMA
* enable mask if appropriate.
*/
/* ??? if clk>=66 ...? */
if (clk >= 33) {
sc->sc_clkcycle = 30;
if (rev >= 5)
sc->sc_udmamask = (1 << 2) | (1 << 1) | (1 << 0);
} else if (clk >= 30) {
sc->sc_clkcycle = 33;
if (rev >= 5)
sc->sc_udmamask = (1 << 1) | (1 << 0);
} else if (clk >= 25) {
sc->sc_clkcycle = 40;
/* can barely do UltraDMA mode 1; not recommended */
} else {
/* ??? impossible? */
printf("\n%s: impossible PCI bus speed? (below 25 Mhz)\n",
sc->sc_dev.dv_xname);
return;
}
(The sc_<mode>mask fields in this data structure are bitmasks of
ATA modes supported by the device, so that common code can resolve
the "values supplied by drive" against "values supported by DMA
chipset".)