* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/i386/pc/mmap.c'.
* include/grub/i386/pc/init.h (GRUB_MACHINE_MEMORY_AVAILABLE)
(GRUB_MACHINE_MEMORY_RESERVED): New macros.
(grub_machine_mmap_iterate): New function declaration.
* include/grub/multiboot.h (struct grub_multiboot_mmap_entry): New
structure.
(GRUB_MMAP_MEMORY_AVAILABLE, GRUB_MMAP_MEMORY_RESERVED): New
macros.
* kern/i386/pc/init.c (grub_machine_init): Replace hardcoded region
type check value with `GRUB_MACHINE_MEMORY_AVAILABLE'.
Move e820 parsing from here ...
* kern/i386/pc/mmap.c: New file.
(grub_machine_mmap_iterate): ... to here.
* include/grub/i386/coreboot/memory.h: Remove `<grub/err.h>'.
(GRUB_LINUXBIOS_MEMORY_AVAILABLE): Rename (for consistency) to ...
(GRUB_MACHINE_MEMORY_AVAILABLE): ... this. Update all users.
(grub_available_iterate): Redeclare to return `void', and redeclare
its hook to use grub_uint64_t as addr and size parameters, and rename
to ...
(grub_machine_mmap_iterate): ... this. Update all users.
* kern/i386/coreboot/mmap.c (grub_mmap_iterate): Simplify parser loop
to make it more readable. Rename to ...
(grub_machine_mmap_iterate): ... this.
* loader/i386/pc/multiboot.c (mmap_addr, mmap_length): New variables.
(grub_get_multiboot_mmap_len, grub_fill_multiboot_mmap): New functions.
(grub_multiboot): Allocate an extra region after the payload, and fill
it with a Multiboot memory map. Adjust a.out loader to calculate size
with the extra space.
(grub_multiboot_load_elf32): Adjust elf32 loader to calculate size
with the extra space.
* include/grub/err.h (grub_err_printf): New function prototype.
* util/misc.c (grub_err_printf): New function.
* kern/misc.c [! GRUB_UTIL] (grub_err_printf): New alias for
grub_printf.
* kern/err.c (grub_print_error): Use grub_err_printf.
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Move part
of the relocation code from here ...
(grub_multiboot): ... to here.
(forward_relocator, backward_relocator): Move from here ...
* kern/i386/loader.S (grub_multiboot_forward_relocator)
(grub_multiboot_backward_relocator): ... to here.
(grub_multiboot_real_boot): Use %edx for entry offset. Put Multiboot
magic in %eax. Use %ebp for jumping (so %edx is not trashed).
* include/grub/i386/loader.h (grub_multiboot_forward_relocator)
(grub_multiboot_forward_relocator_end)
(grub_multiboot_backward_relocator)
(grub_multiboot_backward_relocator_end): New variables.
* kern/i386/linuxbios/startup.S: Move from here ...
* kern/i386/coreboot/startup.S: ... to here.
* kern/i386/linuxbios/init.c: Move from here ...
* kern/i386/coreboot/init.c: ... to here.
* kern/i386/linuxbios/table.c: Move from here ...
* kern/i386/coreboot/mmap.c: ... to here.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Update moved files.
* Makefile.in: Add `target_os' and `enable_grub_pe2elf'.
* conf/common.rmk: Install `grub-pe2elf' only if requested.
Install `grub.d/10_windows' only on Cygwin.
* configure.ac: Add subst of `target_os'.
Check `target_os' also before setting TARGET_OBJ2ELF.
Add `--enable-grub-pe2elf'.
* kern/disk.c: Replace `<grub/machine/time.h>' with `<grub/time.h>'.
(grub_last_time): Change type to grub_uint64_t.
(grub_disk_open): Migrate code from to using grub_get_time_ms().
(grub_disk_close): Likewise.
* normal/menu.c: Replace `<grub/machine/time.h>' with `<grub/time.h>'.
(run_menu): Migrate code from to using grub_get_time_ms().
* util/misc.c (grub_get_time_ms): New function.
* disk/ata.c (grub_ata_regget): Change return type to
`grub_uint8_t'.
(grub_ata_regget2): Likewise.
(grub_ata_wait_status): New function.
(grub_ata_wait_busy): Removed function, updated all users to use
`grub_ata_wait_status'.
(grub_ata_wait_drq): Likewise.
(grub_ata_cmd): New function.
(grub_ata_pio_read): Change return type to `grub_uint8_t'. Add
error handling.
(grub_ata_pio_write): Add error handling.
(grub_atapi_identify): Likewise.
(grub_atapi_packet): Use `grub_ata_cmd' and improve error
handling.
(grub_ata_identify): Use `grub_ata_cmd' and improve error
handling. Actually use the detected registers. Reorder the
detection logic such that it is easier to read.
(grub_ata_pciinit): Do not assign the same ID to each controller.
(grub_ata_setaddress): Use `grub_ata_cmd' and improve error
handling.
(grub_atapi_readsector): Check the result of `grub_ata_pio_read'.
* include/grub/err.h (grub_err_t): Add `GRUB_ERR_TIMEOUT'.
* kern/i386/pit.c (TIMER2_SPEAKER): New define.
(TIMER2_GATE): Likewise.
(grub_pit_wait): Add enable/disable of the timer2 gate
bit of port 0x61. This fixes a possible infinite loop.
* fs/i386/pc/pxe.c (grub_pxe_data): New member block_size.
(grub_pxefs_fs_int): Remove dummy definition.
(grub_pxefs_open): Use data->block_size to store the current block
size setting.
(grub_pxefs_read): Use block size stored in data->block_size. As the
value of grub_pxe_blksize can be changed after the file is opened.
* fs/i386/pc/pxe.c (curr_file): new variable.
(grub_pxefs_open): Simply the handling of pxe file system. Don't
require the dummy internal file system anymore.
(grub_pxefs_read): Removed.
(grub_pxefs_close): Likewise.
(grub_pxefs_fs_int): Likewise.
(grub_pxefs_read_int): Renamed to grub_pxefs_read. Reinitialize tftp
connection when we switch file.
(grub_pxefs_close_int): Renamed to grub_pxefs_close.
* util/console.c (grub_console_cur_color): New variable.
(grub_console_standard_color): Likewise.
(grub_console_normal_color): Likewise.
(grub_console_highlight_color): Likewise.
(color_map): Likewise.
(use_color): Likewise.
(NUM_COLORS): New macro.
(grub_ncurses_setcolorstate): Handle color properly.
(grub_ncurses_setcolor): Don't change color here, just remember the
settings, color will be set in grub_ncurses_setcolorstate.
(grub_ncurses_getcolor): New function.
(grub_ncurses_init): Initialize color pairs.
(grub_ncurses_term): New member grub_ncurses_getcolor.