fuloong support

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-01-18 15:28:44 +01:00
parent edf9d1f7eb
commit 74eea126f4
8 changed files with 74 additions and 25 deletions

View file

@ -33,11 +33,13 @@
#include <grub/machine/time.h>
#ifdef GRUB_MACHINE_MIPS_YEELOONG
/* This can be detected on runtime from PMON, but:
a) it wouldn't work when GRUB is the firmware
and
b) for now we only support Yeeloong anyway. */
#define LOONGSON_MACHTYPE "machtype=lemote-yeeloong-2f-8.9inches"
#include <grub/machine/kernel.h>
const char loongson_machtypes[][60] =
{
[GRUB_ARCH_MACHINE_YEELOONG] = "machtype=lemote-yeeloong-2f-8.9inches",
[GRUB_ARCH_MACHINE_FULOONG] = "machtype=lemote-fuloong-2f-unknown"
};
#endif
static grub_dl_t my_mod;
@ -222,7 +224,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
/* For arguments. */
linux_argc = argc;
#ifdef LOONGSON_MACHTYPE
#ifdef GRUB_MACHINE_MIPS_YEELOONG
linux_argc++;
#endif
/* Main arguments. */
@ -237,8 +239,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
/* Normal arguments. */
for (i = 1; i < argc; i++)
size += ALIGN_UP (grub_strlen (argv[i]) + 1, 4);
#ifdef LOONGSON_MACHTYPE
size += ALIGN_UP (sizeof (LOONGSON_MACHTYPE), 4);
#ifdef GRUB_MACHINE_MIPS_YEELOONG
size += ALIGN_UP (sizeof (loongson_machtypes[0]), 4);
#endif
/* rd arguments. */
@ -277,14 +279,20 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
linux_argv++;
linux_args += ALIGN_UP (sizeof ("a0"), 4);
#ifdef LOONGSON_MACHTYPE
/* In Loongson platform, it is the responsibility of the bootloader/firmware
to supply the OS kernel with machine type information. */
grub_memcpy (linux_args, LOONGSON_MACHTYPE, sizeof (LOONGSON_MACHTYPE));
*linux_argv = (grub_uint8_t *) linux_args - (grub_uint8_t *) playground
+ target_addr;
linux_argv++;
linux_args += ALIGN_UP (sizeof (LOONGSON_MACHTYPE), 4);
#ifdef GRUB_MACHINE_MIPS_YEELOONG
{
unsigned mtype = grub_arch_machine;
if (mtype >= ARRAY_SIZE (loongson_machtypes))
mtype = 0;
/* In Loongson platform, it is the responsibility of the bootloader/firmware
to supply the OS kernel with machine type information. */
grub_memcpy (linux_args, loongson_machtypes[mtype],
sizeof (loongson_machtypes[mtype]));
*linux_argv = (grub_uint8_t *) linux_args - (grub_uint8_t *) playground
+ target_addr;
linux_argv++;
linux_args += ALIGN_UP (sizeof (loongson_machtypes[mtype]), 4);
}
#endif
for (i = 1; i < argc; i++)