if COND_i386_ieee1275
CFLAGS_PLATFORM += -mrtd -mregparm=3
endif
- if COND_mips_yeeloong
+ if COND_mips_loongson
CFLAGS_PLATFORM += -mexplicit-relocs
CPPFLAGS_PLATFORM = -DUSE_ASCII_FAILBACK
- CCASFLAGS_PLATFORM = -march=mips3
endif
if COND_mips
CFLAGS_PLATFORM += -mflush-func=grub_cpu_flush_cache
powerpc-ieee1275) ;;
sparc64-ieee1275) ;;
mips-qemu-mips) ;;
- mips-yeeloong) ;;
+ mips-yeeloong) platform=loongson ;;
+ mips-fuloong) platform=loongson ;;
+ mips-loongson) ;;
+ mips-arc) ;;
*-emu) ;;
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
esac
qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
- yeeloong) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
+ loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
qemu-mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
+ mips-arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_ARC=1 -DGRUB_MACHINE_ARC=1" ;;
esac
case "$target_cpu" in
mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
- AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong])
+ AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmips -a x$platform = xloongson])
AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips])
+AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc])
AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips])
GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
- "mips_yeeloong", "sparc64_ieee1275",
+ "mips_loongson", "sparc64_ieee1275",
- "powerpc_ieee1275" ]
+ "powerpc_ieee1275", "mips_arc" ]
GROUPS = {}
GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ]
GROUPS["x86_64"] = [ "x86_64_efi" ]
GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"]
- GROUPS["mips"] = [ "mips_yeeloong", "mips_arc" ]
-GROUPS["mips"] = [ "mips_loongson" ]
++GROUPS["mips"] = [ "mips_loongson", "mips_arc" ]
GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
# Groups based on hardware features
- GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_yeeloong"]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
- GROUPS["pci"] = GROUPS["x86"] + ["mips_yeeloong"]
+ GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_loongson"]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
-GROUPS["pci"] = GROUPS["x86"] + GROUPS["mips"]
++GROUPS["pci"] = GROUPS["x86"] + ["mips_loongson"]
GROUPS["usb"] = GROUPS["pci"]
# If gfxterm is main output console integrate it into kernel
for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
# Similar for terminfo
- GROUPS["terminfoinkernel"] = ["mips_yeeloong", "mips_arc"] + GROUPS["ieee1275"];
-GROUPS["terminfoinkernel"] = ["mips_loongson"] + GROUPS["ieee1275"];
++GROUPS["terminfoinkernel"] = ["mips_loongson", "mips_arc"] + GROUPS["ieee1275"];
GROUPS["terminfomodule"] = GRUB_PLATFORMS[:];
for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
endif
- if COND_mips_yeeloong
+if COND_mips
+KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
+endif
+
+if COND_mips_arc
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arc/arc.h
+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/cpu/cache.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
i386_coreboot_ldflags = '-Wl,-Ttext=0x8200';
i386_multiboot_ldflags = '-Wl,-Ttext=0x8200';
i386_ieee1275_ldflags = '-Wl,-Ttext=0x10000';
- mips_yeeloong_ldflags = '-Wl,-Ttext,0x80200000';
+ mips_loongson_ldflags = '-Wl,-Ttext,0x80200000';
powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';
sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400';
+ mips_arc_ldflags = '-Wl,-Ttext,0x8a000000';
- mips_yeeloong_cppflags = '-DUSE_ASCII_FAILBACK';
+ mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK';
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
emu_cflags = '$(CFLAGS_GNULIB)';
emu_cppflags = '$(CPPFLAGS_GNULIB)';
i386_ieee1275 = kern/ieee1275/init.c;
- mips_yeeloong = term/ns8250.c;
- mips_yeeloong = bus/bonito.c;
- mips_yeeloong = bus/cs5536.c;
- mips_yeeloong = bus/pci.c;
- mips_yeeloong = kern/mips/yeeloong/init.c;
- mips_yeeloong = term/at_keyboard.c;
- mips_yeeloong = term/serial.c;
- mips_yeeloong = video/sm712.c;
+ mips = kern/mips/cache.S;
+ mips = kern/mips/dl.c;
+ mips = kern/mips/init.c;
+
+ mips_arc = kern/mips/arc/init.c;
+ mips_arc = term/arc/console.c;
+ mips_arc = disk/arc/arcdisk.c;
+
- mips_loongson = kern/mips/cache.S;
- mips_loongson = kern/mips/dl.c;
- mips_loongson = kern/mips/init.c;
+ mips_loongson = term/ns8250.c;
+ mips_loongson = bus/bonito.c;
+ mips_loongson = bus/cs5536.c;
+ mips_loongson = bus/pci.c;
+ mips_loongson = kern/mips/loongson/init.c;
+ mips_loongson = term/at_keyboard.c;
+ mips_loongson = term/serial.c;
+ mips_loongson = video/sm712.c;
+ mips_loongson = video/sis315pro.c;
extra_dist = video/sm712_init.c;
- mips_yeeloong = commands/keylayouts.c;
+ mips_loongson = commands/keylayouts.c;
powerpc_ieee1275 = kern/ieee1275/init.c;
powerpc_ieee1275 = kern/powerpc/cache.S;
#include <grub/cs5536.h>
#include <grub/term.h>
#include <grub/machine/ec.h>
+#include <grub/cpu/memory.h>
extern void grub_video_sm712_init (void);
+ extern void grub_video_sis315pro_init (void);
extern void grub_video_init (void);
extern void grub_bitmap_init (void);
extern void grub_font_init (void);
*/
. = _start + GRUB_KERNEL_MACHINE_PREFIX_END
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
+VARIABLE (grub_arch_cpuclock)
+ .long 0
+ #ifdef GRUB_MACHINE_MIPS_LOONGSON
VARIABLE (grub_arch_busclock)
.long 0
-VARIABLE (grub_arch_cpuclock)
- .long 0
VARIABLE (grub_arch_memsize)
.long 0
VARIABLE (grub_arch_highmemsize)
GRUB_MOD_LICENSE ("GPLv3+");
/* For frequencies. */
-#include <grub/pci.h>
#include <grub/machine/time.h>
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
-
+ #ifdef GRUB_MACHINE_MIPS_LOONGSON
-#include <grub/machine/kernel.h>
+#include <grub/pci.h>
- /* 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"
+ 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;
static grub_uint8_t *playground;
static grub_addr_t target_addr, entry_addr;
static int linux_argc;
-static grub_off_t argv_off, envp_off;
+static grub_off_t argv_off;
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
++#ifdef GRUB_MACHINE_MIPS_LOONGSON
+static grub_off_t envp_off;
+#endif
static grub_off_t rd_addr_arg_off, rd_size_arg_off;
static int initrd_loaded = 0;
state.gpr[1] = entry_addr;
state.gpr[4] = linux_argc;
state.gpr[5] = target_addr + argv_off;
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
++#ifdef GRUB_MACHINE_MIPS_LOONGSON
state.gpr[6] = target_addr + envp_off;
+#else
+ state.gpr[6] = 0;
+#endif
+ state.gpr[7] = 0;
state.jumpreg = 1;
grub_relocator32_boot (relocator, state);
int i;
int size;
void *extra = NULL;
- grub_uint32_t *linux_argv, *linux_envp;
- char *linux_args, *linux_envs;
+ grub_uint32_t *linux_argv;
+ char *linux_args;
grub_err_t err;
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
++#ifdef GRUB_MACHINE_MIPS_LOONGSON
+ char *linux_envs;
+ grub_uint32_t *linux_envp;
+#endif
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
extra = linux_args;
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
++#ifdef GRUB_MACHINE_MIPS_LOONGSON
linux_envp = extra;
envp_off = (grub_uint8_t *) linux_envp - (grub_uint8_t *) playground;
linux_envs = (char *) (linux_envp + 5);
--- /dev/null
-void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
-void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
-
+ /*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ #ifndef GRUB_KERNEL_MACHINE_HEADER
+ #define GRUB_KERNEL_MACHINE_HEADER 1
+
+ #include <grub/symbol.h>
++#include <grub/cpu/kernel.h>
+
+ #define GRUB_ARCH_MACHINE_YEELOONG 0
+ #define GRUB_ARCH_MACHINE_FULOONG 1
+
+ #ifndef ASM_FILE
+
+ extern grub_uint32_t EXPORT_VAR (grub_arch_machine);
+
+ #endif
+
+ #endif /* ! GRUB_KERNEL_MACHINE_HEADER */
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
- #define GRUB_KERNEL_MIPS_YEELOONG_LINK_ADDR 0x80200000
+ #define GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR 0x80200000
- #define GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN 32
+ #define GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN 32
- #define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE 0x8
- #define GRUB_KERNEL_MIPS_YEELOONG_UNCOMPRESSED_SIZE 0xc
+ #define GRUB_KERNEL_MIPS_LOONGSON_COMPRESSED_SIZE 0x8
+ #define GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_SIZE 0xc
- #define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE 0x08
- #define GRUB_KERNEL_MIPS_YEELOONG_PREFIX 0x0c
- #define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END 0x54
+ #define GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE 0x08
+ #define GRUB_KERNEL_MIPS_LOONGSON_PREFIX 0x0c
+ #define GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END 0x54
+#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x8a000000
+
+#define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32
+
+#define GRUB_KERNEL_MIPS_ARC_COMPRESSED_SIZE 0x8
+#define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_SIZE 0xc
+
+#define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE 0x08
+#define GRUB_KERNEL_MIPS_ARC_PREFIX 0x0c
+#define GRUB_KERNEL_MIPS_ARC_PREFIX_END 0x54
+
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
- #define GRUB_KERNEL_MIPS_YEELOONG_MOD_ALIGN 0x1
+ #define GRUB_KERNEL_MIPS_LOONGSON_MOD_ALIGN 0x1
+#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
/* Minimal gap between _end and the start of the modules. It's a hack
for PowerMac to prevent "CLAIM failed" error. The real fix is to
enum {
IMAGE_I386_PC, IMAGE_EFI, IMAGE_COREBOOT,
IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_I386_IEEE1275,
- IMAGE_YEELOONG_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
- IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC
+ IMAGE_LOONGSON_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
- IMAGE_FULOONG_FLASH, IMAGE_I386_PC_PXE
++ IMAGE_FULOONG_FLASH, IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC
} id;
enum
{
.install_bsd_part = TARGET_NO_FIELD,
.link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
},
- .name = "mips-arc",
+ {
++ .dirname = "mips-arc",
++ .names = {"mips-arc", NULL},
+ .voidp_sizeof = 4,
+ .bigendian = 1,
+ .id = IMAGE_MIPS_ARC,
+ .flags = PLATFORM_FLAGS_DECOMPRESSORS,
+ .prefix = GRUB_KERNEL_MIPS_ARC_PREFIX,
+ .prefix_end = GRUB_KERNEL_MIPS_ARC_PREFIX_END,
+ .raw_size = 0,
+ .total_module_size = GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE,
+ .compressed_size = TARGET_NO_FIELD,
+ .kernel_image_size = TARGET_NO_FIELD,
+ .section_align = 1,
+ .vaddr_offset = 0,
+ .install_dos_part = TARGET_NO_FIELD,
+ .install_bsd_part = TARGET_NO_FIELD,
+ .link_addr = GRUB_KERNEL_MIPS_ARC_LINK_ADDR,
+ .elf_target = EM_MIPS,
+ .link_align = GRUB_KERNEL_MIPS_ARC_LINK_ALIGN,
+ .default_compression = COMPRESSION_NONE
+ },
};
#define grub_target_to_host32(x) (grub_target_to_host32_real (image_target, (x)))
core_size = rom_size;
}
break;
- case IMAGE_YEELOONG_ELF:
+ case IMAGE_MIPS_ARC:
+ {
+ char *ecoff_img;
+ struct ecoff_header {
+ grub_uint16_t magic;
+ grub_uint16_t nsec;
+ grub_uint32_t time;
+ grub_uint32_t syms;
+ grub_uint32_t nsyms;
+ grub_uint16_t opt;
+ grub_uint16_t flags;
+ grub_uint16_t magic2;
+ grub_uint16_t version;
+ grub_uint32_t textsize;
+ grub_uint32_t datasize;
+ grub_uint32_t bsssize;
+ grub_uint32_t entry;
+ grub_uint32_t text_start;
+ grub_uint32_t data_start;
+ grub_uint32_t bss_start;
+ grub_uint32_t gprmask;
+ grub_uint32_t cprmask[4];
+ grub_uint32_t gp_value;
+ };
+ struct ecoff_section
+ {
+ char name[8];
+ grub_uint32_t paddr;
+ grub_uint32_t vaddr;
+ grub_uint32_t size;
+ grub_uint32_t file_offset;
+ grub_uint32_t reloc;
+ grub_uint32_t gp;
+ grub_uint16_t nreloc;
+ grub_uint16_t ngp;
+ grub_uint32_t flags;
+ };
+ struct ecoff_header *head;
+ struct ecoff_section *section;
+ grub_uint32_t target_addr;
+ size_t program_size;
+
+ program_size = ALIGN_ADDR (core_size);
+ target_addr = image_target->link_addr - ALIGN_UP(program_size, 1048576)
+ - (1 << 20);
+
+ ecoff_img = xmalloc (program_size + sizeof (*head) + sizeof (*section));
+ grub_memset (ecoff_img, 0, program_size + sizeof (*head) + sizeof (*section));
+ head = (void *) ecoff_img;
+ section = (void *) (head + 1);
+ head->magic = grub_host_to_target16 (0x160);
+ head->nsec = grub_host_to_target16 (1);
+ head->time = grub_host_to_target32 (0);
+ head->opt = grub_host_to_target16 (0x38);
+ head->flags = grub_host_to_target16 (0x207);
+ head->magic2 = grub_host_to_target16 (0x107);
+ head->textsize = grub_host_to_target32 (program_size);
+ head->entry = grub_host_to_target32 (target_addr);
+ head->text_start = grub_host_to_target32 (target_addr);
+ head->data_start = grub_host_to_target32 (target_addr + program_size);
+ grub_memcpy (section->name, ".text", sizeof (".text") - 1);
+ section->vaddr = grub_host_to_target32 (target_addr);
+ section->size = grub_host_to_target32 (program_size);
+ section->file_offset = grub_host_to_target32 (sizeof (*head) + sizeof (*section));
+ memcpy (section + 1, core_img, core_size);
+ free (core_img);
+ core_img = ecoff_img;
+ core_size = program_size + sizeof (*head) + sizeof (*section);
+ }
+ break;
+ case IMAGE_LOONGSON_ELF:
case IMAGE_PPC:
case IMAGE_COREBOOT:
case IMAGE_I386_IEEE1275: