From nobody@FreeBSD.org  Wed Apr 12 18:32:57 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B0E9D16A401
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 12 Apr 2006 18:32:57 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id CC3E643D5C
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 12 Apr 2006 18:32:56 +0000 (GMT)
	(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 k3CIWsri042803
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 12 Apr 2006 18:32:54 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k3CIWsFq042801;
	Wed, 12 Apr 2006 18:32:54 GMT
	(envelope-from nobody)
Message-Id: <200604121832.k3CIWsFq042801@www.freebsd.org>
Date: Wed, 12 Apr 2006 18:32:54 GMT
From: Brian McGovern <mcgovern@beta.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: pci_pci still not correct for initializing cardbus on HP AMD laptop
X-Send-Pr-Version: www-2.3

>Number:         95661
>Category:       kern
>Synopsis:       [pci] [patch] pci_pci still not correct for initializing cardbus on HP AMD laptop
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 12 18:40:15 GMT 2006
>Closed-Date:    Mon Oct 25 15:45:56 UTC 2010
>Last-Modified:  Mon Oct 25 15:45:56 UTC 2010
>Originator:     Brian McGovern
>Release:        6.1-RC1
>Organization:
>Environment:
FreeBSD bmcgover-hp-laptop 6.1-RC1 FreeBSD 6.1-RC1 #1: Wed Apr 12 14:27:07 EDT 2006    root@bmcgover-hp-laptop:/usr/src/sys/i386/compile/LAPTOP  i386
>Description:
The BIOS on the system sets the wrong subordinate bus number (see patch). This causes cardbus cards not to be detected/attached properly on boot, or when inserted.
>How-To-Repeat:
Boot 6.1-RC1 kernel, insert cardbus card (e.g. Netgear WG511T)
>Fix:
Jung-uk Kim sent me the following patch based on 6.0-RELEASE that fixes the problem. It also appears to apply cleanly to 6.1-RC1.

Index: pci_pci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/pci/pci_pci.c,v
retrieving revision 1.37
diff -u -r1.37 pci_pci.c
--- pci_pci.c   29 Apr 2005 06:22:41 -0000      1.37
+++ pci_pci.c   11 Oct 2005 01:58:00 -0000
@@ -186,6 +186,14 @@
     case 0x060513d7:           /* Toshiba ???? */
        sc->flags |= PCIB_SUBTRACTIVE;
        break;
+
+    /* Compaq R3000 BIOS sets wrong subordinate bus number. */
+    case 0x00dd10de:
+       if (sc->subbus < 0xa) {
+           pci_write_config(dev, PCIR_SUBBUS_1, 0xa, 1);
+           sc->subbus = pci_read_config(dev, PCIR_SUBBUS_1, 1);
+       }
+       break;
     }
 
     /*

>Release-Note:
>Audit-Trail:

From: Jung-uk Kim <jkim@FreeBSD.org>
To: bug-followup@FreeBSD.org, mcgovern@beta.com
Cc:  
Subject: Re: kern/95661: [pci] [patch] pci_pci still not correct for initializing cardbus on HP AMD laptop
Date: Wed, 19 Apr 2006 13:58:35 -0400

 This is handled differently in -CURRENT:
 
 http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/pci/pci_pci.c.diff?r1=1.37&r2=1.38
 
 It requires SMBIOS support in loader, which is missing in RELENG_6.
 
 Jung-uk Kim

From: "Brian J. McGovern" <mcgovern@beta.com>
To: Jung-uk Kim <jkim@FreeBSD.org>
Cc: bug-followup@FreeBSD.org, mcgovern@beta.com, mcgovern@spoon.beta.com
Subject: Re: kern/95661: [pci] [patch] pci_pci still not correct for initializing cardbus on HP AMD laptop 
Date: Wed, 19 Apr 2006 14:26:55 -0400

  > This is handled differently in -CURRENT:
  > 
  > http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/pci/pci_pci.c.diff?r1=1.37
 &r2=1.38
  > 
  > It requires SMBIOS support in loader, which is missing in RELENG_6.
  > 
  > Jung-uk Kim
 
 Agreed, but it works in 6.0 and 6.1. My opinion is that this is a reasonable work around for
 the 6.x lifecycle until the "stable" tree moves to 7.x, and we get SMBIOS support.
 
 I could beg for MFC'ing SMBIOS support, but I think it'd be a much tougher sell, and I doubt
 I can talk anyone in to it for 6.1. :)
 
 	-Brian

From: Jung-uk Kim <jkim@FreeBSD.org>
To: "Brian J. McGovern" <mcgovern@beta.com>
Cc: bug-followup@FreeBSD.org, mcgovern@spoon.beta.com,
        John Baldwin <jhb@FreeBSD.org>, imp@FreeBSD.org
Subject: Re: kern/95661: [pci] [patch] pci_pci still not correct for initializing cardbus on HP AMD laptop
Date: Wed, 19 Apr 2006 14:35:25 -0400

 On Wednesday 19 April 2006 02:26 pm, Brian J. McGovern wrote:
 > Agreed, but it works in 6.0 and 6.1. My opinion is that this is a
 > reasonable work around for the 6.x lifecycle until the "stable"
 > tree moves to 7.x, and we get SMBIOS support.
 
 In fact, the attached patch is incorrect because it does not care 
 whether the BIOS is broken or not.  That's why we have different 
 version in -CURRENT.  A 'real' fix is to re-do subordinate bus 
 numbers when we initialize PCI bridges - search for XXX comments in 
 the same function.  I believe jhb or imp was interested in fixing 
 these at some point but I don't remember who it was; spamming 
 both. ;-)
 
 > I could beg for MFC'ing SMBIOS support, but I think it'd be a much
 > tougher sell, and I doubt I can talk anyone in to it for 6.1. :)
 
 I believe you are right about that. :-(
 
 Jung-uk Kim

From: Jung-uk Kim <jkim@FreeBSD.org>
To: "Brian J. McGovern" <mcgovern@beta.com>
Cc: bug-followup@FreeBSD.org, mcgovern@spoon.beta.com,
        John Baldwin <jhb@FreeBSD.org>, imp@FreeBSD.org
Subject: Re: kern/95661: [pci] [patch] pci_pci still not correct for initializing cardbus on HP AMD laptop
Date: Thu, 20 Apr 2006 19:06:56 -0400

 I tried to make a generic fix by re-scanning PCI bus but I gave up.  
 It was hard to make a clean patch and it was too intrusive.
 
 Funny thing is it seems Linux people started working on this issue 
 again. 8-)  Nice timing...
 
 http://bugzilla.kernel.org/show_bug.cgi?id=2944
 https://bugzilla.novell.com/show_bug.cgi?id=146438
 
 I like the last patches and a similar workaround in CardBus driver 
 would be nice instead of this model-specific kludge.
 
 Jung-uk Kim
State-Changed-From-To: open->closed 
State-Changed-By: jh 
State-Changed-When: Mon Oct 25 15:45:54 UTC 2010 
State-Changed-Why:  
Should be resolved in head, stable/8 and stable/7. 

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