-/* $OpenBSD: pciide.c,v 1.286 2008/07/08 05:59:39 brad Exp $ */
+/* $OpenBSD: pciide.c,v 1.287 2008/07/29 20:09:11 kettenis Exp $ */
/* $NetBSD: pciide.c,v 1.127 2001/08/03 01:31:08 tsutsui Exp $ */
/*
#include <dev/pci/pciide_jmicron_reg.h>
#include <dev/pci/cy82c693var.h>
+#ifdef __sparc64__
+#include <machine/autoconf.h>
+#include <machine/openfirm.h>
+#endif
+
/* functions for reading/writing 8-bit PCI registers */
u_int8_t pciide_pci_read(pci_chipset_tag_t, pcitag_t,
pcireg_t cr, interface;
bus_size_t cmdsize, ctlsize;
int rev = sc->sc_rev;
+#ifdef __sparc64__
+ char buf[32];
+#endif
printf(": DMA");
pciide_mapreg_dma(sc, pa);
sc->sc_wdcdev.cap = WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32 |
WDC_CAPABILITY_MODE;
+#ifdef __sparc64__
+ /*
+ * XXX The Tadpole SPARCLE doesn't want to do DMA. PIO works
+ * fine, so we have this ugly hack to make the machine work.
+ * It is likely the real cause is still lurking somewhere in
+ * the code.
+ */
+ if (OF_getprop(findroot(), "name", buf, sizeof(buf)) > 0 &&
+ strcmp(buf, "TAD,SPARCLE") == 0)
+ sc->sc_dma_ok = 0;
+#endif
+
if (sc->sc_dma_ok) {
sc->sc_wdcdev.cap |= WDC_CAPABILITY_DMA;
if (rev >= 0x20) {