Well, not exactly. The way it is supposed to work is that if the I2C
detects a new adapter, it calls the driver code if the driver registers
with I2C_DF_NOTIFY. So even if the I2C adapter is detected later, it
should still work.
What is happening, though, is the I2C code is incorrectly zeroing its
drivers[] array, so ipmi_smb's initialization is being destroyed at that
point.
Fixing init order is fairly hard. I have attached a patch to 2.4.32
that might fix the problem (it removes the memsets, which are
unnecessary anyway), but I haven't even compiled it.
-Corey
Cress, Andrew R wrote:
>Corey,
>
>The ipmi_smb debug probe gets nothing because i2c hasn't been loaded
>yet.
>
>I did find the problem, though.
>The patch
>http://khali.linux-fr.org/devel/i2c/linux-2.4.27/linux-2.4.27-i2c-2.10.0
>-drivers-i2c.diff was added, because it was pointed to by lm_sensors
>http://secure.netroedge.com/~lm78/download.html
>But it empties out init_i2c_all() in drivers/char/i2c-core.c.
>Which of course what drivers/char/mem.c:chr_dev_init() uses for the i2c
>init.
>It worked by the module dependencies if =m, but fails if =y.
>
>Sigh. The patch writer didn't bother to consider =y.
>
>Andy
>
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of
>Corey Minyard
>Sent: Wednesday, March 22, 2006 12:39 PM
>To: Cress, Andrew R
>Cc: openipmi
>Subject: Re: [Openipmi-developer] ipmi_smb with i2c driver loading order
>
>I haven't looked at the 2.4 code for a long time. It is supposed to
>detect when new adapters are installed and configure them dynamically.
>Can you add ipmi_smb=debug_probe to the kernel command line and see what
>comes out?
>
>-Corey
>
>Cress, Andrew R wrote:
>
>
>
>>Corey,
>>
>>I have someone trying to build a 2.4.27 kernel with OpenIPMI driver +
>>SMBus patches + lm_sensors patch (v2.10) for i2c_i801.
>>It seems to work fine if they are all defined as modules, but they want
>>compile these modules in to the kernel, and when they do that, i2c
>>
>>
>loads
>
>
>>after ipmi.
>>The drivers/char/Config.in has the $CONFIG_I2C dependency, so it looks
>>like this ought to work.
>>Details attached. I've always worked with kernels where lm_sensors/i2c
>>was already integrated.
>>
>>Is this something you have seen before? Any hints?
>>
>>Andy
>>
>>
>>
>>
>>-----------------------------------------------------------------------
>>
>>
>-
>
>
>>So I updated the config changing all =m by =y in the IPMI and I2C
>>sections.
>>Here are 2 extracts from my config:
>>
>>#
>># I2C support
>>#
>>CONFIG_I2C=y
>>CONFIG_I2C_ALGOBIT=y
>># CONFIG_I2C_PHILIPSPAR is not set
>># CONFIG_I2C_ELV is not set
>># CONFIG_I2C_VELLEMAN is not set
>># CONFIG_I2C_PPORT is not set
>># CONFIG_SCx200_I2C is not set
>>CONFIG_SCx200_ACB=y
>>CONFIG_I2C_ALGOPCF=y
>># CONFIG_I2C_ELEKTOR is not set
>># CONFIG_I2C_PCFEPP is not set
>>CONFIG_I2C_MAINBOARD=y
>># CONFIG_I2C_ALI1535 is not set
>># CONFIG_I2C_ALI15X3 is not set
>># CONFIG_I2C_ALI1563 is not set
>># CONFIG_I2C_HYDRA is not set
>># CONFIG_I2C_AMD756 is not set
>># CONFIG_I2C_AMD8111 is not set
>>CONFIG_I2C_I801=y
>># CONFIG_I2C_I810 is not set
>># CONFIG_I2C_PIIX4 is not set
>># CONFIG_I2C_NFORCE2 is not set
>># CONFIG_I2C_SIS5595 is not set
>># CONFIG_I2C_SIS630 is not set
>># CONFIG_I2C_SIS645 is not set
>># CONFIG_I2C_SAVAGE4 is not set
>># CONFIG_I2C_VIA is not set
>># CONFIG_I2C_VIAPRO is not set
>># CONFIG_I2C_VOODOO3 is not set
>># CONFIG_I2C_ISA is not set
>># CONFIG_I2C_CHARDEV is not set
>># CONFIG_I2C_PROC is not set
>>
>>CONFIG_IPMI_HANDLER=y
>># CONFIG_IPMI_PANIC_EVENT is not set
>># CONFIG_IPMI_PANIC_STRING is not set
>>CONFIG_IPMI_DEVICE_INTERFACE=y
>># CONFIG_IPMI_SI is not set
>># CONFIG_IPMI_KCS is not set
>>CONFIG_IPMI_SMB=y
>>CONFIG_IPMI_WATCHDOG=y
>># CONFIG_IPMI_POWEROFF is not set
>>
>>Unfortunately, the lm_sensor patch somehow has changed
>>the init order of i2c-core (it used to get started before ipmi).
>>I have these messages in this order in the log:
>>...
>>ipmi_smb_setup smb_dbg_probe=1 0x0.0x42:1
>>(this a printk of the outcome of ipmi_smb_setup that I added)
>>...
>>Software Watchdog Timer: 0.05, timer margin: 60 sec
>>ipmi message handler version 37
>>ipmi device interface version 37
>>IPMI SMB Interface driver version 37
>>IPMI watchdog driver version 37
>>RAMDISK driver initialized: 16 RAM disks of 65536K size 1024 blocksize
>>loop: loaded (max 8 devices)
>>imq driver loaded.
>>Uniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4
>>ide: Assuming 33MHz system bus speed for PIO modes; override with
>>
>>
>idebus=xx
>
>
>>hda: SILICONSYSTEMS INC 128MB, ATA DISK drive
>>ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
>>hda: attached ide-disk driver.
>>hda: 254208 sectors (130 MB) w/0KiB Cache, CHS=993/8/32
>>Partition check:
>>hda: hda1 hda2 hda3 hda4
>>i2c-core.o: i2c core module version 2.10.0 (20060214)
>>i2c-i801 version 2.10.0 (20060214)
>>...
>>
>>And the device 42 is not detected anymore.
>>The only thing that I can see is the fact that i2c-core and i2c-i801
>>
>>
>are inited
>
>
>>after the ipmi objects, which seems wrong...
>>I dont know inside kernel how the init order is decided
>>
>>
>>
>>
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting
>language
>that extends applications into web and mobile media. Attend the live
>webcast
>and join the prime developer group breaking into this new coding
>territory!
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>_______________________________________________
>Openipmi-developer mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/openipmi-developer
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting language
>that extends applications into web and mobile media. Attend the live webcast
>and join the prime developer group breaking into this new coding territory!
>http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
>_______________________________________________
>Openipmi-developer mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/openipmi-developer
>
>
Index: linux-2.4.32/drivers/i2c/i2c-core.c
===================================================================
--- linux-2.4.32.orig/drivers/i2c/i2c-core.c
+++ linux-2.4.32/drivers/i2c/i2c-core.c
@@ -55,8 +55,8 @@
/* ----- global variables -------------------------------------------------- */
/**** lock for writing to global variables: the adapter & driver list */
-struct semaphore adap_lock;
-struct semaphore driver_lock;
+DECLARE_MUTEX(adap_lock);
+DECLARE_MUTEX(driver_lock);
/**** adapter list */
static struct i2c_adapter *adapters[I2C_ADAP_MAX];
@@ -1226,14 +1226,7 @@ int i2c_check_functionality (struct i2c_
static int __init i2c_init(void)
{
printk(KERN_INFO "i2c-core.o: i2c core module version %s (%s)\n", I2C_VERSION, I2C_DATE);
- memset(adapters,0,sizeof(adapters));
- memset(drivers,0,sizeof(drivers));
- adap_count=0;
- driver_count=0;
- init_MUTEX(&adap_lock);
- init_MUTEX(&driver_lock);
-
i2cproc_init();
return 0;