diff --git a/bcm/bcm.c b/bcm/bcm.c index 589bfc357442361a0730b6aaa8713a4c8201ba4c..2f79f0e62a244a120a03cf32276bf907bd457032 100644 --- a/bcm/bcm.c +++ b/bcm/bcm.c @@ -192,7 +192,7 @@ int bcm_eth_poweron_phy(const char *name, struct eth_phy p) struct ethctl_data data; memset(&data, 0, sizeof(struct ethctl_data)); - data.op = ETHSETSPOWERUP; + data.op = ETHSETPHYPWRON; if (eth_ioctl(name, SIOCETHSWCTLOPS, &data, sizeof(struct ethswctl_data)) < 0) @@ -206,7 +206,7 @@ int bcm_eth_poweroff_phy(const char *name, struct eth_phy p) struct ethctl_data data; memset(&data, 0, sizeof(struct ethctl_data)); - data.op = ETHSETSPOWERDOWN; + data.op = ETHSETPHYPWROFF; if (eth_ioctl(name, SIOCETHSWCTLOPS, &data, sizeof(struct ethswctl_data)) < 0) diff --git a/bcm/bcmnet.h b/bcm/bcmnet.h index aff0271cfaa0adc14b7c4892cb297702876e8fa0..ae67bd6c4dc0ab7db0cd83d7c1986b8e2b8b868b 100644 --- a/bcm/bcmnet.h +++ b/bcm/bcmnet.h @@ -41,14 +41,31 @@ extern "C" { #endif #include <linux/sockios.h> -//#include "skb_defines.h" -//#include "bcmPktDma_defines.h" +#if defined(CONFIG_COMPAT) +#include <linux/compat.h> +#endif +#include "skb_defines.h" +#include "bcmPktDma_defines.h" #include "bcmtypes.h" +#define LINKSTATE_DOWN 0 +#define LINKSTATE_UP 1 + #ifndef IFNAMSIZ #define IFNAMSIZ 16 #endif +/*---------------------------------------------------------------------*/ +/* Ethernet Switch Type */ +/*---------------------------------------------------------------------*/ +#define ESW_TYPE_UNDEFINED 0 +#define ESW_TYPE_BCM5325M 1 +#define ESW_TYPE_BCM5325E 2 +#define ESW_TYPE_BCM5325F 3 +#define ESW_TYPE_BCM53101 4 + +#define ETHERNET_ROOT_DEVICE_NAME "bcmsw" + /* * Ioctl definitions. */ @@ -80,15 +97,33 @@ enum { ETHGETNUMRXDMACHANNELS, ETHSETNUMRXDMACHANNELS, ETHGETSOFTWARESTATS, - ETHSETSPOWERUP, - ETHSETSPOWERDOWN, ETHGETMIIREG, ETHSETMIIREG, ETHSETLINKSTATE, ETHGETCOREID, - ETHINITWAN, - ETHCREATEEPONVPORT, - ETHCREATEEPONAEVPORT + ETHGETPHYEEE, + ETHSETPHYEEEON, + ETHSETPHYEEEOFF, + ETHGETPHYEEERESOLUTION, + ETHSETPHYWOLSLEEP, + ETHGETPHYAPD, + ETHSETPHYAPDON, + ETHSETPHYAPDOFF, + ETHGETPHYPWR, + ETHSETPHYPWRON, + ETHSETPHYPWROFF, + ETHMOVESUBPORT, + ETHPHYMAP, + ETHGETPHYID, + ETHG9991CARRIERON, + ETHG9991CARRIEROFF, + ETHCDGET, + ETHCDSET, + ETHCDRUN, + ETHGETSFPINFO, + ETHPHYMACSEC, + ETHWIRESPEEDGET, + ETHWIRESPEEDSET, }; struct ethctl_data { @@ -100,11 +135,55 @@ struct ethctl_data { int ret_val; /* value for set operations */ int val; + int sub_port; unsigned int phy_addr; unsigned int phy_reg; /* flags to indicate to ioctl functions */ unsigned int flags; - char ifname[IFNAMSIZ]; + union { + char ifname[IFNAMSIZ]; +#define ETHCTL_FLAG_MPMAC_SET (1<<0) + char mpmac[6]; + }; + BCM_IOC_PTR(char *, buf); + int buf_size; + int pair_len[4]; +}; + +typedef enum { + SFP_TYPE_XPON, + SFP_TYPE_ETHERNET, + SFP_TYPE_UNKNOWN, + SFP_TYPE_NOT_ETHERNET, /* Active Ethernet Port not defined in board paramters */ + SFP_TYPE_NO_MODULE, +} sfp_type_t; + +enum { + CD_INVALID, + CD_OK, + CD_OPEN, + CD_INTRA_SHORT, + CD_INTER_SHORT, + CD_ENABLED, + CD_DISABLED, + CD_NOT_SUPPORTED, + CD_ALL_PAIR_OK=0x1111, + CD_ALL_PAIR_OPEN=0x2222, +}; +#define CD_CODE_PAIR_GET(v, p) (((v)>>((p)*4))&0xf) +#define CD_CODE_PAIR_SET(v, p) (((v)&0xf)<<((p)*4)) + +/* Flags for Cable Diagnostic */ +#define INTERFACE_NEXT (1<<0) +#define CD_LINK_UP (1<<1) +/* ethctl ret_val definitions */ +enum { + ETHCTL_RET_OK = 0, + ETHMOVESUBPORT_RET_INVALID_EP, + ETHMOVESUBPORT_RET_SRCDEV_UP, + ETHMOVESUBPORT_RET_DSTDEV_UP, + ETHMOVESUBPORT_RET_MAC2MAC, + ETHMOVESUBPORT_RET_NOT_MOVEABLE, }; /* PHY type */ @@ -116,7 +195,385 @@ enum { ETHCTL_FLAG_ACCESS_SERDES = (1<<3), ETHCTL_FLAG_ACCESS_SERDES_POWER_MODE = (1<<4), ETHCTL_FLAG_ACCESS_32BIT = (1<<5), + ETHCTL_FLAG_ACCESS_10GSERDES = (1<<6), + ETHCTL_FLAG_ACCESS_10GPCS = (1<<7), + ETHCTL_FLAG_ACCESS_SILENT_START = (1<<8), +}; +#define ETHCTL_FLAG_ANY_SERDES (ETHCTL_FLAG_ACCESS_SERDES|ETHCTL_FLAG_ACCESS_10GSERDES) + +enum ethctl_error { + ETHCTL_ERROR_POWER_SAVING_DOWN = -100, + ETHCTL_ERROR_POWER_ADMIN_DOWN = -101, +}; + +enum { + SERDES_NO_POWER_SAVING, + SERDES_BASIC_POWER_SAVING, + SERDES_ADVANCED_POWER_SAVING, + SERDES_FORCE_OFF, + SERDES_POWER_MODE_MAX}; + +/* Various operations through the SIOCGPONIF */ +enum { + GETFREEGEMIDMAP = 0, + SETGEMIDMAP, + GETGEMIDMAP, + CREATEGPONVPORT, + DELETEGPONVPORT, + DELETEALLGPONVPORTS, + SETMCASTGEMID, +}; + +struct interface_data{ + char ifname[IFNAMSIZ]; + int switch_port_id; +}; + +/* Definition for IFREQ extension structure to + support more IFREQs than kernel allocated 16 types */ +struct ifreq_ext { + int opcode; + /* add union struct for different opcode's data below if needed */ + union + { + struct { + BCM_IOC_PTR(char *, stringBuf); + int bufLen; + }; + }; }; +typedef struct ifreq_ext ifreq_ext_t; + +/* Definition for opcode */ +enum +{ + SIOCGPORTWANONLY, + SIOCGPORTWANPREFERRED, + SIOCGPORTLANONLY, +}; + +/* The enet driver subdivides queue field (mark[4:0]) in the skb->mark into + priority and channel */ +/* priority = queue[2:0] (=>mark[2:0]) */ +#define SKBMARK_Q_PRIO_S (SKBMARK_Q_S) +#define SKBMARK_Q_PRIO_M (0x07 << SKBMARK_Q_PRIO_S) +#define SKBMARK_GET_Q_PRIO(MARK) \ + ((MARK & SKBMARK_Q_PRIO_M) >> SKBMARK_Q_PRIO_S) +#define SKBMARK_SET_Q_PRIO(MARK, Q) \ + ((MARK & ~SKBMARK_Q_PRIO_M) | (Q << SKBMARK_Q_PRIO_S)) +/* channel = queue[4:3] (=>mark[4:3]) */ +#define SKBMARK_Q_CH_S (SKBMARK_Q_S + 3) +#define SKBMARK_Q_CH_M (0x03 << SKBMARK_Q_CH_S) +#define SKBMARK_GET_Q_CHANNEL(MARK) ((MARK & SKBMARK_Q_CH_M) >> SKBMARK_Q_CH_S) +#define SKBMARK_SET_Q_CHANNEL(MARK, CH) \ + ((MARK & ~SKBMARK_Q_CH_M) | (CH << SKBMARK_Q_CH_S)) + +#define SPEED_10MBIT 10000000 +#define SPEED_100MBIT 100000000 +#define SPEED_200MBIT 200000000 +#define SPEED_1000MBIT 1000000000 +#define SPEED_2500MBIT 2500000000u +#define SPEED_5000MBIT 5000000000ull +#define SPEED_10000MBIT 10000000000ull +#define SPEED_DOWN 0 + +#define BCMNET_DUPLEX_HALF 0 +#define BCMNET_DUPLEX_FULL 1 + +// Use for Auto negotiation capability +#define AN_10M_HALF 0x0001 +#define AN_10M_FULL 0x0002 +#define AN_100M_HALF 0x0004 +#define AN_100M_FULL 0x0008 +#define AN_1000M_HALF 0x0010 +#define AN_1000M_FULL 0x0020 +#define AN_2500 0x0040 +#define AN_5000 0x0080 +#define AN_10000 0x0100 +#define AN_AUTONEG 0x0200 +#define AN_FLOW_CONTROL 0x0400 +#define AN_FLOW_CONTROL_ASYM 0x0800 +#define AN_REPEATER 0x1000 + +#define AUTONEG_CTRL_MASK 0x01 +#define AUTONEG_RESTART_MASK 0x02 + + +typedef struct IoctlMibInfo +{ + uint32 ulIfLastChange; + uint64 ulIfSpeed; + uint32 ulIfDuplex; +} IOCTL_MIB_INFO, *PIOCTL_MIB_INFO; + + +#define MIRROR_INTF_SIZE 32 +#define MIRROR_DIR_IN 0 +#define MIRROR_DIR_OUT 1 +#define MIRROR_DISABLED 0 +#define MIRROR_ENABLED 1 + +typedef struct _MirrorCfg +{ + char szMonitorInterface[MIRROR_INTF_SIZE]; + char szMirrorInterface[MIRROR_INTF_SIZE]; + int nDirection; + int nStatus; +#if defined(DMP_X_ITU_ORG_GPON_1) && defined(CONFIG_BCM_MAX_GEM_PORTS) + /* +1 is when CONFIG_BCM_MAX_GEM_PORTS is not a multiple of 8 */ + unsigned char nGemPortMaskArray[(CONFIG_BCM_MAX_GEM_PORTS/8)+1]; +#endif +} MirrorCfg ; + +int sfp_i2c_phy_read( int reg, int *data); +int sfp_i2c_phy_write( int reg, int data); + +int bcmeapi_init_wan(void); + +/* VLAN TPIDs that need to be checked + ETH_P_8021Q 0x8100 + ETH_P_8021AD 0x88A8 + ETH_P_QINQ1 0x9100 + ETH_P_QINQ2 0x9200 + */ +#define BCM_VLAN_TPID_CHECK(x) ( (x) == htons(ETH_P_8021Q) \ + || (x) == htons(ETH_P_8021AD) \ + /* || (x) == htons(ETH_P_QINQ1) */\ + /* || (x) == htons(ETH_P_QINQ2) */) + +#define check_arp_lcp_pkt(pkt_p, ret_val) { \ + unsigned char l3_offset = sizeof(struct ethhdr); \ + struct vlan_hdr *vlanhdr = (struct vlan_hdr *)(pkt_p + l3_offset - sizeof(struct vlan_hdr)); \ + ret_val = 0; \ + /* Skip over all the VLAN Tags */ \ + while ( BCM_VLAN_TPID_CHECK(vlanhdr->h_vlan_encapsulated_proto) ) \ + { \ + vlanhdr = (struct vlan_hdr *)(pkt_p + l3_offset); \ + l3_offset += sizeof(struct vlan_hdr); \ + } \ + if (vlanhdr->h_vlan_encapsulated_proto == htons(ETH_P_ARP)) \ + { \ + ret_val = 1; \ + } \ + else if ( vlanhdr->h_vlan_encapsulated_proto == htons(ETH_P_PPP_DISC) ) \ + { \ + ret_val = 1; \ + } \ + else if ( vlanhdr->h_vlan_encapsulated_proto == htons(ETH_P_PPP_SES) ) \ + { \ + struct pppoe_hdr *pppoe = (struct pppoe_hdr *)(pkt_p + l3_offset); \ + \ + if ( ! (pppoe->tag[0].tag_type == htons(PPP_IP) || pppoe->tag[0].tag_type == htons(PPP_IPV6)) ) \ + { \ + ret_val = 1; \ + } \ + } \ + } + +enum Bcm63xxEnetStats { + ET_TX_BYTES = 0, + ET_TX_PACKETS, + ET_TX_ERRORS, + ET_TX_CAPACITY, + ET_RX_BYTES, + ET_RX_PACKETS, + ET_RX_ERRORS, + ET_MAX +}; + +typedef struct mac_limit_arg{ + uint32 cmd; + uint32 val; + union { + void *mac_limit; + char rsvd[8]; + }; +}mac_limit_arg_t; + +enum mac_limit_cmd{ + MAC_LIMIT_IOCTL_GET = 0, + MAC_LIMIT_IOCTL_SET, + MAC_LIMIT_IOCTL_CLR, + MAC_LIMIT_IOCTL_EN +}; + +enum mac_limit_set_op{ + MAC_LIMIT_SET_MAX = 0, + MAC_LIMIT_SET_MIN, +}; + +/*------------------------------------------------------------------------*/ +/* BCM net character device for ioctl to get/set netdev BRCM private info */ +/*------------------------------------------------------------------------*/ +#define BCMNET_DRV_MAJOR 377 +#define BCMNET_DRV_NAME "bcmnet" +#define BCMNET_DRV_DEVICE_NAME "/dev/" BCMNET_DRV_NAME + +typedef enum bcmnet_ioctl_cmd +{ + BCMNET_IOCTL_GET_EXT_FLAGS, + BCMNET_IOCTL_GET_LAST_CHANGE, + BCMNET_IOCTL_CLR_STATS, + BCMNET_IOCTL_ADD_NETDEV_PATH, + BCMNET_IOCTL_MAC_LIMIT, + BCMNET_IOCTL_MAX +} bcmnet_ioctl_cmd_t; + +typedef struct { + unsigned int unused : 25; + unsigned int is_bcm_dev : 1; + unsigned int is_wlan : 1; + unsigned int is_hw_switch : 1; + unsigned int is_hw_fdb : 1; + unsigned int is_ppp : 1; + unsigned int is_vlan : 1; + unsigned int is_wan : 1; +} bcmnet_extflags; + +typedef struct { + char if_name[IFNAMSIZ]; + union { + struct { + bcmnet_extflags ret_val; + }st_get_ext_flags; + struct { + unsigned long last_change; + }st_get_last_change; + struct { + char next_if_name[IFNAMSIZ]; + }st_add_netdev_path; + mac_limit_arg_t st_mac_limit; + }; +}bcmnet_info_t; + +#if defined(CONFIG_COMPAT) +typedef struct mac_limit_compat_arg{ + uint32 cmd; + uint32 val; + union { + compat_uptr_t mac_limit; + char rsvd[8]; + }; +}compat_mac_limit_arg_t; + +typedef struct { + char if_name[IFNAMSIZ]; + union { + struct { + bcmnet_extflags ret_val; + }st_get_ext_flags; + struct { + unsigned long last_change; + }st_get_last_change; + struct { + char next_if_name[IFNAMSIZ]; + }st_add_netdev_path; + compat_mac_limit_arg_t st_mac_limit; + }; +}compat_bcmnet_info_t; +#endif + +#if !defined(__KERNEL__) +#include <fcntl.h> +#include <sys/ioctl.h> +#include <unistd.h> +#include <string.h> + + +// return 0 if successful, -1 - error +static inline int bcmnet_ioctl_get_ext_flags(char const* if_name, bcmnet_extflags* flags) +{ + bcmnet_info_t info; + int fd, err; + + fd = open(BCMNET_DRV_DEVICE_NAME, O_RDWR); + if (fd < 0) + return -1; + + strncpy(info.if_name, if_name, IFNAMSIZ); + err = ioctl(fd, BCMNET_IOCTL_GET_EXT_FLAGS, &info); + close(fd); + if (err == -1) + return err; + *flags = info.st_get_ext_flags.ret_val; + return 0; +} + +// return 1 - dev is WAN, 0 - dev is not WAN, -1 - error +static inline int bcmnet_ioctl_iswandev(char const* if_name) +{ + bcmnet_extflags flags; + int ret; + + ret = bcmnet_ioctl_get_ext_flags(if_name, &flags); + if (ret < 0) + return -1; + + return flags.is_wan; +} + +// return 1 - dev is VLAN, 0 - dev is not VLAN, -1 - error +static inline int bcmnet_ioctl_isvlandev(char const* if_name) +{ + bcmnet_extflags flags; + int ret; + + ret = bcmnet_ioctl_get_ext_flags(if_name, &flags); + if (ret < 0) + return -1; + + return flags.is_vlan; +} + +// return last transction jiffies, 0 if there is error +static inline unsigned long bcmnet_ioctl_get_last_change(char* if_name) +{ + bcmnet_info_t info; + int fd, err; + + fd = open(BCMNET_DRV_DEVICE_NAME, O_RDWR); + if (fd < 0) + return 0; + + strncpy(info.if_name, if_name, IFNAMSIZ); + err = ioctl(fd, BCMNET_IOCTL_GET_LAST_CHANGE, &info); + close(fd); + if (err == -1) + return 0; + return info.st_get_last_change.last_change; +} + +static inline void bcmnet_ioctl_clr_stat(char* if_name) +{ + bcmnet_info_t info; + int fd; + + fd = open(BCMNET_DRV_DEVICE_NAME, O_RDWR); + if (fd < 0) + return; + + strncpy(info.if_name, if_name, IFNAMSIZ); + ioctl(fd, BCMNET_IOCTL_CLR_STATS, &info); + close(fd); +} + +static inline int bcmnet_ioctl_add_netdev_path(char const* dev_name, char const* next_dev_name) +{ + bcmnet_info_t info; + int fd, err; + + fd = open(BCMNET_DRV_DEVICE_NAME, O_RDWR); + if (fd < 0) + return -1; + + strncpy(info.if_name, dev_name, IFNAMSIZ); + strncpy(info.st_add_netdev_path.next_if_name, next_dev_name, IFNAMSIZ); + err = ioctl(fd, BCMNET_IOCTL_ADD_NETDEV_PATH, &info); + close(fd); + return err; +} + +#endif //!__KERNEL__ #ifdef __cplusplus } diff --git a/bcm/bcmswapitypes.h b/bcm/bcmswapitypes.h index bd5c9444aa2e17ea035d26938d43645707acc056..3c5ddd8d028e620c1a88268cedcbb1e786d11ee4 100644 --- a/bcm/bcmswapitypes.h +++ b/bcm/bcmswapitypes.h @@ -78,87 +78,59 @@ typedef int bcm_cos_queue_t; /* Various operations through the SIOCETHSWCTLOPS */ enum { - ETHSWDUMPPAGE = 0, - ETHSWDUMPIUDMA, - ETHSWIUDMASPLIT, - ETHSWDUMPMIB, + ETHSWDUMPMIB = 0, + ETHSWPORTCREATE, + ETHSWPORTDELETE, + ETHSWPORTMCASTGEMSET, ETHSWSWITCHING, - ETHSWRXSCHEDULING, - ETHSWWRRPARAM, - ETHSWUSEDEFTXQ, - ETHSWDEFTXQ, - ETHSWRXRATECFG, - ETHSWRXRATELIMITCFG, /* 10 */ - ETHSWRXPKTRATECFG, - ETHSWRXPKTRATELIMITCFG, ETHSWCONTROL, ETHSWPRIOCONTROL, - ETHSWPORTTAGREPLACE, - ETHSWPORTTAGMANGLE, - ETHSWPORTTAGMANGLEMATCHVID, - ETHSWPORTTAGSTRIP, ETHSWPORTPAUSECAPABILITY, - ETHSWVLAN, /* 20 */ - ETHSWGETRXCOUNTERS, - ETHSWRESETRXCOUNTERS, + ETHSWVLAN, ETHSWPBVLAN, - ETHSWCOSCONF, - ETHSWCOSSCHED, + ETHSWCOSSCHED, /* 10 */ ETHSWCOSPORTMAP, - ETHSWCOSRXCHMAP, - ETHSWCOSTXCHMAP, - ETHSWCOSTXQSEL, - ETHSWSTATCLR, /* 30 */ ETHSWSTATPORTCLR, - ETHSWSTATSYNC, - ETHSWSTATGET, ETHSWPORTRXRATE, ETHSWPORTTXRATE, ETHSWTEST1, ETHSWARLACCESS, - ETHSWPORTDEFTAG, ETHSWCOSPRIORITYMETHOD, - ETHSWREGACCESS, /* 40 */ - ETHSWSPIACCESS, + ETHSWREGACCESS, ETHSWPSEUDOMDIOACCESS, - ETHSWINFO, + ETHSWINFO, /* 20 */ ETHSWLINKSTATUS, ETHSWPORTTRAFFICCTRL, ETHSWPORTLOOPBACK, ETHSWPHYMODE, - ETHSWPKTPAD, - ETHSWJUMBO, - ETHSWCOSDSCPPRIOMAP, /* 50 */ - ETHSWKERNELPOLL, + ETHSWMACLMT, + ETHSWJUMBO, + ETHSWCOSDSCPPRIOMAP, ETHSWPHYCFG, - ETHSWEPONUNITOUNICTRL, - ETHSWDEBUG, ETHSWGETIFNAME, - ETHSWMULTIPORT, + ETHSWMULTIPORT, /* 30 */ ETHSWUNITPORT, ETHSWDOSCTRL, ETHSWHWSTP, - ETHSWSOFTSWITCHING, /* 60 */ + ETHSWSOFTSWITCHING, ETHSWEMACGET, ETHSWEMACCLEAR, ETHSWPHYAUTONEG, ETHSWPORTSALDAL, ETHSWPORTTRANSPARENT, - ETHSWPORTVLANISOLATION, + ETHSWPORTVLANISOLATION, /* 40 */ ETHSWACBCONTROL, - ETHSWPORTMTU, ETHSWMIRROR, - ETHSWPORTTRUNK, /* 70 */ + ETHSWPORTTRUNK, + ETHSWIFSTP, ETHSWCPUMETER, ETHSWPORTSHAPERCFG, ETHSWCOSPCPPRIOMAP, ETHSWCOSPIDPRIOMAP, - ETHSWRDPAPORTGET, ETHSWRDPAPORTGETFROMNAME, - ETHSWEXTPHYLINKSTATUS, - ETHSWPHYAPD, + ETHSWPHYAPD, /* 50 */ ETHSWPHYEEE, - ETHSWDEEPGREENMODE, /* 80 */ + ETHSWDEEPGREENMODE, ETHSWPHYAUTONEGCAPADV, ETHSWQUEMON, ETHSWQUEMAP, @@ -166,9 +138,7 @@ enum { ETHSWOAMIDXMAPPING, ETHSWCFP, ETHSWSWITCHFLAG, - ETHSWAUTOMDIX, - ETHSWIFSTP, - ETHSWMACLMT, /* 90 */ + ETHSWAUTOMDIX, /* 60 */ }; typedef struct cfpArg_s { @@ -348,8 +318,9 @@ enum { MACLMT_MAX_TYPES, }; -#if defined(CONFIG_BCM963138) || defined(CONFIG_BCM963148) || defined(CONFIG_BCM94908) || defined(CONFIG_BCM963158) || defined(CONFIG_BCM963178) || defined(CONFIG_BCM947622) || \ - defined(CHIP_63138) || defined(CHIP_63148) || defined(CHIP_4908) || defined(CHIP_63158) || defined(CHIP_63178) || defined(CHIP_47622) +#if defined(CONFIG_BCM963138) || defined(CONFIG_BCM963148) || defined(CONFIG_BCM94908) || defined(CONFIG_BCM963158) || \ + defined(CONFIG_BCM963178) || defined(CONFIG_BCM947622) || defined(CONFIG_BCM963146) || defined(CONFIG_BCM96756) || \ + defined(CHIP_63138) || defined(CHIP_63148) || defined(CHIP_4908) || defined(CHIP_63158) || defined(CHIP_63178) || defined(CHIP_47622) || defined(CHIP_63146) || defined(CHIP_6756) #define BCM_COS_COUNT 8 #else #define BCM_COS_COUNT 4 @@ -765,8 +736,9 @@ typedef struct { #define SHAPER_RATE_PACKET_MODE 0x2 #define SHAPER_BLOCKING_MODE 0x4 #define SHAPER_INCLUDE_IFG 0x8 -#define SHAPER_OVF_FLAG 0x10 -#define SHAPER_INPF_FLAG 0x20 +#define SHAPER_AVB_MODE 0x10 +#define SHAPER_OVF_FLAG 0x20 +#define SHAPER_INPF_FLAG 0x40 /* Defines for the op_map in tag_mangle_set/get */ #define BCM_PORT_REPLACE_TPID 0x8000 /* Replace TPID */ @@ -779,14 +751,13 @@ typedef struct { /* For scheduling mechanism selection */ #define SP_SCHEDULING 0 #define WRR_SCHEDULING 1 -#define FAP_SCHEDULING 2 #define BCM_COSQ_STRICT 0 #define BCM_COSQ_WRR 1 #define BCM_COSQ_COMBO 2 #define BCM_COSQ_SP 0 -#if defined(CONFIG_BCM963138) || defined(CONFIG_BCM963148) || defined(CONFIG_BCM94908) || defined(CONFIG_BCM963158) || defined(CONFIG_BCM963178) \ - || defined(CHIP_63138) || defined(CHIP_63148) || defined(CHIP_4908) || defined(CHIP_63158) || defined(CHIP_63178) +#if defined(CONFIG_BCM963138) || defined(CONFIG_BCM963148) || defined(CONFIG_BCM94908) || defined(CONFIG_BCM963158) || defined(CONFIG_BCM963178) || defined(CONFIG_BCM963146) \ + || defined(CHIP_63138) || defined(CHIP_63148) || defined(CHIP_4908) || defined(CHIP_63158) || defined(CHIP_63178) || defined(CHIP_63146) #define NUM_EGRESS_QUEUES 8 #else #define NUM_EGRESS_QUEUES 4 @@ -811,14 +782,6 @@ typedef struct { #define PAUSE_FLOW_CTRL_BCMSWITCH_ON 9 #define SWITCH_PORTS_ALL_PHYS 255 -/* For ETHSWCOSTXQSEL */ -/* Use Tx BD priority for egress queue selection */ -#define USE_TX_BD_PRIORITY 0 -/* Use Tx iuDMA channel for egress queue selection */ -#define USE_TX_DMA_CHANNEL 1 -/* Indicates neither BD nor channel is used for queue selection*/ -#define NONE_OF_THE_METHODS 0xFF - #define PORT_QOS 0 #define MAC_QOS 1 #define IEEE8021P_QOS 2 diff --git a/bcm/bcmtypes.h b/bcm/bcmtypes.h index e2ca0a72d52aa1becb8e487ffd6aab7f64907339..acf9f6f1c6cdb86ef6f4a1830a32d222b2b97fd8 100644 --- a/bcm/bcmtypes.h +++ b/bcm/bcmtypes.h @@ -32,6 +32,8 @@ #ifndef BCMTYPES_H #define BCMTYPES_H +#ifndef __ASSEMBLER__ + // These are also defined in typedefs.h in the application area, so I need to // protect against re-definition. @@ -47,18 +49,14 @@ typedef signed int int32; typedef signed long long int64; typedef unsigned long BcmHandle; -#if !defined(__cplusplus) && !defined(__KERNEL__) && !defined(_LINUX_TYPES_H) && !defined(_LINUX_IF_H) -#ifndef bool +#if !defined(__cplusplus) && !defined(__KERNEL__) && !defined(_LINUX_TYPES_H) && !defined(_LINUX_IF_H) && !defined(_ATF_) typedef int bool; #endif -#endif #endif typedef unsigned char byte; -// typedef unsigned long sem_t; - typedef unsigned long HANDLE,*PULONG; typedef int DWORD,*PDWORD; #ifndef LONG @@ -146,14 +144,12 @@ typedef enum #define READ16(addr) (*(volatile UINT16 *)((ULONG)&addr)) #define READ8(addr) (*(volatile UINT8 *)((ULONG)&addr)) -#define VIRT_TO_PHY(a) (((unsigned long)(a)) & 0x1fffffff) - typedef unsigned long long uint64_aligned __attribute__((aligned(8))); typedef signed long long int64_aligned __attribute__((aligned(8))); #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define BCM_IOC_PTR(ptr_t, ptr) union { ptr_t ptr; uint64_aligned ptr##64; } -#define BCM_IOC_PTR_ZERO_EXT(ptr) ((ptr##64) = (uint64_aligned)(uint32_t)(ptr##64)) +#define BCM_IOC_PTR_ZERO_EXT(ptr) if (is_compat_task()) ((ptr##64) = (uint64_aligned)(uint32_t)(ptr##64)) #else #define BCM_IOC_PTR(ptr_t, ptr) ptr_t ptr; #define BCM_IOC_PTR_ZERO_EXT(ptr) @@ -168,3 +164,5 @@ typedef signed long long int64_aligned __attribute__((aligned(8))); } ExampleIoctlMsg; */ #endif + +#endif