#!/bin/bash
####################################################################
#
#      File: S91eobcmon
#      Name: Ranga Rajagopalan
#
#      Description:
#       Cleanup of klm_eobcmon
#	Actual location on disk: /isan/etc/rc.d/rc.isan-stop/S91eobcmon
#
#
# Copyright (c) 1985-2004, 2015-2016, 2019 by cisco Systems, Inc.
# All rights reserved.
#
#
# $Id: S91eobcmon,v 1.1 2003/05/16 00:51:51 rangar Exp $
# $Source: /auto/vwsvua/kirsten/sanos3/VegasSW__isan__platform__common__kspace__eobcmon/S91eobcmon,v $
# $Author: rangar $
#
#####################################################################

. /etc/init.d/mod_ins/module-load-functions


MVDXN_DEV_NAME=/dev/klm_mvdxn

boot_debug "Executing $0 [S36mvdxn]"

BOARDTYPE="$(proc_cmdline_get boardtype)"
card_idx="$(get_cmdline_card_index)"

if [ "$BOARDTYPE" == "RP" ]; then
    # The Precisa RP has a Marvell switch and requires klm_mvdxn
    if [ "$card_idx" != 27024 ]; then
    if [ "$card_idx" != 27059 ]; then
        exit 0;
    fi
    fi
fi


case $1 in
    start)
        boot_debug "Starting mvdxn"
        insmod /lib/modules/klm_mvdxn.o card_index=$(get_cmdline_card_index)

        DEV_NO=`cat /proc/devices | fgrep klm_mvdxn | awk '{print $1}'`
        mknod $MVDXN_DEV_NAME c $DEV_NO 0
    ;;
    stop)
        boot_debug "Stopping mvdxn"
        rmmod klm_mvdxn
        rm MVDXN_DEV_NAME
    ;;
esac
