grub/include/grub/offsets.h

169 lines
6.5 KiB
C
Raw Permalink Normal View History

/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2007,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 OFFSETS_HEADER
#define OFFSETS_HEADER 1
/* The offset of GRUB_COMPRESSED_SIZE. */
#define GRUB_DECOMPRESSOR_I386_PC_COMPRESSED_SIZE 0x08
/* The offset of GRUB_COMPRESSED_SIZE. */
#define GRUB_DECOMPRESSOR_I386_PC_UNCOMPRESSED_SIZE 0x0c
2010-09-24 12:05:47 +00:00
/* Offset of reed_solomon_redundancy. */
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x10
/* Offset of field holding no reed solomon length. */
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH 0x14
#define GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE 0x18
#define GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE (0x9000-0x8200)
/* The segment where the kernel is loaded. */
#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x9000
#define GRUB_KERNEL_I386_XEN_PVH_LINK_ADDR 0x100000
2010-04-26 11:11:43 +00:00
/* The upper memory area (starting at 640 kiB). */
#define GRUB_MEMORY_I386_PC_UPPER 0xa0000
#define GRUB_MEMORY_I386_QEMU_UPPER GRUB_MEMORY_I386_PC_UPPER
/* The offset of GRUB_CORE_ENTRY_ADDR. */
#define GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR 0x4
/* The offset of GRUB_CORE_ENTRY_ADDR. */
#define GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR 0x8
#define GRUB_KERNEL_I386_QEMU_LINK_ADDR 0x9000
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
#define GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE 0x8
#define GRUB_KERNEL_ARM_STACK_SIZE 0x40000
#define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE 12
#define GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS 0x4400
#define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
#define GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR 0x80200000
#define GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN 32
#define GRUB_DECOMPRESSOR_MIPS_LOONGSON_COMPRESSED_SIZE 0x8
#define GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_SIZE 0xc
#define GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_ADDR 0x10
#define GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE 0x08
2011-05-17 12:02:18 +00:00
#define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ADDR 0x80200000
#define GRUB_KERNEL_MIPS_QEMU_MIPS_LINK_ALIGN 32
#define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_COMPRESSED_SIZE 0x8
#define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_SIZE 0xc
#define GRUB_DECOMPRESSOR_MIPS_QEMU_MIPS_UNCOMPRESSED_ADDR 0x10
2011-05-17 12:02:18 +00:00
#define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE 0x08
#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR 0x88200000
2013-04-25 20:42:35 +00:00
#define GRUB_KERNEL_MIPSEL_ARC_LINK_ADDR 0x80700000
2011-05-13 14:36:05 +00:00
#define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN 32
#define GRUB_DECOMPRESSOR_MIPS_ARC_COMPRESSED_SIZE 0x8
#define GRUB_DECOMPRESSOR_MIPS_ARC_UNCOMPRESSED_SIZE 0xc
#define GRUB_DECOMPRESSOR_MIPS_ARC_UNCOMPRESSED_ADDR 0x10
2011-05-13 14:36:05 +00:00
#define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE 0x08
#define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x9000
#define GRUB_KERNEL_I386_COREBOOT_MODULES_ADDR 0x100000
#define GRUB_KERNEL_I386_IEEE1275_LINK_ADDR 0x10000
#define GRUB_KERNEL_I386_IEEE1275_MOD_ALIGN 0x1000
#define GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN 0x1
2010-08-28 22:46:36 +00:00
#define GRUB_KERNEL_I386_MULTIBOOT_MOD_ALIGN GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN
#define GRUB_KERNEL_X86_64_XEN_MOD_ALIGN 0x8
#define GRUB_KERNEL_I386_XEN_MOD_ALIGN 0x8
#define GRUB_KERNEL_I386_XEN_PVH_MOD_ALIGN 0x8
/* Non-zero value is only needed for PowerMacs. */
#define GRUB_KERNEL_X86_64_XEN_MOD_GAP 0x0
#define GRUB_KERNEL_I386_XEN_MOD_GAP 0x0
#define GRUB_KERNEL_I386_XEN_PVH_MOD_GAP 0x0
#define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0
#define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0
#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_GAP 0x0
#define GRUB_KERNEL_ARM_UBOOT_MOD_GAP 0x0
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
#define GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN 3
#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN (1 << GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN)
#define GRUB_KERNEL_MIPS_LOONGSON_MOD_ALIGN 0x1
2011-05-13 14:36:05 +00:00
#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
2011-05-17 12:02:18 +00:00
#define GRUB_KERNEL_MIPS_QEMU_MIPS_MOD_ALIGN 0x1
2010-04-26 19:11:16 +00:00
2013-04-07 00:41:07 +00:00
#define GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN 0x8
#define GRUB_KERNEL_ARM_UBOOT_TOTAL_MODULE_SIZE 0x4
2017-05-08 18:53:28 +00:00
#define GRUB_KERNEL_ARM_COREBOOT_MOD_ALIGN 0x8
#define GRUB_KERNEL_ARM_COREBOOT_TOTAL_MODULE_SIZE 0x4
#define GRUB_KERNEL_ARM_STACK_SIZE 0x40000
#define GRUB_KERNEL_ARM_COREBOOT_MOD_GAP (GRUB_KERNEL_ARM_STACK_SIZE + 1024)
/* Minimal gap between _end and the start of the modules. It's a hack
for PowerMac to prevent "CLAIM failed" error. The real fix is to
rewrite grub-mkimage to generate valid ELF files. */
2011-07-05 13:10:47 +00:00
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_GAP 0x8000
#ifdef GRUB_MACHINE
#define GRUB_OFFSETS_CONCAT_(a,b,c) a ## b ## c
#define GRUB_OFFSETS_CONCAT(a,b,c) GRUB_OFFSETS_CONCAT_(a,b,c)
#define GRUB_KERNEL_MACHINE_MOD_ALIGN GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_ALIGN)
#define GRUB_KERNEL_MACHINE_MOD_GAP GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_GAP)
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _TOTAL_MODULE_SIZE)
#define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, GRUB_MACHINE, _KERNEL_SEG)
#define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, GRUB_MACHINE, _UPPER)
2013-04-25 20:42:35 +00:00
#if defined (GRUB_MACHINE_ARC) && defined (GRUB_CPU_MIPSEL)
#define GRUB_MACHINE_LINK_ADDR GRUB_KERNEL_MIPSEL_ARC_LINK_ADDR
#else
SGI ARCS port. * Makefile.util.def (libgrubmods.a): Add dvh.c. * conf/Makefile.common (CCASFLAGS_PLATFORM): Add -mips3 on all mips platforms. * configure.ac: New target mips-arc. * gentpl.py: Likewise. * grub-core/Makefile.am: Likewise. * grub-core/Makefile.core.def: Likewise. (xz_decompress): Remove -D GRUB_MACHINE_LINK_ADDR. (none_decompress): Likewise. (lsdev): New module. (datetime): Use lib/arc/datetime.c on ARC. (part_dvh): New module. * grub-core/commands/arc/lsdev.c: New file. * grub-core/disk/arc/arcdisk.c: Likewise. * grub-core/kern/mips/arc/init.c: Likewise. * grub-core/kern/mips/cache_flush.S: Don't flush non 4-byte aligned addresses. * grub-core/kern/mips/dl.c (grub_arch_dl_check_header): Fix bigendian support. (grub_arch_dl_relocate_symbols): Likewise. * grub-core/kern/mips/loongson/init.c (grub_get_rtc): Moved from here... * grub-core/kern/mips/init.c (grub_get_rtc): ... here. * grub-core/kern/mips/startup.S (grub_arch_cpuclock): Have on all platforms. * grub-core/lib/arc/datetime.c: New file. * grub-core/loader/mips/linux.c: Always include time.h. Don't include pci.h on non-loongson. (envp_off) [!GRUB_MACHINE_MIPS_LOONGSON]: Remove. (grub_linux_boot): Set unused registers to 0. (grub_cmd_linux) [!GRUB_MACHINE_MIPS_LOONGSON]: Remove envp. * grub-core/mmap/mips/loongson/uppermem.c: Moved from here ... * grub-core/mmap/mips/uppermem.c: ...here. * grub-core/partmap/dvh.c: New file. * grub-core/term/arc/console.c: Likewise. * grub-core/term/terminfo.c (ANSI_C0_STR): New const. (grub_terminfo_set_current): Add terminal "arc". (grub_terminfo_readkey): Support ARC sequences. * include/grub/arc/arc.h: New file. * include/grub/arc/console.h: Likewise. * include/grub/disk.h (grub_disk_dev_id): Add GRUB_DISK_DEVICE_ARCDISK_ID. * include/grub/mips/arc/kernel.h: New file. * include/grub/mips/arc/memory.h: Likewise. * include/grub/mips/arc/time.h: Likewise. * include/grub/mips/loongson/kernel.h (grub_halt): Moved from here ... * include/grub/mips/kernel.h (grub_halt): ... here. * include/grub/mips/loongson.h (GRUB_CPU_REGISTER_WRAP): Moved from here... * include/grub/mips/mips.h (GRUB_CPU_REGISTER_WRAP): ... here. (GRUB_CPU_LOONGSON_COP0_TIMER_COUNT): Moved from here ... * include/grub/mips/mips.h (GRUB_CPU_LOONGSON_COP0_TIMER_COUNT): .. here * include/grub/mips/loongson/kernel.h (grub_reboot): Removed redundant proto. * include/grub/mips/loongson/memory.h (GRUB_ARCH_LOWMEMVSTART): Moved from here ... * include/grub/mips/memory.h (GRUB_ARCH_LOWMEMVSTART): ... here. (GRUB_ARCH_LOWMEMPSTART): Moved from here ... * include/grub/mips/memory.h (GRUB_ARCH_LOWMEMPSTART): ... here. (GRUB_ARCH_LOWMEMMAXSIZE): Moved from here ... * include/grub/mips/memory.h (GRUB_ARCH_LOWMEMMAXSIZE): ... here. (GRUB_ARCH_HIGHMEMPSTART): Moved from here ... * include/grub/mips/memory.h (GRUB_ARCH_HIGHMEMPSTART): ... here. (grub_phys_addr_t): Moved from here ... * include/grub/mips/memory.h (grub_phys_addr_t): ... here. (grub_vtop): Moved from here ... * include/grub/mips/memory.h (grub_vtop): ... here. (grub_map_memory): Moved from here ... * include/grub/mips/memory.h (grub_map_memory): ... here. (grub_unmap_memory): Moved from here ... * include/grub/mips/memory.h (grub_unmap_memory): ... here. (grub_machine_mmap_iterate): Moved from here ... * include/grub/mips/memory.h (grub_machine_mmap_iterate): ... here. (grub_mmap_get_lower): Moved from here ... * include/grub/mips/memory.h (grub_mmap_get_lower): ... here. (grub_mmap_get_upper): Moved from here ... * include/grub/mips/memory.h (grub_mmap_get_upper): ... here. * include/grub/mips/loongson/time.h (grub_arch_cpuclock): Moved from here ... * include/grub/mips/time.h (grub_arch_cpuclock): ... here. * include/grub/mips/loongson/time.h (grub_get_rtc): Moved from here ... * include/grub/mips/time.h (grub_get_rtc): ... here. * include/grub/mips/loongson/time.h (grub_arch_cpuclock): Moved from here ... * include/grub/mips/time.h (grub_arch_cpuclock): ... here. * include/grub/mips/loongson/time.h (grub_cpu_idle): Moved from here ... * include/grub/mips/time.h (grub_cpu_idle): ... here. * include/grub/offsets.h (GRUB_KERNEL_MIPS_ARC_LINK_ADDR): New definition. (GRUB_KERNEL_MIPS_ARC_LINK_ALIGN): Likewise. (GRUB_KERNEL_MIPS_ARC_COMPRESSED_SIZE): Likewise. (GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_SIZE): Likewise. (GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE): Likewise. (GRUB_KERNEL_MIPS_ARC_PREFIX): Likewise. (GRUB_KERNEL_MIPS_ARC_PREFIX_END): Likewise. (GRUB_KERNEL_MIPS_ARC_MOD_ALIGN): Likewise. (GRUB_MACHINE_LINK_ADDR): Likewise. * include/grub/terminfo.h (GRUB_TERMINFO_READKEY_MAX_LEN): Increased to 6. * util/grub-install.in: Run dvhtool on ARC. * util/grub-mkimage.c (image_targets): Add mips-arc.
2011-05-17 07:17:38 +00:00
#define GRUB_MACHINE_LINK_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _LINK_ADDR)
2013-04-25 20:42:35 +00:00
#endif
#define GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _COMPRESSED_SIZE)
#define GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
#define GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _UNCOMPRESSED_ADDR)
#endif
#ifndef ASM_FILE
struct grub_pc_bios_boot_blocklist
{
grub_uint64_t start;
grub_uint16_t len;
grub_uint16_t segment;
} GRUB_PACKED;
#endif
#endif