diff options
author | Roman Yeryomin <roman@advem.lv> | 2013-05-17 20:40:24 +0300 |
---|---|---|
committer | Roman Yeryomin <roman@advem.lv> | 2013-05-17 20:40:24 +0300 |
commit | e6d87036412b952cb083eff2dc716aee97a771f2 (patch) | |
tree | 273dd3daaa85553832d3cc6d48276229dc7fbe09 /target/linux/realtek/files/include | |
parent | a18fec42221baa52fff4c5ffd45ec8f32e3add36 (diff) |
Move to rsdk 3.2.4. Compiles cleanly.
Signed-off-by: Roman Yeryomin <roman@advem.lv>
Diffstat (limited to 'target/linux/realtek/files/include')
25 files changed, 1464 insertions, 4673 deletions
diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/re865x.h b/target/linux/realtek/files/include/asm-mips/rtl865x/re865x.h index e8effa7bb..d7562e600 100644 --- a/target/linux/realtek/files/include/asm-mips/rtl865x/re865x.h +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/re865x.h @@ -1,410 +1,16 @@ /* - * Copyright c Realtek Semiconductor Corporation, 2003 - * All rights reserved. - * * $Header: /home1/sub1/tmp/cvs2svn/skylark/skylark/skylark/linux-2.6.x/include/asm-mips/rtl865x/re865x.h,v 1.1 2007-12-07 05:52:23 alva_zhang Exp $ * * $Author: alva_zhang $ * - * Abstract: + * Copyright (c) 2011 Realtek Semiconductor Corp. * - * re865x.h -- ioctl symbol definitions - * - * $Log: not supported by cvs2svn $ - * Revision 1.1.1.1 2007/08/06 10:04:57 root - * Initial import source to CVS - * - * Revision 1.76 2007/04/23 13:05:40 bo_zhao - * +: add new qos support - * - * Revision 1.75 2007/04/04 03:44:39 alva_zhang - * +: support rtl865xC MIB Couter function - * - * Revision 1.74 2007/04/04 02:29:03 bo_zhao - * *: update MNQueue - * - * Revision 1.73 2007/03/28 03:04:56 bo_zhao - * :Add 865xC MNQueue - * - * Revision 1.72 2007/03/12 05:40:34 darcy_lu - * +: add macro definition for get l2 table - * - * Revision 1.71 2007/03/06 06:56:06 chihhsing - * +: add new IOCTRL for port-base VLAN tagged/untagged - * - * Revision 1.70 2007/03/05 06:07:18 qjj_qin - * *:865xc igmp snooping support - * - * Revision 1.69 2007/02/14 09:23:21 qjj_qin - * *:macro for igmp snooping - * - * Revision 1.68 2007/02/13 07:37:44 qjj_qin - * +:igmp proxy to snooping - * - * Revision 1.67 2007/01/08 01:57:27 hyking_liu - * +: add tag RTL8651_IOCTL_SETMULTIPPPOESESSIONSTATUS for idle time out - * - * Revision 1.66 2006/12/28 02:45:07 hyking_liu - * +: add tag SETNAPTTCPUDPPORTRANGE - * - * Revision 1.65 2006/12/05 05:56:59 qjj_qin - * *:add SDK API to specify detail multicast upstream - * - * Revision 1.64 2006/11/28 02:53:47 hyking_liu - * +: Add Micro for ioctl_setvlanPromiscuous - * - * Revision 1.63 2006/11/13 06:36:25 qjj_qin - * +:igmp proxy for multi-port wan port - * - * Revision 1.62 2006/10/25 07:11:58 qy_wang - * +:add an IOCTRL function to get extension device name & vid - * - * Revision 1.61 2006/08/16 08:33:31 cw_du - * +:Add #define RTL8651_IOCTL_ENABLE_UNNUMBERNAPTPROC 2797. - * - * Revision 1.60 2006/08/15 05:38:56 hyking_liu - * +: Add FLUSHGENERICDMZFILTER for flush dmzfilter. - * - * Revision 1.59 2006/08/14 05:25:44 hyking_liu - * *: Modify for DMZ ipFilter API - * - * Revision 1.58 2006/08/08 08:56:29 hyking_liu - * +: add define of IOCTL_ADDGENERICDMZHOST - * - * Revision 1.57 2006/08/07 07:20:52 jiucai_wang - * +:add RTL8651_IOCTL_MANUALKEYFLAGSEND for ipsec manual key mode - * - * Revision 1.56 2006/08/02 02:20:45 hyking_liu - * +: Add the define of RTL8651_IOCTL_ADDDMZHOSTEXT used in re_core.c - * - * Revision 1.55 2006/05/30 02:13:06 jiucai_wang - * +:add the micro declaration for reinit route list(line 2795) - * - * Revision 1.54 2006/05/24 09:45:45 jiucai_wang - * +:add some micro definition(line:541-546) - * - * Revision 1.53 2006/04/13 05:54:58 chenyl - * +: KERNELPROC for kernel procdure testing - * - * Revision 1.52 2006/03/16 03:12:37 yjlou - * +: Support various NAT Cone Type: - * Naive, Symmetric, Restricted, Port-Restricted, and Full Cone. - * - * Revision 1.51 2006/01/27 07:10:48 shliu - * *: add definition of RTL8651_IOCTL_SETURLFORWARDLOGGING - * - * Revision 1.50 2006/01/26 16:04:49 shliu - * *: define RTL8651_IOCTL_FLUSHURLFILTERRULE - * - * Revision 1.49 2006/01/25 14:53:07 yjlou - * *: fixed the bug of pbnat(Protocol-Base NAT): auto enable when any entry is enabled. - * - * Revision 1.48 2006/01/24 13:52:52 shliu - * *: add ioctl definition RTL8651_IOCTL_SETURLDEFAULTACTION - * - * Revision 1.47 2006/01/23 02:05:40 shliu - * *: add RTL8651_IOCTL_URLUNKNOWNTYPECASESENSITIVE - * - * Revision 1.46 2006/01/23 01:57:15 shliu - * *: add RTL8651_IOCTL_ADDGENERICURLFILTERRULE & RTL8651_IOCTL_DELGENERICURLFILTERRULE - * - * Revision 1.45 2005/12/12 03:25:00 tony - * +: New Feature: support trusted user in url filter. - * - * Revision 1.44 2005/12/02 15:41:11 chenyl - * *: circular buffer write protection by kernel mutex lock / unlock - * - * Revision 1.43 2005/12/02 10:04:46 chenyl - * +: capture Log buffer's snapshot to user space memory under mutex lock/unlock protection. - * *: shliu's new circ_msg write mechanism. - * - * Revision 1.42 2005/11/21 12:40:55 chenyl - * *: always turn OFF interrupts when R/W flash - * - * Revision 1.41 2005/10/26 12:54:40 shliu - * *: add RTL8651_IOCTL_REPROBE - * - * Revision 1.40 2005/10/26 04:57:45 shliu - * *: new API for deletion of proto stack action table entry - * - * Revision 1.39 2005/09/25 17:02:11 shliu - * *: add definitions for mac filter APIs - * - * Revision 1.38 2005/09/09 06:11:05 shliu - * *: add an API of add generic proto stack action - * - * Revision 1.37 2005/09/07 09:54:21 chenyl - * +: set pure-sw forwarding via http-daemon - * - * Revision 1.36 2005/08/04 06:50:15 shliu - * *: add getChipVersion system call - * - * Revision 1.35 2005/08/03 07:35:07 rupert - * +: Add IOCTL for rtl8651a_addAclRuleExt and rtl8651a_delAclRuleExt - * - * Revision 1.34 2005/07/29 09:44:00 chenyl - * +: dns module in ROMEDRV - * +: domain blocking (SDK + RomeDrv) - * - * Revision 1.33 2005/06/07 14:44:50 shliu - * *: add rtl8651_addDriverNaptMapping() API. - * - * Revision 1.32 2005/06/01 07:10:22 tony - * *:add a addarp ioctl - * - * Revision 1.31 2005/05/04 02:42:00 shliu - * *: define reinit ROMEDRV for ioctl case - * - * Revision 1.30 2005/01/18 13:33:37 ghhuang - * *: Replace Diffserv API - * - * Revision 1.29 2005/01/18 08:50:22 ghhuang - * +: Diffserv (DSCP) remarking support - * - * Revision 1.28 2005/01/11 03:22:55 ghhuang - * *:MNQ bug fix - Correct ACL undeletion - * - * Revision 1.27 2005/01/03 02:52:22 tony - * +: add API: rtl8651_queryUpnpMapTimeAge - * - * Revision 1.26 2004/12/22 08:41:49 tony - * *: support for alg qos - * - * Revision 1.25 2004/12/02 03:08:37 yjlou - * +: support IPX/Netbios Passthru function - * - * Revision 1.24 2004/11/01 08:22:21 tony - * *: support for rtl8651_addProtoStackServerPortRange - * - * Revision 1.23 2004/10/21 11:48:39 chenyl - * +: web-based icmp/l4 protocol DMZ forwarding - * - * Revision 1.22 2004/10/11 05:20:27 yjlou - * +: add RTL8651_IOCTL_ENABLE_DROP_UNKNOWN_PPPOE_DROP - * - * Revision 1.21 2004/10/05 09:20:42 chenyl - * +: web page to turn ON/OFF ip-multicast system - * - * Revision 1.20 2004/10/01 08:37:32 yjlou - * +: RTL8651_IOCTL_ENABLE_PPPOE_PASSTHRU and RTL8651_IOCTL_ENABLE_IPV6_PASSTHRU - * - * Revision 1.19 2004/09/23 08:29:33 tony - * new features: when wan port's link is changed, the DHCPC will auto renew. - * - * Revision 1.18 2004/09/15 14:52:19 chenyl - * *: enable multicast upload cache - * *: modify PPTP's default MTU - * - * Revision 1.17 2004/09/03 03:00:09 chhuang - * +: add new feature: pseudo VLAN - * - * Revision 1.16 2004/09/02 06:15:38 chenyl - * *: multicast : - * - when turning-on ip-multicast, periodic query will be sent immediately - * +: tbldrv - * - add options when run addNaptConnection - * - PURE_SW: pure software entry - * - DONT_CHECK_INTIP: ignore internal IP checking - * - TO_PROTOCOL_STACK: this napt packet must be trapped to protocol stack - * +: forwarding engine: - * - protocol stack TCP/UDP flow cache - * - napt redirect register/unregister/query - * - * Revision 1.15 2004/08/20 12:29:17 cfliu - * +: Add loose UDP ctrl item - * - * Revision 1.14 2004/08/18 05:39:59 chenyl - * +: napt special option web-based setting - * - * Revision 1.13 2004/07/27 10:48:52 cfliu - * *: Fix all compile warnings - * - * Revision 1.12 2004/07/27 03:06:16 chenyl - * +: Add DoS ignore type setting ioctl items - * - * Revision 1.11 2004/07/19 02:12:26 chhuang - * *: modify M-N-1 queue - * - * Revision 1.10 2004/07/14 13:55:59 chenyl - * +: web page for MN queue - * - * Revision 1.9 2004/07/12 04:25:36 chenyl - * *: extend existing port scan mechanism - * - * Revision 1.8 2004/07/08 10:58:40 tony - * +: add new ioctl api. - * - * Revision 1.7 2004/07/06 07:22:13 chhuang - * +: add rate limit - * - * Revision 1.6 2004/06/29 07:37:13 chenyl - * +: igmp-proxy filter - * - * Revision 1.5 2004/06/21 03:49:17 chhuang - * +: define RTL8651_IOCTL_NETMTU - * - * Revision 1.4 2004/06/16 04:43:11 tony - * *: support reboot and get loader version for MMU. - * - * Revision 1.3 2004/06/14 09:05:40 rupert - * *: serial definition - * - * Revision 1.58 2004/06/11 11:07:17 cfliu - * +: Add Cable meter and Interface counter webpage - * - * Revision 1.57 2004/05/31 14:41:04 jzchen - * Add Counter setting IO control definition - * - * Revision 1.56 2004/05/28 06:11:51 yjlou - * +: add IOCTL for rtl8651_addProtocolBasedNAT() and rtl8651_delProtocolBasedNAT() - * - * Revision 1.55 2004/05/27 05:14:18 cfliu - * Remove INIT_HARDWARE - * - * Revision 1.54 2004/05/20 08:45:49 chhuang - * add Web Page for QoS - * - * Revision 1.53 2004/05/19 08:49:22 orlando - * add RTL8651_IOCTL_DIAG_LED - * - * Revision 1.52 2004/05/17 07:22:16 tony - * fix pppoe silent timeout bug and make PPTP/L2TP support silent timeout. - * - * Revision 1.51 2004/05/14 10:18:15 orlando - * add RTL8651_IOCTL_DIAG_LED - * - * Revision 1.50 2004/05/12 07:20:15 chenyl - * +: source ip blocking - * *: modify dos mechanism - * - * Revision 1.49 2004/05/10 05:53:45 chhuang - * add new IOCTL: RTL8651_IOCTL_ADDURLFILTER - * - * Revision 1.48 2004/05/05 08:27:07 tony - * new features: add remote management spec - * - * Revision 1.47 2004/04/29 05:47:52 chhuang - * add new ioctl for rtl8651_addNaptMappingExt() - * - * Revision 1.46 2004/04/27 07:05:02 chenyl - * +: ioctl number: RTL8651_IOCTL_SETDEFAULTIGMPUPSTREAM - * - * Revision 1.45 2004/04/19 13:45:18 tony - * add resetPptpProprity and resetL2tpProprity IOCTL. - * - * Revision 1.44 2004/04/14 02:45:50 tony - * add ioctl RTL8651_IOCTL_SETLOOPBACKPORTPHY - * - * Revision 1.43 2004/04/13 08:15:53 tony - * fix bug: make PPTP/L2TP run stably. - * - * Revision 1.42 2004/04/09 02:26:12 tony - * remove rtl8651_specifyNetworkIntfLinkLayerType_1 IOCTL. - * - * Revision 1.41 2004/04/08 13:18:12 tony - * add PPTP/L2TP routine for MII lookback port. - * - * Revision 1.40 2004/04/08 12:25:42 cfliu - * Add del ACL ioctl() - * - * Revision 1.39 2004/02/24 05:12:33 cfliu - * Add symbols required for WLAN HW acceleration code - * - * Revision 1.38 2004/02/10 13:00:34 orlando - * add lanType field in pppoeCfg_t - * - * Revision 1.37 2004/02/09 09:18:00 tony - * add function: user is able to add protocol stack Server used TCP ports by - * rtl8651_addProtoStackServerUsedTcpPort(incoming_src_port); and flush the - * table by rtl8651_flushProtoStackServerUsedTcpPort(); - * - * Revision 1.36 2004/02/04 06:24:19 rupert - * Add UDP IOCTL - * - * Revision 1.35 2004/01/29 09:38:02 tony - * add case RTL8651_IOCTL_ADDNAPTSERVERPORTRANGE ,RTL8651_IOCTL_DELNAPTSERVERPORTRANGE - * - * Revision 1.34 2004/01/29 02:03:34 orlando - * correct duplicate conflicts - * - * Revision 1.33 2004/01/27 02:03:04 tony - * add RTL8651_IOCTL_FLUSHNAPTSERVERPORTBYEXTIP - * - * Revision 1.32 2004/01/12 12:32:23 orlando - * add RTL8651_IOCTL_SETPPPOEDEFAULTDIALSESSIONID - * - * Revision 1.31 2003/12/12 02:40:44 tony - * add rtl8651_setMtu() function. - * - * Revision 1.30 2003/12/10 03:08:58 tony - * make logging function support time zone in kernel space. - * - * Revision 1.29 2003/12/08 13:53:25 orlando - * add RTL8651_IOCTL_ENABLELOGGING - * - * Revision 1.28 2003/12/04 10:39:02 hiwu - * add RTL8651_ADDNAPTUPNPPORTMAPPING - * add RTL8651_DELNAPTUPNPPORTMAPPING - * - * Revision 1.27 2003/12/03 14:29:07 cfliu - * comment out old debug commands when CLE is enabled. - * - * Revision 1.26 2003/12/02 10:24:47 tony - * Add Routine: support DoS is able to set threshold by user(Webs GUI). - * - * Revision 1.25 2003/12/01 12:35:52 tony - * make ALG is able to be configured by users(Web GUI). - * - * Revision 1.24 2003/11/28 01:38:17 rupert - * add PPPOEUP_CFG PPPOEDOWN_CFG BATCH IOCTL - * - * Revision 1.23 2003/11/21 01:56:47 tony - * add function: user is able to add protocol stack used UDP ports by - * rtl8651_addProtoStackUsedUdpPort(incoming_src_port); - * - * Revision 1.22 2003/11/18 13:28:28 rupert - * add ioctl for dial demand and timeout - * - * Revision 1.21 2003/11/18 09:04:47 tony - * add routine: support mtu configure by user in pppoe. - * - * Revision 1.20 2003/11/06 12:15:56 rupert - * add delete policy route ioctl - * - * Revision 1.19 2003/10/30 10:20:49 orlando - * add definitions for command "addflow" - * - * Revision 1.18 2003/10/28 09:58:35 rupert - * add policy route - * - * Revision 1.17 2003/10/28 08:32:36 orlando - * add RTL8651_IOCOL_ENABLENAPTAUTOADD - * - * Revision 1.16 2003/10/24 13:37:42 orlando - * add debug command "dhs","dftcp","dficmp" - * - * Revision 1.15 2003/10/24 10:25:58 tony - * add DoS attack interactive webpage, - * FwdEngine is able to get WAN status by rtl8651_wanStatus(0:disconnect,1:connect) - * - * Revision 1.14 2003/10/20 10:13:08 orlando - * add define for debug command "dl2","dgidx","dfwd" - * - * Revision 1.13 2003/10/20 04:52:11 orlando - * add _RTL_LOGGING related stuff - * - * Revision 1.12 2003/10/09 13:23:44 tony - * TRIGGER_PORT: add function rtl8651_flushTriggerPortRules,rtl8651_addTriggerPortRule - * - * Revision 1.11 2003/10/01 09:43:12 orlando - * add RTL8651_IOCTL_SETPPPOESESSIONHANGUP - * - * Revision 1.10 2003/10/01 06:17:57 orlando - * add cvs file header + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * */ - #ifndef _LINUX_IF_RE865X_H #define _LINUX_IF_RE865X_H diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/rtl865xc_asicregs.h b/target/linux/realtek/files/include/asm-mips/rtl865x/rtl865xc_asicregs.h deleted file mode 100644 index a2c33816c..000000000 --- a/target/linux/realtek/files/include/asm-mips/rtl865x/rtl865xc_asicregs.h +++ /dev/null @@ -1,3483 +0,0 @@ - -/* -* ---------------------------------------------------------------- -* Copyright c Realtek Semiconductor Corporation, 2002 -* All rights reserved. -* -* $Header: /home1/sub1/tmp/cvs2svn/skylark/skylark/skylark/linux-2.6.x/drivers/net/re865x/AsicDriver/rtl865xc_asicregs.h,v 1.3 2008-02-28 11:06:35 alva_zhang Exp $ -* -* Abstract: ASIC specific definitions. -* -* $Author: alva_zhang $ -* -* --------------------------------------------------------------- -*/ -#ifndef _ASICREGS_H -#define _ASICREGS_H - -/* - * Just for check menuconfig .... - */ -#if defined(CONFIG_RTL_819X) -#else - #error You must choice either 865xB or 865xC in 'make menuconfig'. -#endif - -#undef SWTABLE_NO_HW - -/* Basic features -*/ -#ifdef CONFIG_RTL8196B -#define MAX_PORT_NUMBER 5 -#else -#define MAX_PORT_NUMBER 6 -#endif -#define PORT_NUM_MASK 7 -#define ALL_PORT_MASK 0x3F - -#define TABLE_ENTRY_DISTANCE (8 * sizeof(uint32)) -#define SWTABLE_BASE_OF_ALL_TABLES 0xbb000000 -#define table_access_addr_base(type) (SWTABLE_BASE_OF_ALL_TABLES + 0x10000 * (type)) - -/* Filtering Database features */ -#define RTL865XC_FID_BITMASK 0x3 - -/* Register access macro (REG*()). -*/ -#ifndef REG32 -#define REG32(reg) (*((volatile uint32 *)(reg))) -#endif -#ifndef REG16 -#define REG16(reg) (*((volatile uint16 *)(reg))) -#endif -#ifndef REG8 -#define REG8(reg) (*((volatile uint8 *)(reg))) -#endif - -/* Register access macro (READ_MEM32() and WRITE_MEM32()). */ -#if defined(RTL865X_MODEL_USER)||defined(RTL865X_TEST) -/* - * big_endian() is a macro to make endian consistence between 865x board and x86 PC. - * All the ASIC registers stored in memory will be stored at big-endian order. - * Therefore, we will see the same result when memory dump ASIC registers. - * - * big_endian32() and big_endian16() are like ntohs() and ntohl(). - * In order to reduce the complexity of include hirerachy, we don't use ntohs-related functions. - */ -#define big_endian32(x) ((((x)&0xff000000)>>24)|(((x)&0x00ff0000)>>8)|(((x)&0x0000ff00)<<8)|(((x)&0x000000ff)<<24)) -#define big_endian16(x) (((x)>>8)|(((x)&0x000000ff)<<8)) -#define big_endian(x) big_endian32(x) /* backward-compatible */ -#else -#define big_endian32(x) (x) -#define big_endian16(x) (x) -#define big_endian(x) big_endian32(x) /* backward-compatible */ -#endif - -#if defined(RTL865X_MODEL_USER)||defined(RTL865X_MODEL_KERNEL) -void WRITE_MEM32(uint32 reg, uint32 val); -void WRITE_MEM16(uint32 reg, uint32 val); -void WRITE_MEM8(uint32 reg, uint32 val); -uint32 READ_MEM32(uint32 reg); -uint32 READ_MEM16(uint32 reg); -uint32 READ_MEM8(uint32 reg); -void WRITE_VIR32(uint32 reg, uint32 val); -void WRITE_VIR16(uint32 reg, uint32 val); -void WRITE_VIR8(uint32 reg, uint32 val); -uint32 READ_VIR32(uint32 reg); -uint32 READ_VIR16(uint32 reg); -uint32 READ_VIR8(uint32 reg); -#else -/* Target Platform, RTL865X_TEST */ -#ifndef WRITE_MEM32 -#define WRITE_MEM32(reg,val) REG32(reg)=big_endian(val) -#endif - -#ifndef WRITE_MEM16 -#define WRITE_MEM16(reg,val) REG16(reg)=big_endian16(val) -#endif - -#ifndef WRITE_MEM8 -#define WRITE_MEM8(reg,val) REG8(reg)=(val) -#endif - -#ifndef READ_MEM32 -#define READ_MEM32(reg) big_endian(REG32(reg)) -#endif - -#ifndef READ_MEM16 -#define READ_MEM16(reg) big_endian16(REG16(reg)) -#endif - -#ifndef READ_MEM8 -#define READ_MEM8(reg) (REG8(reg)) -#endif -#endif - -#ifdef CONFIG_RTL8196C_REVISION_B -#define TOGGLE_BIT_IN_REG(reg, bit_shift) (WRITE_MEM32(reg, READ_MEM32(reg) ^ bit_shift)) -#define TOGGLE_BIT_IN_REG_TWICE(reg, bit_shift) \ - do{ \ - TOGGLE_BIT_IN_REG(reg, bit_shift); \ - TOGGLE_BIT_IN_REG(reg, bit_shift); \ - } while (0) -#else -#define TOGGLE_BIT_IN_REG_TWICE(reg, bit_shift) -#endif - - -#define RTL_R32(addr) (*(volatile unsigned long *)(addr)) -#define RTL_W32(addr, l) ((*(volatile unsigned long*)(addr)) = (l)) -#define RTL_R8(addr) (*(volatile unsigned char*)(addr)) -#define RTL_W8(addr, l) ((*(volatile unsigned char*)(addr)) = (l)) - -/* MACRO to update HW configuration */ -#define UPDATE_MEM32(reg, val, mask, offset) \ - do{ \ - WRITE_MEM32( (reg), \ - ((READ_MEM32(reg) & ~((mask) << (offset))) | (((val) & (mask)) << (offset))));\ - } while (0) - -/* MACRO to get value of HW configuration */ -#define GET_MEM32_VAL(reg, mask, offset) ((READ_MEM32(reg) >> (offset)) & (mask)) - -#define DIVISOR 1000 /* cfliu: change DIVISOR from 0xe to 4096 for watchdog */ - /* yjlou: change DIVISOR from 4096 to 100 for better resolution. */ - /* yjlou: change DIVISOR from 100 to 1000 for longer watchdog trigger. */ - /* cfliu: change DIVISOR back to 4000 to let printk happy. */ - -#define REAL_SWCORE_BASE 0xBB800000 -#define REAL_SYSTEM_BASE 0xB8000000 -#define REAL_HSB_BASE 0xBB806280 -#define REAL_HSA_BASE 0xBB806200 -#define REAL_SWTBL_BASE 0xBB000000 - -#if defined(RTL865X_TEST) || defined(RTL865X_MODEL_USER) || defined(RTL865X_MODEL_KERNEL) -#define VIRTUAL_SWCORE_REG_SIZE (1*64*1024) /* said, BB80_xxxx */ -#define VIRTUAL_SYSTEM_REG_SIZE (2*64*1024) /* said, B800_xxxx */ -#define VIRTUAL_SWCORE_TBL_SIZE (1*1024*1024+256*1024) /* said, BB00_xxxx */ -extern int8 *pVirtualSWReg; -extern int8 *pVirtualSysReg; -extern int8 *pVirtualHsb; -extern int8 *pVirtualHsa; -extern int8 *pVirtualSWTable; -#define SWCORE_BASE ((uint32)pVirtualSWReg) -#define SWCORE_SIZE VIRTUAL_SWCORE_REG_SIZE -#define SYSTEM_BASE ((uint32)pVirtualSysReg) -#define SYSTEM_SIZE (VIRTUAL_SYSTEM_REG_SIZE) -#define HSB_BASE ((uint32)pVirtualHsb) -#define HSB_SIZE 0x40 -#define HSA_BASE ((uint32)pVirtualHsa) -#define HSA_SIZE 0x40 -#else -#define SWCORE_BASE REAL_SWCORE_BASE -#define SYSTEM_BASE REAL_SYSTEM_BASE -#define HSB_BASE REAL_HSB_BASE -#define HSA_BASE REAL_HSA_BASE -#endif - -#ifdef CONFIG_RTL_8198 -#define PIN_MUX_SEL_2 (SYSTEM_BASE + 0x0044) -#endif - -#ifndef REVR -#define REVR (SYSTEM_BASE + 0x00000000) -#endif - -#ifndef RTL8196C_REVISION_A -#define RTL8196C_REVISION_A 0x80000001 -#endif - -#ifndef RTL8196C_REVISION_B -#define RTL8196C_REVISION_B 0x80000002 -#endif - -/* Table access and CPU interface control registers -*/ -#define TACI_BASE (SWCORE_BASE + 0x00004D00) -#define SWTACR (0x000 + TACI_BASE) /* Table Access Control */ -#define SWTASR (0x004 + TACI_BASE) /* Table Access Status */ -#define SWTAA (0x008 + TACI_BASE) /* Table Access Address */ -#define TCR0 (0x020 + TACI_BASE) /* Table Access Control 0 */ -#define TCR1 (0x024 + TACI_BASE) /* Table Access Control 1 */ -#define TCR2 (0x028 + TACI_BASE) /* Table Access Control 2 */ -#define TCR3 (0x02C + TACI_BASE) /* Table Access Control 3 */ -#define TCR4 (0x030 + TACI_BASE) /* Table Access Control 4 */ -#define TCR5 (0x034 + TACI_BASE) /* Table Access Control 5 */ -#define TCR6 (0x038 + TACI_BASE) /* Table Access Control 6 */ -#define TCR7 (0x03C + TACI_BASE) /* Table Access Control 7 */ -/* Table access control register field definitions -*/ -#define ACTION_MASK 1 -#define ACTION_DONE 0 -#define ACTION_START 1 -#define CMD_MASK (7 << 1) -#define CMD_ADD (1 << 1) -#define CMD_MODIFY (1 << 2) -#define CMD_FORCE (1 << 3) -#define STOP_TLU_READY (1<<19) -#define EN_STOP_TLU (1<<18) -/* Table access status register field definitions -*/ -#define TABSTS_MASK 1 -#define TABSTS_SUCCESS 0 -#define TABSTS_FAIL 1 -/* Vlan table access definitions -*/ -#define STP_DISABLE 0 -#define STP_BLOCK 1 -#define STP_LEARN 2 -#define STP_FORWARD 3 -/* Protocol trapping table access definitions -*/ -#define TYPE_TRAP_ETHERNET 0x00 -#define TYPE_TRAP_IP 0x02 -#define TYPE_TRAP_TCP 0x05 -#define TYPE_TRAP_UDP 0x06 -/* L3 Routing table access definitions -*/ -#define PROCESS_PPPOE 0x00 -#define PROCESS_DIRECT 0x01 -#define PROCESS_INDIRECT 0x02 -#define PROCESS_S_CPU 0x04 -#define PROCESS_NXT_HOP 0x05 -#define PROCESS_S_DROP 0x06 -#define PROCESS_N_DROP 0x07 -/* ACL table access definitions -*/ -#define RULE_ETHERNET 0 -#define RULE_IP 2 -#define RULE_IFSEL 3 -#define RULE_ICMP 4 -#define RULE_IGMP 5 -#define RULE_TCP 6 -#define RULE_UDP 7 -#define RULE_SRC_FILTER 8 -#define RULE_DST_FILTER 9 -#define ACTION_PERMIT 0 -#define ACTION_REDIRECT 1 -#define ACTION_S_DROP 2 -#define ACTION_S_CPU 3 -#define ACTION_N_DROP 4 -#define ACTION_N_CPU 5 -#define ACTION_CPU_FOR_LOGGING 5 -#define ACTION_MIRROR 6 -#define ACTION_PPPOE_REDIRECT 7 -#define ACTION_DEFAULT_REDIRECT 8 -#define ACTION_DEFAULT_MIRROR 9 -#define ACTION_DROP_RATE_PPS 10 -#define ACTION_LOG2CPU_RATE_PPS 11 -#define ACTION_DROP_RATE_BPS 12 -#define ACTION_LOG2CPU_RATE_BPS 13 - - - -/* MIB counter registers -*/ -#define MIB_COUNTER_BASE (SWCORE_BASE + 0x00001000) -#define MIB_CONTROL (0x00 + MIB_COUNTER_BASE) /*MIB control Register */ - -/* MIB counter registers -*/ -#define MIB_ADDROFFSETBYPORT 0x80 /* Address offset of the same counters of each port. Ex: P0's ifInOctets counter and P1's ifInOctets counter. */ -#define OFFSET_ETHERSTATSCPUEVENTPKT 0x84 -#define OFFSET_IFINOCTETS_P0 0x100 -#define OFFSET_IFINUCASTPKTS_P0 0x108 -#define OFFSET_ETHERSTATSOCTETS_P0 0x10C -#define OFFSET_ETHERSTATSUNDERSIZEPKTS_P0 0x114 -#define OFFSET_ETHERSTATSFRAGMEMTS_P0 0x118 -#define OFFSET_ETHERSTATSPKTS64OCTETS_P0 0x11C -#define OFFSET_ETHERSTATSPKTS65TO127OCTETS_P0 0x120 -#define OFFSET_ETHERSTATSPKTS128TO255OCTETS_P0 0x124 -#define OFFSET_ETHERSTATSPKTS256TO511OCTETS_P0 0x128 -#define OFFSET_ETHERSTATSPKTS512TO1023OCTETS_P0 0x12C -#define OFFSET_ETHERSTATSPKTS1024TO1518OCTETS_P0 0x130 -#define OFFSET_ETHERSTATSOVERSIZEPKTS_P0 0x134 -#define OFFSET_ETHERSTATSJABBERS_P0 0x138 -#define OFFSET_ETHERSTATSMULTICASTPKTS_P0 0x13C -#define OFFSET_ETHERSTATSBROADCASTPKTS_P0 0x140 -#define OFFSET_DOT1DTPPORTINDISCARDS_P0 0x144 -#define OFFSET_ETHERSTATSDROPEVENTS_P0 0x148 -#define OFFSET_DOT3STATSFCSERRORS_P0 0x14C -#define OFFSET_DOT3STATSSYMBOLERRORS_P0 0x150 -#define OFFSET_DOT3CONTROLINUNKNOWNOPCODES_P0 0x154 -#define OFFSET_DOT3INPAUSEFRAMES_P0 0x158 -#define OFFSET_IFOUTOCTETS_P0 0x800 -#define OFFSET_IFOUTUCASTPKTS_P0 0x808 -#define OFFSET_IFOUTMULTICASTPKTS_P0 0x80C -#define OFFSET_IFOUTBROADCASTPKTS_P0 0x810 -#define OFFSET_IFOUTDISCARDS 0x814 -#define OFFSET_DOT3STATSSINGLECOLLISIONFRAMES_P0 0x818 -#define OFFSET_DOT3STATSMULTIPLECOLLISIONFRAMES_P0 0x81C -#define OFFSET_DOT3STATSDEFERREDTRANSMISSIONS_P0 0x820 -#define OFFSET_DOT3STATSLATECOLLISIONS_P0 0x824 -#define OFFSET_DOT3STATSEXCESSIVECOLLISIONS_P0 0x828 -#define OFFSET_DOT3OUTPAUSEFRAMES_P0 0x82C -#define OFFSET_DOT1DBASEPORTDELAYEXCEEDEDDISCARDS_P0 0x830 -#define OFFSET_ETHERSTATSCOLLISIONS_P0 0x834 -/* MIB control register field definitions -*/ -#define ALL_COUNTER_RESTART_MASK 0x0007ffff /* SYS_COUNTER_RESTART | IN_COUNTER_RESTART_P8 | ... | OUT_COUNTER_RESTART_P0 */ -#define SYS_COUNTER_RESTART (1 << 18) -#define IN_COUNTER_RESTART_P8 (1 << 17) -#define OUT_COUNTER_RESTART_P8 (1 << 16) -#define IN_COUNTER_RESTART_P7 (1 << 15) -#define OUT_COUNTER_RESTART_P7 (1 << 14) -#define IN_COUNTER_RESTART_P6 (1 << 13) -#define OUT_COUNTER_RESTART_P6 (1 << 12) -#define IN_COUNTER_RESTART_P5 (1 << 11) -#define OUT_COUNTER_RESTART_P5 (1 << 10) -#define IN_COUNTER_RESTART_P4 (1 << 9) -#define OUT_COUNTER_RESTART_P4 (1 << 8) -#define IN_COUNTER_RESTART_P3 (1 << 7) -#define OUT_COUNTER_RESTART_P3 (1 << 6) -#define IN_COUNTER_RESTART_P2 (1 << 5) -#define OUT_COUNTER_RESTART_P2 (1 << 4) -#define IN_COUNTER_RESTART_P1 (1 << 3) -#define OUT_COUNTER_RESTART_P1 (1 << 2) -#define IN_COUNTER_RESTART_P0 (1 << 1) -#define OUT_COUNTER_RESTART_P0 (1 << 0) - -#define PORT_FOR_COUNTING_OFFSET 24 /*8650 offset while 8650B offset is 21*/ - -#define CPU_EVENTS (0x074 + MIB_COUNTER_BASE) -#define EXT_PORT_FOR_COUNTING_MASK 0x00E00000 -#define EXT_PORT_FOR_COUNTING_OFFSET 21 -#define RX_BYTES_1 (0x080 + MIB_COUNTER_BASE) -#define RX_PKTS_1 (0x084 + MIB_COUNTER_BASE) -#define DROP_EVENTS_1 (0x088 + MIB_COUNTER_BASE) -#define CPU_EVENTS_1 (0x08C + MIB_COUNTER_BASE) -#define RX_BYTES_2 (0x090 + MIB_COUNTER_BASE) -#define RX_PKTS_2 (0x094 + MIB_COUNTER_BASE) -#define DROP_EVENTS_2 (0x098 + MIB_COUNTER_BASE) -#define CPU_EVENTS_2 (0x09C + MIB_COUNTER_BASE) -#define TX_BYTES_1 (0x0A0 + MIB_COUNTER_BASE) -#define TX_PKTS_1 (0x0A4 + MIB_COUNTER_BASE) -#define TX_BYTES_2 (0x0A8 + MIB_COUNTER_BASE) -#define TX_PKTS_2 (0x0AC + MIB_COUNTER_BASE) - -/* Pre-fetch control register -*/ -#define PFBRst (1<<16) /* Pre-fetch buffer reset */ -#define DFC_OV (1<<15) /* DFC counter overflow flag */ -#define FPFHC_OV (1<<14) /* DPFHC counter overflow flag */ -#define CDFC (1<<13) /* Clear Data Fetch Counter */ -#define CDPFHC (1<<12) /* Clear Data Pre-Fetch Hit Counter */ -#define EnDFC (1<<11) /* Enable Data Fetch Counter */ -#define EnDPFHC (1<<10) /* Enable Data Pre-Fetch Hit Counter */ -#define EnSDPreFetch_D_MASK (0x00000300) /* Enable SDRAM pre-fetch function for Data : Mask */ -#define EnSDPreFetch_D_Disable (0x00000100) /* Enable SDRAM pre-fetch function for Data : disable */ -#define EnSDPreFetch_D_4W (0x00000200) /* Enable SDRAM pre-fetch function for Data : 4W */ -#define EnSDPreFetch_D_4W4W (0x00000300) /* Enable SDRAM pre-fetch function for Data : 4W+4W */ -#define EnSDPreFetch_D_OFFSET (8) /* Enable SDRAM pre-fetch function for Data : Offset */ -#define IFC_OV (1<<7) /* IFC counter overflow flag */ -#define IPFHC_OV (1<<6) /* IPFHC counter overflow flag */ -#define CIFC (1<<5) /* Clear Instruction Fetch Counter */ -#define CIPFHC (1<<4) /* Clear Instruction Pre-Fetch Hit Counter */ -#define EnIFC (1<<3) /* Enable Instruction Fetch Counter */ -#define EnIPFHC (1<<2) /* Enable Instruction Pre-Fetch Hit Counter */ -#define EnSDPreFetch_I_MASK (0x00000003) /* Enable SDRAM pre-fetch function for Instruction : Mask */ -#define EnSDPreFetch_I_OFFSET (0) /* Enable SDRAM pre-fetch function for Instruction : Offset */ -#define EnSDPreFetch_I_Disable (0x00000001) /* Enable SDRAM pre-fetch function for Instruction : disable */ -#define EnSDPreFetch_I_4W (0x00000002) /* Enable SDRAM pre-fetch function for Instruction : 4W */ -#define EnSDPreFetch_I_4W4W (0x00000003) /* Enable SDRAM pre-fetch function for Instruction : 4W+4W */ - - -/* PHY control registers -*/ -#define PHY_BASE (SWCORE_BASE + 0x00002000) -#define PORT0_PHY_CONTROL (0x000 + PHY_BASE) -#define PORT0_PHY_STATUS (0x004 + PHY_BASE) -#define PORT0_PHY_IDENTIFIER_1 (0x008 + PHY_BASE) -#define PORT0_PHY_IDENTIFIER_2 (0x00C + PHY_BASE) -#define PORT0_PHY_AUTONEGO_ADVERTISEMENT (0x010 + PHY_BASE) -#define PORT0_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x014 + PHY_BASE) -#define PORT1_PHY_CONTROL (0x020 + PHY_BASE) -#define PORT1_PHY_STATUS (0x024 + PHY_BASE) -#define PORT1_PHY_IDENTIFIER_1 (0x028 + PHY_BASE) -#define PORT1_PHY_IDENTIFIER_2 (0x02C + PHY_BASE) -#define PORT1_PHY_AUTONEGO_ADVERTISEMENT (0x030 + PHY_BASE) -#define PORT1_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x034 + PHY_BASE) -#define PORT2_PHY_CONTROL (0x040 + PHY_BASE) -#define PORT2_PHY_STATUS (0x044 + PHY_BASE) -#define PORT2_PHY_IDENTIFIER_1 (0x048 + PHY_BASE) -#define PORT2_PHY_IDENTIFIER_2 (0x04C + PHY_BASE) -#define PORT2_PHY_AUTONEGO_ADVERTISEMENT (0x050 + PHY_BASE) -#define PORT2_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x054 + PHY_BASE) -#define PORT3_PHY_CONTROL (0x060 + PHY_BASE) -#define PORT3_PHY_STATUS (0x064 + PHY_BASE) -#define PORT3_PHY_IDENTIFIER_1 (0x068 + PHY_BASE) -#define PORT3_PHY_IDENTIFIER_2 (0x06C + PHY_BASE) -#define PORT3_PHY_AUTONEGO_ADVERTISEMENT (0x070 + PHY_BASE) -#define PORT3_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x074 + PHY_BASE) -#define PORT4_PHY_CONTROL (0x080 + PHY_BASE) -#define PORT4_PHY_STATUS (0x084 + PHY_BASE) -#define PORT4_PHY_IDENTIFIER_1 (0x088 + PHY_BASE) -#define PORT4_PHY_IDENTIFIER_2 (0x08C + PHY_BASE) -#define PORT4_PHY_AUTONEGO_ADVERTISEMENT (0x090 + PHY_BASE) -#define PORT4_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x094 + PHY_BASE) -#define PORT5_PHY_CONTROL (0x0A0 + PHY_BASE) -#define PORT5_PHY_STATUS (0x0A4 + PHY_BASE) -#define PORT5_PHY_IDENTIFIER_1 (0x0A8 + PHY_BASE) -#define PORT5_PHY_IDENTIFIER_2 (0x0AC + PHY_BASE) -#define PORT5_PHY_AUTONEGO_ADVERTISEMENT (0x0B0 + PHY_BASE) -#define PORT5_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x0B4 + PHY_BASE) -#define PORT6_PHY_CONTROL (0x0C0 + PHY_BASE) -#define PORT6_PHY_STATUS (0x0C4 + PHY_BASE) -#define PORT6_PHY_IDENTIFIER_1 (0x0C8 + PHY_BASE) -#define PORT6_PHY_IDENTIFIER_2 (0x0CC + PHY_BASE) -#define PORT6_PHY_AUTONEGO_ADVERTISEMENT (0x0D0 + PHY_BASE) -#define PORT6_PHY_AUTONEGO_LINK_PARTNER_ABILITY (0x0D4 + PHY_BASE) -/* PHY control register field definitions -*/ -#define PHY_RESET (1 << 15) -#define ENABLE_LOOPBACK (1 << 14) -#define SPEED_SELECT_100M (1 << 13) -#define SPEED_SELECT_10M 0 -#define ENABLE_AUTONEGO (1 << 12) -#define POWER_DOWN (1 << 11) -#define ISOLATE_PHY (1 << 10) -#define RESTART_AUTONEGO (1 << 9) -#define SELECT_FULL_DUPLEX (1 << 8) -#define SELECT_HALF_DUPLEX 0 -#define SPEED_SELECT_1000M (1 << 6) -/* PHY status register field definitions -*/ -#define STS_CAPABLE_100BASE_T4 (1 << 15) -#define STS_CAPABLE_100BASE_TX_FD (1 << 14) -#define STS_CAPABLE_100BASE_TX_HD (1 << 13) -#define STS_CAPABLE_10BASE_TX_FD (1 << 12) -#define STS_CAPABLE_10BASE_TX_HD (1 << 11) -#define STS_MF_PREAMBLE_SUPPRESSION (1 << 6) -#define STS_AUTONEGO_COMPLETE (1 << 5) -#define STS_REMOTE_FAULT (1 << 4) -#define STS_CAPABLE_NWAY_AUTONEGO (1 << 3) -#define STS_LINK_ESTABLISHED (1 << 2) -#define STS_JABBER_DETECTED (1 << 1) -#define STS_CAPABLE_EXTENDED (1 << 0) -/* PHY identifier 1 -*/ -#define OUT_3_18_MASK (0xFFFF << 16) -#define OUT_3_18_OFFSET 16 -#define OUT_19_24_MASK (0x3F << 10) -#define OUT_19_24_OFFSET 10 -#define MODEL_NUMBER_MASK (0x3F << 4) -#define MODEL_NUMBER_OFFSET 4 -#define REVISION_NUMBER_MASK 0x0F -#define REVISION_NUMBER_OFFSET 0 -/* PHY auto-negotiation advertisement and -link partner ability registers field definitions -*/ -#define NEXT_PAGE_ENABLED (1 << 15) -#define ACKNOWLEDGE (1 << 14) -#define REMOTE_FAULT (1 << 13) -#define CAPABLE_PAUSE (1 << 10) -#define CAPABLE_100BASE_T4 (1 << 9) -#define CAPABLE_100BASE_TX_FD (1 << 8) -#define CAPABLE_100BASE_TX_HD (1 << 7) -#define CAPABLE_10BASE_TX_FD (1 << 6) -#define CAPABLE_10BASE_TX_HD (1 << 5) -#define SELECTOR_MASK 0x1F -#define SELECTOR_OFFSET 0 -#define CAP_100BASE_OFFSET 5 -#define CAP_100BASE_MASK (0x1F << CAP_100BASE_OFFSET) /* 10/100 capability mask */ -/* PHY 1000BASE-T control and 1000BASE-T Status -*/ -#define CAPABLE_1000BASE_TX_FD (1 << 9) -#define CAPABLE_1000BASE_TX_HD (1 << 8) -#define ADVCAP_1000BASE_OFFSET 8 -#define LPCAP_1000BASE_OFFSET 10 -#define ADVCAP_1000BASE_MASK (0x3 << ADVCAP_1000BASE_OFFSET) /* advertisement capability mask */ -#define LPCAP_1000BASE_MASK (0x3 << LPCAP_1000BASE_OFFSET) /* link partner status mask */ - -#define CPU_IFACE_BASE (SYSTEM_BASE+0x10000) /* 0xB8010000 */ -#define CPUICR (0x000 + CPU_IFACE_BASE) /* Interface control */ - -#define CPURPDCR0 (0x004 + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 0 */ -#define CPURPDCR1 (0x008 + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 1 */ -#define CPURPDCR2 (0x00c + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 2 */ -#define CPURPDCR3 (0x010 + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 3 */ -#define CPURPDCR4 (0x014 + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 4 */ -#define CPURPDCR5 (0x018 + CPU_IFACE_BASE) /* Rx pkthdr descriptor control 5 */ -#define CPURPDCR(idx) (CPURPDCR0 + (idx << 2)) /* Rx pkthdr descriptor control with index */ - -#define CPURMDCR0 (0x01c + CPU_IFACE_BASE) /* Rx mbuf descriptor control */ -#define CPUTPDCR0 (0x020 + CPU_IFACE_BASE) /* Tx pkthdr descriptor control Low */ -#define CPUTPDCR1 (0x024 + CPU_IFACE_BASE) /* Tx pkthdr descriptor control High */ -#define CPUTPDCR(idx) (CPUTPDCR0 + (idx << 2)) /* Tx pkthdr descriptor control with index */ - -#define CPUIIMR (0x028 + CPU_IFACE_BASE) /* Interrupt mask control */ -#define CPUIISR (0x02c + CPU_IFACE_BASE) /* Interrupt status control */ -#define CPUQDM0 (0x030 + CPU_IFACE_BASE) /* Queue ID 0 and Descriptor Ring Mapping Register */ -#define CPUQDM1 (0x032 + CPU_IFACE_BASE) /* Queue ID 1 and Descriptor Ring Mapping Register */ -#define CPUQDM2 (0x034 + CPU_IFACE_BASE) /* Queue ID 2 and Descriptor Ring Mapping Register */ -#define CPUQDM3 (0x036 + CPU_IFACE_BASE) /* Queue ID 3 and Descriptor Ring Mapping Register */ -#define CPUQDM4 (0x038 + CPU_IFACE_BASE) /* Queue ID 4 and Descriptor Ring Mapping Register */ -#define CPUQDM5 (0x03a + CPU_IFACE_BASE) /* Queue ID 5 and Descriptor Ring Mapping Register */ - -#define DMA_CR1 (0x040 + CPU_IFACE_BASE) /* DMA Control Register 1 */ -#define DMA_CR2 (0x044 + CPU_IFACE_BASE) /* DMA Control Register 2 */ - - -/* CPUICR - CPU interface control register field definitions -*/ -#define TXCMD (1 << 31) /* Enable Tx */ -#define RXCMD (1 << 30) /* Enable Rx */ -#define BUSBURST_32WORDS 0 -#define BUSBURST_64WORDS (1 << 28) -#define BUSBURST_128WORDS (2 << 28) -#define BUSBURST_256WORDS (3 << 28) -#define MBUF_128BYTES 0 -#define MBUF_256BYTES (1 << 24) -#define MBUF_512BYTES (2 << 24) -#define MBUF_1024BYTES (3 << 24) -#define MBUF_2048BYTES (4 << 24) -#define TXFD (1 << 23) /* Notify Tx descriptor fetch */ -#define SOFTRST (1 << 22) /* Re-initialize all descriptors */ -#define STOPTX (1 << 21) /* Stop Tx */ -#define SWINTSET (1 << 20) /* Set software interrupt */ -#define LBMODE (1 << 19) /* Loopback mode */ -#define LB10MHZ (1 << 18) /* LB 10MHz */ -#define LB100MHZ (1 << 18) /* LB 100MHz */ -#define MITIGATION (1 << 17) /* Mitigation with timer1 */ -#define EXCLUDE_CRC (1 << 16) /* Exclude CRC from length */ -#define RX_SHIFT_OFFSET 0 - -/* - CPU interface descriptor field defintions -*/ -#define DESC_OWNED_BIT (1 << 0) -#define DESC_RISC_OWNED (0 << 0) -#define DESC_SWCORE_OWNED (1 << 0) - -#define DESC_WRAP (1 << 1) - -#define DESC_ENG_OWNED 1 - - -/* CPUIIMR - CPU interface interrupt mask register field definitions */ -#define LINK_CHANGE_IE (1 << 31) /* Link change interrupt enable */ - -#define RX_ERR_IE0 (1 << 25) /* Rx error interrupt enable for descriptor 0 */ -#define RX_ERR_IE1 (1 << 26) /* Rx error interrupt enable for descriptor 1 */ -#define RX_ERR_IE2 (1 << 27) /* Rx error interrupt enable for descriptor 2 */ -#define RX_ERR_IE3 (1 << 28) /* Rx error interrupt enable for descriptor 3 */ -#define RX_ERR_IE4 (1 << 29) /* Rx error interrupt enable for descriptor 4 */ -#define RX_ERR_IE5 (1 << 30) /* Rx error interrupt enable for descriptor 5 */ -#define RX_ERR_IE_ALL (0x3f<<25) /* Rx error interrupt enable for any descriptor */ - -#define TX_ERR_IE0 (1 << 23) /* Tx error interrupt pending for descriptor 0 */ -#define TX_ERR_IE1 (1 << 24) /* Tx error interrupt pending for descriptor 1 */ -#define TX_ERR_IE_ALL (0x3<<23) /* Tx error interrupt pending for any descriptor */ -#define TX_ERR_IE (1 << 29) /* Tx error interrupt enable */ - -#define PKTHDR_DESC_RUNOUT_IE0 (1 << 17) /* Run out pkthdr descriptor 0 interrupt enable */ -#define PKTHDR_DESC_RUNOUT_IE1 (1 << 18) /* Run out pkthdr descriptor 1 interrupt enable */ -#define PKTHDR_DESC_RUNOUT_IE2 (1 << 19) /* Run out pkthdr descriptor 2 interrupt enable */ -#define PKTHDR_DESC_RUNOUT_IE3 (1 << 20) /* Run out pkthdr descriptor 3 interrupt enable */ -#define PKTHDR_DESC_RUNOUT_IE4 (1 << 21) /* Run out pkthdr descriptor 4 interrupt enable */ -#define PKTHDR_DESC_RUNOUT_IE5 (1 << 22) /* Run out pkthdr descriptor 5 interrupt enable */ -#define PKTHDR_DESC_RUNOUT_IE_ALL (0x3f << 17) /* Run out anyone pkthdr descriptor interrupt pending */ - -#define MBUF_DESC_RUNOUT_IE_ALL (1 << 11) /* Run out anyone mbuf interrupt pending */ -#define MBUF_DESC_RUNOUT_IE0 (1 << 11) /* Run out mbuf descriptor 0 interrupt enable */ - -#define TX_DONE_IE0 (1 << 9) /* Tx Descript Ring 0 one packet done interrupt enable */ -#define TX_DONE_IE1 (1 << 10) /* Tx Descript Ring 1 one packet done interrupt enable */ -#define TX_DONE_IE_ALL (0x3 << 9) /* Any Tx Descript Ring one packet done interrupt enable */ - -#define RX_DONE_IE0 (1 << 3) /* Rx Descript Ring 0 one packet done interrupt enable */ -#define RX_DONE_IE1 (1 << 4) /* Rx Descript Ring 1 one packet done interrupt enable */ -#define RX_DONE_IE2 (1 << 5) /* Rx Descript Ring 2 one packet done interrupt enable */ -#define RX_DONE_IE3 (1 << 6) /* Rx Descript Ring 3 one packet done interrupt enable */ -#define RX_DONE_IE4 (1 << 7) /* Rx Descript Ring 4 one packet done interrupt enable */ -#define RX_DONE_IE5 (1 << 8) /* Rx Descript Ring 5 one packet done interrupt enable */ -#define RX_DONE_IE_ALL (0x3f << 3) /* Rx Descript Ring any one packet done interrupt enable */ - -#define TX_ALL_DONE_IE0 (1 << 1) /* Tx Descript Ring 0 all packets done interrupt enable */ -#define TX_ALL_DONE_IE1 (1 << 2) /* Tx Descript Ring 1 all packets done interrupt enable */ -#define TX_ALL_DONE_IE_ALL (0x3 << 1) /* Any Tx Descript Ring all packets done interrupt enable */ - -/* CPU interface interrupt status register field definitions */ -#define LINK_CHANGE_IP (1 << 31) /* Link change interrupt pending */ - -#define RX_ERR_IP0 (1 << 25) /* Rx error descriptor 0 interrupt pending */ -#define RX_ERR_IP1 (1 << 26) /* Rx error descriptor 1 interrupt pending */ -#define RX_ERR_IP2 (1 << 27) /* Rx error descriptor 2 interrupt pending */ -#define RX_ERR_IP3 (1 << 28) /* Rx error descriptor 3 interrupt pending */ -#define RX_ERR_IP4 (1 << 29) /* Rx error descriptor 4 interrupt pending */ -#define RX_ERR_IP5 (1 << 30) /* Rx error descriptor 5 interrupt pending */ -#define RX_ERR_IP_ALL (0x3f<<25) /* Rx error any descriptor interrupt pending */ -#define RX_ERR_IP(idx) (1 << (25+(idx))) /* Rx error descriptor [IDX] interrupt pending */ - -#define TX_ERR_IP0 (1 << 23) /* Tx error descriptor 0 interrupt pending */ -#define TX_ERR_IP1 (1 << 24) /* Tx error descriptor 1 interrupt pending */ -#define TX_ERR_IP_ALL (0x3<<23) /* Tx error any descriptor interrupt pending */ -#define TX_ERR_IP(idx) (1 << (23+(idx))) /* Tx error descriptor [IDX] interrupt pending */ - -#define PKTHDR_DESC_RUNOUT_IP0 (1 << 17) /* Run out pkthdr descriptor 0 interrupt pending */ -#define PKTHDR_DESC_RUNOUT_IP1 (1 << 18) /* Run out pkthdr descriptor 1 interrupt pending */ -#define PKTHDR_DESC_RUNOUT_IP2 (1 << 19) /* Run out pkthdr descriptor 2 interrupt pending */ -#define PKTHDR_DESC_RUNOUT_IP3 (1 << 20) /* Run out pkthdr descriptor 3 interrupt pending */ -#define PKTHDR_DESC_RUNOUT_IP4 (1 << 21) /* Run out pkthdr descriptor 4 interrupt pending */ -#define PKTHDR_DESC_RUNOUT_IP5 (1 << 22) /* Run out pkthdr descriptor 5 interrupt pending */ -#define PKTHDR_DESC_RUNOUT_IP_ALL (0x3f << 17) /* Run out anyone pkthdr descriptor interrupt pending */ -#define PKTHDR_DESC_RUNOUT_IP(idx) (1 << (17+(idx))) /* Run out pkthdr descriptor [IDX] interrupt pending */ - -#define MBUF_DESC_RUNOUT_IP_ALL (1 << 11) /* Run out anyone mbuf interrupt pending */ -#define MBUF_DESC_RUNOUT_IP0 (1 << 11) /* Run out mbuf descriptor 0 interrupt pending */ - -#define TX_DONE_IP0 (1 << 9) /* Tx one packet done interrupt for descriptor 0 pending */ -#define TX_DONE_IP1 (1 << 10) /* Tx one packet done interrupt for descriptor 1 pending */ -#define TX_DONE_IP_ALL (0x3 << 9) /* Tx one packet done interrupt for any descriptor pending */ -#define TX_DONE_IP(idx) (1 << (9+(idx))) /* Tx one packet done interrupt for descriptor [IDX] pending */ - -#define RX_DONE_IP0 (1 << 3) /* Rx one packet done 0 interrupt pending */ -#define RX_DONE_IP1 (1 << 4) /* Rx one packet done 1 interrupt pending */ -#define RX_DONE_IP2 (1 << 5) /* Rx one packet done 2 interrupt pending */ -#define RX_DONE_IP3 (1 << 6) /* Rx one packet done 3 interrupt pending */ -#define RX_DONE_IP4 (1 << 7) /* Rx one packet done 4 interrupt pending */ -#define RX_DONE_IP5 (1 << 8) /* Rx one packet done 5 interrupt pending */ -#define RX_DONE_IP_ALL (0x3f << 3) /* Rx one packet done anyone interrupt pending */ -#define RX_DONE_IP(idx) (1 << (3+(idx))) /* Rx one packet done [IDX] interrupt pending */ - -#define TX_ALL_DONE_IP0 (1 << 1) /* Tx all packets done interrupt 0 pending */ -#define TX_ALL_DONE_IP1 (1 << 2) /* Tx all packets done interrupt 1 pending */ -#define TX_ALL_DONE_IP_ALL (0x03 << 1) /* Tx all packets done any interrupt pending */ -#define TX_ALL_DONE_IP(idx) (1 << (1+(idx))) /* Tx all packets done interrupt [IDX] pending */ - -#define INTPENDING_NIC_MASK (RX_ERR_IP_ALL|TX_ERR_IP_ALL|RX_DONE_IP_ALL|PKTHDR_DESC_RUNOUT_IP_ALL) -#define INTPENDING_RUN_OUT (PKTHDR_DESC_RUNOUT_IP_ALL) - -/* CPUQDM0,CPUQDM1,CPUQDM2,CPUQDM3,CPUQDM4,CPUQDM5 - Queue ID 0~5 and Descriptor Ring Mapping Register */ -#define CPURxDesc_OFFSET 12 -#define CPURxDesc_MASK (7<<12) -#define Ext1RxDesc_OFFSET 8 -#define Ext1RxDesc_MASK (7<<8) -#define Ext2RxDesc_OFFSET 4 -#define Ext2RxDesc_MASK (7<<4) -#define Ext3RxDesc_OFFSET 0 -#define Ext3RxDesc_MASK (7<<0) -#define CPU_RX_DESC_SHIFT 12 -#define EXT1_RX_DESC_SHIFT 8 -#define EXT2_RX_DESC_SHIFT 4 -#define EXT3_RX_DESC_SHIFT 0 - - - - -/* Switch Core Control Registers -*/ -#define SWCORECNR (SWCORE_BASE + 0x00006000) - -#define MACMR (0x004 + SWCORECNR) /* MAC monitor */ -#define VLANTCR (0x008 + SWCORECNR) /* Vlan tag control */ -#define DSCR0 (0x00C + SWCORECNR) /* Qos by DS control */ -#define DSCR1 (0x010 + SWCORECNR) /* Qos by DS control */ -#define QOSCR (0x014 + SWCORECNR) /* Qos control */ -#if 0 /* phase out in 865xC */ -#define SWTMCR (0x01C + SWCORECNR) /* Switch table misc control */ -#endif - -#if 0 /* phase out in 865xC */ -/* SWTMCR - Switch table misc control */ -#define EN_BCAST (1<<30) /* Enable Broadcast Handling */ -#define MCAST_TO_CPU (1<<29) /* Enable Multicast Table */ -#define BRIDGE_PKT_TO_CPU (1<<27) /*802.1d packet to CPU*/ -#define MCAST_PORT_EXT_MODE_OFFSET 5 /* Multicast port mode offset */ -#define MCAST_PORT_EXT_MODE_MASK (0x3f << 5) /* Multicast port mode mask */ -#define WAN_ROUTE_MASK (3 << 3) -#define WAN_ROUTE_FORWARD (0 << 3) /* Route WAN packets */ -#define WAN_ROUTE_TO_CPU (1 << 3) /* Forward WAN packets to CPU */ -#define WAN_ROUTE_DROP (2 << 3) /* Drop WAN packets */ -#endif - -/* Descriptor Diagnostic Register */ -#define DESCDIAG_BASE (SWCORECNR + 0x0100) -#define GDSR0 (DESCDIAG_BASE + 0x000) /* Global Descriptor Status Register 0 */ -#define GDSR1 (DESCDIAG_BASE + 0x004) /* Global Descriptor Status Register 1 */ -#define PCSR0 (DESCDIAG_BASE + 0x008) /* Port Congestion Status Register 0 */ -#define PCSR1 (DESCDIAG_BASE + 0x00c) /* Port Congestion Status Register 1 */ -#define P0_DCR0 (DESCDIAG_BASE + 0x010) /* Port 0 Descriptor Counter Register 0 */ -#define P0_DCR1 (DESCDIAG_BASE + 0x014) /* Port 0 Descriptor Counter Register 1 */ -#define P0_DCR2 (DESCDIAG_BASE + 0x018) /* Port 0 Descriptor Counter Register 2 */ -#define P0_DCR3 (DESCDIAG_BASE + 0x01c) /* Port 0 Descriptor Counter Register 3 */ -#define P1_DCR0 (DESCDIAG_BASE + 0x020) /* Port 1 Descriptor Counter Register 0 */ -#define P1_DCR1 (DESCDIAG_BASE + 0x024) /* Port 1 Descriptor Counter Register 1 */ -#define P1_DCR2 (DESCDIAG_BASE + 0x028) /* Port 1 Descriptor Counter Register 2 */ -#define P1_DCR3 (DESCDIAG_BASE + 0x02c) /* Port 1 Descriptor Counter Register 3 */ -#define P2_DCR0 (DESCDIAG_BASE + 0x030) /* Port 2 Descriptor Counter Register 0 */ -#define P2_DCR1 (DESCDIAG_BASE + 0x034) /* Port 2 Descriptor Counter Register 1 */ -#define P2_DCR2 (DESCDIAG_BASE + 0x038) /* Port 2 Descriptor Counter Register 2 */ -#define P2_DCR3 (DESCDIAG_BASE + 0x03c) /* Port 2 Descriptor Counter Register 3 */ -#define P3_DCR0 (DESCDIAG_BASE + 0x040) /* Port 3 Descriptor Counter Register 0 */ -#define P3_DCR1 (DESCDIAG_BASE + 0x044) /* Port 3 Descriptor Counter Register 1 */ -#define P3_DCR2 (DESCDIAG_BASE + 0x048) /* Port 3 Descriptor Counter Register 2 */ -#define P3_DCR3 (DESCDIAG_BASE + 0x04c) /* Port 3 Descriptor Counter Register 3 */ -#define P4_DCR0 (DESCDIAG_BASE + 0x050) /* Port 4 Descriptor Counter Register 0 */ -#define P4_DCR1 (DESCDIAG_BASE + 0x054) /* Port 4 Descriptor Counter Register 1 */ -#define P4_DCR2 (DESCDIAG_BASE + 0x058) /* Port 4 Descriptor Counter Register 2 */ -#define P4_DCR3 (DESCDIAG_BASE + 0x05c) /* Port 4 Descriptor Counter Register 3 */ -#define P5_DCR0 (DESCDIAG_BASE + 0x060) /* Port 5 Descriptor Counter Register 0 */ -#define P5_DCR1 (DESCDIAG_BASE + 0x064) /* Port 5 Descriptor Counter Register 1 */ -#define P5_DCR2 (DESCDIAG_BASE + 0x068) /* Port 5 Descriptor Counter Register 2 */ -#define P5_DCR3 (DESCDIAG_BASE + 0x06c) /* Port 5 Descriptor Counter Register 3 */ -#define P6_DCR0 (DESCDIAG_BASE + 0x070) /* Port CPU Descriptor Counter Register 0 */ -#define P6_DCR1 (DESCDIAG_BASE + 0x074) /* Port CPU Descriptor Counter Register 1 */ -#define P6_DCR2 (DESCDIAG_BASE + 0x078) /* Port CPU Descriptor Counter Register 2 */ -#define P6_DCR3 (DESCDIAG_BASE + 0x07c) /* Port CPU Descriptor Counter Register 3 */ - -#define Pn_DSCR0(idx) (DESCDIAG_BASE + ((idx) * 0x10) + 0x010) -#define Pn_DSCR1(idx) (DESCDIAG_BASE + ((idx) * 0x10) + 0x014) -#define Pn_DSCR2(idx) (DESCDIAG_BASE + ((idx) * 0x10) + 0x018) -#define Pn_DSCR3(idx) (DESCDIAG_BASE + ((idx) * 0x10) + 0x01c) - -#define Pn_IQDesCnt_OFFSET (0) -#define Pn_IQDesCnt_MASK (0x3ff << Pn_IQDesCnt_OFFSET) - -#define Pn_OQDSCR_MASK (0x3ff)<<Pn_ODD_OQDSCR_OFFSET -#define Pn_ODD_OQDSCR_OFFSET (16) -#define Pn_EQDSCR_MASK (0x3ff)<<Pn_EVEN_OQDSCR_OFFSET -#define Pn_EVEN_OQDSCR_OFFSET (0) - -#define Pn_OQDSCR(port, queue) \ - ( \ - ((queue) == 0) || ((queue) == 1)? \ - ((queue & 0x01)?((READ_MEM32(Pn_DSCR0(port)) >> Pn_ODD_OQDSCR_OFFSET) & Pn_OQDSCR_MASK) : \ - ((READ_MEM32(Pn_DSCR0(port)) >> Pn_EVEN_OQDSCR_OFFSET) & Pn_OQDSCR_MASK)): \ - ((queue) == 2) || ((queue) == 3)? \ - ((queue & 0x01)?((READ_MEM32(Pn_DSCR1(port)) >> Pn_ODD_OQDSCR_OFFSET) & Pn_OQDSCR_MASK) : \ - ((READ_MEM32(Pn_DSCR1(port)) >> Pn_EVEN_OQDSCR_OFFSET) & Pn_OQDSCR_MASK)): \ - ((queue) == 4) || ((queue) == 5)? \ - ((queue & 0x01)?((READ_MEM32(Pn_DSCR2(port)) >> Pn_ODD_OQDSCR_OFFSET) & Pn_OQDSCR_MASK) : \ - ((READ_MEM32(Pn_DSCR2(port)) >> Pn_EVEN_OQDSCR_OFFSET) & Pn_OQDSCR_MASK)): \ - 0) - -#define Pn_IQDSCR(port) ((READ_MEM32(Pn_DSCR3(port)) & Pn_IQDesCnt_MASK) >> Pn_IQDesCnt_OFFSET) - -/* GDSR0 - Global Descriptor Status Register 0 */ -#define DSCRUNOUT (1<<27) /* Descriptor Run Out */ -#define TotalDscFctrl_Flag (1<<26) /* TotalDescriptor Flow Control event flag */ -#define USEDDSC_OFFSET 16 /* Total Used Descriptor */ -#define USEDDSC_MASK (0x3ff<<16) /* Total Used Descriptor */ -#define SharedBufFCON_Flag (1<<14) /* SharedBufFCON threshold triggerred flag */ -#define MaxUsedDsc_OFFSET 0 /* Max Used Descriptor Count History */ -#define MaxUsedDsc_MASK (0x3ff<<0) /* Max Used Descriptor Count History */ - -/* PCSR0 - Port Congestion Status Register 0 */ -#define P3OQCgst_OFFSET (24) -#define P3OQCgst_MASK (0x7f << P3OQCgst_OFFSET) -#define P2OQCgst_OFFSET (16) -#define P2OQCgst_MASK (0x7f << P2OQCgst_OFFSET) -#define P1OQCgst_OFFSET (8) -#define P1OQCgst_MASK (0x7f << P1OQCgst_OFFSET) -#define P0OQCgst_OFFSET (0) -#define P0OQCgst_MASK (0x7f << P0OQCgst_OFFSET) - -#define P3QQCgst(queue) (((READ_MEM32(PCSR0) & P3OQCgst_MASK) >> P3OQCgst_OFFSET) & (1 << (queue))) -#define P2QQCgst(queue) (((READ_MEM32(PCSR0) & P2OQCgst_MASK) >> P2OQCgst_OFFSET) & (1 << (queue))) -#define P1QQCgst(queue) (((READ_MEM32(PCSR0) & P1OQCgst_MASK) >> P1OQCgst_OFFSET) & (1 << (queue))) -#define P0QQCgst(queue) (((READ_MEM32(PCSR0) & P0OQCgst_MASK) >> P0OQCgst_OFFSET) & (1 << (queue))) - -/* PCSR1 - Port Congestion Status Register 1 */ -#define IQCgst_OFFSET (24) -#define IQCgst_MASK (0x7f << P3OQCgst_OFFSET) -#define P6OQCgst_OFFSET (16) -#define P6OQCgst_MASK (0x7f << P6OQCgst_OFFSET) -#define P5OQCgst_OFFSET (8) -#define P5OQCgst_MASK (0x7f << P5OQCgst_OFFSET) -#define P4OQCgst_OFFSET (0) -#define P4OQCgst_MASK (0x7f << P4OQCgst_OFFSET) - -#define IQCgst(port) (((READ_MEM32(PCSR1) & IQCgst_MASK) >> IQCgst_OFFSET) & (1 << (port))) -#define P6QQCgst(queue) (((READ_MEM32(PCSR1) & P6OQCgst_MASK) >> P6OQCgst_OFFSET) & (1 << (queue))) -#define P5QQCgst(queue) (((READ_MEM32(PCSR1) & P5OQCgst_MASK) >> P5OQCgst_OFFSET) & (1 << (queue))) -#define P4QQCgst(queue) (((READ_MEM32(PCSR1) & P4OQCgst_MASK) >> P4OQCgst_OFFSET) & (1 << (queue))) - - -#define TMCR (0x300 + SWCORECNR) /* Test mode control */ -#if 1 /* According David Lu 2006/02/10 */ -#define MIITM_TXR0 (0x400 + SWCORECNR) /* MAC Test Mode MII TX Interface Register */ -#define MIITM_TXR1 (0x404 + SWCORECNR) /* MAC Test Mode MII TX Interface Register */ -#define MIITM_RXR0 (0x408 + SWCORECNR) /* MAC Test Mode MII RX Interface Register */ -#define MIITM_RXR1 (0x40C + SWCORECNR) /* MAC Test Mode MII RX Interface Register */ -#define GMIITM_TXR0 (0x400 + SWCORECNR) /* MAC Test Mode MII TX Interface Register */ -#define GMIITM_TXR1 (0x404 + SWCORECNR) /* MAC Test Mode MII TX Interface Register */ -#define GMIITM_RXR0 (0x408 + SWCORECNR) /* MAC Test Mode MII RX Interface Register */ -#define GMIITM_RXR1 (0x40C + SWCORECNR) /* MAC Test Mode MII RX Interface Register */ -#else /* Before 2006/02/09 */ -#define MIITM_TXR (0x400 + SWCORECNR) /* MAC Test Mode MII TX Interface Register */ -#define MIITM_RXR (0x404 + SWCORECNR) /* MAC Test Mode MII RX Interface Register */ -#endif - - -#define EN_PHY_P4 (1 << 9) -#define EN_PHY_P3 (1 << 8) -#define EN_PHY_P2 (1 << 7) -#define EN_PHY_P1 (1 << 6) -#define EN_PHY_P0 (1 << 5) -#define EN_FX_P4 (1 << 4) -#define EN_FX_P3 (1 << 3) -#define EN_FX_P2 (1 << 2) -#define EN_FX_P1 (1 << 1) -#define EN_FX_P0 (1 << 0) - -#define GUEST_VLAN_BITMASK 0xFFF -#define MULTICAST_BROADCAST_BIT 0x1 -#define PCRP_SIZE 4 -#define STP_PortST 5 -#define STP_PortST_BITMASK 3 - - - -/* MAC monitor register field definitions -*/ -#define SYS_CLK_MASK (0x7 << 16) -#define SYS_CLK_100M (0 << 16) -#define SYS_CLK_90M (1 << 16) -#define SYS_CLK_85M (2 << 16) -#define SYS_CLK_96M (3 << 16) -#define SYS_CLK_80M (4 << 16) -#define SYS_CLK_75M (5 << 16) -#define SYS_CLK_70M (6 << 16) -#define SYS_CLK_50M (7 << 16) -/* VLAN tag control register field definitions -*/ -#define VLAN_TAG_ONLY (1 << 19) /* Only accept tagged packets */ -#define MII_ENFORCE_MODE (1 << 4) /* Enable MII port property set by force mode */ -/* Qos by DS control register -*/ -/* Qos control register -*/ -#define QWEIGHT_MASK (3 << 30) -#define QWEIGHT_ALWAYS_H (3 << 30) /* Weighted round robin of priority always high first */ -#define QWEIGHT_16TO1 (2 << 30) /* Weighted round robin of priority queue 16:1 */ -#define QWEIGHT_8O1 (1 << 30) /* Weighted round robin of priority queue 8:1 */ -#define QWEIGHT_4TO1 0 /* Weighted round robin of priority queue 4:1 */ -#define EN_FCA_AUTOOFF (1 << 29) /* Enable flow control auto off */ -#define DIS_DS_PRI (1 << 28) /* Disable DS priority */ -#define DIS_VLAN_PRI (1 << 27) /* Disable 802.1p priority */ -#define PORT5_H_PRI (1 << 26) /* Port 5 high priority */ -#define PORT4_H_PRI (1 << 25) /* Port 4 high priority */ -#define PORT3_H_PRI (1 << 24) /* Port 3 high priority */ -#define PORT2_H_PRI (1 << 23) /* Port 2 high priority */ -#define PORT1_H_PRI (1 << 22) /* Port 1 high priority */ -#define PORT0_H_PRI (1 << 21) /* Port 0 high priority */ -#define EN_QOS (1 << 20) /* Enable QoS */ -/* Switch core misc control register field definitions -*/ -#define DIS_P5_LOOPBACK (1 << 30) /* Disable port 5 loopback */ - -#define LINK_RGMII 0 /* RGMII mode */ -#define LINK_MII_MAC 1 /* GMII/MII MAC auto mode */ -#define LINK_MII_PHY 2 /* GMII/MII PHY auto mode */ -#define LINKMODE_OFFSET 23 /* Link type offset */ -#define P5_LINK_RGMII LINK_RGMII /* Port 5 RGMII mode */ -#define P5_LINK_MII_MAC LINK_MII_MAC /* Port 5 GMII/MII MAC auto mode */ -#define P5_LINK_MII_PHY LINK_MII_PHY /* Port 5 GMII/MII PHY auto mode */ -#define P5_LINK_OFFSET LINKMODE_OFFSET /* Port 5 link type offset */ -/*#define P4_USB_SEL (1 << 25) Select port USB interface */ -#define EN_P5_LINK_PHY (1 << 26) /* Enable port 5 PHY provides link status to MAC */ -#define EN_P4_LINK_PHY (1 << 25) /* Enable port 4 PHY provides link status to MAC */ -#define EN_P3_LINK_PHY (1 << 24) /* Enable port 3 PHY provides link status to MAC */ -#define EN_P2_LINK_PHY (1 << 23) /* Enable port 2 PHY provides link status to MAC */ -#define EN_P1_LINK_PHY (1 << 22) /* Enable port 1 PHY provides link status to MAC */ -#define EN_P0_LINK_PHY (1 << 21) /* Enable port 0 PHY provides link status to MAC */ - - - - -/*When enabled, the authorized node are allowed in one direction ("IN" direction) -to forward packet to the unauthorized node. Otherwise, it is not allowed. -0= BOTH direction. (control for the packets that "SA=" or "DA=" this MAC address.) -1= IN direction. (control for the packets that "SA=" this MAC address.) */ -#define EN_8021X_TOGVLAN ( DOT1X_PROCESS_GVLAN<<GVLAN_PROCESS_BITS) -#define EN_8021X_TOCPU ( DOT1X_PROCESS_TOCPU<<GVLAN_PROCESS_BITS) -#define EN_8021X_DROP ( DOT1X_PROCESS_DROP<<GVLAN_PROCESS_BITS) - - - - -#if 1 /* According David Lu 2006/02/10 */ -/* Test mode Tx MII-like register field definitions -*/ -#define P0TxEN (1<<24) /* Enable port 0 Mii Tx signal (1 - data valid) */ -#define P1TxEN (1<<25) /* Enable port 1 Mii Tx signal (1 - data valid) */ -#define P2TxEN (1<<26) /* Enable port 2 Mii Tx signal (1 - data valid) */ -#define P0TxEN_OFFSET (24) /* Enable port 0 Mii Tx */ -#define P1TxEN_OFFSET (25) /* Enable port 1 Mii Tx */ -#define P2TxEN_OFFSET (26) /* Enable port 2 Mii Tx */ -#define P0TXD_OFFSET (0) /* Port 0 TxD [7:0] */ -#define P1TXD_OFFSET (8) /* Port 1 TxD [7:0] */ -#define P2TXD_OFFSET (16) /* Port 2 TxD [7:0] */ - -#define P3TxEN (1<<24) /* Enable port 3 Mii Tx signal (1 - data valid) */ -#define P4TxEN (1<<25) /* Enable port 4 Mii Tx signal (1 - data valid) */ -#define P5TxEN (1<<26) /* Enable port 5 Mii Tx signal (1 - data valid) */ -#define P3TxEN_OFFSET (24) /* Enable port 3 Mii Tx */ -#define P4TxEN_OFFSET (25) /* Enable port 4 Mii Tx */ -#define P5TxEN_OFFSET (26) /* Enable port 5 Mii Tx */ -#define P3TXD_OFFSET (0) /* Port 3 TxD [7:0] */ -#define P4TXD_OFFSET (8) /* Port 4 TxD [7:0] */ -#define P5TXD_OFFSET (16) /* Port 5 TxD [7:0] */ -/* Test mode Rx MII-like register field definitions -*/ -#define P0RxEN (1<<24) /* Enable port 0 Mii Rx signal (1 - data valid) */ -#define P1RxEN (1<<25) /* Enable port 1 Mii Rx signal (1 - data valid) */ -#define P2RxEN (1<<26) /* Enable port 2 Mii Rx signal (1 - data valid) */ -#define P0RxEN_OFFSET (24) /* Enable port 0 Mii Rx */ -#define P1RxEN_OFFSET (25) /* Enable port 1 Mii Rx */ -#define P2RxEN_OFFSET (26) /* Enable port 2 Mii Rx */ -#define P0RXD_OFFSET (0) /* Port 0 RxD [7:0] */ -#define P1RXD_OFFSET (8) /* Port 1 RxD [7:0] */ -#define P2RXD_OFFSET (16) /* Port 2 RxD [7:0] */ - -#define P3RxEN (1<<24) /* Enable port 3 Mii Rx signal (1 - data valid) */ -#define P4RxEN (1<<25) /* Enable port 4 Mii Rx signal (1 - data valid) */ -#define P5RxEN (1<<26) /* Enable port 5 Mii Rx signal (1 - data valid) */ -#define P3RxEN_OFFSET (24) /* Enable port 3 Mii Rx */ -#define P4RxEN_OFFSET (25) /* Enable port 4 Mii Rx */ -#define P5RxEN_OFFSET (26) /* Enable port 5 Mii Rx */ -#define P3RXD_OFFSET (0) /* Port 3 RxD [7:0] */ -#define P4RXD_OFFSET (8) /* Port 4 RxD [7:0] */ -#define P5RXD_OFFSET (16) /* Port 5 RxD [7:0] */ -#else /* Before 2006/02/09 */ -/* Test mode Rx MII-like register field definitions -*/ -#define P5_RXDV (1 << 30) /* Enable port 0 MII RXDV signal */ -#define P4_RXDV (1 << 29) /* Enable port 1 MII RXDV signal */ -#define P3_RXDV (1 << 28) /* Enable port 2 MII RXDV signal */ -#define P2_RXDV (1 << 27) /* Enable port 3 MII RXDV signal */ -#define P1_RXDV (1 << 26) /* Enable port 4 MII RXDV signal */ -#define P0_RXDV (1 << 25) /* Enable port 5 MII RXDV signal */ -#define NIBBLE_MASK 0x0F /* Mask for a nibble */ -#define P5_RXD_OFFSET 20 /* Port 0 RXD MII signal */ -#define P4_RXD_OFFSET 16 /* Port 1 RXD MII signal */ -#define P3_RXD_OFFSET 12 /* Port 2 RXD MII signal */ -#define P2_RXD_OFFSET 8 /* Port 3 RXD MII signal */ -#define P1_RXD_OFFSET 4 /* Port 4 RXD MII signal */ -#define P0_RXD_OFFSET 0 /* Port 5 RXD MII signal */ -/* Test mode Tx MII-like register field definitions -*/ -#define P5_TXDV (1 << 30) /* Enable port 0 MII TXDV signal */ -#define P4_TXDV (1 << 29) /* Enable port 1 MII TXDV signal */ -#define P3_TXDV (1 << 28) /* Enable port 2 MII TXDV signal */ -#define P2_TXDV (1 << 27) /* Enable port 3 MII TXDV signal */ -#define P1_TXDV (1 << 26) /* Enable port 4 MII TXDV signal */ -#define P0_TXDV (1 << 25) /* Enable port 5 MII TXDV signal */ -#define P5_TXD_OFFSET 20 /* Port 0 TXD MII signal */ -#define P4_TXD_OFFSET 16 /* Port 1 TXD MII signal */ -#define P3_TXD_OFFSET 12 /* Port 2 TXD MII signal */ -#define P2_TXD_OFFSET 8 /* Port 3 TXD MII signal */ -#define P1_TXD_OFFSET 4 /* Port 4 TXD MII signal */ -#define P0_TXD_OFFSET 0 /* Port 5 TXD MII signal */ -#endif - -/* Test mode enable register -*/ -#define TX_TEST_PORT_OFFSET 26 /* Tx test mode enable port offset */ -#define RX_TEST_PORT_OFFSET 18 /* Rx test mode enable port offset */ -#define MiiTxPktRDY_OFFSET 10 /* Status flag of MII TX packet ready to send on port */ -#define HSABUSY (1 << 2) /* HSA process ready flag */ -#define ENHSBTESTMODE (1 << 1) /* Enable HSB Test Mode */ -#define HSB_RDY (1 << 0) /* HSB ready */ -/* Gateway MAC low register -*/ -#define GMACL_OFFSET 20 /* Gateway MAC[15:4] offset */ -#define GMACL_MASK (0xFFFFFFFF << 20) /* Gateway MAC[15:4] mask */ - - - - -#define SWMACCR_BASE (SWCORE_BASE+0x4000) -/* MAC control register field definitions */ -#define MACCR (0x000+SWMACCR_BASE) /* MAC Configuration Register */ -#define MDCIOCR (0x004+SWMACCR_BASE) /* MDC/MDIO Command */ -#define MDCIOSR (0x008+SWMACCR_BASE) /* MDC/MDIO Status */ -#define PMCR (0x00C+SWMACCR_BASE) /* Port Mirror Control Register */ -#define PPMAR (0x010+SWMACCR_BASE) /* Per port matching action */ -#define PATP0 (0x014+SWMACCR_BASE) /* Pattern for port 0 */ -#define PATP1 (0x018+SWMACCR_BASE) /* Pattern for port 1 */ -#define PATP2 (0x01C+SWMACCR_BASE) /* Pattern for port 2 */ -#define PATP3 (0x020+SWMACCR_BASE) /* Pattern for port 3 */ -#define PATP4 (0x024+SWMACCR_BASE) /* Pattern for port 4 */ -#define PATP5 (0x028+SWMACCR_BASE) /* Pattern for port 5 */ -#define MASKP0 (0x02C+SWMACCR_BASE) /* Mask for port 0 */ -#define MASKP1 (0x030+SWMACCR_BASE) /* Mask for port 1 */ -#define MASKP2 (0x034+SWMACCR_BASE) /* Mask for port 2 */ -#define MASKP3 (0x038+SWMACCR_BASE) /* Mask for port 3 */ -#define MASKP4 (0x03C+SWMACCR_BASE) /* Mask for port 4 */ -#define MASKP5 (0x040+SWMACCR_BASE) /* Mask for port 5 */ -#define BSCR (0x044+SWMACCR_BASE) /* Broadcast Storm Control Rate Configuration */ -#define CSCR (0x048+SWMACCR_BASE) /* Checksum Control Register */ -#define CCR (0x048+SWMACCR_BASE) /* Checksum Control Register */ -#define EPOCR (0x04C+SWMACCR_BASE) /* Embedded PHY Operation Control Register */ -#define EPIDR (0x050+SWMACCR_BASE) /* Embedded PHY ID Register */ - -/* MACCR - MAC control register field definitions */ -#define NORMAL_BACKOFF (1 << 28) /* Normal back off slot timer */ -#define BACKOFF_EXPONENTIAL_3 (1 << 27) /* Set back off exponential parameter 9 */ -#define DIS_BACKOFF_BIST (1 << 26) /* Disable back off BIST */ -#define IPG_SEL (1 << 25) /* Fixed IPG */ -#define INFINITE_PAUSE_FRAMES (1 << 24) /* Infinite pause frames */ -#define LONG_TXE (1 << 22) /* Back pressure, carrier based */ -#define DIS_MASK_CGST (1 << 21) -#define EN_48_DROP (1 << 20) - -/* MDCIOCR - MDC/MDIO Command */ -#define COMMAND_OFFSET 31 /* MDCMDIO Command */ -#define COMMAND_MASK (1<<31) /* 0:Read Access, 1:Write Access */ -#define COMMAND_READ (0<<31) /* 0:Read Access, 1:Write Access */ -#define COMMAND_WRITE (1<<31) /* 0:Read Access, 1:Write Access */ -#define PHYADD_OFFSET (24) /* PHY Address, said, PHY ID */ -#define PHYADD_MASK (0x1f<<24) /* PHY Address, said, PHY ID */ -#define REGADD_OFFSET (16) /* PHY Register */ -#define REGADD_MASK (0x1f<<16) /* PHY Register */ -#define WRDATA_OFFSET (0) /* Data to PHY register */ -#define WRDATA_MASK (0xffff<<0) /* Data to PHY register */ - -/* MDCIOSR - MDC/MDIO Status */ -#define MDC_STATUS (1<<31) /* 0: Process Done, 1: In progress */ -#define MDCIO_STATUS (1<<31) -#define RDATA_OFFSET (0) /* Read Data Result of PHY register */ -#define RDATA_MASK (0xffff<<0) /* Read Data Result of PHY register */ - -/* PMCR - Port mirror control register field definitions */ -#define MirrorPortMsk_OFFSET 18 /* Port receiving the mirrored traffic (single bit set to 1 is allowed) */ -#define MirrorPortMsk_MASK (0x1ff<<18) /* Port receiving the mirrored traffic (single bit set to 1 is allowed) */ -#define MirrorRxPrtMsk_OFFSET 9 /* Rx port to be mirrored (Source Mirroring, multiple ports allowed) */ -#define MirrorRxPrtMsk_MASK (0x1ff<<9) /* Rx port to be mirrored (Source Mirroring, multiple ports allowed) */ -#define MirrorTxPrtMsk_OFFSET 0 /* Tx port to be mirrored (Destination Mirroring, multiple ports allowed) */ -#define MirrorTxPrtMsk_MASK (0x1ff<<0) /* Tx port to be mirrored (Destination Mirroring, multiple ports allowed) */ - -/* PPMAR - Per port matching action register field definitions */ -#define EnPatternMatch_OFFSET 26 /* Enable pattern match port list */ -#define EnPatternMatch_MASK (0x3f<<26) /* Enable pattern match port list */ -#define EnPatternMatch_P0 (1<<26) /* Enable pattern match for port 0 */ -#define EnPatternMatch_P1 (1<<27) /* Enable pattern match for port 1 */ -#define EnPatternMatch_P2 (1<<28) /* Enable pattern match for port 2 */ -#define EnPatternMatch_P3 (1<<29) /* Enable pattern match for port 3 */ -#define EnPatternMatch_P4 (1<<30) /* Enable pattern match for port 4 */ -#define EnPatternMatch_P5 (1<<31) /* Enable pattern match for port 5 */ -#define MatchOpRx5_OFFSET 24 /* operation if matched on port 5 */ -#define MatchOpRx5_MASK (3<<24) /* operation if matched on port 5 */ -#define MatchOpRx5_DROP (0<<24) /* Drop if matched on port 5 */ -#define MatchOpRx5_MTCPU (1<<24) /* Mirror to CPU if matched on port 5 */ -#define MatchOpRx5_FTCPU (2<<24) /* Forward to CPU if matched on port 5 */ -#define MatchOpRx5_MTMP (3<<24) /* Mirror to Mirror Port if matched on port 5 */ -#define MatchOpRx4_OFFSET 22 /* operation if matched on port 4 */ -#define MatchOpRx4_MASK (3<<22) /* operation if matched on port 4 */ -#define MatchOpRx4_DROP (0<<22) /* Drop if matched on port 4 */ -#define MatchOpRx4_MTCPU (1<<22) /* Mirror to CPU if matched on port 4 */ -#define MatchOpRx4_FTCPU (2<<22) /* Forward to CPU if matched on port 4 */ -#define MatchOpRx4_MTMP (3<<22) /* Mirror to Mirror Port if matched on port 4 */ -#define MatchOpRx3_OFFSET 20 /* operation if matched on port 3 */ -#define MatchOpRx3_MASK (3<<20) /* operation if matched on port 3 */ -#define MatchOpRx3_DROP (0<<20) /* Drop if matched on port 3 */ -#define MatchOpRx3_MTCPU (1<<20) /* Mirror to CPU if matched on port 3 */ -#define MatchOpRx3_FTCPU (2<<20) /* Forward to CPU if matched on port 3 */ -#define MatchOpRx3_MTMP (3<<20) /* Mirror to Mirror Port if matched on port 3 */ -#define MatchOpRx2_OFFSET 18 /* operation if matched on port 2*/ -#define MatchOpRx2_MASK (3<<18) /* operation if matched on port 2 */ -#define MatchOpRx2_DROP (0<<18) /* Drop if matched on port 2 */ -#define MatchOpRx2_MTCPU (1<<18) /* Mirror to CPU if matched on port 25 */ -#define MatchOpRx2_FTCPU (2<<18) /* Forward to CPU if matched on port 2 */ -#define MatchOpRx2_MTMP (3<<18) /* Mirror to Mirror Port if matched on port 2 */ -#define MatchOpRx1_OFFSET 16 /* operation if matched on port 1 */ -#define MatchOpRx1_MASK (3<<16) /* operation if matched on port 1 */ -#define MatchOpRx1_DROP (0<<16) /* Drop if matched on port 1 */ -#define MatchOpRx1_MTCPU (1<<16) /* Mirror to CPU if matched on port 1 */ -#define MatchOpRx1_FTCPU (2<<16) /* Forward to CPU if matched on port 1 */ -#define MatchOpRx1_MTMP (3<<16) /* Mirror to Mirror Port if matched on port 1 */ -#define MatchOpRx0_OFFSET 14 /* operation if matched on port 0 */ -#define MatchOpRx0_MASK (3<<14) /* operation if matched on port 0 */ -#define MatchOpRx0_DROP (0<<14) /* Drop if matched on port 0 */ -#define MatchOpRx0_MTCPU (1<<14) /* Mirror to CPU if matched on port 0 */ -#define MatchOpRx0_FTCPU (2<<14) /* Forward to CPU if matched on port 0 */ -#define MatchOpRx0_MTMP (3<<14) /* Mirror to Mirror Port if matched on port 0 */ - -/* CSCR, CCR - Checksum Control Register */ -#define EnL4ChkCal (1<<5) /* Enable L4 Checksum Re-calculation */ -#define EnL3ChkCal (1<<4) /* Enable L3 Checksum Re-calculation */ -#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) -#define AcceptL2Err (1<<3) /* CPU port L2 CRC Error Allow; 0: Not Allowed, 1: Allowed (default) */ -#endif -#define L4ChkSErrAllow (1<<2) /* L4 Checksum Error Allow */ -#define L3ChkSErrAllow (1<<1) /* L3 Checksum Error Allow */ -#define L2CRCErrAllow (1<<0) /* L2 CRC Error Allow */ - -/* EPOCR, EPIDR - Embedded PHY Operation Control Register */ -#define Port_embPhyID_MASK(port) ( 0x1f << ( port * 5 ) ) /* Embedded PHY ID MASK of port 'idx' */ -#define Port_embPhyID(id, port) ( id << ( port * 5 ) ) /* Embedded PHY ID setting of port 'idx' */ - -#define PCRAM_BASE (SWCORE_BASE+0x4100) -#define PITCR (0x000 + PCRAM_BASE) /* Port Interface Type Control Register */ -#define PCRP0 (0x004 + PCRAM_BASE) /* Port Configuration Register of Port 0 */ -#define PCRP1 (0x008 + PCRAM_BASE) /* Port Configuration Register of Port 1 */ -#define PCRP2 (0x00C + PCRAM_BASE) /* Port Configuration Register of Port 2 */ -#define PCRP3 (0x010 + PCRAM_BASE) /* Port Configuration Register of Port 3 */ -#define PCRP4 (0x014 + PCRAM_BASE) /* Port Configuration Register of Port 4 */ -#define PCRP5 (0x018 + PCRAM_BASE) /* Port Configuration Register of Port 5 */ -#define PCRP6 (0x01C + PCRAM_BASE) /* Port Configuration Register of Ext Port 0 */ -#define PCRP7 (0x020 + PCRAM_BASE) /* Port Configuration Register of Ext Port 1 */ -#define PCRP8 (0x024 + PCRAM_BASE) /* Port Configuration Register of Ext Port 2 */ -#define PSRP0 (0x028 + PCRAM_BASE) /* Port Status Register Port 0 */ -#define PSRP1 (0x02C + PCRAM_BASE) /* Port Status Register Port 1 */ -#define PSRP2 (0x030 + PCRAM_BASE) /* Port Status Register Port 2 */ -#define PSRP3 (0x034 + PCRAM_BASE) /* Port Status Register Port 3 */ -#define PSRP4 (0x038 + PCRAM_BASE) /* Port Status Register Port 4 */ -#define PSRP5 (0x03C + PCRAM_BASE) /* Port Status Register Port 5 */ -#define PSRP6 (0x040 + PCRAM_BASE) /* Port Status Register Port 6 */ -#define PSRP7 (0x044 + PCRAM_BASE) /* Port Status Register Port 7 */ -#define PSRP8 (0x048 + PCRAM_BASE) /* Port Status Register Port 8 */ -#define P0GMIICR (0x04C + PCRAM_BASE) /* Port-0 GMII Configuration Register */ -#define P5GMIICR (0x050 + PCRAM_BASE) /* Port-5 GMII Configuration Register */ - -/* PITCR - Port Interface Type Control Register */ -#define Port5_TypeCfg_GMII_MII_RGMII (0<<10) -#define Port4_TypeCfg_UTP (0<< 8) -#define Port4_TypeCfg_SerDes (1<< 8) -#define Port3_TypeCfg_UTP (0<< 6) -#define Port3_TypeCfg_SerDes (1<< 6) -#define Port2_TypeCfg_UTP (0<< 4) -#define Port2_TypeCfg_SerDes (1<< 4) -#define Port1_TypeCfg_UTP (0<< 2) -#define Port1_TypeCfg_SerDes (1<< 2) -#define Port0_TypeCfg_UTP (0<< 0) -#define Port0_TypeCfg_GMII_MII_RGMII (1<< 0) - -#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) - -#define GIGA_P5_PHYID 0x16 -/* 0xBB804104 ~ 0xBB804124 */ -/* PCRP0,PCRP1,PCRP2,PCRP3,PCRP4,PCRP5,PCRP6,PCRP7,PCRP8 - Port Configuration Register */ -#define BYPASS_TCRC (1 << 31) /* Not recalculate CRC error */ -#define ExtPHYID_OFFSET (26) /* External PHY ID */ -#define ExtPHYID_MASK (0x1f<<26) /* External PHY ID */ -#define EnForceMode (1<<25) /* Enable Force Mode to set link/speed/duplix/flow status */ - - /* EnForceMode=0, PollLinkStatus: do not care - EnForceMode=1, PollLinkStatus=0 : ForceMode , disable Auto-Negotiation. It's noted that The mode should be setting for MAC-to-MAC connection. - PollLinkStatus=1: ForceMode with polling link status, disable Auto-Negotiation but polling phy's link status. - */ -#define PollLinkStatus (1<<24) -#define ForceLink (1<<23) /* 0-link down, 1-link up */ - - /* FrcAbi_AnAbi_sel[4:0]: bit 22 ~ 18 - If EnForceMode = 1, FrcAbi_AnAbi_sel is used to indicate the force mode operation. (For either MAC mode or PHY mode operation.) - FrcAbi_AnAbi_sel[0] = ForceDuplex1: force FULL duplex , 0: force HALF duplex - FrcAbi_AnAbi_sel[2:1] = ForceSpeed00: force 10Mbps 01: force 100Mbps ( default setting for port#5 NFBI-PHY-mode spec. ) - 10: force 1000Mbps 11: reserved. - FrcAbi_AnAbi_sel[4:3] = Reserved, useless. - If EnForceMode = 0, FrcAbi_AnAbi_sel is used to indicate Auto-Negotiation advertise ability. - FrcAbi_AnAbi_sel[0]: 10Mbps Half-duplexFrcAbi_AnAbi_sel[1]: 10Mbps Full-duplexFrcAbi_AnAbi_sel[2]: 100Mbps Half-duplex - FrcAbi_AnAbi_sel[3]: 100Mbps Full-duplexFrcAbi_AnAbi_sel[4]: 1000Mbps Full-duplex - */ -// !!! temp, 8198 has no these bits -#define IPMSTP_PortST_MASK (3<<21) /* Mask of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_OFFSET (21) /* Offset of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_DISABLE (0<<21) /* Disable State of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_BLOCKING (1<<21) /* Blocking State of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_LISTENING (1<<21) /* Listening State of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_LEARNING (2<<21) /* Learning State of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_FORWARDING (3<<21) /* Forwarding State of IP Multicast Spanning Tree Protocol Port State Control */ - -#define ForceSpeedMask (3<<19) /* Force speed Mask */ -#define ForceSpeed10M (0<<19) /* Force speed 10M */ -#define ForceSpeed100M (1<<19) /* Force speed 100M */ -#define ForceSpeed1000M (2<<19) /* Force speed 1G */ -#define ForceDuplex (1<<18) /* Force Duplex */ -#define AutoNegoSts_OFFSET (18) -#define AutoNegoSts_MASK (0x1f<<18) -/* bit 16, 17 - if EnForceMode = 1, PAUSE flow control ability Control . - [0]= enable TX pause ability - [1]= enable RX pause ability - if EnForceMode =0, PHY advertise pause operation ability : - [0]= PAUSE operation for full duplex links - [1]= Asymmetric PAUSE operation for full duplex links - */ -#define PauseFlowControl_MASK (3<<16) /* Mask for per-port 802.3 PAUSE flow control ability control */ -#define PauseFlowControlNway (0<<16) /* Follow the PHY N-way result */ -#define PauseFlowControlEtxDrx (1<<16) /* force: enable TX, disable RX */ -#define PauseFlowControlDtxErx (2<<16) /* force: disable TX, enable RX */ -#define PauseFlowControlEtxErx (3<<16) /* force: enable TX, enable RX */ - -#define MIIcfg_CRS (1<<15) /* MII interface Parameter setup */ -#define MIIcfg_COL (1<<14) /* MII interface Parameter setup */ -#define MIIcfg_RXER (1<<13) /* MII interface Parameter setup */ -#define GMIIcfg_CRS (1<<12) /* GMII interface Parameter setup */ -#define BCSC_Types_MASK (7<<9) /* Broadcast Storm Control packet type selection */ -//#define BCSC_ENUNKNOWNUNICAST (1<<11) /* Enable control for unknown unicast packet */ -#define BCSC_ENMULTICAST (1<<10) /* Enable control for multicast packet */ -#define BCSC_ENBROADCAST (1<<9) /* Enable control for broadcast packet */ -#define ENBCSC (1<<8) /* Enable broadcast storm control */ -#define EnLoopBack (1<<7) /* Enable MAC-PHY interface Mii Loopback */ -#define DisBKP (1<<6) /* Per-port Disable Backpressure function for Half duplex */ -#define STP_PortST_MASK (3<<4) /* Mask Spanning Tree Protocol Port State Control */ -#define STP_PortST_OFFSET (4) /* Offset */ -#define STP_PortST_DISABLE (0<<4) /* Disable State */ -#define STP_PortST_BLOCKING (1<<4) /* Blocking State */ -#define STP_PortST_LISTENING (1<<4) /* Listening State */ -#define STP_PortST_LEARNING (2<<4) /* Learning State */ -#define STP_PortST_FORWARDING (3<<4) /* Forwarding State */ -#define MacSwReset (1<<3) /* 0: reset state, 1: normal state */ -#define AcptMaxLen_OFFSET (1) /* Enable the max acceptable packet length supported */ -#define AcptMaxLen_MASK (3<<1) /* Enable the max acceptable packet length supported */ -#define AcptMaxLen_1536 (0<<1) /* 1536 Bytes (RTL865xB) */ -#define AcptMaxLen_1552 (1<<1) /* 1552 Bytes (RTL865xB) */ -#define AcptMaxLen_9K (2<<1) /* 9K(9216) Bytes */ -#define AcptMaxLen_16K (3<<1) /* 16370 bytes = 16K-2(cutoff)-4(vlan)-8(pppoe) */ -#define EnablePHYIf (1<<0) /* Enable PHY interface. */ - -/* 0xBB804150 P5GMIICR */ -#define Conf_done (1<<6) /*Port5 configuration is done to enable the frame reception and transmission. */ -#define P5txdely (1<<4) /*Port5 TX clock delay. */ - - -/* 0xBB804008 */ -/* MDCIOSR - MDC/MDIO Status */ -#define MDCIOSR_ReadError (1<<30) /* read only: MII management frame reading error */ - - -/* 0xBB804008 */ -/* GDSR0 - Global Descriptor Status Register 0 */ -#define HSA_OverRun (1<<28) /* HSA fifo is overflow */ - -#else -/* PCRP0,PCRP1,PCRP2,PCRP3,PCRP4,PCRP5,PCRP6,PCRP7,PCRP8 - Port Configuration Register */ -#define BYPASS_TCRC (1 << 29) /* Not recalculate CRC error */ -#define ExtPHYID_OFFSET (24) /* External PHY ID */ -#define ExtPHYID_MASK (0x1f<<24) /* External PHY ID */ -#define EnForceMode (1<<23) /* Enable Force Mode to set link/speed/duplix/flow status */ -#define ForceLink (1<<22) /* 0-link down, 1-link up */ -#define ForceSpeedMask (3<<20) /* Force speed Mask */ -#define ForceSpeed10M (0<<20) /* Force speed 10M */ -#define ForceSpeed100M (1<<20) /* Force speed 100M */ -#define ForceSpeed1000M (2<<20) /* Force speed 1G */ -#define ForceDuplex (1<<19) /* Force Duplex */ -#define MIIcfg_CRS (1<<18) /* MII interface Parameter setup */ -#define MIIcfg_COL (1<<17) /* MII interface Parameter setup */ -#define MIIcfg_RXER (1<<16) /* MII interface Parameter setup */ -#define GMIIcfg_CRS (1<<15) /* GMII interface Parameter setup */ -#define BCSC_Types_MASK (7<<12) /* Broadcast Storm Control packet type selection */ -#define BCSC_ENUNKNOWNUNICAST (1<<14) /* Enable control for unknown unicast packet */ -#define BCSC_ENMULTICAST (1<<13) /* Enable control for multicast packet */ -#define BCSC_ENBROADCAST (1<<12) /* Enable control for broadcast packet */ -#define ENBCSC (1<<11) /* Enable broadcast storm control */ -#define EnLoopBack (1<<10) /* Enable MAC-PHY interface Mii Loopback */ -#define PauseFlowControl_MASK (3<<8) /* Mask for per-port 802.3 PAUSE flow control ability control */ -#define PauseFlowControlNway (0<<8) /* Follow the PHY N-way result */ -#define PauseFlowControlEtxDrx (1<<8) /* force: enable TX, disable RX */ -#define PauseFlowControlDtxErx (2<<8) /* force: disable TX, enable RX */ -#define PauseFlowControlEtxErx (3<<8) /* force: enable TX, enable RX */ -#define DisBKP (1<<7) /* Per-port Disable Backpressure function for Half duplex */ -#define STP_PortST_MASK (3<<5) /* Mask Spanning Tree Protocol Port State Control */ -#define STP_PortST_OFFSET (5) /* Offset */ -#define STP_PortST_DISABLE (0<<5) /* Disable State */ -#define STP_PortST_BLOCKING (1<<5) /* Blocking State */ -#define STP_PortST_LISTENING (1<<5) /* Listening State */ -#define STP_PortST_LEARNING (2<<5) /* Learning State */ -#define STP_PortST_FORWARDING (3<<5) /* Forwarding State */ -#define IPMSTP_PortST_MASK (3<<3) /* Mask of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_OFFSET (3) /* Offset of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_DISABLE (0<<3) /* Disable State of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_BLOCKING (1<<3) /* Blocking State of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_LISTENING (1<<3) /* Listening State of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_LEARNING (2<<3) /* Learning State of IP Multicast Spanning Tree Protocol Port State Control */ -#define IPMSTP_PortST_FORWARDING (3<<3) /* Forwarding State of IP Multicast Spanning Tree Protocol Port State Control */ -#define AcptMaxLen_OFFSET (1) /* Enable the max acceptable packet length supported */ -#define AcptMaxLen_MASK (3<<1) /* Enable the max acceptable packet length supported */ -#define AcptMaxLen_1536 (0<<1) /* 1536 Bytes (RTL865xB) */ -#define AcptMaxLen_1552 (1<<1) /* 1552 Bytes (RTL865xB) */ -#define AcptMaxLen_9K (2<<1) /* 9K(9216) Bytes */ -#define AcptMaxLen_16K (3<<1) /* 16370 bytes = 16K-2(cutoff)-4(vlan)-8(pppoe) */ -#define EnablePHYIf (1<<0) /* Enable PHY interface. */ -#endif - -/* PSRP0,PSRP1,PSRP2,PSRP3,PSRP4,PSRP5,PSRP6,PSRP7,PSRP8 - Port Status Register Port 0~8 */ -#define LinkDownEventFlag (1<<8) /* Port Link Down Event detecting monitor flag */ -#define PortStatusNWayEnable (1<<7) /* N-Way Enable */ -#define PortStatusRXPAUSE (1<<6) /* Rx PAUSE */ -#define PortStatusTXPAUSE (1<<5) /* Tx PAUSE */ -#define PortStatusLinkUp (1<<4) /* Link Up */ -#define PortStatusDuplex (1<<3) /* Duplex */ -#define PortStatusLinkSpeed_MASK (3<<0) /* Link Speed */ -#define PortStatusLinkSpeed_OFFSET 0 -#define PortStatusLinkSpeed10M (0<<0) /* 10M */ -#define PortStatusLinkSpeed100M (1<<0) /* 100M */ -#define PortStatusLinkSpeed1000M (2<<0) /* 1000M */ -#define PortStatusLinkSpeedReserved (3<<0) /* Reserved Speed */ - -/* P0GMIICR Port-0 / Port-5 GMII Configuration Register */ -#define CFG_GMAC_MASK (3<<23) /* The register default reflect the HW power on strapping value of H/W pin. */ -#define CFG_GMAC_RGMII (0<<23) /* RGMII mode */ -#define CFG_GMAC_GMII_MII_MAC (1<<23) /* GMII/MII MAC mode */ -#define CFG_GMAC_GMII_MII_PHY (2<<23) /* GMII/MII PHY mode */ -#define CFG_GMAC_Reserved (3<<23) /* Reserved */ - -#define RGMII_RCOMP_MASK (3<<0) /* RGMII Input Timing compensation control */ -#define RGMII_RCOMP_0NS (0<<0) /* Rcomp 0.0 ns */ -#define RGMII_RCOMP_1DOT5NS (1<<0) /* Rcomp 1.5 ns */ -#define RGMII_RCOMP_2NS (2<<0) /* Rcomp 2.0 ns */ -#define RGMII_RCOMP_2DOT5NS (3<<0) /* Rcomp 3.0 ns */ -#define RGMII_TCOMP_MASK (7<<2) /* RGMII Output Timing compensation control */ -#define RGMII_TCOMP_0NS (0<<2) /* Tcomp 0.0 ns */ -#define RGMII_TCOMP_1DOT5NS (1<<2) /* Tcomp 1.5 ns */ -#define RGMII_TCOMP_2NS (2<<2) /* Tcomp 2.0 ns */ -#define RGMII_TCOMP_2DOT5NS (3<<2) /* Tcomp 2.5 ns */ -#define RGMII_TCOMP_3NS (4<<2) /* Tcomp 3.0 ns */ -#define RGMII_TCOMP_4NS (5<<2) /* Tcomp 4.0 ns */ -#define RGMII_TCOMP_6NS (6<<2) /* Tcomp 6.0 ns */ -#define RGMII_TCOMP_7NS (7<<2) /* Tcomp 7.0 ns */ - -#define EEECR (0x60+PCRAM_BASE) /* EEE ability Control Register ( 0xBB80_4160 ) */ -/* EEE ability Control Register ( 0xBB80_4160 ) */ -#define EN_P5_FRC_EEE (1 << 29) /* Enable Port 5 EEE force mode */ -#define FRC_P5_EEE_Giga (1 << 28) /* Force Port 5 EEE ability for 1000BASE-T. */ -#define FRC_P5_EEE_100 (1 << 27) /* Force Port 5 EEE ability for 100BASE-TX. */ -#define EN_P5_TX_EEE (1 << 26) /* Enable Port 5 MAC TX EEE ability */ -#define EN_P5_RX_EEE (1 << 25) /* Enable Port 5 MAC RX EEE ability */ -#define EN_P4_FRC_EEE (1 << 24) /* Enable Port 4 EEE force mode */ -#define FRC_P4_EEE_Giga (1 << 23) /* Force Port 4 EEE ability for 1000BASE-T. */ -#define FRC_P4_EEE_100 (1 << 22) /* Force Port 4 EEE ability for 100BASE-TX. */ -#define EN_P4_TX_EEE (1 << 21) /* Enable Port 4 MAC TX EEE ability */ -#define EN_P4_RX_EEE (1 << 20) /* Enable Port 4 MAC RX EEE ability */ -#define EN_P3_FRC_EEE (1 << 19) /* Enable Port 3 EEE force mode */ -#define FRC_P3_EEE_Giga (1 << 18) /* Force Port 3 EEE ability for 1000BASE-T. */ -#define FRC_P3_EEE_100 (1 << 17) /* Force Port 3 EEE ability for 100BASE-TX. */ -#define EN_P3_TX_EEE (1 << 16) /* Enable Port 3 MAC TX EEE ability */ -#define EN_P3_RX_EEE (1 << 15) /* Enable Port 3 MAC RX EEE ability */ -#define EN_P2_FRC_EEE (1 << 14) /* Enable Port 2 EEE force mode */ -#define FRC_P2_EEE_Giga (1 << 13) /* Force Port 2 EEE ability for 1000BASE-T */ -#define FRC_P2_EEE_100 (1 << 12) /* Force Port 2 EEE ability for 100BASE-TX. */ -#define EN_P2_TX_EEE (1 << 11) /* Enable Port 2 MAC TX EEE ability */ -#define EN_P2_RX_EEE (1 << 10) /* Enable Port 2 MAC RX EEE ability */ -#define EN_P1_FRC_EEE (1 << 9) /* Enable Port 1 EEE force mode */ -#define FRC_P1_EEE_Giga (1 << 8) /* Force Port 1 EEE ability for 1000BASE-T. */ -#define FRC_P1_EEE_100 (1 << 7) /* Force Port 1 EEE ability for 100BASE-TX. */ -#define EN_P1_TX_EEE (1 << 6) /* Enable Port 1 MAC TX EEE ability */ -#define EN_P1_RX_EEE (1 << 5) /* Enable Port 1 MAC RX EEE ability */ -#define EN_P0_FRC_EEE (1 << 4) /* Enable Port 0 EEE force mode */ -#define FRC_P0_EEE_Giga (1 << 3) /* Force Port 0 EEE ability for 1000BASE-T. */ -#define FRC_P0_EEE_100 (1 << 2) /* Force Port 0 EEE ability for 100BASE-TX. */ -#define EN_P0_TX_EEE (1 << 1) /* Enable Port 0 MAC TX EEE ability */ -#define EN_P0_RX_EEE (1 << 0) /* Enable Port 0 MAC RX EEE ability */ - - -#define SWMISC_BASE (0x4200+SWCORE_BASE) -/* Chip Version ID Register */ -#define CVIDR (0x00+SWMISC_BASE) /* Chip Version ID Register */ -#define SSIR (0x04+SWMISC_BASE) /* System Initial and Reset Registe*/ - -#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) -#define CRMR (0x08+SWMISC_BASE) /* Chip Revision Management Register */ -#define BISTCR (0x0C+SWMISC_BASE) /* BIST control */ -#define BISTTSDR0 (0x38+SWMISC_BASE) /* BIST Test Status Diagnostic Register 0 */ -#define BISTTSDR1 (0x38+SWMISC_BASE) /* BIST Test Status Diagnostic Register 1 */ -#define BISTTSDR2 (0x3C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 2 */ -#define BISTTSDR3 (0x40+SWMISC_BASE) /* BIST Test Status Diagnostic Register 3 */ -#define BISTTSDR4 (0x44+SWMISC_BASE) /* BIST Test Status Diagnostic Register 4 */ -#define BISTTSDR5 (0x48+SWMISC_BASE) /* BIST Test Status Diagnostic Register 5 */ -#define BISTTSDR6 (0x4C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 6 */ -#define BISTTSDR7 (0x50+SWMISC_BASE) /* BIST Test Status Diagnostic Register 7 */ -#define BISTTSDR8 (0x54+SWMISC_BASE) /* BIST Test Status Diagnostic Register 8 */ -#define BISTTSDR9 (0x58+SWMISC_BASE) /* BIST Test Status Diagnostic Register 9 */ -#define BISTTSDR10 (0x5C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 10 */ -#define BISTTSDR11 (0x60+SWMISC_BASE) /* BIST Test Status Diagnostic Register 11 */ -#else -#define BISTCR (0x08+SWMISC_BASE) /* BIST control */ -#define BISTTSDR0 (0x0C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 0 */ -#define BISTTSDR1 (0x10+SWMISC_BASE) /* BIST Test Status Diagnostic Register 1 */ -#define BISTTSDR2 (0x14+SWMISC_BASE) /* BIST Test Status Diagnostic Register 2 */ -#define BISTTSDR3 (0x18+SWMISC_BASE) /* BIST Test Status Diagnostic Register 3 */ -#define BISTTSDR4 (0x1C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 4 */ -#define BISTTSDR5 (0x20+SWMISC_BASE) /* BIST Test Status Diagnostic Register 5 */ -#define BISTTSDR6 (0x24+SWMISC_BASE) /* BIST Test Status Diagnostic Register 6 */ -#define BISTTSDR7 (0x28+SWMISC_BASE) /* BIST Test Status Diagnostic Register 7 */ -#define BISTTSDR8 (0x2C+SWMISC_BASE) /* BIST Test Status Diagnostic Register 8 */ -#define BISTTSDR9 (0x30+SWMISC_BASE) /* BIST Test Status Diagnostic Register 9 */ -#define BISTTSDR10 (0x34+SWMISC_BASE) /* BIST Test Status Diagnostic Register 10 */ -#define BISTTSDR11 (0x38+SWMISC_BASE) /* BIST Test Status Diagnostic Register 11 */ -#define CRMR (0x3C+SWMISC_BASE) /* Chip Revision Management Register */ -#endif -#define SIRR (SSIR) /* Alias Name */ - -/* SIRR, SSIR - System Initial and Reset Register*/ -#define SwitchFullRst (1 << 2) /* Reset all tables & queues */ -#define SwitchSemiRst (1 << 1) /* Reset queues */ -#define TRXRDY (1 << 0) /* Start normal TX and RX */ -#define FULL_RST SwitchFullRst /* Alias Name */ -#define SEMI_RST SwitchSemiRst /* Alias Name */ - -/* BISTCR - BIST control register field definitions */ -#define DisBIST (1<<31) /* (RO)1 if Disable all SRAM BIST. By default, all SRAM BIST are invoked after power-on reset completes. */ -#define dis_skip_fp (1<<30) /* Disable skipping fail pages. Only column repairs of the packet buffer take effect. */ -#define diag_mode (1<<29) /* Enter the diagnosis mode for the SRAM of packet buffer */ -#define diag_done (1<<28) /* The diagnosis mode for the packet buffer allows the user to perform diagnosis of the memory defects. */ -#define lat_fail_info (1<<27) /* Latch failure information for a specific testing condition. */ -#define bisting_MASK (0x000007ff)/* bisting[10]=NICTXRAM BIST ongoingbisting - [9]=NICRXRAM BIST ongoingbisting - [8]=V4KRAM BIST ongoingbisting - [7]=PBRAM BIST ongoingbisting - [6]=OQRAM BIST ongoingbisting - [5]=MIBRAM BIST ongoingbisting - [4]=L2/L4RAM BIST ongoingbisting - [3]=IQRAM BIST ongoingbisting - [2]=HTRAM BIST ongoingbisting - [1]=HSARAM BIST ongoingbisting - [0]=ACL/AMI/RLMRAM BIST ongoing */ -#define bisting_OFFSET 0 -#define BIST_READY_MASK bisting_MASK /* Alias Name */ -#define BIST_READY_PATTERN 0x00000000 - -/* BISTTSDR0 - IST Test Status Diagnostic Register 0 */ -#define BISTTSDR0_READY_MASK 0x03ffffff -#define BISTTSDR0_READY_PATTERN 0x00000000 - -/* Chip version ID register field definitions */ -#define RTL8650_CVID 0x86500000 - - -/**********************************************************************/ -#define ALE_BASE (0x4400+SWCORE_BASE) -#define TEACR (0x00+ALE_BASE) /* Table Entry Aging Control Register */ -#define TEATCR (0x04+ALE_BASE) /* Table entry aging time control */ -#define RMACR (0x08+ALE_BASE) /* Reserved Multicast Address Address Mapping */ -#define ALECR (0x0C+ALE_BASE) /* ALE Control Register */ -#define MSCR (0x10+ALE_BASE) /* Module Switch Control Register */ -#define TTLCR (0x0C+ALE_BASE) /* TTL control */ -#define L4TOCR (0x14+ALE_BASE) /* L4 Table Offset control */ -#define SWTCR0 (0x18+ALE_BASE) /* swtich table control register 0 */ -#define SWTCR1 (0x1C+ALE_BASE) /* swtich table control register 1 */ -#define PLITIMR (0x20+ALE_BASE) /* Port to LAN Interface Table Index Mapping Register */ -#define DACLRCR (0x24+ALE_BASE) /* default ACL rule control register */ -#define FFCR (0x28+ALE_BASE) /*Frame Forwarding Configuratoin Register */ -#define MGFCR_E0R0 (0x2C+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_0 R0 */ -#define MGFCR_E0R1 (0x30+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_1 R1 */ -#define MGFCR_E0R2 (0x34+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_2 R2 */ -#define MGFCR_E1R0 (0x38+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_0 R0 */ -#define MGFCR_E1R1 (0x3C+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_1 R1 */ -#define MGFCR_E1R2 (0x40+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_2 R2 */ -#define MGFCR_E2R0 (0x44+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_0 R0 */ -#define MGFCR_E2R1 (0x48+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_1 R1 */ -#define MGFCR_E2R2 (0x4C+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_2 R2 */ -#define MGFCR_E3R0 (0x50+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_0 R0 */ -#define MGFCR_E3R1 (0x54+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_1 R1 */ -#define MGFCR_E3R2 (0x58+ALE_BASE) /*L2 MAC Group Forwarding Control Register Entry_2 R2 */ -#define OCR L4TOCR /* Alias Name */ - - -/* TEACR - Table Entry Aging Control Register */ -#define EnRateLimitTbAging (1<<6) /* Enable Rate Limit table hardware aging function. */ -#define EnL2FastAging (1<<5) /* Enable L2 Fast Aging Out */ -#define EnL2HashColOW (1<<4) /* Enable L2 Tablsh Hash Collision Over Write */ -#define IPMcastAgingDisable (1<<3) /* 0=Enable IP Multicast table aging. 1=disable */ -#define PPPoEAgingDisable (1<<2) /* 0=Enable PPPoE Table Aging. 1=disable */ -#define L4AgingDisable (1<<1) /* 0=Enable L4 Aging. 1=disable */ -#define L2AgingDisable (1<<0) /* 0=Enable L2 Aging. 1=disable */ - -/* TEATCR - Table entry aging time control */ -#define ICMPT_OFFSET 24 /* ICMP Timeout */ -#define ICMPT_MASK (0x3f<<24) /* ICMP TImeout */ -#define UDPT_OFFSET 18 /* UDP Timeout */ -#define UDPT_MASK (0x3f<<18) /* UDP Timeout */ -#define TCPLT_OFFSET 12 /* TCP Long Timeout */ -#define TCPLT_MASK (0x3f<<12) /* TCP Long Timeout */ -#define TCPMT_OFFSET 6 /* TCP Medium Timeout */ -#define TCPMT_MASK (0x3f<<6) /* TCP Medium Timeout */ -#define TCPST_OFFSET 0 /* TCP Short Timeout */ -#define TCPST_MASK (0x3f<<0) /* TCP Short Timeout */ - -/* RMACR - Reserved Multicast Address Address Mapping (01-80-c2-00-00-xx) */ -#define MADDR20_2F (1<< 8) /* GARP Reserved Address */ -#define MADDR00_10 (1<< 7) /* 802.1d Reservedd Address */ -#define MADDR21 (1<< 6) /* GVRP Address */ -#define MADDR20 (1<< 5) /* GMRP Address */ -#define MADDR10 (1<< 4) /* All LANs Bridge Management Group Address */ -#define MADDR0E (1<< 3) /* IEEE Std. 802.1AB Link Layer Discovery protocol multicast address */ -#define MADDR03 (1<< 2) /* IEEE Std 802.1X PAE address */ -#define MADDR02 (1<< 1) /* IEEE Std 802.3ad Slow Protocols-Multicast address */ -#define MADDR00 (1<< 0) /* BPDU (Bridge Group Address) */ - -/* ALECR */ -#define EN_PPPOE (1<<18) /* Enable PPPoE auto-encapsulation and auto-decapsulation */ -#define TTL_1Enable (1<<16) /* Enable TTL-1 operation for L3 routing */ -#define Fragment2CPU (1<<15) /* When ACL is enabled, enable all fragmented IP packet to be trapped to CPU (because L4 is needed) - When ACL is disabled, if this bit is set, L2 forwarding as before, L3 above operation will trapped to CPU. - When ACL is disabled, if this bit is not set, IP fragment packet will be forwarded as normal via L3 routing or NAT. */ -#define FRAG2CPU Fragment2CPU -#define MultiCastMTU_OFFSET (0) -#define MultiCastMTU_MASK (0x3fff) -#define MULTICAST_L2_MTU_MASK MultiCastMTU_MASK /* Alias Name */ -#define EN_TTL1 TTL_1Enable /* Alias Name */ - - -/* MSCR - Module Switch Control Register */ -#define DisChk_CFI (1<< 9) /* Disable Check CFI bit for L2 random packet testing purpose. */ -#define EnRRCP2CPU (1<< 7) /* Enable trap RRCP packet to CPU port for L2 testing purpose. RRCP: Realtek Remote Control Protocol (Proprietary) */ -#define NATTM (1<< 6) /* 0: Normal mode processing, 1: NAT Test Mode */ -#define Enable_ST (1<< 5) /* Enable Spanning Tree Protocol. 0: disable, 1: enable */ -#define Ingress_ACL (1<< 4) /* Enable Ingress ACL. 0: disable, 1: enable */ -#define Egress_ACL (1<< 3) /* Enable Egress ACL. 0: disable, 1: enable */ -#define Mode_OFFSET 0 /* Switch operation layer function mode */ -#define Mode_MASK (7<< 0) /* Switch operation layer function mode */ -#define Mode_enL2 (1<< 0) /* Enable L2 */ -#define Mode_enL3 (1<< 1) /* Enable L3 */ -#define Mode_enL4 (1<< 2) /* Enable L4 */ -#define EN_STP Enable_ST /* Alias Name */ -#define EN_IN_ACL Ingress_ACL /* Alias Name */ -#define EN_OUT_ACL Egress_ACL /* Alias Name */ -#define EN_L4 Mode_enL4 /* Alias Name */ -#define EN_L3 Mode_enL3 /* Alias Name */ -#define EN_L2 Mode_enL2 /* Alias Name */ - -/* SWTCR0 - swtich table control register */ -#define STOP_TLU_STA (1<<19) /* (RO) Table Lookup Stop Status. 1-STOP_TLU command execute is ready */ -#define STOP_TLU (1<<18) /* Stop Table Lookup Process 1-to stop */ -#define LIMDBC_OFFSET (16) /* LAN Interface Multilayer-Decision-Base Control */ -#define LIMDBC_MASK (3<<16) -#define LIMDBC_VLAN (0<<16) /* By VLAN base */ -#define LIMDBC_PORT (1<<16) /* By Port base */ -#define LIMDBC_MAC (2<<16) /* By MAC base */ -#define EnUkVIDtoCPU (1 << 15) /* Enable trap unknown tagged VID (VLAN table lookup miss) packet to CPU */ -#define NAPTF2CPU (1 << 14) /* Trap packets not in TCP/UDP/ICMP format and - destined to the interface required to do NAPT */ -#define MultiPortModeP_OFFSET (5) /* Multicast Port Mode : Internal (0) or External (1) */ -#define MultiPortModeP_MASK (0x1ff) /* {Ext3~Ext1,Port0~Port5} 0:Internal, 1:External */ -#define MCAST_PORT_EXT_MODE_OFFSET MultiPortModeP_OFFSET /* Alias Name */ -#define MCAST_PORT_EXT_MODE_MASK MultiPortModeP_MASK /* Alias Name */ -#define WANRouteMode_OFFSET (3) -#define WANRouteMode_MASK (3<<3) -#define WANRouteMode_Forward (0<<3) -#define WANRouteMode_ToCpu (1<<3) -#define WANRouteMode_Drop (2<<3) -#define WAN_ROUTE_MASK WANRouteMode_MASK -#define WAN_ROUTE_FORWARD WANRouteMode_Forward /* Route WAN packets */ -#define WAN_ROUTE_TO_CPU WANRouteMode_ToCpu /* Forward WAN packets to CPU */ -#define WAN_ROUTE_DROP WANRouteMode_Drop /* Drop WAN packets */ -#define EnNAPTAutoDelete (1<<2) -#define EnNAPTAutoLearn (1<<1) -#define EnNAPTRNotFoundDrop (1<<0) /* 0: Reverse NAPT entry not found to forward to CPU, 1: Reverse NAPT entry not found to drop */ -#define EN_NAPT_AUTO_DELETE EnNAPTAutoDelete /* Enable NAPT auto delete */ -#define EN_NAPT_AUTO_LEARN EnNAPTAutoLearn /* Enable NAPT auto learn */ -#define NAPTR_NOT_FOUND_DROP EnNAPTRNotFoundDrop /* Reverse NAPT not found to S_DROP */ - -/* SWTCR1 - swtich table control register */ -#define L4EnHash1 (1 << 13) /* Enhanced Hash1 */ -#define EnNAP8651B (1 << 12) /* Enable 51B mode */ -#define EN_RTL8650B EnNAP8651B /* Alias Name */ -#define ENFRAGTOACLPT (1 << 11) /* Enable fragment packet checked by ACL and protocol trapper */ -#define EN_FRAG_TO_ACLPT ENFRAGTOACLPT/* Alias Name */ -#define EnNATT2LOG (1 << 10) /* Enable trapping attack packets for logging */ -#define EN_ATTACK_TO_LOG EnNATT2LOG /* Alias Name */ -#define EnL4WayH (1 << 9) /* Enable 4-way hash on L4 TCP/UDP table */ -#define EN_TCPUDP_4WAY_HASH EnL4WayH /* Alias Name */ -#define SelCpuReason (1 << 8) /* Enable 51B CPU reason coding */ -#define EN_51B_CPU_REASON SelCpuReason/* Alias Name */ -#define EN_SPI6_WAN_SRVPRT (1 << 7) /* Enable SPI-6 between WAN and server port */ -#define EN_SPI5_WAN_NI (1 << 6) /* Enable SPI-5 between WAN and NI */ -#define EN_SPI4_WAN_DMZ (1 << 5) /* Enable SPI-4 between WAN and DMZ */ -#define EN_SPI3_DMZ_RLAN (1 << 4) /* Enable SPI-3 between DMZ and RLAN */ -#define EN_SPI2_DMZ_LAN (1 << 3) /* Enable SPI-2 between DMZ and LAN */ -#define EN_SPI1_WAN_RLAN (1 << 2) /* Enable SPI-1 between WAN and RLAN */ -#define EnSPIRDrp (1 << 1) /* Enable dropping packets not found by reverse SPI */ -#define EN_DROP_SPIR_NOT_FOUND EnSPIRDrp /* Alias Name */ -#define TrapSPIUnknown (1 << 0) /* Enable SPI trapping non-TCP/UDP/ICMP packets */ -#define EN_SPI_TRAP_UNKNOWN TrapSPIUnknown/* Alias Name */ -#if 0 /* no longer supported */ -#define EN_FRAG_PPPOE (1 << 20) /* Enable auto-fragment for PPPoE */ -#define EN_MCAST_TBL_AGING (1 << 19) /* Enable aging of IP multicast table */ -#define EN_PPPOE_TBL_AGING (1 << 18) /* Enable aging of PPPoE table */ -#endif - -/* PLITIMR - Port to LAN Interface Table Index Mapping Register */ -#define INTP0_OFFSET 0 /* Index for P0, pointing to Interface table */ -#define INTP0_MASK (7<<0) /* Index for P0, pointing to Interface table */ -#define INTP1_OFFSET 3 /* Index for P1, pointing to Interface table */ -#define INTP1_MASK (7<<3) /* Index for P1, pointing to Interface table */ -#define INTP2_OFFSET 6 /* Index for P2, pointing to Interface table */ -#define INTP2_MASK (7<<6) /* Index for P2, pointing to Interface table */ -#define INTP3_OFFSET 9 /* Index for P3, pointing to Interface table */ -#define INTP3_MASK (7<<9) /* Index for P3, pointing to Interface table */ -#define INTP4_OFFSET 12 /* Index for P4, pointing to Interface table */ -#define INTP4_MASK (7<<12) /* Index for P4, pointing to Interface table */ -#define INTP5_OFFSET 15 /* Index for P5, pointing to Interface table */ -#define INTP5_MASK (7<<15) /* Index for P5, pointing to Interface table */ -#define INTExtP0_OFFSET 18 /* Index for Ext0, pointing to Interface table */ -#define INTExtP0_MASK (7<<18) /* Index for Ext0, pointing to Interface table */ -#define INTExtP1_OFFSET 21 /* Index for Ext1, pointing to Interface table */ -#define INTExtP1_MASK (7<<21) /* Index for Ext1, pointing to Interface table */ -#define INTExtP2_OFFSET 24 /* Index for Ext2, pointing to Interface table */ -#define INTExtP2_MASK (7<<24) /* Index for Ext2, pointing to Interface table */ - -/* DACLRCR - Default ACL Rule Control Register */ -#define ACLI_STA_MASK (0x7f) -#define ACLI_EDA_OFFSET 7 -#define ACLI_EDA_MASK (0x7f<<ACLI_EDA_OFFSET) -#define ACLO_STA_OFFSET 14 -#define ACLO_STA_MASK (0x7f<<ACLO_STA_OFFSET) -#define ACLO_EDA_OFFSET 21 -#define ACLO_EDA_MASK (0x7f<<ACLO_EDA_OFFSET) - -/* FFCR - Frame Forwarding Configuration Register */ -#define IPMltCstCtrl_OFFSET (3) /* IP Multicast Forwarding Control */ -#define IPMltCstCtrl_MASK (3<<3) /* IP Multicast Forwarding Control */ -#define IPMltCstCtrl_Disable (0<<3) /* Disable IP Multicast table lookup (just follow L2 Multicast packet procedure) */ -#define IPMltCstCtrl_Enable (1<<3) /* Enable IP Multicast table lookup */ -#define IPMltCstCtrl_TrapToCpu (2<<3) /* Tral all IP Multicast packet to CPU port */ -#define EN_MCAST IPMltCstCtrl_Enable /* Alias Name for Enable Multicast Table */ -#define EnFlood2NonCgtPrt (1<<2) /* Enable Flooding to non-Congested Port Only */ -#define EnUnkUC2CPU (1<<1) /* Enable Unknown Unicast Packet Trap to CPU port */ -#define EnUnkMC2CPU (1<<0) /* Enable Unknown Multicast Packet Trap to CPU port */ -#define EN_UNUNICAST_TOCPU EnUnkUC2CPU /* Alias Name */ -#define EN_UNMCAST_TOCPU EnUnkMC2CPU /* Alias Name */ - - - -#define SBFCTR (0x4500+SWCORE_BASE) /* System Based Flow Control Threshold Register */ -#define SBFCR0 (0x000+SBFCTR) /* System Based Flow Control Register 0 */ -#define SBFCR1 (0x004+SBFCTR) /* System Based Flow Control Register 1 */ -#define SBFCR2 (0x008+SBFCTR) /* System Based Flow Control Register 2 */ -#define PBFCR0 (0x00C+SBFCTR) /* Port Based Flow Control Threshold Register */ -#define PBFCR1 (0x010+SBFCTR) /* Port Based Flow Control Threshold Register */ -#define PBFCR2 (0x014+SBFCTR) /* Port Based Flow Control Threshold Register */ -#define PBFCR3 (0x018+SBFCTR) /* Port Based Flow Control Threshold Register */ -#define PBFCR4 (0x01C+SBFCTR) /* Port Based Flow Control Threshold Register */ -#define PBFCR5 (0x020+SBFCTR) /* Port Based Flow Control Threshold Register */ -#define PBFCR6 (0x024+SBFCTR) /* Port Based Flow Control Threshold Register */ -#define QDBFCRP0G0 (0x028+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 0 Group 0 */ -#define QDBFCRP0G1 (0x02C+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 0 Group 1 */ -#define QDBFCRP0G2 (0x030+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 0 Group 2 */ -#define QDBFCRP1G0 (0x034+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 1 Group 0 */ -#define QDBFCRP1G1 (0x038+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 1 Group 1 */ -#define QDBFCRP1G2 (0x03C+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 1 Group 2 */ -#define QDBFCRP2G0 (0x040+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 2 Group 0 */ -#define QDBFCRP2G1 (0x044+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 2 Group 1 */ -#define QDBFCRP2G2 (0x048+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 2 Group 2 */ -#define QDBFCRP3G0 (0x04C+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 3 Group 0 */ -#define QDBFCRP3G1 (0x050+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 3 Group 1 */ -#define QDBFCRP3G2 (0x054+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 3 Group 2 */ -#define QDBFCRP4G0 (0x058+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 4 Group 0 */ -#define QDBFCRP4G1 (0x05C+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 4 Group 1 */ -#define QDBFCRP4G2 (0x060+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 4 Group 2 */ -#define QDBFCRP5G0 (0x064+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 5 Group 0 */ -#define QDBFCRP5G1 (0x068+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 5 Group 1 */ -#define QDBFCRP5G2 (0x06C+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 5 Group 2 */ -#define QDBFCRP6G0 (0x070+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 6 Group 0 */ -#define QDBFCRP6G1 (0x074+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 6 Group 1 */ -#define QDBFCRP6G2 (0x078+SBFCTR) /* Queue-Descriptor=Based Flow Control Threshold for Port 6 Group 2 */ -#define QPKTFCRP0G0 (0x07C+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 0 Group 0 */ -#define QPKTFCRP0G1 (0x080+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 0 Group 1 */ -#define QPKTFCRP0G2 (0x084+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 0 Group 2 */ -#define QPKTFCRP1G0 (0x088+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 1 Group 0 */ -#define QPKTFCRP1G1 (0x08C+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 1 Group 1 */ -#define QPKTFCRP1G2 (0x090+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 1 Group 2 */ -#define QPKTFCRP2G0 (0x094+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 2 Group 0 */ -#define QPKTFCRP2G1 (0x098+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 2 Group 1 */ -#define QPKTFCRP2G2 (0x09C+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 2 Group 2 */ -#define QPKTFCRP3G0 (0x0A0+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 3 Group 0 */ -#define QPKTFCRP3G1 (0x0A4+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 3 Group 1 */ -#define QPKTFCRP3G2 (0x0A8+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 3 Group 2 */ -#define QPKTFCRP4G0 (0x0AC+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 4 Group 0 */ -#define QPKTFCRP4G1 (0x0B0+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 4 Group 1 */ -#define QPKTFCRP4G2 (0x0B4+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 4 Group 2 */ -#define QPKTFCRP5G0 (0x0B8+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 5 Group 0 */ -#define QPKTFCRP5G1 (0x0BC+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 5 Group 1 */ -#define QPKTFCRP5G2 (0x0C0+SBFCTR) /* Queue-Packet-Based Flow Control Register for Port 5 Group 2 */ -#define FCCR0 (0x0d0+SBFCTR) /* Flow Control Configuration Register 0 */ -#define FCCR1 (0x0d4+SBFCTR) /* Flow Control Configuration Register 1 */ -#define PQPLGR (0x0d8+SBFCTR) /* Per Queue Physical Length Gap Register */ -#define QRR (0x0dc+SBFCTR) /* Queue Reset Register */ -#define IQFCTCR (0x0E0+SBFCTR) /* Input Queue Flow Control Threshold Configuration Register */ - -/* SBFCR0 */ -#define S_DSC_RUNOUT_OFFSET (0) /* Offset for Descriptor Run Out Threshold */ -#define S_DSC_RUNOUT_MASK (0x3FF<<0) /* Mask for Descriptor Run Out Threshold */ - -/* SBFCR1 */ -#define SDC_FCOFF_OFFSET (16) /* Offset for system flow control turn off threshold */ -#define SDC_FCOFF_MASK (0x1ff<<16) /* Mask for system flow control turn off threshold */ -#define SDC_FCON_OFFSET (0) /* Offset for system flow control turn on threshold */ -#define SDC_FCON_MASK (0x1ff<<0) /* Mask for system flow control turn on threshold */ - -#define S_DSC_FCOFF_OFFSET (16) /* Offset for system flow control turn off threshold */ -#define S_DSC_FCOFF_MASK (0x1ff<<16) /* Mask for system flow control turn off threshold */ -#define S_DSC_FCON_OFFSET (0) /* Offset for system flow control turn on threshold */ -#define S_DSC_FCON_MASK (0x1ff<<0) /* Mask for system flow control turn on threshold */ - - - -/* SBFCR2 */ -#define S_Max_SBuf_FCOFF_OFFSET (16) /* System max shared buffer flow control turn off threshold */ -#define S_Max_SBuf_FCOFF_MASK (0x1FF<<16) /* System max shared buffer flow control turn off threshold */ -#define S_Max_SBuf_FCON_OFFSET (0) /* System max shared buffer flow control turn on threshold */ -#define S_Max_SBuf_FCON_MASK (0x1FF<<0) /* System max shared buffer flow control turn on threshold */ - -/* PBFCR0~PBFCR6 - Port Based Flow Control Threshold Register */ -#define P_MaxDSC_FCOFF_OFFSET (16) /* Per-Port Max Used Descriptor Flow Control Turn Off Threshold */ -#define P_MaxDSC_FCOFF_MASK (0x1ff<<16) /* Per-Port Max Used Descriptor Flow Control Turn Off Threshold */ -#define P_MaxDSC_FCON_OFFSET (0) /* Per-Port Max Used Descriptor Flow Control Turn On Threshold */ -#define P_MaxDSC_FCON_MASK (0x1ff<<0) /* Per-Port Max Used Descriptor Flow Control Turn On Threshold */ - -/* QDBFCRP0G0,QDBFCRP0G1,QDBFCRP0G2 - * QDBFCRP1G0,QDBFCRP1G1,QDBFCRP1G2 - * QDBFCRP2G0,QDBFCRP2G1,QDBFCRP2G2 - * QDBFCRP3G0,QDBFCRP3G1,QDBFCRP3G2 - * QDBFCRP4G0,QDBFCRP4G1,QDBFCRP4G2 - * QDBFCRP5G0,QDBFCRP5G1,QDBFCRP5G2 - * - Queue-Descriptor=Based Flow Control Threshold for Port 0 Group 0 */ -#define QG_DSC_FCOFF_OFFSET (16) /* Queue Descriptor Based Flow Control Turn Off Threshold */ -#define QG_DSC_FCOFF_MASK (0x1f<<16) /* Queue Descriptor Based Flow Control Turn Off Threshold */ -#define QG_DSC_FCON_OFFSET (0) /* Queue Descriptor Based Flow Control Turn Off Threshold */ -#define QG_DSC_FCON_MASK (0x7f<<0) /* Queue Descriptor Based Flow Control Turn Off Threshold */ - -/* QPKTFCRP0G0,QPKTFCRP0G1,QPKTFCRP0G2 - * QPKTFCRP1G0,QPKTFCRP1G1,QPKTFCRP1G2 - * QPKTFCRP2G0,QPKTFCRP2G1,QPKTFCRP2G2 - * QPKTFCRP3G0,QPKTFCRP3G1,QPKTFCRP3G2 - * QPKTFCRP4G0,QPKTFCRP4G1,QPKTFCRP4G2 - * QPKTFCRP5G0,QPKTFCRP5G1,QPKTFCRP5G2 - - Queue-Packet-Based Flow Control Register for Port 0 Group 0 */ -#define QG_QLEN_FCOFF_OFFSET (16) /* Queue Packet Based Flow Control Turn Off Threshold */ -#define QG_QLEN_FCOFF_MASK (0x1f<<16) /* Queue Packet Based Flow Control Turn Off Threshold */ -#define QG_QLEN_FCON_OFFSET (0) /* Queue Packet Based Flow Control Turn Off Threshold */ -#define QG_QLEN_FCON_MASK (0x7f<<0) /* Queue Packet Based Flow Control Turn Off Threshold */ - - - -/* FCCR0 - Flow Control enable/disable for port3~port0 */ -/* FCCR1 - Flow Control enable/disable for port6~port4 */ -#define Q_P0_EN_FC_OFFSET (0) -#define Q_P0_EN_FC_MASK (0x3f<<0) -#define Q_P1_EN_FC_OFFSET (8) -#define Q_P1_EN_FC_MASK (0x3f<<8) -#define Q_P2_EN_FC_OFFSET (16) -#define Q_P2_EN_FC_MASK (0x3f<<16) -#define Q_P3_EN_FC_OFFSET (24) -#define Q_P3_EN_FC_MASK (0x3f<<24) -#define Q_P4_EN_FC_OFFSET (0) -#define Q_P4_EN_FC_MASK (0x3f<<0) -#define Q_P5_EN_FC_OFFSET (8) -#define Q_P5_EN_FC_MASK (0x3f<<8) -#define Q_P6_EN_FC_OFFSET (16) -#define Q_P6_EN_FC_MASK (0x3f<<16) - - - - -/* PQPLGR - Per-Queue Physical length Gap Register */ -#define QLEN_GAP_OFFSET (0) /* Per Queue physical length gap */ -#define QLEN_GAP_MASK (0xff<<0) /* Per Queue physical length gap */ - - -/* QRR - Queue Reset Register */ -#define QRST (1<<0) /* Queue Reset */ - -//#ifdef CONFIG_RTL865XC_BCUT -/* IQFCTCR - Input Queue Flow Control Threshold Configuration Register */ -#define IQ_DSC_FCON_OFFSET (8) /* Offset for input Queue Flow control turn OFF descriptor threshold */ -#define IQ_DSC_FCON_MASK (0xff<<8) /* Mask for input Queue Flow control turn OFF descriptor threshold */ -#define IQ_DSC_FCOFF_OFFSET (0) /* Offset for input Queue Flow control turn ON descriptor threshold */ -#define IQ_DSC_FCOFF_MASK (0xff<<0) /* Mask for input Queue Flow control turn ON descriptor threshold */ -//#endif - - -#ifdef CONFIG_RTK_VOIP_865xC_QOS -#define PSRP6_RW (SWCORE_BASE+0x4600) /*CPU Port Status : R/W */ -#endif - -/* QoS Function Control Register */ -#define OQNCR_BASE (SWCORE_BASE+0x4700) /* Output Queue Number Control Registers */ -#define QOSFCR (0x00 + OQNCR_BASE) /* QoS Function Control Register */ -#define IBCR0 (0x04 + OQNCR_BASE) /* Ingress Bandwidth Control Register 0 */ -#define IBCR1 (0x08 + OQNCR_BASE) /* Ingress Bandwidth Control Register 1 */ -#define IBCR2 (0x0C + OQNCR_BASE) /* Ingress Bandwidth Control Register 2 */ -#define PBPCR (0x14 + OQNCR_BASE) /* Port Based Priority Control Register Address Mapping */ -#define UPTCMCR0 (0x18 + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 1 output queue */ -#define UPTCMCR1 (0x1c + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 2 output queue */ -#define UPTCMCR2 (0x20 + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 3 output queue */ -#define UPTCMCR3 (0x24 + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 4 output queue */ -#define UPTCMCR4 (0x28 + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 5 output queue */ -#define UPTCMCR5 (0x2c + OQNCR_BASE) /* User Priority to Traffic Class Mapping for 6 output queue */ -#define LPTM8021Q (0x30 + OQNCR_BASE) /*802.1Q priority to linear priority Transfer mapping.*/ -#define DSCPCR0 (0x34 + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ -#define DSCPCR1 (0x38 + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ -#define DSCPCR2 (0x3C + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ -#define DSCPCR3 (0x40 + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ -#define DSCPCR4 (0x44 + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ -#define DSCPCR5 (0x48 + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ -#define DSCPCR6 (0x4C + OQNCR_BASE) /*DSCP Priority Control Register Address Mapping. */ -#define QIDDPCR (0x50 + OQNCR_BASE) /*Queue ID Decision Priority Register Address Mapping*/ -#define QNUMCR (0x54 + OQNCR_BASE) /*Queue Number Control Register*/ -#define CPUQIDMCR0 (0x58 + OQNCR_BASE) /*CPU port QID Mapping Control Register (DP=include CPU)*/ -#define CPUQIDMCR1 (0x5C + OQNCR_BASE) /*CPU port QID Mapping Control Register (DP=EXT0)*/ -#define CPUQIDMCR2 (0x60 + OQNCR_BASE) /*CPU port QID Mapping Control Register (DP=EXT1)*/ -#define CPUQIDMCR3 (0x64 + OQNCR_BASE) /*CPU port QID Mapping Control Register (DP=EXT2)*/ -#define CPUQIDMCR4 (0x68 + OQNCR_BASE) /*CPU port QID Mapping Control Register (DP=multi-port of Ext port)*/ -#define RMCR1P (0x6C + OQNCR_BASE) /*802.1P Remarking Control Register 0*/ -#define DSCPRM0 (0x70 + OQNCR_BASE) /*DSCP Remarking Control Register 0*/ -#define DSCPRM1 (0x74 + OQNCR_BASE) /*DSCP Remarking Control Register 1*/ -#define RLRC (0x78 + OQNCR_BASE) /*Remarking Layer Rule Control*/ - - -/* QOSFCR - QoS Function Control Register */ -#define BC_withPIFG_OFFSET (0) /* Bandwidth Conrol Include/Exclude Preamble&IFG. 0:exclude; 1:include */ -#define BC_withPIFG_MASK (1<<0) /* Bandwidth Conrol Include/Exclude Preamble&IFG. 0:exclude; 1:include */ - -/* IBCR0/IBCR1/IBCR2 general */ -#define IBWC_ODDPORT_OFFSET (16) /* ODD-port Ingress Bandwidth Control Offset */ -#define IBWC_ODDPORT_MASK (0xFFFF<<16) /* ODD-port Ingress Bandwidth Control MASK */ -#define IBWC_EVENPORT_OFFSET (0) /* EVEN-port Ingress Bandwidth Control Offset */ -#define IBWC_EVENPORT_MASK (0xFFFF<<0) /* EVEN-port Ingress Bandwidth Control MASK */ - -/* IBCR0 - Ingress Bandwidth Control Register 0 */ -#define IBWC_P1_OFFSET (16) /* Port1 Ingress Bandwidth Control */ -#define IBWC_P1_MASK (0xffff<<16) /* Port1 Ingress Bandwidth Control */ -#define IBWC_P0_OFFSET ( 0) /* Port0 Ingress Bandwidth Control */ -#define IBWC_P0_MASK (0xffff<< 0) /* Port0 Ingress Bandwidth Control */ - -/* IBCR1 - Ingress Bandwidth Control Register 1 */ -#define IBWC_P3_OFFSET (16) /* Port3 Ingress Bandwidth Control */ -#define IBWC_P3_MASK (0xffff<<16) /* Port3 Ingress Bandwidth Control */ -#define IBWC_P2_OFFSET ( 0) /* Port2 Ingress Bandwidth Control */ -#define IBWC_P2_MASK (0xffff<< 0) /* Port2 Ingress Bandwidth Control */ - -/* IBCR2 - Ingress Bandwidth Control Register 2 */ -#define IBWC_P5_OFFSET (16) /* Port5 Ingress Bandwidth Control */ -#define IBWC_P5_MASK (0xffff<<16) /* Port5 Ingress Bandwidth Control */ -#define IBWC_P4_OFFSET ( 0) /* Port4 Ingress Bandwidth Control */ -#define IBWC_P4_MASK (0xffff<< 0) /* Port4 Ingress Bandwidth Control */ - -/* PBPCR - Port Based Priority Control Register */ -#define PBPRI_P8_OFFSET (24) /* Port Based Priority assign for port 8 */ -#define PBPRI_P8_MASK (0x7<<24) /* Port Based Priority assign for port 8 */ -#define PBPRI_P7_OFFSET (21) /* Port Based Priority assign for port 7 */ -#define PBPRI_P7_MASK (0x7<<21) /* Port Based Priority assign for port 7 */ -#define PBPRI_P6_OFFSET (18) /* Port Based Priority assign for port 6 */ -#define PBPRI_P6_MASK (0x7<<18) /* Port Based Priority assign for port 6 */ -#define PBPRI_P5_OFFSET (15) /* Port Based Priority assign for port 5 */ -#define PBPRI_P5_MASK (0x7<<15) /* Port Based Priority assign for port 5 */ -#define PBPRI_P4_OFFSET (12) /* Port Based Priority assign for port 4 */ -#define PBPRI_P4_MASK (0x7<<12) /* Port Based Priority assign for port 4 */ -#define PBPRI_P3_OFFSET (9) /* Port Based Priority assign for port 3 */ -#define PBPRI_P3_MASK (0x7<<9) /* Port Based Priority assign for port 3 */ -#define PBPRI_P2_OFFSET (6) /* Port Based Priority assign for port 2 */ -#define PBPRI_P2_MASK (0x7<<6) /* Port Based Priority assign for port 2 */ -#define PBPRI_P1_OFFSET (3) /* Port Based Priority assign for port 1 */ -#define PBPRI_P1_MASK (0x7<<3) /* Port Based Priority assign for port 1 */ -#define PBPRI_P0_OFFSET (0) /* Port Based Priority assign for port 0 */ -#define PBPRI_P0_MASK (0x7<<0) /* Port Based Priority assign for port 0 */ - - -/* QIDDPCR - Queue ID Decision Priority Register Address Mapping*/ -#define PBP_PRI_OFFSET 0 /*Output queue decision priority assign for Port Based Priority*/ -#define PBP_PRI_MASK (0xf<< 0) /*Output queue decision priority assign for Port Based Priority*/ -#define BP8021Q_PRI_OFFSET 4 /*Output queue decision priority assign for 1Q Based Priority*/ -#define BP8021Q_PRI_MASK (0xf<< 4) /*Output queue decision priority assign for 1Q Based Priority*/ -#define DSCP_PRI_OFFSET 8 /*Output queue decision priority assign for DSCP Based Priority*/ -#define DSCP_PRI_MASK (0xf<< 8) /*Output queue decision priority assign for DSCP Based Priority*/ -#define ACL_PRI_OFFSET 12 /*Output queue decision priority assign for ACL Based Priority*/ -#define ACL_PRI_MASK (0xf<<12) /*Output queue decision priority assign for ACL Based Priority*/ -#define NAPT_PRI_OFFSET 16 /*Output queue decision priority assign for NAPT Based Priority*/ -#define NAPT_PRI_MASK (0xf<<16) /*Output queue decision priority assign for NAPT Based Priority*/ - -/* LPTM8021Q - 802.1Q priority to linear priority Transfer mapping. */ -#define EN_8021Q2LTMPRI7 21 /* 8 level linear priority mapping for 802.1Q priority level 7 */ -#define EN_8021Q2LTMPRI7_MASK (0x7<<21) /* 8 level linear priority mapping for 802.1Q priority level 7 */ -#define EN_8021Q2LTMPRI6 18 /* 8 level linear priority mapping for 802.1Q priority level 6 */ -#define EN_8021Q2LTMPRI6_MASK (0x7<<18) /* 8 level linear priority mapping for 802.1Q priority level 6 */ -#define EN_8021Q2LTMPRI5 15 /* 8 level linear priority mapping for 802.1Q priority level 5 */ -#define EN_8021Q2LTMPRI5_MASK (0x7<<15) /* 8 level linear priority mapping for 802.1Q priority level 5 */ -#define EN_8021Q2LTMPRI4 12 /* 8 level linear priority mapping for 802.1Q priority level 4 */ -#define EN_8021Q2LTMPRI4_MASK (0x7<<12) /* 8 level linear priority mapping for 802.1Q priority level 4 */ -#define EN_8021Q2LTMPRI3 9 /* 8 level linear priority mapping for 802.1Q priority level 3 */ -#define EN_8021Q2LTMPRI3_MASK (0x7<<9) /* 8 level linear priority mapping for 802.1Q priority level 3 */ -#define EN_8021Q2LTMPRI2 6 /* 8 level linear priority mapping for 802.1Q priority level 2 */ -#define EN_8021Q2LTMPRI2_MASK (0x7<<6) /* 8 level linear priority mapping for 802.1Q priority level 2 */ -#define EN_8021Q2LTMPRI1 3 /* 8 level linear priority mapping for 802.1Q priority level 1 */ -#define EN_8021Q2LTMPRI1_MASK (0x7<<3) /* 8 level linear priority mapping for 802.1Q priority level 1 */ -#define EN_8021Q2LTMPRI0 0 /* 8 level linear priority mapping for 802.1Q priority level 0 */ -#define EN_8021Q2LTMPRI0_MASK (0x7<<0) /* 8 level linear priority mapping for 802.1Q priority level 0 */ - - -/* DSCPCR0 - DSCP Priority Control Register Address Mapping. */ -#define DSCP0_PRI 0 -#define DSCP1_PRI 3 -#define DSCP2_PRI 6 -#define DSCP3_PRI 9 -#define DSCP4_PRI 12 -#define DSCP5_PRI 15 -#define DSCP6_PRI 18 -#define DSCP7_PRI 21 -#define DSCP8_PRI 24 -#define DSCP9_PRI 27 -#define DSCP32_PRI 6 - - -/* QNUMCR - Queue Number Control Register*/ -#define P0QNum_OFFSET (0) -#define P0QNum_MASK (7<<0) /* Valid for 1~6 output queues */ -#define P0QNum_1 (1<<0) /* 1 Output Queue */ -#define P0QNum_2 (2<<0) /* 2 Output Queues */ -#define P0QNum_3 (3<<0) /* 3 Output Queues */ -#define P0QNum_4 (4<<0) /* 4 Output Queues */ -#define P0QNum_5 (5<<0) /* 5 Output Queues */ -#define P0QNum_6 (6<<0) /* 6 Output Queues */ -#define P1QNum_OFFSET (3) -#define P1QNum_MASK (7<<3) /* Valid for 1~6 output queues */ -#define P1QNum_1 (1<<3) /* 1 Output Queue */ -#define P1QNum_2 (2<<3) /* 2 Output Queues */ -#define P1QNum_3 (3<<3) /* 3 Output Queues */ -#define P1QNum_4 (4<<3) /* 4 Output Queues */ -#define P1QNum_5 (5<<3) /* 5 Output Queues */ -#define P1QNum_6 (6<<3) /* 6 Output Queues */ -#define P2QNum_OFFSET (6) -#define P2QNum_MASK (7<<6) /* Valid for 1~6 output queues */ -#define P2QNum_1 (1<<6) /* 1 Output Queue */ -#define P2QNum_2 (2<<6) /* 2 Output Queues */ -#define P2QNum_3 (3<<6) /* 3 Output Queues */ -#define P2QNum_4 (4<<6) /* 4 Output Queues */ -#define P2QNum_5 (5<<6) /* 5 Output Queues */ -#define P2QNum_6 (6<<6) /* 6 Output Queues */ -#define P3QNum_OFFSET (9) -#define P3QNum_MASK (7<<9) /* Valid for 1~6 output queues */ -#define P3QNum_1 (1<<9) /* 1 Output Queue */ -#define P3QNum_2 (2<<9) /* 2 Output Queues */ -#define P3QNum_3 (3<<9) /* 3 Output Queues */ -#define P3QNum_4 (4<<9) /* 4 Output Queues */ -#define P3QNum_5 (5<<9) /* 5 Output Queues */ -#define P3QNum_6 (6<<9) /* 6 Output Queues */ -#define P4QNum_OFFSET (12) -#define P4QNum_MASK (7<<12) /* Valid for 1~6 output queues */ -#define P4QNum_1 (1<<12) /* 1 Output Queue */ -#define P4QNum_2 (2<<12) /* 2 Output Queues */ -#define P4QNum_3 (3<<12) /* 3 Output Queues */ -#define P4QNum_4 (4<<12) /* 4 Output Queues */ -#define P4QNum_5 (5<<12) /* 5 Output Queues */ -#define P4QNum_6 (6<<12) /* 6 Output Queues */ -#define P5QNum_OFFSET (15) -#define P5QNum_MASK (7<<15) /* Valid for 1~6 output queues */ -#define P5QNum_1 (1<<15) /* 1 Output Queue */ -#define P5QNum_2 (2<<15) /* 2 Output Queues */ -#define P5QNum_3 (3<<15) /* 3 Output Queues */ -#define P5QNum_4 (4<<15) /* 4 Output Queues */ -#define P5QNum_5 (5<<15) /* 5 Output Queues */ -#define P5QNum_6 (6<<15) /* 6 Output Queues */ -#define P6QNum_OFFSET (18) /* CPU port */ -#define P6QNum_MASK (7<<18) /* Valid for 1~6 output queues */ -#define P6QNum_1 (1<<18) /* 1 Output Queue */ -#define P6QNum_2 (2<<18) /* 2 Output Queues */ -#define P6QNum_3 (3<<18) /* 3 Output Queues */ -#define P6QNum_4 (4<<18) /* 4 Output Queues */ -#define P6QNum_5 (5<<18) /* 5 Output Queues */ -#define P6QNum_6 (6<<18) /* 6 Output Queues */ - -/* CPUQIDMCR0 - CPU port QID Mapping Control Register (DP=include CPU) */ -#define CPUPri7QIDM_OFFSET 28 /* DP=include CPU, priority=7 */ -#define CPUPri7QIDM_MASK (7<<28) /* DP=include CPU, priority=7 */ -#define CPUPri6QIDM_OFFSET 24 /* DP=include CPU, priority=6 */ -#define CPUPri6QIDM_MASK (7<<24) /* DP=include CPU, priority=6 */ -#define CPUPri5QIDM_OFFSET 20 /* DP=include CPU, priority=5 */ -#define CPUPri5QIDM_MASK (7<<20) /* DP=include CPU, priority=5 */ -#define CPUPri4QIDM_OFFSET 16 /* DP=include CPU, priority=4 */ -#define CPUPri4QIDM_MASK (7<<16) /* DP=include CPU, priority=4 */ -#define CPUPri3QIDM_OFFSET 12 /* DP=include CPU, priority=3 */ -#define CPUPri3QIDM_MASK (7<<12) /* DP=include CPU, priority=3 */ -#define CPUPri2QIDM_OFFSET 8 /* DP=include CPU, priority=2 */ -#define CPUPri2QIDM_MASK (7<<8) /* DP=include CPU, priority=2 */ -#define CPUPri1QIDM_OFFSET 4 /* DP=include CPU, priority=1 */ -#define CPUPri1QIDM_MASK (7<<4) /* DP=include CPU, priority=1 */ -#define CPUPri0QIDM_OFFSET 0 /* DP=include CPU, priority=0 */ -#define CPUPri0QIDM_MASK (7<<0) /* DP=include CPU, priority=0 */ - -/* CPUQIDMCR1 - CPU port QID Mapping Control Register (DP=EXT0) */ -#define EXT0Pri7QIDM_OFFSET 28 /* DP=EXT0, priority=7 */ -#define EXT0Pri7QIDM_MASK (7<<28) /* DP=EXT0, priority=7 */ -#define EXT0Pri6QIDM_OFFSET 24 /* DP=EXT0, priority=6 */ -#define EXT0Pri6QIDM_MASK (7<<24) /* DP=EXT0, priority=6 */ -#define EXT0Pri5QIDM_OFFSET 20 /* DP=EXT0, priority=5 */ -#define EXT0Pri5QIDM_MASK (7<<20) /* DP=EXT0, priority=5 */ -#define EXT0Pri4QIDM_OFFSET 16 /* DP=EXT0, priority=4 */ -#define EXT0Pri4QIDM_MASK (7<<16) /* DP=EXT0, priority=4 */ -#define EXT0Pri3QIDM_OFFSET 12 /* DP=EXT0, priority=3 */ -#define EXT0Pri3QIDM_MASK (7<<12) /* DP=EXT0, priority=3 */ -#define EXT0Pri2QIDM_OFFSET 8 /* DP=EXT0, priority=2 */ -#define EXT0Pri2QIDM_MASK (7<<8) /* DP=EXT0, priority=2 */ -#define EXT0Pri1QIDM_OFFSET 4 /* DP=EXT0, priority=1 */ -#define EXT0Pri1QIDM_MASK (7<<4) /* DP=EXT0, priority=1 */ -#define EXT0Pri0QIDM_OFFSET 0 /* DP=EXT0, priority=0 */ -#define EXT0Pri0QIDM_MASK (7<<0) /* DP=EXT0, priority=0 */ - -/* CPUQIDMCR1 - CPU port QID Mapping Control Register (DP=EXT1) */ -#define EXT1Pri7QIDM_OFFSET 28 /* DP=EXT1, priority=7 */ -#define EXT1Pri7QIDM_MASK (7<<28) /* DP=EXT1, priority=7 */ -#define EXT1Pri6QIDM_OFFSET 24 /* DP=EXT1, priority=6 */ -#define EXT1Pri6QIDM_MASK (7<<24) /* DP=EXT1, priority=6 */ -#define EXT1Pri5QIDM_OFFSET 20 /* DP=EXT1, priority=5 */ -#define EXT1Pri5QIDM_MASK (7<<20) /* DP=EXT1, priority=5 */ -#define EXT1Pri4QIDM_OFFSET 16 /* DP=EXT1, priority=4 */ -#define EXT1Pri4QIDM_MASK (7<<16) /* DP=EXT1, priority=4 */ -#define EXT1Pri3QIDM_OFFSET 12 /* DP=EXT1, priority=3 */ -#define EXT1Pri3QIDM_MASK (7<<12) /* DP=EXT1, priority=3 */ -#define EXT1Pri2QIDM_OFFSET 8 /* DP=EXT1, priority=2 */ -#define EXT1Pri2QIDM_MASK (7<<8) /* DP=EXT1, priority=2 */ -#define EXT1Pri1QIDM_OFFSET 4 /* DP=EXT1, priority=1 */ -#define EXT1Pri1QIDM_MASK (7<<4) /* DP=EXT1, priority=1 */ -#define EXT1Pri0QIDM_OFFSET 0 /* DP=EXT1, priority=0 */ -#define EXT1Pri0QIDM_MASK (7<<0) /* DP=EXT1, priority=0 */ - -/* CPUQIDMCR1 - CPU port QID Mapping Control Register (DP=EXT2) */ -#define EXT2Pri7QIDM_OFFSET 28 /* DP=EXT2, priority=7 */ -#define EXT2Pri7QIDM_MASK (7<<28) /* DP=EXT2, priority=7 */ -#define EXT2Pri6QIDM_OFFSET 24 /* DP=EXT2, priority=6 */ -#define EXT2Pri6QIDM_MASK (7<<24) /* DP=EXT2, priority=6 */ -#define EXT2Pri5QIDM_OFFSET 20 /* DP=EXT2, priority=5 */ -#define EXT2Pri5QIDM_MASK (7<<20) /* DP=EXT2, priority=5 */ -#define EXT2Pri4QIDM_OFFSET 16 /* DP=EXT2, priority=4 */ -#define EXT2Pri4QIDM_MASK (7<<16) /* DP=EXT2, priority=4 */ -#define EXT2Pri3QIDM_OFFSET 12 /* DP=EXT2, priority=3 */ -#define EXT2Pri3QIDM_MASK (7<<12) /* DP=EXT2, priority=3 */ -#define EXT2Pri2QIDM_OFFSET 8 /* DP=EXT2, priority=2 */ -#define EXT2Pri2QIDM_MASK (7<<8) /* DP=EXT2, priority=2 */ -#define EXT2Pri1QIDM_OFFSET 4 /* DP=EXT2, priority=1 */ -#define EXT2Pri1QIDM_MASK (7<<4) /* DP=EXT2, priority=1 */ -#define EXT2Pri0QIDM_OFFSET 0 /* DP=EXT2, priority=0 */ -#define EXT2Pri0QIDM_MASK (7<<0) /* DP=EXT2, priority=0 */ - -/* CPUQIDMCR1 - CPU port QID Mapping Control Register (DP=MultiEXT) */ -#define MultiEXTPri7QIDM_OFFSET 28 /* DP=multi-port of Ext port, priority=7 */ -#define MultiEXTPri7QIDM_MASK (7<<28) /* DP=multi-port of Ext port, priority=7 */ -#define MultiEXTPri6QIDM_OFFSET 24 /* DP=multi-port of Ext port, priority=6 */ -#define MultiEXTPri6QIDM_MASK (7<<24) /* DP=multi-port of Ext port, priority=6 */ -#define MultiEXTPri5QIDM_OFFSET 20 /* DP=multi-port of Ext port, priority=5 */ -#define MultiEXTPri5QIDM_MASK (7<<20) /* DP=multi-port of Ext port, priority=5 */ -#define MultiEXTPri4QIDM_OFFSET 16 /* DP=multi-port of Ext port, priority=4 */ -#define MultiEXTPri4QIDM_MASK (7<<16) /* DP=multi-port of Ext port, priority=4 */ -#define MultiEXTPri3QIDM_OFFSET 12 /* DP=multi-port of Ext port, priority=3 */ -#define MultiEXTPri3QIDM_MASK (7<<12) /* DP=multi-port of Ext port, priority=3 */ -#define MultiEXTPri2QIDM_OFFSET 8 /* DP=multi-port of Ext port, priority=2 */ -#define MultiEXTPri2QIDM_MASK (7<<8) /* DP=multi-port of Ext port, priority=2 */ -#define MultiEXTPri1QIDM_OFFSET 4 /* DP=multi-port of Ext port, priority=1 */ -#define MultiEXTPri1QIDM_MASK (7<<4) /* DP=multi-port of Ext port, priority=1 */ -#define MultiEXTPri0QIDM_OFFSET 0 /* DP=multi-port of Ext port, priority=0 */ -#define MultiEXTPri0QIDM_MASK (7<<0) /* DP=multi-port of Ext port, priority=0 */ - -/* RMCR1P - 802.1P Remarking Control Register 0 */ -#define RM1P_EN_OFFSET (24) /* Enable 802.1p remarking for destination port[7:0] */ -#define RM1P_EN_MASK (0xff<<24) /* Enable 802.1p remarking for destination port */ -#define RM7_1P_OFFSET (21) /* New 3-bit priority for system parsed priority 7 */ -#define RM7_1P_MASK (0x7<<21) /* New 3-bit priority for system parsed priority 7 */ -#define RM6_1P_OFFSET (18) /* New 3-bit priority for system parsed priority 6 */ -#define RM6_1P_MASK (0x7<<18) /* New 3-bit priority for system parsed priority 6 */ -#define RM5_1P_OFFSET (15) /* New 3-bit priority for system parsed priority 5 */ -#define RM5_1P_MASK (0x7<<15) /* New 3-bit priority for system parsed priority 5 */ -#define RM4_1P_OFFSET (12) /* New 3-bit priority for system parsed priority 4 */ -#define RM4_1P_MASK (0x7<<12) /* New 3-bit priority for system parsed priority 4 */ -#define RM3_1P_OFFSET ( 9) /* New 3-bit priority for system parsed priority 3 */ -#define RM3_1P_MASK (0x7<< 9) /* New 3-bit priority for system parsed priority 3 */ -#define RM2_1P_OFFSET ( 6) /* New 3-bit priority for system parsed priority 2 */ -#define RM2_1P_MASK (0x7<< 6) /* New 3-bit priority for system parsed priority 2 */ -#define RM1_1P_OFFSET ( 3) /* New 3-bit priority for system parsed priority 1 */ -#define RM1_1P_MASK (0x7<< 3) /* New 3-bit priority for system parsed priority 1 */ -#define RM0_1P_OFFSET ( 0) /* New 3-bit priority for system parsed priority 0 */ -#define RM0_1P_MASK (0x7<< 0) /* New 3-bit priority for system parsed priority 0 */ - -/* DSCPRM0 - DSCP Remarking Control Register 0 */ -#define RM1P_EN_8_OFFSET (31) /* Enable 802.1p remarking for destination port[8] */ -#define RM1P_EN_8 (1<<31) /* Enable 802.1p remarking for destination port[8] */ -#define DSCPRM4_OFFSET (24) /* New 6-bit DSCP value for system parsed 3-bit priority 4 */ -#define DSCPRM4_MASK (0x3f<<24) /* New 6-bit DSCP value for system parsed 3-bit priority 4 */ -#define DSCPRM3_OFFSET (18) /* New 6-bit DSCP value for system parsed 3-bit priority 3 */ -#define DSCPRM3_MASK (0x3f<<18) /* New 6-bit DSCP value for system parsed 3-bit priority 3 */ -#define DSCPRM2_OFFSET (12) /* New 6-bit DSCP value for system parsed 3-bit priority 2 */ -#define DSCPRM2_MASK (0x3f<<12) /* New 6-bit DSCP value for system parsed 3-bit priority 2 */ -#define DSCPRM1_OFFSET ( 6) /* New 6-bit DSCP value for system parsed 3-bit priority 1 */ -#define DSCPRM1_MASK (0x3f<< 6) /* New 6-bit DSCP value for system parsed 3-bit priority 1 */ -#define DSCPRM0_OFFSET ( 0) /* New 6-bit DSCP value for system parsed 3-bit priority 0 */ -#define DSCPRM0_MASK (0x3f<< 0) /* New 6-bit DSCP value for system parsed 3-bit priority 0 */ - -/* DSCPRM1 - DSCP Remarking Control Register 1 */ -#define DSCPRM_EN_OFFSET (23) /* Enable DSCP Remark for destination output port[8:0] */ -#define DSCPRM_EN_MASK (0x1ff<<23) /* Enable DSCP Remark for destination output port */ -#define DSCPRM7_OFFSET (12) /* New 6-bit DSCP value for system parsed 3-bit priority 7 */ -#define DSCPRM7_MASK (0x3f<<12) /* New 6-bit DSCP value for system parsed 3-bit priority 7 */ -#define DSCPRM6_OFFSET ( 6) /* New 6-bit DSCP value for system parsed 3-bit priority 6 */ -#define DSCPRM6_MASK (0x3f<< 6) /* New 6-bit DSCP value for system parsed 3-bit priority 6 */ -#define DSCPRM5_OFFSET ( 0) /* New 6-bit DSCP value for system parsed 3-bit priority 5 */ -#define DSCPRM5_MASK (0x3f<< 0) /* New 6-bit DSCP value for system parsed 3-bit priority 5 */ - -/* RLRC - Remarking Layer Rule Control */ -#define RMLC_DSCP_L4 (1<<5) /* Applied on L4 Operation */ -#define RMLC_DSCP_L3 (1<<4) /* Applied on L3 Operation */ -#define RMLC_DSCP_L2 (1<<3) /* Applied on L2 Operation */ -#define RMLC_8021P_L4 (1<<2) /* Applied on L4 Operation */ -#define RMLC_8021P_L3 (1<<1) /* Applied on L3 Operation */ -#define RMLC_8021P_L2 (1<<0) /* Applied on L2 Operation */ - - -/* - * Packet Scheduling Control Register */ -#define PSCR (SWCORE_BASE + 0x4800) -#define P0Q0RGCR (0x000 + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 0 */ -#define P0Q1RGCR (0x004 + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 1 */ -#define P0Q2RGCR (0x008 + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 2 */ -#define P0Q3RGCR (0x00C + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 3 */ -#define P0Q4RGCR (0x010 + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 4 */ -#define P0Q5RGCR (0x014 + PSCR) /* Rate Guarantee Control Register of Port 0 Queue 5 */ -#define P1Q0RGCR (0x018 + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 0 */ -#define P1Q1RGCR (0x01C + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 1 */ -#define P1Q2RGCR (0x020 + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 2 */ -#define P1Q3RGCR (0x024 + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 3 */ -#define P1Q4RGCR (0x028 + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 4 */ -#define P1Q5RGCR (0x02C + PSCR) /* Rate Guarantee Control Register of Port 1 Queue 5 */ -#define P2Q0RGCR (0x030 + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 0 */ -#define P2Q1RGCR (0x034 + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 1 */ -#define P2Q2RGCR (0x038 + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 2 */ -#define P2Q3RGCR (0x03C + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 3 */ -#define P2Q4RGCR (0x040 + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 4 */ -#define P2Q5RGCR (0x044 + PSCR) /* Rate Guarantee Control Register of Port 2 Queue 5 */ -#define P3Q0RGCR (0x048 + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 0 */ -#define P3Q1RGCR (0x04C + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 1 */ -#define P3Q2RGCR (0x050 + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 2 */ -#define P3Q3RGCR (0x054 + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 3 */ -#define P3Q4RGCR (0x058 + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 4 */ -#define P3Q5RGCR (0x05C + PSCR) /* Rate Guarantee Control Register of Port 3 Queue 5 */ -#define P4Q0RGCR (0x060 + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 0 */ -#define P4Q1RGCR (0x064 + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 1 */ -#define P4Q2RGCR (0x068 + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 2 */ -#define P4Q3RGCR (0x06C + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 3 */ -#define P4Q4RGCR (0x070 + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 4 */ -#define P4Q5RGCR (0x074 + PSCR) /* Rate Guarantee Control Register of Port 4 Queue 5 */ -#define P5Q0RGCR (0x078 + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 0 */ -#define P5Q1RGCR (0x07C + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 1 */ -#define P5Q2RGCR (0x080 + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 2 */ -#define P5Q3RGCR (0x084 + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 3 */ -#define P5Q4RGCR (0x088 + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 4 */ -#define P5Q5RGCR (0x08C + PSCR) /* Rate Guarantee Control Register of Port 5 Queue 5 */ -#define P6Q0RGCR (0x090 + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 0 */ -#define P6Q1RGCR (0x094 + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 1 */ -#define P6Q2RGCR (0x098 + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 2 */ -#define P6Q3RGCR (0x09C + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 3 */ -#define P6Q4RGCR (0x0A0 + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 4 */ -#define P6Q5RGCR (0x0A4 + PSCR) /* Rate Guarantee Control Register of Port 6 Queue 5 */ -#define WFQRCRP0 (0x0B0 + PSCR) /* Weighted Fair Queue Rate Control Register of Port 0 */ -#define WFQWCR0P0 (0x0B4 + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 0 */ -#define WFQWCR1P0 (0x0B8 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 0 */ -#define WFQRCRP1 (0x0BC + PSCR) /* Weighted Fair Queue Rate Control Register of Port 1 */ -#define WFQWCR0P1 (0x0C0 + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 1 */ -#define WFQWCR1P1 (0x0C4 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 1 */ -#define WFQRCRP2 (0x0C8 + PSCR) /* Weighted Fair Queue Rate Control Register of Port 2 */ -#define WFQWCR0P2 (0x0CC + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 2 */ -#define WFQWCR1P2 (0x0D0 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 2 */ -#define WFQRCRP3 (0x0D4 + PSCR) /* Weighted Fair Queue Rate Control Register of Port 3 */ -#define WFQWCR0P3 (0x0D8 + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 3 */ -#define WFQWCR1P3 (0x0DC + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 3 */ -#define WFQRCRP4 (0x0E0 + PSCR) /* Weighted Fair Queue Rate Control Register of Port 4 */ -#define WFQWCR0P4 (0x0E4 + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 4 */ -#define WFQWCR1P4 (0x0E8 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 4 */ -#define WFQRCRP5 (0x0EC + PSCR) /* Weighted Fair Queue Rate Control Register of Port 5 */ -#define WFQWCR0P5 (0x0F0 + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 5 */ -#define WFQWCR1P5 (0x0F4 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 5 */ -#define WFQRCRP6 (0x0F8 + PSCR) /* Weighted Fair Queue Rate Control Register of Port 6 */ -#define WFQWCR0P6 (0x0FC + PSCR) /* Weighted Fair Queue Weighting Control Register 0 of Port 6 */ -#define WFQWCR1P6 (0x100 + PSCR) /* Weighted Fair Queue Weighting Control Register 1 of Port 6 */ -#define ELBPCR (0x104 + PSCR) /* Leaky Bucket Parameter Control Register */ -#define ELBTTCR (0x108 + PSCR) /* Leaky Bucket Token Threshold Control Register */ -#define ILBPCR1 (0x10C + PSCR) /* Ingress Leaky Bucket Parameter Control Register1 */ -#define ILBPCR2 (0x110 + PSCR) /* Ingress Leaky Bucket Parameter Control Register2 */ -#define ILB_CURRENT_TOKEN (0x114 + PSCR) /* The current token of the Leaky bucket 2Bytes per port(Port 0~Port5) */ - -/* P0Q0RGCG - Per-Queue Rate Guarantee Control Register */ -#define PPR_OFFSET (24) /* Peak Packet Rate, in times of APR CNT2 */ -#define PPR_MASK (7<<24) /* Peak Packet Rate, in times of APR CNT2 */ -#define L1_OFFSET (16) /* Bucket burst size of APR. unit: 1KB MAX */ -#define L1_MASK (0xff<<16) /* Bucket burst size of APR. unit: 1KB MAX */ -#define APR_OFFSET (0) /* Average Packet Rate, in times of 64Kbps CNT1 */ -#define APR_MASK (0x3FFF<<0) /* Average Packet Rate, in times of 64Kbps CNT1 */ - -/* WFQECR0P0 - Weighted Fair Queue Weighting Control Register 0 */ -#define SCHE3_WFQ (1<<31) /* Schedule Type for Queue 3: 1-WFQ ,0-Strict Priority */ -#define SCHE3_OFFSET (31) /* Schedule Type for Queue 3: 1-WFQ ,0-Strict Priority */ -#define SCHE3_MASK (1<<31) /* Schedule Type for Queue 3: 1-WFQ ,0-Strict Priority */ -#define WEIGHT3_OFFSET (24) /* Weight value assign of queue 3 for WFQ */ -#define WEIGHT3_MASK (0x7f<<24) /* Weight value assign of queue 3 for WFQ */ -#define SCHE2_WFQ (1<<23) /* Schedule Type for Queue 2: 1-WFQ ,0-Strict Priority */ -#define SCHE2_OFFSET (23) /* Schedule Type for Queue 2: 1-WFQ ,0-Strict Priority */ -#define SCHE2_MASK (1<<23) /* Schedule Type for Queue 2: 1-WFQ ,0-Strict Priority */ -#define WEIGHT2_OFFSET (16) /* Weight value assign of queue 2 for WFQ */ -#define WEIGHT2_MASK (0x7f<<16) /* Weight value assign of queue 2 for WFQ */ -#define SCHE1_WFQ (1<<15) /* Schedule Type for Queue 1: 1-WFQ ,0-Strict Priority */ -#define SCHE1_OFFSET (15) /* Schedule Type for Queue 1: 1-WFQ ,0-Strict Priority */ -#define SCHE1_MASK (1<<15) /* Schedule Type for Queue 1: 1-WFQ ,0-Strict Priority */ -#define WEIGHT1_OFFSET ( 8) /* Weight value assign of queue 1 for WFQ */ -#define WEIGHT1_MASK (0x7f<< 8) /* Weight value assign of queue 1 for WFQ */ -#define SCHE0_WFQ (1<<7) /* Schedule Type for Queue 0: 1-WFQ ,0-Strict Priority */ -#define SCHE0_OFFSET ( 7) /* Schedule Type for Queue 0: 1-WFQ ,0-Strict Priority */ -#define SCHE0_MASK (1<<7) /* Schedule Type for Queue 0: 1-WFQ ,0-Strict Priority */ -#define WEIGHT0_OFFSET ( 0) /* Weight value assign of queue 0 for WFQ */ -#define WEIGHT0_MASK (0x7f<< 0) /* Weight value assign of queue 0 for WFQ */ -/* WFQECR0P0 - Weighted Fair Queue Weighting Control Register 1 */ -#define SCHE5_WFQ (1<<15) /* Schedule Type for Queue 5: 1-WFQ ,0-Strict Priority */ -#define SCHE5_OFFSET (15) /* Schedule Type for Queue 5: 1-WFQ ,0-Strict Priority */ -#define SCHE5_MASK (1<<15) /* Schedule Type for Queue 5: 1-WFQ ,0-Strict Priority */ -#define WEIGHT5_OFFSET ( 8) /* Weight value assign of queue 5 for WFQ */ -#define WEIGHT5_MASK (0x7f<< 8) /* Weight value assign of queue 5 for WFQ */ -#define SCHE4_WFQ (1<< 7) /* Schedule Type for Queue 4: 1-WFQ ,0-Strict Priority */ -#define SCHE4_OFFSET ( 7) /* Schedule Type for Queue 4: 1-WFQ ,0-Strict Priority */ -#define SCHE4_MASK (1<< 7) /* Schedule Type for Queue 4: 1-WFQ ,0-Strict Priority */ -#define WEIGHT4_OFFSET ( 0) /* Weight value assign of queue 4 for WFQ */ -#define WEIGHT4_MASK (0x7f<< 0) /* Weight value assign of queue 4 for WFQ */ - -/* ELBPCR - Egress Leaky Bucket Parameter Control Register */ -#define Token_OFFSET (8) /* Token used for adding budget in each time slot. */ -#define Token_MASK (0xff<<8) /* Token used for adding budget in each time slot. */ -#define Tick_OFFSET (0) /* Tick used for time slot size unit */ -#define Tick_MASK (0xff<<0) /* Tick used for time slot size unit */ - -/* ELBTTCR - Egress Leaky Bucket Token Threshold Control Register */ -#define L2_OFFSET (0) /* leaky Bucket Token Hi-threshold register */ -#if 0/* conflict with flagDef.h */ -#define L2_MASK (0xffff<<0) /* leaky Bucket Token Hi-threshold register */ -#endif - -/* ILBPCR1 - Ingress Leaky Bucket Parameter Control Register 1 */ -#define UpperBound_OFFSET (16) /* Ingress BWC Parameter Upper bound Threshold (unit: 400bytes) */ -#define UpperBound_MASK (0xffff<<16) /* Ingress BWC Parameter Upper bound Threshold (unit: 400bytes) */ -#define LowerBound_OFFSET (0) /* Ingress BWC Parameter Lower Bound Threshold (unit: 400 bytes) */ -#define LowerBound_MASK (0xffff<<0) /* Ingress BWC Parameter Lower Bound Threshold (unit: 400 bytes) */ - -/* ILBPCR2 - Ingress Leaky Bucket Parameter Control Register 2 */ -#define ILB_feedToken_OFFSET (8) /* Token is used for adding budget in each time slot */ -#define ILB_feedToken_MASK (0xff<<8) /* Token is used for adding budget in each time slot */ -#define ILB_Tick_OFFSET (0) /* Tick is used for time slot size unit. */ -#define ILB_Tick_MASK (0xff<<0) /* Tick is used for time slot size unit. */ - - - - - - -#define VCR0 (0x00 +0x4A00+SWCORE_BASE) /* Vlan Control register*/ -#define VCR1 (0x04 +0x4A00+SWCORE_BASE) /* Vlan Control register*/ -#define PVCR0 (0x08 +0x4A00+SWCORE_BASE) /* port base control register*/ -#define PVCR1 (0x0C +0x4A00+SWCORE_BASE) /* port base control register*/ -#define PVCR2 (0x10 +0x4A00+SWCORE_BASE) /* port base control register*/ -#define PVCR3 (0x14 +0x4A00+SWCORE_BASE) /* port base control register*/ -#define PVCR4 (0x18 +0x4A00+SWCORE_BASE) /* port base control register*/ -#define PBVCR0 (0x1C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Control Register 0 */ -#define PBVCR1 (0x20 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Control Register 1 */ -#define PBVR0_0 (0x24 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 0 -- IPX */ -#define PBVR0_1 (0x28 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 0 -- IPX */ -#define PBVR0_2 (0x2C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 0 -- IPX */ -#define PBVR0_3 (0x30 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 0 -- IPX */ -#define PBVR0_4 (0x34 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 0 -- IPX */ -#define PBVR1_0 (0x38 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 1 NetBIOS */ -#define PBVR1_1 (0x3C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 1 NetBIOS */ -#define PBVR1_2 (0x40 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 1 NetBIOS */ -#define PBVR1_3 (0x44 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 1 NetBIOS */ -#define PBVR1_4 (0x48 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 1 NetBIOS */ -#define PBVR2_0 (0x4C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 2 PPPoE Control */ -#define PBVR2_1 (0x50 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 2 PPPoE Control */ -#define PBVR2_2 (0x54 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 2 PPPoE Control */ -#define PBVR2_3 (0x58 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 2 PPPoE Control */ -#define PBVR2_4 (0x5C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 2 PPPoE Control */ -#define PBVR3_0 (0x60 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 3 PPPoE session */ -#define PBVR3_1 (0x64 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 3 PPPoE session */ -#define PBVR3_2 (0x68 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 3 PPPoE session */ -#define PBVR3_3 (0x6C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 3 PPPoE session */ -#define PBVR3_4 (0x70 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 3 PPPoE session */ -#define PBVR4_0 (0x74 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 1 */ -#define PBVR4_1 (0x78 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 1 */ -#define PBVR4_2 (0x7C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 1 */ -#define PBVR4_3 (0x80 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 1 */ -#define PBVR4_4 (0x84 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 1 */ -#define PBVR5_0 (0x88 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 2 */ -#define PBVR5_1 (0x8C +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 2 */ -#define PBVR5_2 (0x90 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 2 */ -#define PBVR5_3 (0x94 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 2 */ -#define PBVR5_4 (0x98 +0x4A00+SWCORE_BASE) /* Protocol-Based VLAN Rule 4 User-defined 2 */ - -/* VCR0 - Vlan Control register */ -#define En1QtagVIDignore (1<<31) /* Enable 1Q vlan unware*/ -#define EN_1QTAGVIDIGNORE En1QtagVIDignore /* Alias Name */ -#define P8_AcptFType_OFFSET 25 /* Accept Frame Type for VLAN ingress control (Ext2) */ -#define P8_AcptFType_MASK (3<<25) /* Accept Frame Type for VLAN ingress control (Ext2) */ -#define P8_AcptFType_AdmitAllFrame (0<<25) /* Accept tagged and untagged frame (Ext2) */ -#define P8_AcptFType_AdmitTaggedOnly (1<<25) /* Accept tagged frame only (Ext2) */ -#define P8_AcptFType_AdmitUntagged (2<<25) /* Accept untagged frame and priority tag frame (Ext2) */ -#define P7_AcptFType_OFFSET 23 /* Accept Frame Type for VLAN ingress control (Ext1) */ -#define P7_AcptFType_MASK (3<<23) /* Accept Frame Type for VLAN ingress control (Ext1) */ -#define P7_AcptFType_AdmitAllFrame (0<<23) /* Accept tagged and untagged frame (Ext1) */ -#define P7_AcptFType_AdmitTaggedOnly (1<<23) /* Accept tagged frame only (Ext1) */ -#define P7_AcptFType_AdmitUntagged (2<<23) /* Accept untagged frame and priority tag frame (Ext1) */ -#define P6_AcptFType_OFFSET 21 /* Accept Frame Type for VLAN ingress control (Ext0) */ -#define P6_AcptFType_MASK (3<<21) /* Accept Frame Type for VLAN ingress control (Ext0) */ -#define P6_AcptFType_AdmitAllFrame (0<<21) /* Accept tagged and untagged frame (Ext0) */ -#define P6_AcptFType_AdmitTaggedOnly (1<<21) /* Accept tagged frame only (Ext0) */ -#define P6_AcptFType_AdmitUntagged (2<<21) /* Accept untagged frame and priority tag frame (Ext0) */ -#define P5_AcptFType_OFFSET 19 /* Accept Frame Type for VLAN ingress control */ -#define P5_AcptFType_MASK (3<<19) /* Accept Frame Type for VLAN ingress control */ -#define P5_AcptFType_AdmitAllFrame (0<<19) /* Accept tagged and untagged frame */ -#define P5_AcptFType_AdmitTaggedOnly (1<<19) /* Accept tagged frame only */ -#define P5_AcptFType_AdmitUntagged (2<<19) /* Accept untagged frame and priority tag frame */ -#define P4_AcptFType_OFFSET 17 /* Accept Frame Type for VLAN ingress control */ -#define P4_AcptFType_MASK (3<<17) /* Accept Frame Type for VLAN ingress control */ -#define P4_AcptFType_AdmitAllFrame (0<<17) /* Accept tagged and untagged frame */ -#define P4_AcptFType_AdmitTaggedOnly (1<<17) /* Accept tagged frame only */ -#define P4_AcptFType_AdmitUntagged (2<<17) /* Accept untagged frame and priority tag frame */ -#define P3_AcptFType_OFFSET 15 /* Accept Frame Type for VLAN ingress control */ -#define P3_AcptFType_MASK (3<<15) /* Accept Frame Type for VLAN ingress control */ -#define P3_AcptFType_AdmitAllFrame (0<<15) /* Accept tagged and untagged frame */ -#define P3_AcptFType_AdmitTaggedOnly (1<<15) /* Accept tagged frame only */ -#define P3_AcptFType_AdmitUntagged (2<<15) /* Accept untagged frame and priority tag frame */ -#define P2_AcptFType_OFFSET 13 /* Accept Frame Type for VLAN ingress control */ -#define P2_AcptFType_MASK (3<<13) /* Accept Frame Type for VLAN ingress control */ -#define P2_AcptFType_AdmitAllFrame (0<<13) /* Accept tagged and untagged frame */ -#define P2_AcptFType_AdmitTaggedOnly (1<<13) /* Accept tagged frame only */ -#define P2_AcptFType_AdmitUntagged (2<<13) /* Accept untagged frame and priority tag frame */ -#define P1_AcptFType_OFFSET 11 /* Accept Frame Type for VLAN ingress control */ -#define P1_AcptFType_MASK (3<<11) /* Accept Frame Type for VLAN ingress control */ -#define P1_AcptFType_AdmitAllFrame (0<<11) /* Accept tagged and untagged frame */ -#define P1_AcptFType_AdmitTaggedOnly (1<<11) /* Accept tagged frame only */ -#define P1_AcptFType_AdmitUntagged (2<<11) /* Accept untagged frame and priority tag frame */ -#define P0_AcptFType_OFFSET 9 /* Accept Frame Type for VLAN ingress control */ -#define P0_AcptFType_MASK (3<<9) /* Accept Frame Type for VLAN ingress control */ -#define P0_AcptFType_AdmitAllFrame (0<<9) /* Accept tagged and untagged frame */ -#define P0_AcptFType_AdmitTaggedOnly (1<<9) /* Accept tagged frame only */ -#define P0_AcptFType_AdmitUntagged (2<<9) /* Accept untagged frame and priority tag frame */ -#define EnVlanInF_OFFSET 0 /* Enable Vlan Ingress Filtering */ -#define EnVlanInF_MASK (0x1ff<<0) /* Enable Vlan Ingress Filtering */ -#define EN_VLAN_INGRESS_FILTER (1) /* Backward compatible for EnVlanInF */ -#define EN_ALL_PORT_VLAN_INGRESS_FILTER EnVlanInF_MASK /* Alias Name */ - -/* PVCR0, PVCR1, PVCR2, PVCR3, PVCR4 - Port-Based VLAN Control Register */ -#define PVIDP0_OFFSET 0 /* Default PVID for Port 0 */ -#define PVIDP0_MASK (0xfff<< 0) /* Default PVID for Port 0 */ -#define DPRIOP0_OFFSET 12 /* Default Port Priority for Port 0 */ -#define DPRIOP0_MASK (7<<12) /* Default Port Priority for Port 0 */ -#define PVIDP1_OFFSET 16 /* Default PVID for Port 1 */ -#define PVIDP1_MASK (0xfff<<16) /* Default PVID for Port 1 */ -#define DPRIOP1_OFFSET 28 /* Default Port Priority for Port 1 */ -#define DPRIOP1_MASK (7<<28) /* Default Port Priority for Port 1 */ -#define PVIDP2_OFFSET 0 /* Default PVID for Port 2 */ -#define PVIDP2_MASK (0xfff<< 0) /* Default PVID for Port 2 */ -#define DPRIOP2_OFFSET 12 /* Default Port Priority for Port 2 */ -#define DPRIOP2_MASK (7<<12) /* Default Port Priority for Port 2 */ -#define PVIDP3_OFFSET 16 /* Default PVID for Port 3 */ -#define PVIDP3_MASK (0xfff<<16) /* Default PVID for Port 3 */ -#define DPRIOP3_OFFSET 28 /* Default Port Priority for Port 3 */ -#define DPRIOP3_MASK (7<<28) /* Default Port Priority for Port 3 */ -#define PVIDP4_OFFSET 0 /* Default PVID for Port 4 */ -#define PVIDP4_MASK (0xfff<< 0) /* Default PVID for Port 4 */ -#define DPRIOP4_OFFSET 12 /* Default Port Priority for Port 4 */ -#define DPRIOP4_MASK (7<<12) /* Default Port Priority for Port 4 */ -#define PVIDP5_OFFSET 16 /* Default PVID for Port 5 */ -#define PVIDP5_MASK (0xfff<<16) /* Default PVID for Port 5 */ -#define DPRIOP5_OFFSET 28 /* Default Port Priority for Port 5 */ -#define DPRIOP5_MASK (7<<28) /* Default Port Priority for Port 5 */ -#define PVIDP6_OFFSET 0 /* Default PVID for Port 6 */ -#define PVIDP6_MASK (0xfff<< 0) /* Default PVID for Port 6 */ -#define DPRIOP6_OFFSET 12 /* Default Port Priority for Port 6 */ -#define DPRIOP6_MASK (7<<12) /* Default Port Priority for Port 6 */ -#define PVIDP7_OFFSET 16 /* Default PVID for Port 7 */ -#define PVIDP7_MASK (0xfff<<16) /* Default PVID for Port 7 */ -#define DPRIOP7_OFFSET 28 /* Default Port Priority for Port 7 */ -#define DPRIOP7_MASK (7<<28) /* Default Port Priority for Port 7 */ -#define PVIDP8_OFFSET 0 /* Default PVID for Port 8 */ -#define PVIDP8_MASK (0xfff<< 0) /* Default PVID for Port 8 */ -#define DPRIOP8_OFFSET 12 /* Default Port Priority for Port 8 */ -#define DPRIOP8_MASK (7<<12) /* Default Port Priority for Port 8 */ - - -/* - * 802.1X Control Register */ -#define DOT1X_BASE (SWCORE_BASE + 0x4B00) -#define DOT1XPORTCR (0x00 +DOT1X_BASE) /* 802.1X port base control register*/ -#define DOT1XMACCR (0x04 +DOT1X_BASE) /* 802.1X mac base control register*/ -#define GVGCR (0x08 +DOT1X_BASE) /* Guest VLAN registerr*/ - -#define DOT1X_DIR_BOTH 0 /* Bi-directional */ -#define DOT1X_DIR_IN 1 /* only filter IN */ -#define DOT1X_UNAUTH 0 /* Un-auth */ -#define DOT1X_AUTH 1 /* Auth */ -#define DOT1X_DISABLE 0 /* Disable */ -#define DOT1X_ENABLE 1 /* Enable */ - -/* DOT1XPORTCR - 802.1X port base control register */ -#define Dot1XPB_P8OPDIR (1<<26) /* Uni/Bi-directional Control Type for Port 8. 0:BOTH, 1:IN */ -#define Dot1XPB_P8Auth (1<<25) /* Authentication Status for Port 8. 0:Unauthorized, 1:Authorized */ -#define Dot1XPB_P8En (1<<24) /* Enabled/Disable Port Based Access Control for Port 8. 0:Disable, 1:Enable */ -#define Dot1XPB_P7OPDIR (1<<23) /* Uni/Bi-directional Control Type for Port 7. 0:BOTH, 1:IN */ -#define Dot1XPB_P7Auth (1<<22) /* Authentication Status for Port 7. 0:Unauthorized, 1:Authorized */ -#define Dot1XPB_P7En (1<<21) /* Enabled/Disable Port Based Access Control for Port 7. 0:Disable, 1:Enable */ -#define Dot1XPB_P6OPDIR (1<<20) /* Uni/Bi-directional Control Type for Port 6. 0:BOTH, 1:IN */ -#define Dot1XPB_P6Auth (1<<19) /* Authentication Status for Port 6. 0:Unauthorized, 1:Authorized */ -#define Dot1XPB_P6En (1<<18) /* Enabled/Disable Port Based Access Control for Port 6. 0:Disable, 1:Enable */ -#define Dot1XPB_P5OPDIR (1<<17) /* Uni/Bi-directional Control Type for Port 5. 0:BOTH, 1:IN */ -#define Dot1XPB_P5Auth (1<<16) /* Authentication Status for Port 5. 0:Unauthorized, 1:Authorized */ -#define Dot1XPB_P5En (1<<15) /* Enabled/Disable Port Based Access Control for Port 5. 0:Disable, 1:Enable */ -#define Dot1XPB_P4OPDIR (1<<14) /* Uni/Bi-directional Control Type for Port 4. 0:BOTH, 1:IN */ -#define Dot1XPB_P4Auth (1<<13) /* Authentication Status for Port 4. 0:Unauthorized, 1:Authorized */ -#define Dot1XPB_P4En (1<<13) /* Enabled/Disable Port Based Access Control for Port 4. 0:Disable, 1:Enable */ -#define Dot1XPB_P3OPDIR (1<<11) /* Uni/Bi-directional Control Type for Port 3. 0:BOTH, 1:IN */ -#define Dot1XPB_P3Auth (1<<10) /* Authentication Status for Port 3. 0:Unauthorized, 1:Authorized */ -#define Dot1XPB_P3En (1<< 9) /* Enabled/Disable Port Based Access Control for Port 3. 0:Disable, 1:Enable */ -#define Dot1XPB_P2OPDIR (1<< 8) /* Uni/Bi-directional Control Type for Port 2. 0:BOTH, 1:IN */ -#define Dot1XPB_P2Auth (1<< 7) /* Authentication Status for Port 2. 0:Unauthorized, 1:Authorized */ -#define Dot1XPB_P2En (1<< 6) /* Enabled/Disable Port Based Access Control for Port 2. 0:Disable, 1:Enable */ -#define Dot1XPB_P1OPDIR (1<< 5) /* Uni/Bi-directional Control Type for Port 1. 0:BOTH, 1:IN */ -#define Dot1XPB_P1Auth (1<< 4) /* Authentication Status for Port 1. 0:Unauthorized, 1:Authorized */ -#define Dot1XPB_P1En (1<< 3) /* Enabled/Disable Port Based Access Control for Port 1. 0:Disable, 1:Enable */ -#define Dot1XPB_P0OPDIR (1<< 2) /* Uni/Bi-directional Control Type for Port 0. 0:BOTH, 1:IN */ -#define Dot1XPB_P0Auth (1<< 1) /* Authentication Status for Port 0. 0:Unauthorized, 1:Authorized */ -#define Dot1XPB_P0En (1<< 0) /* Enabled/Disable Port Based Access Control for Port 0. 0:Disable, 1:Enable */ - -#define Dot1XPB_POPDIR_offset(idx) (((idx)*3) + 2) -#define Dot1XPB_PAuth_offset(idx) (((idx)*3) + 1) -#define Dot1XPB_PEn_offset(idx) ((idx)*3) -#define Dot1XPB_POPDIR(idx, dir) ((dir) << Dot1XPB_POPDIR_offset(idx)) -#define Dot1XPB_PAuth(idx, auth) ((auth) << Dot1XPB_PAuth_offset(idx)) -#define Dot1XPB_PEn(idx, en) ((en) << Dot1XPB_PEn_offset(idx)) - -#define EN_8021X_PORT_CONTROL Dot1XPB_P0En /* Enable 1X Port Base Control*/ -#define EN_8021X_PORT_AUTH Dot1XPB_P0Auth /* port authorized*/ -#define EN_8021X_PORT_DIR_IN Dot1XPB_P0OPDIR /* Only filter In direction*/ -#define EN_DOT1XPB_P0 Dot1XPB_P0En /* Alias Name */ -#define EN_DOT1XPB_P0_AUTH Dot1XPB_P0Auth /* Alias Name */ -#define EN_DOT1XPB_P0_OPINDIR Dot1XPB_P0OPDIR /* Alias Name */ -#define EN_DOT1XPB_P1 Dot1XPB_P1En /* Alias Name */ -#define EN_DOT1XPB_P1_AUTH Dot1XPB_P1Auth /* Alias Name */ -#define EN_DOT1XPB_P1_OPINDIR Dot1XPB_P1OPDIR /* Alias Name */ -#define EN_DOT1XPB_P2 Dot1XPB_P2En /* Alias Name */ -#define EN_DOT1XPB_P2_AUTH Dot1XPB_P2Auth /* Alias Name */ -#define EN_DOT1XPB_P2_OPINDIR Dot1XPB_P2OPDIR /* Alias Name */ -#define EN_DOT1XPB_P3 Dot1XPB_P3En /* Alias Name */ -#define EN_DOT1XPB_P3_AUTH Dot1XPB_P3Auth /* Alias Name */ -#define EN_DOT1XPB_P3_OPINDIR Dot1XPB_P3OPDIR /* Alias Name */ -#define EN_DOT1XPB_P4 Dot1XPB_P4En /* Alias Name */ -#define EN_DOT1XPB_P4_AUTH Dot1XPB_P4Auth /* Alias Name */ -#define EN_DOT1XPB_P4_OPINDIR Dot1XPB_P4OPDIR /* Alias Name */ -#define EN_DOT1XPB_P5 Dot1XPB_P5En /* Alias Name */ -#define EN_DOT1XPB_P5_AUTH Dot1XPB_P5Auth /* Alias Name */ -#define EN_DOT1XPB_P5_OPINDIR Dot1XPB_P5OPDIR /* Alias Name */ -#define EN_DOT1XPB_P6 Dot1XPB_P6En /* Alias Name */ -#define EN_DOT1XPB_P6_AUTH Dot1XPB_P6Auth /* Alias Name */ -#define EN_DOT1XPB_P6_OPINDIR Dot1XPB_P6OPDIR /* Alias Name */ -#define EN_DOT1XPB_P7 Dot1XPB_P7En /* Alias Name */ -#define EN_DOT1XPB_P7_AUTH Dot1XPB_P7Auth /* Alias Name */ -#define EN_DOT1XPB_P7_OPINDIR Dot1XPB_P7OPDIR /* Alias Name */ -#define EN_DOT1XPB_P8 Dot1XPB_P8En /* Alias Name */ -#define EN_DOT1XPB_P8_AUTH Dot1XPB_P8Auth /* Alias Name */ -#define EN_DOT1XPB_P8_OPINDIR Dot1XPB_P8OPDIR /* Alias Name */ - -/* DOT1XMACCR - 802.1X mac base control register*/ -#define Dot1xMAC_OPDIR (1<<10) /* OperCOnntrolledDirections for MAC-Based ACCESS Control. 0:BOTH, 1:IN */ -#define Dot1xMAC_OPDIR_IN Dot1xMAC_OPDIR -#define Dot1xMAC_OPDIR_BOTH 0 -#define Dot1xMAC_P8En (1<< 8) /* Enable/Disable MAC Address Based Control on Port 8. 0:disable, 1:enable */ -#define Dot1xMAC_P7En (1<< 7) /* Enable/Disable MAC Address Based Control on Port 7. 0:disable, 1:enable */ -#define Dot1xMAC_P6En (1<< 6) /* Enable/Disable MAC Address Based Control on Port 6. 0:disable, 1:enable */ -#define Dot1xMAC_P5En (1<< 5) /* Enable/Disable MAC Address Based Control on Port 5. 0:disable, 1:enable */ -#define Dot1xMAC_P4En (1<< 4) /* Enable/Disable MAC Address Based Control on Port 4. 0:disable, 1:enable */ -#define Dot1xMAC_P3En (1<< 3) /* Enable/Disable MAC Address Based Control on Port 3. 0:disable, 1:enable */ -#define Dot1xMAC_P2En (1<< 2) /* Enable/Disable MAC Address Based Control on Port 2. 0:disable, 1:enable */ -#define Dot1xMAC_P1En (1<< 1) /* Enable/Disable MAC Address Based Control on Port 1. 0:disable, 1:enable */ -#define Dot1xMAC_P0En (1<< 0) /* Enable/Disable MAC Address Based Control on Port 0. 0:disable, 1:enable */ -#define EN_DOT1XMAC_OPDIR_IN Dot1xMAC_OPDIR /* Alias Name */ -#define EN_8021X_ALLPORT_MAC_CONTROL 0x01FF -#define EN_8021X_MAC_CONTROL (1) /* Flag to check if port n is enabled */ -#define EN_8021X_PORT0_MAC_CONTROL Dot1xMAC_P0En /* Alias Name */ -#define EN_8021X_PORT1_MAC_CONTROL Dot1xMAC_P1En /* Alias Name */ -#define EN_8021X_PORT2_MAC_CONTROL Dot1xMAC_P2En /* Alias Name */ -#define EN_8021X_PORT3_MAC_CONTROL Dot1xMAC_P3En /* Alias Name */ -#define EN_8021X_PORT4_MAC_CONTROL Dot1xMAC_P4En /* Alias Name */ -#define EN_8021X_PORT5_MAC_CONTROL Dot1xMAC_P5En /* Alias Name */ -#define EN_8021X_PORT6_MAC_CONTROL Dot1xMAC_P6En /* Alias Name */ -#define EN_8021X_PORT7_MAC_CONTROL Dot1xMAC_P7En /* Alias Name */ -#define EN_8021X_PORT8_MAC_CONTROL Dot1xMAC_P8En /* Alias Name */ - -/* GVGCR - Guest VLAN registerr*/ -#define GVR2CPU (1<<15) /* Enable Guest VLAN routing packet to be trap to CPU */ -#define GVOPDIR (1<<14) /* Guest Vlan operation direction control*/ -#define Dot1xUNAUTHBH_OFFSET 12 /* Defaulkt Process of unauthenticated client(/packet) for both port-based and MAC-based Access Control */ -#define Dot1XUNAUTHBH_MASK (3<<12) /* Defaulkt Process of unauthenticated client(/packet) for both port-based and MAC-based Access Control */ -#define Dot1xUNAUTHBH_DROP (0<<12) /* Drop unauthorized frame */ -#define Dot1xUNAUTHBH_TOCPU (1<<12) /* Trap unauthorized frame to CPU */ -#define Dot1xUNAUTHBH_GVLAN (2<<12) /* Enable limited access in Guest VLAN */ -#define Dot1xUNAUTHBH_RESERVED (3<<12) /* Reserved */ -#define GVID_OFFSET 0 /* Guest VLAN VID */ -#define GVID_MASK (0xfff<<0) /* Guest VLAN VID */ -#define EN_DOT1X_GVR2CPU GVR2CPU /* Alias Name */ -#define EN_GVOPDIR GVOPDIR /* Alias Name */ -#define GVLAN_PROCESS_BITS Dot1xUNAUTHBH_OFFSET /* Alias Name */ -#define GVLAN_PROCESS_MASK (Dot1XUNAUTHBH_MASK>>Dot1xUNAUTHBH_OFFSET) /* Alias Name */ -#define DOT1X_PROCESS_DROP (Dot1xUNAUTHBH_DROP>>Dot1xUNAUTHBH_OFFSET) /* Alias Name */ -#define DOT1X_PROCESS_TOCPU (Dot1xUNAUTHBH_TOCPU>>Dot1xUNAUTHBH_OFFSET) /* Alias Name */ -#define DOT1X_PROCESS_GVLAN (Dot1xUNAUTHBH_GVLAN>>Dot1xUNAUTHBH_OFFSET) /* Alias Name */ -#define DOT1X_PROCESS_RESERVED (Dot1xUNAUTHBH_RESERVED>>Dot1xUNAUTHBH_OFFSET) /* Alias Name */ - -/* Link Aggregation Control Register (IEEE 802.3ad) */ -#define LAGCR_BASE (SWCORE_BASE + 0x4C00) -#define LAGHPMR0 (0x00 + LAGCR_BASE) /* Link Aggregation Hashed Index to Port Mapping Register 0 */ -#define LAGCR0 (0x08 + LAGCR_BASE) /* Link Aggregation Control Register 0 */ -#define LAGCR1 (0x0C + LAGCR_BASE) /* Link Aggregation Control Register 1 */ - -/* output queue stats mask */ -#define OUTPUTQUEUE_STAT_MASK_CR0 0xfc000000 -#define OUTPUTQUEUE_STAT_MASK_CR1 0x3fffffff - -/* LAGHPMR0 - Link Aggregation Hashed Index to Port Mapping Register 0 */ -#define LAG_HASHIDX_BITNUM 4 - -/* LAGCR0 - Link Aggregation Control Register 0 */ -#define TRUNKMASK_MASK (0x1ff) - -#define RTL865X_PORTMASK_UNASIGNED 0x5A5A5A5A - -#define RTL865X_PREALLOC_SKB_UNASIGNED 0xA5A5A5A5 - -#define RTL865XC_PORT_NUMBER 9 - -/* Spanning Tree Port State Definition */ -#define RTL8651_PORTSTA_DISABLED 0x00 -#define RTL8651_PORTSTA_BLOCKING 0x01 -#define RTL8651_PORTSTA_LISTENING 0x02 -#define RTL8651_PORTSTA_LEARNING 0x03 -#define RTL8651_PORTSTA_FORWARDING 0x04 - -#define RTL8651_L2TBL_ROW 256 -#define RTL8651_L2TBL_COLUMN 4 - -#define RTL865XC_LAGHASHIDX_NUMBER 8 /* There are 8 hash values in RTL865xC Link Aggregation. */ - -#define RTL865XC_VLAN_NUMBER 4096 - -//Ethernet port bandwidth control -#define RTL8651_BC_FULL 0x00 -#define RTL8651_BC_128K 0x01 -#define RTL8651_BC_256K 0x02 -#define RTL8651_BC_512K 0x03 -#define RTL8651_BC_1M 0x04 -#define RTL8651_BC_2M 0x05 -#define RTL8651_BC_4M 0x06 -#define RTL8651_BC_8M 0x07 -#define RTL8651_BC_16M 0x08 -#define RTL8651_BC_32M 0x09 -#define RTL8651_BC_64M 0x0A - -/* For round robin ration */ -#define RTL8651_RR_H_FIRST 0x03 -#define RTL8651_RR_H16_L1 0x02 -#define RTL8651_RR_H8_L1 0x01 -#define RTL8651_RR_H4_L1 0x00 - -#define RTL865XC_NETINTERFACE_NUMBER 8 - -#define RTL8651_L2_NUMBER 1024 - -enum FDB_FLAGS -{ - FDB_FWD = 0, - FDB_SRCBLK = 1, - FDB_TRAPCPU = 2, -}; - - -/* Miscellaneous control registers -*/ -#define LEDCREG (SWCORE_BASE + 0x4300) /* LED control */ -#define LEDCR1 (LEDCREG+0x04) -#define LEDBCR (LEDCREG+0x0C) - -#define MISC_BASE (SWCORE_BASE + 0x00007000) -//#define LEDCR (0x000 + MISC_BASE) /* LED control */ -#define LEDCR (0x000 + SWCORE_BASE + 0x4300) /* LED control */ //????? -#define BCR0 (0x008 + MISC_BASE) /* Input bandwidth control */ -#define BCR1 (0x00C + MISC_BASE) /* Ouput bandwidth control */ -#define FCREN (0x014 + MISC_BASE) /* Flow control enable control */ -#define FCRTH (0x018 + MISC_BASE) /* Flow control threshold */ -#define FCPTR (0x028 + MISC_BASE) /* Flow control prime threshold register */ -#define PTCR (0x01C + MISC_BASE) /* Port trunk control */ -#define SWTECR (0x020 + MISC_BASE) /* Switch table extended control */ -#define PTRAPCR (0x024 + MISC_BASE) /* Protocol trapping control */ - - - -#define GIDXMCR (0x07C + MISC_BASE) /* GIDX mapping control */ -#define PBVR2 (0x0A0 + MISC_BASE) /* Protocol-Based VLAN Rule 2 -- NetBIOS */ -#define PBVR2E (0x0A4 + MISC_BASE) /* Protocol-Based VLAN Rule 2 Extended */ -#define PBVR3 (0x0A8 + MISC_BASE) /* Protocol-Based VLAN Rule 3 -- PPPoE Control */ -#define PBVR3E (0x0AC + MISC_BASE) /* Protocol-Based VLAN Rule 3 Extended */ -#define PBVR4 (0x0B0 + MISC_BASE) /* Protocol-Based VLAN Rule 4 -- PPPoE Session */ -#define PBVR4E (0x0B4 + MISC_BASE) /* Protocol-Based VLAN Rule 4 Extended */ -#define PBVR5 (0x0B8 + MISC_BASE) /* Protocol-Based VLAN Rule 5 -- User-defined 1*/ -#define PBVR5E (0x0BC + MISC_BASE) /* Protocol-Based VLAN Rule 5 Extended */ -#define PBVR6 (0x0C0 + MISC_BASE) /* Protocol-Based VLAN Rule 6 -- User-defined 2*/ -#define PBVR6E (0x0C4 + MISC_BASE) /* Protocol-Based VLAN Rule 6 Extended */ - -#define PSIR0 (0x0C8 + MISC_BASE) /* Port State Information Register 0 */ -#define PSIR1 (0x0CC + MISC_BASE) /* Port State Information Register 1 */ -#define CHIPID (0x100 + MISC_BASE) /* Chip version ID */ - -/* LED control register field definitions -*/ -#define LED_P0_SPEED (1 << 0) /* LED port 0 collision */ -#define LED_P0_ACT (1 << 1) /* LED port 0 active */ -#define LED_P0_COL (1 << 2) /* LED port 0 speed 100M */ -#define LED_P1_SPEED (1 << 3) /* LED port 1 collision */ -#define LED_P1_ACT (1 << 4) /* LED port 1 active */ -#define LED_P1_COL (1 << 5) /* LED port 1 speed 100M */ -#define LED_P2_SPEED (1 << 6) /* LED port 2 collision */ -#define LED_P2_ACT (1 << 7) /* LED port 2 active */ -#define LED_P2_COL (1 << 8) /* LED port 2 speed 100M */ -#define LED_P3_SPEED (1 << 9) /* LED port 3 collision */ -#define LED_P3_ACT (1 << 10) /* LED port 3 active */ -#define LED_P3_COL (1 << 11) /* LED port 3 speed 100M */ -#define LED_P4_SPEED (1 << 12) /* LED port 4 collision */ -#define LED_P4_ACT (1 << 13) /* LED port 4 active */ -#define LED_P4_COL (1 << 14) /* LED port 4 speed 100M */ -#define LED_P5_SPEED (1 << 15) /* LED port 5 collision */ -#define LED_P5_ACT (1 << 16) /* LED port 5 active */ -#define LED_P5_COL (1 << 17) /* LED port 5 speed 100M */ -#define EN_LED_CPU_CTRL (1 << 18) /* Enable CPU control LED */ -/* Bandwidth control register field definitions -*/ -#define OUT_BC_P0_OFFSET 0 /* Output bandwidth control port 0 offset */ -#define IN_BC_P0_OFFSET 4 /* Input bandwidth control port 0 offset */ -#define OUT_BC_P1_OFFSET 8 /* Output bandwidth control port 1 offset */ -#define IN_BC_P1_OFFSET 12 /* Input bandwidth control port 1 offset */ -#define OUT_BC_P2_OFFSET 16 /* Output bandwidth control port 2 offset */ -#define IN_BC_P2_OFFSET 20 /* Input bandwidth control port 2 offset */ -#define OUT_BC_P3_OFFSET 24 /* Output bandwidth control port 3 offset */ -#define IN_BC_P3_OFFSET 48 /* Input bandwidth control port 3 offset */ -#define OUT_BC_P4_OFFSET 0 /* Output bandwidth control port 4 offset */ -#define IN_BC_P4_OFFSET 4 /* Input bandwidth control port 4 offset */ -#define OUT_BC_P5_OFFSET 8 /* Output bandwidth control port 5 offset */ -#define IN_BC_P5_OFFSET 12 /* Input bandwidth control port 5 offset */ -#define BW_FULL_RATE 0 -#define BW_128K 1 -#define BW_256K 2 -#define BW_512K 3 -#define BW_1M 4 -#define BW_2M 5 -#define BW_4M 6 -#define BW_8M 7 -/* Checksum control register field definitions -*/ -#define ALLOW_L2_CHKSUM_ERR (1 << 0) /* Allow L2 checksum error */ -#define ALLOW_L3_CHKSUM_ERR (1 << 1) /* Allow L3 checksum error */ -#define ALLOW_L4_CHKSUM_ERR (1 << 2) /* Allow L4 checksum error */ -#define EN_ETHER_L3_CHKSUM_REC (1 << 3) /* Enable L3 checksum recalculation*/ -#define EN_ETHER_L4_CHKSUM_REC (1 << 4) /* Enable L4 checksum recalculation*/ -/* Flow control enable register field defintions -*/ -#define EN_INQ_FC_CPU (1 << 31) /* Enable Flow Control on CPU Port */ -#define EN_INQ_FC_5 (1 << 30) /* Enable Flow Control on Port 5 */ -#define EN_INQ_FC_4 (1 << 29) /* Enable Flow Control on Port 4 */ -#define EN_INQ_FC_3 (1 << 28) /* Enable Flow Control on Port 3 */ -#define EN_INQ_FC_2 (1 << 27) /* Enable Flow Control on Port 2 */ -#define EN_INQ_FC_1 (1 << 26) /* Enable Flow Control on Port 1 */ -#define EN_INQ_FC_0 (1 << 25) /* Enable Flow Control on Port 0 */ -#define EN_OUTQ_FC_CPU (1 << 24) /* Enable Flow Control on CPU Port */ -#define EN_OUTQ_FC_5 (1 << 23) /* Enable Flow Control on Port 5 */ -#define EN_OUTQ_FC_4 (1 << 22) /* Enable Flow Control on Port 4 */ -#define EN_OUTQ_FC_3 (1 << 21) /* Enable Flow Control on Port 3 */ -#define EN_OUTQ_FC_2 (1 << 20) /* Enable Flow Control on Port 2 */ -#define EN_OUTQ_FC_1 (1 << 19) /* Enable Flow Control on Port 1 */ -#define EN_OUTQ_FC_0 (1 << 18) /* Enable Flow Control on Port 0 */ -#define CPU_LAUNCH_FC_P5 (1 << 17) /* CPU launch flow control of Port 5 */ -#define CPU_LAUNCH_FC_P4 (1 << 16) /* CPU launch flow control of Port 4 */ -#define CPU_LAUNCH_FC_P3 (1 << 15) /* CPU launch flow control of Port 3 */ -#define CPU_LAUNCH_FC_P2 (1 << 14) /* CPU launch flow control of Port 2 */ -#define CPU_LAUNCH_FC_P1 (1 << 13) /* CPU launch flow control of Port 1 */ -#define CPU_LAUNCH_FC_P0 (1 << 12) /* CPU launch flow control of Port 0 */ -#define EN_MDC_MDIO_FC (1 << 10) /* Enable MDC/MDIO Flow Control */ -#define DSC_TH_OFFSET 0 /* Descriptor Initial threshold */ -/* Flow control threshold register field defintions -*/ -#define IN_Q_PER_PORT_BUF_FC_THH_OFFSET 24 /* InQ per port buffer page flow control high threshold offset */ -#define IN_Q_PER_PORT_BUF_FC_THL_OFFSET 16 /* InQ per port buffer page flow control low threshold offset */ -#define OUT_Q_PER_PORT_BUF_FC_THH_OFFSET 8 /* OutQ per port buffer page flow control high threshold offset */ -#define OUT_Q_PER_PORT_BUF_FC_THL_OFFSET 0 /* OutQ per port buffer page flow control low threshold offset */ -/* Flow control prime threshold register field defintions -*/ -#define IN_Q_PTH_OFFSET 16 /* InQ Prime flow control threshold */ -#define OUT_Q_PTH_OFFSET 0 /* OutQ Prime flow control threshold */ -/* Port trunking control register field definitions -*/ -#define LMPR7_OFFSET 27 /* Physical port index for logical port 7 */ -#define LMPR6_OFFSET 24 /* Physical port index for logical port 6 */ -#define LMPR5_OFFSET 21 /* Physical port index for logical port 5 */ -#define LMPR4_OFFSET 18 /* Physical port index for logical port 4 */ -#define LMPR3_OFFSET 15 /* Physical port index for logical port 3 */ -#define LMPR2_OFFSET 12 /* Physical port index for logical port 2 */ -#define LMPR1_OFFSET 9 /* Physical port index for logical port 1 */ -#define LMPR0_OFFSET 6 /* Physical port index for logical port 0 */ -#define TRUNK1_PORT_MASK_OFFSET 0 /* Physical port mask of trunk 1 */ -/* Port trunking control register field definitions -*/ -#define EN_PPP_OP (1 << 31) /* Enable PPPoE auto insert and remove */ -/* Protocol trapping control register field definitions -*/ -#define EN_ARP_TRAP (1 << 24) /* Enable trapping ARP packets */ -#define EN_RARP_TRAP (1 << 25) /* Enable trapping RARP packets */ -#define EN_PPPOE_TRAP (1 << 26) /* Enable trapping PPPoE packets */ -#define EN_IGMP_TRAP (1 << 27) /* Enable trapping IGMP packets */ -#define EN_DHCP_TRAP1 (1 << 28) /* Enable trapping DHCP 67 packets */ -#define EN_DHCP_TRAP2 (1 << 29) /* Enable trapping DHCP 68 packets */ -#define EN_OSPF_TRAP (1 << 30) /* Enable trapping OSPF packets */ -#define EN_RIP_TRAP (1 << 31) /* Enable trapping RIP packets */ -/* Spanning tree control register field definitions -*/ -#define EN_ESTP_S_DROP (1 << 5) /* Enable egress spanning tree forward S_Drop */ -/* Broadcast storm control register field definitions -*/ -#define EN_BCAST_STORM (1 << 0) /* Enable broadcast storm control */ -#define BCAST_TH_MASK (0xFF << 1) /* Threshold within broadcast interval mask */ -#define BCAST_TH_OFFSET 1 /* Threshold within broadcast interval offset */ -#define TI_100M_MASK (0x3F << 9) /* Time interval for 100M mask */ -#define TI_100M_OFFSET 9 /* Time interval for 100M offset */ -#define TI_10M_MASK (0x3F << 15)/* Time interval for 10M mask */ -#define TI_10M_OFFSET 15 /* Time interval for 10M offset */ -#define EN_L2LRUHASH (1<<4) /*Enable L2 Table hash collision over write the last used entry mode*/ -#define EN_L2FASTAGING (1<<5) /*Enable L2 Fast Aging Out*/ - -/* Table entry aging time control register field definitions -*/ -#define ICMP_TH_OFFSET 26 /* ICMP timeout threshold offset */ -#define ICMP_TH_MASK (0x3f << ICMP_TH_OFFSET) -#define UDP_TH_OFFSET 20 /* UDP timeout threshold offset */ -#define UDP_TH_MASK (0x3f << UDP_TH_OFFSET) -#define TCP_LONG_TH_OFFSET 14 /* TCP long timeout threshold offset */ -#define TCP_LONG_TH_MASK (0x3f << TCP_LONG_TH_OFFSET) -#define TCP_MED_TH_OFFSET 8 /* TCP medium timeout threshold offset */ -#define TCP_MED_TH_MASK (0x3f << TCP_MED_TH_OFFSET) -#define TCP_FAST_TH_OFFSET 2 /* TCP fast timeout threshold offset */ -#define TCP_FAST_TH_MASK (0x3f << TCP_FAST_TH_OFFSET) -/* Port mirror control register field definitions -*/ -#define MIRROR_TO_PORT_OFFSET 26 /* Port receiving the mirrored traffic offset */ -#define MIRROR_FROM_PORT_RX_OFFSET 20 /* Rx port to be mirrored offset */ -#define MIRROR_FROM_PORT_TX_OFFSET 14 /* Tx port to be mirrored offset */ -/* Per port matching action register field definitions -*/ -#define EN_PMATCH_PORT_LIST_OFFSET 26 /* Enable pattern match port list offset */ -#define MATCH_OP_P5_OFFSET 24 /* Offset of operation if matched on port 5 */ -#define MATCH_OP_P4_OFFSET 22 /* Offset of operation if matched on port 4 */ -#define MATCH_OP_P3_OFFSET 20 /* Offset of operation if matched on port 3 */ -#define MATCH_OP_P2_OFFSET 18 /* Offset of operation if matched on port 2 */ -#define MATCH_OP_P1_OFFSET 16 /* Offset of operation if matched on port 1 */ -#define MATCH_OP_P0_OFFSET 14 /* Offset of operation if matched on port 0 */ -#define MATCH_DROP 0 /* Drop if matched */ -#define MATCH_MIRROR_TO_CPU 1 /* Mirror to CPU if matched */ -#define MATCH_FORWARD_TO_CPU 2 /* Forward to CPU if matched */ -#define MATCH_TO_MIRROR_PORT 3 /* To mirror port if matched */ -/* Port based vlan config register field definitions -*/ -#define PVID_MASK 7 /* MASK for PVID */ -#define VIDP0_OFFSET 0 /* Vlan table index for port 0 */ -#define VIDP1_OFFSET 3 /* Vlan table index for port 1 */ -#define VIDP2_OFFSET 6 /* Vlan table index for port 2 */ -#define VIDP3_OFFSET 9 /* Vlan table index for port 3 */ -#define VIDP4_OFFSET 12 /* Vlan table index for port 4 */ -#define VIDP5_OFFSET 15 /* Vlan table index for port 5 */ -/* GIDX mapping control register field definitions -*/ -#define GIDX_MASK 7 /* MASK for GIDX */ -#define GIDX0_OFFSET 0 /* Index to IP table */ -#define GIDX1_OFFSET 3 /* Index to IP table */ -#define GIDX2_OFFSET 6 /* Index to IP table */ -#define GIDX3_OFFSET 9 /* Index to IP table */ -#define GIDX4_OFFSET 12 /* Index to IP table */ -#define GIDX5_OFFSET 15 /* Index to IP table */ -#define GIDX6_OFFSET 18 /* Index to IP table */ -#define GIDX7_OFFSET 21 /* Index to IP table */ -/* Offset control register field definitions -*/ -#define OCR_START_MASK (0x1f << 26) /* Starting value of offset mask */ -#define OCR_START_OFFSET 26 /* Starting value of offset offset */ -#define OCR_END_MASK (0x1f << 20) /* End value of offset mask */ -#define OCR_END_OFFSET 20 /* End value of offset offset */ -/* Protocol-based VLAN Control Register field definitions -*/ -#define PBVCR_PROTO_TYPE_OFFSET 0 /* Protocol-Based VLAN Control Register Protocol Type */ -#define PBVCR_PROTO_TYPE_MASK (0x3 << PBVCR_PROTO_TYPE_OFFSET) -#define PBVCR_PROTO_VALUE_OFFSET 2 /* Protocol-Based VLAN Control Register Protocol Value */ -#define PBVCR_PROTO_VALUE_MASK (0xffff << PBVCR_PROTO_VALUE_OFFSET) -#define PBVCR_VIDXP5_OFFSET 21 /* VLAN index for Port 5 */ -#define PBVCR_VIDXP5_MASK (0x7 << PBVCR_VIDXP5_OFFSET) -#define PBVCR_VP5_OFFSET 20 /* Valid bit for Port 5 */ -#define PBVCR_VP5_MASK (0x1 << PBVCR_VP5_OFFSET) -#define PBVCR_VIDXP4_OFFSET 17 /* VLAN index for Port 4 */ -#define PBVCR_VIDXP4_MASK (0x7 << PBVCR_VIDXP4_OFFSET) -#define PBVCR_VP4_OFFSET 16 /* Valid bit for Port 4 */ -#define PBVCR_VP4_MASK (0x1 << PBVCR_VP4_OFFSET) -#define PBVCR_VIDXP3_OFFSET 13 /* VLAN index for Port 3 */ -#define PBVCR_VIDXP3_MASK (0x7 << PBVCR_VIDXP3_OFFSET) -#define PBVCR_VP3_OFFSET 12 /* Valid bit for Port 3 */ -#define PBVCR_VP3_MASK (0x1 << PBVCR_VP3_OFFSET) -#define PBVCR_VIDXP2_OFFSET 9 /* VLAN index for Port 2 */ -#define PBVCR_VIDXP2_MASK (0x7 << PBVCR_VIDXP2_OFFSET) -#define PBVCR_VP2_OFFSET 8 /* Valid bit for Port 2 */ -#define PBVCR_VP2_MASK (0x1 << PBVCR_VP2_OFFSET) -#define PBVCR_VIDXP1_OFFSET 5 /* VLAN index for Port 1 */ -#define PBVCR_VIDXP1_MASK (0x7 << PBVCR_VIDXP1_OFFSET) -#define PBVCR_VP1_OFFSET 4 /* Valid bit for Port 1 */ -#define PBVCR_VP1_MASK (0x1 << PBVCR_VP1_OFFSET) -#define PBVCR_VIDXP0_OFFSET 3 /* VLAN index for Port 0 */ -#define PBVCR_VIDXP0_MASK (0x7 << PBVCR_VIDXP0_OFFSET) -#define PBVCR_VP0_OFFSET 0 /* Valid bit for Port 0 */ -#define PBVCR_VP0_MASK (0x1 << PBVCR_VP0_OFFSET) -#define PBVCR_VIDXEP2_OFFSET 9 /* VLAN index for Extented Port 2 */ -#define PBVCR_VIDXEP2_MASK (0x7 << PBVCR_VIDXEP2_OFFSET) -#define PBVCR_VEP2_OFFSET 8 /* Valid bit for Extented Port 2 */ -#define PBVCR_VEP2_MASK (0x1 << PBVCR_VEP2_OFFSET) -#define PBVCR_VIDXEP1_OFFSET 5 /* VLAN index for Extented Port 1 */ -#define PBVCR_VIDXEP1_MASK (0x7 << PBVCR_VIDXEP1_OFFSET) -#define PBVCR_VEP1_OFFSET 4 /* Valid bit for Extented Port 1 */ -#define PBVCR_VEP1_MASK (0x1 << PBVCR_VEP1_OFFSET) -#define PBVCR_VIDXEP0_OFFSET 1 /* VLAN index for Extented Port 0 */ -#define PBVCR_VIDXEP0_MASK (0x7 << PBVCR_VIDXEP0_OFFSET) -#define PBVCR_VEP0_OFFSET 0 /* Valid bit for Extented Port 0 */ -#define PBVCR_VEP0_MASK (0x1 << PBVCR_VEP0_OFFSET) - -#if 0 /* Not defined in 865xC spec */ -/* PCMCIA registers -*/ -#define PCMCIA_BASE (SYSTEM_BASE+0x0000) /* 0xBD010000 */ -#define PCMCIA_CFR (0x000 + PCMCIA_BASE) /* PCMCIA Command FIFO Register */ -#define PCMCIA_IER (0x004 + PCMCIA_BASE) /* PCMCIA Interrupt enable register */ -#define PCMCIA_FCR (0x008 + PCMCIA_BASE) /* PCMCIA FIFO control register */ -#define PCMCIA_ISR (0x00C + PCMCIA_BASE) /* PCMCIA Interrupt Status register */ -#define PCTCR (0x010 + PCMCIA_BASE) /* PCMCIA Timing Control Register */ - -//PCMCIA CFG -#define RD_PCMCIA_ATTR 0x10000000 -#define WR_PCMCIA_ATTR 0x00000000 -#define RD_PCMCIA_IO 0x14000000 -#define WR_PCMCIA_IO 0x04000000 - -//PCMCIA IER -#define ERDAI 0x80000000 -#define ERFEI (1<<30) -#define ERFFI (1<<29) -#define ECFDI (1<<28) -#define ECFEI (1<<27) -#define ECFFI (1<<26) - -//PCMCIA FCR -#define EFIFO 0x80000000 -#define RFRST (1<<30) -#define TFRST (1<<29) -#define RTRG_MASK (0x3<<27) -#define RTRG_01 (0x0<<27) -#define RTRG_12 (0x1<<27) -#define RTRG_16 (0x2<<27) -#define RTRG_26 (0x3<<27) -#define RFRC_MASK (0x3f<<21) -#define CFRC_MASK (0x3f<<15) - -//PCMCIA LSR -#define DR 0x80000000 -#define RxEMPTY (1<<30) -#define RxqFULL (1<<29) -#define CMOK (1<<28) -#define CMEMPTY (1<<27) -#define CMFULL (1<<26) -#endif - - - -/* UART registers -*/ -#define UART0_BASE (SYSTEM_BASE+0x2000) /* 0xB8002000 */ -#define UART1_BASE (SYSTEM_BASE+0x2100) - - - - -/* System Control Registers */ - -/* Global interrupt control registers */ -#define GICR_BASE (SYSTEM_BASE+0x3000) /* 0xB8003000 */ -#define GIMR (0x000 + GICR_BASE) /* Global interrupt mask */ -#define GISR (0x004 + GICR_BASE) /* Global interrupt status */ -#define IRR (0x008 + GICR_BASE) /* Interrupt routing */ -#define IRR0 (0x008 + GICR_BASE) /* Interrupt routing */ -#define IRR1 (0x00C + GICR_BASE) /* Interrupt routing */ -#define IRR2 (0x010 + GICR_BASE) /* Interrupt routing */ -#define IRR3 (0x014 + GICR_BASE) /* Interrupt routing */ -/* Global interrupt mask register field definitions -*/ -#define TCIE (1 << 29) /* Timer/Counter interrupt enable */ -#define USBIE (1 << 30) /* USB interrupt enable */ -#define PCMCIAIE (1 << 29) /* PCMCIA interrupt enable */ -#define UART1IE (1 << 28) /* UART 1 interrupt enable */ -#define UART0IE (1 << 27) /* UART 0 interrupt enable */ -#define PCIIE (1 << 26) /* Parallel port interrupt enable */ -#define SWIE (1 << 25) /* Switch core interrupt enable */ -#define PABCIE (1 << 24) /* GPIO port ABC interrupt enable */ -#define IREQ0IE (1 << 23) /* External interrupt 0 enable */ -#define LBCTMOIE (1 << 21) /* LBC time-out interrupt enable */ -#ifdef CONFIG_RTL865XB -#define CRYPTOIE (1 << 20) /* Crypto engine interrupt enable */ -#define AUTHIE (1 << 19) /* Authentication engine interupt enable */ -#define PCMIE (1 << 18) /* PCM interface interrupt enable */ -#define PDEIE (1 << 17) /* GPIO port D,E,F,G,H,I interrupt enable */ -#define PCIBTMOIE (1 << 16) /* PCI bridge time-out interrupt enable */ -#endif /*CONFIG_RTL865XB*/ -/* Global interrupt status register field definitions -*/ -#define TCIP (1 << 31) /* Timer/Counter interrupt pending */ -#define USBIP (1 << 30) /* USB host interrupt pending */ -#define PCMCIAIP (1 << 29) /* PCMCIA interrupt pending */ -#define UART1IP (1 << 28) /* UART 1 interrupt pending */ -#define UART0IP (1 << 27) /* UART 0 interrupt pending */ -#define PCIIP (1 << 26) /* PCI host interrupt pending */ -#define SWIP (1 << 25) /* Switch core interrupt pending */ -#define PABCIP (1 << 24) /* GPIO port ABC interrupt pending */ -#define IREQIP (1 << 23) /* External interrupt 0 pending */ -#define LBCTMOIP (1 << 21) /* LBC time-out interrupt pending */ -#ifdef CONFIG_RTL865XB -#define CRYPTOIP (1 << 20) /* Crypto engine interrupt pending */ -#define AUTHIP (1 << 19) /* Authentication engine interupt pending */ -#define PCMIP (1 << 18) /* PCM interface interrupt pending */ -#define PDEIP (1 << 17) /* GPIO port D,E,F,G,H,I interrupt pending */ -#define PCIBTMOIP (1 << 16) /* PCI bridge time-out interrupt pending */ -#endif /*CONFIG_RTL865XB*/ -#define LX0_BFRAME_IP (1 << 1) /* LBC 0 bus frame time-out interrupt pending flag */ -/* Interrupt routing register field definitions -*/ -#define TCIRS_OFFSET 30 /* Timer/Counter interrupt routing select offset */ -#define USBIRS_OFFSET 28 /* USB interrupt routing select offset */ -#define PCMCIAIRS_OFFSET 26 /* PCI interrupt routing select offset */ -#define UART1IRS_OFFSET 24 /* UART 1 interrupt routing select offset */ -#define UART0IRS_OFFSET 22 /* UART 0 interrupt routing select offset */ -#define PCIIRS_OFFSET 20 /* USB 1 interrupt routing select offset */ -#define SWIRS_OFFSET 18 /* Switch core interrupt routing select offset */ -#define PABCIRS_OFFSET 16 /* GPIO port B interrupt routing select offset */ -#define IREQ0RS_OFFSET 14 /* External interrupt 0 routing select offset */ -#define LBCTMOIRS_OFFSET 10 /* LBC time-out interrupt routing select offset */ -#ifdef CONFIG_RTL865XB -#define TCIRS_MSB_OFFSET 9 /* Timer/Counter interrupt routing select MSB offset */ -#define USBIRS_MSB_OFFSET 8 /* USB interrupt routing select MSB offset */ -#define PCMCIAIRS_MSB_OFFSET 7 /* PCI interrupt routing select MSB offset */ -#define UART1IRS_MSB_OFFSET 6 /* UART 1 interrupt routing select MSB offset */ -#define UART0IRS_MSB_OFFSET 5 /* UART 0 interrupt routing select MSB offset */ -#define PCIIRS_MSB_OFFSET 4 /* USB 1 interrupt routing select MSB offset */ -#define SWIRS_MSB_OFFSET 3 /* Switch core interrupt routing select MSB offset */ -#define PABCIRS_MSB_OFFSET 2 /* GPIO port B interrupt routing select MSB offset */ -#define IREQ0RS_MSB_OFFSET 1 /* External interrupt 0 routing select MSB offset */ -#define LBCTMOIRS_MSB_OFFSET 0 /* LBC time-out interrupt routing select MSB offset */ -#define CRYPTIRS_OFFSET 29 /* Crypto engine interrupt routing select offset */ -#define AUTHIRS_OFFSET 26 /* Authentication engine interrupt routing select offset */ -#define PCMIRS_OFFSET 23 /* PCM interface interrupt routing select offset */ -#define PDEIRS_OFFSET 20 /* GPIO port D,E,F,G,H,I interrupt routing select MSB offset */ -#define PCIBTMOIRS_OFFSET 17 /* PCI bridge time-out interrupt routing select MSB offset */ -#endif /*CONFIG_RTL865XB*/ - - - - - -/* Timer control registers -*/ -#define TIMER_BASE (SYSTEM_BASE+0x3100) /* 0xB8003100 */ -#define TC0DATA (0x000 + TIMER_BASE) /* Timer/Counter 0 data */ -#define TC1DATA (0x004 + TIMER_BASE) /* Timer/Counter 1 data */ -#define TC0CNT (0x008 + TIMER_BASE) /* Timer/Counter 0 count */ -#define TC1CNT (0x00C + TIMER_BASE) /* Timer/Counter 1 count */ -#define TCCNR (0x010 + TIMER_BASE) /* Timer/Counter control */ -#define TCIR (0x014 + TIMER_BASE) /* Timer/Counter intertupt */ -#define CDBR (0x018 + TIMER_BASE) /* Clock division base */ -#define WDTCNR (0x01C + TIMER_BASE) /* Watchdog timer control */ -/* Timer/Counter data register field definitions -*/ -#define TCD_OFFSET 8 -/* Timer/Counter control register field defintions -*/ -#define TC0EN (1 << 31) /* Timer/Counter 0 enable */ -#define TC0MODE_COUNTER 0 /* Timer/Counter 0 counter mode */ -#define TC0MODE_TIMER (1 << 30) /* Timer/Counter 0 timer mode */ -#define TC1EN (1 << 29) /* Timer/Counter 1 enable */ -#define TC1MODE_COUNTER 0 /* Timer/Counter 1 counter mode */ -#define TC1MODE_TIMER (1 << 28) /* Timer/Counter 1 timer mode */ -/* Timer/Counter interrupt register field definitions -*/ -#define TC0IE ((uint32)1 << 31) /* Timer/Counter 0 interrupt enable */ -#define TC1IE (1 << 30) /* Timer/Counter 1 interrupt enable */ -#define TC0IP (1 << 29) /* Timer/Counter 0 interrupt pending */ -#define TC1IP (1 << 28) /* Timer/Counter 1 interrupt pending */ -/* Clock division base register field definitions -*/ -#define DIVF_OFFSET 16 -/* Watchdog control register field definitions -*/ -#define WDTE_OFFSET 24 /* Watchdog enable */ -#define WDSTOP_PATTERN 0xA5 /* Watchdog stop pattern */ -#define WDTCLR (1 << 23) /* Watchdog timer clear */ -#define OVSEL_15 0 /* Overflow select count 2^15 */ -#define OVSEL_16 (1 << 21) /* Overflow select count 2^16 */ -#define OVSEL_17 (2 << 21) /* Overflow select count 2^17 */ -#define OVSEL_18 (3 << 21) /* Overflow select count 2^18 */ -#define WDTIND (1 << 20) /* Indicate whether watchdog ever occurs */ -/* RTC control register field definitions */ -#define WRITE_CDLW_OK (1 << 31) /* Write CDLW OK */ -#define RTCSEL (1 << 30) /* Fase mode */ -#define RTCEN (1 << 29) /* Enable */ - -/* System clock generation */ -#define SCCR (SYSTEM_BASE+0x3200) /* 0xB8003200 System Clock Control Register */ -#define DPLCR0 (SCCR+0x04) /* DPLL Clock Control Register 0 */ -#define DPLCR1 (SCCR+0x08) /* DPLL Clock Control Register 1 */ -#define PCCR (SCCR+0x0C) /* Peripheral Clock Control Register */ - -#define SCCR_CPU_OFFSET 4 /* SCCR CPU(Lexra Bus 0) status offset */ -#define SCCR_STATUS_MASK 0x07 /* SCCR LexaBus0/LexaBus1/Memory mask */ - -#define EN_S0DPLL (1 << 31) /* Enable S0DPLL Tuning */ -#define EN_S1DPLL (1 << 30) /* Enable S1DPLL Tuning */ -#define EN_MDPLL (1 << 31) /* Enable MDPLL Tuning */ -#define S0UPDPLL_MASK 0x3F /* S0_UP_DPLL mask*/ -#define MUPDPLL_MASK 0x3F /* M_UP_DPLL mask*/ -#define S0DOWNDPLL_MASK 0x1F /* S0_DOWN_DPLL mask*/ -#define MDOWNDPLL_MASK 0x1F /* M_DOWN_DPLL mask*/ -#define S0UPDPLL_OFFSET 16 /* S0_UP_DPLL status offset*/ -#define MUPDPLL_OFFSET 5 /* M_UP_DPLL status offset*/ -#define S0DOWNDPLL_OFFSET 11 /* S0_DOWN_DPLL status offset*/ -#define MDOWNDPLL_OFFSET 0 /* M_DOWN_DPLL status offset*/ - -#define S0DOWNDPLL_VALUE (9 << S0DOWNDPLL_OFFSET) /* S0_DOWN_DPLL default test value*/ -#define S0UPDPLL_VALUE_225MHZ (17 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 0*/ -#define S0UPDPLL_VALUE_250MHZ (19 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 1*/ -#define S0UPDPLL_VALUE_275MHZ (21 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 2*/ -#define S0UPDPLL_VALUE_300MHZ (23 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 3*/ -#define S0UPDPLL_VALUE_325MHZ (25 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 4*/ -#define S0UPDPLL_VALUE_350MHZ (27 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 5*/ -#define S0UPDPLL_VALUE_375MHZ (29 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 6*/ -#define S0UPDPLL_VALUE_400MHZ (31 << S0UPDPLL_OFFSET) /* S0_UP_DPLL test value 7*/ -#define S0UPDPLL_VALUE_NUM 8 /* S0_UP_DPLL total test values */ -#define S0UPDPLL_VALUE_DEFAULT S0UPDPLL_VALUE_275MHZ /* S0_UP_DPLL default test value */ - -#define MDOWNDPLL_VALUE (9 << MDOWNDPLL_OFFSET) /* M_DOWN_DPLL default test value*/ -#define MUPDPLL_VALUE_137MHZ (10 << MUPDPLL_OFFSET) /* M_UP_DPLL test value 0*/ -#define MUPDPLL_VALUE_150MHZ (11 << MUPDPLL_OFFSET) /* M_UP_DPLL test value 1*/ -#define MUPDPLL_VALUE_162MHZ (12 << MUPDPLL_OFFSET) /* M_UP_DPLL test value 2*/ -#define MUPDPLL_VALUE_175MHZ (13 << MUPDPLL_OFFSET) /* M_UP_DPLL test value 3*/ -#define MUPDPLL_VALUE_187MHZ (14 << MUPDPLL_OFFSET) /* M_UP_DPLL test value 4*/ -#define MUPDPLL_VALUE_NUM 5 /* M_UP_DPLL total test values */ -#define MUPDPLL_VALUE_DEFAULT MUPDPLL_VALUE_137MHZ /* M_UP_DPLL default test value */ - -#if defined(CONFIG_RTL_819X) -/*Shared Pin Register Set */ -#ifdef CONFIG_RTL_8196B - #define PIN_MUX_SEL (SYSTEM_BASE+0x30) /* 0xB8000030 - 0xB8000033 */ -#else - #define PIN_MUX_SEL 0xb8000040 -#endif - -/* Shared Pin Register field definitions */ -#define REG_IOCFG_POMII (3 << 0) /* P0-MII Shared Pin Control Bits */ -#define REG_IOCFG_PCIE (3 << 2) /* PCIE Shared Pin Control Bits */ -#define REG_IOCFG_UART (3 << 5) /* UART Shared Pin Control Bits */ -#define REG_IOCFG_JTAG (7 << 7) /* JTAG Shared Pin Control Bits */ -#define REG_IOCFG_LED_S0 (3 << 10) /* LEDSIG0 Shared Pin Control Bits */ -#define REG_IOCFG_LED_S1 (3 << 12) /* LEDSIG1 Shared Pin Control Bits */ -#define REG_IOCFG_LED_S2 (3 << 14) /* LEDSIG2 Shared Pin Control Bits */ -#define REG_IOCFG_LED_S3 (3 << 16) /* LEDSIG3 Shared Pin Control Bits */ -#define REG_IOCFG_LED_P0 (3 << 18) /* LEDPHASE0 Shared Pin Control Bits */ -#define REG_IOCFG_LED_P1 (3 << 20) /* LEDPHASE1 Shared Pin Control Bits */ -#define REG_IOCFG_LED_P2 (3 << 22) /* LEDPHASE2 Shared Pin Control Bits */ -#define REG_IOCFG_LED_P3 (3 << 24) /* LEDPHASE3 Shared Pin Control Bits */ -#define REG_IOCFG_LED_P4 (3 << 26) /* LEDPHASE4 Shared Pin Control Bits */ -#endif - -/* GPIO Register Set */ -#define GPIO_BASE (SYSTEM_BASE+0x3500) /* 0xB8003500 */ - -#define PABCD_CNR (GPIO_BASE + 0x00) -#define PABCD_PTYPE (GPIO_BASE + 0x04) -#define PABCD_DIR (GPIO_BASE + 0x08) -#define PABCD_DAT (GPIO_BASE + 0x0C) -#define PABCD_ISR (GPIO_BASE + 0x10) -#define PAB_IMR (GPIO_BASE + 0x14) -#define PCD_IMR (GPIO_BASE + 0x18) -#define PEFGH_CNR (GPIO_BASE + 0x1C) -#define PEFGH_PTYPE (GPIO_BASE + 0x20) -#define PEFGH_DIR (GPIO_BASE + 0x24) -#define PEFGH_DAT (GPIO_BASE + 0x28) -#define PEFGH_ISR (GPIO_BASE + 0x2C) -#define PEF_IMR (GPIO_BASE + 0x30) -#define PGH_IMR (GPIO_BASE + 0x34) - -#define PABCDCNR_REG (0x000 + GPIO_BASE) /* Port ABCD control */ -#define PABCDPTYPE_REG (0x004 + GPIO_BASE) /* Port ABCD type */ -#define PABCDDIR_REG (0x008 + GPIO_BASE) /* Port ABCD direction */ -#define PABCDDAT_REG (0x00C + GPIO_BASE) /* Port ABCD data */ -#define PABCDISR_REG (0x010 + GPIO_BASE) /* Port ABCD interrupt status */ -#define PABIMR_REG (0x014 + GPIO_BASE) /* Port AB interrupt mask */ -#define PCDIMR_REG (0x018 + GPIO_BASE) /* Port CD interrupt mask */ -#define PEFGHCNR_REG (0x01C + GPIO_BASE) /* Port ABCD control */ -#define PEFGHPTYPE_REG (0x020 + GPIO_BASE) /* Port ABCD type */ -#define PEFGHDIR_REG (0x024 + GPIO_BASE) /* Port ABCD direction */ -#define PEFGHDAT_REG (0x028 + GPIO_BASE) /* Port ABCD data */ -#define PEFGHISR_REG (0x02C + GPIO_BASE) /* Port ABCD interrupt status */ -#define PEFIMR_REG (0x030 + GPIO_BASE) /* Port AB interrupt mask */ -#define PGHIMR_REG (0x034 + GPIO_BASE) /* Port CD interrupt mask */ - -/*added by Mark*/ -/*PCI control regs*/ -#define PCI_CTRL_BASE (SYSTEM_BASE+0x3400) /* 0xB8003400 */ - -/* GPIO control registers -*/ -#define GPIO_BASE (SYSTEM_BASE+0x3500) /* 0xB8003500 */ -#define PABCNR (0x00C + GPIO_BASE) /* Port AB control */ -#define PABDIR (0x010 + GPIO_BASE) /* Port AB direction */ -#define PABDAT (0x014 + GPIO_BASE) /* Port AB data */ -#define PABISR (0x018 + GPIO_BASE) /* Port AB interrupt status */ -/* #define PABIMR (0x01C + GPIO_BASE) */ /* Port AB interrupt mask */ -/* #define PCIMR (0x050 + GPIO_BASE) */ /* Port C interrupt mask */ -/* Port ABC data register field definitions -*/ -#define PDA_OFFSET 24 /* Port A data offset */ -#define PDB_OFFSET 16 /* Port B data offset */ -#define PDC_OFFSET 8 /* Port C data offset */ -/* Port ABC interrupt status register field definitions -*/ -#define PAIP_OFFSET 24 /* Port A pending status offset */ -#define PBIP_OFFSET 16 /* Port B pending status offset */ -#define PCIP_OFFSET 8 /* Port C pending status offset */ - - - -/* Peripheral Lexra timing control registers -*/ -#define PLTC (0x064 + GICR_BASE) /* Peripheral Lexra timeout control */ -/* Peripheral Lexra timeout control register field definitions -*/ -#define TOEN (1 << 31) -#define TOLIMIT_2_7 (0 << 28) -#define TOLIMIT_2_8 (1 << 28) -#define TOLIMIT_2_9 (2 << 28) -#define TOLIMIT_2_10 (3 << 28) -#define TOLIMIT_2_11 (4 << 28) -#define TOLIMIT_2_12 (5 << 28) -#define TOLIMIT_2_13 (6 << 28) -#define TOLIMIT_2_14 (7 << 28) - -/* Memory Control Register registers -*/ -#define MCR_BASE (SYSTEM_BASE+0x1000) /* 0xB8001000 */ -#define MCR (0x000 + MCR_BASE) /* Memory configuration register */ -#define MTCR0 (0x004 + MCR_BASE) /* Memory timing configuration register */ -#define MTCR1 (0x008 + MCR_BASE) /* Memory timing configuration register */ -#define PFCR (0x010 + MCR_BASE) /* Pre-Fetch Control Register */ -#define MPMR (0x040 + MCR_BASE) - -#if defined(CONFIG_RTL_819X) -#define SDRDRAM_MASK (0x1<<31) -#define DCR (0x004 + MCR_BASE) /* DRAM control register */ -#define COLCNT_MASK (0x1c00000) -#define COLCNT_OFFSET 22 -#define ROWCNT_MASK (0x6000000) -#define ROWCNT_OFFSET 25 -#endif - -// MPMR 0xB8001040 Memory Power Management Register -#define PM_MODE_OFFSET 30 -#define PM_MODE_NORMAL (0 << PM_MODE_OFFSET) -#define PM_MODE_ENABLE_AUTOMATIC_POWER_DOWN (1 << PM_MODE_OFFSET) -#define PM_MODE_ENABLE_SELF_REFRESH (2 << PM_MODE_OFFSET) - -#define CRYPTO_BASE (SYSTEM_BASE+0xC000) /* 0xB801C000 */ -#define IPSSDAR (CRYPTO_BASE+0x00) /* IPSec Source Descriptor Starting Address Register */ -#define IPSDDAR (CRYPTO_BASE+0x04) /* IPSec Destination Descriptor Starting Address Register */ -#define IPSCSR (CRYPTO_BASE+0x08) /* IPSec Command/Status Register */ -#define IPSCTR (CRYPTO_BASE+0x0C) /* IPSec Control Register */ - -/* IPSec Command/Status Register */ -#define IPS_SDUEIP (1<<15) /* Source Descriptor Unavailable Error Interrupt Pending */ -#define IPS_SDLEIP (1<<14) /* Source Descriptor Length Error Interrupt Pending */ -#define IPS_DDUEIP (1<<13) /* Destination Descriptor Unavailable Error Interrupt Pending */ -#define IPS_DDOKIP (1<<12) /* Destination Descriptor OK Interrupt Pending */ -#define IPS_DABFIP (1<<11) /* Data Address Buffer Interrupt Pending */ -#define IPS_POLL (1<<1) /* Descriptor Polling. Set 1 to kick crypto engine to fetch source descriptor. */ -#define IPS_SRST (1<<0) /* Software reset, write 1 to reset */ - -/* IPSec Control Register */ -#define IPS_SDUEIE (1<<15) /* Source Descriptor Unavailable Error Interrupt Enable */ -#define IPS_SDLEIE (1<<14) /* Source Descriptor Length Error Interrupt Enable */ -#define IPS_DDUEIE (1<<13) /* Destination Descriptor Unavailable Error Interrupt Enable */ -#define IPS_DDOKIE (1<<12) /* Destination Descriptor OK Interrupt Enable */ -#define IPS_DABFIE (1<<11) /* Data Address Buffer Interrupt Enable */ -#define IPS_LBKM (1<<8) /* Loopback mode enable */ -#define IPS_SAWB (1<<7) /* Source Address Write Back */ -#define IPS_CKE (1<<6) /* Clock enable */ -#define IPS_DMBS_MASK (0x7<<3) /* Mask for Destination DMA Maximum Burst Size */ -#define IPS_DMBS_16 (0x0<<3) /* 16 Bytes */ -#define IPS_DMBS_32 (0x1<<3) /* 32 Bytes */ -#define IPS_DMBS_64 (0x2<<3) /* 64 Bytes */ -#define IPS_DMBS_128 (0x3<<3) /* 128 Bytes */ -#define IPS_SMBS_MASK (0x7<<0) /* Mask for SourceDMA Maximum Burst Size */ -#define IPS_SMBS_16 (0x0<<0) /* 16 Bytes */ -#define IPS_SMBS_32 (0x1<<0) /* 32 Bytes */ -#define IPS_SMBS_64 (0x2<<0) /* 64 Bytes */ -#define IPS_SMBS_128 (0x3<<0) /* 128 Bytes */ - - -/* PCM */ -#define PCM_BASE (SYSTEM_BASE+0x8000) /* 0xB8008000 */ -#define PCM_GCR (PCM_BASE+0x00) /* PCM Generic Control Register */ -#define PCM_SCR (PCM_BASE+0x04) /* PCM Specific Control Register */ -#define PCM_TSAR (PCM_BASE+0x08) /* PCM Time Slot Assignment Register */ -#define PCM_BSIZE (PCM_BASE+0x0C) /* PCM Buffer Size Register */ -#define PCM_CH0TXBSA (PCM_BASE+0x10) /* PCM Channel 0 Tx Buffer Starting Address */ -#define PCM_CH1TXBSA (PCM_BASE+0x14) /* PCM Channel 1 Tx Buffer Starting Address */ -#define PCM_CH2TXBSA (PCM_BASE+0x18) /* PCM Channel 2 Tx Buffer Starting Address */ -#define PCM_CH3TXBSA (PCM_BASE+0x1C) /* PCM Channel 3 Tx Buffer Starting Address */ -#define PCM_CH0RXBSA (PCM_BASE+0x20) /* PCM Channel 0 Rx Buffer Starting Address */ -#define PCM_CH1RXBSA (PCM_BASE+0x24) /* PCM Channel 1 Rx Buffer Starting Address */ -#define PCM_CH2RXBSA (PCM_BASE+0x28) /* PCM Channel 2 Rx Buffer Starting Address */ -#define PCM_CH3RXBSA (PCM_BASE+0x2C) /* PCM Channel 3 Rx Buffer Starting Address */ -#define PCM_IMR (PCM_BASE+0x30) /* PCM Interrupt Mask Register */ -#define PCM_ISR (PCM_BASE+0x34) /* PCM Interrupt Status Register */ - -#define PAGE1_PCM_OWN ( 1 << 1 ) -#define PAGE0_PCM_OWN ( 1 << 0 ) -#define PCM_PAGE0 0 -#define PCM_PAGE1 1 -#define PCM_CHANNEL0 0 -#define PCM_CHANNEL1 1 -#define PCM_CHANNEL2 2 -#define PCM_CHANNEL3 3 -#define PCM_LINEAR 0 -#define PCM_ALAW 1 -#define PCM_ULAW 2 - -/* PCM Generic Control Register -*/ -#define PCM_AE (1<<12) /* Interrupt Enable */ -#define PCM_CLKDIR (1<<11) /* 0:external source from codec, 1:internal PLL */ -#define PCM_EXDSE (1<<10) /* PCM interface A Extra Data Strobe Enable */ -#define PCM_FSINV (1<< 9) /* PCM interface frame synchronization polarity invert */ -#define PCM_ICC_OFFSET (0) /* PCM interface Channel Inter Change control */ -#define PCM_ICC_MASK (0xf<<PCM_ICC_OFFSET)/* PCM interface Channel Inter Change control */ - -/* PCM Specific Control Register -*/ -#define PCM_allCHILBE (1<<28) /* all channel internal loop back enable */ - -#define PCM_CH0CMPE (1<<27) /* Channel 0 compander enable */ -#define PCM_CH0uA (1<<26) /* Channel 0 u-law/A-law selection; 0:u-law, 1:A-law */ -#define PCM_CH0TE (1<<25) /* Channel 0 transmitter enable */ -#define PCM_CH0RE (1<<24) /* Channel 0 receiver enable */ - -#define PCM_CH1CMPE (1<<19) /* Channel 1 compander enable */ -#define PCM_CH1uA (1<<18) /* Channel 1 u-law/A-law selection; 0:u-law, 1:A-law */ -#define PCM_CH1TE (1<<17) /* Channel 1 transmitter enable */ -#define PCM_CH1RE (1<<16) /* Channel 1 receiver enable */ - -#define PCM_CH2CMPE (1<< 11) /* Channel 2 compander enable */ -#define PCM_CH2uA (1<< 10) /* Channel 2 u-law/A-law selection; 0:u-law, 1:A-law */ -#define PCM_CH2TE (1<< 9) /* Channel 2 transmitter enable */ -#define PCM_CH2RE (1<< 8) /* Channel 2 receiver enable */ - -#define PCM_CH3CMPE (1<< 3) /* Channel 3 compander enable */ -#define PCM_CH3uA (1<< 2) /* Channel 3 u-law/A-law selection; 0:u-law, 1:A-law */ -#define PCM_CH3TE (1<< 1) /* Channel 3 transmitter enable */ -#define PCM_CH3RE (1<< 0) /* Channel 3 receiver enable */ - -/* PCM Time Slot Assignment Register -*/ -#define PCM_CH0TSA_OFFSET (24) /* Channel 0 Time Slot Assignment */ -#define PCM_CH0TSA_MASK (0x1f<<PCM_CH0TSA_OFFSET) /* Channel 0 Time Slot Assignment */ -#define PCM_CH1TSA_OFFSET (16) /* Channel 1 Time Slot Assignment */ -#define PCM_CH1TSA_MASK (0x1f<<PCM_CH1TSA_OFFSET) /* Channel 1 Time Slot Assignment */ -#define PCM_CH2TSA_OFFSET ( 8) /* Channel 2 Time Slot Assignment */ -#define PCM_CH2TSA_MASK (0x1f<<PCM_CH2TSA_OFFSET) /* Channel 2 Time Slot Assignment */ -#define PCM_CH3TSA_OFFSET ( 0) /* Channel 3 Time Slot Assignment */ -#define PCM_CH3TSA_MASK (0x1f<<PCM_CH3TSA_OFFSET) /* Channel 3 Time Slot Assignment */ - -/* PCM Buffer Size Register -*/ -#define PCM_CH0BSIZE_OFFSET (24) /* Channel 0 Buffer Size 4(n+1) bytes */ -#define PCM_CH0BSIZE_MASK (0xff<<PCM_CH0BSIZE_OFFSET) /* Channel 0 Buffer Size 4(n+1) bytes */ -#define PCM_CH1BSIZE_OFFSET (16) /* Channel 1 Buffer Size 4(n+1) bytes */ -#define PCM_CH1BSIZE_MASK (0xff<<PCM_CH1BSIZE_OFFSET) /* Channel 1 Buffer Size 4(n+1) bytes */ -#define PCM_CH2BSIZE_OFFSET ( 8) /* Channel 2 Buffer Size 4(n+1) bytes */ -#define PCM_CH2BSIZE_MASK (0xff<<PCM_CH2BSIZE_OFFSET) /* Channel 2 Buffer Size 4(n+1) bytes */ -#define PCM_CH3BSIZE_OFFSET ( 0) /* Channel 3 Buffer Size 4(n+1) bytes */ -#define PCM_CH3BSIZE_MASK (0xff<<PCM_CH3BSIZE_OFFSET) /* Channel 3 Buffer Size 4(n+1) bytes */ - -/* PCM Channel 0 Tx Buffer Starting Address */ -/* PCM Channel 1 Tx Buffer Starting Address */ -/* PCM Channel 2 Tx Buffer Starting Address */ -/* PCM Channel 3 Tx Buffer Starting Address */ -/* PCM Channel 0 Rx Buffer Starting Address */ -/* PCM Channel 1 Rx Buffer Starting Address */ -/* PCM Channel 2 Rx Buffer Starting Address */ -/* PCM Channel 3 Rx Buffer Starting Address */ -#define PCM_TXBUFPTR_MASK (0xfffffffc) /* Physical Tx buffer starting address */ -#define PCM_P1OWN (0x00000002) /* Page 1 own bit; 1:PCM own, 0:CPU own */ -#define PCM_P0OWN (0x00000001) /* Page 0 own bit; 1:PCM own, 0:CPU own */ - -/* PCM Interrupt Mask Register -*/ -#define PCM_CH0P0OKIE (1<<15) /* Channel 0 page 0 OK Interrupt Enable */ -#define PCM_CH0P1OKIE (1<<14) /* Channel 0 page 1 OK Interrupt Enable */ -#define PCM_CH0TBUAIE (1<<13) /* Channel 0 Transmit Buffer Unavailable Interrupt Enable */ -#define PCM_CH0RBUAIE (1<<12) /* Channel 0 Receive Buffer Unavailable Interrupt Enable */ -#define PCM_CH1P0OKIE (1<<11) /* Channel 1 page 0 OK Interrupt Enable */ -#define PCM_CH1P1OKIE (1<<10) /* Channel 1 page 1 OK Interrupt Enable */ -#define PCM_CH1TBUAIE (1<< 9) /* Channel 1 Transmit Buffer Unavailable Interrupt Enable */ -#define PCM_CH1RBUAIE (1<< 8) /* Channel 1 Receive Buffer Unavailable Interrupt Enable */ -#define PCM_CH2P0OKIE (1<< 7) /* Channel 2 page 0 OK Interrupt Enable */ -#define PCM_CH2P1OKIE (1<< 6) /* Channel 2 page 1 OK Interrupt Enable */ -#define PCM_CH2TBUAIE (1<< 5) /* Channel 2 Transmit Buffer Unavailable Interrupt Enable */ -#define PCM_CH2RBUAIE (1<< 4) /* Channel 2 Receive Buffer Unavailable Interrupt Enable */ -#define PCM_CH3P0OKIE (1<< 3) /* Channel 3 page 0 OK Interrupt Enable */ -#define PCM_CH3P1OKIE (1<< 2) /* Channel 3 page 1 OK Interrupt Enable */ -#define PCM_CH3TBUAIE (1<< 1) /* Channel 3 Transmit Buffer Unavailable Interrupt Enable */ -#define PCM_CH3RBUAIE (1<< 0) /* Channel 3 Receive Buffer Unavailable Interrupt Enable */ - -/* PCM Interrupt Status Register -*/ -#define PCM_CH0TXP0IP (1<<31) /* Channel 0 Tx Page 0 Interrupt Pending */ -#define PCM_CH0TXP1IP (1<<30) /* Channel 0 Tx Page 1 Interrupt Pending */ -#define PCM_CH0RXP0IP (1<<29) /* Channel 0 Rx Page 0 Interrupt Pending */ -#define PCM_CH0RXP1IP (1<<28) /* Channel 0 Rx Page 1 Interrupt Pending */ -#define PCM_CH0TXP0UA (1<<27) /* Channel 0 Tx Page 0 Unavailable Interrupt Pending */ -#define PCM_CH0TXP1UA (1<<26) /* Channel 0 Tx Page 1 Unavailable Interrupt Pending */ -#define PCM_CH0RXP0UA (1<<25) /* Channel 0 Rx Page 0 Unavailable Interrupt Pending */ -#define PCM_CH0RXP1UA (1<<24) /* Channel 0 Rx Page 1 Unavailable Interrupt Pending */ -#define PCM_CH1TXP0IP (1<<23) /* Channel 1 Tx Page 0 Interrupt Pending */ -#define PCM_CH1TXP1IP (1<<22) /* Channel 1 Tx Page 1 Interrupt Pending */ -#define PCM_CH1RXP0IP (1<<21) /* Channel 1 Rx Page 0 Interrupt Pending */ -#define PCM_CH1RXP1IP (1<<20) /* Channel 1 Rx Page 1 Interrupt Pending */ -#define PCM_CH1TXP0UA (1<<19) /* Channel 1 Tx Page 0 Unavailable Interrupt Pending */ -#define PCM_CH1TXP1UA (1<<18) /* Channel 1 Tx Page 1 Unavailable Interrupt Pending */ -#define PCM_CH1RXP0UA (1<<17) /* Channel 1 Rx Page 0 Unavailable Interrupt Pending */ -#define PCM_CH1RXP1UA (1<<16) /* Channel 1 Rx Page 1 Unavailable Interrupt Pending */ -#define PCM_CH2TXP0IP (1<<15) /* Channel 2 Tx Page 0 Interrupt Pending */ -#define PCM_CH2TXP1IP (1<<14) /* Channel 2 Tx Page 1 Interrupt Pending */ -#define PCM_CH2RXP0IP (1<<13) /* Channel 2 Rx Page 0 Interrupt Pending */ -#define PCM_CH2RXP1IP (1<<12) /* Channel 2 Rx Page 1 Interrupt Pending */ -#define PCM_CH2TXP0UA (1<<11) /* Channel 2 Tx Page 0 Unavailable Interrupt Pending */ -#define PCM_CH2TXP1UA (1<<10) /* Channel 2 Tx Page 1 Unavailable Interrupt Pending */ -#define PCM_CH2RXP0UA (1<< 9) /* Channel 2 Rx Page 0 Unavailable Interrupt Pending */ -#define PCM_CH2RXP1UA (1<< 8) /* Channel 2 Rx Page 1 Unavailable Interrupt Pending */ -#define PCM_CH3TXP0IP (1<< 7) /* Channel 3 Tx Page 0 Interrupt Pending */ -#define PCM_CH3TXP1IP (1<< 6) /* Channel 3 Tx Page 1 Interrupt Pending */ -#define PCM_CH3RXP0IP (1<< 5) /* Channel 3 Rx Page 0 Interrupt Pending */ -#define PCM_CH3RXP1IP (1<< 4) /* Channel 3 Rx Page 1 Interrupt Pending */ -#define PCM_CH3TXP0UA (1<< 3) /* Channel 3 Tx Page 0 Unavailable Interrupt Pending */ -#define PCM_CH3TXP1UA (1<< 2) /* Channel 3 Tx Page 1 Unavailable Interrupt Pending */ -#define PCM_CH3RXP0UA (1<< 1) /* Channel 3 Rx Page 0 Unavailable Interrupt Pending */ -#define PCM_CH3RXP1UA (1<< 0) /* Channel 3 Rx Page 1 Unavailable Interrupt Pending */ - - -/* Generic DMA */ -#define GDMA_BASE (SYSTEM_BASE+0xA000) /* 0xB800A000 */ -#define GDMACNR (GDMA_BASE+0x00) /* Generic DMA Control Register */ -#define GDMAIMR (GDMA_BASE+0x04) /* Generic DMA Interrupt Mask Register */ -#define GDMAISR (GDMA_BASE+0x08) /* Generic DMA Interrupt Status Register */ -#define GDMAICVL (GDMA_BASE+0x0C) /* Generic DMA Initial Checksum Value (Left Part) Register */ -#define GDMAICVR (GDMA_BASE+0x10) /* Generic DMA Initial Checksum Value (Right Part) Register */ -#define GDMASBP0 (GDMA_BASE+0x20) /* Generic DMA Source Block Pointer 0 Register */ -#define GDMASBL0 (GDMA_BASE+0x24) /* Generic DMA Source Block Length 0 Register */ -#define GDMASBP1 (GDMA_BASE+0x28) /* Generic DMA Source Block Pointer 1 Register */ -#define GDMASBL1 (GDMA_BASE+0x2C) /* Generic DMA Source Block Length 1 Register */ -#define GDMASBP2 (GDMA_BASE+0x30) /* Generic DMA Source Block Pointer 2 Register */ -#define GDMASBL2 (GDMA_BASE+0x34) /* Generic DMA Source Block Length 2 Register */ -#define GDMASBP3 (GDMA_BASE+0x38) /* Generic DMA Source Block Pointer 3 Register */ -#define GDMASBL3 (GDMA_BASE+0x3C) /* Generic DMA Source Block Length 3 Register */ -#define GDMASBP4 (GDMA_BASE+0x40) /* Generic DMA Source Block Pointer 4 Register */ -#define GDMASBL4 (GDMA_BASE+0x44) /* Generic DMA Source Block Length 4 Register */ -#define GDMASBP5 (GDMA_BASE+0x48) /* Generic DMA Source Block Pointer 5 Register */ -#define GDMASBL5 (GDMA_BASE+0x4C) /* Generic DMA Source Block Length 5 Register */ -#define GDMASBP6 (GDMA_BASE+0x50) /* Generic DMA Source Block Pointer 6 Register */ -#define GDMASBL6 (GDMA_BASE+0x54) /* Generic DMA Source Block Length 6 Register */ -#define GDMASBP7 (GDMA_BASE+0x58) /* Generic DMA Source Block Pointer 7 Register */ -#define GDMASBL7 (GDMA_BASE+0x5C) /* Generic DMA Source Block Length 7 Register */ -#define GDMADBP0 (GDMA_BASE+0x60) /* Generic DMA Destination Block Pointer 0 Register */ -#define GDMADBL0 (GDMA_BASE+0x64) /* Generic DMA Destination Block Length 0 Register */ -#define GDMADBP1 (GDMA_BASE+0x68) /* Generic DMA Destination Block Pointer 1 Register */ -#define GDMADBL1 (GDMA_BASE+0x6C) /* Generic DMA Destination Block Length 1 Register */ -#define GDMADBP2 (GDMA_BASE+0x70) /* Generic DMA Destination Block Pointer 2 Register */ -#define GDMADBL2 (GDMA_BASE+0x74) /* Generic DMA Destination Block Length 2 Register */ -#define GDMADBP3 (GDMA_BASE+0x78) /* Generic DMA Destination Block Pointer 3 Register */ -#define GDMADBL3 (GDMA_BASE+0x7C) /* Generic DMA Destination Block Length 3 Register */ -#define GDMADBP4 (GDMA_BASE+0x80) /* Generic DMA Destination Block Pointer 4 Register */ -#define GDMADBL4 (GDMA_BASE+0x84) /* Generic DMA Destination Block Length 4 Register */ -#define GDMADBP5 (GDMA_BASE+0x88) /* Generic DMA Destination Block Pointer 5 Register */ -#define GDMADBL5 (GDMA_BASE+0x8C) /* Generic DMA Destination Block Length 5 Register */ -#define GDMADBP6 (GDMA_BASE+0x90) /* Generic DMA Destination Block Pointer 6 Register */ -#define GDMADBL6 (GDMA_BASE+0x94) /* Generic DMA Destination Block Length 6 Register */ -#define GDMADBP7 (GDMA_BASE+0x98) /* Generic DMA Destination Block Pointer 7 Register */ -#define GDMADBL7 (GDMA_BASE+0x9C) /* Generic DMA Destination Block Length 7 Register */ - -/* Generic DMA Control Register */ -#define GDMA_ENABLE (1<<31) /* Enable GDMA */ -#define GDMA_POLL (1<<30) /* Kick off GDMA */ -#define GDMA_FUNCMASK (0xf<<24) /* GDMA Function Mask */ -#define GDMA_MEMCPY (0x0<<24) /* Memory Copy */ -#define GDMA_CHKOFF (0x1<<24) /* Checksum Offload */ -#define GDMA_STCAM (0x2<<24) /* Sequential T-CAM */ -#define GDMA_MEMSET (0x3<<24) /* Memory Set */ -#define GDMA_B64ENC (0x4<<24) /* Base 64 Encode */ -#define GDMA_B64DEC (0x5<<24) /* Base 64 Decode */ -#define GDMA_QPENC (0x6<<24) /* Quoted Printable Encode */ -#define GDMA_QPDEC (0x7<<24) /* Quoted Printable Decode */ -#define GDMA_MIC (0x8<<24) /* Wireless MIC */ -#define GDMA_MEMXOR (0x9<<24) /* Memory XOR */ -#define GDMA_MEMCMP (0xa<<24) /* Memory Compare */ -#define GDMA_BYTESWAP (0xb<<24) /* Byte Swap */ -#define GDMA_PATTERN (0xc<<24) /* Pattern Match */ -#define GDMA_SWAPTYPE0 (0<<22) /* Original:{0,1,2,3} => {1,0,3,2} */ -#define GDMA_SWAPTYPE1 (1<<22) /* Original:{0,1,2,3} => {3,2,1,0} */ -#define GDMA_ENTSIZMASK (3<<20) /* T-CAM Entry Size Mask */ -#define GDMA_ENTSIZ32 (0<<20) /* T-CAM Entry Size 32 bits */ -#define GDMA_ENTSIZ64 (1<<20) /* T-CAM Entry Size 64 bits */ -#define GDMA_ENTSIZ128 (2<<20) /* T-CAM Entry Size 128 bits */ -#define GDMA_ENTSIZ256 (3<<20) /* T-CAM Entry Size 256 bits */ - -/* Generic DMA Interrupt Mask Register */ -#define GDMA_COMPIE (1<<31) /* Completed Interrupt Enable */ -#if 0 /* phase out */ -#define GDMA_SBUDRIE (1<<30) /* Source Block Under-run Interrupt Enable */ -#define GDMA_DBUDRIE (1<<29) /* destination Block Under-run Interrupt Enable */ -#endif -#define GDMA_NEEDCPUIE (1<<28) /* Need-CPU Interrupt Enable */ - -/* Generic DMA Interrupt Status Register */ -#define GDMA_COMPIP (1<<31) /* Completed Interrupt Status (write 1 to clear) */ -#if 0 /* phase out */ -#define GDMA_SBUDRIP (1<<30) /* Source Block Under-run Interrupt Status (write 1 to clear) */ -#define GDMA_DBUDRIP (1<<29) /* destination Block Under-run Interrupt Status (write 1 to clear) */ -#endif -#define GDMA_NEEDCPUIP (1<<28) /* Need-CPU Interrupt Status (write 1 to clear) */ - -/* Generic DMA Source Block Length n. Register */ -#define GDMA_LDB (1<<31) /* Last Data Block */ -#define GDMA_BLKLENMASK (0x1fff) /* Block Length (valid value: from 1 to 8K-1 bytes) */ - -#if defined(CONFIG_RTL8186_KB) -void rtl865x_startBooting_ledControl(void); -void rtl865x_wireCompSolidBlue(void); -void rtl865x_wireCompBlinkAmber(void); -#endif - -//hyking:define for 8196C FIB test chip -#if defined(CONFIG_RTL_8196C) -#define RTL8196C_EEE_MAC -#endif - -#define GIGA_P5_PHYID 0x16 -#define BSP_REVR 0xB8000000 -#define BSP_RTL8198_REVISION_A 0xC0000000 -#define BSP_RTL8198_REVISION_B 0xC0000001 -#define SYS_CLK_MAG 0xb8000010 -#define SYS_SW_RESET 0x800 -#endif /* _ASICREGS_H */ - diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_glue.h b/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_glue.h index 97bab5a27..67a6273d4 100644 --- a/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_glue.h +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_glue.h @@ -7,161 +7,8 @@ * Abstract :Header of porting layer * Author : Edward Jin-Ru Chen * -* $Id: rtl_glue.h,v 1.1 2007-12-07 05:52:23 alva_zhang Exp $ -* $Log: not supported by cvs2svn $ -* Revision 1.1.1.1 2007/08/06 10:04:57 root -* Initial import source to CVS -* -* Revision 1.34 2007/06/07 05:35:30 chenyl -* +: add new function "rtlglue_clearDCache" to clear D-cache without -* writing back to external memory. ( Only for Processor with this function ) -* -* Revision 1.33 2007/06/01 09:20:52 michaelhuang -* -: removed the rtl867x compiler flag. -* -* Revision 1.32 2007/04/09 14:14:01 michaelhuang -* +: added rtlglue_read() function -* -* Revision 1.31 2007/03/02 13:31:59 chenyl -* *: enable range based D-cache flush function. -* -* Revision 1.30 2007/01/09 02:36:08 michaelhuang -* *: Prepare implement test module for RTL8672 -* -* Revision 1.29 2006/12/21 06:57:00 yjlou -* -: remove the following usages: -* printk -* printfByPolling -* -* Revision 1.28 2006/11/28 02:15:14 hyking_liu -* *: Mofify function related with usrDefineTunnel -* -* Revision 1.27 2006/11/21 12:28:35 chenyl -* *: rearrange some code -* *: bug fix - Src VLAN decision -* *: bug fix - D-cache invalidation for FAST extension device forwarding -* *: bug fix - m_unused1 and ph_reserved are needed for FAST extension device forwarding -* -* Revision 1.26 2006/10/26 02:15:32 qy_wang -* *:remove the inculed file net_device.h in rtl8651_layer2fwd.c -* -* Revision 1.25 2006/10/25 07:10:15 qy_wang -* +:add a function to block extension device when link up -* -* Revision 1.24 2006/08/31 15:44:48 chenyl -* *: add some declarations of external APIs -* -* Revision 1.23 2006/07/13 15:55:49 chenyl -* *: modify code for RTL865XC driver compilation. -* *: dos2unix process -* -* Revision 1.22 2006/06/20 05:53:22 brian_bin -* +: brian_bin move open, write, close declaration into __RTL_GLUE__ define brace -* -* Revision 1.21 2006/01/12 08:32:37 brian_bin -* +: brian_bin add kernel system call of file operations -* -* Revision 1.20 2006/01/02 02:52:14 chenyl -* +: VLAN-tag support extension port forwarding and software Rome Driver forwarding. -* -* Revision 1.19 2005/09/16 11:34:48 tony -* *: bug fixed: support kernel space swNic model code for RTL865XC. -* -* Revision 1.18 2005/09/06 02:36:38 yjlou -* +: add random and time glue functions. -* -* Revision 1.17 2005/07/20 15:29:38 yjlou -* +: porting Model Code to Linux Kernel: check RTL865X_MODEL_KERNEL. -* -* Revision 1.16 2005/07/01 09:34:41 yjlou -* *: porting swNic2.c into model code. -* -* Revision 1.15 2005/06/19 05:41:19 yjlou -* *: merge ASIC driver into model code. -* -* Revision 1.14 2005/06/07 15:00:57 chenyl -* *: modify mutex Lock / Unlock code to check the balance of Lock/Unlock function call -* -* Revision 1.13 2004/11/29 07:35:44 chenyl -* *: fix bug : multiple-PPPoE MTU setting bug -* *: fix bug : Never add second session's ip into ASIC in multiple-PPPoE WAN type. -* *: fix bug : Tunekey abnormal behavior when multiple-PPPoE Dial-on-demand Dynamically turn ON/OFF -* *: in forwarding engine Init function, the parameter == 0xffffffff means user want to set as default value -* *: add Mutex-Lock/Unlock checking in testing code -* -* Revision 1.12 2004/11/05 09:54:08 yjlou -* +: support more precise timeUpdate() function. -* +: add EVENT_TRIGGER_TIMEUPDATE==2 -* *: modify #ifdef EVENT_TRIGGER_TIMEUPDATE -* -* Revision 1.11 2004/07/27 10:47:08 cfliu -* -: Remove RTL865x external loopback port related code for PPTP/L2TP/WLAN -* -* Revision 1.10 2004/06/23 08:11:55 yjlou -* *: change the declaration of rtlglue_getmstime() -* -* Revision 1.9 2004/05/03 14:56:18 cfliu -* Add 8650B extension port support. -* Revise all WLAN/extport related code. -* -* Revision 1.8 2004/05/03 02:53:03 chenyl -* *: swNic_getRingSize -> rtlglue_getRingSize and move it from swNic2.c to rtl_glue.c -* *: set default upstream ip to 0 if we config interface to dhcp -* -* Revision 1.7 2004/04/30 08:58:08 chenyl -* +: ip multicast/igmp proxy -* -* Revision 1.6 2004/04/08 12:11:20 cfliu -* Change extension port API.....define rtlglue_extDeviceSend() -* -* Revision 1.5 2004/03/31 09:37:01 cfliu -* Add WDS support -* -* Revision 1.4 2004/03/19 13:13:35 cfliu -* Reorganize ROME driver local header files. Put all private data structures into different .h file corrsponding to its layering -* Rename printf, printk, malloc, free with rtlglue_XXX prefix -* -* Revision 1.1 2004/03/10 11:42:36 cfliu -* Move rtl_glue.* from rtl865x/ -* -* Revision 1.2 2004/03/03 10:40:38 yjlou -* *: commit for mergence the difference in rtl86xx_tbl/ since 2004/02/26. -* -* Revision 1.1 2004/02/25 14:26:33 chhuang -* *** empty log message *** -* -* Revision 1.2 2004/02/25 14:24:52 chhuang -* *** empty log message *** -* -* Revision 1.7 2004/02/24 04:15:43 cfliu -* add API for WLAN acceleration -* -* Revision 1.6 2004/02/18 13:54:37 chhuang -* *** empty log message *** -* -* Revision 1.5 2003/12/26 09:27:50 orlando -* add rtl_glue.h -* -* Revision 1.3 2003/09/30 06:07:50 orlando -* check in RTL8651BLDRV_V20_20030930 -* -* Revision 1.4 2003/06/10 05:33:30 cfliu -* Remove rtl8651_tblDrvFwdSend registration. -* Add rtlglue_drvSend to replace rtl8651_tblDrvFwdSend function pointer -* -* Revision 1.3 2003/06/09 04:48:43 cfliu -* add 3 OS dependent glue functions to support mbuf external cluster allocation. -* Rewrite all help messages using Autoduck's syntax so documentation could generated automatically. -* -* Revision 1.2 2003/05/23 07:47:06 cfliu -* Extract porting function and fix compile warning. -* -* Revision 1.1 2003/05/23 04:55:25 jzchen -* Add rtl glue to solve porting issue -* */ - #include "rtl_types.h" #if defined(CONFIG_RTL865X) //#include "mbuf.h" diff --git a/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_types.h b/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_types.h index f94206f70..b73767617 100644 --- a/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_types.h +++ b/target/linux/realtek/files/include/asm-mips/rtl865x/rtl_types.h @@ -10,192 +10,6 @@ * Revision 1.1.1.1 2007/08/06 10:04:57 root * Initial import source to CVS * -* Revision 1.21 2007/05/15 03:36:56 michaelhuang -* *: fixed compatibility for Linux Kernel 2.6 -* -* Revision 1.20 2007/04/04 15:48:54 chenyl -* +: cleshell commend for asic register configuration : mmtu ( multicast mtu ) -* -* Revision 1.19 2006/08/29 13:00:00 chenyl -* *: New SWNIC driver for RTL865xC -* *: some rearrange in re_core.c for Bootstrap sequence being more readable. -* -* Revision 1.18 2006/02/27 07:47:06 ympan -* +: No change by ympan -* -* Revision 1.17 2005/09/27 05:59:44 chenyl -* *: modify IRAM / DRAM layout: -* IRAM/DRAM-FWD : external used, swNic ... blahblah -* IRAM/DRAM-L2-FWD : fwdengine internal used, L2 and below (ex. preprocess, postprocess) -* IRAM/DRAM-L34-FWD : fwdengine internal used, L3/L4 process only (ex. Routing, decision table...etc). -* -* => If L34 is used, we strongly suggest L2 must be used, too. -* -* Revision 1.16 2005/08/23 14:38:26 chenyl -* +: apply prioirty IRAM/DRAM usage -* -* Revision 1.15 2005/08/22 07:33:55 chenyl -* *: don't set DRAM/IRAM for other OSs yet. -* -* Revision 1.14 2005/08/18 09:14:08 chenyl -* *: add code to porting to other OSs -* -* Revision 1.13 2005/08/18 06:29:29 chenyl -* +: always define the rtlglue_printf in rtl_types.h -* -* Revision 1.12 2005/07/01 09:34:41 yjlou -* *: porting swNic2.c into model code. -* -* Revision 1.11 2005/06/19 05:29:37 yjlou -* *: use 'unsigned int' to replace 'size_t' -* *: define spinlock_t when RTL865X_MODEL_USER defined. -* -* Revision 1.10 2005/06/10 05:32:22 yjlou -* +: Porting CLE Shell to Linux user space for model test. -* See RTL865X_MODEL_USER compile flags. -* -* Revision 1.9 2005/01/10 03:21:43 yjlou -* *: always define __IRAM and __DRAM -* -* Revision 1.8 2004/07/23 13:42:45 tony -* *: remove all warning messages -* -* Revision 1.7 2004/07/05 08:25:32 chenyl -* +: define __IRAM, __DRAM for module test -* -* Revision 1.6 2004/07/04 15:04:55 cfliu -* +: add IRAM and DRAM -* -* Revision 1.5 2004/04/20 03:44:03 tony -* if disable define "RTL865X_OVER_KERNEL" and "RTL865X_OVER_LINUX", __KERNEL__ and __linux__ will be undefined. -* -* Revision 1.4 2004/03/19 13:13:35 cfliu -* Reorganize ROME driver local header files. Put all private data structures into different .h file corrsponding to its layering -* Rename printf, printk, malloc, free with rtlglue_XXX prefix -* -* Revision 1.3 2004/03/05 07:44:27 cfliu -* fix header file problem for ctype.h -* -* Revision 1.2 2004/03/03 10:40:38 yjlou -* *: commit for mergence the difference in rtl86xx_tbl/ since 2004/02/26. -* -* Revision 1.1 2004/02/25 14:26:33 chhuang -* *** empty log message *** -* -* Revision 1.3 2004/02/25 14:24:52 chhuang -* *** empty log message *** -* -* Revision 1.8 2003/12/10 06:30:12 tony -* add linux/config.h, disable define CONFIG_RTL865X_NICDRV2 in mbuf.c by default -* -* Revision 1.7 2003/12/03 14:25:43 cfliu -* change SIZE_T to _SIZE_T. Linux kernel seems to recognize _SIZE_T -* -* Revision 1.6 2003/10/01 12:29:02 tony -* #define DEBUG_P(args...) while(0); -* -* Revision 1.5 2003/10/01 10:31:47 tony -* solve all the compiler warnning messages in the board.c -* -* Revision 1.4 2003/09/30 06:07:50 orlando -* check in RTL8651BLDRV_V20_20030930 -* -* Revision 1.30 2003/07/21 06:27:49 cfliu -* no message -* -* Revision 1.29 2003/04/30 15:32:30 cfliu -* move macros to types.h -* -* Revision 1.28 2003/03/13 10:29:22 cfliu -* Remove unused symbols -* -* Revision 1.27 2003/03/06 05:00:04 cfliu -* Move '#pragma ghs inlineprologue' to rtl_depend.h since it is compiler dependent -* -* Revision 1.26 2003/03/06 03:41:46 danwu -* Prevent compiler from generating internal sub-routine call code at the -* function prologue and epilogue automatically -* -* Revision 1.25 2003/03/03 09:16:35 hiwu -* remove ip4a -* -* Revision 1.24 2003/02/18 10:04:06 jzchen -* Add ether_addr_t to compatable with protocol stack's ether_addr -* -* Revision 1.23 2003/01/21 05:59:51 cfliu -* add min, max, SETBITS, CLEARBITS, etc. -* -* Revision 1.22 2002/11/25 07:31:30 cfliu -* Remove _POSIX_SOURCE since it is cygwin specific -* -* Revision 1.21 2002/09/30 11:51:49 jzchen -* Add ASSERT_ISR for not print inside ISR -* -* Revision 1.20 2002/09/18 01:43:24 jzchen -* Add type limit definition -* -* Revision 1.19 2002/09/16 00:14:34 elvis -* remove struct posix_handle_t (change the handle type from -* structure to uint32) -* -* Revision 1.18 2002/08/20 01:40:40 danwu -* Add definitions of ipaddr_t & macaddr_t. -* -* Revision 1.17 2002/07/30 04:36:30 danwu -* Add ASSERT_CSP. -* -* Revision 1.16 2002/07/19 06:47:30 cfliu -* Add _POSIX_SOURCE symbol -* -* Revision 1.15 2002/07/05 02:10:39 elvis -* Add new types for OSK -* -* Revision 1.14 2002/07/03 12:36:21 orlando -* <rtl_depend.h> will use type definitions. Has to be moved to -* be after the type declaration lines. -* -* Revision 1.13 2002/07/03 09:19:00 cfliu -* Removed all standard header files from source code. They would be included by <core/types.h>-><rtl_depend.h> -* -* Revision 1.12 2002/07/03 09:16:48 cfliu -* Removed all standard header files from source code. They would be included by <core/types.h>-><rtl_depend.h> -* -* Revision 1.11 2002/07/03 07:14:47 orlando -* Add "struct posix_handle_t_", used by POSIX module. -* -* Revision 1.9 2002/06/21 03:15:36 cfliu -* Add time.h for struct timeval -* -* Revision 1.8 2002/06/14 01:58:03 cfliu -* Move sa_family_t to socket -* -* Revision 1.7 2002/06/13 09:37:42 cfliu -* Move byte order conversion routines to socket -* -* Revision 1.6 2002/05/23 04:24:37 hiwu -* change memaddr_t to calladdr_t -* -* Revision 1.5 2002/05/13 10:15:16 hiwu -* add new type definition -* -* Revision 1.4 2002/05/09 05:21:51 cfliu -* Add parenthesis around swaps16, swapl32 -* -* Revision 1.3 2002/04/30 03:07:34 orlando -* Remove UIxx_T definitions to conform with new -* naming conventions. -* -* Revision 1.2 2002/04/29 10:10:32 hiwu -* add NTOHS macro -* -* Revision 1.1.1.1 2002/04/26 08:53:53 orlando -* Initial source tree creation. -* -* Revision 1.9 2002/04/25 03:59:05 cfliu -* no message -* -* Revision 1.8 2002/04/08 08:08:04 hiwu -* initial version * */ diff --git a/target/linux/realtek/files/include/asm-rlx/asm-offsets.h b/target/linux/realtek/files/include/asm-rlx/asm-offsets.h new file mode 100644 index 000000000..6623b7d2c --- /dev/null +++ b/target/linux/realtek/files/include/asm-rlx/asm-offsets.h @@ -0,0 +1,165 @@ +#ifndef __ASM_OFFSETS_H__ +#define __ASM_OFFSETS_H__ +/* + * DO NOT MODIFY. + * + * This file was generated by Kbuild + * + */ + +/* MIPS pt_regs offsets. */ +#define PT_R0 24 /* offsetof(struct pt_regs, regs[0]) # */ +#define PT_R1 28 /* offsetof(struct pt_regs, regs[1]) # */ +#define PT_R2 32 /* offsetof(struct pt_regs, regs[2]) # */ +#define PT_R3 36 /* offsetof(struct pt_regs, regs[3]) # */ +#define PT_R4 40 /* offsetof(struct pt_regs, regs[4]) # */ +#define PT_R5 44 /* offsetof(struct pt_regs, regs[5]) # */ +#define PT_R6 48 /* offsetof(struct pt_regs, regs[6]) # */ +#define PT_R7 52 /* offsetof(struct pt_regs, regs[7]) # */ +#define PT_R8 56 /* offsetof(struct pt_regs, regs[8]) # */ +#define PT_R9 60 /* offsetof(struct pt_regs, regs[9]) # */ +#define PT_R10 64 /* offsetof(struct pt_regs, regs[10]) # */ +#define PT_R11 68 /* offsetof(struct pt_regs, regs[11]) # */ +#define PT_R12 72 /* offsetof(struct pt_regs, regs[12]) # */ +#define PT_R13 76 /* offsetof(struct pt_regs, regs[13]) # */ +#define PT_R14 80 /* offsetof(struct pt_regs, regs[14]) # */ +#define PT_R15 84 /* offsetof(struct pt_regs, regs[15]) # */ +#define PT_R16 88 /* offsetof(struct pt_regs, regs[16]) # */ +#define PT_R17 92 /* offsetof(struct pt_regs, regs[17]) # */ +#define PT_R18 96 /* offsetof(struct pt_regs, regs[18]) # */ +#define PT_R19 100 /* offsetof(struct pt_regs, regs[19]) # */ +#define PT_R20 104 /* offsetof(struct pt_regs, regs[20]) # */ +#define PT_R21 108 /* offsetof(struct pt_regs, regs[21]) # */ +#define PT_R22 112 /* offsetof(struct pt_regs, regs[22]) # */ +#define PT_R23 116 /* offsetof(struct pt_regs, regs[23]) # */ +#define PT_R24 120 /* offsetof(struct pt_regs, regs[24]) # */ +#define PT_R25 124 /* offsetof(struct pt_regs, regs[25]) # */ +#define PT_R26 128 /* offsetof(struct pt_regs, regs[26]) # */ +#define PT_R27 132 /* offsetof(struct pt_regs, regs[27]) # */ +#define PT_R28 136 /* offsetof(struct pt_regs, regs[28]) # */ +#define PT_R29 140 /* offsetof(struct pt_regs, regs[29]) # */ +#define PT_R30 144 /* offsetof(struct pt_regs, regs[30]) # */ +#define PT_R31 148 /* offsetof(struct pt_regs, regs[31]) # */ +#define PT_HI 152 /* offsetof(struct pt_regs, hi) # */ +#define PT_LO 156 /* offsetof(struct pt_regs, lo) # */ +#define PT_EPC 160 /* offsetof(struct pt_regs, cp0_epc) # */ +#define PT_BVADDR 164 /* offsetof(struct pt_regs, cp0_badvaddr) # */ +#define PT_STATUS 168 /* offsetof(struct pt_regs, cp0_status) # */ +#define PT_CAUSE 172 /* offsetof(struct pt_regs, cp0_cause) # */ +#define PT_SIZE 176 /* sizeof(struct pt_regs) # */ + +/* MIPS task_struct offsets. */ +#define TASK_STATE 0 /* offsetof(struct task_struct, state) # */ +#define TASK_THREAD_INFO 4 /* offsetof(struct task_struct, stack) # */ +#define TASK_FLAGS 12 /* offsetof(struct task_struct, flags) # */ +#define TASK_MM 216 /* offsetof(struct task_struct, mm) # */ +#define TASK_PID 252 /* offsetof(struct task_struct, pid) # */ +#define TASK_STRUCT_SIZE 784 /* sizeof(struct task_struct) # */ + +/* MIPS thread_info offsets. */ +#define TI_TASK 0 /* offsetof(struct thread_info, task) # */ +#define TI_EXEC_DOMAIN 4 /* offsetof(struct thread_info, exec_domain) # */ +#define TI_FLAGS 8 /* offsetof(struct thread_info, flags) # */ +#define TI_TP_VALUE 12 /* offsetof(struct thread_info, tp_value) # */ +#define TI_CPU 16 /* offsetof(struct thread_info, cpu) # */ +#define TI_PRE_COUNT 20 /* offsetof(struct thread_info, preempt_count) # */ +#define TI_ADDR_LIMIT 24 /* offsetof(struct thread_info, addr_limit) # */ +#define TI_RESTART_BLOCK 32 /* offsetof(struct thread_info, restart_block) # */ +#define TI_REGS 64 /* offsetof(struct thread_info, regs) # */ +#define _THREAD_SIZE 32768 /* THREAD_SIZE # */ +#define _THREAD_MASK 32767 /* THREAD_MASK # */ + +/* MIPS specific thread_struct offsets. */ +#define THREAD_REG16 512 /* offsetof(struct task_struct, thread.reg16) # */ +#define THREAD_REG17 516 /* offsetof(struct task_struct, thread.reg17) # */ +#define THREAD_REG18 520 /* offsetof(struct task_struct, thread.reg18) # */ +#define THREAD_REG19 524 /* offsetof(struct task_struct, thread.reg19) # */ +#define THREAD_REG20 528 /* offsetof(struct task_struct, thread.reg20) # */ +#define THREAD_REG21 532 /* offsetof(struct task_struct, thread.reg21) # */ +#define THREAD_REG22 536 /* offsetof(struct task_struct, thread.reg22) # */ +#define THREAD_REG23 540 /* offsetof(struct task_struct, thread.reg23) # */ +#define THREAD_REG29 544 /* offsetof(struct task_struct, thread.reg29) # */ +#define THREAD_REG30 548 /* offsetof(struct task_struct, thread.reg30) # */ +#define THREAD_REG31 552 /* offsetof(struct task_struct, thread.reg31) # */ +#define THREAD_STATUS 556 /* offsetof(struct task_struct, thread.cp0_status) # */ +#define THREAD_BVADDR 560 /* offsetof(struct task_struct, thread.cp0_badvaddr) # */ +#define THREAD_BUADDR 564 /* offsetof(struct task_struct, thread.cp0_baduaddr) # */ +#define THREAD_ECODE 568 /* offsetof(struct task_struct, thread.error_code) # */ +#define THREAD_TRAPNO 572 /* offsetof(struct task_struct, thread.trap_no) # */ + +/* Size of struct page */ +#define STRUCT_PAGE_SIZE 32 /* sizeof(struct page) # */ + +/* Linux mm_struct offsets. */ +#define MM_USERS 40 /* offsetof(struct mm_struct, mm_users) # */ +#define MM_PGD 36 /* offsetof(struct mm_struct, pgd) # */ +#define MM_CONTEXT 328 /* offsetof(struct mm_struct, context) # */ + +#define _PAGE_SIZE 4096 /* PAGE_SIZE # */ +#define _PAGE_SHIFT 12 /* PAGE_SHIFT # */ + +#define _PGD_T_SIZE 4 /* sizeof(pgd_t) # */ +#define _PMD_T_SIZE 4 /* sizeof(pmd_t) # */ +#define _PTE_T_SIZE 4 /* sizeof(pte_t) # */ + +#define _PGD_T_LOG2 2 /* PGD_T_LOG2 # */ +#define _PMD_T_LOG2 2 /* PMD_T_LOG2 # */ +#define _PTE_T_LOG2 2 /* PTE_T_LOG2 # */ + +#define _PGD_ORDER 0 /* PGD_ORDER # */ +#define _PMD_ORDER 1 /* PMD_ORDER # */ +#define _PTE_ORDER 0 /* PTE_ORDER # */ + +#define _PMD_SHIFT 22 /* PMD_SHIFT # */ +#define _PGDIR_SHIFT 22 /* PGDIR_SHIFT # */ + +#define _PTRS_PER_PGD 1024 /* PTRS_PER_PGD # */ +#define _PTRS_PER_PMD 1 /* PTRS_PER_PMD # */ +#define _PTRS_PER_PTE 1024 /* PTRS_PER_PTE # */ + +/* Linux sigcontext offsets. */ +#define SC_REGS 16 /* offsetof(struct sigcontext, sc_regs) # */ +#define SC_MDHI 272 /* offsetof(struct sigcontext, sc_mdhi) # */ +#define SC_MDLO 280 /* offsetof(struct sigcontext, sc_mdlo) # */ +#define SC_PC 8 /* offsetof(struct sigcontext, sc_pc) # */ + +/* Linux signal numbers. */ +#define _SIGHUP 1 /* SIGHUP # */ +#define _SIGINT 2 /* SIGINT # */ +#define _SIGQUIT 3 /* SIGQUIT # */ +#define _SIGILL 4 /* SIGILL # */ +#define _SIGTRAP 5 /* SIGTRAP # */ +#define _SIGIOT 6 /* SIGIOT # */ +#define _SIGABRT 6 /* SIGABRT # */ +#define _SIGEMT 7 /* SIGEMT # */ +#define _SIGFPE 8 /* SIGFPE # */ +#define _SIGKILL 9 /* SIGKILL # */ +#define _SIGBUS 10 /* SIGBUS # */ +#define _SIGSEGV 11 /* SIGSEGV # */ +#define _SIGSYS 12 /* SIGSYS # */ +#define _SIGPIPE 13 /* SIGPIPE # */ +#define _SIGALRM 14 /* SIGALRM # */ +#define _SIGTERM 15 /* SIGTERM # */ +#define _SIGUSR1 16 /* SIGUSR1 # */ +#define _SIGUSR2 17 /* SIGUSR2 # */ +#define _SIGCHLD 18 /* SIGCHLD # */ +#define _SIGPWR 19 /* SIGPWR # */ +#define _SIGWINCH 20 /* SIGWINCH # */ +#define _SIGURG 21 /* SIGURG # */ +#define _SIGIO 22 /* SIGIO # */ +#define _SIGSTOP 23 /* SIGSTOP # */ +#define _SIGTSTP 24 /* SIGTSTP # */ +#define _SIGCONT 25 /* SIGCONT # */ +#define _SIGTTIN 26 /* SIGTTIN # */ +#define _SIGTTOU 27 /* SIGTTOU # */ +#define _SIGVTALRM 28 /* SIGVTALRM # */ +#define _SIGPROF 29 /* SIGPROF # */ +#define _SIGXCPU 30 /* SIGXCPU # */ +#define _SIGXFSZ 31 /* SIGXFSZ # */ + +/* Linux irq_cpustat_t offsets. */ +#define IC_SOFTIRQ_PENDING 0 /* offsetof(irq_cpustat_t, __softirq_pending) # */ +#define IC_IRQ_CPUSTAT_T 32 /* sizeof(irq_cpustat_t) # */ + + +#endif diff --git a/target/linux/realtek/files/include/asm-rlx/rtl865x/rtl865xc_asicregs.h b/target/linux/realtek/files/include/asm-rlx/rtl865x/rtl865xc_asicregs.h index a2c33816c..d27db0a08 100644 --- a/target/linux/realtek/files/include/asm-rlx/rtl865x/rtl865xc_asicregs.h +++ b/target/linux/realtek/files/include/asm-rlx/rtl865x/rtl865xc_asicregs.h @@ -1098,7 +1098,7 @@ to forward packet to the unauthorized node. Otherwise, it is not allowed. /* CSCR, CCR - Checksum Control Register */ #define EnL4ChkCal (1<<5) /* Enable L4 Checksum Re-calculation */ #define EnL3ChkCal (1<<4) /* Enable L3 Checksum Re-calculation */ -#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) +#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) || defined(CONFIG_RTL_819XD) || defined(CONFIG_RTL_8196E) #define AcceptL2Err (1<<3) /* CPU port L2 CRC Error Allow; 0: Not Allowed, 1: Allowed (default) */ #endif #define L4ChkSErrAllow (1<<2) /* L4 Checksum Error Allow */ @@ -1145,7 +1145,7 @@ to forward packet to the unauthorized node. Otherwise, it is not allowed. #define Port0_TypeCfg_UTP (0<< 0) #define Port0_TypeCfg_GMII_MII_RGMII (1<< 0) -#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) +#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) || defined(CONFIG_RTL_819XD) || defined(CONFIG_RTL_8196E) #define GIGA_P5_PHYID 0x16 /* 0xBB804104 ~ 0xBB804124 */ @@ -1369,7 +1369,7 @@ to forward packet to the unauthorized node. Otherwise, it is not allowed. #define CVIDR (0x00+SWMISC_BASE) /* Chip Version ID Register */ #define SSIR (0x04+SWMISC_BASE) /* System Initial and Reset Registe*/ -#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) +#if defined(CONFIG_RTL_8196C) || defined(CONFIG_RTL_8198) || defined(CONFIG_RTL_819XD) || defined(CONFIG_RTL_8196E) #define CRMR (0x08+SWMISC_BASE) /* Chip Revision Management Register */ #define BISTCR (0x0C+SWMISC_BASE) /* BIST control */ #define BISTTSDR0 (0x38+SWMISC_BASE) /* BIST Test Status Diagnostic Register 0 */ diff --git a/target/linux/realtek/files/include/linux/autoconf.h b/target/linux/realtek/files/include/linux/autoconf.h new file mode 100644 index 000000000..d0c26f997 --- /dev/null +++ b/target/linux/realtek/files/include/linux/autoconf.h @@ -0,0 +1,256 @@ +/* + * Automatically generated C config: don't edit + * Linux kernel version: 2.6.30.9 + * Sat May 4 18:36:47 2013 + */ +#define AUTOCONF_INCLUDED +#define CONFIG_SQUASHFS_LZMA 1 +#define CONFIG_RTL_LAYERED_ASIC_DRIVER 1 +#define CONFIG_FRAME_WARN 1024 +#define CONFIG_RTL819X_SPI_FLASH 1 +#define CONFIG_NF_NAT_PROTO_GRE 1 +#define CONFIG_FLATMEM 1 +#define CONFIG_PROC_KCORE 1 +#define CONFIG_RTL8192E 1 +#define CONFIG_CPU_RLX4181 1 +#define CONFIG_KERNEL_STACK_SIZE_ORDER 3 +#define CONFIG_MTD_MAP_BANK_WIDTH_1 1 +#define CONFIG_BROKEN_ON_SMP 1 +#define CONFIG_ARCH_CACHE_WBC 1 +#define CONFIG_HAS_DMA 1 +#define CONFIG_MTD_MAP_BANK_WIDTH_2 1 +#define CONFIG_NETFILTER_XT_MATCH_MARK 1 +#define CONFIG_MTD_MAP_BANK_WIDTH_4 1 +#define CONFIG_PPP_MPPE_MPPC 1 +#define CONFIG_RTL_ETH_PRIV_SKB 1 +#define CONFIG_ROOTFS_SQUASH 1 +#define CONFIG_HW_HAS_PCI 1 +#define CONFIG_BLK_DEV 1 +#define CONFIG_NETFILTER_XT_TARGET_TCPMSS 1 +#define CONFIG_RTL_CURRENT_SETTING_OFFSET 0xC000 +#define CONFIG_HAS_IOPORT 1 +#define CONFIG_NF_CONNTRACK_IPV4 1 +#define CONFIG_RTL_WPS2_SUPPORT 1 +#define CONFIG_RTK_VLAN_SUPPORT 1 +#define CONFIG_NF_DEFRAG_IPV4 1 +#define CONFIG_NF_NAT_FTP 1 +#define CONFIG_NETFILTER_XTABLES 1 +#define CONFIG_CRYPTO_ALGAPI2 1 +#define CONFIG_DEFCONFIG_LIST "/lib/modules/$UNAME_RELEASE/.config" +#define CONFIG_NF_NAT_SIP 1 +#define CONFIG_SLAB 1 +#define CONFIG_WLAN_HAL_8192EE 1 +#define CONFIG_FLATMEM_MANUAL 1 +#define CONFIG_RTL865X_MBUF_HEADROOM 128 +#define CONFIG_NET_CLS_FW 1 +#define CONFIG_RTL_WEB_PAGES_OFFSET 0x10000 +#define CONFIG_FLAT_NODE_MEM_MAP 1 +#define CONFIG_CPU_BIG_ENDIAN 1 +#define CONFIG_NET_CLS 1 +#define CONFIG_RTL_WLAN_BLOCK_RELAY 1 +#define CONFIG_IRQ_VEC 1 +#define CONFIG_SLHC 1 +#define CONFIG_EMBEDDED 1 +#define CONFIG_PROC_FS 1 +#define CONFIG_RTL_CLIENT_MODE_SUPPORT 1 +#define CONFIG_INET 1 +#define CONFIG_RTL_FLASH_MAPPING_ENABLE 1 +#define CONFIG_SYSVIPC 1 +#define CONFIG_RTL_NETIF_MAPPING 1 +#define CONFIG_TCP_CONG_CUBIC 1 +#define CONFIG_IRQ_CPU 1 +#define CONFIG_RTK_VLAN_NEW_FEATURE 1 +#define CONFIG_CC_OPTIMIZE_FOR_SIZE 1 +#define CONFIG_PROC_PAGE_MONITOR 1 +#define CONFIG_IOSCHED_CFQ 1 +#define CONFIG_NF_CONNTRACK_PPTP 1 +#define CONFIG_MIPS 1 +#define CONFIG_PAGEFLAGS_EXTENDED 1 +#define CONFIG_HAVE_MLOCKED_PAGE_BIT 1 +#define CONFIG_ARCH_CPU_SLEEP 1 +#define CONFIG_DEFAULT_CFQ 1 +#define CONFIG_IP_NF_IPTABLES 1 +#define CONFIG_NETFILTER_ADVANCED 1 +#define CONFIG_UNIX 1 +#define CONFIG_32BIT 1 +#define CONFIG_SERIAL_CORE 1 +#define CONFIG_SCHED_OMIT_FRAME_POINTER 1 +#define CONFIG_RTL_IGMP_SNOOPING 1 +#define CONFIG_CRYPTO_ARC4 1 +#define CONFIG_CLASSIC_RCU 1 +#define CONFIG_ARCH_CPU_EB 1 +#define CONFIG_RTL_819X 1 +#define CONFIG_NF_CONNTRACK_PROC_COMPAT 1 +#define CONFIG_IP_FIB_HASH 1 +#define CONFIG_DEFAULT_MMAP_MIN_ADDR 4096 +#define CONFIG_CRYPTO_SHA1 1 +#define CONFIG_SYS_HAS_EARLY_PRINTK 1 +#define CONFIG_GENERIC_FIND_LAST_BIT 1 +#define CONFIG_SLABINFO 1 +#define CONFIG_MTD_BLKDEVS 1 +#define CONFIG_MTD_PARTITIONS 1 +#define CONFIG_SPLIT_PTLOCK_CPUS 4 +#define CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ 1 +#define CONFIG_RTL_DEBUG_TOOL 1 +#define CONFIG_GENERIC_FIND_NEXT_BIT 1 +#define CONFIG_RTL_FLASH_SIZE 0x400000 +#define CONFIG_BINFMT_ELF32 1 +#define CONFIG_CPU_HAS_WBC 1 +#define CONFIG_SERIAL_8250_RUNTIME_UARTS 1 +#define CONFIG_RTL_LAYERED_DRIVER_L2 1 +#define CONFIG_ARCH_SUSPEND_POSSIBLE 1 +#define CONFIG_SERIAL_8250_CONSOLE 1 +#define CONFIG_RTL_LAYERED_DRIVER_L3 1 +#define CONFIG_NET_SCH_HTB 1 +#define CONFIG_RTL_FAST_PPPOE 1 +#define CONFIG_DEFAULT_IOSCHED "cfq" +#define CONFIG_PRINTK_FUNC 1 +#define CONFIG_CRYPTO_HASH 1 +#define CONFIG_LEGACY_PTYS 1 +#define CONFIG_NETFILTER_XT_MATCH_STATE 1 +#define CONFIG_WLAN_HAL 1 +#define CONFIG_NETFILTER_XT_TARGET_MARK 1 +#define CONFIG_BLOCK 1 +#define CONFIG_RTL_8196E_GW 1 +#define CONFIG_GENERIC_CLOCKEVENTS_BUILD 1 +#define CONFIG_GENERIC_HWEIGHT 1 +#define CONFIG_EXTRTL8212_PHYID_P1 18 +#define CONFIG_NET_SCH_SFQ 1 +#define CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE 3 +#define CONFIG_WIRELESS 1 +#define CONFIG_SQUASHFS 1 +#define CONFIG_RTL_8196E 1 +#define CONFIG_EXTRTL8212_PHYID_P3 20 +#define CONFIG_EXTRTL8212_PHYID_P5 22 +#define CONFIG_SYSVIPC_SYSCTL 1 +#define CONFIG_DMA_NONCOHERENT 1 +#define CONFIG_PROC_SYSCTL 1 +#define CONFIG_CPU_HAS_ULS 1 +#define CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW 1 +#define CONFIG_NF_NAT_PPTP 1 +#define CONFIG_RTL_819X_SWCORE 1 +#define CONFIG_STRIP_ASM_SYMS 1 +#define CONFIG_RTL_ROOT_IMAGE_OFFSET 0x130000 +#define CONFIG_RTL_IGMP_PROXY 1 +#define CONFIG_RTL_LAYERED_DRIVER 1 +#define CONFIG_PPPOE 1 +#define CONFIG_DECOMPRESS_LZMA 1 +#define CONFIG_ARCH_CPU_RLX4181 1 +#define CONFIG_ARCH_FLATMEM_ENABLE 1 +#define CONFIG_GENERIC_TIME 1 +#define CONFIG_DECOMPRESS_LZMA_NEEDED 1 +#define CONFIG_AUTO_PCIE_PHY_SCAN 1 +#define CONFIG_EXPERIMENTAL 1 +#define CONFIG_VIRT_TO_BUS 1 +#define CONFIG_LOCALVERSION "" +#define CONFIG_HZ_100 1 +#define CONFIG_ZLIB_INFLATE 1 +#define CONFIG_INIT_ENV_ARG_LIMIT 32 +#define CONFIG_RTL_HW_SETTING_OFFSET 0x6000 +#define CONFIG_CRYPTO_HASH2 1 +#define CONFIG_NF_CONNTRACK 1 +#define CONFIG_SYSFS 1 +#define CONFIG_IOSCHED_NOOP 1 +#define CONFIG_CPU_SUPPORTS_32BIT_KERNEL 1 +#define CONFIG_TRAD_SIGNALS 1 +#define CONFIG_GENERIC_CLOCKEVENTS 1 +#define CONFIG_LOCKDEP_SUPPORT 1 +#define CONFIG_DEFAULTS_KERNEL_2_6 1 +#define CONFIG_MSDOS_PARTITION 1 +#define CONFIG_IP_NF_MANGLE 1 +#define CONFIG_PANIC_PRINTK 1 +#define CONFIG_HZ 100 +#define CONFIG_ARCH_BUS_PCI 1 +#define CONFIG_RTL8190_PRIV_SKB 1 +#define CONFIG_RTL_EXTPORT_VLANID 9 +#define CONFIG_DMA_NEED_PCI_MAP_STATE 1 +#define CONFIG_RTL_HW_MULTICAST_ONLY 1 +#define CONFIG_ARCH_IRQ_VEC 1 +#define CONFIG_NET_SCH_FIFO 1 +#define CONFIG_SSB_POSSIBLE 1 +#define CONFIG_PREEMPT_NONE 1 +#define CONFIG_RWSEM_GENERIC_SPINLOCK 1 +#define CONFIG_NET_SCHED 1 +#define CONFIG_BRIDGE 1 +#define CONFIG_NETFILTER 1 +#define CONFIG_BASE_FULL 1 +#define CONFIG_CRC_CCITT 1 +#define CONFIG_IP_MULTICAST 1 +#define CONFIG_MTD_BLOCK 1 +#define CONFIG_PREVENT_FIRMWARE_BUILD 1 +#define CONFIG_ARCH_IRQ_CPU 1 +#define CONFIG_RTL_LAYERED_DRIVER_ACL 1 +#define CONFIG_IP_NF_FILTER 1 +#define CONFIG_GENERIC_CALIBRATE_DELAY 1 +#define CONFIG_SYS_SUPPORTS_32BIT_KERNEL 1 +#define CONFIG_HAS_IOMEM 1 +#define CONFIG_RTL_HARDWARE_MULTICAST 1 +#define CONFIG_NETFILTER_XT_MATCH_MAC 1 +#define CONFIG_EARLY_PRINTK 1 +#define CONFIG_RTL_EEE_DISABLED 1 +#define CONFIG_PACKET 1 +#define CONFIG_ARCH_CPU_ULS 1 +#define CONFIG_SERIAL_CORE_CONSOLE 1 +#define CONFIG_NF_CT_PROTO_GRE 1 +#define CONFIG_GENERIC_HARDIRQS 1 +#define CONFIG_WIRELESS_EXT 1 +#define CONFIG_RTL_IPTABLES_FAST_PATH 1 +#define CONFIG_SYS_SUPPORTS_ARBIT_HZ 1 +#define CONFIG_ARCH_32BIT 1 +#define CONFIG_RTL_SDRAM_GE_32M 1 +#define CONFIG_SELECT_MEMORY_MODEL 1 +#define CONFIG_RTL_REPEATER_MODE_SUPPORT 1 +#define CONFIG_RTL_LINUX_IMAGE_OFFSET 0x30000 +#define CONFIG_ARCH_SUPPORTS_OPROFILE 1 +#define CONFIG_PPP_ASYNC 1 +#define CONFIG_RTL_LINKCHG_PROCESS 1 +#define CONFIG_DEFAULT_TCP_CONG "cubic" +#define CONFIG_RTL_VAP_SUPPORT 1 +#define CONFIG_IP_MROUTE 1 +#define CONFIG_RTL_REINIT_SWITCH_CORE 1 +#define CONFIG_NLATTR 1 +#define CONFIG_NF_NAT 1 +#define CONFIG_RTL_WTDOG 1 +#define CONFIG_PAGE_SIZE_4KB 1 +#define CONFIG_BOOT_32BIT 1 +#define CONFIG_RTL_IVL_SUPPORT 1 +#define CONFIG_NF_NAT_NEEDED 1 +#define CONFIG_SERIAL_8250_NR_UARTS 2 +#define CONFIG_RTL_WDS_SUPPORT 1 +#define CONFIG_LLC 1 +#define CONFIG_CRYPTO_HW 1 +#define CONFIG_RTL_LAYERED_ASIC_DRIVER_L3 1 +#define CONFIG_NF_CONNTRACK_FTP 1 +#define CONFIG_NF_CONNTRACK_SIP 1 +#define CONFIG_CRYPTO 1 +#define CONFIG_SYSCTL 1 +#define CONFIG_MISC_FILESYSTEMS 1 +#define CONFIG_WLAN_HAL_88XX 1 +#define CONFIG_MTD 1 +#define CONFIG_ZONE_DMA_FLAG 0 +#define CONFIG_NET 1 +#define CONFIG_RTL_SUPPORT_MULTI_PROFILE 1 +#define CONFIG_STANDALONE 1 +#define CONFIG_NETFILTER_XT_MATCH_IPRANGE 1 +#define CONFIG_NETDEVICES 1 +#define CONFIG_PPP_SYNC_TTY 1 +#define CONFIG_RTL_ODM_WLAN_DRIVER 1 +#define CONFIG_CRYPTO_ALGAPI 1 +#define CONFIG_SERIAL_8250 1 +#define CONFIG_MTD_CFI_I1 1 +#define CONFIG_MMU 1 +#define CONFIG_MTD_CFI_I2 1 +#define CONFIG_PPP 1 +#define CONFIG_BASE_SMALL 0 +#define CONFIG_BINFMT_ELF 1 +#define CONFIG_SQUASHFS_EMBEDDED 1 +#define CONFIG_STP 1 +#define CONFIG_LEGACY_PTY_COUNT 256 +#define CONFIG_IP_NF_TARGET_MASQUERADE 1 +#define CONFIG_HAVE_MLOCK 1 +#define CONFIG_RTL_DEFAULT_SETTING_OFFSET 0x8000 +#define CONFIG_RTL_MLD_SNOOPING 1 +#define CONFIG_LOG_BUF_SHIFT 12 +#define CONFIG_CPU_HAS_SLEEP 1 +#define CONFIG_CMDLINE "console=ttyS0,38400 root=/dev/mtdblock1" +#define CONFIG_ARCH_POPULATES_NODE_MAP 1 diff --git a/target/linux/realtek/files/include/linux/bounds.h b/target/linux/realtek/files/include/linux/bounds.h new file mode 100644 index 000000000..f169f15e8 --- /dev/null +++ b/target/linux/realtek/files/include/linux/bounds.h @@ -0,0 +1,13 @@ +#ifndef __LINUX_BOUNDS_H__ +#define __LINUX_BOUNDS_H__ +/* + * DO NOT MODIFY. + * + * This file was generated by Kbuild + * + */ + +#define NR_PAGEFLAGS 23 /* __NR_PAGEFLAGS # */ +#define MAX_NR_ZONES 2 /* __MAX_NR_ZONES # */ + +#endif diff --git a/target/linux/realtek/files/include/linux/compile.h b/target/linux/realtek/files/include/linux/compile.h new file mode 100644 index 000000000..8cda9ae0b --- /dev/null +++ b/target/linux/realtek/files/include/linux/compile.h @@ -0,0 +1,8 @@ +/* This file is auto generated, version 3 */ +#define UTS_MACHINE "rlx" +#define UTS_VERSION "#3 Sat May 4 18:45:47 EEST 2013" +#define LINUX_COMPILE_TIME "18:45:47" +#define LINUX_COMPILE_BY "roman" +#define LINUX_COMPILE_HOST "dexter" +#define LINUX_COMPILE_DOMAIN "" +#define LINUX_COMPILER "gcc version 3.4.6-1.3.6" diff --git a/target/linux/realtek/files/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/target/linux/realtek/files/include/linux/netfilter_ipv4/ip_conntrack_pptp.h index 934d8fa30..7b24f816a 100644 --- a/target/linux/realtek/files/include/linux/netfilter_ipv4/ip_conntrack_pptp.h +++ b/target/linux/realtek/files/include/linux/netfilter_ipv4/ip_conntrack_pptp.h @@ -333,26 +333,6 @@ extern void (*ip_nat_pptp_hook_expectfn)(struct ip_conntrack *ct, struct ip_conntrack_expect *exp); -#define ETH_ALEN 6 -struct pptp_acc_info { - unsigned long fast_pptp_lastxmit; - int valid; - struct net_device *wanDev; - unsigned char ourMac[ETH_ALEN]; - __u16 ourCallID; - __u32 ourIp; - unsigned char peerMac[ETH_ALEN]; - __u16 peerCallID; - __u32 peerIp; - unsigned int tx_seqno; - unsigned int rx_seqno; - __u16 tx_ipID; - __u16 ipID; - unsigned int tx_seqno_daemon; - unsigned int rx_seqno_daemon; - struct net_device *pppDev; - struct ppp_channel *pppChan; -}; #endif /* __KERNEL__ */ #endif /* _CONNTRACK_PPTP_H */ diff --git a/target/linux/realtek/files/include/linux/netfilter_ipv4/ipt_TRIGGER.h b/target/linux/realtek/files/include/linux/netfilter_ipv4/ipt_TRIGGER.h new file mode 100644 index 000000000..ea8db7196 --- /dev/null +++ b/target/linux/realtek/files/include/linux/netfilter_ipv4/ipt_TRIGGER.h @@ -0,0 +1,24 @@ +#ifndef _IPT_TRIGGER_H_target
+#define _IPT_TRIGGER_H_target
+
+enum ipt_trigger_type
+{
+ IPT_TRIGGER_DNAT = 1,
+ IPT_TRIGGER_IN = 2,
+ IPT_TRIGGER_OUT = 3
+};
+
+struct ipt_trigger_ports {
+ u_int16_t mport[2]; /* Trigger port range */
+ u_int16_t rport[2]; /* Related port range */
+};
+
+struct ipt_trigger_info {
+ enum ipt_trigger_type type;
+ u_int16_t mproto; /* Trigger protocol */
+ u_int16_t rproto; /* Related protocol */
+ struct ipt_trigger_ports ports;
+};
+
+#endif /*_IPT_TRIGGER_H_target*/
+
diff --git a/target/linux/realtek/files/include/linux/ulinker_brsc.h b/target/linux/realtek/files/include/linux/ulinker_brsc.h new file mode 100644 index 000000000..e3ba66b8a --- /dev/null +++ b/target/linux/realtek/files/include/linux/ulinker_brsc.h @@ -0,0 +1,97 @@ +#ifndef __LINUX_USB_ULINKER_BRSC_H +#define __LINUX_USB_ULINKER_BRSC_H + +#define FROM_USB 0 +#define FROM_ETH 1 +#define FROM_WLAN 2 + +struct brsc_cache +{ + struct net_device * dev; + unsigned char addr[6]; +}; + +struct brsc_counter_s { + unsigned long tx_in; + unsigned long tx_eth_sc; + unsigned long tx_wlan_sc; + unsigned long tx_ok; + + unsigned long tx_unknown_cdc_filter; + unsigned long tx_req_full; + unsigned long tx_realloc_header_fail; + unsigned long tx_skb_expand_full; + unsigned long tx_ep_queue_err; + unsigned long tx_req_full_recover; + + unsigned long rx_alloc_fail; + unsigned long rx_ep_queue_fail; + unsigned long rx_ep_queue_fail2; + unsigned long rx_ep_queue_ok; + + unsigned long rx_complete_in; + unsigned long rx_complete_err; + unsigned long rx_complete_sc; + unsigned long rx_complete_normal; + unsigned long rx_complete_connreset; + unsigned long rx_complete_shutdown; + unsigned long rx_complete_connabort; + unsigned long rx_complete_overflow; + unsigned long rx_complete_other_err; + + unsigned long otg_status_fail; + unsigned long otg_inepint; + unsigned long otg_outepintr; +}; + +extern struct brsc_counter_s brsc_counter; +extern struct brsc_cache cached_usb; +extern struct net_device *brsc_get_cached_dev(char from_usb, unsigned char *da); +extern void brsc_cache_dev(int from, struct net_device *dev, unsigned char *da); +extern struct net_device *pre_get_shortcut_dev(struct sk_buff *skb); + +#if 0 + #define BDBG_BRSC(format, arg...) \ + panic_printk(format , ## arg) +#elif 0 + #define BDBG_BRSC(format, arg...) \ + printk(format , ## arg) +#else + #define BDBG_BRSC(format, arg...) +#endif + + +#if 0 + #define BDBG_TASKLET(format, arg...) \ + panic_printk(format , ## arg) +#elif 0 + #define BDBG_TASKLET(format, arg...) \ + printk(format , ## arg) +#else + #define BDBG_TASKLET(format, arg...) +#endif + +#if defined(CONFIG_RTL_ULINKER_BRSC) +#define ULINKER_BRSC_RECOVER_TX_REQ 1 +#else +#define ULINKER_BRSC_RECOVER_TX_REQ 0 +#endif + + +#define ULINKER_BRSC_COUNTER 0 +#if ULINKER_BRSC_COUNTER + #define BRSC_COUNTER_UPDATE(X) \ + do { brsc_counter.X++; } while(0); +#else + #define BRSC_COUNTER_UPDATE(x) +#endif + +#if 0 + #define BDBG_GADGET_MODE_SWITCH(format, arg...) \ + printk(format , ## arg) +#else + #define BDBG_GADGET_MODE_SWITCH(format, arg...) +#endif + + +#endif /* __LINUX_USB_ULINKER_BRSC_H */ diff --git a/target/linux/realtek/files/include/linux/utsrelease.h b/target/linux/realtek/files/include/linux/utsrelease.h new file mode 100644 index 000000000..88404bb10 --- /dev/null +++ b/target/linux/realtek/files/include/linux/utsrelease.h @@ -0,0 +1 @@ +#define UTS_RELEASE "2.6.30.9" diff --git a/target/linux/realtek/files/include/linux/version.h b/target/linux/realtek/files/include/linux/version.h new file mode 100644 index 000000000..e6a89ef2b --- /dev/null +++ b/target/linux/realtek/files/include/linux/version.h @@ -0,0 +1,2 @@ +#define LINUX_VERSION_CODE 132638 +#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) diff --git a/target/linux/realtek/files/include/net/rtl/fastpath/fastpath_core.h b/target/linux/realtek/files/include/net/rtl/fastpath/fastpath_core.h index 9d02db024..64d45862b 100644 --- a/target/linux/realtek/files/include/net/rtl/fastpath/fastpath_core.h +++ b/target/linux/realtek/files/include/net/rtl/fastpath/fastpath_core.h @@ -71,8 +71,8 @@ /***********************************cary:refine filter.c**********************************/ #define FASTPATH_FILTER 1 /***********************************************************************************/ -#define CUSTOM_RSP_PACKET -#define DOS_FILTER +#define CUSTOM_RSP_PACKET +#define DOS_FILTER #define URL_FILTER //#define URL_CONTENT_AUTHENTICATION @@ -89,12 +89,51 @@ #define NO_ARP_USED // 2008.01.09, Forrest Lin. Use kernel route cache already. #define INVALID_PATH_BY_FIN +#if defined(CONFIG_RTL_FAST_PPPOE) +#define MAX_PPPOE_ENTRY 16 +struct pppoe_info +{ + char wan_dev[IFNAMSIZ]; /* Local device to use */ + char ppp_dev[IFNAMSIZ]; /* Local device to use */ + unsigned char our_mac[6]; + unsigned char peer_mac[6]; + unsigned int our_ip; + unsigned int peer_ip; + unsigned short sid; + unsigned short valid; + unsigned long last_rx; + unsigned long last_tx; + unsigned char txHdrCache[22]; +#if defined (CONFIG_RTL_FAST_PPPOE_DEBUG) + unsigned int total_rx; + unsigned int total_tx; +#endif +}; + + +int __init fast_pppoe_init(void); +int __exit fast_pppoe_exit(void); + +int clear_pppoe_info(char *ppp_dev, char *wan_dev, unsigned short sid, + unsigned int our_ip,unsigned int peer_ip, + unsigned char * our_mac, unsigned char *peer_mac); + +int set_pppoe_info(char *ppp_dev, char *wan_dev, unsigned short sid, + unsigned int our_ip,unsigned int peer_ip, + unsigned char * our_mac, unsigned char *peer_mac); + +unsigned long get_pppoe_last_rx_tx(char *ppp_dev, char *wan_dev, unsigned short sid, + unsigned int our_ip,unsigned int peer_ip, + unsigned char * our_mac, unsigned char *peer_mac, + unsigned long *last_rx, unsigned long *last_tx); + + +int check_and_pull_pppoe_hdr(struct sk_buff *skb); + +void check_and_restore_pppoe_hdr(struct sk_buff *skb); + +int fast_pppoe_xmit(struct sk_buff *skb); -#if defined(FAST_L2TP) -#if 0 - #define DEBUGP printk -#else - #define DEBUGP(fmt, args...) {} #endif #ifdef URL_CONTENT_AUTHENTICATION @@ -103,7 +142,7 @@ typedef struct _unAuth_skb_s { - struct list_head list; + struct list_head list; int id; /*skb->iphdr.id*/ uint32 saddr; uint32 daddr; @@ -114,6 +153,13 @@ typedef struct _unAuth_skb_s int rtl_urlContent_auth(struct sk_buff *skb); #endif +#if defined(FAST_L2TP) +#if 0 + #define DEBUGP printk +#else + #define DEBUGP(fmt, args...) {} +#endif + #define control_message 0x8000 #define connect_control 0xc @@ -122,8 +168,8 @@ int rtl_urlContent_auth(struct sk_buff *skb); struct l2tp_info { - struct net_device *wan_dev; - struct net_device *ppp0_dev; + void *wan_dev; + void *ppp0_dev; unsigned long last_xmit; __u32 daddr; __u32 saddr; @@ -131,7 +177,7 @@ struct l2tp_info __u16 cid; /* Caller ID */ unsigned char mac_header[ETH_HLEN]; __u16 valid; - + }; @@ -165,7 +211,7 @@ struct l2tp_header __u16 Ns; /* Optional next sent */ __u16 Nr; /* Optional next received */ }; -extern void (*l2tp_tx_id_hook)(struct sk_buff *skb); +extern void (*l2tp_tx_id_hook)(void *skb); #endif @@ -199,6 +245,26 @@ struct pptp_info { }; */ +struct pptp_acc_info { + unsigned long fast_pptp_lastxmit; + int valid; + void *wanDev; + unsigned char ourMac[ETHER_ADDR_LEN]; + __u16 ourCallID; + __u32 ourIp; + unsigned char peerMac[ETHER_ADDR_LEN]; + __u16 peerCallID; + __u32 peerIp; + unsigned int tx_seqno; + unsigned int rx_seqno; + __u16 tx_ipID; + __u16 ipID; + unsigned int tx_seqno_daemon; + unsigned int rx_seqno_daemon; + void *pppDev; + struct ppp_channel *pppChan; +}; + extern int fast_pptp_fw; @@ -276,32 +342,33 @@ void register_customRspHook(int *_cusRsp401_func,int *_cusRspTCPFinAck_func,int void unregister_customRspHook(void); void register_customRspStr(char *_str); void unregister_customRspStr(void); - int GenerateHTTP401(struct sk_buff *skb); + int GenerateHTTP401(void *skb); #endif #ifdef DOS_FILTER - extern int filter_enter(struct sk_buff *skb); + extern int filter_enter(void *skb); extern int __init filter_init(void); extern void __exit filter_exit(void); extern void filter_addconnect(ipaddr_t ipaddr); extern void filter_delconnect(ipaddr_t ipaddr); + extern int filter_checkConnect(__u32 ipaddr); #endif #ifdef FAST_PPTP - extern void fast_pptp_filter(struct sk_buff *skb); - extern void fast_pptp_sync_rx_seq(struct sk_buff *skb); + extern void fast_pptp_filter(void *skb); + extern void fast_pptp_sync_rx_seq(void *skb); extern int __init fast_pptp_init(void); extern void __exit fast_pptp_exit(void); - extern int fast_pptp_to_lan(struct sk_buff **pskb); - extern int Check_GRE_rx_net_device(struct sk_buff *skb); + extern int fast_pptp_to_lan(void **pskb); + extern int Check_GRE_rx_net_device(void *skb); extern int pptp_tcp_finished; #endif #ifdef FAST_L2TP extern int __init fast_l2tp_init(void); extern void __exit fast_l2tp_exit(void); - extern int fast_l2tp_to_wan(struct sk_buff *skb); - extern void fast_l2tp_rx(struct sk_buff *skb); - extern void l2tp_tx_id(struct sk_buff *skb); + extern int fast_l2tp_to_wan(void *skb); + extern void fast_l2tp_rx(void *skb); + extern void l2tp_tx_id(void *skb); extern int fast_l2tp_fw; #endif @@ -320,7 +387,7 @@ void unregister_customRspStr(void); #define ROUTE_TABLE_ENTRY_MAX 64 #if !defined(CONFIG_RTL8186_KB_N) -#if defined(CONFIG_RTL_8198) || defined(CONFIG_RTL_92D_SUPPORT) +#if defined(CONFIG_RTL_8198) || defined(CONFIG_RTL_92D_SUPPORT) ||defined(CONFIG_RTL_819XD) ||(defined(CONFIG_RTL_8196E)&&defined(CONFIG_RTL_SDRAM_GE_32M)) #define NAPT_TABLE_LIST_MAX 4096 #define NAPT_TABLE_ENTRY_MAX 4096 #define PATH_TABLE_LIST_MAX 4096 @@ -358,7 +425,7 @@ enum LR_RESULT LR_ERROR_PARAMETER = -2, /* The given parameter error */ LR_EXIST = -3, /* The entry you want to add has been existed, add failed */ LR_NONEXIST = -4, /* The specified entry is not found */ - + LR_NOBUFFER = -1000, /* Out of Entry Space */ LR_INVAPARAM = -1001, /* Invalid parameters */ LR_NOTFOUND = -1002, /* Entry not found */ @@ -440,8 +507,8 @@ enum LR_RESULT rtk_delSession( uint8* ifname ); enum LR_RESULT rtk_addNaptConnection(rtl_fp_napt_entry *fpNaptEntry, #if defined(IMPROVE_QOS) - struct sk_buff *pskb, struct nf_conn *ct, -#endif + void *pskb, void *ct, +#endif enum NP_FLAGS flags); enum LR_RESULT rtk_delNaptConnection( rtl_fp_napt_entry *fpNaptEntry); #if defined(IMPROVE_QOS) @@ -455,7 +522,7 @@ int32 rtl_br_fdb_time_update(void *br, void *fdb, const unsigned char *addr); int32 rtl_fp_dev_queue_xmit_check(struct sk_buff *skb, struct net_device *dev); int32 rtl_fp_dev_hard_start_xmit_check(struct sk_buff *skb, struct net_device *dev, struct netdev_queue *txq); -#if defined(IMPROVE_QOS) || defined(CONFIG_RTL_HW_QOS_SUPPORT) +#if defined(IMPROVE_QOS) || defined(CONFIG_RTL_HW_QOS_SUPPORT) //To query hardware address based on IP through arp table of dev int arp_req_get_ha(__be32 queryIP, struct net_device *dev, unsigned char * resHwAddr); #endif @@ -597,8 +664,8 @@ int fastpath_dump_napt_entry_num(char *page, int len); chksum = htons((uint16) accumulate); \ } \ }while(0) /* Checksum adjustment */ - - + + #define FASTPATH_ADJUST_CHKSUM_NAPT(ip_mod, ip_org, port_mod, port_org, chksum) \ do { \ s32 accumulate = 0; \ @@ -638,27 +705,31 @@ int init_table_napt(int napt_tbl_list_max, int napt_tbl_entry_max); #endif int init_table_path(int path_tbl_list_max, int path_tbl_entry_max); int udp_fragCache_init(int udp_frag_entry_max); +int negative_fragCache_init(void); void fastpath_set_qos_mark(struct sk_buff *skb, unsigned int preRouteMark, unsigned int postRouteMark); int fast_path_pre_process_check(struct iphdr *iph, struct tcphdr *tcphupuh, struct sk_buff *skb); int fast_path_post_process_xmit_check(struct iphdr *iph, struct tcphdr *tcphupuh, struct sk_buff *skb); int fast_path_post_process_return_check(struct iphdr *iph, struct tcphdr *tcphupuh, struct sk_buff *skb); int ip_finish_output3(struct sk_buff *skb); -__IRAM_GEN int enter_fast_path(struct sk_buff *skb); +#if defined (CONFIG_RTL_FAST_PPPOE) +int ip_finish_output4(struct sk_buff *skb); +#endif +__IRAM_GEN int enter_fast_path(void *skb); uint8 *FastPath_Route(ipaddr_t dIp); int FastPath_Enter(struct sk_buff **skb); extern int Get_fast_pptp_fw(void); #ifdef CONFIG_FAST_PATH_MODULE extern int (*fast_path_hook)(struct sk_buff **pskb) ; extern enum LR_RESULT (*FastPath_hook1)( ipaddr_t ip, ipaddr_t mask ); -extern enum LR_RESULT (*FastPath_hook2)( ipaddr_t ip, ipaddr_t mask, ipaddr_t gateway, uint8* ifname, enum RT_FLAGS flags ); +extern enum LR_RESULT (*FastPath_hook2)( ipaddr_t ip, ipaddr_t mask, ipaddr_t gateway, uint8* ifname, enum RT_FLAGS flags ); extern int (*fast_path_hook)(struct sk_buff **pskb) ; extern enum LR_RESULT (*FastPath_hook3)( ipaddr_t ip, ipaddr_t mask, ipaddr_t gateway, uint8* ifname, enum RT_FLAGS flags ); extern enum LR_RESULT (*FastPath_hook4)( rtl_fp_napt_entry *fpNaptEntry); extern enum LR_RESULT (*FastPath_hook5)( ipaddr_t ip, ether_addr_t* mac, enum ARP_FLAGS flags ); enum LR_RESULT (*FastPath_hook6)( rtl_fp_napt_entry *fpNaptEntry, #if defined(IMPROVE_QOS) - struct sk_buff *pskb, struct nf_conn *ct, -#endif + struct sk_buff *pskb, struct nf_conn *ct, +#endif enum NP_FLAGS flags); extern enum LR_RESULT (*FastPath_hook7)( ipaddr_t ip ); extern enum LR_RESULT (*FastPath_hook8)( ipaddr_t ip, ether_addr_t* mac, enum ARP_FLAGS flags ); @@ -666,12 +737,12 @@ extern int (*FastPath_hook9)( void ); extern int (*FastPath_hook10)(struct sk_buff *skb); extern enum LR_RESULT (*FastPath_hook11)(rtl_fp_napt_entry *fpNaptEntry, uint32 interval); -extern int fast_pptp_to_wan(struct sk_buff *skb); +extern int fast_pptp_to_wan(void *skb); #endif /* ---------------------------------------------------------------------------------------------------- */ #if defined(FASTPATH_FILTER) -#define RTL_FILTER_CONTENT_MAXNUM 40 +#define RTL_FILTER_CONTENT_MAXNUM 40 #define RTL_TABLE_FILTER_ENTRY_COUNT 10 #define IP_RANGE_TABLE 1 #define MAC_TABLE 2 @@ -691,7 +762,7 @@ typedef struct _rlt_filter_table_head typedef struct _filter_ipRange_fastpath { struct list_head list; - uint32 addr_start; /*ipaddr start*/ + uint32 addr_start; /*ipaddr start*/ uint32 addr_end; /*address end*/ uint32 flag; /*0 bit: default action[0:block,1:forward];1 bit: src ip or dest ip[0:src, 1:dest];2 bit: refer both direction*/ /*bit 9: valid 1; invalid 0*/ @@ -701,7 +772,7 @@ typedef struct _filter_ipRange_fastpath #define RTL_URL_FILTER_CONTENT_MAXNUM_FASTPATH 40 typedef struct _url_table_head_entry_fastpath { - struct list_head list; + struct list_head list; uint32 flag; int (*func)(struct sk_buff *skb); }url_table_head_entry_fastpath; @@ -723,7 +794,7 @@ typedef struct _rtl_mac_entry_fastpath { struct list_head list; char mac[ETHER_ADDR_LEN]; - uint8 flag; + uint8 flag; }rtl_mac_entry_fastpath; typedef struct _rtl_sch_entry_fastpath @@ -745,7 +816,7 @@ typedef struct _filter_table_info typedef struct _filter_table_list { struct list_head table_list; - struct list_head item_list; + struct list_head item_list; uint32 type; //type uint32 flag; uint32 num; @@ -754,8 +825,8 @@ typedef struct _filter_table_list typedef struct _filter_item_entry { - struct list_head item_list; - struct list_head rule_list; + struct list_head item_list; + struct list_head rule_list; uint32 relation_flag; //bit0: is the first condition? 1;0 //bit1: have next condition? 1:0 [next table condition] //bit2: have "and" logic condition?1:0 @@ -764,7 +835,7 @@ typedef struct _filter_item_entry //bit8: all match flag 1: all, 0: not all //bit9: NULL flag, 1:NULL, 0: not NULL uint32 index; - uint32 flag; + uint32 flag; char data[RTL_FILTER_CONTENT_MAXNUM]; }filter_item_entry; @@ -783,8 +854,128 @@ extern filter_table_list table_list_head; #define RTL_FASTPATH_PPP0_DEV_NAME "ppp0" #if defined(CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW) -void rtl_fp_mark_invalid(struct nf_conn *ct); +void rtl_fp_mark_invalid(void *ct); +#endif + +#define FASTPTH_INDEPENDENCE_KERNEL 1 +#if defined(FASTPTH_INDEPENDENCE_KERNEL) +extern struct dst_entry *dst_tmp; +extern int ppp_start_xmit(struct sk_buff *skb, struct net_device *dev); +extern struct sk_buff *ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb, int is_fast_fw); + +__be16 rtl_get_skb_protocol(struct sk_buff *skb); +void rtl_set_skb_protocol(struct sk_buff *skb,__be16 protocol); + + +unsigned char rtl_get_skb_type(struct sk_buff *skb); + +__wsum rtl_get_skb_csum(struct sk_buff *skb); + +unsigned int rtl_get_skb_len(struct sk_buff *skb); + +unsigned char *rtl_get_skb_data(struct sk_buff* skb); +void rtl_set_skb_data(struct sk_buff *skb, int offset, int action); + +unsigned char *rtl_skb_mac_header(struct sk_buff * skb); +void rtl_skb_set_mac_header(struct sk_buff *skb, int offset); +int rtl_skb_mac_header_was_set(struct sk_buff *skb); + +void rtl_set_skb_dmac(struct sk_buff *skb, void *device); +void rtl_set_skb_smac(struct sk_buff *skb, void *device); + + +unsigned char *rtl_skb_network_header(struct sk_buff * skb); +void rtl_skb_set_network_header(struct sk_buff * skb,const int offset); +void rtl_skb_reset_network_header(struct sk_buff *skb); +void rtl_set_skb_network_header(struct sk_buff * skb, unsigned char *network_header); + +unsigned char *rtl_skb_transport_header(struct sk_buff * skb); +void rtl_skb_set_transport_header(struct sk_buff * skb,const int offset); +void rtl_skb_reset_transport_header(struct sk_buff *skb); +void rtl_set_skb_transport_header(struct sk_buff * skb, unsigned char *transport_header); + + +unsigned int rtl_get_skb_pppoe_flag(struct sk_buff * skb); +void rtl_set_skb_pppoe_flag(struct sk_buff * skb,unsigned int pppoe_flag); + +unsigned char *rtl_skb_pull(struct sk_buff *skb, unsigned int len); +unsigned char *rtl_skb_push(struct sk_buff *skb, unsigned int len); + +int rtl_ppp_proto_check(struct sk_buff *skb, unsigned char* ppp_proto); +unsigned int rtl_ipt_do_table(struct sk_buff * skb, unsigned int hook, void *in, void *out); +int rtl_ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, u8 tos); +int rtl_skb_dst_check(struct sk_buff *skb); +void rtl_set_skb_ip_summed(struct sk_buff *skb, int value); +void rtl_dst_release(struct sk_buff *skb); + +__u32 rtl_get_skb_mark(struct sk_buff *skb); +void rtl_set_skb_mark(struct sk_buff *skb, unsigned int value); +void rtl_store_skb_dst(struct sk_buff *skb); +void rtl_set_skb_dst(struct sk_buff *skb); +int rtl_tcp_get_timeouts(void *ptr); +int rtl_arp_req_get_ha(__be32 queryIP, void *device, unsigned char * resHwAddr); + + +u_int8_t rtl_get_ct_protonum(void *ct_ptr, enum ip_conntrack_dir dir); +unsigned long rtl_get_ct_udp_status(void *ct_ptr); +u_int8_t rtl_get_ct_tcp_state(void *ct_ptr); +__be32 rtl_get_ct_ip_by_dir(void *ct_ptr, enum ip_conntrack_dir dir, int flag); +__be16 rtl_get_ct_port_by_dir(void *ct_ptr, enum ip_conntrack_dir dir, int flag); +void rtl_set_ct_timeout_expires(void *ct_ptr, unsigned long value); +unsigned long rtl_hold_time(void *br_ptr); +void rtl_set_fdb_aging(void *fdb_ptr, unsigned long value); +unsigned long rtl_get_fdb_aging(void *fdb_ptr); + +struct ethhdr *rtl_eth_hdr(struct sk_buff *skb); +struct iphdr *rtl_ip_hdr(struct sk_buff *skb); + + +struct net_device * rtl_get_dev_by_name(char *name); + +struct net_device *rtl_get_skb_dev(struct sk_buff* skb); +void rtl_set_skb_dev(struct sk_buff *skb, struct net_device *dev); + +char *rtl_get_skb_dev_name(struct sk_buff *skb); + +void rtl_set_skb_inDev(struct sk_buff *skb); + + + +struct net_device *rtl_get_skb_rx_dev(struct sk_buff* skb); +void rtl_set_skb_rx_dev(struct sk_buff* skb,struct net_device *dev); + +char * rtl_get_ppp_dev_name(struct net_device *ppp_dev); +void * rtl_get_ppp_dev_priv(struct net_device *ppp_dev); + +int rtl_call_skb_ndo_start_xmit(struct sk_buff *skb); + +void rtl_inc_ppp_stats(struct ppp *ppp, int act, int len); + +void *rtl_set_skb_tail(struct sk_buff *skb, int offset, int action); +struct sk_buff *rtl_ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb, int is_fast_fw); +int rtl_ppp_start_xmit(struct sk_buff *skb, struct net_device *dev); +void rtl_set_skb_cb(struct sk_buff *skb, char *value, int len); +int rtl_ppp_vj_check(struct ppp* ppp); +void *rtl_get_ppp_xmit_pending(struct ppp* ppp); +void rtl_set_ppp_xmit_pending(struct ppp* ppp, struct sk_buff* skb); +void rtl_set_skb_nfct(struct sk_buff *skb, void *value); +struct neighbour *rtl_neigh_lookup(const void *pkey, struct net_device *dev); +struct hh_cache *rtl_get_hh_from_neigh(struct neighbour *neigh); +seqlock_t rtl_get_lock_from_hh(struct hh_cache * hh); +unsigned short rtl_get_len_from_hh(struct hh_cache * hh); +unsigned long *rtl_get_data_from_hh(struct hh_cache * hh); +unsigned int rtl_skb_headroom(struct sk_buff *skb); +int rtl_skb_cloned(struct sk_buff *skb); +int rtl_skb_shared(const struct sk_buff *skb); +#if defined(CONFIG_RTL_DSCP_IPTABLE_CHECK) && defined(IMPROVE_QOS) +__u8 rtl_get_skb_orig_dscp(struct sk_buff *skb); #endif +void rtl_conntrack_drop_check_hook(struct nf_conn *ct_tmp, uint16 ipprotocol, struct nf_conn *ct); +int rtl_Add_Pattern_ACL_For_ContentFilter(void); +#endif + +#define RTL_FSTPATH_TTL_ADJUST 1 +void get_fastpath_module_info(unsigned char *buf); #endif /* __FASTPATH_CORE_H__ */ diff --git a/target/linux/realtek/files/include/net/rtl/features/rtl_features.h b/target/linux/realtek/files/include/net/rtl/features/rtl_features.h index 45b2c7466..9b7e567e5 100644 --- a/target/linux/realtek/files/include/net/rtl/features/rtl_features.h +++ b/target/linux/realtek/files/include/net/rtl/features/rtl_features.h @@ -1,7 +1,9 @@ #ifndef RTL_FEATURES_H
#define RTL_FEATURES_H 1
+extern char __conntrack_drop_check(void* tmp);
extern int rtl_nf_conntrack_threshold;
+extern int drop_priority_max_idx;
#if defined(CONFIG_RTL_IPTABLES_FAST_PATH) || defined(CONFIG_RTL_HARDWARE_NAT) || defined(CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW)
#define IS_CLASSD_ADDR(__ipv4addr__) ((((uint32)(__ipv4addr__)) & 0xf0000000) == 0xe0000000)
@@ -13,7 +15,7 @@ extern int rtl_nf_conntrack_threshold; struct tcp_state_hash_head
{ enum tcp_conntrack state; - +
struct list_head* state_hash; }; struct udp_state_hash_head @@ -47,20 +49,21 @@ enum { extern unsigned long rtl_gc_overflow_timout;
void gc_overflow_timout_proc_init(void);
#endif
-void clean_from_lists(struct nf_conn *ct, struct net *net);
-void rtl_death_action(struct nf_conn *ct);
+void clean_from_lists(void *ct, void *net);
+void rtl_death_action(void *ct);
int drop_one_conntrack(const struct nf_conntrack_tuple *orig,const struct nf_conntrack_tuple *repl);
+int isReservedConntrack(const struct nf_conntrack_tuple * orig, const struct nf_conntrack_tuple * repl);
int32 rtl_nf_conn_GC_init(void);
-int32 rtl_connGC_addList(struct sk_buff *skb, struct nf_conn *ct);
+int32 rtl_connGC_addList(void *skb, void *ct);
#endif
#if defined(CONFIG_RTL_IPTABLES_FAST_PATH)
-int rtl_fpTimer_update(struct nf_conn *ct);
+int rtl_fpTimer_update(void *ct);
#endif
void rtl_fpAddConnCache(struct nf_conn *ct, struct sk_buff *skb);
-#if defined(CONFIG_RTL_LOCAL_PUBLIC) || defined(CONFIG_RTL_MULTIPLE_WAN) || (defined(CONFIG_NET_SCHED)&&defined(CONFIG_RTL_IPTABLES_FAST_PATH)) || defined(CONFIG_RTL_HW_QOS_SUPPORT) +#if defined(CONFIG_RTL_LOCAL_PUBLIC) || defined(CONFIG_RTL_MULTIPLE_WAN) || (defined(CONFIG_NET_SCHED)&&defined(CONFIG_RTL_IPTABLES_FAST_PATH)) || defined(CONFIG_RTL_HW_QOS_SUPPORT)
extern struct net_device *rtl865x_getWanDev(void ); extern struct net_device *rtl865x_getLanDev(void ); #endif @@ -80,8 +83,9 @@ int32 rtl_connCache_timer_update(struct nf_conn *ct); #endif
#if defined(CONFIG_RTL_HARDWARE_NAT)
-int rtl865x_handle_nat(struct nf_conn *ct, int act, struct sk_buff *skb);
+int32 rtl865x_handle_nat(struct nf_conn *ct, int act, struct sk_buff *skb);
int rtl_hwnat_timer_update(struct nf_conn *ct);
+#define CONFIG_RTL_AVOID_ADDING_WLAN_PKT_TO_HW_NAT 1
#endif
#if defined(IMPROVE_QOS) && (defined(CONFIG_RTL_IPTABLES_FAST_PATH) || defined(CONFIG_RTL_HARDWARE_NAT))
@@ -133,9 +137,9 @@ extern unsigned int rtl_nf_conntrack_in(struct net *net, unsigned int dataoff, unsigned int hooknum, struct sk_buff *skb);
#endif
-#if defined(CONFIG_RTL_HARDWARE_NAT)
+#if defined(CONFIG_RTL_HARDWARE_NAT)
int rtl_flush_extern_ip(void);
-int rtl_init_masq_info(void);
+int rtl_init_masq_info(void);
int rtl_check_for_extern_ip(const char *name,
unsigned int valid_hooks, struct xt_table_info *newinfo,
void *entry0, unsigned int size,
@@ -144,7 +148,7 @@ int rtl_check_for_extern_ip(const char *name, #endif
#if defined(CONFIG_RTL_HARDWARE_NAT) -int rtl865x_handle_nat(struct nf_conn *ct, int act, struct sk_buff *skb);
+int32 rtl865x_handle_nat(struct nf_conn *ct, int act, struct sk_buff *skb);
int32 rtl_update_ip_tables(char *name, unsigned long event, struct in_ifaddr *ina);
int32 rtl_fn_insert(struct fib_table *tb, struct fib_config *cfg, struct fib_info *fi);
int32 rtl_fn_delete(struct fib_table *tb, struct fib_config *cfg);
@@ -172,7 +176,7 @@ extern unsigned long rtl_newGC_session_status_time; #if defined(CONFIG_RTL_8198)
#define RTL_FP_SESSION_LEVEL3_ALLOW_COUNT (40)
#else
-#define RTL_FP_SESSION_LEVEL3_ALLOW_COUNT (16)
+#define RTL_FP_SESSION_LEVEL3_ALLOW_COUNT (16)
#endif
#define RTL_FP_SESSION_LEVEL1_RX_WEIGHT (8) @@ -181,7 +185,35 @@ extern unsigned long rtl_newGC_session_status_time; #define RTL_FP_SESSION_LEVEL2 2 #define RTL_FP_SESSION_LEVEL3 3 //void rtl_fp_mark_invalid(struct nf_conn *ct); -//enum LR_RESULT rtk_refreshOSConnectionTimer(void); +//enum LR_RESULT rtk_refreshOSConnectionTimer(void);
+
+#if 1 //defined(CONFIG_RTL_GC_INDEPENDENCE_ON_KERNEL)
+int rtl_gc_threshold_check(struct net* net);
+void rtl_list_del(struct nf_conn* ct);
+void rtl_hlist_nulls_del_rcu(struct nf_conn* ct, enum ip_conntrack_dir dir);
+void rtl_list_add_tail(struct nf_conn* ct, int proto, int flag);
+int rtl_test_bit(struct nf_conn* ct, int num);
+int rtl_del_ct_timer(struct nf_conn *ct);
+void rtl_add_ct_timer(struct nf_conn *ct);
+void rtl_list_move_tail(struct nf_conn *ct, int proto, int state);
+unsigned long rtl_get_ct_timer_expires(struct nf_conn* ct);
+void rtl_nf_ct_stat_inc(struct net* net);
+int rtl_skb_network_offset(struct sk_buff *skb);
+u_int8_t rtl_new_gc_get_ct_protonum(void *ct_ptr, enum ip_conntrack_dir dir);
+struct iphdr *rtl_new_gc_ip_hdr(struct sk_buff *skb);
+__be16 rtl_new_gc_get_skb_protocol(struct sk_buff *skb);
+unsigned long rtl_new_gc_get_ct_udp_status(void *ct_ptr);
+u_int8_t rtl_new_gc_get_ct_tcp_state(void *ct_ptr);
+void rtl_new_gc_set_ct_timeout_expires(void *ct_ptr, unsigned long value);
+__be32 rtl_new_gc_get_ct_ip_by_dir(void *ct_ptr, enum ip_conntrack_dir dir, int flag);
+__be16 rtl_new_gc_get_ct_port_by_dir(void *ct_ptr, enum ip_conntrack_dir dir, int flag);
+#endif
+
#endif +#define CONFIG_RTL_URL_PATCH 1
+#if defined(CONFIG_RTL_URL_PATCH)
+#define URL_PROTO_PORT 80
+#endif
+
#endif /* RTL_FEATURES_H */
diff --git a/target/linux/realtek/files/include/net/rtl/features/rtl_ps_hooks.h b/target/linux/realtek/files/include/net/rtl/features/rtl_ps_hooks.h index 6af1b865d..8605b5462 100644 --- a/target/linux/realtek/files/include/net/rtl/features/rtl_ps_hooks.h +++ b/target/linux/realtek/files/include/net/rtl/features/rtl_ps_hooks.h @@ -1,8 +1,9 @@ -#ifndef RTL_PS_HOOKS_H +#ifndef RTL_PS_HOOKS_H
#define RTL_PS_HOOKS_H 1 #include <linux/netfilter_ipv4.h> -#include <linux/netfilter/nf_conntrack_common.h> +#include <linux/netfilter/nf_conntrack_common.h>
+
#include <linux/netfilter/nf_conntrack_tcp.h> #include <net/rtl/rtl_types.h> @@ -55,13 +56,15 @@ int32 rtl_fn_hash_replace_hooks(struct fib_table *tb, struct fib_config *cfg, st int32 rtl_dev_queue_xmit_hooks(struct sk_buff *skb, struct net_device *dev); int32 rtl_dev_hard_start_xmit_hooks(struct sk_buff *skb, struct net_device *dev, struct netdev_queue *txq); -int32 rtl_netif_receive_skb_hooks(struct sk_buff **pskb); +int32 rtl_netif_receive_skb_hooks(struct sk_buff **pskb);
int32 rtl_br_dev_queue_push_xmit_before_xmit_hooks(struct sk_buff *skb); #ifdef CONFIG_NET_SCHED +
extern int gQosEnabled; #endif +
int32 rtl_neigh_forced_gc_hooks(struct neigh_table *tbl, struct neighbour *n); int32 rtl_neigh_flush_dev_hooks(struct neigh_table *tbl, struct net_device *dev, struct neighbour *n); int32 rtl_neigh_destroy_hooks(struct neighbour *n); @@ -75,10 +78,11 @@ int32 rtl_neigh_update_hooks(struct neighbour *n, const u8 *lladdr, uint8 old); int32 rtl_neigh_update_post_hooks(struct neighbour *n, const u8 *lladdr, uint8 old); int32 rtl_neigh_periodic_timer_hooks(struct neighbour *n, unsigned int refresh); int32 rtl_neigh_init_hooks(void); -#if defined(CONFIG_BRIDGE) -int32 rtl___br_fdb_get_timeout_hooks(struct net_bridge *br, struct net_bridge_fdb_entry *fdb, const unsigned char *addr); -#endif +#if defined(CONFIG_BRIDGE)
+int32 rtl___br_fdb_get_timeout_hooks(struct net_bridge *br, struct net_bridge_fdb_entry *fdb, const unsigned char *addr);
+#endif
int32 rtl_translate_table_hooks(const char *name, +
unsigned int valid_hooks, struct xt_table_info *newinfo, void *entry0, @@ -112,7 +116,7 @@ int rtl_ct_seq_show_hooks(struct seq_file *s, struct nf_conn *ct); int rtl_get_unique_tuple_hooks(struct nf_conntrack_tuple *tuple, const struct nf_conntrack_tuple *orig_tuple, const struct nf_nat_range *range, - struct nf_conn *ct, + struct nf_conn *ct,
enum nf_nat_manip_type maniptype, struct nf_nat_protocol *proto); @@ -134,11 +138,17 @@ int32 __drop_one_conntrack_process_hooks2(struct nf_conn* ct, int dropPrioIdx, i int32 rtl_nf_conn_GC_init_hooks(void); #endif -#if defined(CONFIG_BRIDGE) -int32 rtl_fdb_delete_hooks(struct net_bridge_fdb_entry *f); -int32 rtl_br_fdb_cleanup_hooks(struct net_bridge *br, struct net_bridge_fdb_entry *f); -#endif - +
+#if defined(CONFIG_BRIDGE)
+int32 rtl_fdb_create_hooks(struct net_bridge_fdb_entry *fdb,const unsigned char *addr);
+int32 rtl865x_addAuthFDBEntry_hooks(const unsigned char *addr);
+int32 rtl_fdb_delete_hooks(struct net_bridge_fdb_entry *f);
+int32 rtl_br_fdb_cleanup_hooks(struct net_bridge *br, struct net_bridge_fdb_entry *f, unsigned long delay);
+
+#endif
+
+
#endif +
diff --git a/target/linux/realtek/files/include/net/rtl/rtk_vlan.h b/target/linux/realtek/files/include/net/rtl/rtk_vlan.h index 71764b61f..0a7f16f36 100644 --- a/target/linux/realtek/files/include/net/rtl/rtk_vlan.h +++ b/target/linux/realtek/files/include/net/rtl/rtk_vlan.h @@ -10,12 +10,16 @@ struct vlan_info {
int global_vlan; // 0/1 - global vlan disable/enable
- int is_lan; // 1: eth-lan/wlan port, 0: wan port
+ int is_lan; // 1: eth-lan/wlan port, 0: wan port
int vlan; // 0/1: disable/enable vlan
int tag; // 0/1: disable/enable tagging
int id; // 1~4090: vlan id
int pri; // 0~7: priority;
int cfi; // 0/1: cfi
+#if defined(CONFIG_RTK_VLAN_NEW_FEATURE)
+ int forwarding_rule; // 0:disabled/1: bridge/2:NAT
+ int index;
+#endif
};
struct _vlan_tag {
@@ -25,14 +29,28 @@ struct _vlan_tag { struct vlan_tag {
union
- {
+ {
unsigned long v;
struct _vlan_tag f;
- };
+ };
+};
+
+#if defined(CONFIG_RTK_VLAN_NEW_FEATURE)
+extern struct vlan_info management_vlan;
+extern unsigned char lan_macaddr[6];
+struct vlan_info_item {
+ struct vlan_info info;
+ struct net_device *dev;
};
+struct net_device *rtl_get_wan_from_vlan_info(void);
+int rtl_add_vlan_info(struct vlan_info *info, struct net_device *dev);
+struct vlan_info_item *rtl_get_vlan_info_item_by_dev(struct net_device *dev);
+
+#endif
+
#if defined(CONFIG_RTL_HW_STP)
-uint32 rtl865x_getVlanPortMask(uint32 vid);
+uint32 rtl865x_getVlanPortMask(uint32 vid);
#endif
#endif // _RTK_VLAN_H
diff --git a/target/linux/realtek/files/include/net/rtl/rtl865x_arp_api.h b/target/linux/realtek/files/include/net/rtl/rtl865x_arp_api.h index 73ed95a2b..23f48e0c2 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl865x_arp_api.h +++ b/target/linux/realtek/files/include/net/rtl/rtl865x_arp_api.h @@ -24,4 +24,8 @@ int32 rtl865x_getArpMapping(ipaddr_t ip, rtl865x_arpMapping_entry_t * arp_mappin int32 rtl_set_callback_for_ps_arp(int (*call_back_fn)(u32 ip,rtl865x_arpMapping_entry_t *entry)); #endif +#if 1//#if defined(CONFIG_RTL_AVOID_ADDING_WLAN_PKT_TO_HW_NAT) +int32 rtl865x_isEthArp(ipaddr_t ip); +#endif + #endif diff --git a/target/linux/realtek/files/include/net/rtl/rtl865x_fdb_api.h b/target/linux/realtek/files/include/net/rtl/rtl865x_fdb_api.h index b2fb2390a..edbab8ccc 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl865x_fdb_api.h +++ b/target/linux/realtek/files/include/net/rtl/rtl865x_fdb_api.h @@ -10,17 +10,62 @@ #endif #define FDB_STATIC 0x01 /* flag for FDB: process static entry only */ -#define FDB_DYNAMIC 0x02 /* flag for FDB: process dynamic entry only */ +#define FDB_DYNAMIC 0x02 /* flag for FDB: process dynamic entry only */ + +#define RTL865x_FDB_NUMBER 4 +#define RTL865x_L2_TYPEI 0x0001 /* Referenced by ARP/PPPoE */ +#define RTL865x_L2_TYPEII 0x0002 /* Referenced by Protocol */ +#define RTL865x_L2_TYPEIII 0x0004 /* Referenced by PCI/Extension Port */ +#define CONFIG_RTL865X_SYNC_L2 1 +#define RTL865X_FDBENTRY_TIMEOUT 0x1001 /*fdb entry time out*/ +#define RTL865X_FDBENTRY_450SEC 0x1002 /*fdb entry 450s timing*/ +#define RTL865X_FDBENTRY_300SEC 0x1004 /*fdb entry 300s timing*/ +#define RTL865X_FDBENTRY_150SEC 0x1008 /*fdb entry 150s timing*/ + +/*#define ETHER_ADDR_LEN 6 +typedef struct ether_addr_s { + uint8 octet[ETHER_ADDR_LEN]; +} ether_addr_t;*/ +/* +typedef struct rtl865x_tblAsicDrv_l2Param_s { + ether_addr_t macAddr; + uint32 memberPortMask; //extension ports [rtl8651_totalExtPortNum-1:0] are located at bits [RTL8651_PORT_NUMBER+rtl8651_totalExtPortNum-1:RTL8651_PORT_NUMBER] + uint32 ageSec; + uint32 cpu:1, + srcBlk:1, + isStatic:1, + nhFlag:1, + fid:2, + auth:1; + +} rtl865x_tblAsicDrv_l2Param_t;*/ + +//extern typedef struct rtl865x_tblAsicDrv_l2Param_s rtl865x_tblAsicDrv_l2Param_t; + + void update_hw_l2table(const char *srcName,const unsigned char *addr); int32 rtl_get_hw_fdb_age(uint32 fid,ether_addr_t *mac, uint32 flags); -int32 rtl865x_addAuthFDBEntry(const unsigned char *addr, int32 auth, int32 port); +int32 rtl865x_addAuthFDBEntry(const unsigned char *addr, int32 auth, int32 port, int32 srcblk); int32 rtl865x_setRestrictPortNum(int32 port, uint8 isEnable, int32 number); int32 rtl865x_check_authfdbentry_Byport(int32 port_num, const unsigned char *macAddr); int32 rtl865x_enableLanPortNumRestrict(uint8 isEnable); +int32 rtl865x_delAuthLanFDBEntry(uint16 l2Type, const unsigned char *addr); +int32 rtl865x_delLanFDBEntry(uint16 l2Type, const unsigned char *addr); + +int32 rtl865x_arrangeFdbEntry(const unsigned char *timeout_addr, int32 *port); +//extern int32 rtl865x_Lookup_fdb_entry(uint32 fid, ether_addr_t *mac, uint32 flags, uint32 *col_num, rtl865x_tblAsicDrv_l2Param_t *L2buff); + +int32 rtl865x_getPortNum(const unsigned char *addr); +int32 rtl865x_ConvertPortMasktoPortNum(int32 portmask); +int32 rtl865x_addFDBEntry(const unsigned char *addr); + #if defined(CONFIG_RTL865X_LANPORT_RESTRICTION) #define LAN_RESTRICT_PORT_NUMBER 9 +#define RTL_LAN_RESTRICT_STAT2 2 +#define RTL_LAN_RESTRICT_STAT1 1 +#define RTL_LAN_RESTRICT_STAT0 0 typedef struct _lan_restrict_info { @@ -32,6 +77,17 @@ typedef struct _lan_restrict_info extern lan_restrict_info lan_restrict_tbl[LAN_RESTRICT_PORT_NUMBER]; + +//int32 rtl865x_addAuthFDBEntry_hooks(struct net_bridge_fdb_entry *fdb,const unsigned char *addr); + + +int32 lan_restrict_getBlockAddr(int32 port , const unsigned char *swap_addr); +int32 lan_restrict_CheckStatusByport(int32 port); + + + + + int32 rtl_check_fdb_entry_check_exist(uint32 fid, ether_addr_t *mac, uint32 flags); int32 rtl_check_fdb_entry_check_srcBlock(uint32 fid, ether_addr_t *mac, int32 *SrcBlk); int32 lanrestrict_callbackFn_for_add_fdb(void *param); diff --git a/target/linux/realtek/files/include/net/rtl/rtl865x_multicast.h b/target/linux/realtek/files/include/net/rtl/rtl865x_multicast.h index 2b55ad5b8..3552c3432 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl865x_multicast.h +++ b/target/linux/realtek/files/include/net/rtl/rtl865x_multicast.h @@ -1,41 +1,41 @@ -#ifndef RTL865X_MULTICAST_H
-#define RTL865X_MULTICAST_H
-
-#define RTL865X_NETWORK_INTERFACE_DATA_STRUCTURE
-
-#define RTL865X_MULTICAST_TABLE_AGE 35
-#define RTL865X_MULTICAST_TABLE_ASIC_FULL_AGE 35
-#define RTL865X_MULTICAST_TABLE_ASIC_AGE 10 /* we would always write this value into ASIC */
-#define RTL865X_MULTICAST_SWAP_THRESHOLD 400
-#define SINGLE_BITMASK_ISSET(x) ((x & (x - 1)) == 0) /* chenyl: only 1 bit is set in vlanMask */
-
-
-/*================================================
- * Multicast Data Structure
- *================================================*/
-#define TBLDRV_MULTICAST_DATA_STRUCTURE
-
-/* mcast entry flag */
-#define RTL865X_MULTICAST_PPPOEPATCH_CPUBIT 0x01
-#define RTL865X_MULTICAST_EXTIP_SET 0x02
-#define RTL865X_MULTICAST_UPLOADONLY 0x04
-
-#define MAX_MCAST_FWD_DESCRIPTOR_CNT 256
-#define MAX_MCAST_TABLE_ENTRY_CNT 128
-
+#ifndef RTL865X_MULTICAST_H +#define RTL865X_MULTICAST_H + +#define RTL865X_NETWORK_INTERFACE_DATA_STRUCTURE + +#define RTL865X_MULTICAST_TABLE_AGE 35 +#define RTL865X_MULTICAST_TABLE_ASIC_FULL_AGE 35 +#define RTL865X_MULTICAST_TABLE_ASIC_AGE 10 /* we would always write this value into ASIC */ +#define RTL865X_MULTICAST_SWAP_THRESHOLD 400 +#define SINGLE_BITMASK_ISSET(x) ((x & (x - 1)) == 0) /* chenyl: only 1 bit is set in vlanMask */ + + +/*================================================ + * Multicast Data Structure + *================================================*/ +#define TBLDRV_MULTICAST_DATA_STRUCTURE + +/* mcast entry flag */ +#define RTL865X_MULTICAST_PPPOEPATCH_CPUBIT 0x01 +#define RTL865X_MULTICAST_EXTIP_SET 0x02 +#define RTL865X_MULTICAST_UPLOADONLY 0x04 + +#define MAX_MCAST_FWD_DESCRIPTOR_CNT 256 +#define MAX_MCAST_TABLE_ENTRY_CNT 128 + /* * List definitions. */ -#define MC_LIST_HEAD(name, type) \
+#define MC_LIST_HEAD(name, type) \ struct name { \ struct type *lh_first; /* first element */ \ } -#define MC_LIST_HEAD_INITIALIZER(head) \
+#define MC_LIST_HEAD_INITIALIZER(head) \ { NULL } -#define MC_LIST_ENTRY(type) \
+#define MC_LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ @@ -45,18 +45,18 @@ struct { \ * List functions. */ -#define MC_LIST_EMPTY(head) ((head)->lh_first == NULL)
+#define MC_LIST_EMPTY(head) ((head)->lh_first == NULL) -#define MC_LIST_FIRST(head) ((head)->lh_first)
+#define MC_LIST_FIRST(head) ((head)->lh_first) -#define MC_LIST_FOREACH(var, head, field) \
+#define MC_LIST_FOREACH(var, head, field) \ for((var) = (head)->lh_first; (var); (var) = (var)->field.le_next) -#define MC_LIST_INIT(head) do { \
+#define MC_LIST_INIT(head) do { \ (head)->lh_first = NULL; \ } while (0) -#define MC_LIST_INSERT_AFTER(listelm, elm, field) do { \
+#define MC_LIST_INSERT_AFTER(listelm, elm, field) do { \ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ (listelm)->field.le_next->field.le_prev = \ &(elm)->field.le_next; \ @@ -64,32 +64,32 @@ struct { \ (elm)->field.le_prev = &(listelm)->field.le_next; \ } while (0) -#define MC_LIST_INSERT_BEFORE(listelm, elm, field) do { \
+#define MC_LIST_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.le_prev = (listelm)->field.le_prev; \ (elm)->field.le_next = (listelm); \ *(listelm)->field.le_prev = (elm); \ (listelm)->field.le_prev = &(elm)->field.le_next; \ } while (0) -#define MC_LIST_INSERT_HEAD(head, elm, field) do { \
+#define MC_LIST_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.le_next = (head)->lh_first) != NULL) \ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ (head)->lh_first = (elm); \ (elm)->field.le_prev = &(head)->lh_first; \ } while (0) -#define MC_LIST_NEXT(elm, field) ((elm)->field.le_next)
+#define MC_LIST_NEXT(elm, field) ((elm)->field.le_next) -#define MC_LIST_REMOVE(elm, field) do { \
+#define MC_LIST_REMOVE(elm, field) do { \ if ((elm)->field.le_next != NULL) \ (elm)->field.le_next->field.le_prev = \ - (elm)->field.le_prev; \
- if ((elm)->field.le_prev != NULL) \
- *(elm)->field.le_prev = (elm)->field.le_next; \
+ (elm)->field.le_prev; \ + if ((elm)->field.le_prev != NULL) \ + *(elm)->field.le_prev = (elm)->field.le_next; \ } while (0) -
-
-
+ + + /* * Counting Tail queue definitions. @@ -186,22 +186,22 @@ struct { \ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ (head)->tqh_count--;\ } while (0) -
-#define ETHERNET_DEVICE_TYPE 0
-#define WIRELESS_DEVICE_TYPE 1
-#define VIRTUAL_DEVICE_TYPE 2
-typedef struct rtl865x_mcast_fwd_descriptor_s{
- char netifName[16];
- unsigned int descPortMask;
- char toCpu;
- unsigned int vid;
- unsigned int fwdPortMask;
- MC_LIST_ENTRY(rtl865x_mcast_fwd_descriptor_s) next;
-
-}rtl865x_mcast_fwd_descriptor_t;
-
-typedef MC_LIST_HEAD(mcast_fwd_descriptor_head_s, rtl865x_mcast_fwd_descriptor_s) mcast_fwd_descriptor_head_t;
-
+ +#define ETHERNET_DEVICE_TYPE 0 +#define WIRELESS_DEVICE_TYPE 1 +#define VIRTUAL_DEVICE_TYPE 2 +typedef struct rtl865x_mcast_fwd_descriptor_s{ + char netifName[16]; + unsigned int descPortMask; + char toCpu; + unsigned int vid; + unsigned int fwdPortMask; + MC_LIST_ENTRY(rtl865x_mcast_fwd_descriptor_s) next; + +}rtl865x_mcast_fwd_descriptor_t; + +typedef MC_LIST_HEAD(mcast_fwd_descriptor_head_s, rtl865x_mcast_fwd_descriptor_s) mcast_fwd_descriptor_head_t; + /* * Tail queue definitions. */ @@ -290,71 +290,71 @@ struct { \ (head)->tqh_last = (elm)->field.tqe_prev; \ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ } while (0) -
-typedef struct rtl865x_tblDrv_mCast_s {
- unsigned int sip;
- unsigned int dip;
- unsigned short svid;
- unsigned short port;
- unsigned int mbr;
- unsigned short age;
- unsigned short cpu;
- unsigned int extIp;
- /*above field is for asic table usage*/
- mcast_fwd_descriptor_head_t fwdDescChain;
- unsigned int count;
- unsigned int maxPPS;
- unsigned char cpuHold;
- unsigned char flag;
- unsigned char inAsic;
- unsigned char unKnownMCast;
-#if defined(CONFIG_RTL8196C_REVISION_B) || defined (CONFIG_RTL8198_REVISION_B)
- unsigned short liveTime;
-#endif
- TAILQ_ENTRY(rtl865x_tblDrv_mCast_s) nextMCast;
-
-} rtl865x_tblDrv_mCast_t;
-
-struct rtl865x_multicastTable{
-
- struct freeList_s {
-
- TAILQ_HEAD( _FreeMultiCastEntry, rtl865x_tblDrv_mCast_s) freeMultiCast;
- } freeList;
-
- struct inuseList_s {
- TAILQ_HEAD( _InuseMCast, rtl865x_tblDrv_mCast_s) *mCastTbl;
- }inuseList;
-
-};
-
-typedef struct rtl865x_mCastConfig_s{
- unsigned int externalPortMask;
-
-}rtl865x_mCastConfig_t;
-
-int rtl865x_initMulticast(rtl865x_mCastConfig_t * mCastConfig);
-int rtl865x_reinitMulticast(void);
-
-int rtl865x_addMulticastExternalPort(unsigned int extPort);
-int rtl865x_delMulticastExternalPort(unsigned int extPort);
-
-int rtl865x_setMulticastExternalPortMask(unsigned int extPortMask);
-int rtl865x_getMulticastExternalPortMask(void);
-
-int rtl865x_addMulticastExternalPortMask(unsigned int extPortMask);
-int rtl865x_delMulticastExternalPortMask(unsigned int extPortMask);
-
-rtl865x_tblDrv_mCast_t *rtl865x_findMCastEntry(unsigned int mAddr, unsigned int sip, unsigned short svid, unsigned short sport);
-
-int rtl865x_addMulticastEntry(unsigned int mAddr, unsigned int sip, unsigned short svid, unsigned short sport,
- rtl865x_mcast_fwd_descriptor_t * newFwdDescChain,
- int flushOldChain, unsigned int extIp, char cpuHold, unsigned char flag);
-
-int rtl865x_delMulticastEntry(unsigned int mcast_addr);
-
-int rtl865x_genVirtualMCastFwdDescriptor(unsigned int forceToCpu, unsigned int fwdPortMask, rtl865x_mcast_fwd_descriptor_t *fwdDescriptor);
-int rtl865x_blockMulticastFlow(unsigned int srcVlanId, unsigned int srcPort,unsigned int srcIpAddr, unsigned int destIpAddr);
-
-#endif
-
+ +typedef struct rtl865x_tblDrv_mCast_s { + unsigned int sip; + unsigned int dip; + unsigned short svid; + unsigned short port; + unsigned int mbr; + unsigned short age; + unsigned short cpu; + unsigned int extIp; + /*above field is for asic table usage*/ + mcast_fwd_descriptor_head_t fwdDescChain; + unsigned int count; + unsigned int maxPPS; + unsigned char cpuHold; + unsigned char flag; + unsigned char inAsic; + unsigned char unKnownMCast; +#if defined(CONFIG_RTL8196C_REVISION_B) || defined (CONFIG_RTL8198_REVISION_B) || defined(CONFIG_RTL_819XD) || defined(CONFIG_RTL_8196E) + unsigned short liveTime; +#endif + TAILQ_ENTRY(rtl865x_tblDrv_mCast_s) nextMCast; + +} rtl865x_tblDrv_mCast_t; + +struct rtl865x_multicastTable{ + + struct freeList_s { + + TAILQ_HEAD( _FreeMultiCastEntry, rtl865x_tblDrv_mCast_s) freeMultiCast; + } freeList; + + struct inuseList_s { + TAILQ_HEAD( _InuseMCast, rtl865x_tblDrv_mCast_s) *mCastTbl; + }inuseList; + +}; + +typedef struct rtl865x_mCastConfig_s{ + unsigned int externalPortMask; + +}rtl865x_mCastConfig_t; + +int rtl865x_initMulticast(rtl865x_mCastConfig_t * mCastConfig); +int rtl865x_reinitMulticast(void); + +int rtl865x_addMulticastExternalPort(unsigned int extPort); +int rtl865x_delMulticastExternalPort(unsigned int extPort); + +int rtl865x_setMulticastExternalPortMask(unsigned int extPortMask); +int rtl865x_getMulticastExternalPortMask(void); + +int rtl865x_addMulticastExternalPortMask(unsigned int extPortMask); +int rtl865x_delMulticastExternalPortMask(unsigned int extPortMask); + +rtl865x_tblDrv_mCast_t *rtl865x_findMCastEntry(unsigned int mAddr, unsigned int sip, unsigned short svid, unsigned short sport); + +int rtl865x_addMulticastEntry(unsigned int mAddr, unsigned int sip, unsigned short svid, unsigned short sport, + rtl865x_mcast_fwd_descriptor_t * newFwdDescChain, + int flushOldChain, unsigned int extIp, char cpuHold, unsigned char flag); + +int rtl865x_delMulticastEntry(unsigned int mcast_addr); + +int rtl865x_genVirtualMCastFwdDescriptor(unsigned int forceToCpu, unsigned int fwdPortMask, rtl865x_mcast_fwd_descriptor_t *fwdDescriptor); +int rtl865x_blockMulticastFlow(unsigned int srcVlanId, unsigned int srcPort,unsigned int srcIpAddr, unsigned int destIpAddr); + +#endif + diff --git a/target/linux/realtek/files/include/net/rtl/rtl865x_nat.h b/target/linux/realtek/files/include/net/rtl/rtl865x_nat.h index 1471a8fee..4cdbc60e9 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl865x_nat.h +++ b/target/linux/realtek/files/include/net/rtl/rtl865x_nat.h @@ -1,122 +1,122 @@ -#ifndef RTL865X_NAT_H -#define RTL865X_NAT_H - -#define FLAG_QOS_ENABLE 1 - -/* NAT timeout value */ -#define TCP_TIMEOUT 120 /* 120 secs */ -#define UDP_TIMEOUT 90 /* 90 secs */ -#define TCP_OVERRIDE_ELASPED_THRESHOLD 60 /* 60 secs */ -#define UDP_OVERRIDE_ELASPED_THRESHOLD 30 /* 30 secs */ - -#define TCP_CLOSED_FLOW 8 - -#define RTL865X_PROTOCOL_UDP 0 -#define RTL865X_PROTOCOL_TCP 1 - -#define NAT_INBOUND 0x00000001 -#define NAT_OUTBOUND 0x00000002 -#define NAT_PRI_PROCESSED 0x00000004 -#define NAT_PRI_HALF_PROCESSED 0x00000008 - -#define NAT_PRE_RESERVED 0x00000100 -#define RESERVE_EXPIRE_TIME 3 /*uinit:seconds*/ - -#define NAT_INUSE(_n_) ( ((_n_)->flags&(NAT_INBOUND|NAT_OUTBOUND)) ) -#define SET_NAT_FLAGS(_n_, _v_) ((_n_)->flags |= (_v_)) -#define CLR_NAT_FLAGS(_n_, _v_) ((_n_)->flags &= (~(_v_))) -#define NAT_INVALID(_n_) ( ((_n_)->flags=0) ) - -#define MAX_EXTPORT_TRY_CNT 8 - -#define RTL_NAPT_ACCELERATION_FAIL -1 -#define RTL_NAPT_FULL_ACCELERATION 0 -#define RTL_NAPT_OUTBOUND_ACCELERATION 1 -#define RTL_NAPT_INBOUND_ACCELERATION 2 - -#define CONFIG_RTL_INBOUND_COLLISION_AVOIDANCE -#define CONFIG_RTL_HALF_NAPT_ACCELERATION - -typedef struct _rtl865x_napt_entry +#ifndef RTL865X_NAT_H
+#define RTL865X_NAT_H
+
+#define FLAG_QOS_ENABLE 1
+
+/* NAT timeout value */
+#define TCP_TIMEOUT 120 /* 120 secs */
+#define UDP_TIMEOUT 90 /* 90 secs */
+#define TCP_OVERRIDE_ELASPED_THRESHOLD 60 /* 60 secs */
+#define UDP_OVERRIDE_ELASPED_THRESHOLD 30 /* 30 secs */
+
+#define TCP_CLOSED_FLOW 8
+
+#define RTL865X_PROTOCOL_UDP 0
+#define RTL865X_PROTOCOL_TCP 1
+
+#define NAT_INBOUND 0x00000001
+#define NAT_OUTBOUND 0x00000002
+#define NAT_PRI_PROCESSED 0x00000004
+#define NAT_PRI_HALF_PROCESSED 0x00000008
+
+#define NAT_PRE_RESERVED 0x00000100
+#define RESERVE_EXPIRE_TIME 3 /*uinit:seconds*/
+
+#define NAT_INUSE(_n_) ( ((_n_)->flags&(NAT_INBOUND|NAT_OUTBOUND)) )
+#define SET_NAT_FLAGS(_n_, _v_) ((_n_)->flags |= (_v_))
+#define CLR_NAT_FLAGS(_n_, _v_) ((_n_)->flags &= (~(_v_)))
+#define NAT_INVALID(_n_) ( ((_n_)->flags=0) )
+
+#define MAX_EXTPORT_TRY_CNT 8
+
+#define RTL_NAPT_ACCELERATION_FAIL -1
+#define RTL_NAPT_FULL_ACCELERATION 0
+#define RTL_NAPT_OUTBOUND_ACCELERATION 1
+#define RTL_NAPT_INBOUND_ACCELERATION 2
+
+#define CONFIG_RTL_INBOUND_COLLISION_AVOIDANCE
+#define CONFIG_RTL_HALF_NAPT_ACCELERATION
+
+typedef struct _rtl865x_napt_entry
{ - uint32 protocol; //RTL865X_PROTOCOL_UDP or RTL865X_PROTOCOL_TCP - ipaddr_t intIp; - uint32 intPort; - ipaddr_t extIp; - uint32 extPort; - ipaddr_t remIp; - uint32 remPort; -}rtl865x_napt_entry; - -typedef struct _rtl865x_priority -{ - int32 uplinkPrio; - int32 downlinkPrio; -}rtl865x_priority; - -typedef struct _rtl865x_qos_mark -{ - int32 uplinkMark; - int32 downlinkMark; -}rtl865x_qos_mark; - -int32 rtl865x_nat_init(void); -int32 rtl865x_nat_reinit(void); -/* -@func enum RTL_RESULT | rtl865x_addNaptConnection | Add a NAPT Flow -@parm enum RTL_NP_PROTOCOL | protocol | The protocol to add -@parm ipaddr_t | intIp | Internal IP address -@parm uint32 | intPort | Internal Port -@parm ipaddr_t | extIp | External IP address -@parm uint32 | extPort | External Port -@parm ipaddr_t | remIp | Remote IP address -@parm uint32 | remPort | Remote Port -@parm enum RTL_NP_FLAGS | flags | reserved for future used -@rvalue RTL_SUCCESS | Add success (can be ASIC-accelerated) -@rvalue RTL_SUCCESS | Add success (cannot be ASIC-accelerated) -@rvalue RTL_ERROR_PARAMETER | Error parameter is given -@rvalue RTL_EXIST | Add an existed flow -@rvalue RTL_FAILED | General failure -@comm - Add a NAPT Flow Entry to L4 TCP/UDP NAPT Table(1024-Entry) -@devnote - Insert into ip_nat_setup_info() function in file net/ipv4/netfilter/ip_nat_core.c -*/ -int32 rtl865x_addNaptConnection(rtl865x_napt_entry *naptEntry, rtl865x_priority *prio); -/* -@func enum RTL_RESULT | rtl865x_delNaptConnection | Delete a NAPT Flow -@parm enum RTL_NP_PROTOCOL | protocol | The protocol to delete -@parm ipaddr_t | intIp | Internal IP address -@parm uint32 | intPort | Internal Port -@parm ipaddr_t | extIp | External IP address -@parm uint32 | extPort | External Port -@parm ipaddr_t | remIp | Remote IP address -@parm uint32 | remPort | Remote Port -@rvalue RTL_SUCCESS | Delete success -@rvalue RTL_NONEXIST | Delete a non-existed flow -@rvalue RTL_FAILED | General failure -@comm - Delete a NAPT Flow Entry of L4 TCP/UDP NAPT Table(1024-Entry) -@devnote - Insert into ip_nat_cleanup_conntrack() function in file net/ipv4/netfilter/ip_nat_core.c -*/ -int32 rtl865x_delNaptConnection(rtl865x_napt_entry *naptEntry); - -int32 rtl865x_naptSync(rtl865x_napt_entry *naptEntry, uint32 refresh); - -#if defined (CONFIG_RTL_INBOUND_COLLISION_AVOIDANCE) -int rtl865x_optimizeExtPort(unsigned short origDelta, unsigned int rangeSize, unsigned short *newDelta); - -int rtl865x_getAsicNaptHashScore(rtl865x_napt_entry *naptEntry, - uint32 *naptHashScore); - -int32 rtl865x_preReserveConn(rtl865x_napt_entry *naptEntry); - -#endif -#if defined(CONFIG_RTL_HARDWARE_NAT) -int32 rtl_nat_expire_interval_update(int proto, int32 interval); -int32 rtl865x_nat_reinit(void); -#endif - -#endif - + uint32 protocol; //RTL865X_PROTOCOL_UDP or RTL865X_PROTOCOL_TCP
+ ipaddr_t intIp;
+ uint32 intPort;
+ ipaddr_t extIp;
+ uint32 extPort;
+ ipaddr_t remIp;
+ uint32 remPort;
+}rtl865x_napt_entry;
+
+typedef struct _rtl865x_priority
+{
+ int32 uplinkPrio;
+ int32 downlinkPrio;
+}rtl865x_priority;
+
+typedef struct _rtl865x_qos_mark
+{
+ int32 uplinkMark;
+ int32 downlinkMark;
+}rtl865x_qos_mark;
+
+int32 rtl865x_nat_init(void);
+int32 rtl865x_nat_reinit(void);
+/*
+@func enum RTL_RESULT | rtl865x_addNaptConnection | Add a NAPT Flow
+@parm enum RTL_NP_PROTOCOL | protocol | The protocol to add
+@parm ipaddr_t | intIp | Internal IP address
+@parm uint32 | intPort | Internal Port
+@parm ipaddr_t | extIp | External IP address
+@parm uint32 | extPort | External Port
+@parm ipaddr_t | remIp | Remote IP address
+@parm uint32 | remPort | Remote Port
+@parm enum RTL_NP_FLAGS | flags | reserved for future used
+@rvalue RTL_SUCCESS | Add success (can be ASIC-accelerated)
+@rvalue RTL_SUCCESS | Add success (cannot be ASIC-accelerated)
+@rvalue RTL_ERROR_PARAMETER | Error parameter is given
+@rvalue RTL_EXIST | Add an existed flow
+@rvalue RTL_FAILED | General failure
+@comm
+ Add a NAPT Flow Entry to L4 TCP/UDP NAPT Table(1024-Entry)
+@devnote
+ Insert into ip_nat_setup_info() function in file net/ipv4/netfilter/ip_nat_core.c
+*/
+int32 rtl865x_addNaptConnection(rtl865x_napt_entry *naptEntry, rtl865x_priority *prio);
+/*
+@func enum RTL_RESULT | rtl865x_delNaptConnection | Delete a NAPT Flow
+@parm enum RTL_NP_PROTOCOL | protocol | The protocol to delete
+@parm ipaddr_t | intIp | Internal IP address
+@parm uint32 | intPort | Internal Port
+@parm ipaddr_t | extIp | External IP address
+@parm uint32 | extPort | External Port
+@parm ipaddr_t | remIp | Remote IP address
+@parm uint32 | remPort | Remote Port
+@rvalue RTL_SUCCESS | Delete success
+@rvalue RTL_NONEXIST | Delete a non-existed flow
+@rvalue RTL_FAILED | General failure
+@comm
+ Delete a NAPT Flow Entry of L4 TCP/UDP NAPT Table(1024-Entry)
+@devnote
+ Insert into ip_nat_cleanup_conntrack() function in file net/ipv4/netfilter/ip_nat_core.c
+*/
+int32 rtl865x_delNaptConnection(rtl865x_napt_entry *naptEntry);
+
+int32 rtl865x_naptSync(rtl865x_napt_entry *naptEntry, uint32 refresh);
+
+#if defined (CONFIG_RTL_INBOUND_COLLISION_AVOIDANCE)
+int rtl865x_optimizeExtPort(unsigned short origDelta, unsigned int rangeSize, unsigned short *newDelta);
+
+int rtl865x_getAsicNaptHashScore(rtl865x_napt_entry *naptEntry,
+ uint32 *naptHashScore);
+
+int32 rtl865x_preReserveConn(rtl865x_napt_entry *naptEntry);
+
+#endif
+#if defined(CONFIG_RTL_HARDWARE_NAT)
+int32 rtl_nat_expire_interval_update(int proto, int32 interval);
+int32 rtl865x_nat_reinit(void);
+#endif
+
+#endif
+
diff --git a/target/linux/realtek/files/include/net/rtl/rtl865x_netif.h b/target/linux/realtek/files/include/net/rtl/rtl865x_netif.h index e2c0c956e..415d70266 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl865x_netif.h +++ b/target/linux/realtek/files/include/net/rtl/rtl865x_netif.h @@ -1,10 +1,10 @@ /* -* Copyright c Realtek Semiconductor Corporation, 2008 +* Copyright c Realtek Semiconductor Corporation, 2008 * All rights reserved. -* +* * Program : network interface driver header file -* Abstract : -* Author : hyking (hyking_liu@realsil.com.cn) +* Abstract : +* Author : hyking (hyking_liu@realsil.com.cn) */ #ifndef RTL865X_NETIF_H @@ -28,7 +28,7 @@ #if 1 //def CONFIG_RTL_LAYERED_DRIVER_ACL typedef struct _rtl865x_AclRule_s { - union + union { /* MAC ACL rule */ struct { @@ -36,7 +36,7 @@ typedef struct _rtl865x_AclRule_s ether_addr_t _srcMac, _srcMacMask; uint16 _typeLen, _typeLenMask; } MAC; - + /* IP Group ACL rule */ struct { @@ -50,31 +50,31 @@ typedef struct _rtl865x_AclRule_s { uint8 _proto, _protoMask, _flagMask;// flag & flagMask only last 3-bit is meaning ful uint32 _FOP:1, _FOM:1, _httpFilter:1, _httpFilterM:1, _identSrcDstIp:1, _identSrcDstIpM:1; - union + union { uint8 _flag; - struct + struct { uint8 pend1:5, pend2:1, _DF:1, //don't fragment flag _MF:1; //more fragments flag } s; - } un; - } ip; - + } un; + } ip; + /* ICMP ACL rule */ - struct + struct { uint8 _type, _typeMask, _code, _codeMask; - } icmp; - + } icmp; + /* IGMP ACL rule */ struct { uint8 _type, _typeMask; - } igmp; - + } igmp; + /* TCP ACL rule */ struct { @@ -94,20 +94,20 @@ typedef struct _rtl865x_AclRule_s _syn:1, //sync bit _fin:1; //fin bit }s; - }un; + }un; }tcp; - + /* UDP ACL rule */ - struct + struct { uint16 _srcPortUpperBound, _srcPortLowerBound; - uint16 _dstPortUpperBound, _dstPortLowerBound; - }udp; - }is; - }L3L4; + uint16 _dstPortUpperBound, _dstPortLowerBound; + }udp; + }is; + }L3L4; /* Source filter ACL rule */ - struct + struct { ether_addr_t _srcMac, _srcMacMask; uint16 _srcPort, _srcPortMask; @@ -117,9 +117,9 @@ typedef struct _rtl865x_AclRule_s uint32 _ignoreL4:1, //L2 rule _ignoreL3L4:1; //L3 rule } SRCFILTER; - + /* Destination filter ACL rule */ - struct + struct { ether_addr_t _dstMac, _dstMacMask; uint16 _vlanIdx, _vlanIdxMask; @@ -135,7 +135,7 @@ typedef struct _rtl865x_AclRule_s #endif }un_ty; - + uint32 ruleType_:5, actionType_:4, pktOpApp_:3, @@ -145,17 +145,17 @@ typedef struct _rtl865x_AclRule_s upDown_:1,//0: uplink acl rule for hw qos; 1: downlink acl rule for hw qos #endif nexthopIdx_:5, /* Index of nexthop table (NOT L2 table) */ /* used as network interface index for 865xC qos system */ - ratelimtIdx_:4; /* Index of rate limit table */ /* used as outputQueue index for 865xC qos system */ + ratelimtIdx_:4; /* Index of rate limit table */ /* used as outputQueue index for 865xC qos system */ + - uint32 netifIdx_:3, /*for redirect*/ pppoeIdx_:3, /*for redirect*/ L2Idx_:10, /* Index of L2 table */ inv_flag:8, /*mainly for iptables-->acl rule, when iptables rule has invert netif flag, this acl rule is added to other netifs*/ aclIdx:7; /* aisc entry idx */ - + struct _rtl865x_AclRule_s *pre,*next; - + }rtl865x_AclRule_t; @@ -203,7 +203,7 @@ typedef struct _rtl865x_AclRule_s /* ICMP ACL Rule Definition */ #define icmpType_ un_ty.L3L4.is.icmp._type -#define icmpTypeMask_ un_ty.L3L4.is.icmp._typeMask +#define icmpTypeMask_ un_ty.L3L4.is.icmp._typeMask #define icmpCode_ un_ty.L3L4.is.icmp._code #define icmpCodeMask_ un_ty.L3L4.is.icmp._codeMask @@ -323,6 +323,7 @@ typedef struct _rtl865x_AclRule_s #define RTL865X_ACLTBL_ALL_TO_CPU 127 // This rule is always "To CPU" #define RTL865X_ACLTBL_DROP_ALL 126 //This rule is always "Drop" #define RTL865X_ACLTBL_PERMIT_ALL 125 // This rule is always "Permit" +#define RTL865X_ACLTBL_IPV6_TO_CPU 124 #define MAX_IFNAMESIZE 16 #define NETIF_NUMBER 8 @@ -346,6 +347,12 @@ typedef struct _rtl865x_AclRule_s #define RTL_DRV_LAN_NETIF_NAME "eth0" #endif +#ifdef CONFIG_RTK_VLAN_WAN_TAG_SUPPORT +#define RTL_BR1_NAME "br1" +#define RTL_PS_BR1_DEV_NAME RTL_BR1_NAME +#define RTL_PS_ETH_NAME_ETH2 "eth2" +#endif + #define RTL_DRV_WAN0_NETIF_NAME "eth1" #if defined(CONFIG_RTL_MULTIPLE_WAN) #define RTL_DRV_WAN1_NETIF_NAME "eth6" @@ -359,93 +366,133 @@ typedef struct _rtl865x_AclRule_s #define RTL_DRV_LAN_P4_NETIF_NAME RTL_DRV_WAN0_NETIF_NAME #define RTL_DRV_LAN_P5_NETIF_NAME "eth5" +#if defined(CONFIG_RTK_VLAN_NEW_FEATURE) +#define RTL_DRV_LAN_P7_NETIF_NAME "eth7" +#endif + + /************************************ * const variable defination *************************************/ #define RTL_WANVLANID 8 #define RTL_LANVLANID 9 + #if defined(CONFIG_RTL_MULTIPLE_WAN) #define RTL_WAN_1_VLANID 369 #endif + #if defined(CONFIG_RTL8196_RTL8366) - #define RTL_WANPORT_MASK 0x1C1 - #define RTL_LANPORT_MASK 0x1C1 - #define RTL8366RB_GMIIPORT 0x20 - #define RTL8366RB_LANPORT 0xCf - #define RTL8366RB_WANPORT 0x10 + #define RTL_WANPORT_MASK 0x1C1 + #define RTL_LANPORT_MASK 0x1C1 + #define RTL8366RB_GMIIPORT 0x20 + #define RTL8366RB_LANPORT 0xCf + #define RTL8366RB_WANPORT 0x10 + #elif defined(CONFIG_RTL_819X) && (defined(CONFIG_RTK_VLAN_SUPPORT) || defined (CONFIG_RTL_MULTI_LAN_DEV)) -#if defined (CONFIG_POCKET_ROUTER_SUPPORT) - #define RTL_WANPORT_MASK 0x10 - #define RTL_LANPORT_MASK 0x10 -#elif defined(CONFIG_RTL_PUBLIC_SSID) - #define RTL_WANPORT_MASK 0x110 //port 4/port 8 - #define RTL_LANPORT_MASK 0x10f -#elif defined(CONFIG_8198_PORT5_RGMII) - #define RTL_WANPORT_MASK 0x10 - #define RTL_LANPORT_MASK 0x12f -#else - #if defined (CONFIG_RTL_8196C_iNIC) - #define RTL_WANPORT_MASK 0x01 - #define RTL_LANPORT_MASK 0x110 //mark_inic , only port4 connect to MII - #elif defined (CONFIG_RTK_INBAND_HOST_HACK) - #if defined (CONFIG_8198_PORT5_GMII) - #define RTL_WANPORT_MASK 0x120 //port5 ,hack port,eth1 - #define RTL_LANPORT_MASK 0x11f // 0~4 port eth0 + #if defined (CONFIG_POCKET_ROUTER_SUPPORT) + #define RTL_WANPORT_MASK 0x10 + #define RTL_LANPORT_MASK 0x10 + + #elif defined(CONFIG_RTL_PUBLIC_SSID) + #define RTL_WANPORT_MASK 0x110 //port 4/port 8 + #define RTL_LANPORT_MASK 0x10f + + #elif defined(CONFIG_8198_PORT5_RGMII) + #define RTL_WANPORT_MASK 0x10 + #define RTL_LANPORT_MASK 0x12f + #else + #if defined (CONFIG_RTL_8196C_iNIC) + #define RTL_WANPORT_MASK 0x01 + #define RTL_LANPORT_MASK 0x110 //mark_inic, only port4 connect to MII + #elif defined (CONFIG_RTK_INBAND_HOST_HACK) + #if defined (CONFIG_8198_PORT5_GMII) + #define RTL_WANPORT_MASK 0x120 //port5, hack port,eth1 + #define RTL_LANPORT_MASK 0x11f //0~4 port eth0 + #else + #define RTL_WANPORT_MASK 0x110 //port4(port0 in some board) is eth1 + #define RTL_LANPORT_MASK 0x12f //0 1 2 3 5 port are eth0 + #endif + #elif defined (CONFIG_8198_PORT5_GMII) + #define RTL_WANPORT_MASK 0x10 //port0 + #define RTL_LANPORT_MASK 0x12f //all port eth0 + #elif defined (CONFIG_RTL_89xxD) + #define RTL_WANPORT_MASK 0x01 //port0 + #define RTL_LANPORT_MASK 0x11e //all port eth0 + #elif defined (CONFIG_RTL_8196EU) + #define RTL_WANPORT_MASK 0x01f + #define RTL_LANPORT_MASK 0x11f #else - #define RTL_WANPORT_MASK 0x110 //port4(port0 in some board) is eth1 - #define RTL_LANPORT_MASK 0x12f // 0 1 2 3 5 port are eth0 + // 8196e, 8196c are here? + #define RTL_WANPORT_MASK 0x10 + #define RTL_LANPORT_MASK 0x10f #endif - #elif defined (CONFIG_8198_PORT5_GMII) - #define RTL_WANPORT_MASK 0x10 //port0 - #define RTL_LANPORT_MASK 0x12f //all port eth0 + #endif + + #if defined(CONFIG_RTL_89xxD) + #define RTL_LANPORT_MASK_1 0x2 //port 1 + #define RTL_LANPORT_MASK_2 0x4 //port 2 + #define RTL_LANPORT_MASK_3 0x8 //port 3 + #define RTL_LANPORT_MASK_4 0x10 //port 4 #else - #define RTL_WANPORT_MASK 0x10 - #define RTL_LANPORT_MASK 0x10f - #endif -#endif - #define RTL_LANPORT_MASK_1 0x8 //port 0 - #define RTL_LANPORT_MASK_2 0x4 //port 1 - #define RTL_LANPORT_MASK_3 0x2 //port 2 - #define RTL_LANPORT_MASK_4 0x1 //port 3 + #define RTL_LANPORT_MASK_1 0x8 //port 0 + #define RTL_LANPORT_MASK_2 0x4 //port 1 + #define RTL_LANPORT_MASK_3 0x2 //port 2 + #define RTL_LANPORT_MASK_4 0x1 //port 3 + #endif + #ifdef CONFIG_8198_PORT5_GMII - #define RTL_LANPORT_MASK_5 0x20 //port 5 + #define RTL_LANPORT_MASK_5 0x20 //port 5 #endif + #elif defined(CONFIG_RTL_8198_NFBI_BOARD) - #define RTL_WANPORT_MASK 0x1e0 //port 5, port 6,port 7,port 8 - #define RTL_LANPORT_MASK 0x1df //port 0~4 , port 6~8 , need port4 ?? + #define RTL_WANPORT_MASK 0x1e0 //port 5, port 6,port 7,port 8 + #define RTL_LANPORT_MASK 0x1df //port 0~4 , port 6~8 , need port4 ?? + #elif defined(CONFIG_8198_PORT5_GMII) - #define RTL_WANPORT_MASK 0x110 - #define RTL_LANPORT_MASK 0x1ef + #define RTL_WANPORT_MASK 0x110 + #define RTL_LANPORT_MASK 0x1ef + #elif defined (CONFIG_POCKET_ROUTER_SUPPORT) - #define RTL_WANPORT_MASK 0x10 - #define RTL_LANPORT_MASK 0x10 + #define RTL_WANPORT_MASK 0x10 + #define RTL_LANPORT_MASK 0x10 + #elif defined(CONFIG_RTL_PUBLIC_SSID) - #define RTL_WANPORT_MASK 0x110 //port 4/port 8 -#elif defined(CONFIG_RTL8186_KB_N) || defined(CONFIG_RTL_819X) /* defined(CONFIG_RTL8196_RTL8366) */ + #define RTL_WANPORT_MASK 0x110 //port 4/port 8 + +#elif defined(CONFIG_RTL8186_KB_N) || defined(CONFIG_RTL_819X) /*defined(CONFIG_RTL8196_RTL8366)*/ #ifdef CONFIG_RTL_8196C_iNIC - #define RTL_WANPORT_MASK 0x01 - #define RTL_LANPORT_MASK 0x110 //mark_inic , only port4 connect to MII + #define RTL_WANPORT_MASK 0x01 + #define RTL_LANPORT_MASK 0x110 //mark_inic, only port4 connect to MII #else - #define RTL_WANPORT_MASK 0x10 - #define RTL_LANPORT_MASK 0x10f + #define RTL_WANPORT_MASK 0x10 + #define RTL_LANPORT_MASK 0x10f #endif + #else #define RTL_WANPORT_MASK 0x01 - #define RTL_LANPORT_MASK 0x11e /* port1/2/3/4/cpu port(port 8) */ + #define RTL_LANPORT_MASK 0x11e /* port1/2/3/4/cpu port(port 8) */ #if defined(CONFIG_RTK_VLAN_SUPPORT) || defined (CONFIG_RTL_MULTI_LAN_DEV) - #define RTL_LANPORT_MASK_1 0x2 //port 1 - #define RTL_LANPORT_MASK_2 0x4 //port 2 - #define RTL_LANPORT_MASK_3 0x8 //port 3 - #define RTL_LANPORT_MASK_4 0x10 //port 4 + #define RTL_LANPORT_MASK_1 0x2 //port 1 + #define RTL_LANPORT_MASK_2 0x4 //port 2 + #define RTL_LANPORT_MASK_3 0x8 //port 3 + #define RTL_LANPORT_MASK_4 0x10 //port 4 #endif -#endif /* defined(CONFIG_RTL8186_KB_N) || defined(CONFIG_RTL_819X) */ +#endif /* defined(CONFIG_RTL8186_KB_N) || defined(CONFIG_RTL_819X) */ -#if defined(CONFIG_RTK_VLAN_SUPPORT) || defined (CONFIG_RTL_MULTI_LAN_DEV) +#if defined(CONFIG_RTK_VLAN_SUPPORT) || defined (CONFIG_RTL_MULTI_LAN_DEV) #if defined(CONFIG_8198_PORT5_GMII) +#if defined(CONFIG_RTK_VLAN_NEW_FEATURE) + #define ETH_INTF_NUM 7 +#else + #define ETH_INTF_NUM 6 +#endif +#else +#if defined(CONFIG_RTK_VLAN_NEW_FEATURE) #define ETH_INTF_NUM 6 #else #define ETH_INTF_NUM 5 #endif +#endif #else #define ETH_INTF_NUM 2 #endif @@ -453,17 +500,17 @@ typedef struct _rtl865x_AclRule_s typedef struct rtl865x_netif_s { uint16 vid; /*netif->vid*/ - uint16 mtu; /*netif's MTU*/ - uint32 if_type:5; /*interface type, 0:ether,1:pppoe....*/ + uint16 mtu; /*netif's MTU*/ + uint32 if_type:5; /*interface type, 0:ether,1:pppoe....*/ ether_addr_t macAddr; uint32 is_wan:1, /*wan interface?*/ dmz:1, /*DMZ/routing lan*/ is_slave:1; /*is slave interface?*/ - uint8 name[MAX_IFNAMESIZE]; + uint8 name[MAX_IFNAMESIZE]; uint16 enableRoute; -#if defined (CONFIG_RTL_LOCAL_PUBLIC) +#if defined (CONFIG_RTL_LOCAL_PUBLIC) ||defined(CONFIG_RTL_MULTIPLE_WAN) uint16 forMacBasedMCast; -#endif +#endif }rtl865x_netif_t; /*internal...*/ @@ -493,6 +540,15 @@ int rtl865x_del_pattern_acl_for_contentFilter(rtl865x_AclRule_t *rule,char *net int32 rtl865x_acl_test(int32 testNo); #endif + +//#define CONFIG_RTL_IPTABLES2ACL_PATCH 1 +#if defined(CONFIG_RTL_IPTABLES2ACL_PATCH) +int32 rtl865x_add_sw_acl(rtl865x_AclRule_t *rule, char *netifName,int32 priority); +int32 _rtl865x_synAclwithAsicTbl(void); +int32 rtl865x_flush_allAcl_sw_fromChain(char *netifName, int32 priority, uint32 flag); +#endif + + int32 rtl865x_deReferNetif(char *ifName); int32 rtl865x_referNetif(char *ifName); int32 rtl865x_setNetifMtu(rtl865x_netif_t *netif); diff --git a/target/linux/realtek/files/include/net/rtl/rtl_nic.h b/target/linux/realtek/files/include/net/rtl/rtl_nic.h index c911b7de9..8f2b212b7 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl_nic.h +++ b/target/linux/realtek/files/include/net/rtl/rtl_nic.h @@ -15,8 +15,11 @@ #define RTL819X_PRIV_IOCTL_ENABLE 1 /* mark_add */ #define CONFIG_RTL_PHY_PATCH 1 #define RTK_QUE 1 -#if defined(CONFIG_NET_WIRELESS_AGN) || defined (CONFIG_RTL8192SE) || defined(CONFIG_RTL8192CD) || defined(CONFIG_RTL8192CD_MODULE) -#define BR_SHORTCUT 1 +#if defined(CONFIG_NET_WIRELESS_AGN) || defined (CONFIG_RTL8192SE) || defined(CONFIG_RTL8192CD) || defined(CONFIG_RTL8192CD_MODULE) || defined(CONFIG_RTL8192E) +#if !defined(CONFIG_RTL_FASTBRIDGE) +#define BR_SHORTCUT 1 +#define BR_SHORTCUT_C2 1 +#endif #endif /* *#define CONFIG_RTL_MULTI_LAN_DEV 1 @@ -106,7 +109,7 @@ struct dev_priv { u32 opened; u32 irq_owner; //record which dev request IRQ struct net_device_stats net_stats; -#if defined(DYNAMIC_ADJUST_TASKLET) || defined(CONFIG_RTL8186_TR) || defined(BR_SHORTCUT) || defined(CONFIG_RTL8196C_REVISION_B) || defined(CONFIG_RTL_8198) +#if defined(DYNAMIC_ADJUST_TASKLET) || defined(CONFIG_RTL8186_TR) || defined(BR_SHORTCUT) || defined(CONFIG_RTL8196C_REVISION_B) || defined(CONFIG_RTL_8198) || defined(CONFIG_RTL_819XD) || defined(CONFIG_RTL_8196E) struct timer_list expire_timer; #endif @@ -254,7 +257,7 @@ typedef struct _ps_drv_netif_mapping_s int32 rtl865x_changeOpMode(int mode); #if defined(CONFIG_RTL_ETH_PRIV_SKB) -__MIPS16 __IRAM_FWD int is_rtl865x_eth_priv_buf(unsigned char *head); +__MIPS16 __IRAM_FWD int is_rtl865x_eth_priv_buf(unsigned char *head); void free_rtl865x_eth_priv_buf(unsigned char *head); #endif @@ -265,10 +268,14 @@ int rtl_del_ps_drv_netif_mapping(struct net_device *dev); #if defined(CONFIG_RTK_VLAN_SUPPORT) && defined(CONFIG_RTK_VLAN_FOR_CABLE_MODEM) extern struct net_device* get_dev_by_vid(int vid); #endif -extern __MIPS16 struct net_device *get_shortcut_dev(unsigned char *da); +extern __MIPS16 struct net_device *get_shortcut_dev(unsigned char *da); #define CONFIG_RTL_NIC_HWSTATS int32 rtl865x_changeOpMode(int mode); int rtl865x_reChangeOpMode (void); +#if defined(CONFIG_RTL_HW_VLAN_SUPPORT) +extern int rtl_hw_vlan_ignore_tagged_mc; +#endif + #endif diff --git a/target/linux/realtek/files/include/net/rtl/rtl_types.h b/target/linux/realtek/files/include/net/rtl/rtl_types.h index cdd29436e..2b662c5bc 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl_types.h +++ b/target/linux/realtek/files/include/net/rtl/rtl_types.h @@ -243,9 +243,10 @@ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) #include <linux/config.h> #endif -#include <linux/ctype.h> +//#include <linux/ctype.h> #include <linux/module.h> -#include <linux/string.h> +//#include <linux/string.h> + #endif /*__KERNEL__*/ #endif /*__linux__*/ @@ -361,8 +362,8 @@ print macro =============================================================================== */ #if defined(__linux__)&&defined(__KERNEL__) - - #define rtlglue_printf printk + + #define rtlglue_printf panic_printk #else /* defined(__linux__)&&defined(__KERNEL__) */ @@ -418,7 +419,11 @@ typedef struct ether_addr_s { uint8 octet[ETHER_ADDR_LEN]; } ether_addr_t; +#if defined(CONFIG_RTL_ULINKER_BRSC) +#define RX_OFFSET 4 +#else #define RX_OFFSET 2 +#endif #define MBUF_LEN 1700 #define CROSS_LAN_MBUF_LEN (MBUF_LEN+RX_OFFSET+10) @@ -547,12 +552,6 @@ typedef struct ether_addr_s { #define CACHED(addr) ((uint32)(addr) & ~(UNCACHE_MASK)) #endif -#if defined(CONFIG_RTL_PROC_DEBUG) -#define RTL865X_DRIVER_DEBUG_FLAG /*flag for debug*/ -#else -#undef RTL865X_DRIVER_DEBUG_FLAG /*flag for debug*/ -#endif - /* asic configuration */ #define RTL8651_OUTPUTQUEUE_SIZE 6 #define TOTAL_VLAN_PRIORITY_NUM 8 @@ -560,14 +559,102 @@ typedef struct ether_addr_s { #if defined(CONFIG_RTL_8196C) #define CONFIG_RTL8196C_ETH_IOT 1 -#ifdef CONFIG_RTL_WTDOG -#define CONFIG_RTL_8196C_ESD 1 +#ifdef CONFIG_MP_PSD_SUPPORT +#undef CONFIG_RTL8196C_GREEN_ETHERNET +#else +//#define CONFIG_RTL_8196C_ESD 1 #endif #endif -#if defined(CONFIG_RTL_8198) && defined(CONFIG_RTL_WTDOG) +#if defined(CONFIG_RTL_8198) && !defined(CONFIG_RTL_819XD) #define CONFIG_RTL_8198_ESD 1 #endif +#if defined(CONFIG_RTL_8198) +#define RTL8198_EEE_MAC 1 +#endif + +#if defined(CONFIG_RTL_819XD) || defined(CONFIG_RTL_8196E) +#define CONFIG_RTL_8197D_DYN_THR 1 +#endif + +#define DYN_THR_LINK_UP_PORTS 3 + +/* IC default value */ +#define DYN_THR_DEF_fcON 0xac +#define DYN_THR_DEF_fcOFF 0xa0 +#define DYN_THR_DEF_sharedON 0x62 +#define DYN_THR_DEF_sharedOFF 0x4a + +/* aggressive value */ +#define DYN_THR_AGG_fcON 0xd0 +#define DYN_THR_AGG_fcOFF 0xa0 // 0xc0 +#if defined(CONFIG_RTL_819XDT) +#define DYN_THR_AGG_sharedON 0xa0 +#define DYN_THR_AGG_sharedOFF 0x88 +#else +#define DYN_THR_AGG_sharedON 0x88 // 0xc0 +#define DYN_THR_AGG_sharedOFF 0x70 // 0xa8 +#endif + +#if defined(CONFIG_RTL_LOG_DEBUG) +extern int scrlog_printk(const char * fmt, ...); + +extern struct RTL_LOG_PRINT_MASK +{ + uint32 ERROR:1; + uint32 WARN:1; + uint32 INFO:1; +}RTL_LogTypeMask; + +extern struct RTL_LOG_ERROR_MASK +{ + uint32 MEM:1; + uint32 SKB:1; +}RTL_LogErrorMask; +extern uint32 RTL_LogRatelimit; + +extern struct RTL_LOG_MODULE_MASK +{ + uint8 NIC:1; + uint8 WIRELESS:1; + uint8 PROSTACK:1; +}RTL_LogModuleMask; + + +#define LOG_LIMIT (!RTL_LogRatelimit||net_ratelimit()) + + +#define LOG_ERROR(fmt, args...) do{ \ + if(RTL_LogTypeMask.ERROR&&LOG_LIMIT)scrlog_printk("ERROR:"fmt, ## args); \ + }while(0) + +#define LOG_MEM_ERROR(fmt, args...) do{ \ + if(RTL_LogTypeMask.ERROR&&RTL_LogErrorMask.MEM&&LOG_LIMIT)scrlog_printk("ERROR:"fmt, ## args); \ + }while(0) + +#define LOG_SKB_ERROR(fmt, args...) do{ \ + if(RTL_LogTypeMask.ERROR&&RTL_LogErrorMask.SKB&&LOG_LIMIT)scrlog_printk("ERROR:"fmt, ## args); \ + }while(0) + +#define LOG_WARN(fmt, args...) do{ \ + if(RTL_LogTypeMask.WARN&&LOG_LIMIT)scrlog_printk("WARN:"fmt, ## args); \ + }while(0) + +#define LOG_INFO(fmt, args...) do{ \ + if(RTL_LogTypeMask.INFO&&LOG_LIMIT)scrlog_printk("INFO:"fmt, ## args); \ + }while(0) + +#else + +#define LOG_ERROR(fmt, args...) +#define LOG_MEM_ERROR(fmt, args...) +#define LOG_SKB_ERROR(fmt, args...) +#define LOG_WARN(fmt, args...) +#define LOG_INFO(fmt, args...) + +#endif + #endif + |