cvmx-sysinfo.h revision 210284
11541Srgrimes/***********************license start*************** 21541Srgrimes * Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights 31541Srgrimes * reserved. 41541Srgrimes * 51541Srgrimes * 61541Srgrimes * Redistribution and use in source and binary forms, with or without 71541Srgrimes * modification, are permitted provided that the following conditions are 81541Srgrimes * met: 91541Srgrimes * 101541Srgrimes * * Redistributions of source code must retain the above copyright 111541Srgrimes * notice, this list of conditions and the following disclaimer. 121541Srgrimes * 131541Srgrimes * * Redistributions in binary form must reproduce the above 141541Srgrimes * copyright notice, this list of conditions and the following 151541Srgrimes * disclaimer in the documentation and/or other materials provided 161541Srgrimes * with the distribution. 171541Srgrimes * 181541Srgrimes * * Neither the name of Cavium Networks nor the names of 191541Srgrimes * its contributors may be used to endorse or promote products 201541Srgrimes * derived from this software without specific prior written 211541Srgrimes * permission. 221541Srgrimes * 231541Srgrimes * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 241541Srgrimes * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS 251541Srgrimes * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH 261541Srgrimes * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY 271541Srgrimes * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT 281541Srgrimes * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES 291541Srgrimes * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR 301541Srgrimes * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET 311541Srgrimes * POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT 321541Srgrimes * OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU. 331541Srgrimes * 341541Srgrimes * 351541Srgrimes * For any questions regarding licensing please contact marketing@caviumnetworks.com 361541Srgrimes * 371541Srgrimes ***********************license end**************************************/ 3814508Shsu 3921101Sjhay 401541Srgrimes 411541Srgrimes 422165Spaul 432865Sbde 442165Spaul/** 451549Srgrimes * @file 461549Srgrimes * 4718883Sbde * This module provides system/board information obtained by the bootloader. 487090Sbde * 497090Sbde * <hr>$Revision: 41586 $<hr> 501541Srgrimes * 511541Srgrimes */ 521541Srgrimes 531541Srgrimes 541541Srgrimes#ifndef __CVMX_SYSINFO_H__ 551541Srgrimes#define __CVMX_SYSINFO_H__ 568504Sdg 571541Srgrimes#include "cvmx-app-init.h" 581541Srgrimes 591541Srgrimes#ifdef __cplusplus 601541Srgrimesextern "C" { 611541Srgrimes#endif 621541Srgrimes 631541Srgrimes#define OCTEON_SERIAL_LEN 20 641541Srgrimes/** 651541Srgrimes * Structure describing application specific information. 661541Srgrimes * __cvmx_app_init() populates this from the cvmx boot descriptor. 671541Srgrimes * This structure is private to simple executive applications, so 681541Srgrimes * no versioning is required. 691541Srgrimes * 701541Srgrimes * This structure must be provided with some fields set in order to use 711541Srgrimes * simple executive functions in other applications (Linux kernel, u-boot, etc.) 721541Srgrimes * The cvmx_sysinfo_minimal_initialize() function is provided to set the required values 731541Srgrimes * in these cases. 741541Srgrimes * 751541Srgrimes * 7615113Sbde */ 771541Srgrimestypedef struct { 781541Srgrimes /* System wide variables */ 791541Srgrimes uint64_t system_dram_size; /**< installed DRAM in system, in bytes */ 801541Srgrimes void *phy_mem_desc_ptr; /**< ptr to memory descriptor block */ 8116875Sbde 821541Srgrimes /* Application image specific variables */ 831541Srgrimes uint64_t stack_top; /**< stack top address (virtual) */ 8414508Shsu uint64_t heap_base; /**< heap base address (virtual) */ 851541Srgrimes uint32_t stack_size; /**< stack size in bytes */ 863304Sphk uint32_t heap_size; /**< heap size in bytes */ 871541Srgrimes uint32_t core_mask; /**< coremask defining cores running application */ 887612Sdg uint32_t init_core; /**< Deprecated, use cvmx_coremask_first_core() to select init core */ 891541Srgrimes uint64_t exception_base_addr; /**< exception base address, as set by bootloader */ 9018277Sbde uint32_t cpu_clock_hz; /**< cpu clock speed in hz */ 9118277Sbde uint32_t dram_data_rate_hz; /**< dram data rate in hz (data rate = 2 * clock rate */ 9217975Sbde 931541Srgrimes uint16_t board_type; 9415680Sgpalmer uint8_t board_rev_major; 9518556Sbde uint8_t board_rev_minor; 9618556Sbde uint8_t mac_addr_base[6]; 971541Srgrimes uint8_t mac_addr_count; 9813697Sgibbs char board_serial_number[OCTEON_SERIAL_LEN]; 9913446Sphk /* Several boards support compact flash on the Octeon boot bus. The CF 1002112Swollman ** memory spaces may be mapped to different addresses on different boards. 10118556Sbde ** These values will be 0 if CF is not present. 1021541Srgrimes ** Note that these addresses are physical addresses, and it is up to the application 1031541Srgrimes ** to use the proper addressing mode (XKPHYS, KSEG0, etc.)*/ 1048215Sdg uint64_t compact_flash_common_base_addr; 1058215Sdg uint64_t compact_flash_attribute_base_addr; 10613414Sphk /* Base address of the LED display (as on EBT3000 board) 1071541Srgrimes ** This will be 0 if LED display not present. 1088215Sdg ** Note that this address is a physical address, and it is up to the application 1098215Sdg ** to use the proper addressing mode (XKPHYS, KSEG0, etc.)*/ 11013456Sbde uint64_t led_display_base_addr; 11113456Sbde uint32_t dfa_ref_clock_hz; /**< DFA reference clock in hz (if applicable)*/ 11213456Sbde uint32_t bootloader_config_flags; /**< configuration flags from bootloader */ 11313456Sbde uint8_t console_uart_num; /** < Uart number used for console */ 11413456Sbde} cvmx_sysinfo_t; 11513456Sbde 1161541Srgrimes 11713456Sbde/** 11813456Sbde * This function returns the system/board information as obtained 1191541Srgrimes * by the bootloader. 1201541Srgrimes * 12113456Sbde * 1221541Srgrimes * @return Pointer to the boot information structure 1236358Sphk * 1241541Srgrimes */ 1251541Srgrimes 1261541Srgrimesextern cvmx_sysinfo_t * cvmx_sysinfo_get(void); 1271541Srgrimes 1281541Srgrimes 1291541Srgrimes/** 1301541Srgrimes * This function is used in non-simple executive environments (such as Linux kernel, u-boot, etc.) 1311541Srgrimes * to configure the minimal fields that are required to use 1321541Srgrimes * simple executive files directly. 1331541Srgrimes * 1341541Srgrimes * Locking (if required) must be handled outside of this 1351541Srgrimes * function 1361541Srgrimes * 1373484Sphk * @param phy_mem_desc_ptr 13821101Sjhay * Pointer to global physical memory descriptor (bootmem descriptor) 13921101Sjhay * @param board_type Octeon board type enumeration 1407109Sphk * 1412112Swollman * @param board_rev_major 1422112Swollman * Board major revision 1432112Swollman * @param board_rev_minor 1442112Swollman * Board minor revision 1452112Swollman * @param cpu_clock_hz 1462112Swollman * CPU clock freqency in hertz 1472112Swollman * 1482112Swollman * @return 0: Failure 1497090Sbde * 1: success 1507090Sbde */ 1517090Sbdeextern int cvmx_sysinfo_minimal_initialize(void *phy_mem_desc_ptr, uint16_t board_type, uint8_t board_rev_major, 1527090Sbde uint8_t board_rev_minor, uint32_t cpu_clock_hz); 1537090Sbde 1547090Sbde#ifdef CVMX_BUILD_FOR_LINUX_USER 1557090Sbde/** 1567090Sbde * Initialize the sysinfo structure when running on 1577090Sbde * Octeon under Linux userspace 1587090Sbde */ 1592112Swollmanextern void cvmx_sysinfo_linux_userspace_initialize(void); 1602112Swollman#endif 1612112Swollman 1622112Swollman#ifdef __cplusplus 1632112Swollman} 1642112Swollman#endif 1653484Sphk 1662165Spaul#endif /* __CVMX_SYSINFO_H__ */ 16717658Sjulian