文档库 最新最全的文档下载
当前位置:文档库 › BCM_CLI_Quick_Start_Guide

BCM_CLI_Quick_Start_Guide

BCM_CLI_Quick_Start_Guide
BCM_CLI_Quick_Start_Guide

QUICK START GUIDE FOR THE BCM Diagnostic Shell

07/25/2004

Revision History

DESCRIPTION

CHANGE

REVISION DATE

Initial

release

1.0 07/25/04

Broadcom Corporation Taiwan

7F, No.25, Puding Road

Hsin-Chu City, Taiwan 300

?Copyright 2004 by Broadcom Corporation Taiwan

All rights reserved

TABLE OF CONTENTS

1 OVERVIEW (6)

2 PREPARE GETTING YOUR FEET WET (6)

3 LOW-LEVEL

COMMANDS (9)

Commands (10)

3.1 Register

Access

commands (17)

Access

3.2 Memory

3.3 Accessing PHY Registers (24)

3.4 Miscellaneous (25)

3.4.1 Interrupts (25)

3.4.2 Counters (26)

Memory (27)

3.4.3 System

Bus (27)

3.4.4 PCI

3.4.5 I2C Bus (27)

LINKS (27)

AND

4 PORTS

4.1 PortStat (28)

4.2 PORT (29)

4.3 LINKscan (29)

5 HIGH-LEVEL

COMMANDS (30)

Management (30)

5.1 VLAN

Remarks

of VLAN management (32)

5.1.1 Concluding

Commands (32)

5.2 L2

Commands (34)

5.3 L3

5.3.1 The ABC of L3 Switching (34)

Example (35)

5.3.2 L3

5.4 Port

Mirroring (37)

5.5 Filtering (37)

5.6 Spanning Tree Group Management (38)

FEATURES (38)

6 ADVANCED

6.1 Sending and Receiving Packets (38)

In the case when no packet generator handy, the commands introduced in this section helps.

(38)

6.1.1 Packet

Transmission (38)

6.1.2 Packet

Receiving (39)

6.2 Debugging (39)

Management (40)

6.3 Configuration

6.4 BCM Shell Variables (41)

Tests (42)

6.5 Diagnostic

1OVERVIEW

The BCM Diagnostic Shell is a general command line interpreter (CLI) that provides precise control of reference platforms in which Broadcom switch chips are embedded. The shell supports all Broadcom switch chips in a singe image and provides direct access to all registers, memories and most high-level API features. Also, since both interactive and non-interactive mode is supported by the shell, it can be embedded into a customer’s design to provide additional diagnostics. The purpose of this quick start guide is to provide supplementary information in addition to those adequate explanations accompany each CLI command. Note that the content presented herein is based on Broadcom SDK 4.2.3.

The rest of this guide is organized as follows. In Section 2, we introduce typical interactive behavior of the BCM shell. In Section3, Some low-level commands that provide direct access to the registers, memories, etc. are introduced. Commands relate to ports and links are given in Section 4. High-level commands deal with VLAN, spanning tree, etc., are given in Section 5. Finally in Section 6, some advanced features of BCM shell are presented.

2PREPARE GETTING YOUR FEET WET

In this section, typical interactive shell behavior is introduced. One can access the built-in help by typing ‘HELP’, or ‘?’ after the shell prompt ‘BCM.0>’. The keyword ‘HELP’ and symbol ‘?’ are interchangeable in the BCM shell. For example, to access the built-in help for a specific command, one can type one of the following commands: ‘HELP ’, ‘?

’, ‘ HELP’ or ‘ ?’ after the shell prompt ‘BCM.0>’. Note that all CLI command names and parameter names are case-insensitive. Thus, ‘HELP

’ and ‘help ’ are exactly the same.

The capitals appear on each command stand for the abbreviation for the command. For instance, commands ‘Listreg’ and ‘PortStat’ can be abbreviated as ‘L’ and ‘PS’, respectively. (Note that the case does not matter.) In the shell, one can use “” or \ to enter special symbol, and ; to put several commands on the same command line. Also, CTRL-C stops the execution of a current command and CTRL-\ reboots the system (VxWorks only).

A typical system may consist of one or more Broadcom switch chips. The first chip in the system is named as unit 0; analogously, the second chip in the system is named as the Unit 1. Initially, the shell prompt is ‘BCM.0>’ which represent that the chip under consideration currently is the Unit 0. One can type ‘1:’ after the shell prompt to change the current working chip from the Unit 0 to 1. The shell prompt after issuing command ‘1:’ will change to ‘BCM.1>’ to reflect the transition. For example, one can type ‘1:ps’ after ‘BCM.0>’ to check the port status on the Unit 1. (Note that ps is a abbreviated form of command PortStat.) For another example, when issue command ‘1:rc’ after ‘BCM.0>’, Unit 1 in the system will then be re-initialized (whereas command ‘*:rc’ will cause all units in the system being re-initialized).

Other frequent-used commands are:

?VER: Display current software version.

?SHOW unit: Display chips in the system.

?SHOW params: Display current chip configuration from driver’s viewpoints.

?SHOW features: Display current chip’s feature from driver’s viewpoints.

Figure 1 demonstrates all the contents mentioned in this section for readers’ convenience.

Figure 1.Example of general CLI commands

Figure 1.Continued

3LOW-LEVEL COMMANDS

In this section, commands that provide direct access to registers, memories, PCI and interrupts are described.

3.1Register Access Commands

There are four types of registers in the system. The tabulation of the register types are given in Table 1.

Table1 The tabulation of the registers in the system

REGISTER TYPE DESCRIPTION

PCIC PCI configuration space registers

PCIM PCI memory-mapped registers (CMIC registers)

SOC Registers and memories accessible via S-channel operations

PHY PHY registers (MIIM addresses)

When executing any register-related operations, one should know the type of the register that is being accessed and the block the register is in (since a register with the same name can exist in several blocks). For example, when you issue command ‘g config’ after ‘BCM.0>’, contents

of all registers named CONFIG in all appropriate blocks, viz. gpic0, gpic1, etc., will be displayed. On the contrary, commands ‘g config gpic0’, and ‘g config gpic0-gpic3’ will cause the contents of registers CONFIG in block gpic0 and in blocks ranging from gpic0 to gpic3 being displayed, respectively (cf. Figure 2).

The general naming format of each register is of the form:

.

For example, to view the value of CONFIG register located in block gpic3, any of the following commands are applicable:

?‘g config gpic3’, or

?‘g soc config gpic3’.

In the above example, please note the following facts: (1) ‘g’ is an abbreviated form of command ‘Getreg’. (2) If is not specified, it defaults to "SOC" (cf. Table 1). (3) All CLI command names and parameter names are case-insensitive; therefore, ‘g’ and ‘G’ are exactly the same.

More examples with regard to the register naming convention mentioned above are given below:

?‘g pcic 0x0’: To get current value of PCI configuration register 0

?‘g PCIM 0x144’ or ‘g CMIC_IRQ_STAT’ or ‘g CMIC_IRQ_STAT.cmic0’: To get current value of interrupt status register located in CMIC.

Figure 2. Example of accessing register CONFIG.

We will now introduce five frequent-used commands in accessing registers.

?Listreg

This command will reveal all detailed information regarding to a register. Some

examples are given in Table 2 and the corresponding result after executing the

commands appears in Figure 3.

Table 2.Some examples of Listreg commands.

EXAMPLE DESCRIPTION l ipg Get a list of matching register names

l config Get all the info about a register

l -t Get all the chip register names organized by block

l -c Get all the counter registers

l 0x00500100 Get all the info about a (SOC) register with the specified address

l config 0x123 Interpret value 0x00000123 as the contents of CONFIG register

Figure 3.The result of the command executions tabulated in Table 2

Figure 3. Continue d

?Getreg

This command will brief information regarding to a register. Some examples are given

in Table 3.

Table 3.Some examples of Getreg command

EXAMPLE DESCRIPTION g CMIC_IRQ_STAT Prints CMIC_IRQ_STAT in hex, then field-by-field

g CONFIG Prints all the copies of CONFIG in all blocks

g raw CONFIG Prints all the copies of CONFIG in all blocks in short form

g chg CONFIG.ge1 It shows only fields/registers that have changed from defaults

g pcic 0x10 Gets the value of PCIC-type register with address 0x10

The main chrematistic that differentiates the command Listreg from command Getreg is

that the Listreg command is applicable only to registers of SOC type whereas the Getreg

command can apply to any type of registers. Also note that the former command reveals more

detailed information of a register comparing to the latter one (cf. Figure 4 for concrete

examples).

Figure 4.Example that reveals the difference between Listreg and Getreg.

?Setreg

This command sets the desired value to a register. Some examples are given in Table 4.

Table 4.Some examples of Setreg command

EXAMPLE DESCRIPTION s mac_ctrl 0x1Sets the value of MAC_CTRL register to 0x1

s mac_ctrl rxen=1Set RXEN field in MAC_CTRL register to 1 (BUT all

other fields will be set to 0!)

s mac_ctrl txen=1,rxen=1 A more reasonable setting

s gmacc2 ipgt=0xe Sets the value of IPG fields of all GE ports to 0xe

s gmacc2.ge0 ipgt=0xe Sets the value of IPG fields of ge0 to 0xe

Please be extremely careful in using this command Setreg since any fields that are not

explicitly specified in the command will be set to 0 automatically. Please refer to Figure 5 for a

concrete example.

?Modreg

This command serves as a safer alternative of command Setreg. Some examples are

given in Table 5. It performs read-modify-write operation; namely, fields that were not

specified explicitly in the command Modreg will not be affected. For concrete

examples that demonstrate the difference between Modreg and Setreg, please refer

to Figure 5.

Table 4.Some examples of Modreg command

EXAMPLE DESCRIPTION m mac_ctrl rxen=0 Sets the value of RXEN field in MAC_CTRL register to 0 with

all other fields, viz. TXEN, LCLLOOP and RMTLOOP, being

unaffected.

?EditReg

This command is an interactive version of command Modreg. Some examples are

given in Table 6.

Table 6.Some examples of EditReg command

EXAMPLE DESCRIPTION er gmacc0.ge0 Interactively modifies the value of each field in GMACC0.ge0 er gmacc0 Interactively modifies the value of each field in GMACC0.ge0

and writes the same value in all other copies of GMACC0

Figure 5.An example that shows the difference between Setreg and Modreg.

3.2Memory Access commands

The BCM Diagnostic Shell makes memories, the so-called tables, look like arrays of registers of

verifying length. The syntax for memories’ names is the same as for registers. And in the

following of presentations, terms like memory and table are used interchangeable. Note that

some CLI commands mentioned in this section can operate on both registers and memories.

We will now introduce eight frequent-used commands in accessing memories.

?LISTmem

This command will reveal all detailed information regarding to a table. Some examples

are given in Table 7.

Table 7.Some examples of LISTmem command

EXAMPLE DESCRIPTION list Lists all the chip memories

list l3Lists all the chip memories with the names containing “L3” as a

substring

list l3_entry Lists all information about the L3_ENTRY table and its fields

list l3_entry 0x01 0x02 0x03 0x04Interprets the value 0x00000001000000020000000300000004 as an L3_ENTRY

list gimask.ge3Lists the gimask table located on block ge3

?Dump

This command will print all the entries, along with their current values, from the

specified table. Some examples are given in Table 8 and the corresponding result after

executing the commands appears in Figure 6. Note that in the example given in Table 8,

(1) if chg is specified after the dump command, only fields changed from default

values will be shown, and (2) if all is specified after the dump command, even empty

or invalid fields will be shown also. For example, Figure 6 reveals that current valid

VLANs are 1, 100, 101, 102, 103, 104 and 105. Command d vlan 110 prints nothing

on the screen since 110 is an invalid VLAN ID whereas command d all vlan 110

prints all the entries for VLAN 110 anyway.

Table 8.Some examples of Dump command

EXAMPLE DESCRIPTION

d vlan Prints all V ALID entries from th

e VLAN table

d vlan 100Print an entry corresponding to a VLAN 100 (if it is valid)

d all vlan 110Print an entry corresponding to VLAN 100 (regardless)

d vlan 100 3 Prints valid entries from th

e VLAN 100 – 102 range

d chg l2_tabl

e Prints all the entries in GIRULE.ge1 we’ve messed up

Figure 6.The result of command executions tabulated in Table 8.

?Write

This command writes the desired values, or entries, into a table. Some examples are

given in Table 9 and a concrete example is shown in Figure 7. This Write command is

somewhat analogous to the Setreg command mentioned in Section 3.1.Any fields that

are not explicitly specified in the command will be set to 0 automatically. Please be

extremely careful in using this Write command (cf. Figure 8 for a exact example).

Table 9.Some examples of Write command

EXAMPLE DESCRIPTION w l2_valid_bits 12 1 16 Make l2_valid_bits [12] a valid entry

w gffpcounters 0 32 0 Sets the values all ffpcounters to 0

Figure 7.The result of command executions tabulated in Table 9

相关文档