Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sata_sis: Support for PATA supports

This is quick rework of the patch Uwe proposed but using Kconfig not
ifdefs and user selection to sort out PATA support. Instead of ifdefs and
requiring the user to select both drivers the SATA driver selects the
PATA one.

For neatness I've also moved the extern into the function that uses it.

Signed-off-by: Alan Cox
Signed-off-by: Jeff Garzik <jeff@garzik.org>

authored by

Alan and committed by
Jeff Garzik
9b14dec5 5924b74c

+33 -12
+6 -3
drivers/ata/Kconfig
··· 116 116 If unsure, say N. 117 117 118 118 config SATA_SIS 119 - tristate "SiS 964/180 SATA support" 119 + tristate "SiS 964/965/966/180 SATA support" 120 120 depends on PCI 121 + select PATA_SIS 121 122 help 122 - This option enables support for SiS Serial ATA 964/180. 123 - 123 + This option enables support for SiS Serial ATA on 124 + SiS 964/965/966/180 and Parallel ATA on SiS 180. 125 + The PATA support for SiS 180 requires additionally to 126 + enable the PATA_SIS driver in the config. 124 127 If unsure, say N. 125 128 126 129 config SATA_ULI
+2
drivers/ata/pata_sis.c
··· 796 796 .port_ops = &sis_133_early_ops, 797 797 }; 798 798 799 + /* Privately shared with the SiS180 SATA driver, not for use elsewhere */ 800 + EXPORT_SYMBOL_GPL(sis_info133); 799 801 800 802 static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis) 801 803 {
+25 -9
drivers/ata/sata_sis.c
··· 138 138 .port_ops = &sis_ops, 139 139 }; 140 140 141 - 142 141 MODULE_AUTHOR("Uwe Koziolek"); 143 142 MODULE_DESCRIPTION("low-level driver for Silicon Integratad Systems SATA controller"); 144 143 MODULE_LICENSE("GPL"); 145 144 MODULE_DEVICE_TABLE(pci, sis_pci_tbl); 146 145 MODULE_VERSION(DRV_VERSION); 147 146 148 - static unsigned int get_scr_cfg_addr(unsigned int port_no, unsigned int sc_reg, struct pci_dev *pdev) 147 + static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg) 149 148 { 149 + struct pci_dev *pdev = to_pci_dev(ap->host->dev); 150 150 unsigned int addr = SIS_SCR_BASE + (4 * sc_reg); 151 + u8 pmr; 151 152 152 - if (port_no) { 153 + if (ap->port_no) { 153 154 switch (pdev->device) { 154 155 case 0x0180: 155 156 case 0x0181: 156 - addr += SIS180_SATA1_OFS; 157 + pci_read_config_byte(pdev, SIS_PMR, &pmr); 158 + if ((pmr & SIS_PMR_COMBINED) == 0) 159 + addr += SIS180_SATA1_OFS; 157 160 break; 158 161 159 162 case 0x0182: ··· 173 170 static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) 174 171 { 175 172 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 176 - unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, sc_reg, pdev); 173 + unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); 177 174 u32 val, val2 = 0; 178 175 u8 pmr; 179 176 ··· 191 188 return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */ 192 189 } 193 190 194 - static void sis_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val) 191 + static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val) 195 192 { 196 193 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 197 - unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, scr, pdev); 194 + unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); 198 195 u8 pmr; 199 196 200 - if (scr == SCR_ERROR) /* doesn't exist in PCI cfg space */ 197 + if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */ 201 198 return; 202 199 203 200 pci_read_config_byte(pdev, SIS_PMR, &pmr); ··· 254 251 255 252 static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 256 253 { 254 + /* Provided by the PATA driver */ 255 + extern struct ata_port_info sis_info133; 256 + 257 257 static int printed_version; 258 258 struct ata_probe_ent *probe_ent = NULL; 259 259 int rc; ··· 306 300 switch (ent->device) { 307 301 case 0x0180: 308 302 case 0x0181: 303 + 304 + /* The PATA-handling is provided by pata_sis */ 305 + switch (pmr & 0x30) { 306 + case 0x10: 307 + ppi[1] = &sis_info133; 308 + break; 309 + 310 + case 0x30: 311 + ppi[0] = &sis_info133; 312 + break; 313 + } 309 314 if ((pmr & SIS_PMR_COMBINED) == 0) { 310 315 dev_printk(KERN_INFO, &pdev->dev, 311 316 "Detected SiS 180/181/964 chipset in SATA mode\n"); ··· 396 379 397 380 module_init(sis_init); 398 381 module_exit(sis_exit); 399 -