From lioux-alias-ppp-FreeBSD-gnats-submit=freebsd.org@uol.com.br  Fri Mar 17 19:28:46 2000
Return-Path: <lioux-alias-ppp-FreeBSD-gnats-submit=freebsd.org@uol.com.br>
Received: from breton.uol.com.br (breton.uol.com.br [200.230.198.74])
	by hub.freebsd.org (Postfix) with ESMTP id 7650D37BA06
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 17 Mar 2000 19:28:30 -0800 (PST)
	(envelope-from lioux-alias-ppp-FreeBSD-gnats-submit=freebsd.org@uol.com.br)
Received: from 200-191-159-101-as.acessonet.com.br (200-191-159-101-as.acessonet.com.br [200.191.159.101])
	by breton.uol.com.br (8.9.1/8.9.1) with ESMTP id AAA23565
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Mar 2000 00:28:20 -0300 (BRT)
Received: (qmail 2321 invoked by uid 1001); 18 Mar 2000 03:27:50 -0000
Message-Id: <20000318032750.2320.qmail@Fedaykin.here>
Date: 18 Mar 2000 03:27:50 -0000
From: lioux@uol.com.br
Sender: lioux-alias-ppp-FreeBSD-gnats-submit=freebsd.org@uol.com.br
Reply-To: lioux@uol.com.br
To: FreeBSD-gnats-submit@freebsd.org
Subject: Added sys/pci/ device identification for Aureal Sound Cards
X-Send-Pr-Version: 3.2

>Number:         17453
>Category:       kern
>Synopsis:       Added sys/pci/ device identification for Aureal Sound Cards
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 17 19:30:01 PST 2000
>Closed-Date:    Tue Apr 11 06:02:42 PDT 2000
>Last-Modified:  Tue Apr 11 06:03:07 PDT 2000
>Originator:     Mario Sergio Fujikawa Ferreira
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:

Should work cleanly with the latest 4.0-current, 4.0-release, 4.0-stable and,
probably, 5.0-current.

>Description:

I added a simple identification function for pci sound cards. In
fact, it is just a simplified copy of the const char* pci_vga_match(device_t)
function renamed const char* pci_snd_match(device_t).

It only tests for aureal cards as of now (I only own this one), identifies
the proper chipset and names the appropriate type.

If it can identify both the vendor and the chip, outputs accordingly;
if it only identifies the vendor, output that alongside the identification
codes. Otherwise, it says it does not recognize the device.
Just like pci_vga_match().

However, inside the loop (vendor && chip) && (type == 0),
I named type = "Sound Card Device" which I am not sure is the correct
nomenclature.

It is working on my computer right now. Nevertheless, either Mr. Stanglmeier
or Mr. Esser should examine this little piece of code.

The information was obtained from Aureal website. The following
pages/softwares were used:
++ VortexID - http://support.a3d.com/utilities/index.htm
+ To get the type definitions, just used the HTML page.

++ Linux Aureal Drivers - http://linux.a3d.com/Drivers/au88xx-1.0.5.tar.gz
+ To get the chip and vendor ids/definitions, just used the vortex.c src
code.

I do believe that it is all public domain information. :)
That's just a source quote for cross examination.

>How-To-Repeat:

Use the following patch at /usr/src

>Fix:

diff -u sys/pci/pci.c /tmp/aureal/pci.c
--- sys/pci/pci.c	Fri Mar 17 23:50:38 2000
+++ /tmp/aureal/pci.c	Fri Mar 17 22:06:41 2000
@@ -1237,6 +1237,7 @@
 	desc = pci_ata_match(child);
 	if (!desc) desc = pci_usb_match(child);
 	if (!desc) desc = pci_vga_match(child);
+	if (!desc) desc = pci_snd_match(child);
 	if (!desc) {
 		desc = "unknown card";
 		unknown++;
diff -u sys/pci/pcisupport.c /tmp/aureal/pcisupport.c
--- sys/pci/pcisupport.c	Fri Mar 17 23:50:38 2000
+++ /tmp/aureal/pcisupport.c	Fri Mar 17 23:31:24 2000
@@ -1831,6 +1831,61 @@
 	return type;
 }
 
+
+const char* pci_snd_match(device_t dev)
+{
+	u_int id = pci_get_devid(dev);
+	const char *vendor, *chip, *type;
+
+	vendor = chip = type = 0;
+	switch (id & 0xffff) {
+	case 0x12eb:
+		vendor = "Aureal";
+		switch (id >> 16) {
+		case 0x0001:
+			chip = "Au8820";
+			type = "Vortex1"; break;
+		case 0x0002:
+			chip = "Au8830";
+			type = "Vortex2 SuperQuad or SQ2500"; break;	
+		case 0x0003:
+			chip = "Au8810";
+			type = "Vortex Advantage or SQ1500"; break;
+		default:
+			chip = "Au88xx"; break;
+		}
+		break;
+	}
+
+	if (vendor && chip) {
+		char *buf;
+		int len;
+
+		if (type == 0)
+			type = "Sound Card Device";
+
+		len = strlen(vendor) + strlen(chip) + strlen(type) + 4;
+		MALLOC(buf, char *, len, M_TEMP, M_NOWAIT);
+		if (buf)
+			sprintf(buf, "%s %s %s", vendor, chip, type);
+		return buf;
+	}
+
+	if (vendor) {
+		char *buf;
+		int len;
+
+		len = strlen(vendor) + strlen(type) + 2 + 6 + 4 + 1;
+		MALLOC(buf, char *, len, M_TEMP, M_NOWAIT);
+		if (buf)
+			sprintf(buf, "%s model %04x %s", vendor, id >> 16, type);
+		return buf;
+	}
+	return 0;
+}
+
+
+
 /*---------------------------------------------------------
 **
 **	Devices to ignore

>Release-Note:
>Audit-Trail:

From: Nick Hibma <n_hibma@calcaphon.com>
To: lioux@uol.com.br
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: kern/17453: Added sys/pci/ device identification for Aureal
 Sound Cards
Date: Sat, 18 Mar 2000 16:11:31 +0000 (GMT)

 This would open the door to add all the PCI devices to it. We might as
 well create some sort of generic function and table for a complete list
 and have the drivers use that table instead.
 
 I've already written the makedevlist.pl script for it that creates the
 stub files in your kernel compile directory, but will have to find some 
 time to finish that work before I can commit it.
 
 Nick
 
 On 18 Mar 2000 lioux@uol.com.br wrote:
 
 > 
 > >Number:         17453
 > >Category:       kern
 > >Synopsis:       Added sys/pci/ device identification for Aureal Sound Cards
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    freebsd-bugs
 > >State:          open
 > >Quarter:        
 > >Keywords:       
 > >Date-Required:
 > >Class:          change-request
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Fri Mar 17 19:30:01 PST 2000
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Mario Sergio Fujikawa Ferreira
 > >Release:        FreeBSD 5.0-CURRENT i386
 > >Organization:
 > >Environment:
 > 
 > Should work cleanly with the latest 4.0-current, 4.0-release, 4.0-stable and,
 > probably, 5.0-current.
 > 
 > >Description:
 > 
 > I added a simple identification function for pci sound cards. In
 > fact, it is just a simplified copy of the const char* pci_vga_match(device_t)
 > function renamed const char* pci_snd_match(device_t).
 > 
 > It only tests for aureal cards as of now (I only own this one), identifies
 > the proper chipset and names the appropriate type.
 > 
 > If it can identify both the vendor and the chip, outputs accordingly;
 > if it only identifies the vendor, output that alongside the identification
 > codes. Otherwise, it says it does not recognize the device.
 > Just like pci_vga_match().
 > 
 > However, inside the loop (vendor && chip) && (type == 0),
 > I named type = "Sound Card Device" which I am not sure is the correct
 > nomenclature.
 > 
 > It is working on my computer right now. Nevertheless, either Mr. Stanglmeier
 > or Mr. Esser should examine this little piece of code.
 > 
 > The information was obtained from Aureal website. The following
 > pages/softwares were used:
 > ++ VortexID - http://support.a3d.com/utilities/index.htm
 > + To get the type definitions, just used the HTML page.
 > 
 > ++ Linux Aureal Drivers - http://linux.a3d.com/Drivers/au88xx-1.0.5.tar.gz
 > + To get the chip and vendor ids/definitions, just used the vortex.c src
 > code.
 > 
 > I do believe that it is all public domain information. :)
 > That's just a source quote for cross examination.
 > 
 > >How-To-Repeat:
 > 
 > Use the following patch at /usr/src
 > 
 > >Fix:
 > 
 > diff -u sys/pci/pci.c /tmp/aureal/pci.c
 > --- sys/pci/pci.c	Fri Mar 17 23:50:38 2000
 > +++ /tmp/aureal/pci.c	Fri Mar 17 22:06:41 2000
 > @@ -1237,6 +1237,7 @@
 >  	desc = pci_ata_match(child);
 >  	if (!desc) desc = pci_usb_match(child);
 >  	if (!desc) desc = pci_vga_match(child);
 > +	if (!desc) desc = pci_snd_match(child);
 >  	if (!desc) {
 >  		desc = "unknown card";
 >  		unknown++;
 > diff -u sys/pci/pcisupport.c /tmp/aureal/pcisupport.c
 > --- sys/pci/pcisupport.c	Fri Mar 17 23:50:38 2000
 > +++ /tmp/aureal/pcisupport.c	Fri Mar 17 23:31:24 2000
 > @@ -1831,6 +1831,61 @@
 >  	return type;
 >  }
 >  
 > +
 > +const char* pci_snd_match(device_t dev)
 > +{
 > +	u_int id = pci_get_devid(dev);
 > +	const char *vendor, *chip, *type;
 > +
 > +	vendor = chip = type = 0;
 > +	switch (id & 0xffff) {
 > +	case 0x12eb:
 > +		vendor = "Aureal";
 > +		switch (id >> 16) {
 > +		case 0x0001:
 > +			chip = "Au8820";
 > +			type = "Vortex1"; break;
 > +		case 0x0002:
 > +			chip = "Au8830";
 > +			type = "Vortex2 SuperQuad or SQ2500"; break;	
 > +		case 0x0003:
 > +			chip = "Au8810";
 > +			type = "Vortex Advantage or SQ1500"; break;
 > +		default:
 > +			chip = "Au88xx"; break;
 > +		}
 > +		break;
 > +	}
 > +
 > +	if (vendor && chip) {
 > +		char *buf;
 > +		int len;
 > +
 > +		if (type == 0)
 > +			type = "Sound Card Device";
 > +
 > +		len = strlen(vendor) + strlen(chip) + strlen(type) + 4;
 > +		MALLOC(buf, char *, len, M_TEMP, M_NOWAIT);
 > +		if (buf)
 > +			sprintf(buf, "%s %s %s", vendor, chip, type);
 > +		return buf;
 > +	}
 > +
 > +	if (vendor) {
 > +		char *buf;
 > +		int len;
 > +
 > +		len = strlen(vendor) + strlen(type) + 2 + 6 + 4 + 1;
 > +		MALLOC(buf, char *, len, M_TEMP, M_NOWAIT);
 > +		if (buf)
 > +			sprintf(buf, "%s model %04x %s", vendor, id >> 16, type);
 > +		return buf;
 > +	}
 > +	return 0;
 > +}
 > +
 > +
 > +
 >  /*---------------------------------------------------------
 >  **
 >  **	Devices to ignore
 > 
 > >Release-Note:
 > >Audit-Trail:
 > >Unformatted:
 > 
 > 
 > To Unsubscribe: send mail to majordomo@FreeBSD.org
 > with "unsubscribe freebsd-bugs" in the body of the message
 > 
 
 --
 n_hibma@webweaving.org
 n_hibma@freebsd.org                                          USB project
 http://www.etla.net/~n_hibma/
 
 

From: lioux@uol.com.br
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/17453: Added sys/pci/ device identification for Aureal Sound Cards
Date: Tue, 11 Apr 2000 00:31:38 -0300

 I would like this PR to be close. I had a little chat with the DEV wiz and I
 this PR is no longer necessary. :)
 
 --
 Thanks mferreira
 
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Tue Apr 11 06:02:42 PDT 2000 
State-Changed-Why:  
Closed as per originator's request. 
>Unformatted:
