static unsigned int __init init_chipset_sis5513 (struct pci_dev *dev, const char *name) 
static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const char *name) 
static unsigned int __init init_chipset_sis5513 (struct pci_dev *dev, const char *name){	struct pci_dev *host;	int i = 0;	chipset_family = 0;	for (i = 0; i < ARRAY_SIZE(SiSHostChipInfo) && !chipset_family; i++) {		host = pci_find_device(PCI_VENDOR_ID_SI, SiSHostChipInfo[i].host_id, NULL);		if (!host)			continue;		chipset_family = SiSHostChipInfo[i].chipset_family;		/* Special case for SiS630 : 630S/ET is ATA_100a */		if (SiSHostChipInfo[i].host_id == PCI_DEVICE_ID_SI_630) {			u8 hostrev;			pci_read_config_byte(host, PCI_REVISION_ID, &hostrev);			if (hostrev >= 0x30)				chipset_family = ATA_100a;		}			printk(KERN_INFO "SIS5513: %s %s controller\n",			 SiSHostChipInfo[i].name, chipset_capability[chipset_family]);	}	if (!chipset_family) { /* Belongs to pci-quirks */			u32 idemisc;			u16 trueid;			/* Disable ID masking and register remapping */			pci_read_config_dword(dev, 0x54, &idemisc);			pci_write_config_dword(dev, 0x54, (idemisc & 0x7fffffff));			pci_read_config_word(dev, PCI_DEVICE_ID, &trueid);			pci_write_config_dword(dev, 0x54, idemisc);			if (trueid == 0x5518) {				printk(KERN_INFO "SIS5513: SiS 962/963 MuTIOL IDE UDMA133 controller\n");				chipset_family = ATA_133;				/* Check for 5513 compability mapping				 * We must use this, else the port enabled code will fail,				 * as it expects the enablebits at 0x4a.				 */				if ((idemisc & 0x40000000) == 0) {					pci_write_config_dword(dev, 0x54, idemisc | 0x40000000);					printk(KERN_INFO "SIS5513: Switching to 5513 register mapping\n");				}			}	}	if (!chipset_family) { /* Belongs to pci-quirks */			struct pci_dev *lpc_bridge;			u16 trueid;			u8 prefctl;			u8 idecfg;			u8 sbrev;			pci_read_config_byte(dev, 0x4a, &idecfg);			pci_write_config_byte(dev, 0x4a, idecfg | 0x10);			pci_read_config_word(dev, PCI_DEVICE_ID, &trueid);			pci_write_config_byte(dev, 0x4a, idecfg);			if (trueid == 0x5517) { /* SiS 961/961B */				lpc_bridge = pci_find_slot(0x00, 0x10); /* Bus 0, Dev 2, Fn 0 */				pci_read_config_byte(lpc_bridge, PCI_REVISION_ID, &sbrev);				pci_read_config_byte(dev, 0x49, &prefctl);				if (sbrev == 0x10 && (prefctl & 0x80)) {					printk(KERN_INFO "SIS5513: SiS 961B MuTIOL IDE UDMA133 controller\n");					chipset_family = ATA_133a;				} else {					printk(KERN_INFO "SIS5513: SiS 961 MuTIOL IDE UDMA100 controller\n");					chipset_family = ATA_100;				}			}	}	if (!chipset_family)		return -1;	/* Make general config ops here	   1/ tell IDE channels to operate in Compatibility mode only	   2/ tell old chips to allow per drive IDE timings */	{		u8 reg;		u16 regw;		switch(chipset_family) {			case ATA_133:				/* SiS962 operation mode */				pci_read_config_word(dev, 0x50, &regw);				if (regw & 0x08)					pci_write_config_word(dev, 0x50, regw&0xfff7);				pci_read_config_word(dev, 0x52, &regw);				if (regw & 0x08)					pci_write_config_word(dev, 0x52, regw&0xfff7);				break;			case ATA_133a:			case ATA_100:				/* Fixup latency */				pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x80);				/* Set compatibility bit */				pci_read_config_byte(dev, 0x49, &reg);				if (!(reg & 0x01)) {					pci_write_config_byte(dev, 0x49, reg|0x01);				}				break;			case ATA_100a:			case ATA_66:				/* Fixup latency */				pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x10);				/* On ATA_66 chips the bit was elsewhere */				pci_read_config_byte(dev, 0x52, &reg);				if (!(reg & 0x04)) {					pci_write_config_byte(dev, 0x52, reg|0x04);				}				break;			case ATA_33:				/* On ATA_33 we didn't have a single bit to set */				pci_read_config_byte(dev, 0x09, &reg);				if ((reg & 0x0f) != 0x00) {					pci_write_config_byte(dev, 0x09, reg&0xf0);				}			case ATA_16:				/* force per drive recovery and active timings				   needed on ATA_33 and below chips */				pci_read_config_byte(dev, 0x52, &reg);				if (!(reg & 0x08)) {					pci_write_config_byte(dev, 0x52, reg|0x08);				}				break;		}#if defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS)		if (!sis_proc) {			sis_proc = 1;			bmide_dev = dev;			ide_pci_create_host_proc("sis", sis_get_info);		}#endif	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/2b0c4bed77041bf64e26b502cd2a767e355c3342/sis5513.c/buggy/drivers/ide/pci/sis5513.c