Hi Corey,
Here is a patch against 2.6.13 I've been working on (and mentioned to
you at OLS), that adds support for the 2.6 driver model, and sysfs to
the ipmi subsystem. It is loosely inspired by the USB driver model
system. There is a driver struct added for the ipmi_msghandler, and
one for each system interface 'driver' (for each state machine in
ipmi_si). A device struct is created for each system interface in the
system, and for each unique BMC on the system, with a symlink between
each system interface and the bmc it interfaces to. Each bmc has a set
of fundamental device attributes, and each of the drivers has a
version attribute reflecting the driver/state machine versions.
Furthermore each of these devices is registered as a class_device with
the ipmi class (moved to ipmi_msghandler) as bmcx and smix.
This in effect creates the following sysfs interface on a machine with
a single BMC and two interfaces:
/sys/
|-- block
|-- bus
| |-- platform
| | |-- devices
| | | |-- ipmi_bmc.0 -> ../../../devices/platform/ipmi_bmc.0
| | | |-- ipmi_si.0 -> ../../../devices/platform/ipmi_si.0
| | | |-- ipmi_si.1 -> ../../../devices/platform/ipmi_si.1
| | `-- drivers
| | |-- ipmi_bt_sm
| | | |-- bind
| | | |-- ipmi_si.1 -> ../../../../devices/platform/ipmi_si.1
| | | |-- unbind
| | | `-- version
| | |-- ipmi_kcs_sm
| | | |-- bind
| | | |-- ipmi_si.0 -> ../../../../devices/platform/ipmi_si.0
| | | |-- unbind
| | | `-- version
| | |-- ipmi_msghandler
| | | |-- bind
| | | |-- ipmi_bmc.0 -> ../../../../devices/platform/ipmi_bmc.0
| | | |-- unbind
| | | `-- version
|-- class
| |-- ipmi
| | |-- bmc0
| | | `-- device -> ../../../devices/platform/ipmi_bmc.0
| | |-- ipmi0
| | | `-- dev
| | |-- ipmi1
| | | `-- dev
| | |-- smi0
| | | `-- device -> ../../../devices/platform/ipmi_si.0
| | `-- smi1
| | `-- device -> ../../../devices/platform/ipmi_si.1
|-- devices
| |-- platform
| | |-- ipmi_bmc.0
| | | |-- bus -> ../../../bus/platform
| | | |-- device_id
| | | |-- driver -> ../../../bus/platform/drivers/ipmi_msghandler
| | | |-- firmware_revision
| | | |-- ipmi_version
| | | |-- power
| | | | `-- state
| | | |-- product_id
| | | `-- revision
| | |-- ipmi_si.0
| | | |-- bmc -> ../../../devices/platform/ipmi_bmc.0
| | | |-- bus -> ../../../bus/platform
| | | |-- driver -> ../../../bus/platform/drivers/ipmi_kcs_sm
| | | `-- power
| | | `-- state
| | |-- ipmi_si.1
| | | |-- bmc -> ../../../devices/platform/ipmi_bmc.0
| | | |-- bus -> ../../../bus/platform
| | | |-- driver -> ../../../bus/platform/drivers/ipmi_bt_sm
| | | `-- power
| | | `-- state
|-- kernel
|-- module
| |-- ipmi_devintf
| | |-- refcnt
| | `-- sections
| | `-- __param
| |-- ipmi_msghandler
| | |-- refcnt
| | `-- sections
| | |-- __ksymtab
| | `-- __ksymtab_strings
| |-- ipmi_si
| | |-- refcnt
| | `-- sections
| | `-- __param
`-- power
My motiviation for the patch is to have a device struct (bmc) to
register with the new hwmon class for my in-progress hwmon driver
ipmi_sensors. With this patch the driver can create device attributes
under bmc devices representing sensor readings for the
hwmon/lm_sensors interface.
I have tested the patch on two systems of mine with a single bmc, it
should however also work for a machine with multiple bmcs using the
guid/product+device id to differentiate.
Thanks,
Yani