diff options
Diffstat (limited to 'sys/pci/isp_pci.c')
-rw-r--r-- | sys/pci/isp_pci.c | 93 |
1 files changed, 63 insertions, 30 deletions
diff --git a/sys/pci/isp_pci.c b/sys/pci/isp_pci.c index 84960d8f1e2d..ae7842b2e079 100644 --- a/sys/pci/isp_pci.c +++ b/sys/pci/isp_pci.c @@ -1,5 +1,4 @@ -/* $Id: isp_pci.c,v 1.12 1998/12/28 19:24:23 mjacob Exp $ */ -/* release_12_28_98_A+ */ +/* $FreeBSD$ */ /* * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. * FreeBSD Version. @@ -79,7 +78,7 @@ static struct ispmdvec mdvec = { ISP_CODE_LENGTH, ISP_CODE_ORG, ISP_CODE_VERSION, - BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64, + BIU_BURST_ENABLE, 0 }; @@ -96,7 +95,7 @@ static struct ispmdvec mdvec_2100 = { ISP2100_CODE_LENGTH, ISP2100_CODE_ORG, ISP2100_CODE_VERSION, - 0, /* Irrelevant to the 2100 */ + BIU_BURST_ENABLE, 0 }; @@ -129,7 +128,7 @@ static struct ispmdvec mdvec_2100 = { #define MEM_MAP_REG 0x14 -static const char *isp_pci_probe __P((pcici_t tag, pcidi_t type)); +static char *isp_pci_probe __P((pcici_t tag, pcidi_t type)); static void isp_pci_attach __P((pcici_t config_d, int unit)); /* This distinguishing define is not right, but it does work */ @@ -196,8 +195,10 @@ struct pci_device isp_pci_driver = { DATA_SET (pcidevice_set, isp_pci_driver); -static const char * -isp_pci_probe(pcici_t tag, pcidi_t type) +static char * +isp_pci_probe(tag, type) + pcici_t tag; + pcidi_t type; { static int oneshot = 1; char *x; @@ -223,7 +224,9 @@ isp_pci_probe(pcici_t tag, pcidi_t type) static void -isp_pci_attach(pcici_t config_id, int unit) +isp_pci_attach(config_id, unit) + pcici_t config_id; + int unit; { int mapped; pci_port_t io_port; @@ -267,11 +270,7 @@ isp_pci_attach(pcici_t config_id, int unit) pcs->pci_st == IO_SPACE_MAPPING? "I/O" : "Memory"); isp = &pcs->pci_isp; -#if __FreeBSD_version >= 300006 - (void) snprintf(isp->isp_name, sizeof(isp->isp_name), "isp%d", unit); -#else (void) sprintf(isp->isp_name, "isp%d", unit); -#endif isp->isp_osinfo.unit = unit; data = pci_conf_read(config_id, PCI_ID_REG); @@ -288,7 +287,7 @@ isp_pci_attach(pcici_t config_id, int unit) data = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG); data |= PCIM_CMD_BUSMASTEREN | PCIM_CMD_INVEN; pci_conf_write(config_id, PCI_COMMAND_STATUS_REG, data); -#if 0 + /* * Wierd- we need to clear the lsb in offset 0x30 to take the * chip out of reset state. @@ -296,7 +295,6 @@ isp_pci_attach(pcici_t config_id, int unit) data = pci_conf_read(config_id, 0x30); data &= ~1; pci_conf_write(config_id, 0x30, data); -#endif ISP_UNLOCK(isp); } else { printf("%s: unknown dev (%x)- punting\n", isp->isp_name, data); @@ -349,7 +347,9 @@ isp_pci_attach(pcici_t config_id, int unit) #define PCI_BIU_REGS_OFF BIU_REGS_OFF static u_int16_t -isp_pci_rd_reg(struct ispsoftc *isp, int regoff) +isp_pci_rd_reg(isp, regoff) + struct ispsoftc *isp; + int regoff; { u_int16_t rv; struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; @@ -382,7 +382,10 @@ isp_pci_rd_reg(struct ispsoftc *isp, int regoff) } static void -isp_pci_wr_reg(struct ispsoftc *isp, int regoff, u_int16_t val) +isp_pci_wr_reg(isp, regoff, val) + struct ispsoftc *isp; + int regoff; + u_int16_t val; { struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; int offset, oldsxp = 0; @@ -417,21 +420,33 @@ static void isp_map_result __P((void *, bus_dma_segment_t *, int, int)); static void isp_map_fcscrt __P((void *, bus_dma_segment_t *, int, int)); static void -isp_map_rquest(void *arg, bus_dma_segment_t *segs, int nseg, int error) +isp_map_rquest(arg, segs, nseg, error) + void *arg; + bus_dma_segment_t *segs; + int nseg; + int error; { struct ispsoftc *isp = (struct ispsoftc *) arg; isp->isp_rquest_dma = segs->ds_addr; } static void -isp_map_result(void *arg, bus_dma_segment_t *segs, int nseg, int error) +isp_map_result(arg, segs, nseg, error) + void *arg; + bus_dma_segment_t *segs; + int nseg; + int error; { struct ispsoftc *isp = (struct ispsoftc *) arg; isp->isp_result_dma = segs->ds_addr; } static void -isp_map_fcscrt(void *arg, bus_dma_segment_t *segs, int nseg, int error) +isp_map_fcscrt(arg, segs, nseg, error) + void *arg; + bus_dma_segment_t *segs; + int nseg; + int error; { struct ispsoftc *isp = (struct ispsoftc *) arg; fcparam *fcp = isp->isp_param; @@ -439,7 +454,8 @@ isp_map_fcscrt(void *arg, bus_dma_segment_t *segs, int nseg, int error) } static int -isp_pci_mbxdma(struct ispsoftc *isp) +isp_pci_mbxdma(isp) + struct ispsoftc *isp; { struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp; caddr_t base; @@ -511,7 +527,11 @@ typedef struct { #define MUSHERR_NOQENTRIES -2 static void -dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) +dma2(arg, dm_segs, nseg, error) + void *arg; + bus_dma_segment_t *dm_segs; + int nseg; + int error; { mush_t *mp; ISP_SCSI_XFER_T *ccb; @@ -632,8 +652,12 @@ dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) } static int -isp_pci_dmasetup(struct ispsoftc *isp, ISP_SCSI_XFER_T *ccb, ispreq_t *rq, - u_int8_t *iptrp, u_int8_t optr) +isp_pci_dmasetup(isp, ccb, rq, iptrp, optr) + struct ispsoftc *isp; + ISP_SCSI_XFER_T *ccb; + ispreq_t *rq; + u_int8_t *iptrp; + u_int8_t optr; { struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp; struct ccb_hdr *ccb_h; @@ -721,8 +745,10 @@ isp_pci_dmasetup(struct ispsoftc *isp, ISP_SCSI_XFER_T *ccb, ispreq_t *rq, } static void -isp_pci_dmateardown(struct ispsoftc *isp, ISP_SCSI_XFER_T *ccb, - u_int32_t handle) +isp_pci_dmateardown(isp, ccb, handle) + struct ispsoftc *isp; + ISP_SCSI_XFER_T *ccb; + u_int32_t handle; { struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp; bus_dmamap_t *dp = &pci->dmaps[handle]; @@ -739,7 +765,8 @@ isp_pci_dmateardown(struct ispsoftc *isp, ISP_SCSI_XFER_T *ccb, static int -isp_pci_mbxdma(struct ispsoftc *isp) +isp_pci_mbxdma(isp) + struct ispsoftc *isp; { struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp; u_int32_t len; @@ -785,8 +812,12 @@ isp_pci_mbxdma(struct ispsoftc *isp) } static int -isp_pci_dmasetup(struct ispsoftc *isp, ISP_SCSI_XFER_T *xs, - ispreq_t *rq, u_int8_t *iptrp, u_int8_t optr) +isp_pci_dmasetup(isp, xs, rq, iptrp, optr) + struct ispsoftc *isp; + ISP_SCSI_XFER_T *xs; + ispreq_t *rq; + u_int8_t *iptrp; + u_int8_t optr; { struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp; ispcontreq_t *crq; @@ -911,14 +942,16 @@ isp_pci_dmasetup(struct ispsoftc *isp, ISP_SCSI_XFER_T *xs, #endif static void -isp_pci_reset1(struct ispsoftc *isp) +isp_pci_reset1(isp) + struct ispsoftc *isp; { /* Make sure the BIOS is disabled */ isp_pci_wr_reg(isp, HCCR, PCI_HCCR_CMD_BIOS); } static void -isp_pci_dumpregs(struct ispsoftc *isp) +isp_pci_dumpregs(isp) + struct ispsoftc *isp; { struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp; printf("%s: PCI Status Command/Status=%lx\n", pci->pci_isp.isp_name, |