From root@marcus.grupos.com.br  Sat Sep  9 19:23:05 2006
Return-Path: <root@marcus.grupos.com.br>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6E04216A40F;
	Sat,  9 Sep 2006 19:23:05 +0000 (UTC)
	(envelope-from root@marcus.grupos.com.br)
Received: from corp.grupos.com.br (corp.grupos.com.br [200.193.29.43])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D55E143D5C;
	Sat,  9 Sep 2006 19:23:04 +0000 (GMT)
	(envelope-from root@marcus.grupos.com.br)
Received: from marcus.grupos.com.br (marcus.grupos.com.br [192.168.10.10])
	by corp.grupos.com.br (Postfix) with ESMTP id 90EA05C80;
	Sat,  9 Sep 2006 16:23:02 -0300 (BRT)
Received: by marcus.grupos.com.br (Postfix, from userid 0)
	id 7975828472; Sat,  9 Sep 2006 16:23:02 -0300 (BRT)
Message-Id: <20060909192302.7975828472@marcus.grupos.com.br>
Date: Sat,  9 Sep 2006 16:23:02 -0300 (BRT)
From: Marcus Alves Grando <mnag@FreeBSD.org>
Reply-To: Marcus Alves Grando <mnag@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: anholt@FreeBSD.org
Subject: Add support to 945GM and fix how recognize agp aperture size
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         103079
>Category:       kern
>Synopsis:       [agp] Add support to 945GM and fix how recognize agp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    anholt
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 09 19:30:18 GMT 2006
>Closed-Date:    Mon Jan 01 22:09:14 GMT 2007
>Last-Modified:  Mon Jan 01 22:09:14 GMT 2007
>Originator:     Marcus Alves Grando
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
Grupos Internet S/A
>Environment:
System: FreeBSD marcus.grupos.com.br 6.1-STABLE FreeBSD 6.1-STABLE #1: Fri Sep 8 00:25:53 BRT 2006 root@marcus.grupos.com.br:/usr/obj/usr/src/sys/MARCUS i386


	
>Description:

- Add support to 945GM and fix how recognize agp aperture size, based on how linux does.

	
>How-To-Repeat:
	
>Fix:

	

--- agp_i810.c.current-patch begins here ---
Index: agp_i810.c
===================================================================
RCS file: /home/ncvs/src/sys/pci/agp_i810.c,v
retrieving revision 1.38
diff -u -r1.38 agp_i810.c
--- agp_i810.c	27 Jun 2006 14:05:11 -0000	1.38
+++ agp_i810.c	9 Sep 2006 19:19:50 -0000
@@ -121,14 +121,14 @@
 	    "Intel 82915G (915G GMCH) SVGA controller"},
 	{0x25928086, CHIP_I915, 0x00020000,
 	    "Intel 82915GM (915GM GMCH) SVGA controller"},
+	{0x27A28086, CHIP_I915, 0x00020000,
+	    "Intel 82945GM (945GM GMCH) SVGA controller"},
 	/* XXX: I believe these chipsets should work, but they haven't been
 	 * tested yet.
 	 */
 	/*
 	{0x27728086, CHIP_I915, 0x00020000,
 	    "Intel 82945G (945G GMCH) SVGA controller"},
-	{0x27A28086, CHIP_I915, 0x00020000,
-	    "Intel 82945GM (945GM GMCH) SVGA controller"},
 	*/
 	{0, 0, 0, NULL}
 };
@@ -510,9 +510,8 @@
 	case CHIP_I855:
 		return 128 * 1024 * 1024;
 	case CHIP_I915:
-		temp = pci_read_config(dev, AGP_I915_MSAC, 1);
-		if ((temp & AGP_I915_MSAC_GMASIZE) ==
-		    AGP_I915_MSAC_GMASIZE_128) {
+		temp = pci_read_config(dev, AGP_I915_GMADR, 1);
+		if (temp & 1<<27) {
 			return 128 * 1024 * 1024;
 		} else {
 			return 256 * 1024 * 1024;
--- agp_i810.c.current-patch ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->anholt 
Responsible-Changed-By: mnag 
Responsible-Changed-When: Sat Sep 9 19:50:57 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer. 

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

From: Eric Anholt <eric@anholt.net>
To: bug-followup@FreeBSD.org, mnag@FreeBSD.org
Cc:  
Subject: Re: kern/103079: [agp] Add support to 945GM and fix how recognize
	agp
Date: Tue, 26 Sep 2006 11:30:15 -0700

 --=-p4EaA7vQlduST6D6T8oi
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 Good catch.  But I think we need to go a step farther, as I believe we
 aren't guaranteed that that bit will be set when we're a 128MB aperture,
 even though linux does it that way.  I've put up an untested proposed
 diff at:
 
 http://people.freebsd.org/~anholt/agp-i945-4.diff
 
 This gets the size from rman, which has done the proper size check on
 that BAR (read it, write 1s, check how many of the 1s were saved,
 restore).  It also corrects a copy'n'paste-o, and allocates the GMADR
 resource, which agp.c wasn't doing since we've got it in a different
 place than most!
 
 --=20
 Eric Anholt                             anholt@FreeBSD.org
 eric@anholt.net                         eric.anholt@intel.com
 
 --=-p4EaA7vQlduST6D6T8oi
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Description: This is a digitally signed message part
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.3 (FreeBSD)
 
 iD8DBQBFGXG3HUdvYGzw6vcRAmqXAJwMbv+ujnWYaV4ij1CGLFGzkA9TzACfV1op
 +JUS46Y7xW6ByMVqImYE8c8=
 =RcgZ
 -----END PGP SIGNATURE-----
 
 --=-p4EaA7vQlduST6D6T8oi--
 
State-Changed-From-To: open->patched 
State-Changed-By: anholt 
State-Changed-When: Wed Sep 27 06:39:09 UTC 2006 
State-Changed-Why:  
Fix committed.  Big thanks for tracking down the cause! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/103079: commit references a PR
Date: Wed, 27 Sep 2006 06:39:10 +0000 (UTC)

 anholt      2006-09-27 06:38:54 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/pci              agp_i810.c 
   Log:
   Add support for 945G/GM AGP chipsets.
   
   The key problem was that the aperture size detection using the MSAC bit
   doesn't work -- the bit appears to be set even when it shouldn't be.  Linux
   takes a different approach, testing for a bit of the GMADR (PCIR_BAR(2)) being
   set.  However, as I don't think that's a safe way to test aperture size, we
   just allocate the resource and check its size.  This also pointed out that
   agp_generic_attach hadn't been allocating our aperture resource, which may
   have caused problems in some cases.
   
   Also corrected is a minor copy-and-pasteo in an error case.
   
   PR:             kern/103079
   Submitted by:   mnag
   Tested on:      i945GM, i915GM
   MFC after:      2 weeks
   
   Revision  Changes    Path
   1.39      +29 -13    src/sys/pci/agp_i810.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: mnag 
State-Changed-When: Mon Jan 1 22:09:13 UTC 2007 
State-Changed-Why:  
MFCed to RELENG_6. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=103079 
>Unformatted:
 aperture size
