1/***********************license start***************
2 * Copyright (c) 2003-2010  Cavium Networks (support@cavium.com). All rights
3 * reserved.
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 *   * Redistributions of source code must retain the above copyright
11 *     notice, this list of conditions and the following disclaimer.
12 *
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.
17
18 *   * Neither the name of Cavium Networks nor the names of
19 *     its contributors may be used to endorse or promote products
20 *     derived from this software without specific prior written
21 *     permission.
22
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
26 * countries.
27
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM  NETWORKS 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**************************************/
39
40
41
42/**
43 * @file
44 *
45 * Interface to Octeon boot structure
46 *
47 * <hr>$Revision:  $<hr>
48 */
49
50#ifndef __OCTEON_BOOT_INFO_H__
51#define __OCTEON_BOOT_INFO_H__
52
53#ifdef CVMX_BUILD_FOR_LINUX_KERNEL
54#include <linux/types.h>
55#endif
56
57#ifndef __ASSEMBLY__
58
59/*
60 * This structure is access by bootloader, Linux kernel and the Linux
61 * user space utility "bootoct".
62
63 * In the bootloader, this structure is accessed by assembly code in start.S,
64 * so any changes to content or size must be reflected there as well.
65
66 * This is placed at a fixed address in DRAM, so that cores can access it
67 * when they come out of reset.  It is used to setup the minimal bootloader
68 * runtime environment (stack, but no heap, global data ptr) that is needed
69 * by the non-boot cores to setup the environment for the applications.
70 * The boot_info_addr is the address of a boot_info_block_t structure
71 * which contains more core-specific information.
72 *
73 * The Linux kernel and the Linux bootoct utility access this structure for
74 * implementing CPU hotplug functionality and booting of idle cores with SE
75 * apps respectively.
76 *
77 */
78typedef struct
79{
80    /* First stage address - in ram instead of flash */
81    uint64_t code_addr;
82    /* Setup code for application, NOT application entry point */
83    uint32_t app_start_func_addr;
84    /* k0 is used for global data - needs to be passed to other cores */
85    uint32_t k0_val;
86    /* Address of boot info block structure */
87    uint64_t boot_info_addr;
88    uint32_t flags;         /* flags */
89    uint32_t pad;
90} boot_init_vector_t;
91
92/*
93 * Definition of a data structure setup by the bootloader to enable Linux to
94 * launch SE apps on idle cores.
95 */
96
97struct linux_app_boot_info
98{
99    uint32_t labi_signature;
100    uint32_t start_core0_addr;
101    uint32_t avail_coremask;
102    uint32_t pci_console_active;
103    uint32_t icache_prefetch_disable;
104    uint64_t InitTLBStart_addr;
105    uint32_t start_app_addr;
106    uint32_t cur_exception_base;
107    uint32_t no_mark_private_data;
108    uint32_t compact_flash_common_base_addr;
109    uint32_t compact_flash_attribute_base_addr;
110    uint32_t led_display_base_addr;
111#ifndef __OCTEON_NEWLIB__
112#if defined(__U_BOOT__) || !defined(__KERNEL__)
113    gd_t gd;
114#endif
115#endif
116};
117typedef struct linux_app_boot_info linux_app_boot_info_t;
118
119#endif
120
121/* If not to copy a lot of bootloader's structures
122   here is only offset of requested member */
123#define AVAIL_COREMASK_OFFSET_IN_LINUX_APP_BOOT_BLOCK    0x765c
124
125/* hardcoded in bootloader */
126#define LABI_ADDR_IN_BOOTLOADER                         0x700
127
128#define LINUX_APP_BOOT_BLOCK_NAME "linux-app-boot"
129
130#define LABI_SIGNATURE 0xAABBCC01
131
132/*  from uboot-headers/octeon_mem_map.h */
133#if defined(CVMX_BUILD_FOR_LINUX_KERNEL) || defined(__OCTEON_NEWLIB__)
134#define EXCEPTION_BASE_INCR     (4 * 1024)
135#endif
136
137#define OCTEON_NUM_CORES    16
138/* Increment size for exception base addresses (4k minimum) */
139#define EXCEPTION_BASE_BASE     0
140#define BOOTLOADER_PRIV_DATA_BASE        (EXCEPTION_BASE_BASE + 0x800)
141#define BOOTLOADER_BOOT_VECTOR           (BOOTLOADER_PRIV_DATA_BASE)
142#define BOOTLOADER_DEBUG_TRAMPOLINE      (BOOTLOADER_BOOT_VECTOR + BOOT_VECTOR_SIZE)   /* WORD */
143#define BOOTLOADER_DEBUG_TRAMPOLINE_CORE (BOOTLOADER_DEBUG_TRAMPOLINE + 4)   /* WORD */
144
145#define OCTEON_EXCEPTION_VECTOR_BLOCK_SIZE  (OCTEON_NUM_CORES*EXCEPTION_BASE_INCR) /* 16 4k blocks */
146#define BOOTLOADER_DEBUG_REG_SAVE_BASE  (EXCEPTION_BASE_BASE + OCTEON_EXCEPTION_VECTOR_BLOCK_SIZE)
147
148#define BOOT_VECTOR_NUM_WORDS           (8)
149#define BOOT_VECTOR_SIZE                ((OCTEON_NUM_CORES*4)*BOOT_VECTOR_NUM_WORDS)
150
151
152#endif /* __OCTEON_BOOT_INFO_H__ */
153