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