Marvell交换机luaCLI引擎启动流程以及如何解决函数cpssInitSystem()被二次调用的问题

来源:互联网 发布:java 成功生成文件夹 编辑:程序博客网 时间:2024/06/07 05:42

1.本文目的

(1)弄清luaCLI引擎的启动流程;

(2)交换机从“命令窗口界面”切换到“luaCLI界面”,如何防止程序跑飞?

说明:从“命令窗口界面”切换到“luaCLI界面”,会调用函数luaCLIEngine_EventLoop(),接着功能函数cpssInitSystem()也会跟着被二次调用(上电时,该函数第一次被调用),交换机系统被两次初始化后,系统就会跑飞了。


2.luaCLI引擎的程序流程图



luaCLI引擎的初始化流程如上图所示,系统上电初始化后会默认进入luaCLI命令窗口,除了luaCLI命令窗口,cpss源码还支持普通命令窗口以及文件系统窗口。三种窗口的切换方式如下:

(1)luaCLI命令窗口-->普通命令窗口:输入CLIexit

(2)普通命令窗口-->luaCLI命令窗口:输入luaCLI

(3)普通命令窗口-->文件系统窗口:输入osShell

(4)文件系统窗口-->普通命令窗口:输入exit

说明:luaCLI命令窗口不能直接切换到文件系统窗口,必须先切换到普通命令窗口,再切换到文件系统窗口。

另外:

(1)普通命令窗口对应的入口函数为cmdEventLoop(),对应C程序为cmdConsole.c;

(2)luaCLI命令窗口对应的入口函数为luaCLI_EventLoop(),对应C程序为cmdLuaCLI.c;

(3)luaCLI引擎入口函数为luaCLIEngine_EventLoop(),对应C程序为luaCLIEngineCLI.c;

(4)命令窗口初始化函数为cmdInit(),对应C程序为cmdMain.c;

(5)文件系统窗口的入口函数为cmdosshell()。


3.如何防止在命令窗口的切换过程中,函数cpssInitSystem()被二次调用?

解决思路:给函数cpssInitSystem()添加一个全局开关GT_STATUS  cpssInitSystem_auto_set,cpssInitSystem_auto_set默认设置为GT_OK,如果函数cpssInitSystem()被调用过一次后,将GT_FAIL赋值给cpssInitSystem_auto_set,这样在窗口的切换的过程中可以保证函数cpssInitSystem()不被二次调用。

具体修改方法是:

(1)在函数cmdInit()所在C程序cmdMain.c的头部添加全局变量cpssInitSystem_auto_set的申明,并给该变量赋值GT_OK;

(2)在luaCLIEngineCLI.c代码

/* accept and handle input as long as connected */
    while (IOStream->connected(IOStream))

的上方添加代码:

/******************************************************************************** Modified by: snaking616@163.com* Date: 20171022* DESCRIPTION:auto set the follow functions cpssInitSystem(19,2,0)********************************************************************************//* cpssInitSystem(19,2,0) */extern cpssInitSystem_auto_set;if(cpssInitSystem_auto_set == GT_OK){GT_STATUS rc ;rc = cpssInitSystem(19,2,0); if(rc!=GT_OK) return rc;cpssInitSystem_auto_set = GT_FAIL;}/*******************************************************************************/

代码中cpssInitSystem_auto_set为条件开关,当它为GT_OK时,允许运行cpssInitSystem(),当它为GT_FAIL时,不允许运行cpssInitSystem(),这样就可以保证cpssInitSystem()不被二次调用,交换机系统也就不会跑飞。

代码的添加位置详见下图:



4.软件测试

(1)交换机上电后串口初始化信息(U-boot初始化部分省略)

Marvell>> bootNAND read: device 0 offset 0x0, size 0xa00000 10485760 bytes read: OK## Booting kernel from Legacy Image at 02000000 ...   Image Name:   Linux-3.4.69   Image Type:   ARM Linux Kernel Image (uncompressed)   Data Size:    2764288 Bytes = 2.6 MiB   Load Address: 00008000   Entry Point:  00008000   Verifying Checksum ... OK   Loading Kernel Image ... OKOKStarting kernel ...Uncompressing Lin done, booting thBooting Linux on physical CPU 0Linux version 3.4.69 (lancoo@ubuntu) (gcc version 4.6.2 (Linaro GCC branch-4.6.2. Marvell GCC 201201-883.01c949de) ) #1 SMP Wed Oct 11 00:40:35 PDT 2017CPU: Marvell PJ4Bv7 Processor [562f5842] revision 2 (ARMv7), cr=10c53c7dCPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cacheMachine: Marvell BC2 RDUsing UBoot passing parameters structureMemory policy: ECC disabled, Data cache writeallocBUG: mapping for 0xfc000000 at 0xff400000 out of vmalloc spaceSMP: init cpusPERCPU: Embedded 7 pages/cpu @c09cf000 s5952 r8192 d14528 u32768Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048Kernel command line: console=ttyS0,115200 mtdparts=spi_flash:2m(spi_uboot)ro,4m(spi_kernel),16m(spi_rootfs),-(remainder);armada-nand:10m(nand_kernel),-(nand_rootfs) ubi.mtd=5 root=ubi0:rootfs_nand ro rootfstype=ubifs mv_net_config=4,(00:50:43:11:11:11,0:1:2:3),mtu=1500PID hash table entries: 2048 (order: 1, 8192 bytes)Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)Memory: 512MB = 512MB totalMemory: 513784k/513784k available, 10504k reserved, 0K highmemVirtual kernel memory layout:    vector  : 0xffff0000 - 0xffff1000   (   4 kB)    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)    vmalloc : 0xe0800000 - 0xff000000   ( 488 MB)    lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)    modules : 0xbf000000 - 0xbfe00000   (  14 MB)      .text : 0xc0008000 - 0xc0518000   (5184 kB)      .init : 0xc0518000 - 0xc0548740   ( 194 kB)      .data : 0xc054a000 - 0xc05806c0   ( 218 kB)       .bss : 0xc05806e4 - 0xc05cafd8   ( 299 kB)Hierarchical RCU implementation.NR_IRQS:178Initializing MSYS SOC Timer 0sched_clock: 32 bits at 25MHz, resolution 40ns, wraps every 171798msCalibrating delay loop... 795.44 BogoMIPS (lpj=3977216)pid_max: default: 32768 minimum: 301Mount-cache hash table entries: 512CPU: Testing write buffer coherency: okCPU0: thread -1, cpu 0, socket 0, mpidr 80000000SMP: prepare CPUs (2 cores)Setting up static identity map for 0x3ece90 - 0x3eceb0SMP: CPU 0 Waking up CPU 1CPU1: Booted secondary processorCPU1: thread -1, cpu 1, socket 0, mpidr 80000001Brought up 2 CPUsSMP: Total of 2 processors activated (1590.88 BogoMIPS).devtmpfs: initializedNET: Registered protocol family 16Aurora: Working in ARMv7 modeL0 cache EnabledSpeculative Prefetch DisabledAurora L2 Cache EnabledSupport IO coherency.CPU Interface-------------SDRAM_CS0 ....base 000000000, size 512MB SDRAM_CS1 ....disableSDRAM_CS2 ....disableSDRAM_CS3 ....disableDEVICE_CS0 ....base 0f2200000, size   1MB DEVICE_CS1 ....no suchDEVICE_CS2 ....no suchDEVICE_CS3 ....no suchPEX0_MEM ....base 090000000, size 128MB PEX0_IO ....no suchINTER_REGS ....base 0f1000000, size   1MB DFX_INTER_REGS ....base 0fc000000, size   1MB SWITCH_REGS ....base 0f8000000, size  64MB DMA_UART ....no suchSPI_CS0 ....base 0f6000000, size  32MB SPI_CS1 ....no suchSPI_CS2 ....no suchSPI_CS3 ....no suchSPI_CS4 ....no suchSPI_CS5 ....no suchSPI_CS6 ....no suchSPI_CS7 ....no suchBOOT_ROM_CS ....base 0fff00000, size   1MB DEV_BOOTCS ....base 0f4000000, size  32MB USB_REGS ....no suchDRAGONITE ....base 080000000, size 128MB   Marvell MSYS RD-XC3-24G-4SFP Board -  Soc: BobK Rev A1 LE  Detected Tclk 200000000, SysClk 167000000, FabricClk 200000000, PClk 800000000  LSP version: linux-3.4.69-2014_T2.1p13Register platform device: mv_neta_port_0Register platform device: mv_neta_port_1registered dev#0 asa ehci_marvellMarvell USB EHCI Host controller #0: df8a26c0bio: create slab <bio-0> at 0SCSI subsystem initializedusbcore: registered new interface driver usbfsusbcore: registered new interface driver hubusbcore: registered new device driver usbSwitching to clocksource msys_clocksourceNET: Registered protocol family 2IP route cache hash table entries: 4096 (order: 2, 16384 bytes)TCP established hash table entries: 16384 (order: 5, 131072 bytes)TCP bind hash table entries: 16384 (order: 5, 131072 bytes)TCP: Hash tables configured (established 16384 bind 16384)TCP: reno registeredUDP hash table entries: 256 (order: 1, 8192 bytes)UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)NET: Registered protocol family 1RPC: Registered named UNIX socket transport module.RPC: Registered udp transport module.RPC: Registered tcp transport module.RPC: Registered tcp NFSv4.1 backchannel transport module.PCI-E: Checking physical bus #0 (controller #0): Enabled - No LinkSoC: model = 0xf400, revision = 0x4  o 2 Giga ports supported  o SKB recycle supported (Enabled)  o NETA acceleration mode 1  o RX Queue support: 8 Queues * 128 Descriptors  o TX Queue support: 8 Queues * 532 Descriptors  o GSO supported  o GRO supported  o Receive checksum offload supported  o Transmit checksum offload supported  o Driver ERROR statistics enabled  o Driver INFO statistics enabledport #0: is_sgmii=1, is_rgmii=0, phy_addr=-1  o Loading network interface(s) for port #0: cpu_mask=0x3, tx_csum_limit=9800  o Port 0 is connected to Linux netdevice    o eth0, ifindex = 2, GbE port = 0        giga p=0: mtu=1500, mac=00:0e:c6:00:2d:72 (platform)port #1: is_sgmii=1, is_rgmii=0, phy_addr=-1  o Loading network interface(s) for port #1: cpu_mask=0x3, tx_csum_limit=9800  o Port 1 is connected to Linux netdevice    o eth1, ifindex = 3, GbE port = 1        giga p=1: mtu=1500, mac=00:50:43:7b:7b:7b (platform)Phy-driver: Initialization startedPhy-driver: register_device() is called.Phy-driver: registered character device with major number = 217 and minor numbers 0...255Warning CESA engine is powered Offdragonite_xcat dragonite_xcat.0: Initializing Co-processor...dragonite_xcat dragonite_xcat.0: Initializing Co-processor finishedgpiochip_add: registered GPIOs 0 to 67 on device: mv_gpiojffs2: version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.msgmni has been set to 1003io scheduler noop registeredio scheduler deadline registeredio scheduler cfq registered (default)mv_xor_shared mv_xor_shared.0: Marvell shared XOR drivermv_xor mv_xor.0: Marvell XOR: ( xor cpy )mv_xor mv_xor.1: Marvell XOR: ( xor fill cpy )Serial: 8250/16550 driver, 2 ports, IRQ sharing disabledserial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 41) is a 16550Aconsole [ttyS0] enabledloop: module loadedSPI Serial flash detected @ 0xf6000000, 32768KB (512sec x 64KB)4 cmdlinepart partitions found on MTD device spi_flashCreating 4 MTD partitions on "spi_flash":0x000000000000-0x000000200000 : "spi_uboot"0x000000200000-0x000000600000 : "spi_kernel"0x000000600000-0x000001600000 : "spi_rootfs"0x000001600000-0x000002000000 : "remainder"armada-nand armada-nand.0: Initialize HAL based NFC in 8bit mode with DMA Disabled using BCH 4bit ECCNAND device: Manufacturer ID: 0x2c, Chip ID: 0x38 (Micron NAND 1GiB 3,3V 8-bit)Bad block table found at page 262016, version 0x01Bad block table found at page 261888, version 0x012 cmdlinepart partitions found on MTD device armada-nand2 cmdlinepart partitions found on MTD device armada-nandCreating 2 MTD partitions on "armada-nand":0x000000000000-0x000000a00000 : "nand_kernel"0x000000a00000-0x000040000000 : "nand_rootfs"UBI: attaching mtd5 to ubi0UBI: physical eraseblock size:   524288 bytes (512 KiB)UBI: logical eraseblock size:    516096 bytesUBI: smallest flash I/O unit:    4096UBI: VID header offset:          4096 (aligned 4096)UBI: data offset:                8192UBI: max. sequence number:       2UBI: attached mtd5 to ubi0UBI: MTD device name:            "nand_rootfs"UBI: MTD device size:            1014 MiBUBI: number of good PEBs:        2020UBI: number of bad PEBs:         8UBI: number of corrupted PEBs:   0UBI: max. allowed volumes:       128UBI: wear-leveling threshold:    4096UBI: number of internal volumes: 1UBI: number of user volumes:     1UBI: available PEBs:             0UBI: total number of reserved PEBs: 2020UBI: number of PEBs reserved for bad PEB handling: 20UBI: max/mean erase counter: 1/0UBI: image sequence number:  1465725342UBI: background thread "ubi_bgt0d" started, PID 356tun: Universal TUN/TAP device driver, 1.6tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPIe100: Copyright(c) 1999-2006 Intel Corporatione1000e: Intel(R) PRO/1000 Network Driver - 1.9.5-ke1000e: Copyright(c) 1999 - 2012 Intel Corporation.sky2: driver version 1.30PPP generic driver version 2.4.2NET: Registered protocol family 24pegasus: v0.6.14 (2006/09/27), Pegasus/Pegasus II USB Ethernet driverusbcore: registered new interface driver pegasususbcore: registered new interface driver asixusbcore: registered new interface driver cdc_etherusbcore: registered new interface driver net1080usbcore: registered new interface driver cdc_subsetusbcore: registered new interface driver zaurususbcore: registered new interface driver cdc_ncmehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driverehci_marvell ehci_marvell.0: Marvell Orion EHCIehci_marvell ehci_marvell.0: new USB bus registered, assigned bus number 1ehci_marvell ehci_marvell.0: irq 45, io base 0xfb050100ehci_marvell ehci_marvell.0: USB 2.0 started, EHCI 1.00hub 1-0:1.0: USB hub foundhub 1-0:1.0: 1 port detectedusbcore: registered new interface driver usblpInitializing USB Mass Storage driver...usbcore: registered new interface driver usb-storageUSB Mass Storage support registered.mousedev: PS/2 mouse device common for all micei2c /dev entries drivermmc0: mvsdio driver initialized, lacking card detect (fall back to polling)usbcore: registered new interface driver usbhidusbhid: USB HID core driveroprofile: hardware counters not availableoprofile: using timer interrupt.TCP: cubic registeredNET: Registered protocol family 10IPv6 over IPv4 tunneling driverNET: Registered protocol family 178021q: 802.1Q VLAN Support v1.8VFP support v0.3: implementor 56 architecture 2 part 20 variant 9 rev 6==Start PCI Devices scan and configure====Start Internal Devices scan and configure==prestera_device prestera_device.0: Internal device 0xf400 detectedmvPP driver initializedprestera_device prestera_device.0: finish internal dev f400 probedrivers/rtc/hctosys.c: unable to open rtc device (rtc0)usb 1-1: new high-speed USB device number 2 using ehci_marvellUBIFS: mounted UBI device 0, volume 0, name "rootfs_nand"UBIFS: mounted read-onlyUBIFS: file system size:   1024966656 bytes (1000944 KiB, 977 MiB, 1986 LEBs)UBIFS: journal size:       10452992 bytes (10208 KiB, 9 MiB, 21 LEBs)UBIFS: media format:       w4/r0 (latest is w4/r0)UBIFS: default compressor: lzoUBIFS: reserved for root:  23 bytes (0 KiB)VFS: Mounted root (ubifs filesystem) readonly on device 0:13.devtmpfs: mountedFreeing init memory: 192KWed Oct 11 00:36:00 UTC 2017scsi0 : usb-storage 1-1:1.0Linux MARVELL_LINUX 3.4.69 #1 SMP Wed Oct 11 00:40:35 PDT 2017Welcome to Embedded Linux           _  _          | ||_|          | | _ ____  _   _  _  _          | || |  _ \| | | |\ \/ /          | || | | | | |_| |/    \          |_||_|_| |_|\____|\_/\_/          On Marvell's ARMADAXP boardFor further information on the Marvell products check:http://www.marvell.com/toolchain=mv7sft little endianEnjoy!scsi 0:0:0:0: Direct-Access     Kingston DataTraveler 3.0 PMAP PQ: 0 ANSI: 6sd 0:0:0:0: [sda] 30497664 512-byte logical blocks: (15.6 GB/14.5 GiB)sd 0:0:0:0: [sda] Write Protect is offsd 0:0:0:0: [sda] No Caching mode page foundsd 0:0:0:0: [sda] Assuming drive cache: write throughsd 0:0:0:0: [sda] No Caching mode page foundsd 0:0:0:0: [sda] Assuming drive cache: write through sda: sda1sd 0:0:0:0: [sda] No Caching mode page foundsd 0:0:0:0: [sda] Assuming drive cache: write throughsd 0:0:0:0: [sda] Attached SCSI removable diskmvPP openedcommander: threads are running: luaCLI cmdShellSupported boards:+---------------------------------+-----------------------------------------+| Board name                      | Revision                                |+---------------------------------+-----------------------------------------+| 01 - DB-DX241-24G               |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 02 - RD-DX246-24G               |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 03 - RD-88E6183                 |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 04 - DB-88E6093                 |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 05 - RD-88E6093-24F4G           |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 06 - DB-DX160-16G               |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 07 - DB-DX270-24G-3XG           |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 08 - RD-DX270-48G-2XG           |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 09 - RD-DX241-48G               |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 10 - RD-88E6093-484F4G          |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 11 - DB-DX246-24G-3XG           |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 12 - 24F4G                      |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 13 - DB-DX107-88E6095-48F2G     |                                         ||                                 | 01 - Rev 0.1                            ||                                 | 02 - Rev 0.2                            |+---------------------------------+-----------------------------------------+| 14 - DB-DX285-24G-4XG           |                                         ||                                 | 01 - Rev 0.1                            ||                                 | 02 - Rev 0.2 - Vr Support               ||                                 | 03 - Rev 0.3 - FC OFF                   ||                                 | 04 - Rev 0.4 - Ch2 as multiplexer       |+---------------------------------+-----------------------------------------+| 15 - DB-DX106-10G               |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 16 - DB-DX106-88E6095-48F2G     |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 17 - DB-DX285-48G-4XG           |                                         ||                                 | 01 - Rev 0.1                            ||                                 | 02 - Rev 0.2 - RD-DX285                 ||                                 | 03 - Rev 0.3 - FC OFF                   |+---------------------------------+-----------------------------------------+| 18 - DB-DX3-GP                  |                                         ||                                 | 01 - Rev 0.1                            ||                                 | 02 - Rev 0.2 - RDE tests                ||                                 | 03 - Rev 0.3 - FC OFF                   |+---------------------------------+-----------------------------------------+| 19 - xCat, xCat2, xCat3         |                                         ||                                 | 01 - Rev 0.1                            ||                                 | 02 - Rev 0.2 - SDMA                     ||                                 | 03 - Rev 0.3 - FC OFF                   ||                                 | 04 - Rev 0.4 - PBR                      ||                                 | 05 - Rev 0.5 - P24/25 SGMII mode, p26/27||                                 |      QX mode                            ||                                 | 06 - Rev 0.6 - PBR SDMA                 ||                                 | 07 - Rev 0.7 - SMI only board           ||                                 | 08 - Rev 0.8 - Native MII               ||                                 | 09 - Rev 0.9 - PHYMAC                   ||                                 | 10 - Rev 0.10 - Legacy VPLS Enabled     ||                                 | 11 - Rev 0.11 - +Linux BM kernel driver |+---------------------------------+-----------------------------------------+| 20 - Lion                       |                                         ||                                 | 01 - Rev 0.1                            ||                                 | 02 - Rev 0.2 - performance test         ||                                 |      configuration                      ||                                 | 03 - Rev 0.3                            ||                                 | 04 - Rev 0.4                            ||                                 | 05 - Rev 0.5 - RD-48                    ||                                 | 06 - Rev 0.6 - 98DX5198 all ports       ||                                 |      1000BaseX                          ||                                 | 07 - Rev 0.7 - 98DX5198 all ports SGMII ||                                 |      1G                                 ||                                 | 08 - Rev 0.8 - 98CX8203 2 core {0,1}    ||                                 | 09 - Rev 0.9 - RD-48 PQ3 (lion_mpc8544) ||                                 | 10 - Rev 0.10- MII interface            ||                                 | 12 - Rev 0.12- RD-48 with solarflare PHY||                                 | 22 - multi port group FDB lookup        ||                                 | 24 - multi port group FDB lookup : 128K ||                                 |      mode - auto init                   ||                                 | 25 - multi port group FDB lookup :  64K ||                                 |      mode - auto init                   |+---------------------------------+-----------------------------------------+| 27 - Lion2                      |                                         ||                                 | 01 - Rev 0.1 - 96X10G_SR_LR             ||                                 | 02 - Rev 0.2 - 32X40G_SR_LR             ||                                 | 03 - Rev 0.3 - 96X10G_KR                ||                                 | 04 - Rev 0.4 - 32X40G_KR4               ||                                 | 05 - Rev 0.5 - CT 10G 40G loopback Port ||                                 | 06 - Rev 0.6 - 56X10G 210MHz            ||                                 | 07 - HooperRD:0..7-10G_KR;8...-40G_KR   ||                                 | 08 - HooperRD:0..7-10G_KR;8...-40G_KR:  ||                                 |      kernel driver                      ||                                 | 10 - Rev 0.10- MII interface            ||                                 | 11 - 96X10G_SR_LR, PFC enable TC5_6 all ||                                 |      ports                              ||                                 | 12 - 96X10G_SR_LR, Lion2-4 cores        ||                                 | 22 - multi port group FDB lookup        ||                                 | 24 - multi port group FDB lookup : 256K ||                                 |      mode - auto init                   ||                                 | 25 - multi port group FDB lookup : 128K ||                                 |      mode - auto init                   ||                                 | 26 - 360MHz 0,1,2,3x10G 4,8,9x40G       |+---------------------------------+-----------------------------------------+| 29 - Bobcat2, Caelum, Cetus,    |                                         || Cygnus, Lewis, Aldrin, Bobcat3  | 01 - All Devices Regular init, No TM    ||                                 | 02 - Bobcat2, Caelum, Cetus - TM enabled||                                 | 03 - Bobcat2 MTL RD board 48GE          ||                                 |      +4X10G/Aldrin MTL RD board 24*10G  ||                                 |      +2X40G                             ||                                 | 04 - Bobcat2 MTL RD board 4*10G         ||                                 |      +2X40G->10G TM Enable              ||                                 | 05 - All Devices Simplified Init DB     ||                                 |      board                              ||                                 | 06 - Bobcat2, Caelum, Cetus Simplified  ||                                 |      Init DB board - TM Enabled         ||                                 | 11 - Bobcat2 RD Board                   ||                                 | 12 - Bobcat2 RD Board TM Enabled        |+---------------------------------+-----------------------------------------+| 30 - Six BobCat2                |                                         ||                                 | 01 - Rev 0.1                            |+---------------------------------+-----------------------------------------+| 31 - Two Lion2 + Bobcat2        |                                         ||                                 | 01 - Rev 0.1 - only Two Lion2           ||                                 | 02 - Rev 0.2                            ||                                 | 03 - Rev 0.3 - Two Hoopers + Bobcat2    ||                                 | 04 - Rev 0.4 - One Hooper  + Bobcat2    |+---------------------------------+-----------------------------------------+| 32 - AC3x                       |                                         ||                                 | 01 - 24/48*1G + 4*10G + 2*40G           ||                                 |      (3/6*PHY1690)                      ||                                 | 02 - 24*2.5G  + 4*10G + 1*40G           ||                                 |      (no_PHY1690)        LUA_CLI with examplesEntering LuaCLI took 3358.953400 msec LUA CLbspPciGetIntVec (single) int vector 0x21, internal Int 0x0I based on LUA 5.1 from www.lua.org LUA CLI uses Mini-XML engine from www.minixml.org***************************************************               LUA CLI shell ready***************************************************
以下为cpssInitSystem(19,2,0)的作用效果:

Device[0] ID 0xF40011AB revision A1Core clock = 167MhzAllocating 32784 bytes for DMAAllocating 32784 bytes for DMAAllocating 4000 bytes for DMAAllocating 4000 bytes for DMAAllocating 4000 bytes for DMAAllocating 45232 bytes for DMAAllocating 4000 bytes for DMAAllocating 4000 bytes for DMAAllocating 45232 bytes for DMAAllocating 4000 bytes for DMAAllocating 400 bytes for DMAAllocating 38701 bytes for DMAAllocating 400 bytes for DMAAllocating 38701 bytes for DMAAllocating 400 bytes for DMAAllocating 38701 bytes for DMAAllocating 400 bytes for DMAAllocating 38701 bytes for DMAAllocating 400 bytes for DMAAllocating 38701 bytes for DMAAllocating 400 bytes for DMAAllocating 38701 bytes for DMAAllocating 400 bytes for DMAAllocating 38701 bytes for DMAAllocating 400 bytes for DMAAllocating 38701 bytes for DMAWarning:Tried to allocate 8388608 which is bigger than the memory chunk size. [UTF]: utfInit: ************************[UTF]: prvUtfExtrasInit: PP dev [0], phy ports [28], virt ports [64] ports bmp[0x0fffffff]UTF: used port type [PRV_TGF_28_PORT_DEVICE_TYPE_E] , with ports up to[28][UTF]: utfInit: OK, number of tests [3708]Run utfHelp 0 for help about UTF usage[UTF]: utfInit: ************************[UTF]: utfHelp: *********************************UTF functions:*****utfHelp             - to log a help about the function.utfTestsList        - to log list of all configured (available) suits and tests.utfTestsTypeList    - to log list of all configured suits by given UT type list (generic, enhanced, etc.)utfTestsRun         - to run suits and testsutfTestsTypeRun     - to run all UT by given UT type list (generic, enhanced, etc.)utfLogOutputSelect  - to change output log mode (all, final, file, debug)utfLogOpen          - to open logger with defined file nameutfLogClose         - to close loggerutfRandomRunModeSet - to set test's random run modeutfTestRunFirstSet  - to put specific test to be run first*****Examples:*****utfHelp 0                - to printout this help info.utfHelp "utfTestsList"   - to get detailed info about command "utfTestsList"utfTestsList 0           - to log list of all configured (available) suits.utfTestsList "tgfBridge" - to log list of test cases inside suit "tgfBridge".utfTestsTypeList 6, 0    - to log list of all Enhanced UTsutfTestsTypeList 1, 6, 0 - to log list of all Generic and Enhanced UTsutfTestsRun 0, 1, 1      - to run all suits once with no interrupts after first failureutfTestsRun "tgfBridge",1,1 - to run all tests from suit "tgfBridge" onceutfTestsRun "tgfBridge.tgfBasicDynamicLearning",1,1 - to run test "tgfBasicDynamicLearning" from suit "tgfBridge" onceutfTestsRun ".tgfBasicDynamicLearning",1,1 - to run test "tgfBasicDynamicLearning" onceutfTestsRun "tgfBridge-tgfIp",1,0 - to run all tests in a range between suitsutfTestsRun "suit1.test1-suit2.test2",1,0 - to run a range of tests starting from certain test to certain testutfTestsRun "suit1-suit2.test",1,0 - to run a range of tests starting from certain suit to certain testutfTestsTypeRun 1, 1, 6, 0 - to run all Enhanced UT  utfTestsTypeRun 1, 1, 1, 6, 0 - to run all Generic and Enhanced UT  utfLogOutputSelect 0     - to change output log to serialutfLogOutputSelect 1     - to change output log to only final reportutfLogOutputSelect 2     - to change output log to fileutfLogOutputSelect 3     - to change output log to debugutfLogOpen "results.log" - to set logger into file "results.log"utfLogClose              - to close opened loggerutfRandomRunModeSet 1, 5 - to enable random run mode with seed 5 for random generatorutfTestRunFirstSet "tgfBasicDynamicLearning" - to run "tgfBasicDynamicLearning" test firstprvUtfSkipLongTestsFlagSet 1 - to state that when running tests skip those with 'long execution time' Run utfHelp "utfTestsList" for example to get detailed info about command[UTF]: utfHelp: ****************************[UTF]: utfInit: enh-UT : tested ports are : 0 8 18 23 cpssInitSystem time: 0 sec., 356912240 nanosec.Time processing the cpssInitSystem (from 'phase1 init') is [0] seconds + [356004520] nanoseconds 
以下为光口自动配置的初始化信息:

Modified by: snaking616@163.cominterface range ethernet 0/24-27speed 10000 mode SR_LRModified by: snaking616@163.comcpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 25 laneBmp 1 invertTx true invertRx falsecpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 27 laneBmp 1 invertTx true invertRx trueConsole# 


(2)稳定性测试

尝试在luaCLI命令窗口、普通命令窗口以及文件系统窗口三者之间进行切换,检查cpssInitSystem()函数会不会被二次调用。

测试记录如下:

Console# CLIexit->osShellBusyBox v1.01 (2017.10.11-07:36+0000) Built-in shell (ash)Enter 'help' for a list of built-in commands./ # ls3240_0400_6270.bin      home                    sbin88X32xx-FW.hdr          init                    sys88X33xx-Z2-FW.hdr       lib                     tmpbin                     linuxrc                 usrdev                     mnt                     varetc                     procflashdownloadslave.bin  root/ # exit->luaCLIDefault PCL CFG Table Access mode configured on dev: 0devices, ports to be used by LUA tests , and configuration files ==> {  {    dev=0,    port={ 0, 8, 18, 24, 20, 2 },    ledIf=0,    portCPU=63  }}#Serdes_Port_Lst ==> 28Default PCL CFG Table Access mode configured on dev: 0LUA_CLI with examplesEntering LuaCLI took 2965.183779 msec LUA CLI based on LUA 5.1 from www.lua.org LUA CLI uses Mini-XML engine from www.minixml.org***************************************************               LUA CLI shell ready***************************************************Console# 

分析:以上顺利的完成了4次窗口切换:

第一次:从luaCLI窗口到普通命令窗口,输入CLIexit;

第二次:从普通命令窗口到文件命令窗口,输入osShell;

第三次:从文件窗口到普通窗口,输入exit;

第四次:从普通窗口回到luaCLI窗口,输入luaCLI,
4次切换后,luaCLI引擎正常启动,cpssInitSystem()没有被二次调用,系统也未出现跑飞的情况,顾该调试思路是可行的!


阅读全文
0 0
原创粉丝点击