1 From 4c1e9aa41b2f9afe8f26e2efe5bb4695f6c40772 Mon Sep 17 00:00:00 2001
2 From: David Milburn <dmilburn@redhat.com>
3 Date: Fri, 3 Apr 2009 15:36:41 -0500
4 Subject: libata: ahci enclosure management bios workaround
7 During driver initialization ahci_start_port may not be able
8 to turn LEDs off because the hardware may still be transmitting
9 a message. And since the BIOS may not be setting the LEDs to
10 off the drive LEDs may end up in a fault state. This has
11 been seen on ICH9r and ICH10r when configured in AHCI mode
12 instead of RAID mode, this patch doesn't key off a specific
13 set of device IDs but will give the EM transmit bit a chance
16 Signed-off-by: David Milburn <dmilburn@redhat.com>
17 Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
18 Signed-off-by: Tejun Heo <teheo@suse.de>
20 drivers/ata/ahci.c | 17 +++++++++++++++--
21 1 file changed, 15 insertions(+), 2 deletions(-)
23 Index: linux-2.6.27-SLE11_BRANCH/drivers/ata/ahci.c
24 ===================================================================
25 --- linux-2.6.27-SLE11_BRANCH.orig/drivers/ata/ahci.c
26 +++ linux-2.6.27-SLE11_BRANCH/drivers/ata/ahci.c
27 @@ -62,6 +62,7 @@ static ssize_t ahci_led_store(struct ata
28 static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
35 @@ -1095,6 +1096,8 @@ static void ahci_start_port(struct ata_p
36 struct ahci_port_priv *pp = ap->private_data;
37 struct ata_link *link;
38 struct ahci_em_priv *emp;
42 /* enable FIS reception */
43 ahci_start_fis_rx(ap);
44 @@ -1106,7 +1109,17 @@ static void ahci_start_port(struct ata_p
45 if (ap->flags & ATA_FLAG_EM) {
46 ata_port_for_each_link(link, ap) {
47 emp = &pp->em_priv[link->pmp];
48 - ahci_transmit_led_message(ap, emp->led_state, 4);
50 + /* EM Transmit bit maybe busy during init */
51 + for (i = 0; i < MAX_RETRY; i++) {
52 + rc = ahci_transmit_led_message(ap,
63 @@ -1308,7 +1321,7 @@ static ssize_t ahci_transmit_led_message
64 em_ctl = readl(mmio + HOST_EM_CTL);
65 if (em_ctl & EM_CTL_TM) {
66 spin_unlock_irqrestore(ap->lock, flags);