Remove non-functional EFI grub_get_rtc. Put a better fatal message

than current grub_get_rtc() not implemented when booted with
	coreboot without TSC.

	* grub-core/Makefile.am: Exclude efi/time.h from kernel headers.
	Add machine/time.h to kernel headers on loongson.
	* grub-core/Makefile.core.def (kernel): Remove
	kern/generic/rtc_get_time_ms.c on qemu-multiboot-coreboot.
	* grub-core/kern/efi/efi.c (grub_rtc_get_time_ms): Removed.
	(grub_get_rtc): Likewise.
	* grub-core/kern/generic/rtc_get_time_ms.c: Include grub/machine/time.h.
	* grub-core/kern/i386/coreboot/init.c (grub_get_rtc): Removed.
	* grub-core/kern/i386/pc/init.c: Include grub/machine/init.h.
	* grub-core/kern/i386/tsc.c (grub_tsc_init)
	[!GRUB_MACHINE_PCBIOS && !GRUB_MACHINE_IEEE1275]: Call grub_fatal
	rather than installing known non-working time source.
	* grub-core/kern/ieee1275/init.c (grub_get_rtc): Removed.
	* grub-core/kern/mips/loongson/init.c: Include grub/machine/time.h.
	* include/grub/time.h: Don't include machine/time.h.
	* include/grub/efi/time.h: Removed.
	* include/grub/i386/efi/time.h: Likewise.
	* include/grub/i386/ieee1275/time.h: Likewise.
	* include/grub/powerpc/ieee1275/time.h: Likewise.
	* include/grub/sparc64/ieee1275/time.h: Likewise.
	* include/grub/x86_64/efi/time.h: Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-06-11 20:44:38 +02:00
parent 4e5a96b02e
commit 7da036bbcb
17 changed files with 38 additions and 187 deletions

View file

@ -93,7 +93,6 @@ endif
if COND_i386_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
@ -124,7 +123,6 @@ endif
if COND_x86_64_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
@ -132,7 +130,6 @@ endif
if COND_ia64_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
endif
@ -165,6 +162,7 @@ endif
if COND_mips_loongson
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/time.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h

View file

@ -103,9 +103,6 @@ kernel = {
noemu_nodist = symlist.c;
i386_pc = kern/generic/rtc_get_time_ms.c;
i386_qemu = kern/generic/rtc_get_time_ms.c;
i386_coreboot = kern/generic/rtc_get_time_ms.c;
i386_multiboot = kern/generic/rtc_get_time_ms.c;
mips = kern/generic/rtc_get_time_ms.c;
ieee1275 = disk/ieee1275/ofdisk.c;

View file

@ -23,7 +23,6 @@
#include <grub/efi/efi.h>
#include <grub/efi/console_control.h>
#include <grub/efi/pe32.h>
#include <grub/machine/time.h>
#include <grub/time.h>
#include <grub/term.h>
#include <grub/kernel.h>
@ -230,29 +229,6 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
return NULL;
}
#ifndef __ia64__
grub_uint64_t
grub_rtc_get_time_ms (void)
{
grub_efi_time_t time;
grub_efi_runtime_services_t *r;
r = grub_efi_system_table->runtime_services;
if (efi_call_2 (r->get_time, &time, 0) != GRUB_EFI_SUCCESS)
/* What is possible in this case? */
return 0;
return ((time.minute * 60 + time.second) * 1000
+ time.nanosecond / 1000000);
}
grub_uint32_t
grub_get_rtc (void)
{
return grub_rtc_get_time_ms ();
}
#endif
#pragma GCC diagnostic ignored "-Wcast-align"
/* Search the mods section from the PE32/PE32+ image. This code uses

View file

@ -21,6 +21,7 @@
#include <grub/time.h>
#include <grub/misc.h>
#include <grub/machine/time.h>
/* Calculate the time in milliseconds since the epoch based on the RTC. */
grub_uint64_t

View file

@ -42,15 +42,7 @@ extern grub_uint8_t _start[];
extern grub_uint8_t _end[];
extern grub_uint8_t _edata[];
#pragma GCC diagnostic warning "-Wsuggest-attribute=noreturn"
grub_uint32_t
grub_get_rtc (void)
{
grub_fatal ("grub_get_rtc() is not implemented.\n");
}
void
void __attribute__ ((noreturn))
grub_exit (void)
{
/* We can't use grub_fatal() in this function. This would create an infinite

View file

@ -33,6 +33,7 @@
#include <grub/cache.h>
#include <grub/time.h>
#include <grub/cpu/tsc.h>
#include <grub/machine/time.h>
struct mem_region
{

View file

@ -69,6 +69,10 @@ grub_tsc_init (void)
}
else
{
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_IEEE1275)
grub_install_get_time_ms (grub_rtc_get_time_ms);
#else
grub_fatal ("no TSC found");
#endif
}
}

View file

@ -292,9 +292,3 @@ ieee1275_get_time_ms (void)
return msecs;
}
grub_uint32_t
grub_get_rtc (void)
{
return ieee1275_get_time_ms ();
}

View file

@ -23,7 +23,7 @@
#include <grub/types.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/time.h>
#include <grub/machine/time.h>
#include <grub/machine/kernel.h>
#include <grub/machine/memory.h>
#include <grub/memory.h>