From nobody@FreeBSD.org  Thu May 31 03:46:59 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 6ABBD16A400
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 31 May 2007 03:46:59 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 5AC2F13C45B
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 31 May 2007 03:46:59 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l4V3kxjm017720
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 31 May 2007 03:46:59 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l4V3kxW9017719;
	Thu, 31 May 2007 03:46:59 GMT
	(envelope-from nobody)
Message-Id: <200705310346.l4V3kxW9017719@www.freebsd.org>
Date: Thu, 31 May 2007 03:46:59 GMT
From: Arthur Hartwig<arthur.hartwig@nokia.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Extended PCI Configuration register (>= 0x100) not enabled
X-Send-Pr-Version: www-3.0

>Number:         113177
>Category:       i386
>Synopsis:       [pci] [patch] Extended PCI Configuration register (>= 0x100) not enabled
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-i386
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 31 03:50:04 GMT 2007
>Closed-Date:    Fri Aug 15 11:39:30 UTC 2008
>Last-Modified:  Fri Aug 15 11:39:30 UTC 2008
>Originator:     Arthur Hartwig
>Release:        6.1
>Organization:
Nokia
>Environment:
>Description:
The Intel 5000P Chipset is not recognised in pci_cfgregopen() in
sys/i386/pci/pci_cfgreg.c as one supporting memory mapped access to PCI
device configuration registers hence error registers with offset > 256
in the MCH can not be accessed.

This would also be true of FreeBSD CURRENT.
>How-To-Repeat:

>Fix:
Suggested fix, change the last part of pci_cfgregopen() in
sys/i386/pci/pci_cfgreg.c to read:

	vid = pci_cfgregread(0, 0, 0, PCIR_VENDOR, 2);
	did = pci_cfgregread(0, 0, 0, PCIR_DEVICE, 2);
	if (vid == 0x8086) {
		switch (did) {
		case 0x3590:
		case 0x3592:
			/* Intel 7520 or 7320 */
			pciebar = pci_cfgregread(0, 0, 0, 0xce, 2) << 16;
			pciereg_cfgopen();
			break;

		case 0x2580:
		case 0x2584:
			/* Intel 915 or 925 */
			pciebar = pci_cfgregread(0, 0, 0, 0x48, 4);
			pciereg_cfgopen();
			break;
		
		case 0x25d8:            /* Intel 5000P */
		case 0x25d0: 
		case 0x25d4:
			/* Intel 5000P or 5000Z or 5000V */
			pciebar = pci_cfgregread(0, 16, 0, 0x64, 4);
#ifndef PAE
			if (pciebar >= 0x10000) {
				printf("%s: Memory mapped PCI configuration "
				       "area base 0x%08x too high\n", 
				       __FUNCTION__, pciebar
);
				pciebar = 0;
				break;
			}
#endif
			pciebar = pciebar << 16;
			pciereg_cfgopen();
			break;
		}
	}

	return(1);
}

Notes: The 5000 series chipset datasheet says the did of the 5000P is
0x25c8 but the actual device in my system has a did of 0x25d8 hence I've
used 0x25d8. I don't have access to systems with 5000Z or 5000V chipsets
so I have used the values in the datasheet for them.

I suspect there are a bunch of other Intel chipset that should also be
recognised: 954, 955, 965 and 965 and variants.

Probably something similar (without the #ifndef PAE) needs to go into the
amd64 branch.

>Release-Note:
>Audit-Trail:

From: Gavin Atkinson <gavin@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: i386/113177: [pci] [patch] Extended PCI Configuration register
 (>= 0x100) not enabled
Date: Mon, 7 Jul 2008 17:17:17 +0100 (BST)

 Diff below:
 
 Index: src/sys/i386/pci/pci_cfgreg.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/i386/pci/pci_cfgreg.c,v
 retrieving revision 1.126
 diff -u -r1.126 pci_cfgreg.c
 --- src/sys/i386/pci/pci_cfgreg.c	28 Nov 2007 22:22:05 -0000	1.126
 +++ src/sys/i386/pci/pci_cfgreg.c	7 Jul 2008 16:12:45 -0000
 @@ -163,14 +163,38 @@
   	vid = pci_cfgregread(0, 0, 0, PCIR_VENDOR, 2);
   	did = pci_cfgregread(0, 0, 0, PCIR_DEVICE, 2);
   	if (vid == 0x8086) {
 -		if (did == 0x3590 || did == 0x3592) {
 +		switch (did) {
 +		case 0x3590:
 +		case 0x3592:
   			/* Intel 7520 or 7320 */
   			pciebar = pci_cfgregread(0, 0, 0, 0xce, 2) << 16;
   			pciereg_cfgopen();
 -		} else if (did == 0x2580 || did == 0x2584) {
 +			break;
 +
 +		case 0x2580:
 +		case 0x2584:
   			/* Intel 915 or 925 */
   			pciebar = pci_cfgregread(0, 0, 0, 0x48, 4);
   			pciereg_cfgopen();
 +			break;
 +
 +		case 0x25d8:
 +		case 0x25d0:
 +		case 0x25d4:
 +			/* Intel 5000P or 5000Z or 5000V */
 +			pciebar = pci_cfgregread(0, 16, 0, 0x64, 4);
 +#ifndef PAE
 +			if (pciebar >= 0x10000) {
 +				printf("%s: Memory mapped PCI configuration "
 +				    "area base 0x%08x too high\n", 
 +				    __FUNCTION__, pciebar);
 +				pciebar = 0;
 +				break;
 +			}
 +#endif
 +			pciebar = pciebar << 16;
 +			pciereg_cfgopen();
 +			break;
   		}
   	}
 
State-Changed-From-To: open->closed 
State-Changed-By: gavin 
State-Changed-When: Fri Aug 15 11:39:00 UTC 2008 
State-Changed-Why:  
Close, superceded by i386/126525 

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