1 /***********************license start***************
2 * Copyright (c) 2003-2011 Cavium Inc. (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * * Neither the name of Cavium Inc. nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
45 * Interface to Octeon boot structure
47 * <hr>$Revision: $<hr>
50 #ifndef __OCTEON_BOOT_INFO_H__
51 #define __OCTEON_BOOT_INFO_H__
53 #ifdef CVMX_BUILD_FOR_LINUX_KERNEL
54 #include <linux/types.h>
55 #include <asm/octeon/cvmx-asm.h>
63 * This structure is access by bootloader, Linux kernel and the Linux
64 * user space utility "bootoct".
66 * In the bootloader, this structure is accessed by assembly code in start.S,
67 * so any changes to content or size must be reflected there as well.
69 * This is placed at a fixed address in DRAM, so that cores can access it
70 * when they come out of reset. It is used to setup the minimal bootloader
71 * runtime environment (stack, but no heap, global data ptr) that is needed
72 * by the non-boot cores to setup the environment for the applications.
73 * The boot_info_addr is the address of a boot_info_block_t structure
74 * which contains more core-specific information.
76 * The Linux kernel and the Linux bootoct utility access this structure for
77 * implementing CPU hotplug functionality and booting of idle cores with SE
83 /* First stage address - in ram instead of flash */
85 /* Setup code for application, NOT application entry point */
86 uint32_t app_start_func_addr;
87 /* k0 is used for global data - needs to be passed to other cores */
89 /* Address of boot info block structure */
90 uint64_t boot_info_addr;
91 uint32_t flags; /* flags */
95 #if defined(__ASM_GBL_DATA_H) /* defined above */
97 * Definition of a data structure to mimic the old u-boot gd_t data structure.
99 #undef GD_TMP_STR_SIZE
100 #define GD_TMP_STR_SIZE 32
102 #define LINUX_APP_GLOBAL_DATA_MAGIC 0x221eb111476f410full
103 #define LINUX_APP_GLOBAL_DATA_VERSION 2
105 struct linux_app_global_data {
108 unsigned long baudrate;
109 unsigned long have_console; /* serial_init() was called */
110 uint64_t ram_size; /* RAM size */
111 uint64_t reloc_off; /* Relocation Offset */
112 unsigned long env_addr; /* Address of Environment struct */
113 unsigned long env_valid; /* Checksum of Environment valid? */
114 unsigned long cpu_clock_mhz; /* CPU clock speed in MHz */
115 unsigned long ddr_clock_mhz; /* DDR clock (not data rate!) in MHz */
116 unsigned long ddr_ref_hertz; /* DDR Ref clock Hertz */
121 /* EEPROM data structures as read from EEPROM or populated by other
122 * means on boards without an EEPROM
124 octeon_eeprom_board_desc_t board_desc;
125 octeon_eeprom_clock_desc_t clock_desc;
126 octeon_eeprom_mac_addr_t mac_desc;
128 void **jt; /* jump table, not used */
129 char *err_msg; /* pointer to error message to save
130 * until console is up. Not used.
133 struct { /* Keep under 32 bytes! */
138 char tmp_str[GD_TMP_STR_SIZE];
140 unsigned long uboot_flash_address; /* Address of normal bootloader
143 unsigned long uboot_flash_size; /* Size of normal bootloader */
144 uint64_t dfm_ram_size; /* DFM RAM size */
146 typedef struct linux_app_global_data linux_app_global_data_t;
148 /* Flags for linux_app_global_data */
149 #define LA_GD_FLG_RELOC 0x0001 /* Code was relocated to RAM */
150 #define LA_GD_FLG_DEVINIT 0x0002 /* Devices have been initialized */
151 #define LA_GD_FLG_SILENT 0x0004 /* Silent mode */
152 #define LA_GD_FLG_CLOCK_DESC_MISSING 0x0008
153 #define LA_GD_FLG_BOARD_DESC_MISSING 0x0010
154 #define LA_GD_FLG_DDR_VERBOSE 0x0020
155 #define LA_GD_FLG_DDR0_CLK_INITIALIZED 0x0040
156 #define LA_GD_FLG_DDR1_CLK_INITIALIZED 0x0080
157 #define LA_GD_FLG_DDR2_CLK_INITIALIZED 0x0100
158 #define LA_GD_FLG_DDR3_CLK_INITIALIZED 0x0200
159 #define LA_GD_FLG_FAILSAFE_MODE 0x0400 /* Use failsafe mode */
160 #define LA_GD_FLG_DDR_TRACE_INIT 0x0800
161 #define LA_GD_FLG_DFM_CLK_INITIALIZED 0x1000
162 #define LA_GD_FLG_DFM_VERBOSE 0x2000
163 #define LA_GD_FLG_DFM_TRACE_INIT 0x4000
164 #define LA_GD_FLG_MEMORY_PRESERVED 0x8000
165 #define LA_GD_FLG_RAM_RESIDENT 0x10000 /* RAM boot detected */
166 #endif /* __ASM_GBL_DATA_H */
169 * Definition of a data structure setup by the bootloader to enable Linux to
170 * launch SE apps on idle cores.
173 struct linux_app_boot_info
175 uint32_t labi_signature;
176 uint32_t start_core0_addr;
177 uint32_t avail_coremask;
178 uint32_t pci_console_active;
179 uint32_t icache_prefetch_disable;
180 uint64_t InitTLBStart_addr;
181 uint32_t start_app_addr;
182 uint32_t cur_exception_base;
183 uint32_t no_mark_private_data;
184 uint32_t compact_flash_common_base_addr;
185 uint32_t compact_flash_attribute_base_addr;
186 uint32_t led_display_base_addr;
187 #if defined(__ASM_GBL_DATA_H) /* defined above */
188 linux_app_global_data_t gd;
191 typedef struct linux_app_boot_info linux_app_boot_info_t;
195 /* If not to copy a lot of bootloader's structures
196 here is only offset of requested member */
197 #define AVAIL_COREMASK_OFFSET_IN_LINUX_APP_BOOT_BLOCK 0x765c
199 /* hardcoded in bootloader */
200 #define LABI_ADDR_IN_BOOTLOADER 0x700
202 #define LINUX_APP_BOOT_BLOCK_NAME "linux-app-boot"
204 #define LABI_SIGNATURE 0xAABBCC01
206 /* from uboot-headers/octeon_mem_map.h */
207 #if defined(CVMX_BUILD_FOR_LINUX_KERNEL) || defined(CVMX_BUILD_FOR_TOOLCHAIN)
208 #define EXCEPTION_BASE_INCR (4 * 1024)
211 /* Increment size for exception base addresses (4k minimum) */
212 #define EXCEPTION_BASE_BASE 0
213 #define BOOTLOADER_PRIV_DATA_BASE (EXCEPTION_BASE_BASE + 0x800)
214 #define BOOTLOADER_BOOT_VECTOR (BOOTLOADER_PRIV_DATA_BASE)
215 #define BOOTLOADER_DEBUG_TRAMPOLINE (BOOTLOADER_BOOT_VECTOR + BOOT_VECTOR_SIZE) /* WORD */
216 #define BOOTLOADER_DEBUG_TRAMPOLINE_CORE (BOOTLOADER_DEBUG_TRAMPOLINE + 4) /* WORD */
218 #define OCTEON_EXCEPTION_VECTOR_BLOCK_SIZE (CVMX_MAX_CORES*EXCEPTION_BASE_INCR) /* 32 4k blocks */
219 #define BOOTLOADER_DEBUG_REG_SAVE_BASE (EXCEPTION_BASE_BASE + OCTEON_EXCEPTION_VECTOR_BLOCK_SIZE)
221 #define BOOT_VECTOR_NUM_WORDS (8)
222 #define BOOT_VECTOR_SIZE ((CVMX_MAX_CORES*4)*BOOT_VECTOR_NUM_WORDS)
225 #endif /* __OCTEON_BOOT_INFO_H__ */