[grub2/f18] Work around AHCI firmware bug in efidisk driver.

Peter Jones pjones at fedoraproject.org
Wed Aug 15 18:40:27 UTC 2012


commit c1a25d07e636b5164c7ae225fbd395baed464af5
Author: Peter Jones <pjones at redhat.com>
Date:   Wed Aug 15 14:40:02 2012 -0400

    Work around AHCI firmware bug in efidisk driver.
    
    - Move to newer pesign macros
    - Don't allow insmod if we're in secure-boot mode.

 grub-2.00-efidisk-ahci-workaround.patch |   60 +++++++++++++++++++++++++++++++
 grub2.spec                              |    2 +
 2 files changed, 62 insertions(+), 0 deletions(-)
---
diff --git a/grub-2.00-efidisk-ahci-workaround.patch b/grub-2.00-efidisk-ahci-workaround.patch
new file mode 100644
index 0000000..36a91c8
--- /dev/null
+++ b/grub-2.00-efidisk-ahci-workaround.patch
@@ -0,0 +1,60 @@
+From 61474615b8e177881caa89fc04cae16019cf01b9 Mon Sep 17 00:00:00 2001
+From: Matthew Garrett <mjg at redhat.com>
+Date: Wed, 15 Aug 2012 14:37:07 -0400
+Subject: [PATCH] efidisk: Read chunks in smaller blocks
+
+---
+ grub-core/disk/efi/efidisk.c | 26 ++++++++++++++++++++++----
+ 1 file changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
+index a432b44..77ab5b0 100644
+--- a/grub-core/disk/efi/efidisk.c
++++ b/grub-core/disk/efi/efidisk.c
+@@ -546,6 +546,9 @@ grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector,
+   struct grub_efidisk_data *d;
+   grub_efi_block_io_t *bio;
+   grub_efi_status_t status;
++  grub_size_t remaining = size;
++  grub_size_t read = 0;
++  grub_size_t chunk = 0x500;
+ 
+   d = disk->data;
+   bio = d->block_io;
+@@ -554,14 +557,29 @@ grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector,
+ 		"reading 0x%lx sectors at the sector 0x%llx from %s\n",
+ 		(unsigned long) size, (unsigned long long) sector, disk->name);
+ 
++  while (remaining > chunk) {
++    status = efi_call_5 (bio->read_blocks, bio, bio->media->media_id,
++			 (grub_efi_uint64_t) sector + read,
++			 (grub_efi_uintn_t) chunk << disk->log_sector_size,
++			 buf + (read << disk->log_sector_size));
++    if (status != GRUB_EFI_SUCCESS)
++      return grub_error (GRUB_ERR_READ_ERROR,
++			 N_("failure reading sector 0x%llx from `%s'"),
++			 (unsigned long long) sector + read,
++			 disk->name);
++    read += chunk;
++    remaining -= chunk;
++  }
++
+   status = efi_call_5 (bio->read_blocks, bio, bio->media->media_id,
+-		       (grub_efi_uint64_t) sector,
+-		       (grub_efi_uintn_t) size << disk->log_sector_size,
+-		       buf);
++		       (grub_efi_uint64_t) sector + read,
++		       (grub_efi_uintn_t) remaining << disk->log_sector_size,
++		       buf + (read << disk->log_sector_size));
++
+   if (status != GRUB_EFI_SUCCESS)
+     return grub_error (GRUB_ERR_READ_ERROR,
+ 		       N_("failure reading sector 0x%llx from `%s'"),
+-		       (unsigned long long) sector,
++		       (unsigned long long) sector + read,
+ 		       disk->name);
+ 
+   return GRUB_ERR_NONE;
+-- 
+1.7.11.2
+
diff --git a/grub2.spec b/grub2.spec
index 7877590..db591e1 100644
--- a/grub2.spec
+++ b/grub2.spec
@@ -65,6 +65,7 @@ Patch21:	grub2-cdpath.patch
 Patch22:	grub2-use-linuxefi.patch
 Patch23:	grub-2.00-dont-decrease-mmap-size.patch
 Patch24:	grub-2.00-no-insmod-on-sb.patch
+Patch25:	grub-2.00-efidisk-ahci-workaround.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -416,6 +417,7 @@ fi
 
 %changelog
 * Tue Aug 14 2012 Peter Jones <pjones at redhat.com> - 2.00-5
+- Work around AHCI firmware bug in efidisk driver.
 - Move to newer pesign macros
 - Don't allow insmod if we're in secure-boot mode.
 


More information about the scm-commits mailing list