rule-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RULE] PCMCIA problems in Red Hat?


From: C David Rigby
Subject: Re: [RULE] PCMCIA problems in Red Hat?
Date: Sun, 30 May 2004 09:51:42 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5

I ran into something very similar in setting up FC2 on the one notebook computer I have (Thinkpad 765L, P166MMX, 104MB RAM) that has sufficient RAM to run Anaconda (well, in text mode - graphics mode fails). The issue for me was twofold: the 2.6.5 kernel's yenta_socket driver does not handle the IRQs well for this machine, and the init scripts start the network before pcmcia is started => the hardware for eth0 is not yet initialized at the time /etc/init.d/network is run.

For the first, what is required is to run modprobe against the yenta_socket driver twice! The order of modprobe commands looks like this:

modprobe pcmcia
modprobe yenta_socket
modprobe yenta_socket pci=biosirq
modprobe ds

From there, cardmgr can be run and pcmcia will work. No combination of PCIC_OPTS in /etc/sysconfig/pcmcia or parmeters passed to the kernel allowed me to avoid running modprobe twice against yenta_socket.

What really needs to be done is to patch yenta_socket.c so that it works correctly. However, the following ugly hack got the job done:

1) Edit /etc/sysconfig/pcmcia so that it looks like this:

PCMCIA=yes
PCIC=yenta_socket
PCIC_OPTS="pci=biosirq"
CORE_OPTS=

2) The kernel does recognize that it needs to use the yenta_socket.o module, but the script /etc/init.d/pcmcia only runs modprobe once with the options from /etc/sysconfig/pcmcia. So, I editted /etc/init.d/pcmcia to call modprobe twice. Once I learn how to use patch correctly, I will just include the diff results here in my emails. For now, my /etc/init.d/pcmcia is attached to this post.

3) Reboot, and yenta_socket + cardmgr have the pcmcia slots under control. But, we are now at the second problem, which is that the network is not operational. In my case, I simply changed the order in which the scripts /etc/init.d/network and /etc/init.d/pcmcia are run at init time by changing the names of the links to the start up scripts that are found in /etc/rc2.d, /etc/rc3.d, /etc/rc4.d and /etc/rc5.d. I did not keep a record of what the old links were (oops) but the new ones look like this:

address@hidden cdrigby]$ ls -l /etc/rc3.d/S22pcmcia
lrwxrwxrwx 1 root root 16 May 25 08:48 /etc/rc3.d/S22pcmcia -> ../init.d/pcmcia
address@hidden cdrigby]$ ls -l /etc/rc3.d/S23network
lrwxrwxrwx 1 root root 17 May 25 08:48 /etc/rc3.d/S23network -> ../init.d/network
address@hidden cdrigby]$

The series of commands that will do this are (where rcN.d is each of N = 2 to 5 - i.e., carry out this operation four times; also XX and YY are whatever the numbers for the startup script links are after a clean installation for SXXnetwork and SYYpcmcia, I simply failed to record the initial names as I was beating on the configuration):

cd /etc/rcN.d/
rm SXXnetwork
rm SYYpcmcia
ln -s ../init.d/pcmcia S22pcmcia
ln -s ../init.d/network S23network

4) Reboot with your network card installed, and you should have eth0 available and configured once you log in.

5) Let me know if this does not work, and we can try something else!

CDR

address@hidden wrote:

>PCI: No IRQ known for interrupt pin A of device 00:03.0. Please try
>>> using pci=biosirq.
>>> PCI: No IRQ known for interrupt pin B of device 00:03.1. Please try
>>> using pci=biosirq.
>>> Yenta IRQ list 0a80, PCI irq0
>>> Socket status: 30000006
>>> Yenta IRQ list 0a80, PCI irq0
>>> Socket status: 30000006

>
>The PCI errors are due to a bug/limitation in the kernel PCI subsystem
>that is pretty much fatal for PCMCIA.  The pcibios suggestion is
>rarely useful.

address@hidden wrote:
Quoting "M. Fioretti" <address@hidden>:


Gabriel, what did you mean exactly by "not working"?


working:  ifconfig shows eth0 configured to the PCMCIA device.
non-working:  ifconfig only shows lo working.

In my case, eth0 (the PCMCIA NIC) isn't even configured on the first boot to 
RedHat.

I was able to get it up and running by hand using the "ideas" behind the scripts
 (esp. with David's help).  (Namely PCIC=i365_base=0xfcfc in the pcmcia.sh
script.)  Then I was able to ftp again to my desktop.

I haven't done the digging to see how to get RedHat to configure it every time
on boot-up.  I know that it's not rocket science, though.

gotta go...

-Gabriel



_______________________________________________
Rule Project HOME PAGE:  http://www.rule-project.org/en/
Rule Development Site:   http://savannah.gnu.org/projects/rule/
address@hidden
http://lists.nongnu.org/mailman/listinfo/rule-list

#!/bin/sh

# rc.pcmcia 1.45 2002/08/08 06:43:43 (David Hinds)
#
# Modified for Thinkpad 765L yenta_socket cockup on 2004.05.25 by CDR
# See main case statement below for details.
#
# This is designed to work in BSD as well as SysV init setups.  See
# the HOWTO for customization instructions.

# Tags for Red Hat init configuration tools
#
# chkconfig: 2345 24 96
# processname: cardmgr
# pidfile: /var/run/cardmgr.pid
# config: /etc/pcmcia/config
# config: /etc/pcmcia/config.opts
# description: PCMCIA support is usually to support things like ethernet \
#              and modems in laptops.  It won't get started unless \
#              configured so it is safe to have it installed on machines \
#              that don't need it.

# Exit if pcmcia-cs is not installed
test -x /sbin/cardmgr || exit 0

# Save option values passed in through the environment
for N in PCMCIA PCIC PCIC_OPTS CORE_OPTS CARDMGR_OPTS SCHEME ; do
    V=`eval echo '$'$N` ; if [ "$V" ] ; then eval ENV_$N=\"$V\" ; fi
done

# Source PCMCIA configuration, if available
if [ -f /etc/pcmcia.conf ] ; then
    # Debian startup option file
    . /etc/pcmcia.conf
elif [ -f /etc/sysconfig/pcmcia ] ; then
    # Red Hat startup option file
    . /etc/sysconfig/pcmcia
else
    # Slackware startup options go right here:
    # Should be either i82365 or tcic
    PCIC=i82365
    # Put socket driver timing parameters here
    PCIC_OPTS=
    # Put pcmcia_core options here
    CORE_OPTS=
    # Put cardmgr options here
    CARDMGR_OPTS=
    # To set the PCMCIA scheme at startup...
    SCHEME=
fi
for N in PCMCIA PCIC PCIC_OPTS CORE_OPTS CARDMGR_OPTS SCHEME ; do
    V=`eval echo '$'ENV_$N` ; if [ "$V" ] ; then eval $N=\"$V\" ; fi
done
if [ "$PCMCIA" -a "$PCMCIA" != "yes" ] ; then exit 0 ; fi

usage()
{
    echo "Usage: $0 {start|stop|status|restart|reload}"
}

cleanup()
{
    while read SN CLASS MOD INST DEV EXTRA ; do
        if [ "$SN" != "Socket" ] ; then
            /etc/pcmcia/$CLASS stop $DEV 2> /dev/null
        fi
    done
}

EXITCODE=1
for x in "1" ; do

    if [ "$PCIC" = "" ] ; then
        echo "PCIC module not defined in startup options!"
        break
    fi

    if [ $# -lt 1 ] ; then usage ; break ; fi
    action=$1

    case "$action" in

    start)
        echo -n "Starting PCMCIA services: "

        if [ -d /var/lib/pcmcia ] ; then
            SC=/var/lib/pcmcia/scheme
            RUN=/var/lib/pcmcia
        else
            SC=/var/run/pcmcia-scheme
            RUN=/var/run
        fi
        if [ -L $SC -o ! -O $SC ] ; then rm -f $SC ; fi
        if [ ! -f $SC ] ; then umask 022 ; touch $SC ; fi
        if [ "$SCHEME" ] ; then umask 022 ; echo $SCHEME > $SC ; fi
            
        if ! grep -q pcmcia /proc/devices ; then
            if [ -d /lib/modules/preferred ] ; then
                PC=/lib/modules/preferred/pcmcia
            else
                PC=/lib/modules/`uname -r`/pcmcia
            fi
            KD=/lib/modules/`uname -r`/kernel/drivers/pcmcia
#
# Modified 2004.05.25 by CDRigby to address a problem with initialization
# of the yenta_socket driver.  To get the driver to properly recognize
# IRQs, the PCMCIA-relevant commands must be run as:
# /sbin/modprobe pcmcia_core
# /sbin/modprobe yenta_socket
# /sbin/modprobe yenta_socket pci=biosirq
#
# So, the if stanza is modified below to change
# /sbin/modprobe $PCIC $PCIC_OPTS >/dev/null 2>&1
# to
# (/sbin/modprobe $PCIC >/dev/null 2>&1 &&
# /sbin/modprobe $PCIC $PCIC_OPTS >/dev/null 2>&1)
# NOTE: this requires that /etc/sysconfig/pcmcia must be modified
# to include PCIC_OPTS="pci=biosirq"
#
# Don't ask me why - it would be better to fix the driver.  But, this
# krufty hack will do for now...
#
            if [ -x /sbin/modprobe ] ; then
                /sbin/modprobe pcmcia_core $CORE_OPTS || break
                (/sbin/modprobe $PCIC >/dev/null 2>&1 &&
                /sbin/modprobe $PCIC $PCIC_OPTS >/dev/null 2>&1) ||
                  (/sbin/modprobe yenta_socket >/dev/null 2>&1 &&
                   echo "using yenta_socket instead of $PCIC") ||
                  /sbin/modprobe $PCIC $PCIC_OPTS || break
                /sbin/modprobe ds || break
            elif [ -d $PC ] ; then
                /sbin/insmod $PC/pcmcia_core.o $CORE_OPTS
                /sbin/insmod $PC/$PCIC.o $PCIC_OPTS
                /sbin/insmod $PC/ds.o
            else
                echo "module directory $PC not found."
                break
            fi
        fi

        if [ -s /var/run/cardmgr.pid ] && \
            kill -0 `cat /var/run/cardmgr.pid` 2>/dev/null ; then
            echo "cardmgr is already running."
        else
            if [ -r $RUN/stab ] ; then
                cat $RUN/stab | cleanup
            fi
            /sbin/cardmgr $CARDMGR_OPTS
        fi

        echo "done."
        touch /var/lock/subsys/pcmcia 2>/dev/null
        EXITCODE=0
        ;;

    stop)
        echo -n "Shutting down PCMCIA services: "
        if [ -s /var/run/cardmgr.pid ] ; then
            PID=`cat /var/run/cardmgr.pid`
            kill $PID
            # Give cardmgr a few seconds to handle the signal
            for N in 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 ; do
                kill -0 $PID 2>/dev/null || break
                sleep 2
            done
        fi
        killall -q "CardBus Watcher"
        if grep -q "ds  " /proc/modules ; then
            /sbin/rmmod ds
            /sbin/rmmod $PCIC 2>/dev/null || \
                /sbin/rmmod yenta_socket 2>/dev/null
            /sbin/rmmod pcmcia_core
        fi
        echo "done."
        rm -f /var/lock/subsys/pcmcia

        # we do this because when we stop the service, the ide stop script
        # gets run before the card disappears
        /usr/sbin/updfstab
        EXITCODE=0
        ;;

    status)
        pid=`/sbin/pidof cardmgr`
        if [ "$pid" != "" ] ; then
            echo "cardmgr (pid $pid) is running..."
            EXITCODE=0
        else
            echo "cardmgr is stopped"
            EXITCODE=3
        fi
        ;;

    restart|reload)
        $0 stop
        $0 start
        EXITCODE=$?
        ;;

    *)
        usage
        ;;

    esac

done

# Only exit if we're in our own subshell
case $0 in *rc.pcmcia) exit $EXITCODE ;; esac

reply via email to

[Prev in Thread] Current Thread [Next in Thread]