a5bd9f6
From 8730a9587670ebd5f7cb14d6bd5e4c7d4003a71d Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Wed, 17 Apr 2013 19:05:57 +0200
a5bd9f6
Subject: [PATCH 321/364] 	* grub-core/disk/efi/efidisk.c: Detect
a5bd9f6
 floppies by ACPI ID. 	It improves performance in qemu.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog                    |  5 +++++
a5bd9f6
 grub-core/disk/efi/efidisk.c | 18 ++++++++++++++----
a5bd9f6
 2 files changed, 19 insertions(+), 4 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 073207a..9d77a7f 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,5 +1,10 @@
a5bd9f6
 2013-04-17  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
+	* grub-core/disk/efi/efidisk.c: Detect floppies by ACPI ID.
a5bd9f6
+	It improves performance in qemu.
a5bd9f6
+
a5bd9f6
+2013-04-17  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
 	* build-aux/snippet: Add missing gnulib files.
a5bd9f6
 
a5bd9f6
 2013-04-16  Andrey Borzenkov <arvidjaar@gmail.com>
a5bd9f6
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
a5bd9f6
index 0e08d3b..e168d07 100644
a5bd9f6
--- a/grub-core/disk/efi/efidisk.c
a5bd9f6
+++ b/grub-core/disk/efi/efidisk.c
a5bd9f6
@@ -329,18 +329,28 @@ name_devices (struct grub_efidisk_data *devices)
a5bd9f6
     {
a5bd9f6
       grub_efi_device_path_t *dp;
a5bd9f6
       grub_efi_block_io_media_t *m;
a5bd9f6
+      int is_floppy = 0;
a5bd9f6
 
a5bd9f6
       dp = d->last_device_path;
a5bd9f6
       if (! dp)
a5bd9f6
 	continue;
a5bd9f6
 
a5bd9f6
       m = d->block_io->media;
a5bd9f6
-      if (m->logical_partition)
a5bd9f6
+      if (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_ACPI_DEVICE_PATH_TYPE
a5bd9f6
+	  && GRUB_EFI_DEVICE_PATH_SUBTYPE (dp)
a5bd9f6
+	  == GRUB_EFI_ACPI_DEVICE_PATH_SUBTYPE)
a5bd9f6
+	{
a5bd9f6
+	  grub_efi_acpi_device_path_t *acpi
a5bd9f6
+	    = (grub_efi_acpi_device_path_t *) dp;
a5bd9f6
+	  /* Floppy EISA ID.  */ 
a5bd9f6
+	  if (acpi->hid == 0x60441d0 || acpi->hid == 0x70041d0
a5bd9f6
+	      || acpi->hid == 0x70141d1)
a5bd9f6
+	    is_floppy = 1;
a5bd9f6
+	}
a5bd9f6
+      if (is_floppy)
a5bd9f6
 	{
a5bd9f6
-	  /* Only one partition in a non-media device. Assume that this
a5bd9f6
-	     is a floppy drive.  */
a5bd9f6
 #ifdef DEBUG_NAMES
a5bd9f6
-	  grub_printf ("adding a floppy by guessing: ");
a5bd9f6
+	  grub_printf ("adding a floppy: ");
a5bd9f6
 	  grub_efi_print_device_path (d->device_path);
a5bd9f6
 #endif
a5bd9f6
 	  add_device (&fd_devices, d);
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6