From takawata@shidahara1.planet.sci.kobe-u.ac.jp Tue Jul 13 14:45:01 1999
Return-Path: <takawata@shidahara1.planet.sci.kobe-u.ac.jp>
Received: from shidahara1.planet.sci.kobe-u.ac.jp (shidahara1.planet.sci.kobe-u.ac.jp [133.30.50.200])
	by hub.freebsd.org (Postfix) with ESMTP id 108DA15195
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Jul 1999 14:44:45 -0700 (PDT)
	(envelope-from takawata@shidahara1.planet.sci.kobe-u.ac.jp)
Received: from libr.scitec.kobe-u.ac.jp (cs22225.ppp.infoweb.ne.jp [202.219.171.41])
	by shidahara1.planet.sci.kobe-u.ac.jp (8.8.8+2.7Wbeta7/8.8.8) with ESMTP id GAA25016
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 14 Jul 1999 06:34:38 +0900 (JST)
Received: (from takawata@localhost) by libr.scitec.kobe-u.ac.jp (8.9.1/3.5Wpl7) id GAA00945; Wed, 14 Jul 1999 06:42:39 +0900 (JST)
Message-Id: <199907132142.GAA00945@libr.scitec.kobe-u.ac.jp>
Date: Wed, 14 Jul 1999 06:42:39 +0900 (JST)
From: Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp>
Reply-To: takawata@shidahara1.planet.sci.kobe-u.ac.jp
To: FreeBSD-gnats-submit@freebsd.org
Subject: intpm driver update
X-Send-Pr-Version: 3.2

>Number:         12631
>Category:       kern
>Synopsis:       intpm driver update
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    nsouch
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 13 14:50:01 PDT 1999
>Closed-Date:    Sat Jul 24 12:17:39 PDT 1999
>Last-Modified:  Sat Jul 24 12:23:03 PDT 1999
>Originator:     Takanori Watanabe
>Release:        FreeBSD 4.0-CURRENT
>Organization:
Kobe Universitiy
>Environment:

FreeBSD/i386 4.0-CURRENTFreeBSD/i386	

>Description:

	When any driver is on smbus and the code probe with polling code in
	intpm driver,intrrupt handler of intpm driver is infinitely called
	when all device probe is finished.
		

>How-To-Repeat:

	Use with my experimental driver code,depend on mother board.	

>Fix:
	
	
--- /home/ctm/src/sys/pci/intpm.c	Tue May 11 10:23:15 1999
+++ intpm.c	Fri Jun  4 00:58:03 1999
@@ -244,16 +244,18 @@
 		return 1;
 		
 	}
-	if(sc->isbusy&&(status&(PIIX4_SMBHSTSTAT_INTR|
+	if(status&(PIIX4_SMBHSTSTAT_INTR|
 				PIIX4_SMBHSTSTAT_ERR|
 				PIIX4_SMBHSTSTAT_BUSC|
-				PIIX4_SMBHSTSTAT_FAIL))){
+				PIIX4_SMBHSTSTAT_FAIL)){
 		int tmp;
-		sc->isbusy=0;
 		tmp=bus_space_read_1(sc->st,sc->sh,PIIX4_SMBHSTCNT);
 		bus_space_write_1(sc->st,sc->sh,PIIX4_SMBHSTCNT,
 				  tmp&~PIIX4_SMBHSTCNT_INTREN);
-		wakeup(sc);
+		if(sc->isbusy){
+		  sc->isbusy=0;
+		  wakeup(sc);
+		}
 		return 0;
 	}
 	return 1;/* Not Completed*/
@@ -347,6 +349,7 @@
 intsmb_stop_poll(device_t dev){
         int error,i;
         struct intsmb_softc *sc = (struct intsmb_softc *)device_get_softc(dev);
+	
 	/*
 	 *  In smbtx driver ,Simply waiting.
 	 *  This loops 100-200 times.
@@ -371,7 +374,13 @@
 			return error;
 		}
 	}
-	sc->isbusy=0;
+	{
+	  int tmp;
+	  sc->isbusy=0;
+	  tmp=bus_space_read_1(sc->st,sc->sh,PIIX4_SMBHSTCNT);
+	  bus_space_write_1(sc->st,sc->sh,PIIX4_SMBHSTCNT,
+			    tmp&~PIIX4_SMBHSTCNT_INTREN);
+	}
 	return EIO;
 }
 /*
@@ -742,6 +751,7 @@
 {
     struct _pcsid *ep =pci_ids;
     u_int32_t device_id=pci_get_devid(dev);
+
     while (ep->type && ep->type != device_id)
 	  ++ep;
     if(ep->desc!=NULL){
@@ -759,6 +769,7 @@
         sc=(struct intpm_pci_softc *)arg;
 	intsmb_intr(sc->smbus);
 	intsmb_slvintr(sc->smbus);
+	
 }
 #endif /* NPCI > 0 */
 #endif


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->nsouch 
Responsible-Changed-By: n_hibma 
Responsible-Changed-When: Sat Jul 24 09:36:41 PDT 1999 
Responsible-Changed-Why:  
smbus is Nicolas' baby. 
State-Changed-From-To: open->closed 
State-Changed-By: nsouch 
State-Changed-When: Sat Jul 24 12:17:39 PDT 1999 
State-Changed-Why:  
Submitted patch aplied, compiled and commited: 1.11->1.12 
>Unformatted:
