summaryrefslogtreecommitdiffstats
path: root/include/grub/mips/loongson
diff options
context:
space:
mode:
Diffstat (limited to 'include/grub/mips/loongson')
-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
8 files changed, 359 insertions, 0 deletions
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 */