Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Nov 1999 11:27:09 +0800
From:      Peter Wemm <peter@netplex.com.au>
To:        tanimura@r.dl.itc.u-tokyo.ac.jp
Cc:        winter@jurai.net, hibma@skylink.it, current@FreeBSD.ORG
Subject:   Re: sbc and pcm 
Message-ID:  <19991130032709.A0AFF1CCC@overcee.netplex.com.au>
In-Reply-To: Message from tanimura@r.dl.itc.u-tokyo.ac.jp  of "Tue, 30 Nov 1999 11:09:15 %2B0900." <14403.12747.511556.68187Y@rina.r.dl.itc.u-tokyo.ac.jp> 

next in thread | previous in thread | raw e-mail | index | archive | help
tanimura@r.dl.itc.u-tokyo.ac.jp wrote:
> On Tue, 23 Nov 1999 04:22:39 +0800,
>   Peter Wemm <peter@netplex.com.au> said:
> 
> >> Mostly, sbc.c is handling PnP ID matching in a totally bogus manner.
> 
> Peter> Yes, it's quite bogus and is incompatible with motherboard devices.  T
    here
> Peter> should be no vendor ID references in there at all, that's for card ID,
     not
> Peter> device id.
> 
> I am now working to tidy up the sbc probe. Would it be enough for the
> sound chips on motherboards to check the logical device ID of 0x??008c0e?

No..  At the very least, do something like the attached patch.  Preferably
go further and use 'struct isa_pnp_id sbc_ids[]' and
        error = ISA_PNP_PROBE(device_get_parent(dev), dev, sbc_ids);
        if (error == ENXIO)
                return ENXIO;
	...

Also, don't add the children until attach time. There is no guarantee that
just because your probe succeeded that you'll actually be attached, something
else might out-bid you for the device id.

> How does the result of pnpinfo(1) for a motherboard chip look like?

There is no pnpinfo for it.  It has a logical device ID only with no vendor ID.

Minimal patch appended..

Cheers,
-Peter
Index: sbc.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/isa/sbc.c,v
retrieving revision 1.2
diff -c -r1.2 sbc.c
*** sbc.c	1999/11/27 06:33:27	1.2
--- sbc.c	1999/11/30 03:26:47
***************
*** 82,206 ****
  
  static devclass_t sbc_devclass;
  
- #if NISA > 0 && NPNP > 0
- static int
- sbc_probe(device_t dev)
- {
- 	u_int32_t vend_id, logical_id, vend_id2;
- 	char *s;
- 	struct sndcard_func *func;
  
! 	vend_id = isa_get_vendorid(dev);
! 	vend_id2 = vend_id & 0xff00ffff;
! 	logical_id = isa_get_logicalid(dev);
! 	s = NULL;
  
! 	switch (logical_id) {
  #if notdef
! 	case 0x0000630e: /* Crystal Semiconductor */
! 		if (vend_id2 ==0x3600630e) /* CS4236 */
! 			s = "CS4236";
! 		else if (vend_id2 ==0x3200630e) /* CS4232 */
! 			s = "CS4232";
! 		else if (vend_id2 ==0x3500630e) /* CS4236B */
! 			s = "CS4236B";
! 		break;
! #endif /* notdef */
! 	case 0x01008c0e: /* Creative ViBRA16C */
! 		if (vend_id2 == 0x70008c0e)
! 			s = "Creative ViBRA16C PnP";
! 		break;
! 	case 0x43008c0e: /* Creative ViBRA16X */
! 		if (vend_id2 == 0xf0008c0e)
! 			s = "Creative ViBRA16C PnP";
! 		break;
! 	case 0x31008c0e: /* Creative SB */
! 		if (vend_id2 == 0x26008c0e)
! 			s = "Creative SB16 PnP";
! 		else if (vend_id2 == 0x42008c0e)
! 			s = "Creative SB32 (CTL0042)";
! 		else if (vend_id2 == 0x44008c0e)
! 			s = "Creative SB32 (CTL0044)";
! 		else if (vend_id2 == 0x48008c0e)
! 			s = "Creative SB32 (CTL0048)";
! 		else if (vend_id2 == 0x49008c0e)
! 			s = "Creative SB32 (CTL0049)";
! 		else if (vend_id2 == 0xf1008c0e)
! 			s = "Creative SB32 (CTL00f1)";
! 		break;
! 	case 0x42008c0e: /* Creative SB AWE64 (CTL00c1) */
! 		if (vend_id2 == 0xc1008c0e)
! 			s = "Creative SB AWE64 (CTL00c1)";
! 		break;
! 	case 0x45008c0e: /* Creative SB AWE64 (CTL0045) */
! 		if (vend_id2 == 0xe4008c0e)
! 			s = "Creative SB AWE64 (CTL0045)";
! 		break;
  #if notdef
! 	case 0x01200001: /* Avance Logic */
! 		if (vend_id2 == 0x20009305)
! 			s = "Avance Logic ALS120";
! 		break;
! 	case 0x01100001: /* Avance Asound */
! 		if (vend_id2 == 0x10009305)
! 			s = "Avance Asound 110";
! 		break;
! 	case 0x68187316: /* ESS1868 */
! 		if (vend_id2 == 0x68007316)
! 			s = "ESS ES1868 Plug and Play AudioDrive";
! 		break;
! 	case 0x79187316: /* ESS1879 */
! 		if (vend_id2 == 0x79007316)
! 			s = "ESS ES1879 Plug and Play AudioDrive";
! 		break;
! 	case 0x2100a865: /* Yamaha */
! 		if (vend_id2 == 0x2000a865)
! 			s = "Yamaha OPL3-SA2/SAX Sound Board";
! 		break;
! 	case 0x80719304: /* Terratec */
! 		if (vend_id2 == 0x1114b250)
! 			s = "Terratec Soundsystem Base 1";
! 		break;
! 	case 0x0300561e: /* Gravis */
! 		if (vend_id2 == 0x0100561e)
! 			s = "Gravis UltraSound Plug & Play";
! 		break;
! #endif /* notdef */
! 	}
! 
! 	if (s != NULL) {
! 		device_set_desc(dev, s);
! 
! 		/* PCM Audio */
! 		func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT);
! 		if (func == NULL)
! 			return (ENOMEM);
! 		bzero(func, sizeof(*func));
! 		func->func = SCF_PCM;
! 		device_add_child(dev, "pcm", -1, func);
  
! #if notyet
! 		/* Midi Interface */
! 		func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT);
! 		if (func == NULL)
! 			return (ENOMEM);
! 		bzero(func, sizeof(*func));
! 		func->func = SCF_MIDI;
! 		device_add_child(dev, "midi", -1, func);
! 
! 		/* OPL FM Synthesizer */
! 		func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT);
! 		if (func == NULL)
! 			return (ENOMEM);
! 		bzero(func, sizeof(*func));
! 		func->func = SCF_SYNTH;
! 		device_add_child(dev, "midi", -1, func);
! #endif /* notyet */
! 
! 		return (0);
! 	}
  
! 	return (ENXIO);
  }
  
  static int
--- 82,124 ----
  
  static devclass_t sbc_devclass;
  
  
! #if NISA > 0 && NPNP > 0
  
! static struct isa_pnp_id fdc_ids[] = {
  #if notdef
! 	{0x0000630e, "CS423x"},
! #endif
! 	{0x01008c0e, "Creative ViBRA16C PnP"},
! 	{0x43008c0e, "Creative ViBRA16X PnP"},
! 	{0x31008c0e, "Creative SB16 PnP/SB32"},
! 	{0x42008c0e, "Creative SB AWE64"}, /* CTL00c1 */
! 	{0x45008c0e, "Creative SB AWE64"}, /* CTL0045 */
  #if notdef
! 	{0x01200001, "Avance Logic ALS120"},
! 	{0x01100001, "Avance Asound 110"},
! 	{0x68187316, "ESS ES1868 Plug and Play AudioDrive"}, /* ESS1868 */
! 	{0x79187316, "ESS ES1879 Plug and Play AudioDrive"}, /* ESS1879 */
! 	{0x2100a865, "Yamaha OPL3-SA2/SAX Sound Board"},
! 	{0x80719304, "Terratec Soundsystem Base 1"},
! 	{0x0300561e, "Gravis UltraSound Plug & Play"},
! #endif
! 	{0}
! };
! 	
  
! };
! static int
! sbc_probe(device_t dev)
! {
! 	int error;
  
! 	/* Check pnp ids */
! 	error = ISA_PNP_PROBE(device_get_parent(dev), dev, sbc_ids);
! 	if (error)
! 		return error;
! 	else
! 		return -100;
  }
  
  static int
***************
*** 208,213 ****
--- 126,132 ----
  {
  	sc_p scp;
  	int unit;
+ 	struct sndcard_func *func;
  
  	scp = device_get_softc(dev);
  	unit = device_get_unit(dev);
***************
*** 219,224 ****
--- 138,169 ----
  		release_resource(scp);
  		return (ENXIO);
  	}
+ 
+ 	/* PCM Audio */
+ 	func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT);
+ 	if (func == NULL)
+ 		return (ENOMEM);
+ 	bzero(func, sizeof(*func));
+ 	func->func = SCF_PCM;
+ 	device_add_child(dev, "pcm", -1, func);
+ 
+ #if notyet
+ 	/* Midi Interface */
+ 	func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT);
+ 	if (func == NULL)
+ 		return (ENOMEM);
+ 	bzero(func, sizeof(*func));
+ 	func->func = SCF_MIDI;
+ 	device_add_child(dev, "midi", -1, func);
+ 
+ 	/* OPL FM Synthesizer */
+ 	func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT);
+ 	if (func == NULL)
+ 		return (ENOMEM);
+ 	bzero(func, sizeof(*func));
+ 	func->func = SCF_SYNTH;
+ 	device_add_child(dev, "midi", -1, func);
+ #endif /* notyet */
  
  	bus_generic_attach(dev);
  



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991130032709.A0AFF1CCC>