Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Apr 1999 21:49:40 -0600 (MDT)
From:      "Kenneth D. Merry" <ken@plutotech.com>
To:        wilko@yedi.iaf.nl (Wilko Bulte)
Cc:        freebsd-scsi@FreeBSD.ORG
Subject:   Re: Getting Pioneer CD changer to work
Message-ID:  <199904130349.VAA09442@panzer.plutotech.com>
In-Reply-To: <199904122151.XAA03836@yedi.iaf.nl> from Wilko Bulte at "Apr 12, 1999 11:51:27 pm"

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

--ELM923975380-9424-0_
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Wilko Bulte wrote...
> As Kenneth D. Merry wrote ...
> > Wilko Bulte wrote...
> > > Alternative: could I use a 4.0-current *Alpha* box to remotely gdb? I.e.
> > > can gdb read other architectures execs/dumps? Probably not I guess..
> > 
> > I doubt that'll work.  Wouldn't you need an i386 gdb to understand the
> > debugging kernel and talk over the serial port?
> 
> I don't know. It is just a thought. A bit bizarre one maybe :)
> 
> I decided to bit the bullet: 2.2.8 is going to be 3.1 via an upgrade,
> probably tomorrow evening. Should give me elf support et al. And a
> working gdb :)

Well, here's something else you can try.  Justin and I went through the
section of code in question, and it looks like there may be a race
condition that could theoretically cause your problem.

In any case, try these diffs out.  There are two main changes here.  The
first will let the CD driver attach to anything that claims to be a CD or
WORM drive, unless it sends back a "logical unit not supported" error.

The second may fix the race condition.

I haven't tested these changes out other than to make sure they compile.

Let me know how it works.

Ken
-- 
Kenneth Merry
ken@plutotech.com

--ELM923975380-9424-0_
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: attachment; filename=scsi_cd.c.changer.diffs.041299
Content-Description: scsi_cd.c.changer.diffs.041299
Content-Transfer-Encoding: 7bit

==== //depot/cam/sys/cam/scsi/scsi_cd.c#102 - /usr/home/ken/perforce/cam/sys/cam/scsi/scsi_cd.c ====
*** /tmp/tmp.33532.0	Mon Apr 12 21:42:23 1999
--- /usr/home/ken/perforce/cam/sys/cam/scsi/scsi_cd.c	Mon Apr 12 21:41:54 1999
***************
*** 126,132 ****
  struct cd_softc {
  	cam_pinfo		pinfo;
  	cd_state		state;
! 	cd_flags		flags;
  	struct buf_queue_head	buf_queue;
  	LIST_HEAD(, ccb_hdr)	pending_ccbs;
  	struct cd_params	params;
--- 126,132 ----
  struct cd_softc {
  	cam_pinfo		pinfo;
  	cd_state		state;
! 	volatile cd_flags	flags;
  	struct buf_queue_head	buf_queue;
  	LIST_HEAD(, ccb_hdr)	pending_ccbs;
  	struct cd_params	params;
***************
*** 301,307 ****
  	struct cd_softc			 *cur_device;
  	struct callout_handle		 short_handle;
  	struct callout_handle		 long_handle;
! 	cd_changer_flags		 flags;
  	STAILQ_ENTRY(cdchanger)		 changer_links;
  	STAILQ_HEAD(chdevlist, cd_softc) chluns;
  };
--- 301,307 ----
  	struct cd_softc			 *cur_device;
  	struct callout_handle		 short_handle;
  	struct callout_handle		 long_handle;
! 	volatile cd_changer_flags	 flags;
  	STAILQ_ENTRY(cdchanger)		 changer_links;
  	STAILQ_HEAD(chdevlist, cd_softc) chluns;
  };
***************
*** 1103,1109 ****
  		 * bootstrap things.
  		 */
  		if (((softc->changer->flags & CHANGER_TIMEOUT_SCHED)==0)
! 		 &&((softc->changer->flags & CHANGER_NEED_TIMEOUT)==0)){
  			softc->changer->flags |= CHANGER_MANUAL_CALL;
  			cdrunchangerqueue(softc->changer);
  		}
--- 1103,1110 ----
  		 * bootstrap things.
  		 */
  		if (((softc->changer->flags & CHANGER_TIMEOUT_SCHED)==0)
! 		 && ((softc->changer->flags & CHANGER_NEED_TIMEOUT)==0)
! 		 && ((softc->changer->flags & CHANGER_SHORT_TMOUT_SCHED)==0)){
  			softc->changer->flags |= CHANGER_MANUAL_CALL;
  			cdrunchangerqueue(softc->changer);
  		}
***************
*** 1341,1347 ****
  		 * This should work the first time this device is woken up,
  		 * but just in case it doesn't, we use a while loop.
  		 */
! 		while ((((volatile cd_flags)softc->flags) & CD_FLAG_ACTIVE)==0){
  			/*
  			 * If this changer isn't already queued, queue it up.
  			 */
--- 1342,1348 ----
  		 * This should work the first time this device is woken up,
  		 * but just in case it doesn't, we use a while loop.
  		 */
! 		while ((softc->flags & CD_FLAG_ACTIVE) == 0) {
  			/*
  			 * If this changer isn't already queued, queue it up.
  			 */
***************
*** 1352,1361 ****
  				camq_insert(&softc->changer->devq,
  					    (cam_pinfo *)softc);
  			}
! 			if (((((volatile cd_changer_flags)softc->changer->flags)
! 				& CHANGER_TIMEOUT_SCHED)==0)
! 			 &&((((volatile cd_changer_flags)softc->changer->flags)
! 				& CHANGER_NEED_TIMEOUT)==0)){
  				softc->changer->flags |= CHANGER_MANUAL_CALL;
  				cdrunchangerqueue(softc->changer);
  			} else
--- 1353,1362 ----
  				camq_insert(&softc->changer->devq,
  					    (cam_pinfo *)softc);
  			}
! 			if (((softc->changer->flags & CHANGER_TIMEOUT_SCHED)==0)
! 			 && ((softc->changer->flags & CHANGER_NEED_TIMEOUT)==0)
! 			 && ((softc->changer->flags
! 			      & CHANGER_SHORT_TMOUT_SCHED)==0)) {
  				softc->changer->flags |= CHANGER_MANUAL_CALL;
  				cdrunchangerqueue(softc->changer);
  			} else
***************
*** 1739,1756 ****
  							   &asc, &ascq);
  				}
  				/*
! 				 * With CDROM devices, we expect 0x3a
! 				 * (Medium not present) errors, since not
! 				 * everyone leaves a CD in the drive.  Some
! 				 * broken Philips and HP WORM drives return
! 				 * 0x04,0x00 (logical unit not ready, cause
! 				 * not reportable), so we accept any "not
! 				 * ready" type errors as well.  If the error
! 				 * is anything else, though, we shouldn't
! 				 * attach.
  				 */
! 				if ((have_sense)
! 				 && ((asc == 0x3a) || (asc == 0x04))
  				 && (error_code == SSD_CURRENT_ERROR))
  					snprintf(announce_buf,
  					    sizeof(announce_buf),
--- 1740,1751 ----
  							   &asc, &ascq);
  				}
  				/*
! 				 * Attach to anything that claims to be a
! 				 * CDROM or WORM device, as long as it
! 				 * doesn't return a "Logical unit not
! 				 * supported" (0x25) error.
  				 */
! 				if ((have_sense) && (asc != 0x25)
  				 && (error_code == SSD_CURRENT_ERROR))
  					snprintf(announce_buf,
  					    sizeof(announce_buf),

--ELM923975380-9424-0_--


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?199904130349.VAA09442>