diff --git a/sys/dev/isp/isp_freebsd.h b/sys/dev/isp/isp_freebsd.h index 0366c6231c7e..70061ef7b5b4 100644 --- a/sys/dev/isp/isp_freebsd.h +++ b/sys/dev/isp/isp_freebsd.h @@ -459,6 +459,39 @@ default: \ break; \ } +#define MEMORYBARRIERW(isp, type, offset, size, chan) \ +switch (type) { \ +case SYNC_SFORDEV: \ +{ \ + struct isp_fc *fc = ISP_FC_PC(isp, chan); \ + bus_dmamap_sync(fc->tdmat, fc->tdmap, \ + BUS_DMASYNC_PREWRITE); \ + break; \ +} \ +case SYNC_REQUEST: \ + bus_dmamap_sync(isp->isp_osinfo.cdmat, \ + isp->isp_osinfo.cdmap, BUS_DMASYNC_PREWRITE); \ + break; \ +case SYNC_SFORCPU: \ +{ \ + struct isp_fc *fc = ISP_FC_PC(isp, chan); \ + bus_dmamap_sync(fc->tdmat, fc->tdmap, \ + BUS_DMASYNC_POSTWRITE); \ + break; \ +} \ +case SYNC_RESULT: \ + bus_dmamap_sync(isp->isp_osinfo.cdmat, \ + isp->isp_osinfo.cdmap, BUS_DMASYNC_POSTWRITE); \ + break; \ +case SYNC_REG: \ + bus_space_barrier(isp->isp_osinfo.bus_tag, \ + isp->isp_osinfo.bus_handle, offset, size, \ + BUS_SPACE_BARRIER_WRITE); \ + break; \ +default: \ + break; \ +} + #define MBOX_ACQUIRE isp_mbox_acquire #define MBOX_WAIT_COMPLETE isp_mbox_wait_complete #define MBOX_NOTIFY_COMPLETE isp_mbox_notify_done diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c index 782178c3ff88..86c5a1db75b2 100644 --- a/sys/dev/isp/isp_pci.c +++ b/sys/dev/isp/isp_pci.c @@ -1432,6 +1432,15 @@ isp_pci_wr_reg_2400(ispsoftc_t *isp, int regoff, uint32_t val) case BIU2400_GPIOE: case BIU2400_HSEMA: BXW4(isp, IspVirt2Off(isp, regoff), val); +#ifdef MEMORYBARRIERW + if (regoff == BIU2400_REQINP || + regoff == BIU2400_RSPOUTP || + regoff == BIU2400_PRI_REQINP || + regoff == BIU2400_ATIO_RSPOUTP) + MEMORYBARRIERW(isp, SYNC_REG, + IspVirt2Off(isp, regoff), 4, -1) + else +#endif MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 4, -1); break; default: