High resolution timer support. Implemented for x86 CPUs using TSC.
Extracted generic grub_millisleep() so it's linked in only as needed.
This requires a Pentium compatible CPU; if the RDTSC instruction is
not supported, then it falls back on the generic grub_get_time_ms()
implementation that uses the machine's RTC.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/time.c',
`kern/i386/tsc.c', `kern/generic/rtc_get_time_ms.c' and
`kern/generic/millisleep.c'.
* conf/i386-efi.rmk (kernel_mod_SOURCES): Add `kern/i386/tsc.c',
`kern/generic/rtc_get_time_ms.c' and `kern/generic/millisleep.c'.
* conf/x86_64-efi.rml (kernel_mod_SOURCES): Add
`kern/generic/millisleep.c' and `kern/generic/rtc_get_time_ms.c'.
* conf/sparc64-ieee1275.rmk (kernel_elf_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (kernel_elf_SOURCES): Add
`kern/generic/millisleep.c'.
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Likewise.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Add `kern/time.c'.
* kern/generic/rtc_get_time_ms.c: New file.
* kern/generic/millisleep.c: New file.
* kern/misc.c: Don't include
<kern/time.h> anymore.
(grub_millisleep_generic): Removed.
* commands/sleep.c (grub_interruptible_millisleep): Uses
grub_get_time_ms() instead of grub_get_rtc().
* include/grub/i386/tsc.h (grub_get_tsc): New file. New inline
function.
(grub_cpu_is_cpuid_supported): New inline function.
(grub_cpu_is_tsc_supported): New inline function.
(grub_tsc_init): New function prototype.
(grub_tsc_get_time_ms): New function prototype.
* kern/i386/tsc.c (grub_get_time_ms): New file.
* include/grub/time.h: Include <grub/types.h.
(grub_millisleep_generic): Removed.
(grub_get_time_ms): New prototype.
(grub_install_get_time_ms): New prototype.
(grub_rtc_get_time_ms): New prototype.
* kern/time.c (grub_get_time_ms): New function.
(grub_install_get_time_ms): New function.
* kern/i386/efi/init.c: Include <grub/cpu/tsc.h>. Don't include
<grub/time.h> anymore.
(grub_millisleep): Removed.
(grub_machine_init): Call grub_tsc_init.
* kern/i386/linuxbios/init.c (grub_machine_init): Install the RTC
get_time_ms() implementation.
* kern/sparc64/ieee1275/init.c (grub_millisleep): Removed.
(ieee1275_get_time_ms): New function.
(grub_machine_init): Install get_time_ms() implementation.
* kern/i386/pc/init.c: Include <grub/cpu/tsc.h>.
(grub_machine_init): Call grub_tsc_init().
(grub_millisleep): Removed.
* kern/ieee1275/init.c (grub_millisleep): Removed.
(grub_machine_init): Install ieee1275_get_time_ms()
implementation.
(ieee1275_get_time_ms): New function.
(grub_get_rtc): Now calls ieee1275_get_time_ms(), which does the
real work.
* kern/ieee1275/init.c (grub_machine_set_prefix): If `grub_prefix'
is non-empty, use it to set the `prefix' environment variable instead
of the usual approach.
* kern/i386/linuxbios/init.c (make_install_device): Remove function.
(grub_machine_set_prefix): Use `grub_prefix' to set the `prefix'
environment variable instead of dummy make_install_device().
* kern/i386/ieee1275/startup.S: Include `<grub/machine/kernel.h>'.
(start): Insert a data section, with `grub_prefix' variable.
* kern/i386/linuxbios/startup.S: Likewise.
* include/grub/powerpc/ieee1275/kernel.h [!ASM_FILE] (grub_prefix):
New variable reference.
* include/grub/i386/ieee1275/kernel.h (GRUB_KERNEL_MACHINE_PREFIX):
New macro. Defines offset of `grub_prefix' within startup.S (relative
to `start').
(GRUB_KERNEL_MACHINE_DATA_END): New macro. Defines the end of data
section within startup.S (relative to `start').
* include/grub/i386/coreboot/kernel.h: Likewise.
* util/elf/grub-mkimage.c (add_segments): Receive `prefix' parameter.
Overwrite grub_prefix with its contents, at the beginning of the
first segment.
(main): Understand -p|--prefix.
* include/grub/ieee1275.h (grub_ieee1275_flag): New constant
GRUB_IEEE1275_FLAG_CANNOT_INTERPRET, GRUB_IEEE1275_FLAG_FORCE_CLAIM
and GRUB_IEEE1275_FLAG_NO_ANSI.
* kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set flag
GRUB_IEEE1275_FLAG_CANNOT_INTERPRET, GRUB_IEEE1275_FLAG_FORCE_CLAIM
and GRUB_IEEE1275_FLAG_NO_ANSI for Open Hackware.
* kern/ieee1275/ieee1275.c (grub_ieee1275_interpret): Return
immediately if GRUB_IEEE1275_FLAG_CANNOT_INTERPRET is set.
* kern/ieee1275/init.c (grub_claim_heap): Claim memory directly if
GRUB_IEEE1275_FLAG_FORCE_CLAIM is set.
* term/ieee1275/ofconsole.c (grub_ofconsole_writeesc): Don't output
esc sequence on non ANSI terminal.
(grub_ofconsole_gotoxy): Emulate backspace key on non ANSI terminal.
* util/elf/grub-mkimage.c (add_segments): Move ELF header to the
beginning of file.
* Makefile.in (RMKFILES): Add missing arch i386-ieee1275 and
i386-linuxbios.
* commands/hexdump.c (grub_cmd_hexdump): Support dumping of device,
change the buffer size to 4096 for cdrom device.
* conf/i386-ieee1275.rmk (pkglib_MODULES): Add _linux.mod, linux.mod
and nand.mod.
(_linux_mod_SOURCES): New variable.
(_linux_mod_CFLAGS): Likewise.
(_linux_mod_LDFLAGS): Likewise.
(linux_mod_SOURCES): Likewise.
(linux_mod_CFLAGS): Likewise.
(linux_mod_LDFLAGS): Likewise.
(nand_mod_SOURCES): Likewise.
(nand_mod_CFLAGS): Likewise.
(nand_mod_LDFLAGS): Likewise.
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Return
GRUB_ERR_UNKNOWN_DEVICE instead of GRUB_ERR_BAD_DEVICE if no device
type property. (nand device in olpc don't have this property)
* include/grub/disk.h (grub_disk_dev_id): New macro
GRUB_DISK_DEVICE_NAND_ID.
* include/grub/i386/ieee1275/loader.h (grub_rescue_cmd_linux): New
function prototype.
(grub_rescue_cmd_initrd): Likewise.
* include/grub/i386/linux.h (GRUB_LINUX_OFW_SIGNATURE): New macro.
(linux_kernel_params): Add new member ofw_signature, ofw_num_items,
ofw_cif_handler and ofw_idt, adjust padding number.
* include/grub/i386/pc/memory.h (grub_upper_mem): Export it if
GRUB_MACHINE_IEEE1275 is defined.
* include/grub/ieee1275/ieee1275.h (grub_available_iterate):
Use NESTED_FUNC_ATTR attribute on the hook parameter.
* kern/powerpc/ieee1275/init.c (grub_claim_heap): Use NESTED_FUNC_ATTR
on nested function heap_init.
(grub_upper_mem): New variable for i386-ieee1275.
(grub_get_extended_memory): New function for i386-ieee1275.
(grub_machine_init): Call grub_get_extended_memory for i386-ieee1275.
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Use
NESTED_FUNC_ATTR on the hook parameter. Don't quit if no device type
property.
* loader/i386/ieee1275/linux.c: New file.
* loader/i386/ieee1275/linux_normal.c: New file.
* disk/ieee1275/nand.c: New file.
Restructures early code path on ieee1275 to unify grub_main() as
the first C function that is executed in every platform.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_init): New prototype.
* kern/i386/ieee1275/startup.S (_start): Jump to grub_main() instead of
cmain().
* kern/powerpc/ieee1275/crt0.S (_start): Likewise.
* kern/ieee1275/cmain.c (cmain): Rename to ...
* kern/ieee1275/cmain.c (grub_ieee1275_init): ... this.
* kern/ieee1275/init.c (grub_machine_init): Call grub_ieee1275_init()
at the beginning.
* kern/powerpc/ieee1275/init.c: Move from here ...
* kern/ieee1275/init.c: ... to here. Update all users.
* kern/powerpc/ieee1275/cmain.c: Move from here ...
* kern/ieee1275/cmain.c: ... to here. Update all users.
* kern/powerpc/ieee1275/openfw.c: Move from here ...
* kern/ieee1275/openfw.c: ... to here. Update all users.
* loader/powerpc/ieee1275/multiboot2.c: Move from here ...
* loader/ieee1275/multiboot2.c: ... to here. Update all users.
2008-04-12 21:09:36 +00:00
Renamed from kern/powerpc/ieee1275/init.c (Browse further)