diff options
author | jhb <jhb@FreeBSD.org> | 2007-01-19 22:37:52 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2007-01-19 22:37:52 +0000 |
commit | a4f70979edca8249a02fb3151e66fddae2901568 (patch) | |
tree | 5dbe44bb5661b5f61460b4a2a9e58c0516a7e276 /sys/dev/aic7xxx | |
parent | a5cccc05cbfa3300d92aad172b2c031250f812df (diff) | |
download | FreeBSD-src-a4f70979edca8249a02fb3151e66fddae2901568.zip FreeBSD-src-a4f70979edca8249a02fb3151e66fddae2901568.tar.gz |
- Change the PCI-X registers constants to be relative to the PCI-X PCI
capability rather than hardcoded offsets for a particular card. While
I'm here, expand the constants some.
- Change the ahd(4) driver to use pci_find_extcap() to locate the PCI-X
capability to keep up with the first change.
Reviewed by: scottl, gibbs (earlier version)
Diffstat (limited to 'sys/dev/aic7xxx')
-rw-r--r-- | sys/dev/aic7xxx/aic79xx.h | 3 | ||||
-rw-r--r-- | sys/dev/aic7xxx/aic79xx_pci.c | 21 |
2 files changed, 17 insertions, 7 deletions
diff --git a/sys/dev/aic7xxx/aic79xx.h b/sys/dev/aic7xxx/aic79xx.h index c8de9b7..2f63683 100644 --- a/sys/dev/aic7xxx/aic79xx.h +++ b/sys/dev/aic7xxx/aic79xx.h @@ -1244,6 +1244,9 @@ struct ahd_softc { /* PCI cacheline size. */ u_int pci_cachesize; + /* PCI-X capability offset. */ + int pcix_ptr; + /* IO Cell Parameters */ uint8_t iocell_opts[AHD_NUM_PER_DEV_ANNEXCOLS]; diff --git a/sys/dev/aic7xxx/aic79xx_pci.c b/sys/dev/aic7xxx/aic79xx_pci.c index d835592..ec47c97 100644 --- a/sys/dev/aic7xxx/aic79xx_pci.c +++ b/sys/dev/aic7xxx/aic79xx_pci.c @@ -342,7 +342,12 @@ ahd_pci_config(struct ahd_softc *ahd, struct ahd_pci_identity *entry) error = entry->setup(ahd); if (error != 0) return (error); - + + /* + * Find the PCI-X cap pointer. If we don't find it, + * pcix_ptr will be 0. + */ + pci_find_extcap(ahd->dev_softc, PCIY_PCIX, &ahd->pcix_ptr); devconfig = aic_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4); if ((devconfig & PCIXINITPAT) == PCIXINIT_PCI33_66) { ahd->chip |= AHD_PCI; @@ -350,6 +355,8 @@ ahd_pci_config(struct ahd_softc *ahd, struct ahd_pci_identity *entry) ahd->bugs &= ~AHD_PCIX_BUG_MASK; } else { ahd->chip |= AHD_PCIX; + if (ahd->pcix_ptr == 0) + return (ENXIO); } ahd->bus_description = pci_bus_modes[PCI_BUS_MODES_INDEX(devconfig)]; @@ -867,16 +874,16 @@ ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat) uint8_t sg_split_status1[2]; ahd_mode_state saved_modes; u_int i; - uint16_t pcix_status; + uint32_t pcix_status; /* * Check for splits in all modes. Modes 0 and 1 * additionally have SG engine splits to look at. */ - pcix_status = aic_pci_read_config(ahd->dev_softc, PCIXR_STATUS, - /*bytes*/2); + pcix_status = aic_pci_read_config(ahd->dev_softc, + ahd->pcix_ptr + PCIXR_STATUS, /*bytes*/ 4); printf("%s: PCI Split Interrupt - PCI-X status = 0x%x\n", - ahd_name(ahd), pcix_status); + ahd_name(ahd), pcix_status >> 16); saved_modes = ahd_save_modes(ahd); for (i = 0; i < 4; i++) { ahd_set_modes(ahd, i, i); @@ -922,8 +929,8 @@ ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat) /* * Clear PCI-X status bits. */ - aic_pci_write_config(ahd->dev_softc, PCIXR_STATUS, - pcix_status, /*bytes*/2); + aic_pci_write_config(ahd->dev_softc, ahd->pcix_ptr + PCIXR_STATUS, + pcix_status, /*bytes*/4); ahd_outb(ahd, CLRINT, CLRSPLTINT); ahd_restore_modes(ahd, saved_modes); } |