## Automatically generated incremental diff ## From: linux-2.5.66-bk7 ## To: linux-2.5.66-bk8 ## Robot: $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $ diff -urN linux-2.5.66-bk7/Documentation/driver-model/overview.txt linux-2.5.66-bk8/Documentation/driver-model/overview.txt --- linux-2.5.66-bk7/Documentation/driver-model/overview.txt Mon Mar 24 14:00:14 2003 +++ linux-2.5.66-bk8/Documentation/driver-model/overview.txt Wed Apr 2 04:38:10 2003 @@ -90,7 +90,7 @@ Or by hand on the command line: -# mount -t sysfs sysfs /devices +# mount -t sysfs sysfs /sys Whenever a device is inserted into the tree, a directory is created for it. This directory may be populated at each layer of discovery - the global layer, diff -urN linux-2.5.66-bk7/Documentation/filesystems/befs.txt linux-2.5.66-bk8/Documentation/filesystems/befs.txt --- linux-2.5.66-bk7/Documentation/filesystems/befs.txt Mon Mar 24 14:00:21 2003 +++ linux-2.5.66-bk8/Documentation/filesystems/befs.txt Wed Apr 2 04:38:10 2003 @@ -18,32 +18,35 @@ AUTHOR ===== Current maintainer: Will Dyson -Has been working on the code since Aug 13, 2001. See the changelog for details. +Has been working on the code since Aug 13, 2001. See the changelog for +details. Original Author: Makoto Kato -His orriginal code can still be found at: -Does anyone know of a more current email address for Makoto? He doesn't respond -to the address given above... +His orriginal code can still be found at: + +Does anyone know of a more current email address for Makoto? He doesn't +respond to the address given above... WHAT IS THIS DRIVER? ================== This module implements the native filesystem of BeOS -for the linux 2.4.1 and later kernels. Currently it is a read-only implementation. +for the linux 2.4.1 and later kernels. Currently it is a read-only +implementation. Which is it, BFS or BEFS? ================ Be, Inc said, "BeOS Filesystem is officially called BFS, not BeFS". -But Unixware Boot Filesystem is called bfs, too. And they are already in the -kernel. -Because of this nameing conflict, on Linux the BeOS filesystem is called befs. +But Unixware Boot Filesystem is called bfs, too. And they are already in +the kernel. Because of this nameing conflict, on Linux the BeOS +filesystem is called befs. HOW TO INSTALL ============== step 1. Install the BeFS patch into the source code tree of linux. Apply the patchfile to your kernel source tree. -Assuming that your kernel source is in /foo/bar/linux and the patchfile is called -patch-befs-xxx, you would do the following: +Assuming that your kernel source is in /foo/bar/linux and the patchfile +is called patch-befs-xxx, you would do the following: cd /foo/bar/linux patch -p1 < /path/to/patch-befs-xxx @@ -66,8 +69,9 @@ The BeFS module is not a standard part of the linux kernel, so you must first enable support for experimental code under the "Code maturity level" menu. -Then, under the "Filesystems" menu will be an option called "BeFS filesystem (experimental)", -or something like that. Enable that option (it is fine to make it a module). +Then, under the "Filesystems" menu will be an option called "BeFS +filesystem (experimental)", or something like that. Enable that option +(it is fine to make it a module). Save your kernel configuration and then build your kernel. diff -urN linux-2.5.66-bk7/Documentation/filesystems/cifs.txt linux-2.5.66-bk8/Documentation/filesystems/cifs.txt --- linux-2.5.66-bk7/Documentation/filesystems/cifs.txt Mon Mar 24 14:00:08 2003 +++ linux-2.5.66-bk8/Documentation/filesystems/cifs.txt Wed Apr 2 04:38:10 2003 @@ -1,26 +1,33 @@ -This module, cifs, is a filesystem that implements the SMB/CIFS protocol, which is the -protocol used by Windows based operating systems (including Windows 2000 and its successors) -as well as Samba, OS/2 and many others operating systems and network file server appliances. -The Cifs VFS filesystem module is designed to work well with servers that implement the newer versions -(dialects) of the SMB/CIFS protocol such as Samba, the program written by Andrew Tridgell -that turns any Unix host into a file server for DOS or Windows clients, as well as Windows NT, -Windows 2000 and its successors. It is not designed to handle older smb servers well, those that -implement older versions of the dialect (such as OS/2 or Windows 95), for this purpose use smbfs. +This module, cifs, is a filesystem that implements the SMB/CIFS +protocol, which is the protocol used by Windows based operating systems +(including Windows 2000 and its successors) as well as Samba, OS/2 and +many others operating systems and network file server appliances. The +Cifs VFS filesystem module is designed to work well with servers that +implement the newer versions (dialects) of the SMB/CIFS protocol such as +Samba, the program written by Andrew Tridgell that turns any Unix host +into a file server for DOS or Windows clients, as well as Windows NT, +Windows 2000 and its successors. It is not designed to handle older smb +servers well, those that implement older versions of the dialect (such +as OS/2 or Windows 95), for this purpose use smbfs. -This module can support mounting without a mount helper program. The mount syntax is: - mount //server_ip_address/share_name /mnt -o user=username,password=your_password -where "username", "your_password" and "server_ip_address" and "share_name" should be replaced -with specific values (supplied by the user) e.g. - mount //9.53.216.16/public /mnt -o user=jsmith,password=openup +This module can support mounting without a mount helper program. The +mount syntax is: + mount //server_ip/share_name /mnt -o user=username,password=your_password -This cifs implementation is designed to handle network caching (safely) as well as to implement locking, -large file (64 bit access), distributed file system ("dfs") and other advanced protocol features. It -also implements the SNIA standard for Unix extensions to CIFS (when communicating with servers such as -Samba 2.2.3 or later which support it). +where "username", "your_password" and "server_ip" and "share_name" +should be replaced with specific values (supplied by the user) e.g. + mount //9.53.216.16/public /mnt -o user=jsmith,password=openup + +This cifs implementation is designed to handle network caching (safely) +as well as to implement locking, large file (64 bit access), distributed +file system ("dfs") and other advanced protocol features. It also +implements the SNIA standard for Unix extensions to CIFS (when +communicating with servers such as Samba 2.2.3 or later which support it). For more information contact sfrench@us.ibm.com -Cifs is an SMB client (or gateway). For more info on the SMB/CIFS protocol and Samba, including -documentation, please go to http://www.samba.org/ and then on to your nearest mirror. For more +Cifs is an SMB client (or gateway). For more info on the SMB/CIFS +protocol and Samba, including documentation, please go to +http://www.samba.org/ and then on to your nearest mirror. For more information about the cifs vfs, go to the project page at: http://us1.samba.org/samba/Linux_CIFS_client.html diff -urN linux-2.5.66-bk7/Documentation/filesystems/sysv-fs.txt linux-2.5.66-bk8/Documentation/filesystems/sysv-fs.txt --- linux-2.5.66-bk7/Documentation/filesystems/sysv-fs.txt Mon Mar 24 13:59:54 2003 +++ linux-2.5.66-bk8/Documentation/filesystems/sysv-fs.txt Wed Apr 2 04:38:10 2003 @@ -23,8 +23,9 @@ - Only file systems with no filesystem name and no pack name are recognized. (See Coherent "man mkfs" for a description of these features.) - SystemV Release 2 FS: - The superblock is only searched in the blocks 9, 15, 18, which corresponds to the - beginning of track 1 on floppy disks. No support for this FS on hard disk yet. + The superblock is only searched in the blocks 9, 15, 18, which + corresponds to the beginning of track 1 on floppy disks. No support + for this FS on hard disk yet. Please report any bugs and suggestions to diff -urN linux-2.5.66-bk7/Documentation/ia64/efirtc.txt linux-2.5.66-bk8/Documentation/ia64/efirtc.txt --- linux-2.5.66-bk7/Documentation/ia64/efirtc.txt Mon Mar 24 14:00:49 2003 +++ linux-2.5.66-bk8/Documentation/ia64/efirtc.txt Wed Apr 2 04:38:10 2003 @@ -12,13 +12,13 @@ to get access to the Time Service offered by EFI version 0.92. EFI provides 4 calls one can make once the OS is booted: GetTime(), -SetTime(), GetWakeupTime(), SetWakeupTime() which are all supported by this driver. -We describe those calls as well the design of the driver in the following -sections. +SetTime(), GetWakeupTime(), SetWakeupTime() which are all supported by this +driver. We describe those calls as well the design of the driver in the +following sections. II/ Design Decisions -The original ideas was to provide a very simple driver to get access to, +The original ideas was to provide a very simple driver to get access to, at first, the time of day service. This is required in order to access, in a portable way, the CMOS clock. A program like /sbin/hwclock uses such a clock to initialize the system view of the time during boot. @@ -39,8 +39,8 @@ without necessarily impacting any of the user applications. The decoupling enables flexibility and permits writing wrapper code is ncase things change. -The driver exposes two interfaces, one via the device file and a set of ioctl()s. -The other is read-only via the /proc filesystem. +The driver exposes two interfaces, one via the device file and a set of +ioctl()s. The other is read-only via the /proc filesystem. As of today we don't offer a /proc/sys interface. diff -urN linux-2.5.66-bk7/Documentation/pci.txt linux-2.5.66-bk8/Documentation/pci.txt --- linux-2.5.66-bk7/Documentation/pci.txt Mon Mar 24 14:00:35 2003 +++ linux-2.5.66-bk8/Documentation/pci.txt Wed Apr 2 04:38:11 2003 @@ -51,21 +51,24 @@ execution of pci_register_driver for already existing devices or later if a new device gets inserted) for all PCI devices which match the ID table and are not handled - by the other drivers yet. This function gets passed a pointer - to the pci_dev structure representing the device and also - which entry in the ID table did the device match. It returns - zero when the driver has accepted the device or an error - code (negative number) otherwise. This function always gets - called from process context, so it can sleep. - remove Pointer to a function which gets called whenever a device - being handled by this driver is removed (either during - deregistration of the driver or when it's manually pulled - out of a hot-pluggable slot). This function always gets - called from process context, so it can sleep. + by the other drivers yet. This function gets passed a + pointer to the pci_dev structure representing the device + and also which entry in the ID table did the device + match. It returns zero when the driver has accepted the + device or an error code (negative number) otherwise. + This function always gets called from process context, + so it can sleep. + remove Pointer to a function which gets called whenever a + device being handled by this driver is removed (either + during deregistration of the driver or when it's + manually pulled out of a hot-pluggable slot). This + function always gets called from process context, so it + can sleep. save_state Save a device's state before it's suspend. suspend Put device into low power state. resume Wake device from low power state. - enable_wake Enable device to generate wake events from a low power state. + enable_wake Enable device to generate wake events from a low power + state. (Please see Documentation/power/pci.txt for descriptions of PCI Power Management and the related functions) @@ -186,8 +189,9 @@ See Documentation/IO-mapping.txt for how to access device memory. - You still need to call request_region() for I/O regions and request_mem_region() -for memory regions to make sure nobody else is using the same device. + You still need to call request_region() for I/O regions and +request_mem_region() for memory regions to make sure nobody else is using the +same device. All interrupt handlers should be registered with SA_SHIRQ and use the devid to map IRQs to devices (remember that all PCI interrupts are shared). diff -urN linux-2.5.66-bk7/Documentation/power/pci.txt linux-2.5.66-bk8/Documentation/power/pci.txt --- linux-2.5.66-bk7/Documentation/power/pci.txt Mon Mar 24 14:01:18 2003 +++ linux-2.5.66-bk8/Documentation/power/pci.txt Wed Apr 2 04:38:11 2003 @@ -22,7 +22,7 @@ power management operations. Implementation of the PCI PM Spec is optional, as are several sub-components of -it. If a device supports the PCI PM Spec, the device will have an 8 byte +it. If a device supports the PCI PM Spec, the device will have an 8 byte capability field in its PCI configuration space. This field is used to describe and control the standard PCI power management features. @@ -50,33 +50,35 @@ | D1, D2, D3 | D0 | +---------------------------+ -Note that when the system is entering a global suspend state, all devices will be -placed into D3 and when resuming, all devices will be placed into D0. However, -when the system is running, other state transitions are possible. +Note that when the system is entering a global suspend state, all devices will +be placed into D3 and when resuming, all devices will be placed into D0. +However, when the system is running, other state transitions are possible. 2. How The PCI Subsystem Handles Power Management ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The PCI suspend/resume functionality is accessed indirectly via the Power Management -subsystem. At boot, the PCI driver registers a power management callback with that layer. -Upon entering a suspend state, the PM layer iterates through all of its registered -callbacks. This currently takes place only during APM state transitions. - -Upon going to sleep, the PCI subsystem walks its device tree twice. Both times, it does -a depth first walk of the device tree. The first walk saves each of the device's state -and checks for devices that will prevent the system from entering a global power state. -The next walk then places the devices in a low power state. - -The first walk allows a graceful recovery in the event of a failure, since none of the -devices have actually been powered down. - -In both walks, in particular the second, all children of a bridge are touched before the -actual bridge itself. This allows the bridge to retain power while its children are being -accessed. - -Upon resuming from sleep, just the opposite must be true: all bridges must be powered on -and restored before their children are powered on. This is easily accomplished with a -breadth-first walk of the PCI device tree. +The PCI suspend/resume functionality is accessed indirectly via the Power +Management subsystem. At boot, the PCI driver registers a power management +callback with that layer. Upon entering a suspend state, the PM layer iterates +through all of its registered callbacks. This currently takes place only during +APM state transitions. + +Upon going to sleep, the PCI subsystem walks its device tree twice. Both times, +it does a depth first walk of the device tree. The first walk saves each of the +device's state and checks for devices that will prevent the system from entering +a global power state. The next walk then places the devices in a low power +state. + +The first walk allows a graceful recovery in the event of a failure, since none +of the devices have actually been powered down. + +In both walks, in particular the second, all children of a bridge are touched +before the actual bridge itself. This allows the bridge to retain power while +its children are being accessed. + +Upon resuming from sleep, just the opposite must be true: all bridges must be +powered on and restored before their children are powered on. This is easily +accomplished with a breadth-first walk of the PCI device tree. 3. PCI Utility Functions @@ -86,8 +88,8 @@ Assuming that a device behaves as advertised, these should be applicable in most cases. However, results may vary. -Note that these functions are never implicitly called for the driver. The driver is always -responsible for deciding when and if to call these. +Note that these functions are never implicitly called for the driver. The driver +is always responsible for deciding when and if to call these. pci_save_state @@ -97,7 +99,8 @@ pci_save_state(dev, buffer); Description: - Save first 64 bytes of PCI config space. Buffer must be allocated by caller. + Save first 64 bytes of PCI config space. Buffer must be allocated by + caller. pci_restore_state @@ -109,8 +112,8 @@ Description: Restore previously saved config space. (First 64 bytes only); - If buffer is NULL, then restore what information we know about the device - from bootup: BARs and interrupt line. + If buffer is NULL, then restore what information we know about the + device from bootup: BARs and interrupt line. pci_set_power_state @@ -120,7 +123,8 @@ pci_set_power_state(dev, state); Description: - Transition device to low power state using PCI PM Capabilities registers. + Transition device to low power state using PCI PM Capabilities + registers. Will fail under one of the following conditions: - If state is less than current state, but not D0 (illegal transition) @@ -138,14 +142,15 @@ Enable device to generate PME# during low power state using PCI PM Capabilities. - Checks whether if device supports generating PME# from requested state and fail - if it does not, unless enable == 0 (request is to disable wake events, which - is implicit if it doesn't even support it in the first place). - - Note that the PMC Register in the device's PM Capabilties has a bitmask of - the states it supports generating PME# from. D3hot is bit 3 and D3cold is bit - 4. So, while a value of 4 as the state may not seem semantically correct, it - is. + Checks whether if device supports generating PME# from requested state + and fail if it does not, unless enable == 0 (request is to disable wake + events, which is implicit if it doesn't even support it in the first + place). + + Note that the PMC Register in the device's PM Capabilties has a bitmask + of the states it supports generating PME# from. D3hot is bit 3 and + D3cold is bit 4. So, while a value of 4 as the state may not seem + semantically correct, it is. 4. PCI Device Drivers @@ -168,25 +173,26 @@ if (dev->driver && dev->driver->save_state) dev->driver->save_state(dev,state); -The driver should use this callback to save device state. It should take into -account the current state of the device and the requested state in order to avoid -any unnecessary operations. - -For example, a video card that supports all 4 states (D0-D3), all controller context -is preserved when entering D1, but the screen is placed into a low power state -(blanked). - -The driver can also interpret this function as a notification that it may be entering -a sleep state in the near future. If it knows that the device cannot enter the -requested state, either because of lack of support for it, or because the device is -middle of some critical operation, then it should fail. - -This function should not be used to set any state in the device or the driver because -the device may not actually enter the sleep state (e.g. another driver later causes -causes a global state transition to fail). - -Note that in intermediate low power states, a device's I/O and memory spaces may be -disabled and may not be available in subsequent transitions to lower power states. +The driver should use this callback to save device state. It should take into +account the current state of the device and the requested state in order to +avoid any unnecessary operations. + +For example, a video card that supports all 4 states (D0-D3), all controller +context is preserved when entering D1, but the screen is placed into a low power +state (blanked). + +The driver can also interpret this function as a notification that it may be +entering a sleep state in the near future. If it knows that the device cannot +enter the requested state, either because of lack of support for it, or because +the device is middle of some critical operation, then it should fail. + +This function should not be used to set any state in the device or the driver +because the device may not actually enter the sleep state (e.g. another driver +later causes causes a global state transition to fail). + +Note that in intermediate low power states, a device's I/O and memory spaces may +be disabled and may not be available in subsequent transitions to lower power +states. suspend @@ -197,27 +203,27 @@ if (dev->driver && dev->driver->suspend) dev->driver->suspend(dev,state); -A driver uses this function to actually transition the device into a low power -state. This may include disabling I/O, memory and bus-mastering, as well as physically -transitioning the device to a lower power state. +A driver uses this function to actually transition the device into a low power +state. This may include disabling I/O, memory and bus-mastering, as well as +physically transitioning the device to a lower power state. Bus mastering may be disabled by doing: pci_disable_device(dev); -For devices that support the PCI PM Spec, this may be used to set the device's power -state: +For devices that support the PCI PM Spec, this may be used to set the device's +power state: pci_set_power_state(dev,state); The driver is also responsible for disabling any other device-specific features (e.g blanking screen, turning off on-card memory, etc). -The driver should be sure to track the current state of the device, as it may obviate -the need for some operations. +The driver should be sure to track the current state of the device, as it may +obviate the need for some operations. -The driver should update the current_state field in its pci_dev structure in this -function. +The driver should update the current_state field in its pci_dev structure in +this function. resume ------ @@ -227,36 +233,37 @@ if (dev->driver && dev->driver->suspend) dev->driver->resume(dev) -The resume callback may be called from any power state, and is always meant to +The resume callback may be called from any power state, and is always meant to transition the device to the D0 state. -The driver is responsible for reenabling any features of the device that had -been disabled during previous suspend calls and restoring all state that was saved -in previous save_state calls. - -If the device is currently in D3, it must be completely reinitialized, as it must be -assumed that the device has lost all of its context (even that of its PCI config -space). For almost all current drivers, this means that the initialization code that -the driver does at boot must be separated out and called again from the resume -callback. Note that some values for the device may not have to be probed for this -time around if they are saved before entering the low power state. +The driver is responsible for reenabling any features of the device that had +been disabled during previous suspend calls and restoring all state that was +saved in previous save_state calls. + +If the device is currently in D3, it must be completely reinitialized, as it +must be assumed that the device has lost all of its context (even that of its +PCI config space). For almost all current drivers, this means that the +initialization code that the driver does at boot must be separated out and +called again from the resume callback. Note that some values for the device may +not have to be probed for this time around if they are saved before entering the +low power state. -If the device supports the PCI PM Spec, it can use this to physically transition the -device to D0: +If the device supports the PCI PM Spec, it can use this to physically transition +the device to D0: pci_set_power_state(dev,0); -Note that if the entire system is transitioning out of a global sleep state, all -devices will be placed in the D0 state, so this is not necessary. However, in the -event that the device is placed in the D3 state during normal operation, this call -is necessary. It is impossible to determine which of the two events is taking place -in the driver, so it is always a good idea to make that call. +Note that if the entire system is transitioning out of a global sleep state, all +devices will be placed in the D0 state, so this is not necessary. However, in +the event that the device is placed in the D3 state during normal operation, +this call is necessary. It is impossible to determine which of the two events is +taking place in the driver, so it is always a good idea to make that call. -The driver should take note of the state that it is resuming from in order to ensure -correct (and speedy) operation. +The driver should take note of the state that it is resuming from in order to +ensure correct (and speedy) operation. -The driver should update the current_state field in its pci_dev structure in this -function. +The driver should update the current_state field in its pci_dev structure in +this function. enable_wake diff -urN linux-2.5.66-bk7/Documentation/swsusp.txt linux-2.5.66-bk8/Documentation/swsusp.txt --- linux-2.5.66-bk7/Documentation/swsusp.txt Mon Mar 24 13:59:53 2003 +++ linux-2.5.66-bk8/Documentation/swsusp.txt Wed Apr 2 04:38:11 2003 @@ -62,14 +62,14 @@ echo 4 > /proc/acpi/sleep. Either way it saves the state of the machine into active swaps and then -reboots. You must explicitly specify the swap partition to resume from with ``resume='' -kernel option. If signature is found it loads and restores saved state. If the -option ``noresume'' is specified as a boot parameter, it skips the resuming. -Warning! Look at section ``Things to implement'' to see what isn't yet -implemented. Also I strongly suggest you to list all active swaps in -/etc/fstab. Firstly because you don't have to specify anything to resume and -secondly if you have more than one swap area you can't decide which one has the -'root' signature. +reboots. You must explicitly specify the swap partition to resume from with +``resume='' kernel option. If signature is found it loads and restores saved +state. If the option ``noresume'' is specified as a boot parameter, it skips +the resuming. Warning! Look at section ``Things to implement'' to see what +isn't yet implemented. Also I strongly suggest you to list all active swaps +in /etc/fstab. Firstly because you don't have to specify anything to resume +and secondly if you have more than one swap area you can't decide which one +has the 'root' signature. In the meantime while the system is suspended you should not touch any of the hardware! @@ -110,10 +110,10 @@ pleasure. Check out my patch at the same location for the sysvinit patch. WARNINGS! -- It does not like pcmcia cards. And this is logical: pcmcia cards need cardmgr to be - initialized. they are not initialized during singleuser boot, but "resumed" kernel does - expect them to be initialized. That leads to armagedon. You should eject any pcmcia cards - before suspending. +- It does not like pcmcia cards. And this is logical: pcmcia cards need + cardmgr to be initialized. they are not initialized during singleuser boot, + but "resumed" kernel does expect them to be initialized. That leads to + armagedon. You should eject any pcmcia cards before suspending. Things to implement - SMP support. I've done an SMP support but since I don't have access to a kind @@ -156,6 +156,20 @@ - do IDE cdroms need some kind of support? - IDE CD-RW -- how to deal with that? +Sleep states summary (thanx, Ducrot) +==================================== + +In a really perfect world: +echo 1 > /proc/acpi/sleep # for standby +echo 2 > /proc/acpi/sleep # for suspend to ram +echo 3 > /proc/acpi/sleep # for suspend to ram, but with more power conservative +echo 4 > /proc/acpi/sleep # for suspend to disk +echo 5 > /proc/acpi/sleep # for shutdown unfriendly the system + +and perhaps +echo 4b > /proc/acpi/sleep # for suspend to disk via s4bios + + FAQ: Q: well, suspending a server is IMHO a really stupid thing, diff -urN linux-2.5.66-bk7/Makefile linux-2.5.66-bk8/Makefile --- linux-2.5.66-bk7/Makefile Wed Apr 2 04:38:02 2003 +++ linux-2.5.66-bk8/Makefile Wed Apr 2 04:38:11 2003 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 SUBLEVEL = 66 -EXTRAVERSION = -bk7 +EXTRAVERSION = -bk8 # *DOCUMENTATION* # To see a list of typical targets execute "make help" diff -urN linux-2.5.66-bk7/arch/alpha/kernel/alpha_ksyms.c linux-2.5.66-bk8/arch/alpha/kernel/alpha_ksyms.c --- linux-2.5.66-bk7/arch/alpha/kernel/alpha_ksyms.c Mon Mar 24 13:59:58 2003 +++ linux-2.5.66-bk8/arch/alpha/kernel/alpha_ksyms.c Wed Apr 2 04:38:11 2003 @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff -urN linux-2.5.66-bk7/arch/alpha/kernel/smp.c linux-2.5.66-bk8/arch/alpha/kernel/smp.c --- linux-2.5.66-bk7/arch/alpha/kernel/smp.c Wed Apr 2 04:38:02 2003 +++ linux-2.5.66-bk8/arch/alpha/kernel/smp.c Wed Apr 2 04:38:11 2003 @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff -urN linux-2.5.66-bk7/arch/i386/kernel/acpi/boot.c linux-2.5.66-bk8/arch/i386/kernel/acpi/boot.c --- linux-2.5.66-bk7/arch/i386/kernel/acpi/boot.c Mon Mar 24 14:01:24 2003 +++ linux-2.5.66-bk8/arch/i386/kernel/acpi/boot.c Wed Apr 2 04:38:11 2003 @@ -28,6 +28,7 @@ #include #include #include +#include #include #if defined (CONFIG_X86_LOCAL_APIC) diff -urN linux-2.5.66-bk7/arch/i386/kernel/cpu/intel.c linux-2.5.66-bk8/arch/i386/kernel/cpu/intel.c --- linux-2.5.66-bk7/arch/i386/kernel/cpu/intel.c Mon Mar 24 14:00:12 2003 +++ linux-2.5.66-bk8/arch/i386/kernel/cpu/intel.c Wed Apr 2 04:38:11 2003 @@ -93,15 +93,17 @@ { { 0x06, LVL_1_INST, 8 }, { 0x08, LVL_1_INST, 16 }, - { 0x0A, LVL_1_DATA, 8 }, - { 0x0C, LVL_1_DATA, 16 }, + { 0x0a, LVL_1_DATA, 8 }, + { 0x0c, LVL_1_DATA, 16 }, { 0x22, LVL_3, 512 }, { 0x23, LVL_3, 1024 }, { 0x25, LVL_3, 2048 }, { 0x29, LVL_3, 4096 }, + { 0x2c, LVL_1_DATA, 32 }, + { 0x30, LVL_1_INST, 32 }, { 0x39, LVL_2, 128 }, { 0x3b, LVL_2, 128 }, - { 0x3C, LVL_2, 256 }, + { 0x3c, LVL_2, 256 }, { 0x41, LVL_2, 128 }, { 0x42, LVL_2, 256 }, { 0x43, LVL_2, 512 }, @@ -114,13 +116,15 @@ { 0x71, LVL_TRACE, 16 }, { 0x72, LVL_TRACE, 32 }, { 0x79, LVL_2, 128 }, - { 0x7A, LVL_2, 256 }, - { 0x7B, LVL_2, 512 }, - { 0x7C, LVL_2, 1024 }, + { 0x7a, LVL_2, 256 }, + { 0x7b, LVL_2, 512 }, + { 0x7c, LVL_2, 1024 }, { 0x82, LVL_2, 256 }, { 0x83, LVL_2, 512 }, { 0x84, LVL_2, 1024 }, { 0x85, LVL_2, 2048 }, + { 0x86, LVL_2, 512 }, + { 0x87, LVL_2, 1024 }, { 0x00, 0, 0} }; diff -urN linux-2.5.66-bk7/arch/i386/kernel/cpu/proc.c linux-2.5.66-bk8/arch/i386/kernel/cpu/proc.c --- linux-2.5.66-bk7/arch/i386/kernel/cpu/proc.c Mon Mar 24 14:01:24 2003 +++ linux-2.5.66-bk8/arch/i386/kernel/cpu/proc.c Wed Apr 2 04:38:11 2003 @@ -44,8 +44,8 @@ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* Intel-defined (#2) */ - "pni", NULL, NULL, "monitor", "ds_cpl", NULL, NULL, NULL, - "tm2", NULL, "cnxt_id", NULL, NULL, NULL, NULL, NULL, + "pni", NULL, NULL, "monitor", "ds_cpl", NULL, NULL, "tm2", + "est", NULL, "cid", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, diff -urN linux-2.5.66-bk7/arch/i386/kernel/vm86.c linux-2.5.66-bk8/arch/i386/kernel/vm86.c --- linux-2.5.66-bk7/arch/i386/kernel/vm86.c Wed Apr 2 04:38:02 2003 +++ linux-2.5.66-bk8/arch/i386/kernel/vm86.c Wed Apr 2 04:38:11 2003 @@ -113,10 +113,13 @@ printk("vm86: could not access userspace vm86_info\n"); do_exit(SIGSEGV); } - tss = init_tss + smp_processor_id(); + + tss = init_tss + get_cpu(); current->thread.esp0 = current->thread.saved_esp0; load_esp0(tss, current->thread.esp0); current->thread.saved_esp0 = 0; + put_cpu(); + loadsegment(fs, current->thread.saved_fs); loadsegment(gs, current->thread.saved_gs); ret = KVM86->regs32; diff -urN linux-2.5.66-bk7/arch/i386/mm/init.c linux-2.5.66-bk8/arch/i386/mm/init.c --- linux-2.5.66-bk7/arch/i386/mm/init.c Mon Mar 24 14:01:14 2003 +++ linux-2.5.66-bk8/arch/i386/mm/init.c Wed Apr 2 04:38:11 2003 @@ -44,6 +44,8 @@ struct mmu_gather mmu_gathers[NR_CPUS]; unsigned long highstart_pfn, highend_pfn; +static int do_test_wp_bit(void); + /* * Creates a middle page table and puts a pointer to it in the * given global directory entry. This only returns the gd entry @@ -377,15 +379,10 @@ /* * Test if the WP bit works in supervisor mode. It isn't supported on 386's - * and also on some strange 486's (NexGen etc.). All 586+'s are OK. The jumps - * before and after the test are here to work-around some nasty CPU bugs. - */ - -/* - * This function cannot be __init, since exceptions don't work in that - * section. + * and also on some strange 486's (NexGen etc.). All 586+'s are OK. This + * used to involve black magic jumps to work around some nasty CPU bugs, + * but fortunately the switch to using exceptions got rid of all that. */ -static int do_test_wp_bit(void); void __init test_wp_bit(void) { @@ -539,7 +536,10 @@ panic("pgtable_cache_init(): Cannot create pgd cache"); } -/* Put this after the callers, so that it cannot be inlined */ +/* + * This function cannot be __init, since exceptions don't work in that + * section. Put this after the callers, so that it cannot be inlined. + */ static int do_test_wp_bit(void) { char tmp_reg; diff -urN linux-2.5.66-bk7/arch/ia64/sn/kernel/sv.c linux-2.5.66-bk8/arch/ia64/sn/kernel/sv.c --- linux-2.5.66-bk7/arch/ia64/sn/kernel/sv.c Mon Mar 24 14:00:08 2003 +++ linux-2.5.66-bk8/arch/ia64/sn/kernel/sv.c Wed Apr 2 04:38:11 2003 @@ -18,7 +18,6 @@ #include #include -#include #include #include diff -urN linux-2.5.66-bk7/arch/m68k/kernel/m68k_ksyms.c linux-2.5.66-bk8/arch/m68k/kernel/m68k_ksyms.c --- linux-2.5.66-bk7/arch/m68k/kernel/m68k_ksyms.c Mon Mar 24 14:01:23 2003 +++ linux-2.5.66-bk8/arch/m68k/kernel/m68k_ksyms.c Wed Apr 2 04:38:11 2003 @@ -17,7 +17,6 @@ #include #include #include -#include asmlinkage long long __ashldi3 (long long, int); asmlinkage long long __ashrdi3 (long long, int); diff -urN linux-2.5.66-bk7/arch/m68knommu/kernel/m68k_ksyms.c linux-2.5.66-bk8/arch/m68knommu/kernel/m68k_ksyms.c --- linux-2.5.66-bk7/arch/m68knommu/kernel/m68k_ksyms.c Mon Mar 24 14:01:24 2003 +++ linux-2.5.66-bk8/arch/m68knommu/kernel/m68k_ksyms.c Wed Apr 2 04:38:11 2003 @@ -17,7 +17,6 @@ #include #include #include -#include #include extern void dump_thread(struct pt_regs *, struct user *); diff -urN linux-2.5.66-bk7/arch/mips/kernel/mips_ksyms.c linux-2.5.66-bk8/arch/mips/kernel/mips_ksyms.c --- linux-2.5.66-bk7/arch/mips/kernel/mips_ksyms.c Mon Mar 24 14:00:09 2003 +++ linux-2.5.66-bk8/arch/mips/kernel/mips_ksyms.c Wed Apr 2 04:38:11 2003 @@ -25,7 +25,6 @@ #include #include #include -#include #include #ifdef CONFIG_BLK_DEV_FD #include diff -urN linux-2.5.66-bk7/arch/mips/kernel/smp.c linux-2.5.66-bk8/arch/mips/kernel/smp.c --- linux-2.5.66-bk7/arch/mips/kernel/smp.c Mon Mar 24 14:00:08 2003 +++ linux-2.5.66-bk8/arch/mips/kernel/smp.c Wed Apr 2 04:38:11 2003 @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff -urN linux-2.5.66-bk7/arch/mips/mm/fault.c linux-2.5.66-bk8/arch/mips/mm/fault.c --- linux-2.5.66-bk7/arch/mips/mm/fault.c Mon Mar 24 14:00:11 2003 +++ linux-2.5.66-bk8/arch/mips/mm/fault.c Wed Apr 2 04:38:11 2003 @@ -22,7 +22,6 @@ #include #include #include -#include #include #include diff -urN linux-2.5.66-bk7/arch/mips64/kernel/mips64_ksyms.c linux-2.5.66-bk8/arch/mips64/kernel/mips64_ksyms.c --- linux-2.5.66-bk7/arch/mips64/kernel/mips64_ksyms.c Mon Mar 24 14:00:19 2003 +++ linux-2.5.66-bk8/arch/mips64/kernel/mips64_ksyms.c Wed Apr 2 04:38:11 2003 @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff -urN linux-2.5.66-bk7/arch/mips64/kernel/smp.c linux-2.5.66-bk8/arch/mips64/kernel/smp.c --- linux-2.5.66-bk7/arch/mips64/kernel/smp.c Mon Mar 24 14:01:12 2003 +++ linux-2.5.66-bk8/arch/mips64/kernel/smp.c Wed Apr 2 04:38:11 2003 @@ -6,12 +6,12 @@ #include #include #include +#include #include #include #include #include -#include #include #include diff -urN linux-2.5.66-bk7/arch/mips64/mm/fault.c linux-2.5.66-bk8/arch/mips64/mm/fault.c --- linux-2.5.66-bk7/arch/mips64/mm/fault.c Mon Mar 24 14:00:48 2003 +++ linux-2.5.66-bk8/arch/mips64/mm/fault.c Wed Apr 2 04:38:11 2003 @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff -urN linux-2.5.66-bk7/arch/ppc/kernel/smp.c linux-2.5.66-bk8/arch/ppc/kernel/smp.c --- linux-2.5.66-bk7/arch/ppc/kernel/smp.c Wed Apr 2 04:38:02 2003 +++ linux-2.5.66-bk8/arch/ppc/kernel/smp.c Wed Apr 2 04:38:12 2003 @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff -urN linux-2.5.66-bk7/arch/ppc/platforms/chrp_smp.c linux-2.5.66-bk8/arch/ppc/platforms/chrp_smp.c --- linux-2.5.66-bk7/arch/ppc/platforms/chrp_smp.c Mon Mar 24 14:00:18 2003 +++ linux-2.5.66-bk8/arch/ppc/platforms/chrp_smp.c Wed Apr 2 04:38:12 2003 @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff -urN linux-2.5.66-bk7/arch/ppc/platforms/pmac_smp.c linux-2.5.66-bk8/arch/ppc/platforms/pmac_smp.c --- linux-2.5.66-bk7/arch/ppc/platforms/pmac_smp.c Wed Apr 2 04:38:02 2003 +++ linux-2.5.66-bk8/arch/ppc/platforms/pmac_smp.c Wed Apr 2 04:38:12 2003 @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff -urN linux-2.5.66-bk7/arch/ppc64/kernel/smp.c linux-2.5.66-bk8/arch/ppc64/kernel/smp.c --- linux-2.5.66-bk7/arch/ppc64/kernel/smp.c Mon Mar 24 14:01:13 2003 +++ linux-2.5.66-bk8/arch/ppc64/kernel/smp.c Wed Apr 2 04:38:12 2003 @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include diff -urN linux-2.5.66-bk7/arch/s390/kernel/s390_ksyms.c linux-2.5.66-bk8/arch/s390/kernel/s390_ksyms.c --- linux-2.5.66-bk7/arch/s390/kernel/s390_ksyms.c Mon Mar 24 14:00:50 2003 +++ linux-2.5.66-bk8/arch/s390/kernel/s390_ksyms.c Wed Apr 2 04:38:12 2003 @@ -6,10 +6,10 @@ #include #include #include +#include #include #include #include -#include #if CONFIG_IP_MULTICAST #include #endif diff -urN linux-2.5.66-bk7/arch/s390x/kernel/s390_ksyms.c linux-2.5.66-bk8/arch/s390x/kernel/s390_ksyms.c --- linux-2.5.66-bk7/arch/s390x/kernel/s390_ksyms.c Mon Mar 24 14:01:18 2003 +++ linux-2.5.66-bk8/arch/s390x/kernel/s390_ksyms.c Wed Apr 2 04:38:12 2003 @@ -8,11 +8,11 @@ #include #include #include +#include #include #include #include #include -#include #if CONFIG_IP_MULTICAST #include #endif diff -urN linux-2.5.66-bk7/arch/sparc/kernel/irq.c linux-2.5.66-bk8/arch/sparc/kernel/irq.c --- linux-2.5.66-bk7/arch/sparc/kernel/irq.c Mon Mar 24 13:59:55 2003 +++ linux-2.5.66-bk8/arch/sparc/kernel/irq.c Wed Apr 2 04:38:12 2003 @@ -45,7 +45,6 @@ #include #include #include -#include #include #include diff -urN linux-2.5.66-bk7/arch/sparc/kernel/setup.c linux-2.5.66-bk8/arch/sparc/kernel/setup.c --- linux-2.5.66-bk7/arch/sparc/kernel/setup.c Mon Mar 24 13:59:54 2003 +++ linux-2.5.66-bk8/arch/sparc/kernel/setup.c Wed Apr 2 04:38:12 2003 @@ -43,7 +43,6 @@ #include #include #include -#include #include #include diff -urN linux-2.5.66-bk7/arch/sparc/kernel/smp.c linux-2.5.66-bk8/arch/sparc/kernel/smp.c --- linux-2.5.66-bk7/arch/sparc/kernel/smp.c Mon Mar 24 14:00:13 2003 +++ linux-2.5.66-bk8/arch/sparc/kernel/smp.c Wed Apr 2 04:38:12 2003 @@ -30,7 +30,6 @@ #include #include #include -#include #define __KERNEL_SYSCALLS__ #include diff -urN linux-2.5.66-bk7/arch/sparc/kernel/sparc_ksyms.c linux-2.5.66-bk8/arch/sparc/kernel/sparc_ksyms.c --- linux-2.5.66-bk7/arch/sparc/kernel/sparc_ksyms.c Mon Mar 24 14:00:00 2003 +++ linux-2.5.66-bk8/arch/sparc/kernel/sparc_ksyms.c Wed Apr 2 04:38:12 2003 @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include diff -urN linux-2.5.66-bk7/arch/sparc/kernel/sun4d_smp.c linux-2.5.66-bk8/arch/sparc/kernel/sun4d_smp.c --- linux-2.5.66-bk7/arch/sparc/kernel/sun4d_smp.c Mon Mar 24 14:00:01 2003 +++ linux-2.5.66-bk8/arch/sparc/kernel/sun4d_smp.c Wed Apr 2 04:38:12 2003 @@ -29,7 +29,6 @@ #include #include #include -#include #include #include diff -urN linux-2.5.66-bk7/arch/sparc/kernel/sun4m_smp.c linux-2.5.66-bk8/arch/sparc/kernel/sun4m_smp.c --- linux-2.5.66-bk7/arch/sparc/kernel/sun4m_smp.c Mon Mar 24 14:01:23 2003 +++ linux-2.5.66-bk8/arch/sparc/kernel/sun4m_smp.c Wed Apr 2 04:38:12 2003 @@ -26,7 +26,6 @@ #include #include #include -#include #define __KERNEL_SYSCALLS__ #include diff -urN linux-2.5.66-bk7/arch/sparc64/kernel/irq.c linux-2.5.66-bk8/arch/sparc64/kernel/irq.c --- linux-2.5.66-bk7/arch/sparc64/kernel/irq.c Wed Apr 2 04:38:02 2003 +++ linux-2.5.66-bk8/arch/sparc64/kernel/irq.c Wed Apr 2 04:38:12 2003 @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff -urN linux-2.5.66-bk7/arch/sparc64/kernel/smp.c linux-2.5.66-bk8/arch/sparc64/kernel/smp.c --- linux-2.5.66-bk7/arch/sparc64/kernel/smp.c Mon Mar 24 13:59:52 2003 +++ linux-2.5.66-bk8/arch/sparc64/kernel/smp.c Wed Apr 2 04:38:12 2003 @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff -urN linux-2.5.66-bk7/arch/sparc64/kernel/sparc64_ksyms.c linux-2.5.66-bk8/arch/sparc64/kernel/sparc64_ksyms.c --- linux-2.5.66-bk7/arch/sparc64/kernel/sparc64_ksyms.c Wed Apr 2 04:38:02 2003 +++ linux-2.5.66-bk8/arch/sparc64/kernel/sparc64_ksyms.c Wed Apr 2 04:38:12 2003 @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff -urN linux-2.5.66-bk7/arch/um/drivers/stdio_console.c linux-2.5.66-bk8/arch/um/drivers/stdio_console.c --- linux-2.5.66-bk7/arch/um/drivers/stdio_console.c Mon Mar 24 14:00:10 2003 +++ linux-2.5.66-bk8/arch/um/drivers/stdio_console.c Wed Apr 2 04:38:13 2003 @@ -18,7 +18,6 @@ #include "linux/interrupt.h" #include "linux/slab.h" #include "asm/current.h" -#include "asm/softirq.h" #include "asm/hardirq.h" #include "asm/irq.h" #include "stdio_console.h" diff -urN linux-2.5.66-bk7/arch/um/kernel/smp.c linux-2.5.66-bk8/arch/um/kernel/smp.c --- linux-2.5.66-bk7/arch/um/kernel/smp.c Mon Mar 24 14:00:10 2003 +++ linux-2.5.66-bk8/arch/um/kernel/smp.c Wed Apr 2 04:38:13 2003 @@ -17,7 +17,6 @@ #include "asm/smp.h" #include "asm/processor.h" #include "asm/spinlock.h" -#include "asm/softirq.h" #include "asm/hardirq.h" #include "user_util.h" #include "kern_util.h" diff -urN linux-2.5.66-bk7/arch/v850/kernel/v850_ksyms.c linux-2.5.66-bk8/arch/v850/kernel/v850_ksyms.c --- linux-2.5.66-bk7/arch/v850/kernel/v850_ksyms.c Mon Mar 24 14:00:48 2003 +++ linux-2.5.66-bk8/arch/v850/kernel/v850_ksyms.c Wed Apr 2 04:38:13 2003 @@ -16,7 +16,6 @@ #include #include #include -#include #include diff -urN linux-2.5.66-bk7/arch/x86_64/ia32/sys_ia32.c linux-2.5.66-bk8/arch/x86_64/ia32/sys_ia32.c --- linux-2.5.66-bk7/arch/x86_64/ia32/sys_ia32.c Wed Apr 2 04:38:02 2003 +++ linux-2.5.66-bk8/arch/x86_64/ia32/sys_ia32.c Wed Apr 2 04:38:13 2003 @@ -75,7 +75,6 @@ #define A(__x) ((unsigned long)(__x)) #define AA(__x) ((unsigned long)(__x)) -#define u32_to_ptr(x) ((void *)(u64)(x)) #define ROUND_UP(x,a) ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1))) #define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) @@ -2091,7 +2090,7 @@ } asmlinkage long sys32_io_submit(aio_context_t ctx_id, int nr, - u32 *iocbpp) + compat_uptr_t *iocbpp) { struct kioctx *ctx; long ret = 0; @@ -2110,14 +2109,14 @@ } for (i=0; i #include +#include #include #include -#include #include extern enum km_type crypto_km_types[]; diff -urN linux-2.5.66-bk7/drivers/acpi/acpi_ksyms.c linux-2.5.66-bk8/drivers/acpi/acpi_ksyms.c --- linux-2.5.66-bk7/drivers/acpi/acpi_ksyms.c Mon Mar 24 14:00:15 2003 +++ linux-2.5.66-bk8/drivers/acpi/acpi_ksyms.c Wed Apr 2 04:38:13 2003 @@ -74,6 +74,8 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler); EXPORT_SYMBOL(acpi_acquire_global_lock); EXPORT_SYMBOL(acpi_release_global_lock); +EXPORT_SYMBOL(acpi_install_gpe_block); +EXPORT_SYMBOL(acpi_remove_gpe_block); EXPORT_SYMBOL(acpi_get_current_resources); EXPORT_SYMBOL(acpi_get_possible_resources); EXPORT_SYMBOL(acpi_walk_resources); diff -urN linux-2.5.66-bk7/drivers/acpi/battery.c linux-2.5.66-bk8/drivers/acpi/battery.c --- linux-2.5.66-bk7/drivers/acpi/battery.c Mon Mar 24 14:01:14 2003 +++ linux-2.5.66-bk8/drivers/acpi/battery.c Wed Apr 2 04:38:13 2003 @@ -28,6 +28,8 @@ #include #include #include +#include + #include #include diff -urN linux-2.5.66-bk7/drivers/acpi/ec.c linux-2.5.66-bk8/drivers/acpi/ec.c --- linux-2.5.66-bk7/drivers/acpi/ec.c Mon Mar 24 14:00:44 2003 +++ linux-2.5.66-bk8/drivers/acpi/ec.c Wed Apr 2 04:38:13 2003 @@ -378,7 +378,7 @@ acpi_evaluate_object(ec->handle, object_name, NULL, NULL); end: - acpi_enable_event(ec->gpe_bit, ACPI_EVENT_GPE, 0); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); } static void @@ -391,7 +391,7 @@ if (!ec) return; - acpi_disable_event(ec->gpe_bit, ACPI_EVENT_GPE, 0); + acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR); status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, acpi_ec_gpe_query, ec); @@ -589,12 +589,13 @@ acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); - acpi_remove_gpe_handler(ec_ecdt->gpe_bit, &acpi_ec_gpe_handler); + acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, &acpi_ec_gpe_handler); kfree(ec_ecdt); } /* Get GPE bit assignment (EC events). */ + /* TODO: Add support for _GPE returning a package */ status = acpi_evaluate_integer(ec->handle, "_GPE", NULL, &ec->gpe_bit); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, @@ -714,7 +715,7 @@ /* * Install GPE handler */ - status = acpi_install_gpe_handler(ec->gpe_bit, + status = acpi_install_gpe_handler(NULL, ec->gpe_bit, ACPI_EVENT_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); if (ACPI_FAILURE(status)) { return_VALUE(-ENODEV); @@ -724,7 +725,7 @@ ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, &acpi_ec_space_setup, ec); if (ACPI_FAILURE(status)) { - acpi_remove_gpe_handler(ec->gpe_bit, &acpi_ec_gpe_handler); + acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler); return_VALUE(-ENODEV); } @@ -752,7 +753,7 @@ if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); - status = acpi_remove_gpe_handler(ec->gpe_bit, &acpi_ec_gpe_handler); + status = acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); @@ -798,7 +799,7 @@ /* * Install GPE handler */ - status = acpi_install_gpe_handler(ec_ecdt->gpe_bit, + status = acpi_install_gpe_handler(NULL, ec_ecdt->gpe_bit, ACPI_EVENT_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec_ecdt); if (ACPI_FAILURE(status)) { @@ -809,7 +810,7 @@ ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, &acpi_ec_space_setup, ec_ecdt); if (ACPI_FAILURE(status)) { - acpi_remove_gpe_handler(ec_ecdt->gpe_bit, + acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, &acpi_ec_gpe_handler); goto error; } diff -urN linux-2.5.66-bk7/drivers/acpi/events/evevent.c linux-2.5.66-bk8/drivers/acpi/events/evevent.c --- linux-2.5.66-bk7/drivers/acpi/events/evevent.c Mon Mar 24 14:01:22 2003 +++ linux-2.5.66-bk8/drivers/acpi/events/evevent.c Wed Apr 2 04:38:13 2003 @@ -78,9 +78,9 @@ } /* - * Initialize the Fixed and General Purpose acpi_events prior. This is - * done prior to enabling SCIs to prevent interrupts from occurring - * before handers are installed. + * Initialize the Fixed and General Purpose Events. This is + * done prior to enabling SCIs to prevent interrupts from + * occurring before handers are installed. */ status = acpi_ev_fixed_event_initialize (); if (ACPI_FAILURE (status)) { @@ -225,7 +225,7 @@ (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &fixed_enable); ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Fixed acpi_event Block: Enable %08X Status %08X\n", + "Fixed Event Block: Enable %08X Status %08X\n", fixed_enable, fixed_status)); /* @@ -282,7 +282,7 @@ 0, ACPI_MTX_DO_NOT_LOCK); ACPI_REPORT_ERROR ( - ("ev_gpe_dispatch: No installed handler for fixed event [%08X]\n", + ("No installed handler for fixed event [%08X]\n", event)); return (ACPI_INTERRUPT_NOT_HANDLED); diff -urN linux-2.5.66-bk7/drivers/acpi/events/evgpe.c linux-2.5.66-bk8/drivers/acpi/events/evgpe.c --- linux-2.5.66-bk7/drivers/acpi/events/evgpe.c Mon Mar 24 14:00:49 2003 +++ linux-2.5.66-bk8/drivers/acpi/events/evgpe.c Wed Apr 2 04:38:13 2003 @@ -53,44 +53,63 @@ * * FUNCTION: acpi_ev_get_gpe_event_info * - * PARAMETERS: gpe_number - Raw GPE number + * PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1 + * gpe_number - Raw GPE number * - * RETURN: None. + * RETURN: A GPE event_info struct. NULL if not a valid GPE * - * DESCRIPTION: Returns the event_info struct - * associated with this GPE. + * DESCRIPTION: Returns the event_info struct associated with this GPE. + * Validates the gpe_block and the gpe_number * - * TBD: this function will go away when full support of GPE block devices - * is implemented! + * Should be called only when the GPE lists are semaphore locked + * and not subject to change. * ******************************************************************************/ struct acpi_gpe_event_info * acpi_ev_get_gpe_event_info ( + acpi_handle gpe_device, u32 gpe_number) { + union acpi_operand_object *obj_desc; struct acpi_gpe_block_info *gpe_block; + acpi_native_uint i; - /* Examine GPE Block 0 */ + ACPI_FUNCTION_NAME ("ev_get_gpe_event_info"); - gpe_block = acpi_gbl_gpe_block_list_head; - if (!gpe_block) { - return (NULL); - } - if ((gpe_number >= gpe_block->block_base_number) && - (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { - return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]); - } + /* A NULL gpe_block means use the FADT-defined GPE block(s) */ - /* Examine GPE Block 1 */ + if (!gpe_device) { + /* Examine GPE Block 0 and 1 (These blocks are permanent) */ + + for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { + gpe_block = acpi_gbl_gpe_fadt_blocks[i]; + if (gpe_block) { + if ((gpe_number >= gpe_block->block_base_number) && + (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { + return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]); + } + } + } + + /* The gpe_number was not in the range of either FADT GPE block */ - gpe_block = gpe_block->next; - if (!gpe_block) { return (NULL); } + /* + * A Non-null gpe_device means this is a GPE Block Device. + */ + obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) gpe_device); + if (!obj_desc || + !obj_desc->device.gpe_block) { + return (NULL); + } + + gpe_block = obj_desc->device.gpe_block; + if ((gpe_number >= gpe_block->block_base_number) && (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]); @@ -99,11 +118,13 @@ return (NULL); } + /******************************************************************************* * * FUNCTION: acpi_ev_gpe_detect * - * PARAMETERS: None + * PARAMETERS: gpe_xrupt_list - Interrupt block for this interrupt. + * Can have multiple GPE blocks attached. * * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * @@ -113,17 +134,19 @@ ******************************************************************************/ u32 -acpi_ev_gpe_detect (void) +acpi_ev_gpe_detect ( + struct acpi_gpe_xrupt_info *gpe_xrupt_list) { u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; - u32 i; - u32 j; u8 enabled_status_byte; u8 bit_mask; struct acpi_gpe_register_info *gpe_register_info; u32 in_value; acpi_status status; struct acpi_gpe_block_info *gpe_block; + u32 gpe_number; + u32 i; + u32 j; ACPI_FUNCTION_NAME ("ev_gpe_detect"); @@ -131,7 +154,8 @@ /* Examine all GPE blocks attached to this interrupt level */ - gpe_block = acpi_gbl_gpe_block_list_head; + acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_ISR); + gpe_block = gpe_xrupt_list->gpe_block_list_head; while (gpe_block) { /* * Read all of the 8-bit GPE status and enable registers @@ -143,18 +167,22 @@ gpe_register_info = &gpe_block->register_info[i]; + /* Read the Status Register */ + status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &in_value, &gpe_register_info->status_address, 0); gpe_register_info->status = (u8) in_value; if (ACPI_FAILURE (status)) { - return (ACPI_INTERRUPT_NOT_HANDLED); + goto unlock_and_exit; } + /* Read the Enable Register */ + status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &in_value, &gpe_register_info->enable_address, 0); gpe_register_info->enable = (u8) in_value; if (ACPI_FAILURE (status)) { - return (ACPI_INTERRUPT_NOT_HANDLED); + goto unlock_and_exit; } ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, @@ -184,8 +212,11 @@ * Found an active GPE. Dispatch the event to a handler * or method. */ + gpe_number = (i * ACPI_GPE_REGISTER_WIDTH) + j; + int_status |= acpi_ev_gpe_dispatch ( - &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) +j]); + &gpe_block->event_info[gpe_number], + gpe_number + gpe_block->register_info[gpe_number].base_gpe_number); } } } @@ -193,6 +224,9 @@ gpe_block = gpe_block->next; } +unlock_and_exit: + + acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_ISR); return (int_status); } @@ -201,7 +235,7 @@ * * FUNCTION: acpi_ev_asynch_execute_gpe_method * - * PARAMETERS: gpe_event_info - Info for this GPE + * PARAMETERS: Context (gpe_event_info) - Info for this GPE * * RETURN: None * @@ -209,7 +243,7 @@ * function is called from an invocation of acpi_os_queue_for_execution * (and therefore does NOT execute at interrupt level) so that * the control method itself is not executed in the context of - * the SCI interrupt handler. + * an interrupt handler. * ******************************************************************************/ @@ -220,44 +254,54 @@ struct acpi_gpe_event_info *gpe_event_info = (void *) context; u32 gpe_number = 0; acpi_status status; + struct acpi_gpe_event_info local_gpe_event_info; ACPI_FUNCTION_TRACE ("ev_asynch_execute_gpe_method"); - /* - * Take a snapshot of the GPE info for this level - we copy the - * info to prevent a race condition with remove_handler. - */ status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (status)) { return_VOID; } + /* Must revalidate the gpe_number/gpe_block */ + + if (!acpi_ev_valid_gpe_event (gpe_event_info)) { + status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); + return_VOID; + } + + /* + * Take a snapshot of the GPE info for this level - we copy the + * info to prevent a race condition with remove_handler/remove_block. + */ + ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info, sizeof (struct acpi_gpe_event_info)); + status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (status)) { return_VOID; } - if (gpe_event_info->method_node) { + if (local_gpe_event_info.method_node) { /* * Invoke the GPE Method (_Lxx, _Exx): * (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.) */ - status = acpi_ns_evaluate_by_handle (gpe_event_info->method_node, NULL, NULL); + status = acpi_ns_evaluate_by_handle (local_gpe_event_info.method_node, NULL, NULL); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2.2X]\n", + ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2X]\n", acpi_format_exception (status), - gpe_event_info->method_node->name.ascii, gpe_number)); + local_gpe_event_info.method_node->name.ascii, gpe_number)); } } - if (gpe_event_info->type & ACPI_EVENT_LEVEL_TRIGGERED) { + if (local_gpe_event_info.flags & ACPI_EVENT_LEVEL_TRIGGERED) { /* * GPE is level-triggered, we clear the GPE status bit after handling * the event. */ - status = acpi_hw_clear_gpe (gpe_event_info); + status = acpi_hw_clear_gpe (&local_gpe_event_info); if (ACPI_FAILURE (status)) { return_VOID; } @@ -265,7 +309,7 @@ /* Enable this GPE */ - (void) acpi_hw_enable_gpe (gpe_event_info); + (void) acpi_hw_enable_gpe (&local_gpe_event_info); return_VOID; } @@ -274,21 +318,23 @@ * * FUNCTION: acpi_ev_gpe_dispatch * - * PARAMETERS: gpe_event_info - info for this GPE + * PARAMETERS: gpe_event_info - info for this GPE + * gpe_number - Number relative to the parent GPE block * * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * * DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC) - * or method (e.g. _Lxx/_Exx) handler. This function executes - * at interrupt level. + * or method (e.g. _Lxx/_Exx) handler. + * + * This function executes at interrupt level. * ******************************************************************************/ u32 acpi_ev_gpe_dispatch ( - struct acpi_gpe_event_info *gpe_event_info) + struct acpi_gpe_event_info *gpe_event_info, + u32 gpe_number) { - u32 gpe_number = 0; /* TBD: remove */ acpi_status status; @@ -299,10 +345,10 @@ * If edge-triggered, clear the GPE status bit now. Note that * level-triggered events are cleared after the GPE is serviced. */ - if (gpe_event_info->type & ACPI_EVENT_EDGE_TRIGGERED) { + if (gpe_event_info->flags & ACPI_EVENT_EDGE_TRIGGERED) { status = acpi_hw_clear_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", + ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: Unable to clear GPE[%2X]\n", gpe_number)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } @@ -327,19 +373,18 @@ */ status = acpi_hw_disable_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: Unable to disable GPE[%2.2X]\n", + ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: Unable to disable GPE[%2X]\n", gpe_number)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } - /* - * Execute the method associated with the GPE. - */ + /* Execute the method associated with the GPE. */ + if (ACPI_FAILURE (acpi_os_queue_for_execution (OSD_PRIORITY_GPE, acpi_ev_asynch_execute_gpe_method, gpe_event_info))) { ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%2.2X], event is disabled\n", + "acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%2X], event is disabled\n", gpe_number)); } } @@ -347,7 +392,7 @@ /* No handler or method to run! */ ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: No handler or method for GPE[%2.2X], disabling event\n", + "acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number)); /* @@ -356,19 +401,18 @@ */ status = acpi_hw_disable_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: Unable to disable GPE[%2.2X]\n", + ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: Unable to disable GPE[%2X]\n", gpe_number)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } } - /* - * It is now safe to clear level-triggered evnets. - */ - if (gpe_event_info->type & ACPI_EVENT_LEVEL_TRIGGERED) { + /* It is now safe to clear level-triggered events. */ + + if (gpe_event_info->flags & ACPI_EVENT_LEVEL_TRIGGERED) { status = acpi_hw_clear_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", + ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: Unable to clear GPE[%2X]\n", gpe_number)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } diff -urN linux-2.5.66-bk7/drivers/acpi/events/evgpeblk.c linux-2.5.66-bk8/drivers/acpi/events/evgpeblk.c --- linux-2.5.66-bk7/drivers/acpi/events/evgpeblk.c Mon Mar 24 14:00:41 2003 +++ linux-2.5.66-bk8/drivers/acpi/events/evgpeblk.c Wed Apr 2 04:38:13 2003 @@ -46,7 +46,107 @@ #include #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evgpe") + ACPI_MODULE_NAME ("evgpeblk") + + +/******************************************************************************* + * + * FUNCTION: acpi_ev_valid_gpe_event + * + * PARAMETERS: gpe_event_info - Info for this GPE + * + * RETURN: TRUE if the gpe_event is valid + * + * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL. + * Should be called only when the GPE lists are semaphore locked + * and not subject to change. + * + ******************************************************************************/ + +u8 +acpi_ev_valid_gpe_event ( + struct acpi_gpe_event_info *gpe_event_info) +{ + struct acpi_gpe_xrupt_info *gpe_xrupt_block; + struct acpi_gpe_block_info *gpe_block; + + + ACPI_FUNCTION_NAME ("ev_valid_gpe_event"); + + + /* No need for spin lock since we are not changing any list elements */ + + gpe_xrupt_block = acpi_gbl_gpe_xrupt_list_head; + while (gpe_xrupt_block) { + gpe_block = gpe_xrupt_block->gpe_block_list_head; + while (gpe_block) { + if ((&gpe_block->event_info[0] <= gpe_event_info) && + (&gpe_block->event_info[gpe_block->register_count * 8] > gpe_event_info)) { + return (TRUE); + } + + gpe_block = gpe_block->next; + } + + gpe_xrupt_block = gpe_xrupt_block->next; + } + + return (FALSE); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ev_walk_gpe_list + * + * PARAMETERS: gpe_walk_callback - Routine called for each GPE block + * + * RETURN: Status + * + * DESCRIPTION: Walk the GPE lists. + * FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED + * + ******************************************************************************/ + +acpi_status +acpi_ev_walk_gpe_list ( + ACPI_GPE_CALLBACK gpe_walk_callback) +{ + struct acpi_gpe_block_info *gpe_block; + struct acpi_gpe_xrupt_info *gpe_xrupt_info; + acpi_status status = AE_OK; + + + ACPI_FUNCTION_TRACE ("ev_walk_gpe_list"); + + + acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_ISR); + + /* Walk the interrupt level descriptor list */ + + gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; + while (gpe_xrupt_info) { + /* Walk all Gpe Blocks attached to this interrupt level */ + + gpe_block = gpe_xrupt_info->gpe_block_list_head; + while (gpe_block) { + /* One callback per GPE block */ + + status = gpe_walk_callback (gpe_xrupt_info, gpe_block); + if (ACPI_FAILURE (status)) { + goto unlock_and_exit; + } + + gpe_block = gpe_block->next; + } + + gpe_xrupt_info = gpe_xrupt_info->next; + } + +unlock_and_exit: + acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_ISR); + return_ACPI_STATUS (status); +} /******************************************************************************* @@ -131,11 +231,12 @@ /* Ensure that we have a valid GPE number for this GPE block */ if ((gpe_number < gpe_block->block_base_number) || - (gpe_number >= (gpe_block->register_count * 8))) { - /* Not valid, all we can do here is ignore it */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "GPE number associated with method %s is not valid\n", name)); + (gpe_number >= (gpe_block->block_base_number + (gpe_block->register_count * 8)))) { + /* + * Not valid for this GPE block, just ignore it + * However, it may be valid for a different GPE block, since GPE0 and GPE1 + * methods both appear under \_GPE. + */ return (AE_OK); } @@ -145,7 +246,7 @@ */ gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; - gpe_event_info->type = type; + gpe_event_info->flags = type; gpe_event_info->method_node = (struct acpi_namespace_node *) obj_handle; /* @@ -156,7 +257,8 @@ return (status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %2.2X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Registered GPE method %s as GPE number 0x%.2X\n", name, gpe_number)); return (AE_OK); } @@ -164,9 +266,139 @@ /******************************************************************************* * + * FUNCTION: acpi_ev_get_gpe_xrupt_block + * + * PARAMETERS: interrupt_level - Interrupt for a GPE block + * + * RETURN: A GPE interrupt block + * + * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt + * block per unique interrupt level used for GPEs. + * Should be called only when the GPE lists are semaphore locked + * and not subject to change. + * + ******************************************************************************/ + +struct acpi_gpe_xrupt_info * +acpi_ev_get_gpe_xrupt_block ( + u32 interrupt_level) +{ + struct acpi_gpe_xrupt_info *next_gpe_xrupt; + struct acpi_gpe_xrupt_info *gpe_xrupt; + acpi_status status; + + + /* No need for spin lock since we are not changing any list elements here */ + + next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; + while (next_gpe_xrupt) { + if (next_gpe_xrupt->interrupt_level == interrupt_level) { + return (next_gpe_xrupt); + } + + next_gpe_xrupt = next_gpe_xrupt->next; + } + + /* Not found, must allocate a new xrupt descriptor */ + + gpe_xrupt = ACPI_MEM_CALLOCATE (sizeof (struct acpi_gpe_xrupt_info)); + if (!gpe_xrupt) { + return (NULL); + } + + gpe_xrupt->interrupt_level = interrupt_level; + + /* Install new interrupt descriptor with spin lock */ + + acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + if (acpi_gbl_gpe_xrupt_list_head) { + next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; + while (next_gpe_xrupt->next) { + next_gpe_xrupt = next_gpe_xrupt->next; + } + + next_gpe_xrupt->next = gpe_xrupt; + gpe_xrupt->previous = next_gpe_xrupt; + } + else { + acpi_gbl_gpe_xrupt_list_head = gpe_xrupt; + } + acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + + /* Install new interrupt handler if not SCI_INT */ + + if (interrupt_level != acpi_gbl_FADT->sci_int) { + status = acpi_os_install_interrupt_handler (interrupt_level, + acpi_ev_gpe_xrupt_handler, gpe_xrupt); + } + + return (gpe_xrupt); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ev_delete_gpe_xrupt + * + * PARAMETERS: gpe_xrupt - A GPE interrupt info block + * + * RETURN: Status + * + * DESCRIPTION: Remove and free a gpe_xrupt block. Remove an associated + * interrupt handler if not the SCI interrupt. + * + ******************************************************************************/ + +acpi_status +acpi_ev_delete_gpe_xrupt ( + struct acpi_gpe_xrupt_info *gpe_xrupt) +{ + acpi_status status; + + + ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt"); + + + /* We never want to remove the SCI interrupt handler */ + + if (gpe_xrupt->interrupt_level == acpi_gbl_FADT->sci_int) { + gpe_xrupt->gpe_block_list_head = NULL; + return_ACPI_STATUS (AE_OK); + } + + /* Disable this interrupt */ + + status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_level, + acpi_ev_gpe_xrupt_handler); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + + /* Unlink the interrupt block with lock */ + + acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + if (gpe_xrupt->previous) { + gpe_xrupt->previous->next = gpe_xrupt->next; + } + + if (gpe_xrupt->next) { + gpe_xrupt->next->previous = gpe_xrupt->previous; + } + acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + + /* Free the block */ + + ACPI_MEM_FREE (gpe_xrupt); + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: acpi_ev_install_gpe_block * - * PARAMETERS: gpe_block - New GPE block + * PARAMETERS: gpe_block - New GPE block + * interrupt_level - Level to be associated with this GPE block * * RETURN: Status * @@ -176,21 +408,33 @@ acpi_status acpi_ev_install_gpe_block ( - struct acpi_gpe_block_info *gpe_block) + struct acpi_gpe_block_info *gpe_block, + u32 interrupt_level) { struct acpi_gpe_block_info *next_gpe_block; + struct acpi_gpe_xrupt_info *gpe_xrupt_block; acpi_status status; + ACPI_FUNCTION_TRACE ("ev_install_gpe_block"); + + status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (status)) { - return (status); + return_ACPI_STATUS (status); } - /* Install the new block at the end of the global list */ + gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_level); + if (!gpe_xrupt_block) { + status = AE_NO_MEMORY; + goto unlock_and_exit; + } - if (acpi_gbl_gpe_block_list_head) { - next_gpe_block = acpi_gbl_gpe_block_list_head; + /* Install the new block at the end of the list for this interrupt with lock */ + + acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + if (gpe_xrupt_block->gpe_block_list_head) { + next_gpe_block = gpe_xrupt_block->gpe_block_list_head; while (next_gpe_block->next) { next_gpe_block = next_gpe_block->next; } @@ -199,11 +443,83 @@ gpe_block->previous = next_gpe_block; } else { - acpi_gbl_gpe_block_list_head = gpe_block; + gpe_xrupt_block->gpe_block_list_head = gpe_block; } + gpe_block->xrupt_block = gpe_xrupt_block; + acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + +unlock_and_exit: status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); - return (status); + return_ACPI_STATUS (status); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ev_delete_gpe_block + * + * PARAMETERS: gpe_block - Existing GPE block + * + * RETURN: Status + * + * DESCRIPTION: Install new GPE block with mutex support + * + ******************************************************************************/ + +acpi_status +acpi_ev_delete_gpe_block ( + struct acpi_gpe_block_info *gpe_block) +{ + acpi_status status; + + + ACPI_FUNCTION_TRACE ("ev_install_gpe_block"); + + + status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + + /* Disable all GPEs in this block */ + + status = acpi_hw_disable_gpe_block (gpe_block->xrupt_block, gpe_block); + + if (!gpe_block->previous && !gpe_block->next) { + /* This is the last gpe_block on this interrupt */ + + status = acpi_ev_delete_gpe_xrupt (gpe_block->xrupt_block); + if (ACPI_FAILURE (status)) { + goto unlock_and_exit; + } + } + else { + /* Remove the block on this interrupt with lock */ + + acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + if (gpe_block->previous) { + gpe_block->previous->next = gpe_block->next; + } + else { + gpe_block->xrupt_block->gpe_block_list_head = gpe_block->next; + } + + if (gpe_block->next) { + gpe_block->next->previous = gpe_block->previous; + } + acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); + } + + /* Free the gpe_block */ + + ACPI_MEM_FREE (gpe_block->register_info); + ACPI_MEM_FREE (gpe_block->event_info); + ACPI_MEM_FREE (gpe_block); + +unlock_and_exit: + status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); + return_ACPI_STATUS (status); } @@ -259,12 +575,16 @@ goto error_exit; } + /* Save the new Info arrays in the GPE block */ + + gpe_block->register_info = gpe_register_info; + gpe_block->event_info = gpe_event_info; + /* * Initialize the GPE Register and Event structures. A goal of these * tables is to hide the fact that there are two separate GPE register sets * in a given gpe hardware block, the status registers occupy the first half, - * and the enable registers occupy the second half. Another goal is to hide - * the fact that there may be multiple GPE hardware blocks. + * and the enable registers occupy the second half. */ this_register = gpe_register_info; this_event = gpe_event_info; @@ -319,14 +639,10 @@ this_register++; } - gpe_block->register_info = gpe_register_info; - gpe_block->event_info = gpe_event_info; - return_ACPI_STATUS (AE_OK); error_exit: - if (gpe_register_info) { ACPI_MEM_FREE (gpe_register_info); } @@ -334,7 +650,7 @@ ACPI_MEM_FREE (gpe_event_info); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (status); } @@ -342,7 +658,12 @@ * * FUNCTION: acpi_ev_create_gpe_block * - * PARAMETERS: TBD + * PARAMETERS: gpe_device - Handle to the parent GPE block + * gpe_block_address - Address and space_iD + * register_count - Number of GPE register pairs in the block + * gpe_block_base_number - Starting GPE number for the block + * interrupt_level - H/W interrupt for the block + * return_gpe_block - Where the new block descriptor is returned * * RETURN: Status * @@ -352,15 +673,15 @@ acpi_status acpi_ev_create_gpe_block ( - char *pathname, + struct acpi_namespace_node *gpe_device, struct acpi_generic_address *gpe_block_address, u32 register_count, u8 gpe_block_base_number, - u32 interrupt_level) + u32 interrupt_level, + struct acpi_gpe_block_info **return_gpe_block) { struct acpi_gpe_block_info *gpe_block; acpi_status status; - acpi_handle obj_handle; ACPI_FUNCTION_TRACE ("ev_create_gpe_block"); @@ -370,13 +691,6 @@ return_ACPI_STATUS (AE_OK); } - /* Get a handle to the parent object for this GPE block */ - - status = acpi_get_handle (NULL, pathname, &obj_handle); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } - /* Allocate a new GPE block */ gpe_block = ACPI_MEM_CALLOCATE (sizeof (struct acpi_gpe_block_info)); @@ -400,9 +714,8 @@ } /* Install the new block in the global list(s) */ - /* TBD: Install block in the interrupt handler list */ - status = acpi_ev_install_gpe_block (gpe_block); + status = acpi_ev_install_gpe_block (gpe_block, interrupt_level); if (ACPI_FAILURE (status)) { ACPI_MEM_FREE (gpe_block); return_ACPI_STATUS (status); @@ -410,22 +723,30 @@ /* Dump info about this GPE block */ - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "GPE Block: %X registers at %8.8X%8.8X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "GPE Block: [%4.4s] %X registers at %8.8X%8.8X on interrupt %d\n", + gpe_device->name.ascii, gpe_block->register_count, ACPI_HIDWORD (gpe_block->block_address.address), - ACPI_LODWORD (gpe_block->block_address.address))); + ACPI_LODWORD (gpe_block->block_address.address), + interrupt_level)); - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "GPE Block defined as GPE%d to GPE%d\n", + ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "GPE Block defined as GPE 0x%.2X to GPE 0x%.2X\n", gpe_block->block_base_number, (u32) (gpe_block->block_base_number + ((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)))); /* Find all GPE methods (_Lxx, _Exx) for this block */ - status = acpi_walk_namespace (ACPI_TYPE_METHOD, obj_handle, - ACPI_UINT32_MAX, acpi_ev_save_method_info, + status = acpi_ns_walk_namespace (ACPI_TYPE_METHOD, gpe_device, + ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, acpi_ev_save_method_info, gpe_block, NULL); + /* Return the new block */ + + if (return_gpe_block) { + (*return_gpe_block) = gpe_block; + } + return_ACPI_STATUS (AE_OK); } @@ -448,11 +769,20 @@ u32 register_count0 = 0; u32 register_count1 = 0; u32 gpe_number_max = 0; + acpi_handle gpe_device; + acpi_status status; ACPI_FUNCTION_TRACE ("ev_gpe_initialize"); + /* Get a handle to the predefined _GPE object */ + + status = acpi_get_handle (NULL, "\\_GPE", &gpe_device); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + /* * Initialize the GPE Blocks defined in the FADT * @@ -474,6 +804,7 @@ * * Note: both GPE0 and GPE1 are optional, and either can exist without * the other. + * * If EITHER the register length OR the block address are zero, then that * particular block is not supported. */ @@ -485,8 +816,15 @@ gpe_number_max = (register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1; - acpi_ev_create_gpe_block ("\\_GPE", &acpi_gbl_FADT->xgpe0_blk, - register_count0, 0, acpi_gbl_FADT->sci_int); + /* Install GPE Block 0 */ + + status = acpi_ev_create_gpe_block (gpe_device, &acpi_gbl_FADT->xgpe0_blk, + register_count0, 0, acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]); + if (ACPI_FAILURE (status)) { + ACPI_REPORT_ERROR (( + "Could not create GPE Block 0, %s\n", + acpi_format_exception (status))); + } } if (acpi_gbl_FADT->gpe1_blk_len && @@ -510,8 +848,16 @@ register_count1 = 0; } else { - acpi_ev_create_gpe_block ("\\_GPE", &acpi_gbl_FADT->xgpe1_blk, - register_count1, acpi_gbl_FADT->gpe1_base, acpi_gbl_FADT->sci_int); + /* Install GPE Block 1 */ + + status = acpi_ev_create_gpe_block (gpe_device, &acpi_gbl_FADT->xgpe1_blk, + register_count1, acpi_gbl_FADT->gpe1_base, + acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]); + if (ACPI_FAILURE (status)) { + ACPI_REPORT_ERROR (( + "Could not create GPE Block 1, %s\n", + acpi_format_exception (status))); + } /* * GPE0 and GPE1 do not have to be contiguous in the GPE number space, diff -urN linux-2.5.66-bk7/drivers/acpi/events/evmisc.c linux-2.5.66-bk8/drivers/acpi/events/evmisc.c --- linux-2.5.66-bk7/drivers/acpi/events/evmisc.c Mon Mar 24 14:00:48 2003 +++ linux-2.5.66-bk8/drivers/acpi/events/evmisc.c Wed Apr 2 04:38:13 2003 @@ -523,9 +523,6 @@ { acpi_native_uint i; acpi_status status; - struct acpi_gpe_block_info *gpe_block; - struct acpi_gpe_block_info *next_gpe_block; - struct acpi_gpe_event_info *gpe_event_info; ACPI_FUNCTION_TRACE ("ev_terminate"); @@ -537,66 +534,35 @@ * In all cases, on error, print a message but obviously we don't abort. */ - /* - * Disable all fixed events - */ + /* Disable all fixed events */ + for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { - status = acpi_disable_event ((u32) i, ACPI_EVENT_FIXED, 0); + status = acpi_disable_event ((u32) i, 0); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable fixed event %d\n", (u32) i)); } } - /* - * Disable all GPEs - */ - gpe_block = acpi_gbl_gpe_block_list_head; - while (gpe_block) { - gpe_event_info = gpe_block->event_info; - for (i = 0; i < (gpe_block->register_count * 8); i++) { - status = acpi_hw_disable_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable GPE %d\n", (u32) i)); - } + /* Disable all GPEs in all GPE blocks */ - gpe_event_info++; - } + status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block); - gpe_block = gpe_block->next; - } + /* Remove SCI handler */ - /* - * Remove SCI handler - */ status = acpi_ev_remove_sci_handler (); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not remove SCI handler\n")); } } - /* - * Return to original mode if necessary - */ + /* Return to original mode if necessary */ + if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { status = acpi_disable (); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "acpi_disable failed\n")); } } - - /* - * Free global GPE blocks and related info structures - */ - gpe_block = acpi_gbl_gpe_block_list_head; - while (gpe_block) { - next_gpe_block = gpe_block->next; - ACPI_MEM_FREE (gpe_block->event_info); - ACPI_MEM_FREE (gpe_block->register_info); - ACPI_MEM_FREE (gpe_block); - - gpe_block = next_gpe_block; - } - return_VOID; } diff -urN linux-2.5.66-bk7/drivers/acpi/events/evsci.c linux-2.5.66-bk8/drivers/acpi/events/evsci.c --- linux-2.5.66-bk7/drivers/acpi/events/evsci.c Mon Mar 24 14:00:55 2003 +++ linux-2.5.66-bk8/drivers/acpi/events/evsci.c Wed Apr 2 04:38:13 2003 @@ -52,26 +52,26 @@ /******************************************************************************* * - * FUNCTION: acpi_ev_sci_handler + * FUNCTION: acpi_ev_sci_xrupt_handler * * PARAMETERS: Context - Calling Context * * RETURN: Status code indicates whether interrupt was handled. * * DESCRIPTION: Interrupt handler that will figure out what function or - * control method to call to deal with a SCI. Installed - * using BU interrupt support. + * control method to call to deal with a SCI. * ******************************************************************************/ static u32 ACPI_SYSTEM_XFACE -acpi_ev_sci_handler ( +acpi_ev_sci_xrupt_handler ( void *context) { + struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; - ACPI_FUNCTION_TRACE("ev_sci_handler"); + ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler"); /* @@ -80,16 +80,54 @@ */ /* - * Fixed acpi_events: - * Check for and dispatch any Fixed acpi_events that have occurred + * Fixed Events: + * Check for and dispatch any Fixed Events that have occurred */ interrupt_handled |= acpi_ev_fixed_event_detect (); /* + * General Purpose Events: + * Check for and dispatch any GPEs that have occurred + */ + interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list); + + return_VALUE (interrupt_handled); +} + + +/******************************************************************************* + * + * FUNCTION: acpi_ev_gpe_xrupt_handler + * + * PARAMETERS: Context - Calling Context + * + * RETURN: Status code indicates whether interrupt was handled. + * + * DESCRIPTION: Handler for GPE Block Device interrupts + * + ******************************************************************************/ + +u32 ACPI_SYSTEM_XFACE +acpi_ev_gpe_xrupt_handler ( + void *context) +{ + struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; + u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; + + + ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler"); + + + /* + * We are guaranteed by the ACPI CA initialization/shutdown code that + * if this interrupt handler is installed, ACPI is enabled. + */ + + /* * GPEs: * Check for and dispatch any GPEs that have occurred */ - interrupt_handled |= acpi_ev_gpe_detect (); + interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list); return_VALUE (interrupt_handled); } @@ -117,7 +155,7 @@ status = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int, - acpi_ev_sci_handler, NULL); + acpi_ev_sci_xrupt_handler, acpi_gbl_gpe_xrupt_list_head); return_ACPI_STATUS (status); } @@ -153,7 +191,7 @@ /* Just let the OS remove the handler and disable the level */ status = acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int, - acpi_ev_sci_handler); + acpi_ev_sci_xrupt_handler); return_ACPI_STATUS (status); } diff -urN linux-2.5.66-bk7/drivers/acpi/events/evxface.c linux-2.5.66-bk8/drivers/acpi/events/evxface.c --- linux-2.5.66-bk7/drivers/acpi/events/evxface.c Mon Mar 24 14:00:48 2003 +++ linux-2.5.66-bk8/drivers/acpi/events/evxface.c Wed Apr 2 04:38:13 2003 @@ -102,7 +102,7 @@ acpi_gbl_fixed_event_handlers[event].handler = handler; acpi_gbl_fixed_event_handlers[event].context = context; - status = acpi_enable_event (event, ACPI_EVENT_FIXED, 0); + status = acpi_enable_event (event, 0); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n")); @@ -160,7 +160,7 @@ /* Disable the event before removing the handler */ - status = acpi_disable_event(event, ACPI_EVENT_FIXED, 0); + status = acpi_disable_event (event, 0); /* Always Remove the handler */ @@ -471,8 +471,8 @@ * * FUNCTION: acpi_install_gpe_handler * - * PARAMETERS: gpe_number - The GPE number. The numbering scheme is - * bank 0 first, then bank 1. + * PARAMETERS: gpe_number - The GPE number within the GPE block + * gpe_block - GPE block (NULL == FADT GPEs) * Type - Whether this GPE should be treated as an * edge- or level-triggered interrupt. * Handler - Address of the handler @@ -486,6 +486,7 @@ acpi_status acpi_install_gpe_handler ( + acpi_handle gpe_device, u32 gpe_number, u32 type, acpi_gpe_handler handler, @@ -504,42 +505,45 @@ return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Ensure that we have a valid GPE number */ - - gpe_event_info = acpi_ev_get_gpe_event_info (gpe_number); - if (!gpe_event_info) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } + /* Ensure that we have a valid GPE number */ + + gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + if (!gpe_event_info) { + status = AE_BAD_PARAMETER; + goto unlock_and_exit; + } + /* Make sure that there isn't a handler there already */ if (gpe_event_info->handler) { status = AE_ALREADY_EXISTS; - goto cleanup; + goto unlock_and_exit; } /* Install the handler */ + acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); gpe_event_info->handler = handler; gpe_event_info->context = context; - gpe_event_info->type = (u8) type; + gpe_event_info->flags = (u8) type; + acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); /* Clear the GPE (of stale events), the enable it */ status = acpi_hw_clear_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { - goto cleanup; + goto unlock_and_exit; } status = acpi_hw_enable_gpe (gpe_event_info); -cleanup: +unlock_and_exit: (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (status); } @@ -550,6 +554,7 @@ * FUNCTION: acpi_remove_gpe_handler * * PARAMETERS: gpe_number - The event to remove a handler + * gpe_block - GPE block (NULL == FADT GPEs) * Handler - Address of the handler * * RETURN: Status @@ -560,6 +565,7 @@ acpi_status acpi_remove_gpe_handler ( + acpi_handle gpe_device, u32 gpe_number, acpi_gpe_handler handler) { @@ -576,23 +582,24 @@ return_ACPI_STATUS (AE_BAD_PARAMETER); } + status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + /* Ensure that we have a valid GPE number */ - gpe_event_info = acpi_ev_get_gpe_event_info (gpe_number); + gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); if (!gpe_event_info) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + status = AE_BAD_PARAMETER; + goto unlock_and_exit; } /* Disable the GPE before removing the handler */ status = acpi_hw_disable_gpe (gpe_event_info); if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } - - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + goto unlock_and_exit; } /* Make sure that the installed handler is the same */ @@ -600,16 +607,18 @@ if (gpe_event_info->handler != handler) { (void) acpi_hw_enable_gpe (gpe_event_info); status = AE_BAD_PARAMETER; - goto cleanup; + goto unlock_and_exit; } /* Remove the handler */ + acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); gpe_event_info->handler = NULL; gpe_event_info->context = NULL; + acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); -cleanup: +unlock_and_exit: (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (status); } diff -urN linux-2.5.66-bk7/drivers/acpi/events/evxfevnt.c linux-2.5.66-bk8/drivers/acpi/events/evxfevnt.c --- linux-2.5.66-bk7/drivers/acpi/events/evxfevnt.c Mon Mar 24 14:00:13 2003 +++ linux-2.5.66-bk8/drivers/acpi/events/evxfevnt.c Wed Apr 2 04:38:13 2003 @@ -44,6 +44,7 @@ #include #include +#include #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evxfevnt") @@ -116,6 +117,7 @@ ACPI_FUNCTION_TRACE ("acpi_disable"); + if (!acpi_gbl_FADT) { ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n")); return_ACPI_STATUS (AE_NO_ACPI_TABLES); @@ -145,94 +147,121 @@ * * FUNCTION: acpi_enable_event * - * PARAMETERS: Event - The fixed event or GPE to be enabled - * Type - The type of event - * Flags - Just enable, or also wake enable? + * PARAMETERS: Event - The fixed eventto be enabled + * Flags - Reserved * * RETURN: Status * - * DESCRIPTION: Enable an ACPI event (fixed and general purpose) + * DESCRIPTION: Enable an ACPI event (fixed) * ******************************************************************************/ acpi_status acpi_enable_event ( u32 event, - u32 type, u32 flags) { acpi_status status = AE_OK; u32 value; - struct acpi_gpe_event_info *gpe_event_info; ACPI_FUNCTION_TRACE ("acpi_enable_event"); - /* The Type must be either Fixed Event or GPE */ - - switch (type) { - case ACPI_EVENT_FIXED: + /* Decode the Fixed Event */ - /* Decode the Fixed Event */ + if (event > ACPI_EVENT_MAX) { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } - if (event > ACPI_EVENT_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } + /* + * Enable the requested fixed event (by writing a one to the + * enable register bit) + */ + status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id, + 1, ACPI_MTX_LOCK); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + + /* Make sure that the hardware responded */ + + status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id, + &value, ACPI_MTX_LOCK); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + + if (value != 1) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Could not enable %s event\n", acpi_ut_get_event_name (event))); + return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); + } - /* - * Enable the requested fixed event (by writing a one to the - * enable register bit) - */ - status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id, - 1, ACPI_MTX_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } + return_ACPI_STATUS (status); +} - /* Make sure that the hardware responded */ - status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id, - &value, ACPI_MTX_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } - - if (value != 1) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not enable %s event\n", acpi_ut_get_event_name (event))); - return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); - } - break; +/******************************************************************************* + * + * FUNCTION: acpi_enable_gpe + * + * PARAMETERS: gpe_device - Parent GPE Device + * gpe_number - GPE level within the GPE block + * Flags - Just enable, or also wake enable? + * Called from ISR or not + * + * RETURN: Status + * + * DESCRIPTION: Enable an ACPI event (general purpose) + * + ******************************************************************************/ +acpi_status +acpi_enable_gpe ( + acpi_handle gpe_device, + u32 gpe_number, + u32 flags) +{ + acpi_status status = AE_OK; + struct acpi_gpe_event_info *gpe_event_info; - case ACPI_EVENT_GPE: - /* Ensure that we have a valid GPE number */ + ACPI_FUNCTION_TRACE ("acpi_enable_gpe"); - gpe_event_info = acpi_ev_get_gpe_event_info (event); - if (!gpe_event_info) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - /* Enable the requested GPE number */ + /* Use semaphore lock if not executing at interrupt level */ - status = acpi_hw_enable_gpe (gpe_event_info); + if (flags & ACPI_NOT_ISR) { + status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (status)) { return_ACPI_STATUS (status); } + } - if (flags & ACPI_EVENT_WAKE_ENABLE) { - acpi_hw_enable_gpe_for_wakeup (gpe_event_info); - } - break; + /* Ensure that we have a valid GPE number */ + + gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + if (!gpe_event_info) { + status = AE_BAD_PARAMETER; + goto unlock_and_exit; + } + /* Enable the requested GPE number */ - default: + status = acpi_hw_enable_gpe (gpe_event_info); + if (ACPI_FAILURE (status)) { + goto unlock_and_exit; + } - status = AE_BAD_PARAMETER; + if (flags & ACPI_EVENT_WAKE_ENABLE) { + acpi_hw_enable_gpe_for_wakeup (gpe_event_info); } +unlock_and_exit: + if (flags & ACPI_NOT_ISR) { + (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); + } return_ACPI_STATUS (status); } @@ -241,92 +270,119 @@ * * FUNCTION: acpi_disable_event * - * PARAMETERS: Event - The fixed event or GPE to be enabled - * Type - The type of event, fixed or general purpose - * Flags - Wake disable vs. non-wake disable + * PARAMETERS: Event - The fixed eventto be enabled + * Flags - Reserved * * RETURN: Status * - * DESCRIPTION: Disable an ACPI event (fixed and general purpose) + * DESCRIPTION: Disable an ACPI event (fixed) * ******************************************************************************/ acpi_status acpi_disable_event ( u32 event, - u32 type, u32 flags) { acpi_status status = AE_OK; u32 value; - struct acpi_gpe_event_info *gpe_event_info; ACPI_FUNCTION_TRACE ("acpi_disable_event"); - /* The Type must be either Fixed Event or GPE */ + /* Decode the Fixed Event */ - switch (type) { - case ACPI_EVENT_FIXED: - - /* Decode the Fixed Event */ + if (event > ACPI_EVENT_MAX) { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } - if (event > ACPI_EVENT_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } + /* + * Disable the requested fixed event (by writing a zero to the + * enable register bit) + */ + status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id, + 0, ACPI_MTX_LOCK); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + + status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id, + &value, ACPI_MTX_LOCK); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + + if (value != 0) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Could not disable %s events\n", acpi_ut_get_event_name (event))); + return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); + } - /* - * Disable the requested fixed event (by writing a zero to the - * enable register bit) - */ - status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id, - 0, ACPI_MTX_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } + return_ACPI_STATUS (status); +} - status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id, - &value, ACPI_MTX_LOCK); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); - } - if (value != 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not disable %s events\n", acpi_ut_get_event_name (event))); - return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); - } - break; +/******************************************************************************* + * + * FUNCTION: acpi_disable_gpe + * + * PARAMETERS: gpe_device - Parent GPE Device + * gpe_number - GPE level within the GPE block + * Flags - Just enable, or also wake enable? + * Called from ISR or not + * + * RETURN: Status + * + * DESCRIPTION: Disable an ACPI event (general purpose) + * + ******************************************************************************/ +acpi_status +acpi_disable_gpe ( + acpi_handle gpe_device, + u32 gpe_number, + u32 flags) +{ + acpi_status status = AE_OK; + struct acpi_gpe_event_info *gpe_event_info; - case ACPI_EVENT_GPE: - /* Ensure that we have a valid GPE number */ + ACPI_FUNCTION_TRACE ("acpi_disable_gpe"); - gpe_event_info = acpi_ev_get_gpe_event_info (event); - if (!gpe_event_info) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - /* - * Only disable the requested GPE number for wake if specified. - * Otherwise, turn it totally off - */ + /* Use semaphore lock if not executing at interrupt level */ - if (flags & ACPI_EVENT_WAKE_DISABLE) { - acpi_hw_disable_gpe_for_wakeup (gpe_event_info); - } - else { - status = acpi_hw_disable_gpe (gpe_event_info); + if (flags & ACPI_NOT_ISR) { + status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); } - break; + } + /* Ensure that we have a valid GPE number */ - default: + gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + if (!gpe_event_info) { status = AE_BAD_PARAMETER; + goto unlock_and_exit; + } + + /* + * Only disable the requested GPE number for wake if specified. + * Otherwise, turn it totally off + */ + if (flags & ACPI_EVENT_WAKE_DISABLE) { + acpi_hw_disable_gpe_for_wakeup (gpe_event_info); + } + else { + status = acpi_hw_disable_gpe (gpe_event_info); } +unlock_and_exit: + if (flags & ACPI_NOT_ISR) { + (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); + } return_ACPI_STATUS (status); } @@ -335,65 +391,91 @@ * * FUNCTION: acpi_clear_event * - * PARAMETERS: Event - The fixed event or GPE to be cleared - * Type - The type of event + * PARAMETERS: Event - The fixed event to be cleared * * RETURN: Status * - * DESCRIPTION: Clear an ACPI event (fixed and general purpose) + * DESCRIPTION: Clear an ACPI event (fixed) * ******************************************************************************/ acpi_status acpi_clear_event ( - u32 event, - u32 type) + u32 event) { acpi_status status = AE_OK; - struct acpi_gpe_event_info *gpe_event_info; ACPI_FUNCTION_TRACE ("acpi_clear_event"); - /* The Type must be either Fixed Event or GPE */ + /* Decode the Fixed Event */ - switch (type) { - case ACPI_EVENT_FIXED: + if (event > ACPI_EVENT_MAX) { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } - /* Decode the Fixed Event */ + /* + * Clear the requested fixed event (By writing a one to the + * status register bit) + */ + status = acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id, + 1, ACPI_MTX_LOCK); - if (event > ACPI_EVENT_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } + return_ACPI_STATUS (status); +} - /* - * Clear the requested fixed event (By writing a one to the - * status register bit) - */ - status = acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id, - 1, ACPI_MTX_LOCK); - break; - - - case ACPI_EVENT_GPE: - - /* Ensure that we have a valid GPE number */ - - gpe_event_info = acpi_ev_get_gpe_event_info (event); - if (!gpe_event_info) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - status = acpi_hw_clear_gpe (gpe_event_info); - break; +/******************************************************************************* + * + * FUNCTION: acpi_clear_gpe + * + * PARAMETERS: gpe_device - Parent GPE Device + * gpe_number - GPE level within the GPE block + * Flags - Called from an ISR or not + * + * RETURN: Status + * + * DESCRIPTION: Clear an ACPI event (general purpose) + * + ******************************************************************************/ + +acpi_status +acpi_clear_gpe ( + acpi_handle gpe_device, + u32 gpe_number, + u32 flags) +{ + acpi_status status = AE_OK; + struct acpi_gpe_event_info *gpe_event_info; + + ACPI_FUNCTION_TRACE ("acpi_clear_gpe"); - default: + /* Use semaphore lock if not executing at interrupt level */ + + if (flags & ACPI_NOT_ISR) { + status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); + } + } + + /* Ensure that we have a valid GPE number */ + + gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + if (!gpe_event_info) { status = AE_BAD_PARAMETER; + goto unlock_and_exit; } + status = acpi_hw_clear_gpe (gpe_event_info); + +unlock_and_exit: + if (flags & ACPI_NOT_ISR) { + (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); + } return_ACPI_STATUS (status); } @@ -402,9 +484,8 @@ * * FUNCTION: acpi_get_event_status * - * PARAMETERS: Event - The fixed event or GPE - * Type - The type of event - * Status - Where the current status of the event will + * PARAMETERS: Event - The fixed event + * Event Status - Where the current status of the event will * be returned * * RETURN: Status @@ -413,15 +494,12 @@ * ******************************************************************************/ - acpi_status acpi_get_event_status ( u32 event, - u32 type, acpi_event_status *event_status) { acpi_status status = AE_OK; - struct acpi_gpe_event_info *gpe_event_info; ACPI_FUNCTION_TRACE ("acpi_get_event_status"); @@ -431,45 +509,224 @@ return_ACPI_STATUS (AE_BAD_PARAMETER); } + /* Decode the Fixed Event */ - /* The Type must be either Fixed Event or GPE */ + if (event > ACPI_EVENT_MAX) { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } - switch (type) { - case ACPI_EVENT_FIXED: + /* Get the status of the requested fixed event */ - /* Decode the Fixed Event */ + status = acpi_get_register (acpi_gbl_fixed_event_info[event].status_register_id, + event_status, ACPI_MTX_LOCK); - if (event > ACPI_EVENT_MAX) { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } + return_ACPI_STATUS (status); +} - /* Get the status of the requested fixed event */ - status = acpi_get_register (acpi_gbl_fixed_event_info[event].status_register_id, - event_status, ACPI_MTX_LOCK); - break; +/******************************************************************************* + * + * FUNCTION: acpi_get_gpe_status + * + * PARAMETERS: gpe_device - Parent GPE Device + * gpe_number - GPE level within the GPE block + * Flags - Called from an ISR or not + * Event Status - Where the current status of the event will + * be returned + * + * RETURN: Status + * + * DESCRIPTION: Get status of an event (general purpose) + * + ******************************************************************************/ +acpi_status +acpi_get_gpe_status ( + acpi_handle gpe_device, + u32 gpe_number, + u32 flags, + acpi_event_status *event_status) +{ + acpi_status status = AE_OK; + struct acpi_gpe_event_info *gpe_event_info; - case ACPI_EVENT_GPE: - /* Ensure that we have a valid GPE number */ + ACPI_FUNCTION_TRACE ("acpi_get_gpe_status"); - gpe_event_info = acpi_ev_get_gpe_event_info (event); - if (!gpe_event_info) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + + /* Use semaphore lock if not executing at interrupt level */ + + if (flags & ACPI_NOT_ISR) { + status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (status)) { + return_ACPI_STATUS (status); } + } + + /* Ensure that we have a valid GPE number */ + + gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number); + if (!gpe_event_info) { + status = AE_BAD_PARAMETER; + goto unlock_and_exit; + } + + /* Obtain status on the requested GPE number */ + + status = acpi_hw_get_gpe_status (gpe_event_info, event_status); + +unlock_and_exit: + if (flags & ACPI_NOT_ISR) { + (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS); + } + return_ACPI_STATUS (status); +} - /* Obtain status on the requested GPE number */ - status = acpi_hw_get_gpe_status (event, event_status); - break; +/******************************************************************************* + * + * FUNCTION: acpi_install_gpe_block + * + * PARAMETERS: gpe_device - Handle to the parent GPE Block Device + * gpe_block_address - Address and space_iD + * register_count - Number of GPE register pairs in the block + * interrupt_level - H/W interrupt for the block + * + * RETURN: Status + * + * DESCRIPTION: Create and Install a block of GPE registers + * + ******************************************************************************/ + +acpi_status +acpi_install_gpe_block ( + acpi_handle gpe_device, + struct acpi_generic_address *gpe_block_address, + u32 register_count, + u32 interrupt_level) +{ + acpi_status status; + union acpi_operand_object *obj_desc; + struct acpi_namespace_node *node; + struct acpi_gpe_block_info *gpe_block; - default: + ACPI_FUNCTION_TRACE ("acpi_install_gpe_block"); + + + if ((!gpe_device) || + (!gpe_block_address) || + (!register_count)) { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (status)) { + return (status); + } + + node = acpi_ns_map_handle_to_node (gpe_device); + if (!node) { status = AE_BAD_PARAMETER; + goto unlock_and_exit; + } + + /* + * For user-installed GPE Block Devices, the gpe_block_base_number + * is always zero + */ + status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count, + 0, interrupt_level, &gpe_block); + if (ACPI_FAILURE (status)) { + goto unlock_and_exit; + } + + /* Get the device_object attached to the node */ + + obj_desc = acpi_ns_get_attached_object (node); + if (!obj_desc) { + /* No object, create a new one */ + + obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_DEVICE); + if (!obj_desc) { + status = AE_NO_MEMORY; + goto unlock_and_exit; + } + + status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_DEVICE); + acpi_ut_remove_reference (obj_desc); + if (ACPI_FAILURE (status)) { + goto unlock_and_exit; + } } + /* Install the GPE block in the device_object */ + + obj_desc->device.gpe_block = gpe_block; + + +unlock_and_exit: + (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (status); } +/******************************************************************************* + * + * FUNCTION: acpi_remove_gpe_block + * + * PARAMETERS: gpe_device - Handle to the parent GPE Block Device + * + * RETURN: Status + * + * DESCRIPTION: Remove a previously installed block of GPE registers + * + ******************************************************************************/ + +acpi_status +acpi_remove_gpe_block ( + acpi_handle gpe_device) +{ + union acpi_operand_object *obj_desc; + acpi_status status; + struct acpi_namespace_node *node; + + + ACPI_FUNCTION_TRACE ("acpi_remove_gpe_block"); + + + if (!gpe_device) { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (status)) { + return (status); + } + + node = acpi_ns_map_handle_to_node (gpe_device); + if (!node) { + status = AE_BAD_PARAMETER; + goto unlock_and_exit; + } + + /* Get the device_object attached to the node */ + + obj_desc = acpi_ns_get_attached_object (node); + if (!obj_desc || + !obj_desc->device.gpe_block) { + return_ACPI_STATUS (AE_NULL_OBJECT); + } + + /* Delete the GPE block (but not the device_object) */ + + status = acpi_ev_delete_gpe_block (obj_desc->device.gpe_block); + if (ACPI_SUCCESS (status)) { + obj_desc->device.gpe_block = NULL; + } + +unlock_and_exit: + (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + return_ACPI_STATUS (status); +} + diff -urN linux-2.5.66-bk7/drivers/acpi/fan.c linux-2.5.66-bk8/drivers/acpi/fan.c --- linux-2.5.66-bk7/drivers/acpi/fan.c Mon Mar 24 13:59:56 2003 +++ linux-2.5.66-bk8/drivers/acpi/fan.c Wed Apr 2 04:38:13 2003 @@ -28,6 +28,8 @@ #include #include #include +#include + #include #include diff -urN linux-2.5.66-bk7/drivers/acpi/hardware/hwgpe.c linux-2.5.66-bk8/drivers/acpi/hardware/hwgpe.c --- linux-2.5.66-bk7/drivers/acpi/hardware/hwgpe.c Mon Mar 24 13:59:54 2003 +++ linux-2.5.66-bk8/drivers/acpi/hardware/hwgpe.c Wed Apr 2 04:38:13 2003 @@ -266,13 +266,12 @@ acpi_status acpi_hw_get_gpe_status ( - u32 gpe_number, + struct acpi_gpe_event_info *gpe_event_info, acpi_event_status *event_status) { u32 in_byte; u8 bit_mask; struct acpi_gpe_register_info *gpe_register_info; - struct acpi_gpe_event_info *gpe_event_info; acpi_status status; acpi_event_status local_event_status = 0; @@ -284,11 +283,6 @@ return (AE_BAD_PARAMETER); } - gpe_event_info = acpi_ev_get_gpe_event_info (gpe_number); - if (!gpe_event_info) { - return (AE_BAD_PARAMETER); - } - /* Get the info block for the entire GPE register */ gpe_register_info = gpe_event_info->register_info; @@ -301,7 +295,7 @@ status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->enable_address, 0); if (ACPI_FAILURE (status)) { - return (status); + goto unlock_and_exit; } if (bit_mask & in_byte) { @@ -318,7 +312,7 @@ status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->status_address, 0); if (ACPI_FAILURE (status)) { - return (status); + goto unlock_and_exit; } if (bit_mask & in_byte) { @@ -328,6 +322,150 @@ /* Set return value */ (*event_status) = local_event_status; + + +unlock_and_exit: + return (status); +} + + +/****************************************************************************** + * + * FUNCTION: acpi_hw_disable_gpe_block + * + * PARAMETERS: gpe_xrupt_info - GPE Interrupt info + * gpe_block - Gpe Block info + * + * RETURN: Status + * + * DESCRIPTION: Disable all GPEs within a GPE block + * + ******************************************************************************/ + +acpi_status +acpi_hw_disable_gpe_block ( + struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block) +{ + u32 i; + struct acpi_gpe_register_info *gpe_register_info; + acpi_status status; + + + /* Get the register info for the entire GPE block */ + + gpe_register_info = gpe_block->register_info; + + /* Examine each GPE Register within the block */ + + for (i = 0; i < gpe_block->register_count; i++) { + status = acpi_hw_low_level_write (8, 0x00, + &gpe_block->register_info[i].enable_address, (u32) i); + if (ACPI_FAILURE (status)) { + return (status); + } + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: acpi_hw_clear_gpe_block + * + * PARAMETERS: gpe_xrupt_info - GPE Interrupt info + * gpe_block - Gpe Block info + * + * RETURN: Status + * + * DESCRIPTION: Clear all GPEs within a GPE block + * + ******************************************************************************/ + +acpi_status +acpi_hw_clear_gpe_block ( + struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block) +{ + u32 i; + struct acpi_gpe_register_info *gpe_register_info; + acpi_status status; + + + /* Get the register info for the entire GPE block */ + + gpe_register_info = gpe_block->register_info; + + /* Examine each GPE Register within the block */ + + for (i = 0; i < gpe_block->register_count; i++) { + status = acpi_hw_low_level_write (8, 0xFF, + &gpe_block->register_info[i].status_address, (u32) i); + if (ACPI_FAILURE (status)) { + return (status); + } + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: acpi_hw_disable_non_wakeup_gpe_block + * + * PARAMETERS: gpe_xrupt_info - GPE Interrupt info + * gpe_block - Gpe Block info + * + * RETURN: Status + * + * DESCRIPTION: Disable all GPEs except wakeup GPEs in a GPE block + * + ******************************************************************************/ + +acpi_status +acpi_hw_disable_non_wakeup_gpe_block ( + struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block) +{ + u32 i; + struct acpi_gpe_register_info *gpe_register_info; + u32 in_value; + acpi_status status; + + + /* Get the register info for the entire GPE block */ + + gpe_register_info = gpe_block->register_info; + + /* Examine each GPE Register within the block */ + + for (i = 0; i < gpe_block->register_count; i++) { + /* + * Read the enabled status of all GPEs. We + * will be using it to restore all the GPEs later. + */ + status = acpi_hw_low_level_read (8, &in_value, + &gpe_register_info->enable_address, 0); + if (ACPI_FAILURE (status)) { + return (status); + } + + gpe_register_info->enable = (u8) in_value; + + /* + * Disable all GPEs except wakeup GPEs. + */ + status = acpi_hw_low_level_write (8, gpe_register_info->wake_enable, + &gpe_register_info->enable_address, 0); + if (ACPI_FAILURE (status)) { + return (status); + } + + gpe_register_info++; + } + return (AE_OK); } @@ -341,7 +479,7 @@ * RETURN: None * * DESCRIPTION: Disable all non-wakeup GPEs - * Call with interrupts disabled. The interrupt handler also + * Called with interrupts disabled. The interrupt handler also * modifies gpe_register_info->Enable, so it should not be * given the chance to run until after non-wake GPEs are * re-enabled. @@ -352,53 +490,64 @@ acpi_hw_disable_non_wakeup_gpes ( void) { + acpi_status status; + + + ACPI_FUNCTION_ENTRY (); + + + status = acpi_ev_walk_gpe_list (acpi_hw_disable_non_wakeup_gpe_block); + + return (status); +} + + +/****************************************************************************** + * + * FUNCTION: acpi_hw_enable_non_wakeup_gpe_block + * + * PARAMETERS: gpe_xrupt_info - GPE Interrupt info + * gpe_block - Gpe Block info + * + * RETURN: Status + * + * DESCRIPTION: Enable a single GPE. + * + ******************************************************************************/ + +acpi_status +acpi_hw_enable_non_wakeup_gpe_block ( + struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block) +{ u32 i; struct acpi_gpe_register_info *gpe_register_info; - u32 in_value; acpi_status status; - struct acpi_gpe_block_info *gpe_block; - ACPI_FUNCTION_ENTRY (); + /* This callback processes one entire GPE block */ + /* Get the register info for the entire GPE block */ - gpe_block = acpi_gbl_gpe_block_list_head; - while (gpe_block) { - /* Get the register info for the entire GPE block */ - - gpe_register_info = gpe_block->register_info; - if (!gpe_register_info) { - return (AE_BAD_PARAMETER); - } + gpe_register_info = gpe_block->register_info; - for (i = 0; i < gpe_block->register_count; i++) { - /* - * Read the enabled status of all GPEs. We - * will be using it to restore all the GPEs later. - */ - status = acpi_hw_low_level_read (8, &in_value, - &gpe_register_info->enable_address, 0); - if (ACPI_FAILURE (status)) { - return (status); - } - - gpe_register_info->enable = (u8) in_value; - - /* - * Disable all GPEs except wakeup GPEs. - */ - status = acpi_hw_low_level_write (8, gpe_register_info->wake_enable, - &gpe_register_info->enable_address, 0); - if (ACPI_FAILURE (status)) { - return (status); - } + /* Examine each GPE register within the block */ - gpe_register_info++; + for (i = 0; i < gpe_block->register_count; i++) { + /* + * We previously stored the enabled status of all GPEs. + * Blast them back in. + */ + status = acpi_hw_low_level_write (8, gpe_register_info->enable, + &gpe_register_info->enable_address, 0); + if (ACPI_FAILURE (status)) { + return (status); } - gpe_block = gpe_block->next; + gpe_register_info++; } + return (AE_OK); } @@ -419,40 +568,13 @@ acpi_hw_enable_non_wakeup_gpes ( void) { - u32 i; - struct acpi_gpe_register_info *gpe_register_info; acpi_status status; - struct acpi_gpe_block_info *gpe_block; ACPI_FUNCTION_ENTRY (); - gpe_block = acpi_gbl_gpe_block_list_head; - while (gpe_block) { - /* Get the register info for the entire GPE block */ - - gpe_register_info = gpe_block->register_info; - if (!gpe_register_info) { - return (AE_BAD_PARAMETER); - } - - for (i = 0; i < gpe_block->register_count; i++) { - /* - * We previously stored the enabled status of all GPEs. - * Blast them back in. - */ - status = acpi_hw_low_level_write (8, gpe_register_info->enable, - &gpe_register_info->enable_address, 0); - if (ACPI_FAILURE (status)) { - return (status); - } - - gpe_register_info++; - } + status = acpi_ev_walk_gpe_list (acpi_hw_enable_non_wakeup_gpe_block); - gpe_block = gpe_block->next; - } - - return (AE_OK); + return (status); } diff -urN linux-2.5.66-bk7/drivers/acpi/hardware/hwregs.c linux-2.5.66-bk8/drivers/acpi/hardware/hwregs.c --- linux-2.5.66-bk7/drivers/acpi/hardware/hwregs.c Mon Mar 24 14:01:22 2003 +++ linux-2.5.66-bk8/drivers/acpi/hardware/hwregs.c Wed Apr 2 04:38:13 2003 @@ -46,6 +46,7 @@ #include #include +#include #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME ("hwregs") @@ -66,9 +67,7 @@ acpi_status acpi_hw_clear_acpi_status (void) { - acpi_native_uint i; acpi_status status; - struct acpi_gpe_block_info *gpe_block; ACPI_FUNCTION_TRACE ("hw_clear_acpi_status"); @@ -102,18 +101,7 @@ /* Clear the GPE Bits in all GPE registers in all GPE blocks */ - gpe_block = acpi_gbl_gpe_block_list_head; - while (gpe_block) { - for (i = 0; i < gpe_block->register_count; i++) { - status = acpi_hw_low_level_write (8, 0xFF, - &gpe_block->register_info[i].status_address, (u32) i); - if (ACPI_FAILURE (status)) { - goto unlock_and_exit; - } - } - - gpe_block = gpe_block->next; - } + status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block); unlock_and_exit: (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE); diff -urN linux-2.5.66-bk7/drivers/acpi/namespace/nsaccess.c linux-2.5.66-bk8/drivers/acpi/namespace/nsaccess.c --- linux-2.5.66-bk7/drivers/acpi/namespace/nsaccess.c Mon Mar 24 14:01:45 2003 +++ linux-2.5.66-bk8/drivers/acpi/namespace/nsaccess.c Wed Apr 2 04:38:13 2003 @@ -73,6 +73,7 @@ const struct acpi_predefined_names *init_val = NULL; struct acpi_namespace_node *new_node; union acpi_operand_object *obj_desc; + acpi_string val = NULL; ACPI_FUNCTION_TRACE ("ns_root_initialize"); @@ -119,9 +120,7 @@ * initial value, create the initial value. */ if (init_val->val) { - acpi_string val; - - status = acpi_os_predefined_override(init_val, &val); + status = acpi_os_predefined_override (init_val, &val); if (ACPI_FAILURE (status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not override predefined %s\n", init_val->name)); diff -urN linux-2.5.66-bk7/drivers/acpi/namespace/nswalk.c linux-2.5.66-bk8/drivers/acpi/namespace/nswalk.c --- linux-2.5.66-bk7/drivers/acpi/namespace/nswalk.c Mon Mar 24 14:01:49 2003 +++ linux-2.5.66-bk8/drivers/acpi/namespace/nswalk.c Wed Apr 2 04:38:13 2003 @@ -164,6 +164,7 @@ void **return_value) { acpi_status status; + acpi_status mutex_status; struct acpi_namespace_node *child_node; struct acpi_namespace_node *parent_node; acpi_object_type child_type; @@ -211,9 +212,9 @@ * callback function */ if (unlock_before_callback) { - status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + mutex_status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (mutex_status)) { + return_ACPI_STATUS (mutex_status); } } @@ -221,9 +222,9 @@ context, return_value); if (unlock_before_callback) { - status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + mutex_status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (mutex_status)) { + return_ACPI_STATUS (mutex_status); } } diff -urN linux-2.5.66-bk7/drivers/acpi/osl.c linux-2.5.66-bk8/drivers/acpi/osl.c --- linux-2.5.66-bk7/drivers/acpi/osl.c Mon Mar 24 14:01:17 2003 +++ linux-2.5.66-bk8/drivers/acpi/osl.c Wed Apr 2 04:38:13 2003 @@ -581,24 +581,32 @@ acpi_status acpi_os_write_pci_configuration ( - acpi_pci_id *pci_id, - u32 reg, - acpi_integer value, - u32 width) + struct acpi_pci_id *pci_id, + u32 reg, + acpi_integer value, + u32 width) { return (AE_SUPPORT); } acpi_status acpi_os_read_pci_configuration ( - acpi_pci_id *pci_id, - u32 reg, - void *value, - u32 width) + struct acpi_pci_id *pci_id, + u32 reg, + void *value, + u32 width) { return (AE_SUPPORT); } +void +acpi_os_derive_pci_id ( + acpi_handle rhandle, /* upper bound */ + acpi_handle chandle, /* current node */ + struct acpi_pci_id **id) +{ +} + #endif /*CONFIG_ACPI_PCI*/ static void @@ -669,6 +677,92 @@ return_ACPI_STATUS (status); } +/* + * Allocate the memory for a spinlock and initialize it. + */ +acpi_status +acpi_os_create_lock ( + acpi_handle *out_handle) +{ + spinlock_t *lock_ptr; + + ACPI_FUNCTION_TRACE ("os_create_lock"); + + lock_ptr = acpi_os_allocate(sizeof(spinlock_t)); + + spin_lock_init(lock_ptr); + + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Creating spinlock[%p].\n", lock_ptr)); + + *out_handle = lock_ptr; + + return_ACPI_STATUS (AE_OK); +} + + +/* + * Deallocate the memory for a spinlock. + */ +void +acpi_os_delete_lock ( + acpi_handle handle) +{ + ACPI_FUNCTION_TRACE ("os_create_lock"); + + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle)); + + acpi_os_free(handle); + + return_VOID; +} + +/* + * Acquire a spinlock. + * + * handle is a pointer to the spinlock_t. + * flags is *not* the result of save_flags - it is an ACPI-specific flag variable + * that indicates whether we are at interrupt level. + */ +void +acpi_os_acquire_lock ( + acpi_handle handle, + u32 flags) +{ + ACPI_FUNCTION_TRACE ("os_acquire_lock"); + + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquiring spinlock[%p] from %s level\n", handle, + ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt"))); + + if (flags & ACPI_NOT_ISR) + ACPI_DISABLE_IRQS(); + + spin_lock(handle); + + return_VOID; +} + + +/* + * Release a spinlock. See above. + */ +void +acpi_os_release_lock ( + acpi_handle handle, + u32 flags) +{ + ACPI_FUNCTION_TRACE ("os_release_lock"); + + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Releasing spinlock[%p] from %s level\n", handle, + ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt"))); + + spin_unlock(handle); + + if (flags & ACPI_NOT_ISR) + ACPI_ENABLE_IRQS(); + + return_VOID; +} + acpi_status acpi_os_create_semaphore( diff -urN linux-2.5.66-bk7/drivers/acpi/processor.c linux-2.5.66-bk8/drivers/acpi/processor.c --- linux-2.5.66-bk7/drivers/acpi/processor.c Mon Mar 24 14:00:56 2003 +++ linux-2.5.66-bk8/drivers/acpi/processor.c Wed Apr 2 04:38:13 2003 @@ -639,7 +639,7 @@ /* * C2 latency must be less than or equal to 100 microseconds. */ - if (acpi_fadt.plvl2_lat >= ACPI_PROCESSOR_MAX_C2_LATENCY) + if (acpi_fadt.plvl2_lat > ACPI_PROCESSOR_MAX_C2_LATENCY) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "C2 latency too large [%d]\n", acpi_fadt.plvl2_lat)); @@ -673,7 +673,7 @@ /* * C3 latency must be less than or equal to 1000 microseconds. */ - if (acpi_fadt.plvl3_lat >= ACPI_PROCESSOR_MAX_C3_LATENCY) + if (acpi_fadt.plvl3_lat > ACPI_PROCESSOR_MAX_C3_LATENCY) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "C3 latency too large [%d]\n", acpi_fadt.plvl3_lat)); diff -urN linux-2.5.66-bk7/drivers/acpi/resources/rsxface.c linux-2.5.66-bk8/drivers/acpi/resources/rsxface.c --- linux-2.5.66-bk7/drivers/acpi/resources/rsxface.c Mon Mar 24 14:01:11 2003 +++ linux-2.5.66-bk8/drivers/acpi/resources/rsxface.c Wed Apr 2 04:38:13 2003 @@ -240,12 +240,13 @@ struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; struct acpi_resource *resource; + ACPI_FUNCTION_TRACE ("acpi_walk_resources"); if (!device_handle || (ACPI_STRNCMP (path, METHOD_NAME__CRS, sizeof (METHOD_NAME__CRS)) && - ACPI_STRNCMP (path, METHOD_NAME__PRS, sizeof (METHOD_NAME__PRS)))) { + ACPI_STRNCMP (path, METHOD_NAME__PRS, sizeof (METHOD_NAME__PRS)))) { return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -290,10 +291,10 @@ cleanup: acpi_os_free (buffer.pointer); - return_ACPI_STATUS (status); } + /******************************************************************************* * * FUNCTION: acpi_set_current_resources @@ -337,6 +338,7 @@ return_ACPI_STATUS (status); } + #define COPY_FIELD(out, in, field) out->field = in->field #define COPY_ADDRESS(out, in) \ COPY_FIELD(out, in, resource_type); \ @@ -352,48 +354,53 @@ COPY_FIELD(out, in, address_length); \ COPY_FIELD(out, in, resource_source); -/******************************************************************************* -* -* FUNCTION: acpi_resource_to_address64 -* -* PARAMETERS: resource - Pointer to a resource -* out - Pointer to the users's return -* buffer (a struct -* struct acpi_resource_address64) -* -* RETURN: Status -* -* DESCRIPTION: If the resource is an address16, address32, or address64, -* copy it to the address64 return buffer. This saves the -* caller from having to duplicate code for different-sized -* addresses. -* -******************************************************************************/ +/****************************************************************************** + * + * FUNCTION: acpi_resource_to_address64 + * + * PARAMETERS: resource - Pointer to a resource + * out - Pointer to the users's return + * buffer (a struct + * struct acpi_resource_address64) + * + * RETURN: Status + * + * DESCRIPTION: If the resource is an address16, address32, or address64, + * copy it to the address64 return buffer. This saves the + * caller from having to duplicate code for different-sized + * addresses. + * + ******************************************************************************/ acpi_status acpi_resource_to_address64 ( - struct acpi_resource *resource, - struct acpi_resource_address64 *out) + struct acpi_resource *resource, + struct acpi_resource_address64 *out) { - struct acpi_resource_address16 *address16; - struct acpi_resource_address32 *address32; - struct acpi_resource_address64 *address64; + struct acpi_resource_address16 *address16; + struct acpi_resource_address32 *address32; + struct acpi_resource_address64 *address64; + switch (resource->id) { case ACPI_RSTYPE_ADDRESS16: address16 = (struct acpi_resource_address16 *) &resource->data; COPY_ADDRESS(out, address16); break; + case ACPI_RSTYPE_ADDRESS32: address32 = (struct acpi_resource_address32 *) &resource->data; COPY_ADDRESS(out, address32); break; + case ACPI_RSTYPE_ADDRESS64: address64 = (struct acpi_resource_address64 *) &resource->data; COPY_ADDRESS(out, address64); break; + default: return (AE_BAD_PARAMETER); } + return (AE_OK); } diff -urN linux-2.5.66-bk7/drivers/acpi/tables/tbgetall.c linux-2.5.66-bk8/drivers/acpi/tables/tbgetall.c --- linux-2.5.66-bk7/drivers/acpi/tables/tbgetall.c Mon Mar 24 14:01:14 2003 +++ linux-2.5.66-bk8/drivers/acpi/tables/tbgetall.c Wed Apr 2 04:38:13 2003 @@ -228,7 +228,7 @@ * any SSDTs. */ for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { - /* Get the table addresss from the common internal XSDT */ + /* Get the table address from the common internal XSDT */ address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; diff -urN linux-2.5.66-bk7/drivers/acpi/thermal.c linux-2.5.66-bk8/drivers/acpi/thermal.c --- linux-2.5.66-bk7/drivers/acpi/thermal.c Mon Mar 24 14:01:24 2003 +++ linux-2.5.66-bk8/drivers/acpi/thermal.c Wed Apr 2 04:38:13 2003 @@ -39,6 +39,8 @@ #include #include #include +#include + #include #include diff -urN linux-2.5.66-bk7/drivers/acpi/utilities/utdelete.c linux-2.5.66-bk8/drivers/acpi/utilities/utdelete.c --- linux-2.5.66-bk7/drivers/acpi/utilities/utdelete.c Mon Mar 24 14:00:35 2003 +++ linux-2.5.66-bk8/drivers/acpi/utilities/utdelete.c Wed Apr 2 04:38:13 2003 @@ -45,6 +45,7 @@ #include #include #include +#include #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utdelete") @@ -130,6 +131,14 @@ break; + case ACPI_TYPE_DEVICE: + + if (object->device.gpe_block) { + (void) acpi_ev_delete_gpe_block (object->device.gpe_block); + } + break; + + case ACPI_TYPE_MUTEX: ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n", diff -urN linux-2.5.66-bk7/drivers/acpi/utilities/utglobal.c linux-2.5.66-bk8/drivers/acpi/utilities/utglobal.c --- linux-2.5.66-bk7/drivers/acpi/utilities/utglobal.c Mon Mar 24 14:00:01 2003 +++ linux-2.5.66-bk8/drivers/acpi/utilities/utglobal.c Wed Apr 2 04:38:13 2003 @@ -731,7 +731,9 @@ /* GPE support */ - acpi_gbl_gpe_block_list_head = NULL; + acpi_gbl_gpe_xrupt_list_head = NULL; + acpi_gbl_gpe_fadt_blocks[0] = NULL; + acpi_gbl_gpe_fadt_blocks[1] = NULL; /* Global notify handlers */ diff -urN linux-2.5.66-bk7/drivers/acpi/utilities/utinit.c linux-2.5.66-bk8/drivers/acpi/utilities/utinit.c --- linux-2.5.66-bk7/drivers/acpi/utilities/utinit.c Mon Mar 24 14:00:48 2003 +++ linux-2.5.66-bk8/drivers/acpi/utilities/utinit.c Wed Apr 2 04:38:13 2003 @@ -166,20 +166,42 @@ * * RETURN: none * - * DESCRIPTION: free memory allocated for table storage. + * DESCRIPTION: free global memory * ******************************************************************************/ void acpi_ut_terminate (void) { + struct acpi_gpe_block_info *gpe_block; + struct acpi_gpe_block_info *next_gpe_block; + struct acpi_gpe_xrupt_info *gpe_xrupt_info; + struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; + ACPI_FUNCTION_TRACE ("ut_terminate"); /* Free global tables, etc. */ - /* Nothing to do at this time */ + + /* Free global GPE blocks and related info structures */ + + gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; + while (gpe_xrupt_info) { + gpe_block = gpe_xrupt_info->gpe_block_list_head; + while (gpe_block) { + next_gpe_block = gpe_block->next; + ACPI_MEM_FREE (gpe_block->event_info); + ACPI_MEM_FREE (gpe_block->register_info); + ACPI_MEM_FREE (gpe_block); + + gpe_block = next_gpe_block; + } + next_gpe_xrupt_info = gpe_xrupt_info->next; + ACPI_MEM_FREE (gpe_xrupt_info); + gpe_xrupt_info = next_gpe_xrupt_info; + } return_VOID; } diff -urN linux-2.5.66-bk7/drivers/acpi/utilities/utmisc.c linux-2.5.66-bk8/drivers/acpi/utilities/utmisc.c --- linux-2.5.66-bk7/drivers/acpi/utilities/utmisc.c Mon Mar 24 14:00:00 2003 +++ linux-2.5.66-bk8/drivers/acpi/utilities/utmisc.c Wed Apr 2 04:38:13 2003 @@ -556,6 +556,9 @@ } } + + status = acpi_os_create_lock (&acpi_gbl_gpe_lock); + return_ACPI_STATUS (AE_OK); } @@ -589,6 +592,7 @@ (void) acpi_ut_delete_mutex (i); } + (void) acpi_os_delete_lock (acpi_gbl_gpe_lock); return_VOID; } diff -urN linux-2.5.66-bk7/drivers/atm/iphase.c linux-2.5.66-bk8/drivers/atm/iphase.c --- linux-2.5.66-bk7/drivers/atm/iphase.c Wed Apr 2 04:38:03 2003 +++ linux-2.5.66-bk8/drivers/atm/iphase.c Wed Apr 2 04:38:13 2003 @@ -3281,7 +3281,7 @@ .name = DEV_LABEL, .id_table = ia_pci_tbl, .probe = ia_init_one, - .remove = ia_remove_one, + .remove = __devexit_p(ia_remove_one), }; static int __init ia_module_init(void) diff -urN linux-2.5.66-bk7/drivers/block/scsi_ioctl.c linux-2.5.66-bk8/drivers/block/scsi_ioctl.c --- linux-2.5.66-bk7/drivers/block/scsi_ioctl.c Mon Mar 24 14:01:48 2003 +++ linux-2.5.66-bk8/drivers/block/scsi_ioctl.c Wed Apr 2 04:38:13 2003 @@ -45,7 +45,8 @@ #define SCSI_SENSE_BUFFERSIZE 64 #endif -int blk_do_rq(request_queue_t *q, struct block_device *bdev, struct request *rq) +static int blk_do_rq(request_queue_t *q, struct block_device *bdev, + struct request *rq) { DECLARE_COMPLETION(wait); int err = 0; @@ -368,6 +369,7 @@ goto error; switch (opcode) { + case SEND_DIAGNOSTIC: case FORMAT_UNIT: rq->timeout = FORMAT_UNIT_TIMEOUT; break; @@ -398,7 +400,8 @@ if (in_len) rq->flags |= REQ_RW; - err = blk_do_rq(q, bdev, rq); + blk_do_rq(q, bdev, rq); + err = rq->errors & 0xff; /* only 8 bit SCSI status */ if (err) { if (rq->sense_len) if (copy_to_user(sic->data, rq->sense, rq->sense_len)) diff -urN linux-2.5.66-bk7/drivers/cdrom/optcd.c linux-2.5.66-bk8/drivers/cdrom/optcd.c --- linux-2.5.66-bk7/drivers/cdrom/optcd.c Mon Mar 24 14:00:10 2003 +++ linux-2.5.66-bk8/drivers/cdrom/optcd.c Wed Apr 2 04:38:13 2003 @@ -1598,19 +1598,17 @@ } +static struct gendisk *optcd_disk; + + static int cdromread(unsigned long arg, int blocksize, int cmd) { - int status, ret = 0; + int status; struct cdrom_msf msf; - char *buf; if (copy_from_user(&msf, (void *) arg, sizeof msf)) return -EFAULT; - buf = kmalloc(CD_FRAMESIZE_RAWER, GFP_KERNEL); - if (!buf) - return -ENOMEM; - bin2bcd(&msf); msf.cdmsf_min1 = 0; msf.cdmsf_sec1 = 0; @@ -1619,19 +1617,15 @@ DEBUG((DEBUG_VFS, "read cmd status 0x%x", status)); - if (!sleep_flag_low(FL_DTEN, SLEEP_TIMEOUT)) { - ret = -EIO; - goto cdr_free; - } + if (!sleep_flag_low(FL_DTEN, SLEEP_TIMEOUT)) + return -EIO; - fetch_data(buf, blocksize); + fetch_data(optcd_disk->private_data, blocksize); - if (copy_to_user((void *)arg, &buf, blocksize)) - ret = -EFAULT; + if (copy_to_user((void *)arg, optcd_disk->private_data, blocksize)) + return -EFAULT; -cdr_free: - kfree(buf); - return ret; + return 0; } @@ -1857,6 +1851,14 @@ if (!open_count && state == S_IDLE) { int status; + char *buf; + + buf = kmalloc(CD_FRAMESIZE_RAWER, GFP_KERNEL); + if (!buf) { + printk(KERN_INFO "optcd: cannot allocate read buffer\n"); + return -ENOMEM; + } + optcd_disk->private_data = buf; /* save read buffer */ toc_uptodate = 0; opt_invalidate_buffers(); @@ -1922,6 +1924,7 @@ status = exec_cmd(COMOPEN); DEBUG((DEBUG_VFS, "exec_cmd COMOPEN: %02x", -status)); } + kfree(optcd_disk->private_data); del_timer(&delay_timer); del_timer(&req_timer); } @@ -2010,8 +2013,6 @@ #endif /* MODULE */ -static struct gendisk *optcd_disk; - /* Test for presence of drive and initialize it. Called at boot time or during module initialisation. */ static int __init optcd_init(void) diff -urN linux-2.5.66-bk7/drivers/char/pty.c linux-2.5.66-bk8/drivers/char/pty.c --- linux-2.5.66-bk7/drivers/char/pty.c Mon Mar 24 14:00:14 2003 +++ linux-2.5.66-bk8/drivers/char/pty.c Wed Apr 2 04:38:13 2003 @@ -362,6 +362,7 @@ init_waitqueue_head(&pty_state[i].open_wait); memset(&pty_driver, 0, sizeof(struct tty_driver)); pty_driver.magic = TTY_DRIVER_MAGIC; + pty_driver.owner = THIS_MODULE; pty_driver.driver_name = "pty_master"; #ifdef CONFIG_DEVFS_FS pty_driver.name = "pty/m%d"; diff -urN linux-2.5.66-bk7/drivers/char/rio/rio_linux.c linux-2.5.66-bk8/drivers/char/rio/rio_linux.c --- linux-2.5.66-bk7/drivers/char/rio/rio_linux.c Mon Mar 24 14:00:50 2003 +++ linux-2.5.66-bk8/drivers/char/rio/rio_linux.c Wed Apr 2 04:38:13 2003 @@ -1139,7 +1139,6 @@ struct vpd_prom *vpdp; int okboard; - #ifdef CONFIG_PCI #ifndef TWO_ZERO struct pci_dev *pdev = NULL; @@ -1161,8 +1160,16 @@ rio_debug=-1; } + if (misc_register(&rio_fw_device) < 0) { + printk(KERN_ERR "RIO: Unable to register firmware loader driver.\n"); + return -EIO; + } + retval = rio_init_datastructures (); - if (retval < 0) return retval; + if (retval < 0) { + misc_deregister(&rio_fw_device); + return retval; + } #ifdef CONFIG_PCI if (pci_present ()) { @@ -1400,12 +1407,10 @@ if (found) { rio_dprintk (RIO_DEBUG_INIT, "rio: total of %d boards detected.\n", found); - - if (misc_register(&rio_fw_device) < 0) { - printk(KERN_ERR "RIO: Unable to register firmware loader driver.\n"); - return -EIO; - } rio_init_drivers (); + } else { + /* deregister the misc device we created earlier */ + misc_deregister(&rio_fw_device); } func_exit(); diff -urN linux-2.5.66-bk7/drivers/char/sonypi.c linux-2.5.66-bk8/drivers/char/sonypi.c --- linux-2.5.66-bk7/drivers/char/sonypi.c Mon Mar 24 14:01:12 2003 +++ linux-2.5.66-bk8/drivers/char/sonypi.c Wed Apr 2 04:38:13 2003 @@ -532,7 +532,7 @@ ret = -EFAULT; break; case SONYPI_IOCGBAT1REM: - if (ec_read16(SONYPI_BAT1_FULL, &val16)) { + if (ec_read16(SONYPI_BAT1_LEFT, &val16)) { ret = -EIO; break; } @@ -540,7 +540,7 @@ ret = -EFAULT; break; case SONYPI_IOCGBAT2CAP: - if (ec_read16(SONYPI_BAT1_FULL, &val16)) { + if (ec_read16(SONYPI_BAT2_FULL, &val16)) { ret = -EIO; break; } @@ -548,7 +548,7 @@ ret = -EFAULT; break; case SONYPI_IOCGBAT2REM: - if (ec_read16(SONYPI_BAT1_FULL, &val16)) { + if (ec_read16(SONYPI_BAT2_LEFT, &val16)) { ret = -EIO; break; } diff -urN linux-2.5.66-bk7/drivers/char/tty_io.c linux-2.5.66-bk8/drivers/char/tty_io.c --- linux-2.5.66-bk7/drivers/char/tty_io.c Wed Apr 2 04:38:03 2003 +++ linux-2.5.66-bk8/drivers/char/tty_io.c Wed Apr 2 04:38:13 2003 @@ -1662,13 +1662,6 @@ return put_user(real_tty->session, arg); } -static int tiocttygstruct(struct tty_struct *tty, struct tty_struct *arg) -{ - if (copy_to_user(arg, tty, sizeof(*arg))) - return -EFAULT; - return 0; -} - static int tiocsetd(struct tty_struct *tty, int *arg) { int ldisc; @@ -1795,9 +1788,6 @@ case TIOCLINUX: return tioclinux(tty, arg); #endif - case TIOCTTYGSTRUCT: - return tiocttygstruct(tty, (struct tty_struct *) arg); - /* * Break handling */ @@ -2246,6 +2236,7 @@ */ memset(&dev_tty_driver, 0, sizeof(struct tty_driver)); dev_tty_driver.magic = TTY_DRIVER_MAGIC; + dev_tty_driver.owner = THIS_MODULE; dev_tty_driver.driver_name = "/dev/tty"; dev_tty_driver.name = dev_tty_driver.driver_name + 5; dev_tty_driver.name_base = 0; @@ -2259,6 +2250,7 @@ panic("Couldn't register /dev/tty driver\n"); dev_syscons_driver = dev_tty_driver; + dev_syscons_driver.owner = THIS_MODULE; dev_syscons_driver.driver_name = "/dev/console"; dev_syscons_driver.name = dev_syscons_driver.driver_name + 5; dev_syscons_driver.major = TTYAUX_MAJOR; @@ -2271,6 +2263,7 @@ #ifdef CONFIG_UNIX98_PTYS dev_ptmx_driver = dev_tty_driver; + dev_ptmx_driver.owner = THIS_MODULE; dev_ptmx_driver.driver_name = "/dev/ptmx"; dev_ptmx_driver.name = dev_ptmx_driver.driver_name + 5; dev_ptmx_driver.major= TTYAUX_MAJOR; @@ -2284,6 +2277,7 @@ #ifdef CONFIG_VT dev_console_driver = dev_tty_driver; + dev_console_driver.owner = THIS_MODULE; dev_console_driver.driver_name = "/dev/vc/0"; dev_console_driver.name = dev_console_driver.driver_name + 5; dev_console_driver.major = TTY_MAJOR; @@ -2332,9 +2326,6 @@ rs_8xx_init(); #endif /* CONFIG_8xx */ pty_init(); -#ifdef CONFIG_MOXA_SMARTIO - mxser_init(); -#endif #ifdef CONFIG_MOXA_INTELLIO moxa_init(); #endif diff -urN linux-2.5.66-bk7/drivers/char/vt.c linux-2.5.66-bk8/drivers/char/vt.c --- linux-2.5.66-bk7/drivers/char/vt.c Mon Mar 24 14:01:23 2003 +++ linux-2.5.66-bk8/drivers/char/vt.c Wed Apr 2 04:38:13 2003 @@ -2502,6 +2502,7 @@ { memset(&console_driver, 0, sizeof(struct tty_driver)); console_driver.magic = TTY_DRIVER_MAGIC; + console_driver.owner = THIS_MODULE; console_driver.name = "vc/%d"; console_driver.name_base = 1; console_driver.major = TTY_MAJOR; diff -urN linux-2.5.66-bk7/drivers/char/watchdog/indydog.c linux-2.5.66-bk8/drivers/char/watchdog/indydog.c --- linux-2.5.66-bk7/drivers/char/watchdog/indydog.c Mon Mar 24 14:01:43 2003 +++ linux-2.5.66-bk8/drivers/char/watchdog/indydog.c Wed Apr 2 04:38:13 2003 @@ -155,7 +155,7 @@ .fops = &indydog_fops, }; -static const char banner[] __initdata = KERN_INFO "Hardware Watchdog Timer for SGI IP22: 0.2\n"; +static char banner[] __initdata = KERN_INFO "Hardware Watchdog Timer for SGI IP22: 0.2\n"; static int __init watchdog_init(void) { diff -urN linux-2.5.66-bk7/drivers/macintosh/adb.c linux-2.5.66-bk8/drivers/macintosh/adb.c --- linux-2.5.66-bk7/drivers/macintosh/adb.c Mon Mar 24 14:01:52 2003 +++ linux-2.5.66-bk8/drivers/macintosh/adb.c Wed Apr 2 04:38:14 2003 @@ -102,6 +102,7 @@ void (*handler)(unsigned char *, int, struct pt_regs *, int); int original_address; int handler_id; + int busy; } adb_handler[16]; /* @@ -134,7 +135,7 @@ { if (current->pid && adb_probe_task_pid && adb_probe_task_pid == current->pid) { - current->state = TASK_UNINTERRUPTIBLE; + set_task_state(current, TASK_UNINTERRUPTIBLE); schedule_timeout(1 + ms * HZ / 1000); } else mdelay(ms); @@ -249,7 +250,7 @@ strcpy(current->comm, "kadbprobe"); sigfillset(&blocked); - sigprocmask(SIG_BLOCK, &blocked, NULL); + sigprocmask(SIG_BLOCK, &blocked, NULL); flush_signals(current); printk(KERN_INFO "adb: starting probe task...\n"); @@ -550,12 +551,17 @@ down(&adb_handler_sem); write_lock_irq(&adb_handler_lock); if (adb_handler[index].handler) { + while(adb_handler[index].busy) { + write_unlock_irq(&adb_handler_lock); + yield(); + write_lock_irq(&adb_handler_lock); + } ret = 0; adb_handler[index].handler = 0; } write_unlock_irq(&adb_handler_lock); up(&adb_handler_sem); - return 0; + return ret; } void @@ -563,6 +569,8 @@ { int i, id; static int dump_adb_input = 0; + unsigned long flags; + void (*handler)(unsigned char *, int, struct pt_regs *, int); /* We skip keystrokes and mouse moves when the sleep process @@ -578,11 +586,17 @@ printk(" %x", buf[i]); printk(", id = %d\n", id); } - read_lock(&adb_handler_lock); + write_lock_irqsave(&adb_handler_lock, flags); handler = adb_handler[id].handler; - if (handler != 0) + if (handler != NULL) + adb_handler[id].busy = 1; + write_unlock_irqrestore(&adb_handler_lock, flags); + if (handler != NULL) { (*handler)(buf, nb, regs, autopoll); - read_unlock(&adb_handler_lock); + wmb(); + adb_handler[id].busy = 0; + } + } /* Try to change handler to new_id. Will return 1 if successful. */ @@ -671,6 +685,29 @@ spin_unlock_irqrestore(&state->lock, flags); } +static int +do_adb_query(struct adb_request *req) +{ + int ret = -EINVAL; + + switch(req->data[1]) + { + case ADB_QUERY_GETDEVINFO: + if (req->nbytes < 3) + break; + down(&adb_handler_sem); + req->reply[0] = adb_handler[req->data[2]].original_address; + req->reply[1] = adb_handler[req->data[2]].handler_id; + up(&adb_handler_sem); + req->complete = 1; + req->reply_len = 2; + adb_write_done(req); + ret = 0; + break; + } + return ret; +} + static int adb_open(struct inode *inode, struct file *file) { struct adbdev_state *state; @@ -806,24 +843,32 @@ /* If a probe is in progress or we are sleeping, wait for it to complete */ down(&adb_probe_mutex); - up(&adb_probe_mutex); + /* Queries are special requests sent to the ADB driver itself */ + if (req->data[0] == ADB_QUERY) { + if (count > 1) + ret = do_adb_query(req); + else + ret = -EINVAL; + up(&adb_probe_mutex); + } /* Special case for ADB_BUSRESET request, all others are sent to the controller */ - if ((req->data[0] == ADB_PACKET)&&(count > 1) + else if ((req->data[0] == ADB_PACKET)&&(count > 1) &&(req->data[1] == ADB_BUSRESET)) { ret = do_adb_reset_bus(); + up(&adb_probe_mutex); atomic_dec(&state->n_pending); if (ret == 0) ret = count; goto out; } else { req->reply_expected = ((req->data[1] & 0xc) == 0xc); - if (adb_controller && adb_controller->send_request) ret = adb_controller->send_request(req, 0); else ret = -ENXIO; + up(&adb_probe_mutex); } if (ret != 0) { diff -urN linux-2.5.66-bk7/drivers/macintosh/apm_emu.c linux-2.5.66-bk8/drivers/macintosh/apm_emu.c --- linux-2.5.66-bk7/drivers/macintosh/apm_emu.c Mon Mar 24 14:01:43 2003 +++ linux-2.5.66-bk8/drivers/macintosh/apm_emu.c Wed Apr 2 04:38:14 2003 @@ -436,40 +436,40 @@ int percentage = -1; int time_units = -1; int real_count = 0; - int charge = -1; - int current = 0; int i; char * p = buf; char charging = 0; + long charge = -1; + long current = 0; + unsigned long btype = 0; ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0); for (i=0; i 0) { battery_status = 0x03; battery_flag = 0x08; } else if (percentage <= APM_CRITICAL) { diff -urN linux-2.5.66-bk7/drivers/macintosh/macio-adb.c linux-2.5.66-bk8/drivers/macintosh/macio-adb.c --- linux-2.5.66-bk7/drivers/macintosh/macio-adb.c Mon Mar 24 14:01:48 2003 +++ linux-2.5.66-bk8/drivers/macintosh/macio-adb.c Wed Apr 2 04:38:14 2003 @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff -urN linux-2.5.66-bk7/drivers/media/video/saa7111.c linux-2.5.66-bk8/drivers/media/video/saa7111.c --- linux-2.5.66-bk7/drivers/media/video/saa7111.c Wed Apr 2 04:38:03 2003 +++ linux-2.5.66-bk8/drivers/media/video/saa7111.c Wed Apr 2 04:38:14 2003 @@ -63,23 +63,9 @@ static unsigned short normal_i2c[] = { 34>>1, I2C_CLIENT_END }; static unsigned short normal_i2c_range[] = { 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, - .normal_i2c_range = normal_i2c_range, - .probe = probe, - .probe_range = probe_range, - .ignore = ignore, - .ignore_range = ignore_range, - .force = force -}; +I2C_CLIENT_INSMOD; -static struct i2c_client client_template; /* ----------------------------------------------------------------------- */ static int saa7111_attach(struct i2c_adapter *adap, int addr, unsigned short flags, int kind) diff -urN linux-2.5.66-bk7/drivers/net/hamradio/dmascc.c linux-2.5.66-bk8/drivers/net/hamradio/dmascc.c --- linux-2.5.66-bk7/drivers/net/hamradio/dmascc.c Mon Mar 24 14:00:21 2003 +++ linux-2.5.66-bk8/drivers/net/hamradio/dmascc.c Wed Apr 2 04:38:14 2003 @@ -285,9 +285,8 @@ /* Initialization variables */ static int io[MAX_NUM_DEVS] __initdata = { 0, }; -/* Beware! hw[] is also used in cleanup_module(). If __initdata also applies - to modules, we may not declare hw[] as __initdata */ -static struct scc_hardware hw[NUM_TYPES] __initdata = HARDWARE; +/* Beware! hw[] is also used in cleanup_module(). */ +static struct scc_hardware hw[NUM_TYPES] __initdata_or_module = HARDWARE; static char ax25_broadcast[7] __initdata = { 'Q'<<1, 'S'<<1, 'T'<<1, ' '<<1, ' '<<1, ' '<<1, '0'<<1 }; static char ax25_test[7] __initdata = diff -urN linux-2.5.66-bk7/drivers/net/pcnet32.c linux-2.5.66-bk8/drivers/net/pcnet32.c --- linux-2.5.66-bk7/drivers/net/pcnet32.c Mon Mar 24 14:00:12 2003 +++ linux-2.5.66-bk8/drivers/net/pcnet32.c Wed Apr 2 04:38:14 2003 @@ -468,10 +468,13 @@ /* search for PCnet32 VLB cards at known addresses */ for (port = pcnet32_portlist; (ioaddr = *port); port++) { - if (!check_region(ioaddr, PCNET32_TOTAL_SIZE)) { - /* check if there is really a pcnet chip on that ioaddr */ - if ((inb(ioaddr + 14) == 0x57) && (inb(ioaddr + 15) == 0x57)) - pcnet32_probe1(ioaddr, 0, 0, NULL); + if (request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_vlbus")) { + /* check if there is really a pcnet chip on that ioaddr */ + if ((inb(ioaddr + 14) == 0x57) && (inb(ioaddr + 15) == 0x57)) { + pcnet32_probe1(ioaddr, 0, 0, NULL); + } else { + release_region(ioaddr, PCNET32_TOTAL_SIZE); + } } } } @@ -500,6 +503,10 @@ printk(KERN_ERR PFX "architecture does not support 32bit PCI busmaster DMA\n"); return -ENODEV; } + if (request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci") == NULL) { + printk(KERN_ERR PFX "io address range already allocated\n"); + return -EBUSY; + } return pcnet32_probe1(ioaddr, pdev->irq, 1, pdev); } @@ -533,15 +540,19 @@ pcnet32_dwio_reset(ioaddr); if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 && pcnet32_dwio_check(ioaddr)) { a = &pcnet32_dwio; - } else - return -ENODEV; + } else { + release_region(ioaddr, PCNET32_TOTAL_SIZE); + return -ENODEV; + } } chip_version = a->read_csr(ioaddr, 88) | (a->read_csr(ioaddr,89) << 16); if (pcnet32_debug > 2) printk(KERN_INFO " PCnet chip version is %#x.\n", chip_version); - if ((chip_version & 0xfff) != 0x003) - return -ENODEV; + if ((chip_version & 0xfff) != 0x003) { + release_region(ioaddr, PCNET32_TOTAL_SIZE); + return -ENODEV; + } /* initialize variables */ fdx = mii = fset = dxsuflo = ltint = 0; @@ -603,6 +614,7 @@ default: printk(KERN_INFO PFX "PCnet version %#x, no PCnet32 chip.\n", chip_version); + release_region(ioaddr, PCNET32_TOTAL_SIZE); return -ENODEV; } @@ -622,8 +634,10 @@ } dev = alloc_etherdev(0); - if(!dev) - return -ENOMEM; + if(!dev) { + release_region(ioaddr, PCNET32_TOTAL_SIZE); + return -ENOMEM; + } printk(KERN_INFO PFX "%s at %#3lx,", chipname, ioaddr); @@ -691,9 +705,6 @@ } dev->base_addr = ioaddr; - if (request_region(ioaddr, PCNET32_TOTAL_SIZE, chipname) == NULL) - return -EBUSY; - /* pci_alloc_consistent returns page-aligned memory, so we do not have to check the alignment */ if ((lp = pci_alloc_consistent(pdev, sizeof(*lp), &lp_dma_addr)) == NULL) { release_region(ioaddr, PCNET32_TOTAL_SIZE); diff -urN linux-2.5.66-bk7/drivers/net/znet.c linux-2.5.66-bk8/drivers/net/znet.c --- linux-2.5.66-bk7/drivers/net/znet.c Mon Mar 24 13:59:46 2003 +++ linux-2.5.66-bk8/drivers/net/znet.c Wed Apr 2 04:38:14 2003 @@ -107,7 +107,7 @@ /* This include could be elsewhere, since it is not wireless specific */ #include "wireless/i82593.h" -static const char version[] __initdata = "znet.c:v1.02 9/23/94 becker@scyld.com\n"; +static char version[] __initdata = "znet.c:v1.02 9/23/94 becker@scyld.com\n"; #ifndef ZNET_DEBUG #define ZNET_DEBUG 1 diff -urN linux-2.5.66-bk7/drivers/oprofile/buffer_sync.c linux-2.5.66-bk8/drivers/oprofile/buffer_sync.c --- linux-2.5.66-bk7/drivers/oprofile/buffer_sync.c Mon Mar 24 14:00:11 2003 +++ linux-2.5.66-bk8/drivers/oprofile/buffer_sync.c Wed Apr 2 04:38:14 2003 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "oprofile_stats.h" @@ -67,6 +68,19 @@ } +static int module_load_notify(struct notifier_block * self, unsigned long val, void * data) +{ + if (val != MODULE_STATE_COMING) + return 0; + + sync_cpu_buffers(); + down(&buffer_sem); + add_event_entry(ESCAPE_CODE); + add_event_entry(MODULE_LOADED_CODE); + up(&buffer_sem); + return 0; +} + static struct notifier_block exit_task_nb = { .notifier_call = exit_task_notify, }; @@ -79,6 +93,10 @@ .notifier_call = mm_notify, }; +static struct notifier_block module_load_nb = { + .notifier_call = module_load_notify, +}; + int sync_start(void) { @@ -98,9 +116,14 @@ err = profile_event_register(EXEC_UNMAP, &exec_unmap_nb); if (err) goto out3; + err = register_module_notifier(&module_load_nb); + if (err) + goto out4; out: return err; +out4: + profile_event_unregister(EXEC_UNMAP, &exec_unmap_nb); out3: profile_event_unregister(EXIT_MMAP, &exit_mmap_nb); out2: @@ -113,6 +136,7 @@ void sync_stop(void) { + unregister_module_notifier(&module_load_nb); profile_event_unregister(EXIT_TASK, &exit_task_nb); profile_event_unregister(EXIT_MMAP, &exit_mmap_nb); profile_event_unregister(EXEC_UNMAP, &exec_unmap_nb); diff -urN linux-2.5.66-bk7/drivers/oprofile/event_buffer.h linux-2.5.66-bk8/drivers/oprofile/event_buffer.h --- linux-2.5.66-bk7/drivers/oprofile/event_buffer.h Mon Mar 24 14:00:02 2003 +++ linux-2.5.66-bk8/drivers/oprofile/event_buffer.h Wed Apr 2 04:38:14 2003 @@ -24,12 +24,13 @@ * then one of the following codes, then the * relevant data. */ -#define ESCAPE_CODE ~0UL +#define ESCAPE_CODE ~0UL #define CTX_SWITCH_CODE 1 #define CPU_SWITCH_CODE 2 #define COOKIE_SWITCH_CODE 3 #define KERNEL_ENTER_SWITCH_CODE 4 #define KERNEL_EXIT_SWITCH_CODE 5 +#define MODULE_LOADED_CODE 6 /* add data to the event buffer */ void add_event_entry(unsigned long data); diff -urN linux-2.5.66-bk7/drivers/parisc/eisa_eeprom.c linux-2.5.66-bk8/drivers/parisc/eisa_eeprom.c --- linux-2.5.66-bk7/drivers/parisc/eisa_eeprom.c Mon Mar 24 14:01:23 2003 +++ linux-2.5.66-bk8/drivers/parisc/eisa_eeprom.c Wed Apr 2 04:38:14 2003 @@ -96,11 +96,21 @@ int __init eisa_eeprom_init(unsigned long addr) { - if (addr) { - eeprom_addr = addr; - misc_register(&eisa_eeprom_dev); - printk(KERN_INFO "EISA EEPROM at 0x%lx\n", eeprom_addr); + int retval; + + /* XXX why return success when we haven't done anything? */ + if (!addr) + return 0; + + eeprom_addr = addr; + + retval = misc_register(&eisa_eeprom_dev); + if (retval < 0) { + printk(KERN_ERR "EISA EEPROM: cannot register misc device.\n"); + return retval; } + + printk(KERN_INFO "EISA EEPROM at 0x%lx\n", eeprom_addr); return 0; } diff -urN linux-2.5.66-bk7/drivers/pnp/Kconfig linux-2.5.66-bk8/drivers/pnp/Kconfig --- linux-2.5.66-bk7/drivers/pnp/Kconfig Mon Mar 24 14:00:38 2003 +++ linux-2.5.66-bk8/drivers/pnp/Kconfig Wed Apr 2 04:38:14 2003 @@ -47,11 +47,6 @@ Say Y here if you would like support for ISA Plug and Play devices. Some information is in . - This support is also available as a module called isapnp ( = - code which can be inserted in and removed from the running kernel - whenever you want). If you want to compile it as a module, say M - here and read . - If unsure, say Y. config PNPBIOS diff -urN linux-2.5.66-bk7/drivers/s390/char/con3215.c linux-2.5.66-bk8/drivers/s390/char/con3215.c --- linux-2.5.66-bk7/drivers/s390/char/con3215.c Mon Mar 24 14:01:11 2003 +++ linux-2.5.66-bk8/drivers/s390/char/con3215.c Wed Apr 2 04:38:14 2003 @@ -1178,6 +1178,7 @@ memset(&tty3215_driver, 0, sizeof(struct tty_driver)); tty3215_driver.magic = TTY_DRIVER_MAGIC; + tty3215_driver.owner = THIS_MODULE; tty3215_driver.driver_name = "tty3215"; tty3215_driver.name = "ttyS"; tty3215_driver.name_base = 0; diff -urN linux-2.5.66-bk7/drivers/s390/char/sclp_tty.c linux-2.5.66-bk8/drivers/s390/char/sclp_tty.c --- linux-2.5.66-bk7/drivers/s390/char/sclp_tty.c Mon Mar 24 14:00:03 2003 +++ linux-2.5.66-bk8/drivers/s390/char/sclp_tty.c Wed Apr 2 04:38:14 2003 @@ -743,6 +743,7 @@ memset (&sclp_tty_driver, 0, sizeof(struct tty_driver)); sclp_tty_driver.magic = TTY_DRIVER_MAGIC; + sclp_tty_driver.owner = THIS_MODULE; sclp_tty_driver.driver_name = "tty_sclp"; sclp_tty_driver.name = "ttyS"; sclp_tty_driver.name_base = 0; diff -urN linux-2.5.66-bk7/drivers/s390/char/tuball.c linux-2.5.66-bk8/drivers/s390/char/tuball.c --- linux-2.5.66-bk7/drivers/s390/char/tuball.c Mon Mar 24 14:01:18 2003 +++ linux-2.5.66-bk8/drivers/s390/char/tuball.c Wed Apr 2 04:38:14 2003 @@ -218,18 +218,6 @@ } #endif /* Not a MODULE or a MODULE */ -void -tub_inc_use_count(void) -{ - MOD_INC_USE_COUNT; -} - -void -tub_dec_use_count(void) -{ - MOD_DEC_USE_COUNT; -} - static int tub3270_is_ours(s390_dev_info_t *dp) { diff -urN linux-2.5.66-bk7/drivers/s390/char/tubfs.c linux-2.5.66-bk8/drivers/s390/char/tubfs.c --- linux-2.5.66-bk7/drivers/s390/char/tubfs.c Mon Mar 24 14:00:49 2003 +++ linux-2.5.66-bk8/drivers/s390/char/tubfs.c Wed Apr 2 04:38:14 2003 @@ -118,7 +118,6 @@ return -EBUSY; } - tub_inc_use_count(); fp->private_data = ip; tubp->mode = TBM_FS; tubp->intv = fs3270_int; @@ -144,7 +143,6 @@ fs3270_wait(tubp, &flags); tubp->fsopen = 0; tubp->fs_pid = 0; - tub_dec_use_count(); tubp->intv = NULL; tubp->mode = 0; tty3270_refresh(tubp); @@ -165,7 +163,6 @@ fs3270_wait(tubp, &flags); tubp->fsopen = 0; tubp->fs_pid = 0; - tub_dec_use_count(); tubp->intv = NULL; tubp->mode = 0; /*tty3270_refresh(tubp);*/ diff -urN linux-2.5.66-bk7/drivers/s390/char/tubio.h linux-2.5.66-bk8/drivers/s390/char/tubio.h --- linux-2.5.66-bk7/drivers/s390/char/tubio.h Mon Mar 24 14:00:40 2003 +++ linux-2.5.66-bk8/drivers/s390/char/tubio.h Wed Apr 2 04:38:14 2003 @@ -421,8 +421,6 @@ return tubp; } -extern void tub_inc_use_count(void); -extern void tub_dec_use_count(void); extern int tub3270_movedata(bcb_t *, bcb_t *, int); #if 0 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)) diff -urN linux-2.5.66-bk7/drivers/s390/char/tubtty.c linux-2.5.66-bk8/drivers/s390/char/tubtty.c --- linux-2.5.66-bk7/drivers/s390/char/tubtty.c Mon Mar 24 14:01:17 2003 +++ linux-2.5.66-bk8/drivers/s390/char/tubtty.c Wed Apr 2 04:38:14 2003 @@ -80,6 +80,7 @@ /* Initialize for tty driver */ td->magic = TTY_DRIVER_MAGIC; + td->owner = THIS_MODULE; td->driver_name = "tty3270"; td->name = "tty3270"; td->major = IBM_TTY3270_MAJOR; @@ -189,7 +190,6 @@ return -ENODEV; } - tub_inc_use_count(); if ((rc = tty3270_wait(tubp, &flags)) != 0) goto do_fail; if (tubp->lnopen > 0) { @@ -231,7 +231,6 @@ tty3270_aid_fini(tubp); tty3270_rcl_fini(tubp); TUBUNLOCK(tubp->irq, flags); - tub_dec_use_count(); return rc; } @@ -253,7 +252,6 @@ tty3270_rcl_fini(tubp); tty3270_scl_fini(tubp); do_return: - tub_dec_use_count(); TUBUNLOCK(tubp->irq, flags); } diff -urN linux-2.5.66-bk7/drivers/s390/cio/qdio.c linux-2.5.66-bk8/drivers/s390/cio/qdio.c --- linux-2.5.66-bk7/drivers/s390/cio/qdio.c Mon Mar 24 14:00:49 2003 +++ linux-2.5.66-bk8/drivers/s390/cio/qdio.c Wed Apr 2 04:38:14 2003 @@ -65,7 +65,7 @@ /******************** HERE WE GO ***********************************/ -static const char *version="QDIO base support version 2 (" +static const char version[] = "QDIO base support version 2 (" VERSION_QDIO_C "/" VERSION_QDIO_H "/" VERSION_CIO_QDIO_H ")"; #ifdef QDIO_PERFORMANCE_STATS diff -urN linux-2.5.66-bk7/drivers/scsi/Kconfig linux-2.5.66-bk8/drivers/scsi/Kconfig --- linux-2.5.66-bk7/drivers/scsi/Kconfig Mon Mar 24 14:01:25 2003 +++ linux-2.5.66-bk8/drivers/scsi/Kconfig Wed Apr 2 04:38:14 2003 @@ -1715,6 +1715,11 @@ If you have the NEC PC-9801-55 SCSI interface card or compatibles for NEC PC-9801/PC-9821, say Y. +config WD33C93_PIO + bool + depends on SCSI_PC980155 + default y + # bool 'Cyberstorm Mk III SCSI support (EXPERIMENTAL)' CONFIG_CYBERSTORMIII_SCSI # bool 'GVP Turbo 040/060 SCSI support (EXPERIMENTAL)' CONFIG_GVP_TURBO_SCSI endmenu diff -urN linux-2.5.66-bk7/drivers/scsi/Makefile linux-2.5.66-bk8/drivers/scsi/Makefile --- linux-2.5.66-bk7/drivers/scsi/Makefile Mon Mar 24 14:01:17 2003 +++ linux-2.5.66-bk8/drivers/scsi/Makefile Wed Apr 2 04:38:14 2003 @@ -29,6 +29,7 @@ obj-$(CONFIG_A3000_SCSI) += a3000.o wd33c93.o obj-$(CONFIG_A2091_SCSI) += a2091.o wd33c93.o obj-$(CONFIG_GVP11_SCSI) += gvp11.o wd33c93.o +obj-$(CONFIG_SCSI_PC980155) += pc980155.o wd33c93.o obj-$(CONFIG_MVME147_SCSI) += mvme147.o wd33c93.o obj-$(CONFIG_SGIWD93_SCSI) += sgiwd93.o wd33c93.o obj-$(CONFIG_CYBERSTORM_SCSI) += NCR53C9x.o cyberstorm.o diff -urN linux-2.5.66-bk7/drivers/scsi/aha152x.c linux-2.5.66-bk8/drivers/scsi/aha152x.c --- linux-2.5.66-bk7/drivers/scsi/aha152x.c Mon Mar 24 13:59:55 2003 +++ linux-2.5.66-bk8/drivers/scsi/aha152x.c Wed Apr 2 04:38:14 2003 @@ -221,11 +221,6 @@ **************************************************************************/ #include - -#if defined(PCMCIA) -#undef MODULE -#endif - #include #include #include @@ -244,14 +239,16 @@ #include #include #include -#include #include +#include +#include +#include +#include +#include +#include "scsi.h" #include "aha152x.h" -#include -#include -#include /* DEFINES */ @@ -338,11 +335,11 @@ resetting = 0x0400, /* BUS DEVICE RESET is pending */ }; -#if defined(MODULE) MODULE_AUTHOR("Jürgen Fischer"); MODULE_DESCRIPTION(AHA152X_REVID); MODULE_LICENSE("GPL"); +#if defined(MODULE) && !defined(PCMCIA) MODULE_PARM(io, "1-2i"); MODULE_PARM_DESC(io,"base io address of controller"); static int io[] = {0, 0}; @@ -396,6 +393,7 @@ MODULE_PARM_DESC(aha152x1, "parameters for second controller"); static int aha152x1[] = {0, 11, 7, 1, 1, 1, DELAY_DEFAULT, 0, DEBUG_DEFAULT}; #endif /* !defined(AHA152X_DEBUG) */ +#endif /* MODULE && !PCMCIA */ #ifdef __ISAPNP__ static struct isapnp_device_id id_table[] __devinitdata = { @@ -404,28 +402,13 @@ }; MODULE_DEVICE_TABLE(isapnp, id_table); #endif /* ISAPNP */ -#endif /* MODULE */ /* set by aha152x_setup according to the command line */ -static int setup_count = 0; -static int registered_count = 0; -static struct aha152x_setup { - int io_port; - int irq; - int scsiid; - int reconnect; - int parity; - int synchronous; - int delay; - int ext_trans; - int tc1550; -#if defined(AHA152X_DEBUG) - int debug; -#endif - char *conf; -} setup[2]; - +static int setup_count; +static int registered_count; +static struct aha152x_setup setup[2]; static struct Scsi_Host *aha152x_host[2]; +static Scsi_Host_Template aha152x_driver_template; /* * internal states of the host @@ -809,7 +792,7 @@ } #if defined(PCMCIA) || !defined(MODULE) -void aha152x_setup(char *str, int *ints) +static void aha152x_setup(char *str, int *ints) { if(setup_count>=ARRAY_SIZE(setup)) { printk(KERN_ERR "aha152x: you can only configure up to two controllers\n"); @@ -835,10 +818,8 @@ printk(KERN_NOTICE "aha152x: usage: aha152x=[,[," "[,[,[,[,[,]]]]]]]\n"); #endif - return; } else { setup_count++; - return; } } #endif @@ -973,7 +954,142 @@ static struct pnp_dev *pnpdev[2]; static int num_pnpdevs; #endif -int aha152x_detect(Scsi_Host_Template * tpnt) + +struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup) +{ + struct Scsi_Host *shost, *shpnt; + struct aha152x_hostdata *aha; + + /* XXX: shpnt is needed for some broken macros */ + shost = shpnt = scsi_register(&aha152x_driver_template, + sizeof(struct aha152x_hostdata)); + if (!shost) { + printk(KERN_ERR "aha152x: scsi_register failed\n"); + return NULL; + } + + aha = (struct aha152x_hostdata *)&shost->hostdata; + memset(aha, 0, sizeof(*aha)); + + shost->io_port = setup->io_port; + shost->n_io_port = IO_RANGE; + shost->irq = setup->irq; + + if (!setup->tc1550) { + aha->io_port0 = setup->io_port; + aha->io_port1 = setup->io_port; + } else { + aha->io_port0 = setup->io_port+0x10; + aha->io_port1 = setup->io_port-0x10; + } + + spin_lock_init(&aha->lock); + aha->reconnect = setup->reconnect; + aha->synchronous = setup->synchronous; + aha->parity = setup->parity; + aha->delay = setup->delay; + aha->ext_trans = setup->ext_trans; + +#if defined(AHA152X_DEBUG) + aha->debug = setup->debug; +#endif + + SETPORT(SCSIID, setup->scsiid << 4); + shost->this_id = setup->scsiid; + + if (setup->reconnect) + shost->can_queue = AHA152X_MAXQUEUE; + + /* RESET OUT */ + printk("aha152x: resetting bus...\n"); + SETPORT(SCSISEQ, SCSIRSTO); + mdelay(256); + SETPORT(SCSISEQ, 0); + mdelay(DELAY); + + reset_ports(shost); + + printk(KERN_INFO + "aha152x%d%s: " + "vital data: rev=%x, " + "io=0x%03lx (0x%03lx/0x%03lx), " + "irq=%d, " + "scsiid=%d, " + "reconnect=%s, " + "parity=%s, " + "synchronous=%s, " + "delay=%d, " + "extended translation=%s\n", + shost->host_no, setup->tc1550 ? " (tc1550 mode)" : "", + GETPORT(REV) & 0x7, + shost->io_port, aha->io_port0, aha->io_port1, + shost->irq, + shost->this_id, + aha->reconnect ? "enabled" : "disabled", + aha->parity ? "enabled" : "disabled", + aha->synchronous ? "enabled" : "disabled", + aha->delay, + aha->ext_trans ? "enabled" : "disabled"); + + if (!request_region(shost->io_port, IO_RANGE, "aha152x")) + goto out_unregister; + + /* not expecting any interrupts */ + SETPORT(SIMODE0, 0); + SETPORT(SIMODE1, 0); + + if (request_irq(shost->irq, swintr, SA_INTERRUPT|SA_SHIRQ, + "aha152x", shost) < 0) { + printk(KERN_ERR "aha152x%d: driver needs an IRQ.\n", shost->host_no); + goto out_release_region; + } + + aha->swint = 0; + + printk(KERN_INFO "aha152x%d: trying software interrupt, ", + shost->host_no); + SETPORT(DMACNTRL0, SWINT|INTEN); + mdelay(1000); + free_irq(shost->irq, shost); + + if (!aha->swint) { + if (TESTHI(DMASTAT, INTSTAT)) { + printk("lost.\n"); + } else { + printk("failed.\n"); + } + + SETPORT(DMACNTRL0, INTEN); + + printk(KERN_ERR "aha152x%d: IRQ %d possibly wrong. " + "Please verify.\n", shost->host_no, shost->irq); + goto out_release_region; + } + printk("ok.\n"); + + + /* clear interrupts */ + SETPORT(SSTAT0, 0x7f); + SETPORT(SSTAT1, 0xef); + + if (request_irq(shost->irq, intr, SA_INTERRUPT|SA_SHIRQ, + "aha152x", shost) < 0) { + printk(KERN_ERR "aha152x%d: failed to reassign interrupt.\n", + shost->host_no); + goto out_release_region; + } + + aha152x_host[registered_count] = shost; + return shost; /* the pcmcia stub needs the return value; */ + +out_release_region: + release_region(shost->io_port, IO_RANGE); +out_unregister: + scsi_unregister(shost); + return NULL; +} + +static int aha152x_detect(Scsi_Host_Template * tpnt) { int i, j, ok; #if defined(AUTOCONF) @@ -982,10 +1098,6 @@ struct pnp_dev *dev = NULL; #endif #endif - tpnt->proc_name = "aha152x"; - - for (i = 0; i < ARRAY_SIZE(aha152x_host); i++) - aha152x_host[i] = (struct Scsi_Host *) NULL; if (setup_count) { printk(KERN_INFO "aha152x: processing commandline: "); @@ -1040,7 +1152,7 @@ } #endif -#if defined(MODULE) +#if defined(MODULE) && !defined(PCMCIA) if (setup_countio_port = setup[i].io_port; - shpnt->n_io_port = IO_RANGE; - shpnt->irq = setup[i].irq; - - if(!setup[i].tc1550) { - HOSTIOPORT0 = setup[i].io_port; - HOSTIOPORT1 = setup[i].io_port; - } else { - HOSTIOPORT0 = setup[i].io_port+0x10; - HOSTIOPORT1 = setup[i].io_port-0x10; - } - - ISSUE_SC = 0; - CURRENT_SC = 0; - DONE_SC = 0; - DISCONNECTED_SC = 0; - - QLOCK = SPIN_LOCK_UNLOCKED; - - STATE = 0; - PREVSTATE = 0; - LASTSTATE = 0; - - MSGILEN = 0; - MSGOLEN = 0; - - RECONNECT = setup[i].reconnect; - SYNCHRONOUS = setup[i].synchronous; - PARITY = setup[i].parity; - DELAY = setup[i].delay; - EXT_TRANS = setup[i].ext_trans; -#if defined(AHA152X_DEBUG) - HOSTDATA(shpnt)->debug = setup[i].debug; -#endif - HOSTDATA(shpnt)->in_intr = 0; - HOSTDATA(shpnt)->commands = 0; - -#if defined(AHA152X_STAT) - HOSTDATA(shpnt)->total_commands=0; - HOSTDATA(shpnt)->disconnections=0; - HOSTDATA(shpnt)->busfree_without_any_action=0; - HOSTDATA(shpnt)->busfree_without_old_command=0; - HOSTDATA(shpnt)->busfree_without_new_command=0; - HOSTDATA(shpnt)->busfree_without_done_command=0; - HOSTDATA(shpnt)->busfree_with_check_condition=0; - for (j = idle; jcount[j]=0; - HOSTDATA(shpnt)->count_trans[j]=0; - HOSTDATA(shpnt)->time[j]=0; - } -#endif - - for (j = 0; j < 8; j++) { - HOSTDATA(shpnt)->syncrate[j] = 0; - HOSTDATA(shpnt)->syncneg[j] = 0; - } - - SETPORT(SCSIID, setup[i].scsiid << 4); - shpnt->this_id = setup[i].scsiid; - - if (setup[i].reconnect) - shpnt->can_queue = AHA152X_MAXQUEUE; - - /* RESET OUT */ - printk("aha152x: resetting bus...\n"); - SETPORT(SCSISEQ, SCSIRSTO); - mdelay(256); - SETPORT(SCSISEQ, 0); - mdelay(DELAY); - - reset_ports(shpnt); - - printk(KERN_INFO - "aha152x%d%s: " - "vital data: rev=%x, " - "io=0x%03lx (0x%03lx/0x%03lx), " - "irq=%d, " - "scsiid=%d, " - "reconnect=%s, " - "parity=%s, " - "synchronous=%s, " - "delay=%d, " - "extended translation=%s\n", - HOSTNO, setup[i].tc1550 ? " (tc1550 mode)" : "", - GETPORT(REV) & 0x7, - shpnt->io_port, HOSTIOPORT0, HOSTIOPORT1, - shpnt->irq, - shpnt->this_id, - RECONNECT ? "enabled" : "disabled", - PARITY ? "enabled" : "disabled", - SYNCHRONOUS ? "enabled" : "disabled", - DELAY, - EXT_TRANS ? "enabled" : "disabled"); - - request_region(shpnt->io_port, IO_RANGE, "aha152x"); - - /* not expecting any interrupts */ - SETPORT(SIMODE0, 0); - SETPORT(SIMODE1, 0); - - ok = request_irq(shpnt->irq, swintr, SA_INTERRUPT|SA_SHIRQ, "aha152x", shpnt); - if (ok < 0) { - if (ok==-EINVAL) - printk(KERN_ERR "aha152x%d: bad IRQ %d.\n", HOSTNO, shpnt->irq); - else if(ok==-EBUSY) - printk(KERN_ERR "aha152x%d: IRQ %d already in use.\n", HOSTNO, shpnt->irq); - else - printk(KERN_ERR "aha152x%d: Unexpected error code %d on requesting IRQ %d.\n", HOSTNO, ok, shpnt->irq); - - printk(KERN_ERR "aha152x%d: driver needs an IRQ.\n", HOSTNO); - - scsi_unregister(shpnt); - registered_count--; - release_region(shpnt->io_port, IO_RANGE); - aha152x_host[registered_count] = 0; - shpnt = 0; - continue; - } - HOSTDATA(shpnt)->swint = 0; - - printk(KERN_INFO "aha152x%d: trying software interrupt, ", HOSTNO); - SETPORT(DMACNTRL0, SWINT|INTEN); - mdelay(1000); - free_irq(shpnt->irq, shpnt); - - if (!HOSTDATA(shpnt)->swint) { - if (TESTHI(DMASTAT, INTSTAT)) { - printk("lost.\n"); - } else { - printk("failed.\n"); - } - - SETPORT(DMACNTRL0, INTEN); - - printk(KERN_ERR "aha152x%d: IRQ %d possibly wrong. Please verify.\n", HOSTNO, shpnt->irq); - - registered_count--; - release_region(shpnt->io_port, IO_RANGE); - aha152x_host[registered_count] = 0; - scsi_unregister(shpnt); - shpnt=NULL; - continue; - } - printk("ok.\n"); - - - /* clear interrupts */ - SETPORT(SSTAT0, 0x7f); - SETPORT(SSTAT1, 0xef); - - if (request_irq(shpnt->irq, intr, SA_INTERRUPT|SA_SHIRQ, "aha152x", shpnt) < 0) { - printk(KERN_ERR "aha152x%d: failed to reassign interrupt.\n", HOSTNO); - - registered_count--; - release_region(shpnt->io_port, IO_RANGE); - aha152x_host[registered_count] = 0; - scsi_unregister(shpnt); - shpnt=NULL; - continue; - } + aha152x_probe_one(&setup[i]); + if (aha152x_host[registered_count]) + registered_count++; } return registered_count>0; } -int aha152x_release(struct Scsi_Host *shpnt) +static int aha152x_release(struct Scsi_Host *shpnt) { if (shpnt->irq) free_irq(shpnt->irq, shpnt); @@ -1474,7 +1417,7 @@ /* * Queue a command and setup interrupts for a free bus. */ -int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct semaphore *sem, int phase, Scsi_Cmnd *done_SC, void (*done)(Scsi_Cmnd *)) +static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct semaphore *sem, int phase, Scsi_Cmnd *done_SC, void (*done)(Scsi_Cmnd *)) { struct Scsi_Host *shpnt = SCpnt->device->host; unsigned long flags; @@ -1543,7 +1486,7 @@ return 0; } -int aha152x_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) +static int aha152x_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) { #if 0 if(*SCpnt->cmnd == REQUEST_SENSE) { @@ -1562,7 +1505,7 @@ * run a command * */ -void internal_done(Scsi_Cmnd *SCpnt) +static void internal_done(Scsi_Cmnd *SCpnt) { #if 0 struct Scsi_Host *shpnt = SCpnt->host; @@ -1573,7 +1516,7 @@ up(SCSEM(SCpnt)); } -int aha152x_command(Scsi_Cmnd * SCpnt) +static int aha152x_command(Scsi_Cmnd * SCpnt) { DECLARE_MUTEX_LOCKED(sem); @@ -1587,7 +1530,7 @@ * Abort a command * */ -int aha152x_abort(Scsi_Cmnd *SCpnt) +static int aha152x_abort(Scsi_Cmnd *SCpnt) { struct Scsi_Host *shpnt = SCpnt->device->host; Scsi_Cmnd *ptr; @@ -1661,7 +1604,7 @@ * FIXME: never seen this live. might lockup... * */ -int aha152x_device_reset(Scsi_Cmnd * SCpnt) +static int aha152x_device_reset(Scsi_Cmnd * SCpnt) { struct Scsi_Host *shpnt = SCpnt->device->host; DECLARE_MUTEX_LOCKED(sem); @@ -1719,7 +1662,7 @@ return ret; } -void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs) +static void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs) { Scsi_Cmnd *ptr; unsigned long flags; @@ -1748,7 +1691,7 @@ * Reset the bus * */ -int aha152x_bus_reset(Scsi_Cmnd *SCpnt) +static int aha152x_bus_reset(Scsi_Cmnd *SCpnt) { struct Scsi_Host *shpnt = SCpnt->device->host; unsigned long flags; @@ -1843,7 +1786,7 @@ * Return the "logical geometry" * */ -int aha152x_biosparam(struct scsi_device *sdev, struct block_device *bdev, +static int aha152x_biosparam(struct scsi_device *sdev, struct block_device *bdev, sector_t capacity, int *info_array) { struct Scsi_Host *shpnt = sdev->host; @@ -3744,7 +3687,7 @@ return (pos - start); } -int aha152x_set_info(char *buffer, int length, struct Scsi_Host *shpnt) +static int aha152x_set_info(char *buffer, int length, struct Scsi_Host *shpnt) { if(!shpnt || !buffer || length<8 || strncmp("aha152x ", buffer, 8)!=0) return -EINVAL; @@ -3791,7 +3734,7 @@ #define SPRINTF(args...) \ do { if(pos < buffer + length) pos += sprintf(pos, ## args); } while(0) -int aha152x_proc_info(char *buffer, char **start, +static int aha152x_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout) { int i; @@ -3935,7 +3878,28 @@ return thislength < length ? thislength : length; } -/* Eventually this will go into an include file, but this will be later */ -static Scsi_Host_Template driver_template = AHA152X; +static Scsi_Host_Template aha152x_driver_template = { + .module = THIS_MODULE, + .name = AHA152X_REVID, + .proc_name = "aha152x", + .proc_info = aha152x_proc_info, + .detect = aha152x_detect, + .command = aha152x_command, + .queuecommand = aha152x_queue, + .eh_abort_handler = aha152x_abort, + .eh_device_reset_handler = aha152x_device_reset, + .eh_bus_reset_handler = aha152x_bus_reset, + .eh_host_reset_handler = aha152x_host_reset, + .release = aha152x_release, + .bios_param = aha152x_biosparam, + .can_queue = 1, + .this_id = 7, + .sg_tablesize = SG_ALL, + .cmd_per_lun = 1, + .use_clustering = DISABLE_CLUSTERING, +}; +#ifndef PCMCIA +#define driver_template aha152x_driver_template #include "scsi_module.c" +#endif diff -urN linux-2.5.66-bk7/drivers/scsi/aha152x.h linux-2.5.66-bk8/drivers/scsi/aha152x.h --- linux-2.5.66-bk7/drivers/scsi/aha152x.h Mon Mar 24 14:00:54 2003 +++ linux-2.5.66-bk8/drivers/scsi/aha152x.h Wed Apr 2 04:38:14 2003 @@ -5,54 +5,12 @@ * $Id: aha152x.h,v 2.5 2002/04/14 11:24:12 fischer Exp $ */ -#if defined(__KERNEL__) - -#include -#include "scsi.h" -#include -#include - -int aha152x_detect(Scsi_Host_Template *); -int aha152x_command(Scsi_Cmnd *); -int aha152x_queue(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); -int aha152x_abort(Scsi_Cmnd *); -int aha152x_release(struct Scsi_Host *shpnt); -int aha152x_device_reset(Scsi_Cmnd *); -int aha152x_bus_reset(Scsi_Cmnd *); -int aha152x_host_reset(Scsi_Cmnd *); -int aha152x_biosparam(struct scsi_device *, struct block_device *, - sector_t, int*); -int aha152x_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout); - /* number of queueable commands (unless we support more than 1 cmd_per_lun this should do) */ #define AHA152X_MAXQUEUE 7 #define AHA152X_REVID "Adaptec 152x SCSI driver; $Revision: 2.5 $" -/* Initial value of Scsi_Host entry */ -#define AHA152X { .proc_name = "aha152x", \ - .proc_info = aha152x_proc_info, \ - .name = AHA152X_REVID, \ - .detect = aha152x_detect, \ - .command = aha152x_command, \ - .queuecommand = aha152x_queue, \ - .eh_abort_handler = aha152x_abort, \ - .eh_device_reset_handler = aha152x_device_reset, \ - .eh_bus_reset_handler = aha152x_bus_reset, \ - .eh_host_reset_handler = aha152x_host_reset, \ - .release = aha152x_release, \ - .bios_param = aha152x_biosparam, \ - .can_queue = 1, \ - .this_id = 7, \ - .sg_tablesize = SG_ALL, \ - .cmd_per_lun = 1, \ - .present = 0, \ - .unchecked_isa_dma = 0, \ - .use_clustering = DISABLE_CLUSTERING } -#endif - - /* port addresses */ #define SCSISEQ (HOSTIOPORT0+0x00) /* SCSI sequence control */ #define SXFRCTL0 (HOSTIOPORT0+0x01) /* SCSI transfer control 0 */ @@ -355,4 +313,24 @@ }; #endif +/* for the pcmcia stub */ +struct aha152x_setup { + int io_port; + int irq; + int scsiid; + int reconnect; + int parity; + int synchronous; + int delay; + int ext_trans; + int tc1550; +#if defined(AHA152X_DEBUG) + int debug; +#endif + char *conf; +}; + +struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *); +int aha152x_host_reset(struct scsi_cmnd *); + #endif /* _AHA152X_H */ diff -urN linux-2.5.66-bk7/drivers/scsi/pc980155.c linux-2.5.66-bk8/drivers/scsi/pc980155.c --- linux-2.5.66-bk7/drivers/scsi/pc980155.c Wed Dec 31 16:00:00 1969 +++ linux-2.5.66-bk8/drivers/scsi/pc980155.c Wed Apr 2 04:38:14 2003 @@ -0,0 +1,299 @@ +/* + * + * drivers/scsi/pc980155.c + * + * PC-9801-55 SCSI host adapter driver + * + * Copyright (C) 1997-2003 Kyoto University Microcomputer Club + * (Linux/98 project) + * Tomoharu Ugawa + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "scsi.h" +#include "hosts.h" +#include "wd33c93.h" +#include "pc980155.h" + +extern int pc98_bios_param(struct scsi_device *, struct block_device *, + sector_t, int *); +static int scsi_pc980155_detect(Scsi_Host_Template *); +static int scsi_pc980155_release(struct Scsi_Host *); + +#ifndef CMD_PER_LUN +#define CMD_PER_LUN 2 +#endif + +#ifndef CAN_QUEUE +#define CAN_QUEUE 16 +#endif + +#undef PC_9801_55_DEBUG +#undef PC_9801_55_DEBUG_VERBOSE + +#define NR_BASE_IOS 4 +static int nr_base_ios = NR_BASE_IOS; +static unsigned int base_ios[NR_BASE_IOS] = {0xcc0, 0xcd0, 0xce0, 0xcf0}; +static wd33c93_regs init_regs; +static int io; + +static struct Scsi_Host *pc980155_host = NULL; + +static void pc980155_intr_handle(int irq, void *dev_id, struct pt_regs *regp); + +static inline void pc980155_dma_enable(unsigned int base_io) +{ + outb(0x01, REG_CWRITE); +} + +static inline void pc980155_dma_disable(unsigned int base_io) +{ + outb(0x02, REG_CWRITE); +} + + +static void pc980155_intr_handle(int irq, void *dev_id, struct pt_regs *regp) +{ + wd33c93_intr(pc980155_host); +} + +static int dma_setup(Scsi_Cmnd *sc, int dir_in) +{ + /* + * sc->SCp.this_residual : transfer count + * sc->SCp.ptr : distination address (virtual address) + * dir_in : data direction (DATA_OUT_DIR:0 or DATA_IN_DIR:1) + * + * if success return 0 + */ + + /* + * DMA WRITE MODE + * bit 7,6 01b single mode (this mode only) + * bit 5 inc/dec (default:0 = inc) + * bit 4 auto initialize (normaly:0 = off) + * bit 3,2 01b memory -> io + * 10b io -> memory + * 00b verify + * bit 1,0 channel + */ + disable_dma(sc->device->host->dma_channel); + set_dma_mode(sc->device->host->dma_channel, + 0x40 | (dir_in ? 0x04 : 0x08)); + clear_dma_ff(sc->device->host->dma_channel); + set_dma_addr(sc->device->host->dma_channel, virt_to_phys(sc->SCp.ptr)); + set_dma_count(sc->device->host->dma_channel, sc->SCp.this_residual); +#ifdef PC_9801_55_DEBUG + printk("D%d(%x)D", sc->device->host->dma_channel, + sc->SCp.this_residual); +#endif + enable_dma(sc->device->host->dma_channel); + pc980155_dma_enable(sc->device->host->io_port); + return 0; +} + +static void dma_stop(struct Scsi_Host *instance, Scsi_Cmnd *sc, int status) +{ + /* + * instance: Hostadapter's instance + * sc: scsi command + * status: True if success + */ + pc980155_dma_disable(sc->device->host->io_port); + disable_dma(sc->device->host->dma_channel); +} + +/* return non-zero on detection */ +static inline int pc980155_test_port(wd33c93_regs regs) +{ + /* Quick and dirty test for presence of the card. */ + if (inb(regs.SASR) == 0xff) + return 0; + + return 1; +} + +static inline int pc980155_getconfig(unsigned int base_io, wd33c93_regs regs, + unsigned char* irq, unsigned char* dma, + unsigned char* scsi_id) +{ + static unsigned char irqs[] = {3, 5, 6, 9, 12, 13}; + unsigned char result; + + printk(KERN_DEBUG "PC-9801-55: base_io=%x SASR=%x SCMD=%x\n", + base_io, regs.SASR, regs.SCMD); + result = read_pc980155_resetint(regs); + printk(KERN_DEBUG "PC-9801-55: getting config (%x)\n", result); + *scsi_id = result & 0x07; + *irq = (result >> 3) & 0x07; + if (*irq > 5) { + printk(KERN_ERR "PC-9801-55 (base %#x): impossible IRQ (%d)" + " - other device here?\n", base_io, *irq); + return 0; + } + + *irq = irqs[*irq]; + result = inb(REG_STATRD); + *dma = result & 0x03; + if (*dma == 1) { + printk(KERN_ERR + "PC-9801-55 (base %#x): impossible DMA channl (%d)" + " - other device here?\n", base_io, *dma); + return 0; + } +#ifdef PC_9801_55_DEBUG + printk("PC-9801-55: end of getconfig\n"); +#endif + return 1; +} + +/* return non-zero on detection */ +static int scsi_pc980155_detect(Scsi_Host_Template* tpnt) +{ + unsigned int base_io; + unsigned char irq, dma, scsi_id; + int i; +#ifdef PC_9801_55_DEBUG + unsigned char debug; +#endif + + if (io) { + base_ios[0] = io; + nr_base_ios = 1; + } + + for (i = 0; i < nr_base_ios; i++) { + base_io = base_ios[i]; + init_regs.SASR = REG_ADDRST; + init_regs.SCMD = REG_CONTRL; +#ifdef PC_9801_55_DEBUG + printk("PC-9801-55: SASR(%x = %x)\n", SASR, REG_ADDRST); +#endif + if (!request_region(base_io, 6, "PC-9801-55")) + continue; + + if (pc980155_test_port(init_regs) && + pc980155_getconfig(base_io, init_regs, + &irq, &dma, &scsi_id)) + goto found; + + release_region(base_io, 6); + } + + printk("PC-9801-55: not found\n"); + return 0; + + found: +#ifdef PC_9801_55_DEBUG + printk("PC-9801-55: config: base io = %x, irq = %d, dma channel = %d, scsi id = %d\n", base_io, irq, dma, scsi_id); +#endif + if (request_irq(irq, pc980155_intr_handle, 0, "PC-9801-55", NULL)) { + printk(KERN_ERR "PC-9801-55: unable to allocate IRQ %d\n", irq); + goto err1; + } + + if (request_dma(dma, "PC-9801-55")) { + printk(KERN_ERR "PC-9801-55: unable to allocate DMA channel %d\n", dma); + goto err2; + } + + pc980155_host = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); + if (pc980155_host) { + pc980155_host->this_id = scsi_id; + pc980155_host->io_port = base_io; + pc980155_host->n_io_port = 6; + pc980155_host->irq = irq; + pc980155_host->dma_channel = dma; + printk("PC-9801-55: scsi host found at %x irq = %d, use dma channel %d.\n", base_io, irq, dma); + pc980155_int_enable(init_regs); + wd33c93_init(pc980155_host, init_regs, dma_setup, dma_stop, + WD33C93_FS_12_15); + return 1; + } + + printk(KERN_ERR "PC-9801-55: failed to register device\n"); + +err2: + free_irq(irq, NULL); +err1: + release_region(base_io, 6); + return 0; +} + +static int scsi_pc980155_release(struct Scsi_Host *shost) +{ + struct WD33C93_hostdata *hostdata + = (struct WD33C93_hostdata *)shost->hostdata; + + pc980155_int_disable(hostdata->regs); + release_region(shost->io_port, shost->n_io_port); + free_irq(shost->irq, NULL); + free_dma(shost->dma_channel); + wd33c93_release(); + return 1; +} + +static int pc980155_bus_reset(Scsi_Cmnd *cmd) +{ + struct WD33C93_hostdata *hostdata + = (struct WD33C93_hostdata *)cmd->device->host->hostdata; + + pc980155_int_disable(hostdata->regs); + pc980155_assert_bus_reset(hostdata->regs); + udelay(50); + pc980155_negate_bus_reset(hostdata->regs); + (void) inb(hostdata->regs.SASR); + (void) read_pc980155(hostdata->regs, WD_SCSI_STATUS); + pc980155_int_enable(hostdata->regs); + wd33c93_host_reset(cmd); + return SUCCESS; +} + + +#ifndef MODULE +static int __init pc980155_setup(char *str) +{ + int ints[4]; + + str = get_options(str, ARRAY_SIZE(ints), ints); + if (ints[0] > 0) + io = ints[1]; + return 1; +} +__setup("pc980155_io=", pc980155_setup); +#endif + +MODULE_PARM(io, "i"); +MODULE_AUTHOR("Tomoharu Ugawa "); +MODULE_DESCRIPTION("PC-9801-55 SCSI host adapter driver"); +MODULE_LICENSE("GPL"); + +static Scsi_Host_Template driver_template = { + .proc_info = wd33c93_proc_info, + .name = "SCSI PC-9801-55", + .detect = scsi_pc980155_detect, + .release = scsi_pc980155_release, + .queuecommand = wd33c93_queuecommand, + .eh_abort_handler = wd33c93_abort, + .eh_bus_reset_handler = pc980155_bus_reset, + .eh_host_reset_handler = wd33c93_host_reset, + .bios_param = pc98_bios_param, + .can_queue = CAN_QUEUE, + .this_id = 7, + .sg_tablesize = SG_ALL, + .cmd_per_lun = CMD_PER_LUN, /* dont use link command */ + .unchecked_isa_dma = 1, /* use dma **XXXX***/ + .use_clustering = ENABLE_CLUSTERING, + .proc_name = "PC_9801_55", +}; + +#include "scsi_module.c" diff -urN linux-2.5.66-bk7/drivers/scsi/pc980155.h linux-2.5.66-bk8/drivers/scsi/pc980155.h --- linux-2.5.66-bk7/drivers/scsi/pc980155.h Wed Dec 31 16:00:00 1969 +++ linux-2.5.66-bk8/drivers/scsi/pc980155.h Wed Apr 2 04:38:14 2003 @@ -0,0 +1,52 @@ +/* + * + * drivers/scsi/pc980155.h + * + * PC-9801-55 SCSI host adapter driver + * + * Copyright (C) 1997-2003 Kyoto University Microcomputer Club + * (Linux/98 project) + * Tomoharu Ugawa + * + */ + +#ifndef __PC980155_H +#define __PC980155_H + +#include "wd33c93.h" + +#define REG_ADDRST (base_io) +#define REG_CONTRL (base_io + 2) +#define REG_CWRITE (base_io + 4) +#define REG_STATRD (base_io + 4) + +#define WD_MEMORYBANK 0x30 +#define WD_RESETINT 0x33 + +static inline uchar read_pc980155(const wd33c93_regs regs, uchar reg_num) +{ + outb(reg_num, regs.SASR); + return (uchar)inb(regs.SCMD); +} + +static inline void write_memorybank(const wd33c93_regs regs, uchar value) +{ + outb(WD_MEMORYBANK, regs.SASR); + outb(value, regs.SCMD); +} + +#define read_pc980155_resetint(regs) \ + read_pc980155((regs), WD_RESETINT) +#define pc980155_int_enable(regs) \ + write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) | 0x04) + +#define pc980155_int_disable(regs) \ + write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) & ~0x04) + +#define pc980155_assert_bus_reset(regs) \ + write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) | 0x02) + +#define pc980155_negate_bus_reset(regs) \ + write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) & ~0x02) + +#endif /* __PC980155_H */ diff -urN linux-2.5.66-bk7/drivers/scsi/pcmcia/aha152x_stub.c linux-2.5.66-bk8/drivers/scsi/pcmcia/aha152x_stub.c --- linux-2.5.66-bk7/drivers/scsi/pcmcia/aha152x_stub.c Mon Mar 24 14:01:24 2003 +++ linux-2.5.66-bk8/drivers/scsi/pcmcia/aha152x_stub.c Wed Apr 2 04:38:14 2003 @@ -49,6 +49,7 @@ #include "scsi.h" #include "hosts.h" +#include "aha152x.h" #include #include @@ -102,8 +103,6 @@ dev_node_t node[8]; } scsi_info_t; -extern void aha152x_setup(char *str, int *ints); - static void aha152x_release_cs(u_long arg); static int aha152x_event(event_t event, int priority, event_callback_args_t *args); @@ -111,11 +110,7 @@ static dev_link_t *aha152x_attach(void); static void aha152x_detach(dev_link_t *); -#define driver_template aha152x_driver_template -extern Scsi_Host_Template aha152x_driver_template; - -static dev_link_t *dev_list = NULL; - +static dev_link_t *dev_list; static dev_info_t dev_info = "aha152x_cs"; /*====================================================================*/ @@ -227,11 +222,12 @@ { client_handle_t handle = link->handle; scsi_info_t *info = link->priv; + struct aha152x_setup s; tuple_t tuple; cisparse_t parse; - int i, last_ret, last_fn, ints[8]; + int i, last_ret, last_fn; u_char tuple_data[64]; - Scsi_Device *dev; + struct scsi_device *dev; dev_node_t *node, **tail; struct Scsi_Host *host; @@ -247,7 +243,6 @@ link->conf.ConfigBase = parse.config.base; /* Configure card */ - driver_template.module = &__this_module; link->state |= DEV_CONFIG; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; @@ -276,29 +271,32 @@ /* A bad hack... */ release_region(link->io.BasePort1, link->io.NumPorts1); - + /* Set configuration options for the aha152x driver */ - ints[0] = 7; - ints[1] = link->io.BasePort1; - ints[2] = link->irq.AssignedIRQ; - ints[3] = host_id; - ints[4] = reconnect; - ints[5] = parity; - ints[6] = synchronous; - ints[7] = reset_delay; - if (ext_trans) { - ints[8] = ext_trans; ints[0] = 8; - } - aha152x_setup("PCMCIA setup", ints); - - scsi_register_host(&driver_template); + memset(&s, 0, sizeof(s)); + s.conf = "PCMCIA setup"; + s.io_port = link->io.BasePort1; + s.irq = link->irq.AssignedIRQ; + s.scsiid = host_id; + s.reconnect = reconnect; + s.parity = parity; + s.synchronous = synchronous; + s.delay = reset_delay; + if (ext_trans) + s.ext_trans = ext_trans; tail = &link->dev; info->ndev = 0; - for (host = scsi_host_get_next(NULL); host; - host = scsi_host_get_next(host)) - if (host->hostt == &driver_template) - list_for_each_entry (dev, &host->my_devices, siblings) { + + host = aha152x_probe_one(&s); + if (host == NULL) { + printk(KERN_INFO "aha152x_cs: no SCSI devices found\n"); + goto cs_failed; + } + + scsi_add_host(host, NULL); + + list_for_each_entry(dev, &host->my_devices, siblings) { u_long arg[2], id; kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg); id = (arg[0]&0x0f) + ((arg[0]>>4)&0xf0) + @@ -328,11 +326,9 @@ *tail = node; tail = &node->next; info->ndev++; info->host = dev->host; - } + } + *tail = NULL; - if (info->ndev == 0) - printk(KERN_INFO "aha152x_cs: no SCSI devices found\n"); - link->state &= ~DEV_CONFIG_PENDING; return; @@ -340,41 +336,26 @@ cs_error(link->handle, last_fn, last_ret); aha152x_release_cs((u_long)link); return; - -} /* aha152x_config_cs */ - -/*====================================================================*/ +} static void aha152x_release_cs(u_long arg) { - dev_link_t *link = (dev_link_t *)arg; - - DEBUG(0, "aha152x_release_cs(0x%p)\n", link); + dev_link_t *link = (dev_link_t *)arg; + scsi_info_t *info = link->priv; -#warning This does not protect you. You need some real fix for your races. -#if 0 - if (GET_USE_COUNT(driver_template.module) != 0) { - DEBUG(1, "aha152x_cs: release postponed, " - "device still open\n"); - link->state |= DEV_STALE_CONFIG; - return; - } -#endif - - scsi_unregister_host(&driver_template); - link->dev = NULL; + scsi_remove_host(info->host); + link->dev = NULL; - CardServices(ReleaseConfiguration, link->handle); - CardServices(ReleaseIO, link->handle, &link->io); - CardServices(ReleaseIRQ, link->handle, &link->irq); - - link->state &= ~DEV_CONFIG; - if (link->state & DEV_STALE_LINK) - aha152x_detach(link); + CardServices(ReleaseConfiguration, link->handle); + CardServices(ReleaseIO, link->handle, &link->io); + CardServices(ReleaseIRQ, link->handle, &link->irq); -} /* aha152x_release_cs */ + link->state &= ~DEV_CONFIG; + scsi_unregister(info->host); -/*====================================================================*/ + if (link->state & DEV_STALE_LINK) + aha152x_detach(link); +} static int aha152x_event(event_t event, int priority, event_callback_args_t *args) @@ -414,28 +395,29 @@ break; } return 0; -} /* aha152x_event */ +} -/*====================================================================*/ +static struct pcmcia_driver aha152x_cs_driver = { + .owner = THIS_MODULE, + .drv = { + .name = "aha152x_cs", + }, + .attach = aha152x_attach, + .detach = aha152x_detach, +}; -static int __init init_aha152x_cs(void) { - servinfo_t serv; - DEBUG(0, "%s\n", version); - CardServices(GetCardServicesInfo, &serv); - if (serv.Revision != CS_RELEASE_CODE) { - printk(KERN_NOTICE "aha152x_cs: Card Services release " - "does not match!\n"); - return -1; - } - register_pccard_driver(&dev_info, &aha152x_attach, &aha152x_detach); - return 0; +static int __init init_aha152x_cs(void) +{ + return pcmcia_register_driver(&aha152x_cs_driver); } -static void __exit exit_aha152x_cs(void) { - DEBUG(0, "aha152x_cs: unloading\n"); - unregister_pccard_driver(&dev_info); - while (dev_list != NULL) - aha152x_detach(dev_list); +static void __exit exit_aha152x_cs(void) +{ + pcmcia_unregister_driver(&aha152x_cs_driver); + + /* XXX: this really needs to move into generic code.. */ + while (dev_list != NULL) + aha152x_detach(dev_list); } module_init(init_aha152x_cs); diff -urN linux-2.5.66-bk7/drivers/scsi/pcmcia/fdomain_stub.c linux-2.5.66-bk8/drivers/scsi/pcmcia/fdomain_stub.c --- linux-2.5.66-bk7/drivers/scsi/pcmcia/fdomain_stub.c Mon Mar 24 14:00:49 2003 +++ linux-2.5.66-bk8/drivers/scsi/pcmcia/fdomain_stub.c Wed Apr 2 04:38:14 2003 @@ -379,26 +379,27 @@ return 0; } /* fdomain_event */ -/*====================================================================*/ +static struct pcmcia_driver fdomain_cs_driver = { + .owner = THIS_MODULE, + .drv = { + .name = "fdomain_cs", + }, + .attach = fdomain_attach, + .detach = fdomain_detach, +}; -static int __init init_fdomain_cs(void) { - servinfo_t serv; - DEBUG(0, "%s\n", version); - CardServices(GetCardServicesInfo, &serv); - if (serv.Revision != CS_RELEASE_CODE) { - printk(KERN_NOTICE "fdomain_cs: Card Services release " - "does not match!\n"); - return -1; - } - register_pccard_driver(&dev_info, &fdomain_attach, &fdomain_detach); - return 0; +static int __init init_fdomain_cs(void) +{ + return pcmcia_register_driver(&fdomain_cs_driver); } -static void __exit exit_fdomain_cs(void) { - DEBUG(0, "fdomain_cs: unloading\n"); - unregister_pccard_driver(&dev_info); - while (dev_list != NULL) - fdomain_detach(dev_list); +static void __exit exit_fdomain_cs(void) +{ + pcmcia_unregister_driver(&fdomain_cs_driver); + + /* XXX: this really needs to move into generic code.. */ + while (dev_list != NULL) + fdomain_detach(dev_list); } module_init(init_fdomain_cs); diff -urN linux-2.5.66-bk7/drivers/scsi/pcmcia/qlogic_stub.c linux-2.5.66-bk8/drivers/scsi/pcmcia/qlogic_stub.c --- linux-2.5.66-bk7/drivers/scsi/pcmcia/qlogic_stub.c Mon Mar 24 14:00:41 2003 +++ linux-2.5.66-bk8/drivers/scsi/pcmcia/qlogic_stub.c Wed Apr 2 04:38:14 2003 @@ -397,25 +397,26 @@ return 0; } /* qlogic_event */ -/*====================================================================*/ + +static struct pcmcia_driver qlogic_cs_driver = { + .owner = THIS_MODULE, + .drv = { + .name = "qlogic_cs", + }, + .attach = qlogic_attach, + .detach = qlogic_detach, +}; static int __init init_qlogic_cs(void) { - servinfo_t serv; - DEBUG(0, "%s\n", version); - CardServices(GetCardServicesInfo, &serv); - if (serv.Revision != CS_RELEASE_CODE) { - printk(KERN_NOTICE "qlogic_cs: Card Services release " "does not match!\n"); - return -1; - } - register_pccard_driver(&dev_info, &qlogic_attach, &qlogic_detach); - return 0; + return pcmcia_register_driver(&qlogic_cs_driver); } static void __exit exit_qlogic_cs(void) { - DEBUG(0, "qlogic_cs: unloading\n"); - unregister_pccard_driver(&dev_info); + pcmcia_unregister_driver(&qlogic_cs_driver); + + /* XXX: this really needs to move into generic code.. */ while (dev_list != NULL) qlogic_detach(dev_list); } diff -urN linux-2.5.66-bk7/drivers/scsi/qlogicfc.c linux-2.5.66-bk8/drivers/scsi/qlogicfc.c --- linux-2.5.66-bk7/drivers/scsi/qlogicfc.c Mon Mar 24 14:01:13 2003 +++ linux-2.5.66-bk8/drivers/scsi/qlogicfc.c Wed Apr 2 04:38:14 2003 @@ -643,6 +643,7 @@ u_char queued; u_char host_id; struct timer_list explore_timer; + struct id_name_map tempmap[QLOGICFC_MAX_ID + 1]; }; @@ -836,22 +837,13 @@ short param[8]; int i, j; - struct id_name_map *map; /* base of array [QLOGICFC_MAX_ID + 1] */ - struct id_name_map *mapx; /* array entry pointer */ struct isp2x00_hostdata *hostdata; - hostdata = (struct isp2x00_hostdata *) host->hostdata; - - map = kmalloc((QLOGICFC_MAX_ID + 1) * sizeof(struct id_name_map), GFP_ATOMIC); - if (!map) { - printk("qlogicfc%d : error getting memory -- cannot make port database.\n", - hostdata->host_id); - goto fini; - } - memset(map, 0, (QLOGICFC_MAX_ID + 1) * sizeof(struct id_name_map)); - isp2x00_disable_irqs(host); + hostdata = (struct isp2x00_hostdata *) host->hostdata; + memset(hostdata->tempmap, 0, sizeof(hostdata->tempmap)); + #if ISP2x00_FABRIC for (i = 0x81; i < QLOGICFC_MAX_ID; i++) { param[0] = MBOX_PORT_LOGOUT; @@ -876,74 +868,72 @@ if (param[0] == MBOX_COMMAND_COMPLETE) { hostdata->port_id = ((u_int) param[3]) << 16; hostdata->port_id |= param[2]; - map->loop_id = param[1]; - map->wwn = hostdata->wwn; + hostdata->tempmap[0].loop_id = param[1]; + hostdata->tempmap[0].wwn = hostdata->wwn; } else { printk("qlogicfc%d : error getting scsi id.\n", hostdata->host_id); } - for (i = 0, mapx = map; i <= QLOGICFC_MAX_ID; i++, mapx++) - mapx->loop_id = map->loop_id; + for (i = 0; i <=QLOGICFC_MAX_ID; i++) + hostdata->tempmap[i].loop_id = hostdata->tempmap[0].loop_id; - for (i = 0, j = 1, mapx = map + 1; i <= QLOGICFC_MAX_LOOP_ID; i++) { + for (i = 0, j = 1; i <= QLOGICFC_MAX_LOOP_ID; i++) { param[0] = MBOX_GET_PORT_NAME; param[1] = (i << 8) & 0xff00; isp2x00_mbox_command(host, param); if (param[0] == MBOX_COMMAND_COMPLETE) { - mapx->loop_id = i; - mapx->wwn = ((u64) (param[2] & 0xff)) << 56; - mapx->wwn |= ((u64) ((param[2] >> 8) & 0xff)) << 48; - mapx->wwn |= ((u64) (param[3] & 0xff)) << 40; - mapx->wwn |= ((u64) ((param[3] >> 8) & 0xff)) << 32; - mapx->wwn |= ((u64) (param[6] & 0xff)) << 24; - mapx->wwn |= ((u64) ((param[6] >> 8) & 0xff)) << 16; - mapx->wwn |= ((u64) (param[7] & 0xff)) << 8; - mapx->wwn |= ((u64) ((param[7] >> 8) & 0xff)); + hostdata->tempmap[j].loop_id = i; + hostdata->tempmap[j].wwn = ((u64) (param[2] & 0xff)) << 56; + hostdata->tempmap[j].wwn |= ((u64) ((param[2] >> 8) & 0xff)) << 48; + hostdata->tempmap[j].wwn |= ((u64) (param[3] & 0xff)) << 40; + hostdata->tempmap[j].wwn |= ((u64) ((param[3] >> 8) & 0xff)) << 32; + hostdata->tempmap[j].wwn |= ((u64) (param[6] & 0xff)) << 24; + hostdata->tempmap[j].wwn |= ((u64) ((param[6] >> 8) & 0xff)) << 16; + hostdata->tempmap[j].wwn |= ((u64) (param[7] & 0xff)) << 8; + hostdata->tempmap[j].wwn |= ((u64) ((param[7] >> 8) & 0xff)); j++; - mapx++; + } } #if ISP2x00_FABRIC - isp2x00_init_fabric(host, map, j); + isp2x00_init_fabric(host, hostdata->tempmap, j); #endif - for (i = 0, mapx = map; i <= QLOGICFC_MAX_ID; i++, mapx++) { - struct id_name_map *tmap; /* second array entry pointer */ - if (mapx->wwn != hostdata->port_db[i].wwn) { - for (j = 0, tmap = map; j <= QLOGICFC_MAX_ID; j++, tmap++) { - if (tmap->wwn == hostdata->port_db[i].wwn) { - hostdata->port_db[i].loop_id = tmap->loop_id; + for (i = 0; i <= QLOGICFC_MAX_ID; i++) { + if (hostdata->tempmap[i].wwn != hostdata->port_db[i].wwn) { + for (j = 0; j <= QLOGICFC_MAX_ID; j++) { + if (hostdata->tempmap[j].wwn == hostdata->port_db[i].wwn) { + hostdata->port_db[i].loop_id = hostdata->tempmap[j].loop_id; break; } } if (j == QLOGICFC_MAX_ID + 1) - hostdata->port_db[i].loop_id = map->loop_id; + hostdata->port_db[i].loop_id = hostdata->tempmap[0].loop_id; for (j = 0; j <= QLOGICFC_MAX_ID; j++) { - if (hostdata->port_db[j].wwn == mapx->wwn || !hostdata->port_db[j].wwn) { + if (hostdata->port_db[j].wwn == hostdata->tempmap[i].wwn || !hostdata->port_db[j].wwn) { break; } } if (j == QLOGICFC_MAX_ID + 1) printk("qlogicfc%d : Too many scsi devices, no more room in port map.\n", hostdata->host_id); if (!hostdata->port_db[j].wwn) { - hostdata->port_db[j].loop_id = mapx->loop_id; - hostdata->port_db[j].wwn = mapx->wwn; + hostdata->port_db[j].loop_id = hostdata->tempmap[i].loop_id; + hostdata->port_db[j].wwn = hostdata->tempmap[i].wwn; } } else - hostdata->port_db[i].loop_id = mapx->loop_id; + hostdata->port_db[i].loop_id = hostdata->tempmap[i].loop_id; } isp2x00_enable_irqs(host); - kfree(map); -fini: + return 0; } diff -urN linux-2.5.66-bk7/drivers/scsi/scsi.h linux-2.5.66-bk8/drivers/scsi/scsi.h --- linux-2.5.66-bk7/drivers/scsi/scsi.h Mon Mar 24 14:00:10 2003 +++ linux-2.5.66-bk8/drivers/scsi/scsi.h Wed Apr 2 04:38:14 2003 @@ -442,6 +442,7 @@ extern int scsi_retry_command(Scsi_Cmnd *); extern int scsi_attach_device(struct scsi_device *); extern void scsi_detach_device(struct scsi_device *); +extern void scsi_rescan_device(struct scsi_device *); extern int scsi_get_device_flags(unsigned char *vendor, unsigned char *model); /* diff -urN linux-2.5.66-bk7/drivers/scsi/scsi_debug.c linux-2.5.66-bk8/drivers/scsi/scsi_debug.c --- linux-2.5.66-bk7/drivers/scsi/scsi_debug.c Mon Mar 24 14:00:50 2003 +++ linux-2.5.66-bk8/drivers/scsi/scsi_debug.c Wed Apr 2 04:38:14 2003 @@ -20,8 +20,8 @@ * add timers for delayed responses [20020721] * Patrick Mansfield max_luns+scsi_level [20021031] * Mike Anderson sysfs work [20021118] - * dpg: change style of boot options to "scsi_debug.num_devs=2" and - * module options to "modprobe scsi_debug num_devs=2" [20021221] + * dpg: change style of boot options to "scsi_debug.num_tgts=2" and + * module options to "modprobe scsi_debug num_tgts=2" [20021221] */ #include @@ -54,18 +54,31 @@ #include "scsi_debug.h" -static const char * scsi_debug_version_str = "Version: 1.68 (20030314)"; +static const char * scsi_debug_version_str = "Version: 1.69 (20030329)"; + +/* Additional Sense Code (ASC) used */ +#define NO_ADDED_SENSE 0x0 +#define UNRECOVERED_READ_ERR 0x11 +#define INVALID_OPCODE 0x20 +#define ADDR_OUT_OF_RANGE 0x21 +#define INVALID_FIELD_IN_CDB 0x24 +#define POWERON_RESET 0x29 +#define SAVING_PARAMS_UNSUP 0x39 +#define THRESHHOLD_EXCEEDED 0x5d #define SDEBUG_TAGGED_QUEUING 0 /* 0 | MSG_SIMPLE_TAG | MSG_ORDERED_TAG */ /* Default values for driver parameters */ -#define DEF_NUM_DEVS 1 +#define DEF_NUM_HOST 1 +#define DEF_NUM_TGTS 1 +#define DEF_MAX_LUNS 1 +/* With these defaults, this driver will make 1 host with 1 target + * (id 0) containing 1 logical unit (lun 0). That is 1 device. + */ #define DEF_DEV_SIZE_MB 8 #define DEF_EVERY_NTH 0 #define DEF_DELAY 1 -#define DEF_MAX_LUNS 2 #define DEF_SCSI_LEVEL 3 -#define DEF_NUM_HOST 1 #define DEF_OPTS 0 /* bit mask values for scsi_debug_opts */ @@ -83,8 +96,12 @@ * sector on read commands: */ #define OPT_MEDIUM_ERR_ADDR 0x1234 /* that's sector 4660 in decimal */ +/* If REPORT LUNS has luns >= 256 it can choose "flat space" (value 1) + * or "peripheral device" addressing (value 0) */ +#define SAM2_LUN_ADDRESS_METHOD 0 + static int scsi_debug_dev_size_mb = DEF_DEV_SIZE_MB; -static int scsi_debug_num_devs = DEF_NUM_DEVS; /* max devs per host */ +static int scsi_debug_num_tgts = DEF_NUM_TGTS; /* targets per host */ static int scsi_debug_opts = DEF_OPTS; static int scsi_debug_every_nth = DEF_EVERY_NTH; static int scsi_debug_cmnd_count = 0; @@ -303,7 +320,7 @@ sbuff = devip->sense_buff; memcpy(buff, sbuff, (bufflen < SDEBUG_SENSE_LEN) ? bufflen : SDEBUG_SENSE_LEN); - mk_sense_buffer(devip, 0, 0x0, 0, 7); + mk_sense_buffer(devip, 0, NO_ADDED_SENSE, 0, 7); } else { memset(buff, 0, bufflen); buff[0] = 0x70; @@ -384,7 +401,8 @@ } errsts = resp_read(SCpnt, upper_blk, block, num, devip); if (inj_recovered && (0 == errsts)) { - mk_sense_buffer(devip, RECOVERED_ERROR, 0x5d, 0, 14); + mk_sense_buffer(devip, RECOVERED_ERROR, + THRESHHOLD_EXCEEDED, 0, 18); errsts = check_condition_result; } break; @@ -421,7 +439,8 @@ } errsts = resp_write(SCpnt, upper_blk, block, num, devip); if (inj_recovered && (0 == errsts)) { - mk_sense_buffer(devip, RECOVERED_ERROR, 0x5d, 0, 14); + mk_sense_buffer(devip, RECOVERED_ERROR, + THRESHHOLD_EXCEEDED, 0, 18); errsts = check_condition_result; } break; @@ -435,7 +454,7 @@ default: if ((errsts = check_reset(SCpnt, devip))) break; - mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x20, 0, 14); + mk_sense_buffer(devip, ILLEGAL_REQUEST, INVALID_OPCODE, 0, 18); errsts = check_condition_result; break; } @@ -455,7 +474,7 @@ { if (devip->reset) { devip->reset = 0; - mk_sense_buffer(devip, UNIT_ATTENTION, 0x29, 0, 14); + mk_sense_buffer(devip, UNIT_ATTENTION, POWERON_RESET, 0, 18); return check_condition_result; } return 0; @@ -516,7 +535,8 @@ pq_pdt = PERIPH_DEVICE_TYPE(target); arr[0] = pq_pdt; if (0x2 & cmd[1]) { /* CMDDT bit set */ - mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14); + mk_sense_buffer(devip, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, + 0, 18); return check_condition_result; } else if (0x1 & cmd[1]) { /* EVPD bit set */ int dev_id_num, len; @@ -541,7 +561,8 @@ dev_id_str, len); } else { /* Illegal request, invalid field in cdb */ - mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14); + mk_sense_buffer(devip, ILLEGAL_REQUEST, + INVALID_FIELD_IN_CDB, 0, 18); return check_condition_result; } memcpy(buff, arr, min_len); @@ -654,7 +675,8 @@ memset(buff, 0, bufflen); memset(arr, 0, SDEBUG_MAX_MSENSE_SZ); if (0x3 == pcontrol) { /* Saving values not supported */ - mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x39, 0, 14); + mk_sense_buffer(devip, ILLEGAL_REQUEST, SAVING_PARAMS_UNSUP, + 0, 18); return check_condition_result; } dev_spec = DEV_READONLY(target) ? 0x80 : 0x0; @@ -697,7 +719,8 @@ offset += len; break; default: - mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14); + mk_sense_buffer(devip, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, + 0, 18); return check_condition_result; } if (msense_6) @@ -721,13 +744,15 @@ unsigned long iflags; if (upper_blk || (block + num > sdebug_capacity)) { - mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x21, 0, 14); + mk_sense_buffer(devip, ILLEGAL_REQUEST, ADDR_OUT_OF_RANGE, + 0, 18); return check_condition_result; } if ((SCSI_DEBUG_OPT_MEDIUM_ERR & scsi_debug_opts) && (block <= OPT_MEDIUM_ERR_ADDR) && ((block + num) > OPT_MEDIUM_ERR_ADDR)) { - mk_sense_buffer(devip, MEDIUM_ERROR, 0x11, 0, 14); + mk_sense_buffer(devip, MEDIUM_ERROR, UNRECOVERED_READ_ERR, + 0, 18); /* claim unrecoverable read error */ return check_condition_result; } @@ -770,7 +795,8 @@ unsigned long iflags; if (upper_blk || (block + num > sdebug_capacity)) { - mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x21, 0, 14); + mk_sense_buffer(devip, ILLEGAL_REQUEST, ADDR_OUT_OF_RANGE, + 0, 18); return check_condition_result; } @@ -805,23 +831,33 @@ static int resp_report_luns(unsigned char * cmd, unsigned char * buff, int bufflen, struct sdebug_dev_info * devip) { - unsigned int alloc_len, lun_cnt, i; + unsigned int alloc_len; + int lun_cnt, i, upper; int select_report = (int)cmd[2]; ScsiLun *one_lun; alloc_len = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24); if ((alloc_len < 16) || (select_report > 2)) { - mk_sense_buffer(devip, ILLEGAL_REQUEST, 0x24, 0, 14); + mk_sense_buffer(devip, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, + 0, 18); return check_condition_result; } - if (bufflen > 3) { - lun_cnt = min((int)(bufflen / sizeof(ScsiLun)), - (int)scsi_debug_max_luns); + if (bufflen > 8) { /* can produce response with up to 16k luns + (lun 0 to lun 16383) */ memset(buff, 0, bufflen); - buff[3] = 8 * lun_cnt; - one_lun = (ScsiLun*) &buff[0]; - for (i = 0; i < lun_cnt; i++) - one_lun[i].scsi_lun[1] = i; + lun_cnt = scsi_debug_max_luns; + buff[2] = ((sizeof(ScsiLun) * lun_cnt) >> 8) & 0xff; + buff[3] = (sizeof(ScsiLun) * lun_cnt) & 0xff; + lun_cnt = min((int)((bufflen - 8) / sizeof(ScsiLun)), + lun_cnt); + one_lun = (ScsiLun*) &buff[8]; + for (i = 0; i < lun_cnt; i++) { + upper = (i >> 8) & 0x3f; + if (upper) + one_lun[i].scsi_lun[0] = + (upper | (SAM2_LUN_ADDRESS_METHOD << 6)); + one_lun[i].scsi_lun[1] = i & 0xff; + } } return 0; } @@ -1101,7 +1137,7 @@ if ((SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) && cmnd) { printk(KERN_INFO "scsi_debug: cmd "); for (k = 0, num = cmnd->cmd_len; k < num; ++k) - printk("%02x ", (int)cmnd->cmnd[k]); + printk("%02x ", (int)cmnd->cmnd[k]); printk("\n"); if (scsi_result) { struct scsi_device * sdp = cmnd->device; @@ -1159,7 +1195,7 @@ * of sysfs parameters (which module_param doesn't yet support). * Sysfs parameters defined explicitly below. */ -module_param_named(num_devs, scsi_debug_num_devs, int, 0); +module_param_named(num_tgts, scsi_debug_num_tgts, int, 0); module_param_named(max_luns, scsi_debug_max_luns, int, 0); module_param_named(scsi_level, scsi_debug_scsi_level, int, 0); module_param_named(dev_size_mb, scsi_debug_dev_size_mb, int, 0); @@ -1172,7 +1208,7 @@ MODULE_DESCRIPTION("SCSI debug adapter driver"); MODULE_LICENSE("GPL"); -MODULE_PARM_DESC(num_devs, "number of SCSI devices per host to simulate"); +MODULE_PARM_DESC(num_tgts, "number of SCSI targets per host to simulate"); MODULE_PARM_DESC(max_luns, "number of SCSI LUNs per target to simulate"); MODULE_PARM_DESC(scsi_level, "SCSI level to simulate"); MODULE_PARM_DESC(dev_size_mb, "size in MB of ram shared by devs"); @@ -1186,9 +1222,9 @@ static const char * scsi_debug_info(struct Scsi_Host * shp) { - sprintf(sdebug_info, "scsi_debug, %s, num_devs=%d, " + sprintf(sdebug_info, "scsi_debug, %s, num_tgts=%d, " "dev_size_mb=%d, opts=0x%x", scsi_debug_version_str, - scsi_debug_num_devs, scsi_debug_dev_size_mb, + scsi_debug_num_tgts, scsi_debug_dev_size_mb, scsi_debug_opts); return sdebug_info; } @@ -1221,13 +1257,13 @@ } begin = 0; pos = len = sprintf(buffer, "scsi_debug adapter driver, %s\n" - "num_devs=%d, shared (ram) size=%d MB, opts=0x%x, " + "num_tgts=%d, shared (ram) size=%d MB, opts=0x%x, " "every_nth=%d(curr:%d)\n" "delay=%d, max_luns=%d, scsi_level=%d\n" "sector_size=%d bytes, cylinders=%d, heads=%d, sectors=%d\n" "number of aborts=%d, device_reset=%d, bus_resets=%d, " "host_resets=%d\n", - scsi_debug_version_str, scsi_debug_num_devs, + scsi_debug_version_str, scsi_debug_num_tgts, scsi_debug_dev_size_mb, scsi_debug_opts, scsi_debug_every_nth, scsi_debug_cmnd_count, scsi_debug_delay, scsi_debug_max_luns, scsi_debug_scsi_level, @@ -1295,23 +1331,23 @@ DRIVER_ATTR(opts, S_IRUGO | S_IWUSR, sdebug_opts_show, sdebug_opts_store) -static ssize_t sdebug_num_devs_show(struct device_driver * ddp, char * buf) +static ssize_t sdebug_num_tgts_show(struct device_driver * ddp, char * buf) { - return snprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_num_devs); + return snprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_num_tgts); } -static ssize_t sdebug_num_devs_store(struct device_driver * ddp, +static ssize_t sdebug_num_tgts_store(struct device_driver * ddp, const char * buf, size_t count) { int n; if ((count > 0) && (1 == sscanf(buf, "%d", &n)) && (n >= 0)) { - scsi_debug_num_devs = n; + scsi_debug_num_tgts = n; return count; } return -EINVAL; } -DRIVER_ATTR(num_devs, S_IRUGO | S_IWUSR, sdebug_num_devs_show, - sdebug_num_devs_store) +DRIVER_ATTR(num_tgts, S_IRUGO | S_IWUSR, sdebug_num_tgts_show, + sdebug_num_tgts_store) static ssize_t sdebug_dev_size_mb_show(struct device_driver * ddp, char * buf) { @@ -1342,7 +1378,19 @@ { return snprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_max_luns); } -DRIVER_ATTR(max_luns, S_IRUGO, sdebug_max_luns_show, NULL) +static ssize_t sdebug_max_luns_store(struct device_driver * ddp, + const char * buf, size_t count) +{ + int n; + + if ((count > 0) && (1 == sscanf(buf, "%d", &n)) && (n >= 0)) { + scsi_debug_max_luns = n; + return count; + } + return -EINVAL; +} +DRIVER_ATTR(max_luns, S_IRUGO | S_IWUSR, sdebug_max_luns_show, + sdebug_max_luns_store) static ssize_t sdebug_scsi_level_show(struct device_driver * ddp, char * buf) { @@ -1391,7 +1439,7 @@ { driver_create_file(&sdebug_driverfs_driver, &driver_attr_delay); driver_create_file(&sdebug_driverfs_driver, &driver_attr_opts); - driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_devs); + driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_tgts); driver_create_file(&sdebug_driverfs_driver, &driver_attr_dev_size_mb); driver_create_file(&sdebug_driverfs_driver, &driver_attr_every_nth); driver_create_file(&sdebug_driverfs_driver, &driver_attr_max_luns); @@ -1406,7 +1454,7 @@ driver_remove_file(&sdebug_driverfs_driver, &driver_attr_max_luns); driver_remove_file(&sdebug_driverfs_driver, &driver_attr_every_nth); driver_remove_file(&sdebug_driverfs_driver, &driver_attr_dev_size_mb); - driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_devs); + driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_tgts); driver_remove_file(&sdebug_driverfs_driver, &driver_attr_opts); driver_remove_file(&sdebug_driverfs_driver, &driver_attr_delay); } @@ -1567,7 +1615,7 @@ static int sdebug_driver_probe(struct device * dev) { - int k; + int k, devs_per_host; int error = 0; struct sdebug_host_info *sdbg_host; struct sdebug_dev_info *sdbg_devinfo; @@ -1584,7 +1632,8 @@ INIT_LIST_HEAD(&sdbg_host->dev_info_list); - for (k = 0; k < scsi_debug_num_devs; k++) { + devs_per_host = scsi_debug_num_tgts * scsi_debug_max_luns; + for (k = 0; k < devs_per_host; k++) { sdbg_devinfo = kmalloc(sizeof(*sdbg_devinfo),GFP_KERNEL); if (NULL == sdbg_devinfo) { printk(KERN_ERR "%s: out of memory at line %d\n", @@ -1608,7 +1657,11 @@ sdbg_host->shost = hpnt; sdbg_host->dev = dev; - hpnt->max_lun = scsi_debug_max_luns; + if ((hpnt->this_id >= 0) && (scsi_debug_num_tgts > hpnt->this_id)) + hpnt->max_id = scsi_debug_num_tgts + 1; + else + hpnt->max_id = scsi_debug_num_tgts; + hpnt->max_lun = scsi_debug_max_luns; error = scsi_add_host(hpnt, sdbg_host->dev); if (error) { diff -urN linux-2.5.66-bk7/drivers/scsi/scsi_ioctl.c linux-2.5.66-bk8/drivers/scsi/scsi_ioctl.c --- linux-2.5.66-bk7/drivers/scsi/scsi_ioctl.c Mon Mar 24 14:01:46 2003 +++ linux-2.5.66-bk8/drivers/scsi/scsi_ioctl.c Wed Apr 2 04:38:14 2003 @@ -298,6 +298,7 @@ goto error; switch (opcode) { + case SEND_DIAGNOSTIC: case FORMAT_UNIT: timeout = FORMAT_UNIT_TIMEOUT; retries = 1; diff -urN linux-2.5.66-bk7/drivers/scsi/scsi_lib.c linux-2.5.66-bk8/drivers/scsi/scsi_lib.c --- linux-2.5.66-bk7/drivers/scsi/scsi_lib.c Wed Apr 2 04:38:03 2003 +++ linux-2.5.66-bk8/drivers/scsi/scsi_lib.c Wed Apr 2 04:38:14 2003 @@ -810,7 +810,7 @@ cmd->device->host->host_no, (int) cmd->device->channel, (int) cmd->device->id, (int) cmd->device->lun); print_command(cmd->data_cmnd); - print_sense("sd", cmd); + print_sense("", cmd); cmd = scsi_end_request(cmd, 0, block_sectors, 1); return; default: @@ -830,7 +830,7 @@ struct Scsi_Device_Template *sdt; sdt = scsi_get_request_dev(cmd->request); - printk("SCSI %s error : host %d channel %d id %d lun %d return code = %x\n", + printk("SCSI %s error : <%d %d %d %d> return code = 0x%x\n", (sdt ? sdt->name : "device"), cmd->device->host->host_no, cmd->device->channel, @@ -838,7 +838,7 @@ cmd->device->lun, result); if (driver_byte(result) & DRIVER_SENSE) - print_sense("sd", cmd); + print_sense("", cmd); /* * Mark a single buffer as not uptodate. Queue the remainder. * We sometimes get this cruft in the event that a medium error diff -urN linux-2.5.66-bk7/drivers/scsi/scsi_pc98.c linux-2.5.66-bk8/drivers/scsi/scsi_pc98.c --- linux-2.5.66-bk7/drivers/scsi/scsi_pc98.c Mon Mar 24 13:59:54 2003 +++ linux-2.5.66-bk8/drivers/scsi/scsi_pc98.c Wed Apr 2 04:38:14 2003 @@ -48,7 +48,7 @@ int pc98_bios_param(struct scsi_device *sdev, struct block_device *bdev, sector_t capacity, int *ip) { - static struct Scsi_Host *first_real = first_real_host(); + struct Scsi_Host *first_real = first_real_host(); if (sdev->host == first_real && sdev->id < 7 && __PC9800SCA_TEST_BIT(PC9800SCA_DISK_EQUIPS, sdev->id)) diff -urN linux-2.5.66-bk7/drivers/scsi/scsi_scan.c linux-2.5.66-bk8/drivers/scsi/scsi_scan.c --- linux-2.5.66-bk7/drivers/scsi/scsi_scan.c Mon Mar 24 14:01:15 2003 +++ linux-2.5.66-bk8/drivers/scsi/scsi_scan.c Wed Apr 2 04:38:14 2003 @@ -191,6 +191,13 @@ {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, {"SUN", "T300", "*", BLIST_SPARSELUN}, {"SUN", "T4", "*", BLIST_SPARSELUN}, + {"SGI", "RAID3", "*", BLIST_SPARSELUN}, + {"SGI", "RAID5", "*", BLIST_SPARSELUN}, + {"SGI", "TP9100", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, + {"SGI", "TP9300", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, + {"SGI", "TP9400", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, + {"SGI", "TP9500", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, + {"MYLEX", "DACARMRB", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, { NULL, NULL, NULL, 0 }, }; diff -urN linux-2.5.66-bk7/drivers/scsi/scsi_sysfs.c linux-2.5.66-bk8/drivers/scsi/scsi_sysfs.c --- linux-2.5.66-bk7/drivers/scsi/scsi_sysfs.c Mon Mar 24 14:00:08 2003 +++ linux-2.5.66-bk8/drivers/scsi/scsi_sysfs.c Wed Apr 2 04:38:14 2003 @@ -275,12 +275,8 @@ static ssize_t store_rescan_field (struct device *dev, const char *buf, size_t count) { - int ret = ENODEV; - struct scsi_device *sdev; - sdev = to_scsi_device(dev); - if (sdev) - ret = scsi_rescan_device(sdev); - return ret; + scsi_rescan_device(to_scsi_device(dev)); + return 0; } static DEVICE_ATTR(rescan, S_IRUGO | S_IWUSR, show_rescan_field, store_rescan_field) diff -urN linux-2.5.66-bk7/drivers/scsi/sym53c8xx.c linux-2.5.66-bk8/drivers/scsi/sym53c8xx.c --- linux-2.5.66-bk7/drivers/scsi/sym53c8xx.c Mon Mar 24 14:00:55 2003 +++ linux-2.5.66-bk8/drivers/scsi/sym53c8xx.c Wed Apr 2 04:38:14 2003 @@ -4901,6 +4901,11 @@ u_long period; int i; +#ifdef CONFIG_PARISC + char scsi_mode = -1; + struct hardware_path hwpath; +#endif + /* ** Wide ? */ @@ -4972,6 +4977,31 @@ */ period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz; + +#ifdef CONFIG_PARISC + /* Host firmware (PDC) keeps a table for crippling SCSI capabilities. + * Many newer machines export one channel of 53c896 chip + * as SE, 50-pin HD. Also used for Multi-initiator SCSI clusters + * to set the SCSI Initiator ID. + */ + get_pci_node_path(np->pdev, &hwpath); + if (pdc_get_initiator(&hwpath, &np->myaddr, &period, &np->maxwide, &scsi_mode)) + { + if (np->maxwide) + np->features |= FE_WIDE; + if (scsi_mode >= 0) { + /* C3000 PDC reports period/mode */ + driver_setup.diff_support = 0; + switch(scsi_mode) { + case 0: np->scsi_mode = SMODE_SE; break; + case 1: np->scsi_mode = SMODE_HVD; break; + case 2: np->scsi_mode = SMODE_LVD; break; + default: break; + } + } + } +#endif + if (period <= 250) np->minsync = 10; else if (period <= 303) np->minsync = 11; else if (period <= 500) np->minsync = 12; diff -urN linux-2.5.66-bk7/drivers/scsi/wd33c93.c linux-2.5.66-bk8/drivers/scsi/wd33c93.c --- linux-2.5.66-bk7/drivers/scsi/wd33c93.c Mon Mar 24 14:00:55 2003 +++ linux-2.5.66-bk8/drivers/scsi/wd33c93.c Wed Apr 2 04:38:14 2003 @@ -162,8 +162,8 @@ { uchar data; - outb(reg_num, *regs.SASR); - data = inb(*regs.SCMD); + outb(reg_num, regs.SASR); + data = inb(regs.SCMD); return data; } @@ -172,33 +172,33 @@ { unsigned long value; - outb(WD_TRANSFER_COUNT_MSB, *regs.SASR); - value = inb(*regs.SCMD) << 16; - value |= inb(*regs.SCMD) << 8; - value |= inb(*regs.SCMD); + outb(WD_TRANSFER_COUNT_MSB, regs.SASR); + value = inb(regs.SCMD) << 16; + value |= inb(regs.SCMD) << 8; + value |= inb(regs.SCMD); return value; } static inline uchar read_aux_stat(const wd33c93_regs regs) { - return inb(*regs.SASR); + return inb(regs.SASR); } static inline void write_wd33c93(const wd33c93_regs regs, uchar reg_num, uchar value) { - outb(reg_num, *regs.SASR); - outb(value, *regs.SCMD); + outb(reg_num, regs.SASR); + outb(value, regs.SCMD); } static inline void write_wd33c93_count(const wd33c93_regs regs, unsigned long value) { - outb(WD_TRANSFER_COUNT_MSB, *regs.SASR); - outb((value >> 16) & 0xff, *regs.SCMD); - outb((value >> 8) & 0xff, *regs.SCMD); - outb( value & 0xff, *regs.SCMD); + outb(WD_TRANSFER_COUNT_MSB, regs.SASR); + outb((value >> 16) & 0xff, regs.SCMD); + outb((value >> 8) & 0xff, regs.SCMD); + outb( value & 0xff, regs.SCMD); } #define write_wd33c93_cmd(regs, cmd) \ @@ -209,9 +209,9 @@ { int i; - outb(WD_CDB_1, *regs.SASR); + outb(WD_CDB_1, regs.SASR); for (i=0; iresult = DID_RESET << 16; enable_irq(instance->irq); - return 0; + return SUCCESS; } int @@ -1591,7 +1591,7 @@ instance->host_no, cmd->pid); enable_irq(cmd->device->host->irq); cmd->scsi_done(cmd); - return SCSI_ABORT_SUCCESS; + return SUCCESS; } prev = tmp; tmp = (Scsi_Cmnd *) tmp->host_scribble; @@ -1666,7 +1666,7 @@ enable_irq(cmd->device->host->irq); cmd->scsi_done(cmd); - return SCSI_ABORT_SUCCESS; + return SUCCESS; } /* @@ -1681,9 +1681,9 @@ printk ("scsi%d: Abort - command %ld found on disconnected_Q - ", instance->host_no, cmd->pid); - printk("returning ABORT_SNOOZE. "); + printk("Abort SNOOZE. "); enable_irq(cmd->device->host->irq); - return SCSI_ABORT_SNOOZE; + return FAILED; } tmp = (Scsi_Cmnd *) tmp->host_scribble; } @@ -1704,7 +1704,7 @@ enable_irq(cmd->device->host->irq); printk("scsi%d: warning : SCSI command probably completed successfully" " before abortion. ", instance->host_no); - return SCSI_ABORT_NOT_RUNNING; + return FAILED; } #define MAX_WD33C93_HOSTS 4 @@ -1755,7 +1755,7 @@ return 1; } -__setup("wd33c9=", wd33c93_setup); +__setup("wd33c93=", wd33c93_setup); /* check_setup_args() returns index if key found, 0 if not */ @@ -2080,7 +2080,7 @@ { } -EXPORT_SYMBOL(wd33c93_reset); +EXPORT_SYMBOL(wd33c93_host_reset); EXPORT_SYMBOL(wd33c93_init); EXPORT_SYMBOL(wd33c93_release); EXPORT_SYMBOL(wd33c93_abort); diff -urN linux-2.5.66-bk7/drivers/scsi/wd33c93.h linux-2.5.66-bk8/drivers/scsi/wd33c93.h --- linux-2.5.66-bk7/drivers/scsi/wd33c93.h Mon Mar 24 14:00:10 2003 +++ linux-2.5.66-bk8/drivers/scsi/wd33c93.h Wed Apr 2 04:38:14 2003 @@ -186,8 +186,13 @@ /* This is what the 3393 chip looks like to us */ typedef struct { +#ifdef CONFIG_WD33C93_PIO + unsigned int SASR; + unsigned int SCMD; +#else volatile unsigned char *SASR; volatile unsigned char *SCMD; +#endif } wd33c93_regs; @@ -334,7 +339,7 @@ int wd33c93_queuecommand (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)); void wd33c93_intr (struct Scsi_Host *instance); int wd33c93_proc_info(char *, char **, off_t, int, int, int); -int wd33c93_reset (Scsi_Cmnd *, unsigned int); +int wd33c93_host_reset (Scsi_Cmnd *); void wd33c93_release(void); #endif /* WD33C93_H */ diff -urN linux-2.5.66-bk7/drivers/video/logo/Makefile linux-2.5.66-bk8/drivers/video/logo/Makefile --- linux-2.5.66-bk7/drivers/video/logo/Makefile Mon Mar 24 14:01:13 2003 +++ linux-2.5.66-bk8/drivers/video/logo/Makefile Wed Apr 2 04:38:14 2003 @@ -25,3 +25,6 @@ $(obj)/%_gray256.c: $(src)/%_gray256.pgm $(objtree)/scripts/pnmtologo -t gray256 -n $*_gray256 -o $@ $< + +# Files generated that shall be removed upon make clean +clean-files := *_mono.c *_vga16.c *_clut224.c *_gray256.c diff -urN linux-2.5.66-bk7/drivers/video/vfb.c linux-2.5.66-bk8/drivers/video/vfb.c --- linux-2.5.66-bk7/drivers/video/vfb.c Mon Mar 24 13:59:46 2003 +++ linux-2.5.66-bk8/drivers/video/vfb.c Wed Apr 2 04:38:14 2003 @@ -36,7 +36,6 @@ static void *videomemory; static u_long videomemorysize = VIDEOMEMSIZE; MODULE_PARM(videomemorysize, "l"); -static const char *mode_option __initdata = NULL; static struct fb_info fb_info; static u32 vfb_pseudo_palette[17]; @@ -430,7 +429,7 @@ fb_info.node = NODEV; fb_info.fbops = &vfb_ops; - retval = fb_find_mode(&fb_info.var, &fb_info, mode_option, + retval = fb_find_mode(&fb_info.var, &fb_info, NULL, NULL, 0, NULL, 8); if (!retval || (retval == 4)) diff -urN linux-2.5.66-bk7/fs/ChangeLog linux-2.5.66-bk8/fs/ChangeLog --- linux-2.5.66-bk7/fs/ChangeLog Mon Mar 24 14:00:01 2003 +++ linux-2.5.66-bk8/fs/ChangeLog Wed Dec 31 16:00:00 1969 @@ -1,159 +0,0 @@ -Mon Oct 24 23:27:42 1994 Theodore Y. Ts'o (tytso@rt-11) - - * fcntl.c (sys_fcntl): Liberalize security checks which Alan Cox - put in. - -Thu Oct 20 23:44:22 1994 Theodore Y. Ts'o (tytso@rt-11) - - * fcntl.c (sys_fcntl): Add more of a security check to the - F_SETOWN fcntl(). - -[Tons of changes missed, indeed. This list is worth restarting since -at least some fixes WILL break third-party filesystems. Sorry, but -there was no other way to fix rmdir/rename deadlock, for one.] - -Wed Dec 2 (Linus, fill the rest, please) - - * namei.c (do_rmdir) and rmdir method in filesystems: - Locking of directory we remove was taken to VFS. - See comments in do_rmdir(). Unfixed filesystems - will bloody likely deadlock in rmdir(). - -Thu Dec 3 17:25:31 1998 Al Viro (viro@math.psu.edu) - - * namei.c (do_rmdir): - Reject non-directories here. - Two (probably) obsolete checks moved here too: we fail if - the directory we remove is the same as parent (BUG: we - serve mountpoints later) or if it lives on a different - device. - * sysv/namei.c (sysv_rmdir): See sysv/CHANGES - -Fri Dec 4 00:54:12 1998 AV - - * namei.c (check_sticky): New function check_sticky(dir, inode). - If dir is sticky check whether we can unlink/rmdir/rename - the inode. Returns 1 if we can't. If dir isn't sticky - - return 0 (i.e. no objections). Some filesystems require - suser() here; some are fine with CAP_FOWNER. The later - seems more reasonable. - * namei.c (do_rmdir): - Moved the check for sticky bit here. - * affs/{inode,namei}.c: - All AFFS directories have sticky semantics (i.e. non-owner - having write permisssions on directory can unlink/rmdir/rename - only the files he owns), but AFFS didn't set S_ISVTX on them. - Fixed. NB: maybe this behaviour should be controlled by mount - option. Obvious values being 'sticky' (current behaviour), - 'nonsticky' (normal behaviour) and maybe some play on 'D' - permissions bit. FIXME. - * qnx4/namei.c (qnx4_rmdir): - Plugged inode leak. - * ufs/namei.c (ufs_rmdir): - Changed handling of busy directory to new scheme. - -Fri Dec 4 10:30:58 1998 AV - - * namei.c (VFS_rmdir): New function. It gets inode of the parent and - dentry of the victim, does all checks and applies fs-specific - rmdir() method. It should be called with semaphores down - on both the victim and its parent and with bumped d_count on - victim (see comments in do_rmdir). - * include/linux/fs.h: Added VFS_rmdir - * kernel/ksyms.c: Added VFS_rmdir to export list (for NFSD). - * nfsd/vfs.c: Fixed rmdir handling. - -Tue Dec 8 05:55:08 1998 AV - * vfat/namei.c: Fixed the bug in vfat_rename() introduced in the - first round of rmdir fixes. - -Wed Dec 9 03:06:10 1998 AV - * namei.c (do_rename): part of fs-independent checks had been moved - here (sticky bit handling, type mismatches). Cases of - the source or target being append-only or immutable also went - here - if we check it for parent we could as well do it for - children. - * {affs,ext2,minix,sysv,ufs}/namei.c (do_*_rename): - Removed tests that went to VFS, it simplified the code big way. - Fixed a race in check for empty target - we should check for - extra owners _before_ checking for emptiness, not after it. - * {ext2,ufs}/namei.c (do_*_rename): - VERY nasty bug shot: if somebody mkdired /tmp/cca01234, went - there, rmdired '.', waited till somebody created a file with - the same name and said mv . /tmp/goodbye_sticky_bit... Well, - goodbye sticky bit. Down, not across! - * {minix,sysv}/namei.c (do_*_rename): - Incorrect check for other owners (i_count instead of d_count). - Fixed. - * vfat: Looks like the changes above fixed a bug in VFAT - this beast - used to allow renaming file over directory and vice versa. - -Wed Dec 9 08:00:27 1998 AV - * namei.c (VFS_rename): New function. It gets the same arguments as - ->rename() method, does all checks and applies fs-specific - rmdir() method. It should be called with semaphores down - on both parents. - * include/linux/fs.h: Added VFS_rename - * kernel/ksyms.c: Added VFS_rename to export list (for NFSD). - * nfsd/vfs.c: Changed rename handling (switched to VFS_rename). - -Wed Dec 9 18:16:27 1998 AV - * namei.c (do_unlink): handling of sticky bit went here. - * {affs,ext2,minix,qnx4,sysv,ufs}/namei.c (*_unlink): - removed handling of sticky bit. - * qnx4/namei.c (qnx4_unlink): - Yet another inode leak. Fixed. - -Thu Dec 10 04:55:26 1998 AV - * {ext2,minix,sysv,ufs}/namei.c (*_mknod): - removed meaningless code handling attempts to mknod symlinks - and directories. VFS protects us from _that_ and if this code - would ever be called we'ld get a filesystem corruption. - -Thu Dec 10 16:58:50 1998 AV - * namei.c (do_rename): Fixed dentry leak that had been introduced by - the first round of rmdir fixes. - -Fri Dec 11 14:57:17 1998 AV - * msdos/namei.c (msdos_rmdir): Fixed race in emptiness check. - -Sat Dec 12 19:59:57 1998 AV - * msdos/namei.c (msdos_mkdir): Fixed the evil breakage introduced by - the changes of rmdir locking scheme. We shouldn't call - msdos_rmdir from there. - -Sun Dec 13 02:05:16 1998 AV - * namei.c (do_unlink): - Added new function: vfs_unlink, with the same arguments as - ->unlink() method. - * kernel/ksyms.c: Made it exported. - * include/linux/fs.h: Added prototype. - * nfsd/vfs.c: Changed handling of unlink (switched to vfs_unlink) - * {ext2,ufs}/namei.c (*_unlink): moved handling of imm./append-only to - VFS. - -Wed Dec 16 06:10:04 1998 AV - * namei.c (may_create, may_delete): New inline functions. - They check whether creation/deletion is permitted. - Checks from other places of namei.c went there. - Looks like originally I misread permission-related stuff - both here and in nfsd. In particular, checks for - immutable are done in permission(). D'oh. - * unlink on directory should return -EISDIR, not -EPERM as it used to - do. Fixed. - * rmdir of immutable/append-only directory shouldn't be allowed. Fixed. - -Remains unfixed: - * rename's handling of races is, erm, not optimal. Looks like I know - what to do, but this thing needs some more cleanup - we can - take care of almost all races in VFS and be much more graceful - wrt locking. Moreover, it would give strong lookup atomicity. - But it's a lot of changes to lookup and dcache code, so it will - go after the fs drivers' cleanup. - * affs allows HARD links to directories. VFS is, to put it politely, - not too ready to cope with _that_. And I'm not sure it should - be - looks like they are pretty much similar to symlinks. - * truncate doesn't give a damn about IO errors and disk overflows (on - braindead filesystems). I've submitted a patch to Linus, but - looks like it wasn't applied. - * msdos: shouldn't we treat SYS as IMMUTABLE? Makes sense, IMHO. diff -urN linux-2.5.66-bk7/fs/befs/btree.c linux-2.5.66-bk8/fs/befs/btree.c --- linux-2.5.66-bk7/fs/befs/btree.c Mon Mar 24 13:59:54 2003 +++ linux-2.5.66-bk8/fs/befs/btree.c Wed Apr 2 04:38:14 2003 @@ -324,7 +324,7 @@ * * finds exact match if one exists, and returns BEFS_BT_MATCH * If no exact match, finds first key in node that is greater - * (alpabeticly) than the search key and returns BEFS_BT_PARMATCH + * (alphabetically) than the search key and returns BEFS_BT_PARMATCH * (for partial match, I guess). Can you think of something better to * call it? * @@ -402,9 +402,9 @@ * @value: Value stored with the returned key * * Heres how it works: Key_no is the index of the key/value pair to - * retun in keybuf/value. + * return in keybuf/value. * Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is - * the number of charecters in the key (just a convience). + * the number of charecters in the key (just a convenience). * * Algorithm: * Get the first leafnode of the tree. See if the requested key is in that @@ -530,7 +530,7 @@ * befs_btree_seekleaf - Find the first leafnode in the btree * @sb: Filesystem superblock * @ds: Datastream containing btree - * @bt_super: Pointer to the uperblock of the btree + * @bt_super: Pointer to the superblock of the btree * @this_node: Buffer to return the leafnode in * @node_off: Pointer to offset of current node within datastream. Modified * by the function. @@ -615,10 +615,10 @@ * of the B+tree node *@node * * "The length of all the keys in the node is added to the size of the - * header and then rounded up to a multiple of four to get the begining + * header and then rounded up to a multiple of four to get the beginning * of the key length index" (p.88, practical filesystem design). * - * Exept that rounding up to 8 works, and rounding up to 4 doesn't. + * Except that rounding up to 8 works, and rounding up to 4 doesn't. */ static u16 * befs_bt_keylen_index(befs_btree_node * node) @@ -704,7 +704,7 @@ * @key1: pointer to the first key to be compared * @keylen1: length in bytes of key1 * @key2: pointer to the second key to be compared - * @kelen2: lenght in bytes of key2 + * @kelen2: length in bytes of key2 * * Returns 0 if @key1 and @key2 are equal. * Returns >0 if @key1 is greater. diff -urN linux-2.5.66-bk7/fs/befs/linuxvfs.c linux-2.5.66-bk8/fs/befs/linuxvfs.c --- linux-2.5.66-bk7/fs/befs/linuxvfs.c Mon Mar 24 14:00:20 2003 +++ linux-2.5.66-bk8/fs/befs/linuxvfs.c Wed Apr 2 04:38:14 2003 @@ -345,7 +345,7 @@ /* * set uid and gid. But since current BeOS is single user OS, so * you can change by "uid" or "gid" options. - */ + */ inode->i_uid = befs_sb->mount_opts.use_uid ? befs_sb->mount_opts.uid : (uid_t) fs32_to_cpu(sb, raw_inode->uid); @@ -358,11 +358,14 @@ * BEFS's time is 64 bits, but current VFS is 32 bits... * BEFS don't have access time. Nor inode change time. VFS * doesn't have creation time. + * Also, the lower 16 bits of the last_modified_time and + * create_time are just a counter to help ensure uniqueness + * for indexing purposes. (PFD, page 54) */ inode->i_mtime.tv_sec = fs64_to_cpu(sb, raw_inode->last_modified_time) >> 16; - inode->i_mtime.tv_nsec = 0; /* use the lower bits ? */ + inode->i_mtime.tv_nsec = 0; /* lower 16 bits are not a time */ inode->i_ctime = inode->i_mtime; inode->i_atime = inode->i_mtime; inode->i_blksize = befs_sb->block_size; @@ -527,6 +530,7 @@ /* * UTF-8 to NLS charset convert routine + * * * Changed 8/10/01 by Will Dyson. Now use uni2char() / char2uni() rather than * the nls tables directly @@ -572,11 +576,11 @@ } } result[o] = '\0'; + *out_len = o; befs_debug(sb, "<--- utf2nls()"); return o; - *out_len = o; conv_err: befs_error(sb, "Name using charecter set %s contains a charecter that " @@ -602,8 +606,8 @@ * * On return, *@destlen is the length of @dest in bytes. * - * On success, the return value is the number of utf8 charecters written to - * the ouput buffer @dest. + * On success, the return value is the number of utf8 characters written to + * the output buffer @dest. * * On Failure, a negative number coresponding to the error code is returned. */ diff -urN linux-2.5.66-bk7/fs/libfs.c linux-2.5.66-bk8/fs/libfs.c --- linux-2.5.66-bk7/fs/libfs.c Mon Mar 24 13:59:54 2003 +++ linux-2.5.66-bk8/fs/libfs.c Wed Apr 2 04:38:15 2003 @@ -332,14 +332,3 @@ set_page_dirty(page); return 0; } - -/* - * Print device name (in decimal, hexadecimal or symbolic) - * Note: returns pointer to static data! - */ -const char * kdevname(kdev_t dev) -{ - static char buffer[32]; - sprintf(buffer, "%02x:%02x", major(dev), minor(dev)); - return buffer; -} diff -urN linux-2.5.66-bk7/fs/ncpfs/inode.c linux-2.5.66-bk8/fs/ncpfs/inode.c --- linux-2.5.66-bk7/fs/ncpfs/inode.c Mon Mar 24 14:00:39 2003 +++ linux-2.5.66-bk8/fs/ncpfs/inode.c Wed Apr 2 04:38:15 2003 @@ -227,11 +227,13 @@ ncp_update_inode(inode, nwinfo); } +#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) static struct inode_operations ncp_symlink_inode_operations = { .readlink = page_readlink, .follow_link = page_follow_link, .setattr = ncp_notify_change, }; +#endif /* * Get a new inode. diff -urN linux-2.5.66-bk7/fs/nfsd/export.c linux-2.5.66-bk8/fs/nfsd/export.c --- linux-2.5.66-bk7/fs/nfsd/export.c Wed Apr 2 04:38:04 2003 +++ linux-2.5.66-bk8/fs/nfsd/export.c Wed Apr 2 04:38:15 2003 @@ -271,6 +271,47 @@ } static struct svc_export *svc_export_lookup(struct svc_export *, int); + +extern struct dentry * +find_exported_dentry(struct super_block *sb, void *obj, void *parent, + int (*acceptable)(void *context, struct dentry *de), + void *context); + +static int check_export(struct inode *inode, int flags) +{ + + /* We currently export only dirs and regular files. + * This is what umountd does. + */ + if (!S_ISDIR(inode->i_mode) && + !S_ISREG(inode->i_mode)) + return -ENOTDIR; + + /* There are two requirements on a filesystem to be exportable. + * 1: We must be able to identify the filesystem from a number. + * either a device number (so FS_REQUIRES_DEV needed) + * or an FSID number (so NFSEXP_FSID needed). + * 2: We must be able to find an inode from a filehandle. + * This means that s_export_op must be set. + */ + if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && + !(flags & NFSEXP_FSID)) { + dprintk("exp_export: export of non-dev fs without fsid"); + return -EINVAL; + } + if (!inode->i_sb->s_export_op) { + dprintk("exp_export: export of invalid fs type.\n"); + return -EINVAL; + } + + /* Ok, we can export it */; + if (!inode->i_sb->s_export_op->find_exported_dentry) + inode->i_sb->s_export_op->find_exported_dentry = + find_exported_dentry; + return 0; + +} + int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) { /* client path expiry [flags anonuid anongid fsid] */ @@ -342,6 +383,9 @@ err = get_int(&mesg, &an_int); if (err) goto out; exp.ex_fsid = an_int; + + err = check_export(nd.dentry->d_inode, exp.ex_flags); + if (err) goto out; } expp = svc_export_lookup(&exp, 1); @@ -594,10 +638,6 @@ svc_expkey_cache.nextcheck = get_seconds(); } -extern struct dentry * -find_exported_dentry(struct super_block *sb, void *obj, void *parent, - int (*acceptable)(void *context, struct dentry *de), - void *context); /* * Export a file system. */ @@ -661,36 +701,8 @@ goto finish; } - /* We currently export only dirs and regular files. - * This is what umountd does. - */ - err = -ENOTDIR; - if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode)) - goto finish; - - err = -EINVAL; - /* There are two requirements on a filesystem to be exportable. - * 1: We must be able to identify the filesystem from a number. - * either a device number (so FS_REQUIRES_DEV needed) - * or an FSID number (so NFSEXP_FSID needed). - * 2: We must be able to find an inode from a filehandle. - * This means that s_export_op must be set. - */ - if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV)) { - if (!(nxp->ex_flags & NFSEXP_FSID)) { - dprintk("exp_export: export of non-dev fs without fsid"); - goto finish; - } - } - if (!inode->i_sb->s_export_op) { - dprintk("exp_export: export of invalid fs type.\n"); - goto finish; - } - - /* Ok, we can export it */; - if (!inode->i_sb->s_export_op->find_exported_dentry) - inode->i_sb->s_export_op->find_exported_dentry = - find_exported_dentry; + err = check_export(inode, nxp->ex_flags); + if (err) goto finish; err = -ENOMEM; diff -urN linux-2.5.66-bk7/fs/quota_v1.c linux-2.5.66-bk8/fs/quota_v1.c --- linux-2.5.66-bk7/fs/quota_v1.c Mon Mar 24 14:01:13 2003 +++ linux-2.5.66-bk8/fs/quota_v1.c Wed Apr 2 04:38:15 2003 @@ -10,6 +10,10 @@ #include #include +MODULE_AUTHOR("Jan Kara"); +MODULE_DESCRIPTION("Old quota format support"); +MODULE_LICENSE("GPL"); + static void v1_disk2mem_dqblk(struct mem_dqblk *m, struct v1_disk_dqblk *d) { m->dqb_ihardlimit = d->dqb_ihardlimit; diff -urN linux-2.5.66-bk7/fs/quota_v2.c linux-2.5.66-bk8/fs/quota_v2.c --- linux-2.5.66-bk7/fs/quota_v2.c Mon Mar 24 14:01:17 2003 +++ linux-2.5.66-bk8/fs/quota_v2.c Wed Apr 2 04:38:15 2003 @@ -15,6 +15,10 @@ #include #include +MODULE_AUTHOR("Jan Kara"); +MODULE_DESCRIPTION("Quota format v2 support"); +MODULE_LICENSE("GPL"); + #define __QUOTA_V2_PARANOIA typedef char *dqbuf_t; diff -urN linux-2.5.66-bk7/fs/sysfs/bin.c linux-2.5.66-bk8/fs/sysfs/bin.c --- linux-2.5.66-bk7/fs/sysfs/bin.c Mon Mar 24 14:00:38 2003 +++ linux-2.5.66-bk8/fs/sysfs/bin.c Wed Apr 2 04:38:15 2003 @@ -6,6 +6,8 @@ #include #include +#include + #include "sysfs.h" static struct file_operations bin_fops; diff -urN linux-2.5.66-bk7/fs/sysfs/file.c linux-2.5.66-bk8/fs/sysfs/file.c --- linux-2.5.66-bk7/fs/sysfs/file.c Mon Mar 24 13:59:55 2003 +++ linux-2.5.66-bk8/fs/sysfs/file.c Wed Apr 2 04:38:15 2003 @@ -5,6 +5,7 @@ #include #include #include +#include #include "sysfs.h" diff -urN linux-2.5.66-bk7/include/acpi/acconfig.h linux-2.5.66-bk8/include/acpi/acconfig.h --- linux-2.5.66-bk7/include/acpi/acconfig.h Mon Mar 24 14:01:14 2003 +++ linux-2.5.66-bk8/include/acpi/acconfig.h Wed Apr 2 04:38:16 2003 @@ -72,7 +72,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20030228 +#define ACPI_CA_VERSION 0x20030328 /* Version of ACPI supported */ diff -urN linux-2.5.66-bk7/include/acpi/acevents.h linux-2.5.66-bk8/include/acpi/acevents.h --- linux-2.5.66-bk7/include/acpi/acevents.h Mon Mar 24 14:00:48 2003 +++ linux-2.5.66-bk8/include/acpi/acevents.h Wed Apr 2 04:38:16 2003 @@ -109,21 +109,44 @@ * Evgpe - GPE handling and dispatch */ +acpi_status +acpi_ev_walk_gpe_list ( + ACPI_GPE_CALLBACK gpe_walk_callback); + +u8 +acpi_ev_valid_gpe_event ( + struct acpi_gpe_event_info *gpe_event_info); + struct acpi_gpe_event_info * acpi_ev_get_gpe_event_info ( + acpi_handle gpe_device, u32 gpe_number); acpi_status acpi_ev_gpe_initialize ( void); +acpi_status +acpi_ev_create_gpe_block ( + struct acpi_namespace_node *gpe_device, + struct acpi_generic_address *gpe_block_address, + u32 register_count, + u8 gpe_block_base_number, + u32 interrupt_level, + struct acpi_gpe_block_info **return_gpe_block); + +acpi_status +acpi_ev_delete_gpe_block ( + struct acpi_gpe_block_info *gpe_block); + u32 acpi_ev_gpe_dispatch ( - struct acpi_gpe_event_info *gpe_event_info); + struct acpi_gpe_event_info *gpe_event_info, + u32 gpe_number); u32 acpi_ev_gpe_detect ( - void); + struct acpi_gpe_xrupt_info *gpe_xrupt_list); /* * Evregion - Address Space handling @@ -216,6 +239,10 @@ * Evsci - SCI (System Control Interrupt) handling/dispatch */ +u32 ACPI_SYSTEM_XFACE +acpi_ev_gpe_xrupt_handler ( + void *context); + u32 acpi_ev_install_sci_handler ( void); diff -urN linux-2.5.66-bk7/include/acpi/acglobal.h linux-2.5.66-bk8/include/acpi/acglobal.h --- linux-2.5.66-bk7/include/acpi/acglobal.h Mon Mar 24 13:59:46 2003 +++ linux-2.5.66-bk8/include/acpi/acglobal.h Wed Apr 2 04:38:16 2003 @@ -234,7 +234,9 @@ extern struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; ACPI_EXTERN struct acpi_fixed_event_handler acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; -ACPI_EXTERN struct acpi_gpe_block_info *acpi_gbl_gpe_block_list_head; +ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; +ACPI_EXTERN struct acpi_gpe_block_info *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; +ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; /***************************************************************************** diff -urN linux-2.5.66-bk7/include/acpi/achware.h linux-2.5.66-bk8/include/acpi/achware.h --- linux-2.5.66-bk7/include/acpi/achware.h Mon Mar 24 14:00:49 2003 +++ linux-2.5.66-bk8/include/acpi/achware.h Wed Apr 2 04:38:16 2003 @@ -127,6 +127,11 @@ acpi_hw_disable_gpe ( struct acpi_gpe_event_info *gpe_event_info); +acpi_status +acpi_hw_disable_gpe_block ( + struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); + void acpi_hw_disable_gpe_for_wakeup ( struct acpi_gpe_event_info *gpe_event_info); @@ -136,8 +141,13 @@ struct acpi_gpe_event_info *gpe_event_info); acpi_status +acpi_hw_clear_gpe_block ( + struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); + +acpi_status acpi_hw_get_gpe_status ( - u32 gpe_number, + struct acpi_gpe_event_info *gpe_event_info, acpi_event_status *event_status); acpi_status diff -urN linux-2.5.66-bk7/include/acpi/aclocal.h linux-2.5.66-bk8/include/acpi/aclocal.h --- linux-2.5.66-bk7/include/acpi/aclocal.h Mon Mar 24 14:00:50 2003 +++ linux-2.5.66-bk8/include/acpi/aclocal.h Wed Apr 2 04:38:16 2003 @@ -308,19 +308,19 @@ * ****************************************************************************/ -/* Information about each particular GPE level */ +/* Information about a GPE, one per each GPE in an array */ struct acpi_gpe_event_info { struct acpi_namespace_node *method_node; /* Method node for this GPE level */ acpi_gpe_handler handler; /* Address of handler, if any */ void *context; /* Context to be passed to handler */ - struct acpi_gpe_register_info *register_info; - u8 type; /* Level or Edge */ - u8 bit_mask; + struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ + u8 flags; /* Level or Edge */ + u8 bit_mask; /* This GPE within the register */ }; -/* Information about a particular GPE register pair */ +/* Information about a GPE register pair, one per each status/enable pair in an array */ struct acpi_gpe_register_info { @@ -332,25 +332,37 @@ u8 base_gpe_number; /* Base GPE number for this register */ }; - -#define ACPI_GPE_LEVEL_TRIGGERED 1 -#define ACPI_GPE_EDGE_TRIGGERED 2 - - -/* Information about each GPE register block */ - +/* + * Information about a GPE register block, one per each installed block -- + * GPE0, GPE1, and one per each installed GPE Block Device. + */ struct acpi_gpe_block_info { struct acpi_gpe_block_info *previous; struct acpi_gpe_block_info *next; - struct acpi_gpe_block_info *next_on_interrupt; - struct acpi_gpe_register_info *register_info; - struct acpi_gpe_event_info *event_info; - struct acpi_generic_address block_address; - u32 register_count; - u8 block_base_number; + struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ + struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ + struct acpi_gpe_event_info *event_info; /* One for each GPE */ + struct acpi_generic_address block_address; /* Base address of the block */ + u32 register_count; /* Number of register pairs in block */ + u8 block_base_number;/* Base GPE number for this block */ }; +/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ + +struct acpi_gpe_xrupt_info +{ + struct acpi_gpe_xrupt_info *previous; + struct acpi_gpe_xrupt_info *next; + struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ + u32 interrupt_level; /* System interrupt level */ +}; + + +typedef acpi_status (*ACPI_GPE_CALLBACK) ( + struct acpi_gpe_xrupt_info *gpe_xrupt_info, + struct acpi_gpe_block_info *gpe_block); + /* Information about each particular fixed event */ @@ -360,7 +372,6 @@ void *context; /* Context to be passed to handler */ }; - struct acpi_fixed_event_info { u8 status_register_id; diff -urN linux-2.5.66-bk7/include/acpi/acobject.h linux-2.5.66-bk8/include/acpi/acobject.h --- linux-2.5.66-bk7/include/acpi/acobject.h Mon Mar 24 14:00:01 2003 +++ linux-2.5.66-bk8/include/acpi/acobject.h Wed Apr 2 04:38:16 2003 @@ -239,6 +239,7 @@ { ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO + struct acpi_gpe_block_info *gpe_block; }; diff -urN linux-2.5.66-bk7/include/acpi/acpiosxf.h linux-2.5.66-bk8/include/acpi/acpiosxf.h --- linux-2.5.66-bk7/include/acpi/acpiosxf.h Mon Mar 24 13:59:54 2003 +++ linux-2.5.66-bk8/include/acpi/acpiosxf.h Wed Apr 2 04:38:16 2003 @@ -77,19 +77,6 @@ /* - * Types specific to the OS service interfaces - */ - -typedef u32 -(ACPI_SYSTEM_XFACE *OSD_HANDLER) ( - void *context); - -typedef void -(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) ( - void *context); - - -/* * OSL Initialization and shutdown primitives */ @@ -147,6 +134,24 @@ acpi_handle handle, u32 units); +acpi_status +acpi_os_create_lock ( + acpi_handle *out_handle); + +void +acpi_os_delete_lock ( + acpi_handle handle); + +void +acpi_os_acquire_lock ( + acpi_handle handle, + u32 flags); + +void +acpi_os_release_lock ( + acpi_handle handle, + u32 flags); + /* * Memory allocation and mapping diff -urN linux-2.5.66-bk7/include/acpi/acpixf.h linux-2.5.66-bk8/include/acpi/acpixf.h --- linux-2.5.66-bk7/include/acpi/acpixf.h Mon Mar 24 13:59:52 2003 +++ linux-2.5.66-bk8/include/acpi/acpixf.h Wed Apr 2 04:38:16 2003 @@ -293,6 +293,7 @@ acpi_status acpi_install_gpe_handler ( + acpi_handle gpe_device, u32 gpe_number, u32 type, acpi_gpe_handler handler, @@ -309,32 +310,66 @@ acpi_status acpi_remove_gpe_handler ( + acpi_handle gpe_device, u32 gpe_number, acpi_gpe_handler handler); acpi_status acpi_enable_event ( - u32 acpi_event, - u32 type, + u32 event, u32 flags); acpi_status acpi_disable_event ( - u32 acpi_event, - u32 type, + u32 event, u32 flags); acpi_status acpi_clear_event ( - u32 acpi_event, - u32 type); + u32 event); acpi_status acpi_get_event_status ( - u32 acpi_event, - u32 type, + u32 event, + acpi_event_status *event_status); + +acpi_status +acpi_enable_gpe ( + acpi_handle gpe_device, + u32 gpe_number, + u32 flags); + +acpi_status +acpi_disable_gpe ( + acpi_handle gpe_device, + u32 gpe_number, + u32 flags); + +acpi_status +acpi_clear_gpe ( + acpi_handle gpe_device, + u32 gpe_number, + u32 flags); + +acpi_status +acpi_get_gpe_status ( + acpi_handle gpe_device, + u32 gpe_number, + u32 flags, acpi_event_status *event_status); +acpi_status +acpi_install_gpe_block ( + acpi_handle gpe_device, + struct acpi_generic_address *gpe_block_address, + u32 register_count, + u32 interrupt_level); + +acpi_status +acpi_remove_gpe_block ( + acpi_handle gpe_device); + + /* * Resource interfaces */ diff -urN linux-2.5.66-bk7/include/acpi/actypes.h linux-2.5.66-bk8/include/acpi/actypes.h --- linux-2.5.66-bk7/include/acpi/actypes.h Mon Mar 24 14:00:49 2003 +++ linux-2.5.66-bk8/include/acpi/actypes.h Wed Apr 2 04:38:16 2003 @@ -516,13 +516,10 @@ /* - * acpi_event Types: Fixed & General Purpose + * Acpi Event Types: Fixed & General Purpose */ typedef u32 acpi_event_type; -#define ACPI_EVENT_FIXED 0 -#define ACPI_EVENT_GPE 1 - /* * Fixed events */ @@ -542,10 +539,13 @@ #define ACPI_EVENT_EDGE_TRIGGERED 2 /* - * GPEs + * Flags for GPE and Lock interfaces */ -#define ACPI_EVENT_WAKE_ENABLE 0x1 -#define ACPI_EVENT_WAKE_DISABLE 0x1 +#define ACPI_EVENT_WAKE_ENABLE 0x2 +#define ACPI_EVENT_WAKE_DISABLE 0x2 + +#define ACPI_NOT_ISR 0x1 +#define ACPI_ISR 0x0 /* @@ -752,6 +752,18 @@ /* + * Types specific to the OS service interfaces + */ + +typedef u32 +(ACPI_SYSTEM_XFACE *OSD_HANDLER) ( + void *context); + +typedef void +(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) ( + void *context); + +/* * Various handlers and callback procedures */ typedef diff -urN linux-2.5.66-bk7/include/asm-alpha/ioctls.h linux-2.5.66-bk8/include/asm-alpha/ioctls.h --- linux-2.5.66-bk7/include/asm-alpha/ioctls.h Mon Mar 24 14:01:13 2003 +++ linux-2.5.66-bk8/include/asm-alpha/ioctls.h Wed Apr 2 04:38:16 2003 @@ -86,7 +86,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-alpha/softirq.h linux-2.5.66-bk8/include/asm-alpha/softirq.h --- linux-2.5.66-bk7/include/asm-alpha/softirq.h Mon Mar 24 14:00:15 2003 +++ linux-2.5.66-bk8/include/asm-alpha/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,21 +0,0 @@ -#ifndef _ALPHA_SOFTIRQ_H -#define _ALPHA_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && \ - softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* _ALPHA_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-arm/hardirq.h linux-2.5.66-bk8/include/asm-arm/hardirq.h --- linux-2.5.66-bk7/include/asm-arm/hardirq.h Mon Mar 24 14:00:49 2003 +++ linux-2.5.66-bk8/include/asm-arm/hardirq.h Wed Apr 2 04:38:16 2003 @@ -5,7 +5,6 @@ #include #include -/* softirq.h is sensitive to the offsets of these fields */ typedef struct { unsigned int __softirq_pending; unsigned int __local_irq_count; diff -urN linux-2.5.66-bk7/include/asm-arm/ioctls.h linux-2.5.66-bk8/include/asm-arm/ioctls.h --- linux-2.5.66-bk7/include/asm-arm/ioctls.h Mon Mar 24 14:00:23 2003 +++ linux-2.5.66-bk8/include/asm-arm/ioctls.h Wed Apr 2 04:38:16 2003 @@ -43,7 +43,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-arm/softirq.h linux-2.5.66-bk8/include/asm-arm/softirq.h --- linux-2.5.66-bk7/include/asm-arm/softirq.h Mon Mar 24 14:00:18 2003 +++ linux-2.5.66-bk8/include/asm-arm/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,20 +0,0 @@ -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \ - __asm__("bl%? __do_softirq": : : "lr");/* out of line */\ - preempt_check_resched(); \ -} while (0) - -#endif /* __ASM_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-cris/ioctls.h linux-2.5.66-bk8/include/asm-cris/ioctls.h --- linux-2.5.66-bk7/include/asm-cris/ioctls.h Mon Mar 24 14:00:51 2003 +++ linux-2.5.66-bk8/include/asm-cris/ioctls.h Wed Apr 2 04:38:16 2003 @@ -45,7 +45,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-cris/softirq.h linux-2.5.66-bk8/include/asm-cris/softirq.h --- linux-2.5.66-bk7/include/asm-cris/softirq.h Mon Mar 24 14:00:10 2003 +++ linux-2.5.66-bk8/include/asm-cris/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,30 +0,0 @@ -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ -do { \ - local_bh_count(smp_processor_id())++; \ - barrier(); \ -} while (0) - -#define __local_bh_enable() \ -do { \ - barrier(); \ - local_bh_count(smp_processor_id())--; \ -} while (0) - -#define local_bh_enable() \ -do { \ - if (!--local_bh_count(smp_processor_id()) \ - && softirq_pending(smp_processor_id())) { \ - do_softirq(); \ - local_irq_enable(); \ - } \ -} while (0) - -#define in_softirq() (local_bh_count(smp_processor_id()) != 0) - -#endif /* __ASM_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-i386/dma.h linux-2.5.66-bk8/include/asm-i386/dma.h --- linux-2.5.66-bk7/include/asm-i386/dma.h Mon Mar 24 14:00:39 2003 +++ linux-2.5.66-bk8/include/asm-i386/dma.h Wed Apr 2 04:38:16 2003 @@ -239,7 +239,7 @@ } -/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for +/* Set transfer size (max 64k for DMA0..3, 128k for DMA5..7) for * a specific DMA channel. * You must ensure the parameters are valid. * NOTE: from a manual: "the number of transfers is one more diff -urN linux-2.5.66-bk7/include/asm-i386/floppy.h linux-2.5.66-bk8/include/asm-i386/floppy.h --- linux-2.5.66-bk7/include/asm-i386/floppy.h Mon Mar 24 14:00:10 2003 +++ linux-2.5.66-bk8/include/asm-i386/floppy.h Wed Apr 2 04:38:16 2003 @@ -22,7 +22,7 @@ * floppy accesses go through the track buffer. */ #define _CROSS_64KB(a,s,vdma) \ -(!vdma && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)) +(!(vdma) && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)) #define CROSS_64KB(a,s) _CROSS_64KB(a,s,use_virtual_dma & 1) diff -urN linux-2.5.66-bk7/include/asm-i386/hardirq.h linux-2.5.66-bk8/include/asm-i386/hardirq.h --- linux-2.5.66-bk7/include/asm-i386/hardirq.h Mon Mar 24 14:01:13 2003 +++ linux-2.5.66-bk8/include/asm-i386/hardirq.h Wed Apr 2 04:38:16 2003 @@ -5,7 +5,6 @@ #include #include -/* assembly code in softirq.h is sensitive to the offsets of these fields */ typedef struct { unsigned int __softirq_pending; unsigned int __syscall_count; diff -urN linux-2.5.66-bk7/include/asm-i386/ioctls.h linux-2.5.66-bk8/include/asm-i386/ioctls.h --- linux-2.5.66-bk7/include/asm-i386/ioctls.h Mon Mar 24 14:00:00 2003 +++ linux-2.5.66-bk8/include/asm-i386/ioctls.h Wed Apr 2 04:38:16 2003 @@ -43,14 +43,14 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ +/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ -#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ +#define FIONCLEX 0x5450 #define FIOCLEX 0x5451 #define FIOASYNC 0x5452 #define TIOCSERCONFIG 0x5453 diff -urN linux-2.5.66-bk7/include/asm-i386/softirq.h linux-2.5.66-bk8/include/asm-i386/softirq.h --- linux-2.5.66-bk7/include/asm-i386/softirq.h Mon Mar 24 14:01:46 2003 +++ linux-2.5.66-bk8/include/asm-i386/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,20 +0,0 @@ -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* __ASM_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-ia64/ioctls.h linux-2.5.66-bk8/include/asm-ia64/ioctls.h --- linux-2.5.66-bk7/include/asm-ia64/ioctls.h Mon Mar 24 14:00:02 2003 +++ linux-2.5.66-bk8/include/asm-ia64/ioctls.h Wed Apr 2 04:38:16 2003 @@ -48,7 +48,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-ia64/softirq.h linux-2.5.66-bk8/include/asm-ia64/softirq.h --- linux-2.5.66-bk7/include/asm-ia64/softirq.h Mon Mar 24 14:01:17 2003 +++ linux-2.5.66-bk8/include/asm-ia64/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,26 +0,0 @@ -#ifndef _ASM_IA64_SOFTIRQ_H -#define _ASM_IA64_SOFTIRQ_H - -#include - -/* - * Copyright (C) 1998-2002 Hewlett-Packard Co - * David Mosberger-Tang - */ -#include -#include - -#include - -#define __local_bh_enable() do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_disable() do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && local_softirq_pending())) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* _ASM_IA64_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-m68k/ioctls.h linux-2.5.66-bk8/include/asm-m68k/ioctls.h --- linux-2.5.66-bk7/include/asm-m68k/ioctls.h Mon Mar 24 14:00:01 2003 +++ linux-2.5.66-bk8/include/asm-m68k/ioctls.h Wed Apr 2 04:38:16 2003 @@ -43,7 +43,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-m68k/softirq.h linux-2.5.66-bk8/include/asm-m68k/softirq.h --- linux-2.5.66-bk7/include/asm-m68k/softirq.h Mon Mar 24 14:00:08 2003 +++ linux-2.5.66-bk8/include/asm-m68k/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,24 +0,0 @@ -#ifndef __M68K_SOFTIRQ_H -#define __M68K_SOFTIRQ_H - -/* - * Software interrupts.. no SMP here either. - */ - -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif diff -urN linux-2.5.66-bk7/include/asm-m68knommu/softirq.h linux-2.5.66-bk8/include/asm-m68knommu/softirq.h --- linux-2.5.66-bk7/include/asm-m68knommu/softirq.h Mon Mar 24 14:00:24 2003 +++ linux-2.5.66-bk8/include/asm-m68knommu/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,20 +0,0 @@ -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* __ASM_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-mips/ioctls.h linux-2.5.66-bk8/include/asm-mips/ioctls.h --- linux-2.5.66-bk7/include/asm-mips/ioctls.h Mon Mar 24 14:01:24 2003 +++ linux-2.5.66-bk8/include/asm-mips/ioctls.h Wed Apr 2 04:38:16 2003 @@ -74,6 +74,12 @@ /* #define TIOCSETD _IOW('t', 27, int) set line discipline */ /* 127-124 compat */ +#define TIOCSBRK 0x5427 /* BSD compatibility */ +#define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x7416 /* Return the session ID of FD */ +#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ +#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ + /* I hope the range from 0x5480 on is free ... */ #define TIOCSCTTY 0x5480 /* become controlling tty */ #define TIOCGSOFTCAR 0x5481 @@ -81,15 +87,7 @@ #define TIOCLINUX 0x5483 #define TIOCGSERIAL 0x5484 #define TIOCSSERIAL 0x5485 - #define TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5487 /* For debugging only */ -#define TIOCSBRK 0x5427 /* BSD compatibility */ -#define TIOCCBRK 0x5428 /* BSD compatibility */ -#define TIOCGSID 0x7416 /* Return the session ID of FD */ -#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ -#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ - #define TIOCSERCONFIG 0x5488 #define TIOCSERGWILD 0x5489 #define TIOCSERSWILD 0x548a diff -urN linux-2.5.66-bk7/include/asm-mips/softirq.h linux-2.5.66-bk8/include/asm-mips/softirq.h --- linux-2.5.66-bk7/include/asm-mips/softirq.h Mon Mar 24 14:00:45 2003 +++ linux-2.5.66-bk8/include/asm-mips/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,45 +0,0 @@ -/* - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1997, 1998, 1999, 2000, 2001 Ralf Baechle - * Copyright (C) 1999, 2000 Silicon Graphics, Inc. - * Copyright (C) 1999, 2001 MIPS Technologies, Inc. - */ -#ifndef _ASM_SOFTIRQ_H -#define _ASM_SOFTIRQ_H - -#include -#include - -extern inline void cpu_bh_disable(int cpu) -{ - local_bh_count(cpu)++; - barrier(); -} - -extern inline void __cpu_bh_enable(int cpu) -{ - barrier(); - local_bh_count(cpu)--; -} - - -#define local_bh_disable() cpu_bh_disable(smp_processor_id()) -#define __local_bh_enable() __cpu_bh_enable(smp_processor_id()) -#define local_bh_enable() \ -do { \ - int cpu; \ - \ - barrier(); \ - cpu = smp_processor_id(); \ - if (!--local_bh_count(cpu) && softirq_pending(cpu)) \ - do_softirq(); \ -} while (0) - -#define in_softirq() (local_bh_count(smp_processor_id()) != 0) - -#define __cpu_raise_softirq(cpu, nr) set_bit(nr, &softirq_pending(cpu)) - -#endif /* _ASM_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-mips64/ioctls.h linux-2.5.66-bk8/include/asm-mips64/ioctls.h --- linux-2.5.66-bk7/include/asm-mips64/ioctls.h Mon Mar 24 14:01:14 2003 +++ linux-2.5.66-bk8/include/asm-mips64/ioctls.h Wed Apr 2 04:38:16 2003 @@ -74,6 +74,12 @@ /* #define TIOCSETD _IOW('t', 27, int) set line discipline */ /* 127-124 compat */ +#define TIOCSBRK 0x5427 /* BSD compatibility */ +#define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x7416 /* Return the session ID of FD */ +#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ +#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ + /* I hope the range from 0x5480 on is free ... */ #define TIOCSCTTY 0x5480 /* become controlling tty */ #define TIOCGSOFTCAR 0x5481 @@ -81,15 +87,7 @@ #define TIOCLINUX 0x5483 #define TIOCGSERIAL 0x5484 #define TIOCSSERIAL 0x5485 - #define TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5487 /* For debugging only */ -#define TIOCSBRK 0x5427 /* BSD compatibility */ -#define TIOCCBRK 0x5428 /* BSD compatibility */ -#define TIOCGSID 0x7416 /* Return the session ID of FD */ -#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ -#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ - #define TIOCSERCONFIG 0x5488 #define TIOCSERGWILD 0x5489 #define TIOCSERSWILD 0x548a diff -urN linux-2.5.66-bk7/include/asm-mips64/softirq.h linux-2.5.66-bk8/include/asm-mips64/softirq.h --- linux-2.5.66-bk7/include/asm-mips64/softirq.h Mon Mar 24 14:00:40 2003 +++ linux-2.5.66-bk8/include/asm-mips64/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,57 +0,0 @@ -/* - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1997, 1998, 1999, 2000, 2001 by Ralf Baechle - * Copyright (C) 1999, 2000 Silicon Graphics, Inc. - * Copyright (C) 2001 MIPS Technologies, Inc. - */ -#ifndef _ASM_SOFTIRQ_H -#define _ASM_SOFTIRQ_H - -#include -#include - -extern inline void cpu_bh_disable(int cpu) -{ - local_bh_count(cpu)++; - barrier(); -} - -extern inline void __cpu_bh_enable(int cpu) -{ - barrier(); - local_bh_count(cpu)--; -} - -#define local_bh_disable() cpu_bh_disable(smp_processor_id()) -#define __local_bh_enable() __cpu_bh_enable(smp_processor_id()) -#define local_bh_enable() \ -do { \ - int cpu; \ - \ - barrier(); \ - cpu = smp_processor_id(); \ - if (!--local_bh_count(cpu) && softirq_pending(cpu)) \ - do_softirq(); \ -} while (0) - -#define in_softirq() (local_bh_count(smp_processor_id()) != 0) - -extern inline void __cpu_raise_softirq(int cpu, int nr) -{ - unsigned int *m = (unsigned int *) &softirq_pending(cpu); - unsigned int temp; - - __asm__ __volatile__( - "1:\tll\t%0, %1\t\t\t# __cpu_raise_softirq\n\t" - "or\t%0, %2\n\t" - "sc\t%0, %1\n\t" - "beqz\t%0, 1b" - : "=&r" (temp), "=m" (*m) - : "ir" (1UL << nr), "m" (*m) - : "memory"); -} - -#endif /* _ASM_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-parisc/compat.h linux-2.5.66-bk8/include/asm-parisc/compat.h --- linux-2.5.66-bk7/include/asm-parisc/compat.h Mon Mar 24 14:01:53 2003 +++ linux-2.5.66-bk8/include/asm-parisc/compat.h Wed Apr 2 04:38:16 2003 @@ -24,6 +24,11 @@ typedef s32 compat_daddr_t; typedef u32 compat_caddr_t; +typedef s32 compat_int_t; +typedef s32 compat_long_t; +typedef u32 compat_uint_t; +typedef u32 compat_ulong_t; + struct compat_timespec { compat_time_t tv_sec; s32 tv_nsec; diff -urN linux-2.5.66-bk7/include/asm-parisc/ioctls.h linux-2.5.66-bk8/include/asm-parisc/ioctls.h --- linux-2.5.66-bk7/include/asm-parisc/ioctls.h Mon Mar 24 14:00:01 2003 +++ linux-2.5.66-bk8/include/asm-parisc/ioctls.h Wed Apr 2 04:38:16 2003 @@ -43,7 +43,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID _IOR('T', 20, int) /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-parisc/softirq.h linux-2.5.66-bk8/include/asm-parisc/softirq.h --- linux-2.5.66-bk7/include/asm-parisc/softirq.h Mon Mar 24 14:01:48 2003 +++ linux-2.5.66-bk8/include/asm-parisc/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,20 +0,0 @@ -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* __ASM_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-ppc/ioctls.h linux-2.5.66-bk8/include/asm-ppc/ioctls.h --- linux-2.5.66-bk7/include/asm-ppc/ioctls.h Mon Mar 24 14:01:17 2003 +++ linux-2.5.66-bk8/include/asm-ppc/ioctls.h Wed Apr 2 04:38:16 2003 @@ -83,7 +83,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-ppc/softirq.h linux-2.5.66-bk8/include/asm-ppc/softirq.h --- linux-2.5.66-bk7/include/asm-ppc/softirq.h Mon Mar 24 14:01:12 2003 +++ linux-2.5.66-bk8/include/asm-ppc/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,31 +0,0 @@ -#ifdef __KERNEL__ -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ -do { \ - preempt_count() += SOFTIRQ_OFFSET; \ - barrier(); \ -} while (0) - -#define __local_bh_enable() \ -do { \ - barrier(); \ - preempt_count() -= SOFTIRQ_OFFSET; \ -} while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() \ - && softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - if (preempt_count() == 0) \ - preempt_check_resched(); \ -} while (0) - -#endif /* __ASM_SOFTIRQ_H */ -#endif /* __KERNEL__ */ diff -urN linux-2.5.66-bk7/include/asm-ppc/termios.h linux-2.5.66-bk8/include/asm-ppc/termios.h --- linux-2.5.66-bk7/include/asm-ppc/termios.h Mon Mar 24 14:01:50 2003 +++ linux-2.5.66-bk8/include/asm-ppc/termios.h Wed Apr 2 04:38:16 2003 @@ -97,7 +97,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 diff -urN linux-2.5.66-bk7/include/asm-ppc64/compat.h linux-2.5.66-bk8/include/asm-ppc64/compat.h --- linux-2.5.66-bk7/include/asm-ppc64/compat.h Mon Mar 24 14:00:10 2003 +++ linux-2.5.66-bk8/include/asm-ppc64/compat.h Wed Apr 2 04:38:16 2003 @@ -25,6 +25,11 @@ typedef u32 compat_caddr_t; typedef __kernel_fsid_t compat_fsid_t; +typedef s32 compat_int_t; +typedef s32 compat_long_t; +typedef u32 compat_uint_t; +typedef u32 compat_ulong_t; + struct compat_timespec { compat_time_t tv_sec; s32 tv_nsec; diff -urN linux-2.5.66-bk7/include/asm-ppc64/ioctls.h linux-2.5.66-bk8/include/asm-ppc64/ioctls.h --- linux-2.5.66-bk7/include/asm-ppc64/ioctls.h Mon Mar 24 13:59:53 2003 +++ linux-2.5.66-bk8/include/asm-ppc64/ioctls.h Wed Apr 2 04:38:16 2003 @@ -90,7 +90,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-ppc64/softirq.h linux-2.5.66-bk8/include/asm-ppc64/softirq.h --- linux-2.5.66-bk7/include/asm-ppc64/softirq.h Mon Mar 24 13:59:54 2003 +++ linux-2.5.66-bk8/include/asm-ppc64/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,27 +0,0 @@ -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -/* - * 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 - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* __ASM_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-ppc64/termios.h linux-2.5.66-bk8/include/asm-ppc64/termios.h --- linux-2.5.66-bk7/include/asm-ppc64/termios.h Mon Mar 24 13:59:55 2003 +++ linux-2.5.66-bk8/include/asm-ppc64/termios.h Wed Apr 2 04:38:16 2003 @@ -152,7 +152,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 diff -urN linux-2.5.66-bk7/include/asm-s390/ioctls.h linux-2.5.66-bk8/include/asm-s390/ioctls.h --- linux-2.5.66-bk7/include/asm-s390/ioctls.h Mon Mar 24 14:00:45 2003 +++ linux-2.5.66-bk8/include/asm-s390/ioctls.h Wed Apr 2 04:38:16 2003 @@ -51,7 +51,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-s390/softirq.h linux-2.5.66-bk8/include/asm-s390/softirq.h --- linux-2.5.66-bk7/include/asm-s390/softirq.h Mon Mar 24 14:01:14 2003 +++ linux-2.5.66-bk8/include/asm-s390/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,42 +0,0 @@ -/* - * include/asm-s390/softirq.h - * - * S390 version - * - * Derived from "include/asm-i386/softirq.h" - */ - -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -#include -#include - -#include -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -extern void do_call_softirq(void); - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (!in_interrupt() && softirq_pending(smp_processor_id())) \ - /* Use the async. stack for softirq */ \ - do_call_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* __ASM_SOFTIRQ_H */ - - - - - - - diff -urN linux-2.5.66-bk7/include/asm-s390x/compat.h linux-2.5.66-bk8/include/asm-s390x/compat.h --- linux-2.5.66-bk7/include/asm-s390x/compat.h Mon Mar 24 14:00:38 2003 +++ linux-2.5.66-bk8/include/asm-s390x/compat.h Wed Apr 2 04:38:16 2003 @@ -25,6 +25,11 @@ typedef u32 compat_caddr_t; typedef __kernel_fsid_t compat_fsid_t; +typedef s32 compat_int_t; +typedef s32 compat_long_t; +typedef u32 compat_uint_t; +typedef u32 compat_ulong_t; + struct compat_timespec { compat_time_t tv_sec; s32 tv_nsec; diff -urN linux-2.5.66-bk7/include/asm-s390x/ioctls.h linux-2.5.66-bk8/include/asm-s390x/ioctls.h --- linux-2.5.66-bk7/include/asm-s390x/ioctls.h Mon Mar 24 14:00:15 2003 +++ linux-2.5.66-bk8/include/asm-s390x/ioctls.h Wed Apr 2 04:38:16 2003 @@ -51,7 +51,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-s390x/softirq.h linux-2.5.66-bk8/include/asm-s390x/softirq.h --- linux-2.5.66-bk7/include/asm-s390x/softirq.h Mon Mar 24 14:00:08 2003 +++ linux-2.5.66-bk8/include/asm-s390x/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,42 +0,0 @@ -/* - * include/asm-s390/softirq.h - * - * S390 version - * - * Derived from "include/asm-i386/softirq.h" - */ - -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -#include -#include - -#include -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -extern void do_call_softirq(void); - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (!in_interrupt() && softirq_pending(smp_processor_id())) \ - /* Use the async. stack for softirq */ \ - do_call_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* __ASM_SOFTIRQ_H */ - - - - - - - diff -urN linux-2.5.66-bk7/include/asm-sh/ioctls.h linux-2.5.66-bk8/include/asm-sh/ioctls.h --- linux-2.5.66-bk7/include/asm-sh/ioctls.h Mon Mar 24 14:00:54 2003 +++ linux-2.5.66-bk8/include/asm-sh/ioctls.h Wed Apr 2 04:38:16 2003 @@ -75,7 +75,6 @@ #define TIOCSETD _IOW('T', 35, int) /* 0x5423 */ #define TIOCGETD _IOR('T', 36, int) /* 0x5424 */ #define TCSBRKP _IOW('T', 37, int) /* 0x5425 */ /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* 0x5426 */ /* For debugging only */ #define TIOCSBRK _IO('T', 39) /* 0x5427 */ /* BSD compatibility */ #define TIOCCBRK _IO('T', 40) /* 0x5428 */ /* BSD compatibility */ #define TIOCGSID _IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-sh/softirq.h linux-2.5.66-bk8/include/asm-sh/softirq.h --- linux-2.5.66-bk7/include/asm-sh/softirq.h Mon Mar 24 14:01:12 2003 +++ linux-2.5.66-bk8/include/asm-sh/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,30 +0,0 @@ -#ifndef __ASM_SH_SOFTIRQ_H -#define __ASM_SH_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ -do { \ - local_bh_count(smp_processor_id())++; \ - barrier(); \ -} while (0) - -#define __local_bh_enable() \ -do { \ - barrier(); \ - local_bh_count(smp_processor_id())--; \ -} while (0) - -#define local_bh_enable() \ -do { \ - barrier(); \ - if (!--local_bh_count(smp_processor_id()) \ - && softirq_pending(smp_processor_id())) { \ - do_softirq(); \ - } \ -} while (0) - -#define in_softirq() (local_bh_count(smp_processor_id()) != 0) - -#endif /* __ASM_SH_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-sparc/ioctls.h linux-2.5.66-bk8/include/asm-sparc/ioctls.h --- linux-2.5.66-bk7/include/asm-sparc/ioctls.h Mon Mar 24 14:00:22 2003 +++ linux-2.5.66-bk8/include/asm-sparc/ioctls.h Wed Apr 2 04:38:16 2003 @@ -99,7 +99,6 @@ #define TIOCGSERIAL 0x541E #define TIOCSSERIAL 0x541F #define TCSBRKP 0x5425 -#define TIOCTTYGSTRUCT 0x5426 #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 #define TIOCSERSWILD 0x5455 diff -urN linux-2.5.66-bk7/include/asm-sparc/softirq.h linux-2.5.66-bk8/include/asm-sparc/softirq.h --- linux-2.5.66-bk7/include/asm-sparc/softirq.h Mon Mar 24 13:59:55 2003 +++ linux-2.5.66-bk8/include/asm-sparc/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,31 +0,0 @@ -/* softirq.h: 32-bit Sparc soft IRQ support. - * - * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1998-99 Anton Blanchard (anton@progsoc.uts.edu.au) - */ - -#ifndef __SPARC_SOFTIRQ_H -#define __SPARC_SOFTIRQ_H - -// #include /* For NR_CPUS */ - -// #include -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (!in_interrupt() && \ - softirq_pending(smp_processor_id())) { \ - do_softirq(); \ - } \ - preempt_check_resched(); \ -} while (0) - -#endif /* __SPARC_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/asm-sparc64/compat.h linux-2.5.66-bk8/include/asm-sparc64/compat.h --- linux-2.5.66-bk7/include/asm-sparc64/compat.h Mon Mar 24 14:00:50 2003 +++ linux-2.5.66-bk8/include/asm-sparc64/compat.h Wed Apr 2 04:38:16 2003 @@ -25,6 +25,11 @@ typedef u32 compat_caddr_t; typedef __kernel_fsid_t compat_fsid_t; +typedef s32 compat_int_t; +typedef s32 compat_long_t; +typedef u32 compat_uint_t; +typedef u32 compat_ulong_t; + struct compat_timespec { compat_time_t tv_sec; s32 tv_nsec; diff -urN linux-2.5.66-bk7/include/asm-sparc64/ioctls.h linux-2.5.66-bk8/include/asm-sparc64/ioctls.h --- linux-2.5.66-bk7/include/asm-sparc64/ioctls.h Mon Mar 24 14:00:40 2003 +++ linux-2.5.66-bk8/include/asm-sparc64/ioctls.h Wed Apr 2 04:38:16 2003 @@ -100,7 +100,6 @@ #define TIOCGSERIAL 0x541E #define TIOCSSERIAL 0x541F #define TCSBRKP 0x5425 -#define TIOCTTYGSTRUCT 0x5426 #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 #define TIOCSERSWILD 0x5455 diff -urN linux-2.5.66-bk7/include/asm-sparc64/softirq.h linux-2.5.66-bk8/include/asm-sparc64/softirq.h --- linux-2.5.66-bk7/include/asm-sparc64/softirq.h Mon Mar 24 14:01:49 2003 +++ linux-2.5.66-bk8/include/asm-sparc64/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,25 +0,0 @@ -/* softirq.h: 64-bit Sparc soft IRQ support. - * - * Copyright (C) 1997, 1998 David S. Miller (davem@caip.rutgers.edu) - */ - -#ifndef __SPARC64_SOFTIRQ_H -#define __SPARC64_SOFTIRQ_H - -#include -#include -#include /* for membar() */ - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) -#define local_bh_enable() \ -do { __local_bh_enable(); \ - if (unlikely(!in_interrupt() && \ - softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* !(__SPARC64_SOFTIRQ_H) */ diff -urN linux-2.5.66-bk7/include/asm-um/softirq.h linux-2.5.66-bk8/include/asm-um/softirq.h --- linux-2.5.66-bk7/include/asm-um/softirq.h Mon Mar 24 14:00:02 2003 +++ linux-2.5.66-bk8/include/asm-um/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,13 +0,0 @@ -#ifndef __UM_SOFTIRQ_H -#define __UM_SOFTIRQ_H - -#include "linux/smp.h" -#include "asm/system.h" -#include "asm/processor.h" - -/* A gratuitous name change */ -#define i386_bh_lock um_bh_lock -#include "asm/arch/softirq.h" -#undef i386_bh_lock - -#endif diff -urN linux-2.5.66-bk7/include/asm-v850/ioctls.h linux-2.5.66-bk8/include/asm-v850/ioctls.h --- linux-2.5.66-bk7/include/asm-v850/ioctls.h Mon Mar 24 14:00:18 2003 +++ linux-2.5.66-bk8/include/asm-v850/ioctls.h Wed Apr 2 04:38:16 2003 @@ -43,7 +43,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-v850/softirq.h linux-2.5.66-bk8/include/asm-v850/softirq.h --- linux-2.5.66-bk7/include/asm-v850/softirq.h Mon Mar 24 13:59:53 2003 +++ linux-2.5.66-bk8/include/asm-v850/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,20 +0,0 @@ -#ifndef __V850_SOFTIRQ_H__ -#define __V850_SOFTIRQ_H__ - -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* __V850_SOFTIRQ_H__ */ diff -urN linux-2.5.66-bk7/include/asm-x86_64/compat.h linux-2.5.66-bk8/include/asm-x86_64/compat.h --- linux-2.5.66-bk7/include/asm-x86_64/compat.h Mon Mar 24 14:01:12 2003 +++ linux-2.5.66-bk8/include/asm-x86_64/compat.h Wed Apr 2 04:38:16 2003 @@ -27,6 +27,11 @@ typedef u32 compat_caddr_t; typedef __kernel_fsid_t compat_fsid_t; +typedef s32 compat_int_t; +typedef s32 compat_long_t; +typedef u32 compat_uint_t; +typedef u32 compat_ulong_t; + struct compat_timespec { compat_time_t tv_sec; s32 tv_nsec; diff -urN linux-2.5.66-bk7/include/asm-x86_64/ioctls.h linux-2.5.66-bk8/include/asm-x86_64/ioctls.h --- linux-2.5.66-bk7/include/asm-x86_64/ioctls.h Mon Mar 24 14:01:48 2003 +++ linux-2.5.66-bk8/include/asm-x86_64/ioctls.h Wed Apr 2 04:38:16 2003 @@ -43,7 +43,6 @@ #define TIOCSETD 0x5423 #define TIOCGETD 0x5424 #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ #define TIOCGSID 0x5429 /* Return the session ID of FD */ diff -urN linux-2.5.66-bk7/include/asm-x86_64/softirq.h linux-2.5.66-bk8/include/asm-x86_64/softirq.h --- linux-2.5.66-bk7/include/asm-x86_64/softirq.h Mon Mar 24 14:01:14 2003 +++ linux-2.5.66-bk8/include/asm-x86_64/softirq.h Wed Dec 31 16:00:00 1969 @@ -1,22 +0,0 @@ -#ifndef __ASM_SOFTIRQ_H -#define __ASM_SOFTIRQ_H - -#include -#include - -#define local_bh_disable() \ - do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) -#define __local_bh_enable() \ - do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) - -void do_softirq(void); - -#define local_bh_enable() \ -do { \ - __local_bh_enable(); \ - if (unlikely(!in_interrupt() && softirq_pending(smp_processor_id()))) \ - do_softirq(); \ - preempt_check_resched(); \ -} while (0) - -#endif /* __ASM_SOFTIRQ_H */ diff -urN linux-2.5.66-bk7/include/linux/fs.h linux-2.5.66-bk8/include/linux/fs.h --- linux-2.5.66-bk7/include/linux/fs.h Wed Apr 2 04:38:04 2003 +++ linux-2.5.66-bk8/include/linux/fs.h Wed Apr 2 04:38:16 2003 @@ -1076,7 +1076,6 @@ extern void close_bdev_excl(struct block_device *, int); extern const char * cdevname(kdev_t); -extern const char * kdevname(kdev_t); extern void init_special_inode(struct inode *, umode_t, dev_t); /* Invalid inode operations -- fs/bad_inode.c */ diff -urN linux-2.5.66-bk7/include/linux/ftape.h linux-2.5.66-bk8/include/linux/ftape.h --- linux-2.5.66-bk7/include/linux/ftape.h Mon Mar 24 14:00:55 2003 +++ linux-2.5.66-bk8/include/linux/ftape.h Wed Apr 2 04:38:16 2003 @@ -30,9 +30,6 @@ #define FTAPE_VERSION "ftape v3.04d 25/11/97" -/* this makes the Kernel version numbers readable */ -#define KERNEL_VER(major,minor,sublvl) (((major)<<16)+((minor)<<8)+(sublvl)) - #ifdef __KERNEL__ #include #include diff -urN linux-2.5.66-bk7/include/linux/interrupt.h linux-2.5.66-bk8/include/linux/interrupt.h --- linux-2.5.66-bk7/include/linux/interrupt.h Mon Mar 24 14:00:41 2003 +++ linux-2.5.66-bk8/include/linux/interrupt.h Wed Apr 2 04:38:16 2003 @@ -5,10 +5,10 @@ #include #include #include +#include #include #include #include -#include #include struct irqaction { @@ -36,6 +36,13 @@ # define save_and_cli(x) local_irq_save(x) #endif +/* SoftIRQ primitives. */ +#define local_bh_disable() \ + do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) +#define __local_bh_enable() \ + do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0) + +extern void local_bh_enable(void); /* PLEASE, avoid to allocate new softirqs, if you need not _really_ high frequency threaded job scheduling. For almost all the purposes diff -urN linux-2.5.66-bk7/include/linux/irq_cpustat.h linux-2.5.66-bk8/include/linux/irq_cpustat.h --- linux-2.5.66-bk7/include/linux/irq_cpustat.h Mon Mar 24 14:01:27 2003 +++ linux-2.5.66-bk8/include/linux/irq_cpustat.h Wed Apr 2 04:38:16 2003 @@ -29,6 +29,7 @@ /* arch independent irq_stat fields */ #define softirq_pending(cpu) __IRQ_STAT((cpu), __softirq_pending) +#define local_softirq_pending() softirq_pending(smp_processor_id()) #define syscall_count(cpu) __IRQ_STAT((cpu), __syscall_count) #define ksoftirqd_task(cpu) __IRQ_STAT((cpu), __ksoftirqd_task) /* arch dependent irq_stat fields */ diff -urN linux-2.5.66-bk7/include/linux/kdev_t.h linux-2.5.66-bk8/include/linux/kdev_t.h --- linux-2.5.66-bk7/include/linux/kdev_t.h Mon Mar 24 14:01:19 2003 +++ linux-2.5.66-bk8/include/linux/kdev_t.h Wed Apr 2 04:38:16 2003 @@ -101,8 +101,6 @@ #define NODEV (mk_kdev(0,0)) #define B_FREE (mk_kdev(0xff,0xff)) -extern const char * kdevname(kdev_t); /* note: returns pointer to static data! */ - static inline int kdev_same(kdev_t dev1, kdev_t dev2) { return dev1.value == dev2.value; diff -urN linux-2.5.66-bk7/include/linux/module.h linux-2.5.66-bk8/include/linux/module.h --- linux-2.5.66-bk7/include/linux/module.h Mon Mar 24 14:01:15 2003 +++ linux-2.5.66-bk8/include/linux/module.h Wed Apr 2 04:38:16 2003 @@ -18,7 +18,6 @@ #include #include -#include /* For struct exception_table_entry */ /* Not Yet Implemented */ #define MODULE_AUTHOR(name) @@ -51,6 +50,8 @@ extern void cleanup_module(void); /* Archs provide a method of finding the correct exception table. */ +struct exception_table_entry; + const struct exception_table_entry * search_extable(const struct exception_table_entry *first, const struct exception_table_entry *last, @@ -111,33 +112,10 @@ #define MODULE_DEVICE_TABLE(type,name) \ MODULE_GENERIC_TABLE(type##_device,name) -struct kernel_symbol_group -{ - /* Links us into the global symbol list */ - struct list_head list; - - /* Module which owns it (if any) */ - struct module *owner; - - /* Are we internal use only? */ - int gplonly; - - unsigned int num_syms; - const struct kernel_symbol *syms; - const unsigned long *crcs; -}; - /* Given an address, look for it in the exception tables */ const struct exception_table_entry *search_exception_tables(unsigned long add); -struct exception_table -{ - struct list_head list; - - unsigned int num_entries; - const struct exception_table_entry *entry; -}; - +struct notifier_block; #ifdef CONFIG_MODULES @@ -204,13 +182,18 @@ char name[MODULE_NAME_LEN]; /* Exported symbols */ - struct kernel_symbol_group symbols; + const struct kernel_symbol *syms; + unsigned int num_ksyms; + const unsigned long *crcs; /* GPL-only exported symbols. */ - struct kernel_symbol_group gpl_symbols; - - /* Exception tables */ - struct exception_table extable; + const struct kernel_symbol *gpl_syms; + unsigned int num_gpl_syms; + const unsigned long *gpl_crcs; + + /* Exception table */ + unsigned int num_exentries; + const struct exception_table_entry *extable; /* Startup function. */ int (*init)(void); @@ -268,7 +251,7 @@ } /* Is this address in a module? */ -int module_text_address(unsigned long addr); +struct module *module_text_address(unsigned long addr); #ifdef CONFIG_MODULE_UNLOAD @@ -348,6 +331,9 @@ /* For extable.c to search modules' exception tables. */ const struct exception_table_entry *search_module_extables(unsigned long addr); +int register_module_notifier(struct notifier_block * nb); +int unregister_module_notifier(struct notifier_block * nb); + #else /* !CONFIG_MODULES... */ #define EXPORT_SYMBOL(sym) #define EXPORT_SYMBOL_GPL(sym) @@ -361,9 +347,9 @@ } /* Is this address in a module? */ -static inline int module_text_address(unsigned long addr) +static inline struct module *module_text_address(unsigned long addr) { - return 0; + return NULL; } /* Get/put a kernel symbol (calls should be symmetric) */ @@ -392,6 +378,18 @@ { return NULL; } + +static inline int register_module_notifier(struct notifier_block * nb) +{ + /* no events will happen anyway, so this can always succeed */ + return 0; +} + +static inline int unregister_module_notifier(struct notifier_block * nb) +{ + return 0; +} + #endif /* CONFIG_MODULES */ #ifdef MODULE @@ -401,8 +399,6 @@ struct module __this_module __attribute__((section(".gnu.linkonce.this_module"))) = { .name = __stringify(KBUILD_MODNAME), - .symbols = { .owner = &__this_module }, - .gpl_symbols = { .owner = &__this_module, .gplonly = 1 }, .init = init_module, #ifdef CONFIG_MODULE_UNLOAD .exit = cleanup_module, @@ -454,14 +450,6 @@ #define __MODULE_STRING(x) __stringify(x) -/* - * The exception and symbol tables, and the lock - * to protect them. - */ -extern spinlock_t modlist_lock; -extern struct list_head extables; -extern struct list_head symbols; - /* Use symbol_get and symbol_put instead. You'll thank me. */ #define HAVE_INTER_MODULE extern void inter_module_register(const char *, struct module *, const void *); diff -urN linux-2.5.66-bk7/include/linux/mtd/compatmac.h linux-2.5.66-bk8/include/linux/mtd/compatmac.h --- linux-2.5.66-bk7/include/linux/mtd/compatmac.h Mon Mar 24 14:01:23 2003 +++ linux-2.5.66-bk8/include/linux/mtd/compatmac.h Wed Apr 2 04:38:16 2003 @@ -194,7 +194,6 @@ #define spin_unlock_bh(lock) do {spin_unlock(lock);end_bh_atomic();} while(0) #else #include -#include #include #endif diff -urN linux-2.5.66-bk7/include/linux/netfilter_ipv4/ip_conntrack.h linux-2.5.66-bk8/include/linux/netfilter_ipv4/ip_conntrack.h --- linux-2.5.66-bk7/include/linux/netfilter_ipv4/ip_conntrack.h Mon Mar 24 14:01:27 2003 +++ linux-2.5.66-bk8/include/linux/netfilter_ipv4/ip_conntrack.h Wed Apr 2 04:38:16 2003 @@ -63,12 +63,14 @@ }; /* Add protocol helper include file here */ +#include #include #include /* per expectation: application helper private data */ union ip_conntrack_expect_help { /* insert conntrack helper private data (expect) here */ + struct ip_ct_amanda_expect exp_amanda_info; struct ip_ct_ftp_expect exp_ftp_info; struct ip_ct_irc_expect exp_irc_info; diff -urN linux-2.5.66-bk7/include/linux/netfilter_ipv4/ip_conntrack_amanda.h linux-2.5.66-bk8/include/linux/netfilter_ipv4/ip_conntrack_amanda.h --- linux-2.5.66-bk7/include/linux/netfilter_ipv4/ip_conntrack_amanda.h Wed Dec 31 16:00:00 1969 +++ linux-2.5.66-bk8/include/linux/netfilter_ipv4/ip_conntrack_amanda.h Wed Apr 2 04:38:16 2003 @@ -0,0 +1,29 @@ +#ifndef _IP_CONNTRACK_AMANDA_H +#define _IP_CONNTRACK_AMANDA_H +/* AMANDA tracking. */ + +#ifdef __KERNEL__ + +#include + +/* Protects amanda part of conntracks */ +DECLARE_LOCK_EXTERN(ip_amanda_lock); + +#endif + +struct conn { + char* match; + int matchlen; +}; + +#define NUM_MSGS 3 + + +struct ip_ct_amanda_expect +{ + u_int16_t port; /* port number of this expectation */ + u_int16_t offset; /* offset of the port specification in ctrl packet */ + u_int16_t len; /* the length of the port number specification */ +}; + +#endif /* _IP_CONNTRACK_AMANDA_H */ diff -urN linux-2.5.66-bk7/include/linux/netfilter_ipv4/ip_conntrack_tftp.h linux-2.5.66-bk8/include/linux/netfilter_ipv4/ip_conntrack_tftp.h --- linux-2.5.66-bk7/include/linux/netfilter_ipv4/ip_conntrack_tftp.h Wed Dec 31 16:00:00 1969 +++ linux-2.5.66-bk8/include/linux/netfilter_ipv4/ip_conntrack_tftp.h Wed Apr 2 04:38:16 2003 @@ -0,0 +1,13 @@ +#ifndef _IP_CT_TFTP +#define _IP_CT_TFTP + +#define TFTP_PORT 69 + +struct tftphdr { + u_int16_t opcode; +}; + +#define TFTP_OPCODE_READ 1 +#define TFTP_OPCODE_WRITE 2 + +#endif /* _IP_CT_TFTP */ diff -urN linux-2.5.66-bk7/include/linux/pci_ids.h linux-2.5.66-bk8/include/linux/pci_ids.h --- linux-2.5.66-bk7/include/linux/pci_ids.h Mon Mar 24 14:00:20 2003 +++ linux-2.5.66-bk8/include/linux/pci_ids.h Wed Apr 2 04:38:16 2003 @@ -758,6 +758,10 @@ #define PCI_DEVICE_ID_APPLE_UNI_N_AGP_P 0x0027 #define PCI_DEVICE_ID_APPLE_UNI_N_AGP15 0x002d #define PCI_DEVICE_ID_APPLE_UNI_N_FW2 0x0030 +#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032 +#define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034 +#define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e +#define PCI_DEVICE_ID_APPLE_TIGON3 0x1645 #define PCI_VENDOR_ID_YAMAHA 0x1073 #define PCI_DEVICE_ID_YAMAHA_724 0x0004 diff -urN linux-2.5.66-bk7/include/net/compat.h linux-2.5.66-bk8/include/net/compat.h --- linux-2.5.66-bk7/include/net/compat.h Wed Apr 2 04:38:04 2003 +++ linux-2.5.66-bk8/include/net/compat.h Wed Apr 2 04:38:16 2003 @@ -8,19 +8,19 @@ #include struct compat_msghdr { - compat_uptr_t msg_name; - s32 msg_namelen; - compat_uptr_t msg_iov; + compat_uptr_t msg_name; /* void * */ + compat_int_t msg_namelen; + compat_uptr_t msg_iov; /* struct compat_iovec * */ compat_size_t msg_iovlen; - compat_uptr_t msg_control; + compat_uptr_t msg_control; /* void * */ compat_size_t msg_controllen; - u32 msg_flags; + compat_uint_t msg_flags; }; struct compat_cmsghdr { compat_size_t cmsg_len; - s32 cmsg_level; - s32 cmsg_type; + compat_int_t cmsg_level; + compat_int_t cmsg_type; }; #else /* defined(CONFIG_COMPAT) */ diff -urN linux-2.5.66-bk7/kernel/extable.c linux-2.5.66-bk8/kernel/extable.c --- linux-2.5.66-bk7/kernel/extable.c Mon Mar 24 14:00:15 2003 +++ linux-2.5.66-bk8/kernel/extable.c Wed Apr 2 04:38:16 2003 @@ -16,6 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include +#include extern const struct exception_table_entry __start___ex_table[]; extern const struct exception_table_entry __stop___ex_table[]; @@ -38,5 +39,5 @@ addr <= (unsigned long)_etext) return 1; - return module_text_address(addr); + return module_text_address(addr) != NULL; } diff -urN linux-2.5.66-bk7/kernel/ksyms.c linux-2.5.66-bk8/kernel/ksyms.c --- linux-2.5.66-bk7/kernel/ksyms.c Mon Mar 24 13:59:54 2003 +++ linux-2.5.66-bk8/kernel/ksyms.c Wed Apr 2 04:38:16 2003 @@ -511,7 +511,6 @@ EXPORT_SYMBOL(vsprintf); EXPORT_SYMBOL(vsnprintf); EXPORT_SYMBOL(vsscanf); -EXPORT_SYMBOL(kdevname); EXPORT_SYMBOL(__bdevname); EXPORT_SYMBOL(cdevname); EXPORT_SYMBOL(simple_strtoull); diff -urN linux-2.5.66-bk7/kernel/module.c linux-2.5.66-bk8/kernel/module.c --- linux-2.5.66-bk7/kernel/module.c Mon Mar 24 14:01:13 2003 +++ linux-2.5.66-bk8/kernel/module.c Wed Apr 2 04:38:16 2003 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -52,14 +53,35 @@ #define symbol_is(literal, string) \ (strcmp(MODULE_SYMBOL_PREFIX literal, (string)) == 0) -/* Protects extables and symbols lists */ +/* Protects module list */ static spinlock_t modlist_lock = SPIN_LOCK_UNLOCKED; /* List of modules, protected by module_mutex AND modlist_lock */ static DECLARE_MUTEX(module_mutex); static LIST_HEAD(modules); -static LIST_HEAD(symbols); -static LIST_HEAD(extables); + +static DECLARE_MUTEX(notify_mutex); +static struct notifier_block * module_notify_list; + +int register_module_notifier(struct notifier_block * nb) +{ + int err; + down(¬ify_mutex); + err = notifier_chain_register(&module_notify_list, nb); + up(¬ify_mutex); + return err; +} +EXPORT_SYMBOL(register_module_notifier); + +int unregister_module_notifier(struct notifier_block * nb) +{ + int err; + down(¬ify_mutex); + err = notifier_chain_unregister(&module_notify_list, nb); + up(¬ify_mutex); + return err; +} +EXPORT_SYMBOL(unregister_module_notifier); /* We require a truly strong try_module_get() */ static inline int strong_try_module_get(struct module *mod) @@ -92,25 +114,60 @@ return 0; } -/* Find a symbol, return value and the symbol group */ +/* Provided by the linker */ +extern const struct kernel_symbol __start___ksymtab[]; +extern const struct kernel_symbol __stop___ksymtab[]; +extern const struct kernel_symbol __start___ksymtab_gpl[]; +extern const struct kernel_symbol __stop___ksymtab_gpl[]; +extern const unsigned long __start___kcrctab[]; +extern const unsigned long __start___kcrctab_gpl[]; + +#ifndef CONFIG_MODVERSIONS +#define symversion(base, idx) NULL +#else +#define symversion(base, idx) ((base) ? ((base) + (idx)) : NULL) +#endif + +/* Find a symbol, return value, crc and module which owns it */ static unsigned long __find_symbol(const char *name, - struct kernel_symbol_group **group, - unsigned int *symidx, + struct module **owner, + const unsigned long **crc, int gplok) { - struct kernel_symbol_group *ks; - - list_for_each_entry(ks, &symbols, list) { - unsigned int i; + struct module *mod; + unsigned int i; - if (ks->gplonly && !gplok) - continue; - for (i = 0; i < ks->num_syms; i++) { - if (strcmp(ks->syms[i].name, name) == 0) { - *group = ks; - if (symidx) - *symidx = i; - return ks->syms[i].value; + /* Core kernel first. */ + *owner = NULL; + for (i = 0; __start___ksymtab+i < __stop___ksymtab; i++) { + if (strcmp(__start___ksymtab[i].name, name) == 0) { + *crc = symversion(__start___kcrctab, i); + return __start___ksymtab[i].value; + } + } + if (gplok) { + for (i = 0; __start___ksymtab_gpl+i<__stop___ksymtab_gpl; i++) + if (strcmp(__start___ksymtab_gpl[i].name, name) == 0) { + *crc = symversion(__start___kcrctab_gpl, i); + return __start___ksymtab_gpl[i].value; + } + } + + /* Now try modules. */ + list_for_each_entry(mod, &modules, list) { + *owner = mod; + for (i = 0; i < mod->num_ksyms; i++) + if (strcmp(mod->syms[i].name, name) == 0) { + *crc = symversion(mod->crcs, i); + return mod->syms[i].value; + } + + if (gplok) { + for (i = 0; i < mod->num_gpl_syms; i++) { + if (strcmp(mod->gpl_syms[i].name, name) == 0) { + *crc = symversion(mod->crcs, i); + return mod->gpl_syms[i].value; + } } } } @@ -539,36 +596,28 @@ void __symbol_put(const char *symbol) { - struct kernel_symbol_group *ksg; + struct module *owner; unsigned long flags; + const unsigned long *crc; spin_lock_irqsave(&modlist_lock, flags); - if (!__find_symbol(symbol, &ksg, NULL, 1)) + if (!__find_symbol(symbol, &owner, &crc, 1)) BUG(); - module_put(ksg->owner); + module_put(owner); spin_unlock_irqrestore(&modlist_lock, flags); } EXPORT_SYMBOL(__symbol_put); void symbol_put_addr(void *addr) { - struct kernel_symbol_group *ks; unsigned long flags; spin_lock_irqsave(&modlist_lock, flags); - list_for_each_entry(ks, &symbols, list) { - unsigned int i; + if (!kernel_text_address((unsigned long)addr)) + BUG(); - for (i = 0; i < ks->num_syms; i++) { - if (ks->syms[i].value == (unsigned long)addr) { - module_put(ks->owner); - spin_unlock_irqrestore(&modlist_lock, flags); - return; - } - } - } + module_put(module_text_address((unsigned long)addr)); spin_unlock_irqrestore(&modlist_lock, flags); - BUG(); } EXPORT_SYMBOL_GPL(symbol_put_addr); @@ -752,19 +801,15 @@ unsigned int versindex, const char *symname, struct module *mod, - struct kernel_symbol_group *ksg, - unsigned int symidx) + const unsigned long *crc) { - unsigned long crc; unsigned int i, num_versions; struct modversion_info *versions; /* Exporting module didn't supply crcs? OK, we're already tainted. */ - if (!ksg->crcs) + if (!crc) return 1; - crc = ksg->crcs[symidx]; - versions = (void *) sechdrs[versindex].sh_addr; num_versions = sechdrs[versindex].sh_size / sizeof(struct modversion_info); @@ -773,12 +818,12 @@ if (strcmp(versions[i].name, symname) != 0) continue; - if (versions[i].crc == crc) + if (versions[i].crc == *crc) return 1; printk("%s: disagrees about version of symbol %s\n", mod->name, symname); DEBUGP("Found checksum %lX vs module %lX\n", - crc, versions[i].crc); + *crc, versions[i].crc); return 0; } /* Not in module's version table. OK, but that taints the kernel. */ @@ -814,8 +859,7 @@ unsigned int versindex, const char *symname, struct module *mod, - struct kernel_symbol_group *ksg, - unsigned int symidx) + const unsigned long *crc) { return 1; } @@ -840,17 +884,16 @@ const char *name, struct module *mod) { - struct kernel_symbol_group *ksg; + struct module *owner; unsigned long ret; - unsigned int symidx; + const unsigned long *crc; spin_lock_irq(&modlist_lock); - ret = __find_symbol(name, &ksg, &symidx, mod->license_gplok); + ret = __find_symbol(name, &owner, &crc, mod->license_gplok); if (ret) { /* use_module can fail due to OOM, or module unloading */ - if (!check_version(sechdrs, versindex, name, mod, - ksg, symidx) || - !use_module(mod, ksg->owner)) + if (!check_version(sechdrs, versindex, name, mod, crc) || + !use_module(mod, owner)) ret = 0; } spin_unlock_irq(&modlist_lock); @@ -863,9 +906,6 @@ /* Delete from various lists */ spin_lock_irq(&modlist_lock); list_del(&mod->list); - list_del(&mod->symbols.list); - list_del(&mod->gpl_symbols.list); - list_del(&mod->extable.list); spin_unlock_irq(&modlist_lock); /* Module unload stuff */ @@ -881,12 +921,13 @@ void *__symbol_get(const char *symbol) { - struct kernel_symbol_group *ksg; + struct module *owner; unsigned long value, flags; + const unsigned long *crc; spin_lock_irqsave(&modlist_lock, flags); - value = __find_symbol(symbol, &ksg, NULL, 1); - if (value && !strong_try_module_get(ksg->owner)) + value = __find_symbol(symbol, &owner, &crc, 1); + if (value && !strong_try_module_get(owner)) value = 0; spin_unlock_irqrestore(&modlist_lock, flags); @@ -1232,35 +1273,26 @@ goto cleanup; /* Set up EXPORTed & EXPORT_GPLed symbols (section 0 is 0 length) */ - mod->symbols.num_syms = (sechdrs[exportindex].sh_size - / sizeof(*mod->symbols.syms)); - mod->symbols.syms = (void *)sechdrs[exportindex].sh_addr; + mod->num_syms = sechdrs[exportindex].sh_size / sizeof(*mod->syms); + mod->syms = (void *)sechdrs[exportindex].sh_addr; if (crcindex) - mod->symbols.crcs = (void *)sechdrs[crcindex].sh_addr; - - mod->gpl_symbols.num_syms = (sechdrs[gplindex].sh_size - / sizeof(*mod->symbols.syms)); - mod->gpl_symbols.syms = (void *)sechdrs[gplindex].sh_addr; + mod->crcs = (void *)sechdrs[crcindex].sh_addr; + mod->num_gpl_syms = sechdrs[gplindex].sh_size / sizeof(*mod->gpl_syms); + mod->gpl_syms = (void *)sechdrs[gplindex].sh_addr; if (gplcrcindex) - mod->gpl_symbols.crcs = (void *)sechdrs[gplcrcindex].sh_addr; + mod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr; #ifdef CONFIG_MODVERSIONS - if ((mod->symbols.num_syms && !crcindex) - || (mod->gpl_symbols.num_syms && !gplcrcindex)) { + if ((mod->num_ksyms&&!crcindex) || (mod->num_gpl_syms&&!gplcrcindex)) { printk(KERN_WARNING "%s: No versions for exported symbols." " Tainting kernel.\n", mod->name); tainted |= TAINT_FORCED_MODULE; } #endif - /* Set up exception table */ - if (exindex) { - /* FIXME: Sort exception table. */ - mod->extable.num_entries = (sechdrs[exindex].sh_size - / sizeof(struct - exception_table_entry)); - mod->extable.entry = (void *)sechdrs[exindex].sh_addr; - } + /* Set up exception table */ + mod->num_exentries = sechdrs[exindex].sh_size / sizeof(*mod->extable); + mod->extable = (void *)sechdrs[exindex].sh_addr; /* Now do relocations. */ for (i = 1; i < hdr->e_shnum; i++) { @@ -1359,15 +1391,16 @@ /* Now sew it into the lists. They won't access us, since strong_try_module_get() will fail. */ spin_lock_irq(&modlist_lock); - list_add(&mod->extable.list, &extables); - list_add_tail(&mod->symbols.list, &symbols); - list_add_tail(&mod->gpl_symbols.list, &symbols); list_add(&mod->list, &modules); spin_unlock_irq(&modlist_lock); /* Drop lock so they can recurse */ up(&module_mutex); + down(¬ify_mutex); + notifier_call_chain(&module_notify_list, MODULE_STATE_COMING, mod); + up(¬ify_mutex); + /* Start the module */ ret = mod->init(); if (ret < 0) { @@ -1526,14 +1559,16 @@ { unsigned long flags; const struct exception_table_entry *e = NULL; - struct exception_table *i; + struct module *mod; spin_lock_irqsave(&modlist_lock, flags); - list_for_each_entry(i, &extables, list) { - if (i->num_entries == 0) + list_for_each_entry(mod, &modules, list) { + if (mod->num_exentries == 0) continue; - e = search_extable(i->entry, i->entry+i->num_entries-1, addr); + e = search_extable(mod->extable, + mod->extable + mod->num_exentries - 1, + addr); if (e) break; } @@ -1545,50 +1580,17 @@ } /* Is this a valid kernel address? We don't grab the lock: we are oopsing. */ -int module_text_address(unsigned long addr) +struct module *module_text_address(unsigned long addr) { struct module *mod; list_for_each_entry(mod, &modules, list) if (within(addr, mod->module_init, mod->init_size) || within(addr, mod->module_core, mod->core_size)) - return 1; - return 0; -} - -/* Provided by the linker */ -extern const struct kernel_symbol __start___ksymtab[]; -extern const struct kernel_symbol __stop___ksymtab[]; -extern const struct kernel_symbol __start___ksymtab_gpl[]; -extern const struct kernel_symbol __stop___ksymtab_gpl[]; -extern const unsigned long __start___kcrctab[]; -extern const unsigned long __stop___kcrctab[]; -extern const unsigned long __start___kcrctab_gpl[]; -extern const unsigned long __stop___kcrctab_gpl[]; - -static struct kernel_symbol_group kernel_symbols, kernel_gpl_symbols; - -static int __init symbols_init(void) -{ - /* Add kernel symbols to symbol table */ - kernel_symbols.num_syms = (__stop___ksymtab - __start___ksymtab); - kernel_symbols.syms = __start___ksymtab; - kernel_symbols.crcs = __start___kcrctab; - kernel_symbols.gplonly = 0; - list_add(&kernel_symbols.list, &symbols); - - kernel_gpl_symbols.num_syms = (__stop___ksymtab_gpl - - __start___ksymtab_gpl); - kernel_gpl_symbols.syms = __start___ksymtab_gpl; - kernel_gpl_symbols.crcs = __start___kcrctab_gpl; - kernel_gpl_symbols.gplonly = 1; - list_add(&kernel_gpl_symbols.list, &symbols); - - return 0; + return mod; + return NULL; } -__initcall(symbols_init); - #ifdef CONFIG_MODVERSIONS /* Generate the signature for struct module here, too, for modversions. */ void struct_module(struct module *mod) { return; } diff -urN linux-2.5.66-bk7/kernel/softirq.c linux-2.5.66-bk8/kernel/softirq.c --- linux-2.5.66-bk7/kernel/softirq.c Mon Mar 24 14:00:10 2003 +++ linux-2.5.66-bk8/kernel/softirq.c Wed Apr 2 04:38:16 2003 @@ -6,6 +6,7 @@ * Rewritten. Old one was good in 2.2, but in 2.3 it was immoral. --ANK (990903) */ +#include #include #include #include @@ -55,15 +56,13 @@ __u32 pending; unsigned long flags; __u32 mask; - int cpu; if (in_interrupt()) return; local_irq_save(flags); - cpu = smp_processor_id(); - pending = softirq_pending(cpu); + pending = local_softirq_pending(); if (pending) { struct softirq_action *h; @@ -72,7 +71,7 @@ local_bh_disable(); restart: /* Reset the pending bitmask before enabling irqs */ - softirq_pending(cpu) = 0; + local_softirq_pending() = 0; local_irq_enable(); @@ -87,19 +86,30 @@ local_irq_disable(); - pending = softirq_pending(cpu); + pending = local_softirq_pending(); if (pending & mask) { mask &= ~pending; goto restart; } if (pending) - wakeup_softirqd(cpu); + wakeup_softirqd(smp_processor_id()); __local_bh_enable(); } local_irq_restore(flags); } +void local_bh_enable(void) +{ + __local_bh_enable(); + BUG_ON(irqs_disabled()); + if (unlikely(!in_interrupt() && + local_softirq_pending())) + do_softirq(); + preempt_check_resched(); +} +EXPORT_SYMBOL(local_bh_enable); + /* * This function must run with irqs disabled! */ @@ -314,12 +324,12 @@ ksoftirqd_task(cpu) = current; for (;;) { - if (!softirq_pending(cpu)) + if (!local_softirq_pending()) schedule(); __set_current_state(TASK_RUNNING); - while (softirq_pending(cpu)) { + while (local_softirq_pending()) { do_softirq(); cond_resched(); } diff -urN linux-2.5.66-bk7/net/ipv4/ah.c linux-2.5.66-bk8/net/ipv4/ah.c --- linux-2.5.66-bk7/net/ipv4/ah.c Mon Mar 24 14:01:24 2003 +++ linux-2.5.66-bk8/net/ipv4/ah.c Wed Apr 2 04:38:17 2003 @@ -18,7 +18,7 @@ static int ip_clear_mutable_options(struct iphdr *iph, u32 *daddr) { unsigned char * optptr = (unsigned char*)(iph+1); - int l = iph->ihl*4 - 20; + int l = iph->ihl*4 - sizeof(struct iphdr); int optlen; while (l > 0) { @@ -132,7 +132,7 @@ top_iph->frag_off = iph->frag_off; top_iph->daddr = iph->daddr; if (iph->ihl != 5) - memcpy(top_iph+1, iph+1, iph->ihl*5 - 20); + memcpy(top_iph+1, iph+1, iph->ihl*4 - sizeof(struct iphdr)); } ip_send_check(top_iph); @@ -288,7 +288,7 @@ x->props.header_len = XFRM_ALIGN8(ahp->icv_trunc_len + AH_HLEN_NOICV); if (x->props.mode) - x->props.header_len += 20; + x->props.header_len += sizeof(struct iphdr); x->data = ahp; return 0; diff -urN linux-2.5.66-bk7/net/ipv4/esp.c linux-2.5.66-bk8/net/ipv4/esp.c --- linux-2.5.66-bk7/net/ipv4/esp.c Mon Mar 24 14:00:48 2003 +++ linux-2.5.66-bk8/net/ipv4/esp.c Wed Apr 2 04:38:17 2003 @@ -367,7 +367,7 @@ crypto_cipher_setkey(esp->conf.tfm, esp->conf.key, esp->conf.key_len); x->props.header_len = 8 + esp->conf.ivlen; if (x->props.mode) - x->props.header_len += 20; + x->props.header_len += sizeof(struct iphdr); x->data = esp; x->props.trailer_len = esp4_get_max_size(x, 0) - x->props.header_len; return 0; diff -urN linux-2.5.66-bk7/net/ipv4/netfilter/Kconfig linux-2.5.66-bk8/net/ipv4/netfilter/Kconfig --- linux-2.5.66-bk7/net/ipv4/netfilter/Kconfig Mon Mar 24 14:01:18 2003 +++ linux-2.5.66-bk8/net/ipv4/netfilter/Kconfig Wed Apr 2 04:38:17 2003 @@ -44,8 +44,34 @@ chats. Note that you do NOT need this extension to get files or have others initiate chats, or everything else in IRC. - If you want to compile it as a module, say 'M' here and read - Documentation/modules.txt. If unsure, say 'N'. + If you want to compile it as a module, say M here and read + . If unsure, say `Y'. + +config IP_NF_TFTP + tristate "TFTP prtocol support" + depends on IP_NF_CONNTRACK + help + TFTP connection tracking helper, this is required depending + on how restrictive your ruleset is. + If you are using a tftp client behind -j SNAT or -j MASQUERADING + you will need this. + + If you want to compile it as a module, say M here and read + . If unsure, say `Y'. + +config IP_NF_AMANDA + tristate "Amanda backup protocol support" + depends on IP_NF_CONNTRACK + help + If you are running the Amanda backup package (http://www.amanda.org/) + on this machine or machines that will be MASQUERADED through this + machine, then you may want to enable this feature. This allows the + connection tracking and natting code to allow the sub-channels that + Amanda requires for communication of the backup data, messages and + index. + + If you want to compile it as a module, say M here and read + . If unsure, say `Y'. config IP_NF_QUEUE tristate "Userspace queueing via NETLINK (EXPERIMENTAL)" @@ -380,6 +406,18 @@ default IP_NF_NAT if IP_NF_FTP=y default m if IP_NF_FTP=m +config IP_NF_NAT_TFTP + tristate + depends on IP_NF_IPTABLES!=n && IP_NF_CONNTRACK!=n && IP_NF_NAT!=n + default IP_NF_NAT if IP_NF_TFTP=y + default m if IP_NF_TFTP=m + +config IP_NF_NAT_AMANDA + tristate + depends on IP_NF_IPTABLES!=n && IP_NF_CONNTRACK!=n && IP_NF_NAT!=n + default IP_NF_NAT if IP_NF_TFTP=y + default m if IP_NF_TFTP=m + config IP_NF_MANGLE tristate "Packet mangling" depends on IP_NF_IPTABLES diff -urN linux-2.5.66-bk7/net/ipv4/netfilter/Makefile linux-2.5.66-bk8/net/ipv4/netfilter/Makefile --- linux-2.5.66-bk7/net/ipv4/netfilter/Makefile Mon Mar 24 14:00:09 2003 +++ linux-2.5.66-bk8/net/ipv4/netfilter/Makefile Wed Apr 2 04:38:17 2003 @@ -20,14 +20,14 @@ obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o # connection tracking helpers +obj-$(CONFIG_IP_NF_AMANDA) += ip_conntrack_amanda.o +obj-$(CONFIG_IP_NF_TFTP) += ip_conntrack_tftp.o obj-$(CONFIG_IP_NF_FTP) += ip_conntrack_ftp.o -ifdef CONFIG_IP_NF_NAT_FTP -endif obj-$(CONFIG_IP_NF_IRC) += ip_conntrack_irc.o -ifdef CONFIG_IP_NF_NAT_IRC -endif # NAT helpers +obj-$(CONFIG_IP_NF_NAT_AMANDA) += ip_nat_amanda.o +obj-$(CONFIG_IP_NF_NAT_TFTP) += ip_nat_tftp.o obj-$(CONFIG_IP_NF_NAT_FTP) += ip_nat_ftp.o obj-$(CONFIG_IP_NF_NAT_IRC) += ip_nat_irc.o diff -urN linux-2.5.66-bk7/net/ipv4/netfilter/ip_conntrack_amanda.c linux-2.5.66-bk8/net/ipv4/netfilter/ip_conntrack_amanda.c --- linux-2.5.66-bk7/net/ipv4/netfilter/ip_conntrack_amanda.c Wed Dec 31 16:00:00 1969 +++ linux-2.5.66-bk8/net/ipv4/netfilter/ip_conntrack_amanda.c Wed Apr 2 04:38:17 2003 @@ -0,0 +1,233 @@ +/* Amanda extension for IP connection tracking, Version 0.2 + * (C) 2002 by Brian J. Murrell + * based on HW's ip_conntrack_irc.c as well as other modules + * + * 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. + * + * Module load syntax: + * insmod ip_conntrack_amanda.o [master_timeout=n] + * + * Where master_timeout is the timeout (in seconds) of the master + * connection (port 10080). This defaults to 5 minutes but if + * your clients take longer than 5 minutes to do their work + * before getting back to the Amanda server, you can increase + * this value. + * + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +static unsigned int master_timeout = 300; + +MODULE_AUTHOR("Brian J. Murrell "); +MODULE_DESCRIPTION("Amanda connection tracking module"); +MODULE_LICENSE("GPL"); +MODULE_PARM(master_timeout, "i"); +MODULE_PARM_DESC(master_timeout, "timeout for the master connection"); + +DECLARE_LOCK(ip_amanda_lock); +struct module *ip_conntrack_amanda = THIS_MODULE; + +#define MAXMATCHLEN 6 +struct conn conns[NUM_MSGS] = { + {"DATA ", 5}, + {"MESG ", 5}, + {"INDEX ", 6}, +}; + +#if 0 +#define DEBUGP printk +#else +#define DEBUGP(format, args...) +#endif + + +/* FIXME: This should be in userspace. Later. */ +static int help(const struct iphdr *iph, size_t len, + struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) +{ + struct udphdr *udph = (void *)iph + iph->ihl * 4; + u_int32_t udplen = len - iph->ihl * 4; + u_int32_t datalen = udplen - sizeof(struct udphdr); + char *data = (char *)udph + sizeof(struct udphdr); + char *datap = data; + char *data_limit = (char *) data + datalen; + int dir = CTINFO2DIR(ctinfo); + struct ip_ct_amanda *info = + (struct ip_ct_amanda *)&ct->help.ct_ftp_info; + + /* Can't track connections formed before we registered */ + if (!info) + return NF_ACCEPT; + + /* increase the UDP timeout of the master connection as replies from + * Amanda clients to the server can be quite delayed */ + ip_ct_refresh(ct, master_timeout * HZ); + + /* If packet is coming from Amanda server */ + if (dir == IP_CT_DIR_ORIGINAL) + return NF_ACCEPT; + + /* Not whole UDP header? */ + if (udplen < sizeof(struct udphdr)) { + printk("ip_conntrack_amanda_help: udplen = %u\n", + (unsigned)udplen); + return NF_ACCEPT; + } + + /* Checksum invalid? Ignore. */ + if (csum_tcpudp_magic(iph->saddr, iph->daddr, udplen, IPPROTO_UDP, + csum_partial((char *)udph, udplen, 0))) { + DEBUGP("ip_ct_talk_help: bad csum: %p %u %u.%u.%u.%u " + "%u.%u.%u.%u\n", + udph, udplen, NIPQUAD(iph->saddr), + NIPQUAD(iph->daddr)); + return NF_ACCEPT; + } + + /* Search for the CONNECT string */ + while (data < data_limit) { + if (!memcmp(data, "CONNECT ", 8)) { + break; + } + data++; + } + if (memcmp(data, "CONNECT ", 8)) + return NF_ACCEPT; + + DEBUGP("ip_conntrack_amanda_help: CONNECT found in connection " + "%u.%u.%u.%u:%u %u.%u.%u.%u:%u\n", + NIPQUAD(iph->saddr), htons(udph->source), + NIPQUAD(iph->daddr), htons(udph->dest)); + data += 8; + while (*data != 0x0a && data < data_limit) { + + int i; + + for (i = 0; i < NUM_MSGS; i++) { + if (!memcmp(data, conns[i].match, + conns[i].matchlen)) { + + char *portchr; + struct ip_conntrack_expect expect; + struct ip_ct_amanda_expect + *exp_amanda_info = + &expect.help.exp_amanda_info; + + memset(&expect, 0, sizeof(expect)); + + data += conns[i].matchlen; + /* this is not really tcp, but let's steal an + * idea from a tcp stream helper :-) + */ + // XXX expect.seq = data - datap; + exp_amanda_info->offset = data - datap; +// XXX DEBUGP("expect.seq = %p - %p = %d\n", data, datap, expect.seq); +DEBUGP("exp_amanda_info->offset = %p - %p = %d\n", data, datap, exp_amanda_info->offset); + portchr = data; + exp_amanda_info->port = + simple_strtoul(data, &data, 10); + exp_amanda_info->len = data - portchr; + + /* eat whitespace */ + while (*data == ' ') + data++; + DEBUGP ("ip_conntrack_amanda_help: " + "CONNECT %s request with port " + "%u found\n", conns[i].match, + exp_amanda_info->port); + + LOCK_BH(&ip_amanda_lock); + + expect.tuple = ((struct ip_conntrack_tuple) + { { ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip, + { 0 } }, + { ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip, + { htons(exp_amanda_info->port) }, + IPPROTO_TCP }}); + expect.mask = ((struct ip_conntrack_tuple) + { { 0, { 0 } }, + { 0xFFFFFFFF, { 0xFFFF }, 0xFFFF }}); + + expect.expectfn = NULL; + + DEBUGP ("ip_conntrack_amanda_help: " + "expect_related: %u.%u.%u.%u:%u - " + "%u.%u.%u.%u:%u\n", + NIPQUAD(expect.tuple.src.ip), + ntohs(expect.tuple.src.u.tcp.port), + NIPQUAD(expect.tuple.dst.ip), + ntohs(expect.tuple.dst.u.tcp.port)); + if (ip_conntrack_expect_related(ct, &expect) == + -EEXIST) { + ; + /* this must be a packet being resent */ + /* XXX - how do I get the + * ip_conntrack_expect that + * already exists so that I can + * update the .seq so that the + * nat module rewrites the port + * numbers? + * Perhaps I should use the + * exp_amanda_info instead of + * .seq. + */ + } + UNLOCK_BH(&ip_amanda_lock); + } /* if memcmp(conns) */ + } /* for .. NUM_MSGS */ + data++; + } /* while (*data != 0x0a && data < data_limit) */ + + return NF_ACCEPT; +} + +static struct ip_conntrack_helper amanda_helper; + +static void fini(void) +{ + DEBUGP("ip_ct_amanda: unregistering helper for port 10080\n"); + ip_conntrack_helper_unregister(&amanda_helper); +} + +static int __init init(void) +{ + int ret; + + memset(&amanda_helper, 0, sizeof(struct ip_conntrack_helper)); + amanda_helper.tuple.src.u.udp.port = htons(10080); + amanda_helper.tuple.dst.protonum = IPPROTO_UDP; + amanda_helper.mask.src.u.udp.port = 0xFFFF; + amanda_helper.mask.dst.protonum = 0xFFFF; + amanda_helper.max_expected = NUM_MSGS; + amanda_helper.timeout = 180; + amanda_helper.flags = IP_CT_HELPER_F_REUSE_EXPECT; + amanda_helper.me = ip_conntrack_amanda; + amanda_helper.help = help; + amanda_helper.name = "amanda"; + + DEBUGP("ip_ct_amanda: registering helper for port 10080\n"); + + ret = ip_conntrack_helper_register(&amanda_helper); + + if (ret) { + printk("ip_ct_amanda: ERROR registering helper\n"); + fini(); + return -EBUSY; + } + return 0; +} + +module_init(init); +module_exit(fini); diff -urN linux-2.5.66-bk7/net/ipv4/netfilter/ip_conntrack_tftp.c linux-2.5.66-bk8/net/ipv4/netfilter/ip_conntrack_tftp.c --- linux-2.5.66-bk7/net/ipv4/netfilter/ip_conntrack_tftp.c Wed Dec 31 16:00:00 1969 +++ linux-2.5.66-bk8/net/ipv4/netfilter/ip_conntrack_tftp.c Wed Apr 2 04:38:17 2003 @@ -0,0 +1,131 @@ +/* + * Licensed under GNU GPL version 2 Copyright Magnus Boden + * Version: 0.0.7 + * + * Thu 21 Mar 2002 Harald Welte + * - port to newnat API + * + */ + +#include +#include +#include + +#include +#include +#include +#include + +MODULE_AUTHOR("Magnus Boden "); +MODULE_DESCRIPTION("Netfilter connection tracking module for tftp"); +MODULE_LICENSE("GPL"); + +#define MAX_PORTS 8 +static int ports[MAX_PORTS]; +static int ports_c = 0; +#ifdef MODULE_PARM +MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i"); +MODULE_PARM_DESC(ports, "port numbers of tftp servers"); +#endif + +#if 0 +#define DEBUGP(format, args...) printk(__FILE__ ":" __FUNCTION__ ": " \ + format, ## args) +#else +#define DEBUGP(format, args...) +#endif + +static int tftp_help(const struct iphdr *iph, size_t len, + struct ip_conntrack *ct, + enum ip_conntrack_info ctinfo) +{ + struct udphdr *udph = (void *)iph + iph->ihl * 4; + struct tftphdr *tftph = (void *)udph + 8; + struct ip_conntrack_expect exp; + + switch (ntohs(tftph->opcode)) { + /* RRQ and WRQ works the same way */ + case TFTP_OPCODE_READ: + case TFTP_OPCODE_WRITE: + DEBUGP(""); + DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); + DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); + memset(&exp, 0, sizeof(exp)); + + exp.tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple; + exp.mask.src.ip = 0xffffffff; + exp.mask.dst.ip = 0xffffffff; + exp.mask.dst.u.udp.port = 0xffff; + exp.mask.dst.protonum = 0xffff; + exp.expectfn = NULL; + + DEBUGP("expect: "); + DUMP_TUPLE(&exp.tuple); + DUMP_TUPLE(&exp.mask); + ip_conntrack_expect_related(ct, &exp); + break; + default: + DEBUGP("Unknown opcode\n"); + } + return NF_ACCEPT; +} + +static struct ip_conntrack_helper tftp[MAX_PORTS]; +static char tftp_names[MAX_PORTS][10]; + +static void fini(void) +{ + int i; + + for (i = 0 ; i < ports_c; i++) { + DEBUGP("unregistering helper for port %d\n", + ports[i]); + ip_conntrack_helper_unregister(&tftp[i]); + } +} + +static int __init init(void) +{ + int i, ret; + char *tmpname; + + if (!ports[0]) + ports[0]=TFTP_PORT; + + for (i = 0 ; (i < MAX_PORTS) && ports[i] ; i++) { + /* Create helper structure */ + memset(&tftp[i], 0, sizeof(struct ip_conntrack_helper)); + + tftp[i].tuple.dst.protonum = IPPROTO_UDP; + tftp[i].tuple.src.u.udp.port = htons(ports[i]); + tftp[i].mask.dst.protonum = 0xFFFF; + tftp[i].mask.src.u.udp.port = 0xFFFF; + tftp[i].max_expected = 1; + tftp[i].timeout = 0; + tftp[i].flags = IP_CT_HELPER_F_REUSE_EXPECT; + tftp[i].me = THIS_MODULE; + tftp[i].help = tftp_help; + + tmpname = &tftp_names[i][0]; + if (ports[i] == TFTP_PORT) + sprintf(tmpname, "tftp"); + else + sprintf(tmpname, "tftp-%d", i); + tftp[i].name = tmpname; + + DEBUGP("port #%d: %d\n", i, ports[i]); + + ret=ip_conntrack_helper_register(&tftp[i]); + if (ret) { + printk("ERROR registering helper for port %d\n", + ports[i]); + fini(); + return(ret); + } + ports_c++; + } + return(0); +} + +module_init(init); +module_exit(fini); diff -urN linux-2.5.66-bk7/net/ipv4/netfilter/ip_nat_amanda.c linux-2.5.66-bk8/net/ipv4/netfilter/ip_nat_amanda.c --- linux-2.5.66-bk7/net/ipv4/netfilter/ip_nat_amanda.c Wed Dec 31 16:00:00 1969 +++ linux-2.5.66-bk8/net/ipv4/netfilter/ip_nat_amanda.c Wed Apr 2 04:38:17 2003 @@ -0,0 +1,226 @@ +/* Amanda extension for TCP NAT alteration. + * (C) 2002 by Brian J. Murrell + * based on a copy of HW's ip_nat_irc.c as well as other modules + * + * 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. + * + * Module load syntax: + * insmod ip_nat_amanda.o + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + + +#if 0 +#define DEBUGP printk +#define DUMP_OFFSET(x) printk("offset_before=%d, offset_after=%d, correction_pos=%u\n", x->offset_before, x->offset_after, x->correction_pos); +#else +#define DEBUGP(format, args...) +#define DUMP_OFFSET(x) +#endif + +MODULE_AUTHOR("Brian J. Murrell "); +MODULE_DESCRIPTION("Amanda network address translation module"); +MODULE_LICENSE("GPL"); + +/* protects amanda part of conntracks */ +DECLARE_LOCK_EXTERN(ip_amanda_lock); + +static unsigned int +amanda_nat_expected(struct sk_buff **pskb, + unsigned int hooknum, + struct ip_conntrack *ct, + struct ip_nat_info *info) +{ + struct ip_nat_multi_range mr; + u_int32_t newdstip, newsrcip, newip; + u_int16_t port; + struct ip_ct_amanda_expect *exp_info; + struct ip_conntrack *master = master_ct(ct); + + IP_NF_ASSERT(info); + IP_NF_ASSERT(master); + + IP_NF_ASSERT(!(info->initialized & (1 << HOOK2MANIP(hooknum)))); + + DEBUGP("nat_expected: We have a connection!\n"); + exp_info = &ct->master->help.exp_amanda_info; + + newdstip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip; + newsrcip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip; + DEBUGP("nat_expected: %u.%u.%u.%u->%u.%u.%u.%u\n", + NIPQUAD(newsrcip), NIPQUAD(newdstip)); + + port = exp_info->port; + + if (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) + newip = newsrcip; + else + newip = newdstip; + + DEBUGP("nat_expected: IP to %u.%u.%u.%u\n", NIPQUAD(newip)); + + mr.rangesize = 1; + /* We don't want to manip the per-protocol, just the IPs. */ + mr.range[0].flags = IP_NAT_RANGE_MAP_IPS; + mr.range[0].min_ip = mr.range[0].max_ip = newip; + + if (HOOK2MANIP(hooknum) == IP_NAT_MANIP_DST) { + mr.range[0].flags |= IP_NAT_RANGE_PROTO_SPECIFIED; + mr.range[0].min = mr.range[0].max + = ((union ip_conntrack_manip_proto) + { htons(port) }); + } + + return ip_nat_setup_info(ct, &mr, hooknum); +} + +static int amanda_data_fixup(struct ip_conntrack *ct, + struct sk_buff **pskb, + enum ip_conntrack_info ctinfo, + struct ip_conntrack_expect *expect) +{ + u_int32_t newip; + /* DATA 99999 MESG 99999 INDEX 99999 */ + char buffer[6]; + struct ip_conntrack_expect *exp = expect; + struct ip_ct_amanda_expect *ct_amanda_info = &exp->help.exp_amanda_info; + struct ip_conntrack_tuple t = exp->tuple; + int port; + + MUST_BE_LOCKED(&ip_amanda_lock); + + newip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip; + DEBUGP ("ip_nat_amanda_help: newip = %u.%u.%u.%u\n", NIPQUAD(newip)); + + /* Alter conntrack's expectations. */ + + /* We can read expect here without conntrack lock, since it's + only set in ip_conntrack_amanda, with ip_amanda_lock held + writable */ + + t.dst.ip = newip; + for (port = ct_amanda_info->port + 10; port != 0; port++) { + t.dst.u.tcp.port = htons(port); + if (ip_conntrack_change_expect(exp, &t) == 0) + break; + } + + if (port == 0) + return 0; + + sprintf(buffer, "%u", port); + + return ip_nat_mangle_udp_packet(pskb, ct, ctinfo, /* XXX exp->seq */ ct_amanda_info->offset, + ct_amanda_info->len, buffer, strlen(buffer)); +} + +static unsigned int help(struct ip_conntrack *ct, + struct ip_conntrack_expect *exp, + struct ip_nat_info *info, + enum ip_conntrack_info ctinfo, + unsigned int hooknum, + struct sk_buff **pskb) +{ + int dir; + + if (!exp) + DEBUGP("ip_nat_amanda: no exp!!"); + + /* Only mangle things once: original direction in POST_ROUTING + and reply direction on PRE_ROUTING. */ + dir = CTINFO2DIR(ctinfo); + if (!((hooknum == NF_IP_POST_ROUTING && dir == IP_CT_DIR_ORIGINAL) + || (hooknum == NF_IP_PRE_ROUTING && dir == IP_CT_DIR_REPLY))) { + DEBUGP("ip_nat_amanda_help: Not touching dir %s at hook %s\n", + dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY", + hooknum == NF_IP_POST_ROUTING ? "POSTROUTING" + : hooknum == NF_IP_PRE_ROUTING ? "PREROUTING" + : hooknum == NF_IP_LOCAL_OUT ? "OUTPUT" + : hooknum == NF_IP_LOCAL_IN ? "INPUT" : "???"); + return NF_ACCEPT; + } + DEBUGP("ip_nat_amanda_help: got beyond not touching: dir %s at hook %s for expect: ", + dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY", + hooknum == NF_IP_POST_ROUTING ? "POSTROUTING" + : hooknum == NF_IP_PRE_ROUTING ? "PREROUTING" + : hooknum == NF_IP_LOCAL_OUT ? "OUTPUT" + : hooknum == NF_IP_LOCAL_IN ? "INPUT" : "???"); + DUMP_TUPLE(&exp->tuple); + + LOCK_BH(&ip_amanda_lock); +// XXX if (exp->seq != 0) + if (exp->help.exp_amanda_info.offset != 0) + /* if this packet has a "seq" it needs to have it's content mangled */ + if (!amanda_data_fixup(ct, pskb, ctinfo, exp)) { + UNLOCK_BH(&ip_amanda_lock); + DEBUGP("ip_nat_amanda: NF_DROP\n"); + return NF_DROP; + } + exp->help.exp_amanda_info.offset = 0; + UNLOCK_BH(&ip_amanda_lock); + + DEBUGP("ip_nat_amanda: NF_ACCEPT\n"); + return NF_ACCEPT; +} + +static struct ip_nat_helper ip_nat_amanda_helper; + +/* This function is intentionally _NOT_ defined as __exit, because + * it is needed by init() */ +static void fini(void) +{ + DEBUGP("ip_nat_amanda: unregistering nat helper\n"); + ip_nat_helper_unregister(&ip_nat_amanda_helper); +} + +static int __init init(void) +{ + int ret = 0; + struct ip_nat_helper *hlpr; + + hlpr = &ip_nat_amanda_helper; + memset(hlpr, 0, sizeof(struct ip_nat_helper)); + + hlpr->tuple.dst.protonum = IPPROTO_UDP; + hlpr->tuple.src.u.udp.port = htons(10080); + hlpr->mask.src.u.udp.port = 0xFFFF; + hlpr->mask.dst.protonum = 0xFFFF; + hlpr->help = help; + hlpr->flags = 0; + hlpr->me = THIS_MODULE; + hlpr->expect = amanda_nat_expected; + + hlpr->name = "amanda"; + + DEBUGP + ("ip_nat_amanda: Trying to register nat helper\n"); + ret = ip_nat_helper_register(hlpr); + + if (ret) { + printk + ("ip_nat_amanda: error registering nat helper\n"); + fini(); + return 1; + } + return ret; +} + + +module_init(init); +module_exit(fini); diff -urN linux-2.5.66-bk7/net/ipv4/netfilter/ip_nat_tftp.c linux-2.5.66-bk8/net/ipv4/netfilter/ip_nat_tftp.c --- linux-2.5.66-bk7/net/ipv4/netfilter/ip_nat_tftp.c Wed Dec 31 16:00:00 1969 +++ linux-2.5.66-bk8/net/ipv4/netfilter/ip_nat_tftp.c Wed Apr 2 04:38:17 2003 @@ -0,0 +1,197 @@ +/* + * Licensed under GNU GPL version 2 Copyright Magnus Boden + * Version: 0.0.7 + * + * Thu 21 Mar 2002 Harald Welte + * - Port to newnat API + * + * This module currently supports DNAT: + * iptables -t nat -A PREROUTING -d x.x.x.x -j DNAT --to-dest x.x.x.y + * + * and SNAT: + * iptables -t nat -A POSTROUTING { -j MASQUERADE , -j SNAT --to-source x.x.x.x } + * + * It has not been tested with + * -j SNAT --to-source x.x.x.x-x.x.x.y since I only have one external ip + * If you do test this please let me know if it works or not. + * + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +MODULE_AUTHOR("Magnus Boden "); +MODULE_DESCRIPTION("Netfilter NAT helper for tftp"); +MODULE_LICENSE("GPL"); + +#define MAX_PORTS 8 + +static int ports[MAX_PORTS]; +static int ports_c = 0; +#ifdef MODULE_PARM +MODULE_PARM(ports,"1-" __MODULE_STRING(MAX_PORTS) "i"); +MODULE_PARM_DESC(ports, "port numbers of tftp servers"); +#endif + +#if 0 +#define DEBUGP(format, args...) printk(__FILE__ ":" __FUNCTION__ ": " \ + format, ## args) +#else +#define DEBUGP(format, args...) +#endif +static unsigned int +tftp_nat_help(struct ip_conntrack *ct, + struct ip_conntrack_expect *exp, + struct ip_nat_info *info, + enum ip_conntrack_info ctinfo, + unsigned int hooknum, + struct sk_buff **pskb) +{ + int dir = CTINFO2DIR(ctinfo); + struct iphdr *iph = (*pskb)->nh.iph; + struct udphdr *udph = (void *)iph + iph->ihl * 4; + struct tftphdr *tftph = (void *)udph + 8; + struct ip_conntrack_tuple repl; + + if (!((hooknum == NF_IP_POST_ROUTING && dir == IP_CT_DIR_ORIGINAL) + || (hooknum == NF_IP_PRE_ROUTING && dir == IP_CT_DIR_REPLY))) + return NF_ACCEPT; + + if (!exp) { + DEBUGP("no conntrack expectation to modify\n"); + return NF_ACCEPT; + } + + switch (ntohs(tftph->opcode)) { + /* RRQ and WRQ works the same way */ + case TFTP_OPCODE_READ: + case TFTP_OPCODE_WRITE: + repl = ct->tuplehash[IP_CT_DIR_REPLY].tuple; + DEBUGP(""); + DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); + DUMP_TUPLE(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); + DEBUGP("expecting: "); + DUMP_TUPLE(&repl); + DUMP_TUPLE(&exp->mask); + ip_conntrack_change_expect(exp, &repl); + break; + default: + DEBUGP("Unknown opcode\n"); + } + + return NF_ACCEPT; +} + +static unsigned int +tftp_nat_expected(struct sk_buff **pskb, + unsigned int hooknum, + struct ip_conntrack *ct, + struct ip_nat_info *info) +{ + const struct ip_conntrack *master = ct->master->expectant; + const struct ip_conntrack_tuple *orig = + &master->tuplehash[IP_CT_DIR_ORIGINAL].tuple; + struct ip_nat_multi_range mr; +#if 0 + const struct ip_conntrack_tuple *repl = + &master->tuplehash[IP_CT_DIR_REPLY].tuple; + struct iphdr *iph = (*pskb)->nh.iph; + struct udphdr *udph = (void *)iph + iph->ihl*4; +#endif + + IP_NF_ASSERT(info); + IP_NF_ASSERT(master); + IP_NF_ASSERT(!(info->initialized & (1 << HOOK2MANIP(hooknum)))); + + mr.rangesize = 1; + mr.range[0].flags = IP_NAT_RANGE_MAP_IPS; + + if (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) { + mr.range[0].min_ip = mr.range[0].max_ip = orig->dst.ip; + DEBUGP("orig: %u.%u.%u.%u:%u <-> %u.%u.%u.%u:%u " + "newsrc: %u.%u.%u.%u\n", + NIPQUAD((*pskb)->nh.iph->saddr), ntohs(udph->source), + NIPQUAD((*pskb)->nh.iph->daddr), ntohs(udph->dest), + NIPQUAD(orig->dst.ip)); + } else { + mr.range[0].min_ip = mr.range[0].max_ip = orig->src.ip; + mr.range[0].min.udp.port = mr.range[0].max.udp.port = + orig->src.u.udp.port; + mr.range[0].flags |= IP_NAT_RANGE_PROTO_SPECIFIED; + + DEBUGP("orig: %u.%u.%u.%u:%u <-> %u.%u.%u.%u:%u " + "newdst: %u.%u.%u.%u:%u\n", + NIPQUAD((*pskb)->nh.iph->saddr), ntohs(udph->source), + NIPQUAD((*pskb)->nh.iph->daddr), ntohs(udph->dest), + NIPQUAD(orig->src.ip), ntohs(orig->src.u.udp.port)); + } + + return ip_nat_setup_info(ct,&mr,hooknum); +} + +static struct ip_nat_helper tftp[MAX_PORTS]; +static char tftp_names[MAX_PORTS][10]; + +static void fini(void) +{ + int i; + + for (i = 0 ; i < ports_c; i++) { + DEBUGP("unregistering helper for port %d\n", ports[i]); + ip_nat_helper_unregister(&tftp[i]); + } +} + +static int __init init(void) +{ + int i, ret; + char *tmpname; + + if (!ports[0]) + ports[0] = TFTP_PORT; + + for (i = 0 ; (i < MAX_PORTS) && ports[i] ; i++) { + memset(&tftp[i], 0, sizeof(struct ip_nat_helper)); + + tftp[i].tuple.dst.protonum = IPPROTO_UDP; + tftp[i].tuple.src.u.udp.port = htons(ports[i]); + tftp[i].mask.dst.protonum = 0xFFFF; + tftp[i].mask.src.u.udp.port = 0xFFFF; + tftp[i].help = tftp_nat_help; + tftp[i].flags = 0; + tftp[i].me = THIS_MODULE; + tftp[i].expect = tftp_nat_expected; + + tmpname = &tftp_names[i][0]; + if (ports[i] == TFTP_PORT) + sprintf(tmpname, "tftp"); + else + sprintf(tmpname, "tftp-%d", i); + tftp[i].name = tmpname; + + DEBUGP("ip_nat_tftp: registering for port %d: name %s\n", + ports[i], tftp[i].name); + ret = ip_nat_helper_register(&tftp[i]); + + if (ret) { + printk("ip_nat_tftp: unable to register for port %d\n", + ports[i]); + fini(); + return ret; + } + ports_c++; + } + return ret; +} + +module_init(init); +module_exit(fini); diff -urN linux-2.5.66-bk7/net/ipv6/addrconf.c linux-2.5.66-bk8/net/ipv6/addrconf.c --- linux-2.5.66-bk7/net/ipv6/addrconf.c Mon Mar 24 14:01:28 2003 +++ linux-2.5.66-bk8/net/ipv6/addrconf.c Wed Apr 2 04:38:17 2003 @@ -30,6 +30,8 @@ * address validation timer. * YOSHIFUJI Hideaki @USAGI : Privacy Extensions (RFC3041) * support. + * Yuji SEKIYA @USAGI : Don't assign a same IPv6 + * address on a same interface. */ #include @@ -126,6 +128,8 @@ static void addrconf_rs_timer(unsigned long data); static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); +static int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev); + static struct notifier_block *inet6addr_chain; struct ipv6_devconf ipv6_devconf = @@ -492,12 +496,23 @@ { struct inet6_ifaddr *ifa; int hash; + static spinlock_t lock = SPIN_LOCK_UNLOCKED; + + spin_lock_bh(&lock); + + /* Ignore adding duplicate addresses on an interface */ + if (ipv6_chk_same_addr(addr, idev->dev)) { + spin_unlock_bh(&lock); + ADBG(("ipv6_add_addr: already assigned\n")); + return ERR_PTR(-EEXIST); + } ifa = kmalloc(sizeof(struct inet6_ifaddr), GFP_ATOMIC); if (ifa == NULL) { + spin_unlock_bh(&lock); ADBG(("ipv6_add_addr: malloc failed\n")); - return NULL; + return ERR_PTR(-ENOBUFS); } memset(ifa, 0, sizeof(struct inet6_ifaddr)); @@ -513,8 +528,9 @@ read_lock(&addrconf_lock); if (idev->dead) { read_unlock(&addrconf_lock); + spin_unlock_bh(&lock); kfree(ifa); - return NULL; + return ERR_PTR(-ENODEV); /*XXX*/ } inet6_ifa_count++; @@ -551,6 +567,7 @@ in6_ifa_hold(ifa); write_unlock_bh(&idev->lock); read_unlock(&addrconf_lock); + spin_unlock_bh(&lock); notifier_call_chain(&inet6addr_chain,NETDEV_UP,ifa); @@ -697,7 +714,7 @@ ift = ipv6_count_addresses(idev) < IPV6_MAX_ADDRESSES ? ipv6_add_addr(idev, &addr, tmp_plen, ipv6_addr_type(&addr)&IPV6_ADDR_SCOPE_MASK, IFA_F_TEMPORARY) : 0; - if (!ift) { + if (IS_ERR(ift)) { in6_dev_put(idev); in6_ifa_put(ifp); printk(KERN_INFO @@ -928,6 +945,23 @@ return ifp != NULL; } +static +int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev) +{ + struct inet6_ifaddr * ifp; + u8 hash = ipv6_addr_hash(addr); + + read_lock_bh(&addrconf_hash_lock); + for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { + if (ipv6_addr_cmp(&ifp->addr, addr) == 0) { + if (dev == NULL || ifp->idev->dev == dev) + break; + } + } + read_unlock_bh(&addrconf_hash_lock); + return ifp != NULL; +} + struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, struct net_device *dev) { struct inet6_ifaddr * ifp; @@ -1344,7 +1378,7 @@ ifp = ipv6_add_addr(in6_dev, &addr, pinfo->prefix_len, addr_type&IPV6_ADDR_SCOPE_MASK, 0); - if (ifp == NULL) { + if (IS_ERR(ifp)) { in6_dev_put(in6_dev); return; } @@ -1499,13 +1533,14 @@ scope = ipv6_addr_scope(pfx); - if ((ifp = ipv6_add_addr(idev, pfx, plen, scope, IFA_F_PERMANENT)) != NULL) { + ifp = ipv6_add_addr(idev, pfx, plen, scope, IFA_F_PERMANENT); + if (!IS_ERR(ifp)) { addrconf_dad_start(ifp); in6_ifa_put(ifp); return 0; } - return -ENOBUFS; + return PTR_ERR(ifp); } static int inet6_addr_del(int ifindex, struct in6_addr *pfx, int plen) @@ -1597,7 +1632,7 @@ if (addr.s6_addr32[3]) { ifp = ipv6_add_addr(idev, &addr, 128, scope, IFA_F_PERMANENT); - if (ifp) { + if (!IS_ERR(ifp)) { spin_lock_bh(&ifp->lock); ifp->flags &= ~IFA_F_TENTATIVE; spin_unlock_bh(&ifp->lock); @@ -1633,7 +1668,7 @@ ifp = ipv6_add_addr(idev, &addr, plen, flag, IFA_F_PERMANENT); - if (ifp) { + if (!IS_ERR(ifp)) { spin_lock_bh(&ifp->lock); ifp->flags &= ~IFA_F_TENTATIVE; spin_unlock_bh(&ifp->lock); @@ -1660,7 +1695,7 @@ } ifp = ipv6_add_addr(idev, &in6addr_loopback, 128, IFA_HOST, IFA_F_PERMANENT); - if (ifp) { + if (!IS_ERR(ifp)) { spin_lock_bh(&ifp->lock); ifp->flags &= ~IFA_F_TENTATIVE; spin_unlock_bh(&ifp->lock); @@ -1674,7 +1709,7 @@ struct inet6_ifaddr * ifp; ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, IFA_F_PERMANENT); - if (ifp) { + if (!IS_ERR(ifp)) { addrconf_dad_start(ifp); in6_ifa_put(ifp); } diff -urN linux-2.5.66-bk7/net/ipv6/ah6.c linux-2.5.66-bk8/net/ipv6/ah6.c --- linux-2.5.66-bk7/net/ipv6/ah6.c Wed Apr 2 04:38:05 2003 +++ linux-2.5.66-bk8/net/ipv6/ah6.c Wed Apr 2 04:38:17 2003 @@ -287,7 +287,7 @@ x->props.header_len = XFRM_ALIGN8(ahp->icv_trunc_len + AH_HLEN_NOICV); if (x->props.mode) - x->props.header_len += 40; + x->props.header_len += sizeof(struct ipv6hdr); x->data = ahp; return 0; diff -urN linux-2.5.66-bk7/net/ipv6/esp6.c linux-2.5.66-bk8/net/ipv6/esp6.c --- linux-2.5.66-bk7/net/ipv6/esp6.c Wed Apr 2 04:38:05 2003 +++ linux-2.5.66-bk8/net/ipv6/esp6.c Wed Apr 2 04:38:17 2003 @@ -468,7 +468,7 @@ crypto_cipher_setkey(esp->conf.tfm, esp->conf.key, esp->conf.key_len); x->props.header_len = 8 + esp->conf.ivlen; if (x->props.mode) - x->props.header_len += 40; /* XXX ext hdr */ + x->props.header_len += sizeof(struct ipv6hdr); x->data = esp; return 0; diff -urN linux-2.5.66-bk7/net/ipx/af_ipx.c linux-2.5.66-bk8/net/ipx/af_ipx.c --- linux-2.5.66-bk7/net/ipx/af_ipx.c Mon Mar 24 14:00:08 2003 +++ linux-2.5.66-bk8/net/ipx/af_ipx.c Wed Apr 2 04:38:17 2003 @@ -180,7 +180,8 @@ spin_unlock_bh(&intrfc->if_sklist_lock); sock_put(sk); ipxitf_put(intrfc); -out: return; +out: + return; } static void ipx_destroy_socket(struct sock *sk) @@ -403,7 +404,8 @@ i = tmp; } spin_unlock_bh(&ipx_interfaces_lock); -out: return NOTIFY_DONE; +out: + return NOTIFY_DONE; } static void ipxitf_def_skb_handler(struct sock *sock, struct sk_buff *skb) @@ -463,7 +465,8 @@ kfree_skb(skb); ret = 0; -out: spin_unlock_bh(&intrfc->if_sklist_lock); +out: + spin_unlock_bh(&intrfc->if_sklist_lock); return ret; } #else @@ -578,7 +581,8 @@ ipxitf_def_skb_handler(sock2, skb2); ret = 0; -out: if (sock1) +out: + if (sock1) sock_put(sock1); if (sock2) sock_put(sock2); @@ -716,7 +720,8 @@ /* Send it out */ dl->request(dl, skb, dest_node); -out: return 0; +out: + return 0; } static int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc, @@ -903,7 +908,8 @@ } } spin_unlock_bh(&ipx_interfaces_lock); -out: return ret; +out: + return ret; } static void ipxitf_insert(struct ipx_interface *intrfc) @@ -979,7 +985,8 @@ ret = ipxitf_add_local_route(intrfc); ipxitf_put(intrfc); -out: return ret; +out: + return ret; } static int ipx_map_frame_type(unsigned char type) @@ -1109,7 +1116,8 @@ goto out; out_dev: dev_put(dev); -out: return err; +out: + return err; } static int ipxitf_delete(struct ipx_interface_definition *idef) @@ -1146,7 +1154,8 @@ __ipxitf_put(intrfc); ret = 0; -out: spin_unlock_bh(&ipx_interfaces_lock); +out: + spin_unlock_bh(&ipx_interfaces_lock); return ret; } @@ -1197,7 +1206,8 @@ dev_hold(dev); } -out: return intrfc; +out: + return intrfc; } static int ipxitf_ioctl(unsigned int cmd, void *arg) @@ -1346,7 +1356,8 @@ ret = 0; out_put: ipxrtr_put(rt); -out: return ret; +out: + return ret; } static void ipxrtr_del_routes(struct ipx_interface *intrfc) @@ -1375,7 +1386,8 @@ goto out; ret = ipxrtr_add_route(rd->ipx_network, intrfc, rd->ipx_router_node); ipxitf_put(intrfc); -out: return ret; +out: + return ret; } static int ipxrtr_delete(long net) @@ -1401,7 +1413,8 @@ r = &(tmp->ir_next); } err = -ENOENT; -out: write_unlock_bh(&ipx_routes_lock); +out: + write_unlock_bh(&ipx_routes_lock); return err; } @@ -1528,7 +1541,8 @@ ipxitf_put(intrfc); if (rt) ipxrtr_put(rt); -out: return err; +out: + return err; } /* the skb has to be unshared, we'll end up calling ipxitf_send, that'll @@ -1587,7 +1601,8 @@ } } -out: return ret; +out: + return ret; } const char *ipx_frame_name(unsigned short frame) @@ -1634,7 +1649,8 @@ ipx_sk(sk)->type = opt; ret = 0; -out: return ret; +out: + return ret; } static int ipx_getsockopt(struct socket *sock, int level, int optname, @@ -1664,7 +1680,8 @@ goto out; ret = 0; -out: return ret; +out: + return ret; } static int ipx_create(struct socket *sock, int protocol) @@ -1706,9 +1723,12 @@ sock_init_data(sock, sk); sk->no_check = 1; /* Checksum off by default */ ret = 0; -out: return ret; -outsk: sk_free(sk); -decmod: MOD_DEC_USE_COUNT; +out: + return ret; +outsk: + sk_free(sk); +decmod: + MOD_DEC_USE_COUNT; goto out; } @@ -1729,7 +1749,8 @@ if (sock->type == SOCK_DGRAM) MOD_DEC_USE_COUNT; -out: return 0; +out: + return 0; } /* caller must hold a reference to intrfc */ @@ -1847,7 +1868,8 @@ ret = 0; out_put: ipxitf_put(intrfc); -out: return ret; +out: + return ret; } static int ipx_connect(struct socket *sock, struct sockaddr *uaddr, @@ -1907,7 +1929,8 @@ if (rt) ipxrtr_put(rt); ret = 0; -out: return ret; +out: + return ret; } @@ -1954,7 +1977,8 @@ memcpy(uaddr, &sipx, sizeof(sipx)); ret = 0; -out: return ret; +out: + return ret; } int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) @@ -2005,8 +2029,10 @@ ret = ipxitf_rcv(intrfc, skb); ipxitf_put(intrfc); goto out; -drop: kfree_skb(skb); -out: return ret; +drop: + kfree_skb(skb); +out: + return ret; } static int ipx_sendmsg(struct kiocb *iocb, struct socket *sock, @@ -2065,7 +2091,8 @@ flags & MSG_DONTWAIT); if (ret >= 0) ret = len; -out: return ret; +out: + return ret; } @@ -2134,7 +2161,8 @@ out_free: skb_free_datagram(sk, skb); -out: return err; +out: + return err; } diff -urN linux-2.5.66-bk7/net/socket.c linux-2.5.66-bk8/net/socket.c --- linux-2.5.66-bk7/net/socket.c Wed Apr 2 04:38:06 2003 +++ linux-2.5.66-bk8/net/socket.c Wed Apr 2 04:38:18 2003 @@ -55,6 +55,7 @@ * This module is effectively the top level interface to the BSD socket * paradigm. * + * Based upon Swansea University Computer Society NET3.039 */ #include @@ -1874,9 +1875,6 @@ { int i; - printk(KERN_INFO "Linux NET4.0 for Linux 2.4\n"); - printk(KERN_INFO "Based upon Swansea University Computer Society NET3.039\n"); - /* * Initialize all address (protocol) families. */ diff -urN linux-2.5.66-bk7/scripts/file2alias.c linux-2.5.66-bk8/scripts/file2alias.c --- linux-2.5.66-bk7/scripts/file2alias.c Mon Mar 24 14:00:35 2003 +++ linux-2.5.66-bk8/scripts/file2alias.c Wed Apr 2 04:38:18 2003 @@ -81,10 +81,14 @@ return 1; } -/* Looks like: pci:vNdNsvNsdNcN. */ +/* Looks like: pci:vNdNsvNsdNbcNscNiN. */ static int do_pci_entry(const char *filename, struct pci_device_id *id, char *alias) { + /* Class field can be divided into these three. */ + unsigned char baseclass, subclass, interface, + baseclass_mask, subclass_mask, interface_mask; + id->vendor = TO_NATIVE(id->vendor); id->device = TO_NATIVE(id->device); id->subvendor = TO_NATIVE(id->subvendor); @@ -97,13 +101,26 @@ ADD(alias, "d", id->device != PCI_ANY_ID, id->device); ADD(alias, "sv", id->subvendor != PCI_ANY_ID, id->subvendor); ADD(alias, "sd", id->subdevice != PCI_ANY_ID, id->subdevice); - if (id->class_mask != 0 && id->class_mask != ~0) { + + baseclass = (id->class) >> 16; + baseclass_mask = (id->class_mask) >> 16; + subclass = (id->class) >> 8; + subclass_mask = (id->class_mask) >> 8; + interface = id->class; + interface_mask = id->class_mask; + + if ((baseclass_mask != 0 && baseclass_mask != 0xFF) + || (subclass_mask != 0 && subclass_mask != 0xFF) + || (interface_mask != 0 && interface_mask != 0xFF)) { fprintf(stderr, - "*** Warning: Can't handle class_mask in %s:%04X\n", + "*** Warning: Can't handle masks in %s:%04X\n", filename, id->class_mask); return 0; } - ADD(alias, "c", id->class_mask == ~0, id->class); + + ADD(alias, "bc", baseclass_mask == 0xFF, baseclass); + ADD(alias, "sc", subclass_mask == 0xFF, subclass); + ADD(alias, "i", interface_mask == 0xFF, interface); return 1; }