From jdc@pentarou.parodius.com  Thu May 19 12:20:25 2005
Return-Path: <jdc@pentarou.parodius.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2CAFB16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 19 May 2005 12:20:25 +0000 (GMT)
Received: from mx1.parodius.com (mx1.parodius.com [64.62.145.229])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B708E43DBC
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 19 May 2005 12:20:20 +0000 (GMT)
	(envelope-from jdc@pentarou.parodius.com)
Received: from pentarou.parodius.com (localhost [127.0.0.1])
	by mx1.parodius.com (8.13.3/8.13.3) with ESMTP id j4JCKKEU090623
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 19 May 2005 05:20:20 -0700 (PDT)
	(envelope-from jdc@pentarou.parodius.com)
Received: (from jdc@localhost)
	by pentarou.parodius.com (8.13.3/8.13.3/Submit) id j4JCKKRJ090622;
	Thu, 19 May 2005 05:20:20 -0700 (PDT)
	(envelope-from jdc)
Message-Id: <200505191220.j4JCKKRJ090622@pentarou.parodius.com>
Date: Thu, 19 May 2005 05:20:20 -0700 (PDT)
From: Jeremy Chadwick <freebsd@jdc.parodius.com>
Reply-To: Jeremy Chadwick <freebsd@jdc.parodius.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: aac(4) update -- CPU ID for 2410SA controllers, other cosmetic changes
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         81259
>Category:       kern
>Synopsis:       [patch] aac(4) update -- CPU ID for 2410SA controllers, other cosmetic changes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    scottl
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 19 12:30:10 GMT 2005
>Closed-Date:    Wed Jun 01 07:14:05 GMT 2005
>Last-Modified:  Wed Jun 01 07:14:05 GMT 2005
>Originator:     Jeremy Chadwick
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
Parodius Networking
>Environment:
System: FreeBSD icarus.home.lan 5.4-STABLE FreeBSD 5.4-STABLE #0: Thu May 19 04:48:24 PDT 2005 root@icarus.home.lan:/usr/obj/usr/src/sys/ICARUS i386
>Description:
	Please toss this PR over to Scott Long <scottl@freebsd.org>.

	A few changes to aac(4):

	* Adaptec 2410SA controllers (and likely the 2810SA and 21610SA too)
	display "Unknown processor" for the on-board CPU.  NetBSD and OpenBSD's aac
	driver code had definitions for this processor (though they conflict as to
	what it really is).  I'm going with OpenBSD on this one, since Theo has quite
	an interest in Adaptec right now, and I'd be surprised if they got it wrong.
	The actual IC is an Intel GC80302 controller ("IOP" = I/O Processor).  The
	official Adaptec Linux driver doesn't even mention CPUs or their types, so I
	can't go off of that...

	* Print out more verbose memory statistics for the cards.  I was surprised
	to see my controller reporting 64MB in the BIOS, yet FreeBSD claiming 48MB.
	After looking at the code, I realised a portion of it gets assigned to
	read/write caching, and a portion gets assigned to "execution" (not sure
	what that is; Scott, please educate me).  I thought it'd make more sense to
	administrators to show the total memory, and how it's delegated.

	The above two changes now result in this output:

aac0: <Adaptec SCSI RAID 2410SA> mem 0xf0000000-0xf3ffffff irq 17 at device 2.0 on pci2
aac0: Intel GC80302 IOP 100MHz, 64MB memory (48MB cache, 16MB execution), optional battery not installed

	* The on-board CPU type which was previously listed as "MPC824x" is
	actually a PowerPC 603e.  OpenBSD and NetBSD both agree on this.  So,
	to keep the code bases and ID tags identical, I changed this for FreeBSD.

	Also, something I forgot to toss into the patch: the aac(4) manpage
	needs to be updated to reflect the fact that "options AAC_DEBUG"
	should *not* be assigned to such things as 'N'.  This option takes
	a numeric argument (0-2), defining the verbosity of the debug output.
	Assigning it to 'N' like the manpage suggests results in build errors.
>How-To-Repeat:
	Install an Adaptec 2410SA controller and have fun.  :-)
>Fix:
	Apply below patch.  Patch tested on 5.4-STABLE, works great.  This can
	probably be backported to the 4.x tree as well, but I'll let Scott
	deal with that.


diff -ruN aac.orig/aac.c aac/aac.c
--- aac.orig/aac.c	Wed Mar 23 01:24:41 2005
+++ aac/aac.c	Thu May 19 04:03:36 2005
@@ -2351,9 +2351,13 @@
 	}
 	info = (struct aac_adapter_info *)&fib->data[0];   
 
-	device_printf(sc->aac_dev, "%s %dMHz, %dMB cache memory, %s\n", 
+	device_printf(sc->aac_dev,
+		      "%s %dMHz, %dMB memory (%dMB cache, %dMB execution), %s\n", 
 		      aac_describe_code(aac_cpu_variant, info->CpuVariant),
-		      info->ClockSpeed, info->BufferMem / (1024 * 1024), 
+		      info->ClockSpeed,
+		      info->TotalMem / (1024 * 1024), 
+		      info->BufferMem / (1024 * 1024), 
+		      info->ExecutionMem / (1024 * 1024), 
 		      aac_describe_code(aac_battery_platform,
 					info->batteryPlatform));
 
diff -ruN aac.orig/aac_tables.h aac/aac_tables.h
--- aac.orig/aac_tables.h	Mon Dec  3 18:39:06 2001
+++ aac/aac_tables.h	Thu May 19 04:43:58 2005
@@ -80,9 +80,10 @@
 	{"i960HX",		CPUI960_HX},
 	{"i960RX",		CPUI960_RX},
 	{"StrongARM SA110",	CPUARM_SA110},
-	{"MPC824x",		CPUMPC_824x},
+	{"PowerPC 603e",	CPUPPC_603e},
 	{"Unknown StrongARM",	CPUARM_xxx},
 	{"Unknown PowerPC",	CPUPPC_xxx},
+	{"Intel GC80302 IOP",	CPUI960_302},
 	{NULL, 0},
 	{"Unknown processor",	0}
 };
diff -ruN aac.orig/aacreg.h aac/aacreg.h
--- aac.orig/aacreg.h	Tue Jan 25 03:39:00 2005
+++ aac/aacreg.h	Thu May 19 04:42:50 2005
@@ -427,8 +427,9 @@
 	CPUI960_RX,
 	CPUARM_SA110,
 	CPUARM_xxx,
-	CPUMPC_824x,
+	CPUPPC_603e,
 	CPUPPC_xxx,
+	CPUI960_302,
 	CPUSUBTYPE__last
 } AAC_CpuSubType;
 
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->scottl 
Responsible-Changed-By: delphij 
Responsible-Changed-When: Thu May 19 12:55:23 GMT 2005 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=81259 

From: Scott Long <scottl@samsco.org>
To: bug-followup@FreeBSD.org, freebsd@jdc.parodius.com
Cc:  
Subject: Re: kern/81259: aac(4) update -- CPU ID for 2410SA controllers, other
 cosmetic changes
Date: Thu, 19 May 2005 09:23:34 -0600

 Thanks for the patch.  One thing to note is that the MPC824x entry is 
 correct.  The MPC8240 and 8245 are part of the PPC603e family, just
 like the GC80302 is part of the i960 family.  Also, Adaptec uses both
 the 80303 and 80302 for different cards, I'll experiment to see if
 they differentiate their ID at all.
 
 Scott
State-Changed-From-To: open->closed 
State-Changed-By: scottl 
State-Changed-When: Wed Jun 1 07:11:40 GMT 2005 
State-Changed-Why:  
Submitted to HEAD, will MFC later.  I altered the patch a little to better 
conform to existing style.  Also, 'Execution Memory' is what the operating 
system of the controller uses as it's own working memory.  For i960-based 
controllers the total RAM is split up between execution and cache RAM, 
while on SA controllers there is a dedicated bank of execution RAM that is 
separate from the cache bank.  That's one of the many ways that the SA 
cards are so much faster. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=81259 
>Unformatted:
