xref: /OK3568_Linux_fs/kernel/arch/mips/include/asm/octeon/cvmx-sysinfo.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /***********************license start***************
2*4882a593Smuzhiyun  * Author: Cavium Networks
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Contact: support@caviumnetworks.com
5*4882a593Smuzhiyun  * This file is part of the OCTEON SDK
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Copyright (c) 2003-2016 Cavium, Inc.
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * This file is free software; you can redistribute it and/or modify
10*4882a593Smuzhiyun  * it under the terms of the GNU General Public License, Version 2, as
11*4882a593Smuzhiyun  * published by the Free Software Foundation.
12*4882a593Smuzhiyun  *
13*4882a593Smuzhiyun  * This file is distributed in the hope that it will be useful, but
14*4882a593Smuzhiyun  * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15*4882a593Smuzhiyun  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16*4882a593Smuzhiyun  * NONINFRINGEMENT.  See the GNU General Public License for more
17*4882a593Smuzhiyun  * details.
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  * You should have received a copy of the GNU General Public License
20*4882a593Smuzhiyun  * along with this file; if not, write to the Free Software
21*4882a593Smuzhiyun  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22*4882a593Smuzhiyun  * or visit http://www.gnu.org/licenses/.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * This file may also be available under a different license from Cavium.
25*4882a593Smuzhiyun  * Contact Cavium Networks for more information
26*4882a593Smuzhiyun  ***********************license end**************************************/
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun /*
29*4882a593Smuzhiyun  * This module provides system/board information obtained by the bootloader.
30*4882a593Smuzhiyun  */
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #ifndef __CVMX_SYSINFO_H__
33*4882a593Smuzhiyun #define __CVMX_SYSINFO_H__
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #include "cvmx-coremask.h"
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #define OCTEON_SERIAL_LEN 20
38*4882a593Smuzhiyun /**
39*4882a593Smuzhiyun  * Structure describing application specific information.
40*4882a593Smuzhiyun  * __cvmx_app_init() populates this from the cvmx boot descriptor.
41*4882a593Smuzhiyun  * This structure is private to simple executive applications, so
42*4882a593Smuzhiyun  * no versioning is required.
43*4882a593Smuzhiyun  *
44*4882a593Smuzhiyun  * This structure must be provided with some fields set in order to
45*4882a593Smuzhiyun  * use simple executive functions in other applications (Linux kernel,
46*4882a593Smuzhiyun  * u-boot, etc.)  The cvmx_sysinfo_minimal_initialize() function is
47*4882a593Smuzhiyun  * provided to set the required values in these cases.
48*4882a593Smuzhiyun  */
49*4882a593Smuzhiyun struct cvmx_sysinfo {
50*4882a593Smuzhiyun 	/* System wide variables */
51*4882a593Smuzhiyun 	/* installed DRAM in system, in bytes */
52*4882a593Smuzhiyun 	uint64_t system_dram_size;
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun 	/* ptr to memory descriptor block */
55*4882a593Smuzhiyun 	uint64_t phy_mem_desc_addr;
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun 	/* Application image specific variables */
58*4882a593Smuzhiyun 	/* stack top address (virtual) */
59*4882a593Smuzhiyun 	uint64_t stack_top;
60*4882a593Smuzhiyun 	/* heap base address (virtual) */
61*4882a593Smuzhiyun 	uint64_t heap_base;
62*4882a593Smuzhiyun 	/* stack size in bytes */
63*4882a593Smuzhiyun 	uint32_t stack_size;
64*4882a593Smuzhiyun 	/* heap size in bytes */
65*4882a593Smuzhiyun 	uint32_t heap_size;
66*4882a593Smuzhiyun 	/* coremask defining cores running application */
67*4882a593Smuzhiyun 	struct cvmx_coremask core_mask;
68*4882a593Smuzhiyun 	/* Deprecated, use cvmx_coremask_first_core() to select init core */
69*4882a593Smuzhiyun 	uint32_t init_core;
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun 	/* exception base address, as set by bootloader */
72*4882a593Smuzhiyun 	uint64_t exception_base_addr;
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun 	/* cpu clock speed in hz */
75*4882a593Smuzhiyun 	uint32_t cpu_clock_hz;
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun 	/* dram data rate in hz (data rate = 2 * clock rate */
78*4882a593Smuzhiyun 	uint32_t dram_data_rate_hz;
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun 
81*4882a593Smuzhiyun 	uint16_t board_type;
82*4882a593Smuzhiyun 	uint8_t board_rev_major;
83*4882a593Smuzhiyun 	uint8_t board_rev_minor;
84*4882a593Smuzhiyun 	uint8_t mac_addr_base[6];
85*4882a593Smuzhiyun 	uint8_t mac_addr_count;
86*4882a593Smuzhiyun 	char board_serial_number[OCTEON_SERIAL_LEN];
87*4882a593Smuzhiyun 	/*
88*4882a593Smuzhiyun 	 * Several boards support compact flash on the Octeon boot
89*4882a593Smuzhiyun 	 * bus.	 The CF memory spaces may be mapped to different
90*4882a593Smuzhiyun 	 * addresses on different boards.  These values will be 0 if
91*4882a593Smuzhiyun 	 * CF is not present.  Note that these addresses are physical
92*4882a593Smuzhiyun 	 * addresses, and it is up to the application to use the
93*4882a593Smuzhiyun 	 * proper addressing mode (XKPHYS, KSEG0, etc.)
94*4882a593Smuzhiyun 	 */
95*4882a593Smuzhiyun 	uint64_t compact_flash_common_base_addr;
96*4882a593Smuzhiyun 	uint64_t compact_flash_attribute_base_addr;
97*4882a593Smuzhiyun 	/*
98*4882a593Smuzhiyun 	 * Base address of the LED display (as on EBT3000 board) This
99*4882a593Smuzhiyun 	 * will be 0 if LED display not present.  Note that this
100*4882a593Smuzhiyun 	 * address is a physical address, and it is up to the
101*4882a593Smuzhiyun 	 * application to use the proper addressing mode (XKPHYS,
102*4882a593Smuzhiyun 	 * KSEG0, etc.)
103*4882a593Smuzhiyun 	 */
104*4882a593Smuzhiyun 	uint64_t led_display_base_addr;
105*4882a593Smuzhiyun 	/* DFA reference clock in hz (if applicable)*/
106*4882a593Smuzhiyun 	uint32_t dfa_ref_clock_hz;
107*4882a593Smuzhiyun 	/* configuration flags from bootloader */
108*4882a593Smuzhiyun 	uint32_t bootloader_config_flags;
109*4882a593Smuzhiyun 
110*4882a593Smuzhiyun 	/* Uart number used for console */
111*4882a593Smuzhiyun 	uint8_t console_uart_num;
112*4882a593Smuzhiyun };
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun /**
115*4882a593Smuzhiyun  * This function returns the system/board information as obtained
116*4882a593Smuzhiyun  * by the bootloader.
117*4882a593Smuzhiyun  *
118*4882a593Smuzhiyun  *
119*4882a593Smuzhiyun  * Returns  Pointer to the boot information structure
120*4882a593Smuzhiyun  *
121*4882a593Smuzhiyun  */
122*4882a593Smuzhiyun 
123*4882a593Smuzhiyun extern struct cvmx_sysinfo *cvmx_sysinfo_get(void);
124*4882a593Smuzhiyun 
125*4882a593Smuzhiyun #endif /* __CVMX_SYSINFO_H__ */
126