diff options
author | Stefan Schweizer <genstef@gentoo.org> | 2005-02-26 22:20:37 +0000 |
---|---|---|
committer | Stefan Schweizer <genstef@gentoo.org> | 2005-02-26 22:20:37 +0000 |
commit | 0bee955056fd6c11c6fccf9319b080c32636629b (patch) | |
tree | 32134feb9018f2e3f3491a95ddd3f808dd692c4f /net-dialup | |
parent | Update SRC_URI (diff) | |
download | gentoo-2-0bee955056fd6c11c6fccf9319b080c32636629b.tar.gz gentoo-2-0bee955056fd6c11c6fccf9319b080c32636629b.tar.bz2 gentoo-2-0bee955056fd6c11c6fccf9319b080c32636629b.zip |
New ebuild, removing specific capi.conf in favour of capi4k-utils, adding patches for bug 76832 thanks to MonkeyIsland <parkmann@gmx.net>
(Portage version: 2.0.51-r15)
Diffstat (limited to 'net-dialup')
-rw-r--r-- | net-dialup/fcdsl/ChangeLog | 10 | ||||
-rw-r--r-- | net-dialup/fcdsl/fcdsl-2.6.20.7-r4.ebuild | 281 | ||||
-rw-r--r-- | net-dialup/fcdsl/files/digest-fcdsl-2.6.20.7-r4 | 5 | ||||
-rw-r--r-- | net-dialup/fcdsl/files/fcdsl.diff | 157 | ||||
-rw-r--r-- | net-dialup/fcdsl/files/fcdsl2.diff | 62 | ||||
-rw-r--r-- | net-dialup/fcdsl/files/fcdslsl.diff | 63 | ||||
-rw-r--r-- | net-dialup/fcdsl/files/fcdslslusb.diff | 135 | ||||
-rw-r--r-- | net-dialup/fcdsl/files/fcdslusb.diff | 86 |
8 files changed, 798 insertions, 1 deletions
diff --git a/net-dialup/fcdsl/ChangeLog b/net-dialup/fcdsl/ChangeLog index de06b57892e1..2b4fbb3d2972 100644 --- a/net-dialup/fcdsl/ChangeLog +++ b/net-dialup/fcdsl/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for net-dialup/fcdsl # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-dialup/fcdsl/ChangeLog,v 1.9 2005/02/17 23:02:19 mrness Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-dialup/fcdsl/ChangeLog,v 1.10 2005/02/26 22:20:37 genstef Exp $ + +*fcdsl-2.6.20.7-r4 (26 Feb 2005) + + 26 Feb 2005; Stefan Schweizer <genstef@gentoo.org> +files/fcdsl.diff, + +files/fcdsl2.diff, +files/fcdslsl.diff, +files/fcdslslusb.diff, + +files/fcdslusb.diff, +fcdsl-2.6.20.7-r4.ebuild: + New ebuild, removing specific capi.conf in favour of capi4k-utils, adding + patches for bug 76832 thanks to MonkeyIsland <parkmann@gmx.net> 18 Feb 2005; Alin Nastac <mrness@gentoo.org> fcdsl-2.6.20.7-r2.ebuild, fcdsl-2.6.20.7-r3.ebuild: diff --git a/net-dialup/fcdsl/fcdsl-2.6.20.7-r4.ebuild b/net-dialup/fcdsl/fcdsl-2.6.20.7-r4.ebuild new file mode 100644 index 000000000000..1cc6e59e15b2 --- /dev/null +++ b/net-dialup/fcdsl/fcdsl-2.6.20.7-r4.ebuild @@ -0,0 +1,281 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-dialup/fcdsl/fcdsl-2.6.20.7-r4.ebuild,v 1.1 2005/02/26 22:20:37 genstef Exp $ + +inherit linux-mod eutils + +FCDSL_SRC=("fritzcrd.dsl" "fritzcrd.dsl_v20" "fritzcrd.dsl_sl" + "fritzcrd.dsl_usb" "fritzcrd.dsl_sl_usb") +FCDSL_FILES=("fcdsl-suse9.1-3.11-02" "fcdsl2-suse9.1-3.11-04" + "fcdslsl-suse9.1-3.11-04" "fcdslusb-suse9.1-3.11-02" + "fcdslslusb-suse9.1-3.11-04") + +DESCRIPTION="AVM FRITZ!Card DSL drivers for 2.6 kernel" +HOMEPAGE="http://www.avm.de/" +SRC_URI="" +for ((CARD=0; CARD < ${#FCDSL_SRC[*]}; CARD++)); do + SRC_URI="${SRC_URI} + ftp://ftp.avm.de/cardware/${FCDSL_SRC[CARD]}/linux/suse.91/${FCDSL_FILES[CARD]}.tar.gz" +done + +LICENSE="LGPL-2" +KEYWORDS="~x86" +IUSE="" +SLOT="0" +S=${WORKDIR}/fritz + +RDEPEND=">=net-dialup/capi4k-utils-20040810" + +FCDSL_NAMES=("AVM FRITZ!Card DSL" "AVM FRITZ!Card DSL v2.0" "AVM FRITZ!Card DSL SL" "AVM FRITZ!Card DSL USB" "AVM FRITZ!Card DSL SL USB") +FCDSL_BUSTYPES=("pci" "pci" "pci" "usb" "usb") +FCDSL_IDS=("1131:5402" "1244:2900" "1244:2700" "057c:2300" "057c:3500") +FCDSL_FIRMWARES=("fdslbase.bin" "fds2base.bin" "fdssbase.bin" "fdsubase.frm" "fdlubase.frm") +FCDSL_MODULES=("fcdsl" "fcdsl2" "fcdslsl" "fcdslusb" "fcdslslusb") + +pkg_setup() { + CONFIG_CHECK="ISDN_CAPI_CAPI20" + linux-mod_pkg_setup + + MODULE_NAMES="" + #Check existence of user selected cards + if [ -n "${FCDSL_CARDS}" ] ; then + for USERCARD in ${FCDSL_CARDS} ; do + for ((CARD=0; CARD < ${#FCDSL_MODULES[*]}; CARD++)); do + if [ "${USERCARD}" = "${FCDSL_MODULES[CARD]}" ]; then + MODULE_NAMES="${MODULE_NAMES} ${FCDSL_MODULES[CARD]}(net:${WORKDIR}/${FCDSL_MODULES[CARD]/fc/fritz.}/src)" + continue 2 + fi + done + die "Driver for ${USERCARD} not present in ${P}" + done + else + einfo + einfo "You can control the modules which are built with the variable" + einfo "FCDSL_CARDS which should contain a blank separated list" + einfo "of a selection from the following cards:" + einfo " ${FCDSL_MODULES[*]}" + for ((CARD=0; CARD < ${#FCDSL_MODULES[*]}; CARD++)); do + MODULE_NAMES="${MODULE_NAMES} ${FCDSL_MODULES[CARD]}(net:${WORKDIR}/${FCDSL_MODULES[CARD]/fc/fritz.}/src)" + done + fi + BUILD_TARGETS="all" + BUILD_PARAMS="KDIR=${KV_DIR} LIBDIR=${S}" + NO_MODULESD="1" +} + +src_unpack() { + for ((CARD=0; CARD < ${#FCDSL_MODULES[*]}; CARD++)); do + tar xzf ${DISTDIR}/${FCDSL_FILES[CARD]}.tar.gz + mv fritz ${FCDSL_MODULES[CARD]/fc/fritz.} + cd ${FCDSL_MODULES[CARD]/fc/fritz.}/src + patch -p0 < ${FILESDIR}/${FCDSL_MODULES[CARD]}.diff + cd ../.. + done + + ln -s ${FCDSL_MODULES[0]/fc/fritz.} fritz +} + +src_install() { + linux-mod_src_install + + dodir /etc/drdsl /etc/modules.d /lib/firmware /usr/sbin + + echo "# modules.d config file for AVM FRITZ!Card DSL" >${D}/etc/modules.d/fcdsl + echo "# Correct these settings with the output from drdsl -n" >>${D}/etc/modules.d/fcdsl + + for ((CARD=0; CARD < ${#FCDSL_MODULES[*]}; CARD++)); do + if [ -n "${FCDSL_CARDS}" ] ; then + INS="" + for USERCARD in ${FCDSL_CARDS} ; do + if [ "${USERCARD}" = "${FCDSL_MODULES[CARD]}" ]; then INS="1"; fi + done + if [ -z "${INS}" ]; then continue; fi + fi + + echo "#options ${FCDSL_MODULES[CARD]} VPI=1 VCI=32 VCC=1" >>${D}/etc/modules.d/fcdsl + + insinto /lib/firmware + doins ${WORKDIR}/${FCDSL_MODULES[CARD]/fc/fritz.}/${FCDSL_FIRMWARES[CARD]} + done + + insinto /etc/drdsl + doins ${S}/drdsl.ini + + exeinto /usr/sbin + doexe ${S}/drdsl + + dodoc ${S}/CAPI* ${S}/compile* ${S}/license.txt +} + +pkg_postinst() { + linux-mod_pkg_postinst + + echo + einfo "If you want to setup your DSL card driver and create a peer file, please run:" + einfo " etc-update" + einfo " ebuild /var/db/pkg/net-dialup/${PF}/${PF}.ebuild config" + einfo " /etc/init.d/capi start" + einfo " drdsl -n" + einfo " nano /etc/modules.d/fcdsl" + einfo " update-modules" + einfo " /etc/init.d/capi restart" + epause 10 +} + +#pkg-config functions + +detect_fcdsl_card() { + PCI_IDS="" + USB_IDS="" + if [ -d /sys/bus ]; then + if [ -d /sys/bus/pci/devices ]; then + cd /sys/bus/pci/devices + for PCI_DEVICE in *; do + vendor="$(< ${PCI_DEVICE}/vendor)" + device="$(< ${PCI_DEVICE}/device)" + PCI_IDS="${PCI_IDS}${vendor:2}:${device:2} " + done + fi + if [ -d /sys/bus/usb/devices ]; then + cd /sys/bus/usb/devices + for USB_DEVICE in [0-9]*; do + if [ -f ${USB_DEVICE}/idVendor ]; then + USB_IDS="${USB_IDS}$(< ${USB_DEVICE}/idVendor):$(< ${USB_DEVICE}/idProduct) " + fi + done + fi + fi + + FCDSL_MODULE="" + for ((CARD=0; CARD < ${#FCDSL_IDS[*]}; CARD++)); do + BUS_IDS="" + if [ "${FCDSL_BUSTYPES[CARD]}" == "pci" ]; then + BUS_IDS="${PCI_IDS}" + else + BUS_IDS="${USB_IDS}" + fi + for BUS_ID in ${BUS_IDS}; do + if [ "${BUS_ID}" == "${FCDSL_IDS[CARD]}" ]; then + einfo "Found: ${FCDSL_NAMES[CARD]}" + FCDSL_FIRMWARE=${FCDSL_FIRMWARES[CARD]} + FCDSL_MODULE=${FCDSL_MODULES[CARD]} + fi + done + done + if [ "${FCDSL_MODULE}" == "" ]; then + ewarn "No AVM FRITZ!Card DSL found!" + fi +} + +readpassword() { + VALUE_1="" + VALUE_2="" + while true; do + einfo "Enter your password:" + read -r -s VALUE_1 + einfo "Retype your password:" + read -r -s VALUE_2 + if [ "${VALUE_1}" == "" ]; then + echo + eerror "You entered a blank password. Please try again." + echo + else + if [ "${VALUE_1}" == "${VALUE_2}" ] ; then + break + else + echo + eerror "Your password entries do not match. Please try again." + echo + fi + fi + done + eval ${1}=${VALUE_1} + + VALUE_1="" + VALUE_2="" + unset VALUE_1 + unset VALUE_2 +} + +readvalue() { + VALUE="" + while true; do + einfo "${2}:" + read VALUE + if [ "${VALUE}" == "" ]; then + eerror "You entered a blank value. Please try again." + echo + else + break + fi + done + eval ${1}=${VALUE} + + VALUE="" + unset VALUE +} + +pkg_config() { + detect_fcdsl_card + + if [ "${FCDSL_MODULE}" != "" ]; then + readvalue FCDSL_PROVIDER "Enter the name of your ISP" + if [ ! -e "/etc/ppp/peers/${FCDSL_PROVIDER}" ]; then + readvalue FCDSL_USER "Enter your user name" + if [ "$(grep "${FCDSL_USER}" /etc/ppp/pap-secrets)" == "" ]; then + readpassword FCDSL_PASSWORD + echo '"'${FCDSL_USER}'" * "'${FCDSL_PASSWORD}'"' >>/etc/ppp/pap-secrets + unset FCDSL_PASSWORD + cat <<EOF >>/etc/ppp/peers/${FCDSL_PROVIDER} +connect "" +ipcp-accept-remote +ipcp-accept-local +usepeerdns +defaultroute +user "${FCDSL_USER}" +hide-password +sync +noauth +lcp-echo-interval 5 +lcp-echo-failure 3 +lcp-max-configure 50 +lcp-max-terminate 2 +noccp +noipx +noproxyarp +mru 1492 +mtu 1492 +linkname "${FCDSL_PROVIDER}" +ipparam internet +plugin capiplugin.so +avmadsl +: +/dev/null +EOF + echo + echo + echo + einfo "Now, you can start an ADSL connection with either" + einfo " pon \"${FCDSL_PROVIDER}\"" + einfo "or" + einfo " pppd call \"${FCDSL_PROVIDER}\"" + else + ewarn "User \"${FCDSL_USER}\" always exists in \"/etc/ppp/pap-secrets\"!" + fi + else + ewarn "Peer file \"/etc/ppp/peers/${FCDSL_PROVIDER}\" always exists!" + fi + + #Uncomment correspondent lines in /etc/capi.conf & /etc/modules.d/fcdsl + if [ -f /etc/capi.conf ]; then + sed -i -e "s:^#${FCDSL_MODULE}:${FCDSL_MODULE}" /etc/capi.conf + fi + if [ -f /etc/modules.d/fcdsl ]; then + sed -i -e "s:^#options +${FCDSL_MODULE}:options ${FCDSL_MODULE}" /etc/modules.d/fcdsl + fi + else + ewarn "No AVM FRITZ!Card DSL found!" + fi + unset FCDSL_PROVIDER + unset FCDSL_USER +} diff --git a/net-dialup/fcdsl/files/digest-fcdsl-2.6.20.7-r4 b/net-dialup/fcdsl/files/digest-fcdsl-2.6.20.7-r4 new file mode 100644 index 000000000000..31e652664807 --- /dev/null +++ b/net-dialup/fcdsl/files/digest-fcdsl-2.6.20.7-r4 @@ -0,0 +1,5 @@ +MD5 4355167c8ca87ef796eb55cdaabf1b36 fcdsl-suse9.1-3.11-02.tar.gz 1931601 +MD5 b33f95f659d50a611dc1b63255a0b5fc fcdsl2-suse9.1-3.11-04.tar.gz 1446440 +MD5 ceadcdddc662fbcfa8fa9e2980748666 fcdslsl-suse9.1-3.11-04.tar.gz 1441516 +MD5 5fde466f6c66d37353355fa6d07721fb fcdslusb-suse9.1-3.11-02.tar.gz 1154136 +MD5 1c35c16e699ed70e70ab2351bd83d109 fcdslslusb-suse9.1-3.11-04.tar.gz 1430073 diff --git a/net-dialup/fcdsl/files/fcdsl.diff b/net-dialup/fcdsl/files/fcdsl.diff new file mode 100644 index 000000000000..590ad5ef379a --- /dev/null +++ b/net-dialup/fcdsl/files/fcdsl.diff @@ -0,0 +1,157 @@ +--- driver.c.orig 2004-05-14 02:00:00.000000000 +0200 ++++ driver.c 2005-01-21 15:40:33.000000000 +0100 +@@ -18,6 +18,10 @@ + * http://www.opensource.org/licenses/lgpl-license.html + * + * Contact: AVM GmbH, Alt-Moabit 95, 10559 Berlin, Germany, email: info@avm.de ++ * ++ * Mon Oct 20 22:43:31 2003 ++ * Modified by Joerg Lehrke to improve locking ++ * Fixed for rev 0.4.1 by Stefan Schweizer + */ + + #include <asm/io.h> +@@ -57,6 +61,8 @@ + #include "dbgif.h" + #endif + ++#undef SINGLE_LOCK ++ + #define KILOBYTE 1024 + #define MEGABYTE (1024*KILOBYTE) + #define DMA_BUFFER_SIZE (9*KILOBYTE) +@@ -101,7 +107,11 @@ + static struct capi_ctr capi_ctrl[2]; + static int capi_ctrl_ix = 0; + static per_ctrl_t ctrl_params[2]; ++#if defined (SINGLE_LOCK) ++# define stack_lock qt_lock ++#else + static spinlock_t stack_lock = SPIN_LOCK_UNLOCKED; ++#endif + static atomic_t rx_flag = ATOMIC_INIT (0); + static atomic_t tx_flag = ATOMIC_INIT (0); + static atomic_t thread_flag = ATOMIC_INIT (0); +@@ -1142,7 +1152,7 @@ + } /* remove_ctrl */ + + /*---------------------------------------------------------------------------*\ +-\*-C-------------------------------------------------------------------------*/ ++\*---------------------------------------------------------------------------*/ + static inline int in_critical (void) { + + return (0 < atomic_read (&crit_count)); +@@ -1301,7 +1311,7 @@ + capi_ctr_handle_message (ctrl, appl, skb); + } /* msg2capi */ + +-/*-S-------------------------------------------------------------------------*\ ++/*---------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static __attr void __stack scheduler_control (unsigned ena) { + int enabled = (int) ena; +@@ -1323,6 +1333,7 @@ + /*---------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static int sched_thread (void * arg) { ++ unsigned long flags; + + UNUSED_ARG (arg); + daemonize (TARGET); +@@ -1356,6 +1367,7 @@ + } + + /* Body of thread, invoke scheduler */ ++ local_irq_save(flags); + if (spin_trylock (&stack_lock)) { + os_timer_poll (); + assert (capi_lib->cm_schedule); +@@ -1364,6 +1376,7 @@ + } + spin_unlock (&stack_lock); + } ++ local_irq_restore(flags); + } + LOG("Scheduler thread stopped.\n"); + up (&hotplug); +@@ -1470,17 +1483,22 @@ + /*---------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static void tx_task (unsigned long data) { +- ++ unsigned long flags; ++ + UNUSED_ARG (data); + if (in_critical ()) { + atomic_set (&tx_flag, 1); + kick_scheduler (); +- } else if (spin_trylock (&stack_lock)) { +- tx_handler (capi_card); +- spin_unlock (&stack_lock); + } else { +- atomic_set (&tx_flag, 1); +- kick_scheduler (); ++ local_irq_save(flags); ++ if (spin_trylock (&stack_lock)) { ++ tx_handler (capi_card); ++ spin_unlock (&stack_lock); ++ } else { ++ atomic_set (&tx_flag, 1); ++ kick_scheduler (); ++ } ++ local_irq_restore(flags); + } + } /* tx_task */ + +@@ -1533,17 +1551,22 @@ + /*---------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static void rx_task (unsigned long data) { ++ unsigned long flags; + + UNUSED_ARG (data); + if (in_critical ()) { + atomic_set (&rx_flag, 1); + kick_scheduler (); +- } else if (spin_trylock (&stack_lock)) { +- rx_handler (capi_card); +- spin_unlock (&stack_lock); + } else { +- atomic_set (&rx_flag, 1); +- kick_scheduler (); ++ local_irq_save(flags); ++ if (spin_trylock (&stack_lock)) { ++ rx_handler (capi_card); ++ spin_unlock (&stack_lock); ++ } else { ++ atomic_set (&rx_flag, 1); ++ kick_scheduler (); ++ } ++ local_irq_restore(flags); + } + } /* rx_task */ + +@@ -1562,6 +1585,7 @@ + return IRQ_NONE; + } + cp = (card_p) args; ++ spin_lock (&stack_lock); + while (0 != ((flags = PEEK (cp->io_base + INT_CTL)) & CARD_PCI_INT_ASSERT)) { + ++count; + assert (count < 3); +@@ -1572,6 +1596,7 @@ + assert ((PEEK (cp->io_base + INT_CTL) + & ~(CARD_PCI_INT_ASSERT | CARD_PCI_INT_ISASSERTED)) != 0); + if (!atomic_read (&link_open)) { ++ spin_unlock (&stack_lock); + return IRQ_HANDLED; + } + tx_flag = PEEK (cp->io_base + XFER_TOTM_STATUS) == TM_READY; +@@ -1586,6 +1611,7 @@ + } + } + info (0 == (PEEK (cp->io_base + INT_CTL) & CARD_PCI_INT_ASSERT)); ++ spin_unlock (&stack_lock); + return IRQ_RETVAL(count > 0); + } /* irq_handler */ + diff --git a/net-dialup/fcdsl/files/fcdsl2.diff b/net-dialup/fcdsl/files/fcdsl2.diff new file mode 100644 index 000000000000..c8df5fa0f57b --- /dev/null +++ b/net-dialup/fcdsl/files/fcdsl2.diff @@ -0,0 +1,62 @@ +--- driver.c.orig 2004-07-01 00:00:00.000000000 +0200 ++++ driver.c 2005-02-26 11:15:41.000000000 +0100 +@@ -18,6 +18,10 @@ + * http://www.opensource.org/licenses/lgpl-license.html + * + * Contact: AVM GmbH, Alt-Moabit 95, 10559 Berlin, Germany, email: info@avm.de ++ * ++ * Mon Oct 20 22:43:31 2003 ++ * Modified by Joerg Lehrke to improve locking ++ * Fixed for rev 0.4.1 by Stefan Schweizer + */ + + #include <asm/io.h> +@@ -54,6 +58,8 @@ + #include "devif.h" + #include "driver.h" + ++#undef SINGLE_LOCK ++ + #define KILOBYTE 1024 + #define MEGABYTE (1024*KILOBYTE) + #define _2_MEGS_ (2*MEGABYTE) +@@ -92,7 +98,11 @@ typedef struct __db { + card_p capi_card = NULL; + lib_callback_t * capi_lib = NULL; + atomic_t crit_count = ATOMIC_INIT(0); ++#if defined (SINGLE_LOCK) ++# define stack_lock qt_lock ++#else + spinlock_t stack_lock = SPIN_LOCK_UNLOCKED; ++#endif + + static int nvers = 0; + static atomic_t scheduler_enabled = ATOMIC_INIT (1); +@@ -1322,9 +1332,10 @@ void msg2capi (unsigned char * msg) { + capi_ctr_handle_message (ctrl, appl, skb); + } /* msg2capi */ + +-/*-S-------------------------------------------------------------------------*\ ++/*---------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static int sched_thread (void * arg) { ++ unsigned long flags; + + UNUSED_ARG (arg); + daemonize (TARGET); +@@ -1356,6 +1367,7 @@ static int sched_thread (void * arg) { + continue; + } + /* Body of thread, invoke scheduler */ ++ local_irq_save(flags); + if (spin_trylock (&stack_lock)) { + os_timer_poll (); + assert (capi_lib->cm_schedule); +@@ -1364,6 +1376,7 @@ static int sched_thread (void * arg) { + } + spin_unlock (&stack_lock); + } ++ local_irq_restore(flags); + } + LOG("Scheduler thread stopped.\n"); + up (&thread_sync); diff --git a/net-dialup/fcdsl/files/fcdslsl.diff b/net-dialup/fcdsl/files/fcdslsl.diff new file mode 100644 index 000000000000..ff06da9df07b --- /dev/null +++ b/net-dialup/fcdsl/files/fcdslsl.diff @@ -0,0 +1,63 @@ +--- driver.c.orig 2004-06-17 02:00:00.000000000 +0200 ++++ driver.c 2005-02-26 11:02:38.000000000 +0100 +@@ -18,6 +18,11 @@ + * http://www.opensource.org/licenses/lgpl-license.html + * + * Contact: AVM GmbH, Alt-Moabit 95, 10559 Berlin, Germany, email: info@avm.de ++ * ++ * Sunday Dec 07 18:10 2003 ++ * Modified by Christian 'greeny' Heckhoff to improve locking ++ * based on modifications by Joerg Lehrke for Fritz!Card DSL ++ * + */ + + #include <asm/io.h> +@@ -54,6 +59,8 @@ + #include "devif.h" + #include "driver.h" + ++#undef SINGLE_LOCK ++ + #define KILOBYTE 1024 + #define MEGABYTE (1024*KILOBYTE) + #define _2_MEGS_ (2*MEGABYTE) +@@ -92,7 +99,11 @@ typedef struct __db { + card_p capi_card = NULL; + lib_callback_t * capi_lib = NULL; + atomic_t crit_count = ATOMIC_INIT(0); ++#if defined (SINGLE_LOCK) ++# define stack_lock qt_lock ++#else + spinlock_t stack_lock = SPIN_LOCK_UNLOCKED; ++#endif + + static int nvers = 0; + static atomic_t scheduler_enabled = ATOMIC_INIT (1); +@@ -1322,9 +1333,10 @@ void msg2capi (unsigned char * msg) { + capi_ctr_handle_message (ctrl, appl, skb); + } /* msg2capi */ + +-/*-S-------------------------------------------------------------------------*\ ++/*---------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static int sched_thread (void * arg) { ++ unsigned long flags; + + UNUSED_ARG (arg); + daemonize (TARGET); +@@ -1356,6 +1368,7 @@ static int sched_thread (void * arg) { + continue; + } + /* Body of thread, invoke scheduler */ ++ local_irq_save(flags); + if (spin_trylock (&stack_lock)) { + os_timer_poll (); + assert (capi_lib->cm_schedule); +@@ -1364,6 +1377,7 @@ static int sched_thread (void * arg) { + } + spin_unlock (&stack_lock); + } ++ local_irq_restore(flags); + } + LOG("Scheduler thread stopped.\n"); + up (&thread_sync); diff --git a/net-dialup/fcdsl/files/fcdslslusb.diff b/net-dialup/fcdsl/files/fcdslslusb.diff new file mode 100644 index 000000000000..e8dfe40e6c8f --- /dev/null +++ b/net-dialup/fcdsl/files/fcdslslusb.diff @@ -0,0 +1,135 @@ +--- driver.c.orig 2004-06-17 02:00:00.000000000 +0200 ++++ driver.c 2005-02-26 10:40:39.000000000 +0100 +@@ -18,6 +18,16 @@ + * http://www.opensource.org/licenses/lgpl-license.html + * + * Contact: AVM GmbH, Alt-Moabit 95, 10559 Berlin, Germany, email: info@avm.de ++ * ++ * Sunday Dec 07 18:10 2003 ++ * Modified by Christian 'greeny' Heckhoff to improve locking ++ * based on modifications by Joerg Lehrke for Fritz!Card DSL ++ * ++ * Saturday Jul 24 2004, Oswin Horvath ++ * small modifications to make the patch work for the Fritz!Card SL USB (03.11.94) ++ * ++ * Saturday Feb 26 2005, Stefan Schweizer ++ * Fixed patch for rev 0.2.2 + */ + + #include <asm/io.h> +@@ -54,6 +64,8 @@ + #include "devif.h" + #include "driver.h" + ++#undef SINGLE_LOCK ++ + #ifndef HZ + # error HZ is not defined... + #endif +@@ -84,7 +96,11 @@ + \*---------------------------------------------------------------------------*/ + card_p capi_card = NULL; + lib_callback_t * capi_lib = NULL; ++#if defined (SINGLE_LOCK) ++# define stack_lock qt_lock ++#else + spinlock_t stack_lock = SPIN_LOCK_UNLOCKED; ++#endif + struct capi_ctr * capi_controller[2] = { NULL, NULL } ; + int card_config; + +@@ -919,12 +935,17 @@ static inline int in_critical (void) { + /*---------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static inline void check (void) { ++ unsigned long flags; + + if (atomic_read (&rx_flag) > 0) { ++ spin_lock_irqsave (&stack_lock, flags); + rx_handler (capi_card); ++ spin_unlock_irqrestore (&stack_lock, flags); + } + if (atomic_read (&tx_flag) > 0) { ++ spin_lock_irqsave (&stack_lock, flags); + tx_handler (capi_card); ++ spin_unlock_irqrestore (&stack_lock, flags); + } + } /* check */ + +@@ -1101,6 +1122,7 @@ static __attr void __stack scheduler_con + /*-S-------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static int scheduler (void * arg) { ++ unsigned long flags; + + UNUSED_ARG (arg); + daemonize (TARGET); +@@ -1134,6 +1156,7 @@ static int scheduler (void * arg) { + } + + /* Body of thread, invoke scheduler */ ++ local_irq_save(flags); + if (spin_trylock (&stack_lock)) { + info (!atomic_xchg (&in_scheduler, 1)); + os_timer_poll (); +@@ -1146,6 +1169,7 @@ static int scheduler (void * arg) { + #endif + spin_unlock (&stack_lock); + } ++ local_irq_restore(flags); + } + LOG("Scheduler thread stopped.\n"); + up (&thread_sync); +@@ -1324,22 +1348,44 @@ static void rx_handler (card_p pdc) { + /*---------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static void tx_task (unsigned long data) { +- ++ unsigned long flags; + UNUSED_ARG (data); +- if (!in_critical () && spin_trylock (&stack_lock)) { +- tx_handler (capi_card); +- spin_unlock (&stack_lock); ++ ++ if (in_critical ()){ ++ atomic_set (&tx_flag, 1); ++ kick_scheduler (); ++ } else { ++ local_irq_save(flags); ++ if (spin_trylock (&stack_lock)) { ++ tx_handler (capi_card); ++ spin_unlock (&stack_lock); ++ } else { ++ atomic_set (&tx_flag, 1); ++ kick_scheduler (); ++ } ++ local_irq_restore(flags); + } + } /* tx_task */ + + /*---------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static void rx_task (unsigned long data) { +- ++ unsigned long flags; + UNUSED_ARG (data); +- if (!in_critical () && spin_trylock (&stack_lock)) { +- rx_handler (capi_card); +- spin_unlock (&stack_lock); ++ ++ if (in_critical ()){ ++ atomic_set (&tx_flag, 1); ++ kick_scheduler (); ++ } else { ++ local_irq_save(flags); ++ if (spin_trylock (&stack_lock)) { ++ tx_handler (capi_card); ++ spin_unlock (&stack_lock); ++ } else { ++ atomic_set (&tx_flag, 1); ++ kick_scheduler (); ++ } ++ local_irq_restore(flags); + } + } /* rx_task */ + diff --git a/net-dialup/fcdsl/files/fcdslusb.diff b/net-dialup/fcdsl/files/fcdslusb.diff new file mode 100644 index 000000000000..922cad2629d0 --- /dev/null +++ b/net-dialup/fcdsl/files/fcdslusb.diff @@ -0,0 +1,86 @@ +--- driver.c.orig 2004-05-14 02:00:00.000000000 +0200 ++++ driver.c 2005-02-26 11:26:41.000000000 +0100 +@@ -18,6 +18,10 @@ + * http://www.opensource.org/licenses/lgpl-license.html + * + * Contact: AVM GmbH, Alt-Moabit 95, 10559 Berlin, Germany, email: info@avm.de ++ * ++ * Mon Oct 20 22:43:31 2003 ++ * Modified by Joerg Lehrke to improve locking ++ * Fixed for rev 0.4.1 by Stefan Schweizer + */ + + #include <asm/atomic.h> +@@ -46,6 +50,8 @@ + #include "main.h" + #include "driver.h" + ++#undef SINGLE_LOCK ++ + #ifndef HZ + # error HZ is not defined... + #endif +@@ -76,7 +82,11 @@ static atomic_t crit_count = ATOMIC_I + static volatile int hard_error_issued; + static atomic_t tx_flag = ATOMIC_INIT (0); + static atomic_t rx_flag = ATOMIC_INIT (0); ++#if defined (SINGLE_LOCK) ++# define stack_lock qt_lock ++#else + static spinlock_t stack_lock = SPIN_LOCK_UNLOCKED; ++#endif + static int thread_pid = -1; + static atomic_t thread_flag; + static atomic_t thread_capi_flag; +@@ -1367,15 +1377,20 @@ static void tx_handler (card_p pdc) { + /*---------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static void tx_task (unsigned long data) { +- ++ unsigned long flags; + UNUSED_ARG (data); ++ + if (in_critical ()) { + atomic_set (&tx_flag, 1); +- } else if (spin_trylock (&stack_lock)) { +- tx_handler (capi_card); +- spin_unlock (&stack_lock); + } else { +- atomic_set (&tx_flag, 1); ++ local_irq_save(flags); ++ if (spin_trylock (&stack_lock)) { ++ tx_handler (capi_card); ++ spin_unlock (&stack_lock); ++ } else { ++ atomic_set (&tx_flag, 1); ++ } ++ local_irq_restore(flags); + } + } /* tx_task */ + +@@ -1412,15 +1427,20 @@ static void rx_handler (card_p pdc) { + /*---------------------------------------------------------------------------*\ + \*---------------------------------------------------------------------------*/ + static void rx_task (unsigned long data) { +- ++ unsigned long flags; + UNUSED_ARG (data); ++ + if (in_critical ()) { + atomic_set (&rx_flag, 1); +- } else if (spin_trylock (&stack_lock)) { +- rx_handler (capi_card); +- spin_unlock (&stack_lock); + } else { +- atomic_set (&rx_flag, 1); ++ local_irq_save(flags); ++ if (spin_trylock (&stack_lock)) { ++ tx_handler (capi_card); ++ spin_unlock (&stack_lock); ++ } else { ++ atomic_set (&tx_flag, 1); ++ } ++ local_irq_restore(flags); + } + } /* rxi_task */ + |