? sys/dev/cardbus/pciide_cardbus_common.c ? sys/dev/cardbus/pciide_cardbusvar.h Index: sys/dev/cardbus/cardbusvar.h =================================================================== RCS file: /cvsroot/src/sys/dev/cardbus/cardbusvar.h,v retrieving revision 1.43 diff -u -r1.43 cardbusvar.h --- sys/dev/cardbus/cardbusvar.h 26 Jun 2008 12:33:17 -0000 1.43 +++ sys/dev/cardbus/cardbusvar.h 28 Sep 2008 16:53:09 -0000 @@ -35,8 +35,10 @@ #ifndef _DEV_CARDBUS_CARDBUSVAR_H_ #define _DEV_CARDBUS_CARDBUSVAR_H_ +#include "cardbus.h" + #include -#if 1 +#if NCARDBUS > 0 #include #endif Index: sys/dev/cardbus/files.cardbus =================================================================== RCS file: /cvsroot/src/sys/dev/cardbus/files.cardbus,v retrieving revision 1.34 diff -u -r1.34 files.cardbus --- sys/dev/cardbus/files.cardbus 7 Sep 2006 14:22:07 -0000 1.34 +++ sys/dev/cardbus/files.cardbus 28 Sep 2008 16:53:09 -0000 @@ -131,3 +131,15 @@ # attach njata at cardbus with njata_cardbus file dev/cardbus/njata_cardbus.c njata_cardbus + +# +# PCI IDE controllers +# +define pciide_cardbus_common +file dev/cardbus/pciide_cardbus_common.c pciide_cardbus_common + +# +# Silicon Image SATALink controllers +# +attach satalink at cardbus with satalink_cardbus: pciide_cardbus_common +file dev/cardbus/satalink_cardbus.c satalink_cardbus Index: sys/dev/pci/acardide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/acardide.c,v retrieving revision 1.23 diff -u -r1.23 acardide.c --- sys/dev/pci/acardide.c 14 May 2008 13:29:29 -0000 1.23 +++ sys/dev/pci/acardide.c 28 Sep 2008 16:53:10 -0000 @@ -36,7 +36,7 @@ #include #include -static void acard_chip_map(struct pciide_softc*, struct pci_attach_args*); +static void acard_chip_map(struct pciide_softc*, union bus_attach_args*); static void acard_setup_channel(struct ata_channel*); #if 0 /* XXX !! */ static int acard_pci_intr(void *); @@ -110,8 +110,9 @@ ((sc)->sc_pp->ide_product == PCI_PRODUCT_ACARD_ATP850U) static void -acard_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +acard_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; int i; pcireg_t interface; Index: sys/dev/pci/aceride.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/aceride.c,v retrieving revision 1.25 diff -u -r1.25 aceride.c --- sys/dev/pci/aceride.c 18 Mar 2008 20:46:36 -0000 1.25 +++ sys/dev/pci/aceride.c 28 Sep 2008 16:53:10 -0000 @@ -43,7 +43,7 @@ static int acer_pcib_match(struct pci_attach_args *); static void acer_do_reset(struct ata_channel *, int); -static void acer_chip_map(struct pciide_softc*, struct pci_attach_args*); +static void acer_chip_map(struct pciide_softc*, union bus_attach_args*); static void acer_setup_channel(struct ata_channel*); static int acer_pci_intr(void *); @@ -113,8 +113,9 @@ } static void -acer_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +acer_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; int channel; pcireg_t cr, interface; Index: sys/dev/pci/artsata.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/artsata.c,v retrieving revision 1.18 diff -u -r1.18 artsata.c --- sys/dev/pci/artsata.c 28 Apr 2008 20:23:54 -0000 1.18 +++ sys/dev/pci/artsata.c 28 Sep 2008 16:53:10 -0000 @@ -49,7 +49,7 @@ #include #include -static void artisea_chip_map(struct pciide_softc*, struct pci_attach_args *); +static void artisea_chip_map(struct pciide_softc*, union bus_attach_args *); static int artsata_match(device_t, cfdata_t, void *); static void artsata_attach(device_t, device_t, void *); @@ -385,8 +385,9 @@ } static void -artisea_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +artisea_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; bus_size_t cmdsize, ctlsize; pcireg_t interface; Index: sys/dev/pci/cmdide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/cmdide.c,v retrieving revision 1.28 diff -u -r1.28 cmdide.c --- sys/dev/pci/cmdide.c 18 Mar 2008 20:46:36 -0000 1.28 +++ sys/dev/pci/cmdide.c 28 Sep 2008 16:53:11 -0000 @@ -49,14 +49,14 @@ CFATTACH_DECL_NEW(cmdide, sizeof(struct pciide_softc), cmdide_match, cmdide_attach, NULL, NULL); -static void cmd_chip_map(struct pciide_softc*, struct pci_attach_args*); -static void cmd0643_9_chip_map(struct pciide_softc*, struct pci_attach_args*); +static void cmd_chip_map(struct pciide_softc*, union bus_attach_args*); +static void cmd0643_9_chip_map(struct pciide_softc*, union bus_attach_args*); static void cmd0643_9_setup_channel(struct ata_channel*); static void cmd_channel_map(struct pci_attach_args *, struct pciide_softc *, int); static int cmd_pci_intr(void *); static void cmd646_9_irqack(struct ata_channel *); -static void cmd680_chip_map(struct pciide_softc*, struct pci_attach_args*); +static void cmd680_chip_map(struct pciide_softc*, union bus_attach_args*); static void cmd680_setup_channel(struct ata_channel*); static void cmd680_channel_map(struct pci_attach_args *, struct pciide_softc *, int); @@ -236,8 +236,9 @@ } static void -cmd_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +cmd_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; int channel; /* @@ -272,8 +273,9 @@ } static void -cmd0643_9_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +cmd0643_9_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; int channel; pcireg_t rev = PCI_REVISION(pa->pa_class); @@ -462,8 +464,9 @@ } static void -cmd680_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +cmd680_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; int channel; if (pciide_chipen(sc, pa) == 0) Index: sys/dev/pci/cypide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/cypide.c,v retrieving revision 1.21 diff -u -r1.21 cypide.c --- sys/dev/pci/cypide.c 18 Mar 2008 20:46:36 -0000 1.21 +++ sys/dev/pci/cypide.c 28 Sep 2008 16:53:11 -0000 @@ -44,7 +44,7 @@ #include #include -static void cy693_chip_map(struct pciide_softc*, struct pci_attach_args*); +static void cy693_chip_map(struct pciide_softc*, union bus_attach_args*); static void cy693_setup_channel(struct ata_channel*); static int cypide_match(device_t, cfdata_t, void *); @@ -94,8 +94,9 @@ } static void -cy693_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +cy693_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; pcireg_t interface = PCI_INTERFACE(pa->pa_class); bus_size_t cmdsize, ctlsize; Index: sys/dev/pci/geodeide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/geodeide.c,v retrieving revision 1.15 diff -u -r1.15 geodeide.c --- sys/dev/pci/geodeide.c 18 Mar 2008 20:46:36 -0000 1.15 +++ sys/dev/pci/geodeide.c 28 Sep 2008 17:00:51 -0000 @@ -52,7 +52,7 @@ #include static void geodeide_chip_map(struct pciide_softc *, - struct pci_attach_args *); + union bus_attach_args *); static void geodeide_setup_channel(struct ata_channel *); static int geodeide_dma_init(void *, int, int, void *, size_t, int); @@ -107,8 +107,9 @@ } static void -geodeide_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +geodeide_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; int channel; bus_size_t cmdsize, ctlsize; Index: sys/dev/pci/hptide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/hptide.c,v retrieving revision 1.25 diff -u -r1.25 hptide.c --- sys/dev/pci/hptide.c 18 Mar 2008 20:46:36 -0000 1.25 +++ sys/dev/pci/hptide.c 28 Sep 2008 16:53:11 -0000 @@ -41,7 +41,7 @@ #include #include -static void hpt_chip_map(struct pciide_softc*, struct pci_attach_args*); +static void hpt_chip_map(struct pciide_softc*, union bus_attach_args*); static void hpt_setup_channel(struct ata_channel*); static int hpt_pci_intr(void *); @@ -110,8 +110,9 @@ } static void -hpt_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +hpt_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; int i, compatchan, revision; pcireg_t interface; Index: sys/dev/pci/iteide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/iteide.c,v retrieving revision 1.10 diff -u -r1.10 iteide.c --- sys/dev/pci/iteide.c 10 Apr 2008 19:13:37 -0000 1.10 +++ sys/dev/pci/iteide.c 28 Sep 2008 16:53:11 -0000 @@ -42,7 +42,7 @@ #include #include -static void ite_chip_map(struct pciide_softc*, struct pci_attach_args*); +static void ite_chip_map(struct pciide_softc*, union bus_attach_args*); static void ite_setup_channel(struct ata_channel*); static int iteide_match(device_t, cfdata_t, void *); @@ -94,8 +94,9 @@ } static void -ite_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +ite_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; int channel; pcireg_t interface; Index: sys/dev/pci/ixpide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/ixpide.c,v retrieving revision 1.13 diff -u -r1.13 ixpide.c --- sys/dev/pci/ixpide.c 6 Sep 2008 22:18:56 -0000 1.13 +++ sys/dev/pci/ixpide.c 28 Sep 2008 16:53:11 -0000 @@ -41,7 +41,7 @@ static int ixpide_match(device_t, cfdata_t, void *); static void ixpide_attach(device_t, device_t, void *); -static void ixp_chip_map(struct pciide_softc *, struct pci_attach_args *); +static void ixp_chip_map(struct pciide_softc *, union bus_attach_args *); static void ixp_setup_channel(struct ata_channel *); CFATTACH_DECL_NEW(ixpide, sizeof(struct pciide_softc), @@ -89,8 +89,9 @@ } static void -ixp_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +ixp_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; int channel; pcireg_t interface; Index: sys/dev/pci/jmide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/jmide.c,v retrieving revision 1.6 diff -u -r1.6 jmide.c --- sys/dev/pci/jmide.c 5 Jun 2008 18:22:02 -0000 1.6 +++ sys/dev/pci/jmide.c 28 Sep 2008 16:53:11 -0000 @@ -53,7 +53,7 @@ static void jmide_attach(device_t, device_t, void *); static int jmide_intr(void *); -static void jmpata_chip_map(struct pciide_softc*, struct pci_attach_args*); +static void jmpata_chip_map(struct pciide_softc*, union bus_attach_args*); static void jmpata_setup_channel(struct ata_channel*); static int jmahci_print(void *, const char *); @@ -308,8 +308,9 @@ } static void -jmpata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +jmpata_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct jmide_softc *jmidesc = (struct jmide_softc *)sc; int channel; pcireg_t interface; Index: sys/dev/pci/optiide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/optiide.c,v retrieving revision 1.17 diff -u -r1.17 optiide.c --- sys/dev/pci/optiide.c 28 Apr 2008 20:23:55 -0000 1.17 +++ sys/dev/pci/optiide.c 28 Sep 2008 16:53:12 -0000 @@ -41,7 +41,7 @@ #include #include -static void opti_chip_map(struct pciide_softc*, struct pci_attach_args*); +static void opti_chip_map(struct pciide_softc*, union bus_attach_args*); static void opti_setup_channel(struct ata_channel*); static int optiide_match(device_t, cfdata_t, void *); @@ -101,8 +101,9 @@ } static void -opti_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +opti_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; bus_size_t cmdsize, ctlsize; pcireg_t interface; Index: sys/dev/pci/pciide_common.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/pciide_common.c,v retrieving revision 1.38 diff -u -r1.38 pciide_common.c --- sys/dev/pci/pciide_common.c 18 Mar 2008 20:46:37 -0000 1.38 +++ sys/dev/pci/pciide_common.c 28 Sep 2008 16:53:18 -0000 @@ -133,6 +133,7 @@ #if NATA_DMA pcireg_t csr; #endif + union bus_attach_args ba; char devinfo[256]; const char *displaydev; @@ -169,7 +170,8 @@ if (atadebug_pciide_mask & DEBUG_PROBE) pci_conf_print(sc->sc_pc, sc->sc_tag, NULL); #endif - sc->sc_pp->chip_map(sc, pa); + ba.pa = pa; + sc->sc_pp->chip_map(sc, &ba); #if NATA_DMA if (sc->sc_dma_ok) { @@ -866,10 +868,11 @@ } void -default_chip_map(sc, pa) +default_chip_map(sc, ba) struct pciide_softc *sc; - struct pci_attach_args *pa; + union bus_attach_args *ba; { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; pcireg_t interface = PCI_INTERFACE(pa->pa_class); pcireg_t csr; Index: sys/dev/pci/pciidevar.h =================================================================== RCS file: /cvsroot/src/sys/dev/pci/pciidevar.h,v retrieving revision 1.36 diff -u -r1.36 pciidevar.h --- sys/dev/pci/pciidevar.h 4 Jan 2008 00:27:27 -0000 1.36 +++ sys/dev/pci/pciidevar.h 28 Sep 2008 16:53:18 -0000 @@ -39,6 +39,7 @@ * Author: Christopher G. Demetriou, March 2, 1998. */ +#include #include #include #include @@ -78,6 +79,8 @@ struct wdc_softc sc_wdcdev; /* common wdc definitions */ pci_chipset_tag_t sc_pc; /* PCI registers info */ pcitag_t sc_tag; + bus_size_t sc_cmdsize[PCIIDE_NUM_CHANNELS]; + bus_size_t sc_ctlsize[PCIIDE_NUM_CHANNELS]; void *sc_pci_ih; /* PCI interrupt handle */ #if NATA_DMA int sc_dma_ok; /* bus-master DMA info */ @@ -90,6 +93,7 @@ */ bus_space_tag_t sc_dma_iot; bus_space_handle_t sc_dma_ioh; + bus_size_t sc_dma_size; bus_dma_tag_t sc_dmat; /* @@ -115,7 +119,10 @@ */ bus_space_tag_t sc_ba5_st; bus_space_handle_t sc_ba5_sh; + bus_size_t sc_ba5_ssize; int sc_ba5_en; + uint32_t (*sc_ba5_read_4)(struct pciide_softc *, bus_addr_t); + void (*sc_ba5_write_4)(struct pciide_softc *, bus_addr_t, uint32_t); #endif /* NATA_DMA */ /* Vendor info (for interpreting Chip description) */ @@ -159,12 +166,17 @@ /* Given an ata_channel, get the pciide_channel. */ #define CHAN_TO_PCHAN(chp) ((struct pciide_channel *) (chp)) +union bus_attach_args { + struct pci_attach_args *pa; + struct cardbus_attach_args *ca; +}; + struct pciide_product_desc { u_int32_t ide_product; int ide_flags; const char *ide_name; /* map and setup chip, probe drives */ - void (*chip_map)(struct pciide_softc*, struct pci_attach_args*); + void (*chip_map)(struct pciide_softc*, union bus_attach_args*); }; /* Flags for ide_flags */ @@ -202,7 +214,7 @@ pci_conf_write(pc, pa, (reg & ~0x03), pcival); } -void default_chip_map(struct pciide_softc*, struct pci_attach_args*); +void default_chip_map(struct pciide_softc*, union bus_attach_args*); void sata_setup_channel(struct ata_channel*); void pciide_channel_dma_setup(struct pciide_channel *); Index: sys/dev/pci/pdcide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/pdcide.c,v retrieving revision 1.26 diff -u -r1.26 pdcide.c --- sys/dev/pci/pdcide.c 18 Mar 2008 20:46:37 -0000 1.26 +++ sys/dev/pci/pdcide.c 28 Sep 2008 16:53:18 -0000 @@ -41,7 +41,7 @@ #include #include -static void pdc202xx_chip_map(struct pciide_softc *, struct pci_attach_args *); +static void pdc202xx_chip_map(struct pciide_softc *, union bus_attach_args *); static void pdc202xx_setup_channel(struct ata_channel *); static void pdc20268_setup_channel(struct ata_channel *); static int pdc202xx_pci_intr(void *); @@ -181,8 +181,9 @@ (sc)->sc_pp->ide_product == PCI_PRODUCT_PROMISE_PDC20277) static void -pdc202xx_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +pdc202xx_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; int channel; pcireg_t interface, st, mode; Index: sys/dev/pci/pdcsata.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/pdcsata.c,v retrieving revision 1.16 diff -u -r1.16 pdcsata.c --- sys/dev/pci/pdcsata.c 18 Mar 2008 20:46:37 -0000 1.16 +++ sys/dev/pci/pdcsata.c 28 Sep 2008 16:53:18 -0000 @@ -61,7 +61,7 @@ #define PDC205_SCONTROL(ch) PDC205_REGADDR(0x408,ch) #define PDC205_MULTIPLIER(ch) PDC205_REGADDR(0x4e8,ch) -static void pdcsata_chip_map(struct pciide_softc *, struct pci_attach_args *); +static void pdcsata_chip_map(struct pciide_softc *, union bus_attach_args *); static void pdc203xx_setup_channel(struct ata_channel *); static void pdc203xx_irqack(struct ata_channel *); static int pdc203xx_dma_init(void *, int, int, void *, size_t, int); @@ -225,8 +225,9 @@ } static void -pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +pdcsata_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; struct ata_channel *wdc_cp; struct wdc_regs *wdr; Index: sys/dev/pci/piixide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/piixide.c,v retrieving revision 1.46 diff -u -r1.46 piixide.c --- sys/dev/pci/piixide.c 18 Mar 2008 20:46:37 -0000 1.46 +++ sys/dev/pci/piixide.c 28 Sep 2008 16:53:19 -0000 @@ -41,13 +41,13 @@ #include #include -static void piix_chip_map(struct pciide_softc*, struct pci_attach_args *); +static void piix_chip_map(struct pciide_softc*, union bus_attach_args *); static void piix_setup_channel(struct ata_channel *); static void piix3_4_setup_channel(struct ata_channel *); static u_int32_t piix_setup_idetim_timings(u_int8_t, u_int8_t, u_int8_t); static u_int32_t piix_setup_idetim_drvs(struct ata_drive_datas *); static u_int32_t piix_setup_sidetim_timings(u_int8_t, u_int8_t, u_int8_t); -static void piixsata_chip_map(struct pciide_softc*, struct pci_attach_args *); +static void piixsata_chip_map(struct pciide_softc*, union bus_attach_args *); static int piix_dma_init(void *, int, int, void *, size_t, int); static bool piixide_resume(device_t PMF_FN_PROTO); @@ -310,8 +310,9 @@ } static void -piix_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +piix_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; int channel; u_int32_t idetim; @@ -815,8 +816,9 @@ } static void -piixsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +piixsata_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; bus_size_t cmdsize, ctlsize; pcireg_t interface, cmdsts; Index: sys/dev/pci/satalink.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/satalink.c,v retrieving revision 1.38 diff -u -r1.38 satalink.c --- sys/dev/pci/satalink.c 28 Apr 2008 20:23:55 -0000 1.38 +++ sys/dev/pci/satalink.c 28 Sep 2008 16:53:19 -0000 @@ -410,8 +366,9 @@ } static void -sii3112_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +sii3112_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; bus_size_t cmdsize, ctlsize; pcireg_t interface, scs_cmd, cfgctl; @@ -654,8 +611,9 @@ } static void -sii3114_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +sii3114_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; pcireg_t scs_cmd; pci_intr_handle_t intrhandle; Index: sys/dev/pci/siside.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/siside.c,v retrieving revision 1.23 diff -u -r1.23 siside.c --- sys/dev/pci/siside.c 18 Mar 2008 20:46:37 -0000 1.23 +++ sys/dev/pci/siside.c 28 Sep 2008 16:53:19 -0000 @@ -41,8 +41,8 @@ #include #include -static void sis_chip_map(struct pciide_softc *, struct pci_attach_args *); -static void sis_sata_chip_map(struct pciide_softc *, struct pci_attach_args *); +static void sis_chip_map(struct pciide_softc *, union bus_attach_args *); +static void sis_sata_chip_map(struct pciide_softc *, union bus_attach_args *); static void sis_setup_channel(struct ata_channel *); static void sis96x_setup_channel(struct ata_channel *); @@ -215,8 +215,9 @@ } static void -sis_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +sis_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; int channel; u_int8_t sis_ctr0 = pciide_pci_read(sc->sc_pc, sc->sc_tag, SIS_CTRL0); @@ -504,8 +505,9 @@ } static void -sis_sata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +sis_sata_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; pcireg_t interface = PCI_INTERFACE(pa->pa_class); int channel; Index: sys/dev/pci/slide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/slide.c,v retrieving revision 1.20 diff -u -r1.20 slide.c --- sys/dev/pci/slide.c 28 Apr 2008 20:23:55 -0000 1.20 +++ sys/dev/pci/slide.c 28 Sep 2008 16:53:19 -0000 @@ -41,7 +41,7 @@ #include #include -static void sl82c105_chip_map(struct pciide_softc*, struct pci_attach_args*); +static void sl82c105_chip_map(struct pciide_softc*, union bus_attach_args*); static void sl82c105_setup_channel(struct ata_channel*); static int slide_match(device_t, cfdata_t, void *); @@ -125,8 +125,9 @@ } static void -sl82c105_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +sl82c105_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; bus_size_t cmdsize, ctlsize; pcireg_t interface, idecr; Index: sys/dev/pci/svwsata.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/svwsata.c,v retrieving revision 1.10 diff -u -r1.10 svwsata.c --- sys/dev/pci/svwsata.c 18 Mar 2008 20:46:37 -0000 1.10 +++ sys/dev/pci/svwsata.c 28 Sep 2008 16:53:19 -0000 @@ -34,7 +34,7 @@ static int svwsata_match(device_t, cfdata_t, void *); static void svwsata_attach(device_t, device_t, void *); -static void svwsata_chip_map(struct pciide_softc *, struct pci_attach_args *); +static void svwsata_chip_map(struct pciide_softc *, union bus_attach_args *); static void svwsata_mapreg_dma(struct pciide_softc *, struct pci_attach_args *); static void svwsata_mapchan(struct pciide_channel *); @@ -100,8 +100,9 @@ } static void -svwsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +svwsata_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; pci_intr_handle_t intrhandle; pcireg_t interface; Index: sys/dev/pci/viaide.c =================================================================== RCS file: /cvsroot/src/sys/dev/pci/viaide.c,v retrieving revision 1.57 diff -u -r1.57 viaide.c --- sys/dev/pci/viaide.c 6 Sep 2008 22:42:59 -0000 1.57 +++ sys/dev/pci/viaide.c 28 Sep 2008 16:53:20 -0000 @@ -43,7 +43,7 @@ #include static int via_pcib_match(struct pci_attach_args *); -static void via_chip_map(struct pciide_softc *, struct pci_attach_args *); +static void via_chip_map(struct pciide_softc *, union bus_attach_args *); static void via_mapchan(struct pci_attach_args *, struct pciide_channel *, pcireg_t, bus_size_t *, bus_size_t *, int (*)(void *)); static void via_mapregs_compat_native(struct pci_attach_args *, @@ -53,13 +53,13 @@ static void via_sata_chip_map(struct pciide_softc *, struct pci_attach_args *, int); static void via_sata_chip_map_0(struct pciide_softc *, - struct pci_attach_args *); + union bus_attach_args *); static void via_sata_chip_map_6(struct pciide_softc *, - struct pci_attach_args *); + union bus_attach_args *); static void via_sata_chip_map_7(struct pciide_softc *, - struct pci_attach_args *); + union bus_attach_args *); static void via_sata_chip_map_new(struct pciide_softc *, - struct pci_attach_args *); + union bus_attach_args *); static void via_setup_channel(struct ata_channel *); static int viaide_match(device_t, cfdata_t, void *); @@ -430,8 +430,9 @@ } static void -via_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) +via_chip_map(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; pcireg_t interface = PCI_INTERFACE(pa->pa_class); pcireg_t vendor = PCI_VENDOR(pa->pa_id); @@ -955,26 +956,33 @@ } static void -via_sata_chip_map_0(struct pciide_softc *sc, struct pci_attach_args *pa) +via_sata_chip_map_0(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; + via_sata_chip_map(sc, pa, 0); } static void -via_sata_chip_map_6(struct pciide_softc *sc, struct pci_attach_args *pa) +via_sata_chip_map_6(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; + via_sata_chip_map(sc, pa, 6); } static void -via_sata_chip_map_7(struct pciide_softc *sc, struct pci_attach_args *pa) +via_sata_chip_map_7(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; + via_sata_chip_map(sc, pa, 7); } static void -via_sata_chip_map_new(struct pciide_softc *sc, struct pci_attach_args *pa) +via_sata_chip_map_new(struct pciide_softc *sc, union bus_attach_args *ba) { + struct pci_attach_args *pa = ba->pa; struct pciide_channel *cp; struct ata_channel *wdc_cp; struct wdc_regs *wdr; --- sys/dev/cardbus/pciide_cardbus_common.c.orig 1970-01-01 09:00:00.000000000 +0900 +++ sys/dev/cardbus/pciide_cardbus_common.c 2008-09-28 21:54:46.000000000 +0900 @@ -0,0 +1,399 @@ +/* $NetBSD: pciide_common.c,v 1.38 2008/03/18 20:46:37 cube Exp $ */ + + +/* + * Copyright (c) 1999, 2000, 2001, 2003 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Manuel Bouyer. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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. + * + */ + + +/* + * Copyright (c) 1996, 1998 Christopher G. Demetriou. All rights reserved. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * 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. + */ + +/* + * PCI IDE controller driver. + * + * Author: Christopher G. Demetriou, March 2, 1998 (derived from NetBSD + * sys/dev/pci/ppb.c, revision 1.16). + * + * See "PCI IDE Controller Specification, Revision 1.0 3/4/94" and + * "Programming Interface for Bus Master IDE Controller, Revision 1.0 + * 5/16/94" from the PCI SIG. + * + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.38 2008/03/18 20:46:37 cube Exp $"); + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#ifdef ATADEBUG +extern int atadebug_pciide_mask; +#endif + +#if NATA_DMA +static const char dmaerrfmt[] = + "%s:%d: unable to %s table DMA map for drive %d, error=%d\n"; +#endif + + +void +pciide_cardbus_common_attach(struct cardbus_pciide_softc *sc, + struct cardbus_attach_args *ca, + const struct pciide_product_desc *pp) +{ + struct pciide_softc *psc = &sc->sc_pidesc; + cardbus_devfunc_t ct = ca->ca_ct; + cardbus_chipset_tag_t cc = ct->ct_cc; + cardbus_function_tag_t cf = ct->ct_cf; + cardbustag_t tag = ca->ca_tag; +#if NATA_DMA + cardbusreg_t csr; +#endif + union bus_attach_args ba; + const char *displaydev; + + aprint_naive(": disk controller\n"); + aprint_normal("\n"); + + psc->sc_pci_id = ca->ca_id; + psc->sc_pp = pp; + displaydev = sc->sc_pidesc.sc_pp->ide_name; + + aprint_normal_dev(psc->sc_wdcdev.sc_atac.atac_dev, "%s (rev. 0x%02x)\n", + displaydev, CARDBUS_REVISION(ca->ca_class)); + + sc->sc_ct = ct; + sc->sc_cc = cc; + sc->sc_cf = cf; + sc->sc_ctag = ca->ca_tag; + + (cf->cardbus_ctrl)(cc, CARDBUS_IO_ENABLE); + (cf->cardbus_ctrl)(cc, CARDBUS_MEM_ENABLE); + (cf->cardbus_ctrl)(cc, CARDBUS_BM_ENABLE); + +#if NATA_DMA + /* Set up DMA defaults; these might be adjusted by chip_map. */ + psc->sc_dma_maxsegsz = IDEDMA_BYTE_COUNT_MAX; + psc->sc_dma_boundary = IDEDMA_BYTE_COUNT_ALIGN; +#endif + +#if 0 +#ifdef ATADEBUG + if (atadebug_pciide_mask & DEBUG_PROBE) + pci_conf_print(sc->sc_pc, sc->sc_tag, NULL); +#endif +#endif + ba.ca = ca; + psc->sc_pp->chip_map(psc, &ba); + + csr = cardbus_conf_read(cc, cf, tag, CARDBUS_COMMAND_STATUS_REG); + csr |= (PCI_COMMAND_IO_ENABLE | CARDBUS_COMMAND_MEM_ENABLE); +#if NATA_DMA + if (psc->sc_dma_ok) + csr |= PCI_COMMAND_MASTER_ENABLE; +#endif + cardbus_conf_write(cc, cf, tag, CARDBUS_COMMAND_STATUS_REG, csr); + + ATADEBUG_PRINT(("pciide: command/status register=%x\n", + cardbus_conf_read(cc, cf, tag, CARDBUS_COMMAND_STATUS_REG)), + DEBUG_PROBE); +} + +int +pciide_cardbus_common_detach(struct cardbus_pciide_softc *sc, int force) +{ + struct pciide_softc *psc = &sc->sc_pidesc; + struct pciide_channel *cp; + struct ata_channel *wdc_cp; + struct wdc_regs *wdr; + int chan, rv; + + rv = wdcdetach(psc->sc_wdcdev.sc_atac.atac_dev, force); + + if (psc->sc_pci_ih != NULL) + cardbus_intr_disestablish(sc->sc_cc, sc->sc_cf, psc->sc_pci_ih); + if (psc->sc_dma_ok) + Cardbus_mapreg_unmap(sc->sc_ct, PCIIDE_REG_BUS_MASTER_DMA, + psc->sc_dma_iot, psc->sc_dma_ioh, psc->sc_dma_size); + for (chan = 0; chan < psc->sc_wdcdev.sc_atac.atac_nchannels; chan++) { + cp = &psc->pciide_channels[chan]; + wdc_cp = &cp->ata_channel; + wdr = CHAN_TO_WDC_REGS(wdc_cp); + if (psc->sc_cmdsize[chan]) + Cardbus_mapreg_unmap(sc->sc_ct, + PCIIDE_REG_CMD_BASE(chan), wdr->cmd_iot, + wdr->cmd_baseioh, psc->sc_cmdsize[chan]); + if (psc->sc_ctlsize[chan]) + Cardbus_mapreg_unmap(sc->sc_ct, + PCIIDE_REG_CTL_BASE(chan), wdr->ctl_iot, + cp->ctl_baseioh, psc->sc_ctlsize[chan]); + } + return rv; +} + +void +pciide_cardbus_mapregs_native(struct cardbus_attach_args *ca, + struct pciide_channel *cp, + int (*pci_intr)(void *)) +{ + struct pciide_softc *psc = CHAN_TO_PCIIDE(&cp->ata_channel); + cardbus_devfunc_t ct = ca->ca_ct; + cardbus_chipset_tag_t cc = ct->ct_cc; + cardbus_function_tag_t cf = ct->ct_cf; + struct ata_channel *wdc_cp = &cp->ata_channel; + struct wdc_regs *wdr = CHAN_TO_WDC_REGS(wdc_cp); + int i; + + cp->compat = 0; + + if (psc->sc_pci_ih == NULL) { + psc->sc_pci_ih = cardbus_intr_establish(cc, cf, ca->ca_intrline, + IPL_BIO, pci_intr, psc); + if (psc->sc_pci_ih == NULL) { + aprint_error_dev(psc->sc_wdcdev.sc_atac.atac_dev, + "couldn't establish interrupt\n"); + goto bad; + } + } + cp->ih = psc->sc_pci_ih; + if (Cardbus_mapreg_map(ct, PCIIDE_REG_CMD_BASE(wdc_cp->ch_channel), + CARDBUS_MAPREG_TYPE_IO, 0, &wdr->cmd_iot, &wdr->cmd_baseioh, + NULL, &psc->sc_cmdsize[wdc_cp->ch_channel]) != 0) { + aprint_error_dev(psc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map %s channel cmd regs\n", cp->name); + goto bad; + } + + if (Cardbus_mapreg_map(ct, PCIIDE_REG_CTL_BASE(wdc_cp->ch_channel), + CARDBUS_MAPREG_TYPE_IO, 0, &wdr->ctl_iot, &cp->ctl_baseioh, + NULL, &psc->sc_ctlsize[wdc_cp->ch_channel]) != 0) { + aprint_error_dev(psc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map %s channel ctl regs\n", cp->name); + bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, + psc->sc_cmdsize[wdc_cp->ch_channel]); + goto bad; + } + /* + * In native mode, 4 bytes of I/O space are mapped for the control + * register, the control register is at offset 2. Pass the generic + * code a handle for only one byte at the right offset. + */ + if (bus_space_subregion(wdr->ctl_iot, cp->ctl_baseioh, 2, 1, + &wdr->ctl_ioh) != 0) { + aprint_error_dev(psc->sc_wdcdev.sc_atac.atac_dev, + "unable to subregion %s channel ctl regs\n", cp->name); + bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, + psc->sc_cmdsize[wdc_cp->ch_channel]); + bus_space_unmap(wdr->cmd_iot, cp->ctl_baseioh, + psc->sc_ctlsize[wdc_cp->ch_channel]); + goto bad; + } + + for (i = 0; i < WDC_NREG; i++) { + if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, + i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { + aprint_error_dev(psc->sc_wdcdev.sc_atac.atac_dev, + "couldn't subregion %s channel cmd regs\n", + cp->name); + goto bad; + } + } + wdc_init_shadow_regs(wdc_cp); + wdr->data32iot = wdr->cmd_iot; + wdr->data32ioh = wdr->cmd_iohs[0]; + return; + +bad: + cp->ata_channel.ch_flags |= ATACH_DISABLED; + return; +} + +#if NATA_DMA +void +pciide_cardbus_mapreg_dma(struct cardbus_pciide_softc *sc, + struct cardbus_attach_args *ca) +{ + struct pciide_softc *psc = &sc->sc_pidesc; + cardbus_devfunc_t ct = ca->ca_ct; + cardbus_chipset_tag_t cc = ct->ct_cc; + cardbus_function_tag_t cf = ct->ct_cf; + cardbusreg_t maptype; + bus_addr_t addr; + struct pciide_channel *pc; + int reg, chan; + bus_size_t size; + + /* + * Map DMA registers + * + * Note that sc_dma_ok is the right variable to test to see if + * DMA can be done. If the interface doesn't support DMA, + * sc_dma_ok will never be non-zero. If the DMA regs couldn't + * be mapped, it'll be zero. I.e., sc_dma_ok will only be + * non-zero if the interface supports DMA and the registers + * could be mapped. + * + * XXX Note that despite the fact that the Bus Master IDE specs + * XXX say that "The bus master IDE function uses 16 bytes of IO + * XXX space," some controllers (at least the United + * XXX Microelectronics UM8886BF) place it in memory space. + */ +#define CARDBUS_MAPREG_TYPE_MASK CARDBUS_MAPREG_TYPE_IO + maptype = cardbus_conf_read(cc, cf, ca->ca_tag, + PCIIDE_REG_BUS_MASTER_DMA) & CARDBUS_MAPREG_TYPE_MASK; + + switch (maptype) { + case CARDBUS_MAPREG_TYPE_IO: + psc->sc_dma_ok = (Cardbus_mapreg_map(ct, + PCIIDE_REG_BUS_MASTER_DMA, CARDBUS_MAPREG_TYPE_IO, 0, + &psc->sc_dma_iot, &psc->sc_dma_ioh, &addr, + &psc->sc_dma_size) == 0); + if (!psc->sc_dma_ok) { + aprint_verbose( + ", but unused (couldn't query registers)"); + break; + } + if ((psc->sc_pp->ide_flags & IDE_16BIT_IOSPACE) && + addr >= 0x10000) { + psc->sc_dma_ok = 0; + Cardbus_mapreg_unmap(ct, PCIIDE_REG_BUS_MASTER_DMA, + psc->sc_dma_iot, psc->sc_dma_ioh, psc->sc_dma_size); + aprint_verbose( + ", but unused (registers at unsafe address %#lx)", + (unsigned long)addr); + } + break; + + case CARDBUS_MAPREG_TYPE_MEM: + psc->sc_dma_ok = (Cardbus_mapreg_map(ct, + PCIIDE_REG_BUS_MASTER_DMA, maptype, 0, &psc->sc_dma_iot, + &psc->sc_dma_ioh, NULL, &psc->sc_dma_size) == 0); + if (!psc->sc_dma_ok) + aprint_verbose(", but unused (couldn't map registers)"); + break; + + default: + psc->sc_dma_ok = 0; + aprint_verbose(", but unsupported register maptype (0x%x)", + maptype); + } + + if (psc->sc_dma_ok) { + if (device_cfdata(psc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & + PCIIDE_OPTIONS_NODMA) { + aprint_verbose( + ", but unused (forced off by config file)"); + psc->sc_dma_ok = 0; + } + } + if (psc->sc_dma_ok == 0) + return; + + psc->sc_dmat = ca->ca_dmat; + psc->sc_wdcdev.dma_arg = psc; + psc->sc_wdcdev.dma_init = pciide_dma_init; + psc->sc_wdcdev.dma_start = pciide_dma_start; + psc->sc_wdcdev.dma_finish = pciide_dma_finish; + + /* + * Set up the default handles for the DMA registers. + * Just reserve 32 bits for each handle, unless space + * doesn't permit it. + */ + for (chan = 0; chan < PCIIDE_NUM_CHANNELS; chan++) { + pc = &psc->pciide_channels[chan]; + for (reg = 0; reg < IDEDMA_NREGS; reg++) { + size = 4; + if (size > (IDEDMA_SCH_OFFSET - reg)) + size = IDEDMA_SCH_OFFSET - reg; + if (bus_space_subregion(psc->sc_dma_iot, + psc->sc_dma_ioh, IDEDMA_SCH_OFFSET * chan + reg, + size, &pc->dma_iohs[reg]) != 0) { + psc->sc_dma_ok = 0; + aprint_verbose( + ", but can't subregion offset %d size %lu", + reg, (u_long)size); + return; + } + } + } +} +#endif /* NATA_DMA */ + +/* some common code used by several chip channel_map */ +void +pciide_cardbus_mapchan(struct cardbus_attach_args *ca, + struct pciide_channel *cp, cardbusreg_t interface, + bus_size_t *cmdsizep, bus_size_t *ctlsizep, + int (*pci_intr)(void *)) +{ + struct ata_channel *wdc_cp = &cp->ata_channel; + + pciide_cardbus_mapregs_native(ca, cp, pci_intr); + wdcattach(wdc_cp); +} --- sys/dev/cardbus/pciide_cardbusvar.h.orig 1970-01-01 09:00:00.000000000 +0900 +++ sys/dev/cardbus/pciide_cardbusvar.h 2008-09-28 21:54:56.000000000 +0900 @@ -0,0 +1,62 @@ +/* $NetBSD: pciidevar.h,v 1.36 2008/01/04 00:27:27 joerg Exp $ */ + +/* + * Copyright (c) 1998 Christopher G. Demetriou. All rights reserved. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * 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. + */ + +#ifndef _DEV_CARDBUS_PCIIDE_CARDBUSVAR_H_ +#define _DEV_CARDBUS_PCIIDE_CARDBUSVAR_H_ + +struct cardbus_pciide_softc { + struct pciide_softc sc_pidesc; + cardbus_devfunc_t sc_ct; /* Cardbus registers info */ + cardbus_chipset_tag_t sc_cc; + cardbus_function_tag_t sc_cf; + cardbustag_t sc_ctag; +}; + + +void pciide_cardbus_common_attach(struct cardbus_pciide_softc *, + struct cardbus_attach_args *, + const struct pciide_product_desc *); +int pciide_cardbus_common_detach(struct cardbus_pciide_softc *, int); + +void pciide_cardbus_mapregs_native(struct cardbus_attach_args *, + struct pciide_channel *, + int (*pci_intr)(void *)); +void pciide_cardbus_mapreg_dma(struct cardbus_pciide_softc *, + struct cardbus_attach_args *); +void pciide_cardbus_mapchan(struct cardbus_attach_args *, + struct pciide_channel *, cardbusreg_t, + bus_size_t *, bus_size_t *, + int (*pci_intr)(void *)); +void pciide_cardbus_map_compat_intr(struct cardbus_attach_args *, + struct pciide_channel *, int); + +#endif /* _DEV_CARDBUS_PCIIDE_CARDBUSVAR_H_ */