vserver 1.9.3
[linux-2.6.git] / drivers / scsi / sata_via.c
index 993edfc..44ffa9b 100644 (file)
@@ -81,6 +81,7 @@ static struct pci_driver svia_pci_driver = {
 static Scsi_Host_Template svia_sht = {
        .module                 = THIS_MODULE,
        .name                   = DRV_NAME,
+       .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
        .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
@@ -99,15 +100,16 @@ static Scsi_Host_Template svia_sht = {
 static struct ata_port_operations svia_sata_ops = {
        .port_disable           = ata_port_disable,
 
-       .tf_load                = ata_tf_load_pio,
-       .tf_read                = ata_tf_read_pio,
-       .check_status           = ata_check_status_pio,
-       .exec_command           = ata_exec_command_pio,
+       .tf_load                = ata_tf_load,
+       .tf_read                = ata_tf_read,
+       .check_status           = ata_check_status,
+       .exec_command           = ata_exec_command,
+       .dev_select             = ata_std_dev_select,
 
        .phy_reset              = sata_phy_reset,
 
-       .bmdma_setup            = ata_bmdma_setup_pio,
-       .bmdma_start            = ata_bmdma_start_pio,
+       .bmdma_setup            = ata_bmdma_setup,
+       .bmdma_start            = ata_bmdma_start,
        .qc_prep                = ata_qc_prep,
        .qc_issue               = ata_qc_issue_prot,
 
@@ -123,6 +125,15 @@ static struct ata_port_operations svia_sata_ops = {
        .port_stop              = ata_port_stop,
 };
 
+static struct ata_port_info svia_port_info = {
+       .sht            = &svia_sht,
+       .host_flags     = ATA_FLAG_SATA | ATA_FLAG_SRST | ATA_FLAG_NO_LEGACY,
+       .pio_mask       = 0x1f,
+       .mwdma_mask     = 0x07,
+       .udma_mask      = 0x7f,
+       .port_ops       = &svia_sata_ops,
+};
+
 MODULE_AUTHOR("Jeff Garzik");
 MODULE_DESCRIPTION("SCSI low-level driver for VIA SATA controllers");
 MODULE_LICENSE("GPL");
@@ -156,6 +167,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        static int printed_version;
        unsigned int i;
        int rc;
+       struct ata_port_info *ppi;
        struct ata_probe_ent *probe_ent;
        u8 tmp8;
 
@@ -196,41 +208,17 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        if (rc)
                goto err_out_regions;
 
-       probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL);
+       ppi = &svia_port_info;
+       probe_ent = ata_pci_init_native_mode(pdev, &ppi);
        if (!probe_ent) {
                printk(KERN_ERR DRV_NAME "(%s): out of memory\n",
                       pci_name(pdev));
                rc = -ENOMEM;
                goto err_out_regions;
        }
-       memset(probe_ent, 0, sizeof(*probe_ent));
-       INIT_LIST_HEAD(&probe_ent->node);
-       probe_ent->pdev = pdev;
-       probe_ent->sht = &svia_sht;
-       probe_ent->host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST |
-                               ATA_FLAG_NO_LEGACY;
-       probe_ent->port_ops = &svia_sata_ops;
-       probe_ent->n_ports = 2;
-       probe_ent->irq = pdev->irq;
-       probe_ent->irq_flags = SA_SHIRQ;
-       probe_ent->pio_mask = 0x1f;
-       probe_ent->udma_mask = 0x7f;
-
-       probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0);
-       ata_std_ports(&probe_ent->port[0]);
-       probe_ent->port[0].altstatus_addr =
-       probe_ent->port[0].ctl_addr =
-               pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS;
-       probe_ent->port[0].bmdma_addr = pci_resource_start(pdev, 4);
+
        probe_ent->port[0].scr_addr =
                svia_scr_addr(pci_resource_start(pdev, 5), 0);
-
-       probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2);
-       ata_std_ports(&probe_ent->port[1]);
-       probe_ent->port[1].altstatus_addr =
-       probe_ent->port[1].ctl_addr =
-               pci_resource_start(pdev, 3) | ATA_PCI_CTL_OFS;
-       probe_ent->port[1].bmdma_addr = pci_resource_start(pdev, 4) + 8;
        probe_ent->port[1].scr_addr =
                svia_scr_addr(pci_resource_start(pdev, 5), 1);