grub/grub-core/kern/mips/qemu_mips/init.c

103 lines
1.8 KiB
C
Raw Normal View History

2009-10-09 17:50:31 +00:00
#include <grub/kernel.h>
#include <grub/misc.h>
#include <grub/env.h>
#include <grub/time.h>
#include <grub/types.h>
#include <grub/misc.h>
2009-10-10 11:30:14 +00:00
#include <grub/mm.h>
2009-10-11 00:07:52 +00:00
#include <grub/time.h>
2009-10-10 11:30:14 +00:00
#include <grub/machine/memory.h>
#include <grub/machine/kernel.h>
Remove grub_{modname}_init and grub_{modname}_fini. They should never be used directly if it's really a module and GRUB_MOD_INIT shouldn't be used on non-modules. * grub-core/commands/boot.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_boot_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_boot_fini. * grub-core/commands/keylayouts.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_keylayouts_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_keylayouts_fini. * grub-core/font/font_cmd.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_font_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_font_fini. * grub-core/kern/mips/loongson/init.c: Replace explicit protos with includes. (grub_machine_init): Remove empty inits. * grub-core/kern/mips/qemu_mips/init.c: Replace explicit protos with includes. (grub_machine_init): Remove empty inits. * grub-core/term/arc/console.c: Remove explicit proto. * grub-core/term/at_keyboard.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_at_keyboard_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_at_keyboard_fini. * grub-core/term/gfxterm.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_gfxterm_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_gfxterm_fini. * grub-core/term/i386/pc/vga_text.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_vgatext_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_vgatext_fini. * grub-core/term/ieee1275/console.c: Remove explicit proto. * grub-core/term/serial.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_serial_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_serial_fini. * grub-core/term/terminfo.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_terminfo_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_terminfo_fini. * grub-core/video/bitmap.c (GRUB_MOD_INIT): Removed. (GRUB_MOD_FINI): Likewise. * grub-core/video/radeon_fuloong2e.c (GRUB_MOD_INIT) [LOONGSON]: Rename to grub_video_radeon_fuloong2e_init. (GRUB_MOD_FINI) [LOONGSON]: Rename to grub_video_radeon_fuloong2e_fini. * grub-core/video/sis315pro.c (GRUB_MOD_INIT) [LOONGSON]: Rename to grub_video_sis315pro_init. (GRUB_MOD_FINI) [LOONGSON]: Rename to grub_video_sis315pro_fini. * grub-core/video/sm712.c (GRUB_MOD_INIT) [LOONGSON]: Rename to grub_video_sm712_init. (GRUB_MOD_FINI) [LOONGSON]: Rename to grub_video_sm712_fini. * include/grub/at_keyboard.h (grub_at_keyboard_init): New proto. (grub_at_keyboard_fini): Likewise. * include/grub/dl.h (GRUB_MOD_INIT) [!GRUB_UTIL && !EMU]: Don't declare grub_{modname}_init. (GRUB_MOD_INIT) [!GRUB_UTIL && !EMU]: Don't declare grub_{modname}_fini. * include/grub/keyboard_layouts.h (grub_keylayouts_init) [!EMU]: New proto. (grub_keylayouts_fini) [!EMU]: Likewise. * include/grub/serial.h (grub_serial_init) [!EMU]: New proto. (grub_serial_fini) [!EMU]: Likewise. * include/grub/terminfo.h (grub_terminfo_init) [!EMU]: New proto. (grub_terminfo_fini) [!EMU]: Likewise. * include/grub/video.h (grub_font_init) [!EMU]: New proto. (grub_font_fini) [!EMU]: Likewise. (grub_gfxterm_init) [!EMU]: Likewise. (grub_gfxterm_fini) [!EMU]: Likewise. (grub_video_sm712_init) [!EMU]: Likewise. (grub_video_sm712_fini) [!EMU]: Likewise. (grub_video_sis315pro_init) [!EMU]: Likewise. (grub_video_sis315pro_fini) [!EMU]: Likewise. (grub_video_radeon_fuloong2e_init) [!EMU]: Likewise. (grub_video_radeon_fuloong2e_fini) [!EMU]: Likewise.
2012-02-26 23:28:45 +00:00
#include <grub/machine/console.h>
2011-05-17 12:02:18 +00:00
#include <grub/cpu/memory.h>
#include <grub/memory.h>
Remove grub_{modname}_init and grub_{modname}_fini. They should never be used directly if it's really a module and GRUB_MOD_INIT shouldn't be used on non-modules. * grub-core/commands/boot.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_boot_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_boot_fini. * grub-core/commands/keylayouts.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_keylayouts_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_keylayouts_fini. * grub-core/font/font_cmd.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_font_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_font_fini. * grub-core/kern/mips/loongson/init.c: Replace explicit protos with includes. (grub_machine_init): Remove empty inits. * grub-core/kern/mips/qemu_mips/init.c: Replace explicit protos with includes. (grub_machine_init): Remove empty inits. * grub-core/term/arc/console.c: Remove explicit proto. * grub-core/term/at_keyboard.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_at_keyboard_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_at_keyboard_fini. * grub-core/term/gfxterm.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_gfxterm_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_gfxterm_fini. * grub-core/term/i386/pc/vga_text.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_vgatext_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_vgatext_fini. * grub-core/term/ieee1275/console.c: Remove explicit proto. * grub-core/term/serial.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_serial_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_serial_fini. * grub-core/term/terminfo.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]: Rename to grub_terminfo_init. (GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_terminfo_fini. * grub-core/video/bitmap.c (GRUB_MOD_INIT): Removed. (GRUB_MOD_FINI): Likewise. * grub-core/video/radeon_fuloong2e.c (GRUB_MOD_INIT) [LOONGSON]: Rename to grub_video_radeon_fuloong2e_init. (GRUB_MOD_FINI) [LOONGSON]: Rename to grub_video_radeon_fuloong2e_fini. * grub-core/video/sis315pro.c (GRUB_MOD_INIT) [LOONGSON]: Rename to grub_video_sis315pro_init. (GRUB_MOD_FINI) [LOONGSON]: Rename to grub_video_sis315pro_fini. * grub-core/video/sm712.c (GRUB_MOD_INIT) [LOONGSON]: Rename to grub_video_sm712_init. (GRUB_MOD_FINI) [LOONGSON]: Rename to grub_video_sm712_fini. * include/grub/at_keyboard.h (grub_at_keyboard_init): New proto. (grub_at_keyboard_fini): Likewise. * include/grub/dl.h (GRUB_MOD_INIT) [!GRUB_UTIL && !EMU]: Don't declare grub_{modname}_init. (GRUB_MOD_INIT) [!GRUB_UTIL && !EMU]: Don't declare grub_{modname}_fini. * include/grub/keyboard_layouts.h (grub_keylayouts_init) [!EMU]: New proto. (grub_keylayouts_fini) [!EMU]: Likewise. * include/grub/serial.h (grub_serial_init) [!EMU]: New proto. (grub_serial_fini) [!EMU]: Likewise. * include/grub/terminfo.h (grub_terminfo_init) [!EMU]: New proto. (grub_terminfo_fini) [!EMU]: Likewise. * include/grub/video.h (grub_font_init) [!EMU]: New proto. (grub_font_fini) [!EMU]: Likewise. (grub_gfxterm_init) [!EMU]: Likewise. (grub_gfxterm_fini) [!EMU]: Likewise. (grub_video_sm712_init) [!EMU]: Likewise. (grub_video_sm712_fini) [!EMU]: Likewise. (grub_video_sis315pro_init) [!EMU]: Likewise. (grub_video_sis315pro_fini) [!EMU]: Likewise. (grub_video_radeon_fuloong2e_init) [!EMU]: Likewise. (grub_video_radeon_fuloong2e_fini) [!EMU]: Likewise.
2012-02-26 23:28:45 +00:00
#include <grub/video.h>
#include <grub/terminfo.h>
#include <grub/keyboard_layouts.h>
#include <grub/serial.h>
#include <grub/loader.h>
#include <grub/at_keyboard.h>
2009-10-09 17:50:31 +00:00
static inline int
probe_mem (grub_addr_t addr)
{
volatile grub_uint8_t *ptr = (grub_uint8_t *) (0xa0000000 | addr);
grub_uint8_t c = *ptr;
*ptr = 0xAA;
if (*ptr != 0xAA)
return 0;
*ptr = 0x55;
if (*ptr != 0x55)
return 0;
*ptr = c;
return 1;
}
2009-10-09 17:50:31 +00:00
void
grub_machine_init (void)
{
2011-05-17 12:02:18 +00:00
grub_addr_t modend;
if (grub_arch_memsize == 0)
{
int i;
for (i = 27; i >= 0; i--)
if (probe_mem (grub_arch_memsize | (1 << i)))
grub_arch_memsize |= (1 << i);
grub_arch_memsize++;
}
2011-05-17 12:02:18 +00:00
/* FIXME: measure this. */
grub_arch_cpuclock = 64000000;
modend = grub_modules_get_end ();
grub_mm_init_region ((void *) modend, grub_arch_memsize
2011-05-17 12:02:18 +00:00
- (modend - GRUB_ARCH_LOWMEMVSTART));
2009-10-10 18:52:15 +00:00
grub_install_get_time_ms (grub_rtc_get_time_ms);
2011-05-17 12:02:18 +00:00
grub_font_init ();
grub_keylayouts_init ();
grub_at_keyboard_init ();
grub_qemu_init_cirrus ();
grub_vga_text_init ();
2011-05-17 12:02:18 +00:00
grub_terminfo_init ();
grub_serial_init ();
grub_boot_init ();
grub_gfxterm_init ();
2009-10-09 17:50:31 +00:00
}
void
grub_machine_fini (void)
{
}
void
grub_exit (void)
{
while (1);
}
void
grub_halt (void)
{
while (1);
}
2009-10-10 11:30:14 +00:00
grub_err_t
2010-09-04 15:10:10 +00:00
grub_machine_mmap_iterate (grub_memory_hook_t hook)
2009-10-10 11:30:14 +00:00
{
hook (0, grub_arch_memsize, GRUB_MEMORY_AVAILABLE);
2009-10-10 11:30:14 +00:00
return GRUB_ERR_NONE;
}
extern char _end[];
Replace grub_module_iterate with FOR_MODULES. * grub-core/disk/memdisk.c (GRUB_MOD_INIT): Switched to new interface. * grub-core/kern/efi/efi.c (grub_arch_modules_addr): Renamed to... (grub_efi_modules_addr): ...this. * grub-core/kern/efi/init.c (grub_modbase): New variable. (grub_efi_init): Set grub_modbase. * grub-core/kern/emu/main.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. * grub-core/kern/i386/coreboot/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/i386/pc/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/ieee1275/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/main.c (grub_module_iterate): Remove. (grub_modules_get_end): Use grub_modbase. (grub_load_modules): Use FOR_MODULES. (grub_load_config): Likewise. * grub-core/kern/mips/arc/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/mips/loongson/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * grub-core/kern/mips/qemu_mips/init.c (grub_arch_modules_addr): Removed. (grub_modbase): New variable. (grub_machine_init): Set grub_modbase. * include/grub/efi/efi.h (grub_efi_modules_addr): New declaration. * include/grub/kernel.h (grub_arch_modules_addr): Removed. (grub_module_iterate): Likewise. (grub_modbase): New variable declaration. (FOR_MODULES): New macro.
2011-10-16 13:23:29 +00:00
grub_addr_t grub_modbase = (grub_addr_t) _end;