From: Vladimir 'phcoder' Serbinenko Date: Wed, 22 Sep 2010 12:51:49 +0000 (+0200) Subject: Implement EFI and ACPI multiboot2 extensions. X-Git-Tag: 1.99~429 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e255597e513b42dc7e84ad14ef515a48ed30eb31;p=thirdparty%2Fgrub.git Implement EFI and ACPI multiboot2 extensions. * grub-core/loader/multiboot_mbi2.c (grub_multiboot_load): Declare new tags as supported. (acpiv2_size): New function. (grub_multiboot_get_mbi_size): Take new tags into account. (grub_multiboot_make_mbi): Add new tags. * include/grub/multiboot.h (GRUB_MACHINE_HAS_ACPI): New definition. --- e255597e513b42dc7e84ad14ef515a48ed30eb31 diff --cc ChangeLog index 2a7889bf7,c79bdcf8f..0f9b33a82 --- a/ChangeLog +++ b/ChangeLog @@@ -1,89 -1,3 +1,100 @@@ ++2010-09-22 Vladimir Serbinenko ++ ++ Implement EFI and ACPI multiboot2 extensions. ++ ++ * grub-core/loader/multiboot_mbi2.c (grub_multiboot_load): Declare ++ new tags as supported. ++ (acpiv2_size): New function. ++ (grub_multiboot_get_mbi_size): Take new tags into account. ++ (grub_multiboot_make_mbi): Add new tags. ++ * include/grub/multiboot.h (GRUB_MACHINE_HAS_ACPI): New definition. ++ +2010-09-21 Aleš Nesrsta + + * grub-core/bus/usb/serial/common.c (grub_usbserial_attach): + Added missing configuration of USB device. + +2010-09-21 Colin Watson + + * grub-core/normal/menu_entry.c (run): Make sure we always return + a value. + +2010-09-21 Colin Watson + + * grub-core/commands/efi/lsefimmap.c (grub_cmd_lsefimmap): + NumberOfPages is UINT64 according to the UEFI specification, not + UINTN. Fix printf format. + +2010-09-21 Colin Watson + + * grub-core/bus/usb/usbhub.c (poll_nonroot_hub): Change type of + `err' to grub_usb_err_t. + Reported and tested by: KESHAV P.R. + +2010-09-21 Colin Watson + + * grub-core/disk/efi/efidisk.c (grub_efidisk_get_device_name): Make + tpart non-const, so that we can assign to it. (Since this is a + typedef, the constness refers to the pointer rather than what it + points to.) + +2010-09-21 Colin Watson + + * conf/Makefile.common (CPPFLAGS_GNULIB): Add + $(top_srcdir)/grub-core/gnulib as well as + $(top_builddir)/grub-core/gnulib. + Reported by: KESHAV P.R. + +2010-09-21 Colin Watson + + * util/grub-install.in: Fix the bootloader ID option to be + consistently --bootloader-id, not --bootloader_id. + Reported by: KESHAV P.R. + +2010-09-21 Colin Watson + + * grub-core/commands/hashsum.c (GRUB_MOD_INIT): Make "Compute or + check hash checksum." consistently translatable. + +2010-09-21 Yves Blusseau + + * conf/Makefile.common (CPPFLAGS_GNULIB): Replace $(top_srcdir) with + $(top_builddir). + +2010-09-21 Colin Watson + + * grub-core/commands/hashsum.c (aliases): Add sha1sum alias. + (GRUB_MOD_INIT): Register sha1sum command. + (GRUB_MOD_FINI): Unregister sha1sum command. + +2010-09-21 Yves Blusseau + + Keep boot and grub directory names in sync with utils scripts + + * configure.ac: Define GRUB_BOOT_DIR_NAME and GRUB_DIR_NAME macros. + * config.h.in: Add previous macros. + * include/grub/emu/misc.h (DEFAULT_DIRECTORY): Use previous macros. + * util/grub-install.in: Use $bootdir and $grubdir variables. + +2010-09-21 Colin Watson + + * grub-core/kern/emu/hostdisk.c (find_system_device): Only try to + convert partition names to disk names if the new `convert' parameter + is set. + (grub_util_biosdisk_get_grub_dev): If opening the disk device + returns GRUB_ERR_UNKNOWN_DEVICE, treat the partition device as a + disk in its own right. This can happen with Xen disk images. + +2010-09-21 Yves Blusseau + + * util/grub-editenv.c: Update strings to avoid warnings when generating + grub.pot file. + * util/grub-setup.c: Likewise. + +2010-09-21 Vladimir Serbinenko + + * configure.ac: Change version to 1.99~beta0. + 2010-09-21 Vladimir Serbinenko * grub-core/loader/i386/multiboot_mbi.c (grub_fill_multiboot_mmap): diff --cc grub-core/loader/multiboot_mbi2.c index 799985a1c,d499de2bb..f7a05bcac --- a/grub-core/loader/multiboot_mbi2.c +++ b/grub-core/loader/multiboot_mbi2.c @@@ -265,6 -270,18 +270,22 @@@ grub_multiboot_load (grub_file_t file return err; } + static grub_size_t + acpiv2_size (void) + { ++#if GRUB_MACHINE_HAS_ACPI + struct grub_acpi_rsdp_v20 *p = grub_acpi_get_rsdpv2 (); + + if (!p) + return 0; + + return ALIGN_UP (sizeof (struct multiboot_tag_old_acpi) + + p->length, MULTIBOOT_TAG_ALIGN); ++#else ++ return 0; ++#endif + } + static grub_size_t grub_multiboot_get_mbi_size (void) { @@@ -674,7 -696,53 +700,55 @@@ grub_multiboot_make_mbi (grub_uint32_t grub_errno = GRUB_ERR_NONE; } } - + + #if defined (GRUB_MACHINE_EFI) && __x86_64__ + { + struct multiboot_tag_efi64 *tag = (struct multiboot_tag_efi64 *) ptrorig; + tag->type = MULTIBOOT_TAG_TYPE_EFI64; + tag->size = sizeof (*tag); + tag->pointer = (grub_addr_t) grub_efi_system_table; + ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN); + } + #endif + + #if defined (GRUB_MACHINE_EFI) && __i386_ + { + struct multiboot_tag_efi64 *tag = (struct multiboot_tag_efi32 *) ptrorig; + tag->type = MULTIBOOT_TAG_TYPE_EFI32; + tag->size = sizeof (*tag); + tag->pointer = (grub_addr_t) grub_efi_system_table; + ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN); + } + #endif + ++#if GRUB_MACHINE_HAS_ACPI + { + struct multiboot_tag_old_acpi *tag = (struct multiboot_tag_old_acpi *) + ptrorig; + struct grub_acpi_rsdp_v10 *a = grub_acpi_get_rsdpv1 (); + if (a) + { + tag->type = MULTIBOOT_TAG_TYPE_ACPI_OLD; + tag->size = sizeof (*tag) + sizeof (*a); + grub_memcpy (tag->rsdp, a, sizeof (*a)); + ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN); + } + } + + { + struct multiboot_tag_new_acpi *tag = (struct multiboot_tag_new_acpi *) + ptrorig; + struct grub_acpi_rsdp_v20 *a = grub_acpi_get_rsdpv2 (); + if (a) + { + tag->type = MULTIBOOT_TAG_TYPE_ACPI_NEW; + tag->size = sizeof (*tag) + a->length; + grub_memcpy (tag->rsdp, a, a->length); + ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN); + } + } ++#endif + { struct multiboot_tag *tag = (struct multiboot_tag *) ptrorig; tag->type = MULTIBOOT_TAG_TYPE_END; diff --cc include/grub/multiboot.h index 92837d7d2,92837d7d2..364dc3ca6 --- a/include/grub/multiboot.h +++ b/include/grub/multiboot.h @@@ -62,6 -62,6 +62,12 @@@ grub_err_t grub_multiboot_set_video_mod #define GRUB_MACHINE_HAS_VBE 0 #endif ++#if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) ++#define GRUB_MACHINE_HAS_ACPI 1 ++#else ++#define GRUB_MACHINE_HAS_ACPI 0 ++#endif ++ #define GRUB_MULTIBOOT_CONSOLE_EGA_TEXT 1 #define GRUB_MULTIBOOT_CONSOLE_FRAMEBUFFER 2