Date: Wed, 14 Mar 2007 06:35:23 GMT From: Matt Jacob <mjacob@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 115836 for review Message-ID: <200703140635.l2E6ZN4G032828@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=115836 Change 115836 by mjacob@mjexp on 2007/03/14 06:34:42 Pick up some useful changes for my p4 depot and avoid some of the bge related breakage that caused my amd box to not work. Affected files ... .. //depot/projects/mjexp/sys/dev/isp/isp.c#16 integrate .. //depot/projects/mjexp/sys/dev/isp/isp_freebsd.c#13 integrate .. //depot/projects/mjexp/sys/dev/isp/isp_freebsd.h#9 integrate .. //depot/projects/mjexp/sys/dev/isp/isp_pci.c#17 integrate .. //depot/projects/mjexp/sys/dev/isp/isp_sbus.c#7 integrate Differences ... ==== //depot/projects/mjexp/sys/dev/isp/isp.c#16 (text+ko) ==== @@ -46,7 +46,7 @@ #endif #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.140 2007/03/10 02:39:53 mjacob Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/isp/isp.c,v 1.143 2007/03/14 05:58:07 mjacob Exp $"); #include <dev/isp/isp_freebsd.h> #endif #ifdef __OpenBSD__ @@ -2000,10 +2000,14 @@ icbp->icb_atioqlen); return; } - icbp->icb_atioqaddr[RQRSP_ADDR0015] = DMA_WD0(isp->isp_atioq_dma); - icbp->icb_atioqaddr[RQRSP_ADDR1631] = DMA_WD1(isp->isp_atioq_dma); - icbp->icb_atioqaddr[RQRSP_ADDR3247] = DMA_WD2(isp->isp_atioq_dma); - icbp->icb_atioqaddr[RQRSP_ADDR4863] = DMA_WD3(isp->isp_atioq_dma); + icbp->icb_atioqaddr[RQRSP_ADDR0015] = + DMA_WD0(isp->isp_atioq_dma); + icbp->icb_atioqaddr[RQRSP_ADDR1631] = + DMA_WD1(isp->isp_atioq_dma); + icbp->icb_atioqaddr[RQRSP_ADDR3247] = + DMA_WD2(isp->isp_atioq_dma); + icbp->icb_atioqaddr[RQRSP_ADDR4863] = + DMA_WD3(isp->isp_atioq_dma); isp_prt(isp, ISP_LOGDEBUG0, "isp_fibre_init_2400: atioq %04x%04x%04x%04x", DMA_WD3(isp->isp_atioq_dma), DMA_WD2(isp->isp_atioq_dma), @@ -3991,8 +3995,7 @@ isp_start(XS_T *xs) { ispsoftc_t *isp; - uint32_t nxti, optr, handle, isr; - uint16_t sema, mbox; + uint32_t nxti, optr, handle; uint8_t local[QENTRY_LEN]; ispreq_t *reqp, *qep; void *cdbp; @@ -4257,11 +4260,6 @@ (long) XS_XFRLEN(xs)); ISP_ADD_REQUEST(isp, nxti); isp->isp_nactive++; - if (IS_23XX(isp) || IS_24XX(isp)) { - if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) { - isp_intr(isp, isr, sema, mbox); - } - } return (CMD_QUEUED); } @@ -4617,6 +4615,7 @@ ISP_WRITE(isp, isp->isp_atiooutrp, optr); } isp->isp_rspbsy = 0; + optr = isp->isp_residx; } #endif @@ -4803,7 +4802,7 @@ isp_prt(isp, ISP_LOGERR, notresp, etype, oop, optr, nlooked); isp_print_bytes(isp, - "Reqeonse Queue Entry", QENTRY_LEN, sp); + "Request Queue Entry", QENTRY_LEN, sp); MEMZERO(hp, QENTRY_LEN); /* PERF */ continue; } @@ -7502,7 +7501,7 @@ { int loops = 0; const uint32_t base = 0x7ffe0000; - uint32_t tmp; + uint32_t tmp = 0; ISP_WRITE(isp, BIU2400_FLASH_ADDR, base | addr); for (loops = 0; loops < 5000; loops++) { ==== //depot/projects/mjexp/sys/dev/isp/isp_freebsd.c#13 (text+ko) ==== @@ -28,7 +28,7 @@ * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/isp/isp_freebsd.c,v 1.135 2007/03/10 02:39:53 mjacob Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/isp/isp_freebsd.c,v 1.136 2007/03/12 04:54:30 mjacob Exp $"); #include <dev/isp/isp_freebsd.h> #include <sys/unistd.h> #include <sys/kthread.h> @@ -39,6 +39,8 @@ #include <dev/isp/isp_ioctl.h> #if __FreeBSD_version >= 500000 #include <sys/sysctl.h> +#else +#include <sys/devicestat.h> #endif #include <cam/cam_periph.h> #include <cam/cam_xpt_periph.h> @@ -2127,10 +2129,7 @@ } -#if __FreeBSD_version >= 500000 -/* - * Support functions for Found/Lost - */ +#if __FreeBSD_version >= 600000 static void isp_make_here(ispsoftc_t *isp, int tgt) { ==== //depot/projects/mjexp/sys/dev/isp/isp_freebsd.h#9 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/dev/isp/isp_freebsd.h,v 1.100 2007/02/23 23:13:46 mjacob Exp $ */ +/* $FreeBSD: src/sys/dev/isp/isp_freebsd.h,v 1.102 2007/03/13 06:46:08 mjacob Exp $ */ /*- * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions * @@ -140,6 +140,8 @@ struct isposinfo { struct ispsoftc * next; + bus_space_tag_t bus_tag; + bus_space_handle_t bus_handle; uint64_t default_port_wwn; uint64_t default_node_wwn; uint32_t default_id; @@ -194,6 +196,8 @@ }; #define isp_lock isp_osinfo.lock +#define isp_bus_tag isp_osinfo.bus_tag +#define isp_bus_handle isp_osinfo.bus_handle /* * Locking macros... @@ -251,6 +255,11 @@ bus_dmamap_sync(isp->isp_cdmat, isp->isp_cdmap, \ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \ break; \ +case SYNC_REG: \ + bus_space_barrier(isp->isp_bus_tag, \ + isp->isp_bus_handle, offset, size, \ + BUS_SPACE_BARRIER_READ); \ + break; \ default: \ break; \ } @@ -349,6 +358,17 @@ #define ISP_NODEWWN(isp) FCPARAM(isp)->isp_wwnn_nvram #define ISP_PORTWWN(isp) FCPARAM(isp)->isp_wwpn_nvram + +#if __FreeBSD_version < 500000 +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define bswap16 htobe16 +#define bswap32 htobe32 +#else +#define bswap16 htole16 +#define bswap32 htole32 +#endif +#endif + #if BYTE_ORDER == BIG_ENDIAN #ifdef ISP_SBUS_SUPPORTED #define ISP_IOXPUT_8(isp, s, d) *(d) = s ==== //depot/projects/mjexp/sys/dev/isp/isp_pci.c#17 (text+ko) ==== @@ -28,7 +28,7 @@ * FreeBSD Version. */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.138 2007/03/10 02:39:53 mjacob Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.140 2007/03/13 06:46:08 mjacob Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -335,8 +335,6 @@ ispsoftc_t pci_isp; device_t pci_dev; struct resource * pci_reg; - bus_space_tag_t pci_st; - bus_space_handle_t pci_sh; void * ih; int16_t pci_poff[_NREG_BLKS]; bus_dma_tag_t dmat; @@ -435,7 +433,6 @@ static void isp_get_generic_options(device_t dev, ispsoftc_t *isp) { - uint64_t wwn; int bitmap, unit; unit = device_get_unit(dev); @@ -508,6 +505,9 @@ static void isp_get_specific_options(device_t dev, ispsoftc_t *isp) { + uint64_t wwn; + int bitmap; + int unit = device_get_unit(dev); callout_handle_init(&isp->isp_osinfo.ldt); callout_handle_init(&isp->isp_osinfo.gdt); @@ -885,8 +885,8 @@ } pcs->pci_dev = dev; pcs->pci_reg = regs; - pcs->pci_st = rman_get_bustag(regs); - pcs->pci_sh = rman_get_bushandle(regs); + isp->isp_bus_tag = rman_get_bustag(regs); + isp->isp_bus_handle = rman_get_bushandle(regs); pcs->pci_poff[BIU_BLOCK >> _BLK_REG_SHFT] = BIU_REGS_OFF; pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS_OFF; @@ -1131,9 +1131,10 @@ * Make sure the Cache Line Size register is set sensibly. */ data = pci_read_config(dev, PCIR_CACHELNSZ, 1); - if (data != linesz) { - data = PCI_DFLT_LNSZ; - isp_prt(isp, ISP_LOGCONFIG, "set PCI line size to %d", data); + if (data == 0 || (linesz != PCI_DFLT_LNSZ && data != linesz)) { + isp_prt(isp, ISP_LOGCONFIG, "set PCI line size to %d from %d", + linesz, data); + data = linesz; pci_write_config(dev, PCIR_CACHELNSZ, data, 1); } @@ -1293,26 +1294,25 @@ (((struct isp_pcisoftc *)a)->pci_poff[((x) & _BLK_REG_MASK) >> \ _BLK_REG_SHFT] + ((x) & 0xfff)) -#define BXR2(pcs, off) \ - bus_space_read_2(pcs->pci_st, pcs->pci_sh, off) -#define BXW2(pcs, off, v) \ - bus_space_write_2(pcs->pci_st, pcs->pci_sh, off, v) -#define BXR4(pcs, off) \ - bus_space_read_4(pcs->pci_st, pcs->pci_sh, off) -#define BXW4(pcs, off, v) \ - bus_space_write_4(pcs->pci_st, pcs->pci_sh, off, v) +#define BXR2(isp, off) \ + bus_space_read_2(isp->isp_bus_tag, isp->isp_bus_handle, off) +#define BXW2(isp, off, v) \ + bus_space_write_2(isp->isp_bus_tag, isp->isp_bus_handle, off, v) +#define BXR4(isp, off) \ + bus_space_read_4(isp->isp_bus_tag, isp->isp_bus_handle, off) +#define BXW4(isp, off, v) \ + bus_space_write_4(isp->isp_bus_tag, isp->isp_bus_handle, off, v) static __inline int isp_pci_rd_debounced(ispsoftc_t *isp, int off, uint16_t *rp) { - struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; uint32_t val0, val1; int i = 0; do { - val0 = BXR2(pcs, IspVirt2Off(isp, off)); - val1 = BXR2(pcs, IspVirt2Off(isp, off)); + val0 = BXR2(isp, IspVirt2Off(isp, off)); + val1 = BXR2(isp, IspVirt2Off(isp, off)); } while (val0 != val1 && ++i < 1000); if (val0 != val1) { return (1); @@ -1325,7 +1325,6 @@ isp_pci_rd_isr(ispsoftc_t *isp, uint32_t *isrp, uint16_t *semap, uint16_t *mbp) { - struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; uint16_t isr, sema; if (IS_2100(isp)) { @@ -1336,8 +1335,8 @@ return (0); } } else { - isr = BXR2(pcs, IspVirt2Off(isp, BIU_ISR)); - sema = BXR2(pcs, IspVirt2Off(isp, BIU_SEMA)); + isr = BXR2(isp, IspVirt2Off(isp, BIU_ISR)); + sema = BXR2(isp, IspVirt2Off(isp, BIU_SEMA)); } isp_prt(isp, ISP_LOGDEBUG3, "ISR 0x%x SEMA 0x%x", isr, sema); isr &= INT_PENDING_MASK(isp); @@ -1352,7 +1351,7 @@ return (0); } } else { - *mbp = BXR2(pcs, IspVirt2Off(isp, OUTMAILBOX0)); + *mbp = BXR2(isp, IspVirt2Off(isp, OUTMAILBOX0)); } } return (1); @@ -1362,15 +1361,14 @@ isp_pci_rd_isr_2300(ispsoftc_t *isp, uint32_t *isrp, uint16_t *semap, uint16_t *mbox0p) { - struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; uint32_t hccr; uint32_t r2hisr; - if (!(BXR2(pcs, IspVirt2Off(isp, BIU_ISR) & BIU2100_ISR_RISC_INT))) { + if (!(BXR2(isp, IspVirt2Off(isp, BIU_ISR) & BIU2100_ISR_RISC_INT))) { *isrp = 0; return (0); } - r2hisr = BXR4(pcs, IspVirt2Off(pcs, BIU_R2HSTSLO)); + r2hisr = BXR4(isp, IspVirt2Off(isp, BIU_R2HSTSLO)); isp_prt(isp, ISP_LOGDEBUG3, "RISC2HOST ISR 0x%x", r2hisr); if ((r2hisr & BIU_R2HST_INTR) == 0) { *isrp = 0; @@ -1426,10 +1424,9 @@ isp_pci_rd_isr_2400(ispsoftc_t *isp, uint32_t *isrp, uint16_t *semap, uint16_t *mbox0p) { - struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; uint32_t r2hisr; - r2hisr = BXR4(pcs, IspVirt2Off(pcs, BIU2400_R2HSTSLO)); + r2hisr = BXR4(isp, IspVirt2Off(isp, BIU2400_R2HSTSLO)); isp_prt(isp, ISP_LOGDEBUG3, "RISC2HOST ISR 0x%x", r2hisr); if ((r2hisr & BIU2400_R2HST_INTR) == 0) { *isrp = 0; @@ -1462,21 +1459,22 @@ static uint32_t isp_pci_rd_reg(ispsoftc_t *isp, int regoff) { - uint32_t rv; - struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; + uint16_t rv; int oldconf = 0; if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) { /* * We will assume that someone has paused the RISC processor. */ - oldconf = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); - BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), + oldconf = BXR2(isp, IspVirt2Off(isp, BIU_CONF1)); + BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oldconf | BIU_PCI_CONF1_SXP); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2); } - rv = BXR2(pcs, IspVirt2Off(isp, regoff)); + rv = BXR2(isp, IspVirt2Off(isp, regoff)); if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) { - BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), oldconf); + BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oldconf); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2); } return (rv); } @@ -1484,38 +1482,30 @@ static void isp_pci_wr_reg(ispsoftc_t *isp, int regoff, uint32_t val) { - struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; int oldconf = 0; - volatile int junk; if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) { /* * We will assume that someone has paused the RISC processor. */ - oldconf = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); - BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), + oldconf = BXR2(isp, IspVirt2Off(isp, BIU_CONF1)); + BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oldconf | BIU_PCI_CONF1_SXP); - if (IS_2100(isp)) { - junk = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); - } + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2); } - BXW2(pcs, IspVirt2Off(isp, regoff), val); - if (IS_2100(isp)) { - junk = BXR2(pcs, IspVirt2Off(isp, regoff)); - } + BXW2(isp, IspVirt2Off(isp, regoff), val); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 2); if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) { - BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), oldconf); - if (IS_2100(isp)) { - junk = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); - } + BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oldconf); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2); } + } static uint32_t isp_pci_rd_reg_1080(ispsoftc_t *isp, int regoff) { uint32_t rv, oc = 0; - struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; if ((regoff & _BLK_REG_MASK) == SXP_BLOCK || (regoff & _BLK_REG_MASK) == (SXP_BLOCK|SXP_BANK1_SELECT)) { @@ -1523,21 +1513,24 @@ /* * We will assume that someone has paused the RISC processor. */ - oc = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); + oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1)); tc = oc & ~BIU_PCI1080_CONF1_DMA; if (regoff & SXP_BANK1_SELECT) tc |= BIU_PCI1080_CONF1_SXP1; else tc |= BIU_PCI1080_CONF1_SXP0; - BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), tc); + BXW2(isp, IspVirt2Off(isp, BIU_CONF1), tc); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2); } else if ((regoff & _BLK_REG_MASK) == DMA_BLOCK) { - oc = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); - BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), + oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1)); + BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oc | BIU_PCI1080_CONF1_DMA); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2); } - rv = BXR2(pcs, IspVirt2Off(isp, regoff)); + rv = BXR2(isp, IspVirt2Off(isp, regoff)); if (oc) { - BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), oc); + BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oc); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2); } return (rv); } @@ -1545,9 +1538,7 @@ static void isp_pci_wr_reg_1080(ispsoftc_t *isp, int regoff, uint32_t val) { - struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; int oc = 0; - volatile int junk; if ((regoff & _BLK_REG_MASK) == SXP_BLOCK || (regoff & _BLK_REG_MASK) == (SXP_BLOCK|SXP_BANK1_SELECT)) { @@ -1555,32 +1546,31 @@ /* * We will assume that someone has paused the RISC processor. */ - oc = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); + oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1)); tc = oc & ~BIU_PCI1080_CONF1_DMA; if (regoff & SXP_BANK1_SELECT) tc |= BIU_PCI1080_CONF1_SXP1; else tc |= BIU_PCI1080_CONF1_SXP0; - BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), tc); - junk = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); + BXW2(isp, IspVirt2Off(isp, BIU_CONF1), tc); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2); } else if ((regoff & _BLK_REG_MASK) == DMA_BLOCK) { - oc = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); - BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), + oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1)); + BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oc | BIU_PCI1080_CONF1_DMA); - junk = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2); } - BXW2(pcs, IspVirt2Off(isp, regoff), val); - junk = BXR2(pcs, IspVirt2Off(isp, regoff)); + BXW2(isp, IspVirt2Off(isp, regoff), val); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 2); if (oc) { - BXW2(pcs, IspVirt2Off(isp, BIU_CONF1), oc); - junk = BXR2(pcs, IspVirt2Off(isp, BIU_CONF1)); + BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oc); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2); } } static uint32_t isp_pci_rd_reg_2400(ispsoftc_t *isp, int regoff) { - struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; uint32_t rv; int block = regoff & _BLK_REG_MASK; @@ -1588,7 +1578,7 @@ case BIU_BLOCK: break; case MBOX_BLOCK: - return (BXR2(pcs, IspVirt2Off(pcs, regoff))); + return (BXR2(isp, IspVirt2Off(isp, regoff))); case SXP_BLOCK: isp_prt(isp, ISP_LOGWARN, "SXP_BLOCK read at 0x%x", regoff); return (0xffffffff); @@ -1622,13 +1612,13 @@ case BIU2400_GPIOD: case BIU2400_GPIOE: case BIU2400_HSEMA: - rv = BXR4(pcs, IspVirt2Off(pcs, regoff)); + rv = BXR4(isp, IspVirt2Off(isp, regoff)); break; case BIU2400_R2HSTSLO: - rv = BXR4(pcs, IspVirt2Off(pcs, regoff)); + rv = BXR4(isp, IspVirt2Off(isp, regoff)); break; case BIU2400_R2HSTSHI: - rv = BXR4(pcs, IspVirt2Off(pcs, regoff)) >> 16; + rv = BXR4(isp, IspVirt2Off(isp, regoff)) >> 16; break; default: isp_prt(isp, ISP_LOGERR, @@ -1642,16 +1632,14 @@ static void isp_pci_wr_reg_2400(ispsoftc_t *isp, int regoff, uint32_t val) { - struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; int block = regoff & _BLK_REG_MASK; - volatile int junk; switch (block) { case BIU_BLOCK: break; case MBOX_BLOCK: - BXW2(pcs, IspVirt2Off(pcs, regoff), val); - junk = BXR2(pcs, IspVirt2Off(pcs, regoff)); + BXW2(isp, IspVirt2Off(isp, regoff), val); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 2); return; case SXP_BLOCK: isp_prt(isp, ISP_LOGWARN, "SXP_BLOCK write at 0x%x", regoff); @@ -1686,8 +1674,8 @@ case BIU2400_GPIOD: case BIU2400_GPIOE: case BIU2400_HSEMA: - BXW4(pcs, IspVirt2Off(pcs, regoff), val); - junk = BXR4(pcs, IspVirt2Off(pcs, regoff)); + BXW4(isp, IspVirt2Off(isp, regoff), val); + MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 4); break; default: isp_prt(isp, ISP_LOGERR, ==== //depot/projects/mjexp/sys/dev/isp/isp_sbus.c#7 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/isp/isp_sbus.c,v 1.29 2007/02/23 23:13:46 mjacob Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/isp/isp_sbus.c,v 1.30 2007/03/13 06:46:08 mjacob Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -89,8 +89,6 @@ ispsoftc_t sbus_isp; device_t sbus_dev; struct resource * sbus_reg; - bus_space_tag_t sbus_st; - bus_space_handle_t sbus_sh; void * ih; int16_t sbus_poff[_NREG_BLKS]; bus_dma_tag_t dmat; @@ -194,9 +192,9 @@ } sbs->sbus_dev = dev; sbs->sbus_reg = regs; - sbs->sbus_st = rman_get_bustag(regs); - sbs->sbus_sh = rman_get_bushandle(regs); sbs->sbus_mdvec = mdvec; + isp->isp_bus_tag = rman_get_bustag(regs); + isp->isp_bus_handle = rman_get_bushandle(regs); sbs->sbus_poff[BIU_BLOCK >> _BLK_REG_SHFT] = BIU_REGS_OFF; sbs->sbus_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = SBUS_MBOX_REGS_OFF; @@ -404,12 +402,11 @@ _BLK_REG_SHFT] + ((x) & 0xff)) #define BXR2(sbc, off) \ - bus_space_read_2(sbc->sbus_st, sbc->sbus_sh, off) + bus_space_read_2(isp->isp_bus_tag, isp->isp_bus_handle, off) static int isp_sbus_rd_isr(ispsoftc_t *isp, uint32_t *isrp, uint16_t *semap, uint16_t *mbp) { - struct isp_sbussoftc *sbc = (struct isp_sbussoftc *) isp; uint16_t isr, sema; isr = BXR2(sbc, IspVirt2Off(isp, BIU_ISR)); @@ -434,7 +431,7 @@ struct isp_sbussoftc *sbs = (struct isp_sbussoftc *) isp; int offset = sbs->sbus_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT]; offset += (regoff & 0xff); - rval = bus_space_read_2(sbs->sbus_st, sbs->sbus_sh, offset); + rval = bus_space_read_2(isp->isp_bus_tag, isp->isp_bus_handle, offset); isp_prt(isp, ISP_LOGDEBUG3, "isp_sbus_rd_reg(off %x) = %x", regoff, rval); return (rval); @@ -448,7 +445,8 @@ offset += (regoff & 0xff); isp_prt(isp, ISP_LOGDEBUG3, "isp_sbus_wr_reg(off %x) = %x", regoff, val); - bus_space_write_2(sbs->sbus_st, sbs->sbus_sh, offset, val); + bus_space_write_2(isp->isp_bus_tag, isp->isp_bus_handle, offset, val); + MEMORYBARRIER(isp, SYNC_REG, offset, 2); } struct imush {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703140635.l2E6ZN4G032828>