cvmx-sysinfo.h revision 215990
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 * @file 43 * 44 * This module provides system/board information obtained by the bootloader. 45 * 46 * <hr>$Revision: 49448 $<hr> 47 * 48 */ 49 50 51#ifndef __CVMX_SYSINFO_H__ 52#define __CVMX_SYSINFO_H__ 53 54#ifndef CVMX_BUILD_FOR_LINUX_KERNEL 55#include "cvmx-app-init.h" 56#endif 57 58#ifdef __cplusplus 59extern "C" { 60#endif 61 62#define OCTEON_SERIAL_LEN 20 63/** 64 * Structure describing application specific information. 65 * __cvmx_app_init() populates this from the cvmx boot descriptor. 66 * This structure is private to simple executive applications, so no 67 * versioning is required. 68 * 69 * This structure must be provided with some fields set in order to 70 * use simple executive functions in other applications (Linux kernel, 71 * u-boot, etc.) The cvmx_sysinfo_minimal_initialize() function is 72 * provided to set the required values in these cases. 73 * 74 */ 75struct cvmx_sysinfo { 76 /* System wide variables */ 77 uint64_t system_dram_size; /**< installed DRAM in system, in bytes */ 78 uint64_t phy_mem_desc_addr; /**< Address of the memory descriptor block */ 79 80 /* Application image specific variables */ 81 uint64_t stack_top; /**< stack top address (virtual) */ 82 uint64_t heap_base; /**< heap base address (virtual) */ 83 uint32_t stack_size; /**< stack size in bytes */ 84 uint32_t heap_size; /**< heap size in bytes */ 85 uint32_t core_mask; /**< coremask defining cores running application */ 86 uint32_t init_core; /**< Deprecated, use cvmx_coremask_first_core() to select init core */ 87 uint64_t exception_base_addr; /**< exception base address, as set by bootloader */ 88 uint32_t cpu_clock_hz; /**< cpu clock speed in hz */ 89 uint32_t dram_data_rate_hz; /**< dram data rate in hz (data rate = 2 * clock rate */ 90 91 uint16_t board_type; 92 uint8_t board_rev_major; 93 uint8_t board_rev_minor; 94 uint8_t mac_addr_base[6]; 95 uint8_t mac_addr_count; 96 char board_serial_number[OCTEON_SERIAL_LEN]; 97 /* 98 * Several boards support compact flash on the Octeon boot 99 * bus. The CF memory spaces may be mapped to different 100 * addresses on different boards. These values will be 0 if 101 * CF is not present. Note that these addresses are physical 102 * addresses, and it is up to the application to use the 103 * proper addressing mode (XKPHYS, KSEG0, etc.) 104 */ 105 uint64_t compact_flash_common_base_addr; 106 uint64_t compact_flash_attribute_base_addr; 107 /* 108 * Base address of the LED display (as on EBT3000 board) This 109 * will be 0 if LED display not present. Note that this 110 * address is a physical address, and it is up to the 111 * application to use the proper addressing mode (XKPHYS, 112 * KSEG0, etc.) 113 */ 114 uint64_t led_display_base_addr; 115 uint32_t dfa_ref_clock_hz; /**< DFA reference clock in hz (if applicable)*/ 116 uint32_t bootloader_config_flags; /**< configuration flags from bootloader */ 117 uint8_t console_uart_num; /** < Uart number used for console */ 118}; 119 120#ifndef CVMX_BUILD_FOR_LINUX_KERNEL 121typedef struct cvmx_sysinfo cvmx_sysinfo_t; 122#endif 123 124/** 125 * This function returns the system/board information as obtained 126 * by the bootloader. 127 * 128 * 129 * @return Pointer to the boot information structure 130 * 131 */ 132 133extern struct cvmx_sysinfo *cvmx_sysinfo_get(void); 134 135#ifndef CVMX_BUILD_FOR_LINUX_KERNEL 136/** 137 * This function is used in non-simple executive environments (such as Linux kernel, u-boot, etc.) 138 * to configure the minimal fields that are required to use 139 * simple executive files directly. 140 * 141 * Locking (if required) must be handled outside of this 142 * function 143 * 144 * @param phy_mem_desc_addr 145 * Address of the global physical memory descriptor (bootmem 146 * descriptor) 147 * @param board_type Octeon board type enumeration 148 * 149 * @param board_rev_major 150 * Board major revision 151 * @param board_rev_minor 152 * Board minor revision 153 * @param cpu_clock_hz 154 * CPU clock freqency in hertz 155 * 156 * @return 0: Failure 157 * 1: success 158 */ 159extern int cvmx_sysinfo_minimal_initialize(uint64_t phy_mem_desc_addr, uint16_t board_type, uint8_t board_rev_major, 160 uint8_t board_rev_minor, uint32_t cpu_clock_hz); 161#endif 162 163#ifdef CVMX_BUILD_FOR_LINUX_USER 164/** 165 * Initialize the sysinfo structure when running on 166 * Octeon under Linux userspace 167 */ 168extern void cvmx_sysinfo_linux_userspace_initialize(void); 169#endif 170 171#ifdef __cplusplus 172} 173#endif 174 175#endif /* __CVMX_SYSINFO_H__ */ 176