diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2005-04-20 00:53:12 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2005-04-20 00:53:12 +0000 |
commit | 33e91575565bb3a8cc83ceb556c4f059787f4f31 (patch) | |
tree | 20dbd5fbe03a4cd3aeb2e41eab89827470fa386c /sys | |
parent | 2e3249ac0bb20e6fccf3530d313e189225a9f6fb (diff) |
Replace VIA SATA chip map routine with generic sata_chip_map().
ok grange@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/pciide.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c index 754e29591f9..d0ca8b05b4d 100644 --- a/sys/dev/pci/pciide.c +++ b/sys/dev/pci/pciide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pciide.c,v 1.189 2005/04/20 00:46:20 jsg Exp $ */ +/* $OpenBSD: pciide.c,v 1.190 2005/04/20 00:53:11 jsg Exp $ */ /* $NetBSD: pciide.c,v 1.127 2001/08/03 01:31:08 tsutsui Exp $ */ /* @@ -154,6 +154,7 @@ pciide_pci_write(pci_chipset_tag_t pc, pcitag_t pa, int reg, u_int8_t val) void default_chip_map(struct pciide_softc *, struct pci_attach_args *); +void sata_chip_map(struct pciide_softc *, struct pci_attach_args *); void sata_setup_channel(struct channel_softc *); void piix_chip_map(struct pciide_softc *, struct pci_attach_args *); @@ -168,7 +169,6 @@ void amd756_chip_map(struct pciide_softc *, struct pci_attach_args *); void amd756_setup_channel(struct channel_softc *); void apollo_chip_map(struct pciide_softc *, struct pci_attach_args *); -void apollo_sata_chip_map(struct pciide_softc *, struct pci_attach_args *); void apollo_setup_channel(struct channel_softc *); void cmd_chip_map(struct pciide_softc *, struct pci_attach_args *); @@ -472,7 +472,7 @@ const struct pciide_product_desc pciide_via_products[] = { }, { PCI_PRODUCT_VIATECH_VT8237_SATA, /* VIA VT8237 SATA */ IDE_PCI_CLASS_OVERRIDE, - apollo_sata_chip_map + sata_chip_map } }; @@ -1666,6 +1666,53 @@ next: } void +sata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +{ + struct pciide_channel *cp; + pcireg_t interface = PCI_INTERFACE(pa->pa_class); + int channel; + bus_size_t cmdsize, ctlsize; + + if (pciide_chipen(sc, pa) == 0) + return; + + if (interface == 0) { + WDCDEBUG_PRINT(("sata_chip_map interface == 0\n"), + DEBUG_PROBE); + interface = PCIIDE_INTERFACE_BUS_MASTER_DMA | + PCIIDE_INTERFACE_PCI(0) | PCIIDE_INTERFACE_PCI(1); + } + + printf(": DMA"); + pciide_mapreg_dma(sc, pa); + printf("\n"); + + if (sc->sc_dma_ok) { + sc->sc_wdcdev.cap |= WDC_CAPABILITY_UDMA | + WDC_CAPABILITY_DMA | WDC_CAPABILITY_IRQACK; + sc->sc_wdcdev.irqack = pciide_irqack; + } + sc->sc_wdcdev.PIO_cap = 4; + sc->sc_wdcdev.DMA_cap = 2; + sc->sc_wdcdev.UDMA_cap = 6; + + sc->sc_wdcdev.channels = sc->wdc_chanarray; + sc->sc_wdcdev.nchannels = PCIIDE_NUM_CHANNELS; + sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32 | + WDC_CAPABILITY_MODE | WDC_CAPABILITY_SATA; + sc->sc_wdcdev.set_modes = sata_setup_channel; + + for (channel = 0; channel < sc->sc_wdcdev.nchannels; channel++) { + cp = &sc->pciide_channels[channel]; + if (pciide_chansetup(sc, channel, interface) == 0) + continue; + pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize, + pciide_pci_intr); + sata_setup_channel(&cp->wdc_channel); + } +} + +void sata_setup_channel(struct channel_softc *chp) { struct ata_drive_datas *drvp; @@ -2580,53 +2627,6 @@ next: } void -apollo_sata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) -{ - struct pciide_channel *cp; - pcireg_t interface = PCI_INTERFACE(pa->pa_class); - int channel; - bus_size_t cmdsize, ctlsize; - - if (pciide_chipen(sc, pa) == 0) - return; - - if (interface == 0) { - WDCDEBUG_PRINT(("apollo_sata_chip_map interface == 0\n"), - DEBUG_PROBE); - interface = PCIIDE_INTERFACE_BUS_MASTER_DMA | - PCIIDE_INTERFACE_PCI(0) | PCIIDE_INTERFACE_PCI(1); - } - - printf(": DMA"); - pciide_mapreg_dma(sc, pa); - printf("\n"); - - if (sc->sc_dma_ok) { - sc->sc_wdcdev.cap |= WDC_CAPABILITY_UDMA | - WDC_CAPABILITY_DMA | WDC_CAPABILITY_IRQACK; - sc->sc_wdcdev.irqack = pciide_irqack; - } - sc->sc_wdcdev.PIO_cap = 4; - sc->sc_wdcdev.DMA_cap = 2; - sc->sc_wdcdev.UDMA_cap = 6; - - sc->sc_wdcdev.channels = sc->wdc_chanarray; - sc->sc_wdcdev.nchannels = PCIIDE_NUM_CHANNELS; - sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32 | - WDC_CAPABILITY_MODE | WDC_CAPABILITY_SATA; - sc->sc_wdcdev.set_modes = sata_setup_channel; - - for (channel = 0; channel < sc->sc_wdcdev.nchannels; channel++) { - cp = &sc->pciide_channels[channel]; - if (pciide_chansetup(sc, channel, interface) == 0) - continue; - pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize, - pciide_pci_intr); - sata_setup_channel(&cp->wdc_channel); - } -} - -void apollo_setup_channel(struct channel_softc *chp) { u_int32_t udmatim_reg, datatim_reg; |