Hi,while my notebook (Thinkpad R40, i82801DB chipset) produces very nice worst-case numbers under RTAI/fusion with SMI disabled, it unfortunately fails to reboot when this fix is enabled. Therefore, I quickly patched rtai_hal to restore the SMI settings on reboot - works great for me. :)
JanPS: Sorry, the patch also contains three whitespace "fixes", I was too lazy to remove them.
Index: arch/i386/hal/smi.c
===================================================================
RCS file: /cvs/rtai/fusion/arch/i386/hal/smi.c,v
retrieving revision 1.12
diff -u -p -r1.12 smi.c
--- arch/i386/hal/smi.c 16 Apr 2005 11:54:01 -0000 1.12
+++ arch/i386/hal/smi.c 5 May 2005 08:58:07 -0000
@@ -28,6 +28,7 @@
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/pci_ids.h>
+#include <linux/reboot.h>
#include <smi.h>
@@ -127,6 +128,22 @@ static unsigned short rthal_smi_en_addr;
#define mask_bits(v, p) outl(inl(p)&~(v),(p))
#define set_bits(v, p) outl(inl(p)|(v), (p))
+static int rthal_smi_reboot(struct notifier_block *nb, ulong event, void *buf);
+
+static struct notifier_block rthal_smi_notifier = {
+ .notifier_call = rthal_smi_reboot
+};
+
+static int rthal_smi_reboot(struct notifier_block *nb, ulong event, void *buf)
+{
+ if ((event != SYS_RESTART) && (event != SYS_HALT) &&
+ (event != SYS_POWER_OFF))
+ return NOTIFY_DONE;
+
+ rthal_smi_restore();
+ return NOTIFY_OK;
+}
+
void rthal_smi_disable(void)
{
if(!rthal_smi_en_addr)
@@ -134,6 +151,8 @@ void rthal_smi_disable(void)
rthal_smi_saved_bits = inl(rthal_smi_en_addr) & rthal_smi_masked_bits;
mask_bits(rthal_smi_masked_bits, rthal_smi_en_addr);
+
+ register_reboot_notifier(&rthal_smi_notifier);
}
void rthal_smi_restore(void)
@@ -141,13 +160,15 @@ void rthal_smi_restore(void)
if(!rthal_smi_en_addr)
return;
+ unregister_reboot_notifier(&rthal_smi_notifier);
+
set_bits(rthal_smi_saved_bits, rthal_smi_en_addr);
}
static unsigned short __devinit get_smi_en_addr(struct pci_dev *dev)
{
u_int8_t byte0, byte1;
-
+
pci_read_config_byte (dev, PMBASE_B0, &byte0);
pci_read_config_byte (dev, PMBASE_B1, &byte1);
return SMI_CTRL_ADDR + (((byte1 << 1) | (byte0 >> 7)) << 7); // bits 7-15
@@ -166,7 +187,7 @@ void __devinit rthal_smi_init(void)
*/
for(id = &rthal_smi_pci_tbl[0]; dev == NULL && id->vendor != 0; id++)
dev = pci_get_device(id->vendor, id->device, NULL);
-
+
if(dev == NULL || dev->bus->number || dev->devfn != DEVFN)
return ;
@@ -180,7 +201,7 @@ void __devinit rthal_smi_init(void)
printk("RTAI: Intel chipset found and SMI workaround not enabled,\n"
" you may encounter high interrupt latencies.\n");
-#endif /* ! CONFIG_RTAI_HW_SMI_WORKAROUND */
+#endif /* ! CONFIG_RTAI_HW_SMI_WORKAROUND */
}
/*
smime.p7s
Description: S/MIME Cryptographic Signature
