1 /* 2 * (C) Copyright 2007-2011 3 * Allwinner Technology Co., Ltd. <www.allwinnertech.com> 4 * Tom Cubie <tangliang@allwinnertech.com> 5 * 6 * SPDX-License-Identifier: GPL-2.0+ 7 */ 8 #ifndef _ASM_ARCH_SPL_H_ 9 #define _ASM_ARCH_SPL_H_ 10 11 #define BOOT0_MAGIC "eGON.BT0" 12 #define SPL_SIGNATURE "SPL" /* marks "sunxi" SPL header */ 13 #define SPL_HEADER_VERSION 1 14 15 #if defined(CONFIG_MACH_SUN9I) || defined(CONFIG_MACH_SUN50I) 16 #define SPL_ADDR 0x10000 17 #else 18 #define SPL_ADDR 0x0 19 #endif 20 21 /* boot head definition from sun4i boot code */ 22 struct boot_file_head { 23 uint32_t b_instruction; /* one intruction jumping to real code */ 24 uint8_t magic[8]; /* ="eGON.BT0" or "eGON.BT1", not C-style str */ 25 uint32_t check_sum; /* generated by PC */ 26 uint32_t length; /* generated by PC */ 27 /* 28 * We use a simplified header, only filling in what is needed 29 * by the boot ROM. To be compatible with Allwinner tools we 30 * would need to implement the proper fields here instead of 31 * padding. 32 * 33 * Actually we want the ability to recognize our "sunxi" variant 34 * of the SPL. To do so, let's place a special signature into the 35 * "pub_head_size" field. We can reasonably expect Allwinner's 36 * boot0 to always have the upper 16 bits of this set to 0 (after 37 * all the value shouldn't be larger than the limit imposed by 38 * SRAM size). 39 * If the signature is present (at 0x14), then we know it's safe 40 * to use the remaining 8 bytes (at 0x18) for our own purposes. 41 * (E.g. sunxi-tools "fel" utility can pass information there.) 42 */ 43 union { 44 uint32_t pub_head_size; 45 uint8_t spl_signature[4]; 46 }; 47 uint32_t fel_script_address; 48 uint32_t reserved; /* padding, align to 32 bytes */ 49 }; 50 51 #define is_boot0_magic(addr) (memcmp((void *)addr, BOOT0_MAGIC, 8) == 0) 52 53 #endif 54