|
|
d41074 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
a85e8e |
From: Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a85e8e |
Date: Wed, 29 Jan 2014 23:49:51 +0100
|
|
|
d41074 |
Subject: [PATCH] * grub-core/disk/ahci.c: Properly handle transactions with no
|
|
|
d41074 |
transferred data.
|
|
|
a85e8e |
|
|
|
a85e8e |
---
|
|
|
a85e8e |
grub-core/disk/ahci.c | 7 +++++--
|
|
|
d41074 |
ChangeLog | 5 +++++
|
|
|
a85e8e |
2 files changed, 10 insertions(+), 2 deletions(-)
|
|
|
a85e8e |
|
|
|
a85e8e |
diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c
|
|
|
d41074 |
index 643e691ef80..fdd40c64dd9 100644
|
|
|
a85e8e |
--- a/grub-core/disk/ahci.c
|
|
|
a85e8e |
+++ b/grub-core/disk/ahci.c
|
|
|
a85e8e |
@@ -932,7 +932,10 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
|
|
|
a85e8e |
if (parms->size > GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH)
|
|
|
a85e8e |
return grub_error (GRUB_ERR_BUG, "too big data buffer");
|
|
|
a85e8e |
|
|
|
a85e8e |
- bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
|
|
|
a85e8e |
+ if (parms->size)
|
|
|
a85e8e |
+ bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
|
|
|
a85e8e |
+ else
|
|
|
a85e8e |
+ bufc = grub_memalign_dma32 (1024, 512);
|
|
|
a85e8e |
|
|
|
a85e8e |
grub_dprintf ("ahci", "AHCI tfd = %x, CL=%p\n",
|
|
|
a85e8e |
dev->hba->ports[dev->port].task_file_data,
|
|
|
a85e8e |
@@ -942,7 +945,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
|
|
|
a85e8e |
= (5 << GRUB_AHCI_CONFIG_CFIS_LENGTH_SHIFT)
|
|
|
a85e8e |
// | GRUB_AHCI_CONFIG_CLEAR_R_OK
|
|
|
a85e8e |
| (0 << GRUB_AHCI_CONFIG_PMP_SHIFT)
|
|
|
a85e8e |
- | (1 << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT)
|
|
|
a85e8e |
+ | ((parms->size ? 1 : 0) << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT)
|
|
|
a85e8e |
| (parms->cmdsize ? GRUB_AHCI_CONFIG_ATAPI : 0)
|
|
|
a85e8e |
| (parms->write ? GRUB_AHCI_CONFIG_WRITE : GRUB_AHCI_CONFIG_READ)
|
|
|
a85e8e |
| (parms->taskfile.cmd == 8 ? (1 << 8) : 0);
|
|
|
d41074 |
diff --git a/ChangeLog b/ChangeLog
|
|
|
d41074 |
index 15300b020c6..bc1ab231b02 100644
|
|
|
d41074 |
--- a/ChangeLog
|
|
|
d41074 |
+++ b/ChangeLog
|
|
|
d41074 |
@@ -1,3 +1,8 @@
|
|
|
d41074 |
+2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
d41074 |
+
|
|
|
d41074 |
+ * grub-core/disk/ahci.c: Properly handle transactions with no
|
|
|
d41074 |
+ transferred data.
|
|
|
d41074 |
+
|
|
|
d41074 |
2014-01-29 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
d41074 |
|
|
|
d41074 |
* grub-core/disk/ahci.c: Add safety cleanups.
|