From 2df6044b61d3d828971f1d8cca95a1f6a6a1d6b1 Mon Sep 17 00:00:00 2001 From: mjacob Date: Tue, 23 Jan 2007 00:02:29 +0000 Subject: [PATCH] Clean up some of the various platform and release specific dma tag stuff so it is centralized in isp_freebsd.h. Take out PCI posting flushed in qla2100/2200 register reads except for 2100s. --- sys/dev/isp/isp_freebsd.h | 22 ++++++++++++++++++++++ sys/dev/isp/isp_pci.c | 35 ++++++++++------------------------- sys/dev/isp/isp_sbus.c | 26 ++++---------------------- 3 files changed, 36 insertions(+), 47 deletions(-) diff --git a/sys/dev/isp/isp_freebsd.h b/sys/dev/isp/isp_freebsd.h index f49b1d88005f..c9868abb63cb 100644 --- a/sys/dev/isp/isp_freebsd.h +++ b/sys/dev/isp/isp_freebsd.h @@ -474,6 +474,28 @@ void isp_mbox_notify_done(ispsoftc_t *); void isp_mbox_release(ispsoftc_t *); int isp_mstohz(int); +/* + * Platform specific defines + */ +#if __FreeBSD_version < 500000 +#define BUS_DMA_ROOTARG(x) NULL +#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ + bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) +#elif __FreeBSD_version < 700020 +#define BUS_DMA_ROOTARG(x) NULL +#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ + bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \ + busdma_lock_mutex, &Giant, z) +#else +#define BUS_DMA_ROOTARG(x) bus_get_dma_tag(x) +#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ + bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \ + busdma_lock_mutex, &Giant, z) +#endif + +/* Should be BUS_SPACE_MAXSIZE, but MAXPHYS is larger than BUS_SPACE_MAXSIZE */ +#define ISP_NSEGS ((MAXPHYS / PAGE_SIZE) + 1) + /* * Platform specific inline functions */ diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c index 2b603e909672..652e4dc4a29f 100644 --- a/sys/dev/isp/isp_pci.c +++ b/sys/dev/isp/isp_pci.c @@ -1462,13 +1462,19 @@ isp_pci_wr_reg(ispsoftc_t *isp, int regoff, uint32_t val) oldconf = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), oldconf | BIU_PCI_CONF1_SXP); - junk = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); + if (IS_2100(isp)) { + junk = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); + } } BXW2(pcs, IspVirt2Off(isp, regoff), val); - junk = BXR2(pcs, IspVirt2Off(isp, regoff)); + if (IS_2100(isp)) { + junk = BXR2(pcs, IspVirt2Off(isp, regoff)); + } if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) { BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), oldconf); - junk = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); + if (IS_2100(isp)) { + junk = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); + } } } @@ -1685,27 +1691,6 @@ imc(void *arg, bus_dma_segment_t *segs, int nseg, int error) } } -/* - * Should be BUS_SPACE_MAXSIZE, but MAXPHYS is larger than BUS_SPACE_MAXSIZE - */ -#define ISP_NSEGS ((MAXPHYS / PAGE_SIZE) + 1) - -#if __FreeBSD_version < 500000 -#define BUS_DMA_ROOTARG NULL -#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ - bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) -#elif __FreeBSD_version < 700020 -#define BUS_DMA_ROOTARG NULL -#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ - bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \ - busdma_lock_mutex, &Giant, z) -#else -#define BUS_DMA_ROOTARG bus_get_dma_tag(pcs->pci_dev) -#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ - bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \ - busdma_lock_mutex, &Giant, z) -#endif - static int isp_pci_mbxdma(ispsoftc_t *isp) { @@ -1750,7 +1735,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) #endif ISP_UNLOCK(isp); - if (isp_dma_tag_create(BUS_DMA_ROOTARG, 1, slim, llim, + if (isp_dma_tag_create(BUS_DMA_ROOTARG(pcs->pci_dev), 1, slim, llim, hlim, NULL, NULL, BUS_SPACE_MAXSIZE, ISP_NSEGS, slim, 0, &pcs->dmat)) { isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); diff --git a/sys/dev/isp/isp_sbus.c b/sys/dev/isp/isp_sbus.c index b45d5ea3184f..c9a429416f43 100644 --- a/sys/dev/isp/isp_sbus.c +++ b/sys/dev/isp/isp_sbus.c @@ -474,23 +474,6 @@ imc(void *arg, bus_dma_segment_t *segs, int nseg, int error) } } -/* - * Should be BUS_SPACE_MAXSIZE, but MAXPHYS is larger than BUS_SPACE_MAXSIZE - */ -#define ISP_NSEGS ((MAXPHYS / PAGE_SIZE) + 1) - -#if __FreeBSD_version < 700020 -#define BUS_DMA_ROOTARG NULL -#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ - bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \ - busdma_lock_mutex, &Giant, z) -#else -#define BUS_DMA_ROOTARG bus_get_dma_tag(sbs->sbus_dev) -#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ - bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \ - busdma_lock_mutex, &Giant, z) -#endif - static int isp_sbus_mbxdma(ispsoftc_t *isp) { @@ -509,11 +492,10 @@ isp_sbus_mbxdma(ispsoftc_t *isp) ISP_UNLOCK(isp); - if (isp_dma_tag_create(BUS_DMA_ROOTARG, 1, BUS_SPACE_MAXADDR_24BIT+1, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR_32BIT, - NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, ISP_NSEGS, - BUS_SPACE_MAXADDR_24BIT, 0, - &sbs->dmat)) { + if (isp_dma_tag_create(BUS_DMA_ROOTARG(sbs->sbus_dev), 1, + BUS_SPACE_MAXADDR_24BIT+1, BUS_SPACE_MAXADDR_32BIT, + BUS_SPACE_MAXADDR_32BIT, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, + ISP_NSEGS, BUS_SPACE_MAXADDR_24BIT, 0, &sbs->dmat)) { isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); ISP_LOCK(isp); return(1);