From 34f550135e349102bd065488eabbbb217ab27f0d Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:32:20 -0500 Subject: [PATCH] Import 2.3.49pre2 --- Documentation/Configure.help | 25 +- Documentation/usb/ibmcam.txt | 134 +- arch/alpha/kernel/Makefile | 44 +- arch/alpha/kernel/core_pyxis.c | 3 +- arch/alpha/kernel/irq.c | 311 +-- .../alpha/kernel/{alpha_irq.c => irq_alpha.c} | 118 +- arch/alpha/kernel/{i8259.c => irq_i8259.c} | 73 +- arch/alpha/kernel/irq_smp.c | 250 +++ arch/alpha/kernel/{srm_irq.c => irq_srm.c} | 2 +- arch/alpha/kernel/signal.c | 4 + arch/alpha/kernel/sys_alcor.c | 2 +- arch/alpha/kernel/sys_cabriolet.c | 2 +- arch/alpha/kernel/sys_dp264.c | 29 +- arch/alpha/kernel/sys_eb64p.c | 2 +- arch/alpha/kernel/sys_eiger.c | 2 +- arch/alpha/kernel/sys_mikasa.c | 2 +- arch/alpha/kernel/sys_noritake.c | 2 +- arch/alpha/kernel/sys_rawhide.c | 2 +- arch/alpha/kernel/sys_rx164.c | 2 +- arch/alpha/kernel/sys_sable.c | 4 +- arch/alpha/kernel/sys_takara.c | 2 +- arch/arm/boot/compressed/Makefile | 9 +- arch/arm/boot/compressed/head-sa1100.S | 61 + arch/arm/config.in | 12 +- arch/arm/kernel/arthur.c | 60 +- arch/arm/kernel/entry-armo.S | 20 +- arch/arm/kernel/entry-armv.S | 20 +- arch/arm/kernel/entry-common.S | 47 +- arch/arm/kernel/sys_arm.c | 23 +- arch/arm/lib/findbit.S | 4 +- arch/arm/lib/getconsdata.c | 2 + arch/arm/lib/strrchr.S | 2 +- arch/arm/mm/consistent.c | 19 +- arch/arm/mm/fault-armv.c | 4 +- arch/arm/mm/fault-common.c | 2 +- arch/arm/mm/mm-clps7500.c | 28 + arch/arm/mm/mm-nexuspci.c | 20 +- arch/arm/vmlinux-armo.lds.in | 5 + arch/i386/config.in | 27 +- arch/i386/defconfig | 4 +- arch/i386/kernel/acpi.c | 25 +- arch/i386/kernel/io_apic.c | 1 + arch/i386/kernel/irq.c | 42 +- arch/i386/kernel/pci-pc.c | 43 + arch/i386/kernel/process.c | 2 - arch/i386/kernel/signal.c | 10 + arch/i386/kernel/traps.c | 1 + arch/mips/arc/console.c | 1 + arch/mips/arc/init.c | 1 - arch/mips/arc/memory.c | 1 - arch/mips/arc/printf.c | 1 + arch/mips/baget/balo_supp.S | 1 - arch/mips/baget/prom/init.c | 1 - arch/mips/baget/setup.c | 1 - arch/mips/ddb5074/irq.c | 1 + arch/mips/ddb5074/pci.c | 2 - arch/mips/dec/prom/cmdline.c | 1 - arch/mips/dec/prom/identify.c | 1 - arch/mips/kernel/r2300_misc.S | 2 - arch/mips/kernel/time.c | 1 + arch/mips/mm/loadmmu.c | 1 + arch/mips/sgi/kernel/indy_int.c | 1 - arch/mips64/arc/init.c | 1 - arch/mips64/arc/memory.c | 2 - arch/mips64/kernel/signal32.c | 1 - arch/mips64/kernel/syscall.c | 1 - arch/mips64/sgi-ip27/ip27-init.c | 1 - arch/mips64/sgi-ip27/ip27-irq.c | 1 - arch/mips64/sgi-ip27/ip27-rtc.c | 13 +- arch/mips64/sgi-ip27/ip27-setup.c | 1 - arch/mips64/sgi-ip27/ip27-timer.c | 3 - drivers/acorn/block/Makefile | 59 +- drivers/acorn/block/mfmhd.c | 1 - drivers/acorn/char/Makefile | 62 +- drivers/acorn/net/Makefile | 32 +- drivers/acorn/scsi/Makefile | 125 +- drivers/acorn/scsi/arxescsi.c | 2 +- drivers/block/DAC960.c | 2 +- drivers/block/amd7409.c | 1 + drivers/block/cmd64x.c | 1 + drivers/block/cpqarray.h | 2 +- drivers/block/cs5530.c | 1 + drivers/block/ide-pci.c | 5 +- drivers/block/piix.c | 2 +- drivers/block/sl82c105.c | 85 +- drivers/char/Config.in | 1 + drivers/char/Makefile | 1 + drivers/char/README.epca | 8 + {include/linux => drivers/char}/digi1.h | 0 {include/linux => drivers/char}/digiFep1.h | 0 {include/linux => drivers/char}/digiPCI.h | 0 drivers/char/ds1620.c | 16 +- drivers/char/dz.c | 1 + drivers/char/epca.c | 435 ++-- {include/linux => drivers/char}/epca.h | 0 {include/linux => drivers/char}/epcaconfig.h | 0 drivers/char/nwbutton.c | 13 +- drivers/char/nwflash.c | 20 +- drivers/char/tuner-3036.c | 227 ++ drivers/char/wdt285.c | 16 +- drivers/char/wdt977.c | 15 +- drivers/i2o/i2o_lan.c | 27 +- drivers/ieee1394/aic5800.c | 2 +- drivers/isdn/avmb1/capi.c | 19 +- drivers/isdn/divert/divert_procfs.c | 18 +- drivers/isdn/hisax/hfc_sx.c | 1 - drivers/isdn/hysdn/hysdn_procconf.c | 16 +- drivers/isdn/hysdn/hysdn_procfs.c | 17 +- drivers/isdn/hysdn/hysdn_proclog.c | 17 +- drivers/isdn/isdn_common.c | 18 +- drivers/macintosh/via-pmu68k.c | 14 +- drivers/net/3c505.c | 4 +- drivers/net/aironet4500.h | 134 +- drivers/net/aironet4500_card.c | 226 +- drivers/net/aironet4500_core.c | 247 +-- drivers/net/aironet4500_proc.c | 2 +- drivers/net/aironet4500_rid.c | 2 +- drivers/net/am79c961a.c | 2 +- drivers/net/arlan.c | 153 +- drivers/net/bonding.c | 1 - drivers/net/fc/iph5526.c | 3 + drivers/net/hamradio/mkiss.c | 33 +- drivers/net/ioc3-eth.c | 1 - drivers/net/pcmcia/aironet4500_cs.c | 22 +- drivers/net/pcmcia/com20020_cs.c | 6 +- drivers/net/seeq8005.c | 2 +- drivers/net/tulip/eeprom.c | 6 + drivers/net/tulip/tulip.h | 7 +- drivers/net/tulip/tulip_core.c | 33 +- drivers/net/wan/sdla.c | 2 +- drivers/net/wan/sdla_chdlc.c | 79 +- drivers/net/wan/sdla_fr.c | 86 +- drivers/net/wan/sdla_ppp.c | 85 +- drivers/net/wavelan.c | 4 +- drivers/net/yellowfin.c | 143 +- drivers/parport/daisy.c | 6 +- drivers/parport/ieee1284.c | 38 +- drivers/parport/parport_pc.c | 19 +- drivers/pci/Makefile | 7 +- drivers/pci/pci.c | 49 + drivers/pci/pci.ids | 1 + drivers/pci/pcisyms.c | 58 - drivers/pci/quirks.c | 51 + drivers/pcmcia/cs.c | 10 +- drivers/pcmcia/rsrc_mgr.c | 18 +- drivers/pcmcia/yenta.c | 10 +- drivers/scsi/pci2000.c | 2 +- drivers/scsi/pci2220i.c | 12 +- drivers/scsi/seagate.c | 3 +- drivers/scsi/st.c | 16 +- drivers/scsi/u14-34f.c | 2 +- drivers/sgi/char/graphics_syms.c | 1 - drivers/sgi/char/newport.c | 1 - drivers/sound/ac97_codec.c | 3 + drivers/sound/ad1816.c | 1 - drivers/sound/audio.c | 1 - drivers/sound/dmabuf.c | 2 - drivers/sound/gus_midi.c | 2 - drivers/sound/gus_vol.c | 2 - drivers/sound/ics2101.c | 3 - drivers/sound/midi_synth.c | 2 - drivers/sound/midibuf.c | 1 - drivers/sound/mpu401.c | 1 - drivers/sound/opl3sa.c | 1 - drivers/sound/pas2_midi.c | 2 - drivers/sound/pas2_mixer.c | 2 - drivers/sound/pas2_pcm.c | 2 - drivers/sound/sb.h | 2 - drivers/sound/sb_audio.c | 1 - drivers/sound/sb_midi.c | 1 - drivers/sound/sb_mixer.c | 1 - drivers/sound/sb_mixer.h | 2 - drivers/sound/sequencer.c | 1 - drivers/sound/sgalaxy.c | 1 - drivers/sound/softoss_rs.c | 3 - drivers/sound/sound_timer.c | 1 - drivers/sound/sys_timer.c | 3 - drivers/sound/uart401.c | 1 - drivers/sound/uart6850.c | 1 - drivers/sound/v_midi.c | 1 - drivers/sound/vidc.c | 1 + drivers/usb/Config.in | 7 +- drivers/usb/Makefile | 3 +- drivers/usb/acm.c | 26 +- drivers/usb/graphire.c | 195 -- drivers/usb/hid.c | 13 +- drivers/usb/hid.h | 2 +- drivers/usb/ibmcam.c | 845 +++++++- drivers/usb/ibmcam.h | 6 +- drivers/usb/inode.c | 3 - drivers/usb/joydev.c | 4 +- drivers/usb/pegasus.c | 579 +++++ drivers/usb/scanner.c | 17 +- drivers/usb/usb-debug.c | 11 +- drivers/usb/usb.c | 9 +- drivers/usb/usb.h | 19 +- drivers/usb/usbdevice_fs.h | 3 + drivers/usb/usbkbd.c | 7 +- drivers/usb/wacom.c | 286 +++ drivers/video/Config.in | 2 +- drivers/video/Makefile | 13 +- drivers/video/aty128fb.c | 195 +- drivers/video/clgenfb.c | 4 +- drivers/video/fbmem.c | 15 +- drivers/video/matrox/matroxfb_base.c | 26 +- drivers/video/riva/Makefile | 14 + drivers/video/riva/fbdev.c | 1705 +++++++++++++++ drivers/video/{ => riva}/nv4ref.h | 0 drivers/video/{ => riva}/nvreg.h | 0 drivers/video/{ => riva}/riva_hw.c | 11 +- drivers/video/{ => riva}/riva_hw.h | 0 drivers/video/{ => riva}/riva_tbl.h | 0 drivers/video/rivafb.c | 1891 ----------------- drivers/video/vesafb.c | 2 +- fs/affs/inode.c | 1 + fs/affs/namei.c | 2 + fs/binfmt_elf.c | 13 +- fs/binfmt_script.c | 5 + fs/exec.c | 25 +- fs/nfsd/export.c | 2 +- fs/nfsd/nfs3xdr.c | 6 +- fs/nfsd/vfs.c | 118 +- fs/udf/dir.c | 1 - fs/udf/namei.c | 1 + include/asm-alpha/hw_irq.h | 2 + include/asm-arm/arch-cl7500/hardware.h | 2 +- include/asm-arm/arch-cl7500/memory.h | 10 +- include/asm-arm/arch-cl7500/param.h | 2 + include/asm-arm/arch-cl7500/processor.h | 2 - include/asm-arm/arch-cl7500/serial.h | 6 +- include/asm-arm/arch-cl7500/system.h | 25 +- include/asm-arm/arch-cl7500/time.h | 9 +- include/asm-arm/arch-nexuspci/dma.h | 9 +- include/asm-arm/arch-nexuspci/hardware.h | 47 +- include/asm-arm/arch-nexuspci/ide.h | 36 + include/asm-arm/arch-nexuspci/io.h | 187 +- include/asm-arm/arch-nexuspci/irq.h | 54 +- include/asm-arm/arch-nexuspci/irqs.h | 33 +- include/asm-arm/arch-nexuspci/keyboard.h | 29 + include/asm-arm/arch-nexuspci/memory.h | 15 +- include/asm-arm/arch-nexuspci/system.h | 4 +- include/asm-arm/arch-nexuspci/time.h | 39 +- include/asm-arm/arch-nexuspci/uncompress.h | 46 +- include/asm-arm/arch-sa1100/uncompress.h | 17 +- include/asm-arm/parport.h | 13 +- include/asm-arm/pci.h | 14 +- include/asm-i386/parport.h | 2 - include/asm-i386/spinlock.h | 1 + include/asm-mips/bitops.h | 5 +- include/asm-mips/bootinfo.h | 3 - include/asm-mips/io.h | 2 - include/asm-mips/keyboard.h | 1 - include/asm-mips64/dma.h | 1 - include/asm-mips64/keyboard.h | 1 - include/asm-mips64/mmu_context.h | 1 - include/asm-mips64/mmzone.h | 1 + include/asm-mips64/sn/sn0/hubmd.h | 2 + include/linux/ac97_codec.h | 2 + include/linux/input.h | 14 +- include/linux/ioport.h | 1 + include/linux/mm.h | 1 - include/linux/netfilter_ipv6.h | 1 - include/linux/nfsd/nfsd.h | 5 +- include/linux/nfsd/nfsfh.h | 62 +- include/linux/pm.h | 6 +- kernel/Makefile | 6 +- kernel/resource.c | 46 +- kernel/sched.c | 6 +- mm/memory.c | 10 - mm/vmscan.c | 10 +- net/bridge/br_device.c | 1 - net/ipv6/ip6_output.c | 1 + 272 files changed, 6302 insertions(+), 5041 deletions(-) rename arch/alpha/kernel/{alpha_irq.c => irq_alpha.c} (69%) rename arch/alpha/kernel/{i8259.c => irq_i8259.c} (54%) create mode 100644 arch/alpha/kernel/irq_smp.c rename arch/alpha/kernel/{srm_irq.c => irq_srm.c} (97%) create mode 100644 arch/arm/mm/mm-clps7500.c rename {include/linux => drivers/char}/digi1.h (100%) rename {include/linux => drivers/char}/digiFep1.h (100%) rename {include/linux => drivers/char}/digiPCI.h (100%) rename {include/linux => drivers/char}/epca.h (100%) rename {include/linux => drivers/char}/epcaconfig.h (100%) create mode 100644 drivers/char/tuner-3036.c delete mode 100644 drivers/pci/pcisyms.c delete mode 100644 drivers/usb/graphire.c create mode 100644 drivers/usb/pegasus.c create mode 100644 drivers/usb/wacom.c create mode 100644 drivers/video/riva/Makefile create mode 100644 drivers/video/riva/fbdev.c rename drivers/video/{ => riva}/nv4ref.h (100%) rename drivers/video/{ => riva}/nvreg.h (100%) rename drivers/video/{ => riva}/riva_hw.c (99%) rename drivers/video/{ => riva}/riva_hw.h (100%) rename drivers/video/{ => riva}/riva_tbl.h (100%) delete mode 100644 drivers/video/rivafb.c create mode 100644 include/asm-arm/arch-nexuspci/ide.h create mode 100644 include/asm-arm/arch-nexuspci/keyboard.h diff --git a/Documentation/Configure.help b/Documentation/Configure.help index 878b5abe0151..a66ce14f2cbf 100644 --- a/Documentation/Configure.help +++ b/Documentation/Configure.help @@ -339,10 +339,6 @@ CONFIG_BLK_DEV_IDE performance, look for the hdparm package at ftp://metalab.unc.edu/pub/Linux/kernel/patches/diskdrives/ . - To fine-tune ATA/IDE drive/interface parameters for improved - performance, look for the hdparm package at - ftp://metalab.unc.edu/pub/Linux/kernel/patches/diskdrives/ . - If you want to compile this driver as a module ( = code which can be inserted in and removed from the running kernel whenever you want), say M here and read Documentation/modules.txt and @@ -8478,12 +8474,11 @@ CONFIG_USB_MOUSE USB mouse and prefer to use the mouse in its limited Boot Protocol mode. This driver is much smaller than the HID one. -Wacom Graphire tablet support -CONFIG_USB_GRAPHIRE +Wacom Intuos/Graphire tablet support +CONFIG_USB_WACOM Say Y here if you want to use the USB version of the Wacom - Graphire tablet. Make sure you select Mouse and Event support, - don't select HID support, because this driver collides with it. - Use HIDBP support for keyboards and mice instead if you need it. + Intuos or Graphire tablet. Make sure you select Mouse and Event + support as well. Logitech WingMan Force joystick support CONFIG_USB_WMFORCE @@ -8656,6 +8651,18 @@ CONFIG_USB_OV511 The module will be called ov511.o. If you want to compile it as a module, say M here and read Documentation/modules.txt. +USB ADMtek's Pegasus based ethernet devices support +CONFIG_USB_PEGASUS + Say Y if you want to use your usb ethernet device. Note that + the code is still experimental. If you have devices with other + vendor IDs than ADMtek's you should change/add them in the + driver code and send a message to me (petkan@spct.net) for + update. + This code is also available as a module ( = code which can be + inserted in and removed from the running kernel whenever you want). + The module will be called ov511.o. If you want to compile it as a + module, say M here and read Documentation/modules.txt. + USB Kodak DC-2xx Camera support CONFIG_USB_DC2XX Say Y here if you want to connect this type of still camera to diff --git a/Documentation/usb/ibmcam.txt b/Documentation/usb/ibmcam.txt index 6880ed3340ab..5943227a6978 100644 --- a/Documentation/usb/ibmcam.txt +++ b/Documentation/usb/ibmcam.txt @@ -10,7 +10,12 @@ which was produced by standard Windows driver (c-it98.sys). I did not have any input from Xirlink. Some people asked about data sheets, but nothing came out of that. I didn't try. -Video formats: 128x96, 176x144, 352x288 +Video formats: + 128x96 [model 1] + 176x144 + 320x240 [model 2] + 352x240 [model 2] + 352x288 Frame rate: 3 - 30 frames per second (FPS) External interface: USB Internal interface: Video For Linux (V4L) @@ -28,11 +33,11 @@ or http://www.c-itnow.com/ for details and pictures. The Linux driver was developed with camera with following model number (or FCC ID): KSX-XVP510. This camera has three -interfaces, each with one endpoint (control, iso, iso). +interfaces, each with one endpoint (control, iso, iso). This +type of cameras is referred to as "model 1". It appears that Xirlink made some changes in their cameras recently. -In particular, following models [FCC ID] are suspect; one with -with FCC ID KSX-X9903 is known to be one of them: +In particular, following models [FCC ID] belong to that category: XVP300 [KSX-X9903] XVP600 [KSX-X9902] @@ -41,12 +46,57 @@ XVP610 [KSX-X9902] (see http://www.xirlink.com/ibmpccamera/ for updates, they refer to these new cameras by Windows driver dated 12-27-99, v3005 BETA) These cameras have two interfaces, one endpoint in each (iso, bulk). -Attempts to remotely debug one of these cameras weren't successful. -I'd need to have a camera to figure out how to use it. +Such type of cameras is referred to as "model 2". They are supported. + +Quirks of Model 2 cameras: +------------------------- + +These cameras apparently produce only 176x144 native video stream; +the 352x288 formats are produced from 176x144 RGB stream. In fact, +Xirlink broke perfectly good Model 1 (which used I420 on all sizes) +and instead switched to color-separated RGB which is a terrible waste +of bandwidth and resolution. However it probably allowed to simplify +the camera and use less RAM. Model 2 camera works visibly worse than +model 1 even using Xirlink's own driver on Windows. The image quality +is better on Linux than on Windows, partly thanks to _absence_ of +annoying automatic color corrections which Windows driver feeds into +the camera several times per second. + +Model 2 does not have hardware contrast control. Corresponding V4L +control is not used at the moment. It may be possible to implement +contrast control in software, at cost of extra processor cycles. + +The bandwidth demand imposed by RGB quasi-352x288 mode (800 Kbits per +frame) essentially limits this mode to 10 frames per second or less, in +ideal conditions on the bus (USB is shared, after all). The frame rate +has to be programmed very conservatively. Additional concern is that +frame rate depends on brightness setting; therefore the picture can +be good at one brightness and broken at another! I did not want to fix +the frame rate at slowest setting, but I had to move it pretty much down +the scale (so that framerate option barely matters). I also noticed that +camera after first powering up produces frames slightly faster than during +consecutive uses. All this means that if you use videosize=2 (which is +default), be warned - you may encounter broken picture on first connect; +try to adjust brightness - brighter image is slower, so USB will be able +to send all data. However if you regularly use Model 2 cameras you may +prefer videosize=1 which makes perfectly good I420, with no scaling and +lesser demands on USB (300 Kbits per second, or 26 frames per second). +Remember that model 2 cameras never produce images with resolution +better than "true" 176x144 - or so it seems. + +The camera that I had also has a hardware quirk: if disconnected, +it needs few minutes to "relax" before it can be plugged in again +(poorly designed USB processor reset circuit?) + +Finally, to say something good about Model 2: it is much simpler to program +than Model 1. Commands are few, and they all are straightforward. This camera +can be programmed for very high sensitivity (starlight may be enough), this +makes it convenient for tinkering with. The driver code has enough comments +to help a programmer to tweak the camera as s/he feels necessary. WHAT YOU NEED: -- A supported IBM PC (C-it) camera (see above) +- A supported IBM PC (C-it) camera (model 1 or 2) - A Linux box with USB support (2.3/2.4 or 2.2 w/backport) @@ -85,7 +135,7 @@ Module can be inserted with camera connected or disconnected. The driver can have options, though some defaults are provided. -Driver options: +Driver options: (* indicates that option is model-dependent) Name Type Range [default] Example -------------- -------------- -------------- ------------------ @@ -97,9 +147,18 @@ init_brightness Integer 0-255 [128] init_brightness=100 init_contrast Integer 0-255 [192] init_contrast=200 init_color Integer 0-255 [128] init_color=130 init_hue Integer 0-255 [128] init_hue=115 -lighting Integer 0-2 [1] lighting=2 -sharpness Integer 0-6 [4] sharpness=3 -videosize Integer 0-2 [2] videosize=1 +lighting Integer 0-2* [1] lighting=2 +sharpness Integer 0-6* [4] sharpness=3 +videosize Integer 0-2* [2] videosize=1 + +Options for Model 2 only: + +Name Type Range [default] Example +-------------- -------------- -------------- ------------------ +init_model2_rg Integer 0..255 [0x70] init_model2_rg=128 +init_model2_rg2 Integer 0..255 [0x2f] init_model2_rg2=50 +init_model2_sat Integer 0..255 [0x34] init_model2_sat=65 +init_model2_yb Integer 0..255 [0xa0] init_model2_yb=200 debug You don't need this option unless you are a developer. If you are a developer then you will see in the code @@ -145,49 +204,80 @@ init_hue controls will be used too. These options allow you to preconfigure the camera when it gets connected, before any V4L application connects to it. Good for webcams. +init_model2_rg These initial settings alter color balance of the +init_model2_rg2 camera on hardware level. All four settings may be used +init_model2_sat to tune the camera to specific lighting conditions. These +init_model2_yb settings only apply to Model 2 cameras. + lighting This option selects one of three hardware-defined photosensitivity settings of the camera. 0=bright light, 1=Medium (default), 2=Low light. This setting affects frame rate: the dimmer the lighting the lower the frame - rate (because longer exposition time is needed). + rate (because longer exposition time is needed). The + Model 2 cameras allow values more than 2 for this option, + thus enabling extremely high sensitivity at cost of frame + rate, color saturation and imaging sensor noise. sharpness This option controls smoothing (noise reduction) made by camera. Setting 0 is most smooth, setting 6 is most sharp. Be aware that CMOS sensor used in the camera is pretty noisy, so if you choose 6 you will - be greeted with "snowy" image. Default is 4. + be greeted with "snowy" image. Default is 4. Model 2 + cameras do not support this feature. videosize This setting chooses one if three image sizes that are supported by this driver. Camera supports more, but it's difficult to reverse-engineer all formats. Following video sizes are supported: - videosize=0 128x96 + videosize=0 128x96 (Model 1 only) videosize=1 176x144 videosize=2 352x288 + videosize=3 320x240 (Model 2 only) + videosize=4 352x240 (Model 2 only) The last one (352x288) is the native size of the sensor - array, so it's the best resolution camera can yield. + array, so it's the best resolution camera (Model 1) can + yield. The best resolution of Model 2 is 176x144, and + larger images are produced by stretching the bitmap. Choose the image size you need. The smaller image can support faster frame rate. Default is 352x288. WHAT NEEDS TO BE DONE: - The box freezes if camera is unplugged after being used (OHCI). - Workaround: don't do that :) -- Some USB frames are lost on high frame rates, though they shouldn't -- ViCE compression (Xirlink proprietary) may improve frame rate -- On occasion camera does not start properly; xawtv reports errors. - Workaround: reload the driver module. Reason: [1]. -- On occasion camera produces negative image (funny colors.) + Workaround: remove usb-ohci module first. +- On occasion camera (model 1) does not start properly (xawtv reports + errors), or camera produces negative image (funny colors.) Workaround: reload the driver module. Reason: [1]. - The button on the camera is not used. I don't know how to get to it. + I know now how to read button on Model 2, but what to do with it? [1] - Camera reports its status back to the driver; however I don't know what returned data means. If camera fails at some initialization stage then something should be done, and I don't do that because - I don't even know that some command failed. + I don't even know that some command failed. This is mostly Model 1 + concern because Model 2 uses different commands which do not return + status (and seem to complete successfully every time). + +VIDEO SIZE AND IMAGE SIZE + +Camera produces picture X by Y pixels. This is camera-specific and can be +altered by programming the camera accordingly. This image is placed onto +larger (or equal) area W by H, this is V4L image. At this time the driver +uses V4L image size (W by H) 352x288 pixels because many programs (such +as xawtv) expect quite specific sizes and don't want to deal with arbitrary, +camera-specific sizes. However this approach "hides" real image size, and +application always sees the camera as producing only 352x288 image. It is +possible to change the V4L image size to 128x96, and then if camera is +switched to 128x96 mode then xawtv will correctly accept this image size. But +many other popular sizes (such as 176x144) will not be welcomed. This is the +reason why all camera images are at this time placed onto 352x288 "canvas", +and size of that canvas (V4L) is reported to applications. It will be easy +to add options to control the canvas size, but it will be application- +specific because not all applications are ready to work with variety of +camera-specific sizes. CREDITS: diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile index 383728856d79..309a308a44c7 100644 --- a/arch/alpha/kernel/Makefile +++ b/arch/alpha/kernel/Makefile @@ -13,10 +13,21 @@ $(CC) -D__ASSEMBLY__ $(AFLAGS) -c -o $*.o $< O_TARGET := kernel.o -O_OBJS := entry.o traps.o process.o osf_sys.o irq.o signal.o setup.o \ - ptrace.o time.o semaphore.o i8259.o srm_irq.o alpha_irq.o +O_OBJS := entry.o traps.o process.o osf_sys.o irq.o irq_alpha.o \ + signal.o setup.o ptrace.o time.o semaphore.o OX_OBJS := alpha_ksyms.o +L_TARGET := rest.a +L_OBJS := irq_i8259.o irq_srm.o \ + es1888.o smc37c669.o smc37c93x.o ns87312.o + +ifdef CONFIG_SMP +O_OBJS += smp.o irq_smp.o +endif + +ifdef CONFIG_PCI +L_OBJS += pci.o pci_iommu.o +endif ifdef CONFIG_ALPHA_GENERIC @@ -25,13 +36,9 @@ O_OBJS += core_apecs.o core_cia.o core_irongate.o core_lca.o core_mcpcia.o \ sys_alcor.o sys_cabriolet.o sys_dp264.o sys_eb64p.o sys_eiger.o \ sys_jensen.o sys_miata.o sys_mikasa.o sys_nautilus.o \ sys_noritake.o sys_rawhide.o sys_ruffian.o sys_rx164.o \ - sys_sable.o sys_sio.o sys_sx164.o sys_takara.o sys_rx164.o \ - es1888.o smc37c669.o smc37c93x.o ns87312.o pci.o pci_iommu.o -else + sys_sable.o sys_sio.o sys_sx164.o sys_takara.o sys_rx164.o -ifdef CONFIG_PCI -O_OBJS += pci.o pci_iommu.o -endif +else # Core logic support ifdef CONFIG_ALPHA_APECS @@ -67,10 +74,10 @@ ifneq ($(CONFIG_ALPHA_ALCOR)$(CONFIG_ALPHA_XLT),) O_OBJS += sys_alcor.o endif ifneq ($(CONFIG_ALPHA_CABRIOLET)$(CONFIG_ALPHA_EB164)$(CONFIG_ALPHA_EB66P)$(CONFIG_ALPHA_LX164)$(CONFIG_ALPHA_PC164),) -O_OBJS += sys_cabriolet.o ns87312.o +O_OBJS += sys_cabriolet.o endif ifdef CONFIG_ALPHA_DP264 -O_OBJS += sys_dp264.o es1888.o smc37c669.o +O_OBJS += sys_dp264.o endif ifneq ($(CONFIG_ALPHA_EB64P)$(CONFIG_ALPHA_EB66),) O_OBJS += sys_eb64p.o @@ -82,7 +89,7 @@ ifdef CONFIG_ALPHA_JENSEN O_OBJS += sys_jensen.o endif ifdef CONFIG_ALPHA_MIATA -O_OBJS += sys_miata.o es1888.o smc37c669.o +O_OBJS += sys_miata.o endif ifdef CONFIG_ALPHA_MIKASA O_OBJS += sys_mikasa.o @@ -106,25 +113,18 @@ ifdef CONFIG_ALPHA_SABLE O_OBJS += sys_sable.o endif ifneq ($(CONFIG_ALPHA_BOOK1)$(CONFIG_ALPHA_AVANTI)$(CONFIG_ALPHA_NONAME)$(CONFIG_ALPHA_P2K)$(CONFIG_ALPHA_XL),) -O_OBJS += sys_sio.o ns87312.o +O_OBJS += sys_sio.o endif ifdef CONFIG_ALPHA_SX164 -O_OBJS += sys_sx164.o smc37c669.o +O_OBJS += sys_sx164.o endif ifdef CONFIG_ALPHA_TAKARA -O_OBJS += sys_takara.o ns87312.o -endif - -# Device support -ifneq ($(CONFIG_ALPHA_PC164)$(CONFIG_ALPHA_LX164),) -O_OBJS += smc37c93x.o +O_OBJS += sys_takara.o endif endif # GENERIC -ifdef CONFIG_SMP -O_OBJS += smp.o -endif +O_OBJS += $(L_TARGET) all: kernel.o head.o diff --git a/arch/alpha/kernel/core_pyxis.c b/arch/alpha/kernel/core_pyxis.c index fa0f98f2c224..d5a7d882d9cc 100644 --- a/arch/alpha/kernel/core_pyxis.c +++ b/arch/alpha/kernel/core_pyxis.c @@ -389,7 +389,7 @@ init_pyxis_irqs(unsigned long ignore_mask) for (i = 16; i < 48; ++i) { if ((ignore_mask >> i) & 1) continue; - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &pyxis_irq_type; } @@ -560,6 +560,7 @@ pyxis_init_arch(void) pyxis_enable_broken_tbi(hose->sg_pci); alpha_mv.mv_pci_tbi(hose, 0, -1); +alpha_mv.mv_pci_tbi = 0; /* * Next, clear the PYXIS_CFG register, which gets used diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c index 04d5ea40c3b3..bc8ca101a702 100644 --- a/arch/alpha/kernel/irq.c +++ b/arch/alpha/kernel/irq.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -33,12 +32,13 @@ /* * Controller mappings for all interrupt sources: */ -irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = - { [0 ... NR_IRQS-1] = { 0, &no_irq_type, NULL, 0, SPIN_LOCK_UNLOCKED}}; +irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = { + [0 ... NR_IRQS-1] = { 0, &no_irq_type, NULL, 0, SPIN_LOCK_UNLOCKED} +}; -static void register_irq_proc (unsigned int irq); +static void register_irq_proc(unsigned int irq); -volatile unsigned long irq_err_count; +unsigned long irq_err_count; /* * Special irq handlers. @@ -50,30 +50,29 @@ void no_action(int cpl, void *dev_id, struct pt_regs *regs) { } * Generic no controller code */ -static void enable_none(unsigned int irq) { } -static unsigned int startup_none(unsigned int irq) { return 0; } -static void disable_none(unsigned int irq) { } -static void ack_none(unsigned int irq) +static void no_irq_enable_disable(unsigned int irq) { } +static unsigned int no_irq_startup(unsigned int irq) { return 0; } + +static void +no_irq_ack(unsigned int irq) { irq_err_count++; - printk("unexpected IRQ trap at vector %02x\n", irq); + printk(KERN_CRIT "Unexpected IRQ trap at vector %u\n", irq); } -/* startup is the same as "enable", shutdown is same as "disable" */ -#define shutdown_none disable_none -#define end_none enable_none - struct hw_interrupt_type no_irq_type = { - "none", - startup_none, - shutdown_none, - enable_none, - disable_none, - ack_none, - end_none, + typename: "none", + startup: no_irq_startup, + shutdown: no_irq_enable_disable, + enable: no_irq_enable_disable, + disable: no_irq_enable_disable, + ack: no_irq_ack, + end: no_irq_enable_disable, }; -int handle_IRQ_event(unsigned int irq, struct pt_regs * regs, struct irqaction * action) +int +handle_IRQ_event(unsigned int irq, struct pt_regs *regs, + struct irqaction *action) { int status; int cpu = smp_processor_id(); @@ -232,7 +231,8 @@ static unsigned long irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = ~0UL }; #define HEX_DIGITS 16 -static int irq_affinity_read_proc (char *page, char **start, off_t off, +static int +irq_affinity_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { if (count < HEX_DIGITS+1) @@ -240,8 +240,9 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off, return sprintf (page, "%016lx\n", irq_affinity[(long)data]); } -static unsigned int parse_hex_value (const char *buffer, - unsigned long count, unsigned long *ret) +static unsigned int +parse_hex_value (const char *buffer, + unsigned long count, unsigned long *ret) { unsigned char hexnum [HEX_DIGITS]; unsigned long value; @@ -277,8 +278,9 @@ out: return 0; } -static int irq_affinity_write_proc (struct file *file, const char *buffer, - unsigned long count, void *data) +static int +irq_affinity_write_proc(struct file *file, const char *buffer, + unsigned long count, void *data) { int irq = (long) data, full_count = count, err; unsigned long new_value; @@ -304,7 +306,8 @@ static int irq_affinity_write_proc (struct file *file, const char *buffer, return full_count; } -static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, +static int +prof_cpu_mask_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) { unsigned long *mask = (unsigned long *) data; @@ -313,8 +316,9 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off, return sprintf (page, "%08lx\n", *mask); } -static int prof_cpu_mask_write_proc (struct file *file, const char *buffer, - unsigned long count, void *data) +static int +prof_cpu_mask_write_proc(struct file *file, const char *buffer, + unsigned long count, void *data) { unsigned long *mask = (unsigned long *) data, full_count = count, err; unsigned long new_value; @@ -329,7 +333,8 @@ static int prof_cpu_mask_write_proc (struct file *file, const char *buffer, #define MAX_NAMELEN 10 -static void register_irq_proc (unsigned int irq) +static void +register_irq_proc (unsigned int irq) { struct proc_dir_entry *entry; char name [MAX_NAMELEN]; @@ -356,7 +361,8 @@ static void register_irq_proc (unsigned int irq) unsigned long prof_cpu_mask = ~0UL; -void init_irq_proc (void) +void +init_irq_proc (void) { struct proc_dir_entry *entry; int i; @@ -472,7 +478,8 @@ free_irq(unsigned int irq, void *dev_id) } } -int get_irq_list(char *buf) +int +get_irq_list(char *buf) { int i, j; struct irqaction * action; @@ -525,241 +532,6 @@ int get_irq_list(char *buf) return p - buf; } -#ifdef CONFIG_SMP -/* Who has global_irq_lock. */ -int global_irq_holder = NO_PROC_ID; - -/* This protects IRQ's. */ -spinlock_t global_irq_lock = SPIN_LOCK_UNLOCKED; - -/* Global IRQ locking depth. */ -static void *previous_irqholder = NULL; - -#define MAXCOUNT 100000000 - -static void show(char * str, void *where); - -static inline void -wait_on_irq(int cpu, void *where) -{ - int count = MAXCOUNT; - - for (;;) { - - /* - * Wait until all interrupts are gone. Wait - * for bottom half handlers unless we're - * already executing in one.. - */ - if (!irqs_running()) { - if (local_bh_count(cpu) - || !spin_is_locked(&global_bh_lock)) - break; - } - - /* Duh, we have to loop. Release the lock to avoid deadlocks */ - spin_unlock(&global_irq_lock); - - for (;;) { - if (!--count) { - show("wait_on_irq", where); - count = MAXCOUNT; - } - __sti(); - udelay(1); /* make sure to run pending irqs */ - __cli(); - - if (irqs_running()) - continue; - if (spin_is_locked(&global_irq_lock)) - continue; - if (!local_bh_count(cpu) - && spin_is_locked(&global_bh_lock)) - continue; - if (spin_trylock(&global_irq_lock)) - break; - } - } -} - -static inline void -get_irqlock(int cpu, void* where) -{ - if (!spin_trylock(&global_irq_lock)) { - /* Do we already hold the lock? */ - if (cpu == global_irq_holder) - return; - /* Uhhuh.. Somebody else got it. Wait. */ - spin_lock(&global_irq_lock); - } - - /* - * Ok, we got the lock bit. - * But that's actually just the easy part.. Now - * we need to make sure that nobody else is running - * in an interrupt context. - */ - wait_on_irq(cpu, where); - - /* - * Finally. - */ -#if DEBUG_SPINLOCK - global_irq_lock.task = current; - global_irq_lock.previous = where; -#endif - global_irq_holder = cpu; - previous_irqholder = where; -} - -void -__global_cli(void) -{ - int cpu = smp_processor_id(); - void *where = __builtin_return_address(0); - - /* - * Maximize ipl. If ipl was previously 0 and if this thread - * is not in an irq, then take global_irq_lock. - */ - if (swpipl(IPL_MAX) == IPL_MIN && !local_irq_count(cpu)) - get_irqlock(cpu, where); -} - -void -__global_sti(void) -{ - int cpu = smp_processor_id(); - - if (!local_irq_count(cpu)) - release_irqlock(cpu); - __sti(); -} - -/* - * SMP flags value to restore to: - * 0 - global cli - * 1 - global sti - * 2 - local cli - * 3 - local sti - */ -unsigned long -__global_save_flags(void) -{ - int retval; - int local_enabled; - unsigned long flags; - int cpu = smp_processor_id(); - - __save_flags(flags); - local_enabled = (!(flags & 7)); - /* default to local */ - retval = 2 + local_enabled; - - /* Check for global flags if we're not in an interrupt. */ - if (!local_irq_count(cpu)) { - if (local_enabled) - retval = 1; - if (global_irq_holder == cpu) - retval = 0; - } - return retval; -} - -void -__global_restore_flags(unsigned long flags) -{ - switch (flags) { - case 0: - __global_cli(); - break; - case 1: - __global_sti(); - break; - case 2: - __cli(); - break; - case 3: - __sti(); - break; - default: - printk(KERN_ERR "global_restore_flags: %08lx (%p)\n", - flags, __builtin_return_address(0)); - } -} - -static void -show(char * str, void *where) -{ -#if 0 - int i; - unsigned long *stack; -#endif - int cpu = smp_processor_id(); - - printk("\n%s, CPU %d: %p\n", str, cpu, where); - printk("irq: %d [%d %d]\n", - irqs_running(), - cpu_data[0].irq_count, - cpu_data[1].irq_count); - - printk("bh: %d [%d %d]\n", - spin_is_locked(&global_bh_lock) ? 1 : 0, - cpu_data[0].bh_count, - cpu_data[1].bh_count); -#if 0 - stack = (unsigned long *) &str; - for (i = 40; i ; i--) { - unsigned long x = *++stack; - if (x > (unsigned long) &init_task_union && - x < (unsigned long) &vsprintf) { - printk("<[%08lx]> ", x); - } - } -#endif -} - -/* - * From its use, I infer that synchronize_irq() stalls a thread until - * the effects of a command to an external device are known to have - * taken hold. Typically, the command is to stop sending interrupts. - * The strategy here is wait until there is at most one processor - * (this one) in an irq. The memory barrier serializes the write to - * the device and the subsequent accesses of global_irq_count. - * --jmartin - */ -#define DEBUG_SYNCHRONIZE_IRQ 0 - -void -synchronize_irq(void) -{ -#if 0 - /* Joe's version. */ - int cpu = smp_processor_id(); - int local_count; - int global_count; - int countdown = 1<<24; - void *where = __builtin_return_address(0); - - mb(); - do { - local_count = local_irq_count(cpu); - global_count = atomic_read(&global_irq_count); - if (DEBUG_SYNCHRONIZE_IRQ && (--countdown == 0)) { - printk("%d:%d/%d\n", cpu, local_count, global_count); - show("synchronize_irq", where); - break; - } - } while (global_count != local_count); -#else - /* Jay's version. */ - if (irqs_running()) { - cli(); - sti(); - } -#endif -} -#endif /* CONFIG_SMP */ /* * do_IRQ handles all normal device IRQ's (the special @@ -933,7 +705,8 @@ probe_irq_on(void) * Return a mask of triggered interrupts (this * can handle only legacy ISA interrupts). */ -unsigned int probe_irq_mask(unsigned long val) +unsigned int +probe_irq_mask(unsigned long val) { int i; unsigned int mask; diff --git a/arch/alpha/kernel/alpha_irq.c b/arch/alpha/kernel/irq_alpha.c similarity index 69% rename from arch/alpha/kernel/alpha_irq.c rename to arch/alpha/kernel/irq_alpha.c index 70bacda625bf..65a140bff84e 100644 --- a/arch/alpha/kernel/alpha_irq.c +++ b/arch/alpha/kernel/irq_alpha.c @@ -38,82 +38,6 @@ dummy_perf(unsigned long vector, struct pt_regs *regs) void (*perf_irq)(unsigned long, struct pt_regs *) = dummy_perf; -/* - * Dispatch device interrupts. - */ - -/* Handle ISA interrupt via the PICs. */ - -#if defined(CONFIG_ALPHA_GENERIC) -# define IACK_SC alpha_mv.iack_sc -#elif defined(CONFIG_ALPHA_APECS) -# define IACK_SC APECS_IACK_SC -#elif defined(CONFIG_ALPHA_LCA) -# define IACK_SC LCA_IACK_SC -#elif defined(CONFIG_ALPHA_CIA) -# define IACK_SC CIA_IACK_SC -#elif defined(CONFIG_ALPHA_PYXIS) -# define IACK_SC PYXIS_IACK_SC -#elif defined(CONFIG_ALPHA_TSUNAMI) -# define IACK_SC TSUNAMI_IACK_SC -#elif defined(CONFIG_ALPHA_POLARIS) -# define IACK_SC POLARIS_IACK_SC -#elif defined(CONFIG_ALPHA_IRONGATE) -# define IACK_SC IRONGATE_IACK_SC -#endif - -#if defined(IACK_SC) -void -isa_device_interrupt(unsigned long vector, struct pt_regs *regs) -{ - /* - * Generate a PCI interrupt acknowledge cycle. The PIC will - * respond with the interrupt vector of the highest priority - * interrupt that is pending. The PALcode sets up the - * interrupts vectors such that irq level L generates vector L. - */ - int j = *(vuip) IACK_SC; - j &= 0xff; - if (j == 7) { - if (!(inb(0x20) & 0x80)) { - /* It's only a passive release... */ - return; - } - } - handle_irq(j, regs); -} -#endif - -#if defined(CONFIG_ALPHA_GENERIC) || !defined(IACK_SC) -void -isa_no_iack_sc_device_interrupt(unsigned long vector, struct pt_regs *regs) -{ - unsigned long pic; - - /* - * It seems to me that the probability of two or more *device* - * interrupts occurring at almost exactly the same time is - * pretty low. So why pay the price of checking for - * additional interrupts here if the common case can be - * handled so much easier? - */ - /* - * The first read of gives you *all* interrupting lines. - * Therefore, read the mask register and and out those lines - * not enabled. Note that some documentation has 21 and a1 - * write only. This is not true. - */ - pic = inb(0x20) | (inb(0xA0) << 8); /* read isr */ - pic &= 0xFFFB; /* mask out cascade & hibits */ - - while (pic) { - int j = ffz(~pic); - pic &= pic - 1; - handle_irq(j, regs); - } -} -#endif - /* * The main interrupt entry point. */ @@ -274,35 +198,39 @@ process_mcheck_info(unsigned long vector, unsigned long la_ptr, #endif } -/* RTC */ -static void enable_rtc(unsigned int irq) { } -static unsigned int startup_rtc(unsigned int irq) { return 0; } -#define shutdown_rtc enable_rtc -#define end_rtc enable_rtc -#define ack_rtc enable_rtc -#define disable_rtc enable_rtc +/* + * The special RTC interrupt type. The interrupt itself was + * processed by PALcode, and comes in via entInt vector 1. + */ + +static void rtc_enable_disable(unsigned int irq) { } +static unsigned int rtc_startup(unsigned int irq) { return 0; } -struct irqaction timer_irqaction = { timer_interrupt, - SA_INTERRUPT, 0, "timer", - NULL, NULL}; +struct irqaction timer_irqaction = { + handler: timer_interrupt, + flags: SA_INTERRUPT, + name: "timer", +}; + +static struct hw_interrupt_type rtc_irq_type = { + typename: "RTC", + startup: rtc_startup, + shutdown: rtc_enable_disable, + enable: rtc_enable_disable, + disable: rtc_enable_disable, + ack: rtc_enable_disable, + end: rtc_enable_disable, +}; void __init init_rtc_irq(void) { - static struct hw_interrupt_type rtc_irq_type = { "RTC", - startup_rtc, - shutdown_rtc, - enable_rtc, - disable_rtc, - ack_rtc, - end_rtc }; irq_desc[RTC_IRQ].status = IRQ_DISABLED; irq_desc[RTC_IRQ].handler = &rtc_irq_type; - setup_irq(RTC_IRQ, &timer_irqaction); } -/* dummy irqactions */ +/* Dummy irqactions. */ struct irqaction isa_cascade_irqaction = { handler: no_action, name: "isa-cascade" diff --git a/arch/alpha/kernel/i8259.c b/arch/alpha/kernel/irq_i8259.c similarity index 54% rename from arch/alpha/kernel/i8259.c rename to arch/alpha/kernel/irq_i8259.c index 05326124b720..ea28c1316447 100644 --- a/arch/alpha/kernel/i8259.c +++ b/arch/alpha/kernel/irq_i8259.c @@ -1,5 +1,5 @@ /* - * linux/arch/alpha/kernel/i8259.c + * linux/arch/alpha/kernel/irq_i8259.c * * This is the 'legacy' 8259A Programmable Interrupt Controller, * present in the majority of PC/AT boxes. @@ -113,3 +113,74 @@ init_i8259a_irqs(void) setup_irq(2, &cascade); } + + +#if defined(CONFIG_ALPHA_GENERIC) +# define IACK_SC alpha_mv.iack_sc +#elif defined(CONFIG_ALPHA_APECS) +# define IACK_SC APECS_IACK_SC +#elif defined(CONFIG_ALPHA_LCA) +# define IACK_SC LCA_IACK_SC +#elif defined(CONFIG_ALPHA_CIA) +# define IACK_SC CIA_IACK_SC +#elif defined(CONFIG_ALPHA_PYXIS) +# define IACK_SC PYXIS_IACK_SC +#elif defined(CONFIG_ALPHA_TSUNAMI) +# define IACK_SC TSUNAMI_IACK_SC +#elif defined(CONFIG_ALPHA_POLARIS) +# define IACK_SC POLARIS_IACK_SC +#elif defined(CONFIG_ALPHA_IRONGATE) +# define IACK_SC IRONGATE_IACK_SC +#endif + +#if defined(IACK_SC) +void +isa_device_interrupt(unsigned long vector, struct pt_regs *regs) +{ + /* + * Generate a PCI interrupt acknowledge cycle. The PIC will + * respond with the interrupt vector of the highest priority + * interrupt that is pending. The PALcode sets up the + * interrupts vectors such that irq level L generates vector L. + */ + int j = *(vuip) IACK_SC; + j &= 0xff; + if (j == 7) { + if (!(inb(0x20) & 0x80)) { + /* It's only a passive release... */ + return; + } + } + handle_irq(j, regs); +} +#endif + +#if defined(CONFIG_ALPHA_GENERIC) || !defined(IACK_SC) +void +isa_no_iack_sc_device_interrupt(unsigned long vector, struct pt_regs *regs) +{ + unsigned long pic; + + /* + * It seems to me that the probability of two or more *device* + * interrupts occurring at almost exactly the same time is + * pretty low. So why pay the price of checking for + * additional interrupts here if the common case can be + * handled so much easier? + */ + /* + * The first read of gives you *all* interrupting lines. + * Therefore, read the mask register and and out those lines + * not enabled. Note that some documentation has 21 and a1 + * write only. This is not true. + */ + pic = inb(0x20) | (inb(0xA0) << 8); /* read isr */ + pic &= 0xFFFB; /* mask out cascade & hibits */ + + while (pic) { + int j = ffz(~pic); + pic &= pic - 1; + handle_irq(j, regs); + } +} +#endif diff --git a/arch/alpha/kernel/irq_smp.c b/arch/alpha/kernel/irq_smp.c new file mode 100644 index 000000000000..90a3c30b2895 --- /dev/null +++ b/arch/alpha/kernel/irq_smp.c @@ -0,0 +1,250 @@ +/* + * linux/arch/alpha/kernel/irq_smp.c + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +/* Who has global_irq_lock. */ +int global_irq_holder = NO_PROC_ID; + +/* This protects IRQ's. */ +spinlock_t global_irq_lock = SPIN_LOCK_UNLOCKED; + +/* Global IRQ locking depth. */ +static void *previous_irqholder = NULL; + +#define MAXCOUNT 100000000 + + +static void +show(char * str, void *where) +{ +#if 0 + int i; + unsigned long *stack; +#endif + int cpu = smp_processor_id(); + + printk("\n%s, CPU %d: %p\n", str, cpu, where); + printk("irq: %d [%d %d]\n", + irqs_running(), + cpu_data[0].irq_count, + cpu_data[1].irq_count); + + printk("bh: %d [%d %d]\n", + spin_is_locked(&global_bh_lock) ? 1 : 0, + cpu_data[0].bh_count, + cpu_data[1].bh_count); +#if 0 + stack = (unsigned long *) &str; + for (i = 40; i ; i--) { + unsigned long x = *++stack; + if (x > (unsigned long) &init_task_union && + x < (unsigned long) &vsprintf) { + printk("<[%08lx]> ", x); + } + } +#endif +} + +static inline void +wait_on_irq(int cpu, void *where) +{ + int count = MAXCOUNT; + + for (;;) { + + /* + * Wait until all interrupts are gone. Wait + * for bottom half handlers unless we're + * already executing in one.. + */ + if (!irqs_running()) { + if (local_bh_count(cpu) + || !spin_is_locked(&global_bh_lock)) + break; + } + + /* Duh, we have to loop. Release the lock to avoid deadlocks */ + spin_unlock(&global_irq_lock); + + for (;;) { + if (!--count) { + show("wait_on_irq", where); + count = MAXCOUNT; + } + __sti(); + udelay(1); /* make sure to run pending irqs */ + __cli(); + + if (irqs_running()) + continue; + if (spin_is_locked(&global_irq_lock)) + continue; + if (!local_bh_count(cpu) + && spin_is_locked(&global_bh_lock)) + continue; + if (spin_trylock(&global_irq_lock)) + break; + } + } +} + +static inline void +get_irqlock(int cpu, void* where) +{ + if (!spin_trylock(&global_irq_lock)) { + /* Do we already hold the lock? */ + if (cpu == global_irq_holder) + return; + /* Uhhuh.. Somebody else got it. Wait. */ + spin_lock(&global_irq_lock); + } + + /* + * Ok, we got the lock bit. + * But that's actually just the easy part.. Now + * we need to make sure that nobody else is running + * in an interrupt context. + */ + wait_on_irq(cpu, where); + + /* + * Finally. + */ +#if DEBUG_SPINLOCK + global_irq_lock.task = current; + global_irq_lock.previous = where; +#endif + global_irq_holder = cpu; + previous_irqholder = where; +} + +void +__global_cli(void) +{ + int cpu = smp_processor_id(); + void *where = __builtin_return_address(0); + + /* + * Maximize ipl. If ipl was previously 0 and if this thread + * is not in an irq, then take global_irq_lock. + */ + if (swpipl(IPL_MAX) == IPL_MIN && !local_irq_count(cpu)) + get_irqlock(cpu, where); +} + +void +__global_sti(void) +{ + int cpu = smp_processor_id(); + + if (!local_irq_count(cpu)) + release_irqlock(cpu); + __sti(); +} + +/* + * SMP flags value to restore to: + * 0 - global cli + * 1 - global sti + * 2 - local cli + * 3 - local sti + */ +unsigned long +__global_save_flags(void) +{ + int retval; + int local_enabled; + unsigned long flags; + int cpu = smp_processor_id(); + + __save_flags(flags); + local_enabled = (!(flags & 7)); + /* default to local */ + retval = 2 + local_enabled; + + /* Check for global flags if we're not in an interrupt. */ + if (!local_irq_count(cpu)) { + if (local_enabled) + retval = 1; + if (global_irq_holder == cpu) + retval = 0; + } + return retval; +} + +void +__global_restore_flags(unsigned long flags) +{ + switch (flags) { + case 0: + __global_cli(); + break; + case 1: + __global_sti(); + break; + case 2: + __cli(); + break; + case 3: + __sti(); + break; + default: + printk(KERN_ERR "global_restore_flags: %08lx (%p)\n", + flags, __builtin_return_address(0)); + } +} + +/* + * From its use, I infer that synchronize_irq() stalls a thread until + * the effects of a command to an external device are known to have + * taken hold. Typically, the command is to stop sending interrupts. + * The strategy here is wait until there is at most one processor + * (this one) in an irq. The memory barrier serializes the write to + * the device and the subsequent accesses of global_irq_count. + * --jmartin + */ +#define DEBUG_SYNCHRONIZE_IRQ 0 + +void +synchronize_irq(void) +{ +#if 0 + /* Joe's version. */ + int cpu = smp_processor_id(); + int local_count; + int global_count; + int countdown = 1<<24; + void *where = __builtin_return_address(0); + + mb(); + do { + local_count = local_irq_count(cpu); + global_count = atomic_read(&global_irq_count); + if (DEBUG_SYNCHRONIZE_IRQ && (--countdown == 0)) { + printk("%d:%d/%d\n", cpu, local_count, global_count); + show("synchronize_irq", where); + break; + } + } while (global_count != local_count); +#else + /* Jay's version. */ + if (irqs_running()) { + cli(); + sti(); + } +#endif +} diff --git a/arch/alpha/kernel/srm_irq.c b/arch/alpha/kernel/irq_srm.c similarity index 97% rename from arch/alpha/kernel/srm_irq.c rename to arch/alpha/kernel/irq_srm.c index 46e2e72cad43..8b14a59fe912 100644 --- a/arch/alpha/kernel/srm_irq.c +++ b/arch/alpha/kernel/irq_srm.c @@ -69,7 +69,7 @@ init_srm_irqs(long max, unsigned long ignore_mask) for (i = 16; i < max; ++i) { if (i < 64 && ((ignore_mask >> i) & 1)) continue; - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &srm_irq_type; } } diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c index cc5d8b16b870..ff12b9e8d960 100644 --- a/arch/alpha/kernel/signal.c +++ b/arch/alpha/kernel/signal.c @@ -437,6 +437,8 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, err |= __copy_to_user(frame->extramask, &set->sig[1], sizeof(frame->extramask)); } + if (err) + goto give_sigsegv; /* Set up to return from userspace. If provided, use a stub already in userspace. */ @@ -499,6 +501,8 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, sw, set->sig[0], oldsp); err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); + if (err) + goto give_sigsegv; /* Set up to return from userspace. If provided, use a stub already in userspace. */ diff --git a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c index 491831250694..867d762f84df 100644 --- a/arch/alpha/kernel/sys_alcor.c +++ b/arch/alpha/kernel/sys_alcor.c @@ -141,7 +141,7 @@ alcor_init_irq(void) on while IRQ probing. */ if (i >= 16+20 && i <= 16+30) continue; - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &alcor_irq_type; } i8259a_irq_type.ack = alcor_isa_mask_and_ack_irq; diff --git a/arch/alpha/kernel/sys_cabriolet.c b/arch/alpha/kernel/sys_cabriolet.c index 736e419c1509..8e016ada0fca 100644 --- a/arch/alpha/kernel/sys_cabriolet.c +++ b/arch/alpha/kernel/sys_cabriolet.c @@ -123,7 +123,7 @@ cabriolet_init_irq(void) outb(0xff, 0x806); for (i = 16; i < 35; ++i) { - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &cabriolet_irq_type; } } diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c index 7b4e3a4310eb..63abc109f671 100644 --- a/arch/alpha/kernel/sys_dp264.c +++ b/arch/alpha/kernel/sys_dp264.c @@ -51,16 +51,17 @@ tsunami_update_irq_hw(unsigned long mask, unsigned long isa_enable) volatile unsigned long *dim0, *dim1, *dim2, *dim3; unsigned long mask0, mask1, mask2, mask3, maskB, dummy; - mask0 = mask & cpu_irq_affinity[0]; - mask1 = mask & cpu_irq_affinity[1]; - mask2 = mask & cpu_irq_affinity[2]; - mask3 = mask & cpu_irq_affinity[3]; - + mask0 = mask1 = mask2 = mask3 = mask; maskB = mask | isa_enable; - if (bcpu == 0) mask0 = maskB & cpu_irq_affinity[0]; - else if (bcpu == 1) mask1 = maskB & cpu_irq_affinity[1]; - else if (bcpu == 2) mask2 = maskB & cpu_irq_affinity[2]; - else if (bcpu == 3) mask3 = maskB & cpu_irq_affinity[3]; + if (bcpu == 0) mask0 = maskB; + else if (bcpu == 1) mask1 = maskB; + else if (bcpu == 2) mask2 = maskB; + else if (bcpu == 3) mask3 = maskB; + + mask0 &= cpu_irq_affinity[0]; + mask1 &= cpu_irq_affinity[1]; + mask2 &= cpu_irq_affinity[2]; + mask3 &= cpu_irq_affinity[3]; dim0 = &cchip->dim0.csr; dim1 = &cchip->dim1.csr; @@ -105,7 +106,7 @@ clipper_update_irq_hw(unsigned long mask) tsunami_update_irq_hw(mask, 1UL << 55); } -static inline void +static void dp264_enable_irq(unsigned int irq) { spin_lock(&dp264_irq_lock); @@ -137,7 +138,7 @@ dp264_end_irq(unsigned int irq) dp264_enable_irq(irq); } -static inline void +static void clipper_enable_irq(unsigned int irq) { spin_lock(&dp264_irq_lock); @@ -175,10 +176,12 @@ cpu_set_irq_affinity(unsigned int irq, unsigned long affinity) int cpu; for (cpu = 0; cpu < 4; cpu++) { + unsigned long aff = cpu_irq_affinity[cpu]; if (affinity & (1UL << cpu)) - cpu_irq_affinity[cpu] |= 1UL << irq; + aff |= 1UL << irq; else - cpu_irq_affinity[cpu] &= ~(1UL << irq); + aff &= ~(1UL << irq); + cpu_irq_affinity[cpu] = aff; } } diff --git a/arch/alpha/kernel/sys_eb64p.c b/arch/alpha/kernel/sys_eb64p.c index 3b9703bf3935..b3e9e386748f 100644 --- a/arch/alpha/kernel/sys_eb64p.c +++ b/arch/alpha/kernel/sys_eb64p.c @@ -128,7 +128,7 @@ eb64p_init_irq(void) init_i8259a_irqs(); for (i = 16; i < 32; ++i) { - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &eb64p_irq_type; } diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c index c6a1c2b47af5..9e4fbe569237 100644 --- a/arch/alpha/kernel/sys_eiger.c +++ b/arch/alpha/kernel/sys_eiger.c @@ -156,7 +156,7 @@ eiger_init_irq(void) init_i8259a_irqs(); for (i = 16; i < 128; ++i) { - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &eiger_irq_type; } } diff --git a/arch/alpha/kernel/sys_mikasa.c b/arch/alpha/kernel/sys_mikasa.c index 4280d25cb3aa..a667311546e7 100644 --- a/arch/alpha/kernel/sys_mikasa.c +++ b/arch/alpha/kernel/sys_mikasa.c @@ -115,7 +115,7 @@ mikasa_init_irq(void) mikasa_update_irq_hw(0); for (i = 16; i < 32; ++i) { - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &mikasa_irq_type; } diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c index 219f080f0e73..523d298539ec 100644 --- a/arch/alpha/kernel/sys_noritake.c +++ b/arch/alpha/kernel/sys_noritake.c @@ -135,7 +135,7 @@ noritake_init_irq(void) outw(0, 0x54c); for (i = 16; i < 48; ++i) { - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &noritake_irq_type; } diff --git a/arch/alpha/kernel/sys_rawhide.c b/arch/alpha/kernel/sys_rawhide.c index a99a13f408ea..3ccce8640a26 100644 --- a/arch/alpha/kernel/sys_rawhide.c +++ b/arch/alpha/kernel/sys_rawhide.c @@ -150,7 +150,7 @@ rawhide_init_irq(void) } for (i = 16; i < 128; ++i) { - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &rawhide_irq_type; } diff --git a/arch/alpha/kernel/sys_rx164.c b/arch/alpha/kernel/sys_rx164.c index cdc5bee8a4d3..2d5927c84b14 100644 --- a/arch/alpha/kernel/sys_rx164.c +++ b/arch/alpha/kernel/sys_rx164.c @@ -116,7 +116,7 @@ rx164_init_irq(void) rx164_update_irq_hw(0); for (i = 16; i < 40; ++i) { - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &rx164_irq_type; } diff --git a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c index c1e5a2f89b1c..b27d757b2edb 100644 --- a/arch/alpha/kernel/sys_sable.c +++ b/arch/alpha/kernel/sys_sable.c @@ -30,7 +30,7 @@ #include "pci_impl.h" #include "machvec_impl.h" -spinlock_t sable_irq_lock = SPIN_LOCK_UNLOCKED: +spinlock_t sable_irq_lock = SPIN_LOCK_UNLOCKED; /* * For SABLE, which is really baroque, we manage 40 IRQ's, but the @@ -218,7 +218,7 @@ sable_init_irq(void) outb(0x44, 0x535); /* enable cascades in master */ for (i = 0; i < 40; ++i) { - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &sable_irq_type; } diff --git a/arch/alpha/kernel/sys_takara.c b/arch/alpha/kernel/sys_takara.c index 5954bc79ac2b..a0bc57125994 100644 --- a/arch/alpha/kernel/sys_takara.c +++ b/arch/alpha/kernel/sys_takara.c @@ -152,7 +152,7 @@ takara_init_irq(void) takara_update_irq_hw(i, -1); for (i = 16; i < 128; ++i) { - irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL; irq_desc[i].handler = &takara_irq_type; } diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index d2992a491851..d92f2b093fb8 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -46,13 +46,12 @@ endif ifeq ($(CONFIG_ARCH_SA1100),y) OBJS += head-sa1100.o -ifeq ($(CONFIG_SA1100_VICTOR),y) -ZTEXTADDR = 0x00002000 -ZBSSADDR = 0xc0100000 -else ZTEXTADDR = 0xc0008000 -endif ZRELADDR = 0xc0008000 +ifeq ($(CONFIG_SA1100_VICTOR),y) + ZTEXTADDR = 0x00002000 + ZBSSADDR = 0xc0100000 +endif endif # diff --git a/arch/arm/boot/compressed/head-sa1100.S b/arch/arm/boot/compressed/head-sa1100.S index 90018e52b802..4464157c3737 100644 --- a/arch/arm/boot/compressed/head-sa1100.S +++ b/arch/arm/boot/compressed/head-sa1100.S @@ -11,6 +11,8 @@ .section ".start", #alloc, #execinstr +__SA1100_start: + #ifndef CONFIG_ARCH_SA1100 #error What am I doing here... #endif @@ -58,6 +60,65 @@ orr r0, r0, #0x1000 @ set Icache mcr p15, 0, r0, c1, c0, 0 +#ifdef CONFIG_SA1100_BRUTUS + @ Initialize UART1 for early serial communication + @ since UART3 is used by angelboot. It is routed to + @ alternate GPIO functions on Brutus. + b 1f + +GPIO_BASE: .long 0x90040000 +#define GPDR 0x04 +#define GAFR 0x1c + +PPC_BASE: .long 0x90060000 +#define PPAR 0x08 + +UART1_BASE: .long 0x80010000 +#define UTCR0 0x00 +#define UTCR1 0x04 +#define UTCR2 0x08 +#define UTCR3 0x0c +#define UTSR0 0x1c +#define UTSR1 0x20 + +#define BAUD_DIV_230400 0x000 +#define BAUD_DIV_115200 0x001 +#define BAUD_DIV_57600 0x003 +#define BAUD_DIV_38400 0x005 +#define BAUD_DIV_19200 0x00b +#define BAUD_DIV_9600 0x017 +#define BAUD_DIV BAUD_DIV_9600 + +1: ldr r0, GPIO_BASE + ldr r1, [r0, #GPDR] + bic r1, r1, #1<<15 + orr r1, r1, #1<<14 + str r1, [r0, #GPDR] + ldr r1, [r0, #GAFR] + orr r1, r1, #(1<<15)|(1<<14) + str r1, [r0, #GAFR] + ldr r0, PPC_BASE + ldr r1, [r0, #PPAR] + orr r1, r1, #1<<12 + str r1, [r0, #PPAR] + ldr r0, UART1_BASE +1: ldr r1, [r0, #UTSR1] + tst r1, #1<<0 @ TBY + bne 1b + mov r1, #0 + str r1, [r0, #UTCR3] + mov r1, #0x08 @ 8N1 + str r1, [r0, #UTCR0] + mov r1, #BAUD_DIV + str r1, [r0, #UTCR2] + mov r1, r1, lsr #8 + str r1, [r0, #UTCR1] + mov r1, #0x03 @ RXE + TXE + str r1, [r0, #UTCR3] + mov r1, #0xff @ flush status reg + str r1, [r0, #UTSR0] +#endif + @ set registers for entry mov r0, #0 mov r1, #16 diff --git a/arch/arm/config.in b/arch/arm/config.in index be7102698b32..5e9cc8bfc72b 100644 --- a/arch/arm/config.in +++ b/arch/arm/config.in @@ -92,6 +92,8 @@ else if [ "$CONFIG_ARCH_EBSA110" = "y" -o \ "$CONFIG_ARCH_SA1100" = "y" -o \ "$CONFIG_FOOTBRIDGE" = "y" -o \ + "$CONFIG_ARCH_TBOX" = "y" -o \ + "$CONFIG_ARCH_SHARK" = "y" -o \ "$CONFIG_ARCH_NEXUSPCI" = "y" ]; then define_bool CONFIG_CPU_32v4 y if [ "$CONFIG_ARCH_SA1100" = "y" ]; then @@ -122,6 +124,7 @@ fi # These machines have ISA-DMA # if [ "$CONFIG_CATS" = "y" -o \ + "$CONFIG_ARCH_SHARK" = "y" -o \ "$CONFIG_ARCH_NETWINDER" = "y" ]; then define_bool CONFIG_ISA_DMA y else @@ -186,6 +189,8 @@ if [ "$CONFIG_ARCH_NETWINDER" = "y" -o \ fi endmenu +source drivers/ieee1394/Config.in + source drivers/i2o/Config.in source drivers/pnp/Config.in @@ -209,6 +214,8 @@ fi source drivers/usb/Config.in +source drivers/misc/Config.in + if [ "$CONFIG_VT" = "y" ]; then mainmenu_option next_comment comment 'Console drivers' @@ -256,7 +263,10 @@ if [ "$CONFIG_SCSI" != "n" ]; then fi endmenu -if [ "$CONFIG_ARCH_ACORN" = "y" -o "$CONFIG_PCI" = "y" ]; then +if [ "$CONFIG_ARCH_ACORN" = "y" -o \ + "$CONFIG_ARCH_CLPS7500" = "y" -o \ + "$CONFIG_ARCH_SHARK" = "y" -o \ + "$CONFIG_PCI" = "y" ]; then mainmenu_option next_comment comment 'Sound' diff --git a/arch/arm/kernel/arthur.c b/arch/arm/kernel/arthur.c index 9994fdd4acfc..77c7d73969fd 100644 --- a/arch/arm/kernel/arthur.c +++ b/arch/arm/kernel/arthur.c @@ -1,6 +1,6 @@ /* * Arthur personality - * Copyright (C) 1998 Philip Blundell + * Copyright (C) 1998-1999 Philip Blundell */ #include @@ -8,35 +8,36 @@ #include #include #include +#include #include -/* RISC OS doesn't have many signals, and a lot of those that it does +/* Arthur doesn't have many signals, and a lot of those that it does have don't map easily to any Linux equivalent. Never mind. */ -#define RISCOS_SIGABRT 1 -#define RISCOS_SIGFPE 2 -#define RISCOS_SIGILL 3 -#define RISCOS_SIGINT 4 -#define RISCOS_SIGSEGV 5 -#define RISCOS_SIGTERM 6 -#define RISCOS_SIGSTAK 7 -#define RISCOS_SIGUSR1 8 -#define RISCOS_SIGUSR2 9 -#define RISCOS_SIGOSERROR 10 +#define ARTHUR_SIGABRT 1 +#define ARTHUR_SIGFPE 2 +#define ARTHUR_SIGILL 3 +#define ARTHUR_SIGINT 4 +#define ARTHUR_SIGSEGV 5 +#define ARTHUR_SIGTERM 6 +#define ARTHUR_SIGSTAK 7 +#define ARTHUR_SIGUSR1 8 +#define ARTHUR_SIGUSR2 9 +#define ARTHUR_SIGOSERROR 10 -static unsigned long riscos_to_linux_signals[32] = { +static unsigned long arthur_to_linux_signals[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; -static unsigned long linux_to_riscos_signals[32] = { - 0, -1, RISCOS_SIGINT, -1, - RISCOS_SIGILL, 5, RISCOS_SIGABRT, 7, - RISCOS_SIGFPE, 9, RISCOS_SIGUSR1, RISCOS_SIGSEGV, - RISCOS_SIGUSR2, 13, 14, RISCOS_SIGTERM, +static unsigned long linux_to_arthur_signals[32] = { + 0, -1, ARTHUR_SIGINT, -1, + ARTHUR_SIGILL, 5, ARTHUR_SIGABRT, 7, + ARTHUR_SIGFPE, 9, ARTHUR_SIGUSR1, ARTHUR_SIGSEGV, + ARTHUR_SIGUSR2, 13, 14, ARTHUR_SIGTERM, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, @@ -52,12 +53,12 @@ static void arthur_lcall7(int nr, struct pt_regs *regs) send_sig_info(SIGSWI, &info, current); } -static struct exec_domain riscos_exec_domain = { +static struct exec_domain arthur_exec_domain = { "Arthur", /* name */ (lcall7_func)arthur_lcall7, PER_RISCOS, PER_RISCOS, - riscos_to_linux_signals, - linux_to_riscos_signals, + arthur_to_linux_signals, + linux_to_arthur_signals, #ifdef MODULE &__this_module, /* No usage counter. */ #else @@ -71,18 +72,15 @@ static struct exec_domain riscos_exec_domain = { * processes are using it. */ -#ifdef MODULE -int init_module(void) -#else -int initialise_arthur(void) -#endif +int __init arthur_init(void) { - return register_exec_domain(&riscos_exec_domain); + return register_exec_domain(&arthur_exec_domain); } -#ifdef MODULE -void cleanup_module(void) +void __exit arthur_exit(void) { - unregister_exec_domain(&riscos_exec_domain); + unregister_exec_domain(&arthur_exec_domain); } -#endif + +module_init(arthur_init); +module_exit(arthur_exit); diff --git a/arch/arm/kernel/entry-armo.S b/arch/arm/kernel/entry-armo.S index f2dc9e36cd27..d6fa94867f60 100644 --- a/arch/arm/kernel/entry-armo.S +++ b/arch/arm/kernel/entry-armo.S @@ -22,6 +22,7 @@ * adhering to the above criteria. */ #include +#include #include #include @@ -29,6 +30,12 @@ #include "../lib/constants.h" + .macro zero_fp +#ifdef CONFIG_FRAME_POINTER + mov fp, #0 +#endif + .endm + .text @ Offsets into task structure @@ -213,7 +220,7 @@ irq_prio_h: .byte 0, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10 stmfd sp!, {r0 - r12} ;\ mov r0, #-1 ;\ str r0, [sp, #S_OLD_R0] ;\ - mov fp, #0 + zero_fp #define SVC_IRQ_SAVE_ALL \ str sp, [sp, #-16]! ;\ @@ -224,7 +231,7 @@ irq_prio_h: .byte 0, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10 stmfd sp!, {r0 - r12} ;\ mov r0, #-1 ;\ str r0, [sp, #S_OLD_R0] ;\ - mov fp, #0 + zero_fp #define SVC_RESTORE_ALL \ ldmfd sp, {r0 - pc}^ @@ -261,7 +268,7 @@ vector_undefinstr: tst lr,#3 bne __und_svc save_user_regs - mov fp, #0 + zero_fp teqp pc, #I_BIT | MODE_SVC .Lbug_undef: ldr r4, .LC2 @@ -283,6 +290,10 @@ __und_svc: SVC_SAVE_ALL @ Non-user mode bl SYMBOL_NAME(do_undefinstr) SVC_RESTORE_ALL +#ifdef CONFIG_NWFPE + /* The FPE is always present */ + .equ fpe_not_present, 0 +#else /* We get here if an undefined instruction happens and the floating * point emulator is not present. If the offending instruction was * a WFS, we just perform a normal return as if we had emulated the @@ -319,6 +330,7 @@ wfs_mask_data: .word 0x0e200110 @ WFS/RFS .word 0x0d0d0100 @ LDF [sp]/STF [sp] .word 0x0d0b0100 @ LDF [fp]/STF [fp] .word 0x0f0f0f00 +#endif .LC2: .word SYMBOL_NAME(fp_enter) @@ -686,7 +698,7 @@ ENTRY(__switch_to) /* * initialise the trap system */ -ENTRY(trap_init) +ENTRY(__trap_init) stmfd sp!, {r4 - r7, lr} adr r1, .Ljump_addresses ldmia r1, {r1 - r7, ip, lr} diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index f4f03ee9354a..fe3939888e96 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -24,6 +24,12 @@ #define MODE_SVC 0x13 #endif + .macro zero_fp +#ifdef CONFIG_FRAME_POINTER + mov fp, #0 +#endif + .endm + .text #define PF_TRACESYS 0x20 @@ -421,7 +427,7 @@ __und_invalid: sub sp, sp, #S_FRAME_SIZE ldr r4, .LCund mov r1, #BAD_UNDEFINSTR @ int reason -1: mov fp, #0 +1: zero_fp ldmia r4, {r5 - r7} @ Get XXX pc, cpsr, old_r0 add r4, sp, #S_PC stmia r4, {r5 - r7} @ Save XXX pc, cpsr, old_r0 @@ -573,7 +579,7 @@ __dabt_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go stmia r3, {r0 - r2} @ Save USR pc, cpsr, old_r0 stmdb r3, {sp, lr}^ alignment_trap r4, r7, __temp_abt - mov fp, #0 + zero_fp #ifdef MULTI_CPU ldr r2, .LCprocfns mov lr, pc @@ -595,7 +601,7 @@ __irq_usr: sub sp, sp, #S_FRAME_SIZE stmia r8, {r5 - r7} @ save pc, psr, old_r0 stmdb r8, {sp, lr}^ alignment_trap r4, r7, __temp_irq - mov fp, #0 + zero_fp 1: get_irqnr_and_base r0, r6, r5 movne r1, sp adrsvc ne, lr, 1b @@ -615,7 +621,7 @@ __und_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go stmia r8, {r5 - r7} @ Save USR pc, cpsr, old_r0 stmdb r8, {sp, lr}^ @ Save user r0 - r12 alignment_trap r4, r7, __temp_und - mov fp, #0 + zero_fp adrsvc al, r9, ret_from_sys_call @ r9 = normal FP return adrsvc al, lr, fpundefinstr @ lr = undefined instr return @@ -641,7 +647,7 @@ __pabt_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go stmia r8, {r5 - r7} @ Save USR pc, cpsr, old_r0 stmdb r8, {sp, lr}^ @ Save sp_usr lr_usr alignment_trap r4, r7, __temp_abt - mov fp, #0 + zero_fp msr cpsr_c, #MODE_SVC @ Enable interrupts mov r0, r5 @ address (pc) mov r1, sp @ regs @@ -688,11 +694,11 @@ t: .ascii "Prefetch -> undefined instruction\n\0" ENTRY(__switch_to) stmfd sp!, {r4 - sl, fp, lr} @ Store most regs on stack mrs ip, cpsr - stmfd sp!, {ip} @ Save cpsr_SVC + str ip, [sp, #-4]! @ Save cpsr_SVC str sp, [r0, #TSS_SAVE] @ Save sp_SVC ldr sp, [r1, #TSS_SAVE] @ Get saved sp_SVC ldr r2, [r1, #TSS_DOMAIN] - ldmfd sp!, {ip} + ldr ip, [sp], #4 mcr p15, 0, r2, c3, c0 @ Set domain register msr spsr, ip @ Save tasks CPSR into SPSR for this return ldmfd sp!, {r4 - sl, fp, pc}^ @ Load all regs saved previously diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 5dc61c6d7de7..97dfef0c1339 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -4,16 +4,6 @@ */ #define S_OFF 8 -#define SYSCALL_REGS r4, r5 - -/* - * Define to favour ARM8, ARM9 and StrongARM cpus. This says that it is - * cheaper to use two LDR instructions than a two-register LDM, if the - * latter would entail calculating an address specially. - */ -#if defined(CONFIG_CPU_SA110) -#define HARVARD_CACHE -#endif .macro get_softirq, rd #ifdef __SMP__ @@ -85,7 +75,7 @@ tip .req r7 @ temporary IP .align 5 vector_swi: save_user_regs mask_pc lr, lr - mov fp, #0 + zero_fp ldr scno, [lr, #-4] @ get SWI instruction arm700_bug_check scno, ip #ifdef CONFIG_ALIGNMENT_TRAP @@ -95,9 +85,7 @@ vector_swi: save_user_regs #endif enable_irqs ip - stmdb sp!, {SYSCALL_REGS} @ new style: (r0 = arg1, r4 = arg5, r5 = arg6) - @ Note that we dont have to handle - @ sys_syscalls arg7 here + str r4, [sp, #-S_OFF]! @ push fifth arg adrsvc al, lr, fast_syscall_return bic scno, scno, #0xff000000 @ mask off SWI op-code @@ -141,10 +129,11 @@ vector_swi: save_user_regs b SYMBOL_NAME(deferred) .align 5 - + .type __softirq_state, #object __softirq_state: .word SYMBOL_NAME(softirq_state) + .type sys_call_table, #object ENTRY(sys_call_table) #include "calls.S" @@ -153,15 +142,18 @@ ENTRY(sys_call_table) */ @ r0 = syscall number @ r5 = syscall table + .type sys_syscall, #function SYMBOL_NAME(sys_syscall): eor scno, r0, #OS_NUMBER << 20 cmp scno, #NR_syscalls @ check range add ip, sp, #S_OFF - ldmleib ip, {r0 - r3, SYSCALL_REGS} @ get our args - stmleia sp, {SYSCALL_REGS} @ Put our arg on the stack + stmleia sp, {r5, r6} @ shuffle args + movle r0, r1 + movle r1, r2 + movle r2, r3 + movle r3, r4 ldrle pc, [tbl, scno, lsl #2] - mov r0, #-ENOSYS - RETINSTR(mov,pc,lr) + b sys_ni_syscall sys_fork_wrapper: add r0, sp, #S_OFF @@ -199,6 +191,23 @@ sys_sigaltstack_wrapper: ldr r2, [sp, #S_OFF + S_SP] b do_sigaltstack +/* + * Note: off_4k (r5) is always units of 4K. If we can't do the requested + * offset, we return EINVAL. + */ +sys_mmap2: +#if PAGE_SHIFT > 12 + tst r5, #PGOFF_MASK + moveq r5, r5, lsr #PGOFF_SHIFT + streq r5, [sp, #4] + beq do_mmap2 + mov r0, #-EINVAL + RETINSTR(mov,pc, lr) +#else + str r5, [sp, #4] + b do_mmap2 +#endif + .data ENTRY(fp_enter) diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c index 47b2930c20f1..9abb9e6177d3 100644 --- a/arch/arm/kernel/sys_arm.c +++ b/arch/arm/kernel/sys_arm.c @@ -50,7 +50,7 @@ asmlinkage int sys_pipe(unsigned long * fildes) } /* common code for old and new mmaps */ -static inline long do_mmap2( +inline long do_mmap2( unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff) @@ -79,27 +79,6 @@ out: return error; } -#define PGOFF_SHIFT (PAGE_SHIFT - 12) -#define PGOFF_MASK (~((1 << PGOFF_SHIFT) - 1)) - -/* - * Note: off_4k is always units of 4K. If we can't do the requested - * offset, we return EINVAL. - */ -asmlinkage long -sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, - unsigned long flags, unsigned long fd, unsigned long off_4k) -{ - unsigned long pgoff; - - if (off_4k & ~PGOFF_MASK) - return -EINVAL; - - pgoff = off_4k >> PGOFF_SHIFT; - - return do_mmap2(addr, len, prot, flags, fd, pgoff); -} - struct mmap_arg_struct { unsigned long addr; unsigned long len; diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index e1651904f022..3544ac89df69 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -53,10 +53,10 @@ ENTRY(find_next_zero_bit) beq Lfindzbit1lp @ If new byte, goto old routine ldrb r3, [r0, r2, lsr#3] orr r3, r3, #0xFF00 @ Set top bits so we wont get confused - stmfd sp!, {r4} + str r4, [sp, #-4]! and r4, r2, #7 mov r3, r3, lsr r4 @ Shift right by no. of bits - ldmfd sp!, {r4} + ldr r4, [sp], #4 and r3, r3, #0xFF teq r3, #0xFF orreq r2, r2, #7 diff --git a/arch/arm/lib/getconsdata.c b/arch/arm/lib/getconsdata.c index aaa7a7ad202d..8b6a0affa340 100644 --- a/arch/arm/lib/getconsdata.c +++ b/arch/arm/lib/getconsdata.c @@ -91,3 +91,5 @@ unsigned long PAGE_SZ = PAGE_SIZE; unsigned long KSWI_BASE = 0x900000; unsigned long KSWI_SYS_BASE = 0x9f0000; unsigned long SYS_ERROR0 = 0x9f0000; +unsigned long PGOFF_SHIFT = PAGE_SHIFT - 12; +unsigned long PGOFF_MASK = (1 << (PAGE_SHIFT - 12)) - 1; diff --git a/arch/arm/lib/strrchr.S b/arch/arm/lib/strrchr.S index ad5a46089d34..c9145d7af4f9 100644 --- a/arch/arm/lib/strrchr.S +++ b/arch/arm/lib/strrchr.S @@ -12,7 +12,7 @@ .text ENTRY(strrchr) - stmfd sp!, {lr} + str lr, [sp, #-4]! mov r3, #0 1: ldrb r2, [r0], #1 teq r2, r1 diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c index 7101b29363e6..76d1a5c7419f 100644 --- a/arch/arm/mm/consistent.c +++ b/arch/arm/mm/consistent.c @@ -1,13 +1,14 @@ /* * Dynamic DMA mapping support. */ - +#include #include #include #include #include #include #include +#include #include #include @@ -49,6 +50,22 @@ no_page: return NULL; } +void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *handle) +{ + void *__ret; + int __gfp = GFP_KERNEL; + +#ifdef CONFIG_PCI + if ((hwdev) == NULL || + (hwdev)->dma_mask != 0xffffffff) +#endif + __gfp |= GFP_DMA; + + __ret = consistent_alloc(__gfp, (size), + (handle)); + return __ret; +} + /* * free a page as defined by the above mapping. We expressly forbid * calling this from interrupt context. diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c index 5151591b8e80..4a23d14bddf1 100644 --- a/arch/arm/mm/fault-armv.c +++ b/arch/arm/mm/fault-armv.c @@ -351,7 +351,7 @@ do_sect_fault(unsigned long addr, int error_code, struct pt_regs *regs) #endif -static struct fsr_info { +static const struct fsr_info { int (*fn)(unsigned long addr, int error_code, struct pt_regs *regs); int sig; char *name; @@ -384,7 +384,7 @@ static struct fsr_info { asmlinkage void do_DataAbort(unsigned long addr, int fsr, int error_code, struct pt_regs *regs) { - struct fsr_info *inf; + const struct fsr_info *inf; if (user_mode(regs) && addr == regs->ARM_pc) { static int first = 1; diff --git a/arch/arm/mm/fault-common.c b/arch/arm/mm/fault-common.c index d04808ffa2f3..c34c37203b34 100644 --- a/arch/arm/mm/fault-common.c +++ b/arch/arm/mm/fault-common.c @@ -6,7 +6,7 @@ */ #include -extern void die(const char *msg, struct pt_regs *regs, unsigned int err); +extern void die(const char *msg, struct pt_regs *regs, int err); /* * This is useful to dump out the page tables associated with diff --git a/arch/arm/mm/mm-clps7500.c b/arch/arm/mm/mm-clps7500.c new file mode 100644 index 000000000000..b9199de80707 --- /dev/null +++ b/arch/arm/mm/mm-clps7500.c @@ -0,0 +1,28 @@ +/* + * arch/arm/mm/mm-cl7500.c + * + * Extra MM routines for CL7500 architecture + * + * Copyright (C) 1998 Russell King + * Copyright (C) 1999 Nexus Electronics Ltd + */ + +#include + +#include +#include +#include +#include + +#include "map.h" + +#define SIZE(x) (sizeof(x) / sizeof(x[0])) + +struct map_desc io_desc[] __initdata = { + { IO_BASE, IO_START, IO_SIZE , DOMAIN_IO, 0, 1 }, /* IO space */ + { ISA_BASE, ISA_START, ISA_SIZE , DOMAIN_IO, 0, 1 }, /* ISA space */ + { FLASH_BASE, FLASH_START, FLASH_SIZE, DOMAIN_IO, 0, 1 }, /* Flash */ + { LED_BASE, LED_START, LED_SIZE , DOMAIN_IO, 0, 1 } /* LED */ +}; + +unsigned int __initdata io_desc_size = SIZE(io_desc); diff --git a/arch/arm/mm/mm-nexuspci.c b/arch/arm/mm/mm-nexuspci.c index 5b66faa51855..ccb6c8a5cb19 100644 --- a/arch/arm/mm/mm-nexuspci.c +++ b/arch/arm/mm/mm-nexuspci.c @@ -2,9 +2,9 @@ * arch/arm/mm/mm-nexuspci.c * from arch/arm/mm/mm-ebsa110.c * - * Extra MM routines for the NexusPCI architecture + * Extra MM routines for the FTV/PCI architecture * - * Copyright (C) 1998 Phil Blundell + * Copyright (C) 1998-1999 Phil Blundell * Copyright (C) 1998-1999 Russell King */ @@ -18,14 +18,14 @@ #include "map.h" -#define SIZE(x) (sizeof(x) / sizeof(x[0])) - -const struct map_desc io_desc[] __initdata = { - { 0xfff00000, 0x10000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffe00000, 0x20000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffc00000, 0x60000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xfe000000, 0x80000000, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xfd000000, 0x88000000, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 } +struct map_desc io_desc[] __initdata = { + { INTCONT_BASE, INTCONT_START, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, + { PLX_BASE, PLX_START, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, + { PCIO_BASE, PLX_IO_START, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 }, + { DUART_BASE, DUART_START, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, + { STATUS_BASE, STATUS_START, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 } }; +#define SIZE(x) (sizeof(x) / sizeof(x[0])) + unsigned int __initdata io_desc_size = SIZE(io_desc); diff --git a/arch/arm/vmlinux-armo.lds.in b/arch/arm/vmlinux-armo.lds.in index 5fbafe77a188..94c15523253a 100644 --- a/arch/arm/vmlinux-armo.lds.in +++ b/arch/arm/vmlinux-armo.lds.in @@ -28,6 +28,11 @@ SECTIONS *(.init.task) } + /DISCARD/ : { /* Exit code and data */ + *(.text.exit) + *(.data.exit) + } + _text = .; /* Text and read-only data */ .text : { *(.text) diff --git a/arch/i386/config.in b/arch/i386/config.in index e074ea81d0f2..fa2056ea281c 100644 --- a/arch/i386/config.in +++ b/arch/i386/config.in @@ -139,30 +139,31 @@ tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC -source drivers/parport/Config.in +bool 'Power Management support' CONFIG_PM -bool 'ACPI support' CONFIG_ACPI +dep_bool ' ACPI support' CONFIG_ACPI $CONFIG_PM if [ "$CONFIG_ACPI" != "n" ]; then if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - bool ' Enter S1 for sleep (EXPERIMENTAL)' CONFIG_ACPI_S1_SLEEP + bool ' Enter S1 for sleep (EXPERIMENTAL)' CONFIG_ACPI_S1_SLEEP fi fi -tristate 'Advanced Power Management BIOS support' CONFIG_APM +dep_tristate ' Advanced Power Management BIOS support' CONFIG_APM $CONFIG_PM if [ "$CONFIG_APM" != "n" ]; then - bool ' Ignore USER SUSPEND' CONFIG_APM_IGNORE_USER_SUSPEND - bool ' Enable PM at boot time' CONFIG_APM_DO_ENABLE - bool ' Make CPU Idle calls when idle' CONFIG_APM_CPU_IDLE - bool ' Enable console blanking using APM' CONFIG_APM_DISPLAY_BLANK - bool ' Ignore multiple suspend' CONFIG_APM_IGNORE_MULTIPLE_SUSPEND - bool ' Ignore multiple suspend/resume cycles' CONFIG_APM_IGNORE_SUSPEND_BOUNCE - bool ' RTC stores time in GMT' CONFIG_APM_RTC_IS_GMT - bool ' Allow interrupts during APM BIOS calls' CONFIG_APM_ALLOW_INTS - bool ' Use real mode APM BIOS call to power off' CONFIG_APM_REAL_MODE_POWER_OFF + bool ' Ignore USER SUSPEND' CONFIG_APM_IGNORE_USER_SUSPEND + bool ' Enable PM at boot time' CONFIG_APM_DO_ENABLE + bool ' Make CPU Idle calls when idle' CONFIG_APM_CPU_IDLE + bool ' Enable console blanking using APM' CONFIG_APM_DISPLAY_BLANK + bool ' Ignore multiple suspend' CONFIG_APM_IGNORE_MULTIPLE_SUSPEND + bool ' Ignore multiple suspend/resume cycles' CONFIG_APM_IGNORE_SUSPEND_BOUNCE + bool ' RTC stores time in GMT' CONFIG_APM_RTC_IS_GMT + bool ' Allow interrupts during APM BIOS calls' CONFIG_APM_ALLOW_INTS + bool ' Use real mode APM BIOS call to power off' CONFIG_APM_REAL_MODE_POWER_OFF fi endmenu +source drivers/parport/Config.in source drivers/pnp/Config.in diff --git a/arch/i386/defconfig b/arch/i386/defconfig index 34b453c2cc86..3e2117a58268 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -74,9 +74,10 @@ CONFIG_KCORE_ELF=y CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y CONFIG_BINFMT_MISC=y -# CONFIG_PARPORT is not set +CONFIG_PM=y CONFIG_ACPI=y # CONFIG_APM is not set +# CONFIG_PARPORT is not set # # Plug and Play configuration @@ -264,6 +265,7 @@ CONFIG_NETDEVICES=y # # CONFIG_ARCNET is not set CONFIG_DUMMY=m +# CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set # CONFIG_NET_SB1000 is not set diff --git a/arch/i386/kernel/acpi.c b/arch/i386/kernel/acpi.c index 6228805dbabd..b190974203d0 100644 --- a/arch/i386/kernel/acpi.c +++ b/arch/i386/kernel/acpi.c @@ -977,11 +977,9 @@ static void acpi_enter_sx(acpi_sstate_t state) typa = ((typa << ACPI_SLP_TYP_SHIFT) & ACPI_SLP_TYP_MASK); typb = ((typb << ACPI_SLP_TYP_SHIFT) & ACPI_SLP_TYP_MASK); - if (state != ACPI_S0) { - acpi_sleep_start = get_cmos_time(); - acpi_enter_dx(ACPI_D3); - acpi_sleep_state = state; - } + acpi_sleep_start = get_cmos_time(); + acpi_enter_dx(ACPI_D3); + acpi_sleep_state = state; // clear wake status acpi_write_pm1_status(acpi_facp, ACPI_WAK); @@ -996,17 +994,11 @@ static void acpi_enter_sx(acpi_sstate_t state) outw(value | typb | ACPI_SLP_EN, acpi_facp->pm1b_cnt); } - if (state == ACPI_S0) { - acpi_sleep_state = state; - acpi_enter_dx(ACPI_D0); - acpi_sleep_start = 0; - } - else if (state == ACPI_S1) { - // wait until S1 is entered - while (!(acpi_read_pm1_status(acpi_facp) & ACPI_WAK)) ; - // finished sleeping, update system time - acpi_update_clock(); - } + // wait until S1 is entered + while (!(acpi_read_pm1_status(acpi_facp) & ACPI_WAK)) ; + // finished sleeping, update system time + acpi_update_clock(); + acpi_enter_dx(ACPI_D0); } } @@ -1292,7 +1284,6 @@ static int acpi_do_sleep(ctl_table *ctl, { #ifdef CONFIG_ACPI_S1_SLEEP acpi_enter_sx(ACPI_S1); - acpi_enter_sx(ACPI_S0); #endif } file->f_pos += *len; diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index b78b5f207bf4..02669540ff64 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c index 5e2c8be6a0c6..4163626f4208 100644 --- a/arch/i386/kernel/irq.c +++ b/arch/i386/kernel/irq.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -184,24 +183,43 @@ int get_irq_list(char *buf) unsigned char global_irq_holder = NO_PROC_ID; unsigned volatile int global_irq_lock; +extern void show_stack(unsigned long* esp); + static void show(char * str) { int i; - unsigned long *stack; int cpu = smp_processor_id(); printk("\n%s, CPU %d:\n", str, cpu); - printk("irq: %d [%d %d]\n", - irqs_running(), local_irq_count(0), local_irq_count(1)); - printk("bh: %d [%d %d]\n", - spin_is_locked(&global_bh_lock) ? 1 : 0, local_bh_count(0), local_bh_count(1)); - stack = (unsigned long *) &stack; - for (i = 40; i ; i--) { - unsigned long x = *++stack; - if (x > (unsigned long) &get_option && x < (unsigned long) &vsprintf) { - printk("<[%08lx]> ", x); + printk("irq: %d [",irqs_running()); + for(i=0;i < smp_num_cpus;i++) + printk(" %d",local_irq_count(i)); + printk(" ]\nbh: %d [",spin_is_locked(&global_bh_lock) ? 1 : 0); + for(i=0;i < smp_num_cpus;i++) + printk(" %d",local_bh_count(i)); + + printk(" ]\nStack dumps:"); + for(i=0;i< smp_num_cpus;i++) { + unsigned long esp; + if(i==cpu) + continue; + printk("\nCPU %d:",i); + esp = init_tss[i].esp0; + if(esp==NULL) { + /* tss->esp0 is set to NULL in cpu_init(), + * it's initialized when the cpu returns to user + * space. -- manfreds + */ + printk(" "); + continue; } - } + esp &= ~(THREAD_SIZE-1); + esp += sizeof(struct task_struct); + show_stack((void*)esp); + } + printk("\nCPU %d:",cpu); + show_stack(NULL); + printk("\n"); } #define MAXCOUNT 100000000 diff --git a/arch/i386/kernel/pci-pc.c b/arch/i386/kernel/pci-pc.c index d5b2b0062f70..a76c92d25e4d 100644 --- a/arch/i386/kernel/pci-pc.c +++ b/arch/i386/kernel/pci-pc.c @@ -1044,6 +1044,45 @@ static void __init pcibios_irq_peer_trick(struct irq_routing_table *rt) printk("PCI: Discovered primary peer bus %02x [IRQ]\n", i); } +static void set_level_irq(unsigned irq) +{ + unsigned char mask = 1 << (irq & 7); + unsigned int port = 0x4d0 + (irq >> 3); + unsigned char val = inb(port); + + if (val & mask) { + printk("PCI irq %d was level\n", irq); + return; + } + printk("PCI irq %d was edge, turning into level-triggered\n", irq); + outb(val | mask, port); +} + +static int ali_set_irq(struct pci_dev *router, unsigned pirq, unsigned irq) +{ + if (irq < 15) { + static unsigned char irqmap[16] = { + 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15 + }; + unsigned char val = irqmap[irq]; + if (val && pirq < 8) { + u8 byte; + unsigned offset = 0x48 + (pirq >> 1); + unsigned shift = (pirq & 1) << 2; + pci_read_config_byte(router, offset, &byte); + printk("ALI: old %04x=%02x\n", offset, byte); + byte &= ~(0xf << shift); + byte |= val << shift; + printk("ALI: new %04x=%02x\n", offset, byte); + pci_write_config_byte(router, offset, byte); + set_level_irq(irq); + return irq; + } + } + return 0; +} + + /* * In case BIOS forgets to tell us about IRQ, we try to look it up in the routing * table, but unfortunately we have to know the interrupt router chip. @@ -1135,6 +1174,10 @@ static char *pcibios_lookup_irq(struct pci_dev *dev, struct irq_routing_table *r DBG(" -> [PIIX] sink\n"); break; case ID(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533): + newirq = ali_set_irq(router, pirq-1, newirq); + if (newirq) + msg = "ALI"; + break; default: DBG(" -> unknown router %04x/%04x\n", rt->rtr_vendor, rt->rtr_device); if (newirq && mask == (1 << newirq)) { diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 19f7022a4968..a043b4cfe0a2 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -693,7 +693,6 @@ asmlinkage int sys_execve(struct pt_regs regs) int error; char * filename; - lock_kernel(); filename = getname((char *) regs.ebx); error = PTR_ERR(filename); if (IS_ERR(filename)) @@ -703,7 +702,6 @@ asmlinkage int sys_execve(struct pt_regs regs) current->flags &= ~PF_DTRACE; putname(filename); out: - unlock_kernel(); return error; } diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c index a973746b9582..d9af88d829ee 100644 --- a/arch/i386/kernel/signal.c +++ b/arch/i386/kernel/signal.c @@ -419,13 +419,19 @@ static void setup_frame(int sig, struct k_sigaction *ka, ? current->exec_domain->signal_invmap[sig] : sig), &frame->sig); + if (err) + goto give_sigsegv; err |= setup_sigcontext(&frame->sc, &frame->fpstate, regs, set->sig[0]); + if (err) + goto give_sigsegv; if (_NSIG_WORDS > 1) { err |= __copy_to_user(frame->extramask, &set->sig[1], sizeof(frame->extramask)); } + if (err) + goto give_sigsegv; /* Set up to return from userspace. If provided, use a stub already in userspace. */ @@ -486,6 +492,8 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, err |= __put_user(&frame->info, &frame->pinfo); err |= __put_user(&frame->uc, &frame->puc); err |= __copy_to_user(&frame->info, info, sizeof(*info)); + if (err) + goto give_sigsegv; /* Create the ucontext. */ err |= __put_user(0, &frame->uc.uc_flags); @@ -497,6 +505,8 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, err |= setup_sigcontext(&frame->uc.uc_mcontext, &frame->fpstate, regs, set->sig[0]); err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); + if (err) + goto give_sigsegv; /* Set up to return from userspace. If provided, use a stub already in userspace. */ diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index 7400b628b189..3a7004970da9 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c @@ -21,6 +21,7 @@ #include #include #include +#include #ifdef CONFIG_MCA #include diff --git a/arch/mips/arc/console.c b/arch/mips/arc/console.c index 4e93e2e77829..4de5130fbce3 100644 --- a/arch/mips/arc/console.c +++ b/arch/mips/arc/console.c @@ -6,6 +6,7 @@ * * $Id: console.c,v 1.3 1999/10/09 00:00:57 ralf Exp $ */ +#include #include #include #include diff --git a/arch/mips/arc/init.c b/arch/mips/arc/init.c index 23ea2d3b510d..81cf6cf74b75 100644 --- a/arch/mips/arc/init.c +++ b/arch/mips/arc/init.c @@ -9,7 +9,6 @@ */ #include #include -#include #include diff --git a/arch/mips/arc/memory.c b/arch/mips/arc/memory.c index 69db5e28d13c..d1c530fda4bf 100644 --- a/arch/mips/arc/memory.c +++ b/arch/mips/arc/memory.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/arch/mips/arc/printf.c b/arch/mips/arc/printf.c index c44b9d5524e0..78b1b5937da3 100644 --- a/arch/mips/arc/printf.c +++ b/arch/mips/arc/printf.c @@ -6,6 +6,7 @@ * * $Id: printf.c,v 1.3 1999/10/09 00:00:57 ralf Exp $ */ +#include #include #include diff --git a/arch/mips/baget/balo_supp.S b/arch/mips/baget/balo_supp.S index 9f579a8e1936..96f2a8f504a2 100644 --- a/arch/mips/baget/balo_supp.S +++ b/arch/mips/baget/balo_supp.S @@ -4,7 +4,6 @@ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov */ -#include #include #include #include diff --git a/arch/mips/baget/prom/init.c b/arch/mips/baget/prom/init.c index 848591ef16f9..a87c004ecacf 100644 --- a/arch/mips/baget/prom/init.c +++ b/arch/mips/baget/prom/init.c @@ -6,7 +6,6 @@ * $Id: init.c,v 1.3 1999/10/09 00:00:57 ralf Exp $ */ #include -#include #include char arcs_cmdline[CL_SIZE]; diff --git a/arch/mips/baget/setup.c b/arch/mips/baget/setup.c index c197dea7f558..dd0a7733e079 100644 --- a/arch/mips/baget/setup.c +++ b/arch/mips/baget/setup.c @@ -5,7 +5,6 @@ * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov * */ -#include #include #include #include diff --git a/arch/mips/ddb5074/irq.c b/arch/mips/ddb5074/irq.c index af4d9e116590..4fee350e23e2 100644 --- a/arch/mips/ddb5074/irq.c +++ b/arch/mips/ddb5074/irq.c @@ -7,6 +7,7 @@ * $Id: irq.c,v 1.1 2000/01/26 00:07:44 ralf Exp $ */ +#include #include #include #include diff --git a/arch/mips/ddb5074/pci.c b/arch/mips/ddb5074/pci.c index aa0839ceb4f8..e0f39c666d46 100644 --- a/arch/mips/ddb5074/pci.c +++ b/arch/mips/ddb5074/pci.c @@ -9,12 +9,10 @@ */ #include -#include #include #include #include #include -#include #include #include diff --git a/arch/mips/dec/prom/cmdline.c b/arch/mips/dec/prom/cmdline.c index 15a2f7d02159..27b31818a728 100644 --- a/arch/mips/dec/prom/cmdline.c +++ b/arch/mips/dec/prom/cmdline.c @@ -7,7 +7,6 @@ */ #include #include -#include #include #include diff --git a/arch/mips/dec/prom/identify.c b/arch/mips/dec/prom/identify.c index 1c9404c866d4..6acacc1c4e8e 100644 --- a/arch/mips/dec/prom/identify.c +++ b/arch/mips/dec/prom/identify.c @@ -6,7 +6,6 @@ * $Id: identify.c,v 1.2 1999/10/09 00:00:58 ralf Exp $ */ #include -#include #include #include diff --git a/arch/mips/kernel/r2300_misc.S b/arch/mips/kernel/r2300_misc.S index b50050a1fb9c..30031e295b8d 100644 --- a/arch/mips/kernel/r2300_misc.S +++ b/arch/mips/kernel/r2300_misc.S @@ -10,8 +10,6 @@ * Copyright (c) 1998 Harald Koerfgen * Copyright (c) 1998, 1999 Gleb Raiko & Vladimir Roganov */ -#include - #include #include #include diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c index d62cc4353306..ea36ed5b24fe 100644 --- a/arch/mips/kernel/time.c +++ b/arch/mips/kernel/time.c @@ -6,6 +6,7 @@ * This file contains the time handling details for PC-style clocks as * found in some MIPS systems. */ +#include #include #include #include diff --git a/arch/mips/mm/loadmmu.c b/arch/mips/mm/loadmmu.c index 21eb0649711e..cb5e1e66dbaa 100644 --- a/arch/mips/mm/loadmmu.c +++ b/arch/mips/mm/loadmmu.c @@ -5,6 +5,7 @@ * * $Id: loadmmu.c,v 1.15 2000/02/24 00:12:40 ralf Exp $ */ +#include #include #include #include diff --git a/arch/mips/sgi/kernel/indy_int.c b/arch/mips/sgi/kernel/indy_int.c index 4f7a2fc21d2c..0a4647262f87 100644 --- a/arch/mips/sgi/kernel/indy_int.c +++ b/arch/mips/sgi/kernel/indy_int.c @@ -9,7 +9,6 @@ * - Indigo2 changes * - Interrupt handling fixes */ -#include #include #include diff --git a/arch/mips64/arc/init.c b/arch/mips64/arc/init.c index f5324f78bbbc..b961fc899976 100644 --- a/arch/mips64/arc/init.c +++ b/arch/mips64/arc/init.c @@ -10,7 +10,6 @@ */ #include #include -#include #include diff --git a/arch/mips64/arc/memory.c b/arch/mips64/arc/memory.c index 55df6ae10d4c..58d4835eaafd 100644 --- a/arch/mips64/arc/memory.c +++ b/arch/mips64/arc/memory.c @@ -13,7 +13,6 @@ * because on some machines like SGI IP27 the ARC memory configuration data * completly bogus and alternate easier to use mechanisms are available. */ -#include #include #include #include @@ -21,7 +20,6 @@ #include #include #include -#include #include #include diff --git a/arch/mips64/kernel/signal32.c b/arch/mips64/kernel/signal32.c index b7839f62867b..109c4d37b8dc 100644 --- a/arch/mips64/kernel/signal32.c +++ b/arch/mips64/kernel/signal32.c @@ -8,7 +8,6 @@ * Copyright (C) 1994 - 1999 Ralf Baechle * Copyright (C) 1999 Silicon Graphics, Inc. */ -#include #include #include #include diff --git a/arch/mips64/kernel/syscall.c b/arch/mips64/kernel/syscall.c index 7fc9e213e483..b7521f151127 100644 --- a/arch/mips64/kernel/syscall.c +++ b/arch/mips64/kernel/syscall.c @@ -7,7 +7,6 @@ * Copyright (C) 1995 - 1999 by Ralf Baechle * Copyright (C) 1999 Silicon Graphics, Inc. */ -#include #include #include #include diff --git a/arch/mips64/sgi-ip27/ip27-init.c b/arch/mips64/sgi-ip27/ip27-init.c index f6b3d6e093fe..e09bc6036485 100644 --- a/arch/mips64/sgi-ip27/ip27-init.c +++ b/arch/mips64/sgi-ip27/ip27-init.c @@ -7,7 +7,6 @@ #include #include #include -#include #include typedef unsigned long cpumask_t; /* into asm/sn/types.h */ diff --git a/arch/mips64/sgi-ip27/ip27-irq.c b/arch/mips64/sgi-ip27/ip27-irq.c index fef993773d68..266a753e1953 100644 --- a/arch/mips64/sgi-ip27/ip27-irq.c +++ b/arch/mips64/sgi-ip27/ip27-irq.c @@ -5,7 +5,6 @@ * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org) * Copyright (C) 1999 Silicon Graphics, Inc. */ -#include #include #include diff --git a/arch/mips64/sgi-ip27/ip27-rtc.c b/arch/mips64/sgi-ip27/ip27-rtc.c index bf85c06f2798..e5f174ab10d7 100644 --- a/arch/mips64/sgi-ip27/ip27-rtc.c +++ b/arch/mips64/sgi-ip27/ip27-rtc.c @@ -192,16 +192,9 @@ static int rtc_release(struct inode *inode, struct file *file) */ static struct file_operations rtc_fops = { - NULL, /* No llseek (yet) */ - NULL, /* No read (yet) */ - NULL, /* No write */ - NULL, /* No readdir */ - NULL, /* No poll (yet) */ - rtc_ioctl, - NULL, /* No mmap */ - rtc_open, - NULL, /* flush */ - rtc_release + ioctl: rtc_ioctl, + open: rtc_open, + release: rtc_release, }; static struct miscdevice rtc_dev= diff --git a/arch/mips64/sgi-ip27/ip27-setup.c b/arch/mips64/sgi-ip27/ip27-setup.c index 4c9233b25332..f0d7d66ab0dc 100644 --- a/arch/mips64/sgi-ip27/ip27-setup.c +++ b/arch/mips64/sgi-ip27/ip27-setup.c @@ -19,7 +19,6 @@ #include #include #include -#include /* Check against user dumbness. */ #ifdef CONFIG_VT diff --git a/arch/mips64/sgi-ip27/ip27-timer.c b/arch/mips64/sgi-ip27/ip27-timer.c index 20eeb301a139..ff6ea60e7cc4 100644 --- a/arch/mips64/sgi-ip27/ip27-timer.c +++ b/arch/mips64/sgi-ip27/ip27-timer.c @@ -148,13 +148,10 @@ void do_settimeofday(struct timeval *tv) } /* Includes for ioc3_init(). */ -#include #include #include #include #include -#include -#include #include /* Converts Gregorian date to seconds since 1970-01-01 00:00:00. diff --git a/drivers/acorn/block/Makefile b/drivers/acorn/block/Makefile index 9f5953b39a3b..481d7f328194 100644 --- a/drivers/acorn/block/Makefile +++ b/drivers/acorn/block/Makefile @@ -9,26 +9,45 @@ # parent makefile. # -L_TARGET := acorn-block.a -L_OBJS := -M_OBJS := -MOD_LIST_NAME := ACORN_BLOCK_MODULES - -ifeq ($(CONFIG_BLK_DEV_FD1772),y) - L_OBJS += fd1772.o fd1772dma.o -else - ifeq ($(CONFIG_BLK_DEV_FD1772),m) - M_OBJS += fd1772_mod.o - endif -endif - -ifeq ($(CONFIG_BLK_DEV_MFM),y) - L_OBJS += mfmhd.o mfm.o -else - ifeq ($(CONFIG_BLK_DEV_MFM),m) - M_OBJS += mfmhd_mod.o - endif -endif +L_TARGET := acorn-block.a +MOD_LIST_NAME := ACORN_BLOCK_MODULES + +obj-y := +obj-m := +obj-n := +obj- := + +export-objs := +list-multi := fd1772_mod.o mfmhd_mod.o +fd1772_mod-objs := fd1772.o fd1772dma.o +mfmhd_mod-objs := mfmhd.o mfm.o + +obj-$(CONFIG_BLK_DEV_FD1772) += fd1772_mod.o +obj-$(CONFIG_BLK_DEV_MFM) += mfmhd.o mfm.o + +# Extract lists of the multi-part drivers. +# The 'int-*' lists are intermediate files used to build the multi's. + +multi-y := $(filter $(list-multi), $(obj-y)) +multi-m := $(filter $(list-multi), $(obj-m)) +int-y := $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs))) +int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs))) + +# Files that are both resident and modular; remove from modular. + +obj-m := $(filter-out $(obj-y), $(obj-m)) +int-m := $(filter-out $(int-y), $(int-m)) + +# Take multi-part drivers out of obj-y and put components in. + +obj-y := $(filter-out $(list-multi), $(obj-y)) $(int-y) + +# Translate to Rules.make lists. + +L_OBJS := $(filter-out $(export-objs), $(obj-y)) +LX_OBJS := $(filter $(export-objs), $(obj-y)) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) include $(TOPDIR)/Rules.make diff --git a/drivers/acorn/block/mfmhd.c b/drivers/acorn/block/mfmhd.c index 0d65a1493734..f2e2f995cc67 100644 --- a/drivers/acorn/block/mfmhd.c +++ b/drivers/acorn/block/mfmhd.c @@ -1280,7 +1280,6 @@ void mfm_setup(char *str, int *ints) * Set the CHS from the ADFS boot block if it is present. This is not ideal * since if there are any non-ADFS partitions on the disk, this won't work! * Hence, I want to get rid of this... - * Please, do. It does seriously sucking things. */ void xd_set_geometry(kdev_t dev, unsigned char secsptrack, unsigned char heads, unsigned long discsize, unsigned int secsize) diff --git a/drivers/acorn/char/Makefile b/drivers/acorn/char/Makefile index 2d08a90cbcee..24bab45a9428 100644 --- a/drivers/acorn/char/Makefile +++ b/drivers/acorn/char/Makefile @@ -10,37 +10,35 @@ # O_TARGET := acorn-char.o -M_OBJS := -O_OBJS := i2c.o pcf8583.o - -O_OBJS_arc := keyb_arc.o -O_OBJS_a5k := keyb_arc.o -O_OBJS_rpc := keyb_ps2.o - -ifeq ($(CONFIG_RPCMOUSE),y) - OX_OBJS += mouse_rpc.o -else - ifeq ($(CONFIG_RPCSMOUSE),m) - MX_OBJS += mouse_rpc.o - endif -endif - -ifeq ($(CONFIG_ATOMWIDE_SERIAL),y) - O_OBJS += serial-atomwide.o -else - ifeq ($(CONFIG_ATOMWIDE_SERIAL),m) - O_OBJS += serial-atomwide.o - endif -endif - -ifeq ($(CONFIG_DUALSP_SERIAL),y) - O_OBJS += serial-dualsp.o -else - ifeq ($(CONFIG_DUALSP_SERIAL),m) - M_OBJS += serial-dualsp.o - endif -endif - -O_OBJS += $(O_OBJS_$(MACHINE)) + +O_OBJS := +OX_OBJS := +M_OBJS := +MX_OBJS := + +# Object file lists. + +obj-y := i2c.o pcf8583.o +obj-m := +obj-n := +obj- := + +# All the objects that export symbols. +export-objs := mouse_rpc.o + +obj-arc := keyb_arc.o +obj-a5k := keyb_arc.o +obj-rpc := keyb_ps2.o + +obj-$(CONFIG_RPCMOUSE) += mouse_rpc.o +obj-$(CONFIG_ATOMWIDE_SERIAL) += serial-atomwide.o +obj-$(CONFIG_DUALSP_SERIAL) += serial-dualsp.o + +obj-y += $(obj-$(MACHINE)) + +O_OBJS := $(filter-out $(export-objs), $(obj-y)) +OX_OBJS := $(filter $(export-objs), $(obj-y)) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) include $(TOPDIR)/Rules.make diff --git a/drivers/acorn/net/Makefile b/drivers/acorn/net/Makefile index 5f79d1ab8714..27811e92ff42 100644 --- a/drivers/acorn/net/Makefile +++ b/drivers/acorn/net/Makefile @@ -4,32 +4,18 @@ # L_TARGET := acorn-net.a -L_OBJS := -M_OBJS := MOD_LIST_NAME := ACORN_NET_MODULES -ifeq ($(CONFIG_ARM_ETHER1),y) - L_OBJS += ether1.o -else - ifeq ($(CONFIG_ARM_ETHER1),m) - M_OBJS += ether1.o - endif -endif +obj-y := +obj-m := +obj-n := +obj- := -ifeq ($(CONFIG_ARM_ETHER3),y) - L_OBJS += ether3.o -else - ifeq ($(CONFIG_ARM_ETHER3),m) - M_OBJS += ether3.o - endif -endif +obj-$(CONFIG_ARM_ETHER1) += ether1.o +obj-$(CONFIG_ARM_ETHER3) += ether3.o +obj-$(CONFIG_ARM_ETHERH) += etherh.o -ifeq ($(CONFIG_ARM_ETHERH),y) - L_OBJS += etherh.o -else - ifeq ($(CONFIG_ARM_ETHERH),m) - M_OBJS += etherh.o - endif -endif +L_OBJS := $(obj-y) +M_OBJS := $(obj-m) include $(TOPDIR)/Rules.make diff --git a/drivers/acorn/scsi/Makefile b/drivers/acorn/scsi/Makefile index ee7152a442cc..a2c94a0d5633 100644 --- a/drivers/acorn/scsi/Makefile +++ b/drivers/acorn/scsi/Makefile @@ -2,109 +2,50 @@ # Makefile for drivers/acorn/scsi # -L_TARGET := acorn-scsi.a -L_OBJS := -LX_OBJS := -M_OBJS := -MX_OBJS := -MOD_LIST_NAME := ACORN_SCSI_MODULES +L_TARGET := acorn-scsi.a +MOD_LIST_NAME := ACORN_SCSI_MODULES -CONFIG_QUEUE_BUILTIN := -CONFIG_FAS216_BUILTIN := -CONFIG_QUEUE_MODULE := -CONFIG_FAS216_MODULE := +obj-y := +obj-m := +obj-n := +obj- := -ifeq ($(CONFIG_SCSI_ACORNSCSI_3),y) - L_OBJS += acornscsi.o acornscsi-io.o - CONFIG_QUEUE_BUILTIN=y -else - ifeq ($(CONFIG_SCSI_ACORNSCSI_3),m) - M_OBJS += acornscsi_mod.o - CONFIG_QUEUE_MODULE=y - endif -endif +export-objs := fas216.o queue.o msgqueue.o +list-multi := acornscsi_mod.o +acornscsi_mod-objs := acornscsi.o acornscsi-io.o -ifeq ($(CONFIG_SCSI_ARXESCSI),y) - L_OBJS += arxescsi.o - CONFIG_FAS216_BUILTIN=y -else - ifeq ($(CONFIG_SCSI_ARXESCSI),m) - M_OBJS += arxescsi.o - CONFIG_FAS216_MODULE=y - endif -endif +obj-$(CONFIG_SCSI_ACORNSCSI_3) += acornscsi_mod.o queue.o msgqueue.o +obj-$(CONFIG_SCSI_ARXESCSI) += arxescsi.o fas216.o queue.o msgqueue.o +obj-$(CONFIG_SCSI_CUMANA_1) += cumana_1.o +obj-$(CONFIG_SCSI_CUMANA_2) += cumana_2.o fas216.o queue.o msgqueue.o +obj-$(CONFIG_SCSI_ECOSCSI) += ecoscsi.o +obj-$(CONFIG_SCSI_OAK1) += oak.o +obj-$(CONFIG_SCSI_POWERTECSCSI) += powertec.o fas216.o queue.o msgqueue.o +obj-$(CONFIG_SCSI_EESOXSCSI) += eesox.o fas216.o queue.o msgqueue.o -ifeq ($(CONFIG_SCSI_CUMANA_1),y) - L_OBJS += cumana_1.o -else - ifeq ($(CONFIG_SCSI_CUMANA_1),m) - M_OBJS += cumana_1.o - endif -endif +# Extract lists of the multi-part drivers. +# The 'int-*' lists are intermediate files used to build the multi's. -ifeq ($(CONFIG_SCSI_CUMANA_2),y) - L_OBJS += cumana_2.o - CONFIG_FAS216_BUILTIN=y -else - ifeq ($(CONFIG_SCSI_CUMANA_2),m) - M_OBJS += cumana_2.o - CONFIG_FAS216_MODULE=y - endif -endif +multi-y := $(filter $(list-multi), $(obj-y)) +multi-m := $(filter $(list-multi), $(obj-m)) +int-y := $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs))) +int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs))) -ifeq ($(CONFIG_SCSI_ECOSCSI),y) - L_OBJS += ecoscsi.o -else - ifeq ($(CONFIG_SCSI_ECOSCSI),m) - M_OBJS += ecoscsi.o - endif -endif +# Files that are both resident and modular; remove from modular. -ifeq ($(CONFIG_SCSI_OAK1),y) - L_OBJS += oak.o -else - ifeq ($(CONFIG_SCSI_OAK1),m) - M_OBJS += oak.o - endif -endif +obj-m := $(filter-out $(obj-y), $(obj-m)) +int-m := $(filter-out $(int-y), $(int-m)) -ifeq ($(CONFIG_SCSI_POWERTECSCSI),y) - L_OBJS += powertec.o - CONFIG_FAS216_BUILTIN=y -else - ifeq ($(CONFIG_SCSI_POWERTECSCSI),m) - M_OBJS += powertec.o - CONFIG_FAS216_MODULE=y - endif -endif +# Take multi-part drivers out of obj-y and put components in. -ifeq ($(CONFIG_SCSI_EESOXSCSI),y) - L_OBJS += eesox.o - CONFIG_FAS216_BUILTIN=y -else - ifeq ($(CONFIG_SCSI_EESOXSCSI),m) - M_OBJS += eesox.o - CONFIG_FAS216_MODULE=y - endif -endif +obj-y := $(filter-out $(list-multi), $(obj-y)) $(int-y) -ifeq ($(CONFIG_FAS216_BUILTIN),y) - LX_OBJS += fas216.o - CONFIG_QUEUE_BUILTIN=y -else - ifeq ($(CONFIG_FAS216_MODULE),y) - MX_OBJS += fas216.o - CONFIG_QUEUE_MODULE=y - endif -endif +# Translate to Rules.make lists. -ifeq ($(CONFIG_QUEUE_BUILTIN),y) - LX_OBJS += queue.o msgqueue.o -else - ifeq ($(CONFIG_QUEUE_MODULE),y) - MX_OBJS += queue.o msgqueue.o - endif -endif +L_OBJS := $(filter-out $(export-objs), $(obj-y)) +LX_OBJS := $(filter $(export-objs), $(obj-y)) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) include $(TOPDIR)/Rules.make diff --git a/drivers/acorn/scsi/arxescsi.c b/drivers/acorn/scsi/arxescsi.c index 2a0ee9d1cfe6..cc1701708bb8 100644 --- a/drivers/acorn/scsi/arxescsi.c +++ b/drivers/acorn/scsi/arxescsi.c @@ -24,8 +24,8 @@ #include #include #include +#include -#include #include #include #include diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index d912f8c08df3..1495809d6086 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c @@ -3583,7 +3583,7 @@ static void DAC960_DestroyProcEntries(void) int init_module(void) { - int ControllerNumber, LogicalDriveNumber; + int ControllerNumber; DAC960_Initialize(); if (DAC960_ActiveControllerCount == 0) return -1; for (ControllerNumber = 0; diff --git a/drivers/block/amd7409.c b/drivers/block/amd7409.c index b12847843b54..7d201802992a 100644 --- a/drivers/block/amd7409.c +++ b/drivers/block/amd7409.c @@ -6,6 +6,7 @@ * */ +#include #include #include #include diff --git a/drivers/block/cmd64x.c b/drivers/block/cmd64x.c index 4e98893ecdd6..40b5c7797fbf 100644 --- a/drivers/block/cmd64x.c +++ b/drivers/block/cmd64x.c @@ -11,6 +11,7 @@ * Copyright (C) 1999-2000 Andre Hedrick (andre@suse.com) */ +#include #include #include #include diff --git a/drivers/block/cpqarray.h b/drivers/block/cpqarray.h index fa51d3dee402..fedbb46acef0 100644 --- a/drivers/block/cpqarray.h +++ b/drivers/block/cpqarray.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #endif diff --git a/drivers/block/cs5530.c b/drivers/block/cs5530.c index 0f2f04990f70..bb68f7b2e89f 100644 --- a/drivers/block/cs5530.c +++ b/drivers/block/cs5530.c @@ -8,6 +8,7 @@ * by the nice folks at National Semiconductor. */ +#include #include #include #include diff --git a/drivers/block/ide-pci.c b/drivers/block/ide-pci.c index 2ddbbc8bd018..f667ee6dd729 100644 --- a/drivers/block/ide-pci.c +++ b/drivers/block/ide-pci.c @@ -243,9 +243,12 @@ extern void ide_init_sis5513(ide_hwif_t *); #ifdef CONFIG_BLK_DEV_SL82C105 extern void ide_init_sl82c105(ide_hwif_t *); +extern void ide_dmacapable_sl82c105(ide_hwif_t *, unsigned long); #define INIT_W82C105 &ide_init_sl82c105 +#define DMA_W82C105 &ide_dmacapable_sl82c105 #else #define INIT_W82C105 IDE_IGNORE +#define DMA_W82C105 NULL #endif #ifdef CONFIG_BLK_DEV_TRM290 @@ -316,7 +319,7 @@ static ide_pci_device_t ide_pci_chipsets[] __initdata = { {DEVID_TRM290, "TRM290", NULL, NULL, INIT_TRM290, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0 }, {DEVID_NS87415, "NS87415", NULL, NULL, INIT_NS87415, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0 }, {DEVID_AEC6210, "AEC6210", PCI_AEC6210, NULL, INIT_AEC6210, DMA_AEC6210, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, OFF_BOARD, 0 }, - {DEVID_W82C105, "W82C105", NULL, NULL, INIT_W82C105, NULL, {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, ON_BOARD, 0 }, + {DEVID_W82C105, "W82C105", NULL, NULL, INIT_W82C105, DMA_W82C105, {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, ON_BOARD, 0 }, {DEVID_UM8673F, "UM8673F", NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0 }, {DEVID_UM8886A, "UM8886A", NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0 }, {DEVID_UM8886BF,"UM8886BF", NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0 }, diff --git a/drivers/block/piix.c b/drivers/block/piix.c index 4c2d94c99f17..97e57fa558d4 100644 --- a/drivers/block/piix.c +++ b/drivers/block/piix.c @@ -85,8 +85,8 @@ #include #include #include +#include -#include #include #include "ide_modes.h" diff --git a/drivers/block/sl82c105.c b/drivers/block/sl82c105.c index 29f006682d1f..483a98fded61 100644 --- a/drivers/block/sl82c105.c +++ b/drivers/block/sl82c105.c @@ -26,6 +26,8 @@ #include "ide_modes.h" +extern char *ide_xfer_verbose (byte xfer_rate); + #ifdef CONFIG_ARCH_NETWINDER /* * Convert a PIO mode and cycle time to the required on/off @@ -50,42 +52,7 @@ static unsigned int get_timing_sl82c105(ide_pio_data_t *p) if (cmd_off == 0) cmd_off = 1; - return (cmd_on - 1) << 8 | (cmd_off - 1); -} - -/* - * Tell the drive to enable the specified PIO mode. - * This should be in ide.c, maybe as a special command - * (see do_special). - */ -static int ide_set_drive_pio_mode(ide_drive_t *drive, byte pio) -{ - ide_hwif_t *hwif = HWIF(drive); - ide_startstop_t startstop; - - if (pio > 2) { - /* FIXME: I don't believe that this SELECT_DRIVE is required, - * since ide.c only calls tuneproc from do_special, after - * the correct drive has been selected. - */ - SELECT_DRIVE(hwif, drive); - if (IDE_CONTROL_REG) - OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG); - OUT_BYTE(0x08 | pio, IDE_NSECTOR_REG); - OUT_BYTE(0x03, IDE_FEATURE_REG); - OUT_BYTE(WIN_SETFEATURES, IDE_COMMAND_REG); - - if (ide_wait_stat(&startstop, drive, DRIVE_READY, - BUSY_STAT|DRQ_STAT|ERR_STAT, WAIT_CMD)) { - printk("%s: drive not ready for command\n", - drive->name); - return 1; /* return startstop; ?? */ - } - if (IDE_CONTROL_REG) - OUT_BYTE(drive->ctl, IDE_CONTROL_REG); - } - - return 0; /* return startstop; ?? */ + return (cmd_on - 1) << 8 | (cmd_off - 1) | (p->use_iordy ? 0x40 : 0x00); } /* @@ -97,27 +64,49 @@ static void tune_sl82c105(ide_drive_t *drive, byte pio) ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = hwif->pci_dev; ide_pio_data_t p; - unsigned int drv_ctrl = 0x909; + unsigned short drv_ctrl = 0x909; + unsigned int xfer_mode, reg; - pio = ide_get_best_pio_mode(drive, pio, 5, &p); + reg = (hwif->channel ? 0x4c : 0x44) + (drive->select.b.unit ? 4 : 0); - if (!ide_set_drive_pio_mode(drive, pio)) { - drv_ctrl = get_timing_sl82c105(&p); + pio = ide_get_best_pio_mode(drive, pio, 5, &p); - if (p.use_iordy) - drv_ctrl |= 0x40; + switch (pio) { + default: + case 0: xfer_mode = XFER_PIO_0; break; + case 1: xfer_mode = XFER_PIO_1; break; + case 2: xfer_mode = XFER_PIO_2; break; + case 3: xfer_mode = XFER_PIO_3; break; + case 4: xfer_mode = XFER_PIO_4; break; } - pci_write_config_word(dev, - (hwif->channel ? 0x4c : 0x44) - + (drive->select.b.unit ? 4 : 0), - drv_ctrl); + if (ide_config_drive_speed(drive, xfer_mode) == 0) + drv_ctrl = get_timing_sl82c105(&p); - printk("%s: selected PIO mode %d (%dns)\n", - drive->name, p.pio_mode, p.cycle_time); + pci_write_config_word(dev, reg, drv_ctrl); + pci_read_config_word(dev, reg, &drv_ctrl); + + printk("%s: selected %s (%dns) (%04X)\n", drive->name, + ide_xfer_verbose(xfer_mode), p.cycle_time, drv_ctrl); } #endif +void ide_dmacapable_sl82c105(ide_hwif_t *hwif, unsigned long dmabase) +{ + unsigned char rev; + + pci_read_config_byte(hwif->pci_dev, PCI_REVISION_ID, &rev); + + if (rev <= 5) { + hwif->autodma = 0; + hwif->drives[0].autotune = 1; + hwif->drives[1].autotune = 1; + printk(" %s: revision %d, Bus-Master DMA disabled\n", + hwif->name, rev); + } + ide_setup_dma(hwif, dmabase, 8); +} + void ide_init_sl82c105(ide_hwif_t *hwif) { struct pci_dev *dev = hwif->pci_dev; diff --git a/drivers/char/Config.in b/drivers/char/Config.in index 1503be21bcb0..11f10b785426 100644 --- a/drivers/char/Config.in +++ b/drivers/char/Config.in @@ -206,6 +206,7 @@ if [ "$CONFIG_VIDEO_DEV" != "n" ]; then fi fi dep_tristate ' SAA5249 Teletext processor' CONFIG_VIDEO_SAA5249 $CONFIG_VIDEO_DEV + dep_tristate ' SAB3036 tuner' CONFIG_TUNER_3036 $CONFIG_VIDEO_DEV if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then if [ "$CONFIG_SGI" = "y" ]; then dep_tristate ' SGI Vino Video For Linux (EXPERIMENTAL)' CONFIG_VIDEO_VINO $CONFIG_VIDEO_DEV $CONFIG_SGI diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 6744e5452966..ddfe79a754d2 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -251,6 +251,7 @@ obj-$(CONFIG_RADIO_ZOLTRIX) += radio-zoltrix.o obj-$(CONFIG_RADIO_MIROPCM20) += radio-miropcm20.o obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o obj-$(CONFIG_RADIO_TRUST) += radio-trust.o +obj-$(CONFIG_TUNER_3036) += tuner-3036.o obj-$(CONFIG_QIC02_TAPE) += tpqic02.o ifeq ($(CONFIG_FTAPE),y) diff --git a/drivers/char/README.epca b/drivers/char/README.epca index 6da3196883ca..da2e114001ac 100644 --- a/drivers/char/README.epca +++ b/drivers/char/README.epca @@ -515,3 +515,11 @@ Description (Verbose) : Updated driver: Files affected : epca.c Release version : 1.3.0-K ----------------------------------------------------------------------- +Programmer : Jeff Garzik +Date : February 26, 2000 +Description (Verbose) : Updated driver: + 1. Use new kernel PCI interfaces. + 2. Updated list of includes. +Files affected : epca.c +Release version : 1.3.0.1-LK +----------------------------------------------------------------------- diff --git a/include/linux/digi1.h b/drivers/char/digi1.h similarity index 100% rename from include/linux/digi1.h rename to drivers/char/digi1.h diff --git a/include/linux/digiFep1.h b/drivers/char/digiFep1.h similarity index 100% rename from include/linux/digiFep1.h rename to drivers/char/digiFep1.h diff --git a/include/linux/digiPCI.h b/drivers/char/digiPCI.h similarity index 100% rename from include/linux/digiPCI.h rename to drivers/char/digiPCI.h diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c index e3a37611decb..5a89e008a163 100644 --- a/drivers/char/ds1620.c +++ b/drivers/char/ds1620.c @@ -352,18 +352,10 @@ static struct proc_dir_entry *proc_therm_ds1620; #endif static struct file_operations ds1620_fops = { - NULL, /* lseek */ - ds1620_read, /* read */ - NULL, /* write */ - NULL, /* readdir */ - NULL, /* select */ - ds1620_ioctl, /* ioctl */ - NULL, /* mmap */ - ds1620_open, /* open */ - NULL, /* flush */ - ds1620_release, /* release */ - NULL, /* fsync */ - NULL, /* fasync */ + read: ds1620_read, + ioctl: ds1620_ioctl, + open: ds1620_open, + release: ds1620_release, }; static struct miscdevice ds1620_miscdev = { diff --git a/drivers/char/dz.c b/drivers/char/dz.c index ceea1ff25d21..b8165ef98935 100644 --- a/drivers/char/dz.c +++ b/drivers/char/dz.c @@ -29,6 +29,7 @@ #define MOD_DEC_USE_COUNT #endif +#include #include #include #include diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 8261e4ef2336..e8de397bfce0 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -28,95 +28,38 @@ /* See README.epca for change history --DAT*/ -#ifdef MODVERSIONS -#ifndef MODULE -#define MODULE -#endif -#endif - -/* ----------------------------------------------------------------------- - This way modules should work regardless if they defined MODULE or - MODVERSIONS. (MODVERSIONS is for the newer kernels ... --------------------------------------------------------------------------- */ - -#ifdef MODULE #include -#endif /* MODULE */ - -#include - -#define NEW_MODULES - -#ifdef NEW_MODULES -#ifdef MODVERSIONS -#include -#endif /* MODVERSIONS */ -#endif /* NEW_MODULES */ - -#ifdef MODULE #include -#endif /* MODULE */ - - -#include -#include -#include -#include -#include -#include #include -#include -#include -#include +#include +#include +#include +#include #include -#include -#include -#include - - -#include - -#include -#include -#include +#include #include -#include -#include -#include -#include - -#ifdef MODULE -#ifndef NEW_MODULES -char kernel_version[]=UTS_RELEASE; -#endif /* NEW_MODULE */ -#endif /* MODULE */ - +#include #ifdef CONFIG_PCI #define ENABLE_PCI #endif /* CONFIG_PCI */ - - -#include #define putUser(arg1, arg2) put_user(arg1, (unsigned long *)arg2) #define getUser(arg1, arg2) get_user(arg1, (unsigned int *)arg2) - - #ifdef ENABLE_PCI #include -#include +#include "digiPCI.h" #endif /* ENABLE_PCI */ -#include -#include -#include -#include +#include "digi1.h" +#include "digiFep1.h" +#include "epca.h" +#include "epcaconfig.h" /* ---------------------- Begin defines ------------------------ */ -#define VERSION "1.3.0-K" +#define VERSION "1.3.0.1-LK" /* This major needs to be submitted to Linux to join the majors list */ @@ -127,6 +70,8 @@ char kernel_version[]=UTS_RELEASE; #define MAXCARDS 7 #define epcaassert(x, msg) if (!(x)) epca_error(__LINE__, msg) +#define PFX "epca: " + /* ----------------- Begin global definitions ------------------- */ static char mesg[100]; @@ -140,7 +85,7 @@ static int invalid_lilo_config = 0; MAXBOARDS is typically 12, but ISA and EISA cards are restricted to 7 below. --------------------------------------------------------------------------*/ -static struct board_info boards[7]; +static struct board_info boards[MAXBOARDS]; /* ------------- Begin structures used for driver registeration ---------- */ @@ -284,11 +229,7 @@ static int pc_write(struct tty_struct *, int, const unsigned char *, int); int pc_init(void); #ifdef ENABLE_PCI -static int init_PCI(int); -static int get_PCI_configuration(unsigned char, unsigned char, - unsigned int *, unsigned int *, - unsigned int *, unsigned int *, - unsigned int *, unsigned int *); +static int init_PCI(void); #endif /* ENABLE_PCI */ @@ -1588,7 +1529,7 @@ static int pc_open(struct tty_struct *tty, struct file * filp) #ifdef MODULE /* -------------------- Begin init_module ---------------------- */ -int init_module() +int __init init_module() { /* Begin init_module */ unsigned long flags; @@ -1606,6 +1547,11 @@ int init_module() #endif #ifdef MODULE /* -------------------- Begin cleanup_module ---------------------- */ + +#ifdef ENABLE_PCI +static struct pci_driver epca_driver; +#endif + void cleanup_module() { /* Begin cleanup_module */ @@ -1654,6 +1600,9 @@ void cleanup_module() } /* End for each port */ } /* End for each card */ +#ifdef ENABLE_PCI + pci_unregister_driver (&epca_driver); +#endif restore_flags(flags); @@ -1662,7 +1611,7 @@ void cleanup_module() /* ------------------ Begin pc_init ---------------------- */ -int pc_init(void) +int __init pc_init(void) { /* Begin pc_init */ /* ---------------------------------------------------------------- @@ -1748,7 +1697,7 @@ int pc_init(void) if (pci_present()) { if(num_cards < MAXBOARDS) - pci_boards_found += init_PCI(num_cards); + pci_boards_found += init_PCI(); num_cards += pci_boards_found; } else @@ -2039,10 +1988,7 @@ static void post_fep_init(unsigned int crd) epcaassert(ch <= &digi_channels[nbdevs - 1], "ch out of range"); - if (bd->membase < (unsigned char *)0x100000) - memaddr = (unchar *) bd->membase; - else /* Else get special mapped memory above RAM */ - memaddr = (unchar *)bd->re_map_membase; + memaddr = (unchar *)bd->re_map_membase; /* The below command is necessary because newer kernels (2.1.x and @@ -2356,12 +2302,7 @@ static void doevent(int crd) assertgwinon(chan0); - if (bd->membase < (unsigned char *)0x100000) - eventbuf = (volatile unchar *)bus_to_virt((ulong)(bd->membase + tail + ISTART)); - else - { - eventbuf = (volatile unchar *)bus_to_virt((ulong)(bd->re_map_membase + tail + ISTART)); - } + eventbuf = (volatile unchar *)bus_to_virt((ulong)(bd->re_map_membase + tail + ISTART)); /* Get the channel the event occurred on */ channel = eventbuf[0]; @@ -2522,10 +2463,7 @@ static void fepcmd(struct channel *ch, int cmd, int word_or_byte, cmdMax = (cmdStart + 4 + (ch->mailbox->cmax)); - if (ch->board->membase < (unsigned char *)0x100000) - memaddr = ch->board->membase; - else - memaddr = ch->board->re_map_membase; + memaddr = ch->board->re_map_membase; /* The below command is necessary because newer kernels (2.1.x and @@ -4036,231 +3974,128 @@ void epca_setup(char *str, int *ints) #ifdef ENABLE_PCI -/* --------------------- Begin get_PCI_configuration ---------------------- */ - -int get_PCI_configuration(unsigned char bus, unsigned char device_fn, - unsigned int *base_addr0, unsigned int *base_addr1, - unsigned int *base_addr2, unsigned int *base_addr3, - unsigned int *base_addr4, unsigned int *base_addr5) -{ /* Begin get_PCI_configuration */ - - struct pci_dev *dev = pci_find_slot(bus, device_fn); - - if (!dev) - return(0); - - *base_addr0 = dev->resource[0].start; - *base_addr1 = dev->resource[1].start; - *base_addr2 = dev->resource[2].start; - *base_addr3 = dev->resource[3].start; - *base_addr4 = dev->resource[4].start; - *base_addr5 = dev->resource[5].start; - - /* ------------------------------------------------------------------------ - NOTE - The code below mask out either the 2 or 4 bits dependent on the - space being addressed. (base_addr value reflecting io space, have their - first 2 bits mask out, while base_addr value reflecting mem space, have - their first 4 bits mask out.) These bits are flag bits and should always - be 0 when used as an address. - ---------------------------------------------------------------------------- */ - - return(1); -} /* End get_PCI_configuration */ - /* ------------------------ Begin init_PCI --------------------------- */ -int init_PCI(int boards_found) -{ /* Begin init_PCI */ - - unsigned char bus, device_fn; - int i, pci_count = 0; - unsigned int base_addr0, base_addr1, base_addr2, - base_addr3, base_addr4, base_addr5; +enum epic_board_types { + brd_xr = 0, + brd_xem, + brd_cx, + brd_xrj, +}; - base_addr0 = base_addr1 = base_addr2 = 0; - base_addr3 = base_addr4 = base_addr5 = 0; - for(i = 0; i < (MAXBOARDS - boards_found); i++) - { /* Begin for each POSSIBLE remaining board */ +/* indexed directly by epic_board_types enum */ +static struct { + unsigned char board_type; + unsigned bar_idx; /* PCI base address region */ +} epca_info_tbl[] = { + { PCIXR, 0, }, + { PCIXEM, 0, }, + { PCICX, 0, }, + { PCIXRJ, 2, }, +}; - if (!pcibios_find_device(PCI_VENDOR_DIGI, PCI_DEVICE_XR, - i, &bus, &device_fn)) - { /* Begin found XR */ - if (get_PCI_configuration(bus, device_fn, &base_addr0, &base_addr1, - &base_addr2, &base_addr3, - &base_addr4, &base_addr5)) - { /* Store a PCI/XR into the boards structure */ +static int __init epca_init_one (struct pci_dev *pdev, + const struct pci_device_id *ent) +{ + static int board_num = -1; + int board_idx, info_idx = ent->driver_data; + unsigned long addr; + + board_num++; + board_idx = board_num + num_cards; + if (board_idx >= MAXBOARDS) + goto err_out; + + addr = pci_resource_start (pdev, epca_info_tbl[info_idx].bar_idx); + if (!addr) { + printk (KERN_ERR PFX "PCI region #%d not available (size 0)\n", + epca_info_tbl[info_idx].bar_idx); + goto err_out; + } - boards[boards_found + pci_count].status = ENABLED; - boards[boards_found + pci_count].type = PCIXR; - - boards[boards_found + pci_count].numports = 0x0; - - boards[boards_found + pci_count].port = (unsigned char *)((char *)base_addr0 + PCI_IO_OFFSET); - /* Most cards use base_addr0, but some use base_addr2 */ - boards[boards_found + pci_count].membase = (unsigned char *)base_addr0; - - if (base_addr0 >= 0x100000) - { - /* ------------------------------------------------------------ - Standard physical addresses are valid to the kernel as long - as they aren't above RAM. Higher addresses (Such as are - typical of a PCI system) need to be mapped in with the - ioremap command. For boards using such high addresses the - driver will store both addresses. One address (The physical) - will be held for the apps use (And mmap) and the other (The - ioremapped address) will be used in the kernel. - - ---------------------------------------------------------------- */ - boards[boards_found + pci_count].re_map_port = ioremap((base_addr0 + PCI_IO_OFFSET),0x200000); - boards[boards_found + pci_count].re_map_membase = ioremap(base_addr0, 0x200000); - } - - pci_count++; - - /* -------------------------------------------------------------- - I don't know what the below does, but the hardware guys say - its required on everything except PLX (In this case XRJ). - ---------------------------------------------------------------- */ - pcibios_write_config_byte(bus, device_fn, 0x40, 0); - pcibios_write_config_byte(bus, device_fn, 0x46, 0); - - } /* End store a PCI/XR into the board structure */ - - } /* End found XR */ - - if (!pcibios_find_device(PCI_VENDOR_DIGI, PCI_DEVICE_XEM, - i, &bus, &device_fn)) - { /* Begin found XEM */ - - if (get_PCI_configuration(bus, device_fn, &base_addr0, &base_addr1, - &base_addr2, &base_addr3, - &base_addr4, &base_addr5)) - { /* Begin store a PCI/XEM into the boards structure */ - - boards[boards_found + pci_count].status = ENABLED; - boards[boards_found + pci_count].type = PCIXEM; - - boards[boards_found + pci_count].numports = 0x0; - boards[boards_found + pci_count].port = (char *)((char *)base_addr0 + PCI_IO_OFFSET); - /* Most cards use base_addr0, but some use base_addr2 */ - boards[boards_found + pci_count].membase = (unsigned char *)base_addr0; - - if (base_addr0 >= 0x100000) - { - /* ------------------------------------------------------------ - Standard physical addresses are valid to the kernel as long - as they aren't above RAM. Higher addresses (Such as are - typical of a PCI system) need to be mapped in with the - ioremap command. For boards using such high addresses the - driver will store both addresses. One address (The physical) - will be held for the apps use (And mmap) and the other (The - vremapped address) will be used in the kernel. - - ---------------------------------------------------------------- */ - boards[boards_found + pci_count].re_map_port = ioremap((base_addr0 + PCI_IO_OFFSET),0x200000); - boards[boards_found + pci_count].re_map_membase = ioremap(base_addr0, 0x200000); - } - - pci_count++; - /* -------------------------------------------------------------- - I don't know what the below does, but the hardware guys say - its required on everything except PLX (In this case XRJ). - ---------------------------------------------------------------- */ - pcibios_write_config_byte(bus, device_fn, 0x40, 0); - pcibios_write_config_byte(bus, device_fn, 0x46, 0); - - } /* End store a PCI/XEM into the boards structure */ - - } /* End found XEM */ - - - if (!pcibios_find_device(PCI_VENDOR_DIGI, PCI_DEVICE_CX, - i, &bus, &device_fn)) - { /* Begin found CX */ - - if (get_PCI_configuration(bus, device_fn, &base_addr0, &base_addr1, - &base_addr2, &base_addr3, - &base_addr4, &base_addr5)) - { /* Begin store a PCI/CX into the boards structure */ - - boards[boards_found + pci_count].status = ENABLED; - boards[boards_found + pci_count].type = PCICX; - - boards[boards_found + pci_count].numports = 0x0; - boards[boards_found + pci_count].port = (char *)((char *)base_addr0 + PCI_IO_OFFSET); - /* Most cards use base_addr0, but some use base_addr2 */ - boards[boards_found + pci_count].membase = (unsigned char *)base_addr0; - - if (base_addr0 >= 0x100000) - { - /* ------------------------------------------------------------ - Standard physical addresses are valid to the kernel as long - as they aren't above RAM. Higher addresses (Such as are - typical of a PCI system) need to be mapped in with the - ioremap command. For boards using such high addresses the - driver will store both addresses. One address (The physical) - will be held for the apps use (And mmap) and the other (The - vremapped address) will be used in the kernel. - - ---------------------------------------------------------------- */ - boards[boards_found + pci_count].re_map_port = ioremap((base_addr0 + PCI_IO_OFFSET),0x200000); - boards[boards_found + pci_count].re_map_membase = ioremap(base_addr0, 0x200000); - } - - pci_count++; - /* -------------------------------------------------------------- - I don't know what the below does, but the hardware guys say - its required on everything except PLX (In this case XRJ). - ---------------------------------------------------------------- */ - pcibios_write_config_byte(bus, device_fn, 0x40, 0); - pcibios_write_config_byte(bus, device_fn, 0x46, 0); - - } /* End store a PCI/CX into the boards structure */ + boards[board_idx].status = ENABLED; + boards[board_idx].type = epca_info_tbl[info_idx].board_type; + boards[board_idx].numports = 0x0; + boards[board_idx].port = + (unsigned char *)((char *) addr + PCI_IO_OFFSET); + boards[board_idx].membase = + (unsigned char *)((char *) addr); + + if (!request_mem_region (addr + PCI_IO_OFFSET, 0x200000, "epca")) { + printk (KERN_ERR PFX "resource 0x%x @ 0x%lx unavailable\n", + 0x200000, addr + PCI_IO_OFFSET); + goto err_out; + } - } /* End found CX */ + boards[board_idx].re_map_port = ioremap(addr + PCI_IO_OFFSET, 0x200000); + if (!boards[board_idx].re_map_port) { + printk (KERN_ERR PFX "cannot map 0x%x @ 0x%lx\n", + 0x200000, addr + PCI_IO_OFFSET); + goto err_out_free_pciio; + } - if (!pcibios_find_device(PCI_VENDOR_DIGI, PCI_DEVICE_XRJ, - i, &bus, &device_fn)) - { /* Begin found XRJ */ + if (!request_mem_region (addr, 0x200000, "epca")) { + printk (KERN_ERR PFX "resource 0x%x @ 0x%lx unavailable\n", + 0x200000, addr); + goto err_out_free_iounmap; + } - if (get_PCI_configuration(bus, device_fn, &base_addr0, &base_addr1, - &base_addr2, &base_addr3, - &base_addr4, &base_addr5)) - { /* Begin store a PCI/XRJ into the boards structure */ + boards[board_idx].re_map_membase = ioremap(addr, 0x200000); + if (!boards[board_idx].re_map_membase) { + printk (KERN_ERR PFX "cannot map 0x%x @ 0x%lx\n", + 0x200000, addr + PCI_IO_OFFSET); + goto err_out_free_memregion; + } - boards[boards_found + pci_count].status = ENABLED; - boards[boards_found + pci_count].type = PCIXRJ; + /* -------------------------------------------------------------- + I don't know what the below does, but the hardware guys say + its required on everything except PLX (In this case XRJ). + ---------------------------------------------------------------- */ + if (info_idx != brd_xrj) { + pci_write_config_byte(pdev, 0x40, 0); + pci_write_config_byte(pdev, 0x46, 0); + } + + return 0; - boards[boards_found + pci_count].numports = 0x0; - boards[boards_found + pci_count].port = (unsigned char *)(base_addr2 + PCI_IO_OFFSET); - /* Most cards use base_addr0, but some use base_addr2 */ - boards[boards_found + pci_count].membase = (unsigned char *)base_addr2; +err_out_free_memregion: + release_mem_region (addr, 0x200000); +err_out_free_iounmap: + iounmap (boards[board_idx].re_map_port); +err_out_free_pciio: + release_mem_region (addr + PCI_IO_OFFSET, 0x200000); +err_out: + return -ENODEV; +} - if (base_addr2 >= 0x100000) - { - /* ------------------------------------------------------------ - Standard physical addresses are valid to the kernel as long - as they aren't above RAM. Higher addresses (Such as are - typical of a PCI system) need to be mapped in with the - ioremap command. For boards using such high addresses the - driver will store both addresses. One address (The physical) - will be held for the apps use (And mmap) and the other (The - vremapped address) will be used in the kernel. - - ---------------------------------------------------------------- */ - boards[boards_found + pci_count].re_map_port = ioremap((base_addr2 + PCI_IO_OFFSET),0x200000); - boards[boards_found + pci_count].re_map_membase = ioremap(base_addr2, 0x200000); - } - pci_count++; +static struct pci_device_id epca_pci_tbl[] __initdata = { + { PCI_VENDOR_DIGI, PCI_DEVICE_XR, PCI_ANY_ID, PCI_ANY_ID, 0, 0, brd_xr }, + { PCI_VENDOR_DIGI, PCI_DEVICE_XEM, PCI_ANY_ID, PCI_ANY_ID, 0, 0, brd_xem }, + { PCI_VENDOR_DIGI, PCI_DEVICE_CX, PCI_ANY_ID, PCI_ANY_ID, 0, 0, brd_cx }, + { PCI_VENDOR_DIGI, PCI_DEVICE_XRJ, PCI_ANY_ID, PCI_ANY_ID, 0, 0, brd_xrj }, + { 0, }, /* terminate list */ +}; - } /* End store a PCI/XRJ into the boards structure */ - } /* End found XRJ */ +int __init init_PCI (void) +{ /* Begin init_PCI */ + + int pci_count; + + memset (&epca_driver, 0, sizeof (epca_driver)); + epca_driver.name = "epca"; + epca_driver.id_table = epca_pci_tbl; + epca_driver.probe = epca_init_one; - } /* End for each POSSIBLE remaining board */ + pci_count = pci_register_driver (&epca_driver); + + if (pci_count <= 0) { + pci_unregister_driver (&epca_driver); + pci_count = 0; + } return(pci_count); diff --git a/include/linux/epca.h b/drivers/char/epca.h similarity index 100% rename from include/linux/epca.h rename to drivers/char/epca.h diff --git a/include/linux/epcaconfig.h b/drivers/char/epcaconfig.h similarity index 100% rename from include/linux/epcaconfig.h rename to drivers/char/epcaconfig.h diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c index 7c9bafc3bb65..986b728dbd29 100644 --- a/drivers/char/nwbutton.c +++ b/drivers/char/nwbutton.c @@ -207,16 +207,9 @@ static int button_release (struct inode *inode, struct file *filp) */ static struct file_operations button_fops = { - NULL, /* lseek */ - button_read, - NULL, /* write */ - NULL, /* readdir */ - NULL, /* select */ - NULL, /* ioctl */ - NULL, /* mmap */ - button_open, - NULL, /* flush */ - button_release, + read: button_read, + open: button_open, + release: button_release, }; /* diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c index a905be058f0f..cbe0ec79f7ec 100644 --- a/drivers/char/nwflash.c +++ b/drivers/char/nwflash.c @@ -60,20 +60,12 @@ extern spinlock_t gpio_lock; static struct file_operations flash_fops = { - flash_llseek, /* llseek */ - flash_read, /* read */ - flash_write, /* write */ - NULL, /* no special readdir */ - NULL, /* no special select */ - flash_ioctl, - NULL, /* no special mmap */ - open_flash, - NULL, /* no special flush */ - release_flash, - NULL, /* no special fsync */ - NULL, /* no special fasync */ - NULL, /* no special check_media_change */ - NULL /* no special revaldate */ + llseek: flash_llseek, + read: flash_read, + write: flash_write, + ioctl: flash_ioctl, + open: open_flash, + release: release_flash, }; static struct miscdevice flash_miscdev = diff --git a/drivers/char/tuner-3036.c b/drivers/char/tuner-3036.c new file mode 100644 index 000000000000..807ae339b16c --- /dev/null +++ b/drivers/char/tuner-3036.c @@ -0,0 +1,227 @@ +/* + * Driver for Philips SAB3036 "CITAC" tuner control chip. + * + * Author: Phil Blundell + * + * The SAB3036 is just about different enough from the chips that + * tuner.c copes with to make it not worth the effort to crowbar + * the support into that file. So instead we have a separate driver. + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "tuner.h" + +static int debug; /* insmod parameter */ +static int this_adap; + +static struct i2c_client client_template; + +/* Addresses to scan */ +static unsigned short normal_i2c[] = {I2C_CLIENT_END}; +static unsigned short normal_i2c_range[] = {0x60, 0x61, I2C_CLIENT_END}; +static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; +static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; +static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; +static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; +static unsigned short force[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; + +static struct i2c_client_address_data addr_data = { + normal_i2c, normal_i2c_range, + probe, probe_range, + ignore, ignore_range, + force +}; + +/* ---------------------------------------------------------------------- */ + +static unsigned char +tuner_getstatus (struct i2c_client *c) +{ + unsigned char byte; + if (i2c_master_recv(c, &byte, 1) != 1) + printk(KERN_ERR "tuner-3036: I/O error.\n"); + return byte; +} + +#define TUNER_FL 0x80 + +static int +tuner_islocked (struct i2c_client *c) +{ + return (tuner_getstatus(c) & TUNER_FL); +} + +/* ---------------------------------------------------------------------- */ + +static void +set_tv_freq(struct i2c_client *c, int freq) +{ + u16 div = ((freq * 20) / 16); + unsigned long give_up = jiffies + HZ; + unsigned char buffer[2]; + + if (debug) + printk(KERN_DEBUG "tuner: setting frequency %dMHz, divisor %x\n", freq / 16, div); + + /* Select high tuning current */ + buffer[0] = 0x29; + buffer[1] = 0x3e; + + if (i2c_master_send(c, buffer, 2) != 2) + printk("tuner: i2c i/o error 1\n"); + + buffer[0] = 0x80 | ((div>>8) & 0x7f); + buffer[1] = div & 0xff; + + if (i2c_master_send(c, buffer, 2) != 2) + printk("tuner: i2c i/o error 2\n"); + + while (!tuner_islocked(c) && time_before(jiffies, give_up)) + schedule(); + + if (!tuner_islocked(c)) + printk(KERN_WARNING "tuner: failed to achieve PLL lock\n"); + + /* Select low tuning current and engage AFC */ + buffer[0] = 0x29; + buffer[1] = 0xb2; + + if (i2c_master_send(c, buffer, 2) != 2) + printk("tuner: i2c i/o error 3\n"); + + if (debug) + printk(KERN_DEBUG "tuner: status %02x\n", tuner_getstatus(c)); +} + +/* ---------------------------------------------------------------------- */ + +static int +tuner_attach(struct i2c_adapter *adap, int addr, + unsigned short flags, int kind) +{ + static unsigned char buffer[] = { 0x29, 0x32, 0x2a, 0, 0x2b, 0 }; + + struct i2c_client *client; + + if (this_adap > 0) + return -1; + this_adap++; + + client_template.adapter = adap; + client_template.addr = addr; + + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == NULL) + return -ENOMEM; + memcpy(client, &client_template, sizeof(struct i2c_client)); + + printk("tuner: SAB3036 found, status %02x\n", tuner_getstatus(client)); + + i2c_attach_client(client); + MOD_INC_USE_COUNT; + + if (i2c_master_send(client, buffer, 2) != 2) + printk("tuner: i2c i/o error 1\n"); + if (i2c_master_send(client, buffer+2, 2) != 2) + printk("tuner: i2c i/o error 2\n"); + if (i2c_master_send(client, buffer+4, 2) != 2) + printk("tuner: i2c i/o error 3\n"); + return 0; +} + +static int +tuner_detach(struct i2c_client *c) +{ + MOD_DEC_USE_COUNT; + return 0; +} + +static int +tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) +{ + int *iarg = (int*)arg; + + switch (cmd) + { + case TUNER_SET_TVFREQ: + set_tv_freq(client, *iarg); + break; + + default: + return -EINVAL; + } + return 0; +} + +static int +tuner_probe(struct i2c_adapter *adap) +{ + this_adap = 0; + if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_LP)) + return i2c_probe(adap, &addr_data, tuner_attach); + return 0; +} + +/* ----------------------------------------------------------------------- */ + +static struct i2c_driver +i2c_driver_tuner = +{ + "sab3036", /* name */ + I2C_DRIVERID_SAB3036, /* ID */ + I2C_DF_NOTIFY, + tuner_probe, + tuner_detach, + tuner_command +}; + +static struct i2c_client client_template = +{ + "SAB3036", /* name */ + -1, + 0, + 0, + NULL, + &i2c_driver_tuner +}; + +EXPORT_NO_SYMBOLS; + +int __init +tuner3036_init(void) +{ + i2c_add_driver(&i2c_driver_tuner); + return 0; +} + +void __exit +tuner3036_exit(void) +{ + i2c_del_driver(&i2c_driver_tuner); +} + +MODULE_DESCRIPTION("SAB3036 tuner driver"); +MODULE_AUTHOR("Philip Blundell "); +MODULE_PARM(debug,"i"); +MODULE_PARM_DESC(debug,"Enable debugging output"); + +module_init(tuner3036_init); +module_exit(tuner3036_exit); diff --git a/drivers/char/wdt285.c b/drivers/char/wdt285.c index b5dc94e2fff6..6efdd7f764f2 100644 --- a/drivers/char/wdt285.c +++ b/drivers/char/wdt285.c @@ -153,18 +153,10 @@ static int watchdog_ioctl(struct inode *inode, struct file *file, static struct file_operations watchdog_fops= { - NULL, /* Seek */ - NULL, /* Read */ - watchdog_write, /* Write */ - NULL, /* Readdir */ - NULL, /* Select */ - watchdog_ioctl, /* Ioctl */ - NULL, /* MMap */ - watchdog_open, - NULL, /* flush */ - watchdog_release, - NULL, - NULL /* Fasync */ + write: watchdog_write, + ioctl: watchdog_ioctl, + open: watchdog_open, + release: watchdog_release, }; static struct miscdevice watchdog_miscdev= diff --git a/drivers/char/wdt977.c b/drivers/char/wdt977.c index c45e63d609a3..9bfbf0cc68d9 100644 --- a/drivers/char/wdt977.c +++ b/drivers/char/wdt977.c @@ -162,18 +162,9 @@ static ssize_t wdt977_write(struct file *file, const char *data, size_t len, lof static struct file_operations wdt977_fops= { - NULL, /* Seek */ - NULL, /* Read */ - wdt977_write, /* Write */ - NULL, /* Readdir */ - NULL, /* Select */ - NULL, /* Ioctl */ - NULL, /* MMap */ - wdt977_open, - NULL, /* flush */ - wdt977_release, - NULL, - NULL /* Fasync */ + write: wdt977_write, + open: wdt977_open, + release: wdt977_release, }; static struct miscdevice wdt977_miscdev= diff --git a/drivers/i2o/i2o_lan.c b/drivers/i2o/i2o_lan.c index d6aa433987a5..ddcefd1a6da1 100644 --- a/drivers/i2o/i2o_lan.c +++ b/drivers/i2o/i2o_lan.c @@ -131,7 +131,7 @@ static void i2o_lan_reply(struct i2o_handler *h, struct i2o_controller *iop, switch (msg[1] >> 24) { case LAN_RECEIVE_POST: { - if (dev->start) { + if (netif_running(dev)) { if (!(msg[4]>>24)) { i2o_lan_receive_post_reply(dev,msg); break; @@ -162,10 +162,8 @@ static void i2o_lan_reply(struct i2o_handler *h, struct i2o_controller *iop, trl_count--; } - if (dev->tbusy) { - clear_bit(0,(void*)&dev->tbusy); - mark_bh(NET_BH); /* inform upper layers */ - } + if (netif_queue_stopped(dev)) + netif_wake_queue(dev); break; } @@ -536,8 +534,7 @@ static int i2o_lan_open(struct net_device *dev) return -ENOMEM; priv->i2o_fbl_tail = -1; - dev->tbusy = 0; - dev->start = 1; + netif_start_queue(dev); i2o_set_batch_mode(dev); i2o_lan_receive_post(dev); @@ -562,8 +559,7 @@ static int i2o_lan_close(struct net_device *dev) printk(KERN_WARNING "%s: Unable to clear the event mask.\n", #endif dev->name); - dev->tbusy = 1; - dev->start = 0; + netif_stop_queue(dev); i2o_lan_suspend(dev); if (i2o_release_device(i2o_dev, &i2o_lan_handler, I2O_CLAIM_PRIMARY)) @@ -617,15 +613,6 @@ static int i2o_lan_packet_send(struct sk_buff *skb, struct net_device *dev) u32 m, *msg; u32 *sgl_elem; - /* - * Keep interrupt from changing dev->tbusy from underneath us - * (Do we really need to do this?) - */ - - if (test_and_set_bit(0,(void*)&dev->tbusy) != 0) { - return 1; - } - priv->tx_count++; priv->tx_out++; @@ -673,8 +660,8 @@ static int i2o_lan_packet_send(struct sk_buff *skb, struct net_device *dev) /* If HDMs TxMaxPktOut reached, stay busy (don't clean tbusy) */ - if (priv->tx_out < priv->tx_max_out) - clear_bit(0, (void *)&dev->tbusy); + if (priv->tx_out >= priv->tx_max_out) + netif_stop_queue(dev); return 0; } diff --git a/drivers/ieee1394/aic5800.c b/drivers/ieee1394/aic5800.c index 73c1928cdd55..be65166848cc 100644 --- a/drivers/ieee1394/aic5800.c +++ b/drivers/ieee1394/aic5800.c @@ -26,11 +26,11 @@ #include #include #include +#include #include #include #include #include -#include #include "ieee1394_types.h" #include "hosts.h" diff --git a/drivers/isdn/avmb1/capi.c b/drivers/isdn/avmb1/capi.c index fb8a32460d4a..6cd9cf3e441f 100644 --- a/drivers/isdn/avmb1/capi.c +++ b/drivers/isdn/avmb1/capi.c @@ -515,18 +515,13 @@ capi_release(struct inode *inode, struct file *file) static struct file_operations capi_fops = { - capi_llseek, - capi_read, - capi_write, - NULL, /* capi_readdir */ - capi_poll, - capi_ioctl, - NULL, /* capi_mmap */ - capi_open, - NULL, /* capi_flush */ - capi_release, - NULL, /* capi_fsync */ - NULL, /* capi_fasync */ + llseek: capi_llseek, + read: capi_read, + write: capi_write, + poll: capi_poll, + ioctl: capi_ioctl, + open: capi_open, + release: capi_release, }; /* -------- /proc functions ----------------------------------- */ diff --git a/drivers/isdn/divert/divert_procfs.c b/drivers/isdn/divert/divert_procfs.c index de56823c09b5..5dc6924e1138 100644 --- a/drivers/isdn/divert/divert_procfs.c +++ b/drivers/isdn/divert/divert_procfs.c @@ -302,17 +302,13 @@ isdn_divert_lseek(struct file *file, loff_t offset, int orig) static struct file_operations isdn_fops = { - isdn_divert_lseek, - isdn_divert_read, - isdn_divert_write, - NULL, /* isdn_readdir */ - isdn_divert_poll, /* isdn_poll */ - isdn_divert_ioctl, /* isdn_ioctl */ - NULL, /* isdn_mmap */ - isdn_divert_open, - NULL, /* flush */ - isdn_divert_close, - NULL /* fsync */ + llseek: isdn_divert_lseek, + read: isdn_divert_read, + write: isdn_divert_write, + poll: isdn_divert_poll, + ioctl: isdn_divert_ioctl, + open: isdn_divert_open, + release: isdn_divert_close, }; /****************************/ diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c index 85040aabf96e..71bc7db99d9c 100644 --- a/drivers/isdn/hisax/hfc_sx.c +++ b/drivers/isdn/hisax/hfc_sx.c @@ -41,7 +41,6 @@ * */ -#include #define __NO_VERSION__ #include "hisax.h" #include "hfc_sx.h" diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 4cb480588a7a..20d69e32f606 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c @@ -403,17 +403,11 @@ hysdn_conf_close(struct inode *ino, struct file *filep) /******************************************************/ static struct file_operations conf_fops = { - hysdn_dummy_lseek, - hysdn_conf_read, - hysdn_conf_write, - NULL, /* readdir */ - NULL, /* poll */ - NULL, /* ioctl */ - NULL, /* mmap */ - hysdn_conf_open, - NULL, /* flush */ - hysdn_conf_close, - NULL /* fsync */ + llseek: hysdn_dummy_lseek, + read: hysdn_conf_read, + write: hysdn_conf_write, + open: hysdn_conf_open, + release: hysdn_conf_close, }; /*****************************/ diff --git a/drivers/isdn/hysdn/hysdn_procfs.c b/drivers/isdn/hysdn/hysdn_procfs.c index b43e2ade7546..867b22766038 100644 --- a/drivers/isdn/hysdn/hysdn_procfs.c +++ b/drivers/isdn/hysdn/hysdn_procfs.c @@ -338,17 +338,12 @@ hysdn_log_poll(struct file *file, poll_table * wait) /**************************************************/ static struct file_operations log_fops = { - hysdn_dummy_lseek, - hysdn_log_read, - hysdn_log_write, - NULL, /* readdir */ - hysdn_log_poll, /* poll */ - NULL, /*hysdn_log_ioctl, *//* ioctl */ - NULL, /* mmap */ - hysdn_log_open, - NULL, /* flush */ - hysdn_log_close, - NULL /* fsync */ + llseek: hysdn_dummy_lseek, + read: hysdn_log_read, + write: hysdn_log_write, + poll: hysdn_log_poll, + open: hysdn_log_open, + release: hysdn_log_close, }; /*****************************************/ diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index 67a91cf0fcca..4a585053af78 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c @@ -420,17 +420,12 @@ hysdn_log_poll(struct file *file, poll_table * wait) /**************************************************/ static struct file_operations log_fops = { - hysdn_dummy_lseek, - hysdn_log_read, - hysdn_log_write, - NULL, /* readdir */ - hysdn_log_poll, /* poll */ - NULL, - NULL, /* mmap */ - hysdn_log_open, - NULL, /* flush */ - hysdn_log_close, - NULL /* fsync */ + llseek: hysdn_dummy_lseek, + read: hysdn_log_read, + write: hysdn_log_write, + poll: hysdn_log_poll, + open: hysdn_log_open, + release: hysdn_log_close, }; /***********************************************************************************/ diff --git a/drivers/isdn/isdn_common.c b/drivers/isdn/isdn_common.c index b259cdc4b3b9..b8e9efa0f703 100644 --- a/drivers/isdn/isdn_common.c +++ b/drivers/isdn/isdn_common.c @@ -2070,17 +2070,13 @@ isdn_close(struct inode *ino, struct file *filep) static struct file_operations isdn_fops = { - isdn_lseek, - isdn_read, - isdn_write, - NULL, /* isdn_readdir */ - isdn_poll, /* isdn_poll */ - isdn_ioctl, /* isdn_ioctl */ - NULL, /* isdn_mmap */ - isdn_open, - NULL, /* flush */ - isdn_close, - NULL /* fsync */ + llseek: isdn_lseek, + read: isdn_read, + write: isdn_write, + poll: isdn_poll, + ioctl: isdn_ioctl, + open: isdn_open, + release: isdn_close, }; char * diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c index 0c14baed5f1d..473700fa8ee9 100644 --- a/drivers/macintosh/via-pmu68k.c +++ b/drivers/macintosh/via-pmu68k.c @@ -1038,16 +1038,10 @@ static int /*__openfirmware*/ pmu_ioctl(struct inode * inode, struct file *filp, } static struct file_operations pmu_device_fops = { - NULL, /* no seek */ - pmu_read, - pmu_write, - NULL, /* no readdir */ - NULL, /* no poll yet */ - pmu_ioctl, - NULL, /* no mmap */ - pmu_open, - NULL, /* flush */ - NULL /* no release */ + read: pmu_read, + write: pmu_write, + ioctl: pmu_ioctl, + open: pmu_open, }; static struct miscdevice pmu_device = { diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c index 5a5d5fcf0cac..5e948c7e7e30 100644 --- a/drivers/net/3c505.c +++ b/drivers/net/3c505.c @@ -1242,12 +1242,12 @@ static void elp_set_mc_list(struct net_device *dev) adapter->got[CMD_CONFIGURE_82586] = 0; if (!send_pcb(dev, &adapter->tx_pcb)) { - spin_unlock_irqrestore(&lp->lock, flags); + spin_unlock_irqrestore(&adapter->lock, flags); printk("%s: couldn't send 82586 configure command\n", dev->name); } else { int timeout = jiffies + TIMEOUT; - spin_unlock_irqrestore(&lp->lock, flags); + spin_unlock_irqrestore(&adapter->lock, flags); while (adapter->got[CMD_CONFIGURE_82586] == 0 && time_before(jiffies, timeout)); if (time_after_eq(jiffies, timeout)) TIMEOUT_MSG(__LINE__); diff --git a/drivers/net/aironet4500.h b/drivers/net/aironet4500.h index 95f0d23af11b..914976a7094a 100644 --- a/drivers/net/aironet4500.h +++ b/drivers/net/aironet4500.h @@ -19,17 +19,7 @@ /*#include #include */ -#if LINUX_VERSION_CODE < 0x2030E -#define NET_DEVICE device -#error bad kernel version code -#else -#define NET_DEVICE net_device -#endif - -#if LINUX_VERSION_CODE < 0x20300 -#define init_MUTEX(a) *(a) = MUTEX; -#endif /* #include #include @@ -63,11 +53,6 @@ typedef spinlock_t my_spinlock_t ; #define my_spin_unlock_irqrestore(a,b) spin_unlock_irqrestore(a,b) -#if LINUX_VERSION_CODE <= 0x20100 -#define in_interrupt() intr_count -#endif - - #define AWC_ERROR -1 #define AWC_SUCCESS 0 @@ -81,6 +66,10 @@ struct awc_cis { }; +/* timeout for transmit watchdog timer */ +#define TX_TIMEOUT (HZ * 3) + + /*************************** REGISTER OFFSETS *********************/ #define awc_Command_register 0x00 @@ -137,7 +126,7 @@ struct awc_bap { struct awc_command { volatile int state; volatile int lock_state; - struct NET_DEVICE * dev; + struct net_device * dev; struct awc_private * priv; u16 port; struct awc_bap * bap; @@ -1293,7 +1282,7 @@ struct awc_strings { /***************************** R I D ***************/ #define AWC_NOF_RIDS 18 -extern int awc_rid_setup(struct NET_DEVICE * dev); +extern int awc_rid_setup(struct net_device * dev); struct aironet4500_rid_selector{ const u16 selector; @@ -1427,7 +1416,7 @@ struct awc_rid_dir{ const struct aironet4500_rid_selector * selector; const int size; const struct aironet4500_RID * rids; - struct NET_DEVICE * dev ; + struct net_device * dev ; void * buff; int bufflen; // just checking }; @@ -1490,8 +1479,6 @@ struct awc_private { int large_buff_mem; int small_buff_no; - int tx_timeout; - volatile int mac_enabled; u16 link_status; u8 link_status_changed; @@ -1533,60 +1520,59 @@ struct awc_private { int card_type; }; -extern int awc_init(struct NET_DEVICE * dev); -extern void awc_reset(struct NET_DEVICE *dev); -extern int awc_config(struct NET_DEVICE *dev); -extern int awc_open(struct NET_DEVICE *dev); -extern void awc_tx_timeout(struct NET_DEVICE *dev); -extern int awc_tx_done(struct awc_fid * rx_fid); -extern int awc_start_xmit(struct sk_buff *, struct NET_DEVICE *); +extern int awc_init(struct net_device * dev); +extern void awc_reset(struct net_device *dev); +extern int awc_config(struct net_device *dev); +extern int awc_open(struct net_device *dev); +extern void awc_tx_timeout(struct net_device *dev); +extern int awc_start_xmit(struct sk_buff *, struct net_device *); extern void awc_interrupt(int irq, void *dev_id, struct pt_regs *regs); -extern struct enet_statistics * awc_get_stats(struct NET_DEVICE *dev); -extern int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid); -extern void awc_set_multicast_list(struct NET_DEVICE *dev); -extern int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu); -extern int awc_close(struct NET_DEVICE *dev); -extern int awc_private_init(struct NET_DEVICE * dev); +extern struct enet_statistics * awc_get_stats(struct net_device *dev); +extern int awc_rx(struct net_device *dev, struct awc_fid * rx_fid); +extern void awc_set_multicast_list(struct net_device *dev); +extern int awc_change_mtu(struct net_device *dev, int new_mtu); +extern int awc_close(struct net_device *dev); +extern int awc_private_init(struct net_device * dev); extern int awc_register_proc(int (*awc_proc_set_device) (int),int (*awc_proc_unset_device)(int)); extern int awc_unregister_proc(void); extern int (* awc_proc_set_fun) (int) ; extern int (* awc_proc_unset_fun) (int) ; -extern int awc_interrupt_process(struct NET_DEVICE * dev); -extern int awc_readrid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf ); -extern int awc_writerid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf); -extern int awc_readrid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid ); -extern int awc_writerid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid); -extern int awc_tx_alloc(struct NET_DEVICE * dev) ; -extern int awc_tx_dealloc(struct NET_DEVICE * dev); -extern struct awc_fid *awc_tx_fid_lookup(struct NET_DEVICE * dev, u16 fid); -extern int awc_issue_soft_reset(struct NET_DEVICE * dev); -extern int awc_issue_noop(struct NET_DEVICE * dev); -extern int awc_dump_registers(struct NET_DEVICE * dev); +extern int awc_interrupt_process(struct net_device * dev); +extern int awc_readrid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf ); +extern int awc_writerid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf); +extern int awc_readrid_dir(struct net_device * dev, struct awc_rid_dir * rid ); +extern int awc_writerid_dir(struct net_device * dev, struct awc_rid_dir * rid); +extern int awc_tx_alloc(struct net_device * dev) ; +extern int awc_tx_dealloc(struct net_device * dev); +extern struct awc_fid *awc_tx_fid_lookup(struct net_device * dev, u16 fid); +extern int awc_issue_soft_reset(struct net_device * dev); +extern int awc_issue_noop(struct net_device * dev); +extern int awc_dump_registers(struct net_device * dev); extern unsigned short awc_issue_command_and_block(struct awc_command * cmd); -extern int awc_enable_MAC(struct NET_DEVICE * dev); -extern int awc_disable_MAC(struct NET_DEVICE * dev); -extern int awc_read_all_rids(struct NET_DEVICE * dev); -extern int awc_write_all_rids(struct NET_DEVICE * dev); -extern int awc_receive_packet(struct NET_DEVICE * dev); -extern int awc_transmit_packet(struct NET_DEVICE * dev, struct awc_fid * tx_buff) ; -extern int awc_tx_complete_check(struct NET_DEVICE * dev); -extern int awc_interrupt_process(struct NET_DEVICE * dev); -extern void awc_bh(struct NET_DEVICE *dev); -extern int awc_802_11_find_copy_path(struct NET_DEVICE * dev, struct awc_fid * rx_buff); -extern void awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff); -extern int awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev, struct sk_buff * skb); -extern void awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev, struct awc_fid * tx_buff); -extern void awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev,struct awc_fid * tx_buff); -extern void awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff); -extern void awc_802_11_failed_rx_copy(struct NET_DEVICE * dev,struct awc_fid * rx_buff); -extern int awc_tx_alloc(struct NET_DEVICE * dev) ; -extern int awc_tx_dealloc_fid(struct NET_DEVICE * dev,struct awc_fid * fid); -extern int awc_tx_dealloc(struct NET_DEVICE * dev); +extern int awc_enable_MAC(struct net_device * dev); +extern int awc_disable_MAC(struct net_device * dev); +extern int awc_read_all_rids(struct net_device * dev); +extern int awc_write_all_rids(struct net_device * dev); +extern int awc_receive_packet(struct net_device * dev); +extern int awc_transmit_packet(struct net_device * dev, struct awc_fid * tx_buff) ; +extern int awc_tx_complete_check(struct net_device * dev); +extern int awc_interrupt_process(struct net_device * dev); +extern void awc_bh(struct net_device *dev); +extern int awc_802_11_find_copy_path(struct net_device * dev, struct awc_fid * rx_buff); +extern void awc_802_11_router_rx(struct net_device * dev,struct awc_fid * rx_buff); +extern int awc_802_11_tx_find_path_and_post(struct net_device * dev, struct sk_buff * skb); +extern void awc_802_11_after_tx_packet_to_card_write(struct net_device * dev, struct awc_fid * tx_buff); +extern void awc_802_11_after_failed_tx_packet_to_card_write(struct net_device * dev,struct awc_fid * tx_buff); +extern void awc_802_11_after_tx_complete(struct net_device * dev, struct awc_fid * tx_buff); +extern void awc_802_11_failed_rx_copy(struct net_device * dev,struct awc_fid * rx_buff); +extern int awc_tx_alloc(struct net_device * dev) ; +extern int awc_tx_dealloc_fid(struct net_device * dev,struct awc_fid * fid); +extern int awc_tx_dealloc(struct net_device * dev); extern struct awc_fid * - awc_tx_fid_lookup_and_remove(struct NET_DEVICE * dev, u16 fid_handle); -extern int awc_queues_init(struct NET_DEVICE * dev); -extern int awc_queues_destroy(struct NET_DEVICE * dev); -extern int awc_rids_setup(struct NET_DEVICE * dev); + awc_tx_fid_lookup_and_remove(struct net_device * dev, u16 fid_handle); +extern int awc_queues_init(struct net_device * dev); +extern int awc_queues_destroy(struct net_device * dev); +extern int awc_rids_setup(struct net_device * dev); @@ -1603,7 +1589,7 @@ extern int tx_rate; extern int awc_full_stats; #define MAX_AWCS 4 -extern struct NET_DEVICE * aironet4500_devices[MAX_AWCS]; +extern struct net_device * aironet4500_devices[MAX_AWCS]; #define AWC_DEBUG 1 @@ -1615,16 +1601,4 @@ extern struct NET_DEVICE * aironet4500_devices[MAX_AWCS]; #define AWC_ENTRY_EXIT_DEBUG(a) #endif -#if LINUX_VERSION_CODE < 0x20100 -#ifndef test_and_set_bit - #define test_and_set_bit(a,b) set_bit(a,b) -#endif -#endif - -#if LINUX_VERSION_CODE < 0x20100 - #define FREE_SKB(a) dev_kfree_skb(a, FREE_WRITE) -#else - #define FREE_SKB(a) dev_kfree_skb(a) -#endif - #endif /* AIRONET4500_H */ diff --git a/drivers/net/aironet4500_card.c b/drivers/net/aironet4500_card.c index b6a00e87549c..b271b18f4641 100644 --- a/drivers/net/aironet4500_card.c +++ b/drivers/net/aironet4500_card.c @@ -7,11 +7,13 @@ * * Revision 0.1 ,started 30.12.1998 * + * Revision 0.2, Feb 27, 2000 + * Jeff Garzik - softnet, cleanups * */ #ifdef MODULE static const char *awc_version = -"aironet4500_cards.c v0.1 28/03/99 Elmer Joandi, elmer@ylenurme.ee.\n"; +"aironet4500_cards.c v0.2 Feb 27, 2000 Elmer Joandi, elmer@ylenurme.ee.\n"; #endif #include @@ -36,9 +38,6 @@ static const char *awc_version = #include #include #include -#if LINUX_VERSION_CODE < 0x20100 -#include -#endif #include "aironet4500.h" @@ -64,11 +63,11 @@ static const char *awc_version = static int reverse_probe =0 ; -static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr, +static int awc_pci_init(struct net_device * dev, struct pci_dev *pdev, int ioaddr, int cis_addr, int mem_addr,u8 pci_irq_line) ; -int awc4500_pci_probe(struct NET_DEVICE *dev) +int awc4500_pci_probe(struct net_device *dev) { int cards_found = 0; static int pci_index = 0; /* Static, for multiple probe calls. */ @@ -77,7 +76,7 @@ int awc4500_pci_probe(struct NET_DEVICE *dev) unsigned char awc_pci_dev, awc_pci_bus; - if (!pcibios_present()) + if (!pci_present()) return -1; for (;pci_index < 0xff; pci_index++) { @@ -85,10 +84,8 @@ int awc4500_pci_probe(struct NET_DEVICE *dev) u32 pci_memaddr; u32 pci_ioaddr; u32 pci_cisaddr; -#if LINUX_VERSION_CODE < 0x20100 - u16 pci_caps =0; - u8 pci_caps_ptr =0; -#endif + struct pci_dev *pdev; + if (pcibios_find_class (PCI_CLASS_NETWORK_OTHER << 8, reverse_probe ? 0xfe - pci_index : pci_index, &awc_pci_bus, &awc_pci_dev) != PCIBIOS_SUCCESSFUL){ @@ -98,31 +95,16 @@ int awc4500_pci_probe(struct NET_DEVICE *dev) break; } } - pcibios_read_config_word(awc_pci_bus, awc_pci_dev, - PCI_VENDOR_ID, &vendor); - pcibios_read_config_word(awc_pci_bus, awc_pci_dev, - PCI_DEVICE_ID, &device); -#if LINUX_VERSION_CODE >= 0x20300 - pci_irq_line = pci_find_slot(awc_pci_bus, awc_pci_dev)->irq; - pci_memaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[0].start; - pci_cisaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[1].start; - pci_ioaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[2].start; -#else -#if LINUX_VERSION_CODE >= 0x20155 - pci_irq_line = pci_find_slot(awc_pci_bus, awc_pci_dev)->irq; - pci_memaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[0]; - pci_cisaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[1]; - pci_ioaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[2]; -#else - pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_0, &pci_memaddr); - pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_1, &pci_cisaddr); - pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_2, &pci_ioaddr); - pcibios_read_config_byte(awc_pci_bus, awc_pci_dev, PCI_INTERRUPT_LINE, &pci_irq_line); - pcibios_read_config_word(awc_pci_bus, awc_pci_dev,PCI_STATUS, &pci_caps); - pcibios_read_config_byte(awc_pci_bus, awc_pci_dev, 0x34, &pci_caps_ptr); - -#endif // 2.2 -#endif // 2.3 + pdev = pci_find_slot(awc_pci_bus, awc_pci_dev); + if (!pdev) + continue; + vendor = pdev->vendor; + device = pdev->device; + pci_irq_line = pdev->irq; + pci_memaddr = pci_resource_start (pdev, 0); + pci_cisaddr = pci_resource_start (pdev, 1); + pci_ioaddr = pci_resource_start (pdev, 2); + // printk("\n pci capabilities %x and ptr %x \n",pci_caps,pci_caps_ptr); /* Remove I/O space marker in bit 0. */ @@ -132,17 +114,7 @@ int awc4500_pci_probe(struct NET_DEVICE *dev) device != PCI_DEVICE_AIRONET_4800 && device != PCI_DEVICE_AIRONET_4500 ) continue; -#if LINUX_VERSION_CODE < 0x20300 - - if (!(pci_ioaddr & 1)){ - printk("awc4X00 ioaddr location mismatch \n"); - return -1; - }; - pci_ioaddr &= ~3; - pci_cisaddr &= ~0xf; - pci_memaddr &= ~0xf; -#endif // if (check_region(pci_ioaddr, AIRONET4X00_IO_SIZE) || // check_region(pci_cisaddr, AIRONET4X00_CIS_SIZE) || // check_region(pci_memaddr, AIRONET4X00_MEM_SIZE)) { @@ -153,33 +125,28 @@ int awc4500_pci_probe(struct NET_DEVICE *dev) // request_region(pci_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis"); // request_region(pci_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem"); -// pcibios_write_config_word(awc_pci_bus, awc_pci_dev, -// PCI_COMMAND, 0); +// pci_write_config_word(pdev, PCI_COMMAND, 0); udelay(10000); - pcibios_read_config_word(awc_pci_bus, awc_pci_dev, - PCI_COMMAND, &pci_command); + pci_read_config_word(pdev, PCI_COMMAND, &pci_command); new_command = pci_command |0x100 | PCI_COMMAND_MEMORY|PCI_COMMAND_IO; if (pci_command != new_command) { printk(KERN_INFO " The PCI BIOS has not enabled this" " device! Updating PCI command %4.4x->%4.4x.\n", pci_command, new_command); - pcibios_write_config_word(awc_pci_bus, awc_pci_dev, - PCI_COMMAND, new_command); + pci_write_config_word(pdev, PCI_COMMAND, new_command); } /* if (device == PCI_DEVICE_AIRONET_4800) - pcibios_write_config_dword(awc_pci_bus, awc_pci_dev, - 0x40, 0x00000000); + pci_write_config_dword(pdev, 0x40, 0x00000000); udelay(1000); */ if (device == PCI_DEVICE_AIRONET_4800) - pcibios_write_config_dword(awc_pci_bus, awc_pci_dev, - 0x40, 0x40000000); + pci_write_config_dword(pdev, 0x40, 0x40000000); - if (awc_pci_init(dev, awc_pci_bus, awc_pci_dev, pci_ioaddr,pci_cisaddr,pci_memaddr,pci_irq_line)){ + if (awc_pci_init(dev, pdev, pci_ioaddr,pci_cisaddr,pci_memaddr,pci_irq_line)){ printk(KERN_ERR "awc4800 pci init failed \n"); break; } @@ -191,7 +158,7 @@ int awc4500_pci_probe(struct NET_DEVICE *dev) } -static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr, +static int awc_pci_init(struct net_device * dev, struct pci_dev *pdev, int ioaddr, int cis_addr, int mem_addr, u8 pci_irq_line) { int i; @@ -218,18 +185,15 @@ static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr, dev->init = &awc_init; dev->open = &awc_open; dev->stop = &awc_close; - dev->tbusy = 1; - dev->start = 0; - dev->base_addr = ioaddr; - - dev->irq = pci_irq_line; -#if LINUX_VERSION_CODE > 0x20100 - request_irq(dev->irq,awc_interrupt, SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev); -#else + dev->tx_timeout = &awc_tx_timeout; + dev->watchdog_timeo = TX_TIMEOUT; + + netif_start_queue (dev); + request_irq(dev->irq,awc_interrupt, SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev); -#endif + awc_private_init( dev); awc_init(dev); @@ -244,17 +208,11 @@ static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr, awc_proc_set_fun(i); } - dev->tbusy = 1; - dev->start = 0; - - // if (register_netdev(dev) != 0) { // printk(KERN_NOTICE "awc_cs: register_netdev() failed\n"); // goto failed; // } - - return 0; // failed: // return -1; @@ -285,7 +243,7 @@ static void awc_pci_release(void) { unregister_netdev(aironet4500_devices[i]); free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]); kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private)); - kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE)); + kfree_s(aironet4500_devices[i], sizeof(struct net_device)); aironet4500_devices[i]=0; @@ -304,14 +262,9 @@ static void awc_pci_release(void) { #ifdef CONFIG_AIRONET4500_PNP -#if LINUX_VERSION_CODE > 0x20300 #include -#else -#include "isapnp.h" -#endif #define AIRONET4X00_IO_SIZE 0x40 -#if LINUX_VERSION_CODE > 0x20300 #define isapnp_logdev pci_dev #define isapnp_dev pci_bus #define isapnp_find_device isapnp_find_card @@ -319,17 +272,11 @@ static void awc_pci_release(void) { #define PNP_BUS bus #define PNP_BUS_NUMBER number #define PNP_DEV_NUMBER devfn -#else -#define PNP_BUS dev -#define PNP_BUS_NUMBER csn -#define PNP_DEV_NUMBER number -#endif -int awc4500_pnp_hw_reset(struct NET_DEVICE *dev){ + +int awc4500_pnp_hw_reset(struct net_device *dev){ struct isapnp_logdev *logdev; -#if LINUX_VERSION_CODE < 0x20300 - struct isapnp_config cfg; -#endif + DEBUG(0, "awc_pnp_reset \n"); if (!dev->priv ) { @@ -357,30 +304,14 @@ int awc4500_pnp_hw_reset(struct NET_DEVICE *dev){ dev->name, logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER); return -EAGAIN; } -#if LINUX_VERSION_CODE < 0x20300 - if (isapnp_config_init(&cfg, logdev)<0) { - printk("cfg init failed \n"); - isapnp_cfg_end(); - return -EAGAIN; - } - cfg.port[0] = dev->base_addr; - cfg.irq[0] = dev->irq; - if (isapnp_configure(&cfg)<0) { - printk("%s hw_reset, isapnp configure failed (out of resources?)\n",dev->name); - isapnp_cfg_end(); - return -ENOMEM; - } -#else - -#endif isapnp_activate(logdev->PNP_DEV_NUMBER); /* activate device */ isapnp_cfg_end(); return 0; } -int awc4500_pnp_probe(struct NET_DEVICE *dev) +int awc4500_pnp_probe(struct net_device *dev) { int isa_index = 0; int isa_irq_line = 0; @@ -389,21 +320,13 @@ int awc4500_pnp_probe(struct NET_DEVICE *dev) int i=0; struct isapnp_dev * pnp_dev ; struct isapnp_logdev *logdev; -#if LINUX_VERSION_CODE < 0x20300 - struct isapnp_config cfg; -#endif while (1) { pnp_dev = isapnp_find_device( ISAPNP_VENDOR('A','W','L'), ISAPNP_DEVICE(1), -#if LINUX_VERSION_CODE < 0x20300 - isa_index -#else - 0 -#endif - ); + 0); if (!pnp_dev) break; @@ -421,28 +344,11 @@ int awc4500_pnp_probe(struct NET_DEVICE *dev) logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER); return -EAGAIN; } -#if LINUX_VERSION_CODE < 0x20300 - if (isapnp_config_init(&cfg, logdev)<0) { - printk("cfg init failed \n"); - isapnp_cfg_end(); - return -EAGAIN; - } - if (isapnp_configure(&cfg)<0) { - printk("isapnp configure failed (out of resources?)\n"); - isapnp_cfg_end(); - return -ENOMEM; - } -#endif isapnp_activate(logdev->PNP_DEV_NUMBER); /* activate device */ isapnp_cfg_end(); -#if LINUX_VERSION_CODE < 0x20300 - isa_ioaddr = cfg.port[0]; - isa_irq_line = cfg.irq[0]; -#else isa_irq_line = logdev->irq; isa_ioaddr = logdev->resource[0].start; -#endif request_region(isa_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr"); if (!dev) { @@ -468,18 +374,14 @@ int awc4500_pnp_probe(struct NET_DEVICE *dev) dev->init = &awc_init; dev->open = &awc_open; dev->stop = &awc_close; - dev->tbusy = 1; - dev->start = 0; - dev->base_addr = isa_ioaddr; - - dev->irq = isa_irq_line; -#if LINUX_VERSION_CODE > 0x20100 + dev->tx_timeout = &awc_tx_timeout; + dev->watchdog_timeo = TX_TIMEOUT; + + netif_start_queue (dev); + request_irq(dev->irq,awc_interrupt , SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev); -#else - request_irq(dev->irq,awc_interrupt, SA_SHIRQ ,"Aironet 4X00",dev); -#endif awc_private_init( dev); @@ -512,9 +414,6 @@ int awc4500_pnp_probe(struct NET_DEVICE *dev) return -1; } - dev->tbusy = 1; - dev->start = 0; - card++; } @@ -557,7 +456,7 @@ static void awc_pnp_release(void) { unregister_netdev(aironet4500_devices[i]); free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]); kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private)); - kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE)); + kfree_s(aironet4500_devices[i], sizeof(struct net_device)); aironet4500_devices[i]=0; @@ -580,16 +479,14 @@ static int io[] = {0,0,0,0,0}; EXPORT_SYMBOL(irq); EXPORT_SYMBOL(io); */ -#if LINUX_VERSION_CODE >= 0x20100 MODULE_PARM(irq,"i"); MODULE_PARM_DESC(irq,"Aironet 4x00 ISA non-PNP irqs,required"); MODULE_PARM(io,"i"); MODULE_PARM_DESC(io,"Aironet 4x00 ISA non-PNP ioports,required"); -#endif -int awc4500_isa_probe(struct NET_DEVICE *dev) +int awc4500_isa_probe(struct net_device *dev) { // int cards_found = 0; // static int isa_index = 0; /* Static, for multiple probe calls. */ @@ -638,19 +535,14 @@ int awc4500_isa_probe(struct NET_DEVICE *dev) dev->init = &awc_init; dev->open = &awc_open; dev->stop = &awc_close; - dev->tbusy = 1; - dev->start = 0; - dev->base_addr = isa_ioaddr; - - dev->irq = isa_irq_line; + dev->tx_timeout = &awc_tx_timeout; + dev->watchdog_timeo = TX_TIMEOUT; + + netif_start_queue (dev); -#if LINUX_VERSION_CODE > 0x20100 request_irq(dev->irq,awc_interrupt ,SA_INTERRUPT ,"Aironet 4X00",dev); -#else - request_irq(dev->irq,awc_interrupt ,0 ,"Aironet 4X00",dev); -#endif awc_private_init( dev); if ( awc_init(dev) ){ @@ -671,9 +563,6 @@ int awc4500_isa_probe(struct NET_DEVICE *dev) awc_proc_set_fun(i); } - dev->tbusy = 1; - dev->start = 0; - card++; } if (card == 0 ) { @@ -707,7 +596,7 @@ static void awc_isa_release(void) { unregister_netdev(aironet4500_devices[i]); free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]); kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private)); - kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE)); + kfree_s(aironet4500_devices[i], sizeof(struct net_device)); aironet4500_devices[i]=0; @@ -906,7 +795,7 @@ int awc_i365_probe_once(struct i365_socket * s ){ static int awc_i365_init(struct i365_socket * s) { - struct NET_DEVICE * dev; + struct net_device * dev; int i; @@ -923,11 +812,12 @@ static int awc_i365_init(struct i365_socket * s) { dev->init = &awc_init; dev->open = &awc_open; dev->stop = &awc_close; - dev->tbusy = 1; - dev->start = 0; dev->irq = s->irq; dev->base_addr = s->io; + dev->tx_timeout = &awc_tx_timeout; + dev->watchdog_timeo = TX_TIMEOUT; + netif_start_queue (dev); awc_private_init( dev); @@ -943,24 +833,18 @@ static int awc_i365_init(struct i365_socket * s) { awc_proc_set_fun(i); } - dev->tbusy = 1; - dev->start = 0; - - if (register_netdev(dev) != 0) { printk(KERN_NOTICE "awc_cs: register_netdev() failed\n"); goto failed; } - - return 0; failed: return -1; - } + static void awc_i365_release(void) { // long flags; @@ -983,7 +867,7 @@ static void awc_i365_release(void) { unregister_netdev(aironet4500_devices[i]); //kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private)); - kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE)); + kfree_s(aironet4500_devices[i], sizeof(struct net_device)); aironet4500_devices[i]=0; diff --git a/drivers/net/aironet4500_core.c b/drivers/net/aironet4500_core.c index 1b82d471532e..205a43d97a28 100644 --- a/drivers/net/aironet4500_core.c +++ b/drivers/net/aironet4500_core.c @@ -72,7 +72,7 @@ const char * awc_print_string( struct awc_strings* strings, int code){ return "UNKNOWN"; }; -int awc_dump_registers(struct NET_DEVICE * dev){ +int awc_dump_registers(struct net_device * dev){ #ifdef AWC_DEBUG int i; @@ -108,7 +108,7 @@ int awc_dump_registers(struct NET_DEVICE * dev){ inline -int awc_command_busy_clear_wait(struct NET_DEVICE * dev){ +int awc_command_busy_clear_wait(struct net_device * dev){ // long long jiff = jiffies; u16 active_interrupts; int cnt= 0; @@ -319,7 +319,7 @@ awc_issue_command(struct awc_command * cmd){ inline unsigned short -awc_issue_command_no_ack(struct NET_DEVICE * dev, +awc_issue_command_no_ack(struct net_device * dev, u16 com, u16 par1, u16 par2, u16 par3){ struct awc_private * priv = (struct awc_private *)dev->priv; @@ -695,7 +695,7 @@ struct awc_rid_dir awc_rids_temp[]={ int -awc_readrid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf ){ +awc_readrid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf ){ struct awc_command cmd; int sleep_state ; @@ -728,7 +728,7 @@ awc_readrid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf ){ } int -awc_writerid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf){ +awc_writerid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf){ struct awc_command cmd; int sleep_state ; @@ -765,7 +765,7 @@ awc_writerid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf){ } int -awc_readrid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid ){ +awc_readrid_dir(struct net_device * dev, struct awc_rid_dir * rid ){ struct awc_command cmd; int sleep_state; @@ -798,7 +798,7 @@ awc_readrid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid ){ } int -awc_writerid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid){ +awc_writerid_dir(struct net_device * dev, struct awc_rid_dir * rid){ struct awc_command cmd; int sleep_state ; @@ -847,7 +847,7 @@ EXPORT_SYMBOL(awc_writerid_dir); inline int -awc_issue_blocking_command(struct NET_DEVICE * dev,u16 comm){ +awc_issue_blocking_command(struct net_device * dev,u16 comm){ struct awc_command cmd; // struct awc_private * priv = (struct awc_private *)dev->priv; @@ -872,7 +872,7 @@ awc_issue_blocking_command(struct NET_DEVICE * dev,u16 comm){ }; int -awc_issue_soft_reset(struct NET_DEVICE * dev){ +awc_issue_soft_reset(struct net_device * dev){ u16 status ; // int i= 0; @@ -912,7 +912,7 @@ awc_issue_soft_reset(struct NET_DEVICE * dev){ }; int -awc_issue_noop(struct NET_DEVICE * dev){ +awc_issue_noop(struct net_device * dev){ int retval; AWC_OUT(dev->base_addr + 0x28, 0); AWC_OUT(dev->base_addr + 0x2A, 0); @@ -925,7 +925,7 @@ awc_issue_noop(struct NET_DEVICE * dev){ EXPORT_SYMBOL(awc_enable_MAC); int -awc_enable_MAC(struct NET_DEVICE * dev){ +awc_enable_MAC(struct net_device * dev){ struct awc_private * priv = (struct awc_private *)dev->priv; AWC_ENTRY_EXIT_DEBUG(" entry awc_enable_MAC "); @@ -950,7 +950,7 @@ awc_enable_MAC(struct NET_DEVICE * dev){ EXPORT_SYMBOL(awc_disable_MAC); int -awc_disable_MAC(struct NET_DEVICE * dev){ +awc_disable_MAC(struct net_device * dev){ struct awc_private * priv = (struct awc_private *)dev->priv; AWC_ENTRY_EXIT_DEBUG(" entry awc_disable_MAC "); @@ -973,7 +973,7 @@ awc_disable_MAC(struct NET_DEVICE * dev){ int -awc_read_all_rids(struct NET_DEVICE * dev){ +awc_read_all_rids(struct net_device * dev){ struct awc_private * priv = (struct awc_private *)dev->priv; int status,i; @@ -992,7 +992,7 @@ awc_read_all_rids(struct NET_DEVICE * dev){ } int -awc_write_all_rids(struct NET_DEVICE * dev){ +awc_write_all_rids(struct net_device * dev){ struct awc_private * priv = (struct awc_private *)dev->priv; int i,status ; @@ -1012,7 +1012,7 @@ awc_write_all_rids(struct NET_DEVICE * dev){ -int awc_tx_alloc(struct NET_DEVICE * dev) { +int awc_tx_alloc(struct net_device * dev) { struct awc_command cmd; int k=0; @@ -1116,7 +1116,7 @@ int awc_tx_alloc(struct NET_DEVICE * dev) { }; int -awc_tx_dealloc_fid(struct NET_DEVICE * dev,struct awc_fid * fid){ +awc_tx_dealloc_fid(struct net_device * dev,struct awc_fid * fid){ struct awc_command cmd; int fid_handle = 0; @@ -1150,7 +1150,7 @@ awc_tx_dealloc_fid(struct NET_DEVICE * dev,struct awc_fid * fid){ }; int -awc_tx_dealloc(struct NET_DEVICE * dev){ +awc_tx_dealloc(struct net_device * dev){ struct awc_private * priv = (struct awc_private *)dev->priv; @@ -1177,7 +1177,7 @@ awc_tx_dealloc(struct NET_DEVICE * dev){ inline struct awc_fid * -awc_tx_fid_lookup_and_remove(struct NET_DEVICE * dev, u16 fid_handle){ +awc_tx_fid_lookup_and_remove(struct net_device * dev, u16 fid_handle){ struct awc_private * priv = (struct awc_private *)dev->priv; // int k = 0; @@ -1272,7 +1272,7 @@ awc_tx_fid_lookup_and_remove(struct NET_DEVICE * dev, u16 fid_handle){ int -awc_queues_init(struct NET_DEVICE * dev){ +awc_queues_init(struct net_device * dev){ struct awc_private * priv = (struct awc_private *)dev->priv; struct awc_fid * fid = NULL; int retv =0; @@ -1302,7 +1302,7 @@ awc_queues_init(struct NET_DEVICE * dev){ int -awc_queues_destroy(struct NET_DEVICE * dev){ +awc_queues_destroy(struct net_device * dev){ struct awc_private * priv = (struct awc_private *)dev->priv; struct awc_fid * fid = NULL; int retv =0; @@ -1325,7 +1325,7 @@ awc_queues_destroy(struct NET_DEVICE * dev){ /****************************** 802.11router ******************/ inline int -awc_802_11_copy_path_skb(struct NET_DEVICE * dev, struct awc_fid * rx_buff){ +awc_802_11_copy_path_skb(struct net_device * dev, struct awc_fid * rx_buff){ struct awc_private * priv = (struct awc_private * )dev->priv; @@ -1360,7 +1360,7 @@ awc_802_11_copy_path_skb(struct NET_DEVICE * dev, struct awc_fid * rx_buff){ int -awc_802_11_find_copy_path(struct NET_DEVICE * dev, struct awc_fid * rx_buff){ +awc_802_11_find_copy_path(struct net_device * dev, struct awc_fid * rx_buff){ // struct awc_private * priv = (struct awc_private * )dev->priv; // u8 is_802_3 = 0; @@ -1386,7 +1386,7 @@ awc_802_11_find_copy_path(struct NET_DEVICE * dev, struct awc_fid * rx_buff){ int parse_not_8023= 0; void -awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff){ +awc_802_11_router_rx(struct net_device * dev,struct awc_fid * rx_buff){ struct awc_private * priv = (struct awc_private * )dev->priv; struct sk_buff * skb = rx_buff->skb; @@ -1531,7 +1531,7 @@ awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff){ DEBUG(0x200,"%s packet dropped in packet hdr parse \n ",dev->name); if (rx_buff->skb && (rx_buff->type & p80211copy_path_skb)){ - FREE_SKB(rx_buff->skb); + dev_kfree_skb_irq(rx_buff->skb); rx_buff->skb = NULL; rx_buff->u.rx.payload = NULL; }; @@ -1541,13 +1541,13 @@ awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff){ }; void -awc_802_11_failed_rx_copy(struct NET_DEVICE * dev,struct awc_fid * rx_buff){ +awc_802_11_failed_rx_copy(struct net_device * dev,struct awc_fid * rx_buff){ struct awc_private * priv = (struct awc_private * )dev->priv; AWC_ENTRY_EXIT_DEBUG("awc_802_11_failed_rx_copy"); if (rx_buff->skb) - FREE_SKB(rx_buff->skb); + dev_kfree_skb_irq(rx_buff->skb); rx_buff->skb = NULL; rx_buff->u.rx.payload = NULL; priv->stats.rx_errors++; @@ -1566,7 +1566,7 @@ awc_802_11_failed_rx_copy(struct NET_DEVICE * dev,struct awc_fid * rx_buff){ int -awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev, +awc_802_11_tx_find_path_and_post(struct net_device * dev, struct sk_buff * skb){ @@ -1750,10 +1750,6 @@ awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev, udelay(1); awc_transmit_packet(dev,fid); UP(&priv->tx_buff_semaphore); - if (priv->tx_large_ready.size > 0 ){ - dev->tbusy = 0; - mark_bh(NET_BH); - } AWC_ENTRY_EXIT_DEBUG("exit\n"); return 0; @@ -1763,7 +1759,7 @@ awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev, #ifdef AWC_DEBUG // printk("s"); #endif - dev->tbusy = 1; //weell, here it must be set anyway and before + netif_stop_queue (dev); //weell, here it must be set anyway and before //priv->stats.tx_fifo_errors++; UP(&priv->tx_buff_semaphore); AWC_ENTRY_EXIT_DEBUG("NoSpaceExit\n"); @@ -1771,9 +1767,7 @@ awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev, final: priv->stats.tx_errors++; UP(&priv->tx_buff_semaphore); - dev->tbusy = 0; - FREE_SKB(skb); - mark_bh(NET_BH); + dev_kfree_skb(skb); AWC_ENTRY_EXIT_DEBUG("BADExit\n"); return -1; @@ -1788,7 +1782,7 @@ awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev, void -awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev, +awc_802_11_after_tx_packet_to_card_write(struct net_device * dev, struct awc_fid * tx_buff){ @@ -1799,10 +1793,10 @@ awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev, }; if(tx_buff->skb){ - FREE_SKB(tx_buff->skb); + dev_kfree_skb(tx_buff->skb); tx_buff->skb = NULL; } - mark_bh(NET_BH); + netif_wake_queue (dev); AWC_ENTRY_EXIT_DEBUG("exit\n"); }; @@ -1815,7 +1809,7 @@ awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev, */ void -awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev, +awc_802_11_after_failed_tx_packet_to_card_write(struct net_device * dev, struct awc_fid * tx_buff){ struct awc_private * priv = (struct awc_private *)dev->priv; @@ -1827,7 +1821,7 @@ awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev, }; if(tx_buff->skb){ - FREE_SKB(tx_buff->skb); + dev_kfree_skb(tx_buff->skb); tx_buff->skb = NULL; tx_buff->busy =0; printk(KERN_ERR "%s packet to card write failed \n",dev->name); @@ -1845,7 +1839,7 @@ awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev, }; void -awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff){ +awc_802_11_after_tx_complete(struct net_device * dev, struct awc_fid * tx_buff){ struct awc_private * priv = (struct awc_private *)dev->priv; @@ -1866,8 +1860,7 @@ awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff){ } tx_buff->busy = 0; - dev->tbusy = 0; - mark_bh(NET_BH); + netif_wake_queue (dev); AWC_ENTRY_EXIT_DEBUG("exit\n"); }; @@ -1880,7 +1873,7 @@ awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff){ inline int -awc_receive_packet(struct NET_DEVICE * dev){ +awc_receive_packet(struct net_device * dev){ struct awc_command cmd; u16 Fid; @@ -2010,7 +2003,7 @@ awc_receive_packet(struct NET_DEVICE * dev){ int -awc_transmit_packet(struct NET_DEVICE * dev, struct awc_fid * tx_buff) { +awc_transmit_packet(struct net_device * dev, struct awc_fid * tx_buff) { struct awc_command cmd; u16 size ; @@ -2143,7 +2136,7 @@ awc_transmit_packet(struct NET_DEVICE * dev, struct awc_fid * tx_buff) { inline int -awc_tx_complete_check(struct NET_DEVICE * dev){ +awc_tx_complete_check(struct net_device * dev){ struct awc_fid * fid; struct awc_command cmd; @@ -2197,7 +2190,7 @@ awc_tx_complete_check(struct NET_DEVICE * dev){ void -awc_bh(struct NET_DEVICE *dev){ +awc_bh(struct net_device *dev){ struct awc_private * priv = (struct awc_private *)dev->priv; int active_interrupts; @@ -2226,8 +2219,7 @@ start: if (active_interrupts == 0xffff){ printk(KERN_CRIT "%s device ejected in interrupt, disabling\n",dev->name); - dev->tbusy = 1; - dev->start = 0; + netif_device_detach (dev); if (priv->command_semaphore_on){ priv->command_semaphore_on--; AWC_UNLOCK_COMMAND_ISSUING(priv); @@ -2286,7 +2278,7 @@ start: inline int -awc_interrupt_process(struct NET_DEVICE * dev){ +awc_interrupt_process(struct net_device * dev){ struct awc_private * priv ; int active_interrupts; @@ -2327,10 +2319,6 @@ awc_interrupt_process(struct NET_DEVICE * dev){ // printk("ikka interruptis\n"); - if (test_and_set_bit( 0, (void *) &dev->interrupt) ) { - printk("RI\n"); - goto reenter_end_here; - } priv->interrupt_count++; if (priv->interrupt_count > 1 ) printk(" interrupt count on\n "); @@ -2354,12 +2342,10 @@ start: printk(KERN_CRIT "%s device ejected, got interrupt, disabling\n",dev->name); //priv-> - dev->tbusy = 1; - dev->start = 0; + netif_device_detach (dev); priv->ejected = 1; if (priv->bh_active || priv->bh_running){ priv->interrupt_count--; - dev->interrupt = 0; goto bad_end; } else if (priv->command_semaphore_on){ @@ -2368,7 +2354,6 @@ start: AWC_QUEUE_BH; } priv->interrupt_count--; - dev->interrupt = 0; goto bad_end; } @@ -2458,8 +2443,7 @@ start: awc_fid_queue_push_tail(&priv->tx_small_ready,fid); else awc_fid_queue_push_tail(&priv->tx_large_ready,fid); - dev->tbusy = 0; - mark_bh(NET_BH); + netif_wake_queue (dev); } } else printk(KERN_ERR "awc fid %x not found\n",tx_fid); @@ -2502,7 +2486,6 @@ start: priv->interrupt_count--; - dev->interrupt = 0; awc_ints_enable(dev->base_addr, 0x0000); @@ -2523,15 +2506,8 @@ start: // restore_flags(flags); return 0; -reenter_end_here: - - AWC_ENTRY_EXIT_DEBUG(" reenter-bad end exit \n"); -// enable_irq(dev->irq); -// restore_flags(flags); - return 0; bad_end: - dev->interrupt = 0; AWC_ENTRY_EXIT_DEBUG(" bad_end exit \n"); // enable_irq(dev->irq); // restore_flags(flags); @@ -2543,7 +2519,7 @@ bad_end: static const char *aironet4500_core_version = "aironet4500.c v0.1 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n"; -struct NET_DEVICE * aironet4500_devices[MAX_AWCS] = {NULL,NULL,NULL,NULL}; +struct net_device * aironet4500_devices[MAX_AWCS] = {NULL,NULL,NULL,NULL}; static int awc_debug = 0; // 0xffffff; static int p802_11_send = 0; // 1 @@ -2595,7 +2571,6 @@ EXPORT_SYMBOL(awc_debug); EXPORT_SYMBOL(awc_private_init); EXPORT_SYMBOL(awc_tx_timeout); EXPORT_SYMBOL(awc_start_xmit); -EXPORT_SYMBOL(awc_tx_done); EXPORT_SYMBOL(awc_rx); EXPORT_SYMBOL(awc_interrupt); EXPORT_SYMBOL(awc_get_stats); @@ -2611,7 +2586,7 @@ EXPORT_SYMBOL(awc_unregister_proc); /*************************** RESET INIT CONFIG ***********************/ - void awc_reset(struct NET_DEVICE *dev) + void awc_reset(struct net_device *dev) { long long jiff; @@ -2633,7 +2608,7 @@ EXPORT_SYMBOL(awc_unregister_proc); } - int awc_config(struct NET_DEVICE *dev) + int awc_config(struct net_device *dev) { // struct awc_private *priv = (struct awc_private *)dev->priv; @@ -2654,7 +2629,7 @@ EXPORT_SYMBOL(awc_unregister_proc); char name[] = "ElmerLinux"; - int awc_init(struct NET_DEVICE *dev){ + int awc_init(struct net_device *dev){ struct awc_private *priv = (struct awc_private *)dev->priv; int i; const char * radioType; @@ -2785,8 +2760,6 @@ char name[] = "ElmerLinux"; // here we go, bad aironet memset(&priv->SSIDs,0,sizeof(priv->SSIDs)); - my_spin_lock_init(&priv->queues_lock); - priv->SSIDs.ridLen =0; if (!SSID) { priv->SSIDs.SSID[0].SSID[0] ='a'; @@ -2834,7 +2807,7 @@ char name[] = "ElmerLinux"; }; -int awc_private_init(struct NET_DEVICE * dev){ +int awc_private_init(struct net_device * dev){ struct awc_private * priv = (struct awc_private *) dev->priv; int i = 0; @@ -2906,7 +2879,6 @@ int awc_private_init(struct NET_DEVICE * dev){ priv->ejected =0; - dev->interrupt =0; priv->interrupt_count =0; return 0; @@ -2916,7 +2888,7 @@ int awc_private_init(struct NET_DEVICE * dev){ /**************************** OPEN CLOSE **********************/ - int awc_open(struct NET_DEVICE *dev) + int awc_open(struct net_device *dev) { struct awc_private *priv = (struct awc_private *)dev->priv; @@ -2924,9 +2896,6 @@ int awc_private_init(struct NET_DEVICE * dev){ DEBUG(2, "%s: awc_open \n", dev->name); - dev->interrupt = 0; dev->tbusy = 1; dev->start = 0; - - if( awc_queues_init(dev) ) goto final; if( awc_config(dev) ) goto final; @@ -2945,24 +2914,23 @@ int awc_private_init(struct NET_DEVICE * dev){ MOD_INC_USE_COUNT; // kernel_thread(awc_thread,dev,0); - dev->tbusy = 0; dev->start = 1; + netif_start_queue (dev); return 0; /* Always succeed */ final: - dev->tbusy = 0; dev->start = 0; + netif_device_detach (dev); printk(KERN_ERR "aironet open failed \n"); return -1; } - int awc_close(struct NET_DEVICE *dev) + int awc_close(struct net_device *dev) { struct awc_private * priv = (struct awc_private *) dev->priv; DEBUG(2, "%s: closing device.\n", dev->name); - dev->start = 0; - dev->tbusy=1; + netif_stop_queue (dev); awc_disable_MAC(dev); awc_queues_destroy(dev); @@ -2986,32 +2954,58 @@ int awc_private_init(struct NET_DEVICE * dev){ - void awc_tx_timeout(struct NET_DEVICE *dev) +void awc_tx_timeout (struct net_device *dev) { - struct awc_private *priv = (struct awc_private *)dev->priv; + struct awc_private *priv = (struct awc_private *) dev->priv; + struct awc_fid * fid; + int cnt; - DEBUG(2, "%s: awc_tx_timeout \n", dev->name); + DEBUG (2, "%s: awc_tx_timeout \n", dev->name); - printk(KERN_NOTICE "%s: Transmit timed out , buffs %d %d, queues tx %d pp %d lrg %d sm %d \n ", - dev->name,priv->tx_small_buffs_total ,priv->tx_buffs_total, - priv->tx_in_transmit.size,priv->tx_post_process.size, - priv->tx_large_ready.size,priv->tx_small_ready.size); + printk (KERN_NOTICE "%s: Transmit timed out , buffs %d %d, queues tx %d pp %d lrg %d sm %d \n ", + dev->name, priv->tx_small_buffs_total, priv->tx_buffs_total, + priv->tx_in_transmit.size, priv->tx_post_process.size, + priv->tx_large_ready.size, priv->tx_small_ready.size); priv->stats.tx_errors++; + // save_flags(flags); + // cli(); + fid = priv->tx_in_transmit.head; + cnt = 0; + while (fid) { + if (jiffies - fid->transmit_start_time > (HZ)) { + // printk(KERN_ERR "%s staled tx_buff found, age %uld jiffies\n",dev->name, + // jiffies - fid->transmit_start_time ); + awc_fid_queue_remove (&priv->tx_in_transmit, fid); + if (fid->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE) + awc_fid_queue_push_tail (&priv->tx_small_ready, fid); + else + awc_fid_queue_push_tail (&priv->tx_large_ready, fid); + } + fid = fid->next; + if (cnt++ > 200) { + printk ("bbb in awc_fid_queue\n"); + // restore_flags(flags); + return; + }; + + } + //restore_flags(flags); + //debug =0x8; + dev->trans_start = jiffies; - dev->tbusy = 0; + netif_start_queue (dev); } + long long last_tx_q_hack = 0; int direction = 1; - int awc_start_xmit(struct sk_buff *skb, struct NET_DEVICE *dev) { + int awc_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct awc_private *priv = (struct awc_private *)dev->priv; int retval = 0; // unsigned long flags; - struct awc_fid * fid = NULL; - int cnt=0; DEBUG(2, "%s: awc_start_xmit \n", dev->name); @@ -3021,48 +3015,13 @@ int direction = 1; return -1; }; - /* Transmitter timeout, serious problems. */ - if (test_and_set_bit( 0, (void *) &dev->tbusy) ) { - if (jiffies - dev->trans_start > 3* HZ ){ - // save_flags(flags); - // cli(); - fid = priv->tx_in_transmit.head; - cnt = 0; - while (fid){ - if (jiffies - fid->transmit_start_time > (HZ)){ - // printk(KERN_ERR "%s staled tx_buff found, age %uld jiffies\n",dev->name, - // jiffies - fid->transmit_start_time ); - awc_fid_queue_remove(&priv->tx_in_transmit, fid); - if (fid->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE) - awc_fid_queue_push_tail(&priv->tx_small_ready,fid); - else - awc_fid_queue_push_tail(&priv->tx_large_ready,fid); - dev->tbusy = 0; - } - fid = fid->next; - if (cnt++ > 200) { - printk("bbb in awc_fid_queue\n"); - // restore_flags(flags); - return -1; - }; - - } - //restore_flags(flags); - //debug =0x8; - }; - if (jiffies - dev->trans_start >= (5* HZ) ) { - awc_tx_timeout(dev); - } - return 1; - } - if (!skb) { DEBUG(1, " xmit skb=NULL, jiffie %ld \n",jiffies); return -1; }; if (test_and_set_bit( 0, (void *) &priv->tx_chain_active) ) { - dev->tbusy=0; + netif_start_queue (dev); return 1; } @@ -3075,15 +3034,7 @@ int direction = 1; return retval; } -int awc_tx_done(struct awc_fid * rx_fid){ - -// dev->tbusy = 0; - mark_bh(NET_BH); - - return 0; -}; - -int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) { +int awc_rx(struct net_device *dev, struct awc_fid * rx_fid) { // struct awc_private *lp = (struct awc_private *)dev->priv; @@ -3109,7 +3060,7 @@ int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) { void awc_interrupt(int irq, void *dev_id, struct pt_regs *regs) { - struct NET_DEVICE *dev = (struct NET_DEVICE *)dev_id; + struct net_device *dev = (struct net_device *)dev_id; // struct awc_private *lp; // unsigned long flags; @@ -3133,7 +3084,7 @@ int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) { - struct enet_statistics *awc_get_stats(struct NET_DEVICE *dev) + struct enet_statistics *awc_get_stats(struct net_device *dev) { struct awc_private *priv = (struct awc_private *)dev->priv; // unsigned long flags; @@ -3142,7 +3093,7 @@ int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) { DEBUG(2, "%s: awc_get_stats \n", dev->name); - if (!dev->start) { + if (!netif_running(dev)) { return 0; } // save_flags(flags); @@ -3175,7 +3126,7 @@ int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) { } -int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu){ +int awc_change_mtu(struct net_device *dev, int new_mtu){ // struct awc_private *priv = (struct awc_private *)dev->priv; // unsigned long flags; @@ -3183,7 +3134,7 @@ int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu){ if ((new_mtu < 256 ) || (new_mtu > 2312) || (max_mtu && new_mtu > max_mtu) ) return -EINVAL; - if (dev->start) { + if (netif_running(dev)) { printk("PLEASE, ifconfig %s down for mtu change\n",dev->name); }; @@ -3207,7 +3158,7 @@ int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu){ void -awc_set_multicast_list(struct NET_DEVICE *dev) { +awc_set_multicast_list(struct net_device *dev) { // int ioaddr = dev->base_addr; /* if (dev->flags & IFF_PROMISC) diff --git a/drivers/net/aironet4500_proc.c b/drivers/net/aironet4500_proc.c index 2b28f1a63adf..b9da62ab78a9 100644 --- a/drivers/net/aironet4500_proc.c +++ b/drivers/net/aironet4500_proc.c @@ -264,7 +264,7 @@ int awc_proc_fun(ctl_table *ctl, int write, struct file * filp, struct awc_rid_dir * rid_dir; - struct NET_DEVICE * dev= NULL; + struct net_device * dev= NULL; struct aironet4500_RID * rid = (struct aironet4500_RID * ) ctl->extra2; diff --git a/drivers/net/aironet4500_rid.c b/drivers/net/aironet4500_rid.c index f1fb95dd67a3..7d52269f99aa 100644 --- a/drivers/net/aironet4500_rid.c +++ b/drivers/net/aironet4500_rid.c @@ -2134,7 +2134,7 @@ struct awc_rid_dir awc_rids[]={ int awc_nof_rids = (sizeof(awc_rids) / sizeof(struct awc_rid_dir)) -1; -int awc_rids_setup(struct NET_DEVICE * dev){ +int awc_rids_setup(struct net_device * dev){ struct awc_private * priv = (struct awc_private *) dev->priv; int i=0; diff --git a/drivers/net/am79c961a.c b/drivers/net/am79c961a.c index cfb48ca0303e..9c00c4cbdd02 100644 --- a/drivers/net/am79c961a.c +++ b/drivers/net/am79c961a.c @@ -20,13 +20,13 @@ #include #include #include +#include #include #include #include #include #include -#include #define TX_BUFFERS 15 #define RX_BUFFERS 25 diff --git a/drivers/net/arlan.c b/drivers/net/arlan.c index d2a02efcb8dc..0e3b982fe987 100644 --- a/drivers/net/arlan.c +++ b/drivers/net/arlan.c @@ -102,6 +102,7 @@ static int arlan_hw_config (struct net_device * dev); static void arlan_tx_done_interrupt (struct net_device * dev, int status); static void arlan_rx_interrupt (struct net_device * dev, u_char rxStatus, u_short, u_short); static void arlan_process_interrupt (struct net_device * dev); +static void arlan_tx_timeout (struct net_device *dev); int arlan_command(struct net_device * dev, int command); EXPORT_SYMBOL(arlan_command); @@ -182,10 +183,7 @@ extern inline int arlan_drop_tx(struct net_device *dev) priv->txOffset = 0; priv->bad = 0; if (!priv->under_reset && !priv->under_config) - { - dev->tbusy = 0; - mark_bh(NET_BH); - } + netif_wake_queue (dev); } return 1; }; @@ -288,15 +286,9 @@ int arlan_command(struct net_device *dev, int command_p) } } if (priv->waiting_command_mask & ARLAN_COMMAND_RESET) - { priv->under_reset = 1; - dev->start = 0; - } if (priv->waiting_command_mask & ARLAN_COMMAND_CONF) - { priv->under_config = 1; - dev->start = 0; - } /* Issuing command */ arlan_lock_card_access(dev); @@ -341,14 +333,14 @@ int arlan_command(struct net_device *dev, int command_p) else if (priv->waiting_command_mask & ARLAN_COMMAND_RESET) { priv->under_reset=1; - dev->tbusy = 1; + netif_stop_queue (dev); arlan_drop_tx(dev); if (priv->tx_command_given || priv->rx_command_given) { printk(KERN_ERR "%s: Reset under tx or rx command \n", dev->name); }; - dev->tbusy = 1; + netif_stop_queue (dev); if (arlan_debug & ARLAN_DEBUG_RESET) printk(KERN_ERR "%s: Doing chip reset\n", dev->name); priv->lastReset = jiffies; @@ -388,7 +380,6 @@ int arlan_command(struct net_device *dev, int command_p) { printk(KERN_ERR "%s: Reset under tx or rx command \n", dev->name); } - dev->start = 0; arlan_drop_tx(dev); setInterruptEnable(dev); arlan_hw_config(dev); @@ -437,13 +428,11 @@ int arlan_command(struct net_device *dev, int command_p) } else if (priv->waiting_command_mask & ARLAN_COMMAND_TBUSY_CLEAR) { - if ( !registrationBad(dev) && (dev->tbusy || !dev->start) ) + if ( !registrationBad(dev) && + (netif_queue_stopped(dev) || !netif_running(dev)) ) { priv->waiting_command_mask &= ~ARLAN_COMMAND_TBUSY_CLEAR; - - dev->tbusy = 0; - dev->start = 1; - mark_bh(NET_BH); + netif_wake_queue (dev); }; } else if (priv->waiting_command_mask & ARLAN_COMMAND_TX) @@ -587,8 +576,7 @@ extern inline void arlan_retransmit_now(struct net_device *dev) else IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_ERR "ReTransmit buff empty"); priv->txOffset = 0; - dev->tbusy = 0; - mark_bh(NET_BH); + netif_wake_queue (dev); return; } @@ -650,11 +638,8 @@ static void arlan_registration_timer(unsigned long data) priv->registrationLastSeen = jiffies; priv->registrationLostCount = 0; priv->reRegisterExp = 1; - if (dev->start == 0) - { - dev->start = 1; - mark_bh(NET_BH); - } + if (!netif_running(dev)) + netif_wake_queue(dev); } @@ -682,8 +667,7 @@ static void arlan_registration_timer(unsigned long data) if (!(TXHEAD(dev).offset && TXTAIL(dev).offset)) { priv->txOffset = 0; - dev->tbusy = 0; - mark_bh(NET_BH); + netif_wake_queue (dev); } priv->tx_done_delayed = 0; bh_mark_needed = 1; @@ -691,8 +675,7 @@ static void arlan_registration_timer(unsigned long data) if (bh_mark_needed) { priv->txOffset = 0; - dev->tbusy = 0; - mark_bh(NET_BH); + netif_wake_queue (dev); } arlan_process_interrupt(dev); @@ -788,7 +771,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length) } else { - dev->tbusy = 1; + netif_stop_queue (dev); return -1; IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_ERR "TX TAIL & HEAD full, return, tailStart %d headEnd %d\n", tailStarts, headEnds); @@ -811,11 +794,11 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length) } if (TXHEAD(dev).offset && TXTAIL(dev).offset) { - dev->tbusy = 1; + netif_stop_queue (dev); return 0; } else - dev->tbusy = 0; + netif_start_queue (dev); IFDEBUG(ARLAN_DEBUG_HEADER_DUMP) @@ -1161,7 +1144,7 @@ static int arlan_mac_addr(struct net_device *dev, void *p) ARLAN_DEBUG_ENTRY("arlan_mac_addr"); return -EINVAL; - if (dev->start) + if (!netif_running(dev)) return -EBUSY; memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); @@ -1223,8 +1206,8 @@ static int __init dev->set_multicast_list = arlan_set_multicast; dev->change_mtu = arlan_change_mtu; dev->set_mac_address = arlan_mac_addr; - dev->tbusy = 1; - dev->start = 0; + dev->tx_timeout = arlan_tx_timeout; + dev->watchdog_timeo = 3*HZ; ((struct arlan_private *) dev->priv)->irq_test_done = 0; arlan_device[num] = dev; @@ -1302,14 +1285,13 @@ static int arlan_open(struct net_device *dev) priv->open_time = jiffies; memcpy_fromio(dev->dev_addr, arlan->lanCardNodeId, 6); memset(dev->broadcast, 0xff, 6); - dev->tbusy = 1; priv->txOffset = 0; - dev->interrupt = 0; - dev->start = 0; dev->tx_queue_len = tx_queue_len; priv->interrupt_processing_active = 0; priv->command_lock = 0; + netif_start_queue (dev); + init_MUTEX(&priv->card_lock); myATOMIC_INIT(priv->card_users, 1); /* damn 2.0.33 */ priv->registrationLostCount = 0; @@ -1327,7 +1309,6 @@ static int arlan_open(struct net_device *dev) priv->Conf->writeEEPROM = 0; priv->Conf->registrationInterrupts = 1; - dev->tbusy = 0; init_timer(&priv->timer); priv->timer.expires = jiffies + HZ / 10; priv->timer.data = (unsigned long) dev; @@ -1335,8 +1316,6 @@ static int arlan_open(struct net_device *dev) arlan_command(dev, ARLAN_COMMAND_POWERUP | ARLAN_COMMAND_LONG_WAIT_NOW); udelay(200000); - dev->tbusy = 0; - dev->start = 1; add_timer(&priv->timer); MOD_INC_USE_COUNT; @@ -1351,69 +1330,43 @@ static int arlan_open(struct net_device *dev) } +static void arlan_tx_timeout (struct net_device *dev) +{ + printk(KERN_ERR "%s: arlan transmit timed out, kernel decided\n", dev->name); + /* Try to restart the adaptor. */ + arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET); + dev->trans_start = jiffies; + netif_start_queue (dev); +} static int arlan_tx(struct sk_buff *skb, struct net_device *dev) { struct arlan_private *priv = ((struct arlan_private *) dev->priv); - struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf; + short length; + unsigned char *buf; ARLAN_DEBUG_ENTRY("arlan_tx"); - - if (dev->tbusy) - { - /* - * If we get here, some higher level has decided we are broken. - * There should really be a "kick me" function call instead. - */ - int tickssofar = jiffies - dev->trans_start; - - if (((tickssofar * 1000) / HZ) * 2 > conf->txTimeoutMs) - arlan_command(dev, ARLAN_COMMAND_TX_ABORT); - - if (((tickssofar * 1000) / HZ) < conf->txTimeoutMs) - { - // up(&priv->card_lock); - goto bad_end; - } - printk(KERN_ERR "%s: arlan transmit timed out, kernel decided\n", dev->name); - /* Try to restart the adaptor. */ - arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET); - dev->trans_start = jiffies; - goto bad_end; - - } + /* - * Block a timer-based transmit from overlapping. This could better be - * done with atomic_swap(1, dev->tbusy), but set_bit() works as well. + * If some higher layer thinks we've missed an tx-done interrupt + * we are passed NULL. Caution: dev_tint() handles the cli()/sti() + * itself. */ - if (test_and_set_bit(0, (void *) &dev->tbusy) != 0) - { - printk(KERN_ERR "%s: Transmitter access conflict.\n", - dev->name); - } - else - { - short length; - unsigned char *buf; - - /* - * If some higher layer thinks we've missed an tx-done interrupt - * we are passed NULL. Caution: dev_tint() handles the cli()/sti() - * itself. - */ - length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; - buf = skb->data; + length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; + buf = skb->data; + + if (priv->txOffset + length + 0x12 > 0x800) { + printk(KERN_ERR "TX RING overflow \n"); + netif_stop_queue (dev); + } - if (priv->txOffset + length + 0x12 > 0x800) - printk(KERN_ERR "TX RING overflow \n"); + if (arlan_hw_tx(dev, buf, length) == -1) + goto bad_end; - if (arlan_hw_tx(dev, buf, length) == -1) - goto bad_end; + dev->trans_start = jiffies; - dev->trans_start = jiffies; - } dev_kfree_skb(skb); arlan_process_interrupt(dev); @@ -1424,6 +1377,7 @@ static int arlan_tx(struct sk_buff *skb, struct net_device *dev) bad_end: arlan_process_interrupt(dev); priv->tx_chain_active = 0; + netif_stop_queue (dev); ARLAN_DEBUG_EXIT("arlan_tx"); return 1; } @@ -1522,8 +1476,7 @@ static void arlan_tx_done_interrupt(struct net_device *dev, int status) if (!TXHEAD(dev).offset || !TXTAIL(dev).offset) { priv->txOffset = 0; - dev->tbusy = 0; - mark_bh(NET_BH); + netif_wake_queue (dev); } } } @@ -1852,15 +1805,12 @@ static void arlan_process_interrupt(struct net_device *dev) WRITESHMB(arlan->rxStatus, 0x00); arlan_command(dev, ARLAN_COMMAND_RX); if (registrationBad(dev)) - dev->start = 0; + netif_device_detach(dev); if (!registrationBad(dev)) { priv->registrationLastSeen = jiffies; - if (!dev->tbusy && !priv->under_reset && !priv->under_config) - { - mark_bh(NET_BH); - dev->start = 1; - } + if (!netif_queue_stopped(dev) && !priv->under_reset && !priv->under_config) + netif_wake_queue (dev); } goto ends; } @@ -1900,12 +1850,10 @@ static void arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (!rxStatus && !txStatus) priv->interrupt_ack_requested++; - dev->interrupt++; arlan_process_interrupt(dev); priv->irq_test_done = 1; - dev->interrupt--; ARLAN_DEBUG_EXIT("arlan_interrupt"); return; @@ -1938,8 +1886,7 @@ static int arlan_close(struct net_device *dev) printk(KERN_NOTICE "%s: Closing device\n", dev->name); priv->open_time = 0; - dev->tbusy = 1; - dev->start = 0; + netif_stop_queue(dev); free_irq(dev->irq, dev); MOD_DEC_USE_COUNT; diff --git a/drivers/net/bonding.c b/drivers/net/bonding.c index c7b2962cc37c..f1a4526d44d3 100644 --- a/drivers/net/bonding.c +++ b/drivers/net/bonding.c @@ -31,7 +31,6 @@ * */ -#include #include #include #include diff --git a/drivers/net/fc/iph5526.c b/drivers/net/fc/iph5526.c index 785a3fafdf18..28d50eb8c2c8 100644 --- a/drivers/net/fc/iph5526.c +++ b/drivers/net/fc/iph5526.c @@ -218,6 +218,7 @@ static void update_scsi_oxid(struct fc_info *fi); Scsi_Host_Template driver_template = IPH5526_SCSI_FC; +static void iph5526_timeout(struct net_device *dev); #ifdef CONFIG_PCI static int iph5526_probe_pci(struct net_device *dev); @@ -286,6 +287,8 @@ static int __init fcdev_init(struct net_device *dev) dev->get_stats = iph5526_get_stats; dev->set_multicast_list = NULL; dev->change_mtu = iph5526_change_mtu; + dev->tx_timeout = iph5526_timeout; + dev->watchdog_timeo = 5*HZ; #ifndef MODULE fc_setup(dev); #endif diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 10b249b4e847..c55556cc9ead 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c @@ -320,16 +320,14 @@ static void ax_changedmtu(struct ax_disp *ax) /* Set the "sending" flag. This must be atomic, hence the ASM. */ static inline void ax_lock(struct ax_disp *ax) { - if (test_and_set_bit(0, (void *)&ax->dev->tbusy)) - printk(KERN_ERR "mkiss: %s: trying to lock already locked device!\n", ax->dev->name); + netif_stop_queue(ax->dev); } /* Clear the "sending" flag. This must be atomic, hence the ASM. */ static inline void ax_unlock(struct ax_disp *ax) { - if (!test_and_clear_bit(0, (void *)&ax->dev->tbusy)) - printk(KERN_ERR "mkiss: %s: trying to unlock already unlocked device!\n", ax->dev->name); + netif_start_queue(ax->dev); } /* Send one completely decapsulated AX.25 packet to the AX.25 layer. */ @@ -435,7 +433,7 @@ static void ax25_write_wakeup(struct tty_struct *tty) struct mkiss_channel *mkiss; /* First make sure we're connected. */ - if (ax == NULL || ax->magic != AX25_MAGIC || !ax->dev->start) + if (ax == NULL || ax->magic != AX25_MAGIC || !netif_running(ax->dev)) return; if (ax->xleft <= 0) { /* Now serial buffer is almost free & we can start @@ -449,8 +447,7 @@ static void ax25_write_wakeup(struct tty_struct *tty) ax_unlock(ax->mkiss); } - ax_unlock(ax); - mark_bh(NET_BH); + netif_wake_queue(ax->dev); return; } @@ -474,22 +471,22 @@ static int ax_xmit(struct sk_buff *skb, struct net_device *dev) tmp_ax = ax->mkiss; } - if (!dev->start) { + if (!netif_running(dev)) { printk(KERN_ERR "mkiss: %s: xmit call when iface is down\n", dev->name); return 1; } if (tmp_ax != NULL) - if (tmp_ax->dev->tbusy) + if (netif_queue_stopped(tmp_ax->dev)) return 1; if (tmp_ax != NULL) - if (dev->tbusy) { + if (netif_queue_stopped(dev)) { printk(KERN_ERR "mkiss: dev busy while serial dev is free\n"); ax_unlock(ax); } - if (dev->tbusy) { + if (netif_queue_stopped(dev)) { /* * May be we must check transmitter timeout here ? * 14 Oct 1994 Dmitry Gorodchanin. @@ -583,9 +580,8 @@ static int ax_open(struct net_device *dev) ax->xleft = 0; ax->flags &= (1 << AXF_INUSE); /* Clear ESCAPE & ERROR flags */ - dev->tbusy = 0; - dev->start = 1; + netif_start_queue(dev); return 0; /* Cleanup */ @@ -609,8 +605,7 @@ static int ax_close(struct net_device *dev) ax->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); - dev->tbusy = 1; - dev->start = 0; + netif_stop_queue(dev); return 0; } @@ -630,7 +625,7 @@ static void ax25_receive_buf(struct tty_struct *tty, const unsigned char *cp, ch { struct ax_disp *ax = (struct ax_disp *)tty->disc_data; - if (ax == NULL || ax->magic != AX25_MAGIC || !ax->dev->start) + if (ax == NULL || ax->magic != AX25_MAGIC || !netif_running(ax->dev)) return; /* @@ -691,7 +686,7 @@ static int ax25_open(struct tty_struct *tty) if (mkiss->magic == MKISS_DRIVER_MAGIC) { for (cnt = 1; cnt < ax25_maxdev; cnt++) { if (ax25_ctrls[cnt]) { - if (ax25_ctrls[cnt]->dev.start) { + if (netif_running(&ax25_ctrls[cnt]->dev)) { if (ax == &ax25_ctrls[cnt]->ctrl) { cnt--; tmp_ax = &ax25_ctrls[cnt]->ctrl; @@ -802,7 +797,7 @@ int kiss_esc(unsigned char *s, unsigned char *d, int len) static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc, int len) { unsigned char *ptr = d; - unsigned char c; + unsigned char c=0; *ptr++ = END; while (len > 0) { @@ -1221,7 +1216,7 @@ void cleanup_module(void) * VSV = if dev->start==0, then device * unregistred while close proc. */ - if (ax25_ctrls[i]->dev.start) + if (netif_running(&ax25_ctrls[i]->dev)) unregister_netdev(&(ax25_ctrls[i]->dev)); kfree(ax25_ctrls[i]); diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 1a52df5f9daa..eb571db3ddc6 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c @@ -48,7 +48,6 @@ * - Use hardware checksums. * - Convert to using the PCI infrastructure / IOC3 meta driver. */ -#include #include #include #include diff --git a/drivers/net/pcmcia/aironet4500_cs.c b/drivers/net/pcmcia/aironet4500_cs.c index 2acd2e46aa9b..5d72f7778fd2 100644 --- a/drivers/net/pcmcia/aironet4500_cs.c +++ b/drivers/net/pcmcia/aironet4500_cs.c @@ -112,13 +112,13 @@ static void flush_stale_links(void) by the net software, because we only register already-found cards. */ -static int awc_pcmcia_init(struct NET_DEVICE *dev) +static int awc_pcmcia_init(struct net_device *dev) { return awc_init(dev); } -static int awc_pcmcia_open(struct NET_DEVICE *dev) +static int awc_pcmcia_open(struct net_device *dev) { dev_link_t *link; int status; @@ -136,7 +136,7 @@ static int awc_pcmcia_open(struct NET_DEVICE *dev) return status; } -static int awc_pcmcia_close(struct NET_DEVICE *dev) +static int awc_pcmcia_close(struct net_device *dev) { // int ioaddr = dev->base_addr; dev_link_t *link; @@ -170,7 +170,7 @@ static dev_link_t *awc_attach(void) { client_reg_t client_reg; dev_link_t *link = NULL; - struct NET_DEVICE *dev = NULL; + struct net_device *dev = NULL; int ret; PC_DEBUG(0, "awc_attach()\n"); @@ -199,8 +199,8 @@ static dev_link_t *awc_attach(void) /* Create the network device object. */ - dev = kmalloc(sizeof(struct NET_DEVICE ), GFP_KERNEL); - memset(dev,0,sizeof(struct NET_DEVICE)); + dev = kmalloc(sizeof(struct net_device ), GFP_KERNEL); + memset(dev,0,sizeof(struct net_device)); // dev = init_etherdev(0, sizeof(struct awc_private) ); if (!dev ) { printk(KERN_CRIT "out of mem on dev alloc \n"); @@ -321,10 +321,10 @@ static void awc_detach(dev_link_t *link) } if (link->priv) { - //struct NET_DEVICE *dev = link->priv; + //struct net_device *dev = link->priv; // dam dam damn mif (dev->priv) // kfree_s(dev->priv, sizeof(struct awc_private)); - kfree_s(link->priv, sizeof(struct NET_DEVICE)); + kfree_s(link->priv, sizeof(struct net_device)); } kfree_s(link->dev, sizeof(struct dev_node_t)); kfree_s(link, sizeof(struct dev_link_t)); @@ -345,7 +345,7 @@ while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed static void awc_pcmcia_config(dev_link_t *link) { client_handle_t handle; - struct NET_DEVICE *dev; + struct net_device *dev; struct awc_private *lp; tuple_t tuple; int ii; @@ -520,7 +520,7 @@ failed: static void awc_release(u_long arg) { dev_link_t *link = (dev_link_t *)arg; - struct NET_DEVICE *dev = link->priv; + struct net_device *dev = link->priv; DEBUG(0, "awc_release(0x%p)\n", link); @@ -558,7 +558,7 @@ static int awc_event(event_t event, int priority, event_callback_args_t *args) { dev_link_t *link = args->client_data; - struct NET_DEVICE *dev = link->priv; + struct net_device *dev = link->priv; PC_DEBUG(1, "awc_event(0x%06x)\n", event); diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index baec21158372..6853cc4039cd 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c @@ -309,7 +309,7 @@ static void com20020_detach(dev_link_t *link) { DEBUG(1,"unregister...\n"); - if (dev->start) + if (netif_running(dev)) dev->stop(dev); /* @@ -501,7 +501,7 @@ static int com20020_event(event_t event, int priority, case CS_EVENT_CARD_REMOVAL: link->state &= ~DEV_PRESENT; if (link->state & DEV_CONFIG) { - dev->tbusy = 1; dev->start = 0; + netif_device_detach(dev); link->release.expires = jiffies + HZ/20; link->state |= DEV_RELEASE_PENDING; add_timer(&link->release); @@ -517,7 +517,7 @@ static int com20020_event(event_t event, int priority, case CS_EVENT_RESET_PHYSICAL: if (link->state & DEV_CONFIG) { if (link->open) { - dev->tbusy = 1; dev->start = 0; + netif_device_detach(dev); } CardServices(ReleaseConfiguration, link->handle); } diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c index f7d86c10336e..283602e44e31 100644 --- a/drivers/net/seeq8005.c +++ b/drivers/net/seeq8005.c @@ -42,9 +42,9 @@ static const char *version = #include #include #include +#include #include #include -#include #include #include #include diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c index 7ac6aa08d921..b009a8a4b197 100644 --- a/drivers/net/tulip/eeprom.c +++ b/drivers/net/tulip/eeprom.c @@ -56,6 +56,12 @@ static struct eeprom_fixup eeprom_fixups[] __devinitdata = { 0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */ 0x1B05, 0x006D, /* 100baseTx-FD CSR12 0x1B */ }}, + {"NetWinder", 0x00, 0x10, 0x57, + /* Default media = MII + * MII block, reset sequence (3) = 0x0821 0x0000 0x0001, capabilities 0x01e1 + */ + { 0x1e00, 0x0000, 0x000b, 0x8f01, 0x0103, 0x0300, 0x0821, 0x000, 0x0001, 0x0000, 0x01e1 } + }, {0, 0, 0, 0, {}}}; diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h index 3642a13b4c19..a5cdc6b8dded 100644 --- a/drivers/net/tulip/tulip.h +++ b/drivers/net/tulip/tulip.h @@ -50,7 +50,6 @@ enum chips { DC21140 = 2, DC21142 = 3, DC21143 = 3, LC82C168, - NGMC169, MX98713, MX98715, MX98725, @@ -242,8 +241,10 @@ struct mediainfo { struct tulip_private { const char *product_name; struct net_device *next_module; - struct tulip_rx_desc rx_ring[RX_RING_SIZE]; - struct tulip_tx_desc tx_ring[TX_RING_SIZE]; + struct tulip_rx_desc *rx_ring; + struct tulip_tx_desc *tx_ring; + dma_addr_t rx_ring_dma; + dma_addr_t tx_ring_dma; /* The saved address of a sent-in-place packet/buffer, for skfree(). */ struct sk_buff *tx_skbuff[TX_RING_SIZE]; /* The addresses of receive-in-place skbuffs. */ diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 3be78468b824..dbbaaa5d7c6f 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c @@ -19,7 +19,7 @@ */ -static const char version[] = "Linux Tulip driver version 0.9.3 (Feb 23, 2000)\n"; +static const char version[] = "Linux Tulip driver version 0.9.4 (Feb 28, 2000)\n"; #include #include "tulip.h" @@ -51,7 +51,7 @@ const char * const medianame[] = { }; /* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ -#ifdef __alpha__ +#if defined(__alpha__) || defined(__arm__) static int rx_copybreak = 1518; #else static int rx_copybreak = 100; @@ -74,6 +74,8 @@ static int rx_copybreak = 100; static int csr0 = 0x01A00000 | 0xE000; #elif defined(__i386__) || defined(__powerpc__) || defined(__sparc__) static int csr0 = 0x01A00000 | 0x8000; +#elif defined(__arm__) +static int csr0 = 0x01A00000 | 0x4800; #else #warning Processor architecture undefined! static int csr0 = 0x00A00000 | 0x4800; @@ -123,8 +125,6 @@ struct tulip_chip_table tulip_tbl[] = { t21142_timer }, { "Lite-On 82c168 PNIC", 256, 0x0001ebef, HAS_MII | HAS_PNICNWAY, pnic_timer }, - { "NETGEAR NGMC169 MAC", 256, 0x0001ebef, - HAS_MII | HAS_PNICNWAY, pnic_timer }, { "Macronix 98713 PMAC", 128, 0x0001ebef, HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM, mxic_timer }, { "Macronix 98715 PMAC", 256, 0x0001ebef, @@ -155,7 +155,6 @@ static struct pci_device_id tulip_pci_tbl[] __devinitdata = { { 0x1011, 0x0009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 }, { 0x1011, 0x0019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21143 }, { 0x11AD, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, LC82C168 }, - { 0x1385, 0xf004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NGMC169 }, { 0x10d9, 0x0512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98713 }, { 0x10d9, 0x0531, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 }, { 0x10d9, 0x0531, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98725 }, @@ -301,8 +300,8 @@ static void tulip_up(struct net_device *dev) tp->cur_tx++; } - outl(virt_to_bus(tp->rx_ring), ioaddr + CSR3); - outl(virt_to_bus(tp->tx_ring), ioaddr + CSR4); + outl(tp->rx_ring_dma, ioaddr + CSR3); + outl(tp->tx_ring_dma, ioaddr + CSR4); tp->saved_if_port = dev->if_port; if (dev->if_port == 0) @@ -569,12 +568,12 @@ static void tulip_init_ring(struct net_device *dev) for (i = 0; i < RX_RING_SIZE; i++) { tp->rx_ring[i].status = 0x00000000; tp->rx_ring[i].length = cpu_to_le32(PKT_BUF_SZ); - tp->rx_ring[i].buffer2 = virt_to_le32desc(&tp->rx_ring[i+1]); + tp->rx_ring[i].buffer2 = cpu_to_le32(tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * (i + 1)); tp->rx_skbuff[i] = NULL; } /* Mark the last entry as wrapping the ring. */ tp->rx_ring[i-1].length = cpu_to_le32(PKT_BUF_SZ | DESC_RING_WRAP); - tp->rx_ring[i-1].buffer2 = virt_to_le32desc(&tp->rx_ring[0]); + tp->rx_ring[i-1].buffer2 = cpu_to_le32(tp->rx_ring_dma); for (i = 0; i < RX_RING_SIZE; i++) { /* Note the receive buffer must be longword aligned. @@ -595,9 +594,9 @@ static void tulip_init_ring(struct net_device *dev) for (i = 0; i < TX_RING_SIZE; i++) { tp->tx_skbuff[i] = 0; tp->tx_ring[i].status = 0x00000000; - tp->tx_ring[i].buffer2 = virt_to_le32desc(&tp->tx_ring[i+1]); + tp->tx_ring[i].buffer2 = cpu_to_le32(tp->tx_ring_dma + sizeof(struct tulip_tx_desc) * (i + 1)); } - tp->tx_ring[i-1].buffer2 = virt_to_le32desc(&tp->tx_ring[0]); + tp->tx_ring[i-1].buffer2 = cpu_to_le32(tp->tx_ring_dma); } static int @@ -1033,6 +1032,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, */ tp = dev->priv; + tp->rx_ring = pci_alloc_consistent(pdev, + sizeof(struct tulip_rx_desc) * RX_RING_SIZE + + sizeof(struct tulip_tx_desc) * TX_RING_SIZE, + &tp->rx_ring_dma); + tp->tx_ring = (struct tulip_tx_desc *)(tp->rx_ring + RX_RING_SIZE); + tp->tx_ring_dma = tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * RX_RING_SIZE; + tp->chip_id = chip_idx; tp->flags = tulip_tbl[chip_idx].flags; tp->pdev = pdev; @@ -1352,6 +1358,11 @@ static void __devexit tulip_remove_one (struct pci_dev *pdev) if (dev) { struct tulip_private *tp = (struct tulip_private *)dev->priv; + pci_free_consistent(pdev, + sizeof(struct tulip_rx_desc) * RX_RING_SIZE + + sizeof(struct tulip_tx_desc) * TX_RING_SIZE, + tp->rx_ring, + tp->rx_ring_dma); unregister_netdev(dev); release_region(dev->base_addr, tulip_tbl[tp->chip_id].io_size); diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 64165cd0e60b..e7875649eb33 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c @@ -565,7 +565,7 @@ int sdla_assoc(struct net_device *slave, struct net_device *master) flp->dlci[i] = -*(short *)(master->dev_addr); master->mtu = slave->mtu; - if (netif_running(dev)) { + if (netif_running(slave)) { if (flp->config.station == FRAD_STATION_CPE) sdla_reconfig(slave); else diff --git a/drivers/net/wan/sdla_chdlc.c b/drivers/net/wan/sdla_chdlc.c index c0b419afa80c..4bc7762cb9ff 100644 --- a/drivers/net/wan/sdla_chdlc.c +++ b/drivers/net/wan/sdla_chdlc.c @@ -11,6 +11,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * ============================================================================ +* Feb 28, 2000 Jeff Garzik softnet updates * Nov 20, 1999 Nenad Corbic Fixed zero length API bug. * Sep 30, 1999 Nenad Corbic Fixed dynamic IP and route setup. * Sep 23, 1999 Nenad Corbic Added SMP support, fixed tracing @@ -64,6 +65,7 @@ #define PORT(x) (x == 0 ? "PRIMARY" : "SECONDARY" ) +#define TX_TIMEOUT (5*HZ) /******Data Structures*****************************************************/ @@ -130,6 +132,7 @@ static int del_if (wan_device_t* wandev, struct net_device* dev); static int if_init (struct net_device* dev); static int if_open (struct net_device* dev); static int if_close (struct net_device* dev); +static void if_tx_timeout (struct net_device *dev); static int if_header (struct sk_buff* skb, struct net_device* dev, unsigned short type, void* daddr, void* saddr, unsigned len); #ifdef LINUX_2_1 @@ -441,7 +444,7 @@ static int update (wan_device_t* wandev) if(test_bit(1, (void*)&card->wandev.critical)) return -EAGAIN; - if(!dev->start) + if(!netif_running(dev)) return -ENODEV; flags = card->u.c.flags; @@ -652,6 +655,8 @@ static int if_init (struct net_device* dev) dev->rebuild_header = &if_rebuild_hdr; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; + dev->tx_timeout = &if_tx_timeout; + dev->watchdog_timeo = TX_TIMEOUT; /* Initialize media-specific parameters */ dev->flags |= IFF_POINTTOPOINT; @@ -709,7 +714,7 @@ static int if_open (struct net_device* dev) /* Only one open per interface is allowed */ - if(dev->start) + if(netif_running(dev)) return -EBUSY; if(test_and_set_bit(1, (void*)&card->wandev.critical)) { @@ -774,9 +779,7 @@ static int if_open (struct net_device* dev) do_gettimeofday(&tv); chdlc_priv_area->router_start_time = tv.tv_sec; - dev->interrupt = 0; - dev->tbusy = 0; - dev->start = 1; + netif_start_queue(dev); dev->flags |= IFF_POINTTOPOINT; wanpipe_open(card); @@ -796,7 +799,7 @@ static int if_close (struct net_device* dev) if(test_and_set_bit(1, (void*)&card->wandev.critical)) return -EAGAIN; - dev->start = 0; + netif_stop_queue(dev); wanpipe_close(card); port_set_state(card, WAN_DISCONNECTED); chdlc_set_intr_mode(card, 0); @@ -843,6 +846,30 @@ static int if_rebuild_hdr (void* hdr, struct net_device* dev, unsigned long radd } #endif + +/*============================================================================ + * Handle transmit timeout event from netif watchdog + */ +static void if_tx_timeout (struct net_device *dev) +{ + chdlc_private_area_t *chdlc_priv_area = dev->priv; + sdla_t *card = chdlc_priv_area->card; + + /* If our device stays busy for at least 5 seconds then we will + * kick start the device by making dev->tbusy = 0. We expect + * that our device never stays busy more than 5 seconds. So this + * is only used as a last resort. + */ + ++card->wandev.stats.collisions; + + printk (KERN_INFO "%s: Transmit timeout !\n", + card->devname); + + /* unbusy the interface */ + netif_start_queue (dev); +} + + /*============================================================================ * Send a packet on a network interface. * o set tbusy flag (marks start of the transmission) to block a timer-based @@ -875,30 +902,10 @@ static int if_send (struct sk_buff* skb, struct net_device* dev) */ printk(KERN_INFO "%s: interface %s got kicked!\n", card->devname, dev->name); - mark_bh(NET_BH); + netif_wake_queue(dev); return 0; } - if(dev->tbusy) { - - /* If our device stays busy for at least 5 seconds then we will - * kick start the device by making dev->tbusy = 0. We expect - * that our device never stays busy more than 5 seconds. So this - * is only used as a last resort. - */ - ++card->wandev.stats.collisions; - - if((jiffies - chdlc_priv_area->tick_counter) < (5 * HZ)) { - return 1; - } - - printk (KERN_INFO "%s: Transmit timeout !\n", - card->devname); - - /* unbusy the interface */ - dev->tbusy = 0; - } - if(ntohs(skb->protocol) != 0x16) { /* check the udp packet type */ @@ -977,31 +984,24 @@ static int if_send (struct sk_buff* skb, struct net_device* dev) } if(chdlc_send(card, data, len)) { - dev->tbusy = 1; + netif_stop_queue(dev); chdlc_priv_area->tick_counter = jiffies; chdlc_int->interrupt_permission |= APP_INT_ON_TX_FRAME; } else { ++card->wandev.stats.tx_packets; -#ifdef LINUX_2_1 card->wandev.stats.tx_bytes += len; -#endif } } - if (!dev->tbusy) { -#ifdef LINUX_2_1 + if (!netif_queue_stopped(dev)) dev_kfree_skb(skb); -#else - dev_kfree_skb(skb, FREE_WRITE); -#endif - } clear_bit(0, (void*)&card->wandev.critical); if(card->hw.type != SDLA_S514){ s508_unlock(card,&smp_flags); } - return dev->tbusy; + return netif_queue_stopped(dev); } @@ -1521,8 +1521,7 @@ STATIC void wpc_isr (sdla_t* card) ~APP_INT_ON_TX_FRAME; chdlc_priv_area = dev->priv; - dev->tbusy = 0; - mark_bh(NET_BH); + netif_wake_queue(dev); break; case COMMAND_COMPLETE_APP_INT_PEND:/* 0x04: cmd cplt */ @@ -1606,7 +1605,7 @@ static void rx_intr (sdla_t* card) dev = card->wandev.dev; chdlc_priv_area = dev->priv; - if(dev && dev->start) { + if(dev && netif_running(dev)) { len = rxbuf->frame_length; diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c index f4431c9dcd61..14257cc85e39 100644 --- a/drivers/net/wan/sdla_fr.c +++ b/drivers/net/wan/sdla_fr.c @@ -11,6 +11,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * ============================================================================ +* Feb 28, 2000 Jeff Garzik o softnet updates * Nov 08, 1999 Nenad Corbic o Combined all debug UDP calls into one function * o Removed the ARP support. This has to be done * in the next version. @@ -108,7 +109,6 @@ * Jan 02, 1997 Gene Kozin Initial version. *****************************************************************************/ -#include #include /* printk(), and other useful stuff */ #include /* offsetof(), etc. */ #include /* return codes */ @@ -129,9 +129,6 @@ #include #include /* frame relay firmware API definitions */ -#if LINUX_VERSION_CODE < 0x020125 -#define test_and_set_bit set_bit -#endif /****** Defines & Macros ****************************************************/ @@ -157,6 +154,8 @@ #define API 0x01 #define FRAME_RELAY_API 1 +#define TX_TIMEOUT (5*HZ) + /* For handle_IPXWAN() */ #define CVHexToAscii(b) (((unsigned char)(b) > (unsigned char)9) ? ((unsigned char)'A' + ((unsigned char)(b) - (unsigned char)10)) : ((unsigned char)'0' + (unsigned char)(b))) @@ -273,6 +272,7 @@ static int if_close(struct net_device *dev); static int if_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len); static int if_rebuild_hdr(struct sk_buff *skb); static int if_send(struct sk_buff *skb, struct net_device *dev); +static void if_tx_timeout (struct net_device *dev); static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev, struct sk_buff *skb); static struct net_device_stats *if_stats(struct net_device *dev); @@ -939,6 +939,8 @@ static int if_init (struct net_device* dev) dev->rebuild_header = &if_rebuild_hdr; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; + dev->tx_timeout = &if_tx_timeout; + dev->watchdog_timeo = TX_TIMEOUT; /* Initialize media-specific parameters */ dev->type = ARPHRD_DLCI; /* ARP h/w type */ @@ -993,7 +995,7 @@ static int if_open (struct net_device* dev) int err = 0; struct timeval tv; - if (dev->start) + if (netif_running(dev)) return -EBUSY; /* only one open is allowed */ if (test_and_set_bit(1, (void*)&card->wandev.critical)) @@ -1034,9 +1036,7 @@ static int if_open (struct net_device* dev) fr_activate_dlci(card, chan->dlci); } - dev->interrupt = 0; - dev->tbusy = 0; - dev->start = 1; + netif_start_queue(dev); wanpipe_open(card); update_chan_state(dev); do_gettimeofday( &tv ); @@ -1058,7 +1058,7 @@ static int if_close (struct net_device* dev) if (test_and_set_bit(1, (void*)&card->wandev.critical)) return -EAGAIN; - dev->start = 0; + netif_stop_queue(dev); wanpipe_close(card); if (card->wandev.station == WANOPT_NODE) { fr_delete_dlci (card,chan->dlci); @@ -1113,6 +1113,30 @@ static int if_rebuild_hdr (struct sk_buff* skb) return 1; } + +/*============================================================================ + * Handle transmit timeout event from netif watchdog + */ +static void if_tx_timeout (struct net_device *dev) +{ + fr_channel_t* chan = dev->priv; + + /* If our device stays busy for at least 5 seconds then we will + * kick start the device by making dev->tbusy = 0. We expect + * that our device never stays busy more than 5 seconds. So this + * is only used as a last resort. + */ + + chan->drvstats_if_send.if_send_tbusy++; + ++chan->ifstats.collisions; + + printk (KERN_INFO "%s: Transmit timed out\n", chan->name); + chan->drvstats_if_send.if_send_tbusy_timeout++; + netif_start_queue (dev); + +} + + /*============================================================================ * Send a packet on a network interface. * o set tbusy flag (marks start of the transmission) to block a timer-based @@ -1153,7 +1177,7 @@ static int if_send (struct sk_buff* skb, struct net_device* dev) printk(KERN_INFO "%s: interface %s got kicked!\n", card->devname, dev->name); chan->drvstats_if_send.if_send_skb_null ++; - mark_bh(NET_BH); + netif_wake_queue(dev); return 0; } @@ -1164,33 +1188,13 @@ static int if_send (struct sk_buff* skb, struct net_device* dev) */ set_bit(2, (void*)&card->wandev.critical); if(chan->transmit_length) { - dev->tbusy = 1; + netif_stop_queue(dev); chan->tick_counter = jiffies; clear_bit(2, (void*)&card->wandev.critical); return 1; } clear_bit(2, (void*)&card->wandev.critical); - if (dev->tbusy) { - - /* If our device stays busy for at least 5 seconds then we will - * kick start the device by making dev->tbusy = 0. We expect - * that our device never stays busy more than 5 seconds. So this - * is only used as a last resort. - */ - - chan->drvstats_if_send.if_send_tbusy++; - ++chan->ifstats.collisions; - - if ((jiffies - chan->tick_counter) < (5 * HZ)) { - return 1; - } - - printk(KERN_INFO "%s: Transmit timed out\n", chan->name); - chan->drvstats_if_send.if_send_tbusy_timeout ++; - dev->tbusy = 0; - } - data = skb->data; sendpacket = skb->data; len = skb->len; @@ -1318,15 +1322,14 @@ static int if_send (struct sk_buff* skb, struct net_device* dev) } } - if (!dev->tbusy) { + if (!netif_queue_stopped(dev)) dev_kfree_skb(skb); - } clear_bit(0, (void*)&card->wandev.critical); s508_s514_unlock(card,&smp_flags); - return (dev->tbusy); + return (netif_queue_stopped(dev)); } @@ -1743,10 +1746,10 @@ static void rx_intr (sdla_t* card) skb = dev_alloc_skb(len); - if (!dev->start || (skb == NULL)) { + if (!netif_running(dev) || (skb == NULL)) { ++chan->ifstats.rx_dropped; - if(dev->start) { + if(netif_running(dev)) { printk(KERN_INFO "%s: no socket buffers available!\n", @@ -1920,8 +1923,7 @@ static void tx_intr(sdla_t *card) if(!(-- card->u.f.tx_interrupts_pending)) flags->imask &= ~FR_INTR_TXRDY; - dev->tbusy = 0; - mark_bh(NET_BH); + netif_wake_queue (dev); } } @@ -2704,7 +2706,7 @@ static int fr_dlci_change (sdla_t *card, fr_mbox_t* mbox) "%s: DLCI %u is inactive!\n", card->devname, dlci); - if (dev && dev->start) + if (dev && netif_running(dev)) set_chan_state(dev, WAN_DISCONNECTED); } @@ -2714,7 +2716,7 @@ static int fr_dlci_change (sdla_t *card, fr_mbox_t* mbox) "%s: DLCI %u has been deleted!\n", card->devname, dlci); - if (dev && dev->start) { + if (dev && netif_running(dev)) { fr_channel_t *chan = dev->priv; if (chan->route_flag == ROUTE_ADDED) { @@ -2738,7 +2740,7 @@ static int fr_dlci_change (sdla_t *card, fr_mbox_t* mbox) */ chan->dlci_configured = DLCI_CONFIG_PENDING; - if (dev && dev->start) + if (dev && netif_running(dev)) set_chan_state(dev, WAN_CONNECTED); } @@ -3004,7 +3006,7 @@ static int process_udp_mgmt_pkt(sdla_t* card) test_bit(2, (void*)&card->wandev.critical)) { return 0; } - if((dev->tbusy) || (card->u.f.tx_interrupts_pending)) { + if((netif_queue_stopped(dev)) || (card->u.f.tx_interrupts_pending)) { return 0; } } diff --git a/drivers/net/wan/sdla_ppp.c b/drivers/net/wan/sdla_ppp.c index f3dcc129bba8..40134ff72393 100644 --- a/drivers/net/wan/sdla_ppp.c +++ b/drivers/net/wan/sdla_ppp.c @@ -142,9 +142,8 @@ #define NUM_AUTH_REQ_WITHOUT_REPLY 10 #define END_OFFSET 0x1F0 -#if LINUX_VERSION_CODE < 0x020125 -#define test_and_set_bit set_bit -#endif + +#define TX_TIMEOUT (5*HZ) /******Data Structures*****************************************************/ @@ -213,6 +212,7 @@ static int wpp_exec (struct sdla *card, void *u_cmd, void *u_data); static int if_init(struct net_device *dev); static int if_open(struct net_device *dev); static int if_close(struct net_device *dev); +static void if_tx_timeout (struct net_device *dev); static int if_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len); static int if_rebuild_hdr(struct sk_buff *skb); @@ -585,7 +585,8 @@ static int if_init(struct net_device *dev) dev->rebuild_header = &if_rebuild_hdr; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; - + dev->tx_timeout = &if_tx_timeout; + dev->watchdog_timeo = TX_TIMEOUT; /* Initialize media-specific parameters */ dev->type = ARPHRD_PPP; /* ARP h/w type */ @@ -632,7 +633,7 @@ static int if_open(struct net_device *dev) struct timeval tv; int err = 0; - if (dev->start) + if (netif_running(dev)) return -EBUSY; /* only one open is allowed */ if (test_and_set_bit(0, (void*)&card->wandev.critical)) @@ -714,13 +715,10 @@ static int if_open(struct net_device *dev) return err; } - wanpipe_set_state(card, WAN_CONNECTING); wanpipe_open(card); dev->mtu = min(dev->mtu, card->wandev.mtu); - dev->interrupt = 0; - dev->tbusy = 0; - dev->start = 1; + netif_start_queue(dev); do_gettimeofday( &tv ); ppp_priv_area->router_start_time = tv.tv_sec; card->wandev.critical = 0; @@ -741,7 +739,7 @@ static int if_close(struct net_device *dev) if (test_and_set_bit(0, (void*)&card->wandev.critical)) return -EAGAIN; - dev->start = 0; + netif_stop_queue(dev); wanpipe_close(card); wanpipe_set_state(card, WAN_DISCONNECTED); ppp_set_intr_mode(card, 0); @@ -795,6 +793,35 @@ static int if_rebuild_hdr (struct sk_buff *skb) return 1; } + +/*============================================================================ + * Handle transmit timeout from netif watchdog + */ +static void if_tx_timeout (struct net_device *dev) +{ + ppp_private_area_t *ppp_priv_area = dev->priv; + sdla_t *card = ppp_priv_area->card; + + + /* If our device stays busy for at least 5 seconds then we will + * kick start the device by making dev->tbusy = 0. We expect + * that our device never stays busy more than 5 seconds. So this + * is only used as a last resort. + */ + + ++ppp_priv_area->if_send_stat.if_send_tbusy; + ++card->wandev.stats.collisions; + + printk (KERN_INFO "%s: Transmit times out\n", card->devname); + + ++ppp_priv_area->if_send_stat.if_send_tbusy_timeout; + ++card->wandev.stats.collisions; + + /* unbusy the card (because only one interface per card) */ + netif_start_queue(dev); +} + + /*============================================================================ * Send a packet on a network interface. * o set tbusy flag (marks start of the transmission) to block a timer-based @@ -835,34 +862,11 @@ static int if_send (struct sk_buff *skb, struct net_device *dev) ++ppp_priv_area->if_send_stat.if_send_skb_null; - mark_bh(NET_BH); + netif_wake_queue(dev); return 0; } - if (dev->tbusy) { - - /* If our device stays busy for at least 5 seconds then we will - * kick start the device by making dev->tbusy = 0. We expect - * that our device never stays busy more than 5 seconds. So this - * is only used as a last resort. - */ - - ++ppp_priv_area->if_send_stat.if_send_tbusy; - ++card->wandev.stats.collisions; - - if ((jiffies - ppp_priv_area->tick_counter) < (5*HZ)) { - return 1; - } - - printk (KERN_INFO "%s: Transmit times out\n",card->devname); - - ++ppp_priv_area->if_send_stat.if_send_tbusy_timeout; - ++card->wandev.stats.collisions; - - /* unbusy the card (because only one interface per card)*/ - dev->tbusy = 0; - } sendpacket = skb->data; udp_type = udp_pkt_type( skb, card ); @@ -930,7 +934,7 @@ static int if_send (struct sk_buff *skb, struct net_device *dev) if (ppp_send(card, skb->data, skb->len, skb->protocol)) { retry = 1; - dev->tbusy = 1; + netif_stop_queue(dev); ++ppp_priv_area->if_send_stat.if_send_adptr_bfrs_full; ++ppp_priv_area->if_send_stat.if_send_tx_int_enabled; ppp_priv_area->tick_counter = jiffies; @@ -1530,7 +1534,7 @@ STATIC void wpp_isr(sdla_t *card) case PPP_INTR_TXRDY: /* transmit interrupt 0x02 (bit 1)*/ ++card->statistics.isr_tx; flags->imask &= ~PPP_INTR_TXRDY; - dev->tbusy = 0; + netif_wake_queue (dev); card->buff_int_mode_unbusy = 1; break; @@ -1564,9 +1568,8 @@ STATIC void wpp_isr(sdla_t *card) flags->iflag = 0; card->wandev.critical = 0; - if(card->buff_int_mode_unbusy) { - mark_bh(NET_BH); - } + if(card->buff_int_mode_unbusy) + netif_wake_queue(dev); } /*============================================================================ @@ -1603,7 +1606,7 @@ static void rx_intr(sdla_t *card) } - if (dev && dev->start) { + if (dev && netif_running(dev)) { len = rxbuf->length; ppp_priv_area = dev->priv; @@ -2006,7 +2009,7 @@ static void poll_disconnected(sdla_t *card) { struct net_device *dev = card->wandev.dev; - if (dev && dev->start && + if (dev && netif_running(dev) && ((jiffies - card->state_tick) > HOLD_DOWN_TIME)) { wanpipe_set_state(card, WAN_CONNECTING); diff --git a/drivers/net/wavelan.c b/drivers/net/wavelan.c index 17b285ba42fc..45592eacf971 100644 --- a/drivers/net/wavelan.c +++ b/drivers/net/wavelan.c @@ -3726,7 +3726,7 @@ static void wavelan_interrupt(int irq, void *dev_id, struct pt_regs *regs) } /* Release spinlock here so that wv_hw_reset() can grab it */ - spin_unlock (&lp->lock); + spin_unlock (&lp->spinlock); /* Check the state of the command unit. */ if (((status & SCB_ST_CNA) == SCB_ST_CNA) || @@ -4006,7 +4006,7 @@ static int __init wavelan_config(device * dev) lp->mc_count = 0; /* Init spinlock */ - spin_lock_init(&lp->lock); + spin_lock_init(&lp->spinlock); /* * Fill in the fields of the device structure diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index a907847c0dbf..7eb759b94de2 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c @@ -103,6 +103,22 @@ static int gx_fix = 0; #define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) +#ifdef USE_IO_OPS +#define YF_INB inb +#define YF_INW inw +#define YF_INL inl +#define YF_OUTB outb +#define YF_OUTW outw +#define YF_OUTL outl +#else +#define YF_INB readb +#define YF_INW readw +#define YF_INL readl +#define YF_OUTB writeb +#define YF_OUTW writew +#define YF_OUTL writel +#endif + /* Theory of Operation @@ -357,11 +373,11 @@ static int __devinit read_eeprom(long ioaddr, int location) { int bogus_cnt = 10000; /* Typical 33Mhz: 1050 ticks */ - outb(location, ioaddr + EEAddr); - outb(0x30 | ((location >> 8) & 7), ioaddr + EECtrl); - while ((inb(ioaddr + EEStatus) & 0x80) && --bogus_cnt > 0) + YF_OUTB(location, ioaddr + EEAddr); + YF_OUTB(0x30 | ((location >> 8) & 7), ioaddr + EECtrl); + while ((YF_INB(ioaddr + EEStatus) & 0x80) && --bogus_cnt > 0) ; - return inb(ioaddr + EERead); + return YF_INB(ioaddr + EERead); } /* MII Managemen Data I/O accesses. @@ -372,24 +388,24 @@ static int mdio_read(long ioaddr, int phy_id, int location) { int i; - outw((phy_id<<8) + location, ioaddr + MII_Addr); - outw(1, ioaddr + MII_Cmd); + YF_OUTW((phy_id<<8) + location, ioaddr + MII_Addr); + YF_OUTW(1, ioaddr + MII_Cmd); for (i = 10000; i >= 0; i--) - if ((inw(ioaddr + MII_Status) & 1) == 0) + if ((YF_INW(ioaddr + MII_Status) & 1) == 0) break; - return inw(ioaddr + MII_Rd_Data); + return YF_INW(ioaddr + MII_Rd_Data); } static void mdio_write(long ioaddr, int phy_id, int location, int value) { int i; - outw((phy_id<<8) + location, ioaddr + MII_Addr); - outw(value, ioaddr + MII_Wr_Data); + YF_OUTW((phy_id<<8) + location, ioaddr + MII_Addr); + YF_OUTW(value, ioaddr + MII_Wr_Data); /* Wait for the command to finish. */ for (i = 10000; i >= 0; i--) - if ((inw(ioaddr + MII_Status) & 1) == 0) + if ((YF_INW(ioaddr + MII_Status) & 1) == 0) break; return; } @@ -402,7 +418,7 @@ static int yellowfin_open(struct net_device *dev) int i; /* Reset the chip. */ - outl(0x80000000, ioaddr + DMACtrl); + YF_OUTL(0x80000000, ioaddr + DMACtrl); if (request_irq(dev->irq, &yellowfin_interrupt, SA_SHIRQ, dev->name, dev)) return -EAGAIN; @@ -415,30 +431,30 @@ static int yellowfin_open(struct net_device *dev) yellowfin_init_ring(dev); - outl(virt_to_bus(yp->rx_ring), ioaddr + RxPtr); - outl(virt_to_bus(yp->tx_ring), ioaddr + TxPtr); + YF_OUTL(virt_to_bus(yp->rx_ring), ioaddr + RxPtr); + YF_OUTL(virt_to_bus(yp->tx_ring), ioaddr + TxPtr); for (i = 0; i < 6; i++) - outb(dev->dev_addr[i], ioaddr + StnAddr + i); + YF_OUTB(dev->dev_addr[i], ioaddr + StnAddr + i); /* Set up various condition 'select' registers. There are no options here. */ - outl(0x00800080, ioaddr + TxIntrSel); /* Interrupt on Tx abort */ - outl(0x00800080, ioaddr + TxBranchSel); /* Branch on Tx abort */ - outl(0x00400040, ioaddr + TxWaitSel); /* Wait on Tx status */ - outl(0x00400040, ioaddr + RxIntrSel); /* Interrupt on Rx done */ - outl(0x00400040, ioaddr + RxBranchSel); /* Branch on Rx error */ - outl(0x00400040, ioaddr + RxWaitSel); /* Wait on Rx done */ + YF_OUTL(0x00800080, ioaddr + TxIntrSel); /* Interrupt on Tx abort */ + YF_OUTL(0x00800080, ioaddr + TxBranchSel); /* Branch on Tx abort */ + YF_OUTL(0x00400040, ioaddr + TxWaitSel); /* Wait on Tx status */ + YF_OUTL(0x00400040, ioaddr + RxIntrSel); /* Interrupt on Rx done */ + YF_OUTL(0x00400040, ioaddr + RxBranchSel); /* Branch on Rx error */ + YF_OUTL(0x00400040, ioaddr + RxWaitSel); /* Wait on Rx done */ /* Initialize other registers: with so many this eventually this will converted to an offset/value list. */ - outl(dma_ctrl, ioaddr + DMACtrl); - outw(fifo_cfg, ioaddr + FIFOcfg); + YF_OUTL(dma_ctrl, ioaddr + DMACtrl); + YF_OUTW(fifo_cfg, ioaddr + FIFOcfg); /* Enable automatic generation of flow control frames, period 0xffff. */ - outl(0x0030FFFF, ioaddr + FlowCtrl); + YF_OUTL(0x0030FFFF, ioaddr + FlowCtrl); yp->tx_threshold = 32; - outl(yp->tx_threshold, ioaddr + TxThreshold); + YF_OUTL(yp->tx_threshold, ioaddr + TxThreshold); if (dev->if_port == 0) dev->if_port = yp->default_port; @@ -449,19 +465,19 @@ static int yellowfin_open(struct net_device *dev) if (yp->flags & IsGigabit) { /* We are always in full-duplex mode with gigabit! */ yp->full_duplex = 1; - outw(0x01CF, ioaddr + Cnfg); + YF_OUTW(0x01CF, ioaddr + Cnfg); } else { - outw(0x0018, ioaddr + FrameGap0); /* 0060/4060 for non-MII 10baseT */ - outw(0x1018, ioaddr + FrameGap1); - outw(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg); + YF_OUTW(0x0018, ioaddr + FrameGap0); /* 0060/4060 for non-MII 10baseT */ + YF_OUTW(0x1018, ioaddr + FrameGap1); + YF_OUTW(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg); } set_rx_mode(dev); /* Enable interrupts by setting the interrupt mask. */ - outw(0x81ff, ioaddr + IntrEnb); /* See enum intr_status_bits */ - outw(0x0000, ioaddr + EventStatus); /* Clear non-interrupting events */ - outl(0x80008000, ioaddr + RxCtrl); /* Start Rx and Tx channels. */ - outl(0x80008000, ioaddr + TxCtrl); + YF_OUTW(0x81ff, ioaddr + IntrEnb); /* See enum intr_status_bits */ + YF_OUTW(0x0000, ioaddr + EventStatus); /* Clear non-interrupting events */ + YF_OUTL(0x80008000, ioaddr + RxCtrl); /* Start Rx and Tx channels. */ + YF_OUTL(0x80008000, ioaddr + TxCtrl); if (yellowfin_debug > 2) { printk(KERN_DEBUG "%s: Done yellowfin_open().\n", @@ -486,7 +502,7 @@ static void yellowfin_timer(unsigned long data) if (yellowfin_debug > 3) { printk(KERN_DEBUG "%s: Yellowfin timer tick, status %8.8x.\n", - dev->name, inw(ioaddr + IntrStatus)); + dev->name, YF_INW(ioaddr + IntrStatus)); } if (yp->mii_cnt) { @@ -503,7 +519,7 @@ static void yellowfin_timer(unsigned long data) || (negotiated & 0x00C0) == 0x0040)) { yp->full_duplex = 1; } - outw(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg); + YF_OUTW(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg); if (mii_reg1 & 0x0004) next_tick = 60*HZ; @@ -523,7 +539,7 @@ static void yellowfin_tx_timeout(struct net_device *dev) printk(KERN_WARNING "%s: Yellowfin transmit timed out at %d/%d Tx " "status %4.4x, Rx status %4.4x, resetting...\n", dev->name, yp->cur_tx, yp->dirty_tx, - inl(ioaddr + TxStatus), inl(ioaddr + RxStatus)); + YF_INL(ioaddr + TxStatus), YF_INL(ioaddr + RxStatus)); /* Note: these should be KERN_DEBUG. */ if (yellowfin_debug) { @@ -543,7 +559,7 @@ static void yellowfin_tx_timeout(struct net_device *dev) dev->if_port = 0; /* Wake the potentially-idle transmit channel. */ - outl(0x10001000, dev->base_addr + TxCtrl); + YF_OUTL(0x10001000, dev->base_addr + TxCtrl); if (yp->cur_tx - yp->dirty_tx < TX_QUEUE_SIZE) netif_wake_queue (dev); /* Typical path */ @@ -681,7 +697,7 @@ static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev) /* Non-x86 Todo: explicitly flush cache lines here. */ /* Wake the potentially-idle transmit channel. */ - outl(0x10001000, dev->base_addr + TxCtrl); + YF_OUTL(0x10001000, dev->base_addr + TxCtrl); if (yp->cur_tx - yp->dirty_tx < TX_QUEUE_SIZE) netif_start_queue (dev); /* Typical path */ @@ -717,7 +733,7 @@ static void yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *reg spin_lock (&yp->lock); do { - u16 intr_status = inw(ioaddr + IntrClear); + u16 intr_status = YF_INW(ioaddr + IntrClear); if (yellowfin_debug > 4) printk(KERN_DEBUG "%s: Yellowfin interrupt, status %4.4x.\n", @@ -728,7 +744,7 @@ static void yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *reg if (intr_status & (IntrRxDone | IntrEarlyRx)) { yellowfin_rx(dev); - outl(0x10001000, ioaddr + RxCtrl); /* Wake Rx engine. */ + YF_OUTL(0x10001000, ioaddr + RxCtrl); /* Wake Rx engine. */ } #ifdef NO_TXSTATS @@ -845,7 +861,7 @@ static void yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *reg if (yellowfin_debug > 3) printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", - dev->name, inw(ioaddr + IntrStatus)); + dev->name, YF_INW(ioaddr + IntrStatus)); /* Code that should never be run! Perhaps remove after testing.. */ { @@ -1023,18 +1039,19 @@ static int yellowfin_close(struct net_device *dev) if (yellowfin_debug > 1) { printk(KERN_DEBUG "%s: Shutting down ethercard, status was Tx %4.4x Rx %4.4x Int %2.2x.\n", - dev->name, inw(ioaddr + TxStatus), - inw(ioaddr + RxStatus), inw(ioaddr + IntrStatus)); + dev->name, YF_INW(ioaddr + TxStatus), + YF_INW(ioaddr + RxStatus), + YF_INW(ioaddr + IntrStatus)); printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d.\n", dev->name, yp->cur_tx, yp->dirty_tx, yp->cur_rx, yp->dirty_rx); } /* Disable interrupts by clearing the interrupt mask. */ - outw(0x0000, ioaddr + IntrEnb); + YF_OUTW(0x0000, ioaddr + IntrEnb); /* Stop the chip's Tx and Rx processes. */ - outl(0x80000000, ioaddr + RxCtrl); - outl(0x80000000, ioaddr + TxCtrl); + YF_OUTL(0x80000000, ioaddr + RxCtrl); + YF_OUTL(0x80000000, ioaddr + TxCtrl); del_timer(&yp->timer); @@ -1043,7 +1060,7 @@ static int yellowfin_close(struct net_device *dev) printk("\n"KERN_DEBUG" Tx ring at %8.8x:\n", (int)virt_to_bus(yp->tx_ring)); for (i = 0; i < TX_RING_SIZE*2; i++) printk(" %c #%d desc. %8.8x %8.8x %8.8x %8.8x.\n", - inl(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ', + YF_INL(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ', i, yp->tx_ring[i].dbdma_cmd, yp->tx_ring[i].addr, yp->tx_ring[i].branch_addr, yp->tx_ring[i].result_status); printk(KERN_DEBUG " Tx status %p:\n", yp->tx_status); @@ -1055,7 +1072,7 @@ static int yellowfin_close(struct net_device *dev) printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", (int)virt_to_bus(yp->rx_ring)); for (i = 0; i < RX_RING_SIZE; i++) { printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x\n", - inl(ioaddr + RxPtr) == (long)&yp->rx_ring[i] ? '>' : ' ', + YF_INL(ioaddr + RxPtr) == (long)&yp->rx_ring[i] ? '>' : ' ', i, yp->rx_ring[i].dbdma_cmd, yp->rx_ring[i].addr, yp->rx_ring[i].result_status); if (yellowfin_debug > 6) { @@ -1134,17 +1151,17 @@ static void set_rx_mode(struct net_device *dev) { struct yellowfin_private *yp = (struct yellowfin_private *)dev->priv; long ioaddr = dev->base_addr; - u16 cfg_value = inw(ioaddr + Cnfg); + u16 cfg_value = YF_INW(ioaddr + Cnfg); /* Stop the Rx process to change any value. */ - outw(cfg_value & ~0x1000, ioaddr + Cnfg); + YF_OUTW(cfg_value & ~0x1000, ioaddr + Cnfg); if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ /* Unconditionally log net taps. */ printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name); - outw(0x000F, ioaddr + AddrMode); + YF_OUTW(0x000F, ioaddr + AddrMode); } else if ((dev->mc_count > 64) || (dev->flags & IFF_ALLMULTI)) { /* Too many to filter well, or accept all multicasts. */ - outw(0x000B, ioaddr + AddrMode); + YF_OUTW(0x000B, ioaddr + AddrMode); } else if (dev->mc_count > 0) { /* Must use the multicast hash table. */ struct dev_mc_list *mclist; u16 hash_table[4]; @@ -1167,13 +1184,13 @@ static void set_rx_mode(struct net_device *dev) } /* Copy the hash table to the chip. */ for (i = 0; i < 4; i++) - outw(hash_table[i], ioaddr + HashTbl + i*2); - outw(0x0003, ioaddr + AddrMode); + YF_OUTW(hash_table[i], ioaddr + HashTbl + i*2); + YF_OUTW(0x0003, ioaddr + AddrMode); } else { /* Normal, unicast/broadcast-only mode. */ - outw(0x0001, ioaddr + AddrMode); + YF_OUTW(0x0001, ioaddr + AddrMode); } /* Restart the Rx process. */ - outw(cfg_value | 0x1000, ioaddr + Cnfg); + YF_OUTW(cfg_value | 0x1000, ioaddr + Cnfg); } #ifdef HAVE_PRIVATE_IOCTL @@ -1209,7 +1226,7 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev, int option, i, irq; int flags, chip_idx; static int find_cnt = 0; - long ioaddr; + long ioaddr, real_ioaddr; chip_idx = ent->driver_data; flags = chip_info[chip_idx].flags; @@ -1243,18 +1260,20 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev, pci_set_master (pdev); #ifdef USE_IO_OPS - ioaddr = pci_resource_start (pdev, 0); + real_ioaddr = ioaddr = pci_resource_start (pdev, 0); #else - ioaddr = pci_resource_start (pdev, 1); + real_ioaddr = ioaddr = pci_resource_start (pdev, 1); + ioaddr = ioremap(ioaddr, YELLOWFIN_SIZE); #endif irq = pdev->irq; printk(KERN_INFO "%s: %s type %8x at 0x%lx, ", - dev->name, chip_info[chip_idx].name, inl(ioaddr + ChipRev), ioaddr); + dev->name, chip_info[chip_idx].name, + YF_INL(ioaddr + ChipRev), real_ioaddr); if (flags & IsGigabit) for (i = 0; i < 6; i++) - dev->dev_addr[i] = inb(ioaddr + StnAddr + i); + dev->dev_addr[i] = YF_INB(ioaddr + StnAddr + i); else { int ee_offset = (read_eeprom(ioaddr, 6) == 0xff ? 0x100 : 0); for (i = 0; i < 6; i++) @@ -1265,7 +1284,7 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev, printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq); /* Reset the chip. */ - outl(0x80000000, ioaddr + DMACtrl); + YF_OUTL(0x80000000, ioaddr + DMACtrl); dev->base_addr = ioaddr; dev->irq = irq; diff --git a/drivers/parport/daisy.c b/drivers/parport/daisy.c index c4003dd27c50..3b13ea71a704 100644 --- a/drivers/parport/daisy.c +++ b/drivers/parport/daisy.c @@ -160,10 +160,10 @@ void parport_daisy_fini (struct parport *port) while (prev) { dev = prev->next; - if (dev && dev->port == port) + if (dev && dev->port == port) { prev->next = dev->next; - - kfree (dev); + kfree (dev); + } prev = prev->next; } diff --git a/drivers/parport/ieee1284.c b/drivers/parport/ieee1284.c index 8db17e5c90d5..6b9c9e47f2d8 100644 --- a/drivers/parport/ieee1284.c +++ b/drivers/parport/ieee1284.c @@ -165,6 +165,7 @@ int parport_wait_peripheral(struct parport *port, /* Terminate a negotiated mode. */ static void parport_ieee1284_terminate (struct parport *port) { + int r; port = port->physport; /* EPP terminates differently. */ @@ -199,9 +200,12 @@ static void parport_ieee1284_terminate (struct parport *port) | PARPORT_CONTROL_AUTOFD); /* Event 49: PError goes high */ - parport_wait_peripheral (port, - PARPORT_STATUS_PAPEROUT, - PARPORT_STATUS_PAPEROUT); + r = parport_wait_peripheral (port, + PARPORT_STATUS_PAPEROUT, + PARPORT_STATUS_PAPEROUT); + if (r) + DPRINTK (KERN_INFO "%s: Timeout at event 49\n", + port->name); parport_data_forward (port); DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n", @@ -221,7 +225,10 @@ static void parport_ieee1284_terminate (struct parport *port) PARPORT_CONTROL_SELECT); /* Event 24: nAck goes low */ - parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0); + r = parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0); + if (r) + DPRINTK (KERN_INFO "%s: Timeout at event 24\n", + port->name); /* Event 25: Set nAutoFd low */ parport_frob_control (port, @@ -229,9 +236,12 @@ static void parport_ieee1284_terminate (struct parport *port) PARPORT_CONTROL_AUTOFD); /* Event 27: nAck goes high */ - parport_wait_peripheral (port, - PARPORT_STATUS_ACK, - PARPORT_STATUS_ACK); + r = parport_wait_peripheral (port, + PARPORT_STATUS_ACK, + PARPORT_STATUS_ACK); + if (r) + DPRINTK (KERN_INFO "%s: Timeout at event 27\n", + port->name); /* Event 29: Set nAutoFd high */ parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); @@ -260,6 +270,7 @@ int parport_negotiate (struct parport *port, int mode) return -1; #else int m = mode & ~IEEE1284_ADDR; + int r; unsigned char xflag; port = port->physport; @@ -367,7 +378,7 @@ int parport_negotiate (struct parport *port, int mode) /* xflag should be high for all modes other than nibble (0). */ if (mode && !xflag) { /* Mode not supported. */ - DPRINTK (KERN_DEBUG "%s: Mode 0x%02x not supported\n", + DPRINTK (KERN_DEBUG "%s: Mode 0x%02x rejected by peripheral\n", port->name, mode); parport_ieee1284_terminate (port); return 1; @@ -434,7 +445,7 @@ int parport_negotiate (struct parport *port, int mode) port->ieee1284.mode = mode; /* But ECP is special */ - if (!(mode & IEEE1284_EXT_LINK) && (mode & IEEE1284_MODE_ECP)) { + if (!(mode & IEEE1284_EXT_LINK) && (m & IEEE1284_MODE_ECP)) { port->ieee1284.phase = IEEE1284_PH_ECP_SETUP; /* Event 30: Set nAutoFd low */ @@ -443,10 +454,11 @@ int parport_negotiate (struct parport *port, int mode) PARPORT_CONTROL_AUTOFD); /* Event 31: PError goes high. */ - parport_wait_peripheral (port, - PARPORT_STATUS_PAPEROUT, - PARPORT_STATUS_PAPEROUT); - /* (Should check that this works..) */ + r = parport_wait_peripheral (port, + PARPORT_STATUS_PAPEROUT, + PARPORT_STATUS_PAPEROUT); + if (r) + DPRINTK (KERN_INFO "%s: Timeout at event 31\n"); port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n", diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 5f5b71a40546..49e530ace82a 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -1503,7 +1503,7 @@ out: /* --- DMA detection -------------------------------------- */ -/* Only if supports ECP mode */ +/* Only if chipset conforms to ECP ISA Interface Standard */ static int __devinit programmable_dma_support (struct parport *p) { unsigned char oecr = inb (ECONTROL (p)); @@ -1511,8 +1511,10 @@ static int __devinit programmable_dma_support (struct parport *p) frob_econtrol (p, 0xe0, ECR_CNF << 5); - dma = inb (CONFIGB(p)) & 0x03; - if (!dma) + dma = inb (CONFIGB(p)) & 0x07; + /* 000: Indicates jumpered 8-bit DMA if read-only. + 100: Indicates jumpered 16-bit DMA if read-only. */ + if ((dma & 0x03) == 0) dma = PARPORT_DMA_NONE; outb (oecr, ECONTROL (p)); @@ -1722,6 +1724,7 @@ struct parport *__devinit parport_pc_probe_port (unsigned long int base, } +/* Via support maintained by Jeff Garzik */ static int __devinit sio_via_686a_probe (struct pci_dev *pdev) { u8 dma, irq, tmp; @@ -1835,6 +1838,7 @@ static struct pci_device_id parport_pc_pci_tbl[] __devinitdata = { static int __devinit parport_pc_init_superio(void) { +#ifdef CONFIG_PCI const struct pci_device_id *id; struct pci_dev *pdev; @@ -1845,11 +1849,11 @@ static int __devinit parport_pc_init_superio(void) return parport_pc_superio_info[id->driver_data].probe (pdev); } +#endif /* CONFIG_PCI */ return 0; /* zero devices found */ } - /* Look for PCI parallel port cards. */ static int __init parport_pc_init_pci (int irq, int dma) { @@ -2036,9 +2040,16 @@ static int dmaval[PARPORT_PC_MAX_PORTS] = { [0 ... PARPORT_PC_MAX_PORTS-1] = PAR static int irqval[PARPORT_PC_MAX_PORTS] = { [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_IRQ_PROBEONLY }; static const char *irq[PARPORT_PC_MAX_PORTS] = { NULL, }; static const char *dma[PARPORT_PC_MAX_PORTS] = { NULL, }; + +MODULE_AUTHOR("Phil Blundell, Tim Waugh, others"); +MODULE_DESCRIPTION("PC-style parallel port driver"); +MODULE_PARM_DESC(io, "Base I/O address (SPP regs)"); MODULE_PARM(io, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "i"); +MODULE_PARM_DESC(io_hi, "Base I/O address (ECR)"); MODULE_PARM(io_hi, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "i"); +MODULE_PARM_DESC(irq, "IRQ line"); MODULE_PARM(irq, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "s"); +MODULE_PARM_DESC(dma, "DMA channel"); MODULE_PARM(dma, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "s"); int init_module(void) diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 945b19bd4997..c2e6ebdf9f68 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -14,11 +14,8 @@ L_TARGET := pci.a # Nasty trick as we need to link files with no references from the outside. O_TARGET := pci_core.o L_OBJS := pci_core.o -O_OBJS := pci.o quirks.o - -ifdef CONFIG_MODULES -OX_OBJS += pcisyms.o -endif +O_OBJS := quirks.o +OX_OBJS := pci.o ifdef CONFIG_PROC_FS O_OBJS += proc.o diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index cc76f78dbc34..1837c2467d0a 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include @@ -19,6 +20,7 @@ #include #include +#include /* isa_dma_bridge_buggy */ #undef DEBUG @@ -987,3 +989,50 @@ static int __init pci_setup(char *str) } __setup("pci=", pci_setup); + + +EXPORT_SYMBOL(pci_read_config_byte); +EXPORT_SYMBOL(pci_read_config_word); +EXPORT_SYMBOL(pci_read_config_dword); +EXPORT_SYMBOL(pci_write_config_byte); +EXPORT_SYMBOL(pci_write_config_word); +EXPORT_SYMBOL(pci_write_config_dword); +EXPORT_SYMBOL(pci_devices); +EXPORT_SYMBOL(pci_root_buses); +EXPORT_SYMBOL(pci_enable_device); +EXPORT_SYMBOL(pci_find_capability); +EXPORT_SYMBOL(pci_find_class); +EXPORT_SYMBOL(pci_find_device); +EXPORT_SYMBOL(pci_find_slot); +EXPORT_SYMBOL(pci_find_subsys); +EXPORT_SYMBOL(pci_set_master); +EXPORT_SYMBOL(pci_set_power_state); +EXPORT_SYMBOL(pci_assign_resource); +EXPORT_SYMBOL(pci_register_driver); +EXPORT_SYMBOL(pci_unregister_driver); +EXPORT_SYMBOL(pci_match_device); +EXPORT_SYMBOL(pci_find_parent_resource); + +#ifdef CONFIG_HOTPLUG +EXPORT_SYMBOL(pci_setup_device); +EXPORT_SYMBOL(pci_insert_device); +EXPORT_SYMBOL(pci_remove_device); +#endif + +/* Obsolete functions */ + +EXPORT_SYMBOL(pcibios_present); +EXPORT_SYMBOL(pcibios_read_config_byte); +EXPORT_SYMBOL(pcibios_read_config_word); +EXPORT_SYMBOL(pcibios_read_config_dword); +EXPORT_SYMBOL(pcibios_write_config_byte); +EXPORT_SYMBOL(pcibios_write_config_word); +EXPORT_SYMBOL(pcibios_write_config_dword); +EXPORT_SYMBOL(pcibios_find_class); +EXPORT_SYMBOL(pcibios_find_device); + +/* Quirk info */ + +EXPORT_SYMBOL(isa_dma_bridge_buggy); +EXPORT_SYMBOL(pci_pci_problems); + diff --git a/drivers/pci/pci.ids b/drivers/pci/pci.ids index 1dfedc0dd011..21a6a4ff1f3d 100644 --- a/drivers/pci/pci.ids +++ b/drivers/pci/pci.ids @@ -2225,6 +2225,7 @@ 1277 Comstream 1278 Transtech Parallel Systems Ltd. 1279 Transmeta Corporation + 0295 Virtual Northbridge 127a Rockwell International 1002 HCF 56k V90 FaxModem 1003 HCF 56k V90 FaxModem diff --git a/drivers/pci/pcisyms.c b/drivers/pci/pcisyms.c deleted file mode 100644 index 310f758403b1..000000000000 --- a/drivers/pci/pcisyms.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * $Id: pcisyms.c,v 1.8 1998/05/12 07:36:04 mj Exp $ - * - * PCI Bus Services -- Exported Symbols - * - * Copyright 1998--2000 Martin Mares - */ - -#include -#include -#include -#include /* isa_dma_bridge_buggy */ - -EXPORT_SYMBOL(pci_read_config_byte); -EXPORT_SYMBOL(pci_read_config_word); -EXPORT_SYMBOL(pci_read_config_dword); -EXPORT_SYMBOL(pci_write_config_byte); -EXPORT_SYMBOL(pci_write_config_word); -EXPORT_SYMBOL(pci_write_config_dword); -EXPORT_SYMBOL(pci_devices); -EXPORT_SYMBOL(pci_root_buses); -EXPORT_SYMBOL(pci_enable_device); -EXPORT_SYMBOL(pci_find_capability); -EXPORT_SYMBOL(pci_find_class); -EXPORT_SYMBOL(pci_find_device); -EXPORT_SYMBOL(pci_find_slot); -EXPORT_SYMBOL(pci_find_subsys); -EXPORT_SYMBOL(pci_set_master); -EXPORT_SYMBOL(pci_set_power_state); -EXPORT_SYMBOL(pci_assign_resource); -EXPORT_SYMBOL(pci_register_driver); -EXPORT_SYMBOL(pci_unregister_driver); -EXPORT_SYMBOL(pci_match_device); -EXPORT_SYMBOL(pci_find_parent_resource); - -#ifdef CONFIG_HOTPLUG -EXPORT_SYMBOL(pci_setup_device); -EXPORT_SYMBOL(pci_insert_device); -EXPORT_SYMBOL(pci_remove_device); -#endif - -/* Obsolete functions */ - -EXPORT_SYMBOL(pcibios_present); -EXPORT_SYMBOL(pcibios_read_config_byte); -EXPORT_SYMBOL(pcibios_read_config_word); -EXPORT_SYMBOL(pcibios_read_config_dword); -EXPORT_SYMBOL(pcibios_write_config_byte); -EXPORT_SYMBOL(pcibios_write_config_word); -EXPORT_SYMBOL(pcibios_write_config_dword); -EXPORT_SYMBOL(pcibios_find_class); -EXPORT_SYMBOL(pcibios_find_device); - -/* Quirk info */ - -EXPORT_SYMBOL(isa_dma_bridge_buggy); -EXPORT_SYMBOL(pci_pci_problems); - diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index cda39a5c15f5..8029b19824f8 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -113,6 +113,55 @@ static void __init quirk_s3_64M(struct pci_dev *dev) } } +static void __init quirk_io_region(struct pci_dev *dev, unsigned region, unsigned size, int nr) +{ + region &= ~(size-1); + if (region) { + struct resource *res = dev->resource + nr; + + res->name = dev->name; + res->start = region; + res->end = region + size - 1; + res->flags = IORESOURCE_IO; + pci_claim_resource(dev, nr); + } +} + +/* + * Let's make the southbridge information explicit instead + * of having to worry about people probing the ACPI areas, + * for example.. (Yes, it happens, and if you read the wrong + * ACPI register it will put the machine to sleep with no + * way of waking it up again. Bummer). + * + * ALI M7101: Two IO regions pointed to by words at + * 0xE0 (64 bytes of ACPI registers) + * 0xE2 (32 bytes of SMB registers) + */ +static void __init quirk_ali7101(struct pci_dev *dev) +{ + u16 region; + + pci_read_config_word(dev, 0xE0, ®ion); + quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES); + pci_read_config_word(dev, 0xE2, ®ion); + quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1); +} + +/* + * PIIX4 ACPI: Two IO regions pointed to by longwords at + * 0x40 (64 bytes of ACPI registers) + * 0x90 (32 bytes of SMB registers) + */ +static void __init quirk_piix4acpi(struct pci_dev *dev) +{ + u32 region; + + pci_read_config_dword(dev, 0x40, ®ion); + quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES); + pci_read_config_dword(dev, 0x90, ®ion); + quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1); +} /* * The main table of quirks. @@ -143,6 +192,8 @@ static struct pci_fixup pci_fixups[] __initdata = { { PCI_FIXUP_FINAL, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443BX_2, quirk_natoma }, { PCI_FIXUP_FINAL, PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5597, quirk_nopcipci }, { PCI_FIXUP_FINAL, PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_496, quirk_nopcipci }, + { PCI_FIXUP_FINAL, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4acpi }, + { PCI_FIXUP_FINAL, PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, quirk_ali7101 }, { 0 } }; diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 7025263d40a9..4439f7c298eb 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -82,14 +82,12 @@ static const char *version = #else #define CB_OPT "" #endif -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) || defined(CONFIG_ACPI) -#define APM_OPT " [apm]" +#ifdef CONFIG_PM +#define APM_OPT " [pm]" #else #define APM_OPT "" #endif -#if !defined(CONFIG_CARDBUS) && !defined(CONFIG_PCI) && \ - !defined(CONFIG_APM) && !defined(CONFIG_APM_MODULE) && \ - !defined(CONFIG_ACPI) +#if !defined(CONFIG_CARDBUS) && !defined(CONFIG_PCI) && !defined(CONFIG_PM) #define OPTIONS " none" #else #define OPTIONS PCI_OPT CB_OPT APM_OPT @@ -125,7 +123,7 @@ static int cis_speed = 300; /* ns */ static int io_speed = 0; /* ns */ /* Optional features */ -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) || defined(CONFIG_ACPI) +#ifdef CONFIG_PM static int do_apm = 1; MODULE_PARM(do_apm, "i"); #else diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c index d059c4fdbc18..f156051239c8 100644 --- a/drivers/pcmcia/rsrc_mgr.c +++ b/drivers/pcmcia/rsrc_mgr.c @@ -102,10 +102,11 @@ static irq_info_t irq_table[NR_IRQS] = { { 0, 0, 0 }, /* etc */ }; /*====================================================================== Linux resource management extensions - + ======================================================================*/ -#define check_io_region(b,n) (0) +#define check_io_resource(b,n) check_resource(&ioport_resource, (b), (n)) +#define check_mem_resource(b,n) check_resource(&iomem_resource, (b), (n)) /*====================================================================== @@ -191,7 +192,7 @@ static void do_io_probe(ioaddr_t base, ioaddr_t num) b = kmalloc(256, GFP_KERNEL); memset(b, 0, 256); for (i = base, most = 0; i < base+num; i += 8) { - if (check_region(i, 8) || check_io_region(i, 8)) + if (check_io_resource(i, 8)) continue; hole = inb(i); for (j = 1; j < 8; j++) @@ -204,7 +205,7 @@ static void do_io_probe(ioaddr_t base, ioaddr_t num) bad = any = 0; for (i = base; i < base+num; i += 8) { - if (check_region(i, 8) || check_io_region(i, 8)) + if (check_io_resource(i, 8)) continue; for (j = 0; j < 8; j++) if (inb(i+j) != most) break; @@ -255,13 +256,13 @@ static int do_mem_probe(u_long base, u_long num, for (i = base; i < base+num; i = j + step) { if (!fail) { for (j = i; j < base+num; j += step) - if ((check_mem_region(j, step) == 0) && is_valid(j)) + if ((check_mem_resource(j, step) == 0) && is_valid(j)) break; fail = ((i == base) && (j == base+num)); } if (fail) { for (j = i; j < base+num; j += 2*step) - if ((check_mem_region(j, 2*step) == 0) && + if ((check_mem_resource(j, 2*step) == 0) && do_cksum(j) && do_cksum(j+step)) break; } @@ -375,8 +376,7 @@ int find_io_region(ioaddr_t *base, ioaddr_t num, ioaddr_t align, for (try = (try >= m->base) ? try : try+align; (try >= m->base) && (try+num <= m->base+m->num); try += align) { - if ((check_region(try, num) == 0) && - (check_io_region(try, num) == 0)) { + if (check_io_resource(try, num) == 0) { *base = try; request_region(try, num, name); return 0; @@ -401,7 +401,7 @@ int find_mem_region(u_long *base, u_long num, u_long align, for (try = (try >= m->base) ? try : try+align; (try >= m->base) && (try+num <= m->base+m->num); try += align) { - if (check_mem_region(try, num) == 0) { + if (check_mem_resource(try, num) == 0) { request_mem_region(try, num, name); *base = try; return 0; diff --git a/drivers/pcmcia/yenta.c b/drivers/pcmcia/yenta.c index 3531348bbeb6..fc971cc7428c 100644 --- a/drivers/pcmcia/yenta.c +++ b/drivers/pcmcia/yenta.c @@ -235,16 +235,18 @@ static int yenta_set_socket(pci_socket_t *socket, socket_state_t *state) socket->io_irq = state->io_irq; bridge = config_readw(socket, CB_BRIDGE_CONTROL) & ~(CB_BRIDGE_CRST | CB_BRIDGE_INTR); if (cb_readl(socket, CB_SOCKET_STATE) & CB_CBCARD) { + u8 intr; bridge |= (state->flags & SS_RESET) ? CB_BRIDGE_CRST : 0; /* ISA interrupt control? */ + intr = exca_readb(socket, I365_INTCTL); + intr = (intr & ~0xf); if (!socket->cb_irq) { - u8 intr = exca_readb(socket, I365_INTCTL); - intr = (intr & ~0xf) | state->io_irq; - exca_writeb(socket, I365_INTCTL, intr); + intr |= state->io_irq; bridge |= CB_BRIDGE_INTR; } - } else { + exca_writeb(socket, I365_INTCTL, intr); + } else { u8 reg; bridge |= CB_BRIDGE_INTR; diff --git a/drivers/scsi/pci2000.c b/drivers/scsi/pci2000.c index 6aef8ae63244..7f14fc61b4bc 100644 --- a/drivers/scsi/pci2000.c +++ b/drivers/scsi/pci2000.c @@ -660,7 +660,7 @@ int Pci2000_Detect (Scsi_Host_Template *tpnt) padapter = HOSTDATA(pshost); #if LINUX_VERSION_CODE > LINUXVERSION(2,1,92) - padapter->basePort = pdev->base_address[1] & 0xFFFE; + padapter->basePort = pci_resource_start (pdev, 1); #else pcibios_read_config_word (pci_bus, pci_device_fn, PCI_BASE_ADDRESS_1, &padapter->basePort); padapter->basePort &= 0xFFFE; diff --git a/drivers/scsi/pci2220i.c b/drivers/scsi/pci2220i.c index fabb61c0ccce..b84ff1723bd1 100644 --- a/drivers/scsi/pci2220i.c +++ b/drivers/scsi/pci2220i.c @@ -2448,15 +2448,9 @@ static USHORT GetRegs (struct Scsi_Host *pshost, BOOL bigd, UCHAR pci_bus, UCHAR memset (&DaleSetup, 0, sizeof (DaleSetup)); memset (DiskMirror, 0, sizeof (DiskMirror)); -#if LINUX_VERSION_CODE > LINUXVERSION(2,1,92) - zr = pcidev->base_address[1] & 0xFFFE; - zl = pcidev->base_address[2] & 0xFFFE; -#else - pcibios_read_config_word (pci_bus, pci_device_fn, PCI_BASE_ADDRESS_1, &zr); - zr &= 0xFFFE; - pcibios_read_config_word (pci_bus, pci_device_fn, PCI_BASE_ADDRESS_2, &zl); - zl &= 0xFFFE; -#endif + zr = pci_resource_start (pcidev, 1); + zl = pci_resource_start (pcidev, 2); + padapter->basePort = zr; padapter->regRemap = zr + RTR_LOCAL_REMAP; // 32 bit local space remap padapter->regDesc = zr + RTR_REGIONS; // 32 bit local region descriptor diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c index 9b82cc839fb4..c8c5dd54dd2b 100644 --- a/drivers/scsi/seagate.c +++ b/drivers/scsi/seagate.c @@ -89,7 +89,7 @@ #include #include #include - +#include #include #include "scsi.h" #include "hosts.h" @@ -99,7 +99,6 @@ #include #include "sd.h" #include -#include #ifdef DEBUG #define DPRINTK( when, msg... ) do { if ( (DEBUG & (when)) == (when) ) printk( msg ); } while (0) diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index f897cba9a87d..1de7686dc2a1 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -11,7 +11,7 @@ Copyright 1992 - 2000 Kai Makisara email Kai.Makisara@metla.fi - Last modified: Sat Feb 19 17:22:34 2000 by makisara@kai.makisara.local + Last modified: Tue Feb 29 20:47:03 2000 by makisara@kai.makisara.local Some small formal changes - aeb, 950809 Last modified: 18-JAN-1998 Richard Gooch Devfs support @@ -172,21 +172,22 @@ static int st_int_ioctl(struct inode *inode, unsigned int cmd_in, /* Convert the result to success code */ static int st_chk_result(Scsi_Request * SRpnt) { - int dev = TAPE_NR(SRpnt->sr_request.rq_dev); + int dev; int result = SRpnt->sr_result; unsigned char *sense = SRpnt->sr_sense_buffer, scode; DEB(const char *stp;) - if (!result) + if (!result) { + sense[0] = 0; /* We don't have sense data if this byte is zero */ return 0; + } if (driver_byte(result) & DRIVER_SENSE) scode = sense[2] & 0x0f; - else { - sense[0] = 0; /* We don't have sense data if this byte is zero */ + else scode = 0; - } + dev = TAPE_NR(SRpnt->sr_request.rq_dev); DEB( if (debugging) { printk(ST_DEB_MSG "st%d: Error: %x, cmd: %x %x %x %x %x %x Len: %d\n", @@ -294,7 +295,7 @@ static Scsi_Request * { unsigned char *bp; - if (SRpnt == NULL) + if (SRpnt == NULL) { SRpnt = scsi_allocate_request(STp->device); if (SRpnt == NULL) { DEBC( printk(KERN_ERR "st%d: Can't get SCSI request.\n", @@ -305,6 +306,7 @@ static Scsi_Request * (STp->buffer)->syscall_result = (-EBUSY); return NULL; } + } cmd[1] |= (SRpnt->sr_device->lun << 5) & 0xe0; init_MUTEX_LOCKED(&STp->sem); diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c index 4aa159decc71..379b55874c57 100644 --- a/drivers/scsi/u14-34f.c +++ b/drivers/scsi/u14-34f.c @@ -1948,7 +1948,7 @@ int u14_34f_release(struct Scsi_Host *shpnt) { if (sh[j] == NULL) panic("%s: release, invalid Scsi_Host pointer.\n", driver_name); - if( sh[j]->block != NULL ) { + if( sh[j]->unchecked_isa_dma ) { scsi_deregister_blocked_host(sh[j]); } diff --git a/drivers/sgi/char/graphics_syms.c b/drivers/sgi/char/graphics_syms.c index 6e07d3b8b87d..0a36ed76e86e 100644 --- a/drivers/sgi/char/graphics_syms.c +++ b/drivers/sgi/char/graphics_syms.c @@ -8,7 +8,6 @@ */ #define __NO_VERSION__ -#include #include /* extern int rrm_command (unsigned int cmd, void *arg); diff --git a/drivers/sgi/char/newport.c b/drivers/sgi/char/newport.c index 7fa4d65febbb..74c9f294c6bd 100644 --- a/drivers/sgi/char/newport.c +++ b/drivers/sgi/char/newport.c @@ -12,7 +12,6 @@ #include #include #include