# FreeBSD 11.0 IPMI driver on the HP ProLiant MicroServer G7



## António Trindade (Jan 10, 2017)

For the last several days, I've been battling with the IPMI driver for FreeBSD 11. My purpose is to use IPMI for hardware monitoring (temperatures, fan speed, voltages, etc.)

I read a lot of forum posts (including these), mailing lists, user experiences' blogs, etc.

I've tried adding device hints:

```
hint.ipmi.0.at="isa"
hint.ipmi.0.port="0xCA2"
hint.ipmi.0.spacing="8"
hint.ipmi.0.mode="KCS"
```
but to no avail.

The kernel output, after loading the IPMI driver is:

```
ipmi0: <IPMI System Interface> on isa0
ipmi0: KCS mode found at mem 0x0 alignment 0x1 on isa
ipmi0: couldn't configure I/O resource
device_attach: ipmi0 attach returned 6
```

I've even tried to hardcode those values into the /usr/src/sys/dev/ipmi/ipmi_isa.c:

```
--- ipmi_isa.c.orig    2017-01-10 15:14:38.710653000 +0000
+++ ipmi_isa.c    2017-01-10 15:42:47.893812000 +0000
@@ -179,9 +179,21 @@
    * Pull info out of the SMBIOS table.  If that doesn't work, use
    * hints to enumerate a device.
    */
-    if (!ipmi_smbios_identify(&info) &&
+    /*if (!ipmi_smbios_identify(&info) &&
       !ipmi_hint_identify(dev, &info))
-        return (ENXIO);
+        return (ENXIO);*/
+
+    /*
+    * Ignore SMBIOS table and use hints exclusively - António Trindade <xxx@xxx.xxx>
+    * 2017-1-10
+    */
+    if (!ipmi_hint_identify(dev, &info))
+                return (ENXIO);
+    /* Hardcode device hints */
+    info.io_mode=1;
+    info.address=0xca2;
+    info.iface_type=KCS_MODE;
+    info.offset=1;

    switch (info.iface_type) {
    case KCS_MODE:
```

Strangely, the kernel output is always the same. It looks like it is ignoring my hard-coded values.

I do not mind having those values hardcoded in the kernel (it just add little work after an upgrade). I just want the driver to work.


----------



## António Trindade (Jan 10, 2017)

Nevermind. I was loading /boot/kernel/ipmi.ko instead of my custom /boot/modules/ipmi.ko.

Having realized this I have made some experiments, but the driver still does not attach. It fails in file ipmi_kcs.c, after a simple probe.


----------



## António Trindade (Jan 13, 2017)

Another update:

The intpm(4) driver from -CURRENT already supports my SMBus controller, so I will try that to get the monitor values via SMBus using that driver.


----------



## scotia (Sep 14, 2017)

Hi António,

did you ever get ipmi access to your server?

I have the same problem.

Thanks,
Scott


----------



## SirDice (Sep 15, 2017)

scotia said:


> did you ever get ipmi access to your server?


You don't need to enable the driver in order for IPMI to work. You'd only need the driver if you want to read/set IPMI parameters using sysutils/ipmitool from FreeBSD.


----------



## scotia (Sep 15, 2017)

Hi SD,

I would like to interrogate BMC sensor values (fans, temps, etc.).  I've only ever done this using ipmitool I complied for ESXi.  (And sysutils/ipmitool for FreeBSD communicating over the LAN).

As for local (non LAN), are you saying that I "don't need to load the driver to read/set IPMI parameters", or that I "don't need to load the driver to read/set IPMI parameters *using ipmitool"*?  (Thereby implying that there is another tool available to read those sensors).

If the above question was unclear, let me rephrase the question:

Can I get sensor values from within FreeBSD on a HP Microserver (as the OP was trying to do)?

Thanks,
Scott


----------



## SirDice (Sep 15, 2017)

scotia said:


> As for local (non LAN), are you saying that I "don't need to load the driver to read/set IPMI parameters", or that I "don't need to load the driver to read/set IPMI parameters *using ipmitool"*? (Thereby implying that there is another tool available to read those sensors).


What I meant to say is that the IPMI driver doesn't need to be loaded on the FreeBSD side to make IPMI functional. So you can remote control the server even if the driver isn't loaded in FreeBSD. I interpreted "IPMI access" as being able to remotely control the server. 

If you want to access any of the IPMI sensor data or set/get parameters from within FreeBSD, then yes, you do need the driver. But some of these sensors may also be gathered using smbus(4) and sysutils/mbmon for example.


----------



## scotia (Sep 20, 2017)

Thanks SirDice,

I have smbus.ko loaded:

`# kldstat
Id Refs Address            Size     Name
 1   66 0xffffffff80200000 1fa8888  kernel
 2    1 0xffffffff821aa000 4c60     coretemp.ko
 3    1 0xffffffff82221000 1fe5a3   zfs.ko
 4    1 0xffffffff82420000 811f     opensolaris.ko
 5    1 0xffffffff82429000 10582    geom_eli.ko
 6    1 0xffffffff8243a000 665d     nullfs.ko
 7    1 0xffffffff82441000 3710     ums.ko
 8    5 0xffffffff82445000 befc     netgraph.ko
 9    1 0xffffffff82451000 7680     ng_netflow.ko
10    1 0xffffffff82459000 4de6     ng_ksocket.ko
11    1 0xffffffff8245e000 423b     ng_ether.ko
12    1 0xffffffff82463000 393d     ng_socket.ko
13    1 0xffffffff82467000 49e25    ctl.ko
14    1 0xffffffff824b1000 ea37     iscsi.ko
15    1 0xffffffff824c0000 587b     fdescfs.ko
16    1 0xffffffff824c6000 91a5     udf.ko
17    1 0xffffffff824d0000 8400     ipmi.ko
18    2 0xffffffff824d9000 e93      smbus.ko
19    1 0xffffffff824da000 2843     intpm.ko`

and mbmon whose provenance is unknown:

`# which mbmon
/usr/local/bin/mbmon
# pkg which /usr/local/bin/mbmon
/usr/local/bin/mbmon was not found in the database`

But when I run mbmon I get the following:

`# mbmon
No Hardware Monitor found!!
InitMBInfo: No error: 0

# mbmon -S
No SMBus HWM available!!
InitMBInfo: No error: 0

# mbmon -A
InitMBInfo: No error: 0
This program needs "setuid root"!!`

And when I try to compile mbmon from ports it fails thusly:

`===>  Building for mbmon-205_6
--- sensors.o ---
--- getMBinfo.o ---
--- sensors.o ---
cc -c -O2 -pipe  -fstack-protector -fno-strict-aliasing -I. -DSMBUS_IOCTL -DHAVE_CONFIG_H -Wall sensors.c
--- getMBinfo.o ---
cc -c -O2 -pipe  -fstack-protector -fno-strict-aliasing -I. -DSMBUS_IOCTL -DHAVE_CONFIG_H -Wall getMBinfo.c
--- tyan_tiger.o ---
cc -c -O2 -pipe  -fstack-protector -fno-strict-aliasing -I. -DSMBUS_IOCTL -DHAVE_CONFIG_H -Wall tyan_tiger.c
--- pci_pm.o ---
cc -c -O2 -pipe  -fstack-protector -fno-strict-aliasing -I. -DSMBUS_IOCTL -DHAVE_CONFIG_H -Wall pci_pm.c
--- getMB-via.o ---
cc -c -O2 -pipe  -fstack-protector -fno-strict-aliasing -I. -DSMBUS_IOCTL -DHAVE_CONFIG_H -Wall getMB-via.c
--- getMB-smb.o ---
cc -c -O2 -pipe  -fstack-protector -fno-strict-aliasing -I. -DSMBUS_IOCTL -DHAVE_CONFIG_H -Wall getMB-smb.c
--- getMB-isa.o ---
cc -c -O2 -pipe  -fstack-protector -fno-strict-aliasing -I. -DSMBUS_IOCTL -DHAVE_CONFIG_H -Wall getMB-isa.c
--- getMB-smb.o ---
In file included from getMB-smb.c:11:
./getMB-smb_ioctl.c:53:6: error: no member named 'data' in 'struct smbcmd'
        cmd.data.byte_ptr = &byte;
        ~~~ ^
./getMB-smb_ioctl.c:133:6: error: no member named 'data' in 'struct smbcmd'
        cmd.data.byte_ptr = &ret;
        ~~~ ^
./getMB-smb_ioctl.c:150:6: error: no member named 'data' in 'struct smbcmd'
        cmd.data.byte = value;
        ~~~ ^
./getMB-smb_ioctl.c:166:6: error: no member named 'data' in 'struct smbcmd'
        cmd.data.word_ptr = &ret;
        ~~~ ^
./getMB-smb_ioctl.c:183:6: error: no member named 'data' in 'struct smbcmd'
        cmd.data.word = value;
        ~~~ ^
5 errors generated.
*** [getMB-smb.o] Error code 1

make[2]: stopped in /usr/portswrkdir/usr/ports/sysutils/mbmon/work/xmbmon205
1 error

make[2]: stopped in /usr/portswrkdir/usr/ports/sysutils/mbmon/work/xmbmon205
===> Compilation failed unexpectedly.`

More debugging required I guess.

I'm running:
`# uname -a
FreeBSD nas-01.thismonkey.com 11.0-RELEASE-p8 FreeBSD 11.0-RELEASE-p8 #0: Wed Feb 22 06:12:04 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64`

Thanks,
Scott


----------



## tobik@ (Sep 20, 2017)

scotia said:


> ===> Building for mbmon-205_6


How old is your ports tree? That version is from 2006? Please update your ports tree before doing anything else.

sysutils/mbmon was moved to sysutils/xmbmon. It also includes patches to fix the errors you're seeing.


----------



## scotia (Sep 21, 2017)

SD,

thanks again.

Stiil, no dice.

I installed sysutils/xmbmon to no avail:

`# pkg which /usr/local/bin/mbmon
/usr/local/bin/mbmon was installed by package xmbmon-205_14`

Same errors as the earlier version of mbmon.

Perhaps the HP Microserver N36L does not support the interface.  I'll try a reboot at the next convenience (which may be a while).


----------



## António Trindade (Jan 10, 2018)

scotia said:


> SD,
> 
> 
> Perhaps the HP Microserver N36L does not support the interface.  I'll try a reboot at the next convenience (which may be a while).



The voltages and temperatures are reported by the BIOS setup. So the sensors are available. It's just a matter of figuring out how to access them in FreeBSD (I leave this for the more knowledgeable in hardware programming... ).


----------



## Snurg (Jan 10, 2018)

tobik@ said:


> How old is your ports tree? That version is from 2006? Please update your ports tree before doing anything else.
> 
> sysutils/mbmon was moved to sysutils/xmbmon. It also includes patches to fix the errors you're seeing.


It is still that old version. At least if installed using pkg install on 11.1Release with "latest" repos.
The man page still even is dated 2003.

Even when `kldload smbus` I only get

```
# kldload smbus
# mbmon -S
No SMBus HWM available!!
InitMBInfo: No error: 0
#
```

Like in António Trindade 's case, I know there is extensive sensor equipment. Lots of temp sensors (CPUs, RAM, NB+SB, ...), fan rpm counters, voltages etc that can be observed in the HP Z800 BIOS, far more than common consumer mainboards offer. I really would like to be able to monitor these things outside of the BIOS.
I want to get early warning if some values change, indicating a developing HW problem, like dirty CPU heatsinks or the like. IMHO this is a thing a server OS should support.
However, I think these are managed via I2C and not smbus, so looking into ipmitool now. But...

```
# kldload ipmi
# ipmitool readings
Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
#
```


----------



## SirDice (Jan 10, 2018)

I'm wondering why IPMI doesn't just work though, is HP's IPMI that different? I've mostly used IPMI with SuperMicro mainboards and it always "just works"(tm). 


```
# ipmitool sdr
CPU1 Temp        | 46 degrees C      | ok
CPU2 Temp        | 51 degrees C      | ok
System Temp      | 31 degrees C      | ok
Peripheral Temp  | 39 degrees C      | ok
PCH Temp         | 52 degrees C      | ok
P1-DIMMA1 TEMP   | 31 degrees C      | ok
P1-DIMMB1 TEMP   | 31 degrees C      | ok
P1-DIMMC1 TEMP   | 37 degrees C      | ok
P1-DIMMD1 TEMP   | 35 degrees C      | ok
P2-DIMME1 TEMP   | 35 degrees C      | ok
P2-DIMMF1 TEMP   | 35 degrees C      | ok
P2-DIMMG1 TEMP   | 33 degrees C      | ok
P2-DIMMH1 TEMP   | 36 degrees C      | ok
FAN1             | 5325 RPM          | ok
FAN2             | no reading        | ns
FAN3             | 5325 RPM          | ok
FAN4             | 5175 RPM          | ok
FAN5             | 5400 RPM          | ok
FAN6             | no reading        | ns
FAN7             | no reading        | ns
FAN8             | no reading        | ns
VTT              | 1.06 Volts        | ok
CPU1 Vcore       | 0.93 Volts        | ok
CPU2 Vcore       | 0.88 Volts        | ok
VDIMM AB         | 1.49 Volts        | ok
VDIMM CD         | 1.49 Volts        | ok
VDIMM EF         | 1.49 Volts        | ok
VDIMM GH         | 1.49 Volts        | ok
+1.5 V           | 1.49 Volts        | ok
3.3V             | 3.31 Volts        | ok
+3.3VSB          | 3.36 Volts        | ok
5V               | 5.06 Volts        | ok
12V              | 12.30 Volts       | ok
VBAT             | 3.26 Volts        | ok
Chassis Intru    | 0x01              | ok
PS1 Status       | 0x01              | ok
```


----------



## Snurg (Jan 10, 2018)

SirDice yes, I would love to have it this way.
Trying to find out what is wrong, I read a small intro about IPMI looked whether there is a PCI device for IPMI. But there seems to be none shown with `pciconf -lv`.
Thus I assume it is memory- or I/O mapped on HP machines. When looking at ipmi_pci.c I found there is only one Dell PCI based SMIC supported.
Reading the release notes of FreeIPMI, which mention adding IPMI support for various HP machines, I think I should look into its sources, maybe there one can learn more how to access HP IPMI.


----------

