NetBSD Problem Report #36744
From paul@whooppee.com Tue Aug 7 11:43:24 2007
Return-Path: <paul@whooppee.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id C44A263BAD3
for <gnats-bugs@gnats.NetBSD.org>; Tue, 7 Aug 2007 11:43:24 +0000 (UTC)
Message-Id: <20070807114316.1F7F858FD@quicky.whooppee.com>
Date: Tue, 7 Aug 2007 04:43:16 -0700 (PDT)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@NetBSD.org
Subject: Add enumeration of i2c bus devices
X-Send-Pr-Version: 3.95
>Number: 36744
>Category: kern
>Synopsis: Add enumeration of i2c bus devices
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Tue Aug 07 11:45:00 +0000 2007
>Closed-Date: Sat Sep 01 22:20:12 +0000 2007
>Last-Modified: Fri Sep 28 14:10:01 +0000 2007
>Originator: Paul Goyette
>Release: NetBSD 4.99.26 sources as of 2007-08-01 12:42:27 UTC
>Organization:
>Environment:
System: NetBSD quicky.whooppee.com 4.99.26 NetBSD 4.99.26 (QUICKY (ASUS A8N5X) 2007-08-01 12:42:27 UTC) #185: Wed Aug 1 06:09:48 PDT 2007 paul@quicky.whooppee.com:/usr/obj/objdir/amd64/sys/arch/amd64/compile/QUICKY amd64
Architecture: x86_64
Machine: amd64
>Description:
For SMB busses, add ability to enumerate devices on the bus. This
does NOT identify the devices, simply determines their presense.
I2C devices still need to be attached at wired bus addresses.
Other SMB bus drivers need to be modified to set the bus type; I
only have nfsmb so I haven't modified or tested the others.
Code originally provided by Nicolas Joly.
>How-To-Repeat:
>Fix:
Index: i2c/i2c.c
===================================================================
RCS file: /cvsroot/src/sys/dev/i2c/i2c.c,v
retrieving revision 1.14
diff -u -p -r1.14 i2c.c
--- i2c/i2c.c 9 Jul 2007 21:00:32 -0000 1.14
+++ i2c/i2c.c 7 Aug 2007 11:41:52 -0000
@@ -109,8 +109,11 @@ iic_attach(struct device *parent, struct
{
struct iic_softc *sc = device_private(self);
struct i2cbus_attach_args *iba = aux;
+ i2c_addr_t addr;
i2c_tag_t ic;
int rv;
+ int found = 0;
+ uint8_t cmd = 0, val;
aprint_naive(": I2C bus\n");
aprint_normal(": I2C bus\n");
@@ -128,6 +131,24 @@ iic_attach(struct device *parent, struct
if (rv)
printf("%s: unable to create intr thread\n", ic->ic_devname);
+ if (sc->sc_type == I2C_TYPE_SMBUS) {
+ for (addr = 0x0; addr < 0x80; addr++) {
+ iic_acquire_bus(ic, 0);
+ if (iic_exec(ic, I2C_OP_READ_WITH_STOP, addr,
+ &cmd, 1, &val, 1, 0) == 0) {
+ if (found == 0)
+ aprint_normal("%s: devices at",
+ ic->ic_devname);
+ found++;
+ aprint_normal(" 0x%02x", addr);
+ }
+ iic_release_bus(ic, 0);
+ }
+ if (found == 0)
+ aprint_normal("%s: no devices found", ic->ic_devname);
+ aprint_normal("\n");
+ }
+
/*
* Attach all i2c devices described in the kernel
* configuration file.
Index: pci/nfsmb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/nfsmb.c,v
retrieving revision 1.3
diff -u -p -r1.3 nfsmb.c
--- pci/nfsmb.c 28 Jul 2007 12:31:50 -0000 1.3
+++ pci/nfsmb.c 7 Aug 2007 11:41:52 -0000
@@ -217,6 +217,7 @@ nfsmb_attach(struct device *parent, stru
return;
}
+ iba.iba_type = I2C_TYPE_SMBUS;
iba.iba_tag = &sc->sc_i2c;
(void) config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print);
}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: riz@netbsd.org
State-Changed-When: Sat, 01 Sep 2007 22:20:12 +0000
State-Changed-Why:
Patch applied to -current, thanks!
From: Jeff Rizzo <riz@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: PR/36744 CVS commit: src/sys/dev
Date: Sat, 1 Sep 2007 22:19:25 +0000 (UTC)
Module Name: src
Committed By: riz
Date: Sat Sep 1 22:19:25 UTC 2007
Modified Files:
src/sys/dev/i2c: i2c.c
src/sys/dev/pci: ichsmb.c nfsmb.c
Log Message:
For SMBus, add the ability to enumerate devices on the bus.
This does NOT identify the devices, merely indicates the
presence of devices at certain addresses. Tested on ichsmb
and nfsmb - other SMBus devices will need to ensure the
proper bus type is set. (I2C_TYPE_SMBUS)
From Nicolas Joly, via Paul Goyette, in PR#36744.
To generate a diff of this commit:
cvs rdiff -r1.14 -r1.15 src/sys/dev/i2c/i2c.c
cvs rdiff -r1.8 -r1.9 src/sys/dev/pci/ichsmb.c
cvs rdiff -r1.5 -r1.6 src/sys/dev/pci/nfsmb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Simon Burge <simonb@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org, paul@whooppee.com
Subject: Re: PR/36744 CVS commit: src/sys/dev
Date: Thu, 06 Sep 2007 14:16:55 +1000
[ Resent hoping to get it attached to the PR this time, with some
new info ]
Jeff Rizzo wrote:
> From: Jeff Rizzo <riz@netbsd.org>
> To: gnats-bugs@NetBSD.org
> Cc:
> Subject: PR/36744 CVS commit: src/sys/dev
> Date: Sat, 1 Sep 2007 22:19:25 +0000 (UTC)
>
> Module Name: src
> Committed By: riz
> Date: Sat Sep 1 22:19:25 UTC 2007
>
> Modified Files:
> src/sys/dev/i2c: i2c.c
> src/sys/dev/pci: ichsmb.c nfsmb.c
>
> Log Message:
> For SMBus, add the ability to enumerate devices on the bus.
> This does NOT identify the devices, merely indicates the
> presence of devices at certain addresses. Tested on ichsmb
> and nfsmb - other SMBus devices will need to ensure the
> proper bus type is set. (I2C_TYPE_SMBUS)
>
> From Nicolas Joly, via Paul Goyette, in PR#36744.
>
>
> To generate a diff of this commit:
> cvs rdiff -r1.14 -r1.15 src/sys/dev/i2c/i2c.c
> cvs rdiff -r1.8 -r1.9 src/sys/dev/pci/ichsmb.c
> cvs rdiff -r1.5 -r1.6 src/sys/dev/pci/nfsmb.c
This change causes my Dell 640m laptop to powerdown when I use
reboot(8), instead of rebooting normally. This happens with both UP and
MP kernels, and both on HEAD and on the jmcneill-pm branch.
Here's some dmesg:
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
pchb0 at pci0 dev 0 function 0
pchb0: Intel 82945GM/PM/GMS Host Bridge (rev. 0x03)
...
ichsmb0 at pci0 dev 31 function 3: Intel 82801GB/GR SMBus Controller (rev. 0x01)
ichsmb0: interrupting at ioapic0 pin 17 (irq 4)
iic0 at ichsmb0: I2C bus
iic0: devices at 0x00 0x08 0x50 0x69
ichsmb0: exec: op 1, addr 0x6a, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x6b, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x6c, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x6d, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x6e, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x6f, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x70, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x71, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x72, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x73, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x74, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x75, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x76, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x77, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x78, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x79, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x7a, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x7b, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x7c, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x7d, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x7e, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x7f, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
At a guess, the read from the device at 0x69 is causing some issue with
keeping the bus tied up or something and then just maybe the reboot
fails after that because the BIOS can no longer talk any smbus devices.
For now, I've just commented out the
iba.iba_type = I2C_TYPE_SMBUS;
sys/dev/pci/ichsmb.c and that gets things working for me again. I
noticed Jared disabled the new code in dev/i2c/i2c.c overnight on the
jmcneill-pm branch.
Perhaps this new code should be disabled on HEAD as well until all its
effects are known? At least I think the PR should be reopened.
Simon.
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
To: riz@netbsd.org, gnats-bugs@netbsd.org
Cc:
Subject: PR/36744 CVS commit: src/sys/dev
Date: Fri, 28 Sep 2007 16:06:59 +0200
[ I hope this one attaches to this PR ]
Same problem here.
ichsmb0 at pci0 dev 31 function 3: Intel 82801EB/ER SMBus Controller (rev. 0x02)
ichsmb0: interrupting at ioapic0 pin 17 (irq 11)
iic0 at ichsmb0: I2C bus
iic0: devices at 0x2f 0x44 0x48 0x49 0x50 0x52 0x61ichsmb0: exec: op 1, addr 0x62, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
ichsmb0: exec: op 1, addr 0x63, cmdlen 1, len 1, flags 0x08: timeout, status 0x41<BUSY,INUSE>
... and so on ...
A `shutdown -r now' shuts down and locks so only hard power-off - power-on
brings the machine back. Reset doesn't work. Nor does soft power-off.
Please reopen this PR ...
--
Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.