Deleted Added
full compact
isp_pci.c (39435) isp_pci.c (39445)
1/* $FreeBSD: head/sys/dev/isp/isp_pci.c 39435 1998-09-17 21:11:21Z mjacob $ */
1/* $FreeBSD: head/sys/dev/isp/isp_pci.c 39445 1998-09-18 00:46:42Z mjacob $ */
2/*
3 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters.
4 * FreeBSD Version.
5 *
6 *---------------------------------------
7 * Copyright (c) 1997, 1998 by Matthew Jacob
8 * NASA/Ames Research Center
9 * All rights reserved.

--- 29 unchanged lines hidden (view full) ---

39#include <vm/vm.h>
40#include <vm/pmap.h>
41#include <vm/vm_extern.h>
42
43
44#include <pci/pcireg.h>
45#include <pci/pcivar.h>
46
2/*
3 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters.
4 * FreeBSD Version.
5 *
6 *---------------------------------------
7 * Copyright (c) 1997, 1998 by Matthew Jacob
8 * NASA/Ames Research Center
9 * All rights reserved.

--- 29 unchanged lines hidden (view full) ---

39#include <vm/vm.h>
40#include <vm/pmap.h>
41#include <vm/vm_extern.h>
42
43
44#include <pci/pcireg.h>
45#include <pci/pcivar.h>
46
47#ifdef SCSI_CAM
47#if __FreeBSD_version >= 300004
48#include <machine/bus_memio.h>
49#include <machine/bus_pio.h>
50#include <machine/bus.h>
51#endif
52
53static u_int16_t isp_pci_rd_reg __P((struct ispsoftc *, int));
54static void isp_pci_wr_reg __P((struct ispsoftc *, int, u_int16_t));
55static int isp_pci_mbxdma __P((struct ispsoftc *));
56static int isp_pci_dmasetup __P((struct ispsoftc *, ISP_SCSI_XFER_T *,
57 ispreq_t *, u_int8_t *, u_int8_t));
48#include <machine/bus_memio.h>
49#include <machine/bus_pio.h>
50#include <machine/bus.h>
51#endif
52
53static u_int16_t isp_pci_rd_reg __P((struct ispsoftc *, int));
54static void isp_pci_wr_reg __P((struct ispsoftc *, int, u_int16_t));
55static int isp_pci_mbxdma __P((struct ispsoftc *));
56static int isp_pci_dmasetup __P((struct ispsoftc *, ISP_SCSI_XFER_T *,
57 ispreq_t *, u_int8_t *, u_int8_t));
58#ifdef SCSI_CAM
58#if __FreeBSD_version >= 300004
59static void
60isp_pci_dmateardown __P((struct ispsoftc *, ISP_SCSI_XFER_T *, u_int32_t));
61#else
62#define isp_pci_dmateardown NULL
63#endif
64
65static void isp_pci_reset1 __P((struct ispsoftc *));
66static void isp_pci_dumpregs __P((struct ispsoftc *));

--- 61 unchanged lines hidden (view full) ---

128#define MEM_MAP_REG 0x14
129
130
131static char *isp_pci_probe __P((pcici_t tag, pcidi_t type));
132static void isp_pci_attach __P((pcici_t config_d, int unit));
133
134/* This distinguishing define is not right, but it does work */
135
59static void
60isp_pci_dmateardown __P((struct ispsoftc *, ISP_SCSI_XFER_T *, u_int32_t));
61#else
62#define isp_pci_dmateardown NULL
63#endif
64
65static void isp_pci_reset1 __P((struct ispsoftc *));
66static void isp_pci_dumpregs __P((struct ispsoftc *));

--- 61 unchanged lines hidden (view full) ---

128#define MEM_MAP_REG 0x14
129
130
131static char *isp_pci_probe __P((pcici_t tag, pcidi_t type));
132static void isp_pci_attach __P((pcici_t config_d, int unit));
133
134/* This distinguishing define is not right, but it does work */
135
136#ifndef SCSI_CAM
136#if __FreeBSD_version < 300004
137#define IO_SPACE_MAPPING 0
138#define MEM_SPACE_MAPPING 1
139typedef int bus_space_tag_t;
140typedef u_long bus_space_handle_t;
141#ifdef __alpha__
142#define bus_space_read_2(st, sh, offset) \
143 (st == IO_SPACE_MAPPING)? \
144 inw((pci_port_t)sh + offset) : readw((pci_port_t)sh + offset)

--- 18 unchanged lines hidden (view full) ---

163#endif
164#endif
165
166struct isp_pcisoftc {
167 struct ispsoftc pci_isp;
168 pcici_t pci_id;
169 bus_space_tag_t pci_st;
170 bus_space_handle_t pci_sh;
137#define IO_SPACE_MAPPING 0
138#define MEM_SPACE_MAPPING 1
139typedef int bus_space_tag_t;
140typedef u_long bus_space_handle_t;
141#ifdef __alpha__
142#define bus_space_read_2(st, sh, offset) \
143 (st == IO_SPACE_MAPPING)? \
144 inw((pci_port_t)sh + offset) : readw((pci_port_t)sh + offset)

--- 18 unchanged lines hidden (view full) ---

163#endif
164#endif
165
166struct isp_pcisoftc {
167 struct ispsoftc pci_isp;
168 pcici_t pci_id;
169 bus_space_tag_t pci_st;
170 bus_space_handle_t pci_sh;
171#ifdef SCSI_CAM
171#if __FreeBSD_version >= 300004
172 bus_dma_tag_t parent_dmat;
173 bus_dma_tag_t cntrol_dmat;
174 bus_dmamap_t cntrol_dmap;
175 bus_dmamap_t dmaps[MAXISPREQUEST];
176#endif
177 union {
178 sdparam _x;
179 struct {

--- 117 unchanged lines hidden (view full) ---

297 pci_conf_write(config_id, 0x30, data);
298 ISP_UNLOCK(isp);
299 } else {
300 printf("%s: unknown dev (%x)- punting\n", isp->isp_name, data);
301 free(pcs, M_DEVBUF);
302 return;
303 }
304
172 bus_dma_tag_t parent_dmat;
173 bus_dma_tag_t cntrol_dmat;
174 bus_dmamap_t cntrol_dmap;
175 bus_dmamap_t dmaps[MAXISPREQUEST];
176#endif
177 union {
178 sdparam _x;
179 struct {

--- 117 unchanged lines hidden (view full) ---

297 pci_conf_write(config_id, 0x30, data);
298 ISP_UNLOCK(isp);
299 } else {
300 printf("%s: unknown dev (%x)- punting\n", isp->isp_name, data);
301 free(pcs, M_DEVBUF);
302 return;
303 }
304
305#ifdef SCSI_CAM
305#if __FreeBSD_version >= 300004
306 if (bus_dma_tag_create(NULL, 0, 0, BUS_SPACE_MAXADDR_32BIT,
307 BUS_SPACE_MAXADDR, NULL, NULL, 1<<24,
308 255, 1<<24, 0, &pcs->parent_dmat) != 0) {
309 printf("%s: could not create master dma tag\n", isp->isp_name);
310 free(pcs, M_DEVBUF);
311 return;
312 }
313#endif

--- 92 unchanged lines hidden (view full) ---

406 regoff &= 0xff;
407 offset += regoff;
408 bus_space_write_2(pcs->pci_st, pcs->pci_sh, offset, val);
409 if ((regoff & SXP_BLOCK) != 0) {
410 isp_pci_wr_reg(isp, BIU_CONF1, oldsxp);
411 }
412}
413
306 if (bus_dma_tag_create(NULL, 0, 0, BUS_SPACE_MAXADDR_32BIT,
307 BUS_SPACE_MAXADDR, NULL, NULL, 1<<24,
308 255, 1<<24, 0, &pcs->parent_dmat) != 0) {
309 printf("%s: could not create master dma tag\n", isp->isp_name);
310 free(pcs, M_DEVBUF);
311 return;
312 }
313#endif

--- 92 unchanged lines hidden (view full) ---

406 regoff &= 0xff;
407 offset += regoff;
408 bus_space_write_2(pcs->pci_st, pcs->pci_sh, offset, val);
409 if ((regoff & SXP_BLOCK) != 0) {
410 isp_pci_wr_reg(isp, BIU_CONF1, oldsxp);
411 }
412}
413
414#ifdef SCSI_CAM
414#if __FreeBSD_version >= 300004
415static void isp_map_rquest __P((void *, bus_dma_segment_t *, int, int));
416static void isp_map_result __P((void *, bus_dma_segment_t *, int, int));
417static void isp_map_fcscrt __P((void *, bus_dma_segment_t *, int, int));
418
419static void
420isp_map_rquest(arg, segs, nseg, error)
421 void *arg;
422 bus_dma_segment_t *segs;

--- 330 unchanged lines hidden (view full) ---

753 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
754 bus_dmamap_sync(pci->parent_dmat, *dp, BUS_DMASYNC_POSTREAD);
755 } else {
756 bus_dmamap_sync(pci->parent_dmat, *dp, BUS_DMASYNC_POSTWRITE);
757 }
758 bus_dmamap_unload(pci->parent_dmat, *dp);
759}
760
415static void isp_map_rquest __P((void *, bus_dma_segment_t *, int, int));
416static void isp_map_result __P((void *, bus_dma_segment_t *, int, int));
417static void isp_map_fcscrt __P((void *, bus_dma_segment_t *, int, int));
418
419static void
420isp_map_rquest(arg, segs, nseg, error)
421 void *arg;
422 bus_dma_segment_t *segs;

--- 330 unchanged lines hidden (view full) ---

753 if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
754 bus_dmamap_sync(pci->parent_dmat, *dp, BUS_DMASYNC_POSTREAD);
755 } else {
756 bus_dmamap_sync(pci->parent_dmat, *dp, BUS_DMASYNC_POSTWRITE);
757 }
758 bus_dmamap_unload(pci->parent_dmat, *dp);
759}
760
761#else /* SCSI_CAM */
761#else /* __FreeBSD_version >= 300004 */
762
762
763
763static int
764isp_pci_mbxdma(isp)
765 struct ispsoftc *isp;
766{
767 struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp;
768 u_int32_t len;
769 int rseg;
770

--- 185 unchanged lines hidden ---
764static int
765isp_pci_mbxdma(isp)
766 struct ispsoftc *isp;
767{
768 struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp;
769 u_int32_t len;
770 int rseg;
771

--- 185 unchanged lines hidden ---