summaryrefslogtreecommitdiffstats
path: root/include/grub/mips/loongson
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:51 +0000
commit6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e (patch)
tree32451fa3cdd9321fb2591fada9891b2cb70a9cd1 /include/grub/mips/loongson
parentInitial commit. (diff)
downloadgrub2-3e86199209a10ed6555e30b8b71884cb7cc45ed2.tar.xz
grub2-3e86199209a10ed6555e30b8b71884cb7cc45ed2.zip
Adding upstream version 2.06.upstream/2.06upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--include/grub/mips/loongson.h86
-rw-r--r--include/grub/mips/loongson/at_keyboard.h27
-rw-r--r--include/grub/mips/loongson/cmos.h30
-rw-r--r--include/grub/mips/loongson/ec.h45
-rw-r--r--include/grub/mips/loongson/kernel.h36
-rw-r--r--include/grub/mips/loongson/memory.h51
-rw-r--r--include/grub/mips/loongson/pci.h110
-rw-r--r--include/grub/mips/loongson/serial.h33
-rw-r--r--include/grub/mips/loongson/time.h27
9 files changed, 445 insertions, 0 deletions
diff --git a/include/grub/mips/loongson.h b/include/grub/mips/loongson.h
new file mode 100644
index 0000000..e6f0241
--- /dev/null
+++ b/include/grub/mips/loongson.h
@@ -0,0 +1,86 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 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_LOONGSON_CPU_HEADER
+#define GRUB_LOONGSON_CPU_HEADER 1
+
+#include <grub/cpu/mips.h>
+
+#define GRUB_CPU_LOONGSON_FLASH_START 0xbfc00000
+#define GRUB_CPU_LOONGSON_FLASH_TLB_REFILL 0xbfc00200
+#define GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR 0xbfc00300
+#define GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION 0xbfc00380
+
+#define GRUB_CPU_LOONGSON_DDR2_BASE 0xaffffe00
+#define GRUB_CPU_LOONGSON_DDR2_REG1_HI_8BANKS 0x00000001
+#define GRUB_CPU_LOONGSON_DDR2_REG_SIZE 0x8
+#define GRUB_CPU_LOONGSON_DDR2_REG_STEP 0x10
+
+#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG GRUB_CPU_REGISTER_WRAP($16)
+#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_ILINESIZE 0x10
+#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_DLINESIZE 0x8
+#define GRUB_CPU_LOONGSON_COP0_CACHE_DSIZE_SHIFT 6
+#define GRUB_CPU_LOONGSON_COP0_CACHE_ISIZE_SHIFT 9
+#define GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_MASK 0x7
+#define GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET 12
+
+#define GRUB_CPU_LOONGSON_COP0_I_INDEX_INVALIDATE 0
+#define GRUB_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE 9
+#define GRUB_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE 11
+
+#define GRUB_CPU_LOONGSON_COP0_I_INDEX_BIT_OFFSET 5
+#define GRUB_CPU_LOONGSON_COP0_D_INDEX_BIT_OFFSET 5
+#define GRUB_CPU_LOONGSON_COP0_S_INDEX_BIT_OFFSET 5
+
+#define GRUB_CPU_LOONGSON_CACHE_ACCELERATED 7
+#define GRUB_CPU_LOONGSON_CACHE_UNCACHED 2
+#define GRUB_CPU_LOONGSON_CACHE_CACHED 3
+#define GRUB_CPU_LOONGSON_CACHE_TYPE_MASK 7
+#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_SMALL 4
+#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG 5
+#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_SMALL 16
+#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_BIG 32
+
+#define GRUB_CPU_LOONGSON_I_CACHE_LOG_WAYS 2
+#define GRUB_CPU_LOONGSON_D_CACHE_LOG_WAYS 2
+#define GRUB_CPU_LOONGSON_S_CACHE_LOG_WAYS 2
+
+/* FIXME: determine dynamically. */
+#define GRUB_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE 19
+
+#define GRUB_CPU_LOONGSON_COP0_BADVADDR GRUB_CPU_REGISTER_WRAP($8)
+#define GRUB_CPU_LOONGSON_COP0_CAUSE GRUB_CPU_REGISTER_WRAP($13)
+#define GRUB_CPU_LOONGSON_COP0_EPC GRUB_CPU_REGISTER_WRAP($14)
+#define GRUB_CPU_LOONGSON_COP0_PRID GRUB_CPU_REGISTER_WRAP($15)
+#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO GRUB_CPU_REGISTER_WRAP($28)
+#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI GRUB_CPU_REGISTER_WRAP($29)
+
+#define GRUB_CPU_LOONGSON_LIOCFG 0xbfe00108
+#define GRUB_CPU_LOONGSON_ROM_DELAY_OFFSET 2
+#define GRUB_CPU_LOONGSON_ROM_DELAY_MASK 0x1f
+#define GRUB_CPU_LOONGSON_CORECFG 0xbfe00180
+#define GRUB_CPU_LOONGSON_CORECFG_DISABLE_DDR2_SPACE 0x100
+#define GRUB_CPU_LOONGSON_CORECFG_BUFFER_CPU 0x200
+
+#define GRUB_CPU_LOONGSON_PCI_HIT1_SEL_LO 0xbfe00150
+#define GRUB_CPU_LOONGSON_PCI_HIT1_SEL_HI 0xbfe00154
+
+#define GRUB_CPU_LOONGSON_GPIOCFG 0xbfe00120
+#define GRUB_CPU_YEELOONG_SHUTDOWN_GPIO 1
+
+#endif
diff --git a/include/grub/mips/loongson/at_keyboard.h b/include/grub/mips/loongson/at_keyboard.h
new file mode 100644
index 0000000..8e58cfb
--- /dev/null
+++ b/include/grub/mips/loongson/at_keyboard.h
@@ -0,0 +1,27 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 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_MACHINE_AT_KEYBOARD_HEADER
+#define GRUB_MACHINE_AT_KEYBOARD_HEADER 1
+
+#include <grub/pci.h>
+
+#define KEYBOARD_REG_DATA (GRUB_MACHINE_PCI_IO_BASE | 0x60)
+#define KEYBOARD_REG_STATUS (GRUB_MACHINE_PCI_IO_BASE | 0x64)
+
+#endif
diff --git a/include/grub/mips/loongson/cmos.h b/include/grub/mips/loongson/cmos.h
new file mode 100644
index 0000000..0c8cc8d
--- /dev/null
+++ b/include/grub/mips/loongson/cmos.h
@@ -0,0 +1,30 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2008 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_CPU_CMOS_H
+#define GRUB_CPU_CMOS_H 1
+
+#include <grub/types.h>
+#include <grub/cpu/io.h>
+
+#define GRUB_CMOS_ADDR_REG 0xbfd00070
+#define GRUB_CMOS_DATA_REG 0xbfd00071
+#define GRUB_CMOS_ADDR_REG_HI 0xbfd00072
+#define GRUB_CMOS_DATA_REG_HI 0xbfd00073
+
+#endif /* GRUB_CPU_CMOS_H */
diff --git a/include/grub/mips/loongson/ec.h b/include/grub/mips/loongson/ec.h
new file mode 100644
index 0000000..3f8ff99
--- /dev/null
+++ b/include/grub/mips/loongson/ec.h
@@ -0,0 +1,45 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 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_EC_MACHINE_HEADER
+#define GRUB_EC_MACHINE_HEADER 1
+
+#include <grub/types.h>
+#include <grub/cpu/io.h>
+#include <grub/pci.h>
+
+#define GRUB_MACHINE_EC_MAGIC_PORT1 0x381
+#define GRUB_MACHINE_EC_MAGIC_PORT2 0x382
+#define GRUB_MACHINE_EC_DATA_PORT 0x383
+
+#define GRUB_MACHINE_EC_MAGIC_VAL1 0xf4
+#define GRUB_MACHINE_EC_MAGIC_VAL2 0xec
+
+#define GRUB_MACHINE_EC_COMMAND_REBOOT 1
+
+static inline void
+grub_write_ec (grub_uint8_t value)
+{
+ grub_outb (GRUB_MACHINE_EC_MAGIC_VAL1,
+ GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_MAGIC_PORT1);
+ grub_outb (GRUB_MACHINE_EC_MAGIC_VAL2,
+ GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_MAGIC_PORT2);
+ grub_outb (value, GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_DATA_PORT);
+}
+
+#endif
diff --git a/include/grub/mips/loongson/kernel.h b/include/grub/mips/loongson/kernel.h
new file mode 100644
index 0000000..0587191
--- /dev/null
+++ b/include/grub/mips/loongson/kernel.h
@@ -0,0 +1,36 @@
+/*
+ * 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_FULOONG2F 1
+#define GRUB_ARCH_MACHINE_FULOONG2E 2
+#define GRUB_ARCH_MACHINE_YEELOONG_3A 3
+
+#ifndef ASM_FILE
+
+extern grub_uint32_t EXPORT_VAR (grub_arch_machine) __attribute__ ((section(".text")));
+
+#endif
+
+#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
diff --git a/include/grub/mips/loongson/memory.h b/include/grub/mips/loongson/memory.h
new file mode 100644
index 0000000..aa41fa6
--- /dev/null
+++ b/include/grub/mips/loongson/memory.h
@@ -0,0 +1,51 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 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_MEMORY_MACHINE_HEADER
+#define GRUB_MEMORY_MACHINE_HEADER 1
+
+#ifndef ASM_FILE
+#include <grub/symbol.h>
+#include <grub/err.h>
+#include <grub/types.h>
+#endif
+
+#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x801ffff0
+
+#ifndef ASM_FILE
+
+static inline grub_err_t
+grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
+ grub_uint64_t size __attribute__ ((unused)),
+ int type __attribute__ ((unused)),
+ int handle __attribute__ ((unused)))
+{
+ return GRUB_ERR_NONE;
+}
+static inline grub_err_t
+grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
+{
+ return GRUB_ERR_NONE;
+}
+
+extern grub_uint32_t EXPORT_VAR (grub_arch_memsize) __attribute__ ((section(".text")));
+extern grub_uint32_t EXPORT_VAR (grub_arch_highmemsize) __attribute__ ((section(".text")));
+
+#endif
+
+#endif
diff --git a/include/grub/mips/loongson/pci.h b/include/grub/mips/loongson/pci.h
new file mode 100644
index 0000000..b3272e9
--- /dev/null
+++ b/include/grub/mips/loongson/pci.h
@@ -0,0 +1,110 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2008 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_MACHINE_PCI_H
+#define GRUB_MACHINE_PCI_H 1
+
+#ifndef ASM_FILE
+#include <grub/types.h>
+#include <grub/cpu/io.h>
+#endif
+
+#define GRUB_LOONGSON_OHCI_PCIID 0x00351033
+#define GRUB_LOONGSON_EHCI_PCIID 0x00e01033
+
+#define GRUB_MACHINE_PCI_IO_BASE_2F 0xbfd00000
+#define GRUB_MACHINE_PCI_IO_BASE_3A 0xb8000000
+#define GRUB_MACHINE_PCI_CONFSPACE_2F 0xbfe80000
+#define GRUB_MACHINE_PCI_CONFSPACE_3A 0xba000000
+#define GRUB_MACHINE_PCI_CONFSPACE_3A_EXT 0xbb000000
+#define GRUB_MACHINE_PCI_CONTROLLER_HEADER 0xbfe00000
+
+#define GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F 0xbfe00118
+
+#define GRUB_PCI_NUM_DEVICES_2F 16
+
+#ifndef ASM_FILE
+
+typedef enum { GRUB_BONITO_2F, GRUB_BONITO_3A } grub_bonito_type_t;
+extern grub_bonito_type_t EXPORT_VAR (grub_bonito_type);
+
+#define GRUB_PCI_NUM_DEVICES (grub_bonito_type ? 32 \
+ : GRUB_PCI_NUM_DEVICES_2F)
+#define GRUB_PCI_NUM_BUS (grub_bonito_type ? 256 : 1)
+
+#define GRUB_MACHINE_PCI_IO_BASE (grub_bonito_type \
+ ? GRUB_MACHINE_PCI_IO_BASE_3A \
+ : GRUB_MACHINE_PCI_IO_BASE_2F)
+
+#define GRUB_MACHINE_PCI_CONF_CTRL_REG_2F (*(volatile grub_uint32_t *) \
+ GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F)
+#define GRUB_MACHINE_PCI_IO_CTRL_REG_2F (*(volatile grub_uint32_t *) 0xbfe00110)
+#define GRUB_MACHINE_PCI_CONF_CTRL_REG_3A (*(volatile grub_uint32_t *) \
+ 0xbfe00118)
+
+#endif
+#define GRUB_MACHINE_PCI_WIN_MASK_SIZE 6
+#define GRUB_MACHINE_PCI_WIN_MASK ((1 << GRUB_MACHINE_PCI_WIN_MASK_SIZE) - 1)
+
+/* We have 3 PCI windows. */
+#define GRUB_MACHINE_PCI_NUM_WIN 3
+/* Each window is 64MiB. */
+#define GRUB_MACHINE_PCI_WIN_SHIFT 26
+#define GRUB_MACHINE_PCI_WIN_OFFSET_MASK ((1 << GRUB_MACHINE_PCI_WIN_SHIFT) - 1)
+
+#define GRUB_MACHINE_PCI_WIN_SIZE 0x04000000
+/* Graphical acceleration takes 1 MiB away. */
+#define GRUB_MACHINE_PCI_WIN1_SIZE 0x03f00000
+
+#define GRUB_MACHINE_PCI_WIN1_ADDR 0xb0000000
+#define GRUB_MACHINE_PCI_WIN2_ADDR 0xb4000000
+#define GRUB_MACHINE_PCI_WIN3_ADDR 0xb8000000
+
+#ifndef ASM_FILE
+grub_uint32_t
+EXPORT_FUNC (grub_pci_read) (grub_pci_address_t addr);
+
+grub_uint16_t
+EXPORT_FUNC (grub_pci_read_word) (grub_pci_address_t addr);
+
+grub_uint8_t
+EXPORT_FUNC (grub_pci_read_byte) (grub_pci_address_t addr);
+
+void
+EXPORT_FUNC (grub_pci_write) (grub_pci_address_t addr, grub_uint32_t data);
+
+void
+EXPORT_FUNC (grub_pci_write_word) (grub_pci_address_t addr, grub_uint16_t data);
+
+void
+EXPORT_FUNC (grub_pci_write_byte) (grub_pci_address_t addr, grub_uint8_t data);
+
+volatile void *
+EXPORT_FUNC (grub_pci_device_map_range) (grub_pci_device_t dev,
+ grub_addr_t base, grub_size_t size);
+void *
+EXPORT_FUNC (grub_pci_device_map_range_cached) (grub_pci_device_t dev,
+ grub_addr_t base,
+ grub_size_t size);
+void
+EXPORT_FUNC (grub_pci_device_unmap_range) (grub_pci_device_t dev,
+ volatile void *mem,
+ grub_size_t size);
+#endif
+
+#endif /* GRUB_MACHINE_PCI_H */
diff --git a/include/grub/mips/loongson/serial.h b/include/grub/mips/loongson/serial.h
new file mode 100644
index 0000000..45e6d84
--- /dev/null
+++ b/include/grub/mips/loongson/serial.h
@@ -0,0 +1,33 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 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_MACHINE_SERIAL_HEADER
+#define GRUB_MACHINE_SERIAL_HEADER 1
+
+#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_PORT0, GRUB_MACHINE_SERIAL_PORT1, GRUB_MACHINE_SERIAL_PORT2 }
+#else
+#endif
+
+#endif
diff --git a/include/grub/mips/loongson/time.h b/include/grub/mips/loongson/time.h
new file mode 100644
index 0000000..0985732
--- /dev/null
+++ b/include/grub/mips/loongson/time.h
@@ -0,0 +1,27 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2003,2004,2005,2007 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 KERNEL_MACHINE_TIME_HEADER
+#define KERNEL_MACHINE_TIME_HEADER 1
+
+#include <grub/symbol.h>
+#include <grub/cpu/time.h>
+
+extern grub_uint32_t EXPORT_VAR (grub_arch_busclock) __attribute__ ((section(".text")));
+
+#endif /* ! KERNEL_MACHINE_TIME_HEADER */