Skip to content

Commit

Permalink
libata-link: introduce ata_link
Browse files Browse the repository at this point in the history
Introduce ata_link.  It abstracts PHY and sits between ata_port and
ata_device.  This new level of abstraction is necessary to support
SATA Port Multiplier, which basically adds a bunch of links (PHYs) to
a ATA host port.  Fields related to command execution, spd_limit and
EH are per-link and thus moved to ata_link.

This patch only defines the host link.  Multiple link handling will be
added later.  Also, a lot of ap->link derefences are added but many of
them will be removed as each part is converted to deal directly with
ata_link instead of ata_port.

This patch introduces no behavior change.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
htejun authored and Jeff Garzik committed Oct 12, 2007
1 parent 640fdb5 commit 9af5c9c
Show file tree
Hide file tree
Showing 33 changed files with 280 additions and 255 deletions.
18 changes: 9 additions & 9 deletions drivers/ata/ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ static int ahci_do_softreset(struct ata_port *ap, unsigned int *class,
ata_port_printk(ap, KERN_WARNING,
"failed to reset engine (errno=%d)", rc);

ata_tf_init(ap->device, &tf);
ata_tf_init(ap->link.device, &tf);

/* issue the first D2H Register FIS */
msecs = 0;
Expand Down Expand Up @@ -1132,7 +1132,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class,
ahci_stop_engine(ap);

/* clear D2H reception area to properly wait for D2H FIS */
ata_tf_init(ap->device, &tf);
ata_tf_init(ap->link.device, &tf);
tf.command = 0x80;
ata_tf_to_fis(&tf, 0, 0, d2h_fis);

Expand All @@ -1159,7 +1159,7 @@ static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class,

ahci_stop_engine(ap);

rc = sata_port_hardreset(ap, sata_ehc_deb_timing(&ap->eh_context),
rc = sata_port_hardreset(ap, sata_ehc_deb_timing(&ap->link.eh_context),
deadline);

/* vt8251 needs SError cleared for the port to operate */
Expand Down Expand Up @@ -1278,7 +1278,7 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
{
struct ahci_port_priv *pp = ap->private_data;
struct ata_eh_info *ehi = &ap->eh_info;
struct ata_eh_info *ehi = &ap->link.eh_info;
unsigned int err_mask = 0, action = 0;
struct ata_queued_cmd *qc;
u32 serror;
Expand Down Expand Up @@ -1332,7 +1332,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
ehi->serror |= serror;
ehi->action |= action;

qc = ata_qc_from_tag(ap, ap->active_tag);
qc = ata_qc_from_tag(ap, ap->link.active_tag);
if (qc)
qc->err_mask |= err_mask;
else
Expand All @@ -1347,7 +1347,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
static void ahci_port_intr(struct ata_port *ap)
{
void __iomem *port_mmio = ap->ioaddr.cmd_addr;
struct ata_eh_info *ehi = &ap->eh_info;
struct ata_eh_info *ehi = &ap->link.eh_info;
struct ahci_port_priv *pp = ap->private_data;
u32 status, qc_active;
int rc, known_irq = 0;
Expand All @@ -1360,7 +1360,7 @@ static void ahci_port_intr(struct ata_port *ap)
return;
}

if (ap->sactive)
if (ap->link.sactive)
qc_active = readl(port_mmio + PORT_SCR_ACT);
else
qc_active = readl(port_mmio + PORT_CMD_ISSUE);
Expand All @@ -1380,7 +1380,7 @@ static void ahci_port_intr(struct ata_port *ap)
/* if !NCQ, ignore. No modern ATA device has broken HSM
* implementation for non-NCQ commands.
*/
if (!ap->sactive)
if (!ap->link.sactive)
return;

if (status & PORT_IRQ_D2H_REG_FIS) {
Expand Down Expand Up @@ -1433,7 +1433,7 @@ static void ahci_port_intr(struct ata_port *ap)
if (!known_irq)
ata_port_printk(ap, KERN_INFO, "spurious interrupt "
"(irq_stat 0x%x active_tag 0x%x sactive 0x%x)\n",
status, ap->active_tag, ap->sactive);
status, ap->link.active_tag, ap->link.sactive);
}

static void ahci_irq_clear(struct ata_port *ap)
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ata_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static int generic_set_mode(struct ata_port *ap, struct ata_device **unused)
dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);

for (i = 0; i < ATA_MAX_DEVICES; i++) {
struct ata_device *dev = &ap->device[i];
struct ata_device *dev = &ap->link.device[i];
if (ata_dev_enabled(dev)) {
/* We don't really care */
dev->pio_mode = XFER_PIO_0;
Expand Down
21 changes: 11 additions & 10 deletions drivers/ata/libata-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ static void ata_acpi_associate_sata_port(struct ata_port *ap)
{
acpi_integer adr = SATA_ADR(ap->port_no, NO_PORT_MULT);

ap->device->acpi_handle = acpi_get_child(ap->host->acpi_handle, adr);
ap->link.device->acpi_handle =
acpi_get_child(ap->host->acpi_handle, adr);
}

static void ata_acpi_associate_ide_port(struct ata_port *ap)
Expand All @@ -60,7 +61,7 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap)
max_devices++;

for (i = 0; i < max_devices; i++) {
struct ata_device *dev = &ap->device[i];
struct ata_device *dev = &ap->link.device[i];

dev->acpi_handle = acpi_get_child(ap->acpi_handle, i);
}
Expand Down Expand Up @@ -182,10 +183,10 @@ static int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm)
/* Buffers for id may need byteswapping ? */
in_params[1].type = ACPI_TYPE_BUFFER;
in_params[1].buffer.length = 512;
in_params[1].buffer.pointer = (u8 *)ap->device[0].id;
in_params[1].buffer.pointer = (u8 *)ap->link.device[0].id;
in_params[2].type = ACPI_TYPE_BUFFER;
in_params[2].buffer.length = 512;
in_params[2].buffer.pointer = (u8 *)ap->device[1].id;
in_params[2].buffer.pointer = (u8 *)ap->link.device[1].id;

input.count = 3;
input.pointer = in_params;
Expand Down Expand Up @@ -226,7 +227,7 @@ static int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm)
static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
void **ptr_to_free)
{
struct ata_port *ap = dev->ap;
struct ata_port *ap = dev->link->ap;
acpi_status status;
struct acpi_buffer output;
union acpi_object *out_obj;
Expand Down Expand Up @@ -320,7 +321,7 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
static int taskfile_load_raw(struct ata_device *dev,
const struct ata_acpi_gtf *gtf)
{
struct ata_port *ap = dev->ap;
struct ata_port *ap = dev->link->ap;
struct ata_taskfile tf, rtf;
unsigned int err_mask;

Expand Down Expand Up @@ -424,7 +425,7 @@ static int ata_acpi_exec_tfs(struct ata_device *dev)
*/
static int ata_acpi_push_id(struct ata_device *dev)
{
struct ata_port *ap = dev->ap;
struct ata_port *ap = dev->link->ap;
int err;
acpi_status status;
struct acpi_object_list input;
Expand Down Expand Up @@ -519,7 +520,7 @@ void ata_acpi_on_resume(struct ata_port *ap)

/* schedule _GTF */
for (i = 0; i < ATA_MAX_DEVICES; i++)
ap->device[i].flags |= ATA_DFLAG_ACPI_PENDING;
ap->link.device[i].flags |= ATA_DFLAG_ACPI_PENDING;
}

/**
Expand All @@ -538,8 +539,8 @@ void ata_acpi_on_resume(struct ata_port *ap)
*/
int ata_acpi_on_devcfg(struct ata_device *dev)
{
struct ata_port *ap = dev->ap;
struct ata_eh_context *ehc = &ap->eh_context;
struct ata_port *ap = dev->link->ap;
struct ata_eh_context *ehc = &ap->link.eh_context;
int acpi_sata = ap->flags & ATA_FLAG_ACPI_SATA;
int rc;

Expand Down
Loading

0 comments on commit 9af5c9c

Please sign in to comment.