Make arch-specific linux.h include guards architecture unique
[grub.git] / include / grub / arm / linux.h
1 /* linux.h - ARM linux specific definitions */
2 /*
3  *  GRUB  --  GRand Unified Bootloader
4  *  Copyright (C) 2013  Free Software Foundation, Inc.
5  *
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.
10  *
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.
15  *
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/>.
18  */
19
20 #ifndef GRUB_ARM_LINUX_HEADER
21 #define GRUB_ARM_LINUX_HEADER 1
22
23 #define LINUX_ZIMAGE_OFFSET 0x24
24 #define LINUX_ZIMAGE_MAGIC  0x016f2818
25
26 #include "system.h"
27
28 #if defined GRUB_MACHINE_UBOOT
29 # include <grub/uboot/uboot.h>
30 # define LINUX_ADDRESS        (start_of_ram + 0x8000)
31 # define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000)
32 # define LINUX_FDT_ADDRESS    (LINUX_INITRD_ADDRESS - 0x10000)
33 # define grub_arm_firmware_get_boot_data grub_uboot_get_boot_data
34 # define grub_arm_firmware_get_machine_type grub_uboot_get_machine_type
35 #elif defined GRUB_MACHINE_EFI
36 # include <grub/efi/efi.h>
37 # include <grub/machine/loader.h>
38 /* On UEFI platforms - load the images at the lowest available address not
39    less than *_PHYS_OFFSET from the first available memory location. */
40 # define LINUX_PHYS_OFFSET        (0x00008000)
41 # define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
42 # define LINUX_FDT_PHYS_OFFSET    (LINUX_INITRD_PHYS_OFFSET - 0x10000)
43 # define grub_arm_firmware_get_boot_data (grub_addr_t)grub_efi_get_firmware_fdt
44 static inline grub_uint32_t
45 grub_arm_firmware_get_machine_type (void)
46 {
47   return GRUB_ARM_MACHINE_TYPE_FDT;
48 }
49 #elif defined (GRUB_MACHINE_COREBOOT)
50 #include <grub/fdtbus.h>
51 #include <grub/machine/kernel.h>
52 # define LINUX_ADDRESS        (start_of_ram + 0x8000)
53 # define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000)
54 # define LINUX_FDT_ADDRESS    (LINUX_INITRD_ADDRESS - 0x10000)
55 static inline const void *
56 grub_arm_firmware_get_boot_data (void)
57 {
58   return grub_fdtbus_get_fdt ();
59 }
60 static inline grub_uint32_t
61 grub_arm_firmware_get_machine_type (void)
62 {
63   return GRUB_ARM_MACHINE_TYPE_FDT;
64 }
65 #endif
66
67 #define FDT_ADDITIONAL_ENTRIES_SIZE     0x300
68
69 #endif /* ! GRUB_ARM_LINUX_HEADER */