Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 1997 00:26:45 -0800
From:      "Jordan K. Hubbard" <jkh@FreeBSD.org>
To:        stable@FreeBSD.org
Cc:        sos@FreeBSD.org
Subject:   [Fwd: patch for 2.1.5/2.1.6 ATAPI wcd driver]
Message-ID:  <32FEDBC5.167EB0E7@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--------------794BDF32446B9B3D2781E494
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Any opinions?  Should these simply go in, or are large 2.2->2.1 merges
for this planned?

-- 
- Jordan Hubbard

--------------794BDF32446B9B3D2781E494
Content-Type: message/news
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Newsgroups: comp.unix.bsd.freebsd.misc
From: jr@cs.mun.ca (John Rochester)
Subject: patch for 2.1.5/2.1.6 ATAPI wcd driver
Message-ID: <1997Feb6.175853.202@cs.mun.ca>
Sender: usenet@cs.mun.ca (NNTP server account)
Organization: CS Dept., Memorial University of Newfoundland
X-Newsreader: NN version 6.4.19
References: <5c0ccn$a3@nntp1.best.com>
Date: Thu, 6 Feb 1997 17:58:53 GMT
Path: nexp.crl.com!207.211.70.11!news7.crl.com!nntp.crl.com!syix.com!news.maxwell.syr.edu!news.mathworks.com!howland.erols.net!spool.mu.edu!torn!news.dal.ca!news.nstn.ca!coranto.ucs.mun.ca!cs.mun.ca!jr

This patch is essentially some of the changes that went into the
2.2 driver (I had originally done my own patches, but edited them
to make them look more like 2.2).

Instructions for the neophyte:

1) put the contents below (between the "cut here" lines) into a file like
	/tmp/cdpatch

2) do the following commands:

	cd /usr/src/sys
	patch -p0 < /tmp/cdpatch

		(patch will put the old file in i386/isa/wcd.c.orig)

3) If you haven't configured a kernel, do so.  Read the handbook entry on
	"Configuring the FreeBSD Kernel".  (The handbook is in
	    /usr/share/doc/handbook/handbook.ascii  or handbook_toc.html).

	cd /usr/src/sys/i386/conf
	cp GENERIC YOURKERNELNAMEHERE
	vi YOURKERNELNAMEHERE
	config YOURKERNELNAMEHERE

4) Recompile and install the new kernel:

	cd /usr/src/sys/compile/YOURKERNELNAMEHERE
	make depend
	make
	(and, if there are no errors:)
	make install

5) Reboot.


For xmcd to work, make sure that /usr/X11R6/lib/X11/xmcd/config/common.cfg
has the following device line:

device:		/dev/rwcd0c

And that /usr/X11R6/lib/X11/xmcd/config/rwcd0c (copied from device.cfg if
you don't already have one) has the following line in it:

deviceInterfaceMethod:	2

john
-----
John Rochester			jr@cs.mun.ca
Dept. of Computer Science
Memorial University of Newfoundland, St. John's, Newfoundland, Canada

-----cut here-----
*** i386/isa/wcd.c.orig	Thu Feb  6 13:43:45 1997
--- i386/isa/wcd.c	Thu Feb  6 13:58:53 1997
***************
*** 41,46 ****
--- 41,48 ----
  #define F_DEBUG         0x0004          /* The media have changed since open */
  #define F_NOPLAYCD      0x0008          /* The PLAY_CD op not supported */
  
+ #define WCD_LASTPLUS1	170		/* Don't ask, xcdplayer uses this */
+ 
  /*
   * Disc table of contents.
   */
***************
*** 732,749 ****
  		struct toc *toc = &t->toc;
  		struct toc buf;
  		u_long len;
  
  		if (! t->toc.hdr.ending_track)
  			return (EIO);
! 		if (te->starting_track < toc->hdr.starting_track ||
! 		    te->starting_track > toc->hdr.ending_track)
  			return (EINVAL);
  
! 		len = (toc->hdr.ending_track - te->starting_track + 2) *
  			sizeof(toc->tab[0]);
  		if (te->data_len < len)
  			len = te->data_len;
! 		if (len <= 0)
  			return (EINVAL);
  
  		/* Convert to MSF format, if needed. */
--- 734,764 ----
  		struct toc *toc = &t->toc;
  		struct toc buf;
  		u_long len;
+ 		u_char starting_track = te->starting_track;
  
  		if (! t->toc.hdr.ending_track)
  			return (EIO);
! 
! 		if (   te->data_len < sizeof(toc->tab[0])
! 		    || (te->data_len % sizeof(toc->tab[0])) != 0
! 		    || te->address_format != CD_MSF_FORMAT
! 		    && te->address_format != CD_LBA_FORMAT
! 		   )
  			return (EINVAL);
  
! 		if (starting_track == 0)
! 			starting_track = toc->hdr.starting_track;
! 		else if (starting_track == WCD_LASTPLUS1)
! 			starting_track = toc->hdr.ending_track + 1;
! 		else if (starting_track < toc->hdr.starting_track ||
! 			 starting_track > toc->hdr.ending_track + 1)
! 			return (EINVAL);
! 
! 		len = (toc->hdr.ending_track + 2 - starting_track) *
  			sizeof(toc->tab[0]);
  		if (te->data_len < len)
  			len = te->data_len;
! 		if (len > sizeof(toc->tab))
  			return (EINVAL);
  
  		/* Convert to MSF format, if needed. */
***************
*** 752,767 ****
  
  			buf = t->toc;
  			toc = &buf;
! 			e = toc->tab + toc->hdr.ending_track -
! 				te->starting_track + 2;
  			while (--e >= toc->tab)
  				lba2msf (e->addr.lba, &e->addr.msf.minute,
  				    &e->addr.msf.second, &e->addr.msf.frame);
  		}
! 		if (copyout (toc->tab + te->starting_track -
! 		    toc->hdr.starting_track, te->data, len) != 0)
! 			error = EFAULT;
! 		break;
  	}
  	case CDIOCREADSUBCHANNEL: {
  		struct ioc_read_subchannel *args =
--- 767,780 ----
  
  			buf = t->toc;
  			toc = &buf;
! 			e = toc->tab + toc->hdr.ending_track + 2 -
! 				    toc->hdr.starting_track;
  			while (--e >= toc->tab)
  				lba2msf (e->addr.lba, &e->addr.msf.minute,
  				    &e->addr.msf.second, &e->addr.msf.frame);
  		}
! 		return copyout (toc->tab + starting_track -
! 				toc->hdr.starting_track, te->data, len);
  	}
  	case CDIOCREADSUBCHANNEL: {
  		struct ioc_read_subchannel *args =
-----cut here-----

--------------794BDF32446B9B3D2781E494--




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