Subject: port-i386/1361: i386 speaker driver not converted to config.new
To: None <gnats-bugs@gnats.netbsd.org>
From: None <rafal@scofflaw.banyan.com>
List: netbsd-bugs
Date: 08/15/1995 12:59:08
>Number:         1361
>Category:       port-i386
>Synopsis:       i386 speaker driver still thinks it's dealing with old config
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 15 13:20:01 1995
>Last-Modified:
>Originator:     Rafal Boni
>Organization:
	...not recently...
>Release:        all -currents
>Environment:

System: NetBSD eightball.banyan.com 1.0A NetBSD 1.0A (EIGHTBALL) #1: Tue Aug 15 11:34:00 EDT 1995 rafal@eightball.banyan.com:/home/scofflaw/src/netbsd/sys/arch/i386/compile/EIGHTBALL i386


>Description:
	The i386 speaker driver was never beat into submission when the port
	went to config.new, hence one cannot build a kernel that uses it..

>How-To-Repeat:
	Try to build a kernel with "spkr0 at isa? port 0x61" in it.
>Fix:

	Patch the following files in /sys/arch/i386:
			(1) isa/spkr.c
			(2) conf/files.i386
			(3) i386/conf.c

	Add "spkr0 at isa? port 0x61" to config-file, re-config and re-build
	Use speaker...

	Patches follow:

*** spkr.orig	Tue Aug 15 12:53:28 1995
--- spkr.c	Tue Aug 15 12:55:27 1995
***************
*** 8,32 ****
   *      386bsd only clean version, all SYSV stuff removed
   *      use hz value from param.c
   */
  
! #include "speaker.h"
! #if NSPEAKER > 0
  
  #include <sys/param.h>
  #include <sys/kernel.h>
  #include <sys/errno.h>
  #include <sys/buf.h>
  #include <sys/uio.h>
  
  #include <machine/cpu.h>
  #include <machine/pio.h>
  #include <machine/spkr.h>
  
! #include <i386/isa/isareg.h>
  #include <i386/isa/timerreg.h>
  #include <i386/isa/spkrreg.h>
  
  /**************** MACHINE DEPENDENT PART STARTS HERE *************************
   *
   * This section defines a function tone() which causes a tone of given
   * frequency and duration from the 80x86's console speaker.
--- 8,44 ----
   *      386bsd only clean version, all SYSV stuff removed
   *      use hz value from param.c
   */
  
! #include "spkr.h"
! #if NSPKR > 0
  
  #include <sys/param.h>
  #include <sys/kernel.h>
  #include <sys/errno.h>
+ #include <sys/device.h>
  #include <sys/buf.h>
  #include <sys/uio.h>
  
  #include <machine/cpu.h>
  #include <machine/pio.h>
  #include <machine/spkr.h>
  
! #include <dev/isa/isareg.h>
  #include <i386/isa/timerreg.h>
  #include <i386/isa/spkrreg.h>
  
+ int spkrprobe __P((struct device *, void *, void *));
+ void spkrattach __P((struct device *, struct device *, void *));
+ 
+ struct spkr_softc {
+ 	struct device sc_dev;
+ };
+ 
+ struct cfdriver spkrcd = {
+ 	NULL, "spkr", spkrprobe, spkrattach, DV_TTY, sizeof(struct spkr_softc)
+ };
+ 
  /**************** MACHINE DEPENDENT PART STARTS HERE *************************
   *
   * This section defines a function tone() which causes a tone of given
   * frequency and duration from the 80x86's console speaker.
***************
*** 43,54 ****
   * Magic numbers for timer control. 
   */
  #define PIT_MODE	(TIMER_SEL2|TIMER_16BIT|TIMER_SQWAVE)
  
- void
- speakerattach()
- {
- }
  
  static int endtone()
  /* turn off the speaker, ending current tone */
  {
--- 55,62 ----
***************
*** 400,407 ****
--- 408,425 ----
   */
  
  static int spkr_active;	/* exclusion flag */
  static struct buf *spkr_inbuf; /* incoming buf */
+ 
+ int spkrprobe (struct device *parent, void *match, void *aux)
+ {
+ 	return 1;
+ }
+ 
+ void spkrattach (struct device *parent, struct device *self, void *aux)
+ {
+ 	printf("\n");
+ }
  
  int spkropen(dev)
  dev_t	dev;
  {


*** /home/scofflaw/rafal/tmp/conf.c.orig	Tue Aug 15 11:46:22 1995
--- conf.c	Tue Aug 15 10:36:15 1995
***************
*** 142,150 ****
  cdev_decl(ch);
  dev_decl(fd,open);
  #include "bpfilter.h"
  cdev_decl(bpf);
! #include "speaker.h"
  cdev_decl(spkr);
  #ifdef LKM
  #define	NLKM	1
  #else
--- 142,150 ----
  cdev_decl(ch);
  dev_decl(fd,open);
  #include "bpfilter.h"
  cdev_decl(bpf);
! #include "spkr.h"
  cdev_decl(spkr);
  #ifdef LKM
  #define	NLKM	1
  #else
***************
*** 197,205 ****
  	cdev_bpftun_init(NBPFILTER,bpf),/* 23: Berkeley packet filter */
  	cdev_notdef(),			/* 24 */
  	cdev_notdef(),			/* 25 */
  	cdev_notdef(),			/* 26 */
! 	cdev_spkr_init(NSPEAKER,spkr),	/* 27: PC speaker */
  	cdev_lkm_init(NLKM,lkm),	/* 28: loadable module driver */
  	cdev_lkm_dummy(),		/* 29 */
  	cdev_lkm_dummy(),		/* 30 */
  	cdev_lkm_dummy(),		/* 31 */
--- 197,205 ----
  	cdev_bpftun_init(NBPFILTER,bpf),/* 23: Berkeley packet filter */
  	cdev_notdef(),			/* 24 */
  	cdev_notdef(),			/* 25 */
  	cdev_notdef(),			/* 26 */
! 	cdev_spkr_init(NSPKR,spkr),	/* 27: PC speaker */
  	cdev_lkm_init(NLKM,lkm),	/* 28: loadable module driver */
  	cdev_lkm_dummy(),		/* 29 */
  	cdev_lkm_dummy(),		/* 30 */
  	cdev_lkm_dummy(),		/* 31 */


*** /home/scofflaw/rafal/tmp/files.i386.orig	Tue Aug 15 11:46:05 1995
--- files.i386	Tue Aug 15 10:20:18 1995
***************
*** 97,105 ****
  major	{fd = 2}
  
  # PC speaker
  device	spkr at isa: tty
! file	arch/i386/isa/spkr.c		speaker needs-flag
  
  # AMD am7990 (Lance) -based boards
  # (BICC Isolan, NE2100, DEPCA)
  # XXX conflicts with other ports; can't be in files.isa
--- 97,105 ----
  major	{fd = 2}
  
  # PC speaker
  device	spkr at isa: tty
! file	arch/i386/isa/spkr.c		spkr needs-flag
  
  # AMD am7990 (Lance) -based boards
  # (BICC Isolan, NE2100, DEPCA)
  # XXX conflicts with other ports; can't be in files.isa
>Audit-Trail:
>Unformatted: