From 3314aa5e45c5b425c6ea14424dc42e8d4d784e9f Mon Sep 17 00:00:00 2001 From: root Date: Wed, 23 Oct 2013 18:24:09 +0100 Subject: disabling GOP/UGA blanks the screen - FFS apple --- master/jmm/xen-multiboot | 174 ++++++++++++++++++++++++++++++++++++++++------- master/status | 53 --------------- 2 files changed, 151 insertions(+), 76 deletions(-) diff --git a/master/jmm/xen-multiboot b/master/jmm/xen-multiboot index c2769ec..52b3e89 100644 --- a/master/jmm/xen-multiboot +++ b/master/jmm/xen-multiboot @@ -1,10 +1,18 @@ Index: grub2/conf/i386-efi.rmk =================================================================== diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c -index d9e74b3..9277b0a 100644 +index d9e74b3..afd0e25 100644 --- a/grub-core/loader/multiboot.c +++ b/grub-core/loader/multiboot.c -@@ -42,6 +42,7 @@ +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -42,6 +43,7 @@ #include #include #include @@ -12,11 +20,10 @@ index d9e74b3..9277b0a 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -51,6 +52,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); +@@ -51,6 +53,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); struct grub_relocator *grub_multiboot_relocator = NULL; grub_uint32_t grub_multiboot_payload_eip; -+void *xen_base = NULL; + #if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) #define DEFAULT_VIDEO_MODE "text" @@ -30,7 +37,7 @@ index d9e74b3..9277b0a 100644 /* Return the length of the Multiboot mmap that will be needed to allocate our platform's map. */ grub_uint32_t -@@ -112,6 +117,36 @@ grub_multiboot_set_video_mode (void) +@@ -112,6 +117,34 @@ grub_multiboot_set_video_mode (void) } static grub_err_t @@ -46,9 +53,7 @@ index d9e74b3..9277b0a 100644 + if (err) + return err; + -+ xen_setup(xen_base); -+ -+ grub_sleep(5); ++ xen_stop_dma(); + +#ifdef GRUB_MACHINE_EFI + err = grub_efi_finish_boot_services (NULL, NULL, NULL, NULL, NULL); @@ -67,7 +72,7 @@ index d9e74b3..9277b0a 100644 grub_multiboot_boot (void) { grub_err_t err; -@@ -213,6 +248,71 @@ grub_multiboot_set_console (int console_type, int accepted_consoles, +@@ -213,6 +246,72 @@ grub_multiboot_set_console (int console_type, int accepted_consoles, } static grub_err_t @@ -113,7 +118,8 @@ index d9e74b3..9277b0a 100644 + } *gr = (struct grub_relocator *) grub_multiboot_relocator; + + -+ xen_base=get_virtual_current_address (gr->chunks); ++ void * xen_base=get_virtual_current_address (gr->chunks); ++ xen_setup(xen_base); + } + + grub_multiboot_set_bootdev (); @@ -139,7 +145,7 @@ index d9e74b3..9277b0a 100644 grub_cmd_multiboot (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]) { -@@ -329,23 +429,32 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), +@@ -329,23 +428,32 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), return GRUB_ERR_NONE;; } @@ -175,10 +181,10 @@ index d9e74b3..9277b0a 100644 my_mod = mod; diff --git a/grub-core/loader/xen.c b/grub-core/loader/xen.c new file mode 100644 -index 0000000..0e3deee +index 0000000..63ce927 --- /dev/null +++ b/grub-core/loader/xen.c -@@ -0,0 +1,301 @@ +@@ -0,0 +1,303 @@ + +#define XEN_EFI_MAGIC 0xdeadbeefef104eadULL +#define XEN_LOADER_GRUB_64 0x0034365f36387847ULL @@ -313,7 +319,7 @@ index 0000000..0e3deee + +#endif + -+static void stop_dma(void) ++static void xen_stop_dma(void) +{ + + auto int NESTED_FUNC_ATTR stop_card_dma (grub_pci_device_t dev, @@ -373,7 +379,8 @@ index 0000000..0e3deee + if (driver_id == GRUB_VIDEO_DRIVER_NONE) + return 1; + -+ err = grub_video_get_info_and_fini (&mode_info, &framebuffer); ++// err = grub_video_get_info_and_fini (&mode_info, &framebuffer); ++ err = grub_video_get_info_and_carry_on (&mode_info, &framebuffer); + + if (err) + { @@ -381,6 +388,8 @@ index 0000000..0e3deee + return 1; + } + ++ grub_printf("Frame buffer is %d (stride 0x%x) x %d @ %p\n",mode_info.width,mode_info.pitch,mode_info.height, framebuffer); ++ + bvi->orig_video_isVGA=0x23; /*XXX: what is 0x23? */ + + bvi->lfb_linelength=mode_info.pitch; @@ -441,13 +450,13 @@ index 0000000..0e3deee + if (hdr->magic != XEN_EFI_MAGIC) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "No EFI support in hypervisor"); + -+ grub_printf("base addr is %p\n",base); ++ grub_printf("\nbase addr is %p\nhdr found at %p\n",base,hdr); + -+ realmode_available=(grub_uint8_t *)hdr->realmode_available; ++ realmode_available=(grub_uint8_t *)(grub_size_t)hdr->realmode_available; + grub_printf("realmode_available was %x@%p\n",(int) *realmode_available,realmode_available); + *realmode_available=0; + -+ efi_loader_signature=(grub_uint64_t*)hdr->efi_loader_signature; ++ efi_loader_signature=(grub_uint64_t*)(grub_size_t)hdr->efi_loader_signature; + +#if defined(__x86_64__) + *efi_loader_signature=XEN_LOADER_GRUB_64; @@ -457,26 +466,145 @@ index 0000000..0e3deee + *efi_loader_signature=0; +#endif + -+ efi_system_table_addr=(grub_uint64_t*)hdr->efi_system_table_addr; ++ efi_system_table_addr=(grub_uint64_t*)(grub_size_t)hdr->efi_system_table_addr; + + grub_printf("efi_system_table_addr was %llx@%p\n",(long long unsigned) *efi_system_table_addr, efi_system_table_addr); + -+ *efi_system_table_addr= (grub_uint64_t) grub_efi_system_table; ++ *efi_system_table_addr= (grub_uint64_t) (grub_size_t) grub_efi_system_table; + -+ boot_vid_mode=(grub_uint16_t *)hdr->boot_vid_mode; ++ boot_vid_mode=(grub_uint16_t *)(grub_size_t)hdr->boot_vid_mode; + grub_printf("boot_vid_mode was 0x%x@%p\n",(int) *boot_vid_mode,boot_vid_mode); + *boot_vid_mode=0xf00; + -+ bvi=(struct xen_boot_video_info *)hdr->boot_vid_info; ++ bvi=(struct xen_boot_video_info *)(grub_size_t)hdr->boot_vid_info; + grub_printf("boot_vid_info @%p\n",bvi); + + xen_setup_video (bvi); + + fake_bios_data(); -+ stop_dma(); + + return GRUB_ERR_NONE; +} + + + +diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c +index d14ae98..6045b21 100644 +--- a/grub-core/video/efi_gop.c ++++ b/grub-core/video/efi_gop.c +@@ -378,6 +378,17 @@ grub_video_gop_set_active_render_target (struct grub_video_render_target *target + } + + static grub_err_t ++grub_video_gop_get_info_and_carry_on (struct grub_video_mode_info *mode_info, ++ void **framebuf) ++{ ++ grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info)); ++ *framebuf = (char *) framebuffer.ptr; ++ ++ return GRUB_ERR_NONE; ++} ++ ++ ++static grub_err_t + grub_video_gop_get_info_and_fini (struct grub_video_mode_info *mode_info, + void **framebuf) + { +@@ -389,6 +400,7 @@ grub_video_gop_get_info_and_fini (struct grub_video_mode_info *mode_info, + return GRUB_ERR_NONE; + } + ++ + static struct grub_video_adapter grub_video_gop_adapter = + { + .name = "EFI GOP driver", +@@ -400,6 +412,7 @@ static struct grub_video_adapter grub_video_gop_adapter = + .fini = grub_video_gop_fini, + .setup = grub_video_gop_setup, + .get_info = grub_video_fb_get_info, ++ .get_info_and_carry_on = grub_video_gop_get_info_and_carry_on, + .get_info_and_fini = grub_video_gop_get_info_and_fini, + .set_palette = grub_video_fb_set_palette, + .get_palette = grub_video_fb_get_palette, +diff --git a/grub-core/video/efi_uga.c b/grub-core/video/efi_uga.c +index 1e709a5..af26f99 100644 +--- a/grub-core/video/efi_uga.c ++++ b/grub-core/video/efi_uga.c +@@ -289,6 +289,16 @@ grub_video_uga_set_active_render_target (struct grub_video_render_target *target + } + + static grub_err_t ++grub_video_uga_get_info_and_carry_on (struct grub_video_mode_info *mode_info, ++ void **framebuf) ++{ ++ grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info)); ++ *framebuf = (char *) framebuffer.ptr; ++ ++ return GRUB_ERR_NONE; ++} ++ ++static grub_err_t + grub_video_uga_get_info_and_fini (struct grub_video_mode_info *mode_info, + void **framebuf) + { +@@ -311,6 +321,7 @@ static struct grub_video_adapter grub_video_uga_adapter = + .fini = grub_video_uga_fini, + .setup = grub_video_uga_setup, + .get_info = grub_video_fb_get_info, ++ .get_info_and_carry_on = grub_video_uga_get_info_and_carry_on, + .get_info_and_fini = grub_video_uga_get_info_and_fini, + .set_palette = grub_video_fb_set_palette, + .get_palette = grub_video_fb_get_palette, +diff --git a/grub-core/video/video.c b/grub-core/video/video.c +index 6a1d473..3fbfed8 100644 +--- a/grub-core/video/video.c ++++ b/grub-core/video/video.c +@@ -72,6 +72,24 @@ grub_video_get_driver_id (void) + + /* Get information about active video mode. */ + grub_err_t ++grub_video_get_info_and_carry_on (struct grub_video_mode_info *mode_info, ++ void **framebuffer) ++{ ++ grub_err_t err; ++ ++ if (! grub_video_adapter_active) ++ return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated"); ++ ++ err = grub_video_adapter_active->get_info_and_carry_on (mode_info, framebuffer); ++ if (err) ++ return err; ++ ++ return GRUB_ERR_NONE; ++} ++ ++ ++/* Get information about active video mode. */ ++grub_err_t + grub_video_get_info_and_fini (struct grub_video_mode_info *mode_info, + void **framebuffer) + { +diff --git a/include/grub/video.h b/include/grub/video.h +index 97bd85b..8047512 100644 +--- a/include/grub/video.h ++++ b/include/grub/video.h +@@ -255,6 +255,9 @@ struct grub_video_adapter + + grub_err_t (*get_info) (struct grub_video_mode_info *mode_info); + ++ grub_err_t (*get_info_and_carry_on) (struct grub_video_mode_info *mode_info, ++ void **framebuffer); ++ + grub_err_t (*get_info_and_fini) (struct grub_video_mode_info *mode_info, + void **framebuffer); + +@@ -349,6 +352,9 @@ grub_err_t EXPORT_FUNC (grub_video_get_info) (struct grub_video_mode_info *mode_ + sure that framebuffer address doesn't change. To ensure this abstraction + grub_video_get_info_and_fini is the only function supplying framebuffer + address. */ ++grub_err_t EXPORT_FUNC (grub_video_get_info_and_carry_on) (struct grub_video_mode_info *mode_info, ++ void **framebuffer); ++ + grub_err_t EXPORT_FUNC (grub_video_get_info_and_fini) (struct grub_video_mode_info *mode_info, + void **framebuffer); + diff --git a/master/status b/master/status index 3b3541d..e69de29 100644 --- a/master/status +++ b/master/status @@ -1,53 +0,0 @@ -debian/olpc_prefix_hack.patch -debian/core_in_fs.patch -debian/dpkg_version_comparison.patch -debian/grub_legacy_0_based_partitions.patch -debian/disable_floppies.patch -debian/grub.cfg_400.patch -debian/gfxpayload_keep_default.patch -debian/mkrescue_diet.patch -debian/mkconfig_skip_dmcrypt.patch -debian/install_stage2_confusion.patch -debian/qemu_img_exists.patch -debian/branch_devmapper.patch -debian/branch_squash.patch -debian/branch_longlinuxcmd.patch -debian/branch_parse-color.patch -debian/branch_embed-sectors.patch -debian/branch_fuse.patch -debian/mkrescue_efi_modules.patch -debian/mkconfig_loopback.patch -debian/lazy_stat.patch -debian/btrfs_stat.patch -debian/partition_performance.patch -debian/kfreebsd-9_ada_devices.patch -debian/gfxterm_background.patch -debian/zfs_packed_la_array.patch -debian/xen_replace.patch -debian/kfreebsd_mfi_devices.patch -debian/probe_canonicalise.patch -debian/mkconfig_skip_readme.patch -debian/kfreebsd_lvm.patch -debian/zfs_update.patch -debian/no_libzfs.patch -debian/xfs_invalid_bmap.patch -debian/handle_new_autotools.patch -debian/bash-completion_identifiers.patch -debian/mkconfig_gnumach.patch -debian/gcc_4_6_space.patch -debian/lzo.patch -debian/fat_uuid.patch -debian/efiemu_fix.patch -debian/4k_sectors.patch -debian/efi_disk_cache.patch -debian/dirlen.patch -debian/hurd.patch -debian/userland-part.patch -jmm/efi_call_7-bis -jmm/efi-load-drivers-bis -jmm/networking-bis -jmm/efi-sni-bis -jmm/copy-acpi-and-dmi-for-mb-kernels -jmm/disable-all-pci-dma-on-boot -jmm/xen-multiboot -endstop -- cgit v1.2.3