]> CyberLeo.Net >> Repos - FreeBSD/releng/8.2.git/blob - sys/contrib/octeon-sdk/cvmx-sysinfo.h
Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.
[FreeBSD/releng/8.2.git] / sys / contrib / octeon-sdk / cvmx-sysinfo.h
1 /***********************license start***************
2  *  Copyright (c) 2003-2008 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  *  TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
24  *  AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
25  *  OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
26  *  RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
27  *  REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
28  *  DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
29  *  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
30  *  PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
31  *  POSSESSION OR CORRESPONDENCE TO DESCRIPTION.  THE ENTIRE RISK ARISING OUT
32  *  OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
33  *
34  *
35  *  For any questions regarding licensing please contact marketing@caviumnetworks.com
36  *
37  ***********************license end**************************************/
38
39
40
41
42
43
44 /**
45  * @file
46  *
47  * This module provides system/board information obtained by the bootloader.
48  *
49  * <hr>$Revision: 41586 $<hr>
50  *
51  */
52
53
54 #ifndef __CVMX_SYSINFO_H__
55 #define __CVMX_SYSINFO_H__
56
57 #include "cvmx-app-init.h"
58
59 #ifdef  __cplusplus
60 extern "C" {
61 #endif
62
63 #define OCTEON_SERIAL_LEN 20
64 /**
65  * Structure describing application specific information.
66  * __cvmx_app_init() populates this from the cvmx boot descriptor.
67  * This structure is private to simple executive applications, so
68  * no versioning is required.
69  *
70  * This structure must be provided with some fields set in order to use
71  * simple executive functions in other applications (Linux kernel, u-boot, etc.)
72  * The cvmx_sysinfo_minimal_initialize() function is provided to set the required values
73  * in these cases.
74  *
75  *
76  */
77 typedef struct {
78     /* System wide variables */
79     uint64_t system_dram_size;  /**< installed DRAM in system, in bytes */
80     void *phy_mem_desc_ptr;  /**< ptr to memory descriptor block */
81
82     /* Application image specific variables */
83     uint64_t stack_top;  /**< stack top address (virtual) */
84     uint64_t heap_base;  /**< heap base address (virtual) */
85     uint32_t stack_size; /**< stack size in bytes */
86     uint32_t heap_size;  /**< heap size in bytes */
87     uint32_t core_mask;  /**< coremask defining cores running application */
88     uint32_t init_core;  /**< Deprecated, use cvmx_coremask_first_core() to select init core */
89     uint64_t exception_base_addr;  /**< exception base address, as set by bootloader */
90     uint32_t cpu_clock_hz;     /**< cpu clock speed in hz */
91     uint32_t dram_data_rate_hz;  /**< dram data rate in hz (data rate = 2 * clock rate */
92
93     uint16_t board_type;
94     uint8_t  board_rev_major;
95     uint8_t  board_rev_minor;
96     uint8_t  mac_addr_base[6];
97     uint8_t  mac_addr_count;
98     char     board_serial_number[OCTEON_SERIAL_LEN];
99     /* Several boards support compact flash on the Octeon boot bus.  The CF
100     ** memory spaces may be mapped to different addresses on different boards.
101     ** These values will be 0 if CF is not present.
102     ** Note that these addresses are physical addresses, and it is up to the application
103     ** to use the proper addressing mode (XKPHYS, KSEG0, etc.)*/
104     uint64_t compact_flash_common_base_addr;
105     uint64_t compact_flash_attribute_base_addr;
106     /* Base address of the LED display (as on EBT3000 board)
107     ** This will be 0 if LED display not present.
108     ** Note that this address is a physical address, and it is up to the application
109     ** to use the proper addressing mode (XKPHYS, KSEG0, etc.)*/
110     uint64_t led_display_base_addr;
111     uint32_t dfa_ref_clock_hz;  /**< DFA reference clock in hz (if applicable)*/
112     uint32_t bootloader_config_flags;  /**< configuration flags from bootloader */
113     uint8_t  console_uart_num;         /** < Uart number used for console */
114 } cvmx_sysinfo_t;
115
116
117 /**
118  * This function returns the system/board information as obtained
119  * by the bootloader.
120  *
121  *
122  * @return  Pointer to the boot information structure
123  *
124  */
125
126 extern cvmx_sysinfo_t * cvmx_sysinfo_get(void);
127
128
129 /**
130  * This function is used in non-simple executive environments (such as Linux kernel, u-boot, etc.)
131  * to configure the minimal fields that are required to use
132  * simple executive files directly.
133  *
134  * Locking (if required) must be handled outside of this
135  * function
136  *
137  * @param phy_mem_desc_ptr
138  *                   Pointer to global physical memory descriptor (bootmem descriptor)
139  * @param board_type Octeon board type enumeration
140  *
141  * @param board_rev_major
142  *                   Board major revision
143  * @param board_rev_minor
144  *                   Board minor revision
145  * @param cpu_clock_hz
146  *                   CPU clock freqency in hertz
147  *
148  * @return 0: Failure
149  *         1: success
150  */
151 extern int cvmx_sysinfo_minimal_initialize(void *phy_mem_desc_ptr, uint16_t board_type, uint8_t board_rev_major,
152                                     uint8_t board_rev_minor, uint32_t cpu_clock_hz);
153
154 #ifdef CVMX_BUILD_FOR_LINUX_USER
155 /**
156  * Initialize the sysinfo structure when running on
157  * Octeon under Linux userspace
158  */
159 extern void cvmx_sysinfo_linux_userspace_initialize(void);
160 #endif
161
162 #ifdef  __cplusplus
163 }
164 #endif
165
166 #endif /* __CVMX_SYSINFO_H__ */