diff --git a/ChangeLog.gingold3 b/ChangeLog.gingold3 new file mode 100644 index 000000000..f8e69c3cd --- /dev/null +++ b/ChangeLog.gingold3 @@ -0,0 +1,7 @@ +2008-01-28 Tristan Gingold <gingold@free.fr> +2010-01-18 Robert Millan <rmh.grub@aybabtu.com> +2010-08-31 Vladimir Serbinenko <phcoder@gmail.com> + + * grub-core/commands/efi/lsefimmap.c: New file. + * grub-core/Makefile.core.def (lsefimmap): New module. + * include/grub/efi/api.h (PRIxGRUB_EFI_UINTN_T): New definition. diff --git a/ChangeLog.ia64 b/ChangeLog.ia64 index a0875f9da..21939faec 100644 --- a/ChangeLog.ia64 +++ b/ChangeLog.ia64 @@ -12,7 +12,6 @@ * normal/ia64/longjmp.S: New file (from glibc). * loader/ia64/efi/linux.c: New file. * conf/ia64-efi.rmk: New file. - * commands/efi/memmap.c: New file. * include/grub/efi/efi.h: Declare grub_efi_allocate_boot_pages and grub_efi_free_boot_pages. * include/grub/kernel.h: Export grub_machine_fini. diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 925f2b7f6..b87003507 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -453,6 +453,14 @@ module = { enable = efi; }; +module = { + name = lsefimmap; + + common = commands/efi/lsefimmap.c; + + enable = efi; +}; + module = { name = blocklist; common = commands/blocklist.c; @@ -1419,9 +1427,3 @@ module = { name = datehook; common = hook/datehook.c; }; - -module = { - name = memmap; - common = commands/efi/memmap.c; - enable = ia64_efi; -}; diff --git a/grub-core/commands/efi/memmap.c b/grub-core/commands/efi/lsefimmap.c similarity index 76% rename from grub-core/commands/efi/memmap.c rename to grub-core/commands/efi/lsefimmap.c index e7c140cff..010fc0d77 100644 --- a/grub-core/commands/efi/memmap.c +++ b/grub-core/commands/efi/lsefimmap.c @@ -19,7 +19,6 @@ #include <grub/types.h> #include <grub/mm.h> #include <grub/misc.h> -#include <grub/normal.h> #include <grub/efi/api.h> #include <grub/efi/efi.h> #include <grub/command.h> @@ -28,9 +27,9 @@ ((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size))) static grub_err_t -grub_cmd_memmap (grub_command_t cmd __attribute__ ((unused)), - int argc __attribute__ ((unused)), - char **args __attribute__ ((unused))) +grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)), + int argc __attribute__ ((unused)), + char **args __attribute__ ((unused))) { grub_efi_uintn_t map_size; grub_efi_memory_descriptor_t *memory_map; @@ -44,21 +43,19 @@ grub_cmd_memmap (grub_command_t cmd __attribute__ ((unused)), memory_map = grub_malloc (map_size); if (memory_map == NULL) - return 0; - if (grub_efi_get_memory_map (&map_size, memory_map, NULL, &desc_size, 0) < 0) + return grub_errno; + if (grub_efi_get_memory_map (&map_size, memory_map, NULL, &desc_size, 0) <= 0) goto fail; - grub_set_more (1); - grub_printf ("Type Physical start - end #Pages " " Size Attributes\n"); - memory_map_end = ADD_MEMORY_DESCRIPTOR(memory_map, map_size); + memory_map_end = ADD_MEMORY_DESCRIPTOR (memory_map, map_size); for (desc = memory_map; desc < memory_map_end; desc = ADD_MEMORY_DESCRIPTOR (desc, desc_size)) { - grub_efi_uintn_t size; + grub_efi_uint64_t size; grub_efi_uint64_t attr; static const char types_str[][9] = { @@ -77,28 +74,30 @@ grub_cmd_memmap (grub_command_t cmd __attribute__ ((unused)), "IO-ports", "PAL-code" }; - if (desc->type < sizeof (types_str) / sizeof (types_str[0])) + if (desc->type < ARRAY_SIZE (types_str)) grub_printf ("%s ", types_str[desc->type]); else grub_printf ("Unk %02x ", desc->type); - grub_printf (" %016llx-%016llx %08lx", - (unsigned long long) desc->physical_start, - (unsigned long long) desc->physical_start + (desc->num_pages << 12) - 1, - (unsigned long) desc->num_pages); + grub_printf (" %016" PRIxGRUB_UINT64_T "-%016" PRIxGRUB_UINT64_T + " %08" PRIxGRUB_EFI_UINTN_T, + desc->physical_start, + desc->physical_start + (desc->num_pages << 12) - 1, + desc->num_pages); - size = desc->num_pages << (12 - 10); + size = desc->num_pages; + size <<= (12 - 10); if (size < 1024) - grub_printf (" %4uKB", (unsigned) size); + grub_printf (" %4" PRIuGRUB_UINT64_T "KB", size); else { size /= 1024; if (size < 1024) - grub_printf (" %4uMB", (unsigned) size); + grub_printf (" %4" PRIuGRUB_UINT64_T "MB", size); else { size /= 1024; - grub_printf (" %4uGB", (unsigned) size); + grub_printf (" %4" PRIuGRUB_UINT64_T "GB", size); } } @@ -125,8 +124,6 @@ grub_cmd_memmap (grub_command_t cmd __attribute__ ((unused)), grub_printf ("\n"); } - grub_set_more (0); - fail: grub_free (memory_map); return 0; @@ -134,13 +131,13 @@ grub_cmd_memmap (grub_command_t cmd __attribute__ ((unused)), static grub_command_t cmd; -GRUB_MOD_INIT(memmap) +GRUB_MOD_INIT(lsefimmap) { - cmd = grub_register_command ("memmap", grub_cmd_memmap, - "", "Display memory map."); + cmd = grub_register_command ("lsefimmap", grub_cmd_lsefimmap, + "", "Display EFI memory map."); } -GRUB_MOD_FINI(memmap) +GRUB_MOD_FINI(lsefimmap) { grub_unregister_command (cmd); } diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index 5eededdc2..cb6b1113b 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -287,6 +287,8 @@ typedef grub_uint64_t grub_efi_uint64_t; typedef grub_uint8_t grub_efi_char8_t; typedef grub_uint16_t grub_efi_char16_t; +#define PRIxGRUB_EFI_UINTN_T "lx" + typedef grub_efi_intn_t grub_efi_status_t; #define GRUB_EFI_ERROR_CODE(value) \