From sbauer@hardrock.sdsmt.edu  Sat Jan  9 13:49:13 1999
Received: from hardrock.sdsmt.edu (hardrock-out.sdsmt.edu [151.159.97.254])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA19412
          for <FreeBSD-gnats-submit@freebsd.org>; Sat, 9 Jan 1999 13:49:11 -0800 (PST)
          (envelope-from sbauer@hardrock.sdsmt.edu)
Received: (from sbauer@localhost)
	by hardrock.sdsmt.edu (8.9.1/8.9.1) id OAA09903;
	Sat, 9 Jan 1999 14:48:38 -0700 (MST)
	(envelope-from sbauer)
Message-Id: <199901092148.OAA09903@hardrock.sdsmt.edu>
Date: Sat, 9 Jan 1999 14:48:38 -0700 (MST)
From: Steve Bauer <sbauer@hardrock.sdsmt.edu>
Reply-To: sbauer@silver.sdsmt.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: parameter reversed to a pci_cfgwrite in pcisupport.c
X-Send-Pr-Version: 3.2

>Number:         9408
>Category:       kern
>Synopsis:       parameter reversed to a pci_cfgwrite in pcisupport.c
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan  9 13:50:00 PST 1999
>Closed-Date:    Sun Jun 3 02:47:52 PDT 2001
>Last-Modified:  Sun Jun 03 02:49:07 PDT 2001
>Originator:     Steve Bauer
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
South Dakota School of Mines and Technology
>Environment:

	3.0-current as of 1-9-1998 on a PII 300

>Description:

	The 2 of the parameters passed to pci_cfgwrite in the function
fixwsc_natoma are reversed.  The data being written out vs the number of
bytes being written out have been reversed.

>How-To-Repeat:

	The bug appears not to cause any problems yet on my machine.

>Fix:
	
	Included below is a patch to fix the small problem.

*** pcisupport.c	Sun Dec 27 00:59:25 1998
--- pcisupport.c.save	Sat Jan  9 14:34:10 1999
***************
*** 213,225 ****
  	if (pmccfg & 0x8000) {
  		printf("Correcting Natoma config for SMP\n");
  		pmccfg &= ~0x8000;
! 		pci_cfgwrite(tag, 0x50, 2, pmccfg);
  	}
  #else
  	if ((pmccfg & 0x8000) == 0) {
  		printf("Correcting Natoma config for non-SMP\n");
  		pmccfg |= 0x8000;
! 		pci_cfgwrite(tag, 0x50, 2, pmccfg);
  	}
  #endif
  }
--- 213,225 ----
  	if (pmccfg & 0x8000) {
  		printf("Correcting Natoma config for SMP\n");
  		pmccfg &= ~0x8000;
! 		pci_cfgwrite(tag, 0x50, pmccfg, 2);
  	}
  #else
  	if ((pmccfg & 0x8000) == 0) {
  		printf("Correcting Natoma config for non-SMP\n");
  		pmccfg |= 0x8000;
! 		pci_cfgwrite(tag, 0x50, pmccfg, 2);
  	}
  #endif
  }
>Release-Note:
>Audit-Trail:

From: Philipp Mergenthaler <philipp.mergenthaler@stud.uni-karlsruhe.de>
To: freebsd-gnats-submit@FreeBSD.org, sbauer@silver.sdsmt.edu
Cc:  
Subject: Re: kern/9408: parameter reversed to a pci_cfgwrite in pcisupport.c
Date: Sun, 3 Jun 2001 11:14:10 +0200

 pcisupport.c is in the attic; this code is now in sys/dev/pci/fixup_pci.c.
 Here's an updated patch.
 
 Bye, Philipp
 
 Index: fixup_pci.c
 ===================================================================
 RCS file: /ncvs/src/sys/dev/pci/fixup_pci.c,v
 retrieving revision 1.2
 diff -u -r1.2 fixup_pci.c
 --- fixup_pci.c	2000/12/12 13:11:42	1.2
 +++ fixup_pci.c	2001/06/03 08:48:40
 @@ -88,13 +88,13 @@
      if (pmccfg & 0x8000) {
  	printf("Correcting Natoma config for SMP\n");
  	pmccfg &= ~0x8000;
 -	pci_write_config(dev, 0x50, 2, pmccfg);
 +	pci_write_config(dev, 0x50, pmccfg, 2);
      }
  #else
      if ((pmccfg & 0x8000) == 0) {
  	printf("Correcting Natoma config for non-SMP\n");
  	pmccfg |= 0x8000;
 -	pci_write_config(dev, 0x50, 2, pmccfg);
 +	pci_write_config(dev, 0x50, pmccfg, 2);
      }
  #endif
  }
State-Changed-From-To: open->closed 
State-Changed-By: peter 
State-Changed-When: Sun Jun 3 02:47:52 PDT 2001 
State-Changed-Why:  
Suggested changes applied, to -current and -stable.  Rev 1.3 & 1.154.2.6 

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