* grub-core/disk/ieee1275/ofdisk.c (quiesce): New function.

(grub_ofdisk_fini): Quiesce USB devices.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-06-06 19:00:04 +02:00
parent 49cea015c0
commit 7bc06a4995
2 changed files with 37 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2012-06-06 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/ieee1275/ofdisk.c (quiesce): New function.
(grub_ofdisk_fini): Quiesce USB devices.
2012-06-06 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/powerpc/ieee1275/linux.c (grub_linux_boot): Sync

View file

@ -23,6 +23,7 @@
#include <grub/ieee1275/ieee1275.h>
#include <grub/ieee1275/ofdisk.h>
#include <grub/i18n.h>
#include <grub/time.h>
static char *last_devpath;
static grub_ieee1275_ihandle_t last_ihandle;
@ -475,6 +476,34 @@ grub_ofdisk_init (void)
grub_disk_dev_register (&grub_ofdisk_dev);
}
static int quiesce (struct grub_ieee1275_devalias *alias)
{
static grub_ieee1275_ihandle_t ihandle;
struct set_color_args
{
struct grub_ieee1275_common_hdr common;
grub_ieee1275_cell_t method;
grub_ieee1275_cell_t ihandle;
grub_ieee1275_cell_t catch_result;
}
args;
if (grub_strcmp (alias->type, "usb") != 0)
return 0;
if (grub_ieee1275_open (alias->path, &ihandle))
return 0;
INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 1);
args.method = (grub_ieee1275_cell_t) "usb-quiesce";
args.ihandle = ihandle;
IEEE1275_CALL_ENTRY_FN (&args);
grub_ieee1275_close (ihandle);
return 0;
}
void
grub_ofdisk_fini (void)
{
@ -483,5 +512,8 @@ grub_ofdisk_fini (void)
last_ihandle = 0;
last_devpath = NULL;
grub_ieee1275_devices_iterate (quiesce);
grub_millisleep (10);
grub_disk_dev_unregister (&grub_ofdisk_dev);
}