From a2bf9168b1a0e964b9db4bd2887aafdcf400d772 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 6 Jun 2012 12:14:19 -0400 Subject: [PATCH] Quiesce USB transactions on ppc. --- grub-core/disk/ieee1275/ofdisk.c | 32 +++++++++++++++++++++++++++++ grub-core/loader/powerpc/ieee1275/linux.c | 2 ++ 2 files changed, 34 insertions(+) diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c index 7266af6..b5bb713 100644 --- a/grub-core/disk/ieee1275/ofdisk.c +++ b/grub-core/disk/ieee1275/ofdisk.c @@ -23,6 +23,7 @@ #include #include #include +#include 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); } diff --git a/grub-core/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c index 5cfa988..a1abc2a 100644 --- a/grub-core/loader/powerpc/ieee1275/linux.c +++ b/grub-core/loader/powerpc/ieee1275/linux.c @@ -28,6 +28,7 @@ #include #include #include +#include GRUB_MOD_LICENSE ("GPLv3+"); @@ -102,6 +103,7 @@ grub_linux_boot (void) kernel_entry_t linuxmain; grub_ssize_t actual; + grub_arch_sync_caches ((void *) linux_addr, linux_size); /* Set the command line arguments. */ grub_ieee1275_set_property (grub_ieee1275_chosen, "bootargs", linux_args, grub_strlen (linux_args) + 1, &actual); -- 1.7.10.2