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