2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* sata_sil.c - Silicon Image SATA
|
|
|
|
*
|
2013-05-15 01:09:50 +07:00
|
|
|
* Maintained by: Tejun Heo <tj@kernel.org>
|
2005-04-17 05:20:36 +07:00
|
|
|
* Please ALWAYS copy linux-ide@vger.kernel.org
|
|
|
|
* on emails.
|
|
|
|
*
|
2005-08-29 07:18:39 +07:00
|
|
|
* Copyright 2003-2005 Red Hat, Inc.
|
2005-04-17 05:20:36 +07:00
|
|
|
* Copyright 2003 Benjamin Herrenschmidt
|
|
|
|
*
|
2005-08-29 07:18:39 +07:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* libata documentation is available via 'make {ps|pdf}docs',
|
|
|
|
* as Documentation/DocBook/libata.*
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
2005-08-27 06:46:24 +07:00
|
|
|
* Documentation for SiI 3112:
|
|
|
|
* http://gkernel.sourceforge.net/specs/sii/3112A_SiI-DS-0095-B2.pdf.bz2
|
|
|
|
*
|
|
|
|
* Other errata and documentation available under NDA.
|
|
|
|
*
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/blkdev.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/interrupt.h>
|
2005-10-31 02:39:11 +07:00
|
|
|
#include <linux/device.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <scsi/scsi_host.h>
|
|
|
|
#include <linux/libata.h>
|
2009-01-29 06:30:56 +07:00
|
|
|
#include <linux/dmi.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#define DRV_NAME "sata_sil"
|
2008-12-25 08:06:06 +07:00
|
|
|
#define DRV_VERSION "2.4"
|
|
|
|
|
|
|
|
#define SIL_DMA_BOUNDARY 0x7fffffffUL
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
enum {
|
2007-02-01 13:06:36 +07:00
|
|
|
SIL_MMIO_BAR = 5,
|
|
|
|
|
2006-03-05 14:03:52 +07:00
|
|
|
/*
|
|
|
|
* host flags
|
|
|
|
*/
|
2006-06-26 19:23:52 +07:00
|
|
|
SIL_FLAG_NO_SATA_IRQ = (1 << 28),
|
2006-02-25 11:52:30 +07:00
|
|
|
SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29),
|
2005-08-23 05:27:25 +07:00
|
|
|
SIL_FLAG_MOD15WRITE = (1 << 30),
|
2006-05-31 16:27:53 +07:00
|
|
|
|
2011-02-05 02:05:48 +07:00
|
|
|
SIL_DFL_PORT_FLAGS = ATA_FLAG_SATA,
|
2005-08-23 05:27:25 +07:00
|
|
|
|
2006-03-05 14:03:52 +07:00
|
|
|
/*
|
|
|
|
* Controller IDs
|
|
|
|
*/
|
2005-04-17 05:20:36 +07:00
|
|
|
sil_3112 = 0,
|
2006-06-26 19:23:52 +07:00
|
|
|
sil_3112_no_sata_irq = 1,
|
|
|
|
sil_3512 = 2,
|
|
|
|
sil_3114 = 3,
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-03-05 14:03:52 +07:00
|
|
|
/*
|
|
|
|
* Register offsets
|
|
|
|
*/
|
2005-04-17 05:20:36 +07:00
|
|
|
SIL_SYSCFG = 0x48,
|
2006-03-05 14:03:52 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Register bits
|
|
|
|
*/
|
|
|
|
/* SYSCFG */
|
2005-04-17 05:20:36 +07:00
|
|
|
SIL_MASK_IDE0_INT = (1 << 22),
|
|
|
|
SIL_MASK_IDE1_INT = (1 << 23),
|
|
|
|
SIL_MASK_IDE2_INT = (1 << 24),
|
|
|
|
SIL_MASK_IDE3_INT = (1 << 25),
|
|
|
|
SIL_MASK_2PORT = SIL_MASK_IDE0_INT | SIL_MASK_IDE1_INT,
|
|
|
|
SIL_MASK_4PORT = SIL_MASK_2PORT |
|
|
|
|
SIL_MASK_IDE2_INT | SIL_MASK_IDE3_INT,
|
|
|
|
|
2006-03-05 14:03:52 +07:00
|
|
|
/* BMDMA/BMDMA2 */
|
2005-04-17 05:20:36 +07:00
|
|
|
SIL_INTR_STEERING = (1 << 1),
|
2006-03-05 14:03:52 +07:00
|
|
|
|
2006-05-31 16:27:53 +07:00
|
|
|
SIL_DMA_ENABLE = (1 << 0), /* DMA run switch */
|
|
|
|
SIL_DMA_RDWR = (1 << 3), /* DMA Rd-Wr */
|
|
|
|
SIL_DMA_SATA_IRQ = (1 << 4), /* OR of all SATA IRQs */
|
|
|
|
SIL_DMA_ACTIVE = (1 << 16), /* DMA running */
|
|
|
|
SIL_DMA_ERROR = (1 << 17), /* PCI bus error */
|
|
|
|
SIL_DMA_COMPLETE = (1 << 18), /* cmd complete / IRQ pending */
|
|
|
|
SIL_DMA_N_SATA_IRQ = (1 << 6), /* SATA_IRQ for the next channel */
|
|
|
|
SIL_DMA_N_ACTIVE = (1 << 24), /* ACTIVE for the next channel */
|
|
|
|
SIL_DMA_N_ERROR = (1 << 25), /* ERROR for the next channel */
|
|
|
|
SIL_DMA_N_COMPLETE = (1 << 26), /* COMPLETE for the next channel */
|
|
|
|
|
|
|
|
/* SIEN */
|
|
|
|
SIL_SIEN_N = (1 << 16), /* triggered by SError.N */
|
|
|
|
|
2006-03-05 14:03:52 +07:00
|
|
|
/*
|
|
|
|
* Others
|
|
|
|
*/
|
2005-04-17 05:20:36 +07:00
|
|
|
SIL_QUIRK_MOD15WRITE = (1 << 0),
|
|
|
|
SIL_QUIRK_UDMA5MAX = (1 << 1),
|
|
|
|
};
|
|
|
|
|
2007-10-26 11:03:37 +07:00
|
|
|
static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
|
2014-05-07 22:17:44 +07:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2006-07-03 14:07:27 +07:00
|
|
|
static int sil_pci_device_resume(struct pci_dev *pdev);
|
2006-08-15 12:49:30 +07:00
|
|
|
#endif
|
2007-03-02 07:56:15 +07:00
|
|
|
static void sil_dev_config(struct ata_device *dev);
|
2008-07-31 15:02:40 +07:00
|
|
|
static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
|
|
|
|
static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
|
2007-08-06 16:36:23 +07:00
|
|
|
static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed);
|
2008-12-25 08:06:06 +07:00
|
|
|
static void sil_qc_prep(struct ata_queued_cmd *qc);
|
|
|
|
static void sil_bmdma_setup(struct ata_queued_cmd *qc);
|
|
|
|
static void sil_bmdma_start(struct ata_queued_cmd *qc);
|
|
|
|
static void sil_bmdma_stop(struct ata_queued_cmd *qc);
|
2006-05-15 18:58:27 +07:00
|
|
|
static void sil_freeze(struct ata_port *ap);
|
|
|
|
static void sil_thaw(struct ata_port *ap);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-30 16:42:52 +07:00
|
|
|
|
2005-11-10 23:04:11 +07:00
|
|
|
static const struct pci_device_id sil_pci_tbl[] = {
|
2006-09-28 09:20:11 +07:00
|
|
|
{ PCI_VDEVICE(CMD, 0x3112), sil_3112 },
|
|
|
|
{ PCI_VDEVICE(CMD, 0x0240), sil_3112 },
|
|
|
|
{ PCI_VDEVICE(CMD, 0x3512), sil_3512 },
|
|
|
|
{ PCI_VDEVICE(CMD, 0x3114), sil_3114 },
|
|
|
|
{ PCI_VDEVICE(ATI, 0x436e), sil_3112 },
|
|
|
|
{ PCI_VDEVICE(ATI, 0x4379), sil_3112_no_sata_irq },
|
|
|
|
{ PCI_VDEVICE(ATI, 0x437a), sil_3112_no_sata_irq },
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
{ } /* terminate list */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* TODO firmware versions should be added - eric */
|
|
|
|
static const struct sil_drivelist {
|
2007-10-26 11:03:37 +07:00
|
|
|
const char *product;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned int quirk;
|
|
|
|
} sil_blacklist [] = {
|
|
|
|
{ "ST320012AS", SIL_QUIRK_MOD15WRITE },
|
|
|
|
{ "ST330013AS", SIL_QUIRK_MOD15WRITE },
|
|
|
|
{ "ST340017AS", SIL_QUIRK_MOD15WRITE },
|
|
|
|
{ "ST360015AS", SIL_QUIRK_MOD15WRITE },
|
|
|
|
{ "ST380023AS", SIL_QUIRK_MOD15WRITE },
|
|
|
|
{ "ST3120023AS", SIL_QUIRK_MOD15WRITE },
|
|
|
|
{ "ST340014ASL", SIL_QUIRK_MOD15WRITE },
|
|
|
|
{ "ST360014ASL", SIL_QUIRK_MOD15WRITE },
|
|
|
|
{ "ST380011ASL", SIL_QUIRK_MOD15WRITE },
|
|
|
|
{ "ST3120022ASL", SIL_QUIRK_MOD15WRITE },
|
|
|
|
{ "ST3160021ASL", SIL_QUIRK_MOD15WRITE },
|
2014-02-03 22:42:07 +07:00
|
|
|
{ "TOSHIBA MK2561GSYN", SIL_QUIRK_MOD15WRITE },
|
2005-04-17 05:20:36 +07:00
|
|
|
{ "Maxtor 4D060H3", SIL_QUIRK_UDMA5MAX },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pci_driver sil_pci_driver = {
|
|
|
|
.name = DRV_NAME,
|
|
|
|
.id_table = sil_pci_tbl,
|
|
|
|
.probe = sil_init_one,
|
|
|
|
.remove = ata_pci_remove_one,
|
2014-05-07 22:17:44 +07:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2006-07-03 14:07:27 +07:00
|
|
|
.suspend = ata_pci_device_suspend,
|
|
|
|
.resume = sil_pci_device_resume,
|
2006-08-15 12:49:30 +07:00
|
|
|
#endif
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
2005-11-07 12:59:37 +07:00
|
|
|
static struct scsi_host_template sil_sht = {
|
2008-12-25 08:06:06 +07:00
|
|
|
ATA_BASE_SHT(DRV_NAME),
|
|
|
|
/** These controllers support Large Block Transfer which allows
|
|
|
|
transfer chunks up to 2GB and which cross 64KB boundaries,
|
|
|
|
therefore the DMA limits are more relaxed than standard ATA SFF. */
|
|
|
|
.dma_boundary = SIL_DMA_BOUNDARY,
|
|
|
|
.sg_tablesize = ATA_MAX_PRD
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
libata: implement and use ops inheritance
libata lets low level drivers build ata_port_operations table and
register it with libata core layer. This allows low level drivers
high level of flexibility but also burdens them with lots of
boilerplate entries.
This becomes worse for drivers which support related similar
controllers which differ slightly. They share most of the operations
except for a few. However, the driver still needs to list all
operations for each variant. This results in large number of
duplicate entries, which is not only inefficient but also error-prone
as it becomes very difficult to tell what the actual differences are.
This duplicate boilerplates all over the low level drivers also make
updating the core layer exteremely difficult and error-prone. When
compounded with multi-branched development model, it ends up
accumulating inconsistencies over time. Some of those inconsistencies
cause immediate problems and fixed. Others just remain there dormant
making maintenance increasingly difficult.
To rectify the problem, this patch implements ata_port_operations
inheritance. To allow LLDs to easily re-use their own ops tables
overriding only specific methods, this patch implements poor man's
class inheritance. An ops table has ->inherits field which can be set
to any ops table as long as it doesn't create a loop. When the host
is started, the inheritance chain is followed and any operation which
isn't specified is taken from the nearest ancestor which has it
specified. This operation is called finalization and done only once
per an ops table and the LLD doesn't have to do anything special about
it other than making the ops table non-const such that libata can
update it.
libata provides four base ops tables lower drivers can inherit from -
base, sata, pmp, sff and bmdma. To avoid overriding these ops
accidentaly, these ops are declared const and LLDs should always
inherit these instead of using them directly.
After finalization, all the ops table are identical before and after
the patch except for setting .irq_handler to ata_interrupt in drivers
which didn't use to. The .irq_handler doesn't have any actual effect
and the field will soon be removed by later patch.
* sata_sx4 is still using old style EH and currently doesn't take
advantage of ops inheritance.
Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-03-25 10:22:49 +07:00
|
|
|
static struct ata_port_operations sil_ops = {
|
2009-04-14 11:57:28 +07:00
|
|
|
.inherits = &ata_bmdma32_port_ops,
|
2005-04-17 05:20:36 +07:00
|
|
|
.dev_config = sil_dev_config,
|
2007-03-09 06:09:12 +07:00
|
|
|
.set_mode = sil_set_mode,
|
2008-12-25 08:06:06 +07:00
|
|
|
.bmdma_setup = sil_bmdma_setup,
|
|
|
|
.bmdma_start = sil_bmdma_start,
|
|
|
|
.bmdma_stop = sil_bmdma_stop,
|
|
|
|
.qc_prep = sil_qc_prep,
|
2006-05-15 18:58:27 +07:00
|
|
|
.freeze = sil_freeze,
|
|
|
|
.thaw = sil_thaw,
|
2005-04-17 05:20:36 +07:00
|
|
|
.scr_read = sil_scr_read,
|
|
|
|
.scr_write = sil_scr_write,
|
|
|
|
};
|
|
|
|
|
2005-11-28 16:06:23 +07:00
|
|
|
static const struct ata_port_info sil_port_info[] = {
|
2005-04-17 05:20:36 +07:00
|
|
|
/* sil_3112 */
|
2005-08-23 05:27:25 +07:00
|
|
|
{
|
2006-08-24 14:19:22 +07:00
|
|
|
.flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE,
|
2009-03-15 03:38:24 +07:00
|
|
|
.pio_mask = ATA_PIO4,
|
|
|
|
.mwdma_mask = ATA_MWDMA2,
|
2007-07-09 23:16:50 +07:00
|
|
|
.udma_mask = ATA_UDMA5,
|
2005-08-23 05:27:25 +07:00
|
|
|
.port_ops = &sil_ops,
|
2006-02-25 11:52:30 +07:00
|
|
|
},
|
2006-06-26 19:23:52 +07:00
|
|
|
/* sil_3112_no_sata_irq */
|
|
|
|
{
|
2006-08-24 14:19:22 +07:00
|
|
|
.flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE |
|
2006-06-26 19:23:52 +07:00
|
|
|
SIL_FLAG_NO_SATA_IRQ,
|
2009-03-15 03:38:24 +07:00
|
|
|
.pio_mask = ATA_PIO4,
|
|
|
|
.mwdma_mask = ATA_MWDMA2,
|
2007-07-09 23:16:50 +07:00
|
|
|
.udma_mask = ATA_UDMA5,
|
2006-06-26 19:23:52 +07:00
|
|
|
.port_ops = &sil_ops,
|
|
|
|
},
|
2006-02-25 11:52:30 +07:00
|
|
|
/* sil_3512 */
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2006-08-24 14:19:22 +07:00
|
|
|
.flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
|
2009-03-15 03:38:24 +07:00
|
|
|
.pio_mask = ATA_PIO4,
|
|
|
|
.mwdma_mask = ATA_MWDMA2,
|
2007-07-09 23:16:50 +07:00
|
|
|
.udma_mask = ATA_UDMA5,
|
2006-02-25 11:52:30 +07:00
|
|
|
.port_ops = &sil_ops,
|
|
|
|
},
|
|
|
|
/* sil_3114 */
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2006-08-24 14:19:22 +07:00
|
|
|
.flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
|
2009-03-15 03:38:24 +07:00
|
|
|
.pio_mask = ATA_PIO4,
|
|
|
|
.mwdma_mask = ATA_MWDMA2,
|
2007-07-09 23:16:50 +07:00
|
|
|
.udma_mask = ATA_UDMA5,
|
2005-04-17 05:20:36 +07:00
|
|
|
.port_ops = &sil_ops,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* per-port register offsets */
|
|
|
|
/* TODO: we can probably calculate rather than use a table */
|
|
|
|
static const struct {
|
|
|
|
unsigned long tf; /* ATA taskfile register block */
|
|
|
|
unsigned long ctl; /* ATA control/altstatus register block */
|
|
|
|
unsigned long bmdma; /* DMA register block */
|
2006-05-31 16:27:53 +07:00
|
|
|
unsigned long bmdma2; /* DMA register block #2 */
|
2006-03-05 14:03:52 +07:00
|
|
|
unsigned long fifo_cfg; /* FIFO Valid Byte Count and Control */
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned long scr; /* SATA control register block */
|
|
|
|
unsigned long sien; /* SATA Interrupt Enable register */
|
|
|
|
unsigned long xfer_mode;/* data transfer mode register */
|
2006-02-25 11:52:30 +07:00
|
|
|
unsigned long sfis_cfg; /* SATA FIS reception config register */
|
2005-04-17 05:20:36 +07:00
|
|
|
} sil_port[] = {
|
|
|
|
/* port 0 ... */
|
2007-05-27 03:35:42 +07:00
|
|
|
/* tf ctl bmdma bmdma2 fifo scr sien mode sfis */
|
|
|
|
{ 0x80, 0x8A, 0x0, 0x10, 0x40, 0x100, 0x148, 0xb4, 0x14c },
|
|
|
|
{ 0xC0, 0xCA, 0x8, 0x18, 0x44, 0x180, 0x1c8, 0xf4, 0x1cc },
|
2006-05-31 16:27:53 +07:00
|
|
|
{ 0x280, 0x28A, 0x200, 0x210, 0x240, 0x300, 0x348, 0x2b4, 0x34c },
|
|
|
|
{ 0x2C0, 0x2CA, 0x208, 0x218, 0x244, 0x380, 0x3c8, 0x2f4, 0x3cc },
|
2005-04-17 05:20:36 +07:00
|
|
|
/* ... port 3 */
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Jeff Garzik");
|
|
|
|
MODULE_DESCRIPTION("low-level driver for Silicon Image SATA controller");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_DEVICE_TABLE(pci, sil_pci_tbl);
|
|
|
|
MODULE_VERSION(DRV_VERSION);
|
|
|
|
|
2007-10-26 11:03:37 +07:00
|
|
|
static int slow_down;
|
2006-01-28 04:50:27 +07:00
|
|
|
module_param(slow_down, int, 0444);
|
|
|
|
MODULE_PARM_DESC(slow_down, "Sledgehammer used to work around random problems, by limiting commands to 15 sectors (0=off, 1=on)");
|
|
|
|
|
2005-08-30 16:42:52 +07:00
|
|
|
|
2008-12-25 08:06:06 +07:00
|
|
|
static void sil_bmdma_stop(struct ata_queued_cmd *qc)
|
|
|
|
{
|
|
|
|
struct ata_port *ap = qc->ap;
|
|
|
|
void __iomem *mmio_base = ap->host->iomap[SIL_MMIO_BAR];
|
|
|
|
void __iomem *bmdma2 = mmio_base + sil_port[ap->port_no].bmdma2;
|
|
|
|
|
|
|
|
/* clear start/stop bit - can safely always write 0 */
|
|
|
|
iowrite8(0, bmdma2);
|
|
|
|
|
|
|
|
/* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
|
|
|
|
ata_sff_dma_pause(ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sil_bmdma_setup(struct ata_queued_cmd *qc)
|
|
|
|
{
|
|
|
|
struct ata_port *ap = qc->ap;
|
|
|
|
void __iomem *bmdma = ap->ioaddr.bmdma_addr;
|
|
|
|
|
|
|
|
/* load PRD table addr. */
|
2010-05-11 02:41:41 +07:00
|
|
|
iowrite32(ap->bmdma_prd_dma, bmdma + ATA_DMA_TABLE_OFS);
|
2008-12-25 08:06:06 +07:00
|
|
|
|
|
|
|
/* issue r/w command */
|
|
|
|
ap->ops->sff_exec_command(ap, &qc->tf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sil_bmdma_start(struct ata_queued_cmd *qc)
|
|
|
|
{
|
|
|
|
unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
|
|
|
|
struct ata_port *ap = qc->ap;
|
|
|
|
void __iomem *mmio_base = ap->host->iomap[SIL_MMIO_BAR];
|
|
|
|
void __iomem *bmdma2 = mmio_base + sil_port[ap->port_no].bmdma2;
|
|
|
|
u8 dmactl = ATA_DMA_START;
|
|
|
|
|
|
|
|
/* set transfer direction, start host DMA transaction
|
|
|
|
Note: For Large Block Transfer to work, the DMA must be started
|
|
|
|
using the bmdma2 register. */
|
|
|
|
if (!rw)
|
|
|
|
dmactl |= ATA_DMA_WR;
|
|
|
|
iowrite8(dmactl, bmdma2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The way God intended PCI IDE scatter/gather lists to look and behave... */
|
|
|
|
static void sil_fill_sg(struct ata_queued_cmd *qc)
|
|
|
|
{
|
|
|
|
struct scatterlist *sg;
|
|
|
|
struct ata_port *ap = qc->ap;
|
2010-05-11 02:41:41 +07:00
|
|
|
struct ata_bmdma_prd *prd, *last_prd = NULL;
|
2008-12-25 08:06:06 +07:00
|
|
|
unsigned int si;
|
|
|
|
|
2010-05-11 02:41:41 +07:00
|
|
|
prd = &ap->bmdma_prd[0];
|
2008-12-25 08:06:06 +07:00
|
|
|
for_each_sg(qc->sg, sg, qc->n_elem, si) {
|
|
|
|
/* Note h/w doesn't support 64-bit, so we unconditionally
|
|
|
|
* truncate dma_addr_t to u32.
|
|
|
|
*/
|
|
|
|
u32 addr = (u32) sg_dma_address(sg);
|
|
|
|
u32 sg_len = sg_dma_len(sg);
|
|
|
|
|
|
|
|
prd->addr = cpu_to_le32(addr);
|
|
|
|
prd->flags_len = cpu_to_le32(sg_len);
|
2009-02-03 02:47:14 +07:00
|
|
|
VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", si, addr, sg_len);
|
2008-12-25 08:06:06 +07:00
|
|
|
|
|
|
|
last_prd = prd;
|
|
|
|
prd++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (likely(last_prd))
|
|
|
|
last_prd->flags_len |= cpu_to_le32(ATA_PRD_EOT);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sil_qc_prep(struct ata_queued_cmd *qc)
|
|
|
|
{
|
|
|
|
if (!(qc->flags & ATA_QCFLAG_DMAMAP))
|
|
|
|
return;
|
|
|
|
|
|
|
|
sil_fill_sg(qc);
|
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
static unsigned char sil_get_device_cache_line(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
u8 cache_line = 0;
|
|
|
|
pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cache_line);
|
|
|
|
return cache_line;
|
|
|
|
}
|
|
|
|
|
2007-03-09 06:09:12 +07:00
|
|
|
/**
|
|
|
|
* sil_set_mode - wrap set_mode functions
|
2007-08-06 16:36:23 +07:00
|
|
|
* @link: link to set up
|
2007-03-09 06:09:12 +07:00
|
|
|
* @r_failed: returned device when we fail
|
|
|
|
*
|
|
|
|
* Wrap the libata method for device setup as after the setup we need
|
|
|
|
* to inspect the results and do some configuration work
|
|
|
|
*/
|
|
|
|
|
2007-08-06 16:36:23 +07:00
|
|
|
static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2007-08-06 16:36:23 +07:00
|
|
|
struct ata_port *ap = link->ap;
|
|
|
|
void __iomem *mmio_base = ap->host->iomap[SIL_MMIO_BAR];
|
2007-02-01 13:06:36 +07:00
|
|
|
void __iomem *addr = mmio_base + sil_port[ap->port_no].xfer_mode;
|
2007-08-06 16:36:23 +07:00
|
|
|
struct ata_device *dev;
|
2007-08-06 16:36:23 +07:00
|
|
|
u32 tmp, dev_mode[2] = { };
|
2007-03-09 06:09:12 +07:00
|
|
|
int rc;
|
2007-05-22 07:14:23 +07:00
|
|
|
|
2007-08-06 16:36:23 +07:00
|
|
|
rc = ata_do_set_mode(link, r_failed);
|
2007-03-09 06:09:12 +07:00
|
|
|
if (rc)
|
|
|
|
return rc;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2008-11-03 18:03:17 +07:00
|
|
|
ata_for_each_dev(dev, link, ALL) {
|
2006-03-31 23:38:18 +07:00
|
|
|
if (!ata_dev_enabled(dev))
|
2007-08-06 16:36:23 +07:00
|
|
|
dev_mode[dev->devno] = 0; /* PIO0/1/2 */
|
2005-04-17 05:20:36 +07:00
|
|
|
else if (dev->flags & ATA_DFLAG_PIO)
|
2007-08-06 16:36:23 +07:00
|
|
|
dev_mode[dev->devno] = 1; /* PIO3/4 */
|
2005-04-17 05:20:36 +07:00
|
|
|
else
|
2007-08-06 16:36:23 +07:00
|
|
|
dev_mode[dev->devno] = 3; /* UDMA */
|
2005-04-17 05:20:36 +07:00
|
|
|
/* value 2 indicates MDMA */
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = readl(addr);
|
|
|
|
tmp &= ~((1<<5) | (1<<4) | (1<<1) | (1<<0));
|
|
|
|
tmp |= dev_mode[0];
|
|
|
|
tmp |= (dev_mode[1] << 4);
|
|
|
|
writel(tmp, addr);
|
|
|
|
readl(addr); /* flush */
|
2007-03-09 06:09:12 +07:00
|
|
|
return 0;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2007-10-26 11:03:37 +07:00
|
|
|
static inline void __iomem *sil_scr_addr(struct ata_port *ap,
|
|
|
|
unsigned int sc_reg)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2007-02-01 13:06:36 +07:00
|
|
|
void __iomem *offset = ap->ioaddr.scr_addr;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
switch (sc_reg) {
|
|
|
|
case SCR_STATUS:
|
|
|
|
return offset + 4;
|
|
|
|
case SCR_ERROR:
|
|
|
|
return offset + 8;
|
|
|
|
case SCR_CONTROL:
|
|
|
|
return offset;
|
|
|
|
default:
|
|
|
|
/* do nothing */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-02-16 16:40:06 +07:00
|
|
|
return NULL;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2008-07-31 15:02:40 +07:00
|
|
|
static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2008-07-31 15:02:40 +07:00
|
|
|
void __iomem *mmio = sil_scr_addr(link->ap, sc_reg);
|
2007-07-16 12:29:40 +07:00
|
|
|
|
|
|
|
if (mmio) {
|
|
|
|
*val = readl(mmio);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -EINVAL;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2008-07-31 15:02:40 +07:00
|
|
|
static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2008-07-31 15:02:40 +07:00
|
|
|
void __iomem *mmio = sil_scr_addr(link->ap, sc_reg);
|
2007-07-16 12:29:40 +07:00
|
|
|
|
|
|
|
if (mmio) {
|
2005-04-17 05:20:36 +07:00
|
|
|
writel(val, mmio);
|
2007-07-16 12:29:40 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -EINVAL;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2006-05-31 16:27:55 +07:00
|
|
|
static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
|
|
|
|
{
|
2007-08-06 16:36:22 +07:00
|
|
|
struct ata_eh_info *ehi = &ap->link.eh_info;
|
|
|
|
struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag);
|
2006-05-31 16:27:55 +07:00
|
|
|
u8 status;
|
|
|
|
|
2006-05-31 16:28:16 +07:00
|
|
|
if (unlikely(bmdma2 & SIL_DMA_SATA_IRQ)) {
|
2011-08-19 10:52:36 +07:00
|
|
|
u32 serror = 0xffffffff;
|
2006-06-12 16:45:55 +07:00
|
|
|
|
|
|
|
/* SIEN doesn't mask SATA IRQs on some 3112s. Those
|
|
|
|
* controllers continue to assert IRQ as long as
|
|
|
|
* SError bits are pending. Clear SError immediately.
|
|
|
|
*/
|
2008-07-31 15:02:40 +07:00
|
|
|
sil_scr_read(&ap->link, SCR_ERROR, &serror);
|
|
|
|
sil_scr_write(&ap->link, SCR_ERROR, serror);
|
2006-06-12 16:45:55 +07:00
|
|
|
|
2007-12-08 06:45:27 +07:00
|
|
|
/* Sometimes spurious interrupts occur, double check
|
|
|
|
* it's PHYRDY CHG.
|
2006-06-12 16:45:55 +07:00
|
|
|
*/
|
2007-12-08 06:45:27 +07:00
|
|
|
if (serror & SERR_PHYRDY_CHG) {
|
2007-12-08 06:47:01 +07:00
|
|
|
ap->link.eh_info.serror |= serror;
|
2007-12-08 06:45:27 +07:00
|
|
|
goto freeze;
|
2006-06-12 16:45:55 +07:00
|
|
|
}
|
|
|
|
|
2007-12-08 06:45:27 +07:00
|
|
|
if (!(bmdma2 & SIL_DMA_COMPLETE))
|
|
|
|
return;
|
2006-05-31 16:28:16 +07:00
|
|
|
}
|
|
|
|
|
2007-12-08 06:45:27 +07:00
|
|
|
if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) {
|
2007-02-24 20:30:36 +07:00
|
|
|
/* this sometimes happens, just clear IRQ */
|
2008-04-07 20:47:16 +07:00
|
|
|
ap->ops->sff_check_status(ap);
|
2007-02-24 20:30:36 +07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-05-31 16:27:55 +07:00
|
|
|
/* Check whether we are expecting interrupt in this state */
|
|
|
|
switch (ap->hsm_task_state) {
|
|
|
|
case HSM_ST_FIRST:
|
|
|
|
/* Some pre-ATAPI-4 devices assert INTRQ
|
|
|
|
* at this state when ready to receive CDB.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Check the ATA_DFLAG_CDB_INTR flag is enough here.
|
2007-11-27 17:28:53 +07:00
|
|
|
* The flag was turned on only for atapi devices. No
|
|
|
|
* need to check ata_is_atapi(qc->tf.protocol) again.
|
2006-05-31 16:27:55 +07:00
|
|
|
*/
|
|
|
|
if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
|
|
|
|
goto err_hsm;
|
|
|
|
break;
|
|
|
|
case HSM_ST_LAST:
|
2007-11-27 17:28:53 +07:00
|
|
|
if (ata_is_dma(qc->tf.protocol)) {
|
2006-05-31 16:27:55 +07:00
|
|
|
/* clear DMA-Start bit */
|
|
|
|
ap->ops->bmdma_stop(qc);
|
|
|
|
|
|
|
|
if (bmdma2 & SIL_DMA_ERROR) {
|
|
|
|
qc->err_mask |= AC_ERR_HOST_BUS;
|
|
|
|
ap->hsm_task_state = HSM_ST_ERR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case HSM_ST:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
goto err_hsm;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check main status, clearing INTRQ */
|
2008-04-07 20:47:16 +07:00
|
|
|
status = ap->ops->sff_check_status(ap);
|
2006-05-31 16:27:55 +07:00
|
|
|
if (unlikely(status & ATA_BUSY))
|
|
|
|
goto err_hsm;
|
|
|
|
|
|
|
|
/* ack bmdma irq events */
|
2010-05-20 03:10:20 +07:00
|
|
|
ata_bmdma_irq_clear(ap);
|
2006-05-31 16:27:55 +07:00
|
|
|
|
|
|
|
/* kick HSM in the ass */
|
2008-04-07 20:47:16 +07:00
|
|
|
ata_sff_hsm_move(ap, qc, status, 0);
|
2006-05-31 16:27:55 +07:00
|
|
|
|
2007-11-27 17:28:53 +07:00
|
|
|
if (unlikely(qc->err_mask) && ata_is_dma(qc->tf.protocol))
|
2006-11-17 10:06:21 +07:00
|
|
|
ata_ehi_push_desc(ehi, "BMDMA2 stat 0x%x", bmdma2);
|
|
|
|
|
2006-05-31 16:27:55 +07:00
|
|
|
return;
|
|
|
|
|
|
|
|
err_hsm:
|
|
|
|
qc->err_mask |= AC_ERR_HSM;
|
|
|
|
freeze:
|
|
|
|
ata_port_freeze(ap);
|
|
|
|
}
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 20:55:46 +07:00
|
|
|
static irqreturn_t sil_interrupt(int irq, void *dev_instance)
|
2006-05-31 16:27:55 +07:00
|
|
|
{
|
2006-08-24 14:19:22 +07:00
|
|
|
struct ata_host *host = dev_instance;
|
2007-02-01 13:06:36 +07:00
|
|
|
void __iomem *mmio_base = host->iomap[SIL_MMIO_BAR];
|
2006-05-31 16:27:55 +07:00
|
|
|
int handled = 0;
|
|
|
|
int i;
|
|
|
|
|
2006-08-24 14:19:22 +07:00
|
|
|
spin_lock(&host->lock);
|
2006-05-31 16:27:55 +07:00
|
|
|
|
2006-08-24 14:19:22 +07:00
|
|
|
for (i = 0; i < host->n_ports; i++) {
|
|
|
|
struct ata_port *ap = host->ports[i];
|
2006-05-31 16:27:55 +07:00
|
|
|
u32 bmdma2 = readl(mmio_base + sil_port[ap->port_no].bmdma2);
|
|
|
|
|
2006-06-26 19:23:52 +07:00
|
|
|
/* turn off SATA_IRQ if not supported */
|
|
|
|
if (ap->flags & SIL_FLAG_NO_SATA_IRQ)
|
|
|
|
bmdma2 &= ~SIL_DMA_SATA_IRQ;
|
|
|
|
|
2006-06-12 12:18:51 +07:00
|
|
|
if (bmdma2 == 0xffffffff ||
|
|
|
|
!(bmdma2 & (SIL_DMA_COMPLETE | SIL_DMA_SATA_IRQ)))
|
2006-05-31 16:27:55 +07:00
|
|
|
continue;
|
|
|
|
|
|
|
|
sil_host_intr(ap, bmdma2);
|
|
|
|
handled = 1;
|
|
|
|
}
|
|
|
|
|
2006-08-24 14:19:22 +07:00
|
|
|
spin_unlock(&host->lock);
|
2006-05-31 16:27:55 +07:00
|
|
|
|
|
|
|
return IRQ_RETVAL(handled);
|
|
|
|
}
|
|
|
|
|
2006-05-15 18:58:27 +07:00
|
|
|
static void sil_freeze(struct ata_port *ap)
|
|
|
|
{
|
2007-02-01 13:06:36 +07:00
|
|
|
void __iomem *mmio_base = ap->host->iomap[SIL_MMIO_BAR];
|
2006-05-15 18:58:27 +07:00
|
|
|
u32 tmp;
|
|
|
|
|
2006-05-31 16:28:16 +07:00
|
|
|
/* global IRQ mask doesn't block SATA IRQ, turn off explicitly */
|
|
|
|
writel(0, mmio_base + sil_port[ap->port_no].sien);
|
|
|
|
|
2006-05-15 18:58:27 +07:00
|
|
|
/* plug IRQ */
|
|
|
|
tmp = readl(mmio_base + SIL_SYSCFG);
|
|
|
|
tmp |= SIL_MASK_IDE0_INT << ap->port_no;
|
|
|
|
writel(tmp, mmio_base + SIL_SYSCFG);
|
|
|
|
readl(mmio_base + SIL_SYSCFG); /* flush */
|
2009-04-08 06:18:32 +07:00
|
|
|
|
|
|
|
/* Ensure DMA_ENABLE is off.
|
|
|
|
*
|
|
|
|
* This is because the controller will not give us access to the
|
|
|
|
* taskfile registers while a DMA is in progress
|
|
|
|
*/
|
|
|
|
iowrite8(ioread8(ap->ioaddr.bmdma_addr) & ~SIL_DMA_ENABLE,
|
|
|
|
ap->ioaddr.bmdma_addr);
|
|
|
|
|
|
|
|
/* According to ata_bmdma_stop, an HDMA transition requires
|
|
|
|
* on PIO cycle. But we can't read a taskfile register.
|
|
|
|
*/
|
|
|
|
ioread8(ap->ioaddr.bmdma_addr);
|
2006-05-15 18:58:27 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void sil_thaw(struct ata_port *ap)
|
|
|
|
{
|
2007-02-01 13:06:36 +07:00
|
|
|
void __iomem *mmio_base = ap->host->iomap[SIL_MMIO_BAR];
|
2006-05-15 18:58:27 +07:00
|
|
|
u32 tmp;
|
|
|
|
|
|
|
|
/* clear IRQ */
|
2008-04-07 20:47:16 +07:00
|
|
|
ap->ops->sff_check_status(ap);
|
2010-05-20 03:10:20 +07:00
|
|
|
ata_bmdma_irq_clear(ap);
|
2006-05-15 18:58:27 +07:00
|
|
|
|
2006-06-26 19:23:52 +07:00
|
|
|
/* turn on SATA IRQ if supported */
|
|
|
|
if (!(ap->flags & SIL_FLAG_NO_SATA_IRQ))
|
|
|
|
writel(SIL_SIEN_N, mmio_base + sil_port[ap->port_no].sien);
|
2006-05-31 16:28:16 +07:00
|
|
|
|
2006-05-15 18:58:27 +07:00
|
|
|
/* turn on IRQ */
|
|
|
|
tmp = readl(mmio_base + SIL_SYSCFG);
|
|
|
|
tmp &= ~(SIL_MASK_IDE0_INT << ap->port_no);
|
|
|
|
writel(tmp, mmio_base + SIL_SYSCFG);
|
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/**
|
|
|
|
* sil_dev_config - Apply device/host-specific errata fixups
|
|
|
|
* @dev: Device to be examined
|
|
|
|
*
|
|
|
|
* After the IDENTIFY [PACKET] DEVICE step is complete, and a
|
|
|
|
* device is known to be present, this function is called.
|
|
|
|
* We apply two errata fixups which are specific to Silicon Image,
|
|
|
|
* a Seagate and a Maxtor fixup.
|
|
|
|
*
|
|
|
|
* For certain Seagate devices, we must limit the maximum sectors
|
|
|
|
* to under 8K.
|
|
|
|
*
|
|
|
|
* For certain Maxtor devices, we must not program the drive
|
|
|
|
* beyond udma5.
|
|
|
|
*
|
|
|
|
* Both fixups are unfairly pessimistic. As soon as I get more
|
|
|
|
* information on these errata, I will create a more exhaustive
|
|
|
|
* list, and apply the fixups to only the specific
|
|
|
|
* devices/hosts/firmwares that need it.
|
|
|
|
*
|
|
|
|
* 20040111 - Seagate drives affected by the Mod15Write bug are blacklisted
|
|
|
|
* The Maxtor quirk is in the blacklist, but I'm keeping the original
|
|
|
|
* pessimistic fix for the following reasons...
|
|
|
|
* - There seems to be less info on it, only one device gleaned off the
|
|
|
|
* Windows driver, maybe only one is affected. More info would be greatly
|
|
|
|
* appreciated.
|
|
|
|
* - But then again UDMA5 is hardly anything to complain about
|
|
|
|
*/
|
2007-03-02 07:56:15 +07:00
|
|
|
static void sil_dev_config(struct ata_device *dev)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2007-08-06 16:36:22 +07:00
|
|
|
struct ata_port *ap = dev->link->ap;
|
|
|
|
int print_info = ap->link.eh_context.i.flags & ATA_EHI_PRINTINFO;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned int n, quirks = 0;
|
2007-01-02 18:18:49 +07:00
|
|
|
unsigned char model_num[ATA_ID_PROD_LEN + 1];
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2007-01-02 18:18:49 +07:00
|
|
|
ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-08-01 00:13:24 +07:00
|
|
|
for (n = 0; sil_blacklist[n].product; n++)
|
2006-02-12 20:47:04 +07:00
|
|
|
if (!strcmp(sil_blacklist[n].product, model_num)) {
|
2005-04-17 05:20:36 +07:00
|
|
|
quirks = sil_blacklist[n].quirk;
|
|
|
|
break;
|
|
|
|
}
|
2005-08-01 00:13:24 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/* limit requests to 15 sectors */
|
2006-01-28 04:50:27 +07:00
|
|
|
if (slow_down ||
|
|
|
|
((ap->flags & SIL_FLAG_MOD15WRITE) &&
|
|
|
|
(quirks & SIL_QUIRK_MOD15WRITE))) {
|
2006-11-01 16:38:52 +07:00
|
|
|
if (print_info)
|
ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level>
Saves text by removing nearly duplicated text format strings by
creating ata_<foo>_printk functions and printf extension %pV.
ata defconfig size shrinks ~5% (~8KB), allyesconfig ~2.5% (~13KB)
Format string duplication comes from:
#define ata_link_printk(link, lv, fmt, args...) do { \
if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \
printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \
(link)->pmp , ##args); \
else \
printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \
} while(0)
Coalesce long formats.
$ size drivers/ata/built-in.*
text data bss dec hex filename
544969 73893 116584 735446 b38d6 drivers/ata/built-in.allyesconfig.ata.o
558429 73893 117864 750186 b726a drivers/ata/built-in.allyesconfig.dev_level.o
141328 14689 4220 160237 271ed drivers/ata/built-in.defconfig.ata.o
149567 14689 4220 168476 2921c drivers/ata/built-in.defconfig.dev_level.o
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2011-04-16 05:51:59 +07:00
|
|
|
ata_dev_info(dev,
|
|
|
|
"applying Seagate errata fix (mod15write workaround)\n");
|
2006-02-12 21:32:59 +07:00
|
|
|
dev->max_sectors = 15;
|
2005-04-17 05:20:36 +07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* limit to udma5 */
|
|
|
|
if (quirks & SIL_QUIRK_UDMA5MAX) {
|
2006-11-01 16:38:52 +07:00
|
|
|
if (print_info)
|
ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level>
Saves text by removing nearly duplicated text format strings by
creating ata_<foo>_printk functions and printf extension %pV.
ata defconfig size shrinks ~5% (~8KB), allyesconfig ~2.5% (~13KB)
Format string duplication comes from:
#define ata_link_printk(link, lv, fmt, args...) do { \
if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \
printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \
(link)->pmp , ##args); \
else \
printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \
} while(0)
Coalesce long formats.
$ size drivers/ata/built-in.*
text data bss dec hex filename
544969 73893 116584 735446 b38d6 drivers/ata/built-in.allyesconfig.ata.o
558429 73893 117864 750186 b726a drivers/ata/built-in.allyesconfig.dev_level.o
141328 14689 4220 160237 271ed drivers/ata/built-in.defconfig.ata.o
149567 14689 4220 168476 2921c drivers/ata/built-in.defconfig.dev_level.o
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2011-04-16 05:51:59 +07:00
|
|
|
ata_dev_info(dev, "applying Maxtor errata fix %s\n",
|
|
|
|
model_num);
|
2006-03-24 12:07:50 +07:00
|
|
|
dev->udma_mask &= ATA_UDMA5;
|
2005-04-17 05:20:36 +07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
static void sil_init_controller(struct ata_host *host)
|
2006-07-03 14:07:27 +07:00
|
|
|
{
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
struct pci_dev *pdev = to_pci_dev(host->dev);
|
|
|
|
void __iomem *mmio_base = host->iomap[SIL_MMIO_BAR];
|
2006-07-03 14:07:27 +07:00
|
|
|
u8 cls;
|
|
|
|
u32 tmp;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Initialize FIFO PCI bus arbitration */
|
|
|
|
cls = sil_get_device_cache_line(pdev);
|
|
|
|
if (cls) {
|
|
|
|
cls >>= 3;
|
|
|
|
cls++; /* cls = (line_size/8)+1 */
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
for (i = 0; i < host->n_ports; i++)
|
2006-07-03 14:07:27 +07:00
|
|
|
writew(cls << 8 | cls,
|
|
|
|
mmio_base + sil_port[i].fifo_cfg);
|
|
|
|
} else
|
2011-04-16 05:51:58 +07:00
|
|
|
dev_warn(&pdev->dev,
|
|
|
|
"cache line size not set. Driver may not function\n");
|
2006-07-03 14:07:27 +07:00
|
|
|
|
|
|
|
/* Apply R_ERR on DMA activate FIS errata workaround */
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
if (host->ports[0]->flags & SIL_FLAG_RERR_ON_DMA_ACT) {
|
2006-07-03 14:07:27 +07:00
|
|
|
int cnt;
|
|
|
|
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
for (i = 0, cnt = 0; i < host->n_ports; i++) {
|
2006-07-03 14:07:27 +07:00
|
|
|
tmp = readl(mmio_base + sil_port[i].sfis_cfg);
|
|
|
|
if ((tmp & 0x3) != 0x01)
|
|
|
|
continue;
|
|
|
|
if (!cnt)
|
2011-04-16 05:51:58 +07:00
|
|
|
dev_info(&pdev->dev,
|
|
|
|
"Applying R_ERR on DMA activate FIS errata fix\n");
|
2006-07-03 14:07:27 +07:00
|
|
|
writel(tmp & ~0x3, mmio_base + sil_port[i].sfis_cfg);
|
|
|
|
cnt++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
if (host->n_ports == 4) {
|
2006-07-03 14:07:27 +07:00
|
|
|
/* flip the magic "make 4 ports work" bit */
|
|
|
|
tmp = readl(mmio_base + sil_port[2].bmdma);
|
|
|
|
if ((tmp & SIL_INTR_STEERING) == 0)
|
|
|
|
writel(tmp | SIL_INTR_STEERING,
|
|
|
|
mmio_base + sil_port[2].bmdma);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-20 02:58:29 +07:00
|
|
|
static bool sil_broken_system_poweroff(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
static const struct dmi_system_id broken_systems[] = {
|
|
|
|
{
|
|
|
|
.ident = "HP Compaq nx6325",
|
|
|
|
.matches = {
|
|
|
|
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
|
|
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"),
|
|
|
|
},
|
|
|
|
/* PCI slot number of the controller */
|
|
|
|
.driver_data = (void *)0x12UL,
|
|
|
|
},
|
|
|
|
|
|
|
|
{ } /* terminate list */
|
|
|
|
};
|
|
|
|
const struct dmi_system_id *dmi = dmi_first_match(broken_systems);
|
|
|
|
|
|
|
|
if (dmi) {
|
|
|
|
unsigned long slot = (unsigned long)dmi->driver_data;
|
|
|
|
/* apply the quirk only to on-board controllers */
|
|
|
|
return slot == PCI_SLOT(pdev->devfn);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-10-26 11:03:37 +07:00
|
|
|
static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
int board_id = ent->driver_data;
|
2009-01-20 02:58:29 +07:00
|
|
|
struct ata_port_info pi = sil_port_info[board_id];
|
|
|
|
const struct ata_port_info *ppi[] = { &pi, NULL };
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
struct ata_host *host;
|
2005-08-30 16:18:18 +07:00
|
|
|
void __iomem *mmio_base;
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
int n_ports, rc;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned int i;
|
|
|
|
|
2011-04-16 05:52:00 +07:00
|
|
|
ata_print_version_once(&pdev->dev, DRV_VERSION);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
/* allocate host */
|
|
|
|
n_ports = 2;
|
|
|
|
if (board_id == sil_3114)
|
|
|
|
n_ports = 4;
|
|
|
|
|
2009-01-20 02:58:29 +07:00
|
|
|
if (sil_broken_system_poweroff(pdev)) {
|
|
|
|
pi.flags |= ATA_FLAG_NO_POWEROFF_SPINDOWN |
|
|
|
|
ATA_FLAG_NO_HIBERNATE_SPINDOWN;
|
|
|
|
dev_info(&pdev->dev, "quirky BIOS, skipping spindown "
|
|
|
|
"on poweroff and hibernation\n");
|
|
|
|
}
|
|
|
|
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
|
|
|
|
if (!host)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
/* acquire resources and fill host */
|
2007-01-20 14:00:28 +07:00
|
|
|
rc = pcim_enable_device(pdev);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
|
2007-02-01 13:06:36 +07:00
|
|
|
rc = pcim_iomap_regions(pdev, 1 << SIL_MMIO_BAR, DRV_NAME);
|
|
|
|
if (rc == -EBUSY)
|
2007-01-20 14:00:28 +07:00
|
|
|
pcim_pin_device(pdev);
|
2007-02-01 13:06:36 +07:00
|
|
|
if (rc)
|
2007-01-20 14:00:28 +07:00
|
|
|
return rc;
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
host->iomap = pcim_iomap_table(pdev);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
|
|
|
|
if (rc)
|
2007-01-20 14:00:28 +07:00
|
|
|
return rc;
|
2005-04-17 05:20:36 +07:00
|
|
|
rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK);
|
|
|
|
if (rc)
|
2007-01-20 14:00:28 +07:00
|
|
|
return rc;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
mmio_base = host->iomap[SIL_MMIO_BAR];
|
2005-04-17 05:20:36 +07:00
|
|
|
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
for (i = 0; i < host->n_ports; i++) {
|
2007-08-18 11:14:55 +07:00
|
|
|
struct ata_port *ap = host->ports[i];
|
|
|
|
struct ata_ioports *ioaddr = &ap->ioaddr;
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
|
|
|
|
ioaddr->cmd_addr = mmio_base + sil_port[i].tf;
|
|
|
|
ioaddr->altstatus_addr =
|
|
|
|
ioaddr->ctl_addr = mmio_base + sil_port[i].ctl;
|
|
|
|
ioaddr->bmdma_addr = mmio_base + sil_port[i].bmdma;
|
|
|
|
ioaddr->scr_addr = mmio_base + sil_port[i].scr;
|
2008-04-07 20:47:16 +07:00
|
|
|
ata_sff_std_ports(ioaddr);
|
2007-08-18 11:14:55 +07:00
|
|
|
|
|
|
|
ata_port_pbar_desc(ap, SIL_MMIO_BAR, -1, "mmio");
|
|
|
|
ata_port_pbar_desc(ap, SIL_MMIO_BAR, sil_port[i].tf, "tf");
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
/* initialize and activate */
|
|
|
|
sil_init_controller(host);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
pci_set_master(pdev);
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
return ata_host_activate(host, pdev->irq, sil_interrupt, IRQF_SHARED,
|
|
|
|
&sil_sht);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2014-05-07 22:17:44 +07:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2006-07-03 14:07:27 +07:00
|
|
|
static int sil_pci_device_resume(struct pci_dev *pdev)
|
|
|
|
{
|
2013-06-03 12:05:36 +07:00
|
|
|
struct ata_host *host = pci_get_drvdata(pdev);
|
2006-12-26 17:39:50 +07:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = ata_pci_device_do_resume(pdev);
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
2006-07-03 14:07:27 +07:00
|
|
|
|
libata: convert the remaining SATA drivers to new init model
Convert ahci, sata_sil, sata_sil24, sata_svw, sata_qstor, sata_mv,
sata_sx4, sata_vsc and sata_inic162x to new init model.
Now that host and ap are available during intialization, functions are
converted to take either host or ap instead of low level parameters
which were inevitable for functions shared between init and other
paths. This simplifies code quite a bit.
* init_one()'s now follow more consistent init order
* ahci_setup_port() and ahci_host_init() collapsed into
ahci_init_one() for init order consistency
* sata_vsc uses port_info instead of setting fields manually
* in sata_svw, k2_board_info converted to port_info (info is now in
port flags). port number is honored now.
Tested on ICH7/8 AHCI, jmb360, sil3112, 3114, 3124 and 3132.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-04-17 21:44:08 +07:00
|
|
|
sil_init_controller(host);
|
2006-08-24 14:19:22 +07:00
|
|
|
ata_host_resume(host);
|
2006-07-03 14:07:27 +07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2006-08-15 12:49:30 +07:00
|
|
|
#endif
|
2006-07-03 14:07:27 +07:00
|
|
|
|
2012-04-19 12:43:05 +07:00
|
|
|
module_pci_driver(sil_pci_driver);
|