sata_sis.c (ef2e58ea6b9931c3a4816c66593da49bb20e3b24) | sata_sis.c (9a829ccfc833269bdb85751f5048288ab93678ac) |
---|---|
1/* 2 * sata_sis.c - Silicon Integrated Systems SATA 3 * 4 * Maintained by: Uwe Koziolek 5 * Please ALWAYS copy linux-ide@vger.kernel.org 6 * on emails. 7 * 8 * Copyright 2004 Uwe Koziolek --- 107 unchanged lines hidden (view full) --- 116 .bmdma_status = ata_bmdma_status, 117 .qc_prep = ata_qc_prep, 118 .qc_issue = ata_qc_issue_prot, 119 .data_xfer = ata_data_xfer, 120 .freeze = ata_bmdma_freeze, 121 .thaw = ata_bmdma_thaw, 122 .error_handler = ata_bmdma_error_handler, 123 .post_internal_cmd = ata_bmdma_post_internal_cmd, | 1/* 2 * sata_sis.c - Silicon Integrated Systems SATA 3 * 4 * Maintained by: Uwe Koziolek 5 * Please ALWAYS copy linux-ide@vger.kernel.org 6 * on emails. 7 * 8 * Copyright 2004 Uwe Koziolek --- 107 unchanged lines hidden (view full) --- 116 .bmdma_status = ata_bmdma_status, 117 .qc_prep = ata_qc_prep, 118 .qc_issue = ata_qc_issue_prot, 119 .data_xfer = ata_data_xfer, 120 .freeze = ata_bmdma_freeze, 121 .thaw = ata_bmdma_thaw, 122 .error_handler = ata_bmdma_error_handler, 123 .post_internal_cmd = ata_bmdma_post_internal_cmd, |
124 .irq_handler = ata_interrupt, | |
125 .irq_clear = ata_bmdma_irq_clear, 126 .irq_on = ata_irq_on, 127 .irq_ack = ata_irq_ack, 128 .scr_read = sis_scr_read, 129 .scr_write = sis_scr_write, 130 .port_start = ata_port_start, 131}; 132 133static struct ata_port_info sis_port_info = { | 124 .irq_clear = ata_bmdma_irq_clear, 125 .irq_on = ata_irq_on, 126 .irq_ack = ata_irq_ack, 127 .scr_read = sis_scr_read, 128 .scr_write = sis_scr_write, 129 .port_start = ata_port_start, 130}; 131 132static struct ata_port_info sis_port_info = { |
134 .sht = &sis_sht, | |
135 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 136 .pio_mask = 0x1f, 137 .mwdma_mask = 0x7, 138 .udma_mask = 0x7f, 139 .port_ops = &sis_ops, 140}; 141 142MODULE_AUTHOR("Uwe Koziolek"); --- 108 unchanged lines hidden (view full) --- 251 (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 252 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)+0x10); 253 } 254} 255 256static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 257{ 258 static int printed_version; | 133 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 134 .pio_mask = 0x1f, 135 .mwdma_mask = 0x7, 136 .udma_mask = 0x7f, 137 .port_ops = &sis_ops, 138}; 139 140MODULE_AUTHOR("Uwe Koziolek"); --- 108 unchanged lines hidden (view full) --- 249 (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 250 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)+0x10); 251 } 252} 253 254static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 255{ 256 static int printed_version; |
259 struct ata_probe_ent *probe_ent = NULL; 260 int rc; | 257 struct ata_port_info pi = sis_port_info; 258 const struct ata_port_info *ppi[2] = { &pi, &pi }; 259 struct ata_host *host; |
261 u32 genctl, val; | 260 u32 genctl, val; |
262 struct ata_port_info pi = sis_port_info, *ppi[2] = { &pi, &pi }; | |
263 u8 pmr; 264 u8 port2_start = 0x20; | 261 u8 pmr; 262 u8 port2_start = 0x20; |
263 int rc; |
|
265 266 if (!printed_version++) 267 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); 268 269 rc = pcim_enable_device(pdev); 270 if (rc) 271 return rc; 272 | 264 265 if (!printed_version++) 266 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); 267 268 rc = pcim_enable_device(pdev); 269 if (rc) 270 return rc; 271 |
273 rc = pci_request_regions(pdev, DRV_NAME); 274 if (rc) { 275 pcim_pin_device(pdev); 276 return rc; 277 } 278 279 rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); 280 if (rc) 281 return rc; 282 rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK); 283 if (rc) 284 return rc; 285 | |
286 /* check and see if the SCRs are in IO space or PCI cfg space */ 287 pci_read_config_dword(pdev, SIS_GENCTL, &genctl); 288 if ((genctl & GENCTL_IOMAPPED_SCR) == 0) 289 pi.flags |= SIS_FLAG_CFGSCR; 290 291 /* if hardware thinks SCRs are in IO space, but there are 292 * no IO resources assigned, change to PCI cfg space. 293 */ --- 50 unchanged lines hidden (view full) --- 344 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966L SATA controller\n"); 345 } else { 346 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966 SATA controller\n"); 347 pi.flags |= ATA_FLAG_SLAVE_POSS; 348 } 349 break; 350 } 351 | 272 /* check and see if the SCRs are in IO space or PCI cfg space */ 273 pci_read_config_dword(pdev, SIS_GENCTL, &genctl); 274 if ((genctl & GENCTL_IOMAPPED_SCR) == 0) 275 pi.flags |= SIS_FLAG_CFGSCR; 276 277 /* if hardware thinks SCRs are in IO space, but there are 278 * no IO resources assigned, change to PCI cfg space. 279 */ --- 50 unchanged lines hidden (view full) --- 330 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966L SATA controller\n"); 331 } else { 332 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966 SATA controller\n"); 333 pi.flags |= ATA_FLAG_SLAVE_POSS; 334 } 335 break; 336 } 337 |
352 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); 353 if (!probe_ent) 354 return -ENOMEM; | 338 rc = ata_pci_prepare_native_host(pdev, ppi, 2, &host); 339 if (rc) 340 return rc; |
355 | 341 |
356 if (!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) { | 342 if (!(pi.flags & SIS_FLAG_CFGSCR)) { |
357 void __iomem *mmio; 358 | 343 void __iomem *mmio; 344 |
359 mmio = pcim_iomap(pdev, SIS_SCR_PCI_BAR, 0); 360 if (!mmio) 361 return -ENOMEM; | 345 rc = pcim_iomap_regions(pdev, 1 << SIS_SCR_PCI_BAR, DRV_NAME); 346 if (rc) 347 return rc; 348 mmio = host->iomap[SIS_SCR_PCI_BAR]; |
362 | 349 |
363 probe_ent->port[0].scr_addr = mmio; 364 probe_ent->port[1].scr_addr = mmio + port2_start; | 350 host->ports[0]->ioaddr.scr_addr = mmio; 351 host->ports[1]->ioaddr.scr_addr = mmio + port2_start; |
365 } 366 367 pci_set_master(pdev); 368 pci_intx(pdev, 1); | 352 } 353 354 pci_set_master(pdev); 355 pci_intx(pdev, 1); |
369 370 if (!ata_device_add(probe_ent)) 371 return -EIO; 372 373 devm_kfree(&pdev->dev, probe_ent); 374 return 0; 375 | 356 return ata_host_activate(host, pdev->irq, ata_interrupt, IRQF_SHARED, 357 &sis_sht); |
376} 377 378static int __init sis_init(void) 379{ 380 return pci_register_driver(&sis_pci_driver); 381} 382 383static void __exit sis_exit(void) 384{ 385 pci_unregister_driver(&sis_pci_driver); 386} 387 388module_init(sis_init); 389module_exit(sis_exit); | 358} 359 360static int __init sis_init(void) 361{ 362 return pci_register_driver(&sis_pci_driver); 363} 364 365static void __exit sis_exit(void) 366{ 367 pci_unregister_driver(&sis_pci_driver); 368} 369 370module_init(sis_init); 371module_exit(sis_exit); |