grub2/0253-grub-core-disk-efi-efidisk.c-Handle-partitions-on-no.patch
2013-05-02 16:54:52 -04:00

75 lines
2.7 KiB
Diff

From 9c5d1aa956de89b429997b19e20cdd887f612414 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 4 Apr 2013 10:35:50 +0200
Subject: [PATCH 253/364] * grub-core/disk/efi/efidisk.c: Handle
partitions on non-512B disks.
---
ChangeLog | 5 +++++
grub-core/disk/efi/efidisk.c | 20 ++++++++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bd9e903..400a071 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
2013-04-04 Vladimir Serbinenko <phcoder@gmail.com>
+2013-04-04 Peter Jones <pjones@redhat.com>
+
+ * grub-core/disk/efi/efidisk.c: Handle partitions on non-512B disks.
+
+2013-04-04 Vladimir Serbinenko <phcoder@gmail.com>
Use TSC as a possible time source on i386-ieee1275.
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
index c883b2c..0a364f1 100644
--- a/grub-core/disk/efi/efidisk.c
+++ b/grub-core/disk/efi/efidisk.c
@@ -658,10 +658,12 @@ grub_efidisk_get_device_handle (grub_disk_t disk)
== GRUB_EFI_MEDIA_DEVICE_PATH_TYPE)
&& (GRUB_EFI_DEVICE_PATH_SUBTYPE (c->last_device_path)
== GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE)
- && (grub_partition_get_start (disk->partition)
- == hd.partition_start)
+ && (grub_partition_get_start (disk->partition)
+ == (hd.partition_start << (disk->log_sector_size
+ - GRUB_DISK_SECTOR_BITS)))
&& (grub_partition_get_len (disk->partition)
- == hd.partition_size))
+ == (hd.partition_size << (disk->log_sector_size
+ - GRUB_DISK_SECTOR_BITS))))
{
handle = c->handle;
break;
@@ -738,8 +740,12 @@ grub_efidisk_get_device_name_iter (grub_disk_t disk __attribute__ ((unused)),
{
struct grub_efidisk_get_device_name_ctx *ctx = data;
- if (grub_partition_get_start (part) == ctx->hd.partition_start
- && grub_partition_get_len (part) == ctx->hd.partition_size)
+ if (grub_partition_get_start (part)
+ == (ctx->hd.partition_start << (disk->log_sector_size
+ - GRUB_DISK_SECTOR_BITS))
+ && grub_partition_get_len (part)
+ == (ctx->hd.partition_size << (disk->log_sector_size
+ - GRUB_DISK_SECTOR_BITS)))
{
ctx->partition_name = grub_partition_get_name (part);
return 1;
@@ -798,7 +804,9 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
ctx.partition_name = NULL;
grub_memcpy (&ctx.hd, ldp, sizeof (ctx.hd));
if (ctx.hd.partition_start == 0
- && ctx.hd.partition_size == grub_disk_get_size (parent))
+ && (ctx.hd.partition_size << (parent->log_sector_size
+ - GRUB_DISK_SECTOR_BITS))
+ == grub_disk_get_size (parent))
{
dev_name = grub_strdup (parent->name);
}
--
1.8.1.4