/*
* Copyright (c) 2004, Manuel Bouyer.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
switch (sc->sc_pp->ide_product) {
case PCI_PRODUCT_PROMISE_PDC20318:
case PCI_PRODUCT_PROMISE_PDC20319:
bus_space_write_4(sc->sc_ba5_st, sc->sc_ba5_sh, 0x6c,
0x00ff0033);
sc->sc_wdcdev.sc_atac.atac_probe = wdc_sataprobe;
sc->sc_wdcdev.sc_atac.atac_nchannels = PDC203xx_SATA_NCHANNELS;
sc->sc_wdcdev.wdc_maxdrives = 1;
break;
case PCI_PRODUCT_PROMISE_PDC20371:
case PCI_PRODUCT_PROMISE_PDC20375:
case PCI_PRODUCT_PROMISE_PDC20376:
case PCI_PRODUCT_PROMISE_PDC20377:
case PCI_PRODUCT_PROMISE_PDC20378:
case PCI_PRODUCT_PROMISE_PDC20379:
bus_space_write_4(sc->sc_ba5_st, sc->sc_ba5_sh, 0x6c,
0x00ff0033);
sc->sc_wdcdev.sc_atac.atac_probe = pdc203xx_combo_probe;
sc->sc_wdcdev.sc_atac.atac_nchannels = PDC203xx_COMBO_NCHANNELS;
break;
case PCI_PRODUCT_PROMISE_PDC40518:
case PCI_PRODUCT_PROMISE_PDC40519:
case PCI_PRODUCT_PROMISE_PDC40718:
case PCI_PRODUCT_PROMISE_PDC40719:
case PCI_PRODUCT_PROMISE_PDC40779:
bus_space_write_4(sc->sc_ba5_st, sc->sc_ba5_sh, 0x60,
0x00ff00ff);
sc->sc_wdcdev.sc_atac.atac_nchannels = PDC40718_SATA_NCHANNELS;
sc->sc_wdcdev.sc_atac.atac_probe = wdc_sataprobe;
sc->sc_wdcdev.wdc_maxdrives = 1;
break;
case PCI_PRODUCT_PROMISE_PDC20571:
case PCI_PRODUCT_PROMISE_PDC20575:
case PCI_PRODUCT_PROMISE_PDC20579:
case PCI_PRODUCT_PROMISE_PDC20771:
case PCI_PRODUCT_PROMISE_PDC20775:
bus_space_write_4(sc->sc_ba5_st, sc->sc_ba5_sh, 0x60,
0x00ff00ff);
sc->sc_wdcdev.sc_atac.atac_nchannels = PDC20575_COMBO_NCHANNELS;
sc->sc_wdcdev.sc_atac.atac_probe = pdc203xx_combo_probe;
break;
case PCI_PRODUCT_PROMISE_PDC20617:
case PCI_PRODUCT_PROMISE_PDC20618:
case PCI_PRODUCT_PROMISE_PDC20619:
case PCI_PRODUCT_PROMISE_PDC20620:
case PCI_PRODUCT_PROMISE_PDC20621:
sc->sc_wdcdev.sc_atac.atac_nchannels =
((bus_space_read_4(sc->sc_ba5_st, sc->sc_ba5_sh,
0x48) & 0x01) ? 1 : 0) +
((bus_space_read_4(sc->sc_ba5_st, sc->sc_ba5_sh,
0x48) & 0x02) ? 1 : 0) +
2;
sc->sc_wdcdev.sc_atac.atac_probe = wdc_drvprobe;
if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh,
0x0238 + (channel << 7), 1, &wdr->ctl_ioh) != 0) {
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"couldn't map channel %d ctl regs\n", channel);
goto next_channel;
}
for (i = 0; i < WDC_NREG; i++) {
if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh,
0x0200 + (i << 2) + (channel << 7), i == 0 ? 4 : 1,
&wdr->cmd_iohs[i]) != 0) {
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"couldn't map channel %d cmd regs\n",
channel);
goto next_channel;
}
}
wdc_init_shadow_regs(wdr);
/*
* subregion de busmaster registers. They're spread all over
* the controller's register space :(. They are also 4 bytes
* sized, with some specific extensions in the extra bits.
* It also seems that the IDEDMA_CTL register isn't available.
*/
if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh,
0x260 + (channel << 7), 1,
&cp->dma_iohs[IDEDMA_CMD]) != 0) {
aprint_normal("%s channel %d: can't subregion DMA "
"registers\n",
device_xname(sc->sc_wdcdev.sc_atac.atac_dev),
channel);
goto next_channel;
}
if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh,
0x244 + (channel << 7), 4,
&cp->dma_iohs[IDEDMA_TBL]) != 0) {
aprint_normal("%s channel %d: can't subregion DMA "
"registers\n",
device_xname(sc->sc_wdcdev.sc_atac.atac_dev),
channel);
goto next_channel;
}