Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Oct 2001 08:26:17 +0200 (SAT)
From:      John Hay <jhay@icomtek.csir.co.za>
To:        matt-sykes@excite.com (Matt Sykes)
Cc:        freebsd-questions@freebsd.org, freebsd-stable@freebsd.org
Subject:   Re: 0.00% CPU for all processes
Message-ID:  <200110150626.f9F6QHi82973@zibbi.icomtek.csir.co.za>
In-Reply-To: <12199010.1003082022454.JavaMail.imail@patti.excite.com> from Matt Sykes at "Oct 14, 2001 10:53:41 am"

next in thread | previous in thread | raw e-mail | index | archive | help
> >  > 
> >  > kernel: 4.4-STABLE motherboard: P2L97-DS, dual Pentium II 300MHZ
> >  > 
> >  > top shows 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 0.0%
> >  > idle
> >  > 
> >  > WCPU and CPU show 0.00% for all processes in top and ps.
> >  > 
> >  
> >  Go and look in the old freebsd-smp archives for this message:
> >  
> >  Message-Id: <199906151902.VAA96921@midten.fast.no>
> >  
> >  It is message by Tor Egge and describes the problem. I have the
> >  same motherboard and that patch did the job. I'm running -current
> >  nowadays and the code does not look like that anymore so i have
> >  changed the patch for current, but I do not have new patches for
> >  -stable, so if that doesn't aplly anymore you will have to tweak
> >  them by hand.
> 
> It's good to know at least I'm not going crazy; that however
> meticulously I was following the instructions for kernel config and
> install, it was still broken because I needed this patch.
> 
> Unfortunately the patch cannot be applied even manually (I happen to
> be a programmer) to 4.4-STABLE.  The patch expects pcici_t types,
> whereas the -stable source needs device_t types (maybe they are just
> typedefs of one another, I did a grep -r but couldn't find the
> definition).

Ok, I have tried to port my -current version to stable. It does compile,
but I don't know what it will do when you run it though. :-) I have added
it to the end.

> Much more importantly, though ... why isn't this patch included in
> 4.4-STABLE?
> 
> When you say you changed the patch for -current, does this mean it is
> IN -current, or that you have a patch which you re-apply every time
> you cvsup?  If the latter, why isn't it in -current as well?

Well it isn't part of -current either. At that time the feeling was that
it shouldn't become part of FreeBSD, so I have just kept it as a local
patch and fixed it everytime it broke when I upgraded to a new -current.

> What can I do to assure that nobody has to do this again?

I don't know. If this patch ever do go in, it will probably have to be
protected with a "#ifdef BROKEN_P2L97-DS" or something similar.

> And, since I still have a broken FreeBSD kernel, how do I to fix it?
> Am I just out of luck with this motherboard?

Well if you are brave enough, you can try my patch. :-) If you see the
message "Disabled Device 13 trap SMI for access to RTC chip" during the
boot phase, you will know that it did execute the code in the patch.

John
-- 
John Hay -- John.Hay@icomtek.csir.co.za


Index: sys/pci/pcisupport.c
===================================================================
RCS file: /home/ncvs/src/sys/pci/Attic/pcisupport.c,v
retrieving revision 1.154.2.7
diff -u -r1.154.2.7 pcisupport.c
--- sys/pci/pcisupport.c	15 Aug 2001 04:04:59 -0000	1.154.2.7
+++ sys/pci/pcisupport.c	15 Oct 2001 05:42:34 -0000
@@ -87,6 +87,85 @@
 	}
 }
 
+#ifdef SMP
+static void
+fix_82371ab_power_management(device_t dev)
+{
+	int pmba;
+	int devctl;
+	int devctl_changed;
+	int devrese;
+	int devresg;
+
+#define PMBA_CONFIG_OFFSET 0x40
+#define PMBA_TO_IO(addr)  (addr & 0xffc0)
+#define DEVRESE_OFFSET 0x68
+#define DEVRESG_OFFSET 0x70
+#define DEVRES_MONITOR_ENABLE (1 << 20)
+#define DEVCTL_IO_OFFSET 0x2c
+#define DEVCTL_TRAP_DEV12 (1 << 24)
+#define DEVCTL_TRAP_DEV13 (1 << 25)
+#define RTC_IOADDR 0x70
+
+	pmba = pci_read_config(dev, PMBA_CONFIG_OFFSET, 4);
+
+	devctl = inl(PMBA_TO_IO(pmba) + DEVCTL_IO_OFFSET);
+	devctl_changed = 0;
+
+	devrese = pci_read_config(dev, DEVRESE_OFFSET, 2) |
+		(pci_read_config(dev, DEVRESE_OFFSET + 2, 1) << 16);
+
+	if ((devrese & DEVRES_MONITOR_ENABLE) != 0 &&
+	    ((devrese >> 16) & 15) <= 7 &&
+	    (devrese & 0xffff) == RTC_IOADDR &&
+	    (devctl & DEVCTL_TRAP_DEV12) != 0) {
+
+		devrese &= ~DEVRES_MONITOR_ENABLE;
+		devctl &= ~DEVCTL_TRAP_DEV12;
+		devctl_changed = 1;
+
+		pci_write_config(dev, DEVRESE_OFFSET, 2, (devrese & 0xffff));
+		pci_write_config(dev, DEVRESE_OFFSET + 2, 1,
+			     (devrese >> 16) & 0xff);
+
+		printf("Disabled Device 12 trap SMI for access to RTC chip\n");
+	}
+
+	devresg = pci_read_config(dev, DEVRESG_OFFSET, 2) |
+		(pci_read_config(dev, DEVRESG_OFFSET + 2, 1) << 16);
+
+	if ((devresg & DEVRES_MONITOR_ENABLE) != 0 &&
+	    ((devresg >> 16) & 15) <= 7 &&
+	    (devresg & 0xffff) == RTC_IOADDR &&
+	    (devctl & DEVCTL_TRAP_DEV13) != 0) {
+
+		devresg &= ~DEVRES_MONITOR_ENABLE;
+		devctl &= ~DEVCTL_TRAP_DEV13;
+		devctl_changed = 1;
+
+		pci_write_config(dev, DEVRESG_OFFSET, 2, (devresg & 0xffff));
+		pci_write_config(dev, DEVRESG_OFFSET + 2, 1,
+			     (devresg >> 16) & 0xff);
+
+		printf("Disabled Device 13 trap SMI for access to RTC chip\n");
+	}
+
+	if (devctl_changed != 0) {
+		outl(PMBA_TO_IO(pmba) + DEVCTL_IO_OFFSET, devctl);
+	}
+
+#undef PMBA_CONFIG_OFFSET
+#undef PMBA_TO_IO
+#undef DEVRESE_OFFSET
+#undef DEVRESG_OFFSET
+#undef DEVRES_MONITOR_ENABLE
+#undef DEVCTL_IO_OFFSET
+#undef DEVCTL_TRAP_DEV12
+#undef DEVCTL_TRAP_DEV13
+#undef RTC_IOADDR
+}
+#endif
+
 static void
 fixwsc_natoma(device_t dev)
 {
@@ -1199,6 +1278,9 @@
 	case 0x71008086:
 		return ("Intel 82439TX System controller (MTXC)");
 	case 0x71138086:
+#if defined(SMP)
+		fix_82371ab_power_management(dev);
+#endif
 		return ("Intel 82371AB Power management controller");
 	case 0x12378086:
 		fixwsc_natoma(dev);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110150626.f9F6QHi82973>