grub2/0322-grub-core-disk-efi-efidisk.c-Detect-floppies-by-ACPI.patch
2013-06-07 14:03:56 -04:00

66 lines
2 KiB
Diff

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