summaryrefslogtreecommitdiffstats
path: root/sys/contrib/octeon-sdk
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2010-07-20 19:25:11 +0000
committerjmallett <jmallett@FreeBSD.org>2010-07-20 19:25:11 +0000
commit3dc9275fe39c5d0fd860c4acac1ab1658a583004 (patch)
tree675a78e54a65a0fe4e3ea52b10a630f886aa4ffc /sys/contrib/octeon-sdk
parentfd28c2f49567cb0767fe5a65f64d034603b1a775 (diff)
downloadFreeBSD-src-3dc9275fe39c5d0fd860c4acac1ab1658a583004.zip
FreeBSD-src-3dc9275fe39c5d0fd860c4acac1ab1658a583004.tar.gz
Update the port of FreeBSD to Cavium Octeon to use the Cavium Simple Executive
library: o) Increase inline unit / large function growth limits for MIPS to accommodate the needs of the Simple Executive, which uses a shocking amount of inlining. o) Remove TARGET_OCTEON and use CPU_CNMIPS to do things required by cnMIPS and the Octeon SoC. o) Add OCTEON_VENDOR_LANNER to use Lanner's allocation of vendor-specific board numbers, specifically to support the MR320. o) Add OCTEON_BOARD_CAPK_0100ND to hard-wire configuration for the CAPK-0100nd, which improperly uses an evaluation board's board number and breaks board detection at runtime. This board is sold by Portwell as the CAM-0100. o) Add support for the RTC available on some Octeon boards. o) Add support for the Octeon PCI bus. Note that rman_[sg]et_virtual for IO ports can not work unless building for n64. o) Clean up the CompactFlash driver to use Simple Executive macros and structures where possible (it would be advisable to use the Simple Executive API to set the PIO mode, too, but that is not done presently.) Also use structures from FreeBSD's ATA layer rather than structures copied from Linux. o) Print available Octeon SoC features on boot. o) Add support for the Octeon timecounter. o) Use the Simple Executive's routines rather than local copies for doing reads and writes to 64-bit addresses and use its macros for various device addresses rather than using local copies. o) Rename octeon_board_real to octeon_is_simulation to reduce differences with Cavium-provided code originally written for Linux. Also make it use the same simplified test that the Simple Executive and Linux both use rather than our complex one. o) Add support for the Octeon CIU, which is the main interrupt unit, as a bus to use normal interrupt allocation and setup routines. o) Use the Simple Executive's bootmem facility to allocate physical memory for the kernel, rather than assuming we know which addresses we can steal. NB: This may reduce the amount of RAM the kernel reports you as having if you are leaving large temporary allocations made by U-Boot allocated when starting FreeBSD. o) Add a port of the Cavium-provided Ethernet driver for Linux. This changes Ethernet interface naming from rgmxN to octeN. The new driver has vast improvements over the old one, both in performance and functionality, but does still have some features which have not been ported entirely and there may be unimplemented code that can be hit in everyday use. I will make every effort to correct those as they are reported. o) Support loading the kernel on non-contiguous cores. o) Add very conservative support for harvesting randomness from the Octeon random number device. o) Turn SMP on by default. o) Clean up the style of the Octeon kernel configurations a little and make them compile with -march=octeon. o) Add support for the Lanner MR320 and the CAPK-0100nd to the Simple Executive. o) Modify the Simple Executive to build on FreeBSD and to build without executive-config.h or cvmx-config.h. In the future we may want to revert part of these changes and supply executive-config.h and cvmx-config.h and access to the options contained in those files via kernel configuration files. o) Modify the Simple Executive USB routines to support getting and setting of the USB PID.
Diffstat (limited to 'sys/contrib/octeon-sdk')
-rw-r--r--sys/contrib/octeon-sdk/cvmx-access-native.h11
-rw-r--r--sys/contrib/octeon-sdk/cvmx-app-init.h6
-rw-r--r--sys/contrib/octeon-sdk/cvmx-asm.h4
-rw-r--r--sys/contrib/octeon-sdk/cvmx-cmd-queue.c1
-rw-r--r--sys/contrib/octeon-sdk/cvmx-cmd-queue.h6
-rw-r--r--sys/contrib/octeon-sdk/cvmx-fpa.c1
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper-board.c58
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper-errata.c3
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper-fpa.c2
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper-loop.c5
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper-npi.c6
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper-rgmii.c32
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper-sgmii.c6
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper-spi.c5
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper-util.c2
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper-util.h2
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper-xaui.c6
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper.c2
-rw-r--r--sys/contrib/octeon-sdk/cvmx-helper.h5
-rw-r--r--sys/contrib/octeon-sdk/cvmx-pko.c2
-rw-r--r--sys/contrib/octeon-sdk/cvmx-platform.h10
-rw-r--r--sys/contrib/octeon-sdk/cvmx-rtc.h2
-rw-r--r--sys/contrib/octeon-sdk/cvmx-spi.c1
-rw-r--r--sys/contrib/octeon-sdk/cvmx-thunder.c11
-rw-r--r--sys/contrib/octeon-sdk/cvmx-usb.c19
-rw-r--r--sys/contrib/octeon-sdk/cvmx-usb.h7
-rw-r--r--sys/contrib/octeon-sdk/octeon-model.h2
-rw-r--r--sys/contrib/octeon-sdk/perfzilla_screen.pngbin27110 -> 0 bytes
28 files changed, 161 insertions, 56 deletions
diff --git a/sys/contrib/octeon-sdk/cvmx-access-native.h b/sys/contrib/octeon-sdk/cvmx-access-native.h
index c16ca9e..af95390 100644
--- a/sys/contrib/octeon-sdk/cvmx-access-native.h
+++ b/sys/contrib/octeon-sdk/cvmx-access-native.h
@@ -122,6 +122,8 @@ static inline uint64_t cvmx_ptr_to_phys(void *ptr)
return address + 0x400000000ull; /* 256MB-512MB is a virtual mapping for the 2nd 256MB */
else
return address; /* Looks to be a 1:1 mapped userspace pointer */
+#elif defined(__FreeBSD__) && defined(_KERNEL)
+ return (pmap_kextract((vm_offset_t)ptr));
#else
#if CVMX_USE_1_TO_1_TLB_MAPPINGS
/* We are assumung we're running the Simple Executive standalone. In this
@@ -201,6 +203,15 @@ static inline void *cvmx_phys_to_ptr(uint64_t physical_address)
return CASTPTR(void, physical_address - 0x400000000ull);
else
return CASTPTR(void, physical_address);
+#elif defined(__FreeBSD__) && defined(_KERNEL)
+#if defined(__mips_n64)
+ return CASTPTR(void, CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, physical_address));
+#else
+ if (physical_address < 0x20000000)
+ return CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, physical_address));
+ else
+ panic("%s: mapping high address (%#jx) not yet supported.\n", __func__, (uintmax_t)physical_address);
+#endif
#else
#if CVMX_USE_1_TO_1_TLB_MAPPINGS
diff --git a/sys/contrib/octeon-sdk/cvmx-app-init.h b/sys/contrib/octeon-sdk/cvmx-app-init.h
index cfe65fb..6becb91 100644
--- a/sys/contrib/octeon-sdk/cvmx-app-init.h
+++ b/sys/contrib/octeon-sdk/cvmx-app-init.h
@@ -194,6 +194,9 @@ enum cvmx_board_types_enum {
/* Set aside a range for customer private use. The SDK won't
** use any numbers in this range. */
CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001,
+#if defined(OCTEON_VENDOR_LANNER)
+ CVMX_BOARD_TYPE_CUST_LANNER_MR320= 20002,
+#endif
CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000,
/* The remaining range is reserved for future use. */
@@ -265,6 +268,9 @@ static inline const char *cvmx_board_type_to_string(enum cvmx_board_types_enum t
/* Customer private range */
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN)
+#if defined(OCTEON_VENDOR_LANNER)
+ ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_LANNER_MR320)
+#endif
ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
}
return "Unsupported Board";
diff --git a/sys/contrib/octeon-sdk/cvmx-asm.h b/sys/contrib/octeon-sdk/cvmx-asm.h
index 2406677..f25d9b2 100644
--- a/sys/contrib/octeon-sdk/cvmx-asm.h
+++ b/sys/contrib/octeon-sdk/cvmx-asm.h
@@ -225,12 +225,12 @@ extern "C" {
unsigned long _v; \
ASM_STMT ("rdhwr\t%0,$31\n" \
"\tsll\t%0,%0,0" : "=d"(_v)); \
- result = (typeof(result))_v; \
+ result = (__typeof(result))_v; \
} \
} else { \
unsigned long _v; \
ASM_STMT ("rdhwr\t%0,$" CVMX_TMP_STR(regstr) : "=d"(_v)); \
- result = (typeof(result))_v; \
+ result = (__typeof(result))_v; \
}})
diff --git a/sys/contrib/octeon-sdk/cvmx-cmd-queue.c b/sys/contrib/octeon-sdk/cvmx-cmd-queue.c
index 5da42e8..f82a31d 100644
--- a/sys/contrib/octeon-sdk/cvmx-cmd-queue.c
+++ b/sys/contrib/octeon-sdk/cvmx-cmd-queue.c
@@ -49,7 +49,6 @@
*
* <hr>$Revision: 42150 $<hr>
*/
-#include "cvmx-config.h"
#include "cvmx.h"
#include "cvmx-fpa.h"
#include "cvmx-cmd-queue.h"
diff --git a/sys/contrib/octeon-sdk/cvmx-cmd-queue.h b/sys/contrib/octeon-sdk/cvmx-cmd-queue.h
index 3a928d1..f5ba5f3 100644
--- a/sys/contrib/octeon-sdk/cvmx-cmd-queue.h
+++ b/sys/contrib/octeon-sdk/cvmx-cmd-queue.h
@@ -92,8 +92,10 @@
#ifndef __CVMX_CMD_QUEUE_H__
#define __CVMX_CMD_QUEUE_H__
+#ifndef CVMX_DONT_INCLUDE_CONFIG
#include "executive-config.h"
#include "cvmx-config.h"
+#endif
#include "cvmx-fpa.h"
#ifdef __cplusplus
@@ -168,6 +170,8 @@ typedef struct
__cvmx_cmd_queue_state_t state[(CVMX_CMD_QUEUE_END>>16) * 256];
} __cvmx_cmd_queue_all_state_t;
+extern CVMX_SHARED __cvmx_cmd_queue_all_state_t *__cvmx_cmd_queue_state_ptr;
+
/**
* Initialize a command queue for use. The initial FPA buffer is
* allocated and the hardware unit is configured to point to the
@@ -246,7 +250,6 @@ static inline int __cvmx_cmd_queue_get_index(cvmx_cmd_queue_id_t queue_id)
*/
static inline void __cvmx_cmd_queue_lock(cvmx_cmd_queue_id_t queue_id, __cvmx_cmd_queue_state_t *qptr)
{
- extern CVMX_SHARED __cvmx_cmd_queue_all_state_t *__cvmx_cmd_queue_state_ptr;
int tmp;
int my_ticket;
CVMX_PREFETCH(qptr, 0);
@@ -304,7 +307,6 @@ static inline void __cvmx_cmd_queue_unlock(__cvmx_cmd_queue_state_t *qptr)
*/
static inline __cvmx_cmd_queue_state_t *__cvmx_cmd_queue_get_state(cvmx_cmd_queue_id_t queue_id)
{
- extern CVMX_SHARED __cvmx_cmd_queue_all_state_t *__cvmx_cmd_queue_state_ptr;
if (CVMX_ENABLE_PARAMETER_CHECKING)
{
if (cvmx_unlikely(queue_id >= CVMX_CMD_QUEUE_END))
diff --git a/sys/contrib/octeon-sdk/cvmx-fpa.c b/sys/contrib/octeon-sdk/cvmx-fpa.c
index 6e719b5..a14e992 100644
--- a/sys/contrib/octeon-sdk/cvmx-fpa.c
+++ b/sys/contrib/octeon-sdk/cvmx-fpa.c
@@ -50,7 +50,6 @@
*
*/
-#include "cvmx-config.h"
#include "cvmx.h"
#include "cvmx-fpa.h"
#include "cvmx-ipd.h"
diff --git a/sys/contrib/octeon-sdk/cvmx-helper-board.c b/sys/contrib/octeon-sdk/cvmx-helper-board.c
index 503e3b6..b890185 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper-board.c
+++ b/sys/contrib/octeon-sdk/cvmx-helper-board.c
@@ -85,6 +85,26 @@ CVMX_SHARED cvmx_helper_link_info_t (*cvmx_override_board_link_get)(int ipd_port
*/
int cvmx_helper_board_get_mii_address(int ipd_port)
{
+ /*
+ * Board types we have to know at compile-time.
+ */
+#ifdef OCTEON_BOARD_CAPK_0100ND
+ switch (ipd_port) {
+ case 0:
+ return 2;
+ case 1:
+ return 3;
+ case 2:
+ /* XXX Switch PHY? */
+ return -1;
+ default:
+ return -1;
+ }
+#endif
+
+ /*
+ * For board types we can determine at runtime.
+ */
switch (cvmx_sysinfo_get()->board_type)
{
case CVMX_BOARD_TYPE_SIM:
@@ -154,6 +174,22 @@ int cvmx_helper_board_get_mii_address(int ipd_port)
return -1;
case CVMX_BOARD_TYPE_BBGW_REF:
return -1; /* No PHYs are connected to Octeon, everything is through switch */
+
+ /* Private vendor-defined boards. */
+#if defined(OCTEON_VENDOR_LANNER)
+ case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
+ switch (ipd_port) {
+ case 0:
+ /* XXX Switch PHY? */
+ return -1;
+ case 1:
+ return 1;
+ case 2:
+ return 2;
+ default:
+ return -1;
+ }
+#endif
}
/* Some unknown board. Somebody forgot to update this function... */
@@ -195,6 +231,7 @@ cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port)
/* Unless we fix it later, all links are defaulted to down */
result.u64 = 0;
+#if !defined(OCTEON_BOARD_CAPK_0100ND)
/* This switch statement should handle all ports that either don't use
Marvell PHYS, or don't support in-band status */
switch (cvmx_sysinfo_get()->board_type)
@@ -248,7 +285,21 @@ cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port)
return result;
}
break;
+ /* Private vendor-defined boards. */
+#if defined(OCTEON_VENDOR_LANNER)
+ case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
+ /* Port 0 connects to the switch */
+ if (ipd_port == 0)
+ {
+ result.s.link_up = 1;
+ result.s.full_duplex = 1;
+ result.s.speed = 1000;
+ return result;
+ }
+ break;
+#endif
}
+#endif
phy_addr = cvmx_helper_board_get_mii_address(ipd_port);
if (phy_addr != -1)
@@ -322,7 +373,11 @@ cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port)
and set the resolved bit (bit 11) */
if (phy_status & (1<<11))
{
+#if defined(OCTEON_BOARD_CAPK_0100ND)
+ result.s.link_up = (phy_status>>10)&1;
+#else
result.s.link_up = 1;
+#endif
result.s.full_duplex = ((phy_status>>13)&1);
switch ((phy_status>>14)&3)
{
@@ -635,6 +690,9 @@ cvmx_helper_board_usb_clock_types_t __cvmx_helper_board_usb_get_clock_type(void)
{
switch (cvmx_sysinfo_get()->board_type) {
case CVMX_BOARD_TYPE_BBGW_REF:
+#if defined(OCTEON_VENDOR_LANNER)
+ case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
+#endif
return USB_CLOCK_TYPE_CRYSTAL_12;
}
return USB_CLOCK_TYPE_REF_48;
diff --git a/sys/contrib/octeon-sdk/cvmx-helper-errata.c b/sys/contrib/octeon-sdk/cvmx-helper-errata.c
index 16ecfb8..10bcd08 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper-errata.c
+++ b/sys/contrib/octeon-sdk/cvmx-helper-errata.c
@@ -51,9 +51,6 @@
*
* <hr>$Revision: 42150 $<hr>
*/
-#include "executive-config.h"
-#include "cvmx-config.h"
-
#include "cvmx.h"
#include "cvmx-fpa.h"
#include "cvmx-pip.h"
diff --git a/sys/contrib/octeon-sdk/cvmx-helper-fpa.c b/sys/contrib/octeon-sdk/cvmx-helper-fpa.c
index 0b91467..4df6ecc 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper-fpa.c
+++ b/sys/contrib/octeon-sdk/cvmx-helper-fpa.c
@@ -48,8 +48,6 @@
*
* <hr>$Revision: 41586 $<hr>
*/
-#include "executive-config.h"
-#include "cvmx-config.h"
#include "cvmx.h"
#include "cvmx-bootmem.h"
#include "cvmx-fpa.h"
diff --git a/sys/contrib/octeon-sdk/cvmx-helper-loop.c b/sys/contrib/octeon-sdk/cvmx-helper-loop.c
index 768d855..7a8c667 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper-loop.c
+++ b/sys/contrib/octeon-sdk/cvmx-helper-loop.c
@@ -49,14 +49,11 @@
*
* <hr>$Revision: 41586 $<hr>
*/
-#include "executive-config.h"
-#include "cvmx-config.h"
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
#include "cvmx.h"
#include "cvmx-helper.h"
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
/**
* @INTERNAL
* Probe a LOOP interface and determine the number of ports
diff --git a/sys/contrib/octeon-sdk/cvmx-helper-npi.c b/sys/contrib/octeon-sdk/cvmx-helper-npi.c
index f2a4f50..bfdcf40 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper-npi.c
+++ b/sys/contrib/octeon-sdk/cvmx-helper-npi.c
@@ -49,14 +49,10 @@
*
* <hr>$Revision: 41586 $<hr>
*/
-#include "executive-config.h"
-#include "cvmx-config.h"
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
#include "cvmx.h"
#include "cvmx-helper.h"
-
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
/**
* @INTERNAL
* Probe a NPI interface and determine the number of ports
diff --git a/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c b/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
index 95bf589..81a790a 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
+++ b/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
@@ -49,10 +49,6 @@
*
* <hr>$Revision: 42417 $<hr>
*/
-#include "executive-config.h"
-#include "cvmx-config.h"
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
#include "cvmx.h"
#include "cvmx-sysinfo.h"
#include "cvmx-mdio.h"
@@ -60,6 +56,7 @@
#include "cvmx-helper.h"
#include "cvmx-helper-board.h"
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
/**
* @INTERNAL
* Probe RGMII ports and determine the number present
@@ -202,6 +199,31 @@ int __cvmx_helper_rgmii_enable(int interface)
cvmx_write_csr(CVMX_GMXX_TXX_PAUSE_PKT_TIME(port, interface), 20000);
cvmx_write_csr(CVMX_GMXX_TXX_PAUSE_PKT_INTERVAL(port, interface), 19000);
+ /*
+ * Board types we have to know at compile-time.
+ */
+#if defined(OCTEON_BOARD_CAPK_0100ND)
+ cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, interface), 26);
+ cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, interface), 26);
+#else
+ /*
+ * Vendor-defined board types.
+ */
+#if defined(OCTEON_VENDOR_LANNER)
+ switch (cvmx_sysinfo_get()->board_type) {
+ case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
+ if (port == 0) {
+ cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, interface), 4);
+ } else {
+ cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, interface), 7);
+ }
+ cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, interface), 0);
+ break;
+ }
+#else
+ /*
+ * For board types we can determine at runtime.
+ */
if (OCTEON_IS_MODEL(OCTEON_CN50XX))
{
cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, interface), 16);
@@ -212,6 +234,8 @@ int __cvmx_helper_rgmii_enable(int interface)
cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, interface), 24);
cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, interface), 24);
}
+#endif
+#endif
}
__cvmx_helper_setup_gmx(interface, num_ports);
diff --git a/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c b/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c
index 4465ecc..3ca5662 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c
+++ b/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c
@@ -49,17 +49,13 @@
*
* <hr>$Revision: 42417 $<hr>
*/
-#include "executive-config.h"
-#include "cvmx-config.h"
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
#include "cvmx.h"
#include "cvmx-sysinfo.h"
#include "cvmx-mdio.h"
#include "cvmx-helper.h"
#include "cvmx-helper-board.h"
-
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
/**
* @INTERNAL
* Perform initialization required only once for an SGMII port.
diff --git a/sys/contrib/octeon-sdk/cvmx-helper-spi.c b/sys/contrib/octeon-sdk/cvmx-helper-spi.c
index d2138af..9ee1aab 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper-spi.c
+++ b/sys/contrib/octeon-sdk/cvmx-helper-spi.c
@@ -49,15 +49,12 @@
*
* <hr>$Revision: 42417 $<hr>
*/
-#include "executive-config.h"
-#include "cvmx-config.h"
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
#include "cvmx.h"
#include "cvmx-spi.h"
#include "cvmx-sysinfo.h"
#include "cvmx-helper.h"
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
/* CVMX_HELPER_SPI_TIMEOUT is used to determine how long the SPI initialization
routines wait for SPI training. You can override the value using
executive-config.h if necessary */
diff --git a/sys/contrib/octeon-sdk/cvmx-helper-util.c b/sys/contrib/octeon-sdk/cvmx-helper-util.c
index 52f648b..bbdbf08 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper-util.c
+++ b/sys/contrib/octeon-sdk/cvmx-helper-util.c
@@ -48,8 +48,6 @@
*
* <hr>$Revision: 42493 $<hr>
*/
-#include "executive-config.h"
-#include "cvmx-config.h"
#include "cvmx.h"
#include "cvmx-bootmem.h"
#include "cvmx-fpa.h"
diff --git a/sys/contrib/octeon-sdk/cvmx-helper-util.h b/sys/contrib/octeon-sdk/cvmx-helper-util.h
index 553e9e0..210f815 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper-util.h
+++ b/sys/contrib/octeon-sdk/cvmx-helper-util.h
@@ -157,8 +157,6 @@ static inline int cvmx_helper_get_first_ipd_port(int interface)
*/
static inline int cvmx_helper_get_last_ipd_port (int interface)
{
- extern int cvmx_helper_ports_on_interface (int interface);
-
return (cvmx_helper_get_first_ipd_port (interface) +
cvmx_helper_ports_on_interface (interface) - 1);
}
diff --git a/sys/contrib/octeon-sdk/cvmx-helper-xaui.c b/sys/contrib/octeon-sdk/cvmx-helper-xaui.c
index 3027cde..1968499 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper-xaui.c
+++ b/sys/contrib/octeon-sdk/cvmx-helper-xaui.c
@@ -49,14 +49,10 @@
*
* <hr>$Revision: 42417 $<hr>
*/
-#include "executive-config.h"
-#include "cvmx-config.h"
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
#include "cvmx.h"
#include "cvmx-helper.h"
-
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
/**
* @INTERNAL
* Probe a XAUI interface and determine the number of ports
diff --git a/sys/contrib/octeon-sdk/cvmx-helper.c b/sys/contrib/octeon-sdk/cvmx-helper.c
index 50cbdb9..cc52749 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper.c
+++ b/sys/contrib/octeon-sdk/cvmx-helper.c
@@ -48,8 +48,6 @@
*
* <hr>$Revision: 42150 $<hr>
*/
-#include "executive-config.h"
-#include "cvmx-config.h"
#include "cvmx.h"
#include "cvmx-bootmem.h"
#include "cvmx-fpa.h"
diff --git a/sys/contrib/octeon-sdk/cvmx-helper.h b/sys/contrib/octeon-sdk/cvmx-helper.h
index 1c0226a..ecc59f0 100644
--- a/sys/contrib/octeon-sdk/cvmx-helper.h
+++ b/sys/contrib/octeon-sdk/cvmx-helper.h
@@ -52,8 +52,10 @@
#ifndef __CVMX_HELPER_H__
#define __CVMX_HELPER_H__
+#ifndef CVMX_DONT_INCLUDE_CONFIG
#include "executive-config.h"
#include "cvmx-config.h"
+#endif
#include "cvmx-fpa.h"
#include "cvmx-wqe.h"
@@ -97,7 +99,6 @@ typedef union
#include "cvmx-helper-rgmii.h"
#include "cvmx-helper-sgmii.h"
#include "cvmx-helper-spi.h"
-#include "cvmx-helper-util.h"
#include "cvmx-helper-xaui.h"
/**
@@ -250,6 +251,8 @@ extern int cvmx_helper_interface_probe(int interface);
*/
extern int cvmx_helper_configure_loopback(int ipd_port, int enable_internal, int enable_external);
+#include "cvmx-helper-util.h"
+
#endif /* CVMX_ENABLE_PKO_FUNCTIONS */
#ifdef __cplusplus
diff --git a/sys/contrib/octeon-sdk/cvmx-pko.c b/sys/contrib/octeon-sdk/cvmx-pko.c
index cbdfa9f..dd439a3 100644
--- a/sys/contrib/octeon-sdk/cvmx-pko.c
+++ b/sys/contrib/octeon-sdk/cvmx-pko.c
@@ -48,8 +48,6 @@
*
* <hr>$Revision: 42150 $<hr>
*/
-#include "executive-config.h"
-#include "cvmx-config.h"
#include "cvmx.h"
#include "cvmx-pko.h"
#include "cvmx-sysinfo.h"
diff --git a/sys/contrib/octeon-sdk/cvmx-platform.h b/sys/contrib/octeon-sdk/cvmx-platform.h
index 57519f5..7021ade 100644
--- a/sys/contrib/octeon-sdk/cvmx-platform.h
+++ b/sys/contrib/octeon-sdk/cvmx-platform.h
@@ -103,6 +103,8 @@
/* To build the simple exec toolchain runtime (newlib) library. We
should only use features available on all Octeon models. */
#define CVMX_BUILD_FOR_TOOLCHAIN
+#elif defined(__FreeBSD__) && defined(_KERNEL)
+ #define CVMX_BUILD_FOR_FREEBSD
#else
/* We are building a simple exec standalone image for Octeon */
#define CVMX_BUILD_FOR_STANDALONE
@@ -117,7 +119,11 @@
* This is for data structures use by software ONLY,
* as it is not 1-1 VA-PA mapped.
*/
+#if defined(CVMX_BUILD_FOR_FREEBSD)
+#define CVMX_SHARED
+#else
#define CVMX_SHARED __attribute__ ((cvmx_shared))
+#endif
#if defined(CVMX_BUILD_FOR_UBOOT)
@@ -187,6 +193,10 @@
#include <string.h>
#include <assert.h>
+#elif defined(CVMX_BUILD_FOR_FREEBSD)
+
+ #include <mips/cavium/cvmx_config.h>
+
#else
#error Unexpected CVMX_BUILD_FOR_* macro
diff --git a/sys/contrib/octeon-sdk/cvmx-rtc.h b/sys/contrib/octeon-sdk/cvmx-rtc.h
index 4908ca2..0d103b9 100644
--- a/sys/contrib/octeon-sdk/cvmx-rtc.h
+++ b/sys/contrib/octeon-sdk/cvmx-rtc.h
@@ -74,7 +74,7 @@ typedef enum
*
* @return Supported options, or 0 if RTC is not supported
*/
-static inline cvmx_rtc_options_t cvmx_rtc_supported()
+static inline cvmx_rtc_options_t cvmx_rtc_supported(void)
{
static int supported = -1;
diff --git a/sys/contrib/octeon-sdk/cvmx-spi.c b/sys/contrib/octeon-sdk/cvmx-spi.c
index bb0426b..012d03b 100644
--- a/sys/contrib/octeon-sdk/cvmx-spi.c
+++ b/sys/contrib/octeon-sdk/cvmx-spi.c
@@ -48,7 +48,6 @@
*
* <hr>$Revision: 41586 $<hr>
*/
-#include "cvmx-config.h"
#include "cvmx.h"
#include "cvmx-mio.h"
#include "cvmx-pko.h"
diff --git a/sys/contrib/octeon-sdk/cvmx-thunder.c b/sys/contrib/octeon-sdk/cvmx-thunder.c
index 4bafa1d..8b81a29 100644
--- a/sys/contrib/octeon-sdk/cvmx-thunder.c
+++ b/sys/contrib/octeon-sdk/cvmx-thunder.c
@@ -50,7 +50,6 @@
*
*/
-#include "cvmx-config.h"
#include "cvmx.h"
#include "cvmx-sysinfo.h"
#include "cvmx-thunder.h"
@@ -121,7 +120,7 @@ int cvmx_rtc_ds1374_write(uint32_t time)
return (rc ? -1 : 0);
}
-int cvmx_rtc_ds1374_alarm_config(int WD, int WDSTR, int AIE)
+static int cvmx_rtc_ds1374_alarm_config(int WD, int WDSTR, int AIE)
{
int val;
@@ -134,7 +133,7 @@ int cvmx_rtc_ds1374_alarm_config(int WD, int WDSTR, int AIE)
return 0;
}
-int cvmx_rtc_ds1374_alarm_set(int alarm_on)
+static int cvmx_rtc_ds1374_alarm_set(int alarm_on)
{
uint8_t val;
@@ -152,7 +151,7 @@ int cvmx_rtc_ds1374_alarm_set(int alarm_on)
}
-int cvmx_rtc_ds1374_alarm_counter_set(uint32_t interval)
+static int cvmx_rtc_ds1374_alarm_counter_set(uint32_t interval)
{
int i;
int rc = 0;
@@ -165,7 +164,8 @@ int cvmx_rtc_ds1374_alarm_counter_set(uint32_t interval)
return rc;
}
-uint32_t cvmx_rtc_ds1374_alarm_counter_get(void)
+#if 0 /* XXX unused */
+static uint32_t cvmx_rtc_ds1374_alarm_counter_get(void)
{
int i;
uint32_t interval = 0;
@@ -176,6 +176,7 @@ uint32_t cvmx_rtc_ds1374_alarm_counter_get(void)
}
return interval;
}
+#endif
#ifdef CVMX_RTC_DEBUG
diff --git a/sys/contrib/octeon-sdk/cvmx-usb.c b/sys/contrib/octeon-sdk/cvmx-usb.c
index 99a6060..67cedc8 100644
--- a/sys/contrib/octeon-sdk/cvmx-usb.c
+++ b/sys/contrib/octeon-sdk/cvmx-usb.c
@@ -194,7 +194,7 @@ typedef struct
/* This macro logs out when a function returns a value */
#define CVMX_USB_RETURN(v) \
do { \
- typeof(v) r = v; \
+ __typeof(v) r = v; \
if (cvmx_unlikely(usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_DEBUG_CALLS)) \
cvmx_dprintf("%*s%s: returned %s(%d)\n", 2*--usb->indent, "", __FUNCTION__, #v, r); \
return r; \
@@ -3648,3 +3648,20 @@ cvmx_usb_status_t cvmx_usb_device_disable_endpoint(cvmx_usb_state_t *state,
CVMX_USB_RETURN(CVMX_USB_SUCCESS);
}
+extern void cvmx_usb_set_toggle(cvmx_usb_state_t *state, int endpoint_num, int toggle)
+{
+ cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
+ cvmx_usb_pipe_t *pipe = usb->pipe + endpoint_num;
+
+ pipe->pid_toggle = !!toggle;
+}
+
+extern int cvmx_usb_get_toggle(cvmx_usb_state_t *state, int endpoint_num)
+{
+ cvmx_usb_internal_state_t *usb = (cvmx_usb_internal_state_t*)state;
+ cvmx_usb_pipe_t *pipe = usb->pipe + endpoint_num;
+
+ if (pipe->pid_toggle)
+ return (1);
+ return (0);
+}
diff --git a/sys/contrib/octeon-sdk/cvmx-usb.h b/sys/contrib/octeon-sdk/cvmx-usb.h
index 825fdb4..bc228ff 100644
--- a/sys/contrib/octeon-sdk/cvmx-usb.h
+++ b/sys/contrib/octeon-sdk/cvmx-usb.h
@@ -1122,6 +1122,13 @@ extern cvmx_usb_status_t cvmx_usb_device_enable_endpoint(cvmx_usb_state_t *state
extern cvmx_usb_status_t cvmx_usb_device_disable_endpoint(cvmx_usb_state_t *state,
int endpoint_num);
+/*
+ * The FreeBSD host driver uses these functions to manipulate the toggle to deal
+ * more easily with endpoint management.
+ */
+extern void cvmx_usb_set_toggle(cvmx_usb_state_t *state, int endpoint_num, int toggle);
+extern int cvmx_usb_get_toggle(cvmx_usb_state_t *state, int endpoint_num);
+
#ifdef __cplusplus
}
#endif
diff --git a/sys/contrib/octeon-sdk/octeon-model.h b/sys/contrib/octeon-sdk/octeon-model.h
index 3191ea4..00c0a69 100644
--- a/sys/contrib/octeon-sdk/octeon-model.h
+++ b/sys/contrib/octeon-sdk/octeon-model.h
@@ -254,7 +254,7 @@ extern "C" {
&& (((chip_model) & OCTEON_58XX_MODEL_MASK) < ((arg_model) & OCTEON_58XX_MODEL_MASK))) \
)))
-#if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__))
+#if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__)) || (defined(__FreeBSD__) && defined(_KERNEL))
/* NOTE: This for internal use only!!!!! */
static inline int __octeon_is_model_runtime__(uint32_t model)
diff --git a/sys/contrib/octeon-sdk/perfzilla_screen.png b/sys/contrib/octeon-sdk/perfzilla_screen.png
deleted file mode 100644
index 512310c..0000000
--- a/sys/contrib/octeon-sdk/perfzilla_screen.png
+++ /dev/null
Binary files differ
OpenPOWER on IntegriCloud