Enforce disabling of firmware disk drivers when native drivers kick in.
This commit is contained in:
parent
ef9d8cd510
commit
e2f27a8c53
9 changed files with 52 additions and 34 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2013-04-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Enforce disabling of firmware disk drivers when native drivers kick in.
|
||||||
|
|
||||||
2013-04-29 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-04-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/commands/nativedisk.c: Customize the list of modules on
|
* grub-core/commands/nativedisk.c: Customize the list of modules on
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
#include <grub/loader.h>
|
#include <grub/loader.h>
|
||||||
#include <grub/cs5536.h>
|
#include <grub/cs5536.h>
|
||||||
|
#include <grub/disk.h>
|
||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
|
@ -1909,6 +1910,9 @@ GRUB_MOD_INIT (ehci)
|
||||||
{
|
{
|
||||||
COMPILE_TIME_ASSERT (sizeof (struct grub_ehci_td) == 64);
|
COMPILE_TIME_ASSERT (sizeof (struct grub_ehci_td) == 64);
|
||||||
COMPILE_TIME_ASSERT (sizeof (struct grub_ehci_qh) == 96);
|
COMPILE_TIME_ASSERT (sizeof (struct grub_ehci_qh) == 96);
|
||||||
|
|
||||||
|
grub_stop_disk_firmware ();
|
||||||
|
|
||||||
grub_boot_time ("Initing EHCI hardware");
|
grub_boot_time ("Initing EHCI hardware");
|
||||||
grub_ehci_inithw ();
|
grub_ehci_inithw ();
|
||||||
grub_boot_time ("Registering EHCI driver");
|
grub_boot_time ("Registering EHCI driver");
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
#include <grub/cs5536.h>
|
#include <grub/cs5536.h>
|
||||||
#include <grub/loader.h>
|
#include <grub/loader.h>
|
||||||
|
#include <grub/disk.h>
|
||||||
|
|
||||||
GRUB_MOD_LICENSE ("GPLv3+");
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
|
@ -1442,6 +1443,9 @@ GRUB_MOD_INIT(ohci)
|
||||||
{
|
{
|
||||||
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_td) == 32);
|
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_td) == 32);
|
||||||
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_ed) == 16);
|
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_ed) == 16);
|
||||||
|
|
||||||
|
grub_stop_disk_firmware ();
|
||||||
|
|
||||||
grub_ohci_inithw ();
|
grub_ohci_inithw ();
|
||||||
grub_usb_controller_dev_register (&usb_controller);
|
grub_usb_controller_dev_register (&usb_controller);
|
||||||
fini_hnd = grub_loader_register_preboot_hook (grub_ohci_fini_hw,
|
fini_hnd = grub_loader_register_preboot_hook (grub_ohci_fini_hw,
|
||||||
|
|
|
@ -866,6 +866,8 @@ static struct grub_usb_controller_dev usb_controller =
|
||||||
|
|
||||||
GRUB_MOD_INIT(uhci)
|
GRUB_MOD_INIT(uhci)
|
||||||
{
|
{
|
||||||
|
grub_stop_disk_firmware ();
|
||||||
|
|
||||||
grub_uhci_inithw ();
|
grub_uhci_inithw ();
|
||||||
grub_usb_controller_dev_register (&usb_controller);
|
grub_usb_controller_dev_register (&usb_controller);
|
||||||
grub_dprintf ("uhci", "registered\n");
|
grub_dprintf ("uhci", "registered\n");
|
||||||
|
|
|
@ -183,11 +183,6 @@ grub_ahci_pciinit (grub_pci_device_t dev,
|
||||||
if (class >> 8 != 0x010601)
|
if (class >> 8 != 0x010601)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_QEMU
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
|
|
||||||
grub_pci_write_word (addr, 0x107);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG5);
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG5);
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_QEMU
|
#ifdef GRUB_MACHINE_QEMU
|
||||||
|
@ -1102,13 +1097,7 @@ static struct grub_preboot *fini_hnd;
|
||||||
|
|
||||||
GRUB_MOD_INIT(ahci)
|
GRUB_MOD_INIT(ahci)
|
||||||
{
|
{
|
||||||
/* To prevent two drivers operating on the same disks. */
|
grub_stop_disk_firmware ();
|
||||||
grub_disk_firmware_is_tainted = 1;
|
|
||||||
if (grub_disk_firmware_fini)
|
|
||||||
{
|
|
||||||
grub_disk_firmware_fini ();
|
|
||||||
grub_disk_firmware_fini = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* AHCI initialization. */
|
/* AHCI initialization. */
|
||||||
grub_ahci_initialize ();
|
grub_ahci_initialize ();
|
||||||
|
|
|
@ -623,22 +623,27 @@ static struct grub_disk_dev grub_efidisk_dev =
|
||||||
.next = 0
|
.next = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
|
||||||
grub_efidisk_init (void)
|
|
||||||
{
|
|
||||||
enumerate_disks ();
|
|
||||||
grub_disk_dev_register (&grub_efidisk_dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_efidisk_fini (void)
|
grub_efidisk_fini (void)
|
||||||
{
|
{
|
||||||
free_devices (fd_devices);
|
free_devices (fd_devices);
|
||||||
free_devices (hd_devices);
|
free_devices (hd_devices);
|
||||||
free_devices (cd_devices);
|
free_devices (cd_devices);
|
||||||
|
fd_devices = 0;
|
||||||
|
hd_devices = 0;
|
||||||
|
cd_devices = 0;
|
||||||
grub_disk_dev_unregister (&grub_efidisk_dev);
|
grub_disk_dev_unregister (&grub_efidisk_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_efidisk_init (void)
|
||||||
|
{
|
||||||
|
grub_disk_firmware_fini = grub_efidisk_fini;
|
||||||
|
|
||||||
|
enumerate_disks ();
|
||||||
|
grub_disk_dev_register (&grub_efidisk_dev);
|
||||||
|
}
|
||||||
|
|
||||||
/* Some utility functions to map GRUB devices with EFI devices. */
|
/* Some utility functions to map GRUB devices with EFI devices. */
|
||||||
grub_efi_handle_t
|
grub_efi_handle_t
|
||||||
grub_efidisk_get_device_handle (grub_disk_t disk)
|
grub_efidisk_get_device_handle (grub_disk_t disk)
|
||||||
|
|
|
@ -549,14 +549,6 @@ insert_bootpath (void)
|
||||||
grub_free (bootpath);
|
grub_free (bootpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
grub_ofdisk_init (void)
|
|
||||||
{
|
|
||||||
insert_bootpath ();
|
|
||||||
|
|
||||||
grub_disk_dev_register (&grub_ofdisk_dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_ofdisk_fini (void)
|
grub_ofdisk_fini (void)
|
||||||
{
|
{
|
||||||
|
@ -568,6 +560,16 @@ grub_ofdisk_fini (void)
|
||||||
grub_disk_dev_unregister (&grub_ofdisk_dev);
|
grub_disk_dev_unregister (&grub_ofdisk_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_ofdisk_init (void)
|
||||||
|
{
|
||||||
|
grub_disk_firmware_fini = grub_ofdisk_fini;
|
||||||
|
|
||||||
|
insert_bootpath ();
|
||||||
|
|
||||||
|
grub_disk_dev_register (&grub_ofdisk_dev);
|
||||||
|
}
|
||||||
|
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size)
|
grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -530,13 +530,7 @@ static struct grub_ata_dev grub_pata_dev =
|
||||||
|
|
||||||
GRUB_MOD_INIT(ata_pthru)
|
GRUB_MOD_INIT(ata_pthru)
|
||||||
{
|
{
|
||||||
/* To prevent two drivers operating on the same disks. */
|
grub_stop_disk_firmware ();
|
||||||
grub_disk_firmware_is_tainted = 1;
|
|
||||||
if (grub_disk_firmware_fini)
|
|
||||||
{
|
|
||||||
grub_disk_firmware_fini ();
|
|
||||||
grub_disk_firmware_fini = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ATA initialization. */
|
/* ATA initialization. */
|
||||||
grub_pata_initialize ();
|
grub_pata_initialize ();
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/device.h>
|
#include <grub/device.h>
|
||||||
|
/* For NULL. */
|
||||||
|
#include <grub/mm.h>
|
||||||
|
|
||||||
/* These are used to set a device id. When you add a new disk device,
|
/* These are used to set a device id. When you add a new disk device,
|
||||||
you must define a new id for it here. */
|
you must define a new id for it here. */
|
||||||
|
@ -205,6 +207,18 @@ EXPORT_FUNC(grub_disk_cache_get_performance) (unsigned long *hits, unsigned long
|
||||||
extern void (* EXPORT_VAR(grub_disk_firmware_fini)) (void);
|
extern void (* EXPORT_VAR(grub_disk_firmware_fini)) (void);
|
||||||
extern int EXPORT_VAR(grub_disk_firmware_is_tainted);
|
extern int EXPORT_VAR(grub_disk_firmware_is_tainted);
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_stop_disk_firmware (void)
|
||||||
|
{
|
||||||
|
/* To prevent two drivers operating on the same disks. */
|
||||||
|
grub_disk_firmware_is_tainted = 1;
|
||||||
|
if (grub_disk_firmware_fini)
|
||||||
|
{
|
||||||
|
grub_disk_firmware_fini ();
|
||||||
|
grub_disk_firmware_fini = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined (GRUB_UTIL)
|
#if defined (GRUB_UTIL)
|
||||||
void grub_lvm_init (void);
|
void grub_lvm_init (void);
|
||||||
void grub_ldm_init (void);
|
void grub_ldm_init (void);
|
||||||
|
|
Loading…
Reference in a new issue