Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 May 1998 15:24:33 +0000
From:      Nicolas Souchu <Nicolas.Souchu@prism.uvsq.fr>
To:        freebsd-scsi@FreeBSD.ORG
Subject:   parallel ZIP port to CAM, done!
Message-ID:  <19980510152433.56484@coreff.prism.uvsq.fr>

next in thread | raw e-mail | index | archive | help

--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii

Hi there,

The parallel ZIP drive has an parallel<->scsi converter named VP0.
vpo is the driver for the ZIP-embeded aic7110 SCSI controller.

** vpo is now CAM compliant **

I've ported vpo with -current 980413 patched with cam diffs.

Justin or anybody else may want to commit/review the code. See attachment.

Few notes:

- #ifdef VP0_DEBUG lines will be removed when the entire ppbus system will be
  released

- the ZIP speed is 93kB/s. I've setup transfer_speed field with 93
  but the reported speed is 0.9Mb/s. The ZIP is certainly to slow for CAM :)

- the ZIP is polled only, should I insert splcam() calls anyway?

- see attachment for dmesg-vpo output

- my aic7880 onboard chipset works fine with CAM. Great work!

Regards.

-- 
Nicolas.Souchu@prism.uvsq.fr
FreeBSD - Turning PCs into workstations - http://www.FreeBSD.org

--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="vpo-980413.diffs"

Index: src/sys/dev/ppbus/vpo.c
diff -c src/sys/dev/ppbus/vpo.c:1.1.1.1 src/sys/dev/ppbus/vpo.c:1.1.1.1.4.1
*** src/sys/dev/ppbus/vpo.c:1.1.1.1	Mon Sep  1 00:51:52 1997
--- src/sys/dev/ppbus/vpo.c	Sun May 10 13:52:58 1998
***************
*** 36,50 ****
  #include <machine/clock.h>
  
  #endif	/* KERNEL */
- #include <scsi/scsi_disk.h>
- #include <scsi/scsiconf.h>
  
  #ifdef	KERNEL
  #include <sys/kernel.h>
  #endif /*KERNEL */
  
  #include <dev/ppbus/ppbconf.h>
- #include <dev/ppbus/vpo.h>
  
  /* --------------------------------------------------------------------
   * HERE ARE THINGS YOU MAY HAVE/WANT TO CHANGE
--- 36,57 ----
  #include <machine/clock.h>
  
  #endif	/* KERNEL */
  
+ #include <cam/cam.h>
+ #include <cam/cam_ccb.h>
+ #include <cam/cam_sim.h>
+ #include <cam/cam_xpt_sim.h>
+ #include <cam/cam_debug.h>
+ 
+ #include <cam/scsi/scsi_all.h>
+ #include <cam/scsi/scsi_message.h>
+ #include <cam/scsi/scsi_da.h>
+ 
  #ifdef	KERNEL
  #include <sys/kernel.h>
  #endif /*KERNEL */
  
  #include <dev/ppbus/ppbconf.h>
  
  /* --------------------------------------------------------------------
   * HERE ARE THINGS YOU MAY HAVE/WANT TO CHANGE
***************
*** 62,108 ****
   * DO NOT MODIFY ANYTHING UNDER THIS LINE
   * --------------------------------------------------------------------
   */
  
! static inline int vpoio_do_scsi(struct vpo_data *, int, int, char *, int,
! 				char *, int, int *, int *);
  
! static int32_t	vpo_scsi_cmd(struct scsi_xfer *);
! static void	vpominphys(struct buf *);
! static u_int32_t vpo_adapter_info(int);
  
  static int	vpo_detect(struct vpo_data *vpo);
  
  static int	nvpo = 0;
  #define MAXVP0	8			/* XXX not much better! */
  static struct vpo_data *vpodata[MAXVP0];
  
  #ifdef KERNEL
- static struct scsi_adapter vpo_switch =
- {
- 	vpo_scsi_cmd,
- 	vpominphys,
- 	0,
- 	0,
- 	vpo_adapter_info,
- 	"vpo",
- 	{ 0, 0 }
- };
- 
- /* 
-  * The below structure is so we have a default dev struct
-  * for out link struct.
-  */
- static struct scsi_device vpo_dev =
- {
- 	NULL,	/* Use default error handler */
- 	NULL,	/* have a queue, served by this */
- 	NULL,	/* have no async handler */
- 	NULL,	/* Use default 'done' routine */
- 	"vpo",
- 	0,
- 	{ 0, 0 }
- };
- 
  
  /*
   * Make ourselves visible as a ppbus driver
--- 69,169 ----
   * DO NOT MODIFY ANYTHING UNDER THIS LINE
   * --------------------------------------------------------------------
   */
+ 
+ #define VP0_INITIATOR	0x7
+ 
+ #define VP0_SECTOR_SIZE	512
+ #define VP0_BUFFER_SIZE	0x12000
+ 
+ #define VP0_ESELECT_TIMEOUT	1
+ #define VP0_ECMD_TIMEOUT	2
+ #define VP0_ECONNECT		3
+ #define VP0_ESTATUS_TIMEOUT	4
+ #define VP0_EDATA_OVERFLOW	5	
+ #define VP0_EDISCONNECT		6
+ #define VP0_EPPDATA_TIMEOUT	7
+ #define VP0_ENOPORT		9
+ #define VP0_EINITFAILED		10
+ #define VP0_EINTR		12
+ 
+ #define VP0_EOTHER		13
+ 
+ #define VP0_OPENNINGS	1
+ 
+ #define n(flags) (~(flags) & (flags))
+ 
+ /*
+  * VP0 timings.
+  */
+ #define MHZ_16_IO_DURATION	62
+ 
+ #define VP0_SPP_WRITE_PULSE	253
+ #define VP0_NIBBLE_READ_PULSE	486
+ 
+ /*
+  * VP0 connections.
+  */
+ #define H_AUTO		n(AUTOFEED)
+ #define H_nAUTO		AUTOFEED
+ #define H_STROBE	n(STROBE)
+ #define H_nSTROBE	STROBE
+ #define H_BSY		n(nBUSY)
+ #define H_nBSY		n_BUSY
+ #define H_SEL		SELECT
+ #define H_nSEL		n(SELECT)
+ #define H_ERR		ERROR
+ #define H_nERR		n(ERROR)
+ #define H_ACK		nACK
+ #define H_nACK		n(nACK)
+ #define H_FLT		nFAULT
+ #define H_nFLT		n(nFAULT)
+ #define H_SELIN		n(SELECTIN)
+ #define H_nSELIN	SELECTIN
+ #define H_INIT		nINIT
+ #define H_nINIT		n(nINIT)
+ 
+ struct vpo_sense {
+ 	struct scsi_sense cmd;
+ 	unsigned int stat;
+ 	unsigned int count;
+ };
+ 
+ struct vpo_data {
+ 	unsigned short vpo_unit;
  
! 	int vpo_stat;
! 	int vpo_count;
! 	int vpo_error;
  
! 	struct cam_sim  *sim;
! 	struct cam_path *path;
  
+ 	struct vpo_sense vpo_sense;
+ 
+ 	unsigned char vpo_buffer[VP0_BUFFER_SIZE];
+ 
+ 	struct ppb_device vpo_dev;
+ };
+ 
+ /* vpo control operations */
+ static int	vpoio_do_scsi(struct vpo_data *, int, int, char *, int,
+ 						char *, int, int *, int *);
+ static int	vpoio_disconnect(struct vpo_data *vpo);
+ static int	vpoio_connect(struct vpo_data *vpo, int how);
+ static int	vpoio_in_disk_mode(struct vpo_data *vpo);
+ static void	vpoio_reset(struct vpo_data *vpo);
+ 
  static int	vpo_detect(struct vpo_data *vpo);
  
+ /* cam related functions */
+ static void	vpo_action(struct cam_sim *sim, union ccb *ccb);
+ static void	vpo_poll(struct cam_sim *sim);
+ 
  static int	nvpo = 0;
  #define MAXVP0	8			/* XXX not much better! */
  static struct vpo_data *vpodata[MAXVP0];
  
  #ifdef KERNEL
  
  /*
   * Make ourselves visible as a ppbus driver
***************
*** 116,122 ****
  };
  DATA_SET(ppbdriver_set, vpodriver);
  
- 
  #endif /* KERNEL */
  
  static u_int32_t
--- 177,182 ----
***************
*** 183,194 ****
  	struct scsibus_data *scbus;
  	struct vpo_data *vpo = vpodata[dev->id_unit];
  
- 	vpo->sc_link.adapter_unit = vpo->vpo_unit;
- 	vpo->sc_link.adapter_targ = VP0_INITIATOR;
- 	vpo->sc_link.adapter = &vpo_switch;
- 	vpo->sc_link.device = &vpo_dev;
- 	vpo->sc_link.opennings = VP0_OPENNINGS;
- 
  	/*
  	 * Report ourselves
  	 */
--- 243,248 ----
***************
*** 196,226 ****
  	       dev->id_unit, dev->ppb->ppb_link->adapter_unit);
  
  	/*
! 	 * Prepare the scsibus_data area for the upperlevel
! 	 * scsi code.
! 	 */
! 	scbus = scsi_alloc_bus();
! 	if(!scbus)
  		return (0);
- 	scbus->adapter_link = &vpo->sc_link;
- 
- 	scsi_attachdevs(scbus);
- 
- 	return (1);
- }
  
! static void
! vpominphys(struct buf *bp)
! {
  
! 	if (bp->b_bcount > VP0_BUFFER_SIZE)
! 		bp->b_bcount = VP0_BUFFER_SIZE;
  
! 	return;
  }
  
  #ifdef VP0_WARNING
! static inline void
  vpo_warning(struct vpo_data *vpo, struct scsi_xfer *xs, int timeout)
  {
  
--- 250,297 ----
  	       dev->id_unit, dev->ppb->ppb_link->adapter_unit);
  
  	/*
! 	**	Now tell the generic SCSI layer
! 	**	about our bus.
! 	*/
! 	vpo->sim = cam_alloc_sim();
! 	if (vpo->sim == 0)
  		return (0);
  
! 	vpo->sim->sim_action = vpo_action;
! 	vpo->sim->sim_poll = vpo_poll;	
! 	vpo->sim->sim_name = "vpo";
! 	vpo->sim->softc = vpo;
  
! 	/*
! 	** Don't care what our path id is - If we were the boot
! 	** device we'd set it to 0????
! 	*/
! 	vpo->sim->path_id = (u_int32_t)-1;
! 	vpo->sim->unit_number = vpo->vpo_unit;
! 	vpo->sim->bus_id = 0;
! 	vpo->sim->base_transfer_speed = 93; /* Async transfer rate in kB/s */	
! 	vpo->sim->max_tagged_dev_openings = 0;
! 	vpo->sim->max_dev_openings = 1;
! 	vpo->sim->max_openings = 1;
! 	
! 	if (xpt_bus_register(vpo->sim) != CAM_SUCCESS) {
! 		free(vpo->sim, M_DEVBUF);
! 		return (0);
! 	}
! 	
! 	if (xpt_create_path(&vpo->path, /*periph*/NULL,
! 			    vpo->sim->path_id, CAM_TARGET_WILDCARD,
! 			    CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
! 		xpt_bus_deregister(vpo->sim->path_id);
! 		free(vpo->sim, M_DEVBUF);
! 		return (0);
! 	}
  
! 	return (1);
  }
  
  #ifdef VP0_WARNING
! static void
  vpo_warning(struct vpo_data *vpo, struct scsi_xfer *xs, int timeout)
  {
  
***************
*** 267,290 ****
  #endif /* VP0_WARNING */
  
  /*
!  * vpointr()
   */
! static inline void
! vpointr(struct vpo_data *vpo, struct scsi_xfer *xs)
  {
  
! 	int errno;	/* error in errno.h */
  
! 	if (xs->datalen && !(xs->flags & SCSI_DATA_IN))
! 		bcopy(xs->data, vpo->vpo_buffer, xs->datalen);
  
! 	errno = vpoio_do_scsi(vpo, VP0_INITIATOR,
! 		xs->sc_link->target, (char *)xs->cmd, xs->cmdlen,
! 		vpo->vpo_buffer, xs->datalen, &vpo->vpo_stat, &vpo->vpo_count);
  
  #ifdef VP0_DEBUG
  	printf("vpo_do_scsi = %d, status = 0x%x, count = %d, vpo_error = %d\n", 
  		 errno, vpo->vpo_stat, vpo->vpo_count, vpo->vpo_error);
  #endif
  
  	if (errno) {
--- 338,368 ----
  #endif /* VP0_WARNING */
  
  /*
!  * vpo_intr()
   */
! static void
! vpo_intr(struct vpo_data *vpo, struct ccb_scsiio *csio)
  {
  
! 	int i, errno;	/* error in errno.h */
! 	int s;
  
! 	s = splcam();
  
! 	errno = vpoio_do_scsi(vpo, VP0_INITIATOR, csio->ccb_h.target_id,
! 		(char *)&csio->cdb_io.cdb_bytes, csio->cdb_len,
! 		(char *)csio->data_ptr, csio->dxfer_len,
! 		&vpo->vpo_stat, &vpo->vpo_count);
  
  #ifdef VP0_DEBUG
  	printf("vpo_do_scsi = %d, status = 0x%x, count = %d, vpo_error = %d\n", 
  		 errno, vpo->vpo_stat, vpo->vpo_count, vpo->vpo_error);
+ 
+ 	/* dump of command */
+ 	for (i=0; i<csio->cdb_len; i++)
+ 		printf("%x ", ((char *)&csio->cdb_io.cdb_bytes)[i]);
+ 
+ 	printf("\n");
  #endif
  
  	if (errno) {
***************
*** 292,298 ****
  		log(LOG_WARNING, "vpo%d: errno = %d\n", vpo->vpo_unit, errno);
  #endif
  		/* connection to ppbus interrupted */
! 		xs->error = XS_DRIVER_STUFFUP;
  		goto error;
  	}
  
--- 370,376 ----
  		log(LOG_WARNING, "vpo%d: errno = %d\n", vpo->vpo_unit, errno);
  #endif
  		/* connection to ppbus interrupted */
! 		csio->ccb_h.status = CAM_CMD_TIMEOUT;
  		goto error;
  	}
  
***************
*** 301,391 ****
  #ifdef VP0_WARNING
  		vpo_warning(vpo, xs, vpo->vpo_error);
  #endif
! 		xs->error = XS_TIMEOUT;
  		goto error;
  	}
  
! #define RESERVED_BITS_MASK 0x3e		/* 00111110b */
! #define NO_SENSE	0x0
! #define CHECK_CONDITION	0x02
  
! 	switch (vpo->vpo_stat & RESERVED_BITS_MASK) {
! 	case NO_SENSE:
! 		break;
  
! 	case CHECK_CONDITION:
! 		vpo->vpo_sense.cmd.op_code = REQUEST_SENSE;
! 		vpo->vpo_sense.cmd.length = sizeof(xs->sense);
  		vpo->vpo_sense.cmd.control = 0;
  
! 		errno = vpoio_do_scsi(vpo, VP0_INITIATOR,
! 			xs->sc_link->target, (char *)&vpo->vpo_sense.cmd,
! 			sizeof(vpo->vpo_sense.cmd),
! 			(char *)&xs->sense, sizeof(xs->sense),
  			&vpo->vpo_sense.stat, &vpo->vpo_sense.count);
  
! 		if (errno)
! 			/* connection to ppbus interrupted */
! 			xs->error = XS_DRIVER_STUFFUP;
! 		else
! 			xs->error = XS_SENSE;
  
! 		goto error;
  
! 	default:	/* BUSY or RESERVATION_CONFLICT */
! 		xs->error = XS_TIMEOUT;
! 		goto error;
! 	}
  
! 	if (xs->datalen && (xs->flags & SCSI_DATA_IN))
! 		bcopy(vpo->vpo_buffer, xs->data, xs->datalen);
  
! done:
! 	xs->resid = 0;
! 	xs->error = XS_NOERROR;
  
  error:
! 	xs->flags |= ITSDONE;
! 	scsi_done(xs);
  
  	return;
  }
  
! static int32_t
! vpo_scsi_cmd(struct scsi_xfer *xs)
  {
  
! 	int s;
  
! 	if (xs->sc_link->lun > 0) {
! 		xs->error = XS_DRIVER_STUFFUP;
! 		return TRY_AGAIN_LATER;
  	}
  
! 	if (xs->flags & SCSI_DATA_UIO) {
! 		printf("UIO not supported by vpo_driver !\n");
! 		xs->error = XS_DRIVER_STUFFUP;
! 		return TRY_AGAIN_LATER;
  	}
  
  #ifdef VP0_DEBUG
! 	printf("vpo_scsi_cmd(): xs->flags = 0x%x, "\
! 		"xs->data = 0x%x, xs->datalen = %d\ncommand : %*D\n",
! 		xs->flags, xs->data, xs->datalen,
! 		xs->cmdlen, xs->cmd, " " );
  #endif
  
! 	if (xs->flags & SCSI_NOMASK) {
! 		vpointr(vpodata[xs->sc_link->adapter_unit], xs);
! 		return COMPLETE;
  	}
  
! 	s = VP0_SPL();
  
! 	vpointr(vpodata[xs->sc_link->adapter_unit], xs);
  
! 	splx(s);
! 	return SUCCESSFULLY_QUEUED;
  }
  
  #define vpoio_d_pulse(vpo,b) { \
--- 379,566 ----
  #ifdef VP0_WARNING
  		vpo_warning(vpo, xs, vpo->vpo_error);
  #endif
! 		csio->ccb_h.status = CAM_CMD_TIMEOUT;
  		goto error;
  	}
  
! 	/* check scsi status */
! 	if (vpo->vpo_stat != SCSI_STATUS_OK) {
  
! 	   csio->scsi_status = vpo->vpo_stat;
  
! 	   /* check if we have to sense the drive */
! 	   if ((vpo->vpo_stat & SCSI_STATUS_CHECK_COND) != 0) {
! 
! 		vpo->vpo_sense.cmd.opcode = REQUEST_SENSE;
! 		vpo->vpo_sense.cmd.length = csio->sense_len;
  		vpo->vpo_sense.cmd.control = 0;
  
! 		errno = vpoio_do_scsi(vpo, VP0_INITIATOR, csio->ccb_h.target_id,
! 			(char *)&vpo->vpo_sense.cmd, sizeof(vpo->vpo_sense.cmd),
! 			(char *)&csio->sense_data, csio->sense_len,
  			&vpo->vpo_sense.stat, &vpo->vpo_sense.count);
+ 
+ #ifdef VP0_DEBUG
+ 		printf("(sense) vpo_do_scsi = %d, status = 0x%x, count = %d, vpo_error = %d\n", 
+ 			errno, vpo->vpo_sense.stat, vpo->vpo_sense.count, vpo->vpo_error);
+ #endif
  
! 		/* check sense return status */
! 		if (errno == 0 && vpo->vpo_sense.stat == SCSI_STATUS_OK) {
  
! 		   /* sense ok */
! 		   csio->ccb_h.status = CAM_AUTOSNS_VALID | CAM_SCSI_STATUS_ERROR;
! 		   csio->sense_resid = csio->sense_len - vpo->vpo_sense.count;
  
! #ifdef VP0_DEBUG
! 		   /* dump of sense info */
! 		   printf("(sense) ");
! 		   for (i=0; i<vpo->vpo_sense.count; i++)
! 			printf("%x ", ((char *)&csio->sense_data)[i]);
! 		   printf("\n");
! #endif
  
! 		} else {
  
! 		   /* sense failed */
! 		   csio->ccb_h.status = CAM_AUTOSENSE_FAIL;
  
+ 		}
+ 	   } else {
+ 
+ 		/* no sense */
+ 		csio->ccb_h.status = CAM_SCSI_STATUS_ERROR;			
+ 	   }
+ 
+ 	   goto error;
+ 	}
+ 
+ 	csio->resid = csio->dxfer_len - vpo->vpo_count;
+ 	csio->ccb_h.status = CAM_REQ_CMP;
+ 
  error:
! 	splx(s);
  
  	return;
  }
  
! static void
! vpo_action(struct cam_sim *sim, union ccb *ccb)
  {
  
! 	struct vpo_data *vpo = (struct vpo_data *)sim->softc;
! 
! 	switch (ccb->ccb_h.func_code) {
! 	case XPT_SCSI_IO:
! 	{
! 		struct ccb_scsiio *csio;
! 
! 		csio = &ccb->csio;
! 
! #ifdef VP0_DEBUG
! 		printf("vpo%d: XPT_SCSI_IO (0x%x) request\n",
! 			vpo->vpo_unit, csio->cdb_io.cdb_bytes[0]);
! #endif
! 		
! 		vpo_intr(vpo, csio);
! 
! 		xpt_done(ccb);
  
! 		break;
  	}
+ 	case XPT_CALC_GEOMETRY:
+ 	{
+ 		struct	  ccb_calc_geometry *ccg;
+ 		u_int32_t size_mb;
+ 		u_int32_t secs_per_cylinder;
+ 
+ 		ccg = &ccb->ccg;
+ 		size_mb = ccg->volume_size
+ 			/ ((1024L * 1024L) / ccg->block_size);
+ 
+ #ifdef VP0_DEBUG
+ 		printf("vpo%d: XPT_CALC_GEOMETRY (%d, %d) request\n",
+ 			vpo->vpo_unit, ccg->volume_size, ccg->block_size);
+ #endif
+ 		
+ 		ccg->heads = 64;
+ 		ccg->secs_per_track = 32;
+ 
+ 		secs_per_cylinder = ccg->heads * ccg->secs_per_track;
+ 		ccg->cylinders = ccg->volume_size / secs_per_cylinder;
  
! 		ccb->ccb_h.status = CAM_REQ_CMP;
! 		xpt_done(ccb);
! 		break;
  	}
+ 	case XPT_RESET_BUS:		/* Reset the specified SCSI bus */
+ 	{
+ 
+ #ifdef VP0_DEBUG
+ 		printf("vpo%d: XPT_RESET_BUS request\n", vpo->vpo_unit);
+ #endif
+ 		/* first, connect to the drive */
+ 		if (vpoio_connect(vpo, PPB_WAIT|PPB_INTR) ||
+ 			(vpoio_in_disk_mode(vpo) == 0)) {
+ 
+ 			/* release ppbus */
+ 			vpoio_disconnect(vpo);
+ 
+ 			ccb->ccb_h.status = CAM_REQ_CMP_ERR;
+ 			xpt_done(ccb);
+ 			return;
+ 		}
+ 
+ 		/* reset the SCSI bus */
+ 		vpoio_reset(vpo);
+ 
+ 		/* then disconnect */
+ 		vpoio_disconnect(vpo);
  
+ 		ccb->ccb_h.status = CAM_REQ_CMP;
+ 		xpt_done(ccb);
+ 		break;
+ 	}
+ 	case XPT_PATH_INQ:		/* Path routing inquiry */
+ 	{
+ 		struct ccb_pathinq *cpi = &ccb->cpi;
+ 		
  #ifdef VP0_DEBUG
! 		printf("vpo%d: XPT_PATH_INQ request\n", vpo->vpo_unit);
  #endif
+ 		cpi->version_num = 1; /* XXX??? */
+ 		cpi->max_target = 7;
+ 		cpi->max_lun = 0;
+ 		cpi->initiator_id = VP0_INITIATOR;
+ 		cpi->bus_id = sim->bus_id;
+ 		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+ 		strncpy(cpi->hba_vid, "Iomega", HBA_IDLEN);
+ 		strncpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
+ 		cpi->unit_number = sim->unit_number;
  
! 		cpi->ccb_h.status = CAM_REQ_CMP;
! 		xpt_done(ccb);
! 		break;
! 	}
! 	default:
! 		ccb->ccb_h.status = CAM_REQ_INVALID;
! 		xpt_done(ccb);
! 		break;
  	}
+ 
+ 	return;
+ }
  
! static void
! vpo_poll(struct cam_sim *sim)
! {       
! 	/* The ZIP is actually always polled throw vpo_action() */
  
! #ifdef VP0_DEBUG
! 	printf("vpo%d: entering vpo_poll()\n", sim->unit_number);
! #endif
  
! 	return;
  }
  
  #define vpoio_d_pulse(vpo,b) { \
***************
*** 516,522 ****
  	}
  
  	/* send SCSI reset signal */
! 	vpoio_reset (vpo);
  
  	vpoio_disconnect(vpo);
  
--- 691,697 ----
  	}
  
  	/* send SCSI reset signal */
! 	vpoio_reset(vpo);
  
  	vpoio_disconnect(vpo);
  
***************
*** 694,700 ****
  	return (error);
  }
  
! static inline char
  vpoio_select(struct vpo_data *vpo, int initiator, int target)
  {
  
--- 869,875 ----
  	return (error);
  }
  
! static char
  vpoio_select(struct vpo_data *vpo, int initiator, int target)
  {
  
***************
*** 708,714 ****
  
  	k = 0;
  	while (!(ppb_rstr(&vpo->vpo_dev) & 0x40) && (k++ < VP0_SELTMO))
! 		barrier();
  
  	if (k >= VP0_SELTMO)
  		return (VP0_ESELECT_TIMEOUT);
--- 883,889 ----
  
  	k = 0;
  	while (!(ppb_rstr(&vpo->vpo_dev) & 0x40) && (k++ < VP0_SELTMO))
! 		;
  
  	if (k >= VP0_SELTMO)
  		return (VP0_ESELECT_TIMEOUT);
***************
*** 721,727 ****
   *
   * H_SELIN must be low.
   */
! static inline char
  vpoio_wait(struct vpo_data *vpo, int tmo)
  {
  
--- 896,902 ----
   *
   * H_SELIN must be low.
   */
! static char
  vpoio_wait(struct vpo_data *vpo, int tmo)
  {
  
***************
*** 737,743 ****
  
  	k = 0;
  	while (!((r = ppb_rstr(&vpo->vpo_dev)) & nBUSY) && (k++ < tmo))
! 		barrier();
  
  	/*
  	 * Return some status information.
--- 912,918 ----
  
  	k = 0;
  	while (!((r = ppb_rstr(&vpo->vpo_dev)) & nBUSY) && (k++ < tmo))
! 		;
  
  	/*
  	 * Return some status information.
***************
*** 752,758 ****
  	return (0);			   /* command timed out */	
  }
  
! static inline int 
  vpoio_do_scsi(struct vpo_data *vpo, int host, int target, char *command,
  		int clen, char *buffer, int blen, int *result, int *count)
  {
--- 927,933 ----
  	return (0);			   /* command timed out */	
  }
  
! static int 
  vpoio_do_scsi(struct vpo_data *vpo, int host, int target, char *command,
  		int clen, char *buffer, int blen, int *result, int *count)
  {
***************
*** 787,797 ****
  	 */
  	ppb_wctr(&vpo->vpo_dev, H_AUTO | H_nSELIN | H_INIT | H_STROBE);
  
- #ifdef VP0_DEBUG
- 	printf("vpo%d: drive selected, now sending the command...\n",
- 		vpo->vpo_unit);
- #endif
- 
  	for (k = 0; k < clen; k++) {
  		if (vpoio_wait(vpo, VP0_FAST_SPINTMO) != (char)0xe0) {
  			vpo->vpo_error = VP0_ECMD_TIMEOUT;
--- 962,967 ----
***************
*** 803,818 ****
  		}
  	}
  
- #ifdef VP0_DEBUG
- 	printf("vpo%d: command sent, now completing the request...\n",
- 		vpo->vpo_unit);
- #endif
- 
  	/* 
  	 * Completion ... 
  	 */
! 	rw = ((command[0] == READ_COMMAND) || (command[0] == READ_BIG) ||
! 		(command[0] == WRITE_COMMAND) || (command[0] == WRITE_BIG));
  
  	*count = 0;
  	for (;;) {
--- 973,983 ----
  		}
  	}
  
  	/* 
  	 * Completion ... 
  	 */
! 	rw = ((command[0] == READ_6) || (command[0] == READ_10) ||
! 		(command[0] == WRITE_6) || (command[0] == WRITE_10));
  
  	*count = 0;
  	for (;;) {
Index: src/sys/dev/ppbus/vpo.h
diff -c src/sys/dev/ppbus/vpo.h:1.1.1.1 src/sys/dev/ppbus/vpo.h:removed
*** src/sys/dev/ppbus/vpo.h:1.1.1.1	Sat Aug 16 14:05:38 1997
--- src/sys/dev/ppbus/vpo.h	Sun May 10 13:56:27 1998
***************
*** 1,110 ****
- /*-
-  * Copyright (c) 1997 Nicolas Souchu
-  * All rights reserved.
-  *
-  * Redistribution and use in source and binary forms, with or without
-  * modification, are permitted provided that the following conditions
-  * are met:
-  * 1. Redistributions of source code must retain the above copyright
-  *    notice, this list of conditions and the following disclaimer.
-  * 2. Redistributions in binary form must reproduce the above copyright
-  *    notice, this list of conditions and the following disclaimer in the
-  *    documentation and/or other materials provided with the distribution.
-  *
-  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-  * SUCH DAMAGE.
-  *
-  *	$Id: vpo.h,v 1.2 1997/08/16 14:05:38 msmith Exp $
-  *
-  */
- #ifndef __VP03_H
- #define __VP03_H
- 
- #define barrier() __asm__("": : :"memory")
- 
- #define VP0_INITIATOR	0x7
- 
- #define VP0_SECTOR_SIZE	512
- #define VP0_BUFFER_SIZE	0x12000
- 
- #define VP0_SPL() splbio()
- 
- #define VP0_ESELECT_TIMEOUT	1
- #define VP0_ECMD_TIMEOUT	2
- #define VP0_ECONNECT		3
- #define VP0_ESTATUS_TIMEOUT	4
- #define VP0_EDATA_OVERFLOW	5	
- #define VP0_EDISCONNECT		6
- #define VP0_EPPDATA_TIMEOUT	7
- #define VP0_ENOPORT		9
- #define VP0_EINITFAILED		10
- #define VP0_EINTR		12
- 
- #define VP0_EOTHER		13
- 
- #define VP0_OPENNINGS	1
- 
- #define n(flags) (~(flags) & (flags))
- 
- /*
-  * VP0 timings.
-  */
- #define MHZ_16_IO_DURATION	62
- 
- #define VP0_SPP_WRITE_PULSE	253
- #define VP0_NIBBLE_READ_PULSE	486
- 
- /*
-  * VP0 connections.
-  */
- #define H_AUTO		n(AUTOFEED)
- #define H_nAUTO		AUTOFEED
- #define H_STROBE	n(STROBE)
- #define H_nSTROBE	STROBE
- #define H_BSY		n(nBUSY)
- #define H_nBSY		n_BUSY
- #define H_SEL		SELECT
- #define H_nSEL		n(SELECT)
- #define H_ERR		ERROR
- #define H_nERR		n(ERROR)
- #define H_ACK		nACK
- #define H_nACK		n(nACK)
- #define H_FLT		nFAULT
- #define H_nFLT		n(nFAULT)
- #define H_SELIN		n(SELECTIN)
- #define H_nSELIN	SELECTIN
- #define H_INIT		nINIT
- #define H_nINIT		n(nINIT)
- 
- struct vpo_sense {
- 	struct scsi_sense cmd;
- 	unsigned int stat;
- 	unsigned int count;
- };
- 
- struct vpo_data {
- 	unsigned short vpo_unit;
- 
- 	int vpo_stat;
- 	int vpo_count;
- 	int vpo_error;
- 
- 	struct ppb_status vpo_status;
- 	struct vpo_sense vpo_sense;
- 
- 	unsigned char vpo_buffer[VP0_BUFFER_SIZE];
- 
- 	struct ppb_device vpo_dev;
- 	struct scsi_link sc_link;
- };
- 
- #endif
--- 0 ----

--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="dmesg.vpo"

Copyright (c) 1992-1998 FreeBSD Inc.
Copyright (c) 1982, 1986, 1989, 1991, 1993
	The Regents of the University of California. All rights reserved.
FreeBSD 3.0-CURRENT #21: Sun May 10 13:25:32 GMT 1998
    toor@breizh:/usr/local/src/sys/compile/CAM
Timecounter "i8254"  frequency 1193182 Hz  cost 2527 ns
Timecounter "TSC"  frequency 166586877 Hz  cost 212 ns
CPU: Pentium (166.59-MHz 586-class CPU)
  Origin = "GenuineIntel"  Id = 0x543  Stepping=3
  Features=0x8001bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,MMX>
real memory  = 33554432 (32768K bytes)
avail memory = 30044160 (29340K bytes)
Probing for devices on PCI bus 0:
chip0: <Intel 82437VX PCI cache memory controller> rev 0x02 on pci0.0.0
chip1: <Intel 82371SB PCI to ISA bridge> rev 0x01 on pci0.7.0
ide_pci0: <Intel PIIX3 Bus-master IDE controller> rev 0x00 on pci0.7.1
ahc0: <Adaptec aic7880 Ultra SCSI adapter> rev 0x00 int a irq 11 on pci0.9.0
ahc0: Using left over BIOS settings
ahc0: aic7880 Wide Channel A, SCSI Id=7, 16/255 SCBs
Probing for devices on the ISA bus:
sc0 at 0x60-0x6f irq 1 on motherboard
sc0: VGA color <16 virtual consoles, flags=0x0>
ed0 at 0x280-0x29f irq 3 maddr 0xd0000 msize 16384 on isa
ed0: address 00:00:c0:37:f2:d0, type SMC8216/SMC8216C (16 bit) 
ppc0 at 0x378 irq 7 on isa
ppc0: Generic chipset in EPP mode (EPP 1.9)
ppbus0: <unknown unknown>
nlpt0: <generic printer> on ppbus 0
nlpt0: Interrupt-driven port
ppi0: <generic parallel i/o> on ppbus 0
vpo0: <Adaptec aic7110 scsi> on ppbus 0
ppc: port not present at 0x278.
ppc1 not found at 0x278
sio0 at 0x3f8-0x3ff irq 4 flags 0x10 on isa
sio0: type 16550A, console
psm0 not found at 0x60
fdc0 at 0x3f0-0x3f7 irq 6 drq 2 on isa
fdc0: FIFO enabled, 8 bytes threshold
fd0: 1.44MB 3.5in
wdc0 not found at 0x1f0
wdc1 at 0x170-0x177 irq 15 on isa
wdc1: unit 0 (atapi): <GCD-R520B/1.1>, removable, intr, iordy
wcd0: 344Kb/sec, 256Kb cache, audio play, 121 volume levels, ejectable tray
wcd0: no disc inside, unlocked, lock protected
npx0 on motherboard
npx0: INT 16 interface
Intel Pentium F00F detected, installing workaround
(da1:vpo0:0:6:0): READ CAPACITY. CDB: 25 0 0 0 0 0 0 0 0 0 
(da1:vpo0:0:6:0): NOT READY asc:3a,0
(da1:vpo0:0:6:0): Medium not present
da1 at vpo0 bus 0 target 6 lun 0
da1: <IOMEGA ZIP 100 D.08> Removable Direct Access SCSI2 device 
da1: 0.9MB/s transfers 
da1: Attempt to query device size, failed
da0 at ahc0 bus 0 target 6 lun 0
da0: <IBM DCAS-32160W S65A> Fixed Direct Access SCSI2 device 
da0: Serial Number F27G5830        
da0: 10.0MB/s transfers (5.0MHz, offset 8, 16bit), Tagged Queueing Enabled
da0: 2063MB (4226725 512 byte sectors: 64H 32S/T 2063C)

--k1lZvvs/B4yU6o8G--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980510152433.56484>