fuloong support
This commit is contained in:
parent
edf9d1f7eb
commit
74eea126f4
8 changed files with 74 additions and 25 deletions
|
@ -25,6 +25,9 @@
|
|||
#include <grub/cs5536.h>
|
||||
#include <grub/smbus.h>
|
||||
|
||||
#define GRUB_MACHINE_SERIAL_PORT GRUB_MACHINE_SERIAL_PORT0
|
||||
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 GRUB_MACHINE_SERIAL_PORT0_DIVISOR_115200
|
||||
|
||||
.set noreorder
|
||||
.set noat
|
||||
.set nomacro
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/offsets.h>
|
||||
|
||||
#define BASE_ADDR 8
|
||||
|
@ -59,6 +60,8 @@ VARIABLE (grub_arch_memsize)
|
|||
.long 0
|
||||
VARIABLE (grub_arch_highmemsize)
|
||||
.long 0
|
||||
VARIABLE (grub_arch_machine)
|
||||
.long GRUB_ARCH_MACHINE_FULOONG
|
||||
#endif
|
||||
cont:
|
||||
/* Save our base. */
|
||||
|
|
|
@ -208,8 +208,11 @@ grub_machine_init (void)
|
|||
grub_font_init ();
|
||||
grub_gfxterm_init ();
|
||||
|
||||
if (grub_arch_machine == GRUB_ARCH_MACHINE_YEELOONG)
|
||||
{
|
||||
grub_keylayouts_init ();
|
||||
grub_at_keyboard_init ();
|
||||
}
|
||||
|
||||
grub_terminfo_init ();
|
||||
grub_serial_init ();
|
||||
|
|
|
@ -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
|
||||
#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_MACHTYPE, sizeof (LOONGSON_MACHTYPE));
|
||||
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_MACHTYPE), 4);
|
||||
linux_args += ALIGN_UP (sizeof (loongson_machtypes[mtype]), 4);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/list.h>
|
||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||
#include <grub/machine/kernel.h>
|
||||
#endif
|
||||
|
||||
#define FOR_SERIAL_PORTS(var) FOR_LIST_ELEMENTS((var), (grub_serial_ports))
|
||||
|
||||
|
@ -296,17 +299,22 @@ grub_serial_register (struct grub_serial_port *port)
|
|||
port->term_out = out;
|
||||
grub_terminfo_output_register (out, "vt100");
|
||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||
if (grub_strcmp (port->name, "com0") == 0)
|
||||
if (grub_strcmp (port->name,
|
||||
(grub_arch_machine == GRUB_ARCH_MACHINE_YEELOONG)
|
||||
? "com0" : "com2") == 0)
|
||||
{
|
||||
grub_term_register_input_active ("serial_*", in);
|
||||
grub_term_register_output_active ("serial_*", out);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
grub_term_register_input_inactive ("serial_*", in);
|
||||
grub_term_register_output_inactive ("serial_*", out);
|
||||
}
|
||||
#else
|
||||
grub_term_register_input ("serial_*", in);
|
||||
grub_term_register_output ("serial_*", out);
|
||||
}
|
||||
#endif
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -21,11 +21,16 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#define GRUB_ARCH_MACHINE_YEELOONG 0
|
||||
#define GRUB_ARCH_MACHINE_FULOONG 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_machine);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -19,11 +19,14 @@
|
|||
#ifndef GRUB_MACHINE_SERIAL_HEADER
|
||||
#define GRUB_MACHINE_SERIAL_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 2
|
||||
#define GRUB_MACHINE_SERIAL_PORT 0xbff003f8
|
||||
#define GRUB_MACHINE_SERIAL_PORT0_DIVISOR_115200 2
|
||||
#define GRUB_MACHINE_SERIAL_PORT2_DIVISOR_115200 1
|
||||
#define GRUB_MACHINE_SERIAL_PORT0 0xbff003f8
|
||||
#define GRUB_MACHINE_SERIAL_PORT1 0xbfd003f8
|
||||
#define GRUB_MACHINE_SERIAL_PORT2 0xbfd002f8
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { GRUB_MACHINE_SERIAL_PORT }
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { GRUB_MACHINE_SERIAL_PORT0, GRUB_MACHINE_SERIAL_PORT1, GRUB_MACHINE_SERIAL_PORT2 }
|
||||
#else
|
||||
#endif
|
||||
|
||||
|
|
|
@ -251,6 +251,14 @@ grub_term_register_input (const char *name __attribute__ ((unused)),
|
|||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_register_input_inactive (const char *name __attribute__ ((unused)),
|
||||
grub_term_input_t term)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_register_input_active (const char *name __attribute__ ((unused)),
|
||||
grub_term_input_t term)
|
||||
|
@ -275,6 +283,14 @@ grub_term_register_output (const char *name __attribute__ ((unused)),
|
|||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_register_output_inactive (const char *name __attribute__ ((unused)),
|
||||
grub_term_output_t term)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_register_output_active (const char *name __attribute__ ((unused)),
|
||||
grub_term_output_t term)
|
||||
|
|
Loading…
Reference in a new issue