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.
This commit is contained in:
mjacob 2007-01-23 00:02:29 +00:00
parent 3624354c54
commit 2df6044b61
3 changed files with 36 additions and 47 deletions

View File

@ -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
*/

View File

@ -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");

View File

@ -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);