From ljo-slip.DIALIN.CWRU.Edu!ljo Fri Aug 19 04:40:01 1994
Return-Path: <ljo@ljo-slip.DIALIN.CWRU.Edu>
Received: from ljo-slip.DIALIN.CWRU.Edu by tfs.com (smail3.1.28.1) with SMTP
	id m0qbSId-0003wLC; Fri, 19 Aug 94 04:39 PDT
Received: by ljo-slip.DIALIN.CWRU.Edu (8.6.8/1.34)
	id EAA08390; Thu, 18 Aug 1994 04:47:57 -0401
Date: Thu, 18 Aug 1994 04:47:57 -0401
From: ljo@ljo-slip.DIALIN.CWRU.Edu (L Jonas Olsson)
Message-Id: <199408180848.EAA08390@ljo-slip.DIALIN.CWRU.Edu>
To: phk@tfs.com
In-reply-to: <m0qbLlq-0003xqC@TFS.COM> (phk@tfs.com)
Subject: Re: FreeBSD 1-current - Anyone have a host for a server for 2/3 months ?
Reply-to: ljo@po.CWRU.Edu
Status: RO


Hi Poul-Henning,
 Here's a patch that Gene Stark wrote to fix the QIC-02/QIC-36
driver. It makes my Cipher 700 tape drive that I bought for $99 work
beutifully!

Jonas

*** /usr.src/sys/i386/isa/wt.c	Wed Jun 29 04:12:42 1994
--- src/sys/i386/isa/wt.c	Tue Jul 19 08:44:56 1994
***************
*** 702,713 ****
  /* execute QIC command */
  static int wtcmd (wtinfo_t *t, int cmd)
  {
! 	int s;
  
  	DEBUG (("wtcmd() cmd=0x%x\n", cmd));
  	s = wtpoll (t, t->BUSY | t->NOEXCEP, t->BUSY | t->NOEXCEP); /* ready? */
! 	if (! (s & t->NOEXCEP))                         /* error */
  		return (0);
  	
  	outb (t->CMDPORT, cmd);                         /* output the command */
  
--- 702,716 ----
  /* execute QIC command */
  static int wtcmd (wtinfo_t *t, int cmd)
  {
! 	int s, x;
  
  	DEBUG (("wtcmd() cmd=0x%x\n", cmd));
+ 	x = splbio();
  	s = wtpoll (t, t->BUSY | t->NOEXCEP, t->BUSY | t->NOEXCEP); /* ready? */
! 	if (! (s & t->NOEXCEP)) {                       /* error */
! 	        splx(x);
  		return (0);
+ 	}
  	
  	outb (t->CMDPORT, cmd);                         /* output the command */
  
***************
*** 715,720 ****
--- 718,724 ----
  	wtpoll (t, t->BUSY, t->BUSY);                   /* wait for ready */
  	outb (t->CTLPORT, t->IEN | t->ONLINE);          /* reset request */
  	wtpoll (t, t->BUSY, 0);                         /* wait for not ready */
+ 	splx(x);
  	return (1);
  }
  
***************
*** 749,760 ****
  /* start i/o operation */
  static int wtstart (wtinfo_t *t, unsigned flags, void *vaddr, unsigned len)
  {
! 	int s;
  
  	DEBUG (("wtstart()\n"));
  	s = wtpoll (t, t->BUSY | t->NOEXCEP, t->BUSY | t->NOEXCEP); /* ready? */
  	if (! (s & t->NOEXCEP)) {
  		t->flags |= TPEXCEP;            /* error */
  		return (0);
  	}
  	t->flags &= ~TPEXCEP;                   /* clear exception flag */
--- 753,766 ----
  /* start i/o operation */
  static int wtstart (wtinfo_t *t, unsigned flags, void *vaddr, unsigned len)
  {
! 	int s, x;
  
  	DEBUG (("wtstart()\n"));
+ 	x = splbio();
  	s = wtpoll (t, t->BUSY | t->NOEXCEP, t->BUSY | t->NOEXCEP); /* ready? */
  	if (! (s & t->NOEXCEP)) {
  		t->flags |= TPEXCEP;            /* error */
+ 		splx(x);
  		return (0);
  	}
  	t->flags &= ~TPEXCEP;                   /* clear exception flag */
***************
*** 763,768 ****
--- 769,775 ----
  	t->dmacount = 0;
  	t->dmaflags = flags;
  	wtdma (t);
+ 	splx(x);
  	return (1);
  }
  
***************
*** 876,882 ****
--- 883,891 ----
  static int wtstatus (wtinfo_t *t)
  {
  	char *p;
+ 	int x;
  
+ 	x = splbio();
  	wtpoll (t, t->BUSY | t->NOEXCEP, t->BUSY | t->NOEXCEP); /* ready? */
  	outb (t->CMDPORT, QIC_RDSTAT);  /* send `read status' command */
  
***************
*** 888,895 ****
  	p = (char*) &t->error;
  	while (p < (char*)&t->error + 6) {
  		int s = wtpoll (t, t->BUSY | t->NOEXCEP, t->BUSY | t->NOEXCEP);
! 		if (! (s & t->NOEXCEP))                 /* error */
  			return (0);
  
  		*p++ = inb (t->DATAPORT);               /* read status byte */
  
--- 897,906 ----
  	p = (char*) &t->error;
  	while (p < (char*)&t->error + 6) {
  		int s = wtpoll (t, t->BUSY | t->NOEXCEP, t->BUSY | t->NOEXCEP);
! 		if (! (s & t->NOEXCEP)) {               /* error */
! 		        splx(x);
  			return (0);
+ 		}
  
  		*p++ = inb (t->DATAPORT);               /* read status byte */
  
***************
*** 898,903 ****
--- 909,915 ----
  		DELAY(30);
  		outb (t->CTLPORT, t->ONLINE);           /* unset request */
  	}
+ 	splx(x);
  	return (1);
  }
  #endif /* NWT */

