Subject: Re: pas0 probs, was Re: ed0 problems from recent change
To: VaX#n8 <vax@linkdead.paranoia.com>
From: John F. Woods <jfw@funhouse.com>
List: port-i386
Date: 05/27/1996 12:59:17
> >If only the PAS16 was *hardware* compatible
> >with the soundblaster.  I don't consider requiring a device driver
> >to enable hardware compatibility to be the real thing.. :)

> Well, AFAIK, the soundblaster portion of the board *is*, the PAS-16 portion
> is seperate.  I could be wrong tho.

After a cold reset, the SB emulation is not enabled.  The driver (NetBSD
and DOS) enables the SB emulation by poking a bit at I/O port 0x388, and
thereafter it behaves like a completely generic SB.  One hopes.

I believe that the problem reported (PAS driver probe causes a crash) is due
to the problem I reported in PR #2237 some time ago:  the PAS driver, like the
SB driver, defines a control structure that includes an sb_softc member as
well as duplicates of all of the sb_softc members; unlike the SB driver, the
PAS driver uses the redundant members, and *doesn't* initialize the sb_softc
members which the sbdsp.c file insists must be initialized (in particular,
sc_dev).  As I said in the PR, "hilarity ensues."  The patch I supplied
simply removes the redundant members and makes the PAS driver rely on sb_softc.
I have updated the patch submitted with that PR and append it below; only
cosmetic changes have been made to the pas.c driver since then, but one of
the cosmetic changes was enough to make the original patch fail.  It would
be really nice if this, or any other, patch could make it into NetBSD 1.2.
(The commented out assignment "/*  sc->sc_iobase = ia->ia_iobase;" can really
be removed altogether; that's what happens when you take a stab at something
late at night, and then never get the time to clean up the detritus later.)

*** pas.c.orig	Mon May 13 07:36:23 1996
--- pas.c	Mon May 27 11:54:08 1996
***************
*** 86,103 ****
   * most basic communications with the sb card.
   */
  struct pas_softc {
! 	struct	device sc_dev;		/* base device */
! 	struct	isadev sc_id;		/* ISA device */
! 	void	*sc_ih;			/* interrupt vectoring */
! 
! 	int	sc_iobase;		/* PAS iobase */
! 	int	sc_irq;			/* PAS irq */
! 	int	sc_drq;			/* PAS drq */
! 
! 	int model;
  	int rev;
  
- 	struct sbdsp_softc sc_sbdsp;
  };
  
  int	pasopen __P((dev_t, int));
--- 86,97 ----
   * most basic communications with the sb card.
   */
  struct pas_softc {
! 	struct sbdsp_softc sc_sbdsp;	/* use sc_dev, sc_id, sc_ih,
! 					 *     sc_iobase, sc_irq, sc_drq
! 					 * from here */
! 	int model;	/* unique to PAS */
  	int rev;
  
  };
  
  int	pasopen __P((dev_t, int));
***************
*** 350,356 ****
          }
  
  	/* Now a SoundBlaster */
! 	sc->sc_iobase = ia->ia_iobase;
  	/* and set the SB iobase into the DSP as well ... */
  	sc->sc_sbdsp.sc_iobase = ia->ia_iobase;
  	if (sbdsp_reset(&sc->sc_sbdsp) < 0) {
--- 344,350 ----
          }
  
  	/* Now a SoundBlaster */
! /*	sc->sc_iobase = ia->ia_iobase;
  	/* and set the SB iobase into the DSP as well ... */
  	sc->sc_sbdsp.sc_iobase = ia->ia_iobase;
  	if (sbdsp_reset(&sc->sc_sbdsp) < 0) {
***************
*** 437,444 ****
  	register int iobase = ia->ia_iobase;
  	int err;
  	
! 	sc->sc_iobase = iobase;
! 	sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
  	    IPL_AUDIO, sbdsp_intr, &sc->sc_sbdsp);
  
  	printf(" ProAudio Spectrum %s [rev %d] ", pasnames[sc->model], sc->rev);
--- 431,438 ----
  	register int iobase = ia->ia_iobase;
  	int err;
  	
! 	sc->sc_sbdsp.sc_iobase = iobase;
! 	sc->sc_sbdsp.sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
  	    IPL_AUDIO, sbdsp_intr, &sc->sc_sbdsp);
  
  	printf(" ProAudio Spectrum %s [rev %d] ", pasnames[sc->model], sc->rev);