# Reading SMBus on an HP ProLiant MicroServer N40L



## BlackThorneDK (Jan 30, 2013)

OK, I'm not usually using FreeBSD, so forgive me, if I only need to load a module or something.

I'm trying to read the status of SMBus, and later control the front LED of my HP ProLiant MicroServer N40L.

I built my own kernel, and added the following:


```
# System management bus
device          ipmi
device          smb
device          smbus
device          smbios
device          ichsmb
device          nfsmb
device          intpm
device          alpm
device          viapm
device          nfpm
device          iicbus
device          iicbb
device          ic
device          iic
device          iicsmb
device          amdsmb
```

But no /dev/smb0 is ever showing up.
All I get from dmesg is this:


```
smbios0: <System Management BIOS> at iomem 0xf99a0-0xf99be on motherboard
smbios0: Version: 2.6
```

I attached my kernel conf, the output of dmesg, dmidecode, ipmi-locate and sysctl dev.
It's like I'm missing a module or something, but kldload smb does nothing.

I also tried the generic kernel, but no luck. 

I'm not really sure, where to continue. My searches come up empty, or relate to the RAID driver, which I don't really use for anything else than SATA.


----------



## tingo (Jan 31, 2013)

That probably won't work, if you load the wrong SMB driver first, it will "block" when you try to load another driver.
It is better to start with a GENERIC kernel, this way you can load each module in turn, and see if it works. Modules in question are amdsmb, ichsmb, iicsmb, nfsmb.
Read kldload(8) and kldstat(8) to find out how to work with loadable modules.


----------



## dR3b (Feb 5, 2013)

BlackThorneDK said:
			
		

> ... and later control the front LED of my HP ProLiant MicroServer N40L.


Interesting, have you more information about that?


----------



## BlackThorneDK (Feb 6, 2013)

Not yet. 
As far as I have figured, the SMBus device on the motherboard is: AMD RS785E/SB820M
The LED is controlled by Windows Home Server, which use it as a status LED.
I found that the SMBus device is at PCI0:0:20:0, but there is no device driver for it yet.
The pci/amdsmb.c driver might be my next try, but it binds only on the specific Device ID for the AMD 8111 Hypertransport Hub.
Perhaps it is as easy as changing the Device ID, and recompile?

But I haven't had the time to test any further, since my day job took my time. 


```
#define AMDSMB_VENDORID_AMD             0x1022
#define AMDSMB_DEVICEID_AMD8111_SMB2    0x746a
```


----------



## maltem (Feb 6, 2013)

If you make any progress, please let us know. It would be great if I could use this LED for something else than lighting up my room


----------



## Terry_Kennedy (Feb 7, 2013)

BlackThorneDK said:
			
		

> The LED is controlled by Windows Home Server, which use it as a status LED.


Is there an HP driver for this installed as part of the WHS install?

The reason I'm asking is that hardware manufacturers tend to put this stuff in non-standard places. For example, some Dell servers have a scrolling LCD text front panel display, which Dell's modified version of ipmitool can access under Linux. When people asked for this to be added as additional OEM support in regular ipmitool, apparently the maintainers looked at the patches and went "Ick!". IIRC, they said they'd be open to user-submitted patches that were modularized, as opposed to changing things all over the ipmitool code.

In that particular case, I was able to change the text under FreeBSD by doing direct pokes into the IPMI / SMBus space (with the appropriate driver loaded), but never pursued it beyond that.

The point being - even if you get a driver for your chipset loaded, you may still not be able to control the LED without information on what is being sent on the bus. In the Dell case, this was somewhat easier because they provided their modified ipmitool source.


----------



## BlackThorneDK (Feb 11, 2013)

Well, I knew it wasn't going to be easy, but I wanted to start with the SMBus controller.
It seems I've found the driver, but here my luck runs out.
I found this code in pci/intpm.c:

```
case 0x43851002:
                /* SB800 and newer can not be configured in a compatible way. */
                if (pci_get_revid(dev) >= 0x40)
                        return (ENXIO);
                device_set_desc(dev, "AMD SB600/700/710/750 SMBus Controller");
                /* XXX Maybe force polling right here? */
                break;
```

It seems like someone already tried to get my SMBus controller running, and failed... 
On Linux the driver loaded is indeed piix4_smbus, which controls the same devices as intpm.c.


----------



## tingo (Feb 16, 2013)

Does the Linux driver work? If so maybe you could figure out how it works, and describe it?
Then we could find someone to implement that for FreeBSD, that way we would have a clean room implementation.


----------



## BlackThorneDK (Feb 16, 2013)

I am reading up on the Linux driver, and trying to figure out, what the difference is.
There is a special probe method for the SB800, that reads out some more info, before accepting the device.

If I get it to work, I can probably write up what I did, and how to get it working, but I have no idea about the license issues. If I hack something together for myself, it will of course not be eligible for the FreeBSD kernel, since I read the Linux source and basically could have copied it. 
How should I give this info to 'someone'?
What info and how?
I can look up data from AMD as well, and point to that, if I find it.


----------



## dR3b (Mar 26, 2014)

Any new information here?


----------



## bhughes (Apr 1, 2014)

I've also got one of these SB800 SMBus devices, but with a different device ID:

```
none0@pci0:0:20:0:	class=0x0c0500 card=0x780b1849 chip=0x780b1022 rev=0x16 hdr=0x00
    vendor     = 'Advanced Micro Devices [AMD]'
    device     = 'Hudson SMBus Controller'
    class      = serial bus
    subclass   = SMBus
```

I saw this the other day, and wanted to give it a try one of these days: https://gitorious.org/freebsd/avgbsd/co ... 41e79c1122


----------

