--- quirks.c.old 2004-12-24 22:33:49.000000000 +0100 +++ quirks.c 2005-01-18 16:46:57.057499248 +0100 @@ -19,6 +19,8 @@ #include #include +#include "pci.h" + #undef DEBUG /* Deal with broken BIOS'es that neglect to enable passive release, @@ -280,6 +282,74 @@ } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, quirk_ali7101_acpi ); +/* ALi 1533 fixup to enable the M7101 SMBus Controller + * ported from prog/hotplug of the lm_sensors + * package + */ +static void __devinit quirk_ali1533_smbus(struct pci_dev *dev) +{ + u8 val = 0; + struct pci_dev *m7101; + + printk ( "M7101: Looking for disabled device... " ); + + m7101 = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL); + + if ( m7101 ) + { + printk ( "not found!\n" ); + return; + } + + pci_read_config_byte ( dev, 0x5F, &val ); + + if ( val & 0x4 ) + { + printk ( "found.\n" ); + printk ( "M7101: Enabling M7101 device ... " ); + + pci_write_config_byte ( dev, 0x5F, val & 0xFB ); + pci_read_config_byte ( dev, 0x5F, &val ); + + if ( val & 0x4 ) + { + printk ( "failed.\n" ); + return; + } + + printk ( "OK.\n" ); + } + else + printk ( "not found.\n" ); + + m7101 = pci_scan_single_device ( dev->bus, 0x18 ); + + printk ( "M7101: Do we need to unlock registers? ... " ); + + if ( pci_read_config_byte ( m7101, 0x05B, &val ) ) + { + printk ( "Failed to read.\n"); + return; + } + + if ( val & 0x06 ) + { + printk ( "yes\n" ); + printk ( "M7101: Unlocking registers ..." ); + + val = val & ~0x06; + + if ( pci_write_config_byte ( m7101, 0x05B, val ) ) + { + printk ( "failed.\n" ); + return; + } + + printk ( "OK.\n" ); + } +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, quirk_ali1533_smbus ); + /* * PIIX4 ACPI: Two IO regions pointed to by longwords at * 0x40 (64 bytes of ACPI registers)