Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2008 15:55:49 +0200
From:      Andriy Gapon <avg@icyb.net.ua>
To:        joerg_wunsch@uriah.heep.sax.de, FreeBSD Stable <freebsd-stable@freebsd.org>
Subject:   smbmsg(8): slave address confusion?
Message-ID:  <4926BDE5.5020708@icyb.net.ua>

next in thread | raw e-mail | index | archive | help

It seems that smbmsg is another victim in "Great SMBus Slave Address
Confusion" - there are two schools: one that think that slave address is
(addr >> 1) and there other thinks that slave address is (addr & ~0x1).
It seems that smb driver in FreeBSD takes the first approach, but smbmsg
is keen on the second.

smbmsg.c:
...
/*
 * The I2C specs say that all addresses below 16 and above or equal
 * 240 are reserved.  Address 0 is the global address, but we do not
 * care for this detail.
 */
#define MIN_I2C_ADDR    16
#define MAX_I2C_ADDR    240
.
.
.
static void
probe_i2c(void)
{
...
        for (addr = MIN_I2C_ADDR; addr < MAX_I2C_ADDR; addr += 2) {
...

And sample output on my machine (releng/7 amd64):
$ mbmsg -p
Probing for devices on /dev/smb0:
Device @0x44: rw
Device @0x50: rw
Device @0x52: rw
Device @0x80: rw
Device @0x88: w
Device @0xc4: rw
Device @0xd0: rw
Device @0xd2: rw

Now:

(0x44 << 1) & 0xff == (0xc4 << 1) & 0xff = 0x88 (looks like RTC)
(0x50 << 1) & 0xff == (0xd0 << 1) & 0xff = 0xa0 (well known SPD addr)
(0x52 << 1) & 0xff == (0xd2 << 1) & 0xff = 0xa4 (well known SPD addr)
(0x80 << 1) & 0xff = 0x0 (mentioned above "global address")
(0x88 << 1) & 0xff == MIN_I2C_ADDR = 0x10 (something weird)

I think that this demonstrates that FreeBSD smb driver expects slave
addresses in range 0x0-0x7f.

-- 
Andriy Gapon



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