|
|
6b3c76 |
From cbe41438563125a6f5aa4225c987b70abda81753 Mon Sep 17 00:00:00 2001
|
|
|
a85e8e |
From: Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a85e8e |
Date: Wed, 29 Jan 2014 23:46:17 +0100
|
|
|
6b3c76 |
Subject: [PATCH 053/261] * grub-core/disk/ahci.c: Add safety cleanups.
|
|
|
a85e8e |
|
|
|
a85e8e |
---
|
|
|
d41074 |
ChangeLog | 4 ++++
|
|
|
6b3c76 |
grub-core/disk/ahci.c | 10 ++++++++++
|
|
|
a85e8e |
2 files changed, 14 insertions(+)
|
|
|
a85e8e |
|
|
|
6b3c76 |
diff --git a/ChangeLog b/ChangeLog
|
|
|
6b3c76 |
index 9bb181777..15300b020 100644
|
|
|
6b3c76 |
--- a/ChangeLog
|
|
|
6b3c76 |
+++ b/ChangeLog
|
|
|
6b3c76 |
@@ -1,5 +1,9 @@
|
|
|
6b3c76 |
2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
6b3c76 |
|
|
|
6b3c76 |
+ * grub-core/disk/ahci.c: Add safety cleanups.
|
|
|
6b3c76 |
+
|
|
|
6b3c76 |
+2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
6b3c76 |
+
|
|
|
6b3c76 |
* grub-core/disk/ahci.c: Allocate and clean space for all possible 32
|
|
|
6b3c76 |
slots to avoid pointing to uninited area.
|
|
|
6b3c76 |
|
|
|
a85e8e |
diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c
|
|
|
6b3c76 |
index d63fd09fd..643e691ef 100644
|
|
|
a85e8e |
--- a/grub-core/disk/ahci.c
|
|
|
a85e8e |
+++ b/grub-core/disk/ahci.c
|
|
|
a85e8e |
@@ -454,6 +454,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
|
|
|
a85e8e |
adevs[i]->hba->ports[adevs[i]->port].fis_base = grub_dma_get_phys (adevs[i]->rfis);
|
|
|
a85e8e |
adevs[i]->hba->ports[adevs[i]->port].command_list_base
|
|
|
a85e8e |
= grub_dma_get_phys (adevs[i]->command_list_chunk);
|
|
|
a85e8e |
+ adevs[i]->hba->ports[adevs[i]->port].command_issue = 0;
|
|
|
a85e8e |
adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_FRE;
|
|
|
a85e8e |
}
|
|
|
a85e8e |
|
|
|
a85e8e |
@@ -600,6 +601,9 @@ grub_ahci_pciinit (grub_pci_device_t dev,
|
|
|
a85e8e |
failed_adevs[i] = adevs[i];
|
|
|
a85e8e |
adevs[i] = 0;
|
|
|
a85e8e |
}
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ grub_dprintf ("ahci", "cleaning up failed devs\n");
|
|
|
a85e8e |
+
|
|
|
a85e8e |
for (i = 0; i < nports; i++)
|
|
|
a85e8e |
if (failed_adevs[i] && (fr_running & (1 << i)))
|
|
|
a85e8e |
failed_adevs[i]->hba->ports[failed_adevs[i]->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_FRE;
|
|
|
a85e8e |
@@ -855,6 +859,12 @@ grub_ahci_reset_port (struct grub_ahci_device *dev, int force)
|
|
|
a85e8e |
{
|
|
|
a85e8e |
struct grub_disk_ata_pass_through_parms parms2;
|
|
|
a85e8e |
dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST;
|
|
|
a85e8e |
+ dev->hba->ports[dev->port].command_issue = 0;
|
|
|
a85e8e |
+ dev->command_list[0].config = 0;
|
|
|
a85e8e |
+ dev->command_table[0].prdt[0].unused = 0;
|
|
|
a85e8e |
+ dev->command_table[0].prdt[0].size = 0;
|
|
|
a85e8e |
+ dev->command_table[0].prdt[0].data_base = 0;
|
|
|
a85e8e |
+
|
|
|
a85e8e |
endtime = grub_get_time_ms () + 1000;
|
|
|
a85e8e |
while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR))
|
|
|
a85e8e |
if (grub_get_time_ms () > endtime)
|
|
|
6b3c76 |
--
|
|
|
6b3c76 |
2.13.5
|
|
|
6b3c76 |
|