Commit fafbae87 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

libata-acpi: implement ata_acpi_associate()

* Add acpi_handle to ata_host and ata_port.  Rename
  ata_device->obj_handle to ->acpi_handle and move it above such that
  it doesn't get cleared on reconfiguration.

* Replace ACPI node association which ata_acpi_associate() which is
  called once during host initialization.  Unlike the previous
  implementation, ata_acpi_associate() uses ATA_FLAG_ACPI_SATA to
  choose between IDE or SATA ACPI hierarchy and uses simple child look
  up instead of recursive walk to match the nodes.  This is way safer
  and simpler.  Please read the following message for more info.

  http://article.gmane.org/gmane.linux.ide/17554Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 7dcca30a
This diff is collapsed.
...@@ -6293,6 +6293,9 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) ...@@ -6293,6 +6293,9 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
if (rc) if (rc)
return rc; return rc;
/* associate with ACPI nodes */
ata_acpi_associate(host);
/* set cable, sata_spd_limit and report */ /* set cable, sata_spd_limit and report */
for (i = 0; i < host->n_ports; i++) { for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap = host->ports[i]; struct ata_port *ap = host->ports[i];
......
...@@ -98,9 +98,11 @@ extern struct ata_port *ata_port_alloc(struct ata_host *host); ...@@ -98,9 +98,11 @@ extern struct ata_port *ata_port_alloc(struct ata_host *host);
/* libata-acpi.c */ /* libata-acpi.c */
#ifdef CONFIG_ATA_ACPI #ifdef CONFIG_ATA_ACPI
extern void ata_acpi_associate(struct ata_host *host);
extern int ata_acpi_exec_tfs(struct ata_port *ap); extern int ata_acpi_exec_tfs(struct ata_port *ap);
extern int ata_acpi_push_id(struct ata_device *dev); extern int ata_acpi_push_id(struct ata_device *dev);
#else #else
static inline void ata_acpi_associate(struct ata_host *host) { }
static inline int ata_acpi_exec_tfs(struct ata_port *ap) static inline int ata_acpi_exec_tfs(struct ata_port *ap)
{ {
return 0; return 0;
......
...@@ -363,6 +363,9 @@ struct ata_host { ...@@ -363,6 +363,9 @@ struct ata_host {
void *private_data; void *private_data;
const struct ata_port_operations *ops; const struct ata_port_operations *ops;
unsigned long flags; unsigned long flags;
#ifdef CONFIG_ATA_ACPI
acpi_handle acpi_handle;
#endif
struct ata_port *simplex_claimed; /* channel owning the DMA */ struct ata_port *simplex_claimed; /* channel owning the DMA */
struct ata_port *ports[0]; struct ata_port *ports[0];
}; };
...@@ -429,6 +432,9 @@ struct ata_device { ...@@ -429,6 +432,9 @@ struct ata_device {
unsigned int devno; /* 0 or 1 */ unsigned int devno; /* 0 or 1 */
unsigned long flags; /* ATA_DFLAG_xxx */ unsigned long flags; /* ATA_DFLAG_xxx */
struct scsi_device *sdev; /* attached SCSI device */ struct scsi_device *sdev; /* attached SCSI device */
#ifdef CONFIG_ATA_ACPI
acpi_handle acpi_handle;
#endif
/* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
u64 n_sectors; /* size of device, if ATA */ u64 n_sectors; /* size of device, if ATA */
unsigned int class; /* ATA_DEV_xxx */ unsigned int class; /* ATA_DEV_xxx */
...@@ -457,10 +463,6 @@ struct ata_device { ...@@ -457,10 +463,6 @@ struct ata_device {
struct ata_ering ering; struct ata_ering ering;
int spdn_cnt; int spdn_cnt;
unsigned int horkage; /* List of broken features */ unsigned int horkage; /* List of broken features */
#ifdef CONFIG_ATA_ACPI
/* ACPI objects info */
acpi_handle obj_handle;
#endif
}; };
/* Offset into struct ata_device. Fields above it are maintained /* Offset into struct ata_device. Fields above it are maintained
...@@ -549,6 +551,9 @@ struct ata_port { ...@@ -549,6 +551,9 @@ struct ata_port {
void *private_data; void *private_data;
#ifdef CONFIG_ATA_ACPI
acpi_handle acpi_handle;
#endif
u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */
}; };
......
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