diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-06-05 22:40:49 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-06-05 22:40:49 +0000 |
commit | 05cba48e6f3b19c47cbdbdf411d947a9e0455b50 (patch) | |
tree | 9ba8ea8816d47ab9c58c4f20859eeba0127b30bf | |
parent | 74e9ef3a22ef012ef162c5aad4682ffa437621fd (diff) |
Cleanup and enable kauaiata DMA. Tables should be mostly sane
Please _TEST_.
-rw-r--r-- | sys/arch/macppc/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/macppc/conf/RAMDISK | 4 | ||||
-rw-r--r-- | sys/arch/macppc/dev/wdc_obio.c | 67 | ||||
-rw-r--r-- | sys/arch/macppc/pci/kauaiata.c | 31 |
4 files changed, 54 insertions, 52 deletions
diff --git a/sys/arch/macppc/conf/GENERIC b/sys/arch/macppc/conf/GENERIC index 6b0b5bcdead..9d3378cae13 100644 --- a/sys/arch/macppc/conf/GENERIC +++ b/sys/arch/macppc/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.44 2003/06/05 05:17:04 drahn Exp $g +# $OpenBSD: GENERIC,v 1.45 2003/06/05 22:40:48 drahn Exp $g # # PPC GENERIC config file # @@ -55,7 +55,7 @@ ahc* at pci? dev ? function ? # Adaptec 294x, aic78x0 SCSI #pcscp* at pci? dev ? function ? # AMD Am53c974 PCscsi-PCI SCSI pciide* at pci? dev ? function ? kauaiata* at pci? dev ? function ? # Apple ATA 100 -wdc* at kauaiata? flags 0x0 +wdc* at kauaiata? flags 0x1 macobio0 at pci? dev ? function ? gem* at pci? dev ? function ? # GMAC ethernet hme* at pci? dev ? function ? # HME ethernet diff --git a/sys/arch/macppc/conf/RAMDISK b/sys/arch/macppc/conf/RAMDISK index 22541450e8b..ab04074560c 100644 --- a/sys/arch/macppc/conf/RAMDISK +++ b/sys/arch/macppc/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.23 2003/06/05 05:17:04 drahn Exp $ +# $OpenBSD: RAMDISK,v 1.24 2003/06/05 22:40:48 drahn Exp $ # # PPC GENERIC config file # @@ -56,7 +56,7 @@ ahc* at pci? dev ? function ? # Adaptec 294x, aic78x0 SCSI #pcscp* at pci? dev ? function ? # AMD Am53c974 PCscsi-PCI SCSI pciide* at pci? dev ? function ? kauaiata* at pci? dev ? function ? # Apple ATA 100 -wdc* at kauaiata? flags 0x0 +wdc* at kauaiata? flags 0x1 macobio0 at pci? dev ? function ? gem* at pci? dev ? function ? # GMAC ethernet hme* at pci? dev ? function ? # HME ethernet diff --git a/sys/arch/macppc/dev/wdc_obio.c b/sys/arch/macppc/dev/wdc_obio.c index 18fd2a5ac32..772be50af4d 100644 --- a/sys/arch/macppc/dev/wdc_obio.c +++ b/sys/arch/macppc/dev/wdc_obio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdc_obio.c,v 1.9 2003/06/05 05:17:04 drahn Exp $ */ +/* $OpenBSD: wdc_obio.c,v 1.10 2003/06/05 22:40:48 drahn Exp $ */ /* $NetBSD: wdc_obio.c,v 1.15 2001/07/25 20:26:33 bouyer Exp $ */ /*- @@ -179,9 +179,6 @@ wdc_obio_attach(parent, self, aux) cmdbase = ca->ca_reg[0]; cmdsize = ca->ca_reg[1]; - printf("wdc_obio map %x %x %x %x\n", cmdbase, cmdsize, ca->ca_reg[2], - ca->ca_reg[2]); - if (bus_space_map(chp->cmd_iot, cmdbase, cmdsize, 0, &chp->cmd_ioh) || bus_space_subregion(chp->cmd_iot, chp->cmd_ioh, /* WDC_AUXREG_OFFSET<<4 */ 0x160, 1, &chp->ctl_ioh)) @@ -215,7 +212,7 @@ wdc_obio_attach(parent, self, aux) if (strcmp(ca->ca_name, "ata-6") == 0) { sc->sc_wdcdev.cap |= WDC_CAPABILITY_UDMA | WDC_CAPABILITY_MODE; - sc->sc_wdcdev.UDMA_cap = 6; + sc->sc_wdcdev.UDMA_cap = 5; sc->sc_wdcdev.set_modes = wdc_obio_ata6_adjust_timing; } } @@ -273,49 +270,48 @@ static const struct ide_timings udma_timing[] = { /* these number _guessed_ from linux driver. */ static u_int32_t kauai_pio_timing[] = { - #if 0 - /*120*/ 0x04000148, /* Mode 0 */ - /*180*/ 0x05000249, /* Mode 1 */ + #if 1 + /*600*/ 0x08000a92, /* Mode 0 */ + /*360*/ 0x08000392, /* Mode 1 */ /*240*/ 0x0800038b, /* Mode 2 */ - /*360*/ 0x08000392, /* Mode 3 */ - /*600*/ 0x08000a92 /* Mode 4 */ - #endif + /*180*/ 0x05000249, /* Mode 3 */ + /*120*/ 0x04000148 /* Mode 4 */ + #else /*120*/ 0x06000246, /* Mode 0 */ /*180*/ 0x06000246, /* Mode 1 */ /*240*/ 0x06000246, /* Mode 2 */ /*360*/ 0x06000246, /* Mode 3 */ /*600*/ 0x06000246 /* Mode 4 */ + #endif }; static u_int32_t kauai_dma_timing[] = { - #if 0 - /*120*/ 0x00148000, /* Mode 0 */ - /*150*/ 0x00209000, /* Mode 1 */ - /*240*/ 0x0030c000, /* Mode 2 */ - /*360*/ 0x00492000, /* Mode 3 */ - /*480*/ 0x00618000 /* Mode 4 */ - #endif + #if 1 + /*480*/ 0x00618000, /* Mode 0 */ + /*360*/ 0x00492000, /* Mode 1 */ + /*240*/ 0x00149000 /* Mode 2 */ + #else /*120*/ 0x00149000, /* Mode 0 */ /*150*/ 0x00149000, /* Mode 1 */ - /*240*/ 0x00149000, /* Mode 2 */ - /*360*/ 0x00149000, /* Mode 3 */ - /*480*/ 0x00149000 /* Mode 4 */ + /*240*/ 0x00149000 /* Mode 2 */ + #endif }; static u_int32_t kauai_udma_timing[] = { - #if 0 - /* 20*/ 0x00002921, /* Mode 0 */ - /* 30*/ 0x00002a30, /* Mode 1 */ - /* 45*/ 0x00003a50, /* Mode 2 */ - /* 60*/ 0x00004a60, /* Mode 3 */ - /* 90*/ 0x00005d80, /* Mode 4 */ - /*120*/ 0x000070c0 /* Mode 5 */ + #if 1 + /*120*/ 0x000070c0, /* Mode 0 */ + /* 90*/ 0x00005d80, /* Mode 1 */ + /* 60*/ 0x00004a60, /* Mode 2 */ + /* 45*/ 0x00003a50, /* Mode 3 */ + /* 30*/ 0x00002a30, /* Mode 4 */ + /* 20*/ 0x00002921 /* Mode 5 */ + #else + /*120*/ 0x00002921, /* Mode 0 */ + /* 90*/ 0x00002921, /* Mode 1 */ + /* 60*/ 0x00002921, /* Mode 2 */ + /* 45*/ 0x00002921, /* Mode 3 */ + /* 30*/ 0x00002921, /* Mode 4 */ + /* 20*/ 0x00002921 /* Mode 5 */ #endif - /* 20*/ 0x00002921, /* Mode 0 */ - /* 30*/ 0x00002921, /* Mode 1 */ - /* 45*/ 0x00002921, /* Mode 2 */ - /* 60*/ 0x00002921, /* Mode 3 */ - /* 90*/ 0x00002921, /* Mode 4 */ - /*120*/ 0x00002921 /* Mode 5 */ }; #define TIME_TO_TICK(time) howmany((time), 30) @@ -541,12 +537,13 @@ wdc_obio_ata6_adjust_timing(struct channel_softc *chp) if (udmamode == -2) udmamode = -1; - conf = bus_space_read_4(chp->cmd_iot, chp->cmd_ioh, CONFIG_REG); conf1 = bus_space_read_4(chp->cmd_iot, chp->cmd_ioh, KAUAI_ULTRA_CONFIG); +#if 1 printf("ata6 conf old: 0x%x, %x", conf, conf1); +#endif conf = (conf & ~KAUAI_PIO_MASK) | kauai_pio_timing[piomode]; if (dmamode != -1) { diff --git a/sys/arch/macppc/pci/kauaiata.c b/sys/arch/macppc/pci/kauaiata.c index 8df3f93d456..e532ee5c001 100644 --- a/sys/arch/macppc/pci/kauaiata.c +++ b/sys/arch/macppc/pci/kauaiata.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kauaiata.c,v 1.2 2003/06/05 18:29:06 grange Exp $ */ +/* $OpenBSD: kauaiata.c,v 1.3 2003/06/05 22:40:48 drahn Exp $ */ /* * Copyright (c) 2003 Dale Rahn @@ -108,21 +108,26 @@ vendor 0x106b product 0x003b (class undefined unknown subclass 0x00, rev 0x00) a node = OF_finddevice("/pci@f4000000/ata-6"); + /* + * XXX - need to compare node and PCI id to verify this is the + * correct device. + */ + ca.ca_nreg = OF_getprop(node, "reg", reg, sizeof(reg)); - printf("nreg %x\n", ca.ca_nreg); intr[0] = PCI_INTERRUPT_LINE(pci_conf_read(pc, pa->pa_tag, PCI_INTERRUPT_REG)); - ca.ca_nintr = 4; /* XXX */ - intr[0] = 0x27; /* XXXX */ + ca.ca_nintr = 4; /* claim to have 4 bytes of interrupt info */ + /* This needs to come from INTERRUPT REG above, but is not filled out */ + intr[0] = 0x27; namelen = OF_getprop(node, "name", name, sizeof(name)); - if (namelen < 0) - return; - if (namelen >= sizeof(name)) + if ((namelen < 0) || (namelen >= sizeof(name))) { + printf(" bad name prop len %x\n", namelen); return; + } - name[namelen] = 0; + name[namelen] = 0; /* name property may not be null terminated */ /* config read */ sc->sc_membus_space.bus_base = @@ -134,7 +139,7 @@ vendor 0x106b product 0x003b (class undefined unknown subclass 0x00, rev 0x00) a sc->sc_membus_space.bus_base); #endif - ca.ca_baseaddr = 0; + ca.ca_baseaddr = sc->sc_membus_space.bus_base; sc->sc_membus_space.bus_reverse = 1; @@ -143,10 +148,10 @@ vendor 0x106b product 0x003b (class undefined unknown subclass 0x00, rev 0x00) a ca.ca_dmat = pa->pa_dmat; ca.ca_reg = reg; - reg[0] = sc->sc_membus_space.bus_base + 0x2000; - reg[1] = reg[9]; /* XXX */ - reg[2] = sc->sc_membus_space.bus_base + 0x1000; - reg[3] = 0x1000; /* XXX */ + reg[0] = 0x2000; /* offset to wdc registers */ + reg[1] = reg[9] - 0x2000; /* map size of wdc registers */ + reg[2] = 0x1000; /* offset to dbdma registers */ + reg[3] = 0x1000; /* map size of dbdma registers */ ca.ca_intr = intr; printf("\n"); |