diff options
Diffstat (limited to 'include/grub/arm')
-rw-r--r-- | include/grub/arm/coreboot/console.h | 29 | ||||
-rw-r--r-- | include/grub/arm/coreboot/kernel.h | 44 | ||||
-rw-r--r-- | include/grub/arm/cros_ec.h | 21 | ||||
-rw-r--r-- | include/grub/arm/efi/memory.h | 6 | ||||
-rw-r--r-- | include/grub/arm/linux.h | 67 | ||||
-rw-r--r-- | include/grub/arm/reloc.h | 51 | ||||
-rw-r--r-- | include/grub/arm/setjmp.h | 27 | ||||
-rw-r--r-- | include/grub/arm/startup.h | 16 | ||||
-rw-r--r-- | include/grub/arm/system.h | 19 | ||||
-rw-r--r-- | include/grub/arm/time.h | 29 | ||||
-rw-r--r-- | include/grub/arm/types.h | 34 | ||||
-rw-r--r-- | include/grub/arm/uboot/kernel.h | 32 |
12 files changed, 375 insertions, 0 deletions
diff --git a/include/grub/arm/coreboot/console.h b/include/grub/arm/coreboot/console.h new file mode 100644 index 0000000..13a14b7 --- /dev/null +++ b/include/grub/arm/coreboot/console.h @@ -0,0 +1,29 @@ +/* + * 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_CONSOLE_HEADER +#define GRUB_MACHINE_CONSOLE_HEADER 1 + +void grub_video_coreboot_fb_init (void); +void grub_video_coreboot_fb_early_init (void); +void grub_video_coreboot_fb_late_init (void); +void grub_video_coreboot_fb_fini (void); + +extern struct grub_linuxbios_table_framebuffer *grub_video_coreboot_fbtable; + +#endif /* ! GRUB_MACHINE_CONSOLE_HEADER */ diff --git a/include/grub/arm/coreboot/kernel.h b/include/grub/arm/coreboot/kernel.h new file mode 100644 index 0000000..2695053 --- /dev/null +++ b/include/grub/arm/coreboot/kernel.h @@ -0,0 +1,44 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 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 + +#ifndef ASM_FILE + +#include <grub/symbol.h> +#include <grub/types.h> + +struct grub_fdt_board +{ + const char *vendor, *part; + const grub_uint8_t *dtb; + grub_size_t dtb_size; +}; + +extern struct grub_fdt_board grub_fdt_boards[]; +void grub_machine_timer_init (void); +void grub_pl050_init (void); +void grub_cros_init (void); +void grub_rk3288_spi_init (void); +extern grub_addr_t EXPORT_VAR (start_of_ram); +#endif /* ! ASM_FILE */ + +#define GRUB_KERNEL_MACHINE_STACK_SIZE GRUB_KERNEL_ARM_STACK_SIZE + +#endif /* ! GRUB_KERNEL_MACHINE_HEADER */ diff --git a/include/grub/arm/cros_ec.h b/include/grub/arm/cros_ec.h new file mode 100644 index 0000000..45a3725 --- /dev/null +++ b/include/grub/arm/cros_ec.h @@ -0,0 +1,21 @@ +#ifndef GRUB_ARM_CROS_EC_H +#define GRUB_ARM_CROS_EC_H 1 + +#include <grub/types.h> +#include <grub/fdtbus.h> + +#define GRUB_CROS_EC_KEYSCAN_COLS 13 +#define GRUB_CROS_EC_KEYSCAN_ROWS 8 + +struct grub_cros_ec_keyscan { + grub_uint8_t data[GRUB_CROS_EC_KEYSCAN_COLS]; +}; + +int +grub_cros_ec_scan_keyboard (const struct grub_fdtbus_dev *dev, + struct grub_cros_ec_keyscan *scan); + +int +grub_cros_ec_validate (const struct grub_fdtbus_dev *dev); + +#endif diff --git a/include/grub/arm/efi/memory.h b/include/grub/arm/efi/memory.h new file mode 100644 index 0000000..2c64918 --- /dev/null +++ b/include/grub/arm/efi/memory.h @@ -0,0 +1,6 @@ +#ifndef GRUB_MEMORY_CPU_HEADER +#include <grub/efi/memory.h> + +#define GRUB_EFI_MAX_USABLE_ADDRESS 0xffffffff + +#endif /* ! GRUB_MEMORY_CPU_HEADER */ diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h new file mode 100644 index 0000000..bcd5a7e --- /dev/null +++ b/include/grub/arm/linux.h @@ -0,0 +1,67 @@ +/* linux.h - ARM linux specific definitions */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 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_ARM_LINUX_HEADER +#define GRUB_ARM_LINUX_HEADER 1 + +#include "system.h" + +#define GRUB_LINUX_ARM_MAGIC_SIGNATURE 0x016f2818 + +struct linux_arm_kernel_header { + grub_uint32_t code0; + grub_uint32_t reserved1[8]; + grub_uint32_t magic; + grub_uint32_t start; /* _start */ + grub_uint32_t end; /* _edata */ + grub_uint32_t reserved2[3]; + grub_uint32_t hdr_offset; +}; + +#if defined(__arm__) +# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE +# define linux_arch_kernel_header linux_arm_kernel_header +#endif + +#if defined GRUB_MACHINE_UBOOT +# include <grub/uboot/uboot.h> +# define LINUX_ADDRESS (start_of_ram + 0x8000) +# define LINUX_INITRD_ADDRESS (start_of_ram + 0x03000000) +# define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000) +# define grub_arm_firmware_get_boot_data grub_uboot_get_boot_data +# define grub_arm_firmware_get_machine_type grub_uboot_get_machine_type +#elif defined (GRUB_MACHINE_COREBOOT) +#include <grub/fdtbus.h> +#include <grub/arm/coreboot/kernel.h> +# define LINUX_ADDRESS (start_of_ram + 0x8000) +# define LINUX_INITRD_ADDRESS (start_of_ram + 0x03000000) +# define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000) +static inline const void * +grub_arm_firmware_get_boot_data (void) +{ + return grub_fdtbus_get_fdt (); +} +static inline grub_uint32_t +grub_arm_firmware_get_machine_type (void) +{ + return GRUB_ARM_MACHINE_TYPE_FDT; +} +#endif + +#endif /* ! GRUB_ARM_LINUX_HEADER */ diff --git a/include/grub/arm/reloc.h b/include/grub/arm/reloc.h new file mode 100644 index 0000000..ae92e21 --- /dev/null +++ b/include/grub/arm/reloc.h @@ -0,0 +1,51 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 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_ARM_RELOC_H +#define GRUB_ARM_RELOC_H 1 + +grub_err_t grub_arm_reloc_abs32 (grub_uint32_t *addr, Elf32_Addr sym_addr); + +int +grub_arm_thm_call_check_offset (grub_int32_t offset, int is_thumb); +grub_int32_t +grub_arm_thm_call_get_offset (grub_uint16_t *target); +grub_err_t +grub_arm_thm_call_set_offset (grub_uint16_t *target, grub_int32_t offset); + +grub_int32_t +grub_arm_thm_jump19_get_offset (grub_uint16_t *target); +void +grub_arm_thm_jump19_set_offset (grub_uint16_t *target, grub_int32_t offset); +int +grub_arm_thm_jump19_check_offset (grub_int32_t offset); + +grub_int32_t +grub_arm_jump24_get_offset (grub_uint32_t *target); +int +grub_arm_jump24_check_offset (grub_int32_t offset); +void +grub_arm_jump24_set_offset (grub_uint32_t *target, + grub_int32_t offset); + +grub_uint16_t +grub_arm_thm_movw_movt_get_value (grub_uint16_t *target); +void +grub_arm_thm_movw_movt_set_value (grub_uint16_t *target, grub_uint16_t value); + +#endif diff --git a/include/grub/arm/setjmp.h b/include/grub/arm/setjmp.h new file mode 100644 index 0000000..7990f2e --- /dev/null +++ b/include/grub/arm/setjmp.h @@ -0,0 +1,27 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002,2004,2006,2007,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_SETJMP_CPU_HEADER +#define GRUB_SETJMP_CPU_HEADER 1 + +typedef unsigned long grub_jmp_buf[10]; + +int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE; +void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); + +#endif /* ! GRUB_SETJMP_CPU_HEADER */ diff --git a/include/grub/arm/startup.h b/include/grub/arm/startup.h new file mode 100644 index 0000000..9afb6c5 --- /dev/null +++ b/include/grub/arm/startup.h @@ -0,0 +1,16 @@ +#ifndef GRUB_STARTUP_CPU_HEADER +#define GRUB_STARTUP_CPU_HEADER + +struct grub_arm_startup_registers +{ + /* registers 0-11 */ + /* for U-boot r[1] is machine type */ + /* for U-boot r[2] is boot data */ + grub_uint32_t r[12]; + grub_uint32_t sp; + grub_uint32_t lr; +}; + +extern struct grub_arm_startup_registers grub_arm_saved_registers; + +#endif diff --git a/include/grub/arm/system.h b/include/grub/arm/system.h new file mode 100644 index 0000000..f15ce97 --- /dev/null +++ b/include/grub/arm/system.h @@ -0,0 +1,19 @@ +#ifndef GRUB_SYSTEM_CPU_HEADER +#define GRUB_SYSTEM_CPU_HEADER + +#include <grub/symbol.h> +#include <grub/types.h> + +enum + { + GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI = 3138, + GRUB_ARM_MACHINE_TYPE_FDT = 0xFFFFFFFF + }; + +void EXPORT_FUNC(grub_arm_disable_caches_mmu) (void); +void grub_arm_enable_caches_mmu (void); +void grub_arm_enable_mmu (grub_uint32_t *mmu_tables); +void grub_arm_clear_mmu_v6 (void); + +#endif /* ! GRUB_SYSTEM_CPU_HEADER */ + diff --git a/include/grub/arm/time.h b/include/grub/arm/time.h new file mode 100644 index 0000000..c5a6852 --- /dev/null +++ b/include/grub/arm/time.h @@ -0,0 +1,29 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 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_CPU_TIME_HEADER +#define KERNEL_CPU_TIME_HEADER 1 + +static __inline void +grub_cpu_idle (void) +{ + /* FIXME: this can't work until we handle interrupts. */ +/* asm volatile ("wfi"); */ +} + +#endif /* ! KERNEL_CPU_TIME_HEADER */ diff --git a/include/grub/arm/types.h b/include/grub/arm/types.h new file mode 100644 index 0000000..4a806d0 --- /dev/null +++ b/include/grub/arm/types.h @@ -0,0 +1,34 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 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_TYPES_CPU_HEADER +#define GRUB_TYPES_CPU_HEADER 1 + +/* The size of void *. */ +#define GRUB_TARGET_SIZEOF_VOID_P 4 + +/* The size of long. */ +#define GRUB_TARGET_SIZEOF_LONG 4 + +/* currently only support little-endian. */ +#undef GRUB_TARGET_WORDS_BIGENDIAN + +/* Unaligned accesses only supported if MMU enabled */ +//#define GRUB_HAVE_UNALIGNED_ACCESS 1 + +#endif /* ! GRUB_TYPES_CPU_HEADER */ diff --git a/include/grub/arm/uboot/kernel.h b/include/grub/arm/uboot/kernel.h new file mode 100644 index 0000000..ce0b149 --- /dev/null +++ b/include/grub/arm/uboot/kernel.h @@ -0,0 +1,32 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 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 + +#ifndef ASM_FILE + +#include <grub/symbol.h> +#include <grub/types.h> + +#endif /* ! ASM_FILE */ + +#define GRUB_KERNEL_MACHINE_STACK_SIZE GRUB_KERNEL_ARM_STACK_SIZE +#define GRUB_KERNEL_MACHINE_HEAP_SIZE (grub_size_t) (16 * 1024 * 1024) + +#endif /* ! GRUB_KERNEL_MACHINE_HEADER */ |