Commit faf8ec06 authored by Jeff Garzik's avatar Jeff Garzik

Merge pobox.com:/spare/repo/linux-2.6

into pobox.com:/spare/repo/libata-2.6
parents 5c5b9c24 cbda3cb1
...@@ -125,15 +125,15 @@ static struct ata_port_operations piix_pata_ops = { ...@@ -125,15 +125,15 @@ static struct ata_port_operations piix_pata_ops = {
.set_piomode = piix_set_piomode, .set_piomode = piix_set_piomode,
.set_dmamode = piix_set_dmamode, .set_dmamode = piix_set_dmamode,
.tf_load = ata_tf_load_pio, .tf_load = ata_tf_load,
.tf_read = ata_tf_read_pio, .tf_read = ata_tf_read,
.check_status = ata_check_status_pio, .check_status = ata_check_status,
.exec_command = ata_exec_command_pio, .exec_command = ata_exec_command,
.phy_reset = piix_pata_phy_reset, .phy_reset = piix_pata_phy_reset,
.bmdma_setup = ata_bmdma_setup_pio, .bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start_pio, .bmdma_start = ata_bmdma_start,
.qc_prep = ata_qc_prep, .qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot, .qc_issue = ata_qc_issue_prot,
...@@ -149,15 +149,15 @@ static struct ata_port_operations piix_pata_ops = { ...@@ -149,15 +149,15 @@ static struct ata_port_operations piix_pata_ops = {
static struct ata_port_operations piix_sata_ops = { static struct ata_port_operations piix_sata_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = ata_tf_load_pio, .tf_load = ata_tf_load,
.tf_read = ata_tf_read_pio, .tf_read = ata_tf_read,
.check_status = ata_check_status_pio, .check_status = ata_check_status,
.exec_command = ata_exec_command_pio, .exec_command = ata_exec_command,
.phy_reset = piix_sata_phy_reset, .phy_reset = piix_sata_phy_reset,
.bmdma_setup = ata_bmdma_setup_pio, .bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start_pio, .bmdma_start = ata_bmdma_start,
.qc_prep = ata_qc_prep, .qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot, .qc_issue = ata_qc_issue_prot,
......
This diff is collapsed.
...@@ -50,8 +50,6 @@ ...@@ -50,8 +50,6 @@
#define NV_PIO_MASK 0x1f #define NV_PIO_MASK 0x1f
#define NV_MWDMA_MASK 0x07 #define NV_MWDMA_MASK 0x07
#define NV_UDMA_MASK 0x7f #define NV_UDMA_MASK 0x7f
#define NV_PORT0_BMDMA_REG_OFFSET 0x00
#define NV_PORT1_BMDMA_REG_OFFSET 0x08
#define NV_PORT0_SCR_REG_OFFSET 0x00 #define NV_PORT0_SCR_REG_OFFSET 0x00
#define NV_PORT1_SCR_REG_OFFSET 0x40 #define NV_PORT1_SCR_REG_OFFSET 0x40
...@@ -187,7 +185,7 @@ static Scsi_Host_Template nv_sht = { ...@@ -187,7 +185,7 @@ static Scsi_Host_Template nv_sht = {
.eh_strategy_handler = ata_scsi_error, .eh_strategy_handler = ata_scsi_error,
.can_queue = ATA_DEF_QUEUE, .can_queue = ATA_DEF_QUEUE,
.this_id = ATA_SHT_THIS_ID, .this_id = ATA_SHT_THIS_ID,
.sg_tablesize = ATA_MAX_PRD, .sg_tablesize = LIBATA_MAX_PRD,
.max_sectors = ATA_MAX_SECTORS, .max_sectors = ATA_MAX_SECTORS,
.cmd_per_lun = ATA_SHT_CMD_PER_LUN, .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
.emulated = ATA_SHT_EMULATED, .emulated = ATA_SHT_EMULATED,
...@@ -200,13 +198,13 @@ static Scsi_Host_Template nv_sht = { ...@@ -200,13 +198,13 @@ static Scsi_Host_Template nv_sht = {
static struct ata_port_operations nv_ops = { static struct ata_port_operations nv_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = ata_tf_load_pio, .tf_load = ata_tf_load,
.tf_read = ata_tf_read_pio, .tf_read = ata_tf_read,
.exec_command = ata_exec_command_pio, .exec_command = ata_exec_command,
.check_status = ata_check_status_pio, .check_status = ata_check_status,
.phy_reset = sata_phy_reset, .phy_reset = sata_phy_reset,
.bmdma_setup = ata_bmdma_setup_pio, .bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start_pio, .bmdma_start = ata_bmdma_start,
.qc_prep = ata_qc_prep, .qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot, .qc_issue = ata_qc_issue_prot,
.eng_timeout = ata_eng_timeout, .eng_timeout = ata_eng_timeout,
...@@ -219,6 +217,18 @@ static struct ata_port_operations nv_ops = { ...@@ -219,6 +217,18 @@ static struct ata_port_operations nv_ops = {
.host_stop = nv_host_stop, .host_stop = nv_host_stop,
}; };
static struct ata_port_info nv_port_info = {
.sht = &nv_sht,
.host_flags = ATA_FLAG_SATA |
ATA_FLAG_SATA_RESET |
ATA_FLAG_SRST |
ATA_FLAG_NO_LEGACY,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
.udma_mask = NV_UDMA_MASK,
.port_ops = &nv_ops,
};
MODULE_AUTHOR("NVIDIA"); MODULE_AUTHOR("NVIDIA");
MODULE_DESCRIPTION("low-level driver for NVIDIA nForce SATA controller"); MODULE_DESCRIPTION("low-level driver for NVIDIA nForce SATA controller");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -299,6 +309,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -299,6 +309,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
static int printed_version = 0; static int printed_version = 0;
struct nv_host *host; struct nv_host *host;
struct ata_port_info *ppi;
struct ata_probe_ent *probe_ent = NULL; struct ata_probe_ent *probe_ent = NULL;
int rc; int rc;
...@@ -320,7 +331,8 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -320,7 +331,8 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc) if (rc)
goto err_out_regions; goto err_out_regions;
probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); ppi = &nv_port_info;
probe_ent = ata_pci_init_native_mode(pdev, &ppi);
if (!probe_ent) { if (!probe_ent) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_regions; goto err_out_regions;
...@@ -334,40 +346,6 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -334,40 +346,6 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
host->host_desc = &nv_device_tbl[ent->driver_data]; host->host_desc = &nv_device_tbl[ent->driver_data];
memset(probe_ent, 0, sizeof(*probe_ent));
INIT_LIST_HEAD(&probe_ent->node);
probe_ent->pdev = pdev;
probe_ent->sht = &nv_sht;
probe_ent->host_flags = ATA_FLAG_SATA |
ATA_FLAG_SATA_RESET |
ATA_FLAG_SRST |
ATA_FLAG_NO_LEGACY;
probe_ent->port_ops = &nv_ops;
probe_ent->n_ports = NV_PORTS;
probe_ent->irq = pdev->irq;
probe_ent->irq_flags = SA_SHIRQ;
probe_ent->pio_mask = NV_PIO_MASK;
probe_ent->mwdma_mask = NV_MWDMA_MASK;
probe_ent->udma_mask = NV_UDMA_MASK;
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) | NV_PORT0_BMDMA_REG_OFFSET;
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) | NV_PORT1_BMDMA_REG_OFFSET;
probe_ent->private_data = host; probe_ent->private_data = host;
if (host->host_desc->host_flags & NV_HOST_FLAGS_SCR_MMIO) { if (host->host_desc->host_flags & NV_HOST_FLAGS_SCR_MMIO) {
......
...@@ -107,8 +107,8 @@ static Scsi_Host_Template pdc_sata_sht = { ...@@ -107,8 +107,8 @@ static Scsi_Host_Template pdc_sata_sht = {
static struct ata_port_operations pdc_sata_ops = { static struct ata_port_operations pdc_sata_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = pdc_tf_load_mmio, .tf_load = pdc_tf_load_mmio,
.tf_read = ata_tf_read_mmio, .tf_read = ata_tf_read,
.check_status = ata_check_status_mmio, .check_status = ata_check_status,
.exec_command = pdc_exec_command_mmio, .exec_command = pdc_exec_command_mmio,
.phy_reset = pdc_phy_reset, .phy_reset = pdc_phy_reset,
.qc_prep = pdc_qc_prep, .qc_prep = pdc_qc_prep,
...@@ -468,7 +468,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) ...@@ -468,7 +468,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
{ {
WARN_ON (tf->protocol == ATA_PROT_DMA || WARN_ON (tf->protocol == ATA_PROT_DMA ||
tf->protocol == ATA_PROT_NODATA); tf->protocol == ATA_PROT_NODATA);
ata_tf_load_mmio(ap, tf); ata_tf_load(ap, tf);
} }
...@@ -476,7 +476,7 @@ static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) ...@@ -476,7 +476,7 @@ static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
{ {
WARN_ON (tf->protocol == ATA_PROT_DMA || WARN_ON (tf->protocol == ATA_PROT_DMA ||
tf->protocol == ATA_PROT_NODATA); tf->protocol == ATA_PROT_NODATA);
ata_exec_command_mmio(ap, tf); ata_exec_command(ap, tf);
} }
......
...@@ -125,14 +125,14 @@ static Scsi_Host_Template sil_sht = { ...@@ -125,14 +125,14 @@ static Scsi_Host_Template sil_sht = {
static struct ata_port_operations sil_ops = { static struct ata_port_operations sil_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.dev_config = sil_dev_config, .dev_config = sil_dev_config,
.tf_load = ata_tf_load_mmio, .tf_load = ata_tf_load,
.tf_read = ata_tf_read_mmio, .tf_read = ata_tf_read,
.check_status = ata_check_status_mmio, .check_status = ata_check_status,
.exec_command = ata_exec_command_mmio, .exec_command = ata_exec_command,
.phy_reset = sata_phy_reset, .phy_reset = sata_phy_reset,
.post_set_mode = sil_post_set_mode, .post_set_mode = sil_post_set_mode,
.bmdma_setup = ata_bmdma_setup_mmio, .bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start_mmio, .bmdma_start = ata_bmdma_start,
.qc_prep = ata_qc_prep, .qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot, .qc_issue = ata_qc_issue_prot,
.eng_timeout = ata_eng_timeout, .eng_timeout = ata_eng_timeout,
......
...@@ -94,13 +94,13 @@ static Scsi_Host_Template sis_sht = { ...@@ -94,13 +94,13 @@ static Scsi_Host_Template sis_sht = {
static struct ata_port_operations sis_ops = { static struct ata_port_operations sis_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = ata_tf_load_pio, .tf_load = ata_tf_load,
.tf_read = ata_tf_read_pio, .tf_read = ata_tf_read,
.check_status = ata_check_status_pio, .check_status = ata_check_status,
.exec_command = ata_exec_command_pio, .exec_command = ata_exec_command,
.phy_reset = sata_phy_reset, .phy_reset = sata_phy_reset,
.bmdma_setup = ata_bmdma_setup_pio, .bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start_pio, .bmdma_start = ata_bmdma_start,
.qc_prep = ata_qc_prep, .qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot, .qc_issue = ata_qc_issue_prot,
.eng_timeout = ata_eng_timeout, .eng_timeout = ata_eng_timeout,
...@@ -112,6 +112,16 @@ static struct ata_port_operations sis_ops = { ...@@ -112,6 +112,16 @@ static struct ata_port_operations sis_ops = {
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
}; };
static struct ata_port_info sis_port_info = {
.sht = &sis_sht,
.host_flags = ATA_FLAG_SATA | ATA_FLAG_SATA_RESET |
ATA_FLAG_NO_LEGACY,
.pio_mask = 0x1f,
.mwdma_mask = 0x7,
.udma_mask = 0x7f,
.port_ops = &sis_ops,
};
MODULE_AUTHOR("Uwe Koziolek"); MODULE_AUTHOR("Uwe Koziolek");
MODULE_DESCRIPTION("low-level driver for Silicon Integratad Systems SATA controller"); MODULE_DESCRIPTION("low-level driver for Silicon Integratad Systems SATA controller");
...@@ -185,6 +195,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -185,6 +195,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
struct ata_probe_ent *probe_ent = NULL; struct ata_probe_ent *probe_ent = NULL;
int rc; int rc;
u32 genctl; u32 genctl;
struct ata_port_info *ppi;
rc = pci_enable_device(pdev); rc = pci_enable_device(pdev);
if (rc) if (rc)
...@@ -201,20 +212,13 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -201,20 +212,13 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc) if (rc)
goto err_out_regions; goto err_out_regions;
probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); ppi = &sis_port_info;
probe_ent = ata_pci_init_native_mode(pdev, &ppi);
if (!probe_ent) { if (!probe_ent) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_regions; goto err_out_regions;
} }
memset(probe_ent, 0, sizeof(*probe_ent));
probe_ent->pdev = pdev;
INIT_LIST_HEAD(&probe_ent->node);
probe_ent->sht = &sis_sht;
probe_ent->host_flags = ATA_FLAG_SATA | ATA_FLAG_SATA_RESET |
ATA_FLAG_NO_LEGACY;
/* check and see if the SCRs are in IO space or PCI cfg space */ /* check and see if the SCRs are in IO space or PCI cfg space */
pci_read_config_dword(pdev, SIS_GENCTL, &genctl); pci_read_config_dword(pdev, SIS_GENCTL, &genctl);
if ((genctl & GENCTL_IOMAPPED_SCR) == 0) if ((genctl & GENCTL_IOMAPPED_SCR) == 0)
...@@ -231,32 +235,12 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -231,32 +235,12 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
probe_ent->host_flags |= SIS_FLAG_CFGSCR; probe_ent->host_flags |= SIS_FLAG_CFGSCR;
} }
probe_ent->pio_mask = 0x1f; if (!(probe_ent->host_flags & SIS_FLAG_CFGSCR)) {
probe_ent->mwdma_mask = 0x7;
probe_ent->udma_mask = 0x7f;
probe_ent->port_ops = &sis_ops;
probe_ent->port[0].cmd_addr = pci_resource_start(pdev, 0);
ata_std_ports(&probe_ent->port[0]);
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);
if (!(probe_ent->host_flags & SIS_FLAG_CFGSCR))
probe_ent->port[0].scr_addr = probe_ent->port[0].scr_addr =
pci_resource_start(pdev, SIS_SCR_PCI_BAR); pci_resource_start(pdev, SIS_SCR_PCI_BAR);
probe_ent->port[1].cmd_addr = pci_resource_start(pdev, 2);
ata_std_ports(&probe_ent->port[1]);
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;
if (!(probe_ent->host_flags & SIS_FLAG_CFGSCR))
probe_ent->port[1].scr_addr = probe_ent->port[1].scr_addr =
pci_resource_start(pdev, SIS_SCR_PCI_BAR) + 64; pci_resource_start(pdev, SIS_SCR_PCI_BAR) + 64;
}
probe_ent->n_ports = 2;
probe_ent->irq = pdev->irq;
probe_ent->irq_flags = SA_SHIRQ;
pci_set_master(pdev); pci_set_master(pdev);
pci_enable_intx(pdev); pci_enable_intx(pdev);
......
...@@ -148,6 +148,72 @@ static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) ...@@ -148,6 +148,72 @@ static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
} }
} }
/**
* k2_bmdma_setup_mmio - Set up PCI IDE BMDMA transaction (MMIO)
* @qc: Info associated with this ATA transaction.
*
* LOCKING:
* spin_lock_irqsave(host_set lock)
*/
void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
u8 dmactl;
void *mmio = (void *) ap->ioaddr.bmdma_addr;
/* load PRD table addr. */
mb(); /* make sure PRD table writes are visible to controller */
writel(ap->prd_dma, mmio + ATA_DMA_TABLE_OFS);
/* specify data direction, triple-check start bit is clear */
dmactl = readb(mmio + ATA_DMA_CMD);
dmactl &= ~(ATA_DMA_WR | ATA_DMA_START);
if (!rw)
dmactl |= ATA_DMA_WR;
writeb(dmactl, mmio + ATA_DMA_CMD);
/* issue r/w command if this is not a ATA DMA command*/
if (qc->tf.protocol != ATA_PROT_DMA)
ap->ops->exec_command(ap, &qc->tf);
}
/**
* k2_bmdma_start_mmio - Start a PCI IDE BMDMA transaction (MMIO)
* @qc: Info associated with this ATA transaction.
*
* LOCKING:
* spin_lock_irqsave(host_set lock)
*/
void k2_bmdma_start_mmio (struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
void *mmio = (void *) ap->ioaddr.bmdma_addr;
u8 dmactl;
/* start host DMA transaction */
dmactl = readb(mmio + ATA_DMA_CMD);
writeb(dmactl | ATA_DMA_START, mmio + ATA_DMA_CMD);
/* There is a race condition in certain SATA controllers that can
be seen when the r/w command is given to the controller before the
host DMA is started. On a Read command, the controller would initiate
the command to the drive even before it sees the DMA start. When there
are very fast drives connected to the controller, or when the data request
hits in the drive cache, there is the possibility that the drive returns a part
or all of the requested data to the controller before the DMA start is issued.
In this case, the controller would become confused as to what to do with the data.
In the worst case when all the data is returned back to the controller, the
controller could hang. In other cases it could return partial data returning
in data corruption. This problem has been seen in PPC systems and can also appear
on an system with very fast disks, where the SATA controller is sitting behind a
number of bridges, and hence there is significant latency between the r/w command
and the start command. */
/* issue r/w command if the access is to ATA*/
if (qc->tf.protocol == ATA_PROT_DMA)
ap->ops->exec_command(ap, &qc->tf);
}
static u8 k2_stat_check_status(struct ata_port *ap) static u8 k2_stat_check_status(struct ata_port *ap)
{ {
...@@ -230,10 +296,10 @@ static struct ata_port_operations k2_sata_ops = { ...@@ -230,10 +296,10 @@ static struct ata_port_operations k2_sata_ops = {
.tf_load = k2_sata_tf_load, .tf_load = k2_sata_tf_load,
.tf_read = k2_sata_tf_read, .tf_read = k2_sata_tf_read,
.check_status = k2_stat_check_status, .check_status = k2_stat_check_status,
.exec_command = ata_exec_command_mmio, .exec_command = ata_exec_command,
.phy_reset = sata_phy_reset, .phy_reset = sata_phy_reset,
.bmdma_setup = ata_bmdma_setup_mmio, .bmdma_setup = k2_bmdma_setup_mmio,
.bmdma_start = ata_bmdma_start_mmio, .bmdma_start = k2_bmdma_start_mmio,
.qc_prep = ata_qc_prep, .qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot, .qc_issue = ata_qc_issue_prot,
.eng_timeout = ata_eng_timeout, .eng_timeout = ata_eng_timeout,
...@@ -373,6 +439,8 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -373,6 +439,8 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
static struct pci_device_id k2_sata_pci_tbl[] = { static struct pci_device_id k2_sata_pci_tbl[] = {
{ 0x1166, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { 0x1166, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ } { }
}; };
......
...@@ -193,8 +193,8 @@ static Scsi_Host_Template pdc_sata_sht = { ...@@ -193,8 +193,8 @@ static Scsi_Host_Template pdc_sata_sht = {
static struct ata_port_operations pdc_20621_ops = { static struct ata_port_operations pdc_20621_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = pdc_tf_load_mmio, .tf_load = pdc_tf_load_mmio,
.tf_read = ata_tf_read_mmio, .tf_read = ata_tf_read,
.check_status = ata_check_status_mmio, .check_status = ata_check_status,
.exec_command = pdc_exec_command_mmio, .exec_command = pdc_exec_command_mmio,
.phy_reset = pdc_20621_phy_reset, .phy_reset = pdc_20621_phy_reset,
.qc_prep = pdc20621_qc_prep, .qc_prep = pdc20621_qc_prep,
...@@ -887,7 +887,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) ...@@ -887,7 +887,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
{ {
WARN_ON (tf->protocol == ATA_PROT_DMA || WARN_ON (tf->protocol == ATA_PROT_DMA ||
tf->protocol == ATA_PROT_NODATA); tf->protocol == ATA_PROT_NODATA);
ata_tf_load_mmio(ap, tf); ata_tf_load(ap, tf);
} }
...@@ -895,7 +895,7 @@ static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) ...@@ -895,7 +895,7 @@ static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
{ {
WARN_ON (tf->protocol == ATA_PROT_DMA || WARN_ON (tf->protocol == ATA_PROT_DMA ||
tf->protocol == ATA_PROT_NODATA); tf->protocol == ATA_PROT_NODATA);
ata_exec_command_mmio(ap, tf); ata_exec_command(ap, tf);
} }
......
...@@ -100,15 +100,15 @@ static Scsi_Host_Template svia_sht = { ...@@ -100,15 +100,15 @@ static Scsi_Host_Template svia_sht = {
static struct ata_port_operations svia_sata_ops = { static struct ata_port_operations svia_sata_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = ata_tf_load_pio, .tf_load = ata_tf_load,
.tf_read = ata_tf_read_pio, .tf_read = ata_tf_read,
.check_status = ata_check_status_pio, .check_status = ata_check_status,
.exec_command = ata_exec_command_pio, .exec_command = ata_exec_command,
.phy_reset = sata_phy_reset, .phy_reset = sata_phy_reset,
.bmdma_setup = ata_bmdma_setup_pio, .bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start_pio, .bmdma_start = ata_bmdma_start,
.qc_prep = ata_qc_prep, .qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot, .qc_issue = ata_qc_issue_prot,
...@@ -124,6 +124,15 @@ static struct ata_port_operations svia_sata_ops = { ...@@ -124,6 +124,15 @@ static struct ata_port_operations svia_sata_ops = {
.port_stop = ata_port_stop, .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_AUTHOR("Jeff Garzik");
MODULE_DESCRIPTION("SCSI low-level driver for VIA SATA controllers"); MODULE_DESCRIPTION("SCSI low-level driver for VIA SATA controllers");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -157,6 +166,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -157,6 +166,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
static int printed_version; static int printed_version;
unsigned int i; unsigned int i;
int rc; int rc;
struct ata_port_info *ppi;
struct ata_probe_ent *probe_ent; struct ata_probe_ent *probe_ent;
u8 tmp8; u8 tmp8;
...@@ -197,42 +207,17 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -197,42 +207,17 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc) if (rc)
goto err_out_regions; 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) { if (!probe_ent) {
printk(KERN_ERR DRV_NAME "(%s): out of memory\n", printk(KERN_ERR DRV_NAME "(%s): out of memory\n",
pci_name(pdev)); pci_name(pdev));
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_regions; 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->mwdma_mask = 0x07;
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 = probe_ent->port[0].scr_addr =
svia_scr_addr(pci_resource_start(pdev, 5), 0); 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 = probe_ent->port[1].scr_addr =
svia_scr_addr(pci_resource_start(pdev, 5), 1); svia_scr_addr(pci_resource_start(pdev, 5), 1);
......
...@@ -211,11 +211,11 @@ static struct ata_port_operations vsc_sata_ops = { ...@@ -211,11 +211,11 @@ static struct ata_port_operations vsc_sata_ops = {
.port_disable = ata_port_disable, .port_disable = ata_port_disable,
.tf_load = vsc_sata_tf_load, .tf_load = vsc_sata_tf_load,
.tf_read = vsc_sata_tf_read, .tf_read = vsc_sata_tf_read,
.exec_command = ata_exec_command_mmio, .exec_command = ata_exec_command,
.check_status = ata_check_status_mmio, .check_status = ata_check_status,
.phy_reset = sata_phy_reset, .phy_reset = sata_phy_reset,
.bmdma_setup = ata_bmdma_setup_mmio, .bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start_mmio, .bmdma_start = ata_bmdma_start,
.qc_prep = ata_qc_prep, .qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot, .qc_issue = ata_qc_issue_prot,
.eng_timeout = ata_eng_timeout, .eng_timeout = ata_eng_timeout,
......
...@@ -379,19 +379,19 @@ extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc ...@@ -379,19 +379,19 @@ extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc
/* /*
* Default driver ops implementations * Default driver ops implementations
*/ */
extern void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf); extern void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf);
extern void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
extern void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf);
extern void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf);
extern void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp); extern void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp);
extern void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf); extern void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf);
extern u8 ata_check_status_pio(struct ata_port *ap); extern u8 ata_check_status(struct ata_port *ap);
extern u8 ata_check_status_mmio(struct ata_port *ap); extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf);
extern void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf);
extern void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf);
extern int ata_port_start (struct ata_port *ap); extern int ata_port_start (struct ata_port *ap);
extern void ata_port_stop (struct ata_port *ap); extern void ata_port_stop (struct ata_port *ap);
extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
extern struct ata_probe_ent *
ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port);
extern struct ata_probe_ent *
ata_pci_init_legacy_mode(struct pci_dev *pdev, struct ata_port_info **port);
extern void ata_qc_prep(struct ata_queued_cmd *qc); extern void ata_qc_prep(struct ata_queued_cmd *qc);
extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); extern int ata_qc_issue_prot(struct ata_queued_cmd *qc);
extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
...@@ -400,10 +400,8 @@ extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, ...@@ -400,10 +400,8 @@ extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
unsigned int n_elem); unsigned int n_elem);
extern void ata_dev_id_string(struct ata_device *dev, unsigned char *s, extern void ata_dev_id_string(struct ata_device *dev, unsigned char *s,
unsigned int ofs, unsigned int len); unsigned int ofs, unsigned int len);
extern void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc); extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
extern void ata_bmdma_start_mmio (struct ata_queued_cmd *qc); extern void ata_bmdma_start (struct ata_queued_cmd *qc);
extern void ata_bmdma_setup_pio (struct ata_queued_cmd *qc);
extern void ata_bmdma_start_pio (struct ata_queued_cmd *qc);
extern void ata_bmdma_irq_clear(struct ata_port *ap); extern void ata_bmdma_irq_clear(struct ata_port *ap);
extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits);
extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat); extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment