158f07778SDavid Daney /***********************license start***************
258f07778SDavid Daney  * Author: Cavium Networks
358f07778SDavid Daney  *
458f07778SDavid Daney  * Contact: support@caviumnetworks.com
558f07778SDavid Daney  * This file is part of the OCTEON SDK
658f07778SDavid Daney  *
758546e3bSDavid Daney  * Copyright (c) 2003-2016 Cavium, Inc.
858f07778SDavid Daney  *
958f07778SDavid Daney  * This file is free software; you can redistribute it and/or modify
1058f07778SDavid Daney  * it under the terms of the GNU General Public License, Version 2, as
1158f07778SDavid Daney  * published by the Free Software Foundation.
1258f07778SDavid Daney  *
1358f07778SDavid Daney  * This file is distributed in the hope that it will be useful, but
1458f07778SDavid Daney  * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
1558f07778SDavid Daney  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
1658f07778SDavid Daney  * NONINFRINGEMENT.  See the GNU General Public License for more
1758f07778SDavid Daney  * details.
1858f07778SDavid Daney  *
1958f07778SDavid Daney  * You should have received a copy of the GNU General Public License
2058f07778SDavid Daney  * along with this file; if not, write to the Free Software
2158f07778SDavid Daney  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2258f07778SDavid Daney  * or visit http://www.gnu.org/licenses/.
2358f07778SDavid Daney  *
2458f07778SDavid Daney  * This file may also be available under a different license from Cavium.
2558f07778SDavid Daney  * Contact Cavium Networks for more information
2658f07778SDavid Daney  ***********************license end**************************************/
2758f07778SDavid Daney 
2858f07778SDavid Daney /*
2958f07778SDavid Daney  * This module provides system/board information obtained by the bootloader.
3058f07778SDavid Daney  */
3158f07778SDavid Daney 
3258f07778SDavid Daney #ifndef __CVMX_SYSINFO_H__
3358f07778SDavid Daney #define __CVMX_SYSINFO_H__
3458f07778SDavid Daney 
357d52ab16SDavid Daney #include "cvmx-coremask.h"
367d52ab16SDavid Daney 
3758f07778SDavid Daney #define OCTEON_SERIAL_LEN 20
3858f07778SDavid Daney /**
3958f07778SDavid Daney  * Structure describing application specific information.
4058f07778SDavid Daney  * __cvmx_app_init() populates this from the cvmx boot descriptor.
4158f07778SDavid Daney  * This structure is private to simple executive applications, so
4258f07778SDavid Daney  * no versioning is required.
4358f07778SDavid Daney  *
4458f07778SDavid Daney  * This structure must be provided with some fields set in order to
4558f07778SDavid Daney  * use simple executive functions in other applications (Linux kernel,
4658f07778SDavid Daney  * u-boot, etc.)  The cvmx_sysinfo_minimal_initialize() function is
4758f07778SDavid Daney  * provided to set the required values in these cases.
4858f07778SDavid Daney  */
4958f07778SDavid Daney struct cvmx_sysinfo {
5058f07778SDavid Daney 	/* System wide variables */
5158f07778SDavid Daney 	/* installed DRAM in system, in bytes */
5258f07778SDavid Daney 	uint64_t system_dram_size;
5358f07778SDavid Daney 
5458f07778SDavid Daney 	/* ptr to memory descriptor block */
557d52ab16SDavid Daney 	uint64_t phy_mem_desc_addr;
5658f07778SDavid Daney 
5758f07778SDavid Daney 	/* Application image specific variables */
5858f07778SDavid Daney 	/* stack top address (virtual) */
5958f07778SDavid Daney 	uint64_t stack_top;
6058f07778SDavid Daney 	/* heap base address (virtual) */
6158f07778SDavid Daney 	uint64_t heap_base;
6258f07778SDavid Daney 	/* stack size in bytes */
6358f07778SDavid Daney 	uint32_t stack_size;
6458f07778SDavid Daney 	/* heap size in bytes */
6558f07778SDavid Daney 	uint32_t heap_size;
6658f07778SDavid Daney 	/* coremask defining cores running application */
677d52ab16SDavid Daney 	struct cvmx_coremask core_mask;
6858f07778SDavid Daney 	/* Deprecated, use cvmx_coremask_first_core() to select init core */
6958f07778SDavid Daney 	uint32_t init_core;
7058f07778SDavid Daney 
7158f07778SDavid Daney 	/* exception base address, as set by bootloader */
7258f07778SDavid Daney 	uint64_t exception_base_addr;
7358f07778SDavid Daney 
7458f07778SDavid Daney 	/* cpu clock speed in hz */
7558f07778SDavid Daney 	uint32_t cpu_clock_hz;
7658f07778SDavid Daney 
7758f07778SDavid Daney 	/* dram data rate in hz (data rate = 2 * clock rate */
7858f07778SDavid Daney 	uint32_t dram_data_rate_hz;
7958f07778SDavid Daney 
8058f07778SDavid Daney 
8158f07778SDavid Daney 	uint16_t board_type;
8258f07778SDavid Daney 	uint8_t board_rev_major;
8358f07778SDavid Daney 	uint8_t board_rev_minor;
8458f07778SDavid Daney 	uint8_t mac_addr_base[6];
8558f07778SDavid Daney 	uint8_t mac_addr_count;
8658f07778SDavid Daney 	char board_serial_number[OCTEON_SERIAL_LEN];
8758f07778SDavid Daney 	/*
8858f07778SDavid Daney 	 * Several boards support compact flash on the Octeon boot
8958f07778SDavid Daney 	 * bus.	 The CF memory spaces may be mapped to different
9058f07778SDavid Daney 	 * addresses on different boards.  These values will be 0 if
9158f07778SDavid Daney 	 * CF is not present.  Note that these addresses are physical
9258f07778SDavid Daney 	 * addresses, and it is up to the application to use the
9358f07778SDavid Daney 	 * proper addressing mode (XKPHYS, KSEG0, etc.)
9458f07778SDavid Daney 	 */
9558f07778SDavid Daney 	uint64_t compact_flash_common_base_addr;
9658f07778SDavid Daney 	uint64_t compact_flash_attribute_base_addr;
9758f07778SDavid Daney 	/*
9858f07778SDavid Daney 	 * Base address of the LED display (as on EBT3000 board) This
9958f07778SDavid Daney 	 * will be 0 if LED display not present.  Note that this
10058f07778SDavid Daney 	 * address is a physical address, and it is up to the
10158f07778SDavid Daney 	 * application to use the proper addressing mode (XKPHYS,
10258f07778SDavid Daney 	 * KSEG0, etc.)
10358f07778SDavid Daney 	 */
10458f07778SDavid Daney 	uint64_t led_display_base_addr;
10558f07778SDavid Daney 	/* DFA reference clock in hz (if applicable)*/
10658f07778SDavid Daney 	uint32_t dfa_ref_clock_hz;
10758f07778SDavid Daney 	/* configuration flags from bootloader */
10858f07778SDavid Daney 	uint32_t bootloader_config_flags;
10958f07778SDavid Daney 
11058f07778SDavid Daney 	/* Uart number used for console */
11158f07778SDavid Daney 	uint8_t console_uart_num;
11258f07778SDavid Daney };
11358f07778SDavid Daney 
11458f07778SDavid Daney /**
11558f07778SDavid Daney  * This function returns the system/board information as obtained
11658f07778SDavid Daney  * by the bootloader.
11758f07778SDavid Daney  *
11858f07778SDavid Daney  *
11958f07778SDavid Daney  * Returns  Pointer to the boot information structure
12058f07778SDavid Daney  *
12158f07778SDavid Daney  */
12258f07778SDavid Daney 
12358f07778SDavid Daney extern struct cvmx_sysinfo *cvmx_sysinfo_get(void);
12458f07778SDavid Daney 
12558f07778SDavid Daney #endif /* __CVMX_SYSINFO_H__ */
126