aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Milburn <dmilburn@redhat.com>2009-04-03 16:36:41 -0400
committerJeff Garzik <jgarzik@redhat.com>2009-04-06 20:00:53 -0400
commit4c1e9aa41b2f9afe8f26e2efe5bb4695f6c40772 (patch)
tree6e54bb654c4cc2b33f132444b516fcd67224f3b9 /drivers
parent0c659b82d11eaf5e1bee1f2bcb9994b9d09d175c (diff)
libata: ahci enclosure management bios workaround
During driver initialization ahci_start_port may not be able to turn LEDs off because the hardware may still be transmitting a message. And since the BIOS may not be setting the LEDs to off the drive LEDs may end up in a fault state. This has been seen on ICH9r and ICH10r when configured in AHCI mode instead of RAID mode, this patch doesn't key off a specific set of device IDs but will give the EM transmit bit a chance to clear if busy. Signed-off-by: David Milburn <dmilburn@redhat.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ahci.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 788bba2b1e17..6ca4bc0fcae3 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -78,6 +78,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
78static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, 78static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
79 ssize_t size); 79 ssize_t size);
80#define MAX_SLOTS 8 80#define MAX_SLOTS 8
81#define MAX_RETRY 15
81 82
82enum { 83enum {
83 AHCI_PCI_BAR = 5, 84 AHCI_PCI_BAR = 5,
@@ -1115,6 +1116,8 @@ static void ahci_start_port(struct ata_port *ap)
1115 struct ahci_port_priv *pp = ap->private_data; 1116 struct ahci_port_priv *pp = ap->private_data;
1116 struct ata_link *link; 1117 struct ata_link *link;
1117 struct ahci_em_priv *emp; 1118 struct ahci_em_priv *emp;
1119 ssize_t rc;
1120 int i;
1118 1121
1119 /* enable FIS reception */ 1122 /* enable FIS reception */
1120 ahci_start_fis_rx(ap); 1123 ahci_start_fis_rx(ap);
@@ -1126,7 +1129,17 @@ static void ahci_start_port(struct ata_port *ap)
1126 if (ap->flags & ATA_FLAG_EM) { 1129 if (ap->flags & ATA_FLAG_EM) {
1127 ata_for_each_link(link, ap, EDGE) { 1130 ata_for_each_link(link, ap, EDGE) {
1128 emp = &pp->em_priv[link->pmp]; 1131 emp = &pp->em_priv[link->pmp];
1129 ahci_transmit_led_message(ap, emp->led_state, 4); 1132
1133 /* EM Transmit bit maybe busy during init */
1134 for (i = 0; i < MAX_RETRY; i++) {
1135 rc = ahci_transmit_led_message(ap,
1136 emp->led_state,
1137 4);
1138 if (rc == -EBUSY)
1139 udelay(100);
1140 else
1141 break;
1142 }
1130 } 1143 }
1131 } 1144 }
1132 1145
@@ -1331,7 +1344,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
1331 em_ctl = readl(mmio + HOST_EM_CTL); 1344 em_ctl = readl(mmio + HOST_EM_CTL);
1332 if (em_ctl & EM_CTL_TM) { 1345 if (em_ctl & EM_CTL_TM) {
1333 spin_unlock_irqrestore(ap->lock, flags); 1346 spin_unlock_irqrestore(ap->lock, flags);
1334 return -EINVAL; 1347 return -EBUSY;
1335 } 1348 }
1336 1349
1337 /* 1350 /*