openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

auto_launch_user.sh (4081B)


      1 #!/bin/sh
      2 # 
      3 # This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4 # 
      5 # Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6 
      7 IS_GTO=0
      8 IPROC_CHIPID_NS="CF12"
      9 IPROC_CHIPID_CS="CF1A"
     10 IPROC_CHIPID_NSP="CF1E"
     11 IPROC_CHIPID_READ=
     12 # Define Broadcom Switch device ID range
     13 # The PCI Device ID is a 16-bit value equal to the part number in hexadecimal.
     14 # For the 5-digit part number Broadcom switch devices, the last three digits
     15 # of the part number match the last three digits of the hexadecimal device ID,
     16 # with the first hexadecimal digit set to B (= 5 + 6). Thus, for the BCM56524
     17 # device, the PCI Device ID is 0xb524.
     18 # Listed the device ID ranges of Broadcom switch devices below. Ranges are
     19 # 0x8000-0x8fff, 0xa000-0xafff, 0xb000-0xbfff, 0xc000-0xcfff.
     20 # For string comparison operation, plus 1 for MAX boundary value and minor 1
     21 # for MIN boundary value.
     22 BRCM_SWITCH_DEVID_MAX1=9000
     23 BRCM_SWITCH_DEVID_MIN1=7fff
     24 BRCM_SWITCH_DEVID_MAX2=d000
     25 BRCM_SWITCH_DEVID_MIN2=bfff
     26 BRCM_SWITCH_DEVID_MAX3=c000
     27 BRCM_SWITCH_DEVID_MIN3=afff
     28 BRCM_SWITCH_DEVID_MAX4=b000
     29 BRCM_SWITCH_DEVID_MIN4=9fff
     30 
     31 cd /broadcom
     32 
     33 grep -q BCM9562 /proc/cpuinfo
     34 if [ $? == 0 ] ; then
     35     mount -t vfat /dev/mtdblock0 /mnt
     36 else
     37     grep -q BCM5300 /proc/cpuinfo
     38     if [ $? == 0 ] ; then
     39         mount -t vfat /dev/mtdblock2 /mnt
     40     else
     41         grep -q BCM98548 /proc/cpuinfo
     42         if [ $? == 0 ] ; then
     43             IS_GTO=1
     44             grep -q "Linux version 2.6" /proc/version
     45             if [ $? == 0 ] ; then
     46                 mount -t vfat /dev/mtdblock1 /mnt
     47             fi
     48         else
     49             grep -q iProc /proc/cpuinfo
     50             if [ $? == 0 ] ; then
     51                 IPROC_CHIPID_READ=`devmem 0x18000000 16|grep '0x'|cut -d'x' -f2`
     52                 # Get Broadcom PCI device ID list
     53                 #     qualification : Ethernet Controller, Class 0200
     54                 #                     Broadcom PCI vendor ID, 14e4
     55                 PCIE_DEVICE_LIST=`lspci | grep 'Class 0200' | grep '14e4' |cut -d':' -f4`
     56                 IS_EHOST=0
     57                 # Identify if the Broadcom PCI devices are switch device.
     58                 # If any Broadcom switch device is found on the PCI bus, consider the CPU is in eHost mode.
     59                 for DEVID in $PCIE_DEVICE_LIST
     60                 do
     61                     if [ "$DEVID" \< "$BRCM_SWITCH_DEVID_MAX1" ] && [ "$DEVID" \> "$BRCM_SWITCH_DEVID_MIN1" ]; then
     62                         IS_EHOST=1
     63                     fi
     64                     if [ "$DEVID" \< "$BRCM_SWITCH_DEVID_MAX2" ] && [ "$DEVID" \> "$BRCM_SWITCH_DEVID_MIN2" ]; then
     65                         IS_EHOST=1
     66                     fi
     67                     if [ "$DEVID" \< "$BRCM_SWITCH_DEVID_MAX3" ] && [ "$DEVID" \> "$BRCM_SWITCH_DEVID_MIN3" ]; then
     68                         IS_EHOST=1
     69                     fi
     70                     if [ "$DEVID" \< "$BRCM_SWITCH_DEVID_MAX4" ] && [ "$DEVID" \> "$BRCM_SWITCH_DEVID_MIN4" ]; then
     71                         IS_EHOST=1
     72                     fi
     73                 done
     74             fi
     75         fi
     76     fi
     77 fi
     78 
     79 if [ -f /mnt/config.bcm ] ; then
     80     export BCM_CONFIG_FILE=/mnt/config.bcm
     81 else
     82     # See if Petra co-processor (vendor 1172, device 4) / ARAD / FE1600
     83     # is present. on the PCI bus. If it is, then this is a Dune board.
     84     #
     85     egrep -q "11720004|14e48650|14e48750|14e48660" /proc/bus/pci/devices
     86     if [ $? == 0 ] ; then
     87         export BCM_CONFIG_FILE=/broadcom/config-sand.bcm
     88     elif [ "$IPROC_CHIPID_READ" == "$IPROC_CHIPID_NSP" ] && [ $IS_EHOST == 0 ]; then
     89         export BCM_CONFIG_FILE=/broadcom/config/BCM953022K.bcm
     90     elif [ "$IPROC_CHIPID_READ" == "$IPROC_CHIPID_CS" ]; then
     91         export BCM_CONFIG_FILE=/broadcom/config/BCM953012K.bcm
     92     elif [ "$IPROC_CHIPID_READ" == "$IPROC_CHIPID_NS" ]; then
     93         export BCM_CONFIG_FILE=/broadcom/config/BCM953012K.bcm
     94     else
     95         # Not XCore, not SAND. Must be an XGS board...
     96         # Load the default configuration file.
     97         #
     98         export BCM_CONFIG_FILE=/broadcom/config.bcm
     99     fi
    100 fi
    101 
    102 ./bcm.user
    103