kernel/prism: Marvell patches for kernel/prism
Change-Id: Ie97701dd7157f77c4f229724b75f8054011fa81a
diff --git a/arch/arm/mach-feroceon-kw2/Makefile b/arch/arm/mach-feroceon-kw2/Makefile
index bf5e8a9..a71da62 100755
--- a/arch/arm/mach-feroceon-kw2/Makefile
+++ b/arch/arm/mach-feroceon-kw2/Makefile
@@ -81,7 +81,7 @@
OSSERVICES_OBJS = $(OSSERV_DIR)/mvOs.o
-HAL_OBJS = $(HAL_DRAM_SPD_DIR)/mvSpd.o \
+HAL_OBJS = $(HAL_RTC_DIR)/mvRtc.o $(HAL_DRAM_SPD_DIR)/mvSpd.o \
$(HAL_CNTMR_DIR)/mvCntmr.o \
$(HAL_TWSI_DIR)/mvTwsi.o \
$(HAL_UART_DIR)/mvUart.o $(HAL_GPP_DIR)/mvGpp.o \
@@ -116,7 +116,7 @@
$(HAL_NOR_DIR)/mvFlashCom.o $(HAL_NOR_DIR)/mvIntelFlash.o
LSP_OBJS = $(LSP_DIR)/core.o $(LSP_DIR)/irq.o $(LSP_DIR)/time.o \
- $(LSP_DIR)/leds.o $(LSP_DIR)/sysmap.o \
+ $(LSP_DIR)/leds.o $(LSP_DIR)/sysmap.o $(LSP_DIR)/rtc.o \
$(LSP_DIR)/export.o $(LSP_DIR)/clock.o
obj-y := feroceon.o
@@ -130,7 +130,6 @@
$(HAL_IF_DIR)/mvSysPex.o $(HAL_PEX_DIR)/mvPexAddrDec.o
feroceon-$(CONFIG_MV_INCLUDE_USB) += $(HAL_USB_DIR)/mvUsb.o $(HAL_USB_DIR)/mvUsbAddrDec.o \
$(HAL_IF_DIR)/mvSysUsb.o
-feroceon-$(CONFIG_MV_INCLUDE_RTC) += $(HAL_RTC_DIR)/mvRtc.o $(LSP_DIR)/rtc.o
feroceon-y += $(HAL_ETHPHY_DIR)/mvEthPhy.o $(HAL_IF_DIR)/mvSysEthPhy.o
ifneq ($(CONFIG_MV_ETH_NFP),m)
diff --git a/arch/arm/mach-feroceon-kw2/core.c b/arch/arm/mach-feroceon-kw2/core.c
index 2c725e0..d972a30 100755
--- a/arch/arm/mach-feroceon-kw2/core.c
+++ b/arch/arm/mach-feroceon-kw2/core.c
@@ -158,11 +158,11 @@
gBoardId = (mvUbootVer & 0xff);
#ifdef CONFIG_MACH_GFLT110
if ((gBoardId != GFLT110_ID) && (gBoardId != GFLT300_ID)) {
- printk("unknown boardID from uboot:%x defaulting to GFLT110\n", gBoardId);
+ printk("Unknown boardId from uboot: %x: Defaulting to GFLT110.\n", gBoardId);
gBoardId = GFLT110_ID;
}
#endif
- printk("BoardId:%x\n", mvBoardIdGet());
+ printk("Google BoardId: %x\n", mvBoardIdGet());
#ifdef CONFIG_MV_INCLUDE_GIG_ETH
for (i = 0; i < CONFIG_MV_ETH_PORTS_NUM; i++) {
#if defined (CONFIG_OVERRIDE_ETH_CMDLINE)
@@ -356,6 +356,7 @@
},
};
+#if 0
static struct resource mv_uart1_resources[] = {
{
.start = PORT1_BASE,
@@ -368,6 +369,7 @@
.flags = IORESOURCE_IRQ,
},
};
+#endif
static struct plat_serial8250_port mv_uart0_data[] = {
{
@@ -401,7 +403,7 @@
{ },
};
-static struct platform_device mv_uart0 = {
+static struct platform_device mv_uart = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
@@ -411,21 +413,11 @@
.resource = mv_uart0_resources,
};
-static struct platform_device mv_uart1 = {
- .name = "serial8250",
- .id = PLAT8250_DEV_PLATFORM1,
- .dev = {
- .platform_data = mv_uart1_data,
- },
- .num_resources = 2, /*ARRAY_SIZE(mv_uart_resources),*/
- .resource = mv_uart1_resources,
-};
static void serial_initialize(void)
{
mv_uart0_data[0].uartclk = mv_uart1_data[0].uartclk = mvTclk;
- platform_device_register(&mv_uart0);
- platform_device_register(&mv_uart1);
+ platform_device_register(&mv_uart);
}
#if defined(CONFIG_MV_INCLUDE_SDIO)
diff --git a/arch/arm/mach-feroceon-kw2/include/mach/system.h b/arch/arm/mach-feroceon-kw2/include/mach/system.h
index 527509b..5b5a6b2 100644
--- a/arch/arm/mach-feroceon-kw2/include/mach/system.h
+++ b/arch/arm/mach-feroceon-kw2/include/mach/system.h
@@ -31,7 +31,7 @@
cpu_do_idle();
}
-#define UPON_SDK_VERSION "uPON_2.7.25_RC24"
+#define UPON_SDK_VERSION "uPON_2.7.25_RC32"
#ifdef __BIG_ENDIAN
#define MV_ARM_32BIT_LE(X) ((((X)&0xff)<<24) | \
diff --git a/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvLib.h b/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvLib.h
index 5fc8a50..7f72bf7 100755
--- a/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvLib.h
+++ b/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvLib.h
@@ -316,7 +316,8 @@
BOARD_GPP_PON_LED,
BOARD_GPP_PON_XVR_TX_POWER,
BOARD_GPP_PON_XVR_TX_IND,
- BOARD_GPP_OTHER
+ BOARD_GPP_OTHER,
+ BOARD_GPP_PON_ALARM
} MV_BOARD_GPP_CLASS;
typedef struct _devCsInfo {
diff --git a/arch/arm/plat-feroceon/Kconfig b/arch/arm/plat-feroceon/Kconfig
index 13cd540..238bbfc 100755
--- a/arch/arm/plat-feroceon/Kconfig
+++ b/arch/arm/plat-feroceon/Kconfig
@@ -411,7 +411,6 @@
source arch/arm/plat-feroceon/mv_drivers_lsp/mv_mac_learn/Kconfig
-
config SCSI_MVSATA
tristate "Support for Marvell Sata Adapters"
depends on ( MV_INCLUDE_INTEG_SATA && SCSI ) || ( PCI && SCSI )
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_ezxml/ezxml.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_ezxml/ezxml.c
index 13c237d..6e0ccfc 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_ezxml/ezxml.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_ezxml/ezxml.c
@@ -343,10 +343,14 @@
while (root->pi[i] && strcmp(target, root->pi[i][0])) i++; // find target
if (! root->pi[i]) { // new target
root->pi = realloc(root->pi, sizeof(char **) * (i + 2));
- root->pi[i] = malloc(sizeof(char *) * 3);
- root->pi[i][0] = target;
- root->pi[i][1] = (char *)(root->pi[i + 1] = NULL); // terminate pi list
- root->pi[i][2] = strdup(""); // empty document position list
+ if( root->pi == NULL)
+ {
+ return;
+ }
+ root->pi[i] = malloc(sizeof(char *) * 3);
+ root->pi[i][0] = target;
+ root->pi[i][1] = (char *)(root->pi[i + 1] = NULL); // terminate pi list
+ root->pi[i][2] = strdup(""); // empty document position list
}
while (root->pi[i][j]) j++; // find end of instruction list for this target
@@ -430,9 +434,13 @@
root->attr = (! i) ? malloc(2 * sizeof(char **))
: realloc(root->attr,
(i + 2) * sizeof(char **));
- root->attr[i] = malloc(2 * sizeof(char *));
- root->attr[i][0] = t; // set tag name
- root->attr[i][1] = (char *)(root->attr[i + 1] = NULL);
+ if( root->attr == NULL)
+ {
+ return NULL;
+ }
+ root->attr[i] = malloc(2 * sizeof(char *));
+ root->attr[i][0] = t; // set tag name
+ root->attr[i][1] = (char *)(root->attr[i + 1] = NULL);
}
for (j = 1; root->attr[i][j]; j += 3); // find end of list
@@ -481,6 +489,10 @@
}
while (l + 6 > max) u = realloc(u, max += EZXML_BUFSIZE);
+ if( u == NULL)
+ {
+ return NULL;
+ }
if (c < 0x80) u[l++] = c; // US-ASCII subset
else { // multi-byte UTF-8 sequence
for (b = 0, d = c; d; d /= 2) b++; // bits in c
@@ -543,6 +555,10 @@
for (l = 0; *s && *s != '/' && *s != '>'; l += 2) { // new attrib
attr = (l) ? realloc(attr, (l + 4) * sizeof(char *))
: malloc(4 * sizeof(char *)); // allocate space
+ if (attr == NULL)
+ {
+ return NULL;
+ }
attr[l + 3] = (l) ? realloc(attr[l + 1], (l / 2) + 2)
: malloc(2); // mem for list of maloced vals
strcpy(attr[l + 3] + (l / 2), " "); // value is not malloced
@@ -979,6 +995,7 @@
if (! value) return xml; // nothing to do
if (xml->attr == EZXML_NIL) { // first attribute
xml->attr = malloc(4 * sizeof(char *));
+ if (xml->attr == NULL) return NULL;
xml->attr[1] = strdup(""); // empty list of malloced names/vals
}
else xml->attr = realloc(xml->attr, (l + 4) * sizeof(char *));
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_gpio/mv_gpio.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_gpio/mv_gpio.c
index 1d92103..0fbf113 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_gpio/mv_gpio.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_gpio/mv_gpio.c
@@ -16,6 +16,7 @@
#include <linux/bitops.h>
#include <linux/io.h>
#include <linux/gpio.h>
+#include <linux/platform_device.h>
#include "mvCommon.h"
#include "mvOs.h"
@@ -141,6 +142,21 @@
return -EINVAL;
}
+
+
+struct mv_gpio_regs {
+ int data_out;
+ int data_out_enable;
+ int blink_enable;
+ int data_in_polarity;
+ int interrupt_mask;
+ int interrupt_level_mask;
+ int blink_cntr_select;
+};
+
+#define MV_GPP_MAX_REG_SET (MV_GPP_MAX_PINS/32)
+static struct mv_gpio_regs regs[MV_GPP_MAX_REG_SET];
+
static struct gpio_chip mv_gpiochip = {
.label = "mv_gpio",
.direction_input = mv_gpio_direction_input,
@@ -153,8 +169,88 @@
.can_sleep = 0,
};
+
+static int mv_gpio_probe(struct platform_device *dev)
+{
+ gpiochip_add(&mv_gpiochip);
+
+ return 0;
+}
+
+static int mv_gpio_suspend(struct platform_device *dev, pm_message_t state)
+{
+ int i;
+ pr_info("Suspending GPIO\n");
+
+ for(i = 0; i < MV_GPP_MAX_REG_SET; i++)
+ {
+ regs[i].data_out = MV_REG_READ(GPP_DATA_OUT_REG(i));
+ regs[i].data_out_enable = MV_REG_READ(GPP_DATA_OUT_EN_REG(i));
+ regs[i].blink_enable = MV_REG_READ(GPP_BLINK_EN_REG(i));
+ regs[i].data_in_polarity = MV_REG_READ(GPP_DATA_IN_POL_REG(i));
+ regs[i].interrupt_mask = MV_REG_READ(GPP_INT_MASK_REG(i));
+ regs[i].interrupt_level_mask = MV_REG_READ(GPP_INT_LVL_REG(i));
+ regs[i].blink_cntr_select = MV_REG_READ(GPP_BLINK_SEL_REG(i));
+ }
+
+ return 0;
+}
+
+static int mv_gpio_resume(struct platform_device *dev)
+{
+ int i;
+ pr_info("Resuming GPIO\n");
+
+ for(i = 0; i < MV_GPP_MAX_REG_SET; i++)
+ {
+ MV_REG_WRITE(GPP_DATA_OUT_REG(i), regs[i].data_out);
+ MV_REG_WRITE(GPP_BLINK_EN_REG(i), regs[i].blink_enable);
+ MV_REG_WRITE(GPP_DATA_IN_POL_REG(i), regs[i].data_in_polarity);
+ MV_REG_WRITE(GPP_INT_MASK_REG(i), regs[i].interrupt_mask);
+ MV_REG_WRITE(GPP_INT_LVL_REG(i), regs[i].interrupt_level_mask);
+ MV_REG_WRITE(GPP_BLINK_SEL_REG(i), regs[i].blink_cntr_select);
+ MV_REG_WRITE(GPP_DATA_OUT_EN_REG(i), regs[i].data_out_enable);
+ }
+
+ return 0;
+}
+
+
+static struct platform_driver mv_gpio_driver = {
+ .probe = mv_gpio_probe,
+#ifdef CONFIG_PM
+ .suspend = mv_gpio_suspend,
+ .resume = mv_gpio_resume,
+#endif /* CONFIG_PM */
+ .driver = {
+ .name = "mv_gpio",
+ },
+};
+
void __init mv_gpio_init(void)
{
gpiochip_add(&mv_gpiochip);
}
+int __init mv_gpio_init_module(void)
+{
+ int i;
+
+ // Initialize struct
+ for(i = 0; i < MV_GPP_MAX_REG_SET; i++)
+ {
+ regs[i].data_out = MV_REG_READ(GPP_DATA_OUT_REG(i));
+ regs[i].data_out_enable = MV_REG_READ(GPP_DATA_OUT_EN_REG(i));
+ regs[i].blink_enable = MV_REG_READ(GPP_BLINK_EN_REG(i));
+ regs[i].data_in_polarity = MV_REG_READ(GPP_DATA_IN_POL_REG(i));
+ regs[i].interrupt_mask = MV_REG_READ(GPP_INT_MASK_REG(i));
+ regs[i].interrupt_level_mask = MV_REG_READ(GPP_INT_LVL_REG(i));
+ regs[i].blink_cntr_select = MV_REG_READ(GPP_BLINK_SEL_REG(i));
+ }
+
+ return platform_driver_register(&mv_gpio_driver);
+}
+
+module_init(mv_gpio_init_module);
+MODULE_DESCRIPTION("Marvell GPIO Driver");
+MODULE_LICENSE("GPL");
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mac_learn/mv_mac_learn_sysfs.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mac_learn/mv_mac_learn_sysfs.c
index 5831e77..610b17e 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mac_learn/mv_mac_learn_sysfs.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mac_learn/mv_mac_learn_sysfs.c
@@ -460,16 +460,16 @@
int sfs_mac_learn_enable_get(char *buf)
{
int off = 0;
- char result[8];
+ char result[9];
bool mac_learn_enable;
if (mv_mac_learn_enable_get(&mac_learn_enable)) {
- memcpy(result, "failed", 8);
+ memcpy(result, "failed", strlen("failed")+1);
} else {
if (true == mac_learn_enable)
- memcpy(result, "enable", 8);
+ memcpy(result, "enable", strlen("enable")+1);
else
- memcpy(result, "disable", 8);
+ memcpy(result, "disable", strlen("disable")+1);
}
off += sprintf(buf+off, "\nmac learn enable get: %s\n", result);
@@ -489,12 +489,12 @@
bool mac_learn_enable;
if (mv_mac_learn_overwrite_enable_get(&mac_learn_enable)) {
- memcpy(result, "failed", 8);
+ memcpy(result, "failed", strlen("failed")+1);
} else {
if (true == mac_learn_enable)
- memcpy(result, "enable", 8);
+ memcpy(result, "enable", strlen("enable")+1);
else
- memcpy(result, "disable", 8);
+ memcpy(result, "disable", strlen("disable")+1);
}
off += sprintf(buf+off, "\nmac learn overwrite enable get: %s\n", result);
@@ -514,7 +514,7 @@
uint32_t max_count;
if (mv_mac_learn_max_count_get(&max_count)) {
- memcpy(result, "failed", 8);
+ memcpy(result, "failed", strlen("failed")+1);
off += sprintf(buf+off, "\nmac learn max count get: %s\n", result);
} else {
off += sprintf(buf+off, "\nmac learn max count get: %d\n", max_count);
@@ -536,7 +536,7 @@
uint32_t expire_time;
if (mv_mac_learn_expire_time_get(&expire_time)) {
- memcpy(result, "failed", 8);
+ memcpy(result, "failed", strlen("failed")+1);
off += sprintf(buf+off, "\nmac learn expire time get: %s\n", result);
} else {
off += sprintf(buf+off, "\nmac learn expire time get: %d(s)\n", expire_time);
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mtd/mflash.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mtd/mflash.c
index 0ae7d1c..bd08825 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mtd/mflash.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mtd/mflash.c
@@ -288,7 +288,7 @@
return -1;
}
- DB(printk("\nNotice: Marvell flash (%s) lock per sector is not supported!\n Locking the whole device.", mtd->name));
+ printk("\nNotice: Marvell flash (%s) lock per sector is not supported!\n Locking the whole device.", mtd->name);
return 0;
}
@@ -306,7 +306,7 @@
return -1;
}
- DB(printk("\nNotice: Marvell flash (%s) unlock per sector is not supported!\n Unlocking the whole device.", mtd->name));
+ printk("\nNotice: Marvell flash (%s) unlock per sector is not supported!\n Unlocking the whole device.", mtd->name);
return 0;
}
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mtd/sflash.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mtd/sflash.c
index 65eb0f4..cd7c20a 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mtd/sflash.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_mtd/sflash.c
@@ -341,7 +341,7 @@
}
sflash_enable_irqs(flags, sflash_in_irq);
- DB(printk("\nNotice: Serial SPI flash (%s) lock per sector is not supported!\n Locking the whole device.", mtd->name));
+ printk("\nNotice: Serial SPI flash (%s) lock per sector is not supported!\n Locking the whole device.", mtd->name);
return 0;
}
@@ -364,7 +364,7 @@
}
sflash_enable_irqs(flags, sflash_in_irq);
- DB(printk("\nNotice: Serial SPI flash (%s) unlock per sector is not supported!\n Unlocking the whole device.", mtd->name));
+ printk("\nNotice: Serial SPI flash (%s) unlock per sector is not supported!\n Unlocking the whole device.", mtd->name);
return 0;
}
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_neta/pnc/pnc_sysfs.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_neta/pnc/pnc_sysfs.c
index dd3fe7e..eb7517f 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_neta/pnc/pnc_sysfs.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_neta/pnc/pnc_sysfs.c
@@ -199,7 +199,10 @@
/* Remove last byte (new line) from the buffer */
int len = strlen(buf);
char *temp = mvOsMalloc(len + 1);
-
+ if(temp == NULL)
+ {
+ return -ENOMEM;
+ }
strncpy(temp, buf, len-1);
temp[len-1] = 0;
tcam_sw_text(&te, temp);
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuAlrm.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuAlrm.c
index 21cd82c..dfe5a4e 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuAlrm.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuAlrm.c
@@ -220,6 +220,17 @@
onuEponPreviousAlarm = onuEponCurrentAlarmState;
}
+#ifdef PON_ALARM_LED
+ // PM: Generate PON alarm signal for Intelbras
+ if((onuEponCurrentAlarmState) == 0)
+ {
+ onuPonLedHandler(ONU_PON_ALARM_LED, ACTIVE_LED_OFF);
+ }
+ else
+ {
+ onuPonLedHandler(ONU_PON_ALARM_LED, ACTIVE_LED_ON);
+ }
+#endif
}
/*******************************************************************************
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuIsr.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuIsr.c
index ee603fc..3e12a2b 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuIsr.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/epon/eponOnuIsr.c
@@ -210,6 +210,7 @@
mvPonPrint(PON_PRINT_DEBUG, PON_ISR_RAND_MODULE,
"DEBUG: (%s:%d) ResetRandomStateMachine %s\n", __FILE_DESC__, __LINE__);
onuEponIsrResetRandomStateMachine();
+
/* Call link status callback function */
if (onuEponDbModeGet() == E_EPON_IOCTL_P2P_MODE)
{
@@ -235,7 +236,6 @@
onuEponDbModeSet(E_EPON_IOCTL_STD_MODE);
}
-
/* config PCS synchronization configuration - FEC disabled */
mvOnuEponMacPcsDelaySet(0x1C58);
/* clear Rx Ctrl message FIFO */
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuAlrm.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuAlrm.c
index 887d63d..48282d1 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuAlrm.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuAlrm.c
@@ -127,10 +127,8 @@
ONU_GPON_ALARM_OFF,
sizeof (S_OnuGponAlarmTbl));
- /* Work around a bug where the Marvell code does not clear the LOS alarm
- * correctly after the board boots. The code will correctly set LOS after boot
- * if there is a legitimate LOS alarm. */
- onuGponApmTbl_s.onuGponAlarmTbl_s.onuGponAlarmTbl[ONU_GPON_ALARM_LOS] = ONU_GPON_ALARM_OFF;
+ /* set alarms on as default only for LOS, LOF, and LCDG */
+ onuGponApmTbl_s.onuGponAlarmTbl_s.onuGponAlarmTbl[ONU_GPON_ALARM_LOS] = ONU_GPON_ALARM_ON;
onuGponApmTbl_s.onuGponAlarmTbl_s.onuGponAlarmTbl[ONU_GPON_ALARM_LOF] = ONU_GPON_ALARM_ON;
}
@@ -486,6 +484,17 @@
l_onuGponPreviousAlarmState = l_onuGponCurrentAlarmState;
}
+#ifdef PON_ALARM_LED
+ // PM: Generate PON alarm signal for Intelbras
+ if((l_onuGponCurrentAlarmState & ONU_GPON_ALARM_LOS_LOC) == 0)
+ {
+ onuPonLedHandler(ONU_PON_ALARM_LED, ACTIVE_LED_OFF);
+ }
+ else
+ {
+ onuPonLedHandler(ONU_PON_ALARM_LED, ACTIVE_LED_ON);
+ }
+#endif
}
/*******************************************************************************
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuInit.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuInit.c
index b22fcce..af11474 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuInit.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuInit.c
@@ -1289,7 +1289,7 @@
if (mvBoardIdGet() == GFLT300_ID)
{
- printk("onuGponStart: - power on xvr\n");
+ printk("onuGponStart: Power on XVR!\n");
mvGppValueSet(1, BIT5, BIT5);
}
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuIsr.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuIsr.c
index 6555274..a610756 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuIsr.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuIsr.c
@@ -547,7 +547,7 @@
if (mode == MV_TRUE)
{
- onuPonTimerEnable(&(onuPonResourceTbl_s.onuPonIsrXvrRstTimerId));
+ onuPonTimerEnable(&(onuPonResourceTbl_s.onuPonIsrXvrRstTimerId));
}
else
{
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuMngrStateMachine.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuMngrStateMachine.c
index 97e8745..5442665 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuMngrStateMachine.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuMngrStateMachine.c
@@ -1470,121 +1470,133 @@
*******************************************************************************/
void onuGponPonMngDisSnMsg(MV_U8 onuId, MV_U8 msgId, MV_U8 *msgData)
{
- MV_STATUS rcode;
- MV_U32 onuState = onuGponDbOnuStateGet();
- MV_U32 disableStatus;
- MV_U8 msgSerialNumber[8];
- MV_U8 onuSerialNumber[8];
- MV_BOOL isSnMatch;
+ MV_STATUS rcode;
+ MV_U32 onuState = onuGponDbOnuStateGet();
+ MV_U32 disableStatus;
+ MV_U8 msgSerialNumber[8];
+ MV_U8 onuSerialNumber[8];
+ MV_BOOL isSnMatch;
#ifdef MV_GPON_DEBUG_PRINT
- mvPonPrint(PON_PRINT_DEBUG, PON_SM_STATE_MODULE,
- "DEBUG: (%s:%d) DISABLE, onuId(%d), msgId(%d), state(%d) msg[0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x]\n",
- __FILE_DESC__, __LINE__, onuId, msgId, onuState,
- msgData[0], msgData[1], msgData[2], msgData[3], msgData[4],
- msgData[5], msgData[6], msgData[7], msgData[8], msgData[9]);
+ mvPonPrint(PON_PRINT_DEBUG, PON_SM_STATE_MODULE,
+ "DEBUG: (%s:%d) DISABLE, onuId(%d), msgId(%d), state(%d) msg[0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x]\n",
+ __FILE_DESC__, __LINE__, onuId, msgId, onuState,
+ msgData[0], msgData[1], msgData[2], msgData[3], msgData[4],
+ msgData[5], msgData[6], msgData[7], msgData[8], msgData[9]);
#endif /* MV_GPON_DEBUG_PRINT */
- disableStatus = msgData[0];
- memcpy(msgSerialNumber, &(msgData[1]), 8);
- onuGponDbSerialNumGet(onuSerialNumber);
- if (memcmp(msgSerialNumber,onuSerialNumber,8) == 0)
- isSnMatch = MV_TRUE;
- else
- isSnMatch = MV_FALSE;
+ disableStatus = msgData[0];
+ memcpy(msgSerialNumber, &(msgData[1]), 8);
+ onuGponDbSerialNumGet(onuSerialNumber);
+ if (memcmp(msgSerialNumber,onuSerialNumber,8) == 0)
+ isSnMatch = MV_TRUE;
+ else
+ isSnMatch = MV_FALSE;
- /* Disable */
- if ((disableStatus == GPON_ONU_DISABLE) && (isSnMatch == MV_TRUE) &&
- (onuState != ONU_GPON_07_EMERGANCY_STOP)) {
+ /* Disable */
+ if ((disableStatus == GPON_ONU_DISABLE) && (isSnMatch == MV_TRUE) &&
+ (onuState != ONU_GPON_07_EMERGANCY_STOP))
+ {
- onuPonTxPowerOn(MV_FALSE);
+ onuPonTxPowerOn(MV_FALSE);
- /* clear onu information */
- /* ===================== */
- rcode = onuGponPonMngClearOnuInfo(CLEAR_BUFFER_EN);
- if (rcode != MV_OK) {
- mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
- "ERROR: (%s:%d) DISABLE: onuGponPonMngClearOnuInfo\n", __FILE_DESC__, __LINE__);
- return;
- }
+ /* clear onu information */
+ /* ===================== */
+ rcode = onuGponPonMngClearOnuInfo(CLEAR_BUFFER_EN);
+ if (rcode != MV_OK)
+ {
+ mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
+ "ERROR: (%s:%d) DISABLE: onuGponPonMngClearOnuInfo\n", __FILE_DESC__, __LINE__);
+ return;
+ }
- /* clear GEM ports */
- /* =============== */
- rcode = onuGponApiGemClearAll(onuGponDbGemRestoreGet());
- if (rcode != MV_OK) {
- mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
- "ERROR: (%s:%d) DISABLE: onuGponApiGemClearAll\n", __FILE_DESC__, __LINE__);
- return;
- }
+ /* clear GEM ports */
+ /* =============== */
+ rcode = onuGponApiGemClearAll(onuGponDbGemRestoreGet());
+ if (rcode != MV_OK)
+ {
+ mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
+ "ERROR: (%s:%d) DISABLE: onuGponApiGemClearAll\n", __FILE_DESC__, __LINE__);
+ return;
+ }
- /* alarm handling */
- /* ============== */
- onuGponAlarmSet(ONU_GPON_ALARM_DIS, ONU_GPON_ALARM_ON);
+ /* alarm handling */
+ /* ============== */
+ onuGponAlarmSet(ONU_GPON_ALARM_DIS, ONU_GPON_ALARM_ON);
- /* state handling */
- /* ============== */
- rcode = onuGponPonMngrUpdateState((MV_U32)ONU_GPON_07_EMERGANCY_STOP);
- if (rcode != MV_OK) {
- mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
- "ERROR: (%s:%d) DISABLE: onuGponPonMngrUpdateState(7)\n", __FILE_DESC__, __LINE__);
- return;
- }
+ /* state handling */
+ /* ============== */
+ rcode = onuGponPonMngrUpdateState((MV_U32)ONU_GPON_07_EMERGANCY_STOP);
+ if (rcode != MV_OK)
+ {
+ mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
+ "ERROR: (%s:%d) DISABLE: onuGponPonMngrUpdateState(7)\n", __FILE_DESC__, __LINE__);
+ return;
+ }
- mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "==================\n");
- mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "== ONT DISABLED ==\n");
- mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "==================\n");
+ /* Disable timers */
+ onuPonTimerDisable(&(onuPonResourceTbl_s.onuGponT01_TimerId));
+ onuPonTimerDisable(&(onuPonResourceTbl_s.onuGponT02_TimerId));
- if (g_onuGponDisableFunc != NULL)
- g_onuGponDisableFunc(MV_TRUE);
+ mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "==================\n");
+ mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "== ONT DISABLED ==\n");
+ mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "==================\n");
- /* Send Disable Notification to upper layer */
- onuGponSrvcDisableMsgNotify( MV_TRUE );
+ if (g_onuGponDisableFunc != NULL)
+ g_onuGponDisableFunc(MV_TRUE);
- /* If was ranged then now ont is not ranged - send status notification */
- if (onuState == ONU_GPON_05_OPERATION)
- onuGponSrvcStatusNotify(GPON_ONU_STATUS_NOT_RANGED);
+ /* Send Disable Notification to upper layer */
+ onuGponSrvcDisableMsgNotify( MV_TRUE );
- /* Enable */
- } else if (((disableStatus == GPON_ONU_ENABLE_ALL) ||
- ((disableStatus == GPON_ONU_ENABLE_ONU) && (isSnMatch == MV_TRUE))) &&
- (onuState == ONU_GPON_07_EMERGANCY_STOP)) {
+ /* If was ranged then now ont is not ranged - send status notification */
+ if (onuState == ONU_GPON_05_OPERATION)
+ onuGponSrvcStatusNotify(GPON_ONU_STATUS_NOT_RANGED);
- onuPonTxPowerOn(MV_TRUE);
+ }
+ /* Enable */
+ else if (((disableStatus == GPON_ONU_ENABLE_ALL) ||
+ ((disableStatus == GPON_ONU_ENABLE_ONU) && (isSnMatch == MV_TRUE))) &&
+ (onuState == ONU_GPON_07_EMERGANCY_STOP))
+ {
- /* alarm handling */
- /* ============== */
- onuGponAlarmSet(ONU_GPON_ALARM_DIS, ONU_GPON_ALARM_OFF);
+ onuPonTxPowerOn(MV_TRUE);
- /* state handling */
- /* ============== */
- rcode = onuGponPonMngrUpdateState((MV_U32)ONU_GPON_02_STANDBY);
- if (rcode != MV_OK) {
- mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
- "ERROR: (%s:%d) DISABLE: onuGponPonMngrUpdateState(2)\n", __FILE_DESC__, __LINE__);
- return;
- }
+ /* alarm handling */
+ /* ============== */
+ onuGponAlarmSet(ONU_GPON_ALARM_DIS, ONU_GPON_ALARM_OFF);
- mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "=================\n");
- mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "== ONT ENABLED ==\n");
- mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "=================\n");
+ /* state handling */
+ /* ============== */
+ rcode = onuGponPonMngrUpdateState((MV_U32)ONU_GPON_02_STANDBY);
+ if (rcode != MV_OK)
+ {
+ mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
+ "ERROR: (%s:%d) DISABLE: onuGponPonMngrUpdateState(2)\n", __FILE_DESC__, __LINE__);
+ return;
+ }
- if (g_onuGponDisableFunc != NULL)
- g_onuGponDisableFunc(MV_FALSE);
+ mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "=================\n");
+ mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "== ONT ENABLED ==\n");
+ mvPonPrint(PON_PRINT_INFO, PON_SM_MODULE, "=================\n");
- /* Send Disable Notification to upper layer */
- onuGponSrvcDisableMsgNotify( MV_FALSE );
+ if (g_onuGponDisableFunc != NULL)
+ g_onuGponDisableFunc(MV_FALSE);
- /* Restore saved GEM ports */
- if (onuGponDbGemRestoreGet() == MV_TRUE) {
- rcode = onuGponApiGemRestoreAll();
- if (rcode != MV_OK) {
- mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
- "ERROR: (%s:%d) DISABLE: onuGponApiGemRestoreAll\n", __FILE_DESC__, __LINE__);
- return;
- }
- }
+ /* Send Disable Notification to upper layer */
+ onuGponSrvcDisableMsgNotify( MV_FALSE );
- }
+ /* Restore saved GEM ports */
+ if (onuGponDbGemRestoreGet() == MV_TRUE)
+ {
+ rcode = onuGponApiGemRestoreAll();
+ if (rcode != MV_OK) {
+ mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
+ "ERROR: (%s:%d) DISABLE: onuGponApiGemRestoreAll\n", __FILE_DESC__, __LINE__);
+ return;
+ }
+ }
+
+ }
}
/*******************************************************************************
@@ -2635,11 +2647,11 @@
#ifdef MV_GPON_DEBUG_PRINT
mvPonPrint(PON_PRINT_DEBUG, PON_SM_MODULE,
"DEBUG: (%s:%d) PON-ID message rcv with ponIdTypeAbit: %d ponIdClassType: 0x%02x ponIdTxOpticalLevel: 0x%04x ponIdBytes[0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x]\n",
- __FILE_DESC__, __LINE__,
- ponIdTypeAbit, ponIdClassType, ponIdTxOpticalLevel,
- ponIdBytes[0], ponIdBytes[1], ponIdBytes[2], ponIdBytes[3],
- ponIdBytes[4], ponIdBytes[5], ponIdBytes[6]
- );
+ __FILE_DESC__, __LINE__,
+ ponIdTypeAbit, ponIdClassType, ponIdTxOpticalLevel,
+ ponIdBytes[0], ponIdBytes[1], ponIdBytes[2], ponIdBytes[3],
+ ponIdBytes[4], ponIdBytes[5], ponIdBytes[6]
+ );
#endif /* MV_GPON_DEBUG_PRINT */
}
@@ -2700,29 +2712,38 @@
"DEBUG: (%s:%d) TIMER TO1 Expired, state(%d)\n", __FILE_DESC__, __LINE__, onuGponDbOnuStateGet());
#endif /* MV_GPON_DEBUG_PRINT */
- /* clear onu information */
- /* ===================== */
- rcode = onuGponPonMngClearOnuInfo(CLEAR_BUFFER_EN);
- if (rcode != MV_OK)
+ if ((onuGponDbOnuStateGet() == ONU_GPON_03_SERIAL_NUM) ||
+ (onuGponDbOnuStateGet() == ONU_GPON_04_RANGING))
+ {
+ /* clear onu information */
+ /* ===================== */
+ rcode = onuGponPonMngClearOnuInfo(CLEAR_BUFFER_EN);
+ if (rcode != MV_OK)
+ {
+ mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
+ "ERROR: (%s:%d) onuGponPonMngClearOnuInfo\n", __FILE_DESC__, __LINE__);
+ return;
+ }
+
+ /* state handling */
+ /* ============== */
+ rcode = onuGponPonMngrUpdateState((MV_U32)ONU_GPON_02_STANDBY);
+ if (rcode != MV_OK)
+ {
+ mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
+ "ERROR: (%s:%d) onuGponPonMngrUpdateState(2)\n", __FILE_DESC__, __LINE__);
+ return;
+ }
+
+ /* alarm handling */
+ /* ============== */
+ onuGponAlarmSet(ONU_GPON_ALARM_SUF, ONU_GPON_ALARM_ON);
+ }
+ else
{
mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
- "ERROR: (%s:%d) onuGponPonMngClearOnuInfo\n", __FILE_DESC__, __LINE__);
- return;
+ "ERROR: (%s:%d) TIMER TO1 Expired, in wrong state(%d)\n", __FILE_DESC__, __LINE__, onuGponDbOnuStateGet());
}
-
- /* state handling */
- /* ============== */
- rcode = onuGponPonMngrUpdateState((MV_U32)ONU_GPON_02_STANDBY);
- if (rcode != MV_OK)
- {
- mvPonPrint(PON_PRINT_ERROR, PON_SM_MODULE,
- "ERROR: (%s:%d) onuGponPonMngrUpdateState(2)\n", __FILE_DESC__, __LINE__);
- return;
- }
-
- /* alarm handling */
- /* ============== */
- onuGponAlarmSet(ONU_GPON_ALARM_SUF, ONU_GPON_ALARM_ON);
}
/*******************************************************************************
@@ -2809,6 +2830,7 @@
onuGponDbOnuDsSyncOnSet(0);
+ onuGponAlarmSet(ONU_GPON_ALARM_LOS, ONU_GPON_ALARM_ON);
onuGponAlarmSet(ONU_GPON_ALARM_LOF, ONU_GPON_ALARM_ON);
#ifdef MV_GPON_DEBUG_PRINT
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/gpon/gponOnuLnxKsUI.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/gpon/gponOnuLnxKsUI.c
index 96bbfc1..add7173 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/gpon/gponOnuLnxKsUI.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/gpon/gponOnuLnxKsUI.c
@@ -3428,13 +3428,13 @@
if (!strcmp(name, "printMask"))
return ponOnuPrintStatus(buf);
- else if (!strcmp(name, "prbsUserPattern"))
- return onuGponUiCfgPrbsUserPattern(buf);
+ else if (!strcmp(name, "prbsUserPattern"))
+ return onuGponUiCfgPrbsUserPattern(buf);
else if (!strcmp(name, "helpMisc"))
return onuGponUiMiscHelpShow(buf);
else if (!strcmp(name, "syncLogEnable")) /* sync log enable or disable */
onuGponUiSyncLogEnableShow();
- else if (!strcmp(name, "syncLog")) /* sync log stop */
+ else if (!strcmp(name, "syncLog")) /* sync log stop */
onuGponUiSyncLogPrint();
else if (!strcmp(name, "laserChannel"))
return onuGponLaserChannelShow(buf);
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/ponOnuLnxKsMI.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/ponOnuLnxKsMI.c
index a9cb5fc..f5b5fe9 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/ponOnuLnxKsMI.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/ponOnuLnxKsMI.c
@@ -253,6 +253,7 @@
goto ioctlErr;
}
ponDev.drvMode = drvMode;
+
} else {
ret = get_user(drvMode, (E_PonDriverMode __user *)arg);
if (ret != 0) {
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/plat/ponOnuBoard.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/plat/ponOnuBoard.c
index 83e37e1..dfbb1dd 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/plat/ponOnuBoard.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/plat/ponOnuBoard.c
@@ -142,6 +142,15 @@
return(status);
}
+#ifdef PON_ALARM_LED
+ PON_GPIO_GET(BOARD_GPP_PON_ALARM, gpioGroup, gpioMask);
+ if (gpioMask != PON_GPIO_NOT_USED) {
+ status = mvGppTypeSet(gpioGroup, gpioMask, 0/*output*/);
+ if (status != MV_OK)
+ return(status);
+ }
+#endif
+
status = asicOntMiscRegWrite(mvAsicReg_PON_LED_BLINK_FREQ_A_ON, 0x30000000, 0);
if (status != MV_OK)
return(status);
@@ -179,16 +188,27 @@
MV_U32 gpioGroup = 0;
MV_U32 gpioMask = 0;
- if (led == ONU_PON_SYS_LED) {
-
+ if (led == ONU_PON_SYS_LED)
+ {
PON_GPIO_GET(BOARD_GPP_SYS_LED, gpioGroup, gpioMask);
- if (gpioMask != PON_GPIO_NOT_USED) {
- status = mvGppValueSet(gpioGroup, gpioMask, gpioMask);
- if (status != MV_OK)
- return(status);
+ if (gpioMask != PON_GPIO_NOT_USED)
+ {
+ switch (action)
+ {
+ case ACTIVE_LED_ON:
+ status = mvGppValueSet(gpioGroup, gpioMask, gpioMask);
+ if (status != MV_OK)
+ return(status);
+ break;
+ case ACTIVE_LED_OFF:
+ status = mvGppValueSet(gpioGroup, gpioMask, ~gpioMask);
+ if (status != MV_OK)
+ return(status);
+ break;
+ }
}
-
- } else if (led == ONU_PON_SYNC_LED) {
+ }
+ else if (led == ONU_PON_SYNC_LED) {
PON_GPIO_GET(BOARD_GPP_PON_LED, gpioGroup, gpioMask);
if (gpioMask != PON_GPIO_NOT_USED) {
@@ -197,6 +217,9 @@
status = mvGppValueSet(gpioGroup, gpioMask, ~gpioMask);
if (status != MV_OK)
return(status);
+ status = mvGppBlinkEn(gpioGroup, gpioMask, ~gpioMask);
+ if (status != MV_OK)
+ return(status);
break;
case ACTIVE_LED_BLINK_SLOW:
@@ -234,6 +257,28 @@
}
}
}
+#ifdef PON_ALARM_LED
+ else if (led == ONU_PON_ALARM_LED) {
+ // Intelbras board
+ PON_GPIO_GET(BOARD_GPP_PON_ALARM, gpioGroup, gpioMask);
+ if (gpioMask != PON_GPIO_NOT_USED)
+ {
+ switch (action)
+ {
+ case ACTIVE_LED_ON:
+ status = mvGppValueSet(gpioGroup, gpioMask, gpioMask);
+ if (status != MV_OK)
+ return(status);
+ break;
+ case ACTIVE_LED_OFF:
+ status = mvGppValueSet(gpioGroup, gpioMask, ~gpioMask);
+ if (status != MV_OK)
+ return(status);
+ break;
+ }
+ }
+ }
+#endif
return(MV_OK);
}
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/plat/ponOnuBoard.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/plat/ponOnuBoard.h
index 321c32a..006a694 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/plat/ponOnuBoard.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/plat/ponOnuBoard.h
@@ -111,12 +111,16 @@
#define ONU_ASIC_REV_Z2 (0x1)
#define ONU_ASIC_REV_A0 (0x2)
+// Used in Intelbras Board
+#define PON_ALARM_LED
+
/* Enums
------------------------------------------------------------------------------*/
typedef enum
{
ONU_PON_SYS_LED = 0,
- ONU_PON_SYNC_LED = 1
+ ONU_PON_SYNC_LED = 1,
+ ONU_PON_ALARM_LED = 2
}E_OnuPonLedTypes;
typedef enum
@@ -186,3 +190,6 @@
------------------------------------------------------------------------------*/
#endif /* _ONU_PON_BOARD_H */
+
+
+
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_switch/mv_switch_wrap.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_switch/mv_switch_wrap.h
index a2da3e0..110a90f 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_switch/mv_switch_wrap.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_switch/mv_switch_wrap.h
@@ -31,7 +31,7 @@
#define SW_QOS_NUM_OF_QUEUES (4)
-#define SW_MAX_VLAN_NUM (4096)
+#define SW_MAX_VLAN_NUM (4095)
#define SW_MAX_PORTS_NUM (7)
#define SW_PORT_NOT_BELONG (0)
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_api.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_api.c
old mode 100755
new mode 100644
index a3a5319..a4fc98e
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_api.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_api.c
@@ -3554,6 +3554,7 @@
return (ret_code);
}
EXPORT_SYMBOL(tpm_xlate_uni_2_switch_port);
+
/*******************************************************************************
* tpm_active_tcont()
*
@@ -3581,6 +3582,7 @@
return ret_code;
}
EXPORT_SYMBOL(tpm_active_tcont);
+
/*******************************************************************************
* tpm_deactive_tcont()
*
@@ -3608,3 +3610,86 @@
}
EXPORT_SYMBOL(tpm_deactive_tcont);
+#ifdef CONFIG_MV_INCLUDE_PON
+/*******************************************************************************
+* tpm_register_pon_callback()
+*
+* DESCRIPTION: Function used to register PON callback functions.
+*
+* INPUTS:
+* pon_func: PON callback function
+*
+* OUTPUTS:
+* None
+*
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_db_err_t.
+*******************************************************************************/
+int tpm_register_pon_callback(PON_SHUTDOWN_FUNC pon_func)
+{
+ tpm_error_code_t ret_code;
+
+ ret_code = tpm_db_register_pon_callback(pon_func);
+
+ return ret_code;
+}
+EXPORT_SYMBOL(tpm_register_pon_callback);
+#endif
+
+/*******************************************************************************
+* tpm_set_drop_precedence_mode()
+*
+* DESCRIPTION: Function used to set drop precedence mode.
+*
+* INPUTS:
+* tcont_num
+*
+* OUTPUTS:
+*
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_error_code_t.
+*
+* COMMENTS:
+*
+*******************************************************************************/
+tpm_error_code_t tpm_set_drop_precedence_mode(uint32_t owner_id,
+ tpm_drop_precedence_t mode)
+{
+ tpm_error_code_t ret_code;
+ /* set drop precedence mode */
+ ret_code = tpm_proc_set_drop_precedence_mode(owner_id, mode);
+
+ return ret_code;
+}
+EXPORT_SYMBOL(tpm_set_drop_precedence_mode);
+
+/*******************************************************************************
+* tpm_get_drop_precedence_mode()
+*
+* DESCRIPTION: Function used to get drop precedence mode.
+*
+* INPUTS:
+* tcont_num
+*
+* OUTPUTS:
+*
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_error_code_t.
+*
+* COMMENTS:
+*
+*******************************************************************************/
+tpm_error_code_t tpm_get_drop_precedence_mode(uint32_t owner_id,
+ tpm_drop_precedence_t *mode)
+{
+ tpm_error_code_t ret_code;
+
+ /* set drop precedence mode */
+ ret_code = tpm_proc_get_drop_precedence_mode(owner_id, mode);
+
+ return ret_code;
+}
+EXPORT_SYMBOL(tpm_get_drop_precedence_mode);
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_api.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_api.h
index 62f8bf1..84222a9 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_api.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_api.h
@@ -4211,6 +4211,70 @@
uint8_t static_mac[6]
);
+#ifdef CONFIG_MV_INCLUDE_PON
+/*******************************************************************************
+* tpm_register_pon_callback()
+*
+* DESCRIPTION: Function used to register PON callback functions.
+*
+* INPUTS:
+* pon_func: PON callback function
+*
+* OUTPUTS:
+* None
+*
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_db_err_t.
+*******************************************************************************/
+int tpm_register_pon_callback(PON_SHUTDOWN_FUNC pon_func);
+#endif
+
+/*******************************************************************************
+* tpm_set_drop_precedence_mode()
+*
+* DESCRIPTION: Function used to set drop precedence mode.
+*
+* INPUTS:
+* tcont_num
+*
+* OUTPUTS:
+*
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_error_code_t.
+*
+* COMMENTS:
+*
+*******************************************************************************/
+tpm_error_code_t tpm_set_drop_precedence_mode
+(
+ uint32_t owner_id,
+ tpm_drop_precedence_t mode
+);
+
+/*******************************************************************************
+* tpm_get_drop_precedence_mode()
+*
+* DESCRIPTION: Function used to get drop precedence mode.
+*
+* INPUTS:
+* tcont_num
+*
+* OUTPUTS:
+*
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_error_code_t.
+*
+* COMMENTS:
+*
+*******************************************************************************/
+tpm_error_code_t tpm_get_drop_precedence_mode
+(
+ uint32_t owner_id,
+ tpm_drop_precedence_t *mode
+);
/* OLD API functions */
#define tpm_add_l2_prim_acl_rule tpm_add_l2_rule
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_db.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_db.c
index 1025809..97d033e 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_db.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_db.c
@@ -439,7 +439,9 @@
gmac1 = 0;
int32_t ret_code;
tpm_db_ds_mac_based_trunk_enable_t ds_mac_based_trunk_enable;
-
+#ifdef CONFIG_MV_INCLUDE_PON
+ PON_SHUTDOWN_FUNC pon_callback_func = NULL;
+#endif
switch(tpm_db.eth_cmplx_profile)
{
case TPM_PON_WAN_DUAL_MAC_INT_SWITCH:
@@ -563,6 +565,18 @@
ret_code = tpm_db_gmac_func_set(TPM_ENUM_GMAC_1, gmac1);
IF_ERROR(ret_code);
+#ifdef CONFIG_MV_INCLUDE_PON
+ /* shut down or enable PON */
+ ret_code = tpm_db_get_pon_callback(&pon_callback_func);
+ IF_ERROR(ret_code);
+ if (pon_callback_func) {
+ if (pon == TPM_GMAC_FUNC_WAN)
+ pon_callback_func(1);
+ else
+ pon_callback_func(0);
+ }
+#endif
+
return (TPM_OK);
}
@@ -8449,7 +8463,7 @@
if (gmac_port >= TPM_MAX_NUM_GMACS)
return;
- if (chain_type > TPM_CHAIN_TYPE_MAX || chain_type == TPM_CHAIN_TYPE_NONE)
+ if (chain_type >= TPM_CHAIN_TYPE_MAX || chain_type == TPM_CHAIN_TYPE_NONE)
return;
if (tpm_db_mod2_chain_cfg[chain_type].total_num == 0)
@@ -9980,6 +9994,92 @@
return TPM_DB_OK;
}
+
+int32_t tpm_db_drop_precedence_mode_set(tpm_drop_precedence_t mode)
+{
+ tpm_db.drop_precedence.mode = mode;
+ return TPM_DB_OK;
+}
+
+int32_t tpm_db_drop_precedence_mode_get(tpm_drop_precedence_t *mode)
+{
+ *mode = tpm_db.drop_precedence.mode;
+ return TPM_DB_OK;
+}
+
+int32_t tpm_db_drop_precedence_rule_set(uint32_t rule_index)
+{
+ uint32_t index;
+ tpm_db_drop_precedence_rule_entry_t *rule_entry;
+
+ for (index = 0; index < TPM_MAX_NUM_DROP_PRECEDENCE; index++) {
+ rule_entry = &tpm_db.drop_precedence.drop_rule[index];
+ if (rule_entry->valid == TPM_FALSE)
+ break;
+ }
+
+ if(index >= TPM_MAX_NUM_DROP_PRECEDENCE) {
+ TPM_OS_ERROR(TPM_DB_MOD, "PnC partition for drop precedence is full %d\n", rule_index);
+ return TPM_DB_ERR_DB_TBL_FULL;
+ }
+
+ rule_entry->rule_index = rule_index;
+ rule_entry->valid = TPM_TRUE;
+
+ return TPM_DB_OK;
+}
+
+int32_t tpm_db_drop_precedence_rule_delete(uint32_t rule_index)
+{
+ uint32_t index;
+ tpm_db_drop_precedence_rule_entry_t *rule_entry;
+
+ for (index = 0; index < TPM_MAX_NUM_DROP_PRECEDENCE; index++) {
+ rule_entry = &tpm_db.drop_precedence.drop_rule[index];
+ if ((rule_entry->valid == TPM_TRUE) &&
+ (rule_entry->rule_index == rule_index))
+ break;
+ }
+
+ if(index >= TPM_MAX_NUM_DROP_PRECEDENCE) {
+ TPM_OS_ERROR(TPM_DB_MOD, "Did not find drop precedence PnC rule for index %d\n", rule_index);
+ return TPM_DB_ERR_REC_NOT_EXIST;
+ }
+
+ memset(rule_entry, 0, sizeof(tpm_db_drop_precedence_rule_entry_t));
+ rule_entry->valid = TPM_FALSE;
+ rule_entry->rule_index = 0;
+
+ return TPM_DB_OK;
+}
+
+int32_t tpm_db_drop_precedence_rule_get(uint32_t index,
+ tpm_db_drop_precedence_rule_entry_t *rule_entry)
+{
+ if(index >= TPM_MAX_NUM_DROP_PRECEDENCE) {
+ TPM_OS_ERROR(TPM_DB_MOD, "The index(%d) >= Maximium number(%d)\n",
+ index, index);
+ return TPM_DB_ERR_REC_NOT_EXIST;
+ }
+
+ rule_entry->valid = tpm_db.drop_precedence.drop_rule[index].valid;
+ rule_entry->rule_index = tpm_db.drop_precedence.drop_rule[index].rule_index;
+
+ return TPM_DB_OK;
+}
+
+int32_t tpm_db_drop_precedence_db_reset(void)
+{
+ uint32_t index;
+
+ memset(&tpm_db.drop_precedence, 0, sizeof(tpm_db.drop_precedence));
+ for (index = 0; index < TPM_MAX_NUM_DROP_PRECEDENCE; index++) {
+ tpm_db.drop_precedence.drop_rule[index].valid = TPM_FALSE;
+ }
+
+ return TPM_DB_OK;
+}
+
int32_t tpm_db_ctc_cm_rule_set(tpm_src_port_type_t src_port,
uint32_t precedence,
tpm_parse_fields_t l2_parse_rule_bm,
@@ -10556,18 +10656,20 @@
tpm_ipv4_acl_key_t *ipv4_key,
uint32_t *key_idx)
{
- tpm_db_cnm_ipv4_pre_filter_key_t *key = &tpm_db.ctc_cm_data.ipv4_pre_filter[src_port].key[0];
+ tpm_db_cnm_ipv4_pre_filter_key_t *key;
uint32_t i;
- /*check param*/
- if (key_idx == NULL || ipv4_key == NULL)
- return (TPM_DB_ERR_INV_INPUT);
-
if(src_port >= TPM_MAX_NUM_UNI_PORTS) {
TPM_OS_ERROR(TPM_DB_MOD, "invalid input Src Port(%d)\n", src_port);
return TPM_DB_ERR_INV_INPUT;
}
+ key = &tpm_db.ctc_cm_data.ipv4_pre_filter[src_port].key[0];
+
+ /*check param*/
+ if (key_idx == NULL || ipv4_key == NULL)
+ return (TPM_DB_ERR_INV_INPUT);
+
for (i = 0; i < TPM_DB_CNM_MAX_IPV4_PRE_FILTER_KEY_NUM; i++) {
if (key[i].valid == TPM_FALSE)
continue;
@@ -11023,6 +11125,58 @@
return (TPM_DB_OK);
}
+#ifdef CONFIG_MV_INCLUDE_PON
+static PON_SHUTDOWN_FUNC gb_pon_callback_func = NULL;
+
+/*******************************************************************************
+* tpm_db_register_pon_callback()
+*
+* DESCRIPTION: Function used to register PON callback functions.
+*
+* INPUTS:
+* pon_func: PON callback function
+*
+* OUTPUTS:
+* None
+*
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_db_err_t.
+*******************************************************************************/
+int32_t tpm_db_register_pon_callback(PON_SHUTDOWN_FUNC pon_func)
+{
+ tpm_error_code_t ret_code = TPM_OK;
+
+ gb_pon_callback_func = pon_func;
+
+ return ret_code;
+}
+
+/*******************************************************************************
+* tpm_db_get_pon_callback()
+*
+* DESCRIPTION: Function used to get PON callback functions.
+*
+* INPUTS:
+* None
+*
+* OUTPUTS:
+* pon_func: PON callback function
+*
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_db_err_t.
+*******************************************************************************/
+int32_t tpm_db_get_pon_callback(PON_SHUTDOWN_FUNC *pon_func)
+{
+ tpm_error_code_t ret_code = TPM_OK;
+
+ *pon_func = gb_pon_callback_func;
+
+ return ret_code;
+}
+#endif
+
/*******************************************************************************
* tpm_db_init()
*
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_db.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_db.h
index 6a9e104..df68277 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_db.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_db.h
@@ -732,6 +732,16 @@
}tpm_db_hot_swap_bak_db_t;
typedef struct {
+ uint32_t valid;
+ uint32_t rule_index;
+} tpm_db_drop_precedence_rule_entry_t;
+
+typedef struct {
+ tpm_drop_precedence_t mode;
+ tpm_db_drop_precedence_rule_entry_t drop_rule[TPM_MAX_NUM_DROP_PRECEDENCE];
+} tpm_db_drop_precedence_t;
+
+typedef struct {
tpm_db_ctc_cm_enable_t enable;
tpm_db_ctc_cm_ipv6_parse_win_t ipv6_parse_win;
/* init value from XML */
@@ -794,6 +804,8 @@
tpm_db_api_group_t api_groups[TPM_MAX_API_TYPES];
#endif
+ tpm_db_drop_precedence_t drop_precedence;
+
/* API Ranges and Entries */
tpm_db_api_section_t api_section[TPM_MAX_NUM_API_SECTIONS];
@@ -1070,6 +1082,14 @@
int32_t tpm_db_api_section_entry_add(tpm_api_sections_t api_section, int32_t new_last_valid);
int32_t tpm_db_api_entries_area_reset(void);
+int32_t tpm_db_drop_precedence_mode_set(tpm_drop_precedence_t mode);
+int32_t tpm_db_drop_precedence_mode_get(tpm_drop_precedence_t *mode);
+int32_t tpm_db_drop_precedence_rule_set(uint32_t rule_index);
+int32_t tpm_db_drop_precedence_rule_delete(uint32_t rule_index);
+int32_t tpm_db_drop_precedence_rule_get(uint32_t index,
+ tpm_db_drop_precedence_rule_entry_t *rule_entry);
+int32_t tpm_db_drop_precedence_db_reset(void);
+
/* API Entry */
int32_t tpm_db_api_entry_set(tpm_api_sections_t api_section,
uint32_t rule_num, uint32_t bi_dir, tpm_rule_entry_t *api_data,
@@ -1448,6 +1468,11 @@
int32_t tpm_db_gmac_lpk_uni_ingr_rate_limit_set(tpm_src_port_type_t port, tpm_db_gmac_lpk_uni_ingr_rate_limit_t rate_limit);
int32_t tpm_db_gmac_lpk_uni_ingr_rate_limit_get(tpm_src_port_type_t port, tpm_db_gmac_lpk_uni_ingr_rate_limit_t *rate_limit);
+#ifdef CONFIG_MV_INCLUDE_PON
+int32_t tpm_db_register_pon_callback(PON_SHUTDOWN_FUNC pon_func);
+int32_t tpm_db_get_pon_callback(PON_SHUTDOWN_FUNC *pon_func);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_init.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_init.c
old mode 100644
new mode 100755
index 9e4d381..b72eb6d
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_init.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_init.c
@@ -89,7 +89,7 @@
extern spinlock_t tpmTcamAgingLock;
/* Local definitions */
-#define TPM_L2_BASE_LUID 0
+#define TPM_L2_BASE_LUID 1
#define TPM_L3_BASE_LUID (TPM_L2_BASE_LUID + 1)
#define TPM_IPV4_BASE_LUID (TPM_L3_BASE_LUID + 1)
#define TPM_IPV6_BASE_LUID (TPM_IPV4_BASE_LUID + 3)
@@ -153,31 +153,32 @@
{TPM_PNC_MULTI_LPBK, 0, 0, 1},
{TPM_PNC_VIRT_UNI, 0, 0, 1},
{TPM_PNC_LOOP_DET_US, 0, 0, 1},
- {TPM_PNC_L2_MAIN, 0, 1, 1},
- {TPM_PNC_ETH_TYPE, 1, 1, 1},
- {TPM_PNC_IGMP, 2, 0, 1},
- {TPM_PNC_IPV4_MC_DS, 2, 0, 1},
- {TPM_PNC_IPV4_MAIN, 2, 1, 1},
- {TPM_PNC_IPV4_TCP_FLAG, 3, 1, 1},
- {TPM_PNC_TTL, 4, 1, 1},
- {TPM_PNC_IPV4_PROTO, 5, 0, 1},
- {TPM_PNC_IPV4_FRAG, 5, 0, 1},
- {TPM_PNC_IPV4_LEN, 5, 1, 1},
- {TPM_PNC_IPV6_NH, 6, 1, 1},
- {TPM_PNC_IPV6_L4_MC_DS, 7, 1, 1},
- {TPM_PNC_IPV6_TCP_FLAG, 7, 1, 1},
- {TPM_PNC_IPV6_L4, 7, 1, 1},
- {TPM_PNC_IPV6_HOPL, 8, 1, 1},
- {TPM_PNC_IPV6_MC_SIP, 8, 1, 1},
- {TPM_PNC_IPV6_GEN, 8, 1, 1},
- {TPM_PNC_IPV6_MC_DS, 9, 1, 1},
- {TPM_PNC_IPV6_DIP, 9, 1, 1},
- {TPM_PNC_CNM_IPV4_PRE, 10, 1, 1},
+ {TPM_PNC_DROP_PRECEDENCE, 0, 0, 1},
+ {TPM_PNC_L2_MAIN, 1, 1, 1},
+ {TPM_PNC_ETH_TYPE, 2, 1, 1},
+ {TPM_PNC_IGMP, 3, 0, 1},
+ {TPM_PNC_IPV4_MC_DS, 3, 0, 1},
+ {TPM_PNC_IPV4_MAIN, 3, 1, 1},
+ {TPM_PNC_IPV4_TCP_FLAG, 4, 1, 1},
+ {TPM_PNC_TTL, 5, 1, 1},
+ {TPM_PNC_IPV4_PROTO, 6, 0, 1},
+ {TPM_PNC_IPV4_FRAG, 6, 0, 1},
+ {TPM_PNC_IPV4_LEN, 6, 1, 1},
+ {TPM_PNC_IPV6_NH, 7, 1, 1},
+ {TPM_PNC_IPV6_L4_MC_DS, 8, 1, 1},
+ {TPM_PNC_IPV6_TCP_FLAG, 8, 1, 1},
+ {TPM_PNC_IPV6_L4, 8, 1, 1},
+ {TPM_PNC_IPV6_HOPL, 9, 1, 1},
+ {TPM_PNC_IPV6_MC_SIP, 9, 1, 1},
+ {TPM_PNC_IPV6_GEN, 9, 1, 1},
+ {TPM_PNC_IPV6_MC_DS, 10, 1, 1},
+ {TPM_PNC_IPV6_DIP, 10, 1, 1},
+ {TPM_PNC_CNM_IPV4_PRE, 11, 1, 1},
/* The range 'TPM_PNC_CNM_MAIN' spans over two lookup ids.
LU_ID_CNM_BASE := 11
LU_ID_L2_CNM := LU_ID_CNM_BASE+0[/11]
LU_ID_IPV4_CNM := LU_ID_CNM_BASE+1[/12] */
- {TPM_PNC_CNM_MAIN, 11, 1, 1},
+ {TPM_PNC_CNM_MAIN, 12, 1, 1},
{TPM_PNC_CATCH_ALL, 0, 0, 1},
};
@@ -686,8 +687,7 @@
profile[0] = ESC_OPT_RGMIIA_MAC0 | ESC_OPT_GEPHY_MAC1;
if (DB_88F6601_BP_ID == mvBoardIdGet())
profile[0] = ESC_OPT_SGMII | ESC_OPT_GEPHY_MAC0 | ESC_OPT_LP_SERDES_FE_GE_PHY;
- if ((RD_88F6601_MC_ID == mvBoardIdGet())
- || (GFLT300_ID == mvBoardIdGet()) || (GFLT200_ID == mvBoardIdGet()) || (GFLT110_ID == mvBoardIdGet()))
+ if (RD_88F6601_MC_ID == mvBoardIdGet())
profile[0] = ESC_OPT_GEPHY_MAC0;
break;
case TPM_PON_WAN_G0_G1_DUAL_LAN:
@@ -698,7 +698,7 @@
off += sprintf(buff+off, "\nProfile supported options:\n");
for (i = 0; profile[i]; i++) {
off += sprintf(buff+off, "\t");
- for (j = 0; j<32; j++) {
+ for (j = 0; j < (sizeof(opt_str_tlb)/sizeof(opt_str_tlb[0])); j++) {
if (profile[i] & (1<<j)) {
off += sprintf(buff+off, "%s ", opt_str_tlb[j]);
}
@@ -4128,6 +4128,9 @@
ret_code = tpm_fc_engine_init();
IF_ERROR(ret_code);
+ ret_code = tpm_init_qos();
+ IF_ERROR(ret_code);
+
return (TPM_OK);
}
@@ -4161,6 +4164,30 @@
}
/*******************************************************************************
+* tpm_init_qos()
+*
+* DESCRIPTION: Set drop precedence for QoS
+*
+* INPUTS:
+
+* OUTPUTS:
+*
+* RETURNS:
+*
+*******************************************************************************/
+int32_t tpm_init_qos(void)
+{
+ int32_t ret_code = TPM_OK;
+
+ ret_code = tpm_proc_set_drop_precedence_mode(0, TPM_DROP_PRECEDENCE_8P0D);
+ IF_ERROR(ret_code);
+ ret_code = tpm_proc_set_drop_precedence_mode(0, TPM_DROP_PRECEDENCE_NONE);
+ IF_ERROR(ret_code);
+
+ return (ret_code);
+}
+
+/*******************************************************************************
* tpm_pnc_init_temp()
*
* DESCRIPTION: when TPM is responsible to configure the PNC:
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_init.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_init.h
index 009d272..e8e5d37 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_init.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_init.h
@@ -109,5 +109,6 @@
tpm_init_gmac_conn_conf_t *gmac_port_conf);
int32_t tpm_init_ipg(int32_t mod_value);
int32_t tpm_init_gmac_loopback(tpm_gmacs_enum_t port, uint8_t enable);
+int32_t tpm_init_qos(void);
#endif /* _TPM_INIT_H_ */
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_internal_types.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_internal_types.h
index 7f8344e..b11667d 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_internal_types.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_internal_types.h
@@ -124,6 +124,7 @@
#define SW_GMAC_0 (0)
#define SW_GMAC_1 (1)
+#define TPM_MAX_NUM_DROP_PRECEDENCE (4)
/* MH configuration - fixed values - will be supported via xml params */
#define TPM_GMAC0_AMBER_PORT_NUM 4
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pkt_proc_logic.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pkt_proc_logic.c
index c3f5f19..21c8a80 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pkt_proc_logic.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pkt_proc_logic.c
@@ -5277,6 +5277,8 @@
memcpy(&(api_data.l2_prim_key.rule_action), rule_action, sizeof(tpm_rule_action_t));
if (l2_key)
memcpy(&(api_data.l2_prim_key.l2_key), l2_key, sizeof(tpm_l2_acl_key_t));
+ else
+ return ERR_GENERAL;
if (pkt_frwd != NULL)
memcpy(&(api_data.l2_prim_key.pkt_frwd), pkt_frwd, sizeof(tpm_pkt_frwd_t));
@@ -15718,6 +15720,10 @@
if (ipv6_key) {
memcpy(&(tcam_data->pkt_key.ipv6_key), ipv6_key, sizeof(tpm_ipv6_acl_key_t));
}
+ else
+ {
+ return ERR_GENERAL;
+ }
/* Get PNC Range information */
ret_code = tpm_proc_common_pncl_info_get(TPM_PNC_CNM_MAIN, &lu_id, &start_offset);
@@ -17890,3 +17896,299 @@
return TPM_OK;
}
+/*******************************************************************************
+* tpm_proc_add_drop_precedence_rule()
+*
+* DESCRIPTION: Function to add L2 drop precedence rule based on P-bit or DEI.
+*
+* INPUTS:
+* All inputs/outputs are same as API call
+*
+* OUTPUTS:
+*
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_db_err_t.
+*
+* COMMENTS:
+*
+*******************************************************************************/
+tpm_error_code_t tpm_proc_add_drop_precedence_rule(uint32_t owner_id,
+ uint32_t rule_num,
+ tpm_vlan_key_t *vlan_key,
+ uint32_t color)
+{
+
+ tpm_error_code_t ret_code;
+ uint32_t free_entries, l2_lu, pnc_entry;
+ tpm_db_pnc_range_t range_data;
+ tpm_pncl_pnc_full_t pnc_data;
+
+ TPM_OS_DEBUG(TPM_TPM_LOG_MOD, " owner(%d) rule_num(%d)\n", owner_id, rule_num);
+
+ memset(&pnc_data, 0, sizeof(pnc_data));
+ memset(&range_data, 0, sizeof(range_data));
+
+ /* Get Range_Id */
+ ret_code = tpm_db_pnc_rng_get(TPM_PNC_DROP_PRECEDENCE, &range_data);
+ IF_ERROR(ret_code);
+ l2_lu = range_data.pnc_range_conf.base_lu_id;
+ free_entries = range_data.pnc_range_oper.free_entries;
+ TPM_OS_DEBUG(TPM_TPM_LOG_MOD, "free_ent(%d)\n", free_entries);
+
+ if (free_entries <= 0) {
+ TPM_OS_ERROR(TPM_TPM_LOG_MOD, "not enough drop precedence rules! (%d/%d)\n",
+ free_entries, TPM_MAX_NUM_DROP_PRECEDENCE);
+ IF_ERROR(ERR_GENERAL);
+ } else if (TPM_MAX_NUM_DROP_PRECEDENCE < free_entries)
+ TPM_OS_WARN(TPM_TPM_LOG_MOD, "too much drop precedence rules, waste. (%d/%d)\n",
+ free_entries, TPM_MAX_NUM_DROP_PRECEDENCE);
+
+ pnc_entry = range_data.pnc_range_conf.range_start + range_data.pnc_range_conf.api_start;
+
+ /* Basic TCAM/SRAM Config, valid for all following entries */
+ /* L2 LUID */
+ pnc_data.pncl_tcam.lu_id = l2_lu;
+
+ /* Bi-direction */
+ pnc_data.pncl_tcam.port_ids = tpm_proc_all_gmac_bm();
+
+ /* Current Offset */
+ pnc_data.pncl_tcam.start_offset.offset_base = TPM_PNCL_ZERO_OFFSET;
+ pnc_data.pncl_tcam.start_offset.offset_sub.l2_subf = TPM_L2_PARSE_MH;
+
+ /* Set parse type for key */
+ pnc_data.pncl_tcam.l3_parse_bm = 0;
+ pnc_data.pncl_tcam.ipv4_parse_bm = 0;
+ pnc_data.pncl_tcam.ipv6_parse_bm = 0;
+ pnc_data.pncl_tcam.tcp_parse_bm = 0;
+
+ /* Set DO_NOT_REPEAT_TAG AI filter */
+ if (color) {
+ pnc_data.pncl_tcam.add_info_data = 1 << TPM_AI_TAG1_BIT_OFF;
+ pnc_data.pncl_tcam.add_info_mask = TPM_AI_TAG1_MASK;
+ }
+
+ /* Copy L2 key */
+ memcpy(&pnc_data.pncl_tcam.pkt_key.l2_key.vlan1, vlan_key, sizeof(tpm_vlan_key_t));
+
+ /* Set L2 key value */
+ pnc_data.pncl_tcam.l2_parse_bm = TPM_L2_PARSE_ONE_VLAN_TAG;
+
+ /* Next LUID is still L2 */
+ ret_code = tpm_db_pnc_rng_get(TPM_PNC_L2_MAIN, &range_data);
+ IF_ERROR(ret_code);
+
+ pnc_data.pncl_sram.next_lu_id = range_data.pnc_range_conf.base_lu_id;
+ /* Using off_reg 1 */
+ pnc_data.pncl_sram.next_lu_off_reg = 1;
+
+ /* No update off_reg 0 */
+ pnc_data.pncl_sram.shift_updt_reg = TPM_PNC_NOSHIFT_UPDATE_REG;
+
+ /* No queue update */
+ pnc_data.pncl_sram.pnc_queue = TPM_PNCL_NO_QUEUE_UPDATE;
+
+ /* ResultInfo&FlowId update */
+ if (color)
+ pnc_data.pncl_sram.sram_updt_bm = TPM_PNCL_SET_COL;
+
+ /* Create Entry in PnC */
+ pnc_entry += rule_num;
+ ret_code = tpm_proc_pnc_create(TPM_PNC_DROP_PRECEDENCE, pnc_entry, &pnc_data);
+ IF_ERROR(ret_code);
+
+ /* Save to DB */
+ ret_code = tpm_db_drop_precedence_rule_set(rule_num);
+ IF_ERROR(ret_code);
+
+ return(TPM_RC_OK);
+}
+
+/*******************************************************************************
+* tpm_proc_clear_drop_precedence_rule()
+*
+* DESCRIPTION: Function to clear all L2 drop precedence rule based on P-bit or DEI.
+*
+* INPUTS:
+* None
+*
+* OUTPUTS:
+* None
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_db_err_t.
+*
+* COMMENTS:
+*
+*******************************************************************************/
+tpm_error_code_t tpm_proc_clear_drop_precedence_rule(uint32_t owner_id)
+{
+ int32_t ret_code;
+ uint32_t rule_num;
+ uint32_t pnc_index;
+ tpm_db_pnc_range_conf_t rang_conf;
+ uint32_t index;
+ tpm_db_drop_precedence_rule_entry_t rule_entry;
+
+ memset(&rang_conf, 0, sizeof(rang_conf));
+
+ TPM_OS_DEBUG(TPM_TPM_LOG_MOD, " Clear TPM drop precedence rules owner_id(%d)\n", owner_id);
+
+ /* Get Range Conf */
+ ret_code = tpm_db_pnc_rng_conf_get(TPM_PNC_DROP_PRECEDENCE, &rang_conf);
+ IF_ERROR(ret_code);
+
+ /* Get the rule_num */
+ for (index = 0; index < TPM_MAX_NUM_DROP_PRECEDENCE; index++) {
+
+ ret_code = tpm_db_drop_precedence_rule_get(index, &rule_entry);
+ IF_ERROR(ret_code);
+
+ if (rule_entry.valid == TPM_FALSE)
+ continue;
+
+ rule_num = rule_entry.rule_index;
+ TPM_OS_DEBUG(TPM_TPM_LOG_MOD, "with rule_num(%d)\n", rule_num);
+
+ /* Delete PNC Entry */
+ pnc_index = rang_conf.range_start + rule_num;
+ ret_code = tpm_pncl_entry_reset(pnc_index);
+ IF_ERROR(ret_code);
+
+ /* Increase number of free entries in pnc_range */
+ ret_code = tpm_db_pnc_rng_free_ent_inc(TPM_PNC_DROP_PRECEDENCE);
+ IF_ERROR(ret_code);
+
+ /* Save to DB */
+ ret_code = tpm_db_drop_precedence_rule_delete(rule_num);
+ IF_ERROR(ret_code);
+ }
+
+ return(TPM_RC_OK);
+}
+
+/*******************************************************************************
+* tpm_proc_set_drop_precedence_mode()
+*
+* DESCRIPTION: Function used to set drop precedence mode.
+*
+* INPUTS:
+* tcont_num
+*
+* OUTPUTS:
+*
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_error_code_t.
+*
+* COMMENTS:
+*
+*******************************************************************************/
+tpm_error_code_t tpm_proc_set_drop_precedence_mode(uint32_t owner_id,
+ tpm_drop_precedence_t mode)
+{
+ tpm_error_code_t ret_code;
+ tpm_drop_precedence_t current_mode;
+ uint32_t rule_num = 0;
+ tpm_vlan_key_t vlan_key;
+ tpm_vlan_key_t match_all_vlan_key;
+
+ /* Do nothing if the modes are the same */
+ ret_code = tpm_db_drop_precedence_mode_get(¤t_mode);
+ if (current_mode == mode) {
+ TPM_OS_INFO(TPM_TPM_LOG_MOD, " New drop precedence mode(%d) is the same as old one\n", mode);
+ return TPM_RC_OK;
+ }
+
+ /* Clear old rules */
+ ret_code = tpm_proc_clear_drop_precedence_rule(owner_id);
+ IF_ERROR(ret_code);
+
+ /* Set drop precedence mode */
+ memset(&vlan_key, 0, sizeof(vlan_key));
+ switch (mode) {
+ case TPM_DROP_PRECEDENCE_NONE:
+ case TPM_DROP_PRECEDENCE_8P0D:
+ /* Do nothing */
+ break;
+ case TPM_DROP_PRECEDENCE_7P1D:
+ vlan_key.pbit = 4;
+ vlan_key.pbit_mask = 0xff;
+ ret_code = tpm_proc_add_drop_precedence_rule(owner_id, rule_num++, &vlan_key, 1);
+ IF_ERROR(ret_code);
+ break;
+ case TPM_DROP_PRECEDENCE_6P2D:
+ vlan_key.pbit = 4;
+ vlan_key.pbit_mask = 0xff;
+ ret_code = tpm_proc_add_drop_precedence_rule(owner_id, rule_num++, &vlan_key, 1);
+ IF_ERROR(ret_code);
+ vlan_key.pbit = 2;
+ vlan_key.pbit_mask = 0xff;
+ ret_code = tpm_proc_add_drop_precedence_rule(owner_id, rule_num++, &vlan_key, 1);
+ IF_ERROR(ret_code);
+ break;
+ case TPM_DROP_PRECEDENCE_5P3D:
+ vlan_key.pbit = 4;
+ vlan_key.pbit_mask = 0xff;
+ ret_code = tpm_proc_add_drop_precedence_rule(owner_id, rule_num++, &vlan_key, 1);
+ IF_ERROR(ret_code);
+ vlan_key.pbit = 2;
+ vlan_key.pbit_mask = 0xff;
+ ret_code = tpm_proc_add_drop_precedence_rule(owner_id, rule_num++, &vlan_key, 1);
+ IF_ERROR(ret_code);
+ vlan_key.pbit = 0;
+ vlan_key.pbit_mask = 0xff;
+ ret_code = tpm_proc_add_drop_precedence_rule(owner_id, rule_num++, &vlan_key, 1);
+ IF_ERROR(ret_code);
+ break;
+ case TPM_DROP_PRECEDENCE_DEI:
+ vlan_key.cfi = 1;
+ vlan_key.cfi_mask = 0xff;
+ ret_code = tpm_proc_add_drop_precedence_rule(owner_id, rule_num++, &vlan_key, 1);
+ IF_ERROR(ret_code);
+ break;
+ default:
+ break;
+ }
+
+ /* Add rule to forward normal packets */
+ memset(&match_all_vlan_key, 0, sizeof(match_all_vlan_key));
+ ret_code = tpm_proc_add_drop_precedence_rule(owner_id, rule_num++, &match_all_vlan_key, 0);
+ IF_ERROR(ret_code);
+
+ /* Save drop precedence mode */
+ ret_code = tpm_db_drop_precedence_mode_set(mode);
+ IF_ERROR(ret_code);
+
+ return ret_code;
+}
+
+/*******************************************************************************
+* tpm_proc_get_drop_precedence_mode()
+*
+* DESCRIPTION: Function used to get drop precedence mode.
+*
+* INPUTS:
+* tcont_num
+*
+* OUTPUTS:
+*
+* RETURNS:
+* On success, the function returns TPM_OK. On error different types are returned
+* according to the case - see tpm_error_code_t.
+*
+* COMMENTS:
+*
+*******************************************************************************/
+tpm_error_code_t tpm_proc_get_drop_precedence_mode(uint32_t owner_id,
+ tpm_drop_precedence_t *mode)
+{
+ int32_t int_ret_code;
+
+ /* Get drop precedence mode */
+ int_ret_code = tpm_db_drop_precedence_mode_get(mode);
+
+ return (tpm_error_code_t)int_ret_code;
+}
+
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pkt_proc_logic.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pkt_proc_logic.h
index 9f47c12..7538ef0 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pkt_proc_logic.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pkt_proc_logic.h
@@ -930,6 +930,9 @@
tpm_error_code_t tpm_acl_rcvr_func_ipv6_l4(uint32_t owner_id, tpm_db_api_entry_t *api_data, uint32_t rule_idx_updt_en);
tpm_error_code_t tpm_acl_rcvr_func_cnm(uint32_t owner_id, tpm_db_api_entry_t *api_data, uint32_t rule_idx_updt_en);
+tpm_error_code_t tpm_proc_set_drop_precedence_mode(uint32_t owner_id, tpm_drop_precedence_t mode);
+tpm_error_code_t tpm_proc_get_drop_precedence_mode(uint32_t owner_id, tpm_drop_precedence_t *mode);
+
#ifdef __cplusplus
}
#endif
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pnc_logic.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pnc_logic.c
index 447de4e..c5df719 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pnc_logic.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pnc_logic.c
@@ -2255,7 +2255,7 @@
tpm_pncl_set_l4(sram_in->l4_type, sram_out);
if (sram_in->sram_updt_bm & TPM_PNCL_SET_COL)
- ;/* TODO : Fill in code */
+ tpm_pncl_set_ri_bit(sram_out, TPM_PNC_RI_COLOR_BIT, 1);
if (sram_in->sram_updt_bm & TPM_PNCL_SET_BC)
tpm_pncl_set_ri_bit(sram_out, TPM_PNC_RI_BC_BIT, 1);
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pnc_logic.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pnc_logic.h
index 271f82f..37728cb 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pnc_logic.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_pnc_logic.h
@@ -224,6 +224,7 @@
#define TPM_PNC_RI_L3_OFF_BIT (3)
#define TPM_PNC_RI_L3_FF_BIT (5)
#define TPM_PNC_RI_MAC_LEARN_BIT (9)/*Just for media convert MAC learning*/
+#define TPM_PNC_RI_COLOR_BIT (9)
#define TPM_PNC_RI_MC_BIT (10)
#define TPM_PNC_RI_BC_BIT (11)
#define TPM_PNC_RI_UC_BIT (12)
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_types.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_types.h
index 4f85779..89a4375 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_types.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/core/tpm_types.h
@@ -104,6 +104,10 @@
/* Maximum number of parallel running API calls to a certain API */
#define TPM_MAX_PARALLEL_API_CALLS (4)
+#ifdef CONFIG_MV_INCLUDE_PON
+typedef void (*PON_SHUTDOWN_FUNC)(unsigned int state); /* prototype for PON shut down function */
+#endif
+
/******************************************************************************/
/********************************** Packet Processing *************************/
/******************************************************************************/
@@ -346,6 +350,16 @@
typedef uint32_t tpm_pkt_mod_int_bm_t; /*ex: TPM_INT_L4_TCP | TPM_INT_L4_UDP ....*/
+
+typedef enum {
+ TPM_DROP_PRECEDENCE_NONE,
+ TPM_DROP_PRECEDENCE_8P0D,
+ TPM_DROP_PRECEDENCE_7P1D,
+ TPM_DROP_PRECEDENCE_6P2D,
+ TPM_DROP_PRECEDENCE_5P3D,
+ TPM_DROP_PRECEDENCE_DEI
+} tpm_drop_precedence_t;
+
/****************************************************************/
/* L2/L3 ACL rule related structures */
/****************************************************************/
@@ -1166,6 +1180,7 @@
TPM_PNC_MULTI_LPBK,
TPM_PNC_VIRT_UNI,
TPM_PNC_LOOP_DET_US,
+ TPM_PNC_DROP_PRECEDENCE,
TPM_PNC_L2_MAIN,
TPM_PNC_ETH_TYPE,
TPM_PNC_IGMP,
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_mng_if.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_mng_if.c
index 0b9e728..07ee2bb 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_mng_if.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_mng_if.c
@@ -343,6 +343,16 @@
ret = 0;
break;
+ /* ====== MV_TPM_IOCTL_GET_SECTION_SIZE ========= */
+ case MV_TPM_IOCTL_SET_DROP_PRECEDENCE_MODE:
+
+ rcode = tpm_set_drop_precedence_mode(tpm_admin->owner_id,
+ tpm_admin->drop_pre_mode);
+ if(rcode != TPM_OK)
+ goto ioctlErr;
+
+ ret = 0;
+ break;
default:
ret = -EINVAL;
}
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_mng_if.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_mng_if.h
index 61b0df8..826a7f4 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_mng_if.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_mng_if.h
@@ -130,6 +130,7 @@
MV_TPM_IOCTL_GET_API_G_OWNER,
MV_TPM_IOCTL_DEL_SECTION,
MV_TPM_IOCTL_GET_SECTION_SIZE,
+ MV_TPM_IOCTL_SET_DROP_PRECEDENCE_MODE,
MV_TPM_IOCTL_ADD_L2_ACL_RULE,
MV_TPM_IOCTL_ADD_L3_ACL_RULE,
MV_TPM_IOCTL_ADD_IPv4_ACL_RULE,
@@ -397,6 +398,7 @@
uint32_t owner_id;
tpm_api_type_t api_type;
tpm_api_ownership_error_t api_ownership_error;
+ tpm_drop_precedence_t drop_pre_mode;
int32_t section_size;
uint8_t section_dir;
uint8_t dummy1;
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_help.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_help.c
index 59cf9fd..25314e8 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_help.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_help.c
@@ -868,7 +868,7 @@
{
int off = 0;
- off += sprintf(buf+off, "echo [owner_id] [rule_num] > no_rule_add_l2 - delete L2 rule from hardware\n");
+ off += sprintf(buf+off, "echo [owner_id] [rule_idx] > no_rule_add_l2 - delete L2 rule from hardware\n");
off += sprintf(buf+off, "echo [owner_id] [rule_idx] > no_rule_add_l3 - delete L3 rule from hardware\n");
off += sprintf(buf+off, "echo [owner_id] [rule_idx] > no_rule_add_ipv4 - delete IPv4 rule from hardware\n");
off += sprintf(buf+off, "echo [owner_id] [rule_idx] > no_rule_add_ipv6_dip_acl - delete a IPv6 DIP ACL\n");
@@ -1763,9 +1763,32 @@
off += sprintf(buf+off, "\t\tTPM_UNK_MAC_CONTINUE, (frwd packet to GMAC1) %#.2X\n", TPM_UNK_MAC_CONTINUE);
return(off);
-
}
+/*******************************************************************************
+**
+** sfs_help_drop_pre
+**
+*******************************************************************************/
+int sfs_help_drop_pre(char* buf)
+{
+ int off = 0;
+
+ off += sprintf(buf+off, "echo [mode] > drop_pre_set\n");
+ off += sprintf(buf+off, "Set the drop precedence mode\n");
+ off += sprintf(buf+off, "\tmode (hex)drop precedence mode: \n");
+ off += sprintf(buf+off, "\t\TPM_DROP_PRECEDENCE_NONE: %d\n", TPM_DROP_PRECEDENCE_NONE);
+ off += sprintf(buf+off, "\t\TPM_DROP_PRECEDENCE_8P0D: %d\n", TPM_DROP_PRECEDENCE_8P0D);
+ off += sprintf(buf+off, "\t\TPM_DROP_PRECEDENCE_7P1D: %d\n", TPM_DROP_PRECEDENCE_7P1D);
+ off += sprintf(buf+off, "\t\TPM_DROP_PRECEDENCE_6P2D: %d\n", TPM_DROP_PRECEDENCE_6P2D);
+ off += sprintf(buf+off, "\t\TPM_DROP_PRECEDENCE_5P3D: %d\n", TPM_DROP_PRECEDENCE_5P3D);
+ off += sprintf(buf+off, "\t\TPM_DROP_PRECEDENCE_DEI: %d\n\n", TPM_DROP_PRECEDENCE_DEI);
+ off += sprintf(buf+off, "echo [dump] > drop_pre_show\n");
+ off += sprintf(buf+off, "Show the drop precedence mode\n");
+ off += sprintf(buf+off, "\tdump (dec)Any dump value\n");
+
+ return(off);
+}
#endif /* CONFIG_MV_TPM_SYSFS_HELP */
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_help.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_help.h
index 15de3bb..6a3747f 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_help.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_help.h
@@ -145,6 +145,7 @@
extern int sfs_help_flush_atu (char *buf);
extern int sfs_help_mac_learn_rule_add (char *buf);
extern int sfs_help_mac_learn_def_act_set (char* buf);
+extern int sfs_help_drop_pre(char* buf);
#else
#define sfs_tpm_cfg_index NULL
@@ -200,6 +201,7 @@
#define sfs_help_flush_atu NULL
#define sfs_help_mac_learn_rule_add NULL
#define sfs_help_mac_learn_def_act_set NULL
+#define sfs_help_drop_pre NULL
#define sfs_help_ds_load_balance_rule NULL
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_hwcall.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_hwcall.c
index 9764ca8..1b119ba 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_hwcall.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_hwcall.c
@@ -236,7 +236,6 @@
}
else
{
- tpmcfg_l2_prim_key_entry_t *pentry;
rule_action.next_phase = nextphase;
rule_action.pkt_act = action;
@@ -260,33 +259,7 @@
&pkt_mod,
pkt_mod_bm,
&rule_action)) == TPM_RC_OK)
- {
- if ((pentry = find_tpm_l2_prim_key_entry_by_owner_id_and_rule_num(ownerid, rulenum)) == 0)
- pentry = find_free_tpm_l2_prim_key_entry();
-
- if (pentry == 0)
- {
- printk(KERN_INFO "L2 rule DB full\n");
- }
- else
- {
- pentry->action = action;
- strcpy(pentry->frwd_name, frwdname);
- strcpy(pentry->key_name, l2keyname);
- strcpy(pentry->mod_name, modname);
- strcpy(pentry->next_phase, nextphase_str);
- pentry->owner_id = ownerid;
- pentry->parse_rule_bm = parserulebm;
- pentry->parse_flags_bm = parseflagbm;
- pentry->pkt_mod_bm = pkt_mod_bm;
- pentry->rule_num = rulenum;
- pentry->rule_idx = rule_idx;
- strcpy(pentry->src_port, srcport_str);
- pentry->used = 1;
- }
-
PR_RULE_IDX(rule_idx)
- }
else
{
printk(KERN_INFO "%s: tpm_add_l2_rule failed, rc[%d] - %s\n", __FUNCTION__, rc, get_tpm_err_str(rc));
@@ -1443,7 +1416,7 @@
} noruleaddl2_parm_indx_t;
// shell line parsing
uint32_t ownerid;
- uint32_t rule_num;
+ uint32_t rule_idx;
int parsedargs;
int numparms;
//Used in API call
@@ -1457,7 +1430,7 @@
else
{
// Get parameters
- parsedargs = sscanf(buf, "%d %d", &ownerid, &rule_num);
+ parsedargs = sscanf(buf, "%d %d", &ownerid, &rule_idx);
//printk(KERN_INFO "len=%d, parsedargs=%d. ownerid[%d], rule_idx[%d]\n",
// len, parsedargs, ownerid, rule_idx);
@@ -1468,24 +1441,14 @@
}
else
{
- tpmcfg_l2_prim_key_entry_t *pentry;
- pentry = find_tpm_l2_prim_key_entry_by_owner_id_and_rule_num(ownerid, rule_num);
- if (pentry != 0) {
- if ((rc = _tpm_del_l2_rule(ownerid, pentry->rule_idx)) == TPM_RC_OK)
- {
- printk(KERN_INFO "OK\n");
- }
- else
- {
- printk(KERN_INFO "%s: tpm_del_l2_prim_rule failed, rc[%d] - %s\n",
- __FUNCTION__, rc, get_tpm_err_str(rc));
- }
- pentry->used = 0;
+ if ((rc = _tpm_del_l2_rule(ownerid,
+ rule_idx)) == TPM_RC_OK)
+ {
+ printk(KERN_INFO "OK\n");
}
else
{
- printk("%s: Table l2_rule does not have entry owner_id[%d], rule_num[%d]\n",
- __FUNCTION__, ownerid, rule_num);
+ printk(KERN_INFO "%s: tpm_del_l2_prim_rule failed, rc[%d] - %s\n", __FUNCTION__, rc, get_tpm_err_str(rc));
}
}
}
@@ -6930,6 +6893,90 @@
}
}
+/*******************************************************************************
+* sfs_tpm_drop_pre_set
+*
+* DESCRIPTION:
+* This function configures drop precedence mode
+* INPUTS:
+* buf - Shell parameters as char buffer
+* len - Number of characters in buffer
+*
+*******************************************************************************/
+void sfs_tpm_drop_pre_set(const char *buf, size_t len)
+{
+ typedef enum {
+ mode = 0,
+ mode_max
+ } drop_pre_parm_indx_t;
+ /* shell line parsing */
+ uint32_t drop_pre;
+ int parsedargs;
+ int numparms;
+ MV_STATUS ret_code;
+
+ numparms = count_parameters(buf);
+ if (numparms != mode_max)
+ parm_error_completion(numparms, mode_max, buf, sfs_help_drop_pre);
+ else {
+ /* Get parameters */
+ parsedargs = sscanf(buf, "%d", &drop_pre);
+
+ if (parsedargs != numparms)
+ printk(KERN_INFO "Parse failure - %d/%d parameters were parsed\n", parsedargs, numparms);
+ else {
+ ret_code = tpm_set_drop_precedence_mode(0, drop_pre);
+ if (ret_code != MV_OK)
+ printk(KERN_INFO "%s: failed!\n", __func__);
+ else
+ printk(KERN_INFO "OK\n");
+ }
+ }
+}
+
+/*******************************************************************************
+* sfs_tpm_drop_pre_show
+*
+* DESCRIPTION:
+* This function show drop precedence mode
+* INPUTS:
+* buf - Shell parameters as char buffer
+* len - Number of characters in buffer
+*
+*******************************************************************************/
+void sfs_tpm_drop_pre_show(const char *buf, size_t len)
+{
+ typedef enum {
+ mode = 0,
+ mode_max
+ } drop_pre_parm_indx_t;
+ /* shell line parsing */
+ uint32_t drop_pre;
+ int parsedargs;
+ int numparms;
+ MV_STATUS ret_code;
+ tpm_drop_precedence_t drop_pre_mode;
+
+ numparms = count_parameters(buf);
+ if (numparms != mode_max)
+ parm_error_completion(numparms, mode_max, buf, sfs_help_drop_pre);
+ else {
+ /* Get parameters */
+ parsedargs = sscanf(buf, "%d", &drop_pre);
+
+ if (parsedargs != numparms)
+ printk(KERN_INFO "Parse failure - %d/%d parameters were parsed\n", parsedargs, numparms);
+ else {
+ ret_code = tpm_get_drop_precedence_mode(0, &drop_pre_mode);
+ if (ret_code != MV_OK)
+ printk(KERN_INFO "%s: failed!\n", __func__);
+ else
+ printk(KERN_INFO "OK Drop precedence mode %d\n", drop_pre_mode);
+ }
+ }
+}
+
+
#ifdef CONFIG_MV_TPM_SFS_2_IOCTL
tpm_error_code_t tpm_add_ds_load_balance_rule_bounce(uint32_t owner_id,
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_hwcall.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_hwcall.h
index 74037d7..6f4277f 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_hwcall.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_hwcall.h
@@ -180,6 +180,9 @@
extern void sfs_tpm_cfg_set_fc_oneshot(const char *buf, size_t len);
extern void sfs_tpm_cfg_fc_enable(const char *buf, size_t len);
+extern void sfs_tpm_drop_pre_set(const char *buf, size_t len);
+extern void sfs_tpm_drop_pre_show(const char *buf, size_t len);
+
extern char *ipv6_gen_key_empty_name;
extern char *ipv6_dip_key_empty_name;
extern char *ipv6_l4_key_empty_name;
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_rule_db.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_rule_db.c
index d96c532..459cfc0 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_rule_db.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_rule_db.c
@@ -1541,7 +1541,6 @@
else
{
strcpy(pentry->name, name);
- pentry->l2_key_type = l2_key_type_ethertype;
pentry->l2_acl.ether_type = (uint16_t)temp_ety;
}
}
@@ -1601,7 +1600,6 @@
else
{
strcpy(pentry->name, name);
- pentry->l2_key_type = l2_key_type_gemport;
pentry->l2_acl.gem_port = (uint16_t)temp_gemport;
}
}
@@ -1680,7 +1678,6 @@
else
{
strcpy(pentry->name, name);
- pentry->l2_key_type = l2_key_type_macaddr;
pentry->l2_acl.mac.mac_sa[0] = (uint8_t)sa[0]; pentry->l2_acl.mac.mac_sa[1] = (uint8_t)sa[1]; pentry->l2_acl.mac.mac_sa[2] = (uint8_t)sa[2];
pentry->l2_acl.mac.mac_sa[3] = (uint8_t)sa[3]; pentry->l2_acl.mac.mac_sa[4] = (uint8_t)sa[4]; pentry->l2_acl.mac.mac_sa[5] = (uint8_t)sa[5];
@@ -1755,7 +1752,6 @@
else
{
strcpy(pentry->name, name);
- pentry->l2_key_type = l2_key_type_pppoe;
pentry->l2_acl.pppoe_hdr.ppp_session = (uint16_t)temp_session;
pentry->l2_acl.pppoe_hdr.ppp_proto = (uint16_t)temp_prototype;
}
@@ -1823,9 +1819,6 @@
else
{
strcpy(pentry->name, name);
- strcpy(pentry->vlan_rule1, vlan1_name);
- strcpy(pentry->vlan_rule2, vlan2_name);
- pentry->l2_key_type = l2_key_type_vlan;
if (pvlan1entry != 0)
{
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_setup.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_setup.c
index 32c3056..940e8fc 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_setup.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_setup.c
@@ -129,7 +129,7 @@
{"no_rule_add_l2", sfs_tpm_cfg_set_no_rule_add_l2},
{"no_rule_add_l3", sfs_tpm_cfg_set_no_rule_add_l3},
{"no_rule_add_ipv4", sfs_tpm_cfg_set_no_rule_add_ipv4},
- {"no_mc_stream_add_ipv6", sfs_tpm_cfg_set_no_mc_stream_add_ipv6},
+ {"no_mc_stream_add_ipv6", sfs_tpm_cfg_set_no_mc_stream_add_ipv6},
{"no_mc_stream_add_ipv4", sfs_tpm_cfg_set_no_mc_stream_add_ipv4},
{"oam_channel", sfs_tpm_cfg_set_oam_channel},
{"omci_channel", sfs_tpm_cfg_set_omci_channel},
@@ -213,7 +213,10 @@
#ifdef TPM_FC_DEBUG
{"fc_oneshot_set", sfs_tpm_cfg_set_fc_oneshot},
#endif
- {"fc_enable", sfs_tpm_cfg_fc_enable}
+ {"fc_enable", sfs_tpm_cfg_fc_enable},
+
+ {"drop_pre_set", sfs_tpm_drop_pre_set},
+ {"drop_pre_show", sfs_tpm_drop_pre_show},
};
static int num_store_name_funcs = sizeof(store_sysfs_name_func_ara)/sizeof(store_sysfs_name_func_ara[0]);
@@ -261,7 +264,7 @@
{
char *sysfs_name;
int (*sysfs_func)( char *buf);
-} show_sysfs_name_func_t;
+ } show_sysfs_name_func_t;
static show_sysfs_name_func_t show_sysfs_name_func_ara[] =
{
@@ -318,14 +321,9 @@
{"help_flush_vtu", sfs_help_flush_vtu},
{"help_mac_learn_rule_add", sfs_help_mac_learn_rule_add},
{"help_mac_learn_def_act_set", sfs_help_mac_learn_def_act_set},
-
- {"show_frwd_rule", sfs_show_frwd_rule},
- {"show_l2_key_ethertype", sfs_show_l2_key_ethertype},
- {"show_l2_key_mac_addr", sfs_show_l2_key_mac_addr},
- {"show_l2_key_vlan", sfs_show_l2_key_vlan},
- {"show_l2_rule", sfs_show_l2_rule},
- {"show_vlan_rule", sfs_show_vlan_rule},
+ {"help_drop_pre", sfs_help_drop_pre},
};
+
static int num_show_name_funcs = sizeof(show_sysfs_name_func_ara)/sizeof(show_sysfs_name_func_ara[0]);
@@ -424,18 +422,12 @@
static DEVICE_ATTR(help_tpm_self_check, S_IRUSR, tpm_cfg_show, tpm_cfg_store);
static DEVICE_ATTR(help_flush_atu, S_IRUSR, tpm_cfg_show, tpm_cfg_store);
static DEVICE_ATTR(help_flush_vtu, S_IRUSR, tpm_cfg_show, tpm_cfg_store);
+static DEVICE_ATTR(help_drop_pre, S_IRUSR, tpm_cfg_show, tpm_cfg_store);
#endif /* CONFIG_MV_TPM_SYSFS_HELP */
-/* sysfs for dumping forwarding table in yaml. */
-static DEVICE_ATTR(show_frwd_rule, S_IRUSR, tpm_cfg_show, NULL);
-static DEVICE_ATTR(show_l2_key_ethertype, S_IRUSR, tpm_cfg_show, NULL);
-static DEVICE_ATTR(show_l2_key_mac_addr, S_IRUSR, tpm_cfg_show, NULL);
-static DEVICE_ATTR(show_l2_key_vlan, S_IRUSR, tpm_cfg_show, NULL);
-static DEVICE_ATTR(show_l2_rule, S_IRUSR, tpm_cfg_show, NULL);
-static DEVICE_ATTR(show_vlan_rule, S_IRUSR, tpm_cfg_show, NULL);
-
// rule set
static DEVICE_ATTR(frwd_rule_set, S_IWUSR, tpm_cfg_show, tpm_cfg_store);
+
static DEVICE_ATTR(vlan_rule_set, S_IWUSR, tpm_cfg_show, tpm_cfg_store);
static DEVICE_ATTR(mod_mh_rule_set, S_IWUSR, tpm_cfg_show, tpm_cfg_store);
static DEVICE_ATTR(mod_vlan_rule_set, S_IWUSR, tpm_cfg_show, tpm_cfg_store);
@@ -570,6 +562,10 @@
static DEVICE_ATTR(fc_config_set, S_IWUSR, tpm_cfg_show, tpm_cfg_store);
static DEVICE_ATTR(fc_us_period_set, S_IWUSR, tpm_cfg_show, tpm_cfg_store);
static DEVICE_ATTR(fc_enable, S_IWUSR, tpm_cfg_show, tpm_cfg_store);
+
+static DEVICE_ATTR(drop_pre_set, S_IWUSR, tpm_cfg_show, tpm_cfg_store);
+static DEVICE_ATTR(drop_pre_show, S_IWUSR, tpm_cfg_show, tpm_cfg_store);
+
#ifdef TPM_FC_DEBUG
static DEVICE_ATTR(fc_oneshot_set, S_IWUSR, tpm_cfg_show, tpm_cfg_store);
#endif
@@ -643,6 +639,29 @@
/******************************************************************************/
/* ========================================================================== */
+/* TPM drop_precedence SYSFS */
+/* ========================================================================== */
+
+static struct attribute *tpm_cfg_drop_pre_sw_attrs[] =
+{
+#ifdef CONFIG_MV_TPM_SYSFS_HELP
+ &dev_attr_help_drop_pre.attr,
+#endif /* CONFIG_MV_TPM_SYSFS_HELP */
+
+ &dev_attr_drop_pre_set.attr,
+ &dev_attr_drop_pre_show.attr,
+
+ NULL
+};
+
+static struct attribute_group tpm_drop_pre_sw_group =
+{
+ .name = "drop_pre",
+ .attrs = tpm_cfg_drop_pre_sw_attrs
+};
+
+/******************************************************************************/
+/* ========================================================================== */
/* TPM cfg_l2 SYS FS STORE ROUTINE SWITCHER */
/* ========================================================================== */
@@ -657,10 +676,6 @@
&dev_attr_help_mac_learn_rule_add.attr,
&dev_attr_help_mac_learn_def_act_set.attr,
#endif /* CONFIG_MV_TPM_SYSFS_HELP */
- &dev_attr_show_l2_key_ethertype.attr,
- &dev_attr_show_l2_key_mac_addr.attr,
- &dev_attr_show_l2_key_vlan.attr,
- &dev_attr_show_l2_rule.attr,
&dev_attr_l2_key_ethertype_rule_set.attr,
&dev_attr_l2_key_gemport_rule_set.attr,
@@ -848,7 +863,6 @@
&dev_attr_help_rule_table_display.attr,
&dev_attr_help_delete_entry_rule_table.attr,
#endif /* CONFIG_MV_TPM_SYSFS_HELP */
- &dev_attr_show_frwd_rule.attr,
&dev_attr_frwd_rule_set.attr,
@@ -877,7 +891,6 @@
&dev_attr_help_rule_table_display.attr,
&dev_attr_help_delete_entry_rule_table.attr,
#endif /* CONFIG_MV_TPM_SYSFS_HELP */
- &dev_attr_show_vlan_rule.attr,
&dev_attr_vlan_rule_set.attr,
@@ -1162,6 +1175,7 @@
#endif /* CONFIG_MV_TPM_SYSFS_HELP */
&dev_attr_frwd_rule_set.attr,
+
&dev_attr_vlan_rule_set.attr,
&dev_attr_mod_vlan_rule_set.attr,
&dev_attr_mod_ipv4_addr_rule_set.attr,
@@ -1278,6 +1292,7 @@
{"cfg_mod", &tpm_cfg_mod_sw_group},
{"cfg_frwd", &tpm_cfg_frwd_sw_group},
{"cfg_vlan", &tpm_cfg_vlan_sw_group},
+ {"drop_pre", &tpm_drop_pre_sw_group},
{"cfg_l2", &tpm_cfg_l2_sw_group},
{"cfg_l3", &tpm_cfg_l3_sw_group},
{"cfg_ipv4", &tpm_cfg_ipv4_sw_group},
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_utils.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_utils.c
index 1778205..00099a5 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_utils.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_utils.c
@@ -1210,68 +1210,6 @@
}
}
-static tpmcfg_l2_prim_key_entry_t tpm_sysfs_l2_rule_table[DB_TPMCFG_MAX_ENTRIES];
-
-static tpm_generic_rule_db_t tpm_l2_rule_db =
-{
- .max_num_entries = DB_TPMCFG_MAX_ENTRIES,
- .num_entries = 0,
- .size_entry = sizeof(tpmcfg_l2_prim_key_entry_t),
- .entryAra = tpm_sysfs_l2_rule_table
-};
-
-
-static void init_tpm_l2_rule_db(void)
-{
- tpmcfg_l2_prim_key_entry_t *pentry = (tpmcfg_l2_prim_key_entry_t *)tpm_l2_rule_db.entryAra;
- int indx;
-
- printk(KERN_INFO "%s: Clearing DB\n", __FUNCTION__);
- for (indx = 0; indx < tpm_l2_rule_db.max_num_entries; indx++, pentry++)
- {
- pentry->used = 0;
- }
-}
-
-tpmcfg_l2_prim_key_entry_t *find_tpm_l2_prim_key_entry_by_owner_id_and_rule_num(uint32_t owner_id, uint32_t rule_num) {
- tpmcfg_l2_prim_key_entry_t *pentry = (tpmcfg_l2_prim_key_entry_t *)tpm_l2_rule_db.entryAra;
- int indx;
-
- for (indx = 0; indx < tpm_l2_rule_db.max_num_entries; indx++, pentry++)
- {
- if (pentry->owner_id == owner_id && pentry->rule_num == rule_num && pentry->used)
- return pentry;
- }
- return 0;
-}
-
-tpmcfg_l2_prim_key_entry_t *find_free_tpm_l2_prim_key_entry(void) {
- tpmcfg_l2_prim_key_entry_t *pentry = (tpmcfg_l2_prim_key_entry_t *)tpm_l2_rule_db.entryAra;
- int indx;
-
- for (indx = 0; indx < tpm_l2_rule_db.max_num_entries; indx++, pentry++)
- {
- if (!pentry->used) return pentry;
- }
- return 0;
-}
-
-GT_BOOL del_tpm_l2_prim_key_entry(uint32_t owner_id, uint32_t rule_num) {
- tpmcfg_l2_prim_key_entry_t *pentry = (tpmcfg_l2_prim_key_entry_t *)tpm_l2_key_db.entryAra;
- int indx;
-
- for (indx = 0; indx < tpm_l2_key_db.max_num_entries; indx++, pentry++)
- {
- if (pentry->owner_id == owner_id && pentry->rule_num == rule_num && pentry->used)
- {
- pentry->used = 0;
- return GT_TRUE;
- };
- }
- return GT_FALSE;
-}
-
-
/********************************************************************************/
/* L3 ACL table and API */
/********************************************************************************/
@@ -1887,7 +1825,6 @@
init_tpm_vlan_db();
init_tpm_mod_db();
init_tpm_l2_key_db();
- init_tpm_l2_rule_db();
init_tpm_l3_key_db();
init_tpm_ipv4_key_db();
init_tpm_ipv6_key_db();
@@ -1936,146 +1873,3 @@
return(TPM_RC_OK);
}
-int sfs_show_frwd_rule (char *buf)
-{
- tpmcfg_frwd_entry_t *pentry =
- (tpmcfg_frwd_entry_t *)tpm_frwd_rule_db.entryAra;
- int indx;
- int off = 0;
-
- for (indx = 0; indx < tpm_frwd_rule_db.max_num_entries; indx++, pentry++)
- {
- if (pentry->name[0] != 0)
- {
- off += sprintf(buf+off, "--- !FrwdRule\n");
- off += sprintf(buf+off, "gem_port: %d\n", pentry->frwd.gem_port);
- off += sprintf(buf+off, "port_bitmap: %-3d\n", pentry->frwd.trg_port);
- off += sprintf(buf+off, "queue: %d\n", pentry->frwd.trg_queue);
- off += sprintf(buf+off, "rule_name: %s\n", pentry->name);
- }
- }
- return off;
-}
-
-int sfs_show_l2_key_ethertype (char *buf)
-{
- tpmcfg_l2_key_entry_t *pentry = (tpmcfg_l2_key_entry_t *)tpm_l2_key_db.entryAra;
- int indx;
- int off = 0;
-
- for (indx = 0; indx < tpm_l2_key_db.max_num_entries; indx++, pentry++)
- {
- if (pentry->name[0] != 0 && l2_key_type_ethertype == pentry->l2_key_type)
- {
- off += sprintf(buf+off, "--- !L2KeyEtherType\n");
- off += sprintf(buf+off, "rule_name: %s\n", pentry->name);
- off += sprintf(buf+off, "ethertype: 0x%x\n", pentry->l2_acl.ether_type);
- }
- }
- return off;
-}
-
-int sfs_show_l2_key_mac_addr (char *buf)
-{
- tpmcfg_l2_key_entry_t *pentry = (tpmcfg_l2_key_entry_t *)tpm_l2_key_db.entryAra;
- int indx;
- int off = 0;
- char d1[60];
- char d2[60];
- char d1_mask[60];
- char d2_mask[60];
-
- for (indx = 0; indx < tpm_l2_key_db.max_num_entries; indx++, pentry++)
- {
- if (pentry->name[0] != 0 && l2_key_type_macaddr == pentry->l2_key_type)
- {
- off += sprintf(buf+off, "--- !L2KeyMacAddr\n");
- format_mac_addr(pentry->l2_acl.mac.mac_da, d1);
- format_mac_addr(pentry->l2_acl.mac.mac_da_mask, d1_mask);
- format_mac_addr(pentry->l2_acl.mac.mac_sa, d2);
- format_mac_addr(pentry->l2_acl.mac.mac_sa_mask, d2_mask);
- off += sprintf(buf+off, "da: %s\n", d1);
- off += sprintf(buf+off, "da_mask: %s\n", d1_mask);
- off += sprintf(buf+off, "rule_name: %s\n", pentry->name);
- off += sprintf(buf+off, "sa: %s\n", d2);
- off += sprintf(buf+off, "sa_mask: %s\n", d2_mask);
- }
- }
- return off;
-}
-
-int sfs_show_l2_key_vlan (char *buf)
-{
- tpmcfg_l2_key_entry_t *pentry = (tpmcfg_l2_key_entry_t *)tpm_l2_key_db.entryAra;
- int indx;
- int off = 0;
-
- for (indx = 0; indx < tpm_l2_key_db.max_num_entries; indx++, pentry++)
- {
- if (pentry->name[0] != 0 && l2_key_type_vlan == pentry->l2_key_type)
- {
- off += sprintf(buf+off, "--- !L2KeyVlan\n");
- off += sprintf(buf+off, "rule_name: %s\n", pentry->name);
- off += sprintf(buf+off, "vlan_rule1: %s\n", pentry->vlan_rule1);
- off += sprintf(buf+off, "vlan_rule2: %s\n", pentry->vlan_rule2);
- }
- }
- return off;
-}
-
-int sfs_show_vlan_rule (char *buf)
-{
- tpmcfg_vlan_entry_t *pentry =
- (tpmcfg_vlan_entry_t *)tpm_vlan_rule_db.entryAra;
- int indx;
- int off = 0;
-
- for (indx = 0; indx < tpm_vlan_rule_db.max_num_entries; indx++, pentry++)
- {
- if (pentry->name[0] != 0)
- {
- off += sprintf(buf+off, "--- !VlanRule\n");
- off += sprintf(buf+off, "rule_name: %s\n", pentry->name);
- off += sprintf(buf+off, "tpid: 0x%x\n", pentry->vlan.tpid);
- off += sprintf(buf+off, "tpid_mask: 0x%x\n",
- pentry->vlan.tpid_mask);
- off += sprintf(buf+off, "vid: %d\n", pentry->vlan.vid);
- off += sprintf(buf+off, "vid_mask: 0x%x\n", pentry->vlan.vid_mask);
- off += sprintf(buf+off, "cfi: %d\n", pentry->vlan.cfi);
- off += sprintf(buf+off, "cfi_mask: 0x%x\n", pentry->vlan.cfi_mask);
- off += sprintf(buf+off, "pbit: %d\n", pentry->vlan.pbit);
- off += sprintf(buf+off, "pbit_mask: 0x%x\n",
- pentry->vlan.pbit_mask);
- }
- }
- return off;
-}
-
-int sfs_show_l2_rule (char *buf)
-{
- tpmcfg_l2_prim_key_entry_t *pentry = (tpmcfg_l2_prim_key_entry_t *)tpm_l2_rule_db.entryAra;
- int indx;
- int off = 0;
-
- for (indx = 0; indx < tpm_l2_rule_db.max_num_entries; indx++, pentry++)
- {
- if (pentry->used)
- {
- off += sprintf(buf+off, "--- !L2Rule\n");
- off += sprintf(buf+off, "action: %d\n", pentry->action);
- off += sprintf(buf+off, "frwd_name: %s\n", pentry->frwd_name);
- off += sprintf(buf+off, "key_name: %s\n", pentry->key_name);
- off += sprintf(buf+off, "mod_name: %s\n", pentry->mod_name);
- off += sprintf(buf+off, "next_phase: %s\n", pentry->next_phase);
- off += sprintf(buf+off, "owner_id: %d\n", pentry->owner_id);
- off += sprintf(buf+off, "parse_flags_bm: 0x%x\n", pentry->parse_flags_bm);
- off += sprintf(buf+off, "parse_rule_bm: 0x%x\n", pentry->parse_rule_bm);
- off += sprintf(buf+off, "pkt_mod_bm: 0x%x\n", pentry->pkt_mod_bm);
- off += sprintf(buf+off, "rule_idx: %d\n", pentry->rule_idx);
- off += sprintf(buf+off, "rule_num: %d\n", pentry->rule_num);
- off += sprintf(buf+off, "src_port: %s\n", pentry->src_port);
- }
- }
- return off;
-}
-
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_utils.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_utils.h
index ef23a68..ddf2bcf 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_utils.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_tpm/perf/tpm_sysfs_utils.h
@@ -198,28 +198,10 @@
extern GT_BOOL del_tpm_mod_entry_by_name (char *name);
extern void show_tpm_mod_db(void);
-typedef enum
-{
- l2_key_type_macaddr,
- l2_key_type_vlan,
- l2_key_type_ethertype,
- l2_key_type_gemport,
- l2_key_type_pppoe
-} tpmcfg_l2_key_type_t;
-
// L2 ACL entry and DB API
typedef struct
{
char name[DB_TPMCFG_MAX_NAME+1];
- tpmcfg_l2_key_type_t l2_key_type;
- /* This is a hack. Vlan name is not saved as part of l2_key. Therefore it is
- * kind of hard to track which vlan rule l2_key_vlan is using. But
- * tpm_l2_acl_key_t is actually used by tcam. The size should not be
- * altered. We have to put aside some space just for VLAN name in case the
- * l2_key_type is l2_key_vlan.
- */
- char vlan_rule1[DB_TPMCFG_MAX_NAME+1];
- char vlan_rule2[DB_TPMCFG_MAX_NAME+1];
tpm_l2_acl_key_t l2_acl;
} tpmcfg_l2_key_entry_t;
@@ -228,30 +210,6 @@
extern GT_BOOL del_tpm_l2_key_entry_by_name (char *name);
extern void show_tpm_l2_key_db(void);
-typedef struct
-{
- /* owner_id is not used at all... Only for logging. We cannot get it from
- * tpm_rule_l2_prim_key_t. rule_num is the real track number for app. */
-
- uint32_t action;
- char frwd_name[DB_TPMCFG_MAX_NAME+1];
- char key_name[DB_TPMCFG_MAX_NAME+1];
- char mod_name[DB_TPMCFG_MAX_NAME+1];
- char next_phase[DB_TPMCFG_MAX_NAME+1];
- uint32_t owner_id;
- uint32_t parse_rule_bm;
- uint32_t parse_flags_bm;
- uint32_t pkt_mod_bm;
- uint32_t rule_num;
- uint32_t rule_idx;
- char src_port[DB_TPMCFG_MAX_NAME+1];
- int used;
-} tpmcfg_l2_prim_key_entry_t;
-
-extern tpmcfg_l2_prim_key_entry_t *find_tpm_l2_prim_key_entry_by_owner_id_and_rule_num(uint32_t owner_id, uint32_t rule_num);
-extern tpmcfg_l2_prim_key_entry_t *find_free_tpm_l2_prim_key_entry(void);
-extern GT_BOOL del_tpm_l2_prim_key_entry(uint32_t owner_id, uint32_t rule_num);
-
// L3 ACL entry and DB API
typedef struct
{
@@ -333,11 +291,5 @@
);
tpm_error_code_t tpm_proc_send_genquery_to_uni(tpm_trg_port_type_t dest_port_bm, uint32_t packet_num);
-extern int sfs_show_frwd_rule(char *buf);
-extern int sfs_show_l2_key_ethertype(char *buf);
-extern int sfs_show_l2_key_mac_addr(char *buf);
-extern int sfs_show_l2_key_vlan(char *buf);
-extern int sfs_show_l2_rule(char *buf);
-extern int sfs_show_vlan_rule(char *buf);
#endif /* _TPM_USR_TPM_SYSFS_DB_H_*/
diff --git a/arch/arm/plat-feroceon/mv_hal/gpp/mvGpp.c b/arch/arm/plat-feroceon/mv_hal/gpp/mvGpp.c
index bb991f0..f30705c 100755
--- a/arch/arm/plat-feroceon/mv_hal/gpp/mvGpp.c
+++ b/arch/arm/plat-feroceon/mv_hal/gpp/mvGpp.c
@@ -335,7 +335,6 @@
return MV_ERROR;
}
}
-
gppRegSet(group, GPP_DATA_OUT_REG(group), mask, value);
return MV_OK;
diff --git a/arch/arm/plat-feroceon/mv_hal/gpp/mvGppRegs.h b/arch/arm/plat-feroceon/mv_hal/gpp/mvGppRegs.h
index d7ae553..cd07c56 100755
--- a/arch/arm/plat-feroceon/mv_hal/gpp/mvGppRegs.h
+++ b/arch/arm/plat-feroceon/mv_hal/gpp/mvGppRegs.h
@@ -115,6 +115,7 @@
#define GPP_INT_CAUSE_REG(grp) (MV_GPP_REGS_BASE(grp) + 0x14)
#define GPP_INT_MASK_REG(grp) (MV_GPP_REGS_BASE(grp) + 0x18)
#define GPP_INT_LVL_REG(grp) (MV_GPP_REGS_BASE(grp) + 0x1C)
+#define GPP_BLINK_SEL_REG(grp) (MV_GPP_REGS_BASE(grp) + 0x20)
#define GPP_BLINK_CNTR_ON(idx) (MV_GPP_REGS_BASE(0) + 0xC0 + (idx) * 8)
#define GPP_BLINK_CNTR_OFF(idx) (MV_GPP_REGS_BASE(0) + 0xC4 + (idx) * 8)
diff --git a/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuDefines.h b/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuDefines.h
index aee9016..8829dec 100755
--- a/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuDefines.h
+++ b/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuDefines.h
@@ -206,8 +206,8 @@
#define ONU_GPON_DS_MSG_BER_INTERVAL (0x12)
#define ONU_GPON_DS_MSG_KEY_SWITCH_TIME (0x13)
#define ONU_GPON_DS_MSG_EXT_BURST_LEN (0x14)
-#define ONU_GPON_DS_MSG_PON_ID (0x15)
-#define ONU_GPON_DS_MSG_LAST (ONU_GPON_DS_MSG_PON_ID)
+#define ONU_GPON_DS_MSG_PON_ID (0x15)
+#define ONU_GPON_DS_MSG_LAST (ONU_GPON_DS_MSG_PON_ID)
/* Upstream */
#define ONU_GPON_US_MSG_SN_ONU (0x01)
@@ -266,7 +266,7 @@
#define ONU_GPON_EVENT_MSG_BER_INTERVAL (ONU_GPON_DS_MSG_BER_INTERVAL)
#define ONU_GPON_EVENT_MSG_KEY_SWITCH_TIME (ONU_GPON_DS_MSG_KEY_SWITCH_TIME)
#define ONU_GPON_EVENT_MSG_EXT_BURST_LEN (ONU_GPON_DS_MSG_EXT_BURST_LEN)
-#define ONU_GPON_EVENT_MSG_PON_ID (ONU_GPON_DS_MSG_PON_ID)
+#define ONU_GPON_EVENT_MSG_PON_ID (ONU_GPON_DS_MSG_PON_ID)
/* Alarms */
#define ONU_GPON_EVENT_ALM_GEN_BASE (ONU_GPON_ALARM_GEN_BASE)
diff --git a/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuMac.h b/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuMac.h
index 6827cd2..e58f03a 100755
--- a/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuMac.h
+++ b/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuMac.h
@@ -120,7 +120,7 @@
/* TX Delay Register - const */
#define GPON_TX_DELAY_TD_622 (0x0AA1) /* Const Delay */
-#define GPON_TX_DELAY_TD_1244 (0x1984) /* Const Delay */
+#define GPON_TX_DELAY_TD_1244 (0x15DD) /* Const Delay */
/* TX Delay Register - equilization */
#define GPON_TX_EQUAL_DELAY_TD (0x0000) /* Equilization Delay */
@@ -507,6 +507,19 @@
#define EPON_MAC_PCS_FRAME_SIZE_LIMIT_SIZE_DEF (0x640)
#define EPON_MAC_PCS_FRAME_SIZE_LIMIT_LATENCY_DEF (0xED8)
+/* Default value for timestamp configuration registers*/
+#define EPON_MAC_TXM_TIMESTAMP_OFFSET (0x77B)
+#define EPON_MAC_TXM_USE_TIMESTAMP_IMG (0x0)
+#define EPON_MAC_TXM_ADD_SYNC_TIME_TO_TM (0x1)
+#define EPON_MAC_GPM_TIMESTAMP_OFFSET (0x760)
+#define EPON_MAC_GPM_ADD_SYNC_TIME_TO_TM (0x0)
+
+#define EPON_MAC_RXM_TIMESTAMP_OFFSET (0x250)
+#define EPON_MAC_RXM_TIMESTAMP_SIGN (0x0)
+#define EPON_MAC_RXM_TIMESTAMP_SELECT (0x1)
+
+
+
/* Global functions
------------------------------------------------------------------------------*/
diff --git a/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuRegs.h b/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuRegs.h
index cde1418..c47ad39 100755
--- a/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuRegs.h
+++ b/arch/arm/plat-feroceon/mv_hal/pon/mvPonOnuRegs.h
@@ -690,6 +690,7 @@
/* Macros
------------------------------------------------------------------------------*/
#define PON_GPIO_NOT_USED (0xFFFF)
+
#define PON_GPIO_GET(gppClass, gpioGroup, gpioMask)\
{\
MV_32 gpioNum;\
diff --git a/arch/arm/plat-feroceon/mv_hal/qd-dsdt/src/msapi/gtPhyCtrl.c b/arch/arm/plat-feroceon/mv_hal/qd-dsdt/src/msapi/gtPhyCtrl.c
index bff23d3..df24d81 100755
--- a/arch/arm/plat-feroceon/mv_hal/qd-dsdt/src/msapi/gtPhyCtrl.c
+++ b/arch/arm/plat-feroceon/mv_hal/qd-dsdt/src/msapi/gtPhyCtrl.c
@@ -1444,7 +1444,8 @@
if(state == NULL)
{
- DBG_INFO(("Input point state equals NULL which is illegal, return\n"));
+ DBG_INFO(("Input point state equals NULL which is illegal, return\n"));
+ return GT_BAD_PARAM;
}
/* translate LPORT to hardware port */
@@ -1657,6 +1658,7 @@
if(dMode == NULL)
{
DBG_INFO(("Input point state equals NULL which is illegal, return\n"));
+ return GT_BAD_PARAM;
}
/* translate LPORT to hardware port */