Subject: port-i386/988: "uk" device driver source is included but non-functional
To: None <gnats-admin@NetBSD.ORG>
From: Andreas Gustafsson <gson@araneus.pp.fi>
List: netbsd-bugs
Date: 04/24/1995 11:05:13
>Number:         988
>Category:       port-i386
>Synopsis:       "uk" device driver source is included but non-functional
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 24 11:05:11 1995
>Originator:     Andreas Gustafsson <gson@araneus.pp.fi>
>Organization:
Araneus Information Systems Oy
>Release:        NetBSD-current snapshot of around March 17, 1995
>Environment:

System: NetBSD araneus.pp.fi 1.0A NetBSD 1.0A (GUANO) #3: Wed Apr 12 17:21:06 EET DST 1995 gson@araneus.pp.fi:/usr/src/sys/arch/i386/compile/GUANO i386

>Description:

The NetBSD-current kernel source tree contains a device driver for
unrecognized SCSI devices in /usr/src/sys/scsi/uk.c.  This driver
would be quite useful now that the SCIOCCOMMAND ioctl() actually
works, but it won't compile due to a syntax error, and it's not
included in any configuration files.

>How-To-Repeat:

Attempt to configure a "uk" device.

>Fix:

(These are my own patches; I suppose FreeBSD has something similar
since they claim to support the uk device.  Also, I don't know whether
my choice of major device number is reasonable, and in case any other
architectures besides i386 use the same SCSI subsystem, they should
probably be updated, too.)


*** /usr/src/sys/scsi/uk.c.orig	Thu Dec 29 13:29:10 1994
--- /usr/src/sys/scsi/uk.c	Sun Apr  2 12:43:55 1995
***************
*** 170,174 ****
  {
  	register struct uk_softc *uk = ukcd.cd_devs[UKUNIT(dev)];
  
! 	return scsi_do_ioctl(uk->sc_link, dev, cmd, addr, flag, p));
  }
--- 170,174 ----
  {
  	register struct uk_softc *uk = ukcd.cd_devs[UKUNIT(dev)];
  
! 	return scsi_do_ioctl(uk->sc_link, dev, cmd, addr, flag, p);
  }

*** /usr/src/sys/arch/i386/i386/conf.c.orig	Fri Mar  3 14:22:08 1995
--- /usr/src/sys/arch/i386/i386/conf.c	Sun Apr  2 12:52:50 1995
***************
*** 296,301 ****
--- 296,310 ----
  	(dev_type_stop((*))) enodev, (dev_type_reset((*))) nullop, 0, \
  	(dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev, 0 }
  
+ #include "uk.h"
+ cdev_decl(uk);
+ /* open, close, ioctl */
+ #define	cdev_uk_init(c,n) { \
+ 	dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
+ 	(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
+ 	(dev_type_stop((*))) enodev, (dev_type_reset((*))) nullop, 0, \
+ 	(dev_type_select((*))) enodev, (dev_type_mmap((*))) enodev, 0 }
+ 
  cdev_decl(wd);
  cdev_decl(fd);
  cdev_decl(wt);
***************
*** 389,395 ****
  	cdev_disk_init(NCD,cd),		/* 15: SCSI CD-ROM */
  	cdev_lpt_init(NLPT,lpt),	/* 16: parallel printer */
  	cdev_ch_init(NCH,ch),		/* 17: SCSI autochanger */
! 	cdev_notdef(),			/* 18: unused */
  	cdev_notdef(),			/* 19: unused */
  	cdev_notdef(),			/* 20: unused */
  	cdev_notdef(),			/* 21: unused */
--- 398,404 ----
  	cdev_disk_init(NCD,cd),		/* 15: SCSI CD-ROM */
  	cdev_lpt_init(NLPT,lpt),	/* 16: parallel printer */
  	cdev_ch_init(NCH,ch),		/* 17: SCSI autochanger */
! 	cdev_uk_init(NUK,uk),		/* 18: unknown SCSI */
  	cdev_notdef(),			/* 19: unused */
  	cdev_notdef(),			/* 20: unused */
  	cdev_notdef(),			/* 21: unused */


*** /usr/src/sys/arch/i386/conf/GENERIC.orig	Mon Mar  6 13:27:19 1995
--- /usr/src/sys/arch/i386/conf/GENERIC	Sun Apr 23 17:29:38 1995
***************
*** 127,132 ****
--- 127,133 ----
  st*	at scsibus? target ? lun ?	# SCSI tape drives
  cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives
  ch*	at scsibus? target ? lun ?	# SCSI autochangers
+ uk*	at scsibus? target ? lun ?      # SCSI unknown
  
  fdc0	at isa? port 0x3f0 irq 6 drq 2	# standard PC floppy controllers
  #fdc1	at isa? port 0x370 irq ? drq ?


*** /dev/MAKEDEV.orig	Tue Aug  2 01:38:31 1994
--- /dev/MAKEDEV	Sun Apr 23 17:36:01 1995
***************
*** 80,86 ****
  
  all)
  	sh MAKEDEV std fd wt0 fd0 fd1 wd0 wd1 sd0 sd1 sd2 tty0 tty1 pty0 pty1
! 	sh MAKEDEV st0 st1 ch0 cd0 cd1 mcd0 vnd0 vnd1 lpa0 lpa1
  	sh MAKEDEV lpt0 lpt1 lpt2 ttyv0 bpf0 bpf1 bpf2 bpf3 speaker lkm
  	sh MAKEDEV mms0 lms0 pms0 audio local
  # MISSING:
--- 80,86 ----
  
  all)
  	sh MAKEDEV std fd wt0 fd0 fd1 wd0 wd1 sd0 sd1 sd2 tty0 tty1 pty0 pty1
! 	sh MAKEDEV st0 st1 ch0 uk0 cd0 cd1 mcd0 vnd0 vnd1 lpa0 lpa1
  	sh MAKEDEV lpt0 lpt1 lpt2 ttyv0 bpf0 bpf1 bpf2 bpf3 speaker lkm
  	sh MAKEDEV mms0 lms0 pms0 audio local
  # MISSING:
***************
*** 258,263 ****
--- 258,274 ----
  		;;
  	esac
  	umask 77
+ 	;;
+ 
+ uk*)
+ 	unit=`expr $i : '..\(.*\)'`
+ 	case $i in
+ 	uk*) name=uk;  chr=18;;
+ 	esac
+ 	rm -f $name$unit
+ 	mknod ${name}${unit}	c $chr $unit
+ 	chgrp operator ${name}${unit}
+ 	chmod 600 ${name}${unit}
  	;;
  
  cd*|mcd*)
>Audit-Trail:
>Unformatted: