E: rml@tech9.net
E: rml@ufl.edu
D: misc. kernel hacking and debugging
-S: FL, USA
+S: Gainesville, Florida 32608
+S: USA
N: Martin von Löwis
E: loewis@informatik.hu-berlin.de
Intel 440LX/BX/GX support
CONFIG_AGP_INTEL
This option gives you AGP support for the GLX component of the
- XFree86 4.x on Intel 440LX/BX/GX chipsets.
+ XFree86 4.x on Intel 440LX/BX/GX, 815, and 840 chipsets.
For the moment, you should probably say N, unless you want to test
the GLX component for XFree86 3.3.6, which can be downloaded from
Intel I810/I810 DC100/I810e support
CONFIG_AGP_I810
- This option gives you AGP support for the Xserver for the Intel
- 810 chipset boards. This is required to do any useful video
- modes.
+ This option gives you AGP support for the Xserver on the Intel 810
+ and 815 chipset boards for their on-board integrated graphics. This
+ is required to do any useful video modes with these boards.
VIA chipset support
CONFIG_AGP_VIA
Documentation/mca.txt (and especially the web page given there)
before attempting to build an MCA bus kernel.
+EISA support
+CONFIG_EISA
+ The Extended Industry Standard Architecture (EISA) bus was
+ developed as an open alternative to the IBM MicroChannel bus.
+
+ The EISA bus provided some of the features of the IBM MicroChannel
+ bus while maintaining backward compatibility with cards made for
+ the older ISA bus. The EISA bus saw limited use between 1988 and 1995
+ when it was made obsolete by the PCI bus.
+
+ Say Y here if you are building a kernel for an EISA-based machine.
+
+ Otherwise, say N.
+
SGI Visual Workstation support
CONFIG_VISWS
The SGI Visual Workstation series is an IA32-based workstation
- "Pentium-MMX" for the Intel Pentium MMX.
- "Pentium-Pro" for the Intel Pentium Pro/Celeron/Pentium II.
- "Pentium-III" for the Intel Pentium III.
+ - "Pentium-4" for the Intel Pentium 4
- "K6" for the AMD K6, K6-II and K6-III (aka K6-3D).
- "Athlon" for the AMD Athlon (K7).
- "Crusoe" for the Transmeta Crusoe series.
Support for OPTi MAD16 and/or Mozart based cards
CONFIG_SOUND_MAD16
Answer Y if your card has a Mozart (OAK OTI-601) or MAD16 (OPTi
- 82C928 or 82C929 or 82C931) audio interface chip. For the 82C931,
- please read drivers/sound/README.C931. These chips are currently
+ 82C928 or 82C929 or 82C931) audio interface chip. These chips are
quite common so it's possible that many no-name cards have one of
them. In addition the MAD16 chip is used in some cards made by known
manufacturers such as Turtle Beach (Tropez), Reveal (some models)
- SiS 900/7016 Fast Ethernet Device Driver
- by Ollie Lho (ollie@sis.com.tw)
- November 4, 1999. Document Revision: 0.2
-
- This document gives some information on installation and usage of SiS
- 900/7016 device driver under Linux.
- ______________________________________________________________________
-
- Table of Contents
-
-
- 1. Introduction
-
- 2. License
-
- 3. Changes
-
- 4. Tested Environment
-
- 5. Files in This Package
-
- 6. Installation
-
- 6.1 Kernel version later than 2.2.11 and 2.3.15
- 6.1.1 Building the driver as loadable module
- 6.1.2 Building the driver into kernel
- 6.2 Earlier Kernel Version in 2.2.x and 2.3.x Series
-
- 7. Known Problems and Bugs
-
- 8. Revision History
-
- 9. Acknowledgements
-
-
-
- ______________________________________________________________________
-
- 1. Introduction
-
- This document describes the revision 1.06 of SiS 900/7016 Fast
- Ethernet device driver under Linux. The driver is developed by Silicon
- Integrated System Corp. and distributed freely under the GNU General
- Public License (GPL). The driver can be compiled as a loadable module
- and used under Linux kernel version 2.2.x. With minimal changes, the
- driver can also be used under 2.3.x kernel, please see section
- ``Installation''. If you are intended to use the driver for earlier
- kernels, you are on your own.
-
- The driver is tested with usual TCP/IP applications including FTP,
- Telnet, Netscape etc. and is used constantly by the developers.
-
- Please send all comments/fixes/questions to Ollie Lho.
-
-
- 2. License
-
-
-
-
-
-
-
-
-
-
- Copyright (C) 1999 Silicon Integrated System Corp.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-
-
-
- 3. Changes
-
- Changes made in Revision 1.06
-
- 1. Separation of sis900.c and sis900.h in order to move most constant
- definition to sis900.h (many of those constants were corrected)
-
- 2. Clean up PCI detection, the pci-scan from Donald Becker were not
- used, just simple pci_find_*.
-
- 3. MII detection is modified to support multiple mii transceiver.
-
- 4. Bugs in read_eeprom, mdio_* were removed.
-
- 5. Lot of sis900 irrelevant comments were removed/changed and more
- comments were added to reflect the real situation.
-
- 6. Clean up of physical/virtual address space mess in buffer
- descriptors.
-
- 7. Better transmit/receive error handling.
-
- 8. The driver now uses zero-copy single buffer management scheme to
- improve performance.
-
- 9. Names of variables were changed to be more consistent.
-
- 10.
- Clean up of auo-negotiation and timer code.
-
- 11.
- Automatic detection and change of PHY on the fly.
-
-
- 4. Tested Environment
-
- This driver is developed on the following hardware
-
- o Intel Celeron 336 with SiS 620 (rev 02) chipset
-
- o SiS 900 (rev 01) and SiS 7016/7014 Fast Ethernet Card
-
- and tested with these software environments
-
- o Red Hat Linux version 6.0
-
- o Linux kernel version 2.2.13
-
- o Netscape version 4.6
-
- o NcFTP 3.0.0 beta 18
-
- o Samba version 2.0.3
-
-
- 5. Files in This Package
-
- In the package you can find these files:
-
-
- sis900-2.2.x.c
- Driver source for kernel 2.2.x
-
- sis900-2.3.x.c
- Driver source for kernel 2.3.x
-
- sis900.h
- Header file for both 2.2.x and 2.3.x kernel
-
- sis900.sgml
- Linux-Doc SGML source of the document
-
-
- 6. Installation
-
- Silicon Integrated System Corp. is cooperating closely with core Linux
- Kernel developers. The revisions of SiS 900 driver are distributed by
- the usual channels for kernel tar files and patches. Those kernel tar
- files for official kernel and patches for kernel pre-release can be
- download at official kernel ftp site
- <http://ftp.kernel.org/pub/linux/kernel/> and its mirrors. The 1.06
- revision can be found in kernel version later than 2.3.15 and
- pre-2.2.14. If you have no prior experience in networking under
- Linux, please read Ethernet HOWTO and Networking HOWTO available from
- Linux Documentation Project (LDP).
-
- The installation procedure are different according to your kernel
- versions.
-
-
- 6.1. Kernel version later than 2.2.11 and 2.3.15
-
- The driver is bundled in release later than 2.2.11 and 2.3.15 so this
- is the most easy case. Be sure you have the appropriate packages for
- compiling kernel source. Those packages are listed in
- Document/Changes in kernel source distribution. There are two
- alternative ways to install the driver
-
-
- 6.1.1. Building the driver as loadable module
-
- To build the driver as a loadable kernel module you have to
- reconfigure the kernel to activate network support by
-
-
-
- make config
-
-
-
-
- Choose "Network Device Support" to "Y" and "Ethernet Support" to "Y".
- Then you have to choose "SiS 900 Fast Ethernet Adapter Support" to
- "M".
-
- After reconfiguring the kernel, you can make the driver module by
-
-
- make modules
-
-
-
-
- The driver should be compiled with no errors. After compiling the
- driver, the driver can be installed to proper place by
-
-
-
- make modules_install
-
-
-
-
- Load the driver into kernel by
-
-
-
- insmod sis900
-
-
-
-
- When loading the driver into memory, some information message can be
- view by
-
-
-
- dmesg
-
-
-
-
- or
-
-
- cat /var/log/message
-
-
-
-
- If the driver is loaded properly you will have messages similar to
- this:
-
-
-
- sis900.c: v1.06 11/04/99
- eth0: SiS 900 PCI Fast Ethernet at 0xd000, IRQ 10, 00:00:e8:83:7f:a4.
- eth0: SiS 900 Internal MII PHY transceiver found at address 1.
- eth0: Using SiS 900 Internal MII PHY as default
-
-
-
-
- showing the version of the driver and the results of probing routine.
-
- Once the driver is loaded, network can be brought up by
-
-
-
- /sbin/ifconfig eth0 IPADDR broadcast BROADCAST netmask NETMASK
-
-
-
-
-
- where IPADDR, BROADCAST, NETMASK are your IP address, broadcast
- address and netmask respectively. For more information on how to
- configure network interface, please refer to Networking HOWTO.
-
- The link status is also shown by kernel messages. For example, after
- the network interface is activated, you may have the message:
-
-
-
- eth0: Media Link On 100mbps full-duplex
-
-
-
-
- If you try to unplug the twist pair (TP) cable you will get
-
-
-
- eth0: Media Link Off
-
-
-
-
- indicating that the link is failed.
-
-
- 6.1.2. Building the driver into kernel
-
- If you want to make the driver into kernel, choose "Y" rather than "M"
- on "SiS 900 Fast Ethernet Adapter Support" when configuring the
- kernel. Build the kernel image in the usual way
-
-
-
- make dep
-
- make clean
-
- make bzlilo
-
-
-
-
- Next time the system reboot, you have the driver in memory.
-
-
- 6.2. Earlier Kernel Version in 2.2.x and 2.3.x Series
-
- Installing the driver for earlier kernels in 2.2.x and 2.3.x series
- requires a little bit more work. First you have to copy sis900-2.x.x.c
- to /usr/src/linux/drivers/net/ and you have to modify some files
- manually (sorry !! no patch available !!)
-
- in Space.c, add
-
-
- extern int sis900_probe(struct device *dev);
-
- ...
-
- #ifdef CONFIG_SIS900
- {sis900_probe,0},
- #endif
-
-
- in Config.in add
-
-
- if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
- ... //other adapter drivers
- tristate 'SiS 900 PCI Fast Ethernet Adapter Support' CONFIG_SIS900
- ... //other adapter drivers
- fi
-
-
-
-
- in Makefile add
-
-
- ifeq ($(CONFIG_SIS900),y)
- L_OBJS += sis900.o
- else
- ifeq ($(CONFIG_SIS900),m)
- M_OBJS += sis900.o
- endif
- endif
-
-
-
-
- After modifying these files, the driver can be build as described in
- the previous section.
-
-
- 7. Known Problems and Bugs
-
- There are some known problems and bugs. If you find any other bugs
- please mail to ollie@sis.com.tw
-
- 1. AM79C901 HomePNA PHY is not thoroughly tested, there may be some
- bugs in the "on the fly" change of transceiver.
-
- 2. A bug is hidden somewhere in the receive buffer management code,
- the bug causes NULL pointer reference in the kernel. This fault is
- caught before bad things happen and reported with the message:
-
-
- eth0: NULL pointer encountered in Rx ring, skipping
-
-
-
-
- which can be viewed with dmesg or cat /var/log/message.
-
-
- 8. Revision History
-
-
- o November 4, 1999, Revision 1.06, Second release, lots of clean up
- and optimization.
-
- o August 8, 1999, Revision 1.05, Initial Public Release
-
-
- 9. Acknowledgements
-
- This driver was originally derived form Donald Becker's pci-skeleton
- and rtl8139 drivers. Donald also provided various suggestion regarded
- with improvements made in revision 1.06.
-
- The 1.05 revision was created by Jim Huang, AMD 79c901 support was
- added by Chin-Shan Li.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+SiS 900/7016 Fast Ethernet Device Driver
+
+Ollie Lho
+
+Lei Chun Chang
+
+ November 16, 2000. Document Revision: 0.3
+
+ This document gives some information on installation and usage of SiS
+ 900/7016 device driver under Linux.
+ _________________________________________________________________
+ _________________________________________________________________
+
+Introduction
+
+ This document describes the revision 1.06 and 1.07 of SiS 900/7016
+ Fast Ethernet device driver under Linux. The driver is developed by
+ Silicon Integrated System Corp. and distributed freely under the GNU
+ General Public License (GPL). The driver can be compiled as a loadable
+ module and used under Linux kernel version 2.2.x. (rev. 1.06) With
+ minimal changes, the driver can also be used under 2.3.x and 2.4.x
+ kernel (rev. 1.07), please see the section called Installation. If you
+ are intended to use the driver for earlier kernels, you are on your
+ own.
+
+ The driver is tested with usual TCP/IP applications including FTP,
+ Telnet, Netscape etc. and is used constantly by the developers.
+
+ Please send all comments/fixes/questions to Lei-Chun Chang.
+ _________________________________________________________________
+
+License
+
+ Copyright (C) 1999 Silicon Integrated System Corp.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 U
+SA
+ _________________________________________________________________
+
+Changes
+
+ Changes made in Revision 1.07
+
+ 1. Separation of sis900.c and sis900.h in order to move most constant
+ definition to sis900.h (many of those constants were corrected)
+ 2. Clean up PCI detection, the pci-scan from Donald Becker were not
+ used, just simple pci_find_*.
+ 3. MII detection is modified to support multiple mii transceiver.
+ 4. Bugs in read_eeprom, mdio_* were removed.
+ 5. Lot of sis900 irrelevant comments were removed/changed and more
+ comments were added to reflect the real situation.
+ 6. Clean up of physical/virtual address space mess in buffer
+ descriptors.
+ 7. Better transmit/receive error handling.
+ 8. The driver now uses zero-copy single buffer management scheme to
+ improve performance.
+ 9. Names of variables were changed to be more consistent.
+ 10. Clean up of auo-negotiation and timer code.
+ 11. Automatic detection and change of PHY on the fly.
+ 12. Bug in mac probing fixed.
+ 13. Fix 630E equalier problem by modifying the equalizer workaround
+ rule.
+ 14. Support for ICS1893 10/100 Interated PHYceiver.
+ 15. Support for media select by ifconfig.
+ _________________________________________________________________
+
+Tested Environment
+
+ This driver is developed on the following hardware
+
+ * Intel Celeron 500 with SiS 630 (rev 02) chipset
+ * SiS 900 (rev 01) and SiS 7016/7014 Fast Ethernet Card
+
+ and tested with these software environments
+
+ * Red Hat Linux version 6.2
+ * Linux kernel version 2.4.0
+ * Netscape version 4.6
+ * NcFTP 3.0.0 beta 18
+ * Samba version 2.0.3
+ _________________________________________________________________
+
+Files in This Package
+
+ In the package you can find these files:
+
+ sis900.c
+ Driver source file in C
+
+ sis900.h
+ Header file for sis900.c
+
+ sis900.sgml
+ DocBook SGML source of the document
+
+ sis900.txt
+ Driver document in plain text
+ _________________________________________________________________
+
+Installation
+
+ Silicon Integrated System Corp. is cooperating closely with core Linux
+ Kernel developers. The revisions of SiS 900 driver are distributed by
+ the usuall channels for kernel tar files and patches. Those kernel tar
+ files for official kernel and patches for kernel pre-release can be
+ download at official kernel ftp site and its mirrors. The 1.06
+ revision can be found in kernel version later than 2.3.15 and
+ pre-2.2.14, and 1.07 revision can be found in kernel version 2.4.0. If
+ you have no prior experience in networking under Linux, please read
+ Ethernet HOWTO and Networking HOWTO available from Linux Documentation
+ Project (LDP).
+
+ The driver is bundled in release later than 2.2.11 and 2.3.15 so this
+ is the most easy case. Be sure you have the appropriate packages for
+ compiling kernel source. Those packages are listed in Document/Changes
+ in kernel source distribution. If you have to install the driver other
+ than those bundled in kernel release, you should have your driver file
+ sis900.c and sis900.h copied into /usr/src/linux/drivers/net/ first.
+ There are two alternative ways to install the driver
+ _________________________________________________________________
+
+Building the driver as loadable module
+
+ To build the driver as a loadable kernel module you have to
+ reconfigure the kernel to activate network support by
+
+make menuconfig
+
+ Choose "Loadable module support --->", then select "Enable loadable
+ module support".
+
+ Choose "Network Device Support --->", select "Ethernet (10 or
+ 100Mbit)". Then select "EISA, VLB, PCI and on board controllers", and
+ choose "SiS 900/7016 PCI Fast Ethernet Adapter support" to "M".
+
+ After reconfiguring the kernel, you can make the driver module by
+
+make modules
+
+ The driver should be compiled with no errors. After compiling the
+ driver, the driver can be installed to proper place by
+
+make modules_install
+
+ Load the driver into kernel by
+
+insmod sis900
+
+ When loading the driver into memory, some information message can be
+ view by
+
+dmesg
+
+ or
+cat /var/log/message
+
+ If the driver is loaded properly you will have messages similar to
+ this:
+
+sis900.c: v1.07.06 11/07/2000
+eth0: SiS 900 PCI Fast Ethernet at 0xd000, IRQ 10, 00:00:e8:83:7f:a4.
+eth0: SiS 900 Internal MII PHY transceiver found at address 1.
+eth0: Using SiS 900 Internal MII PHY as default
+
+ showing the version of the driver and the results of probing routine.
+
+ Once the driver is loaded, network can be brought up by
+
+/sbin/ifconfig eth0 IPADDR broadcast BROADCAST netmask NETMASK
+
+ where IPADDR, BROADCAST, NETMASK are your IP address, broadcast
+ address and netmask respectively. For more information on how to
+ configure network interface, please refer to Networking HOWTO.
+
+ The link status is also shown by kernel messages. For example, after
+ the network interface is activated, you may have the message:
+
+eth0: Media Link On 100mbps full-duplex
+
+ If you try to unplug the twist pair (TP) cable you will get
+
+eth0: Media Link Off
+
+ indicating that the link is failed.
+ _________________________________________________________________
+
+Building the driver into kernel
+
+ If you want to make the driver into kernel, choose "Y" rather than "M"
+ on "SiS 900/7016 PCI Fast Ethernet Adapter support" when configuring
+ the kernel. Build the kernel image in the usual way
+
+make dep
+
+make clean
+
+make bzlilo
+
+ Next time the system reboot, you have the driver in memory.
+ _________________________________________________________________
+
+Known Problems and Bugs
+
+ There are some known problems and bugs. If you find any other bugs
+ please mail to lcchang@sis.com.tw
+
+ 1. AM79C901 HomePNA PHY is not thoroughly tested, there may be some
+ bugs in the "on the fly" change of transceiver.
+ 2. A bug is hidden somewhere in the receive buffer management code,
+ the bug causes NULL pointer reference in the kernel. This fault is
+ caught before bad things happen and reported with the message:
+ eth0: NULL pointer encountered in Rx ring, skipping which can be
+ viewed with dmesg or cat /var/log/message.
+ _________________________________________________________________
+
+Revision History
+
+ * November 13, 2000, Revision 1.07, seventh release, 630E problem
+ fixed and furthur clean up.
+ * November 4, 1999, Revision 1.06, Second release, lots of clean up
+ and optimization.
+ * August 8, 1999, Revision 1.05, Initial Public Release
+ _________________________________________________________________
+
+Acknowledgements
+
+ This driver was originally derived form Donald Becker's pci-skeleton
+ and rtl8139 drivers. Donald also provided various suggestion regarded
+ with improvements made in revision 1.06.
+
+ The 1.05 revision was created by Jim Huang, AMD 79c901 support was
+ added by Chin-Shan Li.
S: Maintained
USB SUBSYSTEM
-P: Randy Dunlap
-M: randy.dunlap@intel.com
+P: Johannes Erdfelt
+M: jerdfelt@valinux.com
+M: johannes@erdfelt.com
L: linux-usb-users@lists.sourceforge.net
L: linux-usb-devel@lists.sourceforge.net
W: http://www.linux-usb.org
$(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
scripts/split-include: scripts/split-include.c
- $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
+ $(HOSTCC) $(HOSTCFLAGS) -I$(HPATH) -o scripts/split-include scripts/split-include.c
define_bool CONFIG_ISA y
define_bool CONFIG_EISA y
define_bool CONFIG_SBUS n
+define_bool CONFIG_MCA n
if [ "$CONFIG_ALPHA_JENSEN" = "y" ]
then
define_bool CONFIG_ARM y
define_bool CONFIG_EISA n
define_bool CONFIG_SBUS n
+define_bool CONFIG_MCA n
define_bool CONFIG_UID16 y
CFLAGS += -march=i686
endif
+ifdef CONFIG_MPENTIUM4
+CFLAGS += -march=i686
+endif
+
ifdef CONFIG_MK6
CFLAGS += $(shell if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; else echo "-march=i586"; fi)
endif
Pentium-MMX CONFIG_M586MMX \
Pentium-Pro/Celeron/Pentium-II CONFIG_M686 \
Pentium-III CONFIG_M686FXSR \
+ Pentium-4 CONFIG_MPENTIUM4 \
K6/K6-II/K6-III CONFIG_MK6 \
Athlon/K7 CONFIG_MK7 \
Crusoe CONFIG_MCRUSOE \
define_bool CONFIG_X86_FXSR y
define_bool CONFIG_X86_XMM y
fi
+if [ "$CONFIG_MPENTIUM4" = "y" ]; then
+ define_int CONFIG_X86_L1_CACHE_SHIFT 7
+ define_bool CONFIG_X86_TSC y
+ define_bool CONFIG_X86_GOOD_APIC y
+ define_bool CONFIG_X86_PGE y
+ define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
+ define_bool CONFIG_X86_FXSR y
+ define_bool CONFIG_X86_XMM y
+fi
if [ "$CONFIG_MK6" = "y" ]; then
define_int CONFIG_X86_L1_CACHE_SHIFT 5
define_bool CONFIG_X86_ALIGNMENT_16 y
define_bool CONFIG_X86_LOCAL_APIC y
fi
fi
+
if [ "$CONFIG_SMP" = "y" -a "$CONFIG_X86_CMPXCHG" = "y" ]; then
define_bool CONFIG_HAVE_DEC_LOCK y
fi
if [ "$CONFIG_VISWS" != "y" ]; then
bool 'MCA support' CONFIG_MCA
+else
+ define_bool CONFIG_MCA n
fi
bool 'Support for hot-pluggable devices' CONFIG_HOTPLUG
# CONFIG_M586MMX is not set
# CONFIG_M686 is not set
CONFIG_M686FXSR=y
+# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
# CONFIG_MCRUSOE is not set
#
CONFIG_PCMCIA=y
CONFIG_CARDBUS=y
+# CONFIG_I82365 is not set
+# CONFIG_TCIC is not set
CONFIG_SYSVIPC=y
# CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_SYSCTL=y
}
#endif
}
+ remove_wait_queue(&apm_waitqueue, &wait);
}
static int check_apm_user(struct apm_user *as, const char *func)
return("Pentium(tm) Pro");
case 0x0F:
+ if (model == 0x00)
+ return("Pentium 4(tm)");
if (model == 0x0F)
return("Special controller");
}
Dprintk(" 64 bit compare & exchange supported.\n");
if (m->mpc_featureflag&(1<<9))
Dprintk(" Internal APIC present.\n");
+ if (m->mpc_featureflag&(1<<11))
+ Dprintk(" SEP present.\n");
+ if (m->mpc_featureflag&(1<<12))
+ Dprintk(" MTRR present.\n");
+ if (m->mpc_featureflag&(1<<13))
+ Dprintk(" PGE present.\n");
+ if (m->mpc_featureflag&(1<<14))
+ Dprintk(" MCA present.\n");
+ if (m->mpc_featureflag&(1<<15))
+ Dprintk(" CMOV present.\n");
+ if (m->mpc_featureflag&(1<<16))
+ Dprintk(" PAT present.\n");
+ if (m->mpc_featureflag&(1<<17))
+ Dprintk(" PSE present.\n");
+ if (m->mpc_featureflag&(1<<18))
+ Dprintk(" PSN present.\n");
+ if (m->mpc_featureflag&(1<<19))
+ Dprintk(" Cache Line Flush Instruction present.\n");
+ /* 20 Reserved */
+ if (m->mpc_featureflag&(1<<21))
+ Dprintk(" Debug Trace and EMON Store present.\n");
+ if (m->mpc_featureflag&(1<<22))
+ Dprintk(" ACPI Thermal Throttle Registers present.\n");
+ if (m->mpc_featureflag&(1<<23))
+ Dprintk(" MMX present.\n");
+ if (m->mpc_featureflag&(1<<24))
+ Dprintk(" FXSR present.\n");
+ if (m->mpc_featureflag&(1<<25))
+ Dprintk(" XMM present.\n");
+ if (m->mpc_featureflag&(1<<26))
+ Dprintk(" Willamette New Instructions present.\n");
+ if (m->mpc_featureflag&(1<<27))
+ Dprintk(" Self Snoop present.\n");
+ /* 28 Reserved */
+ if (m->mpc_featureflag&(1<<29))
+ Dprintk(" Thermal Monitor present.\n");
+ /* 30, 31 Reserved */
+
if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) {
Dprintk(" Bootup CPU\n");
#endif
extern void mcheck_init(struct cpuinfo_x86 *c);
char *p = NULL;
+ unsigned int l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */
#ifndef CONFIG_M686
/*
if (c->cpuid_level > 1) {
/* supports eax=2 call */
- int edx = cpuid_edx(2);
+ int i, j, n;
+ int regs[4];
+ unsigned char *dp = (unsigned char *)regs;
- /* We need only the LSB */
- edx &= 0xff;
+ /* Number of times to iterate */
+ n = cpuid_eax(2) & 0xFF;
- switch (edx) {
- case 0x40:
- c->x86_cache_size = 0;
- break;
-
- case 0x41: /* 4-way 128 */
- c->x86_cache_size = 128;
- break;
-
- case 0x42: /* 4-way 256 */
- case 0x82: /* 8-way 256 */
- c->x86_cache_size = 256;
- break;
-
- case 0x43: /* 4-way 512 */
- c->x86_cache_size = 512;
- break;
+ for ( i = 0 ; i < n ; i++ ) {
+ cpuid(2, ®s[0], ®s[1], ®s[2], ®s[3]);
- case 0x44: /* 4-way 1024 */
- case 0x84: /* 8-way 1024 */
- c->x86_cache_size = 1024;
- break;
-
- case 0x45: /* 4-way 2048 */
- case 0x85: /* 8-way 2048 */
- c->x86_cache_size = 2048;
- break;
-
- default:
- c->x86_cache_size = 0;
- break;
+ /* If bit 31 is set, this is an unknown format */
+ for ( j = 0 ; j < 3 ; j++ ) {
+ if ( regs[j] < 0 ) regs[j] = 0;
+ }
+
+ /* Byte 0 is level count, not a descriptor */
+ for ( j = 1 ; j < 16 ; j++ ) {
+ unsigned char des = dp[j];
+ unsigned char dl, dh;
+ unsigned int cs;
+
+ dh = des >> 4;
+ dl = des & 0x0F;
+
+ switch ( dh )
+ {
+ case 2:
+ if ( dl ) {
+ /* L3 cache */
+ cs = (dl-1) << 9;
+ l3 += cs;
+ }
+ break;
+ case 4:
+ case 8:
+ if ( dl ) {
+ /* L2 cache */
+ cs = 128 << (dl-1);
+ l2 += cs;
+ }
+ break;
+ case 6:
+ if (dl > 5) {
+ /* L1 D cache */
+ cs = 8<<(dl-6);
+ l1d += cs;
+ }
+ break;
+ case 7:
+ /* L1 I cache */
+ cs = dl ? (16 << (dl-1)) : 12;
+ l1i += cs;
+ break;
+ default:
+ /* TLB, or something else we don't know about */
+ break;
+ }
+ }
}
+ if ( l1i || l1d )
+ printk("CPU: L1 I cache: %dK, L1 D cache: %dK\n",
+ l1i, l1d);
+ if ( l2 )
+ printk("CPU: L2 cache: %dK\n", l2);
+ if ( l3 )
+ printk("CPU: L3 cache: %dK\n", l3);
+
+ /*
+ * This assumes the L3 cache is shared; it typically lives in
+ * the northbridge. The L1 caches are included by the L2
+ * cache, and so should not be included for the purpose of
+ * SMP switching weights.
+ */
+ c->x86_cache_size = l2 ? l2 : (l1i+l1d);
}
/* SEP CPUID bug: Pentium Pro reports SEP but doesn't have it */
if (c->x86 == 6) {
switch (c->x86_model) {
case 5:
- if (c->x86_cache_size == 0)
+ if (l2 == 0)
p = "Celeron (Covington)";
- if (c->x86_cache_size == 256)
+ if (l2 == 256)
p = "Mobile Pentium II (Dixon)";
break;
case 6:
- if (c->x86_cache_size == 128)
+ if (l2 == 128)
p = "Celeron (Mendocino)";
break;
case 8:
- if (c->x86_cache_size == 128)
+ if (l2 == 128)
p = "Celeron (Coppermine)";
break;
}
/* Intel-defined */
"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
"cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
- "pat", "pse36", "pn", "clflsh", NULL, "dtes", NULL, "mmx",
+ "pat", "pse36", "pn", "clflsh", NULL, "dtes", "acpi", "mmx",
"fxsr", "sse", "sse2", "selfsnoop", NULL, "acc", "ia64", NULL,
/* AMD-defined */
cpu_init();
smp_callin();
while (!atomic_read(&smp_commenced))
- /* nothing */ ;
+ rep_nop();
/*
* low-memory mappings have been cleared, flush them from
* the local TLBs too.
define_bool CONFIG_ISA n
define_bool CONFIG_EISA n
+define_bool CONFIG_MCA n
define_bool CONFIG_SBUS n
choice 'IA-64 system type' \
define_bool CONFIG_ISA n
define_bool CONFIG_EISA n
+define_bool CONFIG_MCA n
define_bool CONFIG_PCMCIA n
bool 'Amiga support' CONFIG_AMIGA
unset CONFIG_VIDEO_G364
unset CONFIG_PC_KEYB
+define_bool CONFIG_MCA n
define_bool CONFIG_SBUS n
if [ "$CONFIG_ALGOR_P4032" = "y" ]; then
define_bool CONFIG_PCI n
fi
+define_bool CONFIG_MCA n
define_bool CONFIG_SBUS n
mainmenu_option next_comment
define_bool CONFIG_EISA n
define_bool CONFIG_SBUS n
+# Yes MCA RS/6000s exist but Linux-PPC does not currently support any
+define_bool CONFIG_MCA n
+
if [ "$CONFIG_APUS" = "y" -o "$CONFIG_4xx" = "y" -o \
"$CONFIG_8260" = "y" ]; then
define_bool CONFIG_PCI n
define_bool CONFIG_ISA n
define_bool CONFIG_EISA n
+define_bool CONFIG_MCA n
define_bool CONFIG_UID16 y
mainmenu_name "Linux Kernel Configuration"
define_bool CONFIG_ISA n
define_bool CONFIG_EISA n
+define_bool CONFIG_MCA n
define_bool CONFIG_SBUS n
bool 'Networking support' CONFIG_NET
# Global things across all Sun machines.
define_bool CONFIG_ISA n
define_bool CONFIG_EISA n
+define_bool CONFIG_MCA n
define_bool CONFIG_PCMCIA n
define_bool CONFIG_SBUS y
define_bool CONFIG_SBUSCHAR y
define_bool CONFIG_HAVE_DEC_LOCK y
define_bool CONFIG_ISA n
define_bool CONFIG_EISA n
+define_bool CONFIG_MCA n
define_bool CONFIG_PCMCIA n
define_bool CONFIG_SBUS y
define_bool CONFIG_SBUSCHAR y
set_current_state(TASK_UNINTERRUPTIBLE);
schedule();
}
+ current->state = TASK_RUNNING;
remove_wait_queue(&vcc->sleep,&wait);
return error;
}
#define SMART2_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin))
-#define DRIVER_NAME "Compaq SMART2 Driver (v 2.4.0)"
-#define DRIVER_VERSION SMART2_DRIVER_VERSION(2,4,0)
+#define DRIVER_NAME "Compaq SMART2 Driver (v 2.4.1)"
+#define DRIVER_VERSION SMART2_DRIVER_VERSION(2,4,1)
/* Embedded module documentation macros - see modules.h */
/* Original author Chris Frantz - Compaq Computer Corporation */
int ret_code, size;
drv_info_t *drv;
ctlr_info_t *info_p = hba[ctlr];
+ int i;
info_p->log_drv_map = 0;
}
info_p->log_drives = id_ctlr_buf->nr_drvs;;
- *(__u32*)(info_p->firm_rev) = *(__u32*)(id_ctlr_buf->firm_rev);
+ for(i=0;i<4;i++)
+ info_p->firm_rev[i] = id_ctlr_buf->firm_rev[i];
info_p->ctlr_sig = id_ctlr_buf->cfg_sig;
printk(" (%s)\n", info_p->product_name);
*/
static inline void __generic_unplug_device(request_queue_t *q)
{
- if (q->plugged) {
+ if (!list_empty(&q->queue_head)) {
q->plugged = 0;
- if (!list_empty(&q->queue_head))
- q->request_fn(q);
+ q->request_fn(q);
}
}
tristate '/dev/agpgart (AGP Support)' CONFIG_AGP $CONFIG_DRM_AGP
if [ "$CONFIG_AGP" != "n" ]; then
- bool ' Intel 440LX/BX/GX 840 support' CONFIG_AGP_INTEL
- bool ' Intel I810/I815 support' CONFIG_AGP_I810
+ bool ' Intel 440LX/BX/GX and I815/I840 support' CONFIG_AGP_INTEL
+ bool ' Intel I810/I815 (on-board) support' CONFIG_AGP_I810
bool ' VIA chipset support' CONFIG_AGP_VIA
bool ' AMD Irongate support' CONFIG_AGP_AMD
bool ' Generic SiS support' CONFIG_AGP_SIS
"Intel",
"440GX",
intel_generic_setup },
+ /* could we add support for PCI_DEVICE_ID_INTEL_815_1 too ? */
+ { PCI_DEVICE_ID_INTEL_815_0,
+ PCI_VENDOR_ID_INTEL,
+ INTEL_I815,
+ "Intel",
+ "i815",
+ intel_generic_setup },
{ PCI_DEVICE_ID_INTEL_840_0,
PCI_VENDOR_ID_INTEL,
INTEL_I840,
firm_id = (struct FIRM_ID *)
(base_addr + ID_ADDRESS);
if (!ISZLOADED(*cinfo)){
+ current->state = TASK_RUNNING;
+ remove_wait_queue(&info->open_wait, &wait);
return -EINVAL;
}
#define __NO_VERSION__
#include "drmP.h"
#include <linux/module.h>
+#if LINUX_VERSION_CODE < 0x020400
+#include "agpsupport-pre24.h"
+#else
+#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp")
+#define DRM_AGP_PUT inter_module_put("drm_agp")
+#endif
-const drm_agp_t *drm_agp_p;
+static const drm_agp_t *drm_agp = NULL;
int drm_agp_info(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
agp_kern_info *kern;
drm_agp_info_t info;
- if (!dev->agp->acquired || !(drm_agp_p->copy_info)) return -EINVAL;
+ if (!dev->agp->acquired || !drm_agp->copy_info) return -EINVAL;
kern = &dev->agp->agp_info;
info.agp_version_major = kern->version.major;
drm_device_t *dev = priv->dev;
int retcode;
- if (dev->agp->acquired || !(drm_agp_p->acquire)) return -EINVAL;
- if ((retcode = (*(drm_agp_p->acquire))())) return retcode;
+ if (dev->agp->acquired || !drm_agp->acquire) return -EINVAL;
+ if ((retcode = drm_agp->acquire())) return retcode;
dev->agp->acquired = 1;
return 0;
}
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- if (!dev->agp->acquired || !(drm_agp_p->release)) return -EINVAL;
- (*(drm_agp_p->release))();
+ if (!dev->agp->acquired || !drm_agp->release) return -EINVAL;
+ drm_agp->release();
dev->agp->acquired = 0;
return 0;
}
+void _drm_agp_release(void)
+{
+ if (drm_agp->release) drm_agp->release();
+}
+
int drm_agp_enable(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
drm_device_t *dev = priv->dev;
drm_agp_mode_t mode;
- if (!dev->agp->acquired || !(drm_agp_p->enable)) return -EINVAL;
+ if (!dev->agp->acquired || !drm_agp->enable) return -EINVAL;
if (copy_from_user(&mode, (drm_agp_mode_t *)arg, sizeof(mode)))
return -EFAULT;
dev->agp->mode = mode.mode;
- (*(drm_agp_p->enable))(mode.mode);
+ drm_agp->enable(mode.mode);
dev->agp->base = dev->agp->agp_info.aper_base;
dev->agp->enabled = 1;
return 0;
int retcode;
int page;
- if (!dev->agp->acquired || !(drm_agp_p->bind_memory)) return -EINVAL;
+ if (!dev->agp->acquired || !drm_agp->bind_memory) return -EINVAL;
if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request)))
return -EFAULT;
if (!(entry = drm_agp_lookup_entry(dev, request.handle)))
{
drm_agp_head_t *head = NULL;
- drm_agp_p = (drm_agp_t *)inter_module_get("drm_agp");
- DRM_DEBUG("drm_agp_p = %p\n", drm_agp_p);
-
- if (drm_agp_p) {
+ drm_agp = DRM_AGP_GET;
+ if (drm_agp) {
if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
return NULL;
memset((void *)head, 0, sizeof(*head));
- (*(drm_agp_p->copy_info))(&head->agp_info);
+ drm_agp->copy_info(&head->agp_info);
if (head->agp_info.chipset == NOT_SUPPORTED) {
drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
return NULL;
void drm_agp_uninit(void)
{
- inter_module_put("drm_agp");
+ DRM_AGP_PUT;
+ drm_agp = NULL;
+}
+
+agp_memory *drm_agp_allocate_memory(size_t pages, u32 type)
+{
+ if (!drm_agp->allocate_memory) return NULL;
+ return drm_agp->allocate_memory(pages, type);
+}
+
+int drm_agp_free_memory(agp_memory *handle)
+{
+ if (!handle || !drm_agp->free_memory) return 0;
+ drm_agp->free_memory(handle);
+ return 1;
+}
+
+int drm_agp_bind_memory(agp_memory *handle, off_t start)
+{
+ if (!handle || !drm_agp->bind_memory) return -EINVAL;
+ return drm_agp->bind_memory(handle, start);
+}
+
+int drm_agp_unbind_memory(agp_memory *handle)
+{
+ if (!handle || !drm_agp->unbind_memory) return -EINVAL;
+ return drm_agp->unbind_memory(handle);
}
schedule();
if (signal_pending(current)) {
atomic_dec(&q->use_count);
+ remove_wait_queue(&q->write_queue, &entry);
return -EINTR;
}
}
unsigned long base;
int agp_mtrr;
} drm_agp_head_t;
-
#endif
typedef struct drm_sigdata {
extern void drm_agp_uninit(void);
extern int drm_agp_acquire(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+extern void _drm_agp_release(void);
extern int drm_agp_release(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_agp_enable(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_agp_bind(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+extern agp_memory *drm_agp_allocate_memory(size_t pages, u32 type);
+extern int drm_agp_free_memory(agp_memory *handle);
+extern int drm_agp_bind_memory(agp_memory *handle, off_t start);
+extern int drm_agp_unbind_memory(agp_memory *handle);
#endif
#endif
#endif
}
dev->agp->memory = NULL;
- if (dev->agp->acquired && drm_agp_p->release)
- (*(drm_agp_p->release))();
+ if (dev->agp->acquired) _drm_agp_release();
dev->agp->acquired = 0;
dev->agp->enabled = 0;
return NULL;
}
- if (drm_agp_p->allocate_memory) {
- if ((handle = (*(drm_agp_p->allocate_memory))(pages,
- type))) {
- spin_lock(&drm_mem_lock);
- ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count;
- drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated
- += pages << PAGE_SHIFT;
- spin_unlock(&drm_mem_lock);
- return handle;
- }
+ if ((handle = drm_agp_allocate_memory(pages, type))) {
+ spin_lock(&drm_mem_lock);
+ ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count;
+ drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated
+ += pages << PAGE_SHIFT;
+ spin_unlock(&drm_mem_lock);
+ return handle;
}
spin_lock(&drm_mem_lock);
++drm_mem_stats[DRM_MEM_TOTALAGP].fail_count;
return retval;;
}
- if (drm_agp_p->free_memory) {
- (*(drm_agp_p->free_memory))(handle);
+ if (drm_agp_free_memory(handle)) {
spin_lock(&drm_mem_lock);
free_count = ++drm_mem_stats[DRM_MEM_TOTALAGP].free_count;
alloc_count = drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count;
{
int retcode = -EINVAL;
- DRM_DEBUG("drm_bind_agp called\n");
if (!handle) {
DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
"Attempt to bind NULL AGP handle\n");
return retcode;
}
- DRM_DEBUG("drm_agp_p->bind_memory : %p\n", drm_agp_p->bind_memory);
- if (drm_agp_p->bind_memory) {
- if (!(retcode = (*(drm_agp_p->bind_memory))(handle, start))) {
- spin_lock(&drm_mem_lock);
- ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
- drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated
- += handle->page_count << PAGE_SHIFT;
- spin_unlock(&drm_mem_lock);
- DRM_DEBUG("drm_agp_p->bind_memory: retcode %d\n", retcode);
- return retcode;
- }
+ if (!(retcode = drm_agp_bind_memory(handle, start))) {
+ spin_lock(&drm_mem_lock);
+ ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
+ drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated
+ += handle->page_count << PAGE_SHIFT;
+ spin_unlock(&drm_mem_lock);
+ return retcode;
}
spin_lock(&drm_mem_lock);
++drm_mem_stats[DRM_MEM_BOUNDAGP].fail_count;
return retcode;
}
- if (drm_agp_p->unbind_memory) {
- int c = handle->page_count;
- if ((retcode = (*(drm_agp_p->unbind_memory))(handle)))
- return retcode;
- spin_lock(&drm_mem_lock);
- free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count;
- alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
- drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed += c << PAGE_SHIFT;
- spin_unlock(&drm_mem_lock);
- if (free_count > alloc_count) {
- DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
- "Excess frees: %d frees, %d allocs\n",
- free_count, alloc_count);
- }
+ if ((retcode = drm_agp_unbind_memory(handle))) return retcode;
+ spin_lock(&drm_mem_lock);
+ free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count;
+ alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
+ drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed
+ += handle->page_count << PAGE_SHIFT;
+ spin_unlock(&drm_mem_lock);
+ if (free_count > alloc_count) {
+ DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
+ "Excess frees: %d frees, %d allocs\n",
+ free_count, alloc_count);
}
return retcode;
}
}
dev->agp->memory = NULL;
- if (dev->agp->acquired && drm_agp_p->release)
- (*(drm_agp_p->release))();
+ if (dev->agp->acquired) _drm_agp_release();
dev->agp->acquired = 0;
dev->agp->enabled = 0;
PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000);
PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000);
PRIMOUTREG(MGAREG_DMAPAD, 0);
}
} drm_r128_init_t;
typedef struct drm_r128_packet {
- unsigned long *buffer;
- int count;
- int flags;
+ unsigned int *buffer;
+ int count;
+ int flags;
} drm_r128_packet_t;
typedef enum drm_r128_prim {
}
dev->agp->memory = NULL;
- if (dev->agp->acquired && drm_agp_p->release)
- (*(drm_agp_p->release))();
+ if (dev->agp->acquired) _drm_agp_release();
dev->agp->acquired = 0;
dev->agp->enabled = 0;
drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS);
temp = temp_next;
}
- if (dev->agp->acquired) (*(drm_agp_p->release))();
+ if (dev->agp->acquired) _drm_agp_release();
}
#endif
/* Clear vma list (only built for debugging) */
EXPORT_SYMBOL(gs_setserial);
EXPORT_SYMBOL(gs_getserial);
-EXPORT_SYMBOL(gs_debug);
};
static struct ns558 *ns558;
-static int have_pci_devices;
/*
* ns558_isa_probe() tries to find an isa gameport at the
* it is the least-invasive probe.
*/
- i = pci_module_init(&ns558_pci_driver);
- if (i == 0)
- have_pci_devices = 1;
+ i = pci_register_driver(&ns558_pci_driver);
+ if (i < 0) return i;
/*
* Probe for ISA ports.
}
#endif
- return ns558 ? 0 : -ENODEV;
+ return 0;
}
void __exit ns558_exit(void)
port = port->next;
}
- if (have_pci_devices)
- pci_unregister_driver(&ns558_pci_driver);
+ pci_unregister_driver(&ns558_pci_driver);
}
module_init(ns558_init);
#define rio_init init_module
#endif
-extern int gs_debug;
-
int rio_init(void)
{
int found = 0;
func_enter();
rio_dprintk (RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n",
rio_debug);
- gs_debug = rio_debug >> 24;
if (abs ((long) (&rio_debug) - rio_debug) < 0x10000) {
printk (KERN_WARNING "rio: rio_debug is an address, instead of a value. "
sx_initialized++;
break;
case SXIO_SETDEBUG:
+ case SXIO_SETGSDEBUG:
sx_debug = arg;
break;
case SXIO_GETDEBUG:
- rc = sx_debug;
- break;
- case SXIO_SETGSDEBUG:
- gs_debug = arg;
- break;
case SXIO_GETGSDEBUG:
- rc = gs_debug;
+ rc = sx_debug;
break;
case SXIO_GETNPORTS:
rc = sx_nports;
return(0);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
- for ( ;; )
- {
-
#if CONFIG_PCI
+ for ( ;; )
+ {
if (!pci_present()) {
printk(KERN_ERR "Netjet: no PCI bus present\n");
return(0);
return(0);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
- for ( ;; )
- {
-
#if CONFIG_PCI
+ for ( ;; )
+ {
if (!pci_present()) {
printk(KERN_ERR "NETspider-U: no PCI bus present\n");
return(0);
spin_unlock_bh(chip->mutex);
schedule();
+ remove_wait_queue(&chip->wq, &wait);
+
goto retry;
}
}
add_wait_queue(&chip->wq, &wait);
spin_unlock_bh(chip->mutex);
+
schedule();
+ remove_wait_queue(&chip->wq, &wait);
+
goto retry;
}
}
if [ "$CONFIG_ISA" = "y" -o "$CONFIG_EISA" = "y" -o "$CONFIG_PCI" = "y" ]; then
tristate ' HP 10/100VG PCLAN (ISA, EISA, PCI) support' CONFIG_HP100
fi
- bool ' Other ISA cards' CONFIG_NET_ISA
+ dep_bool ' Other ISA cards' CONFIG_NET_ISA $CONFIG_ISA
if [ "$CONFIG_NET_ISA" = "y" ]; then
tristate ' Cabletron E21xx support' CONFIG_E2100
if [ "$CONFIG_OBSOLETE" = "y" ]; then
#endif
-/* Pad device name to IFNAMSIZ=16. F.e. __PAD6 is string of 9 zeros. */
-#define __PAD6 "\0\0\0\0\0\0\0\0\0"
-#define __PAD5 __PAD6 "\0"
-#define __PAD4 __PAD5 "\0"
-#define __PAD3 __PAD4 "\0"
-#define __PAD2 __PAD3 "\0"
-
-
#ifdef CONFIG_NET_FC
static int fcif_probe(struct net_device *dev)
{
#ifdef CONFIG_ETHERTAP
- static struct net_device tap0_dev = { "tap0" __PAD4, 0, 0, 0, 0, NETLINK_TAPBASE, 0, 0, 0, 0, NEXT_DEV, ethertap_probe, };
+ static struct net_device tap0_dev = { "tap0", 0, 0, 0, 0, NETLINK_TAPBASE, 0, 0, 0, 0, NEXT_DEV, ethertap_probe, };
# undef NEXT_DEV
# define NEXT_DEV (&tap0_dev)
#endif
#ifdef CONFIG_SDLA
extern int sdla_init(struct net_device *);
- static struct net_device sdla0_dev = { "sdla0" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, sdla_init, };
+ static struct net_device sdla0_dev = { "sdla0", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, sdla_init, };
# undef NEXT_DEV
# define NEXT_DEV (&sdla0_dev)
#if defined(CONFIG_LTPC)
extern int ltpc_probe(struct net_device *);
static struct net_device dev_ltpc = {
- "lt0" __PAD3,
+ "lt0",
0, 0, 0, 0,
0x0, 0,
0, 0, 0, NEXT_DEV, ltpc_probe };
#if defined(CONFIG_COPS)
extern int cops_probe(struct net_device *);
- static struct net_device cops2_dev = { "lt2" __PAD3, 0, 0, 0, 0, 0x0, 0, 0, 0, 0, NEXT_DEV, cops_probe };
- static struct net_device cops1_dev = { "lt1" __PAD3, 0, 0, 0, 0, 0x0, 0, 0, 0, 0, &cops2_dev, cops_probe };
- static struct net_device cops0_dev = { "lt0" __PAD3, 0, 0, 0, 0, 0x0, 0, 0, 0, 0, &cops1_dev, cops_probe };
+ static struct net_device cops2_dev = { "lt2", 0, 0, 0, 0, 0x0, 0, 0, 0, 0, NEXT_DEV, cops_probe };
+ static struct net_device cops1_dev = { "lt1", 0, 0, 0, 0, 0x0, 0, 0, 0, 0, &cops2_dev, cops_probe };
+ static struct net_device cops0_dev = { "lt0", 0, 0, 0, 0, 0x0, 0, 0, 0, 0, &cops1_dev, cops_probe };
# undef NEXT_DEV
# define NEXT_DEV (&cops0_dev)
#endif /* COPS */
#define ETH_NOPROBE_ADDR 0xffe0
static struct net_device eth7_dev = {
- "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, NEXT_DEV, ethif_probe };
+ "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, NEXT_DEV, ethif_probe };
static struct net_device eth6_dev = {
- "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð7_dev, ethif_probe };
+ "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð7_dev, ethif_probe };
static struct net_device eth5_dev = {
- "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð6_dev, ethif_probe };
+ "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð6_dev, ethif_probe };
static struct net_device eth4_dev = {
- "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð5_dev, ethif_probe };
+ "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð5_dev, ethif_probe };
static struct net_device eth3_dev = {
- "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð4_dev, ethif_probe };
+ "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð4_dev, ethif_probe };
static struct net_device eth2_dev = {
- "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð3_dev, ethif_probe };
+ "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð3_dev, ethif_probe };
static struct net_device eth1_dev = {
- "eth%d" __PAD5, 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð2_dev, ethif_probe };
+ "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, ð2_dev, ethif_probe };
static struct net_device eth0_dev = {
- "eth%d" __PAD5, 0, 0, 0, 0, ETH0_ADDR, ETH0_IRQ, 0, 0, 0, ð1_dev, ethif_probe };
+ "eth%d", 0, 0, 0, 0, ETH0_ADDR, ETH0_IRQ, 0, 0, 0, ð1_dev, ethif_probe };
# undef NEXT_DEV
# define NEXT_DEV (ð0_dev)
return 0;
}
static struct net_device tr7_dev = {
- "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, NEXT_DEV, trif_probe };
+ "tr%d",0,0,0,0,0,0,0,0,0, NEXT_DEV, trif_probe };
static struct net_device tr6_dev = {
- "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr7_dev, trif_probe };
+ "tr%d",0,0,0,0,0,0,0,0,0, &tr7_dev, trif_probe };
static struct net_device tr5_dev = {
- "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr6_dev, trif_probe };
+ "tr%d",0,0,0,0,0,0,0,0,0, &tr6_dev, trif_probe };
static struct net_device tr4_dev = {
- "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr5_dev, trif_probe };
+ "tr%d",0,0,0,0,0,0,0,0,0, &tr5_dev, trif_probe };
static struct net_device tr3_dev = {
- "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr4_dev, trif_probe };
+ "tr%d",0,0,0,0,0,0,0,0,0, &tr4_dev, trif_probe };
static struct net_device tr2_dev = {
- "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr3_dev, trif_probe };
+ "tr%d",0,0,0,0,0,0,0,0,0, &tr3_dev, trif_probe };
static struct net_device tr1_dev = {
- "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr2_dev, trif_probe };
+ "tr%d",0,0,0,0,0,0,0,0,0, &tr2_dev, trif_probe };
static struct net_device tr0_dev = {
- "tr%d" __PAD3,0,0,0,0,0,0,0,0,0, &tr1_dev, trif_probe };
+ "tr%d",0,0,0,0,0,0,0,0,0, &tr1_dev, trif_probe };
# undef NEXT_DEV
# define NEXT_DEV (&tr0_dev)
#ifdef CONFIG_FDDI
static struct net_device fddi7_dev =
- {"fddi7" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, fddiif_probe};
+ {"fddi7", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, fddiif_probe};
static struct net_device fddi6_dev =
- {"fddi6" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi7_dev, fddiif_probe};
+ {"fddi6", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi7_dev, fddiif_probe};
static struct net_device fddi5_dev =
- {"fddi5" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi6_dev, fddiif_probe};
+ {"fddi5", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi6_dev, fddiif_probe};
static struct net_device fddi4_dev =
- {"fddi4" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi5_dev, fddiif_probe};
+ {"fddi4", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi5_dev, fddiif_probe};
static struct net_device fddi3_dev =
- {"fddi3" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi4_dev, fddiif_probe};
+ {"fddi3", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi4_dev, fddiif_probe};
static struct net_device fddi2_dev =
- {"fddi2" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi3_dev, fddiif_probe};
+ {"fddi2", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi3_dev, fddiif_probe};
static struct net_device fddi1_dev =
- {"fddi1" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi2_dev, fddiif_probe};
+ {"fddi1", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi2_dev, fddiif_probe};
static struct net_device fddi0_dev =
- {"fddi0" __PAD5, 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi1_dev, fddiif_probe};
+ {"fddi0", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi1_dev, fddiif_probe};
#undef NEXT_DEV
#define NEXT_DEV (&fddi0_dev)
#endif
volatile struct lance_regs *ll = lp->ll;
int ret;
- MOD_INC_USE_COUNT;
-
last_dev = dev;
/* Install the Interrupt handler */
ret = request_irq(IRQ_AMIGA_PORTS, lance_interrupt, SA_SHIRQ,
dev->name, dev);
- if (ret) {
- MOD_DEC_USE_COUNT;
- return ret;
- }
+ if (ret) return ret;
/* Stop the Lance */
ll->rap = LE_CSR0;
ll->rdp = LE_C0_STOP;
free_irq(IRQ_AMIGA_PORTS, dev);
-
- MOD_DEC_USE_COUNT;
-
return 0;
}
release_resource(r2);
return -ENOMEM;
}
- priv = (struct lance_private *)dev->priv;
+ SET_MODULE_OWNER(dev);
+ priv = dev->priv;
r1->name = dev->name;
r2->name = dev->name;
MODULE_PARM(max_mtu,"i");
MODULE_PARM(large_buff_mem,"i");
MODULE_PARM(small_buff_no,"i");
-MODULE_PARM(SSID,"1-4c31");
+MODULE_PARM(SSID,"c33");
#endif
/*EXPORT_SYMBOL(tx_queue_len);
struct dev_priv *priv = (struct dev_priv *)dev->priv;
int ret;
- MOD_INC_USE_COUNT;
-
memset (&priv->stats, 0, sizeof (priv->stats));
ret = request_irq(dev->irq, am79c961_interrupt, 0, dev->name, dev);
- if (ret) {
- MOD_DEC_USE_COUNT;
+ if (ret)
return ret;
- }
am79c961_init_for_open(dev);
free_irq (dev->irq, dev);
- MOD_DEC_USE_COUNT;
return 0;
}
if (!dev)
goto out;
- priv = (struct dev_priv *) dev->priv;
+ SET_MODULE_OWNER(dev);
+ priv = dev->priv;
/*
* Fixed address and IRQ lines here.
if (apne_owned)
return -ENODEV;
-
+
+ SET_MODULE_OWNER(dev);
+
if ( !(AMIGAHW_PRESENT(PCMCIA)) )
return (-ENODEV);
apne_open(struct net_device *dev)
{
ei_open(dev);
- MOD_INC_USE_COUNT;
return 0;
}
if (ei_debug > 1)
printk("%s: Shutting down ethercard.\n", dev->name);
ei_close(dev);
- MOD_DEC_USE_COUNT;
return 0;
}
}
#ifdef MODULE
-static struct net_device apne_dev = { init: apne_probe };
+static struct net_device apne_dev;
int init_module(void)
{
int err;
+ apne_dev.init = apne_probe;
if ((err = register_netdev(&apne_dev))) {
if (err == -EIO)
printk("No PCMCIA NEx000 ethernet card found.\n");
unsigned long board, ioaddr;
int err;
+ SET_MODULE_OWNER(dev);
+
while ((z = zorro_find_device(ZORRO_PROD_VILLAGE_TRONIC_ARIADNE2, z))) {
board = z->resource.start;
ioaddr = board+ARIADNE2_BASE*2;
static int ariadne2_open(struct net_device *dev)
{
ei_open(dev);
- MOD_INC_USE_COUNT;
return 0;
}
if (ei_debug > 1)
printk("%s: Shutting down ethercard.\n", dev->name);
ei_close(dev);
- MOD_DEC_USE_COUNT;
return 0;
}
}
#ifdef MODULE
-static struct net_device ariadne2_dev = { init: ariadne2_probe };
+static struct net_device ariadne2_dev;
int init_module(void)
{
int err;
+ ariadne2_dev.init = ariadne2_probe;
if ((err = register_netdev(&ariadne2_dev))) {
- if (err == -EIO)
- printk("No AriadNE2 ethernet card found.\n");
+ printk(KERN_WARNING "No AriadNE2 ethernet card found.\n");
return err;
}
return 0;
int probed = 0;
int found = 0;
+ SET_MODULE_OWNER(dev);
+
ARLAN_DEBUG_ENTRY("arlan_probe_everywhere");
if (mem != 0 && numDevices == 1) /* Check a single specified location. */
{
udelay(200000);
add_timer(&priv->timer);
- MOD_INC_USE_COUNT;
#ifdef CONFIG_PROC_FS
#ifndef MODULE
if (arlan_device[0])
priv->open_time = 0;
netif_stop_queue(dev);
free_irq(dev->irq, dev);
- MOD_DEC_USE_COUNT;
ARLAN_DEBUG_EXIT("arlan_close");
return 0;
(detachable devices only).
*/
-int at1700_probe(struct net_device *dev)
+int __init at1700_probe(struct net_device *dev)
{
int i;
- int base_addr = dev ? dev->base_addr : 0;
+ int base_addr = dev->base_addr;
+
+ SET_MODULE_OWNER(dev);
if (base_addr > 0x1ff) /* Check a single specified location. */
return at1700_probe1(dev, base_addr);
}
netif_start_queue(dev);
-
- MOD_INC_USE_COUNT;
-
return 0;
}
/* Power-down the chip. Green, green, green! */
outb(0x00, ioaddr + CONFIG_1);
-
- MOD_DEC_USE_COUNT;
-
return 0;
}
return -ENODEV;
}
+ SET_MODULE_OWNER(dev);
- if (dev == NULL)
- return -ENODEV;
if (bionet_debug > 0 && version_printed++ == 0)
printk(version);
bionet_timer.data = (long)dev;
bionet_timer.expires = jiffies + lp->poll_time;
add_timer(&bionet_timer);
- MOD_INC_USE_COUNT;
return 0;
}
dev->start = 0;
stdma_release();
- MOD_DEC_USE_COUNT;
return 0;
}
#ifdef MODULE
-static char bio_name[16];
-static struct net_device bio_dev =
- {
- bio_name, /* filled in by register_netdev() */
- 0, 0, 0, 0, /* memory */
- 0, 0, /* base, irq */
- 0, 0, 0, NULL, bionet_probe,
- };
+static struct net_device bio_dev;
int
init_module(void) {
int err;
+ bio_dev.init = bionet_probe;
if ((err = register_netdev(&bio_dev))) {
if (err == -EEXIST) {
printk("BIONET: devices already present. Module not loaded.\n");
/* Check for a network adaptor of this type, and return '0' if one exists.
*/
-extern int __init
+int __init
pamsnet_probe (dev)
struct net_device *dev;
{
if (no_more_found)
return -ENODEV;
+ SET_MODULE_OWNER(dev);
+
no_more_found = 1;
printk("Probing for PAM's Net/GK Adapter...\n");
pamsnet_timer.data = (long)dev;
pamsnet_timer.expires = jiffies + lp->poll_time;
add_timer(&pamsnet_timer);
- MOD_INC_USE_COUNT;
return 0;
}
ENABLE_IRQ();
stdma_release();
- MOD_DEC_USE_COUNT;
return 0;
}
#ifdef MODULE
-static char devicename[9] = { 0, };
-static struct net_device pam_dev =
- {
- devicename, /* filled in by register_netdev() */
- 0, 0, 0, 0, /* memory */
- 0, 0, /* base, irq */
- 0, 0, 0, NULL, pamsnet_probe,
- };
+static struct net_device pam_dev;
int
init_module(void) {
int err;
+ pam_dev.init = pamsnet_probe;
if ((err = register_netdev(&pam_dev))) {
if (err == -EEXIST) {
printk("PAM's Net/GK: devices already present. Module not loaded.\n");
\f
-void *slow_memcpy( void *dst, const void *src, size_t len )
+static void *slow_memcpy( void *dst, const void *src, size_t len )
{ char *cto = dst;
const char *cfrom = src;
int i;
static int found = 0;
+ SET_MODULE_OWNER(dev);
+
if (!MACH_IS_ATARI || found)
/* Assume there's only one board possible... That seems true, since
* the Riebl/PAM board's address cannot be changed. */
dev->start = 1;
DPRINTK( 2, ( "%s: LANCE is open, csr0 %04x\n", dev->name, DREG ));
- MOD_INC_USE_COUNT;
return( 0 );
}
memory if we don't. */
DREG = CSR0_STOP;
- MOD_DEC_USE_COUNT;
return 0;
}
\f
#ifdef MODULE
-static char devicename[9] = { 0, };
-
-static struct net_device atarilance_dev =
-{
- devicename, /* filled in by register_netdev() */
- 0, 0, 0, 0, /* memory */
- 0, 0, /* base, irq */
- 0, 0, 0, NULL, atarilance_probe,
-};
+static struct net_device atarilance_dev;
int init_module(void)
{ int err;
+ atarilance_dev.init = atarilance_probe;
if ((err = register_netdev( &atarilance_dev ))) {
if (err == -EIO) {
printk( "No Atari Lance board found. Module not loaded.\n");
dev = init_etherdev(dev, sizeof(struct net_local));
if (!dev)
return -ENOMEM;
+ SET_MODULE_OWNER(dev);
/* Find the IRQ used by triggering an interrupt. */
write_reg_byte(ioaddr, CMR2, 0x01); /* No accept mode, IRQ out. */
struct net_local *lp = (struct net_local *)dev->priv;
int ret;
- MOD_INC_USE_COUNT;
-
/* The interrupt line is turned off (tri-stated) when the device isn't in
use. That's especially important for "attached" interfaces where the
port or interrupt may be shared. */
ret = request_irq(dev->irq, &atp_interrupt, 0, dev->name, dev);
- if (ret) {
- MOD_DEC_USE_COUNT;
+ if (ret)
return ret;
- }
hardware_init(dev);
free_irq(dev->irq, dev);
/* Reset the ethernet hardware and activate the printer pass-through. */
- write_reg_high(ioaddr, CMR1, CMR1h_RESET | CMR1h_MUX);
-
- MOD_DEC_USE_COUNT;
-
+ write_reg_high(ioaddr, CMR1, CMR1h_RESET | CMR1h_MUX);
return 0;
}
static int addr_accessible( volatile void *regp, int wordflag, int
writeflag );
-static unsigned long lance_probe1( struct net_device *dev, struct lance_addr
- *init_rec );
+static int lance_probe1( struct net_device *dev, struct lance_addr *init_rec );
static int lance_open( struct net_device *dev );
static void lance_init_ring( struct net_device *dev );
static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev );
{ int i;
static int found = 0;
+ SET_MODULE_OWNER(dev);
+
if (found)
/* Assume there's only one board possible... That seems true, since
* the Riebl/PAM board's address cannot be changed. */
#define IRQ_TYPE_PRIO SA_INTERRUPT
#define IRQ_SOURCE_TO_VECTOR(x) (x)
-static unsigned long __init lance_probe1( struct net_device *dev,
- struct lance_addr *init_rec )
+static int __init lance_probe1( struct net_device *dev,
+ struct lance_addr *init_rec )
{ volatile unsigned short *memaddr =
(volatile unsigned short *)init_rec->memaddr;
dev->start = 1;
DPRINTK( 2, ( "%s: LANCE is open, csr0 %04x\n", dev->name, DREG ));
- MOD_INC_USE_COUNT;
-
return( 0 );
}
memory if we don't. */
DREG = CSR0_STOP;
- MOD_DEC_USE_COUNT;
return 0;
}
#ifdef MODULE
-static char devicename[9] = { 0, };
-
-static struct net_device bagetlance_dev =
-{
- devicename, /* filled in by register_netdev() */
- 0, 0, 0, 0, /* memory */
- 0, 0, /* base, irq */
- 0, 0, 0, NULL, bagetlance_probe,
-};
+static struct net_device bagetlance_dev;
int init_module(void)
{ int err;
+ bagetlance_dev.init = bagetlance_probe;
if ((err = register_netdev( &bagetlance_dev ))) {
if (err == -EIO) {
printk( "No Vme Lance board found. Module not loaded.\n");
bmac->full_name);
return;
}
+ SET_MODULE_OWNER(dev);
dev->base_addr = (unsigned long)
ioremap(bmac->addrs[0].address, bmac->addrs[0].size);
return -ENOMEM;
dev->flags |= IFF_RUNNING;
-
- MOD_INC_USE_COUNT;
return 0;
}
bp->reset_and_enabled = 0;
XXDEBUG(("bmac: all bufs freed\n"));
- MOD_DEC_USE_COUNT;
-
return 0;
}
static int
de600_open(struct net_device *dev)
{
- if (request_irq(DE600_IRQ, de600_interrupt, 0, "de600", dev)) {
+ int ret = request_irq(DE600_IRQ, de600_interrupt, 0, dev->name, dev);
+ if (ret) {
printk ("%s: unable to get IRQ %d\n", dev->name, DE600_IRQ);
- return 1;
+ return ret;
}
- MOD_INC_USE_COUNT;
- if (adapter_init(dev)) {
- return 1;
- }
+ if (adapter_init(dev))
+ return -EIO;
return 0;
}
if (netif_running(dev)) { /* perhaps not needed? */
free_irq(DE600_IRQ, dev);
- MOD_DEC_USE_COUNT;
}
return 0;
}
static struct net_device_stats de600_netstats;
/*dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);*/
+ SET_MODULE_OWNER(dev);
+
printk("%s: D-Link DE-600 pocket adapter", dev->name);
/* Alpha testers must have the version number to report bugs. */
if (de600_debug > 1)
#endif
\f
#ifdef MODULE
-static struct net_device de600_dev = {
- "", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, de600_probe };
+static struct net_device de600_dev;
int
init_module(void)
{
+ de600_dev.init = de600_probe;
if (register_netdev(&de600_dev) != 0)
return -EIO;
return 0;
*/
static int de620_open(struct net_device *dev)
{
- if (request_irq(dev->irq, de620_interrupt, 0, "de620", dev)) {
+ int ret = request_irq(dev->irq, de620_interrupt, 0, dev->name, dev);
+ if (ret) {
printk (KERN_ERR "%s: unable to get IRQ %d\n", dev->name, dev->irq);
- return 1;
+ return ret;
}
if (adapter_init(dev))
- return 1;
+ return -EIO;
- MOD_INC_USE_COUNT;
netif_start_queue(dev);
return 0;
}
/* disable recv */
de620_set_register(dev, W_TCR, RXOFF);
free_irq(dev->irq, dev);
- MOD_DEC_USE_COUNT;
return 0;
}
int i;
byte checkbyte = 0xa5;
+ SET_MODULE_OWNER(dev);
+
/*
* This is where the base_addr and irq gets set.
* Tunable at compile-time and insmod-time
*
*/
#ifdef MODULE
-static struct net_device de620_dev = {
- "", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, de620_probe };
+static struct net_device de620_dev;
int init_module(void)
{
+ de620_dev.init = de620_probe;
if (register_netdev(&de620_dev) != 0)
return -EIO;
return 0;
#ifdef __i386__
#define GETTICK(x) \
({ \
- if (current_cpu_data.x86_capability & X86_FEATURE_TSC) \
+ if (cpu_has_tsc) \
__asm__ __volatile__("rdtsc" : "=a" (x) : : "dx");\
})
#else /* __i386__ */
#ifdef __i386__
-#define HAS_RDTSC (current_cpu_data.x86_capability & X86_FEATURE_TSC)
-
/*
* only do 32bit cycle counter arithmetic; we hope we won't overflow.
* in fact, overflowing modems would require over 2THz CPU clock speeds :-)
#define time_exec(var,cmd) \
({ \
- if (HAS_RDTSC) { \
+ if (cpu_has_tsc) { \
unsigned int cnt1, cnt2, cnt3; \
__asm__(".byte 0x0f,0x31" : "=a" (cnt1), "=d" (cnt3)); \
cmd; \
int dma;
struct net_device_stats stats;
unsigned char chip_version; /* See lance_chip_type. */
- char tx_full;
spinlock_t devlock;
};
enum {OLD_LANCE = 0, PCNET_ISA=1, PCNET_ISAP=2, PCNET_PCI=3, PCNET_VLB=4, PCNET_PCI_II=5, LANCE_UNKNOWN=6};
-/* Non-zero only if the current card is a PCI with BIOS-set IRQ. */
-static unsigned int pci_irq_line = 0;
/* Non-zero if lance_probe1() needs to allocate low-memory bounce buffers.
Assume yes until we know the memory size. */
if (high_memory <= phys_to_virt(16*1024*1024))
lance_need_isa_bounce_buffers = 0;
-#if defined(CONFIG_PCI)
- {
- struct pci_dev *pdev = NULL;
- if (lance_debug > 1)
- printk("lance.c: PCI bios is present, checking for devices...\n");
-
- while ((pdev = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE, pdev))) {
- unsigned int pci_ioaddr;
-
- if (pci_enable_device(pdev))
- continue;
- pci_set_master(pdev);
- pci_irq_line = pdev->irq;
- pci_ioaddr = pci_resource_start (pdev, 0);
- printk("Found PCnet/PCI at %#x, irq %d.\n",
- pci_ioaddr, pci_irq_line);
- result = lance_probe1(dev, pci_ioaddr, pci_irq_line, 0);
- pci_irq_line = 0;
- if (!result) return 0;
- }
- }
-#endif /* defined(CONFIG_PCI) */
-
for (port = lance_portlist; *port; port++) {
int ioaddr = *port;
static int
lance_open(struct net_device *dev)
{
- struct lance_private *lp = (struct lance_private *)dev->priv;
+ struct lance_private *lp = dev->priv;
int ioaddr = dev->base_addr;
int i;
static void
lance_purge_ring(struct net_device *dev)
{
- struct lance_private *lp = (struct lance_private *)dev->priv;
+ struct lance_private *lp = dev->priv;
int i;
/* Free all the skbuffs in the Rx and Tx queues. */
lp->rx_skbuff[i] = 0;
lp->rx_ring[i].base = 0; /* Not owned by LANCE chip. */
if (skb)
- dev_kfree_skb(skb);
+ dev_kfree_skb_any(skb);
}
for (i = 0; i < TX_RING_SIZE; i++) {
if (lp->tx_skbuff[i]) {
- dev_kfree_skb(lp->tx_skbuff[i]);
+ dev_kfree_skb_any(lp->tx_skbuff[i]);
lp->tx_skbuff[i] = NULL;
}
}
static void
lance_init_ring(struct net_device *dev, int gfp)
{
- struct lance_private *lp = (struct lance_private *)dev->priv;
+ struct lance_private *lp = dev->priv;
int i;
- lp->tx_full = 0;
lp->cur_rx = lp->cur_tx = 0;
lp->dirty_rx = lp->dirty_tx = 0;
static void
lance_restart(struct net_device *dev, unsigned int csr0_bits, int must_reinit)
{
- struct lance_private *lp = (struct lance_private *)dev->priv;
+ struct lance_private *lp = dev->priv;
if (must_reinit ||
(chip_table[lp->chip_version].flags & LANCE_MUST_REINIT_RING)) {
if (lance_debug > 3) {
int i;
printk (" Ring data dump: dirty_tx %d cur_tx %d%s cur_rx %d.",
- lp->dirty_tx, lp->cur_tx, lp->tx_full ? " (full)" : "",
+ lp->dirty_tx, lp->cur_tx, netif_queue_stopped(dev) ? " (full)" : "",
lp->cur_rx);
for (i = 0; i < RX_RING_SIZE; i++)
printk ("%s %08x %04x %04x", i & 0x3 ? "" : "\n ",
static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
- struct lance_private *lp = (struct lance_private *)dev->priv;
+ struct lance_private *lp = dev->priv;
int ioaddr = dev->base_addr;
int entry;
unsigned long flags;
+
+ spin_lock_irqsave(&lp->devlock, flags);
+
if (lance_debug > 3) {
outw(0x0000, ioaddr+LANCE_ADDR);
printk("%s: lance_start_xmit() called, csr0 %4.4x.\n", dev->name,
outw(0x0000, ioaddr+LANCE_DATA);
}
- netif_stop_queue (dev);
-
/* Fill in a Tx ring entry */
/* Mask to ring buffer boundary. */
dev->trans_start = jiffies;
- spin_lock_irqsave (&lp->devlock, flags);
- if (lp->tx_ring[(entry+1) & TX_RING_MOD_MASK].base == 0)
- netif_start_queue (dev);
- else
- lp->tx_full = 1;
- spin_unlock_irqrestore (&lp->devlock, flags);
+ if ((lp->cur_tx - lp->dirty_tx) >= TX_RING_SIZE)
+ netif_stop_queue(dev);
+ spin_unlock_irqrestore(&lp->devlock, flags);
return 0;
}
}
ioaddr = dev->base_addr;
- lp = (struct lance_private *)dev->priv;
+ lp = dev->priv;
spin_lock (&lp->devlock);
#ifndef final_version
if (lp->cur_tx - dirty_tx >= TX_RING_SIZE) {
- printk("out-of-sync dirty pointer, %d vs. %d, full=%d.\n",
- dirty_tx, lp->cur_tx, lp->tx_full);
+ printk("out-of-sync dirty pointer, %d vs. %d, full=%s.\n",
+ dirty_tx, lp->cur_tx,
+ netif_queue_stopped(dev) ? "yes" : "no");
dirty_tx += TX_RING_SIZE;
}
#endif
- if (lp->tx_full &&
- (netif_queue_stopped(dev)) &&
- dirty_tx > lp->cur_tx - TX_RING_SIZE + 2) {
- /* The ring is no longer full, clear tbusy. */
- lp->tx_full = 0;
+ /* if the ring is no longer full, accept more packets */
+ if (netif_queue_stopped(dev) &&
+ dirty_tx > lp->cur_tx - TX_RING_SIZE + 2)
netif_wake_queue (dev);
- }
lp->dirty_tx = dirty_tx;
}
static int
lance_rx(struct net_device *dev)
{
- struct lance_private *lp = (struct lance_private *)dev->priv;
+ struct lance_private *lp = dev->priv;
int entry = lp->cur_rx & RX_RING_MOD_MASK;
int i;
lance_close(struct net_device *dev)
{
int ioaddr = dev->base_addr;
- struct lance_private *lp = (struct lance_private *)dev->priv;
+ struct lance_private *lp = dev->priv;
netif_stop_queue (dev);
static struct net_device_stats *lance_get_stats(struct net_device *dev)
{
- struct lance_private *lp = (struct lance_private *)dev->priv;
- short ioaddr = dev->base_addr;
- short saved_addr;
- unsigned long flags;
+ struct lance_private *lp = dev->priv;
if (chip_table[lp->chip_version].flags & LANCE_HAS_MISSED_FRAME) {
- save_flags(flags);
- cli();
+ short ioaddr = dev->base_addr;
+ short saved_addr;
+ unsigned long flags;
+
+ spin_lock_irqsave(&lp->devlock, flags);
saved_addr = inw(ioaddr+LANCE_ADDR);
outw(112, ioaddr+LANCE_ADDR);
lp->stats.rx_missed_errors = inw(ioaddr+LANCE_DATA);
outw(saved_addr, ioaddr+LANCE_ADDR);
- restore_flags(flags);
+ spin_unlock_irqrestore(&lp->devlock, flags);
}
return &lp->stats;
unsigned int i;
int error = -EOPNOTSUPP;
- rrpriv = (struct rr_private *)dev->priv;
+ rrpriv = dev->priv;
switch(cmd){
case SIOCRRGFW:
- if (!capable(CAP_SYS_RAWIO))
+ if (!capable(CAP_SYS_RAWIO)){
return -EPERM;
+ }
image = kmalloc(EEPROM_WORDS * sizeof(u32), GFP_KERNEL);
if (!image){
return error;
case SIOCRRPFW:
- if (!capable(CAP_SYS_RAWIO))
+ if (!capable(CAP_SYS_RAWIO)){
return -EPERM;
+ }
image = kmalloc(EEPROM_WORDS * sizeof(u32), GFP_KERNEL);
if (!image){
cleanup_filename_hardware:
remove_proc_entry(FILENAME_HARDWARE, new_dir);
cleanup_new_dir:
- remove_proc_entry(dentry->d_name.name, &comx_root_dir);
+ remove_proc_entry(dentry->d_name.name, comx_root_dir);
cleanup_dev:
kfree(dev);
return ret;
#include <linux/ioport.h>
#include <linux/spinlock.h>
#include <linux/pm.h>
+#include <linux/slab.h>
+#include <linux/kmod.h> /* for hotplug_path */
#include <asm/page.h>
#include <asm/dma.h> /* isa_dma_bridge_buggy */
#ifdef CONFIG_HOTPLUG
+#ifndef FALSE
+#define FALSE (0)
+#define TRUE (!FALSE)
+#endif
+
+static void
+run_sbin_hotplug(struct pci_dev *pdev, int insert)
+{
+ int i;
+ char *argv[3], *envp[7];
+ char id[20], sub_id[24], bus_id[64], class_id[20];
+
+ if (!hotplug_path[0])
+ return;
+
+ sprintf(class_id, "PCI_CLASS=%X", pdev->class >> 8);
+ sprintf(id, "PCI_ID=%X/%X", pdev->vendor, pdev->device);
+ sprintf(sub_id, "PCI_SUBSYS_ID=%X/%X", pdev->subsystem_vendor, pdev->subsystem_device);
+ sprintf(bus_id, "PCI_BUS_ID=%s", pdev->slot_name);
+
+ i = 0;
+ argv[i++] = hotplug_path;
+ argv[i++] = "pci";
+ argv[i] = 0;
+
+ i = 0;
+ /* minimal command environment */
+ envp[i++] = "HOME=/";
+ envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
+
+ /* other stuff we want to pass to /sbin/hotplug */
+ envp[i++] = id;
+ envp[i++] = sub_id;
+ envp[i++] = bus_id;
+ if (insert)
+ envp[i++] = "ACTION=add";
+ else
+ envp[i++] = "ACTION=remove";
+ envp[i] = 0;
+
+ call_usermodehelper (argv [0], argv, envp);
+}
+
void
pci_insert_device(struct pci_dev *dev, struct pci_bus *bus)
{
if (drv->remove && pci_announce_device(drv, dev))
break;
}
+
+ /* notify userspace of new hotplug device */
+ run_sbin_hotplug(dev, TRUE);
}
-static void pci_free_resources(struct pci_dev *dev)
+static void
+pci_free_resources(struct pci_dev *dev)
{
int i;
#ifdef CONFIG_PROC_FS
pci_proc_detach_device(dev);
#endif
+
+ /* notify userspace of hotplug device removal */
+ run_sbin_hotplug(dev, FALSE);
}
#endif
mainmenu_option next_comment
comment 'PCMCIA/CardBus support'
-dep_tristate 'CardBus support' CONFIG_PCMCIA $CONFIG_PCI
-if [ "$CONFIG_PCMCIA" != "n" ]; then
- define_bool CONFIG_CARDBUS y
-fi
-
-#tristate 'PCMCIA/CardBus support' CONFIG_PCMCIA
+#dep_tristate 'CardBus support' CONFIG_PCMCIA $CONFIG_PCI
#if [ "$CONFIG_PCMCIA" != "n" ]; then
-# if [ "$CONFIG_PCI" != "n" ]; then
-# bool ' CardBus support' CONFIG_CARDBUS
-# fi
-# bool ' i82365 compatible bridge support' CONFIG_I82365
-# bool ' Databook TCIC host bridge support' CONFIG_TCIC
+# define_bool CONFIG_CARDBUS y
#fi
+tristate 'PCMCIA/CardBus support' CONFIG_PCMCIA
+if [ "$CONFIG_PCMCIA" != "n" ]; then
+ if [ "$CONFIG_PCI" != "n" ]; then
+ bool ' CardBus support' CONFIG_CARDBUS
+ fi
+ bool ' i82365 compatible bridge support' CONFIG_I82365
+ bool ' Databook TCIC host bridge support' CONFIG_TCIC
+fi
+
endmenu
/*====================================================================*/
+static u_int pending_events[8];
+static spinlock_t pending_event_lock = SPIN_LOCK_UNLOCKED;
+
+static void pcic_bh(void *dummy)
+{
+ u_int events;
+ int i;
+
+ for (i=0; i < sockets; i++) {
+ spin_lock_irq(&pending_event_lock);
+ events = pending_events[i];
+ pending_events[i] = 0;
+ spin_unlock_irq(&pending_event_lock);
+ if (socket[i].handler)
+ socket[i].handler(socket[i].info, events);
+ }
+}
+
+static struct tq_struct pcic_task = {
+ routine: pcic_bh
+};
+
static void pcic_interrupt(int irq, void *dev,
struct pt_regs *regs)
{
}
ISA_UNLOCK(i, flags);
DEBUG(2, "i82365: socket %d event 0x%02x\n", i, events);
- if (events)
- socket[i].handler(socket[i].info, events);
+
+ if (events) {
+ spin_lock(&pending_event_lock);
+ pending_events[i] |= events;
+ spin_unlock(&pending_event_lock);
+ schedule_task(&pcic_task);
+ }
active |= events;
}
if (!active) break;
socket->dev = dev;
socket->op = ops;
dev->driver_data = socket;
- init_waitqueue_head(&socket->wait);
+ spin_lock_init(&socket->event_lock);
return socket->op->open(socket);
}
void *info;
struct pci_socket_ops *op;
socket_cap_t cap;
- wait_queue_head_t wait;
+ spinlock_t event_lock;
unsigned int events;
struct socket_info_t *pcmcia_socket;
+ struct tq_struct tq_task;
+ struct timer_list poll_timer;
/* A few words of private data for the low-level driver.. */
unsigned int private[8];
/*====================================================================*/
+static u_int pending_events[2];
+static spinlock_t pending_event_lock = SPIN_LOCK_UNLOCKED;
+
+static void tcic_bh(void *dummy)
+{
+ u_int events;
+ int i;
+
+ for (i=0; i < sockets; i++) {
+ spin_lock_irq(&pending_event_lock);
+ events = pending_events[i];
+ pending_events[i] = 0;
+ spin_unlock_irq(&pending_event_lock);
+ if (socket_table[i].handler)
+ socket_table[i].handler(socket_table[i].info, events);
+ }
+}
+
+static struct tq_struct tcic_task = {
+ routine: tcic_bh
+};
+
static void tcic_interrupt(int irq, void *dev, struct pt_regs *regs)
{
int i, quick = 0;
events |= (latch & TCIC_SSTAT_LBAT1) ? SS_BATDEAD : 0;
events |= (latch & TCIC_SSTAT_LBAT2) ? SS_BATWARN : 0;
}
- if (events)
- socket_table[i].handler(socket_table[i].info, events);
+ if (events) {
+ spin_lock(&pending_event_lock);
+ pending_events[i] |= events;
+ spin_unlock(&pending_event_lock);
+ schedule_task(&tcic_task);
+ }
}
/* Schedule next poll, if needed */
#include <linux/delay.h>
#include <linux/module.h>
+#include <pcmcia/version.h>
+#include <pcmcia/cs_types.h>
#include <pcmcia/ss.h>
+#include <pcmcia/cs.h>
#include <asm/io.h>
return events;
}
+
+static void yenta_bh(void *data)
+{
+ pci_socket_t *socket = data;
+ unsigned int events;
+
+ spin_lock_irq(&socket->event_lock);
+ events = socket->events;
+ socket->events = 0;
+ spin_unlock_irq(&socket->event_lock);
+ if (socket->handler)
+ socket->handler(socket->info, events);
+}
+
static void yenta_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
unsigned int events;
events = yenta_events(socket);
if (events) {
+ spin_lock(&socket->event_lock);
socket->events |= events;
- wake_up_interruptible(&socket->wait);
+ spin_unlock(&socket->event_lock);
+ schedule_task(&socket->tq_task);
}
}
+static void yenta_interrupt_wrapper(unsigned long data)
+{
+ pci_socket_t *socket = (pci_socket_t *) data;
+
+ yenta_interrupt(0, (void *)socket, NULL);
+ socket->poll_timer.expires = jiffies + HZ;
+ add_timer(&socket->poll_timer);
+}
+
/*
* Only probe "regular" interrupts, don't
* touch dangerous spots like the mouse irq,
extern void cardbus_register(pci_socket_t *socket);
/*
- * Watch a socket every second (and possibly in a
- * more timely manner if the state change interrupt
- * works..)
+ * 'Bottom half' for the yenta_open routine. Allocate the interrupt line
+ * and register the socket with the upper layers.
*/
-static int yenta_socket_thread(void * data)
+static void yenta_open_bh(void * data)
{
pci_socket_t * socket = (pci_socket_t *) data;
- DECLARE_WAITQUEUE(wait, current);
- MOD_INC_USE_COUNT;
- daemonize();
- strcpy(current->comm, "CardBus Watcher");
+ /* It's OK to overwrite this now */
+ socket->tq_task.routine = yenta_bh;
- if (socket->cb_irq && request_irq(socket->cb_irq, yenta_interrupt, SA_SHIRQ, socket->dev->name, socket)) {
- printk ("Yenta: unable to register irq %d\n", socket->cb_irq);
- MOD_DEC_USE_COUNT;
- return (1);
+ if (!socket->cb_irq || request_irq(socket->cb_irq, yenta_interrupt, SA_SHIRQ, socket->dev->name, socket)) {
+ /* No IRQ or request_irq failed. Poll */
+ socket->cb_irq = 0; /* But zero is a valid IRQ number. */
+ socket->poll_timer.function = yenta_interrupt_wrapper;
+ socket->poll_timer.data = (unsigned long)socket;
+ socket->poll_timer.expires = jiffies + HZ;
+ add_timer(&socket->poll_timer);
}
/* Figure out what the dang thing can do for the PCMCIA layer... */
/* Register it with the pcmcia layer.. */
cardbus_register(socket);
- do {
- unsigned int events = socket->events | yenta_events(socket);
-
- if (events) {
- socket->events = 0;
- if (socket->handler)
- socket->handler(socket->info, events);
- }
-
- current->state = TASK_INTERRUPTIBLE;
- add_wait_queue(&socket->wait, &wait);
- if (!socket->events)
- schedule_timeout(HZ);
- remove_wait_queue(&socket->wait, &wait);
- } while (!signal_pending(current));
MOD_DEC_USE_COUNT;
- return 0;
}
static void yenta_clear_maps(pci_socket_t *socket)
{
if (sock->cb_irq)
free_irq(sock->cb_irq, sock);
+ else
+ del_timer_sync(&sock->poll_timer);
+
if (sock->base)
iounmap(sock->base);
}
}
}
- kernel_thread(yenta_socket_thread, socket, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ /* Get the PCMCIA kernel thread to complete the
+ initialisation later. We can't do this here,
+ because, er, because Linus says so :)
+ */
+ socket->tq_task.routine = yenta_open_bh;
+ socket->tq_task.data = socket;
+
+ MOD_INC_USE_COUNT;
+ schedule_task(&socket->tq_task);
+
return 0;
}
s390irq_spin_unlock_irqrestore(raw->irq, flags);
schedule();
s390irq_spin_lock_irqsave(raw->irq, flags);
+ remove_wait_queue(&raw->empty_wait, &wait);
current->state = TASK_RUNNING;
raw->flags &= ~(RAW3215_ACTIVE | RAW3215_CLOSING);
}
-/* $Id: sab82532.c,v 1.52 2000/10/14 10:09:04 davem Exp $
+/* $Id: sab82532.c,v 1.53 2000/11/15 07:28:09 davem Exp $
* sab82532.c: ASYNC Driver for the SIEMENS SAB82532 DUSCC.
*
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
#endif
schedule();
}
+ current->state = TASK_RUNNING;
remove_wait_queue(&info->open_wait, &wait);
if (!tty_hung_up_p(filp))
info->count++;
static inline void __init show_serial_version(void)
{
- char *revision = "$Revision: 1.52 $";
+ char *revision = "$Revision: 1.53 $";
char *version, *p;
version = strchr(revision, ' ');
-/* $Id: su.c,v 1.42 2000/10/14 10:09:04 davem Exp $
+/* $Id: su.c,v 1.43 2000/11/15 07:28:09 davem Exp $
* su.c: Small serial driver for keyboard/mouse interface on sparc32/PCI
*
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
#endif
schedule();
}
+ current->state = TASK_RUNNING;
remove_wait_queue(&info->open_wait, &wait);
if (extra_count)
info->count++;
*/
static __inline__ void __init show_su_version(void)
{
- char *revision = "$Revision: 1.42 $";
+ char *revision = "$Revision: 1.43 $";
char *version, *p;
version = strchr(revision, ' ');
ha = HADATA(gdth_ctr_tab[hanum]);
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
- if(sdev)
- scp = scsi_allocate_device(sdev, 1, FALSE);
-
- if(sdev!= NULL && scp != NULL)
- {
+ if (!sdev)
+ return;
+
+ scp = scsi_allocate_device(sdev, 1, FALSE);
+
+ if (scp) {
scp->cmd_len = 12;
scp->use_sg = 0;
gdth_do_cmd(scp, &gdtcmd, 30);
}
}
- }
- if(scp!=NULL)
scsi_release_command(scp);
- if(sdev!=NULL)
- scsi_free_host_dev(sdev);
+ }
+ scsi_free_host_dev(sdev);
}
/* shutdown routine */
+/*
+ * Changes:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 08/23/2000
+ * - get rid of some verify_areas and use __copy*user and __get/put_user
+ * for the ones that remain
+ */
#define __NO_VERSION__
#include <linux/module.h>
static int ioctl_probe(struct Scsi_Host *host, void *buffer)
{
- int temp, result;
unsigned int len, slen;
const char *string;
+ int temp = host->hostt->present;
- if ((temp = host->hostt->present) && buffer) {
- result = verify_area(VERIFY_READ, buffer, sizeof(long));
- if (result)
- return result;
+ if (temp && buffer) {
+ if (get_user(len, (unsigned int *) buffer))
+ return -EFAULT;
- get_user(len, (unsigned int *) buffer);
if (host->hostt->info)
string = host->hostt->info(host);
else
slen = strlen(string);
if (len > slen)
len = slen + 1;
- result = verify_area(VERIFY_WRITE, buffer, len);
- if (result)
- return result;
-
- copy_to_user(buffer, string, len);
+ if (copy_to_user(buffer, string, len))
+ return -EFAULT;
}
}
return temp;
/*
* Verify that we can read at least this much.
*/
- result = verify_area(VERIFY_READ, sic, sizeof(Scsi_Ioctl_Command));
- if (result)
- return result;
+ if (verify_area(VERIFY_READ, sic, sizeof(Scsi_Ioctl_Command)))
+ return -EFAULT;
- get_user(inlen, &sic->inlen);
- get_user(outlen, &sic->outlen);
+ __get_user(inlen, &sic->inlen);
+ __get_user(outlen, &sic->outlen);
/*
* We do not transfer more than MAX_BUF with this interface.
return -EINVAL;
cmd_in = sic->data;
- get_user(opcode, cmd_in);
+ __get_user(opcode, cmd_in);
needed = buf_needed = (inlen > outlen ? inlen : outlen);
if (buf_needed) {
*/
cmdlen = COMMAND_SIZE(opcode);
- result = verify_area(VERIFY_READ, cmd_in, cmdlen + inlen);
- if (result)
- return result;
+ if (verify_area(VERIFY_READ, cmd_in, cmdlen + inlen))
+ return -EFAULT;
- copy_from_user(cmd, cmd_in, cmdlen);
+ __copy_from_user(cmd, cmd_in, cmdlen);
/*
* Obtain the data to be sent to the device (if any).
*/
- copy_from_user(buf, cmd_in + cmdlen, inlen);
+ __copy_from_user(buf, cmd_in + cmdlen, inlen);
/*
* Set the lun field to the correct value.
int sb_len = sizeof(SRpnt->sr_sense_buffer);
sb_len = (sb_len > OMAX_SB_LEN) ? OMAX_SB_LEN : sb_len;
- result = verify_area(VERIFY_WRITE, cmd_in, sb_len);
- if (result)
- return result;
- copy_to_user(cmd_in, SRpnt->sr_sense_buffer, sb_len);
- } else {
- result = verify_area(VERIFY_WRITE, cmd_in, outlen);
- if (result)
- return result;
- copy_to_user(cmd_in, buf, outlen);
- }
- result = SRpnt->sr_result;
+ if (copy_to_user(cmd_in, SRpnt->sr_sense_buffer, sb_len))
+ return -EFAULT;
+ } else
+ if (copy_to_user(cmd_in, buf, outlen))
+ return -EFAULT;
+ result = SRpnt->sr_result;
SDpnt = SRpnt->sr_device;
scsi_release_request(SRpnt);
*/
int scsi_ioctl(Scsi_Device * dev, int cmd, void *arg)
{
- int result;
char scsi_cmd[MAX_COMMAND_SIZE];
/* No idea how this happens.... */
}
switch (cmd) {
case SCSI_IOCTL_GET_IDLUN:
- result = verify_area(VERIFY_WRITE, arg, sizeof(Scsi_Idlun));
- if (result)
- return result;
+ if (verify_area(VERIFY_WRITE, arg, sizeof(Scsi_Idlun)))
+ return -EFAULT;
- put_user(dev->id
+ __put_user(dev->id
+ (dev->lun << 8)
+ (dev->channel << 16)
+ ((dev->host->host_no & 0xff) << 24),
&((Scsi_Idlun *) arg)->dev_id);
- put_user(dev->host->unique_id, &((Scsi_Idlun *) arg)->host_unique_id);
+ __put_user(dev->host->unique_id, &((Scsi_Idlun *) arg)->host_unique_id);
return 0;
case SCSI_IOCTL_GET_BUS_NUMBER:
- result = verify_area(VERIFY_WRITE, (void *) arg, sizeof(int));
- if (result)
- return result;
- put_user(dev->host->host_no, (int *) arg);
- return 0;
+ return put_user(dev->host->host_no, (int *) arg);
case SCSI_IOCTL_TAGGED_ENABLE:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
}
if (((cmd >> 8) & 0xff) == 'M') {
- if (cmd & IOC_IN)
+ if (cmd & SIOC_IN)
/* read and write */
switch (cmd & 0xff) {
case SOUND_MIXER_VOLUME:
if (((cmd >> 8) & 0xff) == 'M') {
/* set ioctl */
- if (_IOC_DIR (cmd) & _IOC_WRITE) {
+ if (_SIOC_DIR (cmd) & _SIOC_WRITE) {
switch (cmd & 0xff){
case SOUND_MIXER_RECSRC:
level = ((level & 0xff) + (level >> 8)) / 2;
DEBUG(0,printk("AWEMix: cmd=%x val=%d\n", cmd & 0xff, level));
- if (_SIOC_DIR(cmd) & _IOC_WRITE) {
+ if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
switch (cmd & 0xff) {
case SOUND_MIXER_BASS:
value = level * 12 / 100;
}
if (cmd == OSS_GETVERSION)
return put_user(SOUND_VERSION, (int *)arg);
- if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+ if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
return -EINVAL;
- if (_IOC_DIR(cmd) == _IOC_READ) {
+ if (_SIOC_DIR(cmd) == _SIOC_READ) {
switch (_IOC_NR(cmd)) {
case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
return put_user(mixer_recmask(s), (int *)arg);
#endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */
}
}
- if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE))
+ if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE))
return -EINVAL;
s->mix.modcnt++;
switch (_IOC_NR(cmd)) {
if (s->dma_dac.mapped || !s->dma_dac.ready)
return 0;
- current->state = TASK_INTERRUPTIBLE;
add_wait_queue(&s->dma_dac.wait, &wait);
for (;;) {
+ set_current_state(TASK_INTERRUPTIBLE);
spin_lock_irqsave(&s->lock, flags);
count = s->dma_dac.count;
spin_unlock_irqrestore(&s->lock, flags);
ret = 0;
add_wait_queue(&s->midi.iwait, &wait);
while (count > 0) {
+ set_current_state(TASK_INTERRUPTIBLE);
spin_lock_irqsave(&s->lock, flags);
ptr = s->midi.ird;
cnt = MIDIINBUF - ptr;
ret = -EAGAIN;
break;
}
- __set_current_state(TASK_INTERRUPTIBLE);
schedule();
if (signal_pending(current))
{
ret = 0;
add_wait_queue(&s->midi.owait, &wait);
while (count > 0) {
+ set_current_state(TASK_INTERRUPTIBLE);
spin_lock_irqsave(&s->lock, flags);
ptr = s->midi.owr;
cnt = MIDIOUTBUF - ptr;
ret = -EAGAIN;
break;
}
- __set_current_state(TASK_INTERRUPTIBLE);
schedule();
if (signal_pending(current)) {
if (!ret)
lock_kernel();
if (file->f_mode & FMODE_WRITE) {
- __set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&s->midi.owait, &wait);
for (;;) {
+ set_current_state(TASK_INTERRUPTIBLE);
spin_lock_irqsave(&s->lock, flags);
count = s->midi.ocnt;
spin_unlock_irqrestore(&s->lock, flags);
if (cmd == OSS_GETVERSION)
return put_user(SOUND_VERSION, (int *) arg);
- if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+ if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
return -EINVAL;
- // If ioctl has only the IOC_READ bit(bit 31)
+ // If ioctl has only the SIOC_READ bit(bit 31)
// on, process the only-read commands.
- if (_IOC_DIR(cmd) == _IOC_READ) {
+ if (_SIOC_DIR(cmd) == _SIOC_READ) {
switch (_IOC_NR(cmd)) {
case SOUND_MIXER_RECSRC: // Arg contains a bit for each recording source
cs4281_read_ac97(s, BA0_AC97_RECORD_SELECT,
return put_user(s->mix.vol[vidx - 1], (int *) arg);
}
}
- // If ioctl doesn't have both the IOC_READ and
- // the IOC_WRITE bit set, return invalid.
- if (_IOC_DIR(cmd) != (_IOC_READ | _IOC_WRITE))
+ // If ioctl doesn't have both the SIOC_READ and
+ // the SIOC_WRITE bit set, return invalid.
+ if (_SIOC_DIR(cmd) != (_SIOC_READ | _SIOC_WRITE))
return -EINVAL;
// Increment the count of volume writes.
if (s->dma_adc.mapped)
return 0;
- current->state = TASK_INTERRUPTIBLE;
add_wait_queue(&s->dma_adc.wait, &wait);
for (;;) {
+ set_current_state(TASK_INTERRUPTIBLE);
spin_lock_irqsave(&s->lock, flags);
count = s->dma_adc.count;
CS_DBGOUT(CS_FUNCTION, 2,
if (s->dma_dac.mapped)
return 0;
- current->state = TASK_INTERRUPTIBLE;
add_wait_queue(&s->dma_dac.wait, &wait);
for (;;) {
+ set_current_state(TASK_INTERRUPTIBLE);
spin_lock_irqsave(&s->lock, flags);
count = s->dma_dac.count;
spin_unlock_irqrestore(&s->lock, flags);
VALIDATE_STATE(s);
if (file->f_mode & FMODE_WRITE) {
- current->state = TASK_INTERRUPTIBLE;
add_wait_queue(&s->midi.owait, &wait);
for (;;) {
+ set_current_state(TASK_INTERRUPTIBLE);
spin_lock_irqsave(&s->lock, flags);
count = s->midi.ocnt;
spin_unlock_irqrestore(&s->lock, flags);
}
if (cmd == OSS_GETVERSION)
return put_user(SOUND_VERSION, (int *)arg);
- if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+ if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
return -EINVAL;
- if (_IOC_DIR(cmd) == _IOC_READ) {
+ if (_SIOC_DIR(cmd) == _SIOC_READ) {
switch (_IOC_NR(cmd)) {
case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
return put_user(s->mix.recsrc, (int *)arg);
return put_user(s->mix.vol[mixtable[i].volidx], (int *)arg);
}
}
- if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE))
+ if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE))
return -EINVAL;
s->mix.modcnt++;
switch (_IOC_NR(cmd)) {
}
if (cmd == OSS_GETVERSION)
return put_user(SOUND_VERSION, (int *)arg);
- if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+ if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
return -EINVAL;
- if (_IOC_DIR(cmd) == _IOC_READ) {
+ if (_SIOC_DIR(cmd) == _SIOC_READ) {
switch (_IOC_NR(cmd)) {
case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
return put_user(mixer_src[read_mixer(s, 0x1c) & 7], (int *)arg);
return put_user(s->mix.vol[vidx-1], (int *)arg);
}
}
- if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE))
+ if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE))
return -EINVAL;
s->mix.modcnt++;
switch (_IOC_NR(cmd)) {
return put_user(0, (int *)arg);
return put_user(((4 - (l & 7)) << 2) | ((4 - (r & 7)) << 5) | 2, (int *)arg);
}
- if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+ if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
return -EINVAL;
- if (_IOC_DIR(cmd) == _IOC_READ) {
+ if (_SIOC_DIR(cmd) == _SIOC_READ) {
switch (_IOC_NR(cmd)) {
case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
return put_user(mixer_recmask(s), (int *)arg);
#endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */
}
}
- if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE))
+ if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE))
return -EINVAL;
s->mix.modcnt++;
switch (_IOC_NR(cmd)) {
aport->swstate = SW_INITIAL;
add_wait_queue(&aport->queue, &wait);
- current->state = TASK_UNINTERRUPTIBLE;
while (1) {
+ set_current_state(TASK_UNINTERRUPTIBLE);
spin_lock_irqsave(&aport->lock, flags);
{
hwstate = aport->hwstate;
DBGEV("(devc=0x%p)\n", devc);
add_wait_queue(&wport->queue, &wait);
- current->state = TASK_UNINTERRUPTIBLE;
while (1) {
+ set_current_state(TASK_UNINTERRUPTIBLE);
spin_lock_irqsave(&wport->lock, flags);
{
hwstate = wport->hwstate;
while (count) {
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&rport->queue, &wait);
- current->state = TASK_INTERRUPTIBLE;
while ((nb = swb_inc_u(rport, 0)) == 0) {
DBGPV("blocking\n");
+ set_current_state(TASK_INTERRUPTIBLE);
if (rport->flags & DISABLED ||
file->f_flags & O_NONBLOCK) {
current->state = TASK_RUNNING;
while (count) {
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&wport->queue, &wait);
- current->state = TASK_INTERRUPTIBLE;
while ((nb = swb_inc_u(wport, 0)) == 0) {
+ set_current_state(TASK_INTERRUPTIBLE);
if (wport->flags & DISABLED ||
file->f_flags & O_NONBLOCK) {
current->state = TASK_RUNNING;
while (!j->read_buffer_ready || (j->dtmf_state && j->flags.dtmf_oob)) {
++j->read_wait;
if(j->tone_state) {
+ set_current_state(TASK_RUNNING);
+ remove_wait_queue(&j->read_q, &wait);
j->flags.inread = 0;
return -EAGAIN;
}
while (!j->write_buffers_empty) {
++j->write_wait;
if(j->tone_state) {
+ set_current_state(TASK_RUNNING);
+ remove_wait_queue(&j->write_q, &wait);
j->flags.inwrite = 0;
return -EAGAIN;
}
dbg ("waited for %d urb completions", temp);
}
dev->wait = 0;
+ current->state = TASK_RUNNING;
remove_wait_queue (&unlink_wakeup, &wait);
mutex_unlock (&dev->mutex);
while (port->write_urb->status == -EINPROGRESS) {
dbg(__FUNCTION__ " write in progress - retrying");
if (0 /* file->f_flags & O_NONBLOCK */) {
+ remove_wait_queue(&port->write_wait, &wait);
+ set_current_state(TASK_RUNNING);
rc = -EAGAIN;
goto err;
}
goto err;
}
schedule();
+ set_current_state (TASK_INTERRUPTIBLE);
}
remove_wait_queue(&port->write_wait, &wait);
set_current_state(TASK_RUNNING);
if (status) {
/* something went wrong */
up(&(us->current_urb_sem));
+ current->state = TASK_RUNNING;
remove_wait_queue(&wqh, &wait);
kfree(dr);
return status;
if (status) {
/* something went wrong */
up(&(us->current_urb_sem));
+ current->state = TASK_RUNNING;
remove_wait_queue(&wqh, &wait);
return status;
}
US_DEBUGP("-- US_ACT_EXIT command recieved\n");
break;
}
+
+ set_current_state(TASK_INTERRUPTIBLE);
} /* for (;;) */
/* notify the exit routine that we're actually exiting now */
up(&(us->notify));
+ remove_wait_queue(&(us->wqh), &wait);
+
return 0;
}
set_current_state(TASK_UNINTERRUPTIBLE);
while (timeout && (urb->status == USB_ST_URB_PENDING))
timeout = schedule_timeout (timeout);
+ current->state = TASK_RUNNING;
remove_wait_queue (&unlink_wakeup, &wait);
if (urb->status == USB_ST_URB_PENDING) {
err ("unlink URB timeout");
set_current_state(TASK_UNINTERRUPTIBLE);
while (timeout && dev->ed_cnt)
timeout = schedule_timeout (timeout);
+ current->state = TASK_RUNNING;
remove_wait_queue (&freedev_wakeup, &wait);
if (dev->ed_cnt) {
err ("free device %d timeout", usb_dev->devnum);
if (status) {
// something went wrong
usb_free_urb(urb);
+ current->state = TASK_RUNNING;
remove_wait_queue(&wqh, &wait);
return status;
}
} else
status = 1;
+ current->state = TASK_RUNNING;
remove_wait_queue(&wqh, &wait);
if (!status) {
ovr = inb_p(vga_video_port_val);
outb_p( 0x09, vga_video_port_reg ); /* Font size register */
fsr = inb_p(vga_video_port_val);
- spin_lock_irq(&vga_lock);
+ spin_unlock_irq(&vga_lock);
vde = maxscan & 0xff; /* Vertical display end reg */
ovr = (ovr & 0xbd) + /* Overflow register */
{
struct inode *inode;
- inode = get_empty_inode();
+ inode = new_inode(sb);
if (!inode)
goto out;
inode->i_version = ++event;
- inode->i_sb = sb;
- inode->i_dev = sb->s_dev;
inode->i_uid = sb->u.adfs_sb.s_uid;
inode->i_gid = sb->u.adfs_sb.s_gid;
inode->i_ino = obj->file_id;
struct super_block *sb;
s32 block;
- if (!dir || !(inode = get_empty_inode()))
+ if (!dir)
return NULL;
sb = dir->i_sb;
- inode->i_sb = sb;
+ inode = new_inode(sb);
+ if (!inode)
+ return NULL;
if (!(block = affs_new_header((struct inode *)dir))) {
iput(inode);
return NULL;
}
- inode->i_dev = sb->s_dev;
inode->i_uid = current->fsuid;
inode->i_gid = current->fsgid;
inode->i_ino = block;
struct inode *autofs4_get_inode(struct super_block *sb,
struct autofs_info *inf)
{
- struct inode *inode = get_empty_inode();
+ struct inode *inode = new_inode(sb);
if (inode == NULL)
return NULL;
inf->inode = inode;
- inode->i_sb = sb;
- inode->i_dev = sb->s_dev;
inode->i_mode = inf->mode;
if (sb->s_root) {
inode->i_uid = sb->s_root->d_inode->i_uid;
inode->i_uid = 0;
inode->i_gid = 0;
}
- inode->i_size = 0;
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0;
inode->i_rdev = 0;
- inode->i_nlink = 1;
- inode->i_op = NULL;
- inode->i_fop = NULL;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
if (S_ISDIR(inf->mode)) {
struct super_block * s = dir->i_sb;
unsigned long ino;
- inode = get_empty_inode();
+ inode = new_inode(s);
if (!inode)
return -ENOSPC;
- inode->i_sb = s;
ino = find_first_zero_bit(s->su_imap, s->su_lasti);
if (ino > s->su_lasti) {
iput(inode);
}
set_bit(ino, s->su_imap);
s->su_freei--;
- inode->i_dev = s->s_dev;
inode->i_uid = current->fsuid;
inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
static struct inode *get_cramfs_inode(struct super_block *sb, struct cramfs_inode * cramfs_inode)
{
- struct inode * inode = get_empty_inode();
+ struct inode * inode = new_inode(sb);
if (inode) {
inode->i_mode = cramfs_inode->mode;
inode->i_size = cramfs_inode->size;
inode->i_gid = cramfs_inode->gid;
inode->i_ino = CRAMINO(cramfs_inode);
- inode->i_sb = sb;
- inode->i_dev = sb->s_dev;
- inode->i_nlink = 1; /* arguably wrong for directories,
- but it's the best we can do
- without reading the directory
- contents. 1 yields the right
- result in GNU find, even
- without -noleaf option. */
+ /* inode->i_nlink is left 1 - arguably wrong for directories,
+ but it's the best we can do without reading the directory
+ contents. 1 yields the right result in GNU find, even
+ without -noleaf option. */
insert_inode_hash(inode);
if (S_ISREG(inode->i_mode)) {
inode->i_fop = &generic_ro_fops;
current->state = TASK_RUNNING;
return -EINTR;
}
+ set_current_state(TASK_INTERRUPTIBLE);
}
remove_wait_queue (&fs_info->devfsd_wait_queue, &wait);
current->state = TASK_RUNNING;
goto fail_free;
}
- inode = get_empty_inode();
+ inode = new_inode(s);
if (!inode)
goto fail_free;
- inode->i_sb = s;
- inode->i_dev = s->s_dev;
inode->i_ino = 1;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
- inode->i_size = 0;
inode->i_blocks = 0;
inode->i_blksize = 1024;
inode->i_uid = inode->i_gid = 0;
if ( sbi->inodes[number] )
return; /* Already registered, this does happen */
- inode = get_empty_inode();
+ inode = new_inode(sb);
if (!inode)
return;
- inode->i_sb = sb;
- inode->i_dev = sb->s_dev;
inode->i_ino = number+2;
inode->i_blocks = 0;
inode->i_blksize = 1024;
return NULL;
}
- inode = get_empty_inode ();
+ sb = dir->i_sb;
+ inode = new_inode(sb);
if (!inode) {
*err = -ENOMEM;
return NULL;
}
- sb = dir->i_sb;
- inode->i_sb = sb;
- inode->i_flags = 0;
lock_super (sb);
es = sb->u.ext2_sb.s_es;
repeat:
mark_buffer_dirty(sb->u.ext2_sb.s_sbh);
sb->s_dirt = 1;
inode->i_mode = mode;
- inode->i_sb = sb;
- inode->i_nlink = 1;
- inode->i_dev = sb->s_dev;
inode->i_uid = current->fsuid;
if (test_opt (sb, GRPID))
inode->i_gid = dir->i_gid;
inode = fat_iget(sb, ino);
if (inode)
goto out;
- inode = get_empty_inode();
+ inode = new_inode(sb);
*res = -ENOMEM;
if (!inode)
goto out;
*res = 0;
- inode->i_sb = sb;
- inode->i_dev = sb->s_dev;
inode->i_ino = iunique(sb, MSDOS_ROOT_INO);
fat_fill_inode(inode, de);
fat_attach(inode, ino);
if (! sbi->nls_io)
sbi->nls_io = load_nls_default();
- root_inode=get_empty_inode();
+ root_inode=new_inode(sb);
if (!root_inode)
goto out_unload_nls;
- root_inode->i_sb = sb;
- root_inode->i_dev = sb->s_dev;
root_inode->i_ino = MSDOS_ROOT_INO;
fat_read_root(root_inode);
insert_inode_hash(root_inode);
back to SIGIO in that case. --sct */
si.si_signo = fown->signum;
si.si_errno = 0;
- si.si_code = reason;
+ si.si_code = reason & ~__SI_MASK;
/* Make sure we are called with one of the POLL_*
reasons, otherwise we could leak kernel stack into
userspace. */
if ((reason & __SI_MASK) != __SI_POLL)
BUG();
- if (reason - POLL_IN > NSIGPOLL)
+ if (reason - POLL_IN >= NSIGPOLL)
si.si_band = ~0L;
else
si.si_band = band_table[reason - POLL_IN];
return retnamlen;
}
+static struct buffer_head *isofs_bread(struct inode *inode, unsigned int bufsize, unsigned int block)
+{
+ unsigned int blknr = isofs_bmap(inode, block);
+ if (!blknr)
+ return NULL;
+ return bread(inode->i_dev, blknr, bufsize);
+}
+
/*
* This should _really_ be cleaned up some day..
*/
unsigned char bufbits = ISOFS_BUFFER_BITS(inode);
unsigned int block, offset;
int inode_number = 0; /* Quiet GCC */
- struct buffer_head *bh;
+ struct buffer_head *bh = NULL;
int len;
int map;
int high_sierra;
return 0;
offset = filp->f_pos & (bufsize - 1);
- block = isofs_bmap(inode, filp->f_pos >> bufbits);
+ block = filp->f_pos >> bufbits;
high_sierra = inode->i_sb->u.isofs_sb.s_high_sierra;
- if (!block)
- return 0;
-
- if (!(bh = breada(inode->i_dev, block, bufsize, filp->f_pos, inode->i_size)))
- return 0;
-
while (filp->f_pos < inode->i_size) {
int de_len;
-#ifdef DEBUG
- printk("Block, offset, f_pos: %x %x %x\n",
- block, offset, filp->f_pos);
- printk("inode->i_size = %x\n",inode->i_size);
-#endif
- /* Next directory_record on next CDROM sector */
- if (offset >= bufsize) {
-#ifdef DEBUG
- printk("offset >= bufsize\n");
-#endif
- brelse(bh);
- offset = 0;
- block = isofs_bmap(inode, (filp->f_pos) >> bufbits);
- if (!block)
- return 0;
- bh = breada(inode->i_dev, block, bufsize, filp->f_pos, inode->i_size);
+
+ if (!bh) {
+ bh = isofs_bread(inode, bufsize, block);
if (!bh)
return 0;
- continue;
}
de = (struct iso_directory_record *) (bh->b_data + offset);
- if(first_de) inode_number = (block << bufbits) + (offset & (bufsize - 1));
+ if (first_de) inode_number = (bh->b_blocknr << bufbits) + (offset & (bufsize - 1));
de_len = *(unsigned char *) de;
#ifdef DEBUG
printk("de_len = %d\n", de_len);
-#endif
-
+#endif
/* If the length byte is zero, we should move on to the next
CDROM sector. If we are at the end of the directory, we
if (de_len == 0) {
brelse(bh);
- filp->f_pos = ((filp->f_pos & ~(ISOFS_BLOCK_SIZE - 1))
- + ISOFS_BLOCK_SIZE);
+ bh = NULL;
+ filp->f_pos = ((filp->f_pos & ~(ISOFS_BLOCK_SIZE - 1)) + ISOFS_BLOCK_SIZE);
+ block = filp->f_pos >> bufbits;
offset = 0;
-
- if (filp->f_pos >= inode->i_size)
- return 0;
-
- block = isofs_bmap(inode, (filp->f_pos) >> bufbits);
- if (!block)
- return 0;
- bh = breada(inode->i_dev, block, bufsize, filp->f_pos, inode->i_size);
- if (!bh)
- return 0;
continue;
}
- offset += de_len;
+ offset += de_len;
+ if (offset == bufsize) {
+ offset = 0;
+ block++;
+ brelse(bh);
+ bh = NULL;
+ }
+
+ /* Make sure we have a full directory entry */
if (offset > bufsize) {
- /*
- * This would only normally happen if we had
- * a buggy cdrom image. All directory
- * entries should terminate with a null size
- * or end exactly at the end of the sector.
- */
- printk("next_offset (%x) > bufsize (%lx)\n",
- offset,bufsize);
- break;
+ int slop = bufsize - offset + de_len;
+ memcpy(tmpde, de, slop);
+ offset &= bufsize - 1;
+ block++;
+ brelse(bh);
+ bh = isofs_bread(inode, bufsize, block);
+ if (!bh)
+ return 0;
+ memcpy((void *) tmpde + slop, bh->b_data, de_len - slop);
+ de = tmpde;
}
- if(de->flags[-high_sierra] & 0x80) {
+ if (de->flags[-high_sierra] & 0x80) {
first_de = 0;
filp->f_pos += de_len;
continue;
struct inode * inode;
struct jffs_control *c;
- inode = get_empty_inode();
+ sb = dir->i_sb;
+ inode = new_inode(sb);
if (!inode) {
*err = -ENOMEM;
return NULL;
}
- sb = dir->i_sb;
c = (struct jffs_control *)sb->u.generic_sbp;
- inode->i_sb = sb;
- inode->i_dev = sb->s_dev;
inode->i_ino = raw_inode->ino;
inode->i_mode = raw_inode->mode;
inode->i_nlink = raw_inode->nlink;
struct buffer_head * bh;
int i,j;
- inode = get_empty_inode();
+ sb = dir->i_sb;
+ inode = new_inode(sb);
if (!inode) {
*error = -ENOMEM;
return NULL;
}
- sb = dir->i_sb;
- inode->i_sb = sb;
- inode->i_flags = 0;
j = 8192;
bh = NULL;
*error = -ENOSPC;
unlock_super(sb);
return NULL;
}
- inode->i_nlink = 1;
- inode->i_dev = sb->s_dev;
inode->i_uid = current->fsuid;
inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
inode->i_ino = j;
return NULL;
}
- inode = get_empty_inode();
+ inode = new_inode(sb);
if (inode) {
init_MUTEX(&NCP_FINFO(inode)->open_sem);
atomic_set(&NCP_FINFO(inode)->opened, info->opened);
- inode->i_sb = sb;
- inode->i_dev = sb->s_dev;
inode->i_ino = info->ino;
ncp_set_attr(inode, info);
if (S_ISREG(inode->i_mode)) {
if ((dentry->d_parent->d_inode->u.nfs_i.flags & NFS_IS_SNAPSHOT) ||
(dentry->d_name.len == 9 &&
memcmp(dentry->d_name.name, ".snapshot", 9) == 0)) {
- struct inode *inode = get_empty_inode();
+ struct inode *inode = new_inode(sb);
if (!inode)
- goto out;
- inode->i_sb = sb;
- inode->i_dev = sb->s_dev;
+ goto out;
inode->i_flags = 0;
inode->i_ino = nfs_fattr_to_ino_t(fattr);
nfs_read_inode(inode);
{
struct inode *inode = req->wb_dentry->d_inode;
struct rpc_clnt *clnt = NFS_CLIENT(inode);
- int retval;
if (!NFS_WBACK_BUSY(req))
return 0;
- req->wb_count++;
- retval = nfs_wait_event(clnt, req->wb_wait, !NFS_WBACK_BUSY(req));
- nfs_release_request(req);
- return retval;
+ return nfs_wait_event(clnt, req->wb_wait, !NFS_WBACK_BUSY(req));
}
/*
}
#endif
+ /*
+ * Update attributes as result of writeback.
+ * FIXME: There is an inherent race with invalidate_inode_pages and
+ * writebacks since the page->count is kept > 1 for as long
+ * as the page has a write request pending.
+ */
+ nfs_write_attributes(inode, resp->fattr);
while (!list_empty(&data->pages)) {
req = nfs_list_entry(data->pages.next);
nfs_list_remove_request(req);
next:
nfs_unlock_request(req);
}
- /* Update attributes as result of writeback. */
- nfs_write_attributes(inode, resp->fattr);
-
}
dprintk("NFS: %4d nfs_commit_done (status %d)\n",
task->tk_pid, task->tk_status);
+ nfs_write_attributes(inode, resp->fattr);
while (!list_empty(&data->pages)) {
req = nfs_list_entry(data->pages.next);
nfs_list_remove_request(req);
next:
nfs_unlock_request(req);
}
-
- nfs_write_attributes(inode, resp->fattr);
}
#endif
int error=0;
ntfs_attribute *si;
- r=get_empty_inode();
+ r=new_inode(dir->i_sb);
if(!r){
error=ENOMEM;
goto fail;
r->i_uid=vol->uid;
r->i_gid=vol->gid;
- r->i_nlink=1;
- r->i_sb=dir->i_sb;
/* FIXME: dirty? dev? */
/* get the file modification times from the standard information */
si=ntfs_find_attr(ino,vol->at_standard_information,NULL);
goto out;
error = EIO;
- r = get_empty_inode();
+ r = new_inode(dir->i_sb);
if (!r)
goto out;
goto out;
r->i_uid = vol->uid;
r->i_gid = vol->gid;
- r->i_nlink = 1;
- r->i_sb = dir->i_sb;
si = ntfs_find_attr(ino,vol->at_standard_information,NULL);
if(si){
char *attr = si->d.data;
static struct super_block * pipefs_read_super(struct super_block *sb, void *data, int silent)
{
- struct inode *root = get_empty_inode();
+ struct inode *root = new_inode(sb);
if (!root)
return NULL;
root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
root->i_uid = root->i_gid = 0;
root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME;
- root->i_sb = sb;
- root->i_dev = sb->s_dev;
sb->s_blocksize = 1024;
sb->s_blocksize_bits = 10;
sb->s_magic = PIPEFS_MAGIC;
/* We need a new inode */
- inode = get_empty_inode();
+ inode = new_inode(sb);
if (!inode)
goto out;
/* Common stuff */
- inode->i_sb = sb;
- inode->i_dev = sb->s_dev;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_ino = fake_ino(task->pid, ino);
name = dentry->d_name.name;
len = dentry->d_name.len;
if (len == 4 && !memcmp(name, "self", 4)) {
- inode = get_empty_inode();
+ inode = new_inode(dir->i_sb);
if (!inode)
return ERR_PTR(-ENOMEM);
- inode->i_sb = dir->i_sb;
- inode->i_dev = dir->i_sb->s_dev;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_ino = fake_ino(0, PROC_PID_INO);
inode->u.proc_i.file = NULL;
struct inode *ramfs_get_inode(struct super_block *sb, int mode, int dev)
{
- struct inode * inode = get_empty_inode();
+ struct inode * inode = new_inode(sb);
if (inode) {
- inode->i_sb = sb;
- inode->i_dev = sb->s_dev;
inode->i_mode = mode;
inode->i_uid = current->fsuid;
inode->i_gid = current->fsgid;
- inode->i_size = 0;
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0;
inode->i_rdev = to_kdev_t(dev);
- inode->i_nlink = 1;
- inode->i_op = NULL;
- inode->i_fop = NULL;
inode->i_mapping->a_ops = &ramfs_aops;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
switch (mode & S_IFMT) {
static int do_poll(unsigned int nfds, unsigned int nchunks, unsigned int nleft,
struct pollfd *fds[], poll_table *wait, long timeout)
{
- int count = 0;
+ int count;
poll_table* pt = wait;
for (;;) {
unsigned int i;
set_current_state(TASK_INTERRUPTIBLE);
+ count = 0;
for (i=0; i < nchunks; i++)
do_pollfd(POLLFD_PER_PAGE, fds[i], &pt, &count);
if (nleft)
pt = NULL;
if (count || !timeout || signal_pending(current))
break;
- if(wait->error) {
- return wait->error;
- }
+ count = wait->error;
+ if (count)
+ break;
timeout = schedule_timeout(timeout);
}
current->state = TASK_RUNNING;
DEBUG1("smb_iget: %p\n", fattr);
- result = get_empty_inode();
+ result = new_inode(sb);
if (!result)
return result;
- result->i_sb = sb;
- result->i_dev = sb->s_dev;
result->i_ino = fattr->f_ino;
memset(&(result->u.smbfs_i), 0, sizeof(result->u.smbfs_i));
smb_set_inode_attr(result, fattr);
struct sysv_inode * raw_inode;
int i,j,ino,block;
- if (!dir || !(inode = get_empty_inode()))
+ if (!dir)
return NULL;
sb = dir->i_sb;
- inode->i_sb = sb;
+ inode = new_inode(sb);
+ if (!inode)
+ return NULL;
lock_super(sb); /* protect against task switches */
if ((*sb->sv_sb_fic_count == 0)
|| (*sv_sb_fic_inode(sb,(*sb->sv_sb_fic_count)-1) == 0) /* Applies only to SystemV2 FS */
mark_buffer_dirty(sb->sv_bh1); /* super-block has been modified */
if (sb->sv_bh1 != sb->sv_bh2) mark_buffer_dirty(sb->sv_bh2);
sb->s_dirt = 1; /* and needs time stamp */
- inode->i_dev = sb->s_dev;
inode->i_uid = current->fsuid;
inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
inode->i_ino = ino;
int block;
Uint32 start = UDF_I_LOCATION(dir).logicalBlockNum;
- inode = get_empty_inode();
+ sb = dir->i_sb;
+ inode = new_inode(sb);
if (!inode)
{
*err = -ENOMEM;
return NULL;
}
- sb = dir->i_sb;
- inode->i_sb = sb;
inode->i_flags = 0;
*err = -ENOSPC;
mark_buffer_dirty(UDF_SB_LVIDBH(sb));
}
inode->i_mode = mode;
- inode->i_sb = sb;
- inode->i_nlink = 1;
- inode->i_dev = sb->s_dev;
inode->i_uid = current->fsuid;
if (dir->i_mode & S_ISGID) {
inode->i_gid = dir->i_gid;
*err = -EPERM;
return NULL;
}
- inode = get_empty_inode ();
+ sb = dir->i_sb;
+ inode = new_inode(sb);
if (!inode) {
*err = -ENOMEM;
return NULL;
}
- sb = dir->i_sb;
swab = sb->u.ufs_sb.s_swab;
uspi = sb->u.ufs_sb.s_uspi;
usb1 = ubh_get_usb_first(USPI_UBH);
- inode->i_sb = sb;
- inode->i_flags = 0;
-
lock_super (sb);
*err = -ENOSPC;
sb->s_dirt = 1;
inode->i_mode = mode;
- inode->i_sb = sb;
- inode->i_nlink = 1;
- inode->i_dev = sb->s_dev;
inode->i_uid = current->fsuid;
if (dir->i_mode & S_ISGID) {
inode->i_gid = dir->i_gid;
#define current_cpu_data boot_cpu_data
#endif
-#define cpu_has_pge \
- (test_bit(X86_FEATURE_PGE, &boot_cpu_data.x86_capability))
-#define cpu_has_pse \
- (test_bit(X86_FEATURE_PSE, &boot_cpu_data.x86_capability))
-#define cpu_has_pae \
- (test_bit(X86_FEATURE_PAE, &boot_cpu_data.x86_capability))
-#define cpu_has_tsc \
- (test_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability))
-#define cpu_has_de \
- (test_bit(X86_FEATURE_DE, &boot_cpu_data.x86_capability))
-#define cpu_has_vme \
- (test_bit(X86_FEATURE_VME, &boot_cpu_data.x86_capability))
-#define cpu_has_fxsr \
- (test_bit(X86_FEATURE_FXSR, &boot_cpu_data.x86_capability))
-#define cpu_has_xmm \
- (test_bit(X86_FEATURE_XMM, &boot_cpu_data.x86_capability))
+#define cpu_has_pge (test_bit(X86_FEATURE_PGE, boot_cpu_data.x86_capability))
+#define cpu_has_pse (test_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability))
+#define cpu_has_pae (test_bit(X86_FEATURE_PAE, boot_cpu_data.x86_capability))
+#define cpu_has_tsc (test_bit(X86_FEATURE_TSC, boot_cpu_data.x86_capability))
+#define cpu_has_de (test_bit(X86_FEATURE_DE, boot_cpu_data.x86_capability))
+#define cpu_has_vme (test_bit(X86_FEATURE_VME, boot_cpu_data.x86_capability))
+#define cpu_has_fxsr (test_bit(X86_FEATURE_FXSR, boot_cpu_data.x86_capability))
+#define cpu_has_xmm (test_bit(X86_FEATURE_XMM, boot_cpu_data.x86_capability))
extern char ignore_irq13;
#define MICROCODE_IOCFREE _IO('6',0) /* because it is for P6 */
+/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
+extern inline void rep_nop(void)
+{
+ __asm__ __volatile__("rep;nop");
+}
+
#endif /* __ASM_I386_PROCESSOR_H */
INTEL_BX,
INTEL_GX,
INTEL_I810,
+ INTEL_I815,
INTEL_I840,
VIA_GENERIC,
VIA_VP3,
extern void clear_inode(struct inode *);
extern struct inode * get_empty_inode(void);
+static inline struct inode * new_inode(struct super_block *sb)
+{
+ struct inode *inode = get_empty_inode();
+ if (inode) {
+ inode->i_sb = sb;
+ inode->i_dev = sb->s_dev;
+ }
+ return inode;
+}
extern void insert_inode_hash(struct inode *);
extern void remove_inode_hash(struct inode *);
/*
* Valid flags for a dirty buffer
*/
-#define PG_BUSY 0x0001
+#define PG_BUSY 0
struct nfs_page {
struct list_head wb_hash, /* Inode */
struct nfs_writeverf wb_verf; /* Commit cookie */
};
-#define NFS_WBACK_BUSY(req) ((req)->wb_flags & PG_BUSY)
+#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
extern struct nfs_page *nfs_create_request(struct file *file,
struct page *page,
static __inline__ int
nfs_lock_request(struct nfs_page *req)
{
- if (NFS_WBACK_BUSY(req))
+ if (test_and_set_bit(PG_BUSY, &req->wb_flags))
return 0;
req->wb_count++;
- req->wb_flags |= PG_BUSY;
return 1;
}
{
if (!NFS_WBACK_BUSY(req)) {
printk(KERN_ERR "NFS: Invalid unlock attempted\n");
- return;
+ BUG();
}
- req->wb_flags &= ~PG_BUSY;
- wake_up(&req->wb_wait);
+ smp_mb__before_clear_bit();
+ clear_bit(PG_BUSY, &req->wb_flags);
+ smp_mb__after_clear_bit();
+ if (waitqueue_active(&req->wb_wait))
+ wake_up(&req->wb_wait);
nfs_release_request(req);
}
extern signed long FASTCALL(schedule_timeout(signed long timeout));
asmlinkage void schedule(void);
+extern void schedule_task(struct tq_struct *task);
+
/*
* The default fd array needs to be at least BITS_PER_LONG,
* as this is the granularity returned by copy_fdset().
unsigned short tk_lock; /* Task lock counter */
unsigned char tk_active : 1,/* Task has been activated */
tk_wakeup : 1;/* Task waiting to wake up */
- volatile unsigned char tk_running : 1,/* Task is running */
- tk_sleeping : 1;/* Task is truly asleep */
+ unsigned int tk_runstate; /* Task run status */
#ifdef RPC_DEBUG
unsigned short tk_pid; /* debugging aid */
#endif
#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS)
#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
-#define RPC_IS_RUNNING(t) ((t)->tk_running)
-#define RPC_IS_SLEEPING(t) ((t)->tk_sleeping)
#define RPC_IS_ACTIVATED(t) ((t)->tk_active)
#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL)
+#define RPC_TASK_SLEEPING 0
+#define RPC_TASK_RUNNING 1
+#define RPC_IS_SLEEPING(t) (test_bit(RPC_TASK_SLEEPING, &(t)->tk_runstate))
+#define RPC_IS_RUNNING(t) (test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
+
+#define rpc_set_running(t) (set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
+#define rpc_clear_running(t) (clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
+
+#define rpc_set_sleeping(t) (set_bit(RPC_TASK_SLEEPING, &(t)->tk_runstate))
+
+#define rpc_clear_sleeping(t) \
+ do { \
+ smp_mb__before_clear_bit(); \
+ clear_bit(RPC_TASK_SLEEPING, &(t)->tk_runstate); \
+ smp_mb__after_clear_bit(); \
+ } while(0)
+
/*
* RPC synchronization objects
*/
if (!q || !p)
WQ_BUG();
#endif
+ q->flags = 0;
q->task = p;
#if WAITQUEUE_DEBUG
q->__magic = (long)&q->__magic;
extern void signals_init(void);
extern void bdev_init(void);
extern int init_pcmcia_ds(void);
+extern void net_notifier_init(void);
extern void free_initmem(void);
extern void filesystem_setup(void);
#ifdef CONFIG_PCMCIA
init_pcmcia_ds(); /* Do this last */
#endif
+
+ /* do this after other 'do this last' stuff, because we want
+ * to minimize spurious executions of /sbin/hotplug
+ * during boot-up
+ */
+ net_notifier_init();
+
/* Mount the root filesystem.. */
mount_root();
module.o exit.o itimer.o info.o time.o softirq.o resource.o \
sysctl.o acct.o capability.o ptrace.o timer.o user.o
-OX_OBJS += signal.o sys.o kmod.o
+OX_OBJS += signal.o sys.o kmod.o context.o
ifeq ($(CONFIG_UID16),y)
O_OBJS += uid16.o
--- /dev/null
+/*
+ * linux/kernel/context.c
+ *
+ * Mechanism for running arbitrary tasks in process context
+ *
+ * dwmw2@redhat.com
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/init.h>
+
+static DECLARE_TASK_QUEUE(tq_context);
+static DECLARE_WAIT_QUEUE_HEAD(context_task_wq);
+
+void schedule_task(struct tq_struct *task)
+{
+ queue_task(task, &tq_context);
+ wake_up(&context_task_wq);
+}
+
+EXPORT_SYMBOL(schedule_task);
+
+static int context_thread(void *dummy)
+{
+ DECLARE_WAITQUEUE(wait, current);
+
+ daemonize();
+ strcpy(current->comm, "eventd");
+
+ spin_lock_irq(¤t->sigmask_lock);
+ sigfillset(¤t->blocked);
+ recalc_sigpending(current);
+ spin_unlock_irq(¤t->sigmask_lock);
+
+ for (;;) {
+ current->state = TASK_INTERRUPTIBLE;
+ add_wait_queue(&context_task_wq, &wait);
+
+ /*
+ * Careful: we depend on the wait-queue modifications
+ * to also act as memory barriers.
+ */
+ if (!tq_context)
+ schedule();
+
+ remove_wait_queue(&context_task_wq, &wait);
+ current->state = TASK_RUNNING;
+ run_task_queue(&tq_context);
+ }
+}
+
+static int __init start_context_thread(void)
+{
+ kernel_thread(context_thread, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ return 0;
+}
+
+module_init(start_context_thread);
unsigned long flags;
wq_write_lock_irqsave(&q->lock, flags);
+ wait->flags = 0;
__add_wait_queue(q, wait);
wq_write_unlock_irqrestore(&q->lock, flags);
}
unsigned long flags;
wq_write_lock_irqsave(&q->lock, flags);
- wait->flags |= WQ_FLAG_EXCLUSIVE;
+ wait->flags = WQ_FLAG_EXCLUSIVE;
__add_wait_queue_tail(q, wait);
wq_write_unlock_irqrestore(&q->lock, flags);
}
static int exec_modprobe(void * module_name)
{
static char * envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
- char *argv[] = { modprobe_path, "-s", "-k", (char*)module_name, NULL };
+ char *argv[] = { modprobe_path, "-s", "-k", "--", (char*)module_name, NULL };
int ret;
ret = exec_usermodehelper(modprobe_path, argv, envp);
EXPORT_SYMBOL(find_vma);
EXPORT_SYMBOL(get_unmapped_area);
EXPORT_SYMBOL(init_mm);
+EXPORT_SYMBOL(deactivate_page);
#ifdef CONFIG_HIGHMEM
EXPORT_SYMBOL(kmap_high);
EXPORT_SYMBOL(kunmap_high);
unsigned long flags;
int best_cpu, irq;
- if (!q || !waitqueue_active(q))
+ if (!q)
goto out;
best_cpu = smp_processor_id();
}
schedule();
}
+ current->state = TASK_RUNNING;
remove_wait_queue(&sigd_sleep,&wait);
#else
if (!sigd) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule();
}
- remove_wait_queue(&vcc->sleep,&wait);
clear_bit(ATM_VF_REGIS,&vcc->flags);
clear_bit(ATM_VF_RELEASED,&vcc->flags);
clear_bit(ATM_VF_CLOSE,&vcc->flags);
return 0;
}
+
+
+/* Notify userspace when a netdevice event occurs,
+ * by running '/sbin/hotplug net' with certain
+ * environment variables set.
+ *
+ * Currently reported events are listed in netdev_event_names[].
+ */
+
+/* /sbin/hotplug ONLY executes for events named here */
+static char *netdev_event_names[] = {
+ [NETDEV_REGISTER] = "register",
+ [NETDEV_UNREGISTER] = "unregister",
+};
+
+static int run_sbin_hotplug(struct notifier_block *this,
+ unsigned long event, void *ptr)
+{
+ struct net_device *dev = (struct net_device *) ptr;
+ char *argv[3], *envp[5], ifname[12 + IFNAMSIZ], action[32];
+ int i;
+
+ if ((event >= ARRAY_SIZE(netdev_event_names)) ||
+ !netdev_event_names[event])
+ return NOTIFY_DONE;
+
+ sprintf(ifname, "INTERFACE=%s", dev->name);
+ sprintf(action, "ACTION=%s", netdev_event_names[event]);
+
+ i = 0;
+ argv[i++] = hotplug_path;
+ argv[i++] = "net";
+ argv[i] = 0;
+
+ i = 0;
+ /* minimal command environment */
+ envp [i++] = "HOME=/";
+ envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
+ envp [i++] = ifname;
+ envp [i++] = action;
+ envp [i] = 0;
+
+ call_usermodehelper (argv [0], argv, envp);
+
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block sbin_hotplug = {
+ notifier_call: run_sbin_hotplug,
+};
+
+/*
+ * called from init/main.c, -after- all the initcalls are complete.
+ * Registers a hook that calls /sbin/hotplug on every netdev
+ * addition and removal.
+ */
+void __init net_notifier_init (void)
+{
+ if (register_netdevice_notifier(&sbin_hotplug))
+ printk (KERN_WARNING "unable to register netdev notifier\n"
+ KERN_WARNING "/sbin/hotplug will not be run.\n");
+}
Port 8080
- in /etc/apache/httpd.conf. For security-reasons, you can also change
-
- BindAddress *
-
- to
-
- BindAddress 127.0.0.1
-
- (in the same file) to prevent outside users from accessing Apache
- directly.
-
Stopping kHTTPd
CPUNR=(int)*(int*)cpu_pointer;
sprintf(current->comm,"khttpd - %i",CPUNR);
- lock_kernel(); /* This seems to be required for exit_mm */
- exit_mm(current);
+ daemonize();
init_waitqueue_head(&(DummyWQ[CPUNR]));
sprintf(current->comm,"khttpd manager");
- lock_kernel(); /* This seems to be required for exit_mm */
- exit_mm(current);
+ daemonize();
/* Block all signals except SIGKILL and SIGSTOP */
static struct super_block * sockfs_read_super(struct super_block *sb, void *data, int silent)
{
- struct inode *root = get_empty_inode();
+ struct inode *root = new_inode(sb);
if (!root)
return NULL;
root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
root->i_uid = root->i_gid = 0;
root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME;
- root->i_sb = sb;
- root->i_dev = sb->s_dev;
sb->s_blocksize = 1024;
sb->s_blocksize_bits = 10;
sb->s_magic = SOCKFS_MAGIC;
printk(KERN_ERR "RPC: task w/ running timer in rpc_make_runnable!!\n");
return;
}
- task->tk_running = 1;
+ rpc_set_running(task);
if (RPC_IS_ASYNC(task)) {
if (RPC_IS_SLEEPING(task)) {
int status;
if (status < 0) {
printk(KERN_WARNING "RPC: failed to add task to queue: error: %d!\n", status);
task->tk_status = status;
- } else
- task->tk_sleeping = 0;
+ return;
+ }
+ rpc_clear_sleeping(task);
+ if (waitqueue_active(&rpciod_idle))
+ wake_up(&rpciod_idle);
}
- if (waitqueue_active(&rpciod_idle))
- wake_up(&rpciod_idle);
} else {
- task->tk_sleeping = 0;
+ rpc_clear_sleeping(task);
if (waitqueue_active(&task->tk_wait))
wake_up(&task->tk_wait);
}
if (RPC_IS_ACTIVATED(task))
return;
task->tk_active = 1;
- task->tk_sleeping = 1;
+ rpc_set_sleeping(task);
rpc_make_runnable(task);
}
/* Mark the task as being activated if so needed */
if (!RPC_IS_ACTIVATED(task)) {
task->tk_active = 1;
- task->tk_sleeping = 1;
+ rpc_set_sleeping(task);
}
status = __rpc_add_wait_queue(q, task);
printk(KERN_WARNING "RPC: failed to add task to queue: error: %d!\n", status);
task->tk_status = status;
} else {
- task->tk_running = 0;
+ rpc_clear_running(task);
if (task->tk_callback) {
dprintk(KERN_ERR "RPC: %4d overwrites an active callback\n", task->tk_pid);
BUG();
/*
* Check whether task is sleeping.
- * Note that if the task goes to sleep in tk_action,
- * and the RPC reply arrives before we get here, it will
- * have state RUNNING, but will still be on schedq.
- * 27/9/99: The above has been attempted fixed by
- * introduction of task->tk_sleeping.
*/
spin_lock_bh(&rpc_queue_lock);
if (!RPC_IS_RUNNING(task)) {
- task->tk_sleeping = 1;
+ rpc_set_sleeping(task);
if (RPC_IS_ASYNC(task)) {
spin_unlock_bh(&rpc_queue_lock);
return 0;
}
- } else
- task->tk_sleeping = 0;
+ }
spin_unlock_bh(&rpc_queue_lock);
while (RPC_IS_SLEEPING(task)) {
}
task->tk_active = 1;
- task->tk_running = 1;
+ rpc_set_running(task);
return __rpc_execute(task);
out_release:
rpc_release_task(task);