Work around AHCI firmware bug in efidisk driver.

- Move to newer pesign macros
- Don't allow insmod if we're in secure-boot mode.
This commit is contained in:
Peter Jones 2012-08-15 14:40:02 -04:00
parent f1d3c740c6
commit c1a25d07e6
2 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,60 @@
From 61474615b8e177881caa89fc04cae16019cf01b9 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg@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

View File

@ -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@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.