1 /***********************license start***************
2 * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
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.
18 * * Neither the name of Cavium Inc. nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
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
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. 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**************************************/
44 * This module provides system/board information obtained by the bootloader.
46 * <hr>$Revision: 70030 $<hr>
51 #ifndef __CVMX_SYSINFO_H__
52 #define __CVMX_SYSINFO_H__
54 #ifndef CVMX_BUILD_FOR_LINUX_KERNEL
55 #include "cvmx-app-init.h"
62 #define OCTEON_SERIAL_LEN 20
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.
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.
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 */
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 */
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];
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.)
105 uint64_t compact_flash_common_base_addr;
106 uint64_t compact_flash_attribute_base_addr;
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,
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 uint64_t fdt_addr; /** pointer to device tree */
121 #ifndef CVMX_BUILD_FOR_LINUX_KERNEL
122 typedef struct cvmx_sysinfo cvmx_sysinfo_t;
126 * This function returns the system/board information as obtained
130 * @return Pointer to the boot information structure
134 extern struct cvmx_sysinfo *cvmx_sysinfo_get(void);
137 * This function adds the current cpu to sysinfo coremask
141 void cvmx_sysinfo_add_self_to_core_mask(void);
144 * This function removes the current cpu to sysinfo coremask
147 void cvmx_sysinfo_remove_self_from_core_mask(void);
149 #ifndef CVMX_BUILD_FOR_LINUX_KERNEL
151 * This function is used in non-simple executive environments (such as Linux kernel, u-boot, etc.)
152 * to configure the minimal fields that are required to use
153 * simple executive files directly.
155 * Locking (if required) must be handled outside of this
158 * @param phy_mem_desc_addr
159 * Address of the global physical memory descriptor (bootmem
161 * @param board_type Octeon board type enumeration
163 * @param board_rev_major
164 * Board major revision
165 * @param board_rev_minor
166 * Board minor revision
167 * @param cpu_clock_hz
168 * CPU clock freqency in hertz
173 extern int cvmx_sysinfo_minimal_initialize(uint64_t phy_mem_desc_addr, uint16_t board_type, uint8_t board_rev_major,
174 uint8_t board_rev_minor, uint32_t cpu_clock_hz);
177 #ifdef CVMX_BUILD_FOR_LINUX_USER
179 * Initialize the sysinfo structure when running on
180 * Octeon under Linux userspace
182 extern void cvmx_sysinfo_linux_userspace_initialize(void);
189 #endif /* __CVMX_SYSINFO_H__ */