From gvs@staff.rinet.ru  Sat Nov 24 11:20:54 2001
Return-Path: <gvs@staff.rinet.ru>
Received: from staff.rinet.ru (staff.rinet.ru [195.54.192.46])
	by hub.freebsd.org (Postfix) with ESMTP id 3200F37B41F
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 24 Nov 2001 11:16:53 -0800 (PST)
Received: (from gvs@localhost)
	by staff.rinet.ru (8.11.6/8.11.4) id fAOJGn024833;
	Sat, 24 Nov 2001 22:16:49 +0300 (MSK)
	(envelope-from gvs)
Message-Id: <200111241916.fAOJGn024833@staff.rinet.ru>
Date: Sat, 24 Nov 2001 22:16:49 +0300 (MSK)
From: Seva Gluschenko <gvs@rinet.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: AMD761(tm) and MGA G550 are not known by PCI kernel routines
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         32255
>Category:       kern
>Synopsis:       AMD761(tm) and MGA G550 are not known by PCI kernel routines
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    murray
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 24 11:30:01 PST 2001
>Closed-Date:    Thu Dec 20 03:11:06 PST 2001
>Last-Modified:  Thu Dec 20 03:11:32 PST 2001
>Originator:     Seva Gluschenko
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
Cronyx Plus LLC / ru.rinet LIR
>Environment:
System: FreeBSD staff.rinet.ru 4.4-STABLE FreeBSD 4.4-STABLE #0: Thu Oct 25 06:32:20 MSD 2001 root@:/usr/src/sys/compile/staff i386


	
>Description:
	1. AMD 761 recognition strings weren't added to kernel PCI routines
	which results, in parts, to unability to properly initialize AGP
	routines for this chipset. Therefore, AGP kernel module fails to
	work affecting the DRM and DRI functionality this way (actual for
	XFree86-4 and accelerated AGP cards).

	Once AMD 751 chipset has pretty the same routines needed to work
	with AGP (derived from AMD documentation studied), the only thing
	which is needed to be performed is to add AMD 761 identification
	codes recognition.

	2. Matrox MGA G550 graphics card (AGP, Dual-Head, DVI) ID wasn't
	added to the device recognitions strings as well.

>How-To-Repeat:

	If you have either AMD 761 based motherboard or MGA G550 card (or
	both), you will see FreeBSD standard messages for unknown generic
	devices of their types/subtypes during initial boot. If you
	compiled DRM module and try to load it in the boot time, you will
	get the message like "DRM probe_and_attach returned 12". It means
	that DRM module cannot connect to the AGP GART interface provided
	by AGP module.

	After that, when trying to start X, you will get message "drmOpen
	failed, disabling DRI".


	N.B.: The DRM modules supplied with XFree86-4 distribution (4.1.0)
	aren't working good at least with MGA. I've used drm-kmod-*-tar.gz
	taken from FreeBSD distfiles (they are for -current, but work
	just fine at least with MGA different models for -stable as well).

>Fix:

	Apply the patch below, as follows:

	# cd /usr/src/sys
	# patch < /path/to/diff

	Then rebuild your kernel and AGP module:

	# cd compile/YOUR_KERNEL_NAME
	# make depend all install
	# cd ../../modules/agp
	# make depend all install

	After reboot your AMD 761 and/or Matrox MGA G550 card should be
	recognized and handled properly.

	The patch itself follows:

--- i386/isa/pcibus.c.orig	Thu Nov 22 11:45:26 2001
+++ i386/isa/pcibus.c	Thu Nov 22 11:46:18 2001
@@ -131,6 +131,9 @@
 	case 0x70061022:
 		s = "AMD-751 host to PCI bridge";
 		break;
+	case 0x700e1022:
+		s = "AMD-761 host to PCI bridge";
+		break;
 
 		/* SiS -- vendor 0x1039 */
 	case 0x04961039:
--- pci/agp_amd.c.orig	Thu Nov 22 11:47:30 2001
+++ pci/agp_amd.c	Thu Nov 22 11:49:20 2001
@@ -163,6 +163,8 @@
 	switch (pci_get_devid(dev)) {
 	case 0x70061022:
 		return ("AMD 751 host to AGP bridge");
+	case 0x700e1022:
+		return ("AMD 761 host to AGP bridge");
 	};
 
 	return NULL;
--- pci/pcisupport.c.orig	Thu Nov 22 01:08:59 2001
+++ pci/pcisupport.c	Thu Nov 22 01:20:54 2001
@@ -713,7 +713,9 @@
 
 	/* AMD -- vendor 0x1022 */
 	case 0x70071022:
-		return ("AMD-751 PCI-PCI (AGP) bridge");
+		return ("AMD-751 PCI-PCI (1x/2x AGP) bridge");
+	case 0x700f1022:
+		return ("AMD-761 PCI-PCI (4x AGP) bridge");
 
 	/* DEC -- vendor 0x1011 */
 	case 0x00011011:
@@ -1269,6 +1271,8 @@
 	/* AMD -- vendor 0x1022 */
 	case 0x70061022:
 		return ("AMD-751 host to PCI bridge");
+	case 0x700e1022:
+		return ("AMD-761 host to PCI bridge");
 
 	/* NEC -- vendor 0x1033 */
 	case 0x00021033:
@@ -1462,6 +1466,8 @@
 			chip = "MGA G100"; break;
 		case 0x1001:
 			chip = "MGA G100 AGP"; break;
+		case 0x2527:
+			chip = "MGA G550 AGP"; break;
 
 		}
 		break;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: murray 
State-Changed-When: Wed Nov 28 12:41:48 PST 2001 
State-Changed-Why:  
This patch doesn't apply to -CURRENT as things have moved around a bit. 



Responsible-Changed-From-To: freebsd-bugs->murray 
Responsible-Changed-By: murray 
Responsible-Changed-When: Wed Nov 28 12:41:48 PST 2001 
Responsible-Changed-Why:  
I'll update the patch and commit this to -CURRENT soon. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32255 

From: Murray Stokely <murray@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, gvs@rinet.ru
Cc:  
Subject: Re: kern/32255: AMD761(tm) and MGA G550 are not known by PCI kernel routines
Date: Mon, 10 Dec 2001 01:30:45 -0800

 Ok.  -CURRENT does things differently.  I believe the video stuff is
 done by PCI class now, instead of by individual chipset, so there is
 no need to add an entry for the MGA G550 in -CURRENT.  Most of the
 AMD761 stuff was also already in -CURRENT but I added one more id
 string so that the correct message will be displayed to identify the
 device at boot.  
 
 I will merge your patches to -STABLE next week.
State-Changed-From-To: analyzed->closed 
State-Changed-By: murray 
State-Changed-When: Thu Dec 20 03:11:06 PST 2001 
State-Changed-Why:  
Your patch has been applied to -STABLE.  This fix will be present in 
the upcoming FreeBSD 4.5.  Thanks for your submission! 


http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32255 
>Unformatted:
