Commit 459e39dd authored by Wen-chien Jesse Sung's avatar Wen-chien Jesse Sung Committed by Thadeu Lima de Souza Cascardo
parent 217f8de3
The software content under this Broadcom Switch / OpenNSL is divided into two
parts, and each part has its respective license.
One portion of the software is Broadcom Switch APIs is governed by the
Apache 2.0 license. It is located at
https://github.com/Broadcom-Switch/OpenNSL/Legal/LICENSE-Apache2.
Such open source software will also expressly reference the Apache 2.0
license at the beginning of the software file.
The other portion of the software is called Broadcom Advanced Switch APIs.
This software is governed by the Broadcom Advanced Switch APIs license.
This license is set out in the
https://github.com/Broadcom-Switch/OpenNSL/Legal/LICENSE-Adv file.
Copyright 2015-2016 Broadcom Corporation. All rights reserved.
This diff is collapsed.
OpenNSL
======
OpenNSL 3.1.0.x Switch Specification and Software
Overview
========
Open Network Switch Layer (OpenNSL) is a library of network switch APIs that
is openly available for programming Broadcom network switch silicon based
platforms. These open APIs enable development of networking application
software based on Broadcom network switch architecture based platforms.
Documentation
=============
Detailed documentation can be found at http://Broadcom-Switch.github.io/OpenNSL/doc/html/index.html.
Legal
=====
Please see LEGAL_TERMS for the use of and access of the Broadcom-Switch Page
License
=======
Licenses for the software are available at the applicable level of the
software repository under the "LICENSE" file
/*********************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************
* File: commdefs.h
* Details: OpenNSL specific defines and options
*******************************************************************/
#ifndef _SAL_COMMDEFS_H
#define _SAL_COMMDEFS_H
#define LIB_DLL_EXPORTED __attribute__((__visibility__("default")))
#endif /* !_SAL_COMMDEFS_H */
This diff is collapsed.
/*********************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************
*
* \file driver.h
*
* \brief This file contains utility functions called externally
*
**********************************************************************/
#ifndef DRIVER_H
#define DRIVER_H
typedef struct opennsl_config_s
{
char *cfg_fname; /* Configuration file name along with the path */
unsigned int flags; /* OpenNSL boot up flags */
char *wb_fname; /* File to store warmboot configuration *
* along with the path */
char *rmcfg_fname; /* RM config file name along with the path */
} opennsl_init_t;
/*****************************************************************//**
* \brief Function to initialize the switch.
*
* \param init [IN] pointer to structure that contains path to
* platform customization config file, boot flags.
*
* \return OPENNSL_E_XXX OpenNSL API return code
********************************************************************/
extern int opennsl_driver_init(opennsl_init_t *init);
/**************************************************************************//**
* \brief To get platform boot flags
*
* \return unsigned int Boot flags
*****************************************************************************/
extern unsigned int opennsl_driver_boot_flags_get(void);
/*****************************************************************//**
* \brief Bringup diagnostic shell prompt and process the input commands.
*
* \return OPENNSL_E_XXX OpenNSL API return code
********************************************************************/
extern int opennsl_driver_shell();
/*****************************************************************//**
* \brief Process diagnostic shell command.
*
* \param commandBuf [IN] pointer to hold the diagnostic shell command
*
* \return OPENNSL_E_XXX OpenNSL API return code
********************************************************************/
extern int opennsl_driver_process_command(char *commandBuf);
extern char *readline(const char *prompt);
#endif /* DRIVER_H */
/*********************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************
* File: types.h
* Details: Type definitions
********************************************************************/
#ifndef _SAL_TYPES_H
#define _SAL_TYPES_H
#include <sal/compiler.h>
/*
* Define platform-independent types
*/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef DONT_CARE
#define DONT_CARE 0
#endif
#define VOL volatile
/*
* Define unsigned and signed integers with guaranteed sizes.
* Adjust if your compiler uses different sizes for short or int.
*/
typedef unsigned char uint8; /* 8-bit quantity */
typedef unsigned short uint16; /* 16-bit quantity */
typedef unsigned int uint32; /* 32-bit quantity */
typedef COMPILER_UINT64 uint64; /* 64-bit quantity */
typedef signed char int8; /* 8-bit quantity */
typedef signed short int16; /* 16-bit quantity */
typedef signed int int32; /* 32-bit quantity */
typedef COMPILER_INT64 int64; /* 64-bit quantity */
#define BITS2BYTES(x) (((x) + 7) / 8)
#define BITS2WORDS(x) (((x) + 31) / 32)
#define BYTES2BITS(x) ((x) * 8)
#define BYTES2WORDS(x) (((x) + 3) / 4)
#define WORDS2BITS(x) ((x) * 32)
#define WORDS2BYTES(x) ((x) * 4)
#define COUNTOF(ary) ((int) (sizeof (ary) / sizeof ((ary)[0])))
typedef uint32 sal_paddr_t; /* Physical address (PCI address) */
#ifdef PTRS_ARE_64BITS
typedef uint64 sal_vaddr_t; /* Virtual address (Host address) */
#define PTR_TO_INT(x) ((uint32)(((sal_vaddr_t)(x))&0xFFFFFFFF))
#define PTR_HI_TO_INT(x) ((uint32)((((sal_vaddr_t)(x))>>32)&0xFFFFFFFF))
#else
typedef uint32 sal_vaddr_t; /* Virtual address (Host address) */
#define PTR_TO_INT(x) ((uint32)(x))
#define PTR_HI_TO_INT(x) (0)
#endif
#define INT_TO_PTR(x) ((void *)((sal_vaddr_t)(x)))
#define PTR_TO_UINTPTR(x) ((sal_vaddr_t)(x))
#define UINTPTR_TO_PTR(x) ((void *)(x))
typedef union
{
uint8 u8;
uint16 u16;
uint32 u32;
uint64 u64;
sal_paddr_t paddr;
sal_vaddr_t vaddr;
void *ptr;
} any_t;
typedef uint8 sal_mac_addr_t[6]; /* MAC address */
typedef uint32 sal_ip_addr_t; /* IP Address */
/* sal_mac_addr_t mac; Just generate a list of the macs for display */
#define SAL_MAC_ADDR_LIST(mac) \
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]
#define SAL_MACADDR_STR_LEN 18 /* Formatted MAC address */
#define SAL_IPADDR_STR_LEN 16 /* Formatted IP address */
/* Adjust justification for uint32 writes to fields */
/* dst is an array name of type uint32 [] */
#define SAL_MAC_ADDR_TO_UINT32(mac, dst) do {\
(dst)[0] = (((uint32)(mac)[2]) << 24 | \
((uint32)(mac)[3]) << 16 | \
((uint32)(mac)[4]) << 8 | \
((uint32)(mac)[5])); \
(dst)[1] = (((uint32)(mac)[0]) << 8 | \
((uint32)(mac)[1])); \
} while (0)
/* Adjust justification for uint32 writes to fields */
/* src is an array name of type uint32 [] */
#define SAL_MAC_ADDR_FROM_UINT32(mac, src) do {\
(mac)[0] = (uint8) ((src)[1] >> 8 & 0xff); \
(mac)[1] = (uint8) ((src)[1] & 0xff); \
(mac)[2] = (uint8) ((src)[0] >> 24); \
(mac)[3] = (uint8) ((src)[0] >> 16 & 0xff); \
(mac)[4] = (uint8) ((src)[0] >> 8 & 0xff); \
(mac)[5] = (uint8) ((src)[0] & 0xff); \
} while (0)
/* dst is a uint64 */
#define SAL_MAC_ADDR_TO_UINT64(mac, dst) do { \
uint32 _val[2]; \
SAL_MAC_ADDR_TO_UINT32(mac, _val); \
COMPILER_64_SET(dst, _val[1], _val[0]); \
} while (0)
/* src is a uint64 */
#define SAL_MAC_ADDR_FROM_UINT64(mac, src) do { \
uint32 _val[2]; \
COMPILER_64_TO_32_LO(_val[0], src); \
COMPILER_64_TO_32_HI(_val[1], src); \
SAL_MAC_ADDR_FROM_UINT32(mac, _val); \
} while (0)
/* Adjust IP6 justification for uint32 field accesses */
/*
* These macros are used on IP6 "half addresses", being
* either the "upper" 64 bits or the "lower" 64 bits of
* an IPv6 address.
*/
/* dst is an array name of type uint32 [] */
#define SAL_IP6_ADDR_HALF_TO_UINT32(ip6, dst) do {\
(dst)[1] = (((uint32)(ip6)[0]) << 24 | \
((uint32)(ip6)[1]) << 16 | \
((uint32)(ip6)[2]) << 8 | \
((uint32)(ip6)[3])); \
(dst)[0] = (((uint32)(ip6)[4]) << 24 | \
((uint32)(ip6)[5]) << 16 | \
((uint32)(ip6)[6]) << 8 | \
((uint32)(ip6)[7])); \
} while (0)
/* src is an array name of type uint32 [] */
#define SAL_IP6_ADDR_HALF_FROM_UINT32(ip6, src) do {\
(ip6)[0] = (uint8) ((src)[1] >> 24); \
(ip6)[1] = (uint8) ((src)[1] >> 16 & 0xff); \
(ip6)[2] = (uint8) ((src)[1] >> 8 & 0xff); \
(ip6)[3] = (uint8) ((src)[1] & 0xff); \
(ip6)[4] = (uint8) ((src)[0] >> 24); \
(ip6)[5] = (uint8) ((src)[0] >> 16 & 0xff); \
(ip6)[6] = (uint8) ((src)[0] >> 8 & 0xff); \
(ip6)[7] = (uint8) ((src)[0] & 0xff); \
} while (0)
/*
* These macros are used on full 128-bit IP6 addresses.
*/
/* dst is an array name of type uint32 [] */
#define SAL_IP6_ADDR_TO_UINT32(ip6, dst) do {\
SAL_IP6_ADDR_HALF_TO_UINT32(&((ip6)[8]), (dst)); \
SAL_IP6_ADDR_HALF_TO_UINT32((ip6), &((dst)[2])); \
} while (0)
/* src is an array name of type uint32 [] */
#define SAL_IP6_ADDR_FROM_UINT32(ip6, src) do {\
SAL_IP6_ADDR_HALF_FROM_UINT32(&((ip6)[8]), (src)); \
SAL_IP6_ADDR_HALF_FROM_UINT32((ip6), &((src)[2])); \
} while (0)
/* Device bus types */
#define SAL_PCI_DEV_TYPE 0x00001 /* PCI device */
#define SAL_SPI_DEV_TYPE 0x00002 /* SPI device */
#define SAL_EB_DEV_TYPE 0x00004 /* EB device */
#define SAL_ICS_DEV_TYPE 0x00008 /* ICS device */
#define SAL_MII_DEV_TYPE 0x00010 /* MII device */
#define SAL_RCPU_DEV_TYPE 0x00020 /* RCPU device */
#define SAL_I2C_DEV_TYPE 0x00040 /* I2C device */
#define SAL_AXI_DEV_TYPE 0x00080 /* AXI device */
#define SAL_EMMI_DEV_TYPE 0x10000 /* EMMI device */
#define SAL_DEV_BUS_TYPE_MASK 0xf00ff /* Odd for historical reasons */
/* Device types */
#define SAL_SWITCH_DEV_TYPE 0x00100 /* Switch device */
#define SAL_ETHER_DEV_TYPE 0x00200 /* Ethernet device */
#define SAL_CPU_DEV_TYPE 0x00400 /* CPU device */
#define SAL_DEV_TYPE_MASK 0x00f00
/* Access types */
#define SAL_DEV_BUS_RD_16BIT 0x01000 /* 16 bit reads on bus */
#define SAL_DEV_BUS_WR_16BIT 0x02000 /* 16 bit writes on bus */
#define SAL_DEV_BUS_ALT 0x04000 /* Alternate access */
#define SAL_DEV_BUS_MSI 0x08000 /* Message-signaled interrupts */
#define SAL_DEV_FLAG_MASK 0x0f000
/* BDE reserved mask (cannot be used by SAL) */
#define SAL_DEV_BDE_MASK 0xff000000
/* Backward compatibility */
#define SAL_ET_DEV_TYPE SAL_MII_DEV_TYPE
/* Special access addresses */
#define SAL_DEV_OP_EMMI_INIT 0x0fff1000
#endif /* !_SAL_TYPES_H */
/**************************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**************************************************************************/
/*****************************************************************//**
*
*\file version.h
*
*\brief This file contains functions to get the build details
*
********************************************************************/
#ifndef _OPENNSL_VERSION_H
#define _OPENNSL_VERSION_H
#include "sal/commdefs.h"
/*****************************************************************//**
*\brief To get the OpenNSL version.
*
*\retval char* OpenNSL version
********************************************************************/
extern char* opennsl_version_get() LIB_DLL_EXPORTED;
#endif /* _OPENNSL_VERSION_H */
/*********************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************
* File: bitop.h
* Details: Bit Array Operations
*********************************************************************/
#ifndef _SHR_BITOP_H
#define _SHR_BITOP_H
#include <sal/types.h>
/* Base type for declarations */
#define SHR_BITDCL uint32
#define SHR_BITWID 32
/* (internal) Number of SHR_BITDCLs needed to contain _max bits */
#define _SHR_BITDCLSIZE(_max) (((_max) + SHR_BITWID - 1) / SHR_BITWID)
/* Size for giving to malloc and memset to handle _max bits */
#define SHR_BITALLOCSIZE(_max) (_SHR_BITDCLSIZE(_max) * sizeof (SHR_BITDCL))
/* Declare bit array _n of size _max bits */
#define SHR_BITDCLNAME(_n, _max) SHR_BITDCL _n[_SHR_BITDCLSIZE(_max)]
/* (internal) Generic operation macro on bit array _a, with bit _b */
#define _SHR_BITOP(_a, _b, _op) \
(((_a)[(_b) / SHR_BITWID]) _op (1U << ((_b) % SHR_BITWID)))
/* Specific operations */
#define SHR_BITGET(_a, _b) _SHR_BITOP(_a, _b, &)
#define SHR_BITSET(_a, _b) _SHR_BITOP(_a, _b, |=)
#define SHR_BITCLR(_a, _b) _SHR_BITOP(_a, _b, &= ~)
#define SHR_BIT_ITER(_a, _max, _b) \
for ((_b) = 0; (_b) < (_max); (_b)++) \
if ((_a)[(_b) / SHR_BITWID] == 0) \
(_b) += (SHR_BITWID - 1); \
else if (SHR_BITGET((_a), (_b)))
/* clear _c bits starting from _b in bit array _a */
extern void shr_bitop_range_clear(SHR_BITDCL *a, CONST int b, CONST int c);
#define SHR_BITCLR_RANGE(_a, _b, _c) \
(shr_bitop_range_clear(_a, _b, _c))
/* set _c bits starting from _b in bit array _a */
extern void shr_bitop_range_set(SHR_BITDCL *a, CONST int b, CONST int c);
#define SHR_BITSET_RANGE(_a, _b, _c) \
(shr_bitop_range_set(_a, _b, _c))
/*
* Copy _e bits from bit array _c offset _d to bit array _a offset _b
* There should be no overlap between source _c and desstination _a
* _a[_b:_b + _e] = _c[_d:_d + _e]
*/
extern void shr_bitop_range_copy(SHR_BITDCL *a,
CONST int b,
CONST SHR_BITDCL *c,
CONST int d,
CONST int e);
#define SHR_BITCOPY_RANGE(_a, _b, _c, _d, _e) \
(shr_bitop_range_copy(_a, _b, _c, _d, _e))
/* Result is 0 only if all bits in the range are 0 */
#define SHR_BITTEST_RANGE(_bits, _first, _bit_count, _result) \
(_result) = !(shr_bitop_range_null(_bits, _first, _bit_count))
extern void shr_bitop_range_and(CONST SHR_BITDCL *bits1,
CONST SHR_BITDCL *bits2,
CONST int first,
CONST int bit_count,
SHR_BITDCL *dest);
extern void shr_bitop_range_or(CONST SHR_BITDCL *bits1,
CONST SHR_BITDCL *bits2,
CONST int first,
CONST int bit_count,
SHR_BITDCL *dest);
extern void shr_bitop_range_xor(CONST SHR_BITDCL *bits1,
CONST SHR_BITDCL *bits2,
CONST int first,
CONST int bit_count,
SHR_BITDCL *dest);
extern void shr_bitop_range_remove(CONST SHR_BITDCL *bits1,
CONST SHR_BITDCL *bits2,
CONST int first,
CONST int bit_count,
SHR_BITDCL *dest);
#define SHR_BITAND_RANGE(_bits1, _bits2, _first, _bit_count, _dest) \
(shr_bitop_range_and(_bits1, _bits2, _first, _bit_count, _dest))
#define SHR_BITOR_RANGE(_bits1, _bits2, _first, _bit_count, _dest) \
(shr_bitop_range_or(_bits1, _bits2, _first, _bit_count, _dest))
#define SHR_BITXOR_RANGE(_bits1, _bits2, _first, _bit_count, _dest) \
(shr_bitop_range_xor(_bits1, _bits2, _first, _bit_count, _dest))
#define SHR_BITREMOVE_RANGE(_bits1, _bits2, _first, _bit_count, _dest) \
(shr_bitop_range_remove(_bits1, _bits2, _first, _bit_count, _dest))
extern void shr_bitop_range_negate(CONST SHR_BITDCL *bits1,
CONST int first,
CONST int bit_count,
SHR_BITDCL *dest);
#define SHR_BITNEGATE_RANGE(_bits1, _first, _bit_count, _dest) \
(shr_bitop_range_negate(_bits1, _first, _bit_count, _dest))
extern int shr_bitop_range_null(CONST SHR_BITDCL *a, CONST int first, CONST int bit_count);
extern int shr_bitop_range_eq(CONST SHR_BITDCL *bits1, CONST SHR_BITDCL *bits2,
CONST int first, CONST int range);
extern void shr_bitop_range_count(CONST SHR_BITDCL *bits, CONST int first,
CONST int range, int *count);
#define SHR_BITNULL_RANGE(_bits, _first, _range) \
(shr_bitop_range_null(_bits, _first, _range))
#define SHR_BITEQ_RANGE(_bits1, _bits2, _first, _range) \
(shr_bitop_range_eq(_bits1, _bits2, _first, _range))
#define SHR_BITCOUNT_RANGE(_bits, _count, _first, _range) \
shr_bitop_range_count(_bits, _first, _range, &(_count))
#endif /* !_SHR_BITOP_H */
/*********************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************
* File: error.h
* Details: This file defines common error codes to be shared
* between API layers.
*
* Its contents are not used directly by applications;
* it is used only by header files of parent APIs which
* need to define error codes.
*********************************************************************/
#ifndef _SHR_ERROR_H
#define _SHR_ERROR_H
typedef enum {
_SHR_E_NONE = 0,
_SHR_E_INTERNAL = -1,
_SHR_E_MEMORY = -2,
_SHR_E_UNIT = -3,
_SHR_E_PARAM = -4,
_SHR_E_EMPTY = -5,
_SHR_E_FULL = -6,
_SHR_E_NOT_FOUND = -7,
_SHR_E_EXISTS = -8,
_SHR_E_TIMEOUT = -9,
_SHR_E_BUSY = -10,
_SHR_E_FAIL = -11,
_SHR_E_DISABLED = -12,
_SHR_E_BADID = -13,
_SHR_E_RESOURCE = -14,
_SHR_E_CONFIG = -15,
_SHR_E_UNAVAIL = -16,
_SHR_E_INIT = -17,
_SHR_E_PORT = -18,
_SHR_E_LIMIT = -19 /* Must come last */
} _shr_error_t;
#define _SHR_ERRMSG_INIT { \
"Ok", /* E_NONE */ \
"Internal error", /* E_INTERNAL */ \
"Out of memory", /* E_MEMORY */ \
"Invalid unit", /* E_UNIT */ \
"Invalid parameter", /* E_PARAM */ \
"Table empty", /* E_EMPTY */ \
"Table full", /* E_FULL */ \
"Entry not found", /* E_NOT_FOUND */ \
"Entry exists", /* E_EXISTS */ \
"Operation timed out", /* E_TIMEOUT */ \
"Operation still running", /* E_BUSY */ \
"Operation failed", /* E_FAIL */ \
"Operation disabled", /* E_DISABLED */ \
"Invalid identifier", /* E_BADID */ \
"No resources for operation", /* E_RESOURCE */ \
"Invalid configuration", /* E_CONFIG */ \
"Feature unavailable", /* E_UNAVAIL */ \
"Feature not initialized", /* E_INIT */ \
"Invalid port", /* E_PORT */ \
"Unknown error" /* E_LIMIT */ \
}
extern char *_shr_errmsg[];
#define _SHR_ERRMSG(r) \
_shr_errmsg[(((int)r) <= 0 && ((int)r) > _SHR_E_LIMIT) ? -(r) : -_SHR_E_LIMIT]
#define _SHR_E_SUCCESS(rv) ((rv) >= 0)
#define _SHR_E_FAILURE(rv) ((rv) < 0)
#define _SHR_ERROR_TRACE(__errcode__)
#define _SHR_RETURN(__expr__) return (__expr__)
#define _SHR_E_IF_ERROR_RETURN(op) \
do { int __rv__; if ((__rv__ = (op)) < 0) { _SHR_ERROR_TRACE(__rv__); return(__rv__); } } while(0)
#define _SHR_E_IF_ERROR_NOT_UNAVAIL_RETURN(op) \
do { \
int __rv__; \
if (((__rv__ = (op)) < 0) && (__rv__ != _SHR_E_UNAVAIL)) { \
return(__rv__); \
} \
} while(0)
typedef enum {
_SHR_SWITCH_EVENT_IO_ERROR = 1,
_SHR_SWITCH_EVENT_PARITY_ERROR = 2,
_SHR_SWITCH_EVENT_THREAD_ERROR = 3,
_SHR_SWITCH_EVENT_ACCESS_ERROR = 4,
_SHR_SWITCH_EVENT_ASSERT_ERROR = 5,
_SHR_SWITCH_EVENT_MODID_CHANGE = 6,
_SHR_SWITCH_EVENT_DOS_ATTACK = 7,
_SHR_SWITCH_EVENT_STABLE_FULL = 8,
_SHR_SWITCH_EVENT_STABLE_ERROR = 9,
_SHR_SWITCH_EVENT_UNCONTROLLED_SHUTDOWN = 10,
_SHR_SWITCH_EVENT_WARM_BOOT_DOWNGRADE = 11,
_SHR_SWITCH_EVENT_TUNE_ERROR = 12,
_SHR_SWITCH_EVENT_DEVICE_INTERRUPT = 13,
_SHR_SWITCH_EVENT_ALARM = 14,
_SHR_SWITCH_EVENT_MMU_BST_TRIGGER = 15,
_SHR_SWITCH_EVENT_EPON_ALARM = 16,
_SHR_SWITCH_EVENT_RUNT_DETECT = 17,
_SHR_SWITCH_EVENT_COUNT /* last, as always */
} _shr_switch_event_t;
#endif /* !_SHR_ERROR_H */
/*********************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************
* File: gport.h
* Details: This file defines common error codes to be shared
* between API layers.
*
* Its contents are not used directly by applications;
* it is used only by header files of parent APIs which
* need to define error codes.
*********************************************************************/
#ifndef _SHR_GPORT_H
#define _SHR_GPORT_H
/*
* Defines:
* _SHR_GPORT_*
* Purpose:
* GPORT (Generic port) definitions. GPORT can be used to specify
* a {module, port} pair, trunk, and other port types.
*/
#define _SHR_GPORT_NONE (0)
#define _SHR_GPORT_INVALID (-1)
#define _SHR_GPORT_TYPE_LOCAL 1 /* Port on local unit */
#define _SHR_GPORT_TYPE_MODPORT 2 /* Module ID and port */
#define _SHR_GPORT_TYPE_TRUNK 3 /* Trunk ID */
#define _SHR_GPORT_TYPE_LOCAL_CPU 5 /* CPU destination */
#define _SHR_GPORT_TYPE_UCAST_QUEUE_GROUP 9 /* Queue Group */
#define _SHR_GPORT_TYPE_MCAST 11 /* Multicast Set */
#define _SHR_GPORT_TYPE_MCAST_QUEUE_GROUP 12 /* Multicast Queue Group */
#define _SHR_GPORT_TYPE_SCHEDULER 13 /* Scheduler */
#define _SHR_GPORT_TYPE_CHILD 20 /* Child port */
#define _SHR_GPORT_TYPE_EGRESS_GROUP 21 /* Egress group port */
#define _SHR_GPORT_TYPE_EGRESS_CHILD 22 /* Egress child port */
#define _SHR_GPORT_TYPE_EGRESS_MODPORT 23 /* Egress Mod and port */
#define _SHR_GPORT_TYPE_UCAST_SUBSCRIBER_QUEUE_GROUP 24 /* Local Queue Group */
#define _SHR_GPORT_TYPE_MCAST_SUBSCRIBER_QUEUE_GROUP 25 /* Local Multicast Queue Group */
#define _SHR_GPORT_TYPE_COSQ 30 /* cosq gport */
#define _SHR_GPORT_TYPE_PROFILE 40
#define _SHR_GPORT_TYPE_DESTMOD_QUEUE_GROUP 41 /* DMVOQ gport */
#define _SHR_COSQ_GPORT_COMMON_CORE_BITS 3
#define _SHR_COSQ_GPORT_COMMON_CORE_MASK ((1 << _SHR_COSQ_GPORT_COMMON_CORE_BITS) - 1)
#define _SHR_COSQ_GPORT_COMMON_ALL_CORES_VALUE _SHR_COSQ_GPORT_COMMON_CORE_MASK
#define _SHR_CORE_ALL -17
#define _SHR_CORE_FIELD2ID(field) ((field) != _SHR_COSQ_GPORT_COMMON_ALL_CORES_VALUE ? field : _SHR_CORE_ALL)
#define _SHR_CORE_ID2FIELD(id) ((id) != _SHR_CORE_ALL ? id : _SHR_COSQ_GPORT_COMMON_ALL_CORES_VALUE)
#define _SHR_GPORT_TYPE_SHIFT 26
#define _SHR_GPORT_TYPE_MASK 0x3f
#define _SHR_GPORT_MODID_SHIFT 11
#define _SHR_GPORT_MODID_MASK 0x7fff
#define _SHR_GPORT_PORT_SHIFT 0
#define _SHR_GPORT_PORT_MASK 0x7ff
#define _SHR_GPORT_TRUNK_SHIFT 0
#define _SHR_GPORT_TRUNK_MASK 0x3ffffff
#define _SHR_GPORT_UCAST_QUEUE_GROUP_SHIFT 0
#define _SHR_GPORT_UCAST_QUEUE_GROUP_MASK 0x3ffffff
#define _SHR_GPORT_UCAST_QUEUE_GROUP_QID_SHIFT 0
#define _SHR_GPORT_UCAST_QUEUE_GROUP_QID_MASK 0x3fff
#define _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_SHIFT 14
#define _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_MASK 0xfff
#define _SHR_GPORT_SCHEDULER_SHIFT 0
#define _SHR_GPORT_SCHEDULER_MASK 0x7fffff
#define _SHR_GPORT_SCHEDULER_CORE_SHIFT 23
#define _SHR_GPORT_SCHEDULER_CORE_MASK _SHR_COSQ_GPORT_COMMON_CORE_MASK
#define _SHR_GPORT_SCHEDULER_NODE_SHIFT 0
#define _SHR_GPORT_SCHEDULER_NODE_MASK 0xfffff
#define _SHR_GPORT_IS_MODPORT(_gport) \
(((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_MODPORT)
#define _SHR_GPORT_MODPORT_SET(_gport, _module, _port) \
((_gport) = (_SHR_GPORT_TYPE_MODPORT << _SHR_GPORT_TYPE_SHIFT) | \
(((_module) & _SHR_GPORT_MODID_MASK) << _SHR_GPORT_MODID_SHIFT) | \
(((_port) & _SHR_GPORT_PORT_MASK) << _SHR_GPORT_PORT_SHIFT))
#define _SHR_GPORT_MODPORT_MODID_GET(_gport) \
(((_gport) >> _SHR_GPORT_MODID_SHIFT) & _SHR_GPORT_MODID_MASK)
#define _SHR_GPORT_MODPORT_PORT_GET(_gport) \
(((_gport) >> _SHR_GPORT_PORT_SHIFT) & _SHR_GPORT_PORT_MASK)
#define _SHR_GPORT_IS_TRUNK(_gport) \
(((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_TRUNK)
#define _SHR_GPORT_TRUNK_SET(_gport, _trunk_id) \
((_gport) = (_SHR_GPORT_TYPE_TRUNK << _SHR_GPORT_TYPE_SHIFT) | \
(((_trunk_id) & _SHR_GPORT_TRUNK_MASK) << _SHR_GPORT_TRUNK_SHIFT))
#define _SHR_GPORT_TRUNK_GET(_gport) \
(((_gport) >> _SHR_GPORT_TRUNK_SHIFT) & _SHR_GPORT_TRUNK_MASK)
#define _SHR_GPORT_IS_SCHEDULER(_gport) \
(((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_SCHEDULER)
#define _SHR_GPORT_SCHEDULER_SET(_gport, _id) \
_SHR_GPORT_SCHEDULER_CORE_SET(_gport, _id, _SHR_CORE_ALL)
#define _SHR_GPORT_SCHEDULER_GET(_gport) \
(((_gport) >> _SHR_GPORT_SCHEDULER_SHIFT) & _SHR_GPORT_SCHEDULER_MASK)
#define _SHR_GPORT_LOCAL_CPU \
(_SHR_GPORT_TYPE_LOCAL_CPU << _SHR_GPORT_TYPE_SHIFT)
#define _SHR_GPORT_IS_UCAST_QUEUE_GROUP(_gport) \
(((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_UCAST_QUEUE_GROUP)
#define _SHR_GPORT_UCAST_QUEUE_GROUP_SET(_gport, _qid) \
_SHR_GPORT_UCAST_QUEUE_GROUP_SYSQID_SET(_gport, \
_SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_MASK, \
_qid)
#define _SHR_GPORT_UCAST_QUEUE_GROUP_SYSQID_SET(_gport, _sysport_id, _qid) \
((_gport) = (_SHR_GPORT_TYPE_UCAST_QUEUE_GROUP << _SHR_GPORT_TYPE_SHIFT) | \
(((_sysport_id) & _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_MASK) << _SHR_GPORT_UCAST_QUEUE_GROUP_SYSPORTID_SHIFT) | \
(((_qid) & _SHR_GPORT_UCAST_QUEUE_GROUP_QID_MASK) << _SHR_GPORT_UCAST_QUEUE_GROUP_QID_SHIFT))
#define _SHR_GPORT_IS_MCAST_QUEUE_GROUP(_gport) \
(((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_MCAST_QUEUE_GROUP)
#define _SHR_GPORT_IS_COSQ(_gport) \
(((_gport) >> _SHR_GPORT_TYPE_SHIFT) == _SHR_GPORT_TYPE_COSQ)
#define _SHR_GPORT_SCHEDULER_CORE_GET(_gport) \
_SHR_CORE_FIELD2ID((((_gport) >> _SHR_GPORT_SCHEDULER_CORE_SHIFT) & _SHR_GPORT_SCHEDULER_CORE_MASK))
#define _SHR_GPORT_SCHEDULER_CORE_SET(_gport, _scheduler_id, _core_id) \
((_gport) = (_SHR_GPORT_TYPE_SCHEDULER << _SHR_GPORT_TYPE_SHIFT) | \
(((_scheduler_id) & _SHR_GPORT_SCHEDULER_MASK) << _SHR_GPORT_SCHEDULER_SHIFT) | \
(((_SHR_CORE_ID2FIELD(_core_id)) & _SHR_GPORT_SCHEDULER_CORE_MASK) << _SHR_GPORT_SCHEDULER_CORE_SHIFT))
#define _SHR_GPORT_SCHEDULER_NODE_SET(_gport, _level, _node) \
((_gport) = (_SHR_GPORT_TYPE_SCHEDULER << _SHR_GPORT_TYPE_SHIFT) | \
(((_level) & _SHR_GPORT_SCHEDULER_LEVEL_MASK) << _SHR_GPORT_SCHEDULER_LEVEL_SHIFT) | \
(((_node) & _SHR_GPORT_SCHEDULER_NODE_MASK) << _SHR_GPORT_SCHEDULER_NODE_SHIFT))
#define _SHR_GPORT_SCHEDULER_NODE_GET(_gport) \
(((_gport) >> _SHR_GPORT_SCHEDULER_NODE_SHIFT) & _SHR_GPORT_SCHEDULER_NODE_MASK)
#endif /* !_SHR_GPORT_H */
This diff is collapsed.
/*********************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************
* File: phyconfig.h
* Details: This file defines PHY configuration modes.
*
* Its contents are not used directly by applications;
* it is used only by header files of parent APIs which
* need to define port modes.
*********************************************************************/
#ifndef _SHR_PHYCONFIG_H
#define _SHR_PHYCONFIG_H
#include <shared/port.h>
#include <shared/portmode.h>
#include <shared/port_ability.h>
/*
* Structure:
* _shr_phy_config_t
* Purpose:
* Defines the operating mode of a PHY.
*/
typedef struct _shr_phy_config_s {
int enable;
int preferred;
int autoneg_enable;
_shr_port_mode_t autoneg_advert;
_shr_port_ability_t advert_ability;
int force_speed;
int force_duplex;
int master;
_shr_port_mdix_t mdix;
} _shr_phy_config_t;
typedef int (*_shr_port_phy_reset_cb_t)(int unit, _shr_port_t port,
void *user_data);
typedef void (*_shr_port_medium_status_cb_t)(int unit, int port,
_shr_port_medium_t medium,
void *user_arg);
#endif /* !_SHR_PHYCONFIG_H */
/******************************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
* File: phyreg.h
* Details: This file defines common PHY register definition.
*
* Its contents are not used directly by applications;
* it is used only by header files of parent APIs which
* need to define PHY register definition.
******************************************************************************/
#ifndef _SHR_PHYREG_H
#define _SHR_PHYREG_H
#define _SHR_PORT_PHY_INTERNAL 0x00000001
#define _SHR_PORT_PHY_NOMAP 0x00000002
#define _SHR_PORT_PHY_CLAUSE45 0x00000004
#define _SHR_PORT_PHY_I2C_DATA8 0x00000008
#define _SHR_PORT_PHY_I2C_DATA16 0x00000010
#define _SHR_PORT_PHY_CLAUSE45_ADDR(_devad, _regad) \
((((_devad) & 0x3F) << 16) | \
((_regad) & 0xFFFF))
#endif /* !_SHR_PHYREG_H */
/*********************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
********************************************************************
* File: port.h
* Details: This file defines common network port parameters.
*
* Its contents are not used directly by applications;
* it is used only by header files of parent APIs
* which need to define port parameters.
* *******************************************************************/
#ifndef _SHR_PORT_H
#define _SHR_PORT_H
/*
* Typedef:
* _shr_port_t
* Purpose:
* Port number type for shared definitions
*/
#include <sal/types.h>
typedef int _shr_port_t;
/*
* Defines:
* _SHR_PORT_DUPLEX_*
* Purpose:
* Defines duplexity of a port
*/
typedef enum _shr_port_duplex_e {
_SHR_PORT_DUPLEX_HALF,
_SHR_PORT_DUPLEX_FULL,
_SHR_PORT_DUPLEX_COUNT /* last, please */
} _shr_port_duplex_t;
/*
* Defines:
* _SHR_PORT_IF_*
* Purpose:
* Defines interface type between MAC and PHY.
*/
typedef enum _shr_port_if_e {
_SHR_PORT_IF_NOCXN, /* No physical connection */
_SHR_PORT_IF_NULL, /* Pass-through connection without PHY */
_SHR_PORT_IF_MII,
_SHR_PORT_IF_GMII,
_SHR_PORT_IF_SGMII,
_SHR_PORT_IF_TBI,
_SHR_PORT_IF_XGMII,
_SHR_PORT_IF_RGMII,
_SHR_PORT_IF_RvMII,
_SHR_PORT_IF_SFI,
_SHR_PORT_IF_XFI,
_SHR_PORT_IF_KR,
_SHR_PORT_IF_KR4,
_SHR_PORT_IF_CR,
_SHR_PORT_IF_CR4,
_SHR_PORT_IF_XLAUI,
_SHR_PORT_IF_SR,
_SHR_PORT_IF_RXAUI,
_SHR_PORT_IF_XAUI,
_SHR_PORT_IF_SPAUI,
_SHR_PORT_IF_QSGMII,
_SHR_PORT_IF_ILKN,
_SHR_PORT_IF_RCY,
_SHR_PORT_IF_FAT_PIPE,
_SHR_PORT_IF_CGMII,
_SHR_PORT_IF_CAUI,
_SHR_PORT_IF_LR,
_SHR_PORT_IF_LR4,
_SHR_PORT_IF_SR4,
_SHR_PORT_IF_KX,
_SHR_PORT_IF_ZR,
_SHR_PORT_IF_SR10,
_SHR_PORT_IF_OTL,
_SHR_PORT_IF_CPU,
_SHR_PORT_IF_OLP,
_SHR_PORT_IF_OAMP,
_SHR_PORT_IF_ERP,
_SHR_PORT_IF_TM_INTERNAL_PKT,
_SHR_PORT_IF_SR2,
_SHR_PORT_IF_KR2,
_SHR_PORT_IF_CR2,
_SHR_PORT_IF_XFI2,
_SHR_PORT_IF_XLAUI2,
_SHR_PORT_IF_CR10,
_SHR_PORT_IF_KR10,
_SHR_PORT_IF_LR10,
_SHR_PORT_IF_ER,
_SHR_PORT_IF_ER2,
_SHR_PORT_IF_ER4,
_SHR_PORT_IF_CX,
_SHR_PORT_IF_CX2,
_SHR_PORT_IF_CX4,
_SHR_PORT_IF_CAUI_C2C,
_SHR_PORT_IF_CAUI_C2M,
_SHR_PORT_IF_VSR,
_SHR_PORT_IF_LR2,
_SHR_PORT_IF_LRM,
_SHR_PORT_IF_XLPPI,
_SHR_PORT_IF_COUNT /* last, please */
} _shr_port_if_t;
/*
* Defines:
* _SHR_PORT_STP_*
* Purpose:
* Defines the spanning tree states of a port.
*/
typedef enum _shr_port_stp_e {
_SHR_PORT_STP_DISABLE = 0,
_SHR_PORT_STP_BLOCK = 1,
_SHR_PORT_STP_LISTEN = 2,
_SHR_PORT_STP_LEARN = 3,
_SHR_PORT_STP_FORWARD = 4,
_SHR_PORT_STP_COUNT = 5 /* last, please */
} _shr_port_stp_t;
/*
* Defines:
* _SHR_PORT_MDIX_*
* Purpose:
* Defines the MDI crossover (MDIX) modes for the port
*/
typedef enum _shr_port_mdix_e {
_SHR_PORT_MDIX_AUTO,
_SHR_PORT_MDIX_FORCE_AUTO,
_SHR_PORT_MDIX_NORMAL,
_SHR_PORT_MDIX_XOVER,
_SHR_PORT_MDIX_COUNT /* last, please */
} _shr_port_mdix_t;
/*
* Defines:
* _SHR_PORT_MDIX_STATUS_*
* Purpose:
* Defines the MDI crossover state
*/
typedef enum _shr_port_mdix_status_e {
_SHR_PORT_MDIX_STATUS_NORMAL,
_SHR_PORT_MDIX_STATUS_XOVER,
_SHR_PORT_MDIX_STATUS_COUNT /* last, please */
} _shr_port_mdix_status_t;
/*
* Defines:
* _SHR_PORT_MEDIUM_*
* Purpose:
* Supported physical mediums
*/
typedef enum _shr_port_medium_e {
_SHR_PORT_MEDIUM_NONE = 0,
_SHR_PORT_MEDIUM_COPPER = 1,
_SHR_PORT_MEDIUM_FIBER = 2,
_SHR_PORT_MEDIUM_COUNT /* last, please */
} _shr_port_medium_t;
#endif /* !_SHR_PORT_H */
This diff is collapsed.
/*********************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************
* File: portmode.h
* Details: This file defines common network port modes.
*
* Its contents are not used directly by applications;
* it is used only by header files of parent APIs which
* need to define port modes.
********************************************************************/
#ifndef _SHR_PORTMODE_H
#define _SHR_PORTMODE_H
typedef unsigned int _shr_port_mode_t;
/*
* Defines:
* _SHR_PM_*
* Purpose:
* Defines for port modes.
*/
#define _SHR_PM_10MB_HD (1 << 0)
#define _SHR_PM_10MB_FD (1 << 1)
#define _SHR_PM_100MB_HD (1 << 2)
#define _SHR_PM_100MB_FD (1 << 3)
#define _SHR_PM_1000MB_HD (1 << 4)
#define _SHR_PM_1000MB_FD (1 << 5)
#define _SHR_PM_2500MB_HD (1 << 6)
#define _SHR_PM_2500MB_FD (1 << 7)
#define _SHR_PM_10GB_HD (1 << 8)
#define _SHR_PM_10GB_FD (1 << 9)
#define _SHR_PM_PAUSE_TX (1 << 10) /* TX pause capable */
#define _SHR_PM_PAUSE_RX (1 << 11) /* RX pause capable */
#define _SHR_PM_PAUSE_ASYMM (1 << 12) /* Asymm pause capable (R/O) */
#define _SHR_PM_TBI (1 << 13) /* TBI mode supported */
#define _SHR_PM_MII (1 << 14) /* MII mode supported */
#define _SHR_PM_GMII (1 << 15) /* GMII mode supported */
#define _SHR_PM_SGMII (1 << 16) /* SGMII mode supported */
#define _SHR_PM_XGMII (1 << 17) /* XGMII mode supported */
#define _SHR_PM_LB_MAC (1 << 18) /* MAC loopback supported */
#define _SHR_PM_LB_NONE (1 << 19) /* Useful for automated test */
#define _SHR_PM_LB_PHY (1 << 20) /* PHY loopback supported */
#define _SHR_PM_AN (1 << 21) /* Auto-negotiation */
#define _SHR_PM_3000MB_HD (1 << 29)
#define _SHR_PM_3000MB_FD (1 << 30)
#define _SHR_PM_12GB_HD (1 << 22)
#define _SHR_PM_12GB_FD (1 << 23)
#define _SHR_PM_13GB_HD (1 << 24)
#define _SHR_PM_13GB_FD (1 << 25)
#define _SHR_PM_16GB_HD (1 << 26)
#define _SHR_PM_16GB_FD (1 << 27)
#define _SHR_PM_COMBO (1 << 31) /* COMBO ports support both
* copper and fiber interfaces */
#define _SHR_PM_PAUSE (_SHR_PM_PAUSE_TX | _SHR_PM_PAUSE_RX)
#define _SHR_PM_10MB (_SHR_PM_10MB_HD | _SHR_PM_10MB_FD)
#define _SHR_PM_100MB (_SHR_PM_100MB_HD | _SHR_PM_100MB_FD)
#define _SHR_PM_1000MB (_SHR_PM_1000MB_HD | _SHR_PM_1000MB_FD)
#define _SHR_PM_2500MB (_SHR_PM_2500MB_HD | _SHR_PM_2500MB_FD)
#define _SHR_PM_3000MB (_SHR_PM_3000MB_HD | _SHR_PM_3000MB_FD)
#define _SHR_PM_10GB (_SHR_PM_10GB_HD | _SHR_PM_10GB_FD)
#define _SHR_PM_12GB (_SHR_PM_12GB_HD | _SHR_PM_12GB_FD)
#define _SHR_PM_13GB (_SHR_PM_13GB_HD | _SHR_PM_13GB_FD)
#define _SHR_PM_16GB (_SHR_PM_16GB_HD | _SHR_PM_16GB_FD)
#define _SHR_PM_SPEED_ALL (_SHR_PM_16GB | \
_SHR_PM_13GB | \
_SHR_PM_12GB | \
_SHR_PM_10GB | \
_SHR_PM_3000MB | \
_SHR_PM_2500MB | \
_SHR_PM_1000MB | \
_SHR_PM_100MB | \
_SHR_PM_10MB)
#define _SHR_PM_SPEED_MAX(m) (((m) & _SHR_PM_16GB) ? 16000 : \
((m) & _SHR_PM_13GB) ? 13000 : \
((m) & _SHR_PM_12GB) ? 12000 : \
((m) & _SHR_PM_10GB) ? 10000 : \
((m) & _SHR_PM_3000MB) ? 3000 : \
((m) & _SHR_PM_2500MB) ? 2500 : \
((m) & _SHR_PM_1000MB) ? 1000 : \
((m) & _SHR_PM_100MB) ? 100 : \
((m) & _SHR_PM_10MB) ? 10 : 0)
#define _SHR_PM_SPEED(s) ((16000 == (s)) ? _SHR_PM_16GB : \
(13000 == (s)) ? _SHR_PM_13GB : \
(12000 == (s)) ? _SHR_PM_12GB : \
(10000 == (s)) ? _SHR_PM_10GB : \
(3000 == (s)) ? _SHR_PM_3000MB : \
(2500 == (s)) ? _SHR_PM_2500MB : \
(1000 == (s)) ? _SHR_PM_1000MB : \
(100 == (s)) ? _SHR_PM_100MB : \
(10 == (s)) ? _SHR_PM_10MB : 0)
#define _SHR_PM_FD (_SHR_PM_16GB_FD | \
_SHR_PM_13GB_FD | \
_SHR_PM_12GB_FD | \
_SHR_PM_10GB_FD | \
_SHR_PM_3000MB_FD | \
_SHR_PM_2500MB_FD | \
_SHR_PM_1000MB_FD | \
_SHR_PM_100MB_FD | \
_SHR_PM_10MB_FD)
#define _SHR_PM_HD (_SHR_PM_16GB_HD | \
_SHR_PM_13GB_HD | \
_SHR_PM_12GB_HD | \
_SHR_PM_10GB_HD | \
_SHR_PM_3000MB_HD | \
_SHR_PM_2500MB_HD | \
_SHR_PM_1000MB_HD | \
_SHR_PM_100MB_HD | \
_SHR_PM_10MB_HD)
#endif /* !_SHR_PORTMODE_H */
This diff is collapsed.
/*********************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*********************************************************************
* File: switch.h
********************************************************************/
#ifndef _SHR_SWITCH_H
#define _SHR_SWITCH_H
#define _SHR_SWITCH_MAX_PIPES 4 /* Max number of pipes (or slices) */
#define _SHR_SWITCH_STABLE_NONE 0 /* No storage */
#define _SHR_SWITCH_STABLE_DEVICE_NEXT_HOP 1 /* Use next hop table */
#define _SHR_SWITCH_STABLE_DEVICE_EXT_MEM 2 /* Use external TCAM/SRAM */
#define _SHR_SWITCH_STABLE_APPLICATION 3 /* Use application storage */
#endif /* !_SHR_SWITCH_H */
/*********************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************
* File: types.h
* Details: Shared data types
*********************************************************************/
#ifndef _SHR_TYPES_H_
#define _SHR_TYPES_H_
typedef int8 _shr_dma_chan_t;
typedef enum {
_SHR_COLOR_GREEN = 0,
_SHR_COLOR_YELLOW = 1,
_SHR_COLOR_RED = 2,
_SHR_COLOR_BLACK = 3,
_SHR_COLOR_PRESERVE = 4,
_SHR_COLOR_COUNT = 5
} _shr_color_t;
typedef enum {
_SHR_FORWARDING_TYPE_L2 = 0, /* L2 switching forwarding. */
_SHR_FORWARDING_TYPE_IP4UCAST = 1, /* IPv4 Unicast Routing forwarding. */
_SHR_FORWARDING_TYPE_IP4MCAST = 2, /* IPv4 Multicast Routing forwarding. */
_SHR_FORWARDING_TYPE_IP6UCAST = 3, /* IPv6 Unicast Routing forwarding. */
_SHR_FORWARDING_TYPE_IP6MCAST = 4, /* IPv6 Multicast Routing forwarding. */
_SHR_FORWARDING_TYPE_MPLS = 5, /* MPLS Switching forwarding. */
_SHR_FORWARDING_TYPE_TRILL = 6, /* Trill forwarding. */
_SHR_FORWARDING_TYPE_RXREASON = 7, /* Forwarding according to a RxReason. */
_SHR_FORWARDING_TYPE_TRAFFIC_MANAGMENT = 8, /* Traffic Management forwarding, when
an external Packet Processor sets the
forwarding decision. */
_SHR_FORWARDING_TYPE_SNOOP = 9, /* Snooped packet. */
_SHR_FORWARDING_TYPE_FCoE = 10, /* Fiber Channel over Ethernet
forwarding. */
_SHR_FORWARDING_TYPE_COUNT = 11 /* Always Last. Not a usable value. */
} _shr_forwarding_type_t;
#endif /* _SHR_TYPES_H_ */
/******************************************************************************
*
* (C) Copyright Broadcom Corporation 2013-2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
* File: util.h
* Details: This file defines general utility routines.
*
* Its contents are not used directly by applications;
* it is used only by header files of parent APIs which
* need to access these routines.
******************************************************************************/
#ifndef _SHR_UTIL_H
#define _SHR_UTIL_H
#include <sal/types.h>
extern int _shr_popcount(unsigned int);
#endif /* !_SHR_UTIL_H */
/*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to
* you under the terms of the GNU General Public License version 2 (the
* "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
* with the following added to such license:
*
* As a special exception, the copyright holders of this software give
* you permission to link this software with independent modules, and to
* copy and distribute the resulting executable under terms of your
* choice, provided that you also meet, for each linked independent
* module, the terms and conditions of the license of that module. An
* independent module is a module which is not derived from this
* software. The special exception does not apply to any modifications
* of the software.
*/
/*
* $Id: ibde.h,v 1.27 2012/11/02 23:10:59 bpeela Exp $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
#ifndef __IBDE_H__
#define __IBDE_H__
#include <sal/types.h>
/*
* Represents a collection of devices
*/
typedef struct ibde_dev_s {
uint16 device;
uint8 rev;
sal_vaddr_t base_address;
sal_vaddr_t base_address1;
sal_vaddr_t base_address2;
} ibde_dev_t;
typedef struct ibde_s {
const char *(*name)(void);
/* Returns the number of devices available */
/* Each device is is accessed through a handle */
/* Handles are assumed to index the array of devices */
/* Support SWITCH or ETHERNET or CPU devices */
int (*num_devices)(int type);
#define BDE_ALL_DEVICES 0
#define BDE_SWITCH_DEVICES 1
#define BDE_ETHER_DEVICES 2
#define BDE_CPU_DEVICES 3
const ibde_dev_t *(*get_dev)(int d);
/*
* Get types of underlaying devices.
* A combination of bus type and functional type is returned.
* In case of bus type, support PCI and SPI device types.
* In case of functional type, specify if underlaying device is
* a switching or ethernet device.
*/
uint32 (*get_dev_type)(int d);
#define BDE_PCI_DEV_TYPE SAL_PCI_DEV_TYPE /* PCI device */
#define BDE_SPI_DEV_TYPE SAL_SPI_DEV_TYPE /* SPI device */
#define BDE_EB_DEV_TYPE SAL_EB_DEV_TYPE /* EB device */
#define BDE_ICS_DEV_TYPE SAL_ICS_DEV_TYPE /* ICS device */
#define BDE_MII_DEV_TYPE SAL_MII_DEV_TYPE /* MII device */
#define BDE_I2C_DEV_TYPE SAL_I2C_DEV_TYPE /* I2C device */
#define BDE_AXI_DEV_TYPE SAL_AXI_DEV_TYPE /* AXI device */
#define BDE_EMMI_DEV_TYPE SAL_EMMI_DEV_TYPE /* EMMI device */
#define BDE_DEV_BUS_ALT SAL_DEV_BUS_ALT /* Alternate Access */
#define BDE_DEV_BUS_MSI SAL_DEV_BUS_MSI /* Message-signaled interrupts */
#define BDE_DEV_BUS_TYPE_MASK SAL_DEV_BUS_TYPE_MASK
#define BDE_SWITCH_DEV_TYPE SAL_SWITCH_DEV_TYPE /* Switch device */
#define BDE_ETHER_DEV_TYPE SAL_ETHER_DEV_TYPE /* Ethernet device */
#define BDE_CPU_DEV_TYPE SAL_CPU_DEV_TYPE /* CPU device */
#define BDE_BYTE_SWAP 0x01000000 /* SW byte swap */
#define BDE_256K_REG_SPACE 0x20000000 /* Map 256K (v 64K) */
#define BDE_128K_REG_SPACE 0x40000000 /* Map 128K (v 64K) */
#define BDE_320K_REG_SPACE 0x80000000 /* Map 256K+64K */
/* Bus supports only 16bit reads */
#define BDE_DEV_BUS_RD_16BIT SAL_DEV_BUS_RD_16BIT
/* Bus supports only 16bit writes */
#define BDE_DEV_BUS_WR_16BIT SAL_DEV_BUS_WR_16BIT
/* Backward compatibility */
#define BDE_ET_DEV_TYPE BDE_MII_DEV_TYPE
#define BDE_DEV_MEM_MAPPED(_d) \
((_d) & (BDE_PCI_DEV_TYPE | BDE_ICS_DEV_TYPE | BDE_EB_DEV_TYPE |\
BDE_EMMI_DEV_TYPE | BDE_AXI_DEV_TYPE))
/*
* PCI Bus Access
*/
uint32 (*pci_conf_read)(int d, uint32 addr);
int (*pci_conf_write)(int d, uint32 addr, uint32 data);
void (*pci_bus_features)(int d, int *be_pio, int *be_packet,
int *be_other);
uint32 (*read)(int d, uint32 addr);
int (*write)(int d, uint32 addr, uint32 data);
uint32* (*salloc)(int d, int size, const char *name);
void (*sfree)(int d, void *ptr);
int (*sflush)(int d, void *addr, int length);
int (*sinval)(int d, void *addr, int length);
int (*interrupt_connect)(int d, void (*)(void*), void *data);
int (*interrupt_disconnect)(int d);
sal_paddr_t (*l2p)(int d, void *laddr);
uint32 *(*p2l)(int d, sal_paddr_t paddr);
/*
* SPI Access via SMP
*/
int (*spi_read)(int d, uint32 addr, uint8 *buf, int len);
int (*spi_write)(int d, uint32 addr, uint8 *buf, int len);
/* Special SPI access addresses */
#define BDE_DEV_OP_EMMI_INIT SAL_DEV_OP_EMMI_INIT
/*
* iProc register access
*/
uint32 (*iproc_read)(int d, uint32 addr);
int (*iproc_write)(int d, uint32 addr, uint32 data);
/*
* Shared memory access
*/
uint32 (*shmem_read)(int dev, uint32 addr, uint8 *buf, uint32 len);
void (*shmem_write)(int dev, uint32 addr, uint8 *buf, uint32 len);
sal_vaddr_t (*shmem_map)(int dev, uint32 addr, uint32 size);
} ibde_t;
/* System BDE */
extern ibde_t *bde;
#endif /* __IBDE_H__ */
This diff is collapsed.
/*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to
* you under the terms of the GNU General Public License version 2 (the
* "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
* with the following added to such license:
*
* As a special exception, the copyright holders of this software give
* you permission to link this software with independent modules, and to
* copy and distribute the resulting executable under terms of your
* choice, provided that you also meet, for each linked independent
* module, the terms and conditions of the license of that module. An
* independent module is a module which is not derived from this
* software. The special exception does not apply to any modifications
* of the software.
*/
/*
* $Id: sync.h,v 1.1 2005/06/25 22:26:59 mlarsen Exp $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
#ifndef _SAL_SYNC_H
#define _SAL_SYNC_H
typedef struct sal_sem_s{
char sal_opaque_type;
} *sal_sem_t;
#define sal_sem_FOREVER (-1)
#define sal_sem_BINARY 1
#define sal_sem_COUNTING 0
sal_sem_t sal_sem_create(char *desc, int binary, int initial_count);
void sal_sem_destroy(sal_sem_t b);
int sal_sem_take(sal_sem_t b, int usec);
int sal_sem_give(sal_sem_t b);
#endif /* !_SAL_SYNC_H */
/*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to
* you under the terms of the GNU General Public License version 2 (the
* "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
* with the following added to such license:
*
* As a special exception, the copyright holders of this software give
* you permission to link this software with independent modules, and to
* copy and distribute the resulting executable under terms of your
* choice, provided that you also meet, for each linked independent
* module, the terms and conditions of the license of that module. An
* independent module is a module which is not derived from this
* software. The special exception does not apply to any modifications
* of the software.
*/
/*
* $Id: thread.h,v 1.1 2005/06/25 22:26:59 mlarsen Exp $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*/
#ifndef _SAL_THREAD_H
#define _SAL_THREAD_H
#include <sal/types.h>
void sal_usleep(uint32 usec);
void sal_udelay(uint32 usec);
#endif /* !_SAL_THREAD_H */
/*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to
* you under the terms of the GNU General Public License version 2 (the
* "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
* with the following added to such license:
*
* As a special exception, the copyright holders of this software give
* you permission to link this software with independent modules, and to
* copy and distribute the resulting executable under terms of your
* choice, provided that you also meet, for each linked independent
* module, the terms and conditions of the license of that module. An
* independent module is a module which is not derived from this
* software. The special exception does not apply to any modifications
* of the software.
*/
/*
* $Id: types.h,v 1.3 2013/04/06 06:19:14 mlarsen Exp $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*
* File: types.h
* Purpose: SAL type definitions
*/
#ifndef _SAL_TYPES_H
#define _SAL_TYPES_H
/*
* Define platform-independent types
*/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef DONT_CARE
#define DONT_CARE 0
#endif
#define VOL volatile
/*
* 64-bit type
*/
#ifdef LONGS_ARE_64BITS
#define COMPILER_64BIT
#define COMPILER_UINT64 unsigned long
#define u64_H(v) (((uint32 *) &(v))[u64_MSW])
#define u64_L(v) (((uint32 *) &(v))[u64_LSW])
#else /* !LONGS_ARE_64BITS */
#define COMPILER_64BIT
#define COMPILER_UINT64 unsigned long long
#define u64_H(v) (((uint32 *) &(v))[u64_MSW])
#define u64_L(v) (((uint32 *) &(v))[u64_LSW])
#endif /* LONGS_ARE_64BITS */
/*
* Define unsigned and signed integers with guaranteed sizes.
* Adjust if your compiler uses different sizes for short or int.
*/
typedef unsigned char uint8; /* 8-bit quantity */
typedef unsigned short uint16; /* 16-bit quantity */
typedef unsigned int uint32; /* 32-bit quantity */
typedef COMPILER_UINT64 uint64; /* 64-bit quantity */
typedef signed char int8; /* 8-bit quantity */
typedef signed short int16; /* 16-bit quantity */
typedef signed int int32; /* 32-bit quantity */
#define BITS2BYTES(x) (((x) + 7) / 8)
#define BITS2WORDS(x) (((x) + 31) / 32)
#define BYTES2BITS(x) ((x) * 8)
#define BYTES2WORDS(x) (((x) + 3) / 4)
#define WORDS2BITS(x) ((x) * 32)
#define WORDS2BYTES(x) ((x) * 4)
#define COUNTOF(ary) ((int) (sizeof (ary) / sizeof ((ary)[0])))
typedef uint32 sal_paddr_t; /* Physical address (PCI address) */
#ifdef PTRS_ARE_64BITS
typedef uint64 sal_vaddr_t; /* Virtual address (Host address) */
#define PTR_TO_INT(x) ((uint32)(((sal_vaddr_t)(x))&0xFFFFFFFF))
#else
typedef uint32 sal_vaddr_t; /* Virtual address (Host address) */
#define PTR_TO_INT(x) ((uint32)(x))
#endif
#define INT_TO_PTR(x) ((void *)((sal_vaddr_t)(x)))
#define PTR_TO_UINTPTR(x) ((sal_vaddr_t)(x))
#define UINTPTR_TO_PTR(x) ((void *)(x))
typedef union
{
uint8 u8;
uint16 u16;
uint32 u32;
uint64 u64;
sal_paddr_t paddr;
sal_vaddr_t vaddr;
void *ptr;
} any_t;
/* Device bus types */
#define SAL_PCI_DEV_TYPE 0x00001 /* PCI device */
#define SAL_SPI_DEV_TYPE 0x00002 /* SPI device */
#define SAL_EB_DEV_TYPE 0x00004 /* EB device */
#define SAL_ICS_DEV_TYPE 0x00008 /* ICS device */
#define SAL_MII_DEV_TYPE 0x00010 /* MII device */
#define SAL_RCPU_DEV_TYPE 0x00020 /* RCPU device */
#define SAL_I2C_DEV_TYPE 0x00040 /* I2C device */
#define SAL_AXI_DEV_TYPE 0x00080 /* AXI device */
#define SAL_EMMI_DEV_TYPE 0x10000 /* EMMI device */
#define SAL_DEV_BUS_TYPE_MASK 0xf00ff /* Odd for historical reasons */
/* Device types */
#define SAL_SWITCH_DEV_TYPE 0x00100 /* Switch device */
#define SAL_ETHER_DEV_TYPE 0x00200 /* Ethernet device */
#define SAL_CPU_DEV_TYPE 0x00400 /* CPU device */
#define SAL_DEV_TYPE_MASK 0x00f00
/* Access types */
#define SAL_DEV_BUS_RD_16BIT 0x01000 /* 16 bit reads on bus */
#define SAL_DEV_BUS_WR_16BIT 0x02000 /* 16 bit writes on bus */
#define SAL_DEV_BUS_ALT 0x04000 /* Alternate access */
#define SAL_DEV_BUS_MSI 0x08000 /* Message-signaled interrupts */
#define SAL_DEV_FLAG_MASK 0x0f000
/* BDE reserved mask (cannot be used by SAL) */
#define SAL_DEV_BDE_MASK 0xff000000
/* Backward compatibility */
#define SAL_ET_DEV_TYPE SAL_MII_DEV_TYPE
/* Special access addresses */
#define SAL_DEV_OP_EMMI_INIT 0x0fff1000
#endif /* !_SAL_TYPES_H */
/*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to
* you under the terms of the GNU General Public License version 2 (the
* "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
* with the following added to such license:
*
* As a special exception, the copyright holders of this software give
* you permission to link this software with independent modules, and to
* copy and distribute the resulting executable under terms of your
* choice, provided that you also meet, for each linked independent
* module, the terms and conditions of the license of that module. An
* independent module is a module which is not derived from this
* software. The special exception does not apply to any modifications
* of the software.
*/
/*
* $Id: sdk_config.h,v 1.5 2012/03/02 15:13:56 yaronm Exp $
* $Copyright: (c) 2006 Broadcom Corp.
* All Rights Reserved.$
*
*
*/
#ifndef __SDK_CONFIG_H__
#define __SDK_CONFIG_H__
/*
* Include custom overrides
*/
#ifdef SDK_INCLUDE_CUSTOM_CONFIG
#include <sdk_custom_config.h>
#endif
/*
* Memory Barrier operation if required.
* Defaults to nothing.
*/
#ifndef SDK_CONFIG_MEMORY_BARRIER
#define SDK_CONFIG_MEMORY_BARRIER
#endif
#endif /* __SDK_CONFIG_H__ */
/*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to
* you under the terms of the GNU General Public License version 2 (the
* "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
* with the following added to such license:
*
* As a special exception, the copyright holders of this software give
* you permission to link this software with independent modules, and to
* copy and distribute the resulting executable under terms of your
* choice, provided that you also meet, for each linked independent
* module, the terms and conditions of the license of that module. An
* independent module is a module which is not derived from this
* software. The special exception does not apply to any modifications
* of the software.
*/
/*
* $Id: cmic.h,v 1.1 2008/10/16 09:41:21 mlarsen Exp $
* $Copyright: (c) 2005 Broadcom Corp.
* All Rights Reserved.$
*
* File: cmic.h
* Purpose: Maps out structures used for CMIC operations and
* exports routines and constants.
*/
#ifndef _SOC_CMIC_H
#define _SOC_CMIC_H
/* IRQ Register (RO) */
#define CMIC_IRQ_STAT 0x00000144
/* IRQ Mask Registers (R/W) */
#define CMIC_IRQ_MASK 0x00000148
#define CMIC_IRQ_MASK_1 0x0000006C
#define CMIC_IRQ_MASK_2 0x00000070
#endif /* !_SOC_CMIC_H */
#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to
# you under the terms of the GNU General Public License version 2 (the
# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
# with the following added to such license:
#
# As a special exception, the copyright holders of this software give
# you permission to link this software with independent modules, and to
# copy and distribute the resulting executable under terms of your
# choice, provided that you also meet, for each linked independent
# module, the terms and conditions of the license of that module. An
# independent module is a module which is not derived from this
# software. The special exception does not apply to any modifications
# of the software.
#
# $Id: Make.config,v 1.3 2011/09/08 06:37:31 mlarsen Exp $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
ifneq ($(strip $(override-target)),)
override TARGET=$(override-target)
endif
export TARGET
#
# Set up the target name, and the target base variables.
#
# target = The full name of the target such as vxworks-bmw
# targetbase = 1st part of target (e.g. vxworks)
# targetplat = 2nd part of target (e.g. x86) if any; otherwise same as 1st
#
target = ${TARGET}
targetsplt = $(subst -, , ${target}) # change hyphens to spaces
targetbase = $(word 1,${targetsplt})
targetplat = $(subst ${targetbase}-,,${TARGET})
#
# Common configuration for all platforms
# (Additional platform-dependent configurations are in Makefile.xxx)
#
#
# THIS FILE SHOULD NOT BE MODIFIED LOCALLY, to override, add a file
# $SDK/make/Make.local that sets your local settings, and/or provide
# a path to your settings using the MAKE_LOCAL variable. If
# either of these files exists, their values will override those in this makefile.
#
ifdef MAKE_LOCAL
-include ${MAKE_LOCAL}
endif
-include ${SDK}/make/Make.local
ifdef ALL_CHIPS
ROBO_CHIPS = 1
ESW_CHIPS = 1
else
ifndef ROBO_CHIPS
ESW_CHIPS = 1
endif
endif # ALL_CHIPS
#
# By default, turn off the "changing directory" message.
#
MAKEFLAGS += --no-print-directory
#
# Use gmake by default
#
include ${SDK}/make/Make.tools
include ${SDK}/make/Makefile.${target}
# use QUIET=1 to control printing of compilation lines
ifdef QUIET
Q:=@
else
Q:=
endif
#
# Suffix to add to the "target" files to allow local builds with different
# flags. Set "target_suffix" to XXX to cause the build to put built objects
# in ${target}${target_suffix}. This allows things like building a debug
# version with different flags. This may also be set in another Makefile.
#
#target_suffix :=
#
# Optional suffix to add to the build directory and output binary files
# to allow multiple builds to co-exist for various reasons.
#
#chip_suffix := -$(shell echo $(CHIP) | tr A-Z a-z)
#
# Combined suffixes
#
all_suffix = ${chip_suffix}${target_suffix}
#
# Default location to place binaries and make depend files for building
# purposes.
#
ifeq "$(HOSTTYPE)" "Windows2000PC"
BLDROOTWITHDRIVE = ${SDK}/build/${target}${all_suffix}${bldroot_suffix}
BLDROOT = ${SDK_NO_DRIVE_NAME}/build/${target}${all_suffix}${bldroot_suffix}
else # ifeq "$(HOSTTYPE)" "Windows2000PC"
ifndef SDKBUILD
SDKBUILD :=build
endif
BLDROOT = ${SDK}/${SDKBUILD}/$(if ${BLDCONFIG},${BLDCONFIG}/)${target}${all_suffix}${bldroot_suffix}
endif # ifeq "$(HOSTTYPE)" "Windows2000PC"
# This is needed because we cannot include Make.vxworks before Make.config
ifndef DEST_DIR_SUFFIX
export DEST_DIR_SUFFIX :=$(subst $(realpath $(SDK))/systems,,$(realpath $(CURDIR)/$(dir ($(firstword $(MAKEFILE_LIST))))))
ifeq ($(MAKELEVEL),0)
endif
endif
ifeq ($(DEST_DIR),)
export DEST_DIR :=${SDK}/${SDKBUILD}$(if ${BLDCONFIG},/${BLDCONFIG})$(DEST_DIR_SUFFIX)
endif
ifdef LOCALDIR
BLDDIR = ${BLDROOT}/${LOCALDIR}
ifeq "$(HOSTTYPE)" "Windows2000PC"
BLDDIRWITHDRIVE = ${BLDROOTWITHDRIVE}/${LOCALDIR}
endif
else # ifdef LOCALDIR
BLDDIR = ${BLDROOT}
ifeq "$(HOSTTYPE)" "Windows2000PC"
BLDDIRWITHDRIVE = ${BLDROOTWITHDRIVE}
endif
endif # ifdef LOCALDIR
LIBDIR = ${BLDROOT}
#
# Export directory, where build objects used by the outside world are
# placed (exported header files, libs, bins)
#
EXPDIR = ${SDK}/export/${target}${all_suffix}
#
# Standard include paths
#
INCDIR = ${SDK}/include
#
# Compilation Flags
#
# Flags may be added to (see below)
#
INCFLAGS = -I${INCDIR} -I${SDK}/systems
CFLAGS += ${INCFLAGS}
CXXFLAGS += ${INCFLAGS}
CPPFLAGS += ${INCFLAGS}
#
# Debug #ifdef control
#
# Compiling out #ifdef DEBUG code saves about 1.3% on executable size.
# It is recommended to leave debug enabled when developing applications.
#
ifndef DEBUG_IFDEFS
DEBUG_IFDEFS=TRUE
endif
ifeq ($(DEBUG_IFDEFS),TRUE)
CFLAGS += -DBROADCOM_DEBUG
CXXFLAGS += -DBROADCOM_DEBUG
CPPFLAGS += -DBROADCOM_DEBUG
endif
#
# Debug symbol information control
#
ifndef DEBUG_SYMBOLS
DEBUG_SYMBOLS=TRUE
endif
ifeq ($(DEBUG_SYMBOLS),TRUE)
CFLAGS += -g
CXXFLAGS += -g
CPPFLAGS += -g
endif
#
# If DEBUG_CFLAGS is set, add its contents to CFLAGS.
# May be useful for setting on the command line or adding to Make.local.
# Example: gmake DEBUG_CFLAGS=-save-temps system.c
#
ifneq ($(DEBUG_CFLAGS),)
CFLAGS += $(DEBUG_CFLAGS)
CXXFLAGS += $(DEBUG_CFLAGS)
CPPFLAGS += $(DEBUG_CFLAGS)
endif
#
# Optimization level
#
# Set DEBUG_OPTIMIZE to TRUE (default) to use a normal optimization
# determined by OPTFLAGS_DEFAULT in the platform Makefile.
# Set DEBUG_OPTIMIZE to FALSE to use no optimization,
# strongly recommended when using any debugger.
# Set DEBUG_OPTIMIZE to any other option string to request specific
# optimization flags (for example -O2).
#
ifndef DEBUG_OPTIMIZE
DEBUG_OPTIMIZE=TRUE
endif
ifeq ($(DEBUG_OPTIMIZE),TRUE)
OPTFLAGS += $(OPTFLAGS_DEFAULT)
else
ifneq ($(DEBUG_OPTIMIZE),FALSE)
OPTFLAGS += $(DEBUG_OPTIMIZE)
endif
endif
#
# Debug assertion control.
#
# Compiling out assert() saves about 1.1% on executable size,
# however doing so is VERY MUCH discouraged.
#
ifndef DEBUG_ASSERTS
DEBUG_ASSERTS=TRUE
endif
ifeq ($(DEBUG_ASSERTS),FALSE)
CFLAGS += -DNDEBUG
CXXFLAGS += -DNDEBUG
CPPFLAGS += -DNDEBUG
endif
#
# GCC pedantic mode.
#
ifeq ($(DEBUG_PEDANTIC),TRUE)
CFGFLAGS += -D__PEDANTIC__
CFLAGS += --pedantic
CXXFLAGS += --pedantic
endif
#
# In each directory, build a list of local sources, objects, and headers
#
LSRCS = $(wildcard *.c *.cpp *.s *.cc *.C)
LOBJS = $(addsuffix .o, $(basename ${LSRCS}))
BOBJS = $(addprefix ${BLDDIR}/,${LOBJS})
LHDRS = $(wildcard *.h *.H)
LDOTIS = $(wildcard *.i)
#
# Rule to create object file (build) directory
#
.PHONY: all install clean distclean
.PRECIOUS: ${BLDDIR}/.tree
%/.tree:
@$(ECHO) 'Creating build directory $(dir $@)'
@$(MKDIR) $(dir $@)
@$(ECHO) "Build Directory for ${LOCALDIR} Created" > $@
# Rule allowing build through CPP only, creates .E file from .c file.
%.E: %.c
$Q${CC} -E ${CFLAGS} $< | sed -e '/^ *$$/d' -e p -e d > $@
# Rule allowing build through source only, creates .s file from .c file.
%.s: %.c
$Q${CC} -S ${CFLAGS} $<
#
# Default Build rules for .c --> .o, leaving the binary in BLDDIR/X.o,
# even if file not built from directory of source.
#
ifeq ($(FAST),1)
${BLDDIR}/%.o: %.c
else
ifdef GENERATE_C_FILES
${BLDDIR}/%.o: %.c
else
${BLDDIR}/%.o: %.c
endif
endif
ifdef QUIET
@${ECHO} Compiling ${LOCALDIR}/$<
endif
ifdef LOCAL_D_FILE
$Q$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< --write-user-dependencies
-@/bin/cp $*.d $(BLDDIR)/$*.d
-@/bin/rm -f $*.d
else
$Q$(CC) -MD -MF $(BLDDIR)/$*.d $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
endif
@/bin/cp $(BLDDIR)/$*.d $(BLDDIR)/$*.tmp;\
/bin/sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' \
< $(BLDDIR)/$*.d >> $(BLDDIR)/$*.tmp; \
/bin/sed \
-e 's| \([0-9a-zA-Z]\)| '$(SDK)/$(LOCALDIR)'\/\1|g' \
-e 's|^\([0-9a-zA-Z]\)|'$(SDK)/$(LOCALDIR)'/\1|g' \
-e 's| \(\.\.\/\)| '$(SDK)/$(LOCALDIR)'\/\1|g' \
-e 's|'$(SDK)'|'$$\{SDK\}'|g' \
-e 's/\w*\/\.\.\/*//g' \
-e 's/\w*\/\.\.\/*//g' \
-e 's/\w*\/\.\.\/*//g' \
< $(BLDDIR)/$*.tmp > $(BLDDIR)/$*.P; \
/bin/rm -f $(BLDDIR)/$*.d $(BLDDIR)/$*.tmp
${BLDDIR}/%.o: %.s
ifdef QUIET
@${ECHO} Assembling ${LOCALDIR}/$<
endif
$Q${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c $< -o $@
${BLDDIR}/%.o: %.cpp
ifdef QUIET
@${ECHO} Compiling ${LOCALDIR}/$<
endif
$Q${CXX} -c ${CXXFLAGS} -c $< -o $@
${BLDDIR}/%.o: %.cc ${BLDDIR}/.tree
ifdef QUIET
@${ECHO} Compiling ${LOCALDIR}/$<
endif
$Q${CXX} -c ${CXXFLAGS} -c $< -o $@
#
# Cause "make foo.o" in any subdirectory to put the object in the build
# directory instead of the local directory.
#
%.o: ${BLDDIR}/%.o
@
#
# List of directories where built objects live.
# (we are not making the export directories for now)
#
#DIRS = ${BLDDIR} ${EXPDIR}/lib ${EXPDIR}/bin ${EXPDIR}/include
DIRS = ${BLDDIR}
ifeq (C_COMPILER,$(MAKECMDGOALS))
C_COMPILER:
@echo $(CC)
endif
#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to
# you under the terms of the GNU General Public License version 2 (the
# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
# with the following added to such license:
#
# As a special exception, the copyright holders of this software give
# you permission to link this software with independent modules, and to
# copy and distribute the resulting executable under terms of your
# choice, provided that you also meet, for each linked independent
# module, the terms and conditions of the license of that module. An
# independent module is a module which is not derived from this
# software. The special exception does not apply to any modifications
# of the software.
#
# $Id: Make.depend,v 1.14 2011/04/12 15:35:33 yshtil Exp $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
# Default rule to build dependencies. This builds a x.d file for each
# x.c file that describes the dependencies. We then conditionally include
# the generated .d files.
#
#
# If making 'clean', do not include any .d files. If they are included,
# gmake intrinsically tries to remake them all.
#
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
ZFS :=$(wildcard *.zf)
ZFC := $(ZFS:.zf=.c)
ifdef GENERATE_C_FILES
ifndef GEN_INCS
$(error "GEN_INCS was not defined")
endif
ZF_GEN = ${SDK}/tools/zFrameCodeGen.pl
# 1=.zf
define ZFS_RULE
$(1:.zf=Console.c) : $(1:.zf=.c)
@echo updated $$@ from $$?
$(1:.zf=.c) : $(1) $(ZF_GEN)
@$(PERL) $(ZF_GEN) -s -z . -p . -g $1 -t c
@echo generated ${LOCALDIR}/$$@ from $(1)
@mv $$(*F).cx $$@
@if [ -e $$(*F)Console.cx ] ; then \
mv $$(*F)Console.cx $$(*F)Console.c; \
echo Created $$(*F)Console.c ;\
fi
@if [ -e $$(*F)Console.hx ] ; then \
echo Created $(GEN_INCS)/$$(*F)Console.hx ;\
mv $$(*F)Console.hx $(GEN_INCS)/ ; \
fi
@mv $$(*F).hx $(GEN_INCS)/
endef
$(foreach zf,$(ZFS),$(eval $(call ZFS_RULE,$(zf))))
${BLDDIR}/%.P : ${BLDDIR}/.tree %.c
.PHONY: GENFILES
GENFILES: $(ZFC)
$(BOBJS) : $(ZFC)
else
#
# Attempt to build the depend files. If it fails, the depend file is
# removed so that it is not included in later builds.
#
${BLDDIR}/%.P : %.c ${BLDDIR}/.tree
@$(ECHO) Dependencies for ${LOCALDIR}/$<
${BLDDIR}/%.P : %.cc ${BLDDIR}/.tree
@$(ECHO) Dependencies for ${LOCALDIR}/$<
endif
#
# If there are C or C++ files in this directory, include the
# depend files for them.
#
ifeq ($(findstring _COMPILER,$(MAKECMDGOALS))$(findstring variable,$(MAKECMDGOALS)),)
ifneq ($(strip ${LSRCS}),)
ifneq (,$(findstring .o,$(MAKECMDGOALS)))
-include $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.P)) $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.sig))
else
-include $(addprefix ${BLDDIR}/,$(addsuffix .P,$(basename $(LSRCS)))) $(addprefix ${BLDDIR}/,$(addsuffix .sig,$(basename $(LSRCS))))
endif
endif
endif
endif # !CLEANING
clean_d::
ifdef QUIET
@$(ECHO) Cleaning dependencies for ${LOCALDIR}
endif
ifdef GENERATE_C_FILES
$Q$(RM) $(ZFC:%=$(SDK)/$(LOCALDIR)/%) $(ZFC:%.c=$(SDK)/$(LOCALDIR)/%Console.c)
endif
clean:: clean_d
#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to
# you under the terms of the GNU General Public License version 2 (the
# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
# with the following added to such license:
#
# As a special exception, the copyright holders of this software give
# you permission to link this software with independent modules, and to
# copy and distribute the resulting executable under terms of your
# choice, provided that you also meet, for each linked independent
# module, the terms and conditions of the license of that module. An
# independent module is a module which is not derived from this
# software. The special exception does not apply to any modifications
# of the software.
#
# $Id: Make.kernlib,v 1.7 2011/08/21 07:18:42 bhanup Exp $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
# Make rules/targets for handling libraries
.SECONDARY:: ${BOBJS}
targetlibsoname = ${lib}.so.${SHAREDLIBVER}
targetlibrealname = ${targetlibsoname}
targetlibso = ${LIBDIR}/${targetlibrealname}
ifeq ($(TOOLS),Borland)
LIBSUFFIX=lib
${LIBDIR}/%.lib: ${BORLAND_BOBJS}
$(RM) $@
$(FOREACH) -subdir "$(LIBDIR)" \
"tlib $@ $(foreach obj, $(BORLAND_LOBJS), +-$(obj))"
else # !Borland
LIBSUFFIX=a
${LIBDIR}/%.a: ${BOBJS}
ifdef QUIET
@$(ECHO) Building library $(notdir $@)
endif
$Q$(RM) $@
$Q$(AR) ${ARFLAGS} $@ $(sort ${BOBJS})
ifeq ($(LINUX_MAKE_SHARED_LIB),1)
$(CC) -shared -Wl,-soname,${targetlibsoname} -o ${targetlibso} ${BOBJS} -lc
endif # LINUX_MAKE_SHARED_LIB #
endif # !Borland
targetlib = ${LIBDIR}/${lib}.${LIBSUFFIX}
all:: ${BLDDIR}/.tree ${targetlib}
install:: all
clean::
ifdef QUIET
@$(ECHO) Cleaning objects for ${LOCALDIR} and ${lib}
endif
$Q$(RM) ${BOBJS}
$Q$(RM) ${targetlib}
distclean:: clean
#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to
# you under the terms of the GNU General Public License version 2 (the
# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
# with the following added to such license:
#
# As a special exception, the copyright holders of this software give
# you permission to link this software with independent modules, and to
# copy and distribute the resulting executable under terms of your
# choice, provided that you also meet, for each linked independent
# module, the terms and conditions of the license of that module. An
# independent module is a module which is not derived from this
# software. The special exception does not apply to any modifications
# of the software.
#
# $Id: Make.lib,v 1.14 2010/11/18 00:27:38 yshtil Exp $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
# Make rules/targets for handling libraries
.SECONDARY:: ${BOBJS}
BOBJS_FAST = ${BOBJS}
BOBJS_MAKE_CMD =
ifeq ($(FAST),1)
ifneq ($(strip $(BOBJS)),)
BOBJS_FAST =
BOBJS_ARGS = -j9
BOBJS_MAKE_CMD = pwd && make LSRUN=$(SDK)/tools/lsrun.pl $(BOBJS_ARGS) ${BOBJS}
endif
endif
ifeq ($(TOOLS),Borland)
LIBSUFFIX=lib
${LIBDIR}/%.lib: ${BORLAND_BOBJS}
$(RM) $@
$(FOREACH) -subdir "$(LIBDIR)" \
"tlib $@ $(foreach obj, $(BORLAND_LOBJS), +-$(obj))"
else # !Borland
ifeq ($(LINUX_MAKE_SHARED_LIB),1)
LIBSUFFIX=so.${SHAREDLIBVER}
else
LIBSUFFIX=a
endif
targetlib = ${LIBDIR}/${lib}.${LIBSUFFIX}
all:: ${BLDDIR}/.tree ${targetlib}
${LIBDIR}/%.${LIBSUFFIX}: ${BOBJS_FAST}
$(BOBJS_MAKE_CMD)
ifdef QUIET
@$(ECHO) Building library $(notdir $@)
endif
$Q$(RM) $@
ifeq ($(LINUX_MAKE_SHARED_LIB),1)
$(CC) -shared -Wl,-soname,${lib}.${LIBSUFFIX} -o ${targetlib} ${BOBJS} -lc
else
${Q}cd $(dir $(word 1,${BOBJS}));$(AR) ${ARFLAGS} $@ $(sort $(notdir ${BOBJS}))
endif
endif # !Borland
install:: all
clean::
ifdef QUIET
@$(ECHO) Cleaning objects for ${LOCALDIR} and ${lib}
endif
$Q$(RM) ${BOBJS}
$Q$(RM) ${targetlib}
distclean:: clean
#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to
# you under the terms of the GNU General Public License version 2 (the
# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
# with the following added to such license:
#
# As a special exception, the copyright holders of this software give
# you permission to link this software with independent modules, and to
# copy and distribute the resulting executable under terms of your
# choice, provided that you also meet, for each linked independent
# module, the terms and conditions of the license of that module. An
# independent module is a module which is not derived from this
# software. The special exception does not apply to any modifications
# of the software.
#
#
# $Id: Make.linux,v 1.18 2012/03/02 15:09:07 yaronm Exp $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
# Common make targets for Linux user and kernel builds included by top
# level Linux makefiles
#
# Variables referenced:
#
# LINUX_MAKE_FLAGS
# Additional flags passed to Make
#
# LINUX_MAKE_USER
# Defined: user build
# Undefined: kernel build
#
# LINUX_MAKE_DIR
# Common makefile location, if it is not ../common
#
#
export DEST_DIR_SUFFIX :=$(subst $(realpath $(SDK))/systems,,$(realpath $(CURDIR)/$(dir ($(firstword $(MAKEFILE_LIST))))))
ifeq (,$(kernel_version))
kernel_version=2_4
endif
ifndef LINUX_MAKE_SHARED_LIB
LINUX_MAKE_SHARED_LIB=0
endif
ifeq (,$(SHAREDLIBVER))
SHAREDLIBVER=1
endif
ifndef LINUX_MAKE_DIR
ifdef LINUX_MAKE_USER
LINUX_MAKE_DIR := $(SDK)/systems/linux/user/common
else
LINUX_MAKE_DIR := $(SDK)/systems/linux/kernel/common
endif
endif
ifdef LINUX_MAKE_USER
CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \
platform=$(platform) bldroot_suffix=/$(platform) kernel_version=$(kernel_version) \
LINUX_MAKE_SHARED_LIB=$(LINUX_MAKE_SHARED_LIB) SHAREDLIBVER=$(SHAREDLIBVER)
else
export LINUX_MAKE_KERNEL := 1
CMD = $(LINUX_MAKE_FLAGS) -C $(LINUX_MAKE_DIR) \
platform=$(platform) kernel_version=$(kernel_version)
endif
ifneq (,$(MIPS_TOOLS_DIR))
CMD += MIPS_TOOLS_DIR=$(MIPS_TOOLS_DIR)
endif
ifneq (,$(MIPS_CROSS_COMPILE))
CMD += MIPS_CROSS_COMPILE=$(MIPS_CROSS_COMPILE)
endif
ifneq (,$(LINUX_INCLUDE))
CMD += LINUX_INCLUDE=$(LINUX_INCLUDE)
endif
# gmake does not understand $(CMD) to be a submake
# options are to +$(CMD) or $(MAKE) $(CMD)
# trying the latter
build:
$(MAKE) $(CMD)
DELIVER clean C_COMPILER CXX_COMPILER variable mod bcm user:
$(MAKE) $(CMD) $@
clean_d: clean
distclean:
$(MAKE) $(CMD) $@
.PHONY: build clean distclean clean_d DELIVER variable mod bcm user
#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to
# you under the terms of the GNU General Public License version 2 (the
# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
# with the following added to such license:
#
# As a special exception, the copyright holders of this software give
# you permission to link this software with independent modules, and to
# copy and distribute the resulting executable under terms of your
# choice, provided that you also meet, for each linked independent
# module, the terms and conditions of the license of that module. An
# independent module is a module which is not derived from this
# software. The special exception does not apply to any modifications
# of the software.
#
# $Id: Make.subdirs,v 1.8 2010/06/22 15:23:57 alai Exp $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
# Make rules/targets for handling subdirectories
.PHONY: ${subdirs}
all:: ${subdirs}
ifdef QUIET
@$(ECHO) Subdirectory build for ${subdirs}
endif
${subdirs}::
$Q$(MAKE) -C $@ kernel_version=$(kernel_version) LINUX_MAKE_SHARED_LIB=${LINUX_MAKE_SHARED_LIB} SHAREDLIBVER=${SHAREDLIBVER}
ifeq "$(HOSTTYPE)" "Windows2000PC"
clean clean_d install distclean::
ifdef QUIET
@$(ECHO) Subdirectory $@ for ${subdirs}
endif
$Q$(FOREACH) "$(subdirs)" "${MAKE} -C ## $@"
else
clean clean_d install distclean::
ifdef QUIET
@$(ECHO) Subdirectory $@ for ${subdirs}
endif
@(for name in $(subdirs); do $(MAKE) -C $$name $@; done)
endif
#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to
# you under the terms of the GNU General Public License version 2 (the
# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
# with the following added to such license:
#
# As a special exception, the copyright holders of this software give
# you permission to link this software with independent modules, and to
# copy and distribute the resulting executable under terms of your
# choice, provided that you also meet, for each linked independent
# module, the terms and conditions of the license of that module. An
# independent module is a module which is not derived from this
# software. The special exception does not apply to any modifications
# of the software.
#
# $Id: Make.tools,v 1.2 2011/09/06 21:30:39 yshtil Exp $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
SYSNAME := $(shell uname -s)
HCC ?=/usr/bin/gcc
SED = /bin/sed
COMPRESS = /usr/bin/compress
PERL = /usr/bin/perl
LN = /bin/ln
HOSTTYPE= i386-linux
#
# Platform Independent
#
MKTOOL = $(PERL) ${SDK}/tools/mktool.pl
RM = $(MKTOOL) -rm
MKDIR = $(MKTOOL) -md
FOREACH = $(MKTOOL) -foreach
CP = $(MKTOOL) -cp
MAKEDEP = $(MKTOOL) -dep
ECHO = $(MKTOOL) -echo
MKBEEP = ${MKTOOL} -beep
#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to
# you under the terms of the GNU General Public License version 2 (the
# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
# with the following added to such license:
#
# As a special exception, the copyright holders of this software give
# you permission to link this software with independent modules, and to
# copy and distribute the resulting executable under terms of your
# choice, provided that you also meet, for each linked independent
# module, the terms and conditions of the license of that module. An
# independent module is a module which is not derived from this
# software. The special exception does not apply to any modifications
# of the software.
#
# $Id: Makefile.linux-kmodule-3_6,v 1.2 2013/01/10 01:00:49 bpeela Exp $
# $Copyright: (c) 2006 Broadcom Corp.
# All Rights Reserved.$
# Due to the extensive use of driver libraries, the SDK usually builds
# kernel modules from a precompiled object. To avoid various warnings
# and conflicts, the pre-compiled object must be named differently
# from the target module, and the object file itself should be
# appended with "_shipped".
# If a module exports any symbols, then the exporting source file must
# be compiled within the kernel source tree for correct generation of
# module symbol versions. The symbol source file should be passed to
# this Makefile via the MODULE_SYM variable.
MODULE := $(MOD_NAME).o
KMODULE := $(MOD_NAME).ko
PRE_COMPILED_OBJ := obj_$(MOD_NAME).o
obj-m := $(MODULE)
$(MOD_NAME)-y := $(MODULE_SYM) $(PRE_COMPILED_OBJ)
ifeq (,$(CROSS_COMPILE))
export CROSS_COMPILE
endif
SAVE_CFLAGS := ${CFLAGS}
include $(SDK)/make/Make.config
PWD := $(shell pwd)
ifneq ($(ARCH),)
# ELDK does not seem to `automatically' define ARCH where other gccs may
A := ARCH=$(ARCH)
export ARCH
endif
# Standard SDK include path for building source files that export
# kernel symbols.
override EXTRA_CFLAGS = -I${SDK}/include -I${SDK}/systems/linux/kernel/modules/include -I${SDK}/systems/bde/linux/include
# The precopiled object needs a dummy command file to avoid warnings
# from the Kbuild scripts (modpost stage).
# Kernels before 2.6.17 do not support external module symbols files,
# so we create a dummy to prevent build failures.
$(KMODULE):
rm -f *.o *.ko .*.cmd
rm -fr .tmp_versions
ln -s $(LIBDIR)/$(MODULE) $(PRE_COMPILED_OBJ)_shipped
echo "suppress warning" > .$(PRE_COMPILED_OBJ).cmd
$(MAKE) -C $(KERNDIR) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) modules
if [ ! -f Module.symvers ]; then echo "old kernel (pre-2.6.17)" > Module.symvers; fi
cp -f $(KMODULE) $(LIBDIR)
rm -f $(PRE_COMPILED_OBJ)_shipped
EXTRA_CFLAGS = $(CFLAGS)
CFLAGS := ${SAVE_CFLAGS}
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment