Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jun 1998 08:43:13 -0700 (PDT)
From:      Steven Schwarz <schwarz@cx25450-a.dt1.sdca.home.com>
To:        freebsd-scsi@FreeBSD.ORG, "Steven T. Schwarz" <schwarz@cx25450-a.dt1.sdca.home.com>
Subject:   980513 CAM, /dev/(r)fd0, vnode pseudo-device
Message-ID:  <XFMail.980626091117.schwarz@cx25450-a.dt1.sdca.home.com>

next in thread | raw e-mail | index | archive | help
This message is in MIME format
--_=XFMail.1.1.p0.FreeBSD:980626091117:375=_
Content-Type: text/plain; charset=us-ascii

I haven't reported in on my CAM experiences for awhile, but I just
integrated the 980513 snapshot onto my machine and wanted to report
on that.

The machine involved is a dual-pentium II (with two 233's) running the
SMP kernel from the 3.0-980520-SNAP, with the CAM patches applied, and
one other small set of patches which I have attached.  The mother-
board is a Tyan S1696DLUA Thunder 2 ATX, which has onboard 2-channel
Adaptec AIC-7895 UW.  There are three scsi devices, two on the 7895
(an IBM hard drive and an Iomega internal Jaz drive) and the third an
Iomega parallel port zip drive.

Getting the ppbus stuff to work with CAM, and hence support for my zip
drive, is what led to the "other small set of patches".  Someone (I
don't remember the name at this moment) posted a very helpful ppbus
patch, which was dated before the 980513 snapshot of CAM and out of
date by the time of that shapshot.  Mine "works" for the zip drive,
but I did no more than "get it to work" -- it maybe could use a
walk-through to clean it up.  So I've attached my patches.

[The patch applies to

                   /usr/src/sys/dev/ppbus/vpo.[ch]

and should be applied localy in

                       /usr/src/sys/dev/ppbus.

It would be real nice if the future CAM snapshots could preserve the
ppbus stuff in working order, especially, as it would seem to require
very little incremental effort to do so.]

Two things of note to report:

[1] This message

          devstat_end_transaction: HELP!! busy_count is < 0!

is spammed to syslog whenever any attempt is made to use the floppy
device /dev/(r)fd0 (mounting, reading, writing).  (Operations do seem
to succeed, you just get the space-filling message.)  Is this related
to CAM?  

[2] In the process of using this machine to make a picoBSD kernel
(for, needless to say, another box to run :->), I noticed that if I
place the sources and do this build on my IBM hard drive, the scsi bus
resets during the build at the point where the build wants to use the
vnode pseudo-device ("treat any file like a disk") during the
manufacture of the bootable floppy.  If I move the sources to my IDE
drive, the whole thing works just fine.  Again, does vnode need work
to play with CAM?

Everything else that I have tried is pretty much working fine.

Thanks for all the great work on CAM.

sts

--_=XFMail.1.1.p0.FreeBSD:980626091117:375=_
Content-Type: text/plain; charset=us-ascii; name=mydiffs; SizeOnDisk=21879
Content-Description: mydiffs
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="mydiffs"

*** vpo.c.orig	Wed Jun 24 08:02:08 1998
--- vpo.c	Wed Jun 24 09:00:46 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
***************
*** 63,108 ****
   * --------------------------------------------------------------------
   */
  
! 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
--- 70,169 ----
   * --------------------------------------------------------------------
   */
  
! #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 ----
***************
*** 182,193 ****
  
  	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
--- 242,248 ----
  
  	struct scsibus_data *scbus;
  	struct vpo_data *vpo = vpodata[dev->id_unit];
! 	struct cam_devq *devq;
  
  	/*
  	 * Report ourselves
***************
*** 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)
  {
  
--- 251,314 ----
  	       dev->id_unit, dev->ppb->ppb_link->adapter_unit);
  
  	/*
! 	**	Now tell the generic SCSI layer
! 	**	about our bus.
! 	*/
! 	devq = cam_simq_alloc(16);
! 
! 	if (devq == 0)
  		return (0);
  
! 	vpo->sim = 
! 	  cam_sim_alloc(/* sim_action                  */ vpo_action,
! 			/* sim_poll                    */ vpo_poll,
! 			/* sim_name                    */ "vpo",
! 			/* softc                       */ vpo,
! 			/* unit                        */ vpo->vpo_unit,
! 			/* max_dev_transactions        */ 1,
! 			/* max_tagged_dev_transactions */ 0,
! 			/* queue                       */ devq);
  
! 	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_transactions = 0;
! 	vpo->sim->max_dev_transactions = 1;
! 	vpo->sim->max_openings = 1;
! 	*/
! 	
! 	if (xpt_bus_register(vpo->sim, 0) != 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) {
--- 355,385 ----
  #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;
  	}
  
--- 387,393 ----
  		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) { \
--- 396,583 ----
  #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);
  
--- 708,714 ----
  	}
  
  	/* 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)
  {
  
--- 886,892 ----
  	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);
--- 900,906 ----
  
  	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)
  {
  
--- 913,919 ----
   *
   * 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.
--- 929,935 ----
  
  	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)
  {
--- 944,950 ----
  	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;
--- 979,984 ----
***************
*** 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 (;;) {
--- 990,1000 ----
  		}
  	}
  
  	/* 
  	 * Completion ... 
  	 */
! 	rw = ((command[0] == READ_6) || (command[0] == READ_10) ||
! 		(command[0] == WRITE_6) || (command[0] == WRITE_10));
  
  	*count = 0;
  	for (;;) {
*** vpo.h.orig	Sat Aug 16 07:05:38 1997
--- vpo.h	Wed Jun 24 08:02:33 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 ----

--_=XFMail.1.1.p0.FreeBSD:980626091117:375=_--
End of MIME message

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?XFMail.980626091117.schwarz>