1 /* linux.h - ARM linux specific definitions */
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2013 Free Software Foundation, Inc.
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef GRUB_ARM_LINUX_HEADER
21 #define GRUB_ARM_LINUX_HEADER 1
25 #define GRUB_LINUX_ARM_MAGIC_SIGNATURE 0x016f2818
27 struct linux_arm_kernel_header {
29 grub_uint32_t reserved1[8];
31 grub_uint32_t start; /* _start */
32 grub_uint32_t end; /* _edata */
33 grub_uint32_t reserved2[4];
34 grub_uint32_t hdr_offset;
37 #if defined GRUB_MACHINE_UBOOT
38 # include <grub/uboot/uboot.h>
39 # define LINUX_ADDRESS (start_of_ram + 0x8000)
40 # define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000)
41 # define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000)
42 # define grub_arm_firmware_get_boot_data grub_uboot_get_boot_data
43 # define grub_arm_firmware_get_machine_type grub_uboot_get_machine_type
44 #elif defined GRUB_MACHINE_EFI
45 # include <grub/efi/efi.h>
46 # include <grub/arm/efi/loader.h>
47 /* On UEFI platforms - load the images at the lowest available address not
48 less than *_PHYS_OFFSET from the first available memory location. */
49 # define LINUX_PHYS_OFFSET (0x00008000)
50 # define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
51 # define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000)
52 # define grub_arm_firmware_get_boot_data (grub_addr_t)grub_efi_get_firmware_fdt
53 static inline grub_uint32_t
54 grub_arm_firmware_get_machine_type (void)
56 return GRUB_ARM_MACHINE_TYPE_FDT;
58 #elif defined (GRUB_MACHINE_COREBOOT)
59 #include <grub/fdtbus.h>
60 #include <grub/arm/coreboot/kernel.h>
61 # define LINUX_ADDRESS (start_of_ram + 0x8000)
62 # define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000)
63 # define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000)
64 static inline const void *
65 grub_arm_firmware_get_boot_data (void)
67 return grub_fdtbus_get_fdt ();
69 static inline grub_uint32_t
70 grub_arm_firmware_get_machine_type (void)
72 return GRUB_ARM_MACHINE_TYPE_FDT;
76 #define FDT_ADDITIONAL_ENTRIES_SIZE 0x300
78 #endif /* ! GRUB_ARM_LINUX_HEADER */