Subject: Re: moving away from BROKEN_INDIRECT_CONFIG
To: None <mikel@shore.net>
From: Lennart Augustsson <augustss@cs.chalmers.se>
List: port-i386
Date: 01/19/1998 22:34:39
> I can probably dig up my PSS if you can't find anyone else.  It's been
> a long time since the pss driver was included in my kernel config, so
> I have no idea if it works.  I suspect it doesn't.
Well, noone else volunteered :-)  I've no clue if the driver
worked before, but here are some diffs.

        -- Lennart

Index: pss.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isa/pss.c,v
retrieving revision 1.38
diff -c -r1.38 pss.c
*** pss.c	1998/01/12 09:43:44	1.38
--- pss.c	1998/01/19 21:33:36
***************
*** 161,171 ****
--- 161,183 ----
  #define DPRINTF(x)
  #endif
  
+ #ifdef __BROKEN_INDIRECT_CONFIG
  int	pssprobe __P((struct device *, void *, void *));
+ #else
+ int	pssprobe __P((struct device *, struct cfdata *, void *));
+ #endif
  void	pssattach __P((struct device *, struct device *, void *));
+ static	int pssfind __P((struct device *, struct pss_softc *, 
+ 			 struct isa_attach_args *));
  
+ #ifdef __BROKEN_INDIRECT_CONFIG
  int	spprobe __P((struct device *, void *, void *));
+ #else
+ int	spprobe __P((struct device *, struct cfdata *, void *));
+ #endif
  void	spattach __P((struct device *, struct device *, void *));
+ static	int spfind __P((struct device *, struct ad1848_softc *, 
+ 			struct isa_attach_args *));
  
  #ifdef notyet
  int	mpuprobe __P((struct device *, void *, void *));
***************
*** 702,714 ****
   * Probe for the PSS hardware.
   */
  int
! pssprobe(parent, self, aux)
      struct device *parent;
!     void *self;
      void *aux;
  {
!     struct pss_softc *sc = self;
!     struct isa_attach_args *ia = aux;
      int iobase = ia->ia_iobase;
      
      if (!PSS_BASE_VALID(iobase)) {
--- 714,746 ----
   * Probe for the PSS hardware.
   */
  int
! pssprobe(parent, match, aux)
      struct device *parent;
! #ifdef __BROKEN_INDIRECT_CONFIG
!     void *match;
! #else
!     struct cfdata *match;
! #endif
      void *aux;
  {
!     struct pss_softc probesc, *sc = &probesc;
! 
!     bzero(sc, sizeof *sc);
! #ifdef __BROKEN_INDIRECT_CONFIG
!     sc->sc_dev.dv_cfdata = ((struct device *)match)->dv_cfdata;
! #else
!     sc->sc_dev.dv_cfdata = match;
! #endif
!     strcpy(sc->sc_dev.dv_xname, "pas");
!     return pssfind(parent, sc, aux);
! }
! 
! static int
! pssfind(parent, sc, ia)
!     struct device *parent;
!     struct pss_softc *sc;
!     struct isa_attach_args *ia;
! {
      int iobase = ia->ia_iobase;
      
      if (!PSS_BASE_VALID(iobase)) {
***************
*** 805,827 ****
  int
  spprobe(parent, match, aux)
      struct device *parent;
!     void *match, *aux;
  {
-     struct ad1848_softc *sc = match;
      struct pss_softc *pc = (void *) parent;
      struct cfdata *cf = (void *)sc->sc_dev.dv_cfdata;
-     struct isa_attach_args *ia = aux;
      u_char bits;
      int i;
  
      sc->sc_iot = ia->ia_iot;
-     sc->sc_iobase = cf->cf_iobase + WSS_CODEC;
      
      /* Set WSS io address */
      pss_setaddr(cf->cf_iobase, pc->sc_iobase+PSS_WSS_CONFIG);
  
      /* Is there an ad1848 chip at the WSS iobase ? */
!     if (ad1848_probe(sc) == 0) {
  	DPRINTF(("sp: no ad1848 ? iobase=%x\n", sc->sc_iobase));
  	return 0;
      }
--- 837,878 ----
  int
  spprobe(parent, match, aux)
      struct device *parent;
! #ifdef __BROKEN_INDIRECT_CONFIG
!     void *match;
! #else
!     struct cfdata *match;
! #endif
!     void *aux;
! {
!     struct ad1848_softc probesc, *sc = &probesc;
! 
!     bzero(sc, sizeof *sc);
! #ifdef __BROKEN_INDIRECT_CONFIG
!     sc->sc_dev.dv_cfdata = ((struct device *)match)->dv_cfdata;
! #else
!     sc->sc_dev.dv_cfdata = match;
! #endif
!     return spfind(parent, sc, aux);
! }
! 
! static int
! spfind(parent, sc, ia)
!     struct device *parent;
!     struct ad1848_softc *sc;
!     struct isa_attach_args *ia;
  {
      struct pss_softc *pc = (void *) parent;
      struct cfdata *cf = (void *)sc->sc_dev.dv_cfdata;
      u_char bits;
      int i;
  
      sc->sc_iot = ia->ia_iot;
      
      /* Set WSS io address */
      pss_setaddr(cf->cf_iobase, pc->sc_iobase+PSS_WSS_CONFIG);
  
      /* Is there an ad1848 chip at the WSS iobase ? */
!     if (ad1848_mapprobe(sc, cf->cf_iobase + WSS_CODEC) == 0) {
  	DPRINTF(("sp: no ad1848 ? iobase=%x\n", sc->sc_iobase));
  	return 0;
      }
***************
*** 1011,1016 ****
--- 1062,1072 ----
      u_char vers;
      struct ad1848_volume vol = {150, 150};
      
+     if (!pssfind(parent, sc, ia)) {
+ 	printf("%s: pssfind failed\n", sc->sc_dev.dv_xname);
+ 	return;
+     }
+ 
      sc->sc_iobase = iobase;
      sc->sc_drq = ia->ia_drq;
  
***************
*** 1025,1031 ****
      vers = (inw(sc->sc_iobase+PSS_ID_VERS)&0xff) - 1;
      printf(": ESC614%c\n", (vers > 0)?'A'+vers:' ');
      
!     (void)config_found(self, ia->ia_ic, NULL);		/* XXX */
  
      sc->out_port = PSS_MASTER_VOL;
  
--- 1081,1087 ----
      vers = (inw(sc->sc_iobase+PSS_ID_VERS)&0xff) - 1;
      printf(": ESC614%c\n", (vers > 0)?'A'+vers:' ');
      
!     (void)config_found(self, ia, NULL);		/* XXX */
  
      sc->out_port = PSS_MASTER_VOL;
  
***************
*** 1044,1051 ****
  {
      struct ad1848_softc *sc = (struct ad1848_softc *)self;
      struct cfdata *cf = (void *)sc->sc_dev.dv_cfdata;
!     isa_chipset_tag_t ic = aux;				/* XXX */
      int iobase = cf->cf_iobase;
  
      sc->sc_iobase = iobase;
      sc->sc_drq = cf->cf_drq;
--- 1100,1113 ----
  {
      struct ad1848_softc *sc = (struct ad1848_softc *)self;
      struct cfdata *cf = (void *)sc->sc_dev.dv_cfdata;
!     struct isa_attach_args *ia = (struct isa_attach_args *)aux;
!     isa_chipset_tag_t ic = ia->ia_ic;
      int iobase = cf->cf_iobase;
+ 
+     if (!spfind(parent, sc, ia)) {
+ 	printf("%s: spfind failed\n", sc->sc_dev.dv_xname);
+ 	return;
+     }
  
      sc->sc_iobase = iobase;
      sc->sc_drq = cf->cf_drq;