cvmx-sysinfo.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /***********************license start***************
  2. * Author: Cavium Networks
  3. *
  4. * Contact: support@caviumnetworks.com
  5. * This file is part of the OCTEON SDK
  6. *
  7. * Copyright (c) 2003-2008 Cavium Networks
  8. *
  9. * This file is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License, Version 2, as
  11. * published by the Free Software Foundation.
  12. *
  13. * This file is distributed in the hope that it will be useful, but
  14. * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
  15. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
  16. * NONINFRINGEMENT. See the GNU General Public License for more
  17. * details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this file; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  22. * or visit http://www.gnu.org/licenses/.
  23. *
  24. * This file may also be available under a different license from Cavium.
  25. * Contact Cavium Networks for more information
  26. ***********************license end**************************************/
  27. /*
  28. * This module provides system/board information obtained by the bootloader.
  29. */
  30. #ifndef __CVMX_SYSINFO_H__
  31. #define __CVMX_SYSINFO_H__
  32. #define OCTEON_SERIAL_LEN 20
  33. /**
  34. * Structure describing application specific information.
  35. * __cvmx_app_init() populates this from the cvmx boot descriptor.
  36. * This structure is private to simple executive applications, so
  37. * no versioning is required.
  38. *
  39. * This structure must be provided with some fields set in order to
  40. * use simple executive functions in other applications (Linux kernel,
  41. * u-boot, etc.) The cvmx_sysinfo_minimal_initialize() function is
  42. * provided to set the required values in these cases.
  43. */
  44. struct cvmx_sysinfo {
  45. /* System wide variables */
  46. /* installed DRAM in system, in bytes */
  47. uint64_t system_dram_size;
  48. /* ptr to memory descriptor block */
  49. void *phy_mem_desc_ptr;
  50. /* Application image specific variables */
  51. /* stack top address (virtual) */
  52. uint64_t stack_top;
  53. /* heap base address (virtual) */
  54. uint64_t heap_base;
  55. /* stack size in bytes */
  56. uint32_t stack_size;
  57. /* heap size in bytes */
  58. uint32_t heap_size;
  59. /* coremask defining cores running application */
  60. uint32_t core_mask;
  61. /* Deprecated, use cvmx_coremask_first_core() to select init core */
  62. uint32_t init_core;
  63. /* exception base address, as set by bootloader */
  64. uint64_t exception_base_addr;
  65. /* cpu clock speed in hz */
  66. uint32_t cpu_clock_hz;
  67. /* dram data rate in hz (data rate = 2 * clock rate */
  68. uint32_t dram_data_rate_hz;
  69. uint16_t board_type;
  70. uint8_t board_rev_major;
  71. uint8_t board_rev_minor;
  72. uint8_t mac_addr_base[6];
  73. uint8_t mac_addr_count;
  74. char board_serial_number[OCTEON_SERIAL_LEN];
  75. /*
  76. * Several boards support compact flash on the Octeon boot
  77. * bus. The CF memory spaces may be mapped to different
  78. * addresses on different boards. These values will be 0 if
  79. * CF is not present. Note that these addresses are physical
  80. * addresses, and it is up to the application to use the
  81. * proper addressing mode (XKPHYS, KSEG0, etc.)
  82. */
  83. uint64_t compact_flash_common_base_addr;
  84. uint64_t compact_flash_attribute_base_addr;
  85. /*
  86. * Base address of the LED display (as on EBT3000 board) This
  87. * will be 0 if LED display not present. Note that this
  88. * address is a physical address, and it is up to the
  89. * application to use the proper addressing mode (XKPHYS,
  90. * KSEG0, etc.)
  91. */
  92. uint64_t led_display_base_addr;
  93. /* DFA reference clock in hz (if applicable)*/
  94. uint32_t dfa_ref_clock_hz;
  95. /* configuration flags from bootloader */
  96. uint32_t bootloader_config_flags;
  97. /* Uart number used for console */
  98. uint8_t console_uart_num;
  99. };
  100. /**
  101. * This function returns the system/board information as obtained
  102. * by the bootloader.
  103. *
  104. *
  105. * Returns Pointer to the boot information structure
  106. *
  107. */
  108. extern struct cvmx_sysinfo *cvmx_sysinfo_get(void);
  109. /**
  110. * This function is used in non-simple executive environments (such as
  111. * Linux kernel, u-boot, etc.) to configure the minimal fields that
  112. * are required to use simple executive files directly.
  113. *
  114. * Locking (if required) must be handled outside of this
  115. * function
  116. *
  117. * @phy_mem_desc_ptr: Pointer to global physical memory descriptor
  118. * (bootmem descriptor) @board_type: Octeon board
  119. * type enumeration
  120. *
  121. * @board_rev_major:
  122. * Board major revision
  123. * @board_rev_minor:
  124. * Board minor revision
  125. * @cpu_clock_hz:
  126. * CPU clock freqency in hertz
  127. *
  128. * Returns 0: Failure
  129. * 1: success
  130. */
  131. extern int cvmx_sysinfo_minimal_initialize(void *phy_mem_desc_ptr,
  132. uint16_t board_type,
  133. uint8_t board_rev_major,
  134. uint8_t board_rev_minor,
  135. uint32_t cpu_clock_hz);
  136. #endif /* __CVMX_SYSINFO_H__ */