GIT 83d722f7e198b034699b1500d98729beff930efd git+ssh://master.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git commit 83d722f7e198b034699b1500d98729beff930efd Author: Chandra Seetharaman Date: Mon Apr 24 19:35:21 2006 -0700 [PATCH] Remove __devinit and __cpuinit from notifier_call definitions Few of the notifier_chain_register() callers use __init in the definition of notifier_call. It is incorrect as the function definition should be available after the initializations (they do not unregister them during initializations). This patch fixes all such usages to _not_ have the notifier_call __init section. Signed-off-by: Chandra Seetharaman Signed-off-by: Linus Torvalds commit 649bbaa484bcdce94f40a1b97a6a2ded0549e8a2 Author: Chandra Seetharaman Date: Mon Apr 24 19:35:15 2006 -0700 [PATCH] Remove __devinitdata from notifier block definitions Few of the notifier_chain_register() callers use __devinitdata in the definition of notifier_block data structure. It is incorrect as the data structure should be available after the initializations (they do not unregister them during initializations). This was leading to an oops when notifier_chain_register() call is invoked for those callback chains after initialization. This patch fixes all such usages to _not_ have the notifier_block data structure in the init data section. Signed-off-by: Chandra Seetharaman Signed-off-by: Linus Torvalds commit e7edf9cdeddc0cff125e8e658216efb2ff2b2219 Author: James Morris Date: Wed Apr 26 02:45:03 2006 -0400 [PATCH] LSM: add missing hook to do_compat_readv_writev() This patch addresses a flaw in LSM, where there is no mediation of readv() and writev() in for 32-bit compatible apps using a 64-bit kernel. This bug was discovered and fixed initially in the native readv/writev code [1], but was not fixed in the compat code. Thanks to Al for spotting this one. [1] http://lwn.net/Articles/154282/ Signed-off-by: James Morris Signed-off-by: Al Viro Signed-off-by: Linus Torvalds commit a090d9132c1e53e3517111123680c15afb25c0a4 Author: Al Viro Date: Wed Apr 26 07:32:40 2006 +0100 [PATCH] protect ext3 ioctl modifying append_only, immutable, etc. with i_mutex All modifications of ->i_flags in inodes that might be visible to somebody else must be under ->i_mutex. That patch fixes ext3 ioctl() setting S_APPEND and friends. Signed-off-by: Al Viro Signed-off-by: Linus Torvalds commit 6ad0013b316367671ef316cff91ab2d912e309c9 Author: Al Viro Date: Wed Apr 26 07:28:09 2006 +0100 [PATCH] fix mips sys32_p{read,write} Switched to use of sys_pread64()/sys_pwrite64() rather than keep duplicating their guts; among the little things that had been missing there were such as ret = security_file_permission (file, MAY_READ); Gotta love the LSM robustness, right? Signed-off-by: Al Viro Signed-off-by: Linus Torvalds commit de0bb97aff6743f71abb8ec581238e2bdae9cdd1 Author: Al Viro Date: Wed Apr 26 07:26:09 2006 +0100 [PATCH] forgotten ->b_data in memcpy() call in ext3/resize.c (oopsable) sbi->s_group_desc is an array of pointers to buffer_head. memcpy() of buffer size from address of buffer_head is a bad idea - it will generate junk in any case, may oops if buffer_head is close to the end of slab page and next page is not mapped and isn't what was intended there. IOW, ->b_data is missing in that call. Fortunately, result doesn't go into the primary on-disk data structures, so only backup ones get crap written to them; that had allowed this bug to remain unnoticed until now. Signed-off-by: Al Viro Signed-off-by: Linus Torvalds commit c82ffb07cd1aa356c599999c4f0dc5155a91d318 Author: Al Viro Date: Wed Apr 26 07:20:48 2006 +0100 [PATCH] fix leak in activate_ep_files() Signed-off-by: Al Viro Signed-off-by: Linus Torvalds commit 1ebd32fc54bd04de6b3944587f25513c0681f98e Author: Jens Axboe Date: Wed Apr 26 14:40:08 2006 +0200 [PATCH] splice: add ->splice_write support for /dev/null Useful for testing. Signed-off-by: Jens Axboe commit 00522fb41a2a9bf0f98a007c0e2b516a3873148c Author: Jens Axboe Date: Wed Apr 26 14:39:29 2006 +0200 [PATCH] splice: rearrange moving to/from pipe helpers We need these for people writing their own ->splice_read/write hooks. Signed-off-by: Jens Axboe commit 86a0f04387bfa814618bf0c2c8b203899c4fa5d2 Author: Ayaz Abdulla Date: Mon Apr 24 18:41:31 2006 -0400 [PATCH] forcedeth: fix initialization This patch fixes the nic initialization. If the nic was in low power mode, it brings it back to normal power. Also, it utilizes a new hardware reset during the init. I am resending based on feedback, I corrected the register size mapping and delay after posted write. Signed-Off-By: Ayaz Abdulla Signed-off-by: Jeff Garzik commit bdf9c27d020ba50b42949c383c1956216c9fd522 Author: Stephen Hemminger Date: Tue Apr 25 10:58:54 2006 -0700 [PATCH] sky2: version 1.2 Update to version 1.2 Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik commit 98712e5e3325247bf22a175d225526c9d5f8439b Author: Stephen Hemminger Date: Tue Apr 25 10:58:53 2006 -0700 [PATCH] sky2: reset function can be devinit The sky2_reset function only called from sky2_probe. Maybe the compiler was smart enough to figure this out already. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik commit 4a15d56f78936ec15a5d747546f25ace8fef9a03 Author: Stephen Hemminger Date: Tue Apr 25 10:58:52 2006 -0700 [PATCH] sky2: use ALIGN() macro The ALIGN() macro in kernel.h does the same math that the sky2 driver was using for padding. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik commit d27ed38765d6e01eaab443a7909f53a37f090e99 Author: Stephen Hemminger Date: Tue Apr 25 10:58:51 2006 -0700 [PATCH] sky2: add fake idle irq timer Add an fake NAPI schedule once a second. This is an attempt to work around for broken configurations with edge-triggered interrupts. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik commit 734cbc363b159caee158d5a83408c72d98bcacf0 Author: Stephen Hemminger Date: Tue Apr 25 10:58:50 2006 -0700 [PATCH] sky2: reschedule if irq still pending This is a workaround for the case edge-triggered irq's. Several users seem to have broken configurations sharing edge-triggered irq's. To avoid losing IRQ's, reshedule if more work arrives. The changes to netdevice.h are to extract the part that puts device back in list into separate inline. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik commit 85ca719e5756d79ea0f10c469e3762462ac45e22 Author: Stephen Hemminger Date: Wed Apr 26 02:39:19 2006 -0700 [BRIDGE]: allow full size vlan packets Need to allow for VLAN header when bridging. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller commit 912d35f86781e64d73be1ef358f703c08905ac37 Author: Jens Axboe Date: Wed Apr 26 10:59:21 2006 +0200 [PATCH] Add support for the sys_vmsplice syscall sys_splice() moves data to/from pipes with a file input/output. sys_vmsplice() moves data to a pipe, with the input being a user address range instead. This uses an approach suggested by Linus, where we can hold partial ranges inside the pages[] map. Hopefully this will be useful for network receive support as well. Signed-off-by: Jens Axboe commit c86d90df2676d9d212c0ab1f3c64e0abdf5b4c09 Author: Miklos Szeredi Date: Wed Apr 26 10:49:26 2006 +0200 [doc] add paragraph about 'fs' subsystem to sysfs.txt Signed-off-by: Miklos Szeredi commit 8aa09a50b5d9dbdf627f79e19d72d82994348089 Author: Miklos Szeredi Date: Wed Apr 26 10:49:16 2006 +0200 [fuse] fix race between checking and setting file->private_data BKL does not protect against races if the task may sleep between checking and setting a value. So move checking of file->private_data near to setting it in fuse_fill_super(). Found by Al Viro. Signed-off-by: Miklos Szeredi commit 6dbbcb120570d747b00783820ee02d1e1bcf63de Author: Miklos Szeredi Date: Wed Apr 26 10:49:06 2006 +0200 [fuse] fix deadlock between fuse_put_super() and request_end(), try #2 A deadlock was possible, when the last reference to the superblock was held due to a background request containing a file reference. Releasing the file would release the vfsmount which in turn would release the superblock. Since sbput_sem is held during the fput() and fuse_put_super() tries to acquire this same semaphore, a deadlock results. The solution is to move the fput() outside the region protected by sbput_sem. Signed-off-by: Miklos Szeredi commit 5a5fb1ea74d8b82ca1461b885a1334fb21e037be Author: Miklos Szeredi Date: Wed Apr 26 10:48:55 2006 +0200 Revert "[fuse] fix deadlock between fuse_put_super() and request_end()" This reverts 73ce8355c243a434524a34c05cc417dd0467996e commit. It was wrong, because it didn't take into account the requirement, that iput() for background requests must be performed synchronously with ->put_super(), otherwise active inodes may remain after unmount. The right solution is to keep the sbput_sem and perform iput() within the locked region, but move fput() outside sbput_sem. Signed-off-by: Miklos Szeredi commit 016b661e2f717168e600f3c85f29e1a49f88e004 Author: Jens Axboe Date: Tue Apr 25 15:42:00 2006 +0200 [PATCH] splice: fix offset problems Make the move_from_pipe() actors return number of bytes processed, then move_from_pipe() can decide more cleverly when to move on to the next buffer. This fixes problems with pipe offset and differing file offset. Signed-off-by: Jens Axboe commit ba5f5d90c45a30e4e9a1bd136acf1b3973c905c8 Author: Andrew Morton Date: Tue Apr 25 15:33:34 2006 +0200 [PATCH] splice: fix min() warning Signed-off-by: Andrew Morton Signed-off-by: Jens Axboe commit bcb49197ed9a2e8a0a8d990723dccfccffa7566f Author: Auke Kok Date: Tue Apr 25 22:50:04 2006 -0700 e1000: Update truesize with the length of the packet for packet split Update skb with the real packet size. Signed-off-by: Jesse Brandeburg Signed-off-by: Auke Kok Signed-off-by: John Ronciak commit 4d5c34ec7b007cfb0771a36996b009f194acbb2f Author: Ivan Kokshaysky Date: Tue Apr 25 13:45:19 2006 +0400 [PATCH] Alpha: strncpy() fix As it turned out after recent SCSI changes, strncpy() was broken - it mixed up the return values from __stxncpy() in registers $24 and $27. Thanks to Mathieu Chouquet-Stringer for tracking down the problem and providing an excellent test case. Signed-off-by: Ivan Kokshaysky Signed-off-by: Linus Torvalds commit 18118cdbfd1f855e09ee511d764d6c9df3d4f952 Author: Patrick McHardy Date: Mon Apr 24 17:18:59 2006 -0700 [NETFILTER]: ipt action: use xt_check_target for basic verification The targets don't do the basic verification themselves anymore so the ipt action needs to take care of it. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller commit 91536b7ae67710ca888e03ea82c60f0ac073a015 Author: Dmitry Mishin Date: Mon Apr 24 17:18:25 2006 -0700 [NETFILTER]: x_tables: move table->lock initialization xt_table->lock should be initialized before xt_replace_table() call, which uses it. This patch removes strict requirement that table should define lock before registering. Signed-off-by: Dmitry Mishin Signed-off-by: Kirill Korotaev Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller commit e4a79ef811505a8bf8d8edfda8602e23cb2fbdb0 Author: Patrick McHardy Date: Mon Apr 24 17:17:49 2006 -0700 [NETFILTER]: ip6_tables: remove broken comefrom debugging The introduction of x_tables broke comefrom debugging, remove it from ip6_tables as well (ip_tables already got removed). Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller commit 2c16b774c7a9b1684b0ff10121915903e9f0cf6c Author: Yasuyuki Kozakai Date: Mon Apr 24 17:16:59 2006 -0700 [NETFILTER]: nf_conntrack: kill unused callback init_conntrack Signed-off-by: Yasuyuki Kozakai Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller commit 55fe5866366ae42f259f27ae5962eb267d9ce172 Author: Patrick McHardy Date: Mon Apr 24 17:16:28 2006 -0700 [NETFILTER]: Fix compat_xt_counters alignment for non-x86 Some (?) non-x86 architectures require 8byte alignment for u_int64_t even when compiled for 32bit, using u_int32_t in compat_xt_counters breaks on these architectures, use u_int64_t for everything but x86. Reported by Andreas Schwab . Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller commit 44adf28f4a27df626d50e54c8d0669df2dd1aa89 Author: Thomas Voegtle Date: Mon Apr 24 17:15:54 2006 -0700 [NETFILTER]: ULOG target is not obsolete The backend part is obsoleted, but the target itself is still needed. Signed-off-by: Thomas Voegtle Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller commit e1bbdebdba615ddd957de81103aa2f7fa0581952 Author: Yasuyuki Kozakai Date: Mon Apr 24 17:15:17 2006 -0700 [NETFILTER]: nf_conntrack: Fix module refcount dropping too far If nf_ct_l3proto_find_get() fails to get the refcount of nf_ct_l3proto_generic, nf_ct_l3proto_put() will drop the refcount too far. This gets rid of '.me = THIS_MODULE' of nf_ct_l3proto_generic so that nf_ct_l3proto_find_get() doesn't try to get refcount of it. It's OK because its symbol is usable until nf_conntrack.ko is unloaded. This also kills unnecessary NULL pointer check as well. __nf_ct_proto_find() allways returns non-NULL pointer. Signed-off-by: Yasuyuki Kozakai Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller commit d8fe3f19203b1f5070358aaa292d33295258b448 Author: OGAWA Hirofumi Date: Mon Apr 24 13:48:51 2006 -0700 [SPARC]: __NR_sys removal __NR_sys_sync_file_range part was lost somewhere... [glibc is already checking __NR_sync_file_range] Signed-off-by: OGAWA Hirofumi Signed-off-by: David S. Miller commit 7c241d37fe0e6442c5cf3b5d73f7f58f2dc66352 Author: Michael Buesch Date: Sun Apr 23 13:23:10 2006 +0200 [PATCH] bcm43xx: make PIO mode usable This patch fixes PIO mode on the softmac bcm43xx driver. (A dscape patch will follow). It mainly fixes endianess issues. This patch is tested on PowerPC32 and i386. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville commit 9eac8f95d1bb2cec96340505bed2d2387780821f Author: Michael Buesch Date: Sat Apr 22 17:31:27 2006 +0200 [PATCH] bcm43xx: add to MAINTAINERS Signed-off-by: John W. Linville commit 818667f7c40dd0bd14029b5ac1d0f5282e12310e Author: Johannes Berg Date: Thu Apr 20 20:02:03 2006 +0200 [PATCH] softmac: fix SIOCSIWAP There are some bugs in the current implementation of the SIOCSIWAP wext, for example that when you do it twice and it fails, it may still try another access point for some reason. This patch fixes this by introducing a new flag that tells the association code that the bssid that is in use was fixed by the user and shouldn't be deviated from. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville commit dac322e39a2b82871cf514c9a533f24a1b4c7e19 Author: Pavel Roskin Date: Mon Apr 17 11:36:43 2006 -0400 [PATCH] Fix crash on big-endian systems during scan The original code was doing arithmetics on a little-endian value. Reported by Stelios Koroneos Signed-off-by: Pavel Roskin Signed-off-by: John W. Linville commit 301dc3e6f6ea83703fa52919c00e60661da5a8fe Author: Steve French Date: Mon Apr 24 16:24:54 2006 +0000 [CIFS] Fix compile error when CONFIG_CIFS_EXPERIMENTAL is undefined Signed-off-by: Dave Kleikamp Signed-off-by: Steve French commit 5d23fafb1bf8ef071738026c2e5071a92186d5f8 Author: Dave Airlie Date: Sun Apr 23 18:26:40 2006 +1000 drm: possible cleanups This patch contains the following possible cleanups: - make the following needlessly global function static: - drm_bufs.c: drm_addbufs_fb() - remove the following unused EXPORT_SYMBOL's: - drm_agpsupport.c: drm_agp_bind_memory - drm_bufs.c: drm_rmmap_locked - drm_bufs.c: drm_rmmap - drm_stub.c: drm_get_dev Signed-off-by: Adrian Bunk Signed-off-by: Dave Airlie commit caa98c41c0db9bfda5bc9a0e680f304283089268 Author: Dave Airlie Date: Sun Apr 23 18:14:00 2006 +1000 drm: fixup r300 scratch on BE machines This fixes the r300 scratch stuff to work on PPC, from Ben Herrenschmidt on IRC. Signed-off-by: Dave Airlie commit b66ac3ea21f81dea02cdb4e9de66ee6afdc540e4 Author: Steve French Date: Sun Apr 23 01:54:50 2006 +0000 [CIFS] Fix typo in previous Signed-off-by: Steve French commit d0e15bed84db7a9b0ea85d2ad9707b5e6d2e38da Author: Paul Mackerras Date: Sun Apr 23 10:42:04 2006 +1000 powerpc: Fix define_machine so machine_is() works from modules machine_is() was always returning 0 when used in a module, because we weren't exporting the machine definitions. This was why sound wasn't working on powermacs when CONFIG_SND_POWERMAC=m. Original fix from Ben Herrenschmidt, further fixed by me. Signed-off-by: Paul Mackerras commit 93e1b7d42e1edb4ddde6257e9a02513fef26f715 Author: Kylene Jo Hall Date: Sat Apr 22 02:39:52 2006 -0700 [PATCH] tpm: add HID module parameter I recently found that not all BIOS manufacturers are using the specified generic PNP id in their TPM ACPI table entry. I have added the vendor specific IDs that I know about and added a module parameter that a user can specify another HID to the probe list if their device isn't being found by the default list. Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 5713556843aee24f484f445db6540f9fef976439 Author: Kylene Jo Hall Date: Sat Apr 22 02:39:44 2006 -0700 [PATCH] tpm: add interrupt module parameter This patch adds a boolean module parameter that allows the user to turn interrupt support on and off. The default behavior is to attempt to use interrupts. Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit cb5354253af2bc30ed449b8be4b3bddf3b3a2746 Author: Kylene Jo Hall Date: Sat Apr 22 02:39:31 2006 -0700 [PATCH] tpm: spacing cleanups 2 Fixes minor spacing issues. Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 397c718299d848ff305ecd955838a9bd32f1f881 Author: Randy Dunlap Date: Sat Apr 22 02:39:18 2006 -0700 [PATCH] tpm_infineon section fixup Use __devexit_p() for the exit/remove function to protect against discarding it. WARNING: drivers/char/tpm/tpm_infineon.o - Section mismatch: reference to .exit.text:tpm_inf_pnp_remove from .data between 'tpm_inf_pnp' (at offset 0x20) and 'tpm_inf' Signed-off-by: Randy Dunlap Cc: Kylene Jo Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 8b006db604527c566dc1dd0aebae37714143aaef Author: Kylene Jo Hall Date: Sat Apr 22 02:39:07 2006 -0700 [PATCH] tpm: update bios log code for 1.2 The acpi table which contains the BIOS log events was updated for 1.2. There are now client and server modes as defined in the specifications with slightly different formats. Additionally, the start field was even too small for the 1.1 version but had been working anyway. This patch updates the code to deal with any of the three types of headers probperly (1.1, 1.2 client and 1.2 server). Signed-off-by: Kylie Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit b09d53009db21228adde29b468eb4583e66cbe7c Author: Kylene Jo Hall Date: Sat Apr 22 02:38:55 2006 -0700 [PATCH] tpm: check mem start and len The memory start and length values obtained from the ACPI entry need to be checked and filled in with the default values from the specification if they don't exist. This patch fills in the default values and uses them appropriately. Signed-off-by: Kylie Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit e496f540540f0a0bffcc3f83785f9954dacf1b83 Author: Marcel Selhorst Date: Sat Apr 22 02:38:42 2006 -0700 [PATCH] tpm: tpm_infineon updated to latest interface changes Apply the latest changes in the TPM interface to the Infineon TPM-driver. Signed-off-by: Marcel Selhorst Acked-by: Kylie Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 10685a95301d02fde2b10f6047e405c69d2af82a Author: Kylene Jo Hall Date: Sat Apr 22 02:38:32 2006 -0700 [PATCH] tpm: use clear_bit Use set_bit() and clear_bit() for dev_mask manipulation. Signed-off-by: Kylie Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 36b20020e537036c4f9eb5b69140c88ead5da7dc Author: Kylene Jo Hall Date: Sat Apr 22 02:38:19 2006 -0700 [PATCH] tpm: msecs_to_jiffies cleanups The timeout and duration values used in the tpm driver are not exposed to userspace. This patch converts the storage units to jiffies with msecs_to_jiffies. They were always being used in jiffies so this simplifies things removing the need for calculation all over the place. The change necessitated a type change in the tpm_chip struct to hold jiffies. Signed-off-by: Kylie Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 27084efee0c3dc0eb15b5ed750aa9f1adb3983c3 Author: Leendert van Doorn Date: Sat Apr 22 02:38:03 2006 -0700 [PATCH] tpm: driver for next generation TPM chips The driver for the next generation of TPM chips version 1.2 including support for interrupts. The Trusted Computing Group has written the TPM Interface Specification (TIS) which defines a common interface for all manufacturer's 1.2 TPM's thus the name tpm_tis. Signed-off-by: Leendert van Doorn Signed-off-by: Kylene Hall Cc: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 08e96e486dd1345ae0ad70247387d0d4fd346889 Author: Kylene Jo Hall Date: Sat Apr 22 02:37:50 2006 -0700 [PATCH] tpm: new 1.2 sysfs files Many of the sysfs files were calling the TPM_GetCapability command with array. Since for 1.2 more sysfs files of this type are coming I am generalizing the array so there can be one array and the unique parts can be filled in just before the command is called. This updated version of the patch breaks the multi-value sysfs file into separate files pointed out by Greg. It also addresses the code redundancy and ugliness in the tpm_show_* functions pointed out on another patch by Dave Hansen. Signed-off-by: Kylene Hall Cc: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 9e18ee19179a7742999d0e2d4bfcba75b5562439 Author: Kylene Jo Hall Date: Sat Apr 22 02:37:38 2006 -0700 [PATCH] tpm: command duration update With the TPM 1.2 Specification, each command is classified as short, medium or long and the chip tells you the maximum amount of time for a response to each class of command. This patch provides and array of the classifications and a function to determine how long the response should be waited for. Also, it uses that information in the command processing to determine how long to poll for. The function is exported so the 1.2 driver can use the functionality to determine how long to wait for a DataAvailable interrupt if interrupts are being used. Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit e0dd03caf20d040a0a86b6bd74028ec9bda545f5 Author: Kylene Jo Hall Date: Sat Apr 22 02:37:26 2006 -0700 [PATCH] tpm: return chip from tpm_register_hardware Changes in the 1.2 TPM Specification make it necessary to update some fields of the chip structure in the initialization function after it is registered with tpm.c thus tpm_register_hardware was modified to return a pointer to the structure. This patch makes that change and the associated changes in tpm_atmel and tpm_nsc. The changes to tpm_infineon will be coming in a patch from Marcel Selhorst. Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 90dda520c1962d55a0e1d2571deed0d75fd6d6f1 Author: Kylene Jo Hall Date: Sat Apr 22 02:37:15 2006 -0700 [PATCH] tpm: chip struct update To assist with chip management and better support the possibility of having multiple TPMs in the system of the same kind, the struct tpm_vendor_specific member of the tpm_chip was changed from a pointer to an instance. This patch changes that declaration and fixes up all accesses to the structure member except in tpm_infineon which is coming in a patch from Marcel Selhorst. Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit beed53a1aaeaae4eb93297c23f1598a726716adf Author: Kylene Jo Hall Date: Sat Apr 22 02:37:05 2006 -0700 [PATCH] tpm: reorganize sysfs files Many of the sysfs files were calling the TPM_GetCapability command with array. Since for 1.2 more sysfs files of this type are coming I am generalizing the array so there can be one array and the unique parts can be filled in just before the command is called. Signed-off-by: Kylene Hall Cc: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 3c2f606a098b07f053904ec8b8f4d0e101c28b35 Author: Kylene Jo Hall Date: Sat Apr 22 02:36:56 2006 -0700 [PATCH] tpm: spacing cleanups The following patch set contains numerous changes to the base tpm driver (tpm.c) to support the next generation of TPM chips. The changes include new sysfs files because of more relevant data being available, a function to access the timeout and duration values for the chip, and changes to make use of those duration values. Duration in the TPM specification is defined as the maximum amount of time the chip could take to return the results. Commands are in one of three categories short, medium and long. Also included are cleanups of how the commands for the sysfs files are composed to reduce a bunch of redundant arrays. This patch: Fix minor spacing issues. Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 7c69a47f1badf40dfa2febac71df98d32b1b56d7 Author: Kylene Jo Hall Date: Sat Apr 22 02:36:46 2006 -0700 [PATCH] tpm: fix missing string A string corresponding to the tcpa_pc_event_id POST_CONTENTS was missing causing an overflow bug when access was attempted in the get_event_name function. This bug was found by Coverity. Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 59e89f3a091d5cf93f4b176aedcfded61ece5252 Author: Kylene Jo Hall Date: Sat Apr 22 02:36:35 2006 -0700 [PATCH] tpm: fix memory leak The eventname was kmalloc'd and not freed in the *_show functions. This bug was found by Coverity. Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit b9251b823b5e921c894eb135cb6c64abf483f50e Author: Jan Kara Date: Sat Apr 22 02:36:24 2006 -0700 [PATCH] Fix reiserfs deadlock reiserfs_cache_default_acl() should return whether we successfully found the acl or not. We have to return correct value even if reiserfs_get_acl() returns error code and not just 0. Otherwise callers such as reiserfs_mkdir() can unnecessarily lock the xattrs and later functions such as reiserfs_new_inode() fail to notice that we have already taken the lock and try to take it again with obvious consequences. Signed-off-by: Jan Kara Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 8c4335a87c9785d2102ab23f09393038e1663314 Author: akpm@osdl.org Date: Sat Apr 22 02:36:15 2006 -0700 [PATCH] Altix snsc: duplicate kobject fix from: Greg Howard Fix Altix system controller (snsc) device names to include the slot number of the blade whose associated system controller is the target of the device interface. Including the slot number avoids a problem we're currently having where slots within the same enclosure are attempting to create multiple kobjects with identical names. Signed-off-by: Greg Howard Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 5b20192727ef2c047343a043ee4fbda67e2beef4 Author: Mike Waychison Date: Sat Apr 22 02:36:06 2006 -0700 [PATCH] x86_64: Fix a race in the free_iommu path We do this by removing a micro-optimization that tries to avoid grabbing the iommu_bitmap_lock spinlock and using a bus-locked operation. This still races with other simultaneous alloc_iommu or free_iommu(size > 1) which both use bus-unlocked operations. The end result of this race is eventually ending up with an iommu_gart_bitmap that has bits errornously set all over, making large contiguous iommu space allocations fail with 'PCI-DMA: Out of IOMMU space'. Signed-off-by: Mike Waychison Signed-off-by: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit ddbe3eec596fc2c6a513717168217bd19c901880 Author: Andi Kleen Date: Sat Apr 22 02:35:57 2006 -0700 [PATCH] x86_64: Pass -32 to the assembler when compiling the 32bit vsyscall pages This quietens warnings and actually fixes a bug. The unwind tables would come out wrong without -32, causing pthread cancellation during them to crash in the gcc runtime. The problem seems to only happen with newer binutils (it doesn't happen with 2.16.91.0.2 but happens wit 2.16.91.0.5) Thanks to David Altobelli and Brian Baker for test case and initial analysis. Signed-off-by: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 304dbdb7a4fbb7f40a6ad5c5836fdd456c233c63 Author: Lee Schermerhorn Date: Sat Apr 22 02:35:48 2006 -0700 [PATCH] add migratepage address space op to shmem Basic problem: pages of a shared memory segment can only be migrated once. In 2.6.16 through 2.6.17-rc1, shared memory mappings do not have a migratepage address space op. Therefore, migrate_pages() falls back to default processing. In this path, it will try to pageout() dirty pages. Once a shared memory page has been migrated it becomes dirty, so migrate_pages() will try to page it out. However, because the page count is 3 [cache + current + pte], pageout() will return PAGE_KEEP because is_page_cache_freeable() returns false. This will abort all subsequent migrations. This patch adds a migratepage address space op to shared memory segments to avoid taking the default path. We use the "migrate_page()" function because it knows how to migrate dirty pages. This allows shared memory segment pages to migrate, subject to other conditions such as # pte's referencing the page [page_mapcount(page)], when requested. I think this is safe. If we're migrating a shared memory page, then we found the page via a page table, so it must be in memory. Can be verified with memtoy and the shmem-mbind-test script, both available at: http://free.linux.hp.com/~lts/Tools/ Signed-off-by: Lee Schermerhorn Acked-by: Christoph Lameter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 3b5fd59fdd2e656dd4d10f2cedb41a7519b131b2 Author: Andy Whitcroft Date: Sat Apr 22 02:35:41 2006 -0700 [PATCH] x86_64: sparsemem does not need node_mem_map Seems we are trying to init the node_mem_map when we don't need to, for example when SPARSEMEM is enabled. This causes the error below during compilation. Use CONFIG_FLAT_NODE_MEM_MAP to gate allocation and init. arch/x86_64/mm/numa.c: In function `setup_node_zones': arch/x86_64/mm/numa.c:191: error: structure has no member named `node_mem_map' Signed-off-by: Andy Whitcroft Acked-by: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 73a88814542d3f5b8973f3db9d7f380bd29957c4 Author: Tilman Schmidt Date: Sat Apr 22 02:35:30 2006 -0700 [PATCH] isdn4linux: Siemens Gigaset base driver: fix disconnect handling Fix a possible Oops in the Siemens Gigaset base driver when the device is unplugged while an ISDN connection is still active, and makes sure that the isdn4linux link level (LL) is properly informed if a connection is broken by the USB cable being unplugged. - Avoid unsafe checks of URB status fields outside the URB completion handlers, keep track of in-use URBs myself instead. - If an isochronous transfer URB completes with status==0, also check the status of the frame descriptors. - Verify length of interrupt messages received from the device. - Align the length limit on transmitted AT commands with the device documentation. - In case of AT response receive overrun, keep newly arrived instead of old unread data. - Remove redundant check of device ID in the USB probe function. - Correct and improve some comments and formatting. Signed-off-by: Tilman Schmidt Acked-by: Hansjoerg Lipp Cc: Karsten Keil Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 60808233f374aebba26488d06a5f25443f6763c3 Author: Steve French Date: Sat Apr 22 15:53:05 2006 +0000 [CIFS] Readdir fixes to allow search to start at arbitrary position in directory Also includes first part of fix to compensate for servers which forget to return . and .. as well as updates to changelog and cifs readme. Signed-off-by: Steve French commit 45af7a0f2ebad1304cab956e15f0b37318226fcd Author: Steve French Date: Fri Apr 21 22:52:25 2006 +0000 [CIFS] Use the kthread_ API instead of opencoding lots of hairy code for kernel thread creation and teardown. It does not move the cifsd thread handling to kthread due to problems found in testing with wakeup of threads blocked in the socket peek api, but the other cifs kernel threads now use kthread. Also cleanup cifs_init to properly unwind when thread creation fails. Signed-off-by: Christoph Hellwig Signed-off-by: Steve French commit 48b950ff241fca03a6969a5eb6a42a02722678d4 Author: Daniel Ritz Date: Fri Apr 14 17:42:13 2006 +0200 [PATCH] pcmcia/pcmcia_resource.c: fix crash when using Cardbus cards Using the old ioctl interface together with cardbus card gives a NULL pointer dereference since cardbus devices don't have a struct pcmcia_device. also s->io[0].res can be NULL as well. Fix is to move the pcmcia code after the cardbus code and to check for a null pointer. Signed-off-by: Daniel Ritz Signed-off-by: Dominik Brodowski commit daaeb72bdf22873e6fa6497550c9e1d9a8825fea Author: Yoichi Yuasa Date: Thu Apr 6 15:08:29 2006 +0900 [PATCH] vrc4171: update config This patch updates "depends on" for PCMCIA_VRC4171. CONFIG_VRC4171 has been removed, so replace it with CPU_VR41XX && ISA. Signed-off-by: Yoichi Yuasa Signed-off-by: Dominik Brodowski commit 2aff541c691b28cecb95ce710c367d16c0a84d8c Author: Dominik Brodowski Date: Thu Apr 13 19:06:49 2006 +0200 [PATCH] pcmcia: fix oops in static mapping case As static maps do not have IO resources, this setting oopses. However, as we do not ever read this value, we can safely remove it. Signed-off-by: Dominik Brodowski commit 80a55e923c76e022de298929e0c09bcca5c247d9 Author: Andrew Morton Date: Mon Apr 10 23:24:57 2006 -0700 [PATCH] pcmcia: remove unneeded forward declarations Also remove a couple of unneeded typecasts. Signed-off-by: Andrew Morton Signed-off-by: Dominik Brodowski commit a0aab14322a74ab5665704c6155bf48fbc38f445 Author: Dominik Brodowski Date: Tue Apr 4 11:09:26 2006 +0200 [PATCH] pcmcia: do not set dev_node to NULL too early If we set dev_node to NULL too early, some drivers which used this to determine whether unregister_netdev() needs to be called fail when removing a PCMCIA card. Signed-off-by: Dominik Brodowski commit 90ff87008df12da7f2486178d0dee13745c1de6b Author: Komuro Date: Sun Mar 12 11:32:07 2006 +0900 [PATCH] pcmcia: fix comment for pcmcia_load_firmware The comment of "pcmcia_load_firmware" is wrong: the firmware(*.cis) files reside in /lib/firmware/ _not_ /lib/firmware/cis/ . Signed-off-by: komurojun-mbn@nifty.com Signed-off-by: Dominik Brodowski commit 6171b88b436ceb91d602ca570e63a0dcdd56648e Author: Komuro Date: Sun Apr 2 17:39:27 2006 +0900 [PATCH] pcmcia: unload second device first Use list_add instead of list_add_tail for pcmcia_device_add so that second device of multi-function-card will be unloaded first. Signed-off-by: komurojun-mbn@nifty.com Signed-off-by: Dominik Brodowski commit 6542729809baa3674b16a76a68346f449266c6dd Author: Dominik Brodowski Date: Tue Apr 4 10:17:52 2006 +0200 [PATCH] pcmcia: add new ID to pcnet_cs This adds a new ID to pcnet_cs, as noted by Kuro Moji. Signed-off-by: Dominik Brodowski commit 223232de068593b40d267e340f24c017d31c018a Author: Kyle McMartin Date: Fri Apr 21 16:54:23 2006 -0400 [PARISC] MAINTAINERS Add myself to maintainers and add the parisc trees. Acked-by: Matthew Wilcox Signed-off-by: Kyle McMartin commit 1b52d7c2210b9a64c5cba6aded478c8217a8853c Author: Kyle McMartin Date: Thu Apr 20 21:16:32 2006 +0000 [PARISC] Make ioremap default to _nocache Since it is way more work to change most drivers to comply with parisc, take the easy way out and make ioremap _NO_CACHE by default. This is in line with what powerpc does. Signed-off-by: Kyle McMartin commit 6ca773cf8b9dc19989c9b44635292b1ba80f9112 Author: Kyle McMartin Date: Thu Apr 20 04:44:07 2006 +0000 [PARISC] Add new entries to the syscall table Most are easy, but sync_file_range needed special handling when entering through the 32-bit syscall table. Signed-off-by: Kyle McMartin commit 2fd83038160531245099c3c5b3511fa4b80765eb Author: Helge Deller Date: Thu Apr 20 20:40:23 2006 +0000 [PARISC] Further work for multiple page sizes More work towards supporing multiple page sizes on 64-bit. Convert some assumptions that 64bit uses 3 level page tables into testing PT_NLEVELS. Also some BUG() to BUG_ON() conversions and some cleanups to assembler. Signed-off-by: Helge Deller Signed-off-by: Kyle McMartin commit d668da80d613def981c573354e1853e38bd0698d Author: Matthew Wilcox Date: Mon Apr 3 13:44:17 2006 +0000 [PARISC] Fix up hil_kbd.c mismerge Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin commit 8ea6947b4b9d918784fa6a1f93ca2882d94b71b6 Author: Helge Deller Date: Sun Apr 2 13:28:00 2006 +0000 [PARISC] defconfig updates Make the defconfig more generally useful. Turn on IPv6, modules, cardbus, etc. Boots 32bit on 715 with HIL, B160L with sound, PrecisionBook, and C3000. Signed-off-by: Helge Deller Signed-off-by: Kyle McMartin commit b312c33e362696d873931d8f84a89b3e894077c8 Author: Grant Grundler Date: Thu Mar 30 07:13:21 2006 +0000 [PARISC] Document that we tolerate "Relaxed Ordering" This means "DMA Read returns" can bypass "MMIO Writes". Violating the PCI specs in this case improves outbound DMA "flows" and is currently not required by any drivers. This is NOT a new behavior. Previous chipsets did this already and I believe ZX1 PDC was already setting this for hpux. I just want to further document the behavior. Signed-off-by: Grant Grundler Signed-off-by: Kyle McMartin commit 67a5a59d3301949f51f2d617d689f005c6d21470 Author: Helge Deller Date: Mon Mar 27 19:52:14 2006 +0000 [PARISC] Misc. janitorial work Fix a spelling mistake, add a KERN_INFO flag, and fix some whitespace uglies. Signed-off-by: Helge Deller Signed-off-by: Kyle McMartin commit b2d6b9fb35bf670df8049f0b3d4d306bf2d454da Author: Helge Deller Date: Mon Mar 27 19:52:14 2006 +0000 [PARISC] EISA regions must be mapped NO_CACHE Signed-off-by: Helge Deller Signed-off-by: Kyle McMartin commit e74eb808ba64610d4983ddd8b5b9a159d178aa8e Author: Stuart Brady Date: Tue Mar 1 23:00:56 2005 +0000 [PARISC] OSS ad1889: Match register names with ALSA driver Signed-off-by: Stuart Brady Signed-off-by: Kyle McMartin commit 296034f7de8bdf111984ce1630ac598a9c94a253 Author: Steve French Date: Fri Apr 21 18:18:37 2006 +0000 [CIFS] Don't allow a backslash in a path component Unless Posix paths have been negotiated, the backslash, "\", is not a valid character in a path component. Signed-off-by: Dave Kleikamp Signed-off-by: Steve French commit 0bd4fa977f81c914eb8bada00284d0933825900e Author: Steve French Date: Fri Apr 21 18:17:42 2006 +0000 [CIFS] [CIFS] Do not take rename sem on most path based calls (during building of full path) to avoid hang rename/readdir hang Reported by Alan Tyson Signed-off-by: Steve French commit 4d6c58899c1cdac018f92cfa0383bb835a0c80ef Author: Benjamin Herrenschmidt Date: Fri Apr 21 15:04:22 2006 +1000 [PATCH] powerpc: fix oops in alsa powermac driver This fixes an oops in 2.6.16.X when loading the snd_powermac module. The name of the requested module changed during the 2.6.16 development cycle from i2c-keylargo to i2c-powermac. Signed-off-by: Guido Guenther Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Greg Kroah-Hartman Signed-off-by: Paul Mackerras commit 5ad1bfeaf7a526ea5c5503c8a48e3a5a3efe18f7 Author: Will Schmidt Date: Wed Apr 19 16:26:22 2006 -0500 [PATCH] powerpc: update {g5,iseries,pseries}_defconfigs Default choices for all. Signed-off-by: Will Schmidt Signed-off-by: Paul Mackerras commit ea1e847cc202e805769c3c46ba5e5c53714068a1 Author: Becky Bruce Date: Tue Apr 18 14:29:34 2006 -0500 [PATCH] ppc: Fix powersave code on arch/ppc Fix asm_offsets.c and entry.S to work with the new power save code. Changes in arch/powerpc needed to exist in arch/ppc as well since the idle code is shared by both ppc and powerpc.. Signed-off-by: Becky Bruce Signed-off-by: Paul Mackerras commit 23b2527d5eae89841eb66b46e80ec91980493dda Author: Arnd Bergmann Date: Tue Apr 18 15:24:16 2006 +0200 [PATCH] powerpc/cell: remove BUILD_BUG_ON and add sys_tee to spu_syscall_table Every time a new syscall gets added, a BUILD_BUG_ON in arch/powerpc/platforms/cell/spu_callbacks.c gets triggered. Since the addition of a new syscall is rather harmless, the error should just be removed. While we're here, add sys_tee to the list and add a comment to systbl.S to remind people that there is another list on powerpc. Signed-off-by: Arnd Bergmann Signed-off-by: Paul Mackerras commit 60162e498e220d1f03bbee5bac0a9ddd6de60ae7 Author: Benjamin Herrenschmidt Date: Tue Apr 18 14:11:53 2006 +1000 [PATCH] powermac: Fix i2c on keywest based chips The new i2c implementation for PowerMac has a regression that causes the hardware to go out of state when probing non-existent devices. While fixing that, I also found & fixed a couple of other corner cases. This fixes booting with a pbbuttons version that scans the i2c bus for an LMU controller among others. Tested on a dual G5 with thermal control (which has heavy i2c activity) with no problem so far. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras commit 28897731318dc8f63f683eed9091e446916ad706 Author: Olof Johansson Date: Wed Apr 12 21:52:33 2006 -0500 [PATCH] powerpc: Lower threshold for DART enablement to 1GB Turn on the DART already at 1GB. This is needed because of crippled devices in some systems, i.e. Airport Extreme cards, only supporting 30-bit DMA addresses. Otherwise, users with between 1 and 2GB of memory will need to manually enable it with iommu=force, and that's no good. Some simple performance tests show that there's a slight impact of enabling DART, but it's in the 1-3% range (kernel build with disk I/O as well as over NFS). iommu=off can still be used for those who don't want to deal with the overhead (and don't need it for any devices). Signed-off-by: Olof Johansson Signed-off-by: Paul Mackerras commit 7daa411b810d7eadfaabe3765ec5f827893dbb30 Author: Olof Johansson Date: Wed Apr 12 21:05:59 2006 -0500 [PATCH] powerpc: IOMMU support for honoring dma_mask Some devices don't support full 32-bit DMA address space, which we currently assume. Add the required mask-passing to the IOMMU allocators. Signed-off-by: Olof Johansson Signed-off-by: Paul Mackerras commit fef6108d4556917c45cd9ba397c1c7597f3990e1 Author: Andy Fleming Date: Thu Apr 20 16:44:29 2006 -0500 [PATCH] Fix locking in gianfar This patch fixes several bugs in the gianfar driver, including a major one where spinlocks were horribly broken: * Split gianfar locks into two types: TX and RX * Made it so gfar_start() now clears RHALT * Fixed a bug where calling gfar_start_xmit() with interrupts off would corrupt the interrupt state * Fixed a bug where a frame could potentially arrive, and never be handled (if no more frames arrived * Fixed a bug where the rx_work_limit would never be observed by the rx completion code * Fixed a bug where the interrupt handlers were not actually protected by their spinlocks Signed-off-by: Andy Fleming Signed-off-by: Jeff Garzik commit 17c281ab3e33be63693687d3db7ac9cf2bbdfd66 Author: Sergei Shtylyov Date: Sun Apr 16 19:42:35 2006 +0400 [PATCH] NEx000: fix RTL8019AS base address for RBTX4938 Correct the base address of the Realtek RTL8019AS chip on the Toshiba RBTX4938 board -- this should make the driver work at least when CONFIG_PCI is enabled. Signed-off-by: Yuri Shpilevsky Signed-off-by: Sergei Shtylyov Signed-off-by: Jeff Garzik commit 036999d50180a9eaaa79dfb1d7a940824e475f24 Author: KAMEZAWA Hiroyuki Date: Thu Apr 20 21:48:02 2006 +0100 [ARM] for_each_possible_cpu for_each_cpu() actually iterates across all possible CPUs. We've had mistakes in the past where people were using for_each_cpu() where they should have been iterating across only online or present CPUs. This is inefficient and possibly buggy. We're renaming for_each_cpu() to for_each_possible_cpu() to avoid this in the future. This patch replaces for_each_cpu with for_each_possible_cpu. Signed-off-by: KAMEZAWA Hiroyuki Signed-off-by: Andrew Morton Signed-off-by: Russell King commit 1c97b73e89af9a20e99450c554cffdd9327e827a Author: Andrew Morton Date: Thu Apr 20 21:41:18 2006 +0100 [ARM] add_memory() build fix This is back again. Offending patch is x86_64-mm-hotadd-reserve.patch arch/arm/kernel/setup.c:435: error: conflicting types for 'add_memory' include/linux/memory_hotplug.h:102: error: previous declaration of 'add_memory' was here arch/arm/kernel/setup.c:435: error: conflicting types for 'add_memory' include/linux/memory_hotplug.h:102: error: previous declaration of 'add_memory' was here Signed-off-by: Andrew Morton Signed-off-by: Russell King commit 4b91ff4f425edb875c8e071d19a2417d23c578a4 Author: Lennert Buytenhek Date: Thu Apr 20 21:24:41 2006 +0100 [ARM] 3483/1: ixp23xx: update defconfig to 2.6.17-rc2 Patch from Lennert Buytenhek Signed-off-by: Lennert Buytenhek Signed-off-by: Russell King commit d2f9caa1be9cf3c18f0bfe70ca2f55d295942a9b Author: Lennert Buytenhek Date: Thu Apr 20 21:24:40 2006 +0100 [ARM] 3482/1: ixp2000: update defconfig to 2.6.17-rc2 Patch from Lennert Buytenhek Signed-off-by: Lennert Buytenhek Signed-off-by: Russell King commit 67c6024cb4c04b4e9122a97e52cf903252020f9f Author: Lennert Buytenhek Date: Thu Apr 20 21:24:39 2006 +0100 [ARM] 3481/1: ep93xx: update defconfig to 2.6.17-rc2 Patch from Lennert Buytenhek Signed-off-by: Lennert Buytenhek Signed-off-by: Russell King commit 6cc1b6588686190325a960b5a598f4f952dbe23b Author: Lennert Buytenhek Date: Thu Apr 20 21:24:38 2006 +0100 [ARM] 3480/1: ixp4xx: fix irq2gpio array type Patch from Lennert Buytenhek The irq2gpio array was recently converted from an array of ints to an array of chars (by patch 3368/1.) However, this array contains elements that are -1, and on ARM, the char type is unsigned by default, so this patch broke the GPIO check in ixp4xx_set_irq_type. Change the 'char' to be a 'signed char' to fix this. Signed-off-by: Lennert Buytenhek Signed-off-by: Deepak Saxena Signed-off-by: Russell King commit 0b699e36b2d43c1b4288992683e5913d347b5b78 Author: Eric Dumazet Date: Thu Apr 20 02:36:48 2006 +0200 [PATCH] x86_64: bring back __read_mostly support to linux-2.6.17-rc2 It seems latest kernel has a wrong/missing __read_mostly implementation for x86_64 __read_mostly macro should be declared outside of #if CONFIG_X86_VSMP block Signed-off-by: Eric Dumazet Signed-off-by: Andi Kleen Signed-off-by: Linus Torvalds commit 18bd057b1408cd110ed23281533430cfc2d52091 Author: Andi Kleen Date: Thu Apr 20 02:36:45 2006 +0200 [PATCH] i386/x86-64: Fix x87 information leak between processes AMD K7/K8 CPUs only save/restore the FOP/FIP/FDP x87 registers in FXSAVE when an exception is pending. This means the value leak through context switches and allow processes to observe some x87 instruction state of other processes. This was actually documented by AMD, but nobody recognized it as being different from Intel before. The fix first adds an optimization: instead of unconditionally calling FNCLEX after each FXSAVE test if ES is pending and skip it when not needed. Then do a x87 load from a kernel variable to clear FOP/FIP/FDP. This means other processes always will only see a constant value defined by the kernel in their FP state. I took some pain to make sure to chose a variable that's already in L1 during context switch to make the overhead of this low. Also alternative() is used to patch away the new code on CPUs who don't need it. Patch for both i386/x86-64. The problem was discovered originally by Jan Beulich. Richard Brunner provided the basic code for the workarounds, with contribution from Jan. This is CVE-2006-1056 Cc: richard.brunner@amd.com Cc: jbeulich@novell.com Signed-off-by: Andi Kleen Signed-off-by: Linus Torvalds commit 5dc5cf7dd2723430b6df3d91c5b22af49e063622 Author: Ingo Molnar Date: Thu Apr 20 02:43:23 2006 -0700 [PATCH] md: locking fix - fix mddev_lock() usage bugs in md_attr_show() and md_attr_store(). [they did not anticipate the possibility of getting a signal] - remove mddev_lock_uninterruptible() [unused] Signed-off-by: Ingo Molnar Acked-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 72b38d436e4cd18185de11f4b48a6e62eb104644 Author: Adrian Bunk Date: Thu Apr 20 02:43:23 2006 -0700 [PATCH] memory_hotplug.h cleanup We don't have to #if guard prototypes. This also fixes a bug observed by Randy Dunlap due to a misspelled option in the #if. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 46539264df5b1fcdc2cad585b032a86661fe079d Author: Adrian Bunk Date: Thu Apr 20 02:43:22 2006 -0700 [PATCH] make the OSS SOUND_VIA82CXXX option available again There was a report of a regression in the ALSA driver for the same hardware. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit aafda4e0d0424180023e16f43785f9344ea35719 Author: Adrian Bunk Date: Thu Apr 20 02:43:21 2006 -0700 [PATCH] update OBSOLETE_OSS_DRIVER schedule and dependencies Update the schedule for the removal of drivers depending on OBSOLETE_OSS_DRIVER as follows: - adjust OBSOLETE_OSS_DRIVER dependencie - from the release of 2.6.16 till the release of 2.6.17: approx. two months for users to report problems with the ALSA drivers for the same hardware - after the release of 2.6.17 (and before 2.6.18): remove the subset of drivers marked at OBSOLETE_OSS_DRIVER without known regressions in the ALSA drivers for the same hardware Additionally, correct some OBSOLETE_OSS_DRIVER dependencies. A rationale of the changes is in http://lkml.org/lkml/2006/1/28/135 Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit bf104e641c5a6567cc00d4ae9d8510cef9f63b18 Author: Arnaud MAZIN Date: Thu Apr 20 02:43:20 2006 -0700 [PATCH] sonypi: correct detection of new ICH7-based laptops Add a test to detect the ICH7 based Core Duo SONY laptops (such as the SZ1) as type3 models. Signed-off-by: Arnaud MAZIN < arnaud.mazin@gmail.com> Acked-by: Stelian Pop Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 962f831f67301265dcd2cd96408d07d95d556aed Author: Jon Masters Date: Thu Apr 20 02:43:20 2006 -0700 [PATCH] sound: fix hang in mpu401_uart.c This fixes a hang in mpu401_uart.c that can occur when the mpu401 interface is non-existent or otherwise doesn't respond to commands but we issue IO anyway. snd_mpu401_uart_cmd now returns an error code that is passed up the stack so that an open() will fail immediately in such cases. Eventually discovered after wine/cxoffice would constantly cause hard lockups on my desktop immediately after loading (emulating Windows too well). Turned out that I'd recently moved my sound cards around and using /dev/sequencer now talks to a sound card with a broken MPU. This second version changes -EFAULT to -EIO and frees open resources on error too. Test booted and seems to work ok. Signed-off-by: Jon Masters Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit c79cfbaccac0ef81ab3e796da1582a83dcef0ff9 Author: Jean Delvare Date: Thu Apr 20 02:43:18 2006 -0700 [PATCH] i2c-i801: Fix resume when PEC is used Fix for bug #6395: Fail to resume on Tecra M2 with ADM1032 and Intel 82801DBM The BIOS of the Tecra M2 doesn't like it when it has to reboot or resume after the i2c-i801 driver has left the SMBus in PEC mode. The most simple fix is to clear the PEC bit after after every transaction. That's what this driver was doing up to 2.6.15 (inclusive). Thanks to Daniele Gaffuri for the very good report. Signed-off-by: Jean Delvare Cc: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 7daa0c4f51897d5d956a62a2bac438e3b58d85dc Author: Johannes Goecke Date: Thu Apr 20 02:43:17 2006 -0700 [PATCH] MSI-K8T-Neo2-Fir OnboardSound and additional Soundcard On the MSI-K8T-NEO2 FIR ( Athlon-64, Socket 939 with VIA-K8T800- Chipset and onboard Sound,... ) the BIOS lets you choose "DISABLED" or "AUTO" for the On-Board Sound Device. If you add another PCI-Sound-Card the BIOS disables the on-board device. So far I have a Quirk, that does set the correspondent BIT in the PCI-registers to enable the soundcard. But how to ensure that the code is executed ONLY on excactly this kind of boards (not any other with similar Chipset)? Cc: Jaroslav Kysela Acked-by: Takashi Iwai Cc: Lee Revell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 68876baf5e713ef711b6e19a279385e14c9921e3 Author: Chris Zankel Date: Thu Apr 20 02:43:15 2006 -0700 [PATCH] xtensa: Fix TIOCGICOUNT macro Remove the dependence on the async_icount structure in the TIOCGICOUNT macro for Xtensa. (Thanks Russell and Adrian for pointing this out) Signed-off-by: Chris Zankel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 0324680064fd89d6ad52e89a4ccf16dec3ea3caa Author: Thayumanavar Sachithanantham Date: Thu Apr 20 02:43:15 2006 -0700 [PATCH] cs5535_gpio.c: call cdev_del() during module_exit to unmap kobject references and other cleanups During module unloading, cdev_del() must be called to unmap cdev related kobject references and other cleanups(such as inode->i_cdev being set to NULL) which prevents the OOPS upon subsequent loading, usage and unloading of modules(as seen in the mail thread http://marc.theaimsgroup.com/?l=linux-kernel&m=114533640609018&w=2). Also, remove unneeded test of gpio_base. Signed-off-by: Thayumanavar Sachithanantham Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit c16c556e0e460a4e8c3f97ea0d50a1217f7fa449 Author: Darren Jenkins Date: Thu Apr 20 02:43:13 2006 -0700 [PATCH] fix section mismatch in pm2fb.o WARNING: drivers/video/pm2fb.o - Section mismatch: reference to .init.data: from .text after 'pm2fb_set_par' (at offset 0xd5d) WARNING: drivers/video/pm2fb.o - Section mismatch: reference to .init.data: from .text after 'pm2fb_set_par' (at offset 0xd82) They are caused because pm2fb_set_par() uses lowhsync and lowvsync which are marked __devinitdata. Signed-off-by: Darren Jenkins Signed-off-by: Adrian Bunk Cc: "Antonino A. Daplas" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 6d472be37896b1c41b50f3da124f8b7718ba7797 Author: Christoph Lameter Date: Thu Apr 20 02:43:12 2006 -0700 [PATCH] Remove cond_resched in gather_stats() gather_stats() is called with a spinlock held from check_pte_range. We cannot reschedule with a lock held. Signed-off-by: Christoph Lameter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 4409ebe9afabe7db77eaaae9eb3eb05b8315ce4a Author: Corey Minyard Date: Thu Apr 20 02:43:12 2006 -0700 [PATCH] IPMI maintainer Add myself as the IPMI maintainer. Signed-off-by: Corey Minyard Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 7522a8423bed9931cbac5502b9c0657bde2700ea Author: Ananth N Mavinakayanahalli Date: Thu Apr 20 02:43:11 2006 -0700 [PATCH] kprobes: NULL out non-relevant fields in struct kretprobe In cases where a struct kretprobe's *_handler fields are non-NULL, it is possible to cause a system crash, due to the possibility of calls ending up in zombie functions. Documentation clearly states that unused *_handlers should be set to NULL, but kprobe users sometimes fail to do so. Fix it by setting the non-relevant fields of the struct kretprobe to NULL. Signed-off-by: Ananth N Mavinakayanahalli Acked-by: Jim Keniston Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 4f73247f0e53be1bd4aa519476e6261a8e4a64ab Author: Adrian Bunk Date: Thu Apr 20 15:45:22 2006 +0200 [PATCH] block/elevator.c: remove unused exports This patch removes the following unused EXPORT_SYMBOL's: - elv_requeue_request - elv_completed_request They are only used by the block core, hence they need not be exported. Signed-off-by: Adrian Bunk Signed-off-by: Jens Axboe commit 82aa5d6183667aa2a5f3c61e390934b0273d2ad7 Author: Jens Axboe Date: Thu Apr 20 13:05:48 2006 +0200 [PATCH] splice: fix smaller sized splice reads Signed-off-by: Jens Axboe commit a0aa7f68afeeb92f6274b395177c20e617c8ed2d Author: Jens Axboe Date: Thu Apr 20 13:05:33 2006 +0200 [PATCH] Don't inherit ->splice_pipe across forks It's really task private, so clear that field on fork after copying task structure. Signed-off-by: Jens Axboe commit 7daac4902053045450fa29db42aba19a4581f850 Author: Coywolf Qi Hunt Date: Wed Apr 19 10:14:49 2006 +0200 [patch] cleanup: use blk_queue_stopped This cleanup the source to use blk_queue_stopped. Signed-off-by: Coywolf Qi Hunt Signed-off-by: Jens Axboe commit 73af994c7d58dd513922dc9d5cd76b124ec02b1b Author: Valdis Kletnieks Date: Wed Apr 19 09:23:09 2006 +0200 [PATCH] Document online io scheduler switching We added the ability to change a block device's IO elevator scheduler both at kernel boot and on-the-fly, but we only documented the elevator= boot parameter. Add a quick how-to on doing it on the fly. Signed-off-by: Valdis Kletnieks Signed-off-by: Andrew Morton Signed-off-by: Jens Axboe commit 18bc89aa25fbfcf467f4ce67f76c7b9893404cac Author: Jayachandran C Date: Thu Apr 20 00:14:49 2006 -0700 [EBTABLES]: Clean up vmalloc usage in net/bridge/netfilter/ebtables.c Make all the vmalloc calls in net/bridge/netfilter/ebtables.c follow the standard convention. Remove unnecessary casts, and use '*object' instead of 'type'. Signed-off-by: Jayachandran C. Signed-off-by: Andrew Morton Signed-off-by: David S. Miller commit dc6de33674608f978ec29f5c2f7e3af458c06f78 Author: David S. Miller Date: Thu Apr 20 00:10:50 2006 -0700 [NET]: Add skb->truesize assertion checking. Add some sanity checking. truesize should be at least sizeof(struct sk_buff) plus the current packet length. If not, then truesize is seriously mangled and deserves a kernel log message. Currently we'll do the check for release of stream socket buffers. But we can add checks to more spots over time. Incorporating ideas from Herbert Xu. Signed-off-by: David S. Miller commit b60b49ea6a3e1f8dcaf4148dad0daab61ab766d2 Author: Herbert Xu Date: Wed Apr 19 21:35:00 2006 -0700 [TCP]: Account skb overhead in tcp_fragment Make sure that we get the full sizeof(struct sk_buff) plus the data size accounted for in skb->truesize. This will create invariants that will allow adding assertion checks on skb->truesize. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller commit 5a7b46b369419493bab4de67b1526e9f76b22a7f Author: OGAWA Hirofumi Date: Thu Apr 20 06:41:39 2006 +0900 [PATCH] Add more prevent_tail_call() Those also break userland regs like following. 00000000 : 0: 0f b7 44 24 0c movzwl 0xc(%esp),%eax 5: 83 ca ff or $0xffffffff,%edx 8: 0f b7 4c 24 08 movzwl 0x8(%esp),%ecx d: 66 83 f8 ff cmp $0xffffffff,%ax 11: 0f 44 c2 cmove %edx,%eax 14: 66 83 f9 ff cmp $0xffffffff,%cx 18: 0f 45 d1 cmovne %ecx,%edx 1b: 89 44 24 0c mov %eax,0xc(%esp) 1f: 89 54 24 08 mov %edx,0x8(%esp) 23: e9 fc ff ff ff jmp 24 where the tailcall at the end overwrites the incoming stack-frame. Signed-off-by: OGAWA Hirofumi [ I would _really_ like to have a way to tell gcc about calling conventions. The "prevent_tail_call()" macro is pretty ugly ] Signed-off-by: Linus Torvalds commit d47f3640fe2ac4da8a8e713a549e6eaf23ac2084 Author: Johannes Berg Date: Wed Apr 19 15:42:28 2006 -0700 [SUNGEM]: Marvell PHY suspend. In a short discussion with Benjamin Herrenschmidt he mentioned that Marvell PHYs are powered down the same way as the other ones we currently handle. Thus actually do that, hopefully saving some power during suspend. Signed-off-by: Johannes Berg Acked-by: Benjamin Herrenschmidt Signed-off-by: David S. Miller commit 5185db09f46ed64d520d09db6e93852e44106628 Author: David S. Miller Date: Wed Apr 19 15:37:13 2006 -0700 [LLC]: Use pskb_trim_rcsum() in llc_fixup_skb(). Kernel Bugzilla #6409 If we use plain skb_trim(), that's wrong, because if the SKB is cloned, and it can be because we unshared it in the caller, we have to allow reallocation. The pskb_trim*() family of routines is therefore the most appropriate here. Signed-off-by: David S. Miller commit 3672558c6180ca28a7aa46765702467a37e58fc5 Author: Hua Zhong Date: Wed Apr 19 15:25:02 2006 -0700 [NET]: sockfd_lookup_light() returns random error for -EBADFD This applies to 2.6.17-rc2. There is a missing initialization of err in sockfd_lookup_light() that could return random error for an invalid file handle. Signed-off-by: Hua Zhong Signed-off-by: David S. Miller commit 2784f40e2774b61d68d232bcf92a9484e99f22b8 Author: David S. Miller Date: Wed Apr 19 15:00:01 2006 -0700 [SPARC]: __NR_sys_splice --> __NR_splice Signed-off-by: David S. Miller commit 848ef8555296f25d9226d3bc43ce4028835ed633 Author: Jean Tourrilhes Date: Fri Apr 14 10:47:26 2006 -0700 [PATCH] wext: Fix RtNetlink ENCODE security permissions I've just realised that the RtNetlink code does not check the permission for SIOCGIWENCODE and SIOCGIWENCODEEXT, which means that any user can read the encryption keys. The fix is trivial and should go in 2.6.17 alonside the two other patch I sent you last week. Signed-off-by: Jean Tourrilhes Signed-off-by: John W. Linville commit a392149ee14d1631d8632060c1fc3082729f83c8 Author: Erik Mouw Date: Thu Apr 13 15:02:27 2006 +0200 [PATCH] bcm43xx: iw_priv_args names should be <16 characters The room for the names in bcm43xx_priv_wx_args[] are IFNAMSIZ long and IFNAMSIZ is defined as 16, so the names in bcm43xx_priv_wx_args should be 15 characters (16 including the trailing \0). This patch fixes that for the "set_shortpreambl", "get_shortpreambl", "set_swencryption", and "get_swencryption" private calls. Patch is against 2.6.17-rc1. Signed-off-by: Erik Mouw Signed-off-by: John W. Linville commit b35d649cb2110b4e782a8a7e9b625432c863cade Author: Michael Buesch Date: Thu Apr 13 02:32:58 2006 +0200 [PATCH] bcm43xx: sysfs code cleanup This cleans up the bcm43xx sysfs code and makes it compliant with the unwritten sysfs rules (at least I hope so). Signed-off-by: Michael Buesch Signed-off-by: John W. Linville commit 8829d55e6b4957770de3f716bafab65ca3680110 Author: Michael Buesch Date: Thu Apr 13 02:30:26 2006 +0200 [PATCH] bcm43xx: fix pctl slowclock limit calculation This fixes coverity bug: http://marc.theaimsgroup.com/?l=linux-netdev&m=114417628413880&w=2 Signed-off-by: Michael Buesch Signed-off-by: John W. Linville commit 2230daa0fd50bf82303fd8da96b088310851d803 Author: Adrian Bunk Date: Thu Apr 13 02:27:49 2006 +0200 [PATCH] bcm43xx: fix dyn tssi2dbm memleak This patch fixes a memory leak spotted by the Coverity checker. Signed-off-by: Adrian Bunk Signed-off-by: Michael Buesch Signed-off-by: John W. Linville commit 93fef7dda4002ac8b21a4a2090ca475dc40cc384 Author: Randy Dunlap Date: Tue Apr 11 14:32:53 2006 -0700 [PATCH] bcm43xx: fix config menu alignment Use "depends on" to make all bcm43xx driver options be listed at the same level. Signed-off-by: Randy Dunlap Signed-off-by: John W. Linville commit 4c6f749f74323518825476e3e5ca3b4f03c07873 Author: Randy Dunlap Date: Tue Apr 11 14:31:56 2006 -0700 [PATCH] bcm43xx wireless: fix printk format warnings Fix printk format warnings: drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c:456: warning: format ‘%u’ expects type ‘unsigned int’, but argument 3 has type ‘size_t’ drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c:460: warning: format ‘%08x’ expects type ‘unsigned int’, but argument 2 has type ‘size_t’ drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c:476: warning: format ‘%u’ expects type ‘unsigned int’, but argument 3 has type ‘size_t’ drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c:480: warning: format ‘%08x’ expects type ‘unsigned int’, but argument 2 has type ‘size_t’ drivers/net/wireless/bcm43xx/bcm43xx_dma.c:200: warning: format ‘%08x’ expects type ‘unsigned int’, but argument 2 has type ‘dma_addr_t’ drivers/net/wireless/bcm43xx/bcm43xx_dma.c:311: warning: format ‘%08x’ expects type ‘unsigned int’, but argument 2 has type ‘dma_addr_t’ drivers/net/wireless/bcm43xx/bcm43xx_dma.c:733: warning: format ‘%08x’ expects type ‘unsigned int’, but argument 2 has type ‘dma_addr_t’ Signed-off-by: Randy Dunlap Signed-off-by: John W. Linville commit 6788a07f8faeb373967cd97b79fb3abec8fccb90 Author: Johannes Berg Date: Thu Apr 13 11:41:28 2006 +0200 [PATCH] softmac: report when scanning has finished Make softmac report a scan event when scanning has finished, that way userspace can wait for the event to happen instead of polling for the results. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville commit feeeaa87e8e6702f57ed3be7904ffd87cc044b82 Author: Johannes Berg Date: Thu Apr 13 02:42:42 2006 +0200 [PATCH] softmac: fix event sending Softmac is sending custom events to userspace already, but it should _really_ be sending the right WEXT events instead. This patch fixes that. Signed-off-by: Dan Williams Signed-off-by: Johannes Berg Signed-off-by: John W. Linville commit 68970ce6ac5ed01b1d10047fd4daba5b40786694 Author: johannes@sipsolutions.net Date: Tue Apr 11 10:58:08 2006 +0200 [PATCH] softmac: handle iw_mode properly Below patch allows using iw_mode auto with softmac. bcm43xx forces managed so this bug wasn't noticed earlier, but this was one of the problems why zd1211 didn't work earlier. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville commit fc242746ea8d87b3032c7a1c9b8eb71c149488a8 Author: johannes@sipsolutions.net Date: Tue Apr 11 10:58:07 2006 +0200 [PATCH] softmac: dont send out packets while scanning Seems we forgot to stop the queue while scanning. Better do that so we don't transmit packets all the time during background scanning. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville commit ba2f8c18756b4a99c8cd3ab6526b2ed7a8f18ead Author: johannes@sipsolutions.net Date: Tue Apr 11 10:58:06 2006 +0200 [PATCH] softmac: return -EAGAIN from getscan while scanning Below patch was developed after discussion with Daniel Drake who mentioned to me that wireless tools expect an EAGAIN return from getscan so that they can wait for the scan to finish before printing out the results. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville commit b79367a5ea28afe2ac659593970c15c9513f1d49 Author: Michael Buesch Date: Mon Apr 10 02:39:54 2006 +0200 [PATCH] bcm43xx: set trans_start on TX to prevent bogus timeouts Signed-off-by: Michael Buesch Signed-off-by: John W. Linville commit a208c4e1ea7a769042be071ae30ba2ad4c844954 Author: Pavel Roskin Date: Fri Apr 7 04:10:26 2006 -0400 [PATCH] orinoco: fix truncating commsquality RID with the latest Symbol firmware Symbol firmware F3.91-71 has an additional word in the commsquality RID. Extend the receiving buffer by one word to accomodate it. Signed-off-by: Pavel Roskin Signed-off-by: John W. Linville commit 9b0b4d8ae82cadd059d01ab93babcaa5e2054b93 Author: Michael Buesch Date: Fri Apr 7 01:42:55 2006 +0200 [PATCH] softmac: fix spinlock recursion on reassoc This fixes a spinlock recursion on receiving a reassoc request. On reassoc, the softmac calls back into the driver. This results in a driver lock recursion. This schedules the assoc workqueue, instead of calling it directly. Probably, we should defer the _whole_ management frame processing to a tasklet or workqueue, because it does several callbacks into the driver. That is dangerous. This fix should go into linus's tree, before 2.6.17 is released, because it is remote exploitable (DoS by crash). Signed-off-by: John W. Linville commit c1783454a31e05b94774951b0b5d1eb9075ebfb4 Author: Jean Tourrilhes Date: Tue Apr 4 15:59:46 2006 -0700 [PATCH] Revert NET_RADIO Kconfig title change 2.6.17-rc1 changed the title for the entry CONFIG_NET_RADIO. I personally disagree with this change and want it reverted. Patch for 2.6.17-rc1. Rationale : WIRELESS_EXT is an invisible option. Therefore, the only way for a user to enable it is via NET_RADIO. Some users need to do that for out-of-tree drivers. Therefore it should be mentionned in the title of the option. Rationale2 : the option just below is called "Wireless Extension API over RtNetlink". Some users may confuse this option for the main "Wireless Extension" option. Therefore reverting this change help disambiguate the relation between those two options. Signed-off-by: Jean Tourrilhes Signed-off-by: John W. Linville commit a417016d1a07e6df0621dbb2926da82642eca823 Author: Jean Tourrilhes Date: Tue Apr 4 15:53:43 2006 -0700 [PATCH] wext: Fix IWENCODEEXT security permissions Check the permissions when user-space try to read the encryption parameters via SIOCGIWENCODEEXT. This is trivial and probably should go in 2.6.17... Bug was found by Brian Eaton , thanks ! Signed-off-by: Jean Tourrilhes Signed-off-by: John W. Linville commit 3a1af6ffe4941497071125d3a8bb3e1feee45df1 Author: Dan Williams Date: Fri Mar 31 15:13:31 2006 -0500 [PATCH] wireless/atmel: send WEXT scan completion events Send scan completion events to user space when a scan completes. Signed-off-by: Dan Williams Signed-off-by: John W. Linville commit 6fcdf565ffb8c661749372115d28efdbe525aeba Author: Dan Williams Date: Fri Mar 31 15:08:46 2006 -0500 [PATCH] wireless/airo: clean up WEXT association and scan events Airo firmware versions >= 5.30.17 send re-association events to the driver that are currently unrecognized, causing spurious disassociation events to be sent to user space. Loss of sync due to scan requests also results in disassociation events sent to user space. This patch traps those two events; suppressing sync-loss on scan, and sending the correct association event on re-association notifications. Signed-off-by: Dan Williams Signed-off-by: John W. Linville commit e4b5fae8b3fb4134deaa6f66c60255c831e2d7e8 Author: Randy Dunlap Date: Mon Mar 27 14:53:41 2006 -0800 [PATCH] softmac uses Wiress Ext. softmac uses wireless extensions, so let it SELECT that config option; WARNING: "wireless_send_event" [net/ieee80211/softmac/ieee80211softmac.ko] undefined! Signed-off-by: Randy Dunlap Signed-off-by: John W. Linville commit 415dcd95b25b59631656f559570d1a973bf691a9 Author: Adrian Bunk Date: Wed Apr 19 00:15:35 2006 +0200 IB/mthca: make a function static This patch makes the needlessly global mthca_update_rate() static. Signed-off-by: Adrian Bunk Signed-off-by: Roland Dreier commit 5494c22ba293a37534591d793f73e445a66196b5 Author: Roland Dreier Date: Wed Apr 19 11:40:12 2006 -0700 IB/ipath: Fix whitespace Signed-off-by: Roland Dreier commit ac2ae4c9770de9450a8e881082a54bbb6f09534e Author: Roland Dreier Date: Wed Apr 19 11:40:12 2006 -0700 IB/ipath: Make more names static Make symbols that are only used in a single source file static. Signed-off-by: Roland Dreier commit 64cb9c6aff273b1cd449e773c937378d68233f8b Author: Hal Rosenstock Date: Wed Apr 12 21:29:10 2006 -0400 IB/mad: Fix RMPP version check during agent registration Only check that RMPP version is not specified when MAD class does not support RMPP. Just because a class is allowed to use RMPP doesn't mean that rmpp_version needs to be set for the MAD agent to register. Checking this was a recent change which was too pedantic. Signed-off-by: Hal Rosenstock Signed-off-by: Roland Dreier commit f80887d0b9e1af481dc4a30fc145dfed24ddfd59 Author: Roland Dreier Date: Wed Apr 19 11:40:10 2006 -0700 IB/srp: Remove request from list when SCSI abort succeeds If a SCSI abort succeeds, then the aborted request should to be removed from the list of pending requests. This fixes list corruption after an abort occurs. Signed-off-by: Roland Dreier commit a5f9145bc9c340bda743ad51e09bdea60fa3ddfa Author: Eric Sesterhenn Date: Wed Apr 19 13:06:49 2006 -0400 SUNRPC: Dead code in net/sunrpc/auth_gss/auth_gss.c Hi, the coverity checker spotted that cred is always NULL when we jump to out_err ( there is just one case, when we fail to allocate the memory for cred ) This is Coverity ID #79 Signed-off-by: Eric Sesterhenn Signed-off-by: Trond Myklebust commit 7451c4f0ee53e36fd74168af8df75b28fd04a2aa Author: Carsten Otte Date: Wed Apr 19 13:06:37 2006 -0400 NFS: remove needless check in nfs_opendir() Local variable res was initialized to 0 - no check needed here. Signed-off-by: Carsten Otte Cc: Trond Myklebust Signed-off-by: Andrew Morton Signed-off-by: Trond Myklebust commit b9d9506d944865876e67281a4e4269d823ce5381 Author: John Hawkes Date: Wed Apr 19 13:06:20 2006 -0400 NFS: nfs_show_stats; for_each_possible_cpu(), not NR_CPUS Convert a for-loop that explicitly references "NR_CPUS" into the potentially more efficient for_each_possible_cpu() construct. Signed-off-by: John Hawkes Signed-off-by: Andrew Morton Signed-off-by: Trond Myklebust commit ec535ce154f2eaad3d97f2f20a76a6d8bdac33e5 Author: Adrian Bunk Date: Tue Apr 18 13:21:50 2006 -0400 NFS: make 2 functions static Signed-off-by: Adrian Bunk Cc: Trond Myklebust Signed-off-by: Andrew Morton Signed-off-by: Trond Myklebust commit e99170ff3b799a9fd43d538932a9231fac1de9d4 Author: Trond Myklebust Date: Tue Apr 18 13:21:42 2006 -0400 NFS,SUNRPC: Fix compiler warnings if CONFIG_PROC_FS & CONFIG_SYSCTL are unset Signed-off-by: Trond Myklebust commit 7866babad542bb5e1dc95deb5800b577abef58dd Author: Adrian Bunk Date: Tue Apr 18 13:14:13 2006 -0400 NFS: fix PROC_FS=n compile error fs/built-in.o: In function `nfs_show_stats':inode.c:(.text+0x15481a): undefined reference to `rpc_print_iostats' net/built-in.o: In function `rpc_destroy_client': undefined reference to `rpc_free_iostats' net/built-in.o: In function `rpc_clone_client': undefined reference to `rpc_alloc_iostats' net/built-in.o: In function `rpc_new_client': undefined reference to `rpc_alloc_iostats' net/built-in.o: In function `xprt_release': undefined reference to `rpc_count_iostats' make: *** [.tmp_vmlinux1] Error 1 Signed-off-by: Adrian Bunk Cc: Trond Myklebust Signed-off-by: Andrew Morton Signed-off-by: Trond Myklebust commit 95cf959b245832ad49bb333bf88f9805244b225d Author: Trond Myklebust Date: Tue Apr 18 13:14:06 2006 -0400 VFS: Fix another open intent Oops If the call to nfs_intent_set_file() fails to open a file in nfs4_proc_create(), we should return an error. Signed-off-by: Trond Myklebust commit d4a30e7e66c004da26dfe5229af7c10fe9853a7a Author: J. Bruce Fields Date: Tue Apr 18 13:14:02 2006 -0400 RPCSEC_GSS: fix leak in krb5 code caused by superfluous kmalloc I was sloppy when generating a previous patch; I modified the callers of krb5_make_checksum() to allocate memory for the buffer where the result is returned, then forgot to modify krb5_make_checksum to stop allocating that memory itself. The result is a per-packet memory leak. This fixes the problem by removing the now-superfluous kmalloc(). Signed-off-by: J. Bruce Fields Signed-off-by: Trond Myklebust commit 6a2a88668e90cd2459d0493e3e3ff17c3557febc Author: Antonino A. Daplas Date: Tue Apr 18 22:22:12 2006 -0700 [PATCH] fbdev: Fix return error of fb_write Fix return code of fb_write(): If at least 1 byte was transferred to the device, return number of bytes, otherwise: - return -EFBIG - if file offset is past the maximum allowable offset or size is greater than framebuffer length - return -ENOSPC - if size is greater than framebuffer length - offset Signed-off-by: Antonino Daplas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit a61bdaad6c696e850d8fa412f1f201cbca51ad30 Author: Randy Dunlap Date: Tue Apr 18 22:22:11 2006 -0700 [PATCH] savagefb: fix section mismatch warnings Fix modpost section mismatch warnings in savagefb driver: WARNING: drivers/video/savage/savagefb.o - Section mismatch: reference to .init.text: from .exit.text after 'savagefb_remove' (at offset 0x66) WARNING: drivers/video/savage/savagefb.o - Section mismatch: reference to .init.text: from .exit.text after 'savagefb_remove' (at offset 0x6e) WARNING: drivers/video/savage/savagefb.o - Section mismatch: reference to .init.text: from .text.savagefb_resume after 'savagefb_resume' (at offset 0x70) Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 246846fc18ba43c4f31d6e5b208fe6b045d9f7b1 Author: Randy Dunlap Date: Tue Apr 18 22:22:10 2006 -0700 [PATCH] radeonfb section mismatches Marking radeon_pci_register() as __devinit clears up all section mismatch warnings that are caused by radeon_pci_register() calling various __devinit function. Is there some reason not to do this? WARNING: drivers/video/aty/radeonfb.o - Section mismatch: reference to .init.text: from .text.radeonfb_pci_register after 'radeonfb_pci_register' (at offset 0x628) WARNING: drivers/video/aty/radeonfb.o - Section mismatch: reference to .init.text: from .text.radeonfb_pci_register after 'radeonfb_pci_register' (at offset 0x6b5) WARNING: drivers/video/aty/radeonfb.o - Section mismatch: reference to .init.text: from .text.radeonfb_pci_register after 'radeonfb_pci_register' (at offset 0x6bd) WARNING: drivers/video/aty/radeonfb.o - Section mismatch: reference to .init.text:radeon_probe_screens from .text.radeonfb_pci_register after 'radeonfb_pci_register' (at offset 0x7d6) WARNING: drivers/video/aty/radeonfb.o - Section mismatch: reference to .init.text:radeon_check_modes from .text.radeonfb_pci_register after 'radeonfb_pci_register' (at offset 0x7e5) Signed-off-by: Randy Dunlap Cc: "Antonino A. Daplas" Acked-by: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 3e42f0b19e94b3e84043088b5367dd0f3c487921 Author: Jean Delvare Date: Tue Apr 18 22:22:09 2006 -0700 [PATCH] fb: Fix section mismatch in savagefb Fix the following section mismatch: WARNING: drivers/video/savage/savagefb.o - Section mismatch: reference to .init.data: from .text.savagefb_probe after 'savagefb_probe' (at offset 0x5e2) Signed-off-by: Jean Delvare Cc: "Antonino A. Daplas" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 0d8a95efd878920e7f791d5bcfb9b70f107aadda Author: KAI.HSU Date: Tue Apr 18 22:22:08 2006 -0700 [PATCH] alim15x3: ULI M-1573 south Bridge support From http://bugzilla.kernel.org/show_bug.cgi?id=6358 The alim15x3.c havn't been update for 3 years. Recently when we use this "ULI M1573" south bridge chip found that can't mount CDROM(VCD) smoothly, must waiting for a long time. After I check the "ULI M1573" south bridge datasheet, I found the reason. The reason is the "ULI M1573" version in the Linux is "0xC7" not "0xC4" anymore So I was modified the source than it was successed. Cc: Bartlomiej Zolnierkiewicz Acked-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit d3a7b202995421631f486313aacf9ab2ad48b2c8 Author: Adrian Bunk Date: Tue Apr 18 22:22:07 2006 -0700 [PATCH] remove the obsolete IDEPCI_FLAG_FORCE_PDC Noted by Sergei Shtylylov Signed-off-by: Adrian Bunk Acked-by: Bartlomiej Zolnierkiewicz Cc: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 6e89280184e4990f5ea80d2504af89b6099523c4 Author: Anatoli Antonovitch Date: Tue Apr 18 22:22:05 2006 -0700 [PATCH] ide: ATI SB600 IDE support Add support for the IDE device on ATI SB600 Signed-off-by: Felix Kuehling Acked-by: Bartlomiej Zolnierkiewicz Cc: Alan Cox Acked-by: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 07fab8da808d0702778da50e5b435e6ba471c903 Author: Prasanna S Panchamukhi Date: Tue Apr 18 22:22:03 2006 -0700 [PATCH] Switch Kprobes inline functions to __kprobes for sparc64 Andrew Morton pointed out that compiler might not inline the functions marked for inline in kprobes. There-by allowing the insertion of probes on these kprobes routines, which might cause recursion. This patch removes all such inline and adds them to kprobes section there by disallowing probes on all such routines. Some of the routines can even still be inlined, since these routines gets executed after the kprobes had done necessay setup for reentrancy. Signed-off-by: Prasanna S Panchamukhi Acked-by: David S. Miller Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 3ca269d8b4d020af018e9e7e82b22f965a0e1bd9 Author: Prasanna S Panchamukhi Date: Tue Apr 18 22:22:02 2006 -0700 [PATCH] Switch Kprobes inline functions to __kprobes for ia64 Andrew Morton pointed out that compiler might not inline the functions marked for inline in kprobes. There-by allowing the insertion of probes on these kprobes routines, which might cause recursion. This patch removes all such inline and adds them to kprobes section there by disallowing probes on all such routines. Some of the routines can even still be inlined, since these routines gets executed after the kprobes had done necessay setup for reentrancy. Signed-off-by: Prasanna S Panchamukhi Cc: "Luck, Tony" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 46dbe2f4ef9954e3ed2155995b76e32f31fef6bb Author: Prasanna S Panchamukhi Date: Tue Apr 18 22:22:01 2006 -0700 [PATCH] Switch Kprobes inline functions to __kprobes for ppc64 Andrew Morton pointed out that compiler might not inline the functions marked for inline in kprobes. There-by allowing the insertion of probes on these kprobes routines, which might cause recursion. This patch removes all such inline and adds them to kprobes section there by disallowing probes on all such routines. Some of the routines can even still be inlined, since these routines gets executed after the kprobes had done necessay setup for reentrancy. Signed-off-by: Prasanna S Panchamukhi Cc: Paul Mackerras Cc: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 3b60211c1618063cb296439ebaef2041a725ba20 Author: Prasanna S Panchamukhi Date: Tue Apr 18 22:22:00 2006 -0700 [PATCH] Switch Kprobes inline functions to __kprobes for x86_64 Andrew Morton pointed out that compiler might not inline the functions marked for inline in kprobes. There-by allowing the insertion of probes on these kprobes routines, which might cause recursion. This patch removes all such inline and adds them to kprobes section there by disallowing probes on all such routines. Some of the routines can even still be inlined, since these routines gets executed after the kprobes had done necessay setup for reentrancy. Signed-off-by: Prasanna S Panchamukhi Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 34c37e18696ff6a773f0403348342a9fe49df4af Author: Prasanna S Panchamukhi Date: Tue Apr 18 22:21:59 2006 -0700 [PATCH] Switch Kprobes inline functions to __kprobes for i386 Andrew Morton pointed out that compiler might not inline the functions marked for inline in kprobes. There-by allowing the insertion of probes on these kprobes routines, which might cause recursion. This patch removes all such inline and adds them to kprobes section there by disallowing probes on all such routines. Some of the routines can even still be inlined, since these routines gets executed after the kprobes had done necessay setup for reentrancy. Signed-off-by: Prasanna S Panchamukhi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit c640be26f7f8b7a826529baa72fad76bd4f6f5a2 Author: Jan Engelhardt Date: Tue Apr 18 22:21:58 2006 -0700 [PATCH] pnp: fix two messages in manager.c The wording of two messages in drivers/pnp/manager.c is incorrect. Fix that. Signed-off-by: Jan Engelhardt Acked-by: Pavel Machek Signed-off-by: Rafael J. Wysocki Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 96766a3caae789cdfd7fc6a50bad4e0759d869b0 Author: Randy.Dunlap Date: Tue Apr 18 22:21:57 2006 -0700 [PATCH] parport_pc: fix section mismatch warnings (v2) From: Randy Dunlap Fix all modpost section mismatch warnings in parport_pc: WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.text: from .text.parport_pc_probe_port after 'parport_pc_probe_port' (at offset 0x230) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.text: from .text.parport_pc_probe_port after 'parport_pc_probe_port' (at offset 0x283) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.text: from .text.parport_pc_probe_port after 'parport_pc_probe_port' (at offset 0x3e6) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.text: from .text.parport_pc_probe_port after 'parport_pc_probe_port' (at offset 0x400) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.text: from .text.parport_pc_probe_port after 'parport_pc_probe_port' (at offset 0x463) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.text: from .text.parport_pc_probe_port after 'parport_pc_probe_port' (at offset 0x488) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.data:superios from .text.parport_pc_probe_port after 'parport_pc_probe_port' (at offset 0x54c) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.data: from .text.parport_pc_probe_port after 'parport_pc_probe_port' (at offset 0x56a) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.data: from .text.parport_pc_pci_probe after 'parport_pc_pci_probe' (at offset 0x67) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.data: from .text.parport_pc_pci_probe after 'parport_pc_pci_probe' (at offset 0x9f) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.data: from .text.parport_pc_pci_probe after 'parport_pc_pci_probe' (at offset 0xa7) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.data:cards from .text.parport_pc_pci_probe after 'parport_pc_pci_probe' (at offset 0x132) WARNING: drivers/parport/parport_pc.o - Section mismatch: reference to .init.data: from .text.parport_pc_pci_probe after 'parport_pc_pci_probe' (at offset 0x142) Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 3fb0cb5d0f8b915a75677e8e8e4a4a4e481f03f7 Author: Heikki Orsila Date: Tue Apr 18 22:21:55 2006 -0700 [PATCH] Open IPMI BT overflow I was looking into random driver code and found a suspicious looking memcpy() in drivers/char/ipmi/ipmi_bt_sm.c on 2.6.17-rc1: if ((size < 2) || (size > IPMI_MAX_MSG_LENGTH)) return -1; ... memcpy(bt->write_data + 3, data + 1, size - 1); where sizeof bt->write_data is IPMI_MAX_MSG_LENGTH. It looks like the memcpy would overflow by 2 bytes if size == IPMI_MAX_MSG_LENGTH. A patch attached to limit size to (IPMI_MAX_LENGTH - 2). Cc: Corey Minyard Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit aa1e816fc92215f94bdfd90107baae8fdc2440d1 Author: Jesper Juhl Date: Tue Apr 18 22:21:54 2006 -0700 [PATCH] Fix potential NULL pointer deref in gen_init_cpio Fix potential NULL pointer deref in gen_init_cpio.c spotted by coverity checker. This fixes coverity bug #86 Without this patch we risk dereferencing a NULL `type' in the "if ('\n' == *type) {" line. Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 9dfb563b07b1aafcd7d40528ebfa7f9ce28f0556 Author: Randy Dunlap Date: Tue Apr 18 22:21:53 2006 -0700 [PATCH] config: update usage/help info Replace outdated help message with a reference to README. Update README for make *config variants and environment variable info. Signed-off-by: Randy Dunlap Acked-by: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 7420884c038f326bdac3a8ded856033523e7684e Author: Randy Dunlap Date: Tue Apr 18 22:21:52 2006 -0700 [PATCH] IPMI: fix devinit placement gcc complains about __devinit in the wrong location: drivers/char/ipmi/ipmi_si_intf.c:2205: warning: '__section__' attribute does not apply to types Signed-off-by: Randy Dunlap Acked-by: Corey Minyard Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 5e1222717932ff7d447af6da03c10a81fb60af7d Author: Randy Dunlap Date: Tue Apr 18 22:21:51 2006 -0700 [PATCH] Doc: vm/hugetlbpage update-2 Add new line of /proc/meminfo output. Explain the HugePage_ lines in /proc/meminfo (from Bill Irwin). Change KB to kB since the latter is what is used in the kernel. Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 73374454558b9caea46a5521fdae312d3d0ed3e1 Author: Samuel Thibault Date: Tue Apr 18 22:21:50 2006 -0700 [PATCH] apm: fix Armada laptops again Fix the "apm: set display: Interface not engaged" error on Armada laptops again. Jordan said: I think this is fine. It seems to me that this may be the fault of one or both of the APM solutions handling this situation in a non-standard way, but since APM is used very little on the Geode, and I have direct access to our BIOS folks, if this problem comes up with a customer again, we'll solve it from the firmware. Signed-off-by: Samuel Thibault Cc: "Jordan Crouse" Cc: Zachary Amsden Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit b514d8c77a6ad9c665c74e6ea7827e5c341095db Author: Jesper Juhl Date: Tue Apr 18 22:21:49 2006 -0700 [PATCH] voyager: no need to define BITS_PER_BYTE when it's already in types.h Signed-off-by: Jesper Juhl Cc: James Bottomley Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit cca57c5b5ab164e3c96576fc7739c0a30c2eab72 Author: Tim Chen Date: Tue Apr 18 22:21:47 2006 -0700 [PATCH] Kconfig.debug: Set DEBUG_MUTEX to off by default DEBUG_MUTEX flag is on by default in current kernel configuration. During performance testing, we saw mutex debug functions like mutex_debug_check_no_locks_freed (called by kfree()) is expensive as it goes through a global list of memory areas with mutex lock and do the checking. For benchmarks such as Volanomark and Hackbench, we have seen more than 40% drop in performance on some platforms. We suggest to set DEBUG_MUTEX off by default. Or at least do that later when we feel that the mutex changes in the current code have stabilized. Signed-off-by: Tim Chen Cc: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit ca99c1da080345e227cfb083c330a184d42e27f3 Author: Dipankar Sarma Date: Tue Apr 18 22:21:46 2006 -0700 [PATCH] Fix file lookup without ref There are places in the kernel where we look up files in fd tables and access the file structure without holding refereces to the file. So, we need special care to avoid the race between looking up files in the fd table and tearing down of the file in another CPU. Otherwise, one might see a NULL f_dentry or such torn down version of the file. This patch fixes those special places where such a race may happen. Signed-off-by: Dipankar Sarma Acked-by: "Paul E. McKenney" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit fb30d64568fd8f6a21afef987f11852a109723da Author: Jeff Dike Date: Tue Apr 18 22:21:44 2006 -0700 [PATCH] uml: add missing __volatile__ We were missing __volatile__ on some bits of asm in the segfault handlers. On x86_64, this was messing up the move from %rdx to uc because that was moved to after the GET_FAULTINFO_FROM_SC, which changed %rdx. Also changed the other bit of asm and the one in the i386 handler to prevent any similar occurrences. Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 966a082f80a073af1564c5ed6313ef2f0587dde3 Author: Rob Landley Date: Tue Apr 18 22:21:43 2006 -0700 [PATCH] uml: physical memory map file fixes UML really wants shared memory semantics form its physical memory map file, and the place for that is /dev/shm. So move the default, and fix the error messages to recognize that this value can be overridden. Signed-off-by: Rob Landley Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit f983c45ebedcaf686223afaecd8e681e8dcd15a9 Author: Al Viro Date: Tue Apr 18 22:21:42 2006 -0700 [PATCH] uml: __user annotations bits of uml __user annotations lost in merge Signed-off-by: Al Viro Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit ad28e029789ef46aebdfb9ece01d431ce1c637c8 Author: Jeff Dike Date: Tue Apr 18 22:21:41 2006 -0700 [PATCH] uml: change sigjmp_buf to jmp_buf Clean up the jmpbuf code. Since softints, we no longer use sig_setjmp, so the UML_SIGSETJMP wrapper now has a misleading name. Also, I forgot to change the buffers from sigjmp_buf to jmp_buf. Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 4127272c38619c56f0c1aa01d01c7bd757db70a1 Author: Hirokazu Takata Date: Tue Apr 18 22:21:38 2006 -0700 [PATCH] m32r: update switch_to macro for tuning - Remove unnecessary push/pop's of the switch_to() macro for performance tuning. - Cosmetic updates: change __inline__ to inline, etc. Signed-off-by: Hirokazu Takata Cc: NIIBE Yutaka Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit dd1c1e3e9ed04d33a698925238e527b7051f64b9 Author: Hirokazu Takata Date: Tue Apr 18 22:21:34 2006 -0700 [PATCH] m32r: Remove a warning in m32r_sio.c /project/m32r-linux/kernel/linux-2.6.17-rc1-mm2/linux-2.6.17-rc1-mm2/drivers/serial/m32r_sio.c: In function 'm32r_sio_console_write': /project/m32r-linux/kernel/linux-2.6.17-rc1-mm2/linux-2.6.17-rc1-mm2/drivers/serial/m32r_sio.c:1060: warning: unused variable 'i' Signed-off-by: Hirokazu Takata Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 0d34c86c3b75e5fd7cde15c965349b0104e06e53 Author: Hirokazu Takata Date: Tue Apr 18 22:21:30 2006 -0700 [PATCH] m32r: mappi3 reboot support Here is a patch to support a reboot function for M3A-2170(Mappi-III) evaluation board. Signed-off-by: Hayato Fujiwara Signed-off-by: Hirokazu Takata Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit fa372810e51979c5044e036a34015845e9c6aedd Author: Hirokazu Takata Date: Tue Apr 18 22:21:25 2006 -0700 [PATCH] m32r: update include/asm-m32r/semaphore.h This patch updates include/asm-m32r/semaphore.h for good readability and maintainability. Signed-off-by: Hirokazu Takata Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 8e8ff02c0b61d9b7c15c7996a2eddbedf51a105b Author: Hirokazu Takata Date: Tue Apr 18 22:21:20 2006 -0700 [PATCH] m32r: Fix pt_regs for !COFNIG_ISA_DSP_LEVEL2 target This modification is required to fix debugging function for m32r targets with !CONFIG_ISA_DSP_LEVEL2, by unifying 'struct pt_regs' and 'struct sigcontext' size for all M32R ISA. Some m32r processor core with !CONFIG_ISA_DSP_LEVEL2 configuration has only single accumulator a0 (ex. VDEC2 core, M32102 core, etc.), the others with CONFIG_ISA_DSP_LEVEL2 has two accumulators, a0 and a1. This means there are two variations of thread context. So far, we reduced and changed stackframe size at a syscall for their context size. However, this causes a problem that a GDB for processors with CONFIG_ISA_DSP_LEVEL2 cannot be used for processors with !CONFIG_ISA_DSP_LEVEL2. From the viewpoint of GDB support, we should reduce such variation of stackframe size for simplicity. In this patch, dummy members are added to 'struct pt_regs' and 'struct sigcontext' to adjust their size for !CONFIG_ISA_DSP_LEVEL2. This modification is also a one step for a GDB update in future. Currently, on the m32r, GDB can access process's context by using ptrace functions in a simple way of register by register access. By unifying stackframe size, we have a possibility to make use of ptrace functions of not only a single register access but also block register access, PTRACE_{GETREGS,PUTREGS}. However, for this purpose, we might have to modify stackframe structure some more; for example, PSW (processor status word) register should be pre-processed before pushing to stack at a syscall, and so on. In this case, we must update carefully both kernel and GDB at a time... Signed-off-by: Hayato Fujiwara Signed-off-by: Hirokazu Takata Cc: Kei Sakamoto Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit efe87d2b822e42975b4da958c9d321cf89bfeb5a Author: Randy Dunlap Date: Tue Apr 18 22:21:14 2006 -0700 [PATCH] x86 cpuid and msr notifier callback section mismatches Fix section mismatch warnings in x86 cpuid and msr notifier callback functions. We can't have these as init (discarded) code. WARNING: arch/x86_64/kernel/cpuid.o - Section mismatch: reference to .init.text: from .data between 'cpuid_class_cpu_notifier' (at offset 0x0) and 'cpuid_fops' WARNING: arch/x86_64/kernel/msr.o - Section mismatch: reference to .init.text: from .data between 'msr_class_cpu_notifier' (at offset 0x0) and 'msr_fops' Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 1bb858f27eadc54e24dfa351fcae724cff426de2 Author: lepton Date: Tue Apr 18 22:21:10 2006 -0700 [PATCH] asm-i386/atomic.h: local_irq_save should be used instead of local_irq_disable atomic_add_return() if CONFIG_M386 can accidentally enable local interrupts. Signed-off-by: Lepton Wu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit ab5703b34237da7034800ec2466ceebf88a7e685 Author: Ron Yorston Date: Tue Apr 18 22:21:04 2006 -0700 [PATCH] selinux: Fix MLS compatibility off-by-one bug Fix an off-by-one error in the MLS compatibility code that was causing contexts with a MLS suffix to be rejected, preventing sharing partitions between FC4 and FC5. Bug reported in https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=188068 Signed-off-by: Stephen Smalley Acked-by: James Morris Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit dda27d1a55e185b0c5fd184b86ac26c66846f095 Author: Arthur Othieno Date: Tue Apr 18 22:20:57 2006 -0700 [PATCH] hugetlbfs: add Kconfig help text In kernel bugzilla #6248 (http://bugzilla.kernel.org/show_bug.cgi?id=6248), Adrian Bunk notes that CONFIG_HUGETLBFS is missing Kconfig help text. Signed-off-by: Arthur Othieno Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 6aa3001b239b387d98a7f945e4a51edeb59e4f2d Author: Andrew Morton Date: Tue Apr 18 22:20:52 2006 -0700 [PATCH] page_alloc.c: buddy handling cleanup Fix up some whitespace damage. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 013159227b840dfd441bd2e4c8b4d77ffb3cc42e Author: Dave Peterson Date: Tue Apr 18 22:20:44 2006 -0700 [PATCH] mm: fix mm_struct reference counting bugs in mm/oom_kill.c Fix oom_kill_task() so it doesn't call mmput() (which may sleep) while holding tasklist_lock. Signed-off-by: David S. Peterson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 97c2c9b84d0c1edf4926b13661d5af3f0edccbce Author: Andrew Morton Date: Tue Apr 18 22:20:38 2006 -0700 [PATCH] oom-kill: mm locking fix Dave Peterson points out that badness() is playing with mm_structs without taking a reference on them. mmput() can sleep, so taking a reference here (inside tasklist_lock) is hard. Fix it up via task_lock() instead. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 75129e297e861e6c61038aa4cdbf604b022de4ff Author: John Hawkes Date: Tue Apr 18 22:20:33 2006 -0700 [PATCH] mm/slob.c: for_each_possible_cpu(), not NR_CPUS Convert for-loops that explicitly reference "NR_CPUS" into the potentially more efficient for_each_possible_cpu() construct. Signed-off-by: John Hawkes Cc: Matt Mackall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 4a3b98a422a20dedf3a2a40c44892d6e7e665157 Author: Rafael J. Wysocki Date: Tue Apr 18 22:20:29 2006 -0700 [PATCH] swsusp: prevent possible image corruption on resume The function free_pagedir() used by swsusp for freeing its internal data structures clears the PG_nosave and PG_nosave_free flags for each page being freed. However, during resume PG_nosave_free set means that the page in question is "unsafe" (ie. it will be overwritten in the process of restoring the saved system state from the image), so it should not be used for the image data. Therefore free_pagedir() should not clear PG_nosave_free if it's called during resume (otherwise "unsafe" pages freed by it may be used for storing the image data and the data may get corrupted later on). Signed-off-by: Rafael J. Wysocki Acked-by: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 8db08de4f6ae24e90aedf5125b5ddd52ffff15f4 Author: David Barksdale Date: Tue Apr 18 22:20:27 2006 -0700 [PATCH] m41t00: fix bitmasks when writing to chip Fix the bitmasks used when writing to the M41T00 registers. The original code used a mask of 0x7f when writing to each register, this is incorrect and probably the result of a copy-paste error. As a result years from 1980 to 1999 will be read back as 2000 to 2019. Signed-off-by: David Barksdale Acked-by: Jean Delvare Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit b73781c866f671ff5a84d7c840510b43e8731d13 Author: Jeff Dike Date: Tue Apr 18 22:20:24 2006 -0700 [PATCH] uml: MADV_REMOVE fixes MADV_REMOVE fixes - change the test mapping to be MAP_SHARED instead of MAP_PRIVATE, as MADV_REMOVE on MAP_PRIVATE maps won't work. Also, use the kernel's definition of MADV_REMOVE instead of hardcoding it if there isn't a libc definition. Signed-off-by: Jeff Dike Cc: Hugh Dickins Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 676ff453e58c5ff7ddbfebf5a11142e3e4add161 Author: KAMEZAWA Hiroyuki Date: Tue Apr 18 22:20:21 2006 -0700 [PATCH] for_each_possible_cpu: x86_64 for_each_cpu() actually iterates across all possible CPUs. We've had mistakes in the past where people were using for_each_cpu() where they should have been iterating across only online or present CPUs. This is inefficient and possibly buggy. We're renaming for_each_cpu() to for_each_possible_cpu() to avoid this in the future. This patch replaces for_each_cpu with for_each_possible_cpu. Signed-off-by: KAMEZAWA Hiroyuki Acked-by: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 5e85d4abe3f43bb5362f384bab0e20ef082ce0b5 Author: Eric W. Biederman Date: Tue Apr 18 22:20:16 2006 -0700 [PATCH] task: Make task list manipulations RCU safe While we can currently walk through thread groups, process groups, and sessions with just the rcu_read_lock, this opens the door to walking the entire task list. We already have all of the other RCU guarantees so there is no cost in doing this, this should be enough so that proc can stop taking the tasklist lock during readdir. prev_task was killed because it has no users, and using it will miss new tasks when doing an rcu traversal. Signed-off-by: Eric W. Biederman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 181ae4005d0a4010802be534d929b38c42b9ac06 Author: Paolo 'Blaisorblade' Giarrusso Date: Tue Apr 18 22:20:13 2006 -0700 [PATCH] uml: make 64-bit COW files compatible with 32-bit ones This is the minimal fix to make 64-bit UML binaries create 32-bit compatible COW files and read them. I've indeed tested that current code doesn't do this - the code gets SIGFPE for a division by a value read at the wrong place, where 0 is found. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Cc: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds commit 9e0267c26e237f84f608a68e579bf4eb89dad819 Author: Jens Axboe Date: Wed Apr 19 15:57:31 2006 +0200 [PATCH] splice: fixup writeout path after ->map changes Since ->map() no longer locks the page, we need to adjust the handling of those pages (and stealing) a little. This now passes full regressions again. Signed-off-by: Jens Axboe commit a4514ebd8e12c63c09ab02be518db545bd1d24af Author: Jens Axboe Date: Wed Apr 19 15:57:05 2006 +0200 [PATCH] splice: offset fixes - We need to adjust *ppos for writes as well. - Copy back modified offset value if one was passed in, similar to what sendfile does. Signed-off-by: Jens Axboe commit 2a27250e6cf47ca1ea3bea0a55e4b7889c097627 Author: Jens Axboe Date: Wed Apr 19 15:56:40 2006 +0200 [PATCH] tee: link_pipe() must be careful when dropping one of the pipe locks We need to ensure that we only drop a lock that is ordered last, to avoid ABBA deadlocks with competing processes. Signed-off-by: Jens Axboe commit c4f895cbe1e95aab633207fb19c650b7c984c01a Author: Jens Axboe Date: Wed Apr 19 15:56:12 2006 +0200 [PATCH] splice: cleanup the SPLICE_F_NONBLOCK handling - generic_file_splice_read() more readable and correct - Don't bail on page allocation with NONBLOCK set, just don't allow direct blocking on IO (eg lock_page). Signed-off-by: Jens Axboe commit 91ad66ef4469cb631ec0ccd131b07f16770773f7 Author: Jens Axboe Date: Wed Apr 19 15:55:10 2006 +0200 [PATCH] splice: close i_size truncate races on read We need to check i_size after doing a blocking readpage. Signed-off-by: Jens Axboe commit 34ddf733c415a8e336c996a4303d9f336e0c81b5 Author: Kumar Gala Date: Sun Apr 2 16:01:58 2006 -0500 powerpc/ppc: export strncasecmp We have a strncasecmp so we might as well export it Signed-off-by: Kumar Gala --- diff --git a/Documentation/block/switching-sched.txt b/Documentation/block/switching-sched.txt new file mode 100644 index 0000000..5fa130a --- /dev/null +++ b/Documentation/block/switching-sched.txt @@ -0,0 +1,22 @@ +As of the Linux 2.6.10 kernel, it is now possible to change the +IO scheduler for a given block device on the fly (thus making it possible, +for instance, to set the CFQ scheduler for the system default, but +set a specific device to use the anticipatory or noop schedulers - which +can improve that device's throughput). + +To set a specific scheduler, simply do this: + +echo SCHEDNAME > /sys/block/DEV/queue/scheduler + +where SCHEDNAME is the name of a defined IO scheduler, and DEV is the +device name (hda, hdb, sga, or whatever you happen to have). + +The list of defined schedulers can be found by simply doing +a "cat /sys/block/DEV/queue/scheduler" - the list of valid names +will be displayed, with the currently selected scheduler in brackets: + +# cat /sys/block/hda/queue/scheduler +noop anticipatory deadline [cfq] +# echo anticipatory > /sys/block/hda/queue/scheduler +# cat /sys/block/hda/queue/scheduler +noop [anticipatory] deadline cfq diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 293fed1..421bcff 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -25,8 +25,9 @@ Who: Adrian Bunk --------------------------- -What: drivers depending on OBSOLETE_OSS_DRIVER -When: January 2006 +What: drivers that were depending on OBSOLETE_OSS_DRIVER + (config options already removed) +When: before 2.6.19 Why: OSS drivers with ALSA replacements Who: Adrian Bunk diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt index c8bce82..89b1d19 100644 --- a/Documentation/filesystems/sysfs.txt +++ b/Documentation/filesystems/sysfs.txt @@ -246,6 +246,7 @@ class/ devices/ firmware/ net/ +fs/ devices/ contains a filesystem representation of the device tree. It maps directly to the internal kernel device tree, which is a hierarchy of @@ -264,6 +265,10 @@ drivers/ contains a directory for each d for devices on that particular bus (this assumes that drivers do not span multiple bus types). +fs/ contains a directory for some filesystems. Currently each +filesystem wanting to export attributes must create its own hierarchy +below fs/ (see ./fuse.txt for an example). + More information can driver-model specific features can be found in Documentation/driver-model/. diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt index 2803f63..687104b 100644 --- a/Documentation/vm/hugetlbpage.txt +++ b/Documentation/vm/hugetlbpage.txt @@ -32,7 +32,16 @@ The output of "cat /proc/meminfo" will h ..... HugePages_Total: xxx HugePages_Free: yyy -Hugepagesize: zzz KB +HugePages_Rsvd: www +Hugepagesize: zzz kB + +where: +HugePages_Total is the size of the pool of hugepages. +HugePages_Free is the number of hugepages in the pool that are not yet +allocated. +HugePages_Rsvd is short for "reserved," and is the number of hugepages +for which a commitment to allocate from the pool has been made, but no +allocation has yet been made. It's vaguely analogous to overcommit. /proc/filesystems should also show a filesystem of type "hugetlbfs" configured in the kernel. diff --git a/MAINTAINERS b/MAINTAINERS index 78a2f5b..d6a8e5b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -421,6 +421,14 @@ L: linux-hams@vger.kernel.org W: http://www.baycom.org/~tom/ham/ham.html S: Maintained +BCM43XX WIRELESS DRIVER +P: Michael Buesch +M: mb@bu3sch.de +P: Stefano Brivio +M: st3@riseup.net +W: http://bcm43xx.berlios.de/ +S: Maintained + BEFS FILE SYSTEM P: Sergey S. Kostyliov M: rathamahata@php4.ru @@ -1458,6 +1466,13 @@ M: support@pathscale.com L: openib-general@openib.org S: Supported +IPMI SUBSYSTEM +P: Corey Minyard +M: minyard@acm.org +L: openipmi-developer@lists.sourceforge.net +W: http://openipmi.sourceforge.net/ +S: Supported + IPX NETWORK LAYER P: Arnaldo Carvalho de Melo M: acme@conectiva.com.br @@ -2058,8 +2073,12 @@ P: Matthew Wilcox M: matthew@wil.cx P: Grant Grundler M: grundler@parisc-linux.org +P: Kyle McMartin +M: kyle@parisc-linux.org L: parisc-linux@parisc-linux.org W: http://www.parisc-linux.org/ +T: git kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6.git +T: cvs cvs.parisc-linux.org:/var/cvs/linux-2.6 S: Maintained PCI ERROR RECOVERY diff --git a/README b/README index 05e0555..3e26472 100644 --- a/README +++ b/README @@ -165,10 +165,31 @@ CONFIGURING the kernel: "make xconfig" X windows (Qt) based configuration tool. "make gconfig" X windows (Gtk) based configuration tool. "make oldconfig" Default all questions based on the contents of - your existing ./.config file. + your existing ./.config file and asking about + new config symbols. "make silentoldconfig" Like above, but avoids cluttering the screen with questions already answered. + "make defconfig" Create a ./.config file by using the default + symbol values from arch/$ARCH/defconfig. + "make allyesconfig" + Create a ./.config file by setting symbol + values to 'y' as much as possible. + "make allmodconfig" + Create a ./.config file by setting symbol + values to 'm' as much as possible. + "make allnoconfig" Create a ./.config file by setting symbol + values to 'n' as much as possible. + "make randconfig" Create a ./.config file by setting symbol + values to random values. + + The allyesconfig/allmodconfig/allnoconfig/randconfig variants can + also use the environment variable KCONFIG_ALLCONFIG to specify a + filename that contains config options that the user requires to be + set to a specific value. If KCONFIG_ALLCONFIG=filename is not used, + "make *config" checks for a file named "all{yes/mod/no/random}.config" + for symbol values that are to be forced. If this file is not found, + it checks for a file named "all.config" to contain forced values. NOTES on "make config": - having unnecessary drivers will make the kernel bigger, and can diff --git a/arch/alpha/lib/strncpy.S b/arch/alpha/lib/strncpy.S index 338551c..bbdef1b 100644 --- a/arch/alpha/lib/strncpy.S +++ b/arch/alpha/lib/strncpy.S @@ -43,8 +43,8 @@ strncpy: .align 4 $multiword: - subq $24, 1, $2 # clear the final bits in the prev word - or $2, $24, $2 + subq $27, 1, $2 # clear the final bits in the prev word + or $2, $27, $2 zapnot $1, $2, $1 subq $18, 1, $18 @@ -70,8 +70,8 @@ $multiword: bne $18, 0b 1: ldq_u $1, 0($16) # clear the leading bits in the final word - subq $27, 1, $2 - or $2, $27, $2 + subq $24, 1, $2 + or $2, $24, $2 zap $1, $2, $1 stq_u $1, 0($16) diff --git a/arch/arm/configs/ep93xx_defconfig b/arch/arm/configs/ep93xx_defconfig index 8dcc8e8..b69e88b 100644 --- a/arch/arm/configs/ep93xx_defconfig +++ b/arch/arm/configs/ep93xx_defconfig @@ -1,12 +1,14 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.16 -# Mon Mar 20 14:54:51 2006 +# Linux kernel version: 2.6.17-rc2 +# Wed Apr 19 21:21:01 2006 # CONFIG_ARM=y CONFIG_MMU=y CONFIG_RWSEM_GENERIC_SPINLOCK=y +CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_VECTORS_BASE=0xffff0000 # # Code maturity level options @@ -28,6 +30,7 @@ CONFIG_SYSCTL=y # CONFIG_AUDIT is not set CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y +# CONFIG_RELAY is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_UID16=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y @@ -43,10 +46,6 @@ CONFIG_BASE_FULL=y CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_SHMEM=y -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 CONFIG_SLAB=y # CONFIG_TINY_SHMEM is not set CONFIG_BASE_SMALL=0 @@ -59,7 +58,6 @@ CONFIG_OBSOLETE_INTERMODULE=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y CONFIG_MODULE_FORCE_UNLOAD=y -CONFIG_OBSOLETE_MODPARM=y # CONFIG_MODVERSIONS is not set # CONFIG_MODULE_SRCVERSION_ALL is not set CONFIG_KMOD=y @@ -67,6 +65,7 @@ CONFIG_KMOD=y # # Block layer # +# CONFIG_BLK_DEV_IO_TRACE is not set # # IO Schedulers @@ -94,6 +93,7 @@ CONFIG_ARCH_EP93XX=y # CONFIG_ARCH_IOP3XX is not set # CONFIG_ARCH_IXP4XX is not set # CONFIG_ARCH_IXP2000 is not set +# CONFIG_ARCH_IXP23XX is not set # CONFIG_ARCH_L7200 is not set # CONFIG_ARCH_PXA is not set # CONFIG_ARCH_RPC is not set @@ -112,7 +112,6 @@ CONFIG_ARCH_EP93XX=y # # Cirrus EP93xx Implementation Options # -CONFIG_CRUNCH=y # # EP93xx Platforms @@ -232,12 +231,15 @@ CONFIG_SYN_COOKIES=y # CONFIG_INET_AH is not set # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set # CONFIG_INET_TUNNEL is not set CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y # CONFIG_TCP_CONG_ADVANCED is not set CONFIG_TCP_CONG_BIC=y # CONFIG_IPV6 is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set # CONFIG_NETFILTER is not set # @@ -346,7 +348,6 @@ CONFIG_MTD_CFI_I2=y # CONFIG_MTD_OTP is not set CONFIG_MTD_CFI_INTELEXT=y CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_CFI_AMDSTD_RETRY=0 CONFIG_MTD_CFI_STAA=y CONFIG_MTD_CFI_UTIL=y # CONFIG_MTD_RAM is not set @@ -371,7 +372,6 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=1 # CONFIG_MTD_SLRAM is not set # CONFIG_MTD_PHRAM is not set # CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLKMTD is not set # CONFIG_MTD_BLOCK2MTD is not set # @@ -412,7 +412,7 @@ CONFIG_MTD_NAND_IDS=y # CONFIG_BLK_DEV_NBD is not set # CONFIG_BLK_DEV_UB is not set # CONFIG_BLK_DEV_RAM is not set -CONFIG_BLK_DEV_RAM_COUNT=16 +# CONFIG_BLK_DEV_INITRD is not set # CONFIG_CDROM_PKTCDVD is not set # CONFIG_ATA_OVER_ETH is not set @@ -576,13 +576,13 @@ CONFIG_WATCHDOG=y # Watchdog Device Drivers # # CONFIG_SOFT_WATCHDOG is not set +CONFIG_EP93XX_WATCHDOG=y # # USB-based Watchdog Cards # # CONFIG_USBPCWATCHDOG is not set # CONFIG_NVRAM is not set -# CONFIG_RTC is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set @@ -626,9 +626,7 @@ CONFIG_I2C_ALGOBIT=y # CONFIG_SENSORS_PCF8574 is not set # CONFIG_SENSORS_PCA9539 is not set # CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_RTC8564 is not set # CONFIG_SENSORS_MAX6875 is not set -# CONFIG_RTC_X1205_I2C is not set CONFIG_I2C_DEBUG_CORE=y CONFIG_I2C_DEBUG_ALGO=y CONFIG_I2C_DEBUG_BUS=y @@ -690,7 +688,16 @@ CONFIG_HWMON=y # # -# Multimedia Capabilities Port drivers +# LED devices +# +# CONFIG_NEW_LEDS is not set + +# +# LED drivers +# + +# +# LED Triggers # # @@ -702,6 +709,7 @@ CONFIG_HWMON=y # Digital Video Broadcasting Devices # # CONFIG_DVB is not set +# CONFIG_USB_DABUSB is not set # # Graphics support @@ -718,6 +726,7 @@ CONFIG_HWMON=y # CONFIG_USB_ARCH_HAS_HCD=y # CONFIG_USB_ARCH_HAS_OHCI is not set +# CONFIG_USB_ARCH_HAS_EHCI is not set CONFIG_USB=y CONFIG_USB_DEBUG=y @@ -776,15 +785,6 @@ CONFIG_USB_STORAGE=y # CONFIG_USB_MICROTEK is not set # -# USB Multimedia devices -# -# CONFIG_USB_DABUSB is not set - -# -# Video4Linux support is needed for USB Multimedia device support -# - -# # USB Network Adapters # # CONFIG_USB_CATC is not set @@ -813,6 +813,7 @@ CONFIG_USB_SERIAL_CONSOLE=y # CONFIG_USB_SERIAL_CYPRESS_M8 is not set # CONFIG_USB_SERIAL_EMPEG is not set # CONFIG_USB_SERIAL_FTDI_SIO is not set +# CONFIG_USB_SERIAL_FUNSOFT is not set # CONFIG_USB_SERIAL_VISOR is not set # CONFIG_USB_SERIAL_IPAQ is not set # CONFIG_USB_SERIAL_IR is not set @@ -825,6 +826,7 @@ CONFIG_USB_SERIAL_CONSOLE=y # CONFIG_USB_SERIAL_KLSI is not set # CONFIG_USB_SERIAL_KOBIL_SCT is not set # CONFIG_USB_SERIAL_MCT_U232 is not set +# CONFIG_USB_SERIAL_NAVMAN is not set CONFIG_USB_SERIAL_PL2303=y # CONFIG_USB_SERIAL_HP4X is not set # CONFIG_USB_SERIAL_SAFE is not set @@ -865,6 +867,32 @@ CONFIG_USB_SERIAL_PL2303=y # CONFIG_MMC is not set # +# Real Time Clock +# +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y + +# +# RTC drivers +# +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +CONFIG_RTC_DRV_M48T86=y +CONFIG_RTC_DRV_EP93XX=y +# CONFIG_RTC_DRV_TEST is not set + +# # File systems # CONFIG_EXT2_FS=y @@ -912,7 +940,6 @@ CONFIG_SYSFS=y CONFIG_TMPFS=y # CONFIG_HUGETLB_PAGE is not set CONFIG_RAMFS=y -# CONFIG_RELAYFS_FS is not set # CONFIG_CONFIGFS_FS is not set # @@ -1044,6 +1071,7 @@ CONFIG_LOG_BUF_SHIFT=14 CONFIG_DETECT_SOFTLOCKUP=y # CONFIG_SCHEDSTATS is not set CONFIG_DEBUG_SLAB=y +# CONFIG_DEBUG_SLAB_LEAK is not set CONFIG_DEBUG_MUTEXES=y CONFIG_DEBUG_SPINLOCK=y # CONFIG_DEBUG_SPINLOCK_SLEEP is not set @@ -1053,6 +1081,7 @@ CONFIG_DEBUG_BUGVERBOSE=y # CONFIG_DEBUG_FS is not set # CONFIG_DEBUG_VM is not set CONFIG_FRAME_POINTER=y +# CONFIG_UNWIND_INFO is not set CONFIG_FORCED_INLINING=y # CONFIG_RCU_TORTURE_TEST is not set CONFIG_DEBUG_USER=y diff --git a/arch/arm/configs/ixp2000_defconfig b/arch/arm/configs/ixp2000_defconfig index 7b02ca0..e6f3e48 100644 --- a/arch/arm/configs/ixp2000_defconfig +++ b/arch/arm/configs/ixp2000_defconfig @@ -1,18 +1,19 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.16-rc2 -# Wed Feb 8 04:49:11 2006 +# Linux kernel version: 2.6.17-rc2 +# Wed Apr 19 21:12:49 2006 # CONFIG_ARM=y CONFIG_MMU=y CONFIG_RWSEM_GENERIC_SPINLOCK=y +CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_VECTORS_BASE=0xffff0000 # # Code maturity level options # CONFIG_EXPERIMENTAL=y -CONFIG_CLEAN_COMPILE=y CONFIG_BROKEN_ON_SMP=y CONFIG_INIT_ENV_ARG_LIMIT=32 @@ -29,6 +30,7 @@ CONFIG_BSD_PROCESS_ACCT=y CONFIG_SYSCTL=y # CONFIG_AUDIT is not set # CONFIG_IKCONFIG is not set +# CONFIG_RELAY is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_UID16=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y @@ -44,10 +46,6 @@ CONFIG_BASE_FULL=y CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_SHMEM=y -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 CONFIG_SLAB=y # CONFIG_TINY_SHMEM is not set CONFIG_BASE_SMALL=0 @@ -60,7 +58,6 @@ CONFIG_OBSOLETE_INTERMODULE=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y # CONFIG_MODULE_FORCE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y # CONFIG_MODVERSIONS is not set # CONFIG_MODULE_SRCVERSION_ALL is not set CONFIG_KMOD=y @@ -68,6 +65,7 @@ CONFIG_KMOD=y # # Block layer # +# CONFIG_BLK_DEV_IO_TRACE is not set # # IO Schedulers @@ -89,11 +87,13 @@ CONFIG_DEFAULT_IOSCHED="anticipatory" # CONFIG_ARCH_CLPS711X is not set # CONFIG_ARCH_CO285 is not set # CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set # CONFIG_ARCH_FOOTBRIDGE is not set # CONFIG_ARCH_INTEGRATOR is not set # CONFIG_ARCH_IOP3XX is not set # CONFIG_ARCH_IXP4XX is not set CONFIG_ARCH_IXP2000=y +# CONFIG_ARCH_IXP23XX is not set # CONFIG_ARCH_L7200 is not set # CONFIG_ARCH_PXA is not set # CONFIG_ARCH_RPC is not set @@ -123,6 +123,7 @@ CONFIG_ARCH_IXDP2800=y CONFIG_ARCH_IXDP2X00=y CONFIG_ARCH_IXDP2401=y CONFIG_ARCH_IXDP2801=y +CONFIG_MACH_IXDP28X5=y CONFIG_ARCH_IXDP2X01=y # CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO is not set @@ -147,7 +148,6 @@ CONFIG_XSCALE_PMU=y # Bus support # CONFIG_PCI=y -CONFIG_PCI_LEGACY_PROC=y # CONFIG_PCI_DEBUG is not set # @@ -160,6 +160,7 @@ CONFIG_PCI_LEGACY_PROC=y # # CONFIG_PREEMPT is not set # CONFIG_NO_IDLE_HZ is not set +CONFIG_HZ=100 # CONFIG_AEABI is not set # CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set CONFIG_SELECT_MEMORY_MODEL=y @@ -213,6 +214,7 @@ CONFIG_NET=y # # Networking options # +# CONFIG_NETDEBUG is not set CONFIG_PACKET=y CONFIG_PACKET_MMAP=y CONFIG_UNIX=y @@ -232,12 +234,15 @@ CONFIG_SYN_COOKIES=y # CONFIG_INET_AH is not set # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set # CONFIG_INET_TUNNEL is not set CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y # CONFIG_TCP_CONG_ADVANCED is not set CONFIG_TCP_CONG_BIC=y # CONFIG_IPV6 is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set # CONFIG_NETFILTER is not set # @@ -347,7 +352,6 @@ CONFIG_MTD_CFI_UTIL=y # CONFIG_MTD_ROM is not set # CONFIG_MTD_ABSENT is not set # CONFIG_MTD_OBSOLETE_CHIPS is not set -# CONFIG_MTD_XIP is not set # # Mapping drivers for chip access @@ -366,7 +370,6 @@ CONFIG_MTD_IXP2000=y # CONFIG_MTD_SLRAM is not set # CONFIG_MTD_PHRAM is not set # CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLKMTD is not set # CONFIG_MTD_BLOCK2MTD is not set # @@ -614,8 +617,9 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 # CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_8250_NR_UARTS=3 -CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=3 # CONFIG_SERIAL_8250_EXTENDED is not set # @@ -623,6 +627,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=4 # CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_JSM is not set CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 @@ -650,7 +655,6 @@ CONFIG_IXP2000_WATCHDOG=y # CONFIG_PCIPCWATCHDOG is not set # CONFIG_WDTPCI is not set # CONFIG_NVRAM is not set -# CONFIG_RTC is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_APPLICOM is not set @@ -696,7 +700,6 @@ CONFIG_I2C_IXP2000=y # CONFIG_I2C_PARPORT_LIGHT is not set # CONFIG_I2C_PROSAVAGE is not set # CONFIG_I2C_SAVAGE4 is not set -# CONFIG_SCx200_ACB is not set # CONFIG_I2C_SIS5595 is not set # CONFIG_I2C_SIS630 is not set # CONFIG_I2C_SIS96X is not set @@ -715,9 +718,7 @@ CONFIG_SENSORS_EEPROM=y # CONFIG_SENSORS_PCF8574 is not set # CONFIG_SENSORS_PCA9539 is not set # CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_RTC8564 is not set # CONFIG_SENSORS_MAX6875 is not set -# CONFIG_RTC_X1205_I2C is not set # CONFIG_I2C_DEBUG_CORE is not set # CONFIG_I2C_DEBUG_ALGO is not set # CONFIG_I2C_DEBUG_BUS is not set @@ -730,6 +731,11 @@ CONFIG_SENSORS_EEPROM=y # CONFIG_SPI_MASTER is not set # +# Dallas's 1-wire bus +# +# CONFIG_W1 is not set + +# # Hardware Monitoring support # CONFIG_HWMON=y @@ -742,6 +748,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_ASB100 is not set # CONFIG_SENSORS_ATXP1 is not set # CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set # CONFIG_SENSORS_FSCHER is not set # CONFIG_SENSORS_FSCPOS is not set # CONFIG_SENSORS_GL518SM is not set @@ -776,7 +783,16 @@ CONFIG_HWMON=y # # -# Multimedia Capabilities Port drivers +# LED devices +# +# CONFIG_NEW_LEDS is not set + +# +# LED drivers +# + +# +# LED Triggers # # @@ -804,6 +820,7 @@ CONFIG_HWMON=y # CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB_ARCH_HAS_OHCI=y +CONFIG_USB_ARCH_HAS_EHCI=y # CONFIG_USB is not set # @@ -821,6 +838,12 @@ CONFIG_USB_ARCH_HAS_OHCI=y # CONFIG_MMC is not set # +# Real Time Clock +# +CONFIG_RTC_LIB=y +# CONFIG_RTC_CLASS is not set + +# # File systems # CONFIG_EXT2_FS=y @@ -870,7 +893,6 @@ CONFIG_SYSFS=y CONFIG_TMPFS=y # CONFIG_HUGETLB_PAGE is not set CONFIG_RAMFS=y -# CONFIG_RELAYFS_FS is not set # CONFIG_CONFIGFS_FS is not set # @@ -972,6 +994,7 @@ CONFIG_DEBUG_BUGVERBOSE=y # CONFIG_DEBUG_FS is not set # CONFIG_DEBUG_VM is not set CONFIG_FRAME_POINTER=y +# CONFIG_UNWIND_INFO is not set CONFIG_FORCED_INLINING=y # CONFIG_RCU_TORTURE_TEST is not set CONFIG_DEBUG_USER=y diff --git a/arch/arm/configs/ixp23xx_defconfig b/arch/arm/configs/ixp23xx_defconfig index 1a2751e..9ce898a 100644 --- a/arch/arm/configs/ixp23xx_defconfig +++ b/arch/arm/configs/ixp23xx_defconfig @@ -1,12 +1,14 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.16 -# Tue Mar 21 03:27:20 2006 +# Linux kernel version: 2.6.17-rc2 +# Wed Apr 19 21:13:50 2006 # CONFIG_ARM=y CONFIG_MMU=y CONFIG_RWSEM_GENERIC_SPINLOCK=y +CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_VECTORS_BASE=0xffff0000 # # Code maturity level options @@ -28,6 +30,7 @@ CONFIG_BSD_PROCESS_ACCT=y CONFIG_SYSCTL=y # CONFIG_AUDIT is not set # CONFIG_IKCONFIG is not set +# CONFIG_RELAY is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_UID16=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y @@ -43,10 +46,6 @@ CONFIG_BASE_FULL=y CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_SHMEM=y -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 CONFIG_SLAB=y # CONFIG_TINY_SHMEM is not set CONFIG_BASE_SMALL=0 @@ -59,7 +58,6 @@ CONFIG_OBSOLETE_INTERMODULE=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y # CONFIG_MODULE_FORCE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y # CONFIG_MODVERSIONS is not set # CONFIG_MODULE_SRCVERSION_ALL is not set CONFIG_KMOD=y @@ -67,6 +65,7 @@ CONFIG_KMOD=y # # Block layer # +# CONFIG_BLK_DEV_IO_TRACE is not set # # IO Schedulers @@ -143,7 +142,6 @@ CONFIG_CPU_BIG_ENDIAN=y # Bus support # CONFIG_PCI=y -CONFIG_PCI_LEGACY_PROC=y # CONFIG_PCI_DEBUG is not set # @@ -230,12 +228,15 @@ CONFIG_SYN_COOKIES=y # CONFIG_INET_AH is not set # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set # CONFIG_INET_TUNNEL is not set CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y # CONFIG_TCP_CONG_ADVANCED is not set CONFIG_TCP_CONG_BIC=y # CONFIG_IPV6 is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set # CONFIG_NETFILTER is not set # @@ -365,7 +366,6 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=1 # CONFIG_MTD_SLRAM is not set # CONFIG_MTD_PHRAM is not set # CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLKMTD is not set # CONFIG_MTD_BLOCK2MTD is not set # @@ -527,7 +527,6 @@ CONFIG_BLK_DEV_SD=y # CONFIG_SCSI_INIA100 is not set # CONFIG_SCSI_SYM53C8XX_2 is not set # CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_QLOGIC_FC is not set # CONFIG_SCSI_QLOGIC_1280 is not set # CONFIG_SCSI_QLA_FC is not set # CONFIG_SCSI_LPFC is not set @@ -735,6 +734,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 # CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 # CONFIG_SERIAL_8250_EXTENDED is not set @@ -776,7 +776,6 @@ CONFIG_WATCHDOG=y # # CONFIG_USBPCWATCHDOG is not set # CONFIG_NVRAM is not set -# CONFIG_RTC is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_APPLICOM is not set @@ -821,7 +820,6 @@ CONFIG_I2C_ALGOBIT=y # CONFIG_I2C_PARPORT_LIGHT is not set # CONFIG_I2C_PROSAVAGE is not set # CONFIG_I2C_SAVAGE4 is not set -# CONFIG_SCx200_ACB is not set # CONFIG_I2C_SIS5595 is not set # CONFIG_I2C_SIS630 is not set # CONFIG_I2C_SIS96X is not set @@ -840,9 +838,7 @@ CONFIG_SENSORS_EEPROM=y # CONFIG_SENSORS_PCF8574 is not set # CONFIG_SENSORS_PCA9539 is not set # CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_RTC8564 is not set # CONFIG_SENSORS_MAX6875 is not set -# CONFIG_RTC_X1205_I2C is not set # CONFIG_I2C_DEBUG_CORE is not set # CONFIG_I2C_DEBUG_ALGO is not set # CONFIG_I2C_DEBUG_BUS is not set @@ -907,7 +903,16 @@ CONFIG_HWMON=y # # -# Multimedia Capabilities Port drivers +# LED devices +# +# CONFIG_NEW_LEDS is not set + +# +# LED drivers +# + +# +# LED Triggers # # @@ -919,6 +924,7 @@ CONFIG_HWMON=y # Digital Video Broadcasting Devices # # CONFIG_DVB is not set +# CONFIG_USB_DABUSB is not set # # Graphics support @@ -935,6 +941,7 @@ CONFIG_HWMON=y # CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB_ARCH_HAS_OHCI=y +CONFIG_USB_ARCH_HAS_EHCI=y CONFIG_USB=y # CONFIG_USB_DEBUG is not set @@ -1000,9 +1007,7 @@ CONFIG_USB_STORAGE=y # CONFIG_USB_ACECAD is not set # CONFIG_USB_KBTAB is not set # CONFIG_USB_POWERMATE is not set -# CONFIG_USB_MTOUCH is not set -# CONFIG_USB_ITMTOUCH is not set -# CONFIG_USB_EGALAX is not set +# CONFIG_USB_TOUCHSCREEN is not set # CONFIG_USB_YEALINK is not set # CONFIG_USB_XPAD is not set # CONFIG_USB_ATI_REMOTE is not set @@ -1017,15 +1022,6 @@ CONFIG_USB_STORAGE=y # CONFIG_USB_MICROTEK is not set # -# USB Multimedia devices -# -# CONFIG_USB_DABUSB is not set - -# -# Video4Linux support is needed for USB Multimedia device support -# - -# # USB Network Adapters # # CONFIG_USB_CATC is not set @@ -1076,6 +1072,12 @@ CONFIG_USB_MON=y # CONFIG_MMC is not set # +# Real Time Clock +# +CONFIG_RTC_LIB=y +# CONFIG_RTC_CLASS is not set + +# # File systems # CONFIG_EXT2_FS=y @@ -1127,7 +1129,6 @@ CONFIG_SYSFS=y CONFIG_TMPFS=y # CONFIG_HUGETLB_PAGE is not set CONFIG_RAMFS=y -# CONFIG_RELAYFS_FS is not set # CONFIG_CONFIGFS_FS is not set # @@ -1268,6 +1269,7 @@ CONFIG_DEBUG_BUGVERBOSE=y # CONFIG_DEBUG_FS is not set # CONFIG_DEBUG_VM is not set CONFIG_FRAME_POINTER=y +# CONFIG_UNWIND_INFO is not set CONFIG_FORCED_INLINING=y # CONFIG_RCU_TORTURE_TEST is not set CONFIG_DEBUG_USER=y diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 8cff73e..9fc9af8 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -407,7 +407,7 @@ static void __init early_initrd(char **p } __early_param("initrd=", early_initrd); -static void __init add_memory(unsigned long start, unsigned long size) +static void __init arm_add_memory(unsigned long start, unsigned long size) { /* * Ensure that start/size are aligned to a page boundary. @@ -445,7 +445,7 @@ static void __init early_mem(char **p) if (**p == '@') start = memparse(*p + 1, p); - add_memory(start, size); + arm_add_memory(start, size); } __early_param("mem=", early_mem); @@ -587,7 +587,7 @@ static int __init parse_tag_mem32(const tag->u.mem.start, tag->u.mem.size / 1024); return -EINVAL; } - add_memory(tag->u.mem.start, tag->u.mem.size); + arm_add_memory(tag->u.mem.start, tag->u.mem.size); return 0; } @@ -807,7 +807,7 @@ static int __init topology_init(void) { int cpu; - for_each_cpu(cpu) + for_each_possible_cpu(cpu) register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu, NULL); return 0; diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index a0888e1..00b761f 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -91,7 +91,7 @@ static void ixp4xx_config_irq(unsigned i /* * IRQ -> GPIO mapping table */ -static char irq2gpio[32] = { +static signed char irq2gpio[32] = { -1, -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 4, 5, 6, diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index da30a37..df0e174 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c @@ -1079,7 +1079,7 @@ static int apm_console_blank(int blank) break; } - if (error == APM_NOT_ENGAGED && state != APM_STATE_READY) { + if (error == APM_NOT_ENGAGED) { static int tried; int eng_error; if (tried++ == 0) { diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c index ff2b215..786d1a5 100644 --- a/arch/i386/kernel/cpu/amd.c +++ b/arch/i386/kernel/cpu/amd.c @@ -207,6 +207,8 @@ static void __init init_amd(struct cpuin set_bit(X86_FEATURE_K7, c->x86_capability); break; } + if (c->x86 >= 6) + set_bit(X86_FEATURE_FXSAVE_LEAK, c->x86_capability); display_cacheinfo(c); diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c index 9df87b0..c8547a6 100644 --- a/arch/i386/kernel/cpu/intel_cacheinfo.c +++ b/arch/i386/kernel/cpu/intel_cacheinfo.c @@ -642,7 +642,7 @@ static void __cpuexit cache_remove_dev(s return; } -static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb, +static int cacheinfo_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; diff --git a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c index 006141d..1d9a4ab 100644 --- a/arch/i386/kernel/cpuid.c +++ b/arch/i386/kernel/cpuid.c @@ -168,7 +168,7 @@ static int cpuid_class_device_create(int return err; } -static int __devinit cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) +static int cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index f197687..043f529 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c @@ -43,7 +43,7 @@ DEFINE_PER_CPU(struct kprobe *, current_ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); /* insert a jmp code */ -static inline void set_jmp_op(void *from, void *to) +static __always_inline void set_jmp_op(void *from, void *to) { struct __arch_jmp_op { char op; @@ -57,7 +57,7 @@ static inline void set_jmp_op(void *from /* * returns non-zero if opcodes can be boosted. */ -static inline int can_boost(kprobe_opcode_t opcode) +static __always_inline int can_boost(kprobe_opcode_t opcode) { switch (opcode & 0xf0 ) { case 0x70: @@ -88,7 +88,7 @@ static inline int can_boost(kprobe_opcod /* * returns non-zero if opcode modifies the interrupt flag. */ -static inline int is_IF_modifier(kprobe_opcode_t opcode) +static int __kprobes is_IF_modifier(kprobe_opcode_t opcode) { switch (opcode) { case 0xfa: /* cli */ @@ -138,7 +138,7 @@ void __kprobes arch_remove_kprobe(struct mutex_unlock(&kprobe_mutex); } -static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) +static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp = kprobe_running(); kcb->prev_kprobe.status = kcb->kprobe_status; @@ -146,7 +146,7 @@ static inline void save_previous_kprobe( kcb->prev_kprobe.saved_eflags = kcb->kprobe_saved_eflags; } -static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) +static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; kcb->kprobe_status = kcb->prev_kprobe.status; @@ -154,7 +154,7 @@ static inline void restore_previous_kpro kcb->kprobe_saved_eflags = kcb->prev_kprobe.saved_eflags; } -static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, +static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = p; @@ -164,7 +164,7 @@ static inline void set_current_kprobe(st kcb->kprobe_saved_eflags &= ~IF_MASK; } -static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) +static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) { regs->eflags |= TF_MASK; regs->eflags &= ~IF_MASK; @@ -507,7 +507,7 @@ no_change: * Interrupts are disabled on entry as trap1 is an interrupt gate and they * remain disabled thoroughout this function. */ -static inline int post_kprobe_handler(struct pt_regs *regs) +static int __kprobes post_kprobe_handler(struct pt_regs *regs) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); @@ -543,7 +543,7 @@ out: return 1; } -static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) +static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c index 1d0a55e..7a32823 100644 --- a/arch/i386/kernel/msr.c +++ b/arch/i386/kernel/msr.c @@ -251,7 +251,7 @@ static int msr_class_device_create(int i return err; } -static int __devinit msr_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) +static int msr_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; diff --git a/arch/i386/mach-voyager/voyager_cat.c b/arch/i386/mach-voyager/voyager_cat.c index 3039539..10d21df 100644 --- a/arch/i386/mach-voyager/voyager_cat.c +++ b/arch/i386/mach-voyager/voyager_cat.c @@ -120,7 +120,6 @@ static struct resource qic_res = { * It writes num_bits of the data buffer in msg starting at start_bit. * Note: This function assumes that any unused bit in the data stream * is set to zero so that the ors will work correctly */ -#define BITS_PER_BYTE 8 static void cat_pack(__u8 *msg, const __u16 start_bit, __u8 *data, const __u16 num_bits) { diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index e307988..bcb80ca 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S @@ -1610,5 +1610,6 @@ sys_call_table: data8 sys_get_robust_list data8 sys_sync_file_range // 1300 data8 sys_tee + data8 sys_vmsplice .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 789881c..f9039f8 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c @@ -251,7 +251,7 @@ static void __kprobes prepare_break_inst update_kprobe_inst_flag(template, slot, major_opcode, kprobe_inst, p); } -static inline void get_kprobe_inst(bundle_t *bundle, uint slot, +static void __kprobes get_kprobe_inst(bundle_t *bundle, uint slot, unsigned long *kprobe_inst, uint *major_opcode) { unsigned long kprobe_inst_p0, kprobe_inst_p1; @@ -278,7 +278,7 @@ static inline void get_kprobe_inst(bundl } /* Returns non-zero if the addr is in the Interrupt Vector Table */ -static inline int in_ivt_functions(unsigned long addr) +static int __kprobes in_ivt_functions(unsigned long addr) { return (addr >= (unsigned long)__start_ivt_text && addr < (unsigned long)__end_ivt_text); @@ -308,19 +308,19 @@ static int __kprobes valid_kprobe_addr(i return 0; } -static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) +static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp = kprobe_running(); kcb->prev_kprobe.status = kcb->kprobe_status; } -static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) +static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; kcb->kprobe_status = kcb->prev_kprobe.status; } -static inline void set_current_kprobe(struct kprobe *p, +static void __kprobes set_current_kprobe(struct kprobe *p, struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = p; diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c index 6386f63..859fb37 100644 --- a/arch/ia64/kernel/palinfo.c +++ b/arch/ia64/kernel/palinfo.c @@ -959,7 +959,7 @@ remove_palinfo_proc_entries(unsigned int } } -static int __devinit palinfo_cpu_callback(struct notifier_block *nfb, +static int palinfo_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c index 9d5a823..663a186 100644 --- a/arch/ia64/kernel/salinfo.c +++ b/arch/ia64/kernel/salinfo.c @@ -572,7 +572,7 @@ static struct file_operations salinfo_da }; #ifdef CONFIG_HOTPLUG_CPU -static int __devinit +static int salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) { unsigned int i, cpu = (unsigned long)hcpu; diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index b47476d..7da4739 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c @@ -429,7 +429,7 @@ static int __cpuinit cache_remove_dev(st * When a cpu is hot-plugged, do a check and initiate * cache kobject if necessary */ -static int __cpuinit cache_cpu_callback(struct notifier_block *nfb, +static int cache_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; diff --git a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S index 3871b65..920bb74 100644 --- a/arch/m32r/kernel/entry.S +++ b/arch/m32r/kernel/entry.S @@ -20,7 +20,7 @@ * Stack layout in 'ret_from_system_call': * ptrace needs to have all regs on the stack. * if the order here is changed, it needs to be - * updated in fork.c:copy_process, signal.c:do_signal, + * updated in fork.c:copy_thread, signal.c:do_signal, * ptrace.c and ptrace.h * * M32Rx/M32R2 M32R @@ -41,18 +41,17 @@ * @(0x38,sp) - syscall_nr ditto * @(0x3c,sp) - acc0h @(0x3c,sp) - acch * @(0x40,sp) - acc0l @(0x40,sp) - accl - * @(0x44,sp) - acc1h @(0x44,sp) - psw - * @(0x48,sp) - acc1l @(0x48,sp) - bpc - * @(0x4c,sp) - psw @(0x4c,sp) - bbpsw - * @(0x50,sp) - bpc @(0x50,sp) - bbpc - * @(0x54,sp) - bbpsw @(0x54,sp) - spu (cr3) - * @(0x58,sp) - bbpc @(0x58,sp) - fp (r13) - * @(0x5c,sp) - spu (cr3) @(0x5c,sp) - lr (r14) - * @(0x60,sp) - fp (r13) @(0x60,sp) - spi (cr12) - * @(0x64,sp) - lr (r14) @(0x64,sp) - orig_r0 - * @(0x68,sp) - spi (cr2) - * @(0x6c,sp) - orig_r0 - * + * @(0x44,sp) - acc1h @(0x44,sp) - dummy_acc1h + * @(0x48,sp) - acc1l @(0x48,sp) - dummy_acc1l + * @(0x4c,sp) - psw ditto + * @(0x50,sp) - bpc ditto + * @(0x54,sp) - bbpsw ditto + * @(0x58,sp) - bbpc ditto + * @(0x5c,sp) - spu (cr3) ditto + * @(0x60,sp) - fp (r13) ditto + * @(0x64,sp) - lr (r14) ditto + * @(0x68,sp) - spi (cr2) ditto + * @(0x6c,sp) - orig_r0 ditto */ #include @@ -102,6 +101,12 @@ #define ACC0L(reg) @(0x40,reg) #define ACC1H(reg) @(0x44,reg) #define ACC1L(reg) @(0x48,reg) +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) +#define ACCH(reg) @(0x3C,reg) +#define ACCL(reg) @(0x40,reg) +#else +#error unknown isa configuration +#endif #define PSW(reg) @(0x4C,reg) #define BPC(reg) @(0x50,reg) #define BBPSW(reg) @(0x54,reg) @@ -111,21 +116,6 @@ #define LR(reg) @(0x64,reg) #define SP(reg) @(0x68,reg) #define ORIG_R0(reg) @(0x6C,reg) -#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) -#define ACCH(reg) @(0x3C,reg) -#define ACCL(reg) @(0x40,reg) -#define PSW(reg) @(0x44,reg) -#define BPC(reg) @(0x48,reg) -#define BBPSW(reg) @(0x4C,reg) -#define BBPC(reg) @(0x50,reg) -#define SPU(reg) @(0x54,reg) -#define FP(reg) @(0x58,reg) /* FP = R13 */ -#define LR(reg) @(0x5C,reg) -#define SP(reg) @(0x60,reg) -#define ORIG_R0(reg) @(0x64,reg) -#else -#error unknown isa configuration -#endif CF_MASK = 0x00000001 TF_MASK = 0x00000100 @@ -142,7 +132,7 @@ VM_MASK = 0x00020000 #endif ENTRY(ret_from_fork) - ld r0, @sp+ + pop r0 bl schedule_tail GET_THREAD_INFO(r8) bra syscall_exit @@ -231,7 +221,7 @@ restore_all: RESTORE_ALL # perform work that needs to be done immediately before resumption - # r9 : frags + # r9 : flags ALIGN work_pending: and3 r4, r9, #_TIF_NEED_RESCHED @@ -320,7 +310,7 @@ ENTRY(ei_handler) ; GET_ICU_STATUS; seth r0, #shigh(M32R_ICU_ISTS_ADDR) ld r0, @(low(M32R_ICU_ISTS_ADDR),r0) - st r0, @-sp + push r0 #if defined(CONFIG_SMP) /* * If IRQ == 0 --> Nothing to do, Not write IMASK @@ -557,7 +547,7 @@ check_end: #endif /* CONFIG_PLAT_M32104UT */ bl do_IRQ #endif /* CONFIG_SMP */ - ld r14, @sp+ + pop r14 seth r0, #shigh(M32R_ICU_IMASK_ADDR) st r14, @(low(M32R_ICU_IMASK_ADDR),r0) #else @@ -1015,4 +1005,3 @@ ENTRY(sys_call_table) .long sys_waitid syscall_table_size=(.-sys_call_table) - diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c index 5dfc7ea..065f5e7 100644 --- a/arch/m32r/kernel/process.c +++ b/arch/m32r/kernel/process.c @@ -116,6 +116,10 @@ void cpu_idle (void) void machine_restart(char *__unused) { +#if defined(CONFIG_PLAT_MAPPI3) + outw(1, (unsigned long)PLD_REBOOT); +#endif + printk("Please push reset button!\n"); while (1) cpu_relax(); diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c index cb33097..6498ee7 100644 --- a/arch/m32r/kernel/signal.c +++ b/arch/m32r/kernel/signal.c @@ -118,6 +118,8 @@ restore_sigcontext(struct pt_regs *regs, #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) COPY(acch); COPY(accl); + COPY(dummy_acc1h); + COPY(dummy_acc1l); #else #error unknown isa configuration #endif @@ -203,6 +205,8 @@ setup_sigcontext(struct sigcontext __use #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) COPY(acch); COPY(accl); + COPY(dummy_acc1h); + COPY(dummy_acc1l); #else #error unknown isa configuration #endif diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 7c953bc..a7d2bb3 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c @@ -356,73 +356,13 @@ asmlinkage int sys32_llseek(unsigned int asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf, size_t count, u32 unused, u64 a4, u64 a5) { - ssize_t ret; - struct file * file; - ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); - loff_t pos; - - ret = -EBADF; - file = fget(fd); - if (!file) - goto bad_file; - if (!(file->f_mode & FMODE_READ)) - goto out; - pos = merge_64(a4, a5); - ret = rw_verify_area(READ, file, &pos, count); - if (ret < 0) - goto out; - ret = -EINVAL; - if (!file->f_op || !(read = file->f_op->read)) - goto out; - if (pos < 0) - goto out; - ret = -ESPIPE; - if (!(file->f_mode & FMODE_PREAD)) - goto out; - ret = read(file, buf, count, &pos); - if (ret > 0) - dnotify_parent(file->f_dentry, DN_ACCESS); -out: - fput(file); -bad_file: - return ret; + return sys_pread64(fd, buf, count, merge_64(a4, a5)); } asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf, size_t count, u32 unused, u64 a4, u64 a5) { - ssize_t ret; - struct file * file; - ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); - loff_t pos; - - ret = -EBADF; - file = fget(fd); - if (!file) - goto bad_file; - if (!(file->f_mode & FMODE_WRITE)) - goto out; - pos = merge_64(a4, a5); - ret = rw_verify_area(WRITE, file, &pos, count); - if (ret < 0) - goto out; - ret = -EINVAL; - if (!file->f_op || !(write = file->f_op->write)) - goto out; - if (pos < 0) - goto out; - - ret = -ESPIPE; - if (!(file->f_mode & FMODE_PWRITE)) - goto out; - - ret = write(file, buf, count, &pos); - if (ret > 0) - dnotify_parent(file->f_dentry, DN_MODIFY); -out: - fput(file); -bad_file: - return ret; + return sys_pwrite64(fd, buf, count, merge_64(a4, a5)); } asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 19f911c..910fb3a 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -138,6 +138,37 @@ config 64BIT enable this option otherwise. The 64bit kernel is significantly bigger and slower than the 32bit one. +choice + prompt "Kernel page size" + default PARISC_PAGE_SIZE_4KB if !64BIT + default PARISC_PAGE_SIZE_4KB if 64BIT +# default PARISC_PAGE_SIZE_16KB if 64BIT + +config PARISC_PAGE_SIZE_4KB + bool "4KB" + help + This lets you select the page size of the kernel. For best + performance, a page size of 16KB is recommended. For best + compatibility with 32bit applications, a page size of 4KB should be + selected (the vast majority of 32bit binaries work perfectly fine + with a larger page size). + + 4KB For best 32bit compatibility + 16KB For best performance + 64KB For best performance, might give more overhead. + + If you don't know what to do, choose 4KB. + +config PARISC_PAGE_SIZE_16KB + bool "16KB (EXPERIMENTAL)" + depends on PA8X00 && EXPERIMENTAL + +config PARISC_PAGE_SIZE_64KB + bool "64KB (EXPERIMENTAL)" + depends on PA8X00 && EXPERIMENTAL + +endchoice + config SMP bool "Symmetric multi-processing support" ---help--- diff --git a/arch/parisc/defconfig b/arch/parisc/defconfig index 59f7bc3..b38b58e 100644 --- a/arch/parisc/defconfig +++ b/arch/parisc/defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.16-pa6 -# Sun Mar 26 19:50:07 2006 +# Linux kernel version: 2.6.16-pa10 +# Sun Apr 2 15:26:38 2006 # CONFIG_PARISC=y CONFIG_MMU=y @@ -25,7 +25,7 @@ CONFIG_LOCALVERSION="" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_SWAP=y CONFIG_SYSVIPC=y -# CONFIG_POSIX_MQUEUE is not set +CONFIG_POSIX_MQUEUE=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y # CONFIG_AUDIT is not set @@ -35,7 +35,7 @@ CONFIG_INITRAMFS_SOURCE="" CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set +CONFIG_KALLSYMS_ALL=y # CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_HOTPLUG=y CONFIG_PRINTK=y @@ -57,7 +57,13 @@ CONFIG_BASE_SMALL=0 # # Loadable module support # -# CONFIG_MODULES is not set +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_OBSOLETE_MODPARM=y +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +CONFIG_KMOD=y # # Block layer @@ -79,16 +85,19 @@ CONFIG_DEFAULT_IOSCHED="anticipatory" # # Processor type and features # -CONFIG_PA7000=y -# CONFIG_PA7100LC is not set +# CONFIG_PA7000 is not set +CONFIG_PA7100LC=y # CONFIG_PA7200 is not set # CONFIG_PA7300LC is not set # CONFIG_PA8X00 is not set CONFIG_PA11=y +CONFIG_PARISC_PAGE_SIZE_4KB=y +# CONFIG_PARISC_PAGE_SIZE_16KB is not set +# CONFIG_PARISC_PAGE_SIZE_64KB is not set # CONFIG_SMP is not set CONFIG_ARCH_FLATMEM_ENABLE=y -CONFIG_PREEMPT_NONE=y -# CONFIG_PREEMPT_VOLUNTARY is not set +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y # CONFIG_PREEMPT is not set # CONFIG_HZ_100 is not set CONFIG_HZ_250=y @@ -108,7 +117,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4096 # Bus options (PCI, PCMCIA, EISA, GSC, ISA) # CONFIG_GSC=y -CONFIG_HPPB=y +# CONFIG_HPPB is not set CONFIG_IOMMU_CCIO=y CONFIG_GSC_LASI=y CONFIG_GSC_WAX=y @@ -126,7 +135,25 @@ CONFIG_IOMMU_SBA=y # # PCCARD (PCMCIA/CardBus) support # -# CONFIG_PCCARD is not set +CONFIG_PCCARD=y +# CONFIG_PCMCIA_DEBUG is not set +CONFIG_PCMCIA=y +CONFIG_PCMCIA_LOAD_CIS=y +CONFIG_PCMCIA_IOCTL=y +CONFIG_CARDBUS=y + +# +# PC-card bridges +# +CONFIG_YENTA=y +CONFIG_YENTA_O2=y +CONFIG_YENTA_RICOH=y +CONFIG_YENTA_TI=y +CONFIG_YENTA_ENE_TUNE=y +CONFIG_YENTA_TOSHIBA=y +CONFIG_PD6729=y +CONFIG_I82092=y +CONFIG_PCCARD_NONSTATIC=y # # PCI Hotplug Support @@ -145,7 +172,7 @@ CONFIG_PDC_STABLE=y # Executable file formats # CONFIG_BINFMT_ELF=y -# CONFIG_BINFMT_MISC is not set +CONFIG_BINFMT_MISC=m # # Networking @@ -159,13 +186,15 @@ CONFIG_NET=y CONFIG_PACKET=y CONFIG_PACKET_MMAP=y CONFIG_UNIX=y -# CONFIG_NET_KEY is not set +CONFIG_XFRM=y +CONFIG_XFRM_USER=m +CONFIG_NET_KEY=m CONFIG_INET=y CONFIG_IP_MULTICAST=y # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_FIB_HASH=y CONFIG_IP_PNP=y -# CONFIG_IP_PNP_DHCP is not set +CONFIG_IP_PNP_DHCP=y CONFIG_IP_PNP_BOOTP=y # CONFIG_IP_PNP_RARP is not set # CONFIG_NET_IPIP is not set @@ -173,19 +202,20 @@ CONFIG_IP_PNP_BOOTP=y # CONFIG_IP_MROUTE is not set # CONFIG_ARPD is not set # CONFIG_SYN_COOKIES is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set +CONFIG_INET_AH=m +CONFIG_INET_ESP=m # CONFIG_INET_IPCOMP is not set -# CONFIG_INET_TUNNEL is not set -# CONFIG_INET_DIAG is not set +CONFIG_INET_TUNNEL=m +CONFIG_INET_DIAG=m +CONFIG_INET_TCP_DIAG=m # CONFIG_TCP_CONG_ADVANCED is not set CONFIG_TCP_CONG_BIC=y CONFIG_IPV6=y # CONFIG_IPV6_PRIVACY is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_INET6_TUNNEL is not set +CONFIG_INET6_AH=y +CONFIG_INET6_ESP=y +CONFIG_INET6_IPCOMP=y +CONFIG_INET6_TUNNEL=y # CONFIG_IPV6_TUNNEL is not set # CONFIG_NETFILTER is not set @@ -207,7 +237,8 @@ CONFIG_IPV6=y # CONFIG_BRIDGE is not set # CONFIG_VLAN_8021Q is not set # CONFIG_DECNET is not set -# CONFIG_LLC2 is not set +CONFIG_LLC=m +CONFIG_LLC2=m # CONFIG_IPX is not set # CONFIG_ATALK is not set # CONFIG_X25 is not set @@ -237,9 +268,9 @@ CONFIG_IPV6=y # # Generic Driver Options # -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -# CONFIG_FW_LOADER is not set +# CONFIG_STANDALONE is not set +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +CONFIG_FW_LOADER=y # CONFIG_DEBUG_DRIVER is not set # @@ -256,13 +287,14 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y # Parallel port support # CONFIG_PARPORT=y -CONFIG_PARPORT_PC=y +CONFIG_PARPORT_PC=m # CONFIG_PARPORT_SERIAL is not set # CONFIG_PARPORT_PC_FIFO is not set # CONFIG_PARPORT_PC_SUPERIO is not set +CONFIG_PARPORT_PC_PCMCIA=m CONFIG_PARPORT_NOT_PC=y CONFIG_PARPORT_GSC=y -# CONFIG_PARPORT_1284 is not set +CONFIG_PARPORT_1284=y # # Plug and Play support @@ -284,7 +316,7 @@ CONFIG_BLK_DEV_CRYPTOLOOP=y # CONFIG_BLK_DEV_UB is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_RAM_SIZE=6144 CONFIG_BLK_DEV_INITRD=y # CONFIG_CDROM_PKTCDVD is not set # CONFIG_ATA_OVER_ETH is not set @@ -292,7 +324,60 @@ CONFIG_BLK_DEV_INITRD=y # # ATA/ATAPI/MFM/RLL support # -# CONFIG_IDE is not set +CONFIG_IDE=y +CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_IDE_SATA is not set +CONFIG_BLK_DEV_IDEDISK=y +CONFIG_IDEDISK_MULTI_MODE=y +CONFIG_BLK_DEV_IDECS=y +CONFIG_BLK_DEV_IDECD=y +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +CONFIG_BLK_DEV_IDESCSI=y +# CONFIG_IDE_TASK_IOCTL is not set + +# +# IDE chipset support/bugfixes +# +CONFIG_IDE_GENERIC=y +CONFIG_BLK_DEV_IDEPCI=y +CONFIG_IDEPCI_SHARE_IRQ=y +# CONFIG_BLK_DEV_OFFBOARD is not set +CONFIG_BLK_DEV_GENERIC=y +# CONFIG_BLK_DEV_OPTI621 is not set +CONFIG_BLK_DEV_IDEDMA_PCI=y +# CONFIG_BLK_DEV_IDEDMA_FORCED is not set +# CONFIG_IDEDMA_PCI_AUTO is not set +# CONFIG_BLK_DEV_AEC62XX is not set +# CONFIG_BLK_DEV_ALI15X3 is not set +# CONFIG_BLK_DEV_AMD74XX is not set +# CONFIG_BLK_DEV_CMD64X is not set +# CONFIG_BLK_DEV_TRIFLEX is not set +# CONFIG_BLK_DEV_CY82C693 is not set +# CONFIG_BLK_DEV_CS5520 is not set +# CONFIG_BLK_DEV_CS5530 is not set +# CONFIG_BLK_DEV_HPT34X is not set +# CONFIG_BLK_DEV_HPT366 is not set +# CONFIG_BLK_DEV_SC1200 is not set +# CONFIG_BLK_DEV_PIIX is not set +# CONFIG_BLK_DEV_IT821X is not set +CONFIG_BLK_DEV_NS87415=y +# CONFIG_BLK_DEV_PDC202XX_OLD is not set +# CONFIG_BLK_DEV_PDC202XX_NEW is not set +# CONFIG_BLK_DEV_SVWKS is not set +# CONFIG_BLK_DEV_SIIMAGE is not set +# CONFIG_BLK_DEV_SLC90E66 is not set +# CONFIG_BLK_DEV_TRM290 is not set +# CONFIG_BLK_DEV_VIA82CXXX is not set +# CONFIG_IDE_ARM is not set +CONFIG_BLK_DEV_IDEDMA=y +# CONFIG_IDEDMA_IVB is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_BLK_DEV_HD is not set # # SCSI device support @@ -375,6 +460,15 @@ CONFIG_SCSI_NCR53C8XX_SYNC=20 # CONFIG_SCSI_DEBUG is not set # +# PCMCIA SCSI adapter support +# +# CONFIG_PCMCIA_AHA152X is not set +# CONFIG_PCMCIA_FDOMAIN is not set +# CONFIG_PCMCIA_NINJA_SCSI is not set +# CONFIG_PCMCIA_QLOGIC is not set +# CONFIG_PCMCIA_SYM53C500 is not set + +# # Multi-device support (RAID and LVM) # CONFIG_MD=y @@ -382,12 +476,17 @@ CONFIG_BLK_DEV_MD=y CONFIG_MD_LINEAR=y CONFIG_MD_RAID0=y CONFIG_MD_RAID1=y -# CONFIG_MD_RAID10 is not set +CONFIG_MD_RAID10=y CONFIG_MD_RAID5=y -# CONFIG_MD_RAID6 is not set +CONFIG_MD_RAID6=y # CONFIG_MD_MULTIPATH is not set # CONFIG_MD_FAULTY is not set -# CONFIG_BLK_DEV_DM is not set +CONFIG_BLK_DEV_DM=y +# CONFIG_DM_CRYPT is not set +# CONFIG_DM_SNAPSHOT is not set +# CONFIG_DM_MIRROR is not set +# CONFIG_DM_ZERO is not set +# CONFIG_DM_MULTIPATH is not set # # Fusion MPT device support @@ -411,10 +510,10 @@ CONFIG_MD_RAID5=y # Network device support # CONFIG_NETDEVICES=y -# CONFIG_DUMMY is not set -# CONFIG_BONDING is not set +CONFIG_DUMMY=m +CONFIG_BONDING=m # CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set +CONFIG_TUN=m # # ARCnet devices @@ -430,7 +529,7 @@ CONFIG_NETDEVICES=y # Ethernet (10 or 100Mbit) # CONFIG_NET_ETHERNET=y -# CONFIG_MII is not set +CONFIG_MII=m CONFIG_LASI_82596=y # CONFIG_HAPPYMEAL is not set # CONFIG_SUNGEM is not set @@ -451,6 +550,8 @@ CONFIG_TULIP=y # CONFIG_WINBOND_840 is not set # CONFIG_DM9102 is not set # CONFIG_ULI526X is not set +# CONFIG_PCMCIA_XIRCOM is not set +# CONFIG_PCMCIA_XIRTULIP is not set # CONFIG_DEPCA is not set # CONFIG_HP100 is not set CONFIG_NET_PCI=y @@ -518,14 +619,33 @@ CONFIG_NET_RADIO=y # Obsolete Wireless cards support (pre-802.11) # # CONFIG_STRIP is not set +# CONFIG_PCMCIA_WAVELAN is not set +# CONFIG_PCMCIA_NETWAVE is not set + +# +# Wireless 802.11 Frequency Hopping cards support +# +# CONFIG_PCMCIA_RAYCS is not set # # Wireless 802.11b ISA/PCI cards support # -# CONFIG_HERMES is not set +CONFIG_HERMES=y +# CONFIG_PLX_HERMES is not set +# CONFIG_TMD_HERMES is not set +# CONFIG_NORTEL_HERMES is not set +# CONFIG_PCI_HERMES is not set # CONFIG_ATMEL is not set # +# Wireless 802.11b Pcmcia/Cardbus cards support +# +CONFIG_PCMCIA_HERMES=y +CONFIG_PCMCIA_SPECTRUM=y +# CONFIG_AIRO_CS is not set +# CONFIG_PCMCIA_WL3501 is not set + +# # Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support # # CONFIG_PRISM54 is not set @@ -533,13 +653,34 @@ CONFIG_NET_RADIO=y CONFIG_NET_WIRELESS=y # +# PCMCIA network device support +# +CONFIG_NET_PCMCIA=y +# CONFIG_PCMCIA_3C589 is not set +# CONFIG_PCMCIA_3C574 is not set +# CONFIG_PCMCIA_FMVJ18X is not set +# CONFIG_PCMCIA_PCNET is not set +# CONFIG_PCMCIA_NMCLAN is not set +# CONFIG_PCMCIA_SMC91C92 is not set +# CONFIG_PCMCIA_XIRC2PS is not set +# CONFIG_PCMCIA_AXNET is not set + +# # Wan interfaces # # CONFIG_WAN is not set # CONFIG_FDDI is not set # CONFIG_HIPPI is not set # CONFIG_PLIP is not set -# CONFIG_PPP is not set +CONFIG_PPP=m +# CONFIG_PPP_MULTILINK is not set +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_ASYNC=m +CONFIG_PPP_SYNC_TTY=m +CONFIG_PPP_DEFLATE=m +CONFIG_PPP_BSDCOMP=m +# CONFIG_PPP_MPPE is not set +CONFIG_PPPOE=m # CONFIG_SLIP is not set # CONFIG_NET_FC is not set # CONFIG_SHAPER is not set @@ -571,14 +712,16 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 # CONFIG_INPUT_JOYDEV is not set # CONFIG_INPUT_TSDEV is not set -CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVDEV is not set # CONFIG_INPUT_EVBUG is not set # # Input Device Drivers # CONFIG_INPUT_KEYBOARD=y -# CONFIG_KEYBOARD_ATKBD is not set +CONFIG_KEYBOARD_ATKBD=y +CONFIG_KEYBOARD_ATKBD_HP_KEYCODES=y +# CONFIG_KEYBOARD_ATKBD_RDI_KEYCODES is not set # CONFIG_KEYBOARD_SUNKBD is not set # CONFIG_KEYBOARD_LKKBD is not set # CONFIG_KEYBOARD_XTKBD is not set @@ -586,52 +729,25 @@ CONFIG_INPUT_KEYBOARD=y # CONFIG_KEYBOARD_HIL_OLD is not set CONFIG_KEYBOARD_HIL=y CONFIG_INPUT_MOUSE=y -# CONFIG_MOUSE_PS2 is not set -# CONFIG_MOUSE_SERIAL is not set +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_SERIAL=y # CONFIG_MOUSE_VSXXXAA is not set CONFIG_MOUSE_HIL=y -CONFIG_INPUT_JOYSTICK=y -# CONFIG_JOYSTICK_ANALOG is not set -# CONFIG_JOYSTICK_A3D is not set -# CONFIG_JOYSTICK_ADI is not set -# CONFIG_JOYSTICK_COBRA is not set -# CONFIG_JOYSTICK_GF2K is not set -# CONFIG_JOYSTICK_GRIP is not set -# CONFIG_JOYSTICK_GRIP_MP is not set -# CONFIG_JOYSTICK_GUILLEMOT is not set -# CONFIG_JOYSTICK_INTERACT is not set -# CONFIG_JOYSTICK_SIDEWINDER is not set -# CONFIG_JOYSTICK_TMDC is not set -# CONFIG_JOYSTICK_IFORCE is not set -# CONFIG_JOYSTICK_WARRIOR is not set -# CONFIG_JOYSTICK_MAGELLAN is not set -# CONFIG_JOYSTICK_SPACEORB is not set -# CONFIG_JOYSTICK_SPACEBALL is not set -# CONFIG_JOYSTICK_STINGER is not set -# CONFIG_JOYSTICK_TWIDJOY is not set -# CONFIG_JOYSTICK_DB9 is not set -# CONFIG_JOYSTICK_GAMECON is not set -# CONFIG_JOYSTICK_TURBOGRAFX is not set -# CONFIG_JOYSTICK_JOYDUMP is not set -CONFIG_INPUT_TOUCHSCREEN=y -# CONFIG_TOUCHSCREEN_GUNZE is not set -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_UINPUT is not set -CONFIG_HP_SDC_RTC=y +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set # # Hardware I/O ports # CONFIG_SERIO=y -# CONFIG_SERIO_SERPORT is not set +CONFIG_SERIO_SERPORT=y # CONFIG_SERIO_PARKBD is not set CONFIG_SERIO_GSCPS2=y CONFIG_HP_SDC=y CONFIG_HIL_MLC=y # CONFIG_SERIO_PCIPS2 is not set +CONFIG_SERIO_LIBPS2=y # CONFIG_SERIO_RAW is not set # CONFIG_GAMEPORT is not set @@ -648,7 +764,8 @@ CONFIG_HW_CONSOLE=y # CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_NR_UARTS=13 +CONFIG_SERIAL_8250_CS=y +CONFIG_SERIAL_8250_NR_UARTS=17 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 CONFIG_SERIAL_8250_EXTENDED=y CONFIG_SERIAL_8250_MANY_PORTS=y @@ -666,10 +783,10 @@ CONFIG_SERIAL_CORE_CONSOLE=y # CONFIG_SERIAL_JSM is not set CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y -CONFIG_LEGACY_PTY_COUNT=256 -CONFIG_PRINTER=y +CONFIG_LEGACY_PTY_COUNT=64 +CONFIG_PRINTER=m # CONFIG_LP_CONSOLE is not set -# CONFIG_PPDEV is not set +CONFIG_PPDEV=m # CONFIG_TIPAR is not set # @@ -682,7 +799,7 @@ CONFIG_PRINTER=y # # CONFIG_WATCHDOG is not set CONFIG_GEN_RTC=y -# CONFIG_GEN_RTC_X is not set +CONFIG_GEN_RTC_X=y # CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_APPLICOM is not set @@ -691,6 +808,13 @@ CONFIG_GEN_RTC=y # Ftape, the floppy tape device driver # # CONFIG_DRM is not set + +# +# PCMCIA character devices +# +# CONFIG_SYNCLINK_CS is not set +# CONFIG_CARDMAN_4000 is not set +# CONFIG_CARDMAN_4040 is not set # CONFIG_RAW_DRIVER is not set # @@ -718,10 +842,8 @@ CONFIG_GEN_RTC=y # # Hardware Monitoring support # -CONFIG_HWMON=y +# CONFIG_HWMON is not set # CONFIG_HWMON_VID is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_HWMON_DEBUG_CHIP is not set # # Misc devices @@ -749,8 +871,8 @@ CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_IMAGEBLIT=y # CONFIG_FB_MACMODES is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_TILEBLITTING is not set +CONFIG_FB_MODE_HELPERS=y +CONFIG_FB_TILEBLITTING=y # CONFIG_FB_CIRRUS is not set # CONFIG_FB_PM2 is not set # CONFIG_FB_CYBER2000 is not set @@ -778,8 +900,8 @@ CONFIG_FB_STI=y # Console display driver support # CONFIG_DUMMY_CONSOLE=y -CONFIG_DUMMY_CONSOLE_COLUMNS=160 -CONFIG_DUMMY_CONSOLE_ROWS=64 +CONFIG_DUMMY_CONSOLE_COLUMNS=128 +CONFIG_DUMMY_CONSOLE_ROWS=48 CONFIG_FRAMEBUFFER_CONSOLE=y # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set CONFIG_STI_CONSOLE=y @@ -816,13 +938,14 @@ CONFIG_SOUND=y CONFIG_SND=y CONFIG_SND_TIMER=y CONFIG_SND_PCM=y +CONFIG_SND_HWDEP=y CONFIG_SND_SEQUENCER=y # CONFIG_SND_SEQ_DUMMY is not set CONFIG_SND_OSSEMUL=y CONFIG_SND_MIXER_OSS=y CONFIG_SND_PCM_OSS=y CONFIG_SND_SEQUENCER_OSS=y -# CONFIG_SND_DYNAMIC_MINORS is not set +CONFIG_SND_DYNAMIC_MINORS=y CONFIG_SND_SUPPORT_OLD_API=y # CONFIG_SND_VERBOSE_PRINTK is not set # CONFIG_SND_DEBUG is not set @@ -830,6 +953,7 @@ CONFIG_SND_SUPPORT_OLD_API=y # # Generic devices # +CONFIG_SND_OPL3_LIB=y CONFIG_SND_AC97_CODEC=y CONFIG_SND_AC97_BUS=y # CONFIG_SND_DUMMY is not set @@ -842,7 +966,7 @@ CONFIG_SND_AC97_BUS=y # PCI devices # CONFIG_SND_AD1889=y -# CONFIG_SND_AD1889_OPL3 is not set +CONFIG_SND_AD1889_OPL3=y # CONFIG_SND_ALI5451 is not set # CONFIG_SND_ATIIXP is not set # CONFIG_SND_ATIIXP_MODEM is not set @@ -890,6 +1014,10 @@ CONFIG_SND_AD1889=y # CONFIG_SND_USB_AUDIO is not set # +# PCMCIA devices +# + +# # GSC devices # CONFIG_SND_HARMONY=y @@ -905,12 +1033,12 @@ CONFIG_SND_HARMONY=y CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB_ARCH_HAS_OHCI=y CONFIG_USB=y -CONFIG_USB_DEBUG=y +# CONFIG_USB_DEBUG is not set # # Miscellaneous USB options # -# CONFIG_USB_DEVICEFS is not set +CONFIG_USB_DEVICEFS=y # CONFIG_USB_BANDWIDTH is not set # CONFIG_USB_DYNAMIC_MINORS is not set # CONFIG_USB_OTG is not set @@ -918,14 +1046,12 @@ CONFIG_USB_DEBUG=y # # USB Host Controller Drivers # -CONFIG_USB_EHCI_HCD=y -# CONFIG_USB_EHCI_SPLIT_ISO is not set -# CONFIG_USB_EHCI_ROOT_HUB_TT is not set +# CONFIG_USB_EHCI_HCD is not set # CONFIG_USB_ISP116X_HCD is not set CONFIG_USB_OHCI_HCD=y # CONFIG_USB_OHCI_BIG_ENDIAN is not set CONFIG_USB_OHCI_LITTLE_ENDIAN=y -# CONFIG_USB_UHCI_HCD is not set +CONFIG_USB_UHCI_HCD=y # CONFIG_USB_SL811_HCD is not set # @@ -948,13 +1074,11 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y # # USB Input Devices # -# CONFIG_USB_HID is not set - -# -# USB HID Boot Protocol drivers -# -# CONFIG_USB_KBD is not set -# CONFIG_USB_MOUSE is not set +CONFIG_USB_HID=y +CONFIG_USB_HIDINPUT=y +# CONFIG_USB_HIDINPUT_POWERBOOK is not set +# CONFIG_HID_FF is not set +# CONFIG_USB_HIDDEV is not set # CONFIG_USB_AIPTEK is not set # CONFIG_USB_WACOM is not set # CONFIG_USB_ACECAD is not set @@ -1020,8 +1144,8 @@ CONFIG_USB_MON=y # CONFIG_USB_PHIDGETKIT is not set # CONFIG_USB_PHIDGETSERVO is not set # CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_SISUSBVGA is not set # CONFIG_USB_LD is not set +# CONFIG_USB_TEST is not set # # USB DSL modem support @@ -1058,7 +1182,7 @@ CONFIG_JBD=y # CONFIG_JBD_DEBUG is not set # CONFIG_REISERFS_FS is not set # CONFIG_JFS_FS is not set -# CONFIG_FS_POSIX_ACL is not set +CONFIG_FS_POSIX_ACL=y # CONFIG_XFS_FS is not set # CONFIG_OCFS2_FS is not set # CONFIG_MINIX_FS is not set @@ -1066,7 +1190,7 @@ CONFIG_JBD=y CONFIG_INOTIFY=y # CONFIG_QUOTA is not set CONFIG_DNOTIFY=y -# CONFIG_AUTOFS_FS is not set +CONFIG_AUTOFS_FS=y # CONFIG_AUTOFS4_FS is not set # CONFIG_FUSE_FS is not set @@ -1081,8 +1205,11 @@ CONFIG_JOLIET=y # # DOS/FAT/NT Filesystems # +CONFIG_FAT_FS=y # CONFIG_MSDOS_FS is not set -# CONFIG_VFAT_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" # CONFIG_NTFS_FS is not set # @@ -1125,7 +1252,7 @@ CONFIG_NFS_V3=y CONFIG_NFSD=y CONFIG_NFSD_V3=y # CONFIG_NFSD_V3_ACL is not set -# CONFIG_NFSD_V4 is not set +CONFIG_NFSD_V4=y CONFIG_NFSD_TCP=y CONFIG_ROOT_NFS=y CONFIG_LOCKD=y @@ -1133,10 +1260,16 @@ CONFIG_LOCKD_V4=y CONFIG_EXPORTFS=y CONFIG_NFS_COMMON=y CONFIG_SUNRPC=y -# CONFIG_RPCSEC_GSS_KRB5 is not set -# CONFIG_RPCSEC_GSS_SPKM3 is not set -# CONFIG_SMB_FS is not set -# CONFIG_CIFS is not set +CONFIG_SUNRPC_GSS=y +CONFIG_RPCSEC_GSS_KRB5=y +CONFIG_RPCSEC_GSS_SPKM3=m +CONFIG_SMB_FS=m +CONFIG_SMB_NLS_DEFAULT=y +CONFIG_SMB_NLS_REMOTE="cp437" +CONFIG_CIFS=m +# CONFIG_CIFS_STATS is not set +# CONFIG_CIFS_XATTR is not set +# CONFIG_CIFS_EXPERIMENTAL is not set # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set @@ -1153,50 +1286,50 @@ CONFIG_MSDOS_PARTITION=y # CONFIG_NLS=y CONFIG_NLS_DEFAULT="iso8859-1" -# CONFIG_NLS_CODEPAGE_437 is not set -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_ASCII is not set -# CONFIG_NLS_ISO8859_1 is not set -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_UTF8 is not set +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_CODEPAGE_737=m +CONFIG_NLS_CODEPAGE_775=m +CONFIG_NLS_CODEPAGE_850=m +CONFIG_NLS_CODEPAGE_852=m +CONFIG_NLS_CODEPAGE_855=m +CONFIG_NLS_CODEPAGE_857=m +CONFIG_NLS_CODEPAGE_860=m +CONFIG_NLS_CODEPAGE_861=m +CONFIG_NLS_CODEPAGE_862=m +CONFIG_NLS_CODEPAGE_863=m +CONFIG_NLS_CODEPAGE_864=m +CONFIG_NLS_CODEPAGE_865=m +CONFIG_NLS_CODEPAGE_866=m +CONFIG_NLS_CODEPAGE_869=m +CONFIG_NLS_CODEPAGE_936=m +CONFIG_NLS_CODEPAGE_950=m +CONFIG_NLS_CODEPAGE_932=m +CONFIG_NLS_CODEPAGE_949=m +CONFIG_NLS_CODEPAGE_874=m +CONFIG_NLS_ISO8859_8=m +CONFIG_NLS_CODEPAGE_1250=y +CONFIG_NLS_CODEPAGE_1251=m +CONFIG_NLS_ASCII=m +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_ISO8859_2=m +CONFIG_NLS_ISO8859_3=m +CONFIG_NLS_ISO8859_4=m +CONFIG_NLS_ISO8859_5=m +CONFIG_NLS_ISO8859_6=m +CONFIG_NLS_ISO8859_7=m +CONFIG_NLS_ISO8859_9=m +CONFIG_NLS_ISO8859_13=m +CONFIG_NLS_ISO8859_14=m +CONFIG_NLS_ISO8859_15=m +CONFIG_NLS_KOI8_R=m +CONFIG_NLS_KOI8_U=m +CONFIG_NLS_UTF8=y # # Profiling support # CONFIG_PROFILING=y -CONFIG_OPROFILE=y +CONFIG_OPROFILE=m # # Kernel hacking @@ -1204,7 +1337,7 @@ CONFIG_OPROFILE=y # CONFIG_PRINTK_TIME is not set CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_KERNEL=y -CONFIG_LOG_BUF_SHIFT=15 +CONFIG_LOG_BUF_SHIFT=16 CONFIG_DETECT_SOFTLOCKUP=y # CONFIG_SCHEDSTATS is not set # CONFIG_DEBUG_SLAB is not set @@ -1217,42 +1350,43 @@ CONFIG_DEBUG_MUTEXES=y # CONFIG_DEBUG_VM is not set CONFIG_FORCED_INLINING=y # CONFIG_RCU_TORTURE_TEST is not set -CONFIG_DEBUG_RODATA=y +# CONFIG_DEBUG_RODATA is not set # # Security options # -# CONFIG_KEYS is not set +CONFIG_KEYS=y +CONFIG_KEYS_DEBUG_PROC_KEYS=y # CONFIG_SECURITY is not set # # Cryptographic options # CONFIG_CRYPTO=y -# CONFIG_CRYPTO_HMAC is not set -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_MD4 is not set -# CONFIG_CRYPTO_MD5 is not set -# CONFIG_CRYPTO_SHA1 is not set -# CONFIG_CRYPTO_SHA256 is not set -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_WP512 is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_DES is not set -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_TWOFISH is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_AES is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_ARC4 is not set -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_ANUBIS is not set -# CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_CRC32C is not set -# CONFIG_CRYPTO_TEST is not set +CONFIG_CRYPTO_HMAC=y +CONFIG_CRYPTO_NULL=m +CONFIG_CRYPTO_MD4=m +CONFIG_CRYPTO_MD5=y +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA256=m +CONFIG_CRYPTO_SHA512=m +CONFIG_CRYPTO_WP512=m +CONFIG_CRYPTO_TGR192=m +CONFIG_CRYPTO_DES=y +CONFIG_CRYPTO_BLOWFISH=m +CONFIG_CRYPTO_TWOFISH=m +CONFIG_CRYPTO_SERPENT=m +CONFIG_CRYPTO_AES=m +CONFIG_CRYPTO_CAST5=m +CONFIG_CRYPTO_CAST6=m +CONFIG_CRYPTO_TEA=m +CONFIG_CRYPTO_ARC4=m +CONFIG_CRYPTO_KHAZAD=m +CONFIG_CRYPTO_ANUBIS=m +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_MICHAEL_MIC=m +CONFIG_CRYPTO_CRC32C=m +CONFIG_CRYPTO_TEST=m # # Hardware crypto devices @@ -1261,7 +1395,9 @@ CONFIG_CRYPTO=y # # Library routines # -# CONFIG_CRC_CCITT is not set +CONFIG_CRC_CCITT=m # CONFIG_CRC16 is not set CONFIG_CRC32=y -# CONFIG_LIBCRC32C is not set +CONFIG_LIBCRC32C=m +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y diff --git a/arch/parisc/kernel/asm-offsets.c b/arch/parisc/kernel/asm-offsets.c index e23c4e1..c11a5bc 100644 --- a/arch/parisc/kernel/asm-offsets.c +++ b/arch/parisc/kernel/asm-offsets.c @@ -288,8 +288,11 @@ int main(void) DEFINE(ASM_PGD_ENTRY_SIZE, PGD_ENTRY_SIZE); DEFINE(ASM_PMD_ENTRY_SIZE, PMD_ENTRY_SIZE); DEFINE(ASM_PTE_ENTRY_SIZE, PTE_ENTRY_SIZE); + DEFINE(ASM_PFN_PTE_SHIFT, PFN_PTE_SHIFT); DEFINE(ASM_PT_INITIAL, PT_INITIAL); DEFINE(ASM_PAGE_SIZE, PAGE_SIZE); + DEFINE(ASM_PAGE_SIZE_DIV64, PAGE_SIZE/64); + DEFINE(ASM_PAGE_SIZE_DIV128, PAGE_SIZE/128); BLANK(); DEFINE(EXCDATA_IP, offsetof(struct exception_data, fault_ip)); DEFINE(EXCDATA_SPACE, offsetof(struct exception_data, fault_space)); diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index 360b739..c057ad7 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -4,7 +4,7 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 1999 Helge Deller (07-13-1999) + * Copyright (C) 1999-2006 Helge Deller (07-13-1999) * Copyright (C) 1999 SuSE GmbH Nuernberg * Copyright (C) 2000 Philipp Rumpf (prumpf@tux.org) * @@ -358,5 +358,5 @@ void parisc_setup_cache_timing(void) if (!parisc_cache_flush_threshold) parisc_cache_flush_threshold = FLUSH_THRESHOLD; - printk("Setting cache flush threshold to %x (%d CPUs online)\n", parisc_cache_flush_threshold, num_online_cpus()); + printk(KERN_INFO "Setting cache flush threshold to %x (%d CPUs online)\n", parisc_cache_flush_threshold, num_online_cpus()); } diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S index 7c95d76..d9e53cf 100644 --- a/arch/parisc/kernel/entry.S +++ b/arch/parisc/kernel/entry.S @@ -502,18 +502,20 @@ * all ILP32 processes and all the kernel for machines with * under 4GB of memory) */ .macro L3_ptep pgd,pte,index,va,fault +#if PT_NLEVELS == 3 /* we might have a 2-Level scheme, e.g. with 16kb page size */ extrd,u \va,63-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index copy %r0,\pte - extrd,u,*= \va,31,32,%r0 + extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0 ldw,s \index(\pgd),\pgd - extrd,u,*= \va,31,32,%r0 + extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0 bb,>=,n \pgd,_PxD_PRESENT_BIT,\fault - extrd,u,*= \va,31,32,%r0 + extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0 shld \pgd,PxD_VALUE_SHIFT,\index - extrd,u,*= \va,31,32,%r0 + extrd,u,*= \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0 copy \index,\pgd - extrd,u,*<> \va,31,32,%r0 + extrd,u,*<> \va,63-ASM_PGDIR_SHIFT,64-ASM_PGDIR_SHIFT,%r0 ldo ASM_PGD_PMD_OFFSET(\pgd),\pgd +#endif L2_ptep \pgd,\pte,\index,\va,\fault .endm @@ -563,10 +565,18 @@ extrd,u,*= \pte,_PAGE_GATEWAY_BIT+32,1,%r0 depd %r0,11,2,\prot /* If Gateway, Set PL2 to 0 */ - /* Get rid of prot bits and convert to page addr for iitlbt and idtlbt */ + /* Enforce uncacheable pages. + * This should ONLY be use for MMIO on PA 2.0 machines. + * Memory/DMA is cache coherent on all PA2.0 machines we support + * (that means T-class is NOT supported) and the memory controllers + * on most of those machines only handles cache transactions. + */ + extrd,u,*= \pte,_PAGE_NO_CACHE_BIT+32,1,%r0 + depi 1,12,1,\prot - depd %r0,63,PAGE_SHIFT,\pte - extrd,s \pte,(63-PAGE_SHIFT)+(63-58),64-PAGE_SHIFT,\pte + /* Drop prot bits and convert to page addr for iitlbt and idtlbt */ + extrd,u \pte,(63-ASM_PFN_PTE_SHIFT)+(63-58),64-PAGE_SHIFT,\pte + depdi _PAGE_SIZE_ENCODING_DEFAULT,63,63-58,\pte .endm /* Identical macro to make_insert_tlb above, except it @@ -584,9 +594,8 @@ /* Get rid of prot bits and convert to page addr for iitlba */ - depi 0,31,PAGE_SHIFT,\pte + depi _PAGE_SIZE_ENCODING_DEFAULT,31,ASM_PFN_PTE_SHIFT,\pte extru \pte,24,25,\pte - .endm /* This is for ILP32 PA2.0 only. The TLB insertion needs @@ -1201,10 +1210,9 @@ intr_save: */ /* adjust isr/ior. */ - - extrd,u %r16,63,7,%r1 /* get high bits from isr for ior */ - depd %r1,31,7,%r17 /* deposit them into ior */ - depdi 0,63,7,%r16 /* clear them from isr */ + extrd,u %r16,63,SPACEID_SHIFT,%r1 /* get high bits from isr for ior */ + depd %r1,31,SPACEID_SHIFT,%r17 /* deposit them into ior */ + depdi 0,63,SPACEID_SHIFT,%r16 /* clear them from isr */ #endif STREG %r16, PT_ISR(%r29) STREG %r17, PT_IOR(%r29) diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S index 0b47afc..3e79e62 100644 --- a/arch/parisc/kernel/head.S +++ b/arch/parisc/kernel/head.S @@ -76,16 +76,16 @@ $bss_loop: mtctl %r4,%cr24 /* Initialize kernel root pointer */ mtctl %r4,%cr25 /* Initialize user root pointer */ -#ifdef CONFIG_64BIT +#if PT_NLEVELS == 3 /* Set pmd in pgd */ load32 PA(pmd0),%r5 shrd %r5,PxD_VALUE_SHIFT,%r3 - ldo (PxD_FLAG_PRESENT+PxD_FLAG_VALID)(%r3),%r3 + ldo (PxD_FLAG_PRESENT+PxD_FLAG_VALID)(%r3),%r3 stw %r3,ASM_PGD_ENTRY*ASM_PGD_ENTRY_SIZE(%r4) ldo ASM_PMD_ENTRY*ASM_PMD_ENTRY_SIZE(%r5),%r4 #else /* 2-level page table, so pmd == pgd */ - ldo ASM_PGD_ENTRY*ASM_PGD_ENTRY_SIZE(%r4),%r4 + ldo ASM_PGD_ENTRY*ASM_PGD_ENTRY_SIZE(%r4),%r4 #endif /* Fill in pmd with enough pte directories */ @@ -99,7 +99,7 @@ $bss_loop: stw %r3,0(%r4) ldo (ASM_PAGE_SIZE >> PxD_VALUE_SHIFT)(%r3),%r3 addib,> -1,%r1,1b -#ifdef CONFIG_64BIT +#if PT_NLEVELS == 3 ldo ASM_PMD_ENTRY_SIZE(%r4),%r4 #else ldo ASM_PGD_ENTRY_SIZE(%r4),%r4 @@ -107,13 +107,14 @@ $bss_loop: /* Now initialize the PTEs themselves */ - ldo _PAGE_KERNEL(%r0),%r3 /* Hardwired 0 phys addr start */ + ldo 0+_PAGE_KERNEL(%r0),%r3 /* Hardwired 0 phys addr start */ + ldi (1<<(KERNEL_INITIAL_ORDER-PAGE_SHIFT)),%r11 /* PFN count */ load32 PA(pg0),%r1 $pgt_fill_loop: STREGM %r3,ASM_PTE_ENTRY_SIZE(%r1) - ldo ASM_PAGE_SIZE(%r3),%r3 - bb,>= %r3,31-KERNEL_INITIAL_ORDER,$pgt_fill_loop + ldo (1< -1,%r11,$pgt_fill_loop nop /* Load the return address...er...crash 'n burn */ diff --git a/arch/parisc/kernel/init_task.c b/arch/parisc/kernel/init_task.c index 7e898fd..8384bf9 100644 --- a/arch/parisc/kernel/init_task.c +++ b/arch/parisc/kernel/init_task.c @@ -53,17 +53,17 @@ union thread_union init_thread_union __attribute__((aligned(128))) __attribute__((__section__(".data.init_task"))) = { INIT_THREAD_INFO(init_task) }; -#ifdef __LP64__ +#if PT_NLEVELS == 3 /* NOTE: This layout exactly conforms to the hybrid L2/L3 page table layout * with the first pmd adjacent to the pgd and below it. gcc doesn't actually * guarantee that global objects will be laid out in memory in the same order * as the order of declaration, so put these in different sections and use * the linker script to order them. */ -pmd_t pmd0[PTRS_PER_PMD] __attribute__ ((aligned(PAGE_SIZE))) __attribute__ ((__section__ (".data.vm0.pmd"))) = { {0}, }; - +pmd_t pmd0[PTRS_PER_PMD] __attribute__ ((__section__ (".data.vm0.pmd"), aligned(PAGE_SIZE))); #endif -pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((aligned(PAGE_SIZE))) __attribute__ ((__section__ (".data.vm0.pgd"))) = { {0}, }; -pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((aligned(PAGE_SIZE))) __attribute__ ((__section__ (".data.vm0.pte"))) = { {0}, }; + +pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((__section__ (".data.vm0.pgd"), aligned(PAGE_SIZE))); +pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((__section__ (".data.vm0.pte"), aligned(PAGE_SIZE))); /* * Initial task structure. diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S index 7a4f07e..f600556 100644 --- a/arch/parisc/kernel/pacache.S +++ b/arch/parisc/kernel/pacache.S @@ -65,7 +65,7 @@ flush_tlb_all_local: */ /* pcxt_ssm_bug - relied upon translation! PA 2.0 Arch. F-4 and F-5 */ - rsm PSW_SM_I, %r19 /* save I-bit state */ + rsm PSW_SM_I, %r19 /* save I-bit state */ load32 PA(1f), %r1 nop nop @@ -84,8 +84,7 @@ flush_tlb_all_local: rfi nop -1: ldil L%PA(cache_info), %r1 - ldo R%PA(cache_info)(%r1), %r1 +1: load32 PA(cache_info), %r1 /* Flush Instruction Tlb */ @@ -212,8 +211,7 @@ flush_instruction_cache_local: .entry mtsp %r0, %sr1 - ldil L%cache_info, %r1 - ldo R%cache_info(%r1), %r1 + load32 cache_info, %r1 /* Flush Instruction Cache */ @@ -254,8 +252,7 @@ flush_data_cache_local: .entry mtsp %r0, %sr1 - ldil L%cache_info, %r1 - ldo R%cache_info(%r1), %r1 + load32 cache_info, %r1 /* Flush Data Cache */ @@ -303,7 +300,8 @@ copy_user_page_asm: */ ldd 0(%r25), %r19 - ldi 32, %r1 /* PAGE_SIZE/128 == 32 */ + ldi ASM_PAGE_SIZE_DIV128, %r1 + ldw 64(%r25), %r0 /* prefetch 1 cacheline ahead */ ldw 128(%r25), %r0 /* prefetch 2 */ @@ -368,7 +366,7 @@ copy_user_page_asm: * use ldd/std on a 32 bit kernel. */ ldw 0(%r25), %r19 - ldi 64, %r1 /* PAGE_SIZE/64 == 64 */ + ldi ASM_PAGE_SIZE_DIV64, %r1 1: ldw 4(%r25), %r20 @@ -461,6 +459,7 @@ copy_user_page_asm: sub %r25, %r1, %r23 /* move physical addr into non shadowed reg */ ldil L%(TMPALIAS_MAP_START), %r28 + /* FIXME for different page sizes != 4k */ #ifdef CONFIG_64BIT extrd,u %r26,56,32, %r26 /* convert phys addr to tlb insert format */ extrd,u %r23,56,32, %r23 /* convert phys addr to tlb insert format */ @@ -551,6 +550,7 @@ __clear_user_page_asm: #ifdef CONFIG_64BIT #if (TMPALIAS_MAP_START >= 0x80000000) depdi 0, 31,32, %r28 /* clear any sign extension */ + /* FIXME: page size dependend */ #endif extrd,u %r26, 56,32, %r26 /* convert phys addr to tlb insert format */ depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */ @@ -566,10 +566,10 @@ __clear_user_page_asm: pdtlb 0(%r28) #ifdef CONFIG_64BIT - ldi 32, %r1 /* PAGE_SIZE/128 == 32 */ + ldi ASM_PAGE_SIZE_DIV128, %r1 /* PREFETCH (Write) has not (yet) been proven to help here */ -/* #define PREFETCHW_OP ldd 256(%0), %r0 */ + /* #define PREFETCHW_OP ldd 256(%0), %r0 */ 1: std %r0, 0(%r28) std %r0, 8(%r28) @@ -591,8 +591,7 @@ __clear_user_page_asm: ldo 128(%r28), %r28 #else /* ! CONFIG_64BIT */ - - ldi 64, %r1 /* PAGE_SIZE/64 == 64 */ + ldi ASM_PAGE_SIZE_DIV64, %r1 1: stw %r0, 0(%r28) diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index d15a1d5..8b5df98 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c @@ -231,6 +231,14 @@ asmlinkage long parisc_fadvise64_64(int (loff_t)high_len << 32 | low_len, advice); } +asmlinkage long parisc_sync_file_range(int fd, + u32 hi_off, u32 lo_off, u32 hi_nbytes, u32 lo_nbytes, + unsigned int flags) +{ + return sys_sync_file_range(fd, (loff_t)hi_off << 32 | lo_off, + (loff_t)hi_nbytes << 32 | lo_nbytes, flags); +} + asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr, unsigned long len, int prot, int flag) { return -ENOMEM; diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S index af88afe..479d9a0 100644 --- a/arch/parisc/kernel/syscall.S +++ b/arch/parisc/kernel/syscall.S @@ -55,7 +55,7 @@ * pointers. */ - .align 4096 + .align ASM_PAGE_SIZE linux_gateway_page: /* ADDRESS 0x00 to 0xb0 = 176 bytes / 4 bytes per insn = 44 insns */ @@ -632,7 +632,7 @@ cas_action: end_compare_and_swap: /* Make sure nothing else is placed on this page */ - .align 4096 + .align ASM_PAGE_SIZE .export end_linux_gateway_page end_linux_gateway_page: @@ -652,7 +652,7 @@ end_linux_gateway_page: .section .rodata,"a" - .align 4096 + .align ASM_PAGE_SIZE /* Light-weight-syscall table */ /* Start of lws table. */ .export lws_table @@ -662,14 +662,14 @@ lws_table: LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic compare and swap */ /* End of lws table */ - .align 4096 + .align ASM_PAGE_SIZE .export sys_call_table .Lsys_call_table: sys_call_table: #include "syscall_table.S" #ifdef CONFIG_64BIT - .align 4096 + .align ASM_PAGE_SIZE .export sys_call_table64 .Lsys_call_table64: sys_call_table64: diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index bbeeb61..e27b432 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S @@ -13,7 +13,7 @@ * Copyright (C) 2001 Helge Deller * Copyright (C) 2000-2001 Thomas Bogendoerfer * Copyright (C) 2002 Randolph Chung - * + * Copyright (C) 2005-2006 Kyle McMartin * * 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 @@ -393,5 +393,11 @@ ENTRY_SAME(readlinkat) /* 285 */ ENTRY_SAME(fchmodat) ENTRY_SAME(faccessat) + ENTRY_SAME(unshare) + ENTRY_COMP(set_robust_list) + ENTRY_COMP(get_robust_list) /* 290 */ + ENTRY_SAME(splice) + ENTRY_OURS(sync_file_range) + ENTRY_SAME(tee) /* Nothing yet */ diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index 6d6436a..94dcc03 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S @@ -6,6 +6,7 @@ * Copyright (C) 2000 Michael Ang * Copyright (C) 2002 Randolph Chung * Copyright (C) 2003 James Bottomley + * Copyright (C) 2006 Helge Deller * * * This program is free software; you can redistribute it and/or modify @@ -27,6 +28,7 @@ /* needed for the processor specific cache alignment size */ #include #include +#include /* ld script to make hppa Linux kernel */ #ifndef CONFIG_64BIT @@ -68,7 +70,7 @@ SECTIONS RODATA /* writeable */ - . = ALIGN(4096); /* Make sure this is page aligned so + . = ALIGN(ASM_PAGE_SIZE); /* Make sure this is page aligned so that we can properly leave these as writable */ data_start = .; @@ -81,23 +83,17 @@ SECTIONS __start___unwind = .; /* unwind info */ .PARISC.unwind : { *(.PARISC.unwind) } __stop___unwind = .; - + + /* rarely changed data like cpu maps */ + . = ALIGN(16); + .data.read_mostly : { *(.data.read_mostly) } + + . = ALIGN(L1_CACHE_BYTES); .data : { /* Data */ *(.data) - *(.data.vm0.pmd) - *(.data.vm0.pgd) - *(.data.vm0.pte) CONSTRUCTORS } - . = ALIGN(4096); - /* nosave data is really only used for software suspend...it's here - * just in case we ever implement it */ - __nosave_begin = .; - .data_nosave : { *(.data.nosave) } - . = ALIGN(4096); - __nosave_end = .; - . = ALIGN(L1_CACHE_BYTES); .data.cacheline_aligned : { *(.data.cacheline_aligned) } @@ -105,12 +101,29 @@ SECTIONS . = ALIGN(16); .data.lock_aligned : { *(.data.lock_aligned) } - /* rarely changed data like cpu maps */ - . = ALIGN(16); - .data.read_mostly : { *(.data.read_mostly) } + . = ALIGN(ASM_PAGE_SIZE); + /* nosave data is really only used for software suspend...it's here + * just in case we ever implement it */ + __nosave_begin = .; + .data_nosave : { *(.data.nosave) } + . = ALIGN(ASM_PAGE_SIZE); + __nosave_end = .; _edata = .; /* End of data section */ + __bss_start = .; /* BSS */ + /* page table entries need to be PAGE_SIZE aligned */ + . = ALIGN(ASM_PAGE_SIZE); + .data.vmpages : { + *(.data.vm0.pmd) + *(.data.vm0.pgd) + *(.data.vm0.pte) + } + .bss : { *(.bss) *(COMMON) } + __bss_stop = .; + + + /* assembler code expects init_task to be 16k aligned */ . = ALIGN(16384); /* init_task */ .data.init_task : { *(.data.init_task) } @@ -126,6 +139,7 @@ SECTIONS .dlt : { *(.dlt) } #endif + /* reserve space for interrupt stack by aligning __init* to 16k */ . = ALIGN(16384); __init_begin = .; .init.text : { @@ -166,7 +180,7 @@ SECTIONS from .altinstructions and .eh_frame */ .exit.text : { *(.exit.text) } .exit.data : { *(.exit.data) } - . = ALIGN(4096); + . = ALIGN(ASM_PAGE_SIZE); __initramfs_start = .; .init.ramfs : { *(.init.ramfs) } __initramfs_end = .; @@ -174,14 +188,10 @@ SECTIONS __per_cpu_start = .; .data.percpu : { *(.data.percpu) } __per_cpu_end = .; - . = ALIGN(4096); + . = ALIGN(ASM_PAGE_SIZE); __init_end = .; /* freed after init ends here */ - __bss_start = .; /* BSS */ - .bss : { *(.bss) *(COMMON) } - __bss_stop = .; - _end = . ; /* Sections to be discarded */ diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 0ad945d..64785e4 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -186,7 +186,7 @@ good_area: break; case VM_FAULT_SIGBUS: /* - * We hit a hared mapping outside of the file, or some + * We hit a shared mapping outside of the file, or some * other thing happened to us that made us unable to * handle the page fault gracefully. */ diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 3796be6..6317125 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c @@ -6,6 +6,7 @@ * changed by Philipp Rumpf * Copyright 1999 Philipp Rumpf (prumpf@tux.org) * Copyright 2004 Randolph Chung (tausq@debian.org) + * Copyright 2006 Helge Deller (deller@gmx.de) * */ @@ -371,8 +372,8 @@ static void __init setup_bootmem(void) void free_initmem(void) { - unsigned long addr; - + unsigned long addr, init_begin, init_end; + printk(KERN_INFO "Freeing unused kernel memory: "); #ifdef CONFIG_DEBUG_KERNEL @@ -395,8 +396,11 @@ void free_initmem(void) local_irq_enable(); #endif - addr = (unsigned long)(&__init_begin); - for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { + /* align __init_begin and __init_end to page size, + ignoring linker script where we might have tried to save RAM */ + init_begin = PAGE_ALIGN((unsigned long)(&__init_begin)); + init_end = PAGE_ALIGN((unsigned long)(&__init_end)); + for (addr = init_begin; addr < init_end; addr += PAGE_SIZE) { ClearPageReserved(virt_to_page(addr)); init_page_count(virt_to_page(addr)); free_page(addr); @@ -407,7 +411,7 @@ void free_initmem(void) /* set up a new led state on systems shipped LED State panel */ pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE); - printk("%luk freed\n", (unsigned long)(&__init_end - &__init_begin) >> 10); + printk("%luk freed\n", (init_end - init_begin) >> 10); } @@ -639,11 +643,13 @@ static void __init map_pages(unsigned lo * Map the fault vector writable so we can * write the HPMC checksum. */ +#if defined(CONFIG_PARISC_PAGE_SIZE_4KB) if (address >= ro_start && address < ro_end && address != fv_addr && address != gw_addr) pte = __mk_pte(address, PAGE_KERNEL_RO); else +#endif pte = __mk_pte(address, pgprot); if (address >= end_paddr) @@ -874,8 +880,7 @@ unsigned long alloc_sid(void) flush_tlb_all(); /* flush_tlb_all() calls recycle_sids() */ spin_lock(&sid_lock); } - if (free_space_ids == 0) - BUG(); + BUG_ON(free_space_ids == 0); } free_space_ids--; @@ -899,8 +904,7 @@ void free_sid(unsigned long spaceid) spin_lock(&sid_lock); - if (*dirty_space_offset & (1L << index)) - BUG(); /* attempt to free space id twice */ + BUG_ON(*dirty_space_offset & (1L << index)); /* attempt to free space id twice */ *dirty_space_offset |= (1L << index); dirty_space_ids++; @@ -975,7 +979,7 @@ static void recycle_sids(void) static unsigned long recycle_ndirty; static unsigned long recycle_dirty_array[SID_ARRAY_SIZE]; -static unsigned int recycle_inuse = 0; +static unsigned int recycle_inuse; void flush_tlb_all(void) { @@ -984,9 +988,7 @@ void flush_tlb_all(void) do_recycle = 0; spin_lock(&sid_lock); if (dirty_space_ids > RECYCLE_THRESHOLD) { - if (recycle_inuse) { - BUG(); /* FIXME: Use a semaphore/wait queue here */ - } + BUG_ON(recycle_inuse); /* FIXME: Use a semaphore/wait queue here */ get_dirty_sids(&recycle_ndirty,recycle_dirty_array); recycle_inuse++; do_recycle++; diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c index 0db1281..2738456 100644 --- a/arch/parisc/mm/ioremap.c +++ b/arch/parisc/mm/ioremap.c @@ -2,7 +2,7 @@ * arch/parisc/mm/ioremap.c * * (C) Copyright 1995 1996 Linus Torvalds - * (C) Copyright 2001 Helge Deller + * (C) Copyright 2001-2006 Helge Deller * (C) Copyright 2005 Kyle McMartin */ @@ -138,6 +138,7 @@ void __iomem * __ioremap(unsigned long p if ((phys_addr >= 0x00080000 && end < 0x000fffff) || (phys_addr >= 0x00500000 && end < 0x03bfffff)) { phys_addr |= F_EXTEND(0xfc000000); + flags |= _PAGE_NO_CACHE; } #endif diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig index 2c3fd20..a456275 100644 --- a/arch/powerpc/configs/g5_defconfig +++ b/arch/powerpc/configs/g5_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.16-rc2 -# Fri Feb 10 17:33:08 2006 +# Linux kernel version: 2.6.17-rc1 +# Wed Apr 19 13:24:37 2006 # CONFIG_PPC64=y CONFIG_64BIT=y @@ -9,6 +9,7 @@ CONFIG_PPC_MERGE=y CONFIG_MMU=y CONFIG_GENERIC_HARDIRQS=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_PPC=y CONFIG_EARLY_PRINTK=y @@ -29,6 +30,7 @@ CONFIG_POWER4=y CONFIG_PPC_FPU=y CONFIG_ALTIVEC=y CONFIG_PPC_STD_MMU=y +CONFIG_VIRT_CPU_ACCOUNTING=y CONFIG_SMP=y CONFIG_NR_CPUS=4 @@ -53,6 +55,7 @@ CONFIG_SYSCTL=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_CPUSETS is not set +# CONFIG_RELAY is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_EMBEDDED is not set @@ -67,10 +70,6 @@ CONFIG_BASE_FULL=y CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_SHMEM=y -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 CONFIG_SLAB=y # CONFIG_TINY_SHMEM is not set CONFIG_BASE_SMALL=0 @@ -82,7 +81,6 @@ CONFIG_BASE_SMALL=0 CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y # CONFIG_MODULE_FORCE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y CONFIG_MODVERSIONS=y CONFIG_MODULE_SRCVERSION_ALL=y CONFIG_KMOD=y @@ -91,6 +89,7 @@ CONFIG_STOP_MACHINE=y # # Block layer # +# CONFIG_BLK_DEV_IO_TRACE is not set # # IO Schedulers @@ -185,7 +184,6 @@ CONFIG_GENERIC_ISA_DMA=y # CONFIG_PPC_INDIRECT_PCI is not set CONFIG_PCI=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI_LEGACY_PROC=y # CONFIG_PCI_DEBUG is not set # @@ -227,6 +225,7 @@ CONFIG_SYN_COOKIES=y CONFIG_INET_AH=m CONFIG_INET_ESP=m CONFIG_INET_IPCOMP=m +CONFIG_INET_XFRM_TUNNEL=m CONFIG_INET_TUNNEL=y CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y @@ -238,6 +237,8 @@ CONFIG_TCP_CONG_BIC=y # # CONFIG_IP_VS is not set # CONFIG_IPV6 is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set CONFIG_NETFILTER=y # CONFIG_NETFILTER_DEBUG is not set @@ -261,6 +262,7 @@ CONFIG_IP_NF_IRC=m CONFIG_IP_NF_TFTP=m CONFIG_IP_NF_AMANDA=m # CONFIG_IP_NF_PPTP is not set +# CONFIG_IP_NF_H323 is not set CONFIG_IP_NF_QUEUE=m # @@ -513,6 +515,7 @@ CONFIG_MD_RAID0=y CONFIG_MD_RAID1=y CONFIG_MD_RAID10=m CONFIG_MD_RAID5=y +# CONFIG_MD_RAID5_RESHAPE is not set CONFIG_MD_RAID6=m CONFIG_MD_MULTIPATH=m CONFIG_MD_FAULTY=m @@ -761,7 +764,6 @@ CONFIG_LEGACY_PTY_COUNT=256 # Watchdog Cards # # CONFIG_WATCHDOG is not set -# CONFIG_RTC is not set CONFIG_GEN_RTC=y # CONFIG_GEN_RTC_X is not set # CONFIG_DTLK is not set @@ -772,6 +774,7 @@ CONFIG_GEN_RTC=y # Ftape, the floppy tape device driver # CONFIG_AGP=m +# CONFIG_AGP_VIA is not set CONFIG_AGP_UNINORTH=m # CONFIG_DRM is not set CONFIG_RAW_DRIVER=y @@ -813,7 +816,6 @@ CONFIG_I2C_POWERMAC=y # CONFIG_I2C_PARPORT_LIGHT is not set # CONFIG_I2C_PROSAVAGE is not set # CONFIG_I2C_SAVAGE4 is not set -# CONFIG_SCx200_ACB is not set # CONFIG_I2C_SIS5595 is not set # CONFIG_I2C_SIS630 is not set # CONFIG_I2C_SIS96X is not set @@ -832,9 +834,7 @@ CONFIG_I2C_POWERMAC=y # CONFIG_SENSORS_PCF8574 is not set # CONFIG_SENSORS_PCA9539 is not set # CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_RTC8564 is not set # CONFIG_SENSORS_MAX6875 is not set -# CONFIG_RTC_X1205_I2C is not set # CONFIG_I2C_DEBUG_CORE is not set # CONFIG_I2C_DEBUG_ALGO is not set # CONFIG_I2C_DEBUG_BUS is not set @@ -862,10 +862,6 @@ CONFIG_I2C_POWERMAC=y # # -# Multimedia Capabilities Port drivers -# - -# # Multimedia devices # # CONFIG_VIDEO_DEV is not set @@ -874,6 +870,7 @@ CONFIG_I2C_POWERMAC=y # Digital Video Broadcasting Devices # # CONFIG_DVB is not set +# CONFIG_USB_DABUSB is not set # # Graphics support @@ -883,6 +880,7 @@ CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_IMAGEBLIT=y CONFIG_FB_MACMODES=y +CONFIG_FB_FIRMWARE_EDID=y CONFIG_FB_MODE_HELPERS=y CONFIG_FB_TILEBLITTING=y # CONFIG_FB_CIRRUS is not set @@ -901,7 +899,6 @@ CONFIG_FB_NVIDIA=y CONFIG_FB_NVIDIA_I2C=y # CONFIG_FB_RIVA is not set # CONFIG_FB_MATROX is not set -# CONFIG_FB_RADEON_OLD is not set CONFIG_FB_RADEON=y CONFIG_FB_RADEON_I2C=y # CONFIG_FB_RADEON_DEBUG is not set @@ -958,9 +955,11 @@ CONFIG_SND_SEQUENCER=m CONFIG_SND_OSSEMUL=y CONFIG_SND_MIXER_OSS=m CONFIG_SND_PCM_OSS=m +CONFIG_SND_PCM_OSS_PLUGINS=y CONFIG_SND_SEQUENCER_OSS=y # CONFIG_SND_DYNAMIC_MINORS is not set CONFIG_SND_SUPPORT_OLD_API=y +CONFIG_SND_VERBOSE_PROCFS=y # CONFIG_SND_VERBOSE_PRINTK is not set # CONFIG_SND_DEBUG is not set @@ -977,6 +976,7 @@ CONFIG_SND_SUPPORT_OLD_API=y # PCI devices # # CONFIG_SND_AD1889 is not set +# CONFIG_SND_ALS300 is not set # CONFIG_SND_ALS4000 is not set # CONFIG_SND_ALI5451 is not set # CONFIG_SND_ATIIXP is not set @@ -1009,6 +1009,7 @@ CONFIG_SND_SUPPORT_OLD_API=y # CONFIG_SND_MIXART is not set # CONFIG_SND_NM256 is not set # CONFIG_SND_PCXHR is not set +# CONFIG_SND_RIPTIDE is not set # CONFIG_SND_RME32 is not set # CONFIG_SND_RME96 is not set # CONFIG_SND_RME9652 is not set @@ -1041,6 +1042,7 @@ CONFIG_SND_USB_AUDIO=m # CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB_ARCH_HAS_OHCI=y +CONFIG_USB_ARCH_HAS_EHCI=y CONFIG_USB=y # CONFIG_USB_DEBUG is not set @@ -1068,7 +1070,6 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y # # USB Device Class drivers # -# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set CONFIG_USB_ACM=m CONFIG_USB_PRINTER=y @@ -1126,15 +1127,6 @@ CONFIG_USB_HIDDEV=y # CONFIG_USB_MICROTEK is not set # -# USB Multimedia devices -# -# CONFIG_USB_DABUSB is not set - -# -# Video4Linux support is needed for USB Multimedia device support -# - -# # USB Network Adapters # CONFIG_USB_CATC=m @@ -1194,6 +1186,7 @@ CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y CONFIG_USB_SERIAL_KLSI=m CONFIG_USB_SERIAL_KOBIL_SCT=m CONFIG_USB_SERIAL_MCT_U232=m +# CONFIG_USB_SERIAL_NAVMAN is not set CONFIG_USB_SERIAL_PL2303=m # CONFIG_USB_SERIAL_HP4X is not set CONFIG_USB_SERIAL_SAFE=m @@ -1237,17 +1230,23 @@ CONFIG_USB_EZUSB=y # CONFIG_MMC is not set # +# LED devices +# +# CONFIG_NEW_LEDS is not set + +# # InfiniBand support # # CONFIG_INFINIBAND is not set # -# SN Devices +# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) # # -# EDAC - error detection and reporting (RAS) +# Real Time Clock # +# CONFIG_RTC_CLASS is not set # # File systems @@ -1319,7 +1318,6 @@ CONFIG_TMPFS=y CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y CONFIG_RAMFS=y -# CONFIG_RELAYFS_FS is not set # CONFIG_CONFIGFS_FS is not set # diff --git a/arch/powerpc/configs/iseries_defconfig b/arch/powerpc/configs/iseries_defconfig index 1816a46..a95e455 100644 --- a/arch/powerpc/configs/iseries_defconfig +++ b/arch/powerpc/configs/iseries_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.16-rc6 -# Wed Mar 15 16:19:52 2006 +# Linux kernel version: 2.6.17-rc1 +# Wed Apr 19 11:46:44 2006 # CONFIG_PPC64=y CONFIG_64BIT=y @@ -9,6 +9,7 @@ CONFIG_PPC_MERGE=y CONFIG_MMU=y CONFIG_GENERIC_HARDIRQS=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_PPC=y CONFIG_EARLY_PRINTK=y @@ -30,6 +31,7 @@ CONFIG_POWER4=y CONFIG_PPC_FPU=y # CONFIG_ALTIVEC is not set CONFIG_PPC_STD_MMU=y +CONFIG_VIRT_CPU_ACCOUNTING=y CONFIG_SMP=y CONFIG_NR_CPUS=32 @@ -55,6 +57,7 @@ CONFIG_AUDITSYSCALL=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_CPUSETS is not set +# CONFIG_RELAY is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_EMBEDDED is not set @@ -69,10 +72,6 @@ CONFIG_BASE_FULL=y CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_SHMEM=y -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 CONFIG_SLAB=y # CONFIG_TINY_SHMEM is not set CONFIG_BASE_SMALL=0 @@ -84,7 +83,6 @@ CONFIG_BASE_SMALL=0 CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y # CONFIG_MODULE_FORCE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y CONFIG_MODVERSIONS=y CONFIG_MODULE_SRCVERSION_ALL=y CONFIG_KMOD=y @@ -93,6 +91,7 @@ CONFIG_STOP_MACHINE=y # # Block layer # +# CONFIG_BLK_DEV_IO_TRACE is not set # # IO Schedulers @@ -165,7 +164,6 @@ CONFIG_GENERIC_ISA_DMA=y # CONFIG_PPC_INDIRECT_PCI is not set CONFIG_PCI=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI_LEGACY_PROC=y # CONFIG_PCI_DEBUG is not set # @@ -207,6 +205,7 @@ CONFIG_SYN_COOKIES=y CONFIG_INET_AH=m CONFIG_INET_ESP=m CONFIG_INET_IPCOMP=m +CONFIG_INET_XFRM_TUNNEL=m CONFIG_INET_TUNNEL=y CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y @@ -218,6 +217,8 @@ CONFIG_TCP_CONG_BIC=y # # CONFIG_IP_VS is not set # CONFIG_IPV6 is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set CONFIG_NETFILTER=y # CONFIG_NETFILTER_DEBUG is not set @@ -236,11 +237,14 @@ CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m CONFIG_NETFILTER_XT_MATCH_CONNMARK=m CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m # CONFIG_NETFILTER_XT_MATCH_DCCP is not set +# CONFIG_NETFILTER_XT_MATCH_ESP is not set CONFIG_NETFILTER_XT_MATCH_HELPER=m CONFIG_NETFILTER_XT_MATCH_LENGTH=m CONFIG_NETFILTER_XT_MATCH_LIMIT=m CONFIG_NETFILTER_XT_MATCH_MAC=m CONFIG_NETFILTER_XT_MATCH_MARK=m +# CONFIG_NETFILTER_XT_MATCH_POLICY is not set +# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m CONFIG_NETFILTER_XT_MATCH_REALM=m CONFIG_NETFILTER_XT_MATCH_SCTP=m @@ -262,20 +266,19 @@ CONFIG_IP_NF_IRC=m CONFIG_IP_NF_TFTP=m CONFIG_IP_NF_AMANDA=m # CONFIG_IP_NF_PPTP is not set +# CONFIG_IP_NF_H323 is not set CONFIG_IP_NF_QUEUE=m CONFIG_IP_NF_IPTABLES=m CONFIG_IP_NF_MATCH_IPRANGE=m -CONFIG_IP_NF_MATCH_MULTIPORT=m CONFIG_IP_NF_MATCH_TOS=m CONFIG_IP_NF_MATCH_RECENT=m CONFIG_IP_NF_MATCH_ECN=m CONFIG_IP_NF_MATCH_DSCP=m -CONFIG_IP_NF_MATCH_AH_ESP=m +# CONFIG_IP_NF_MATCH_AH is not set CONFIG_IP_NF_MATCH_TTL=m CONFIG_IP_NF_MATCH_OWNER=m CONFIG_IP_NF_MATCH_ADDRTYPE=m CONFIG_IP_NF_MATCH_HASHLIMIT=m -CONFIG_IP_NF_MATCH_POLICY=m CONFIG_IP_NF_FILTER=m CONFIG_IP_NF_TARGET_REJECT=m CONFIG_IP_NF_TARGET_LOG=m @@ -479,6 +482,7 @@ CONFIG_MD_RAID0=y CONFIG_MD_RAID1=y CONFIG_MD_RAID10=m CONFIG_MD_RAID5=y +# CONFIG_MD_RAID5_RESHAPE is not set CONFIG_MD_RAID6=m CONFIG_MD_MULTIPATH=m CONFIG_MD_FAULTY=m @@ -702,7 +706,6 @@ CONFIG_LEGACY_PTY_COUNT=256 # Watchdog Cards # # CONFIG_WATCHDOG is not set -# CONFIG_RTC is not set CONFIG_GEN_RTC=y # CONFIG_GEN_RTC_X is not set # CONFIG_DTLK is not set @@ -751,10 +754,6 @@ CONFIG_MAX_RAW_DEVS=256 # # -# Multimedia Capabilities Port drivers -# - -# # Multimedia devices # # CONFIG_VIDEO_DEV is not set @@ -779,6 +778,7 @@ CONFIG_MAX_RAW_DEVS=256 # CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB_ARCH_HAS_OHCI=y +CONFIG_USB_ARCH_HAS_EHCI=y # CONFIG_USB is not set # @@ -796,6 +796,11 @@ CONFIG_USB_ARCH_HAS_OHCI=y # CONFIG_MMC is not set # +# LED devices +# +# CONFIG_NEW_LEDS is not set + +# # InfiniBand support # # CONFIG_INFINIBAND is not set @@ -805,6 +810,11 @@ CONFIG_USB_ARCH_HAS_OHCI=y # # +# Real Time Clock +# +# CONFIG_RTC_CLASS is not set + +# # File systems # CONFIG_EXT2_FS=y @@ -878,7 +888,6 @@ CONFIG_TMPFS=y # CONFIG_HUGETLBFS is not set # CONFIG_HUGETLB_PAGE is not set CONFIG_RAMFS=y -# CONFIG_RELAYFS_FS is not set # CONFIG_CONFIGFS_FS is not set # diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index daaf038..58e68ce 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.16-rc2 -# Fri Feb 10 17:33:32 2006 +# Linux kernel version: 2.6.17-rc1 +# Wed Apr 19 11:48:00 2006 # CONFIG_PPC64=y CONFIG_64BIT=y @@ -9,6 +9,7 @@ CONFIG_PPC_MERGE=y CONFIG_MMU=y CONFIG_GENERIC_HARDIRQS=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_PPC=y CONFIG_EARLY_PRINTK=y @@ -30,6 +31,7 @@ CONFIG_POWER4=y CONFIG_PPC_FPU=y CONFIG_ALTIVEC=y CONFIG_PPC_STD_MMU=y +CONFIG_VIRT_CPU_ACCOUNTING=y CONFIG_SMP=y CONFIG_NR_CPUS=128 @@ -55,6 +57,7 @@ CONFIG_AUDITSYSCALL=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_CPUSETS=y +# CONFIG_RELAY is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_EMBEDDED is not set @@ -69,10 +72,6 @@ CONFIG_BASE_FULL=y CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_SHMEM=y -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 CONFIG_SLAB=y # CONFIG_TINY_SHMEM is not set CONFIG_BASE_SMALL=0 @@ -84,7 +83,6 @@ CONFIG_BASE_SMALL=0 CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y # CONFIG_MODULE_FORCE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y CONFIG_MODVERSIONS=y CONFIG_MODULE_SRCVERSION_ALL=y CONFIG_KMOD=y @@ -93,6 +91,7 @@ CONFIG_STOP_MACHINE=y # # Block layer # +# CONFIG_BLK_DEV_IO_TRACE is not set # # IO Schedulers @@ -188,7 +187,6 @@ CONFIG_PPC_I8259=y # CONFIG_PPC_INDIRECT_PCI is not set CONFIG_PCI=y CONFIG_PCI_DOMAINS=y -CONFIG_PCI_LEGACY_PROC=y # CONFIG_PCI_DEBUG is not set # @@ -235,6 +233,7 @@ CONFIG_SYN_COOKIES=y CONFIG_INET_AH=m CONFIG_INET_ESP=m CONFIG_INET_IPCOMP=m +CONFIG_INET_XFRM_TUNNEL=m CONFIG_INET_TUNNEL=y CONFIG_INET_DIAG=y CONFIG_INET_TCP_DIAG=y @@ -246,6 +245,8 @@ CONFIG_TCP_CONG_BIC=y # # CONFIG_IP_VS is not set # CONFIG_IPV6 is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set CONFIG_NETFILTER=y # CONFIG_NETFILTER_DEBUG is not set @@ -272,6 +273,7 @@ CONFIG_IP_NF_IRC=m CONFIG_IP_NF_TFTP=m CONFIG_IP_NF_AMANDA=m # CONFIG_IP_NF_PPTP is not set +# CONFIG_IP_NF_H323 is not set CONFIG_IP_NF_QUEUE=m # @@ -519,6 +521,7 @@ CONFIG_MD_RAID0=y CONFIG_MD_RAID1=y CONFIG_MD_RAID10=m CONFIG_MD_RAID5=y +# CONFIG_MD_RAID5_RESHAPE is not set CONFIG_MD_RAID6=m CONFIG_MD_MULTIPATH=m CONFIG_MD_FAULTY=m @@ -750,6 +753,7 @@ CONFIG_HW_CONSOLE=y # CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_PCI=y CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 # CONFIG_SERIAL_8250_EXTENDED is not set @@ -767,7 +771,9 @@ CONFIG_LEGACY_PTY_COUNT=256 # CONFIG_PRINTER is not set # CONFIG_PPDEV is not set # CONFIG_TIPAR is not set +CONFIG_HVC_DRIVER=y CONFIG_HVC_CONSOLE=y +# CONFIG_HVC_RTAS is not set CONFIG_HVCS=m # @@ -779,7 +785,6 @@ CONFIG_HVCS=m # Watchdog Cards # # CONFIG_WATCHDOG is not set -# CONFIG_RTC is not set CONFIG_GEN_RTC=y # CONFIG_GEN_RTC_X is not set # CONFIG_DTLK is not set @@ -830,7 +835,6 @@ CONFIG_I2C_ALGOBIT=y # CONFIG_I2C_PARPORT_LIGHT is not set # CONFIG_I2C_PROSAVAGE is not set # CONFIG_I2C_SAVAGE4 is not set -# CONFIG_SCx200_ACB is not set # CONFIG_I2C_SIS5595 is not set # CONFIG_I2C_SIS630 is not set # CONFIG_I2C_SIS96X is not set @@ -849,9 +853,7 @@ CONFIG_I2C_ALGOBIT=y # CONFIG_SENSORS_PCF8574 is not set # CONFIG_SENSORS_PCA9539 is not set # CONFIG_SENSORS_PCF8591 is not set -# CONFIG_SENSORS_RTC8564 is not set # CONFIG_SENSORS_MAX6875 is not set -# CONFIG_RTC_X1205_I2C is not set # CONFIG_I2C_DEBUG_CORE is not set # CONFIG_I2C_DEBUG_ALGO is not set # CONFIG_I2C_DEBUG_BUS is not set @@ -879,10 +881,6 @@ CONFIG_I2C_ALGOBIT=y # # -# Multimedia Capabilities Port drivers -# - -# # Multimedia devices # # CONFIG_VIDEO_DEV is not set @@ -891,6 +889,7 @@ CONFIG_I2C_ALGOBIT=y # Digital Video Broadcasting Devices # # CONFIG_DVB is not set +# CONFIG_USB_DABUSB is not set # # Graphics support @@ -900,6 +899,7 @@ CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_IMAGEBLIT=y CONFIG_FB_MACMODES=y +CONFIG_FB_FIRMWARE_EDID=y CONFIG_FB_MODE_HELPERS=y CONFIG_FB_TILEBLITTING=y # CONFIG_FB_CIRRUS is not set @@ -919,7 +919,6 @@ CONFIG_FB_MATROX_MYSTIQUE=y CONFIG_FB_MATROX_G=y # CONFIG_FB_MATROX_I2C is not set CONFIG_FB_MATROX_MULTIHEAD=y -# CONFIG_FB_RADEON_OLD is not set CONFIG_FB_RADEON=y CONFIG_FB_RADEON_I2C=y # CONFIG_FB_RADEON_DEBUG is not set @@ -968,6 +967,7 @@ CONFIG_LCD_DEVICE=y # CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB_ARCH_HAS_OHCI=y +CONFIG_USB_ARCH_HAS_EHCI=y CONFIG_USB=y # CONFIG_USB_DEBUG is not set @@ -1048,15 +1048,6 @@ CONFIG_USB_HIDDEV=y # CONFIG_USB_MICROTEK is not set # -# USB Multimedia devices -# -# CONFIG_USB_DABUSB is not set - -# -# Video4Linux support is needed for USB Multimedia device support -# - -# # USB Network Adapters # # CONFIG_USB_CATC is not set @@ -1109,6 +1100,11 @@ CONFIG_USB_MON=y # CONFIG_MMC is not set # +# LED devices +# +# CONFIG_NEW_LEDS is not set + +# # InfiniBand support # CONFIG_INFINIBAND=m @@ -1121,12 +1117,13 @@ CONFIG_INFINIBAND_IPOIB=m # CONFIG_INFINIBAND_SRP is not set # -# SN Devices +# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) # # -# EDAC - error detection and reporting (RAS) +# Real Time Clock # +# CONFIG_RTC_CLASS is not set # # File systems @@ -1202,7 +1199,6 @@ CONFIG_TMPFS=y CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y CONFIG_RAMFS=y -# CONFIG_RELAYFS_FS is not set # CONFIG_CONFIGFS_FS is not set # diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index d9a7fde..4eba60a 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -61,6 +61,7 @@ __setup("iommu=", setup_iommu); static unsigned long iommu_range_alloc(struct iommu_table *tbl, unsigned long npages, unsigned long *handle, + unsigned long mask, unsigned int align_order) { unsigned long n, end, i, start; @@ -97,9 +98,21 @@ static unsigned long iommu_range_alloc(s */ if (start >= limit) start = largealloc ? tbl->it_largehint : tbl->it_hint; - + again: + if (limit + tbl->it_offset > mask) { + limit = mask - tbl->it_offset + 1; + /* If we're constrained on address range, first try + * at the masked hint to avoid O(n) search complexity, + * but on second pass, start at 0. + */ + if ((start & mask) >= limit || pass > 0) + start = 0; + else + start &= mask; + } + n = find_next_zero_bit(tbl->it_map, limit, start); /* Align allocation */ @@ -150,14 +163,14 @@ static unsigned long iommu_range_alloc(s static dma_addr_t iommu_alloc(struct iommu_table *tbl, void *page, unsigned int npages, enum dma_data_direction direction, - unsigned int align_order) + unsigned long mask, unsigned int align_order) { unsigned long entry, flags; dma_addr_t ret = DMA_ERROR_CODE; - + spin_lock_irqsave(&(tbl->it_lock), flags); - entry = iommu_range_alloc(tbl, npages, NULL, align_order); + entry = iommu_range_alloc(tbl, npages, NULL, mask, align_order); if (unlikely(entry == DMA_ERROR_CODE)) { spin_unlock_irqrestore(&(tbl->it_lock), flags); @@ -236,7 +249,7 @@ static void iommu_free(struct iommu_tabl int iommu_map_sg(struct device *dev, struct iommu_table *tbl, struct scatterlist *sglist, int nelems, - enum dma_data_direction direction) + unsigned long mask, enum dma_data_direction direction) { dma_addr_t dma_next = 0, dma_addr; unsigned long flags; @@ -274,7 +287,7 @@ int iommu_map_sg(struct device *dev, str vaddr = (unsigned long)page_address(s->page) + s->offset; npages = PAGE_ALIGN(vaddr + slen) - (vaddr & PAGE_MASK); npages >>= PAGE_SHIFT; - entry = iommu_range_alloc(tbl, npages, &handle, 0); + entry = iommu_range_alloc(tbl, npages, &handle, mask >> PAGE_SHIFT, 0); DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen); @@ -479,7 +492,8 @@ void iommu_free_table(struct device_node * byte within the page as vaddr. */ dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, - size_t size, enum dma_data_direction direction) + size_t size, unsigned long mask, + enum dma_data_direction direction) { dma_addr_t dma_handle = DMA_ERROR_CODE; unsigned long uaddr; @@ -492,7 +506,8 @@ dma_addr_t iommu_map_single(struct iommu npages >>= PAGE_SHIFT; if (tbl) { - dma_handle = iommu_alloc(tbl, vaddr, npages, direction, 0); + dma_handle = iommu_alloc(tbl, vaddr, npages, direction, + mask >> PAGE_SHIFT, 0); if (dma_handle == DMA_ERROR_CODE) { if (printk_ratelimit()) { printk(KERN_INFO "iommu_alloc failed, " @@ -521,7 +536,7 @@ void iommu_unmap_single(struct iommu_tab * to the dma address (mapping) of the first page. */ void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, - dma_addr_t *dma_handle, gfp_t flag) + dma_addr_t *dma_handle, unsigned long mask, gfp_t flag) { void *ret = NULL; dma_addr_t mapping; @@ -551,7 +566,8 @@ void *iommu_alloc_coherent(struct iommu_ memset(ret, 0, size); /* Set up tces to cover the allocated range */ - mapping = iommu_alloc(tbl, ret, npages, DMA_BIDIRECTIONAL, order); + mapping = iommu_alloc(tbl, ret, npages, DMA_BIDIRECTIONAL, + mask >> PAGE_SHIFT, order); if (mapping == DMA_ERROR_CODE) { free_pages((unsigned long)ret, order); ret = NULL; diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index ad7a902..856ef1a 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c @@ -88,7 +88,7 @@ void __kprobes arch_remove_kprobe(struct mutex_unlock(&kprobe_mutex); } -static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) +static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) { kprobe_opcode_t insn = *p->ainsn.insn; @@ -101,21 +101,21 @@ static inline void prepare_singlestep(st regs->nip = (unsigned long)p->ainsn.insn; } -static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) +static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp = kprobe_running(); kcb->prev_kprobe.status = kcb->kprobe_status; kcb->prev_kprobe.saved_msr = kcb->kprobe_saved_msr; } -static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) +static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; kcb->kprobe_status = kcb->prev_kprobe.status; kcb->kprobe_saved_msr = kcb->prev_kprobe.saved_msr; } -static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, +static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = p; @@ -141,7 +141,7 @@ void __kprobes arch_prepare_kretprobe(st } } -static inline int kprobe_handler(struct pt_regs *regs) +static int __kprobes kprobe_handler(struct pt_regs *regs) { struct kprobe *p; int ret = 0; @@ -334,7 +334,7 @@ static void __kprobes resume_execution(s regs->nip = (unsigned long)p->addr + 4; } -static inline int post_kprobe_handler(struct pt_regs *regs) +static int __kprobes post_kprobe_handler(struct pt_regs *regs) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); @@ -370,7 +370,7 @@ out: return 1; } -static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) +static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); diff --git a/arch/powerpc/kernel/pci_iommu.c b/arch/powerpc/kernel/pci_iommu.c index c336f3e..c1d95e1 100644 --- a/arch/powerpc/kernel/pci_iommu.c +++ b/arch/powerpc/kernel/pci_iommu.c @@ -59,6 +59,25 @@ static inline struct iommu_table *devnod } +static inline unsigned long device_to_mask(struct device *hwdev) +{ + struct pci_dev *pdev; + + if (!hwdev) { + pdev = ppc64_isabridge_dev; + if (!pdev) /* This is the best guess we can do */ + return 0xfffffffful; + } else + pdev = to_pci_dev(hwdev); + + if (pdev->dma_mask) + return pdev->dma_mask; + + /* Assume devices without mask can take 32 bit addresses */ + return 0xfffffffful; +} + + /* Allocates a contiguous real buffer and creates mappings over it. * Returns the virtual address of the buffer and sets dma_handle * to the dma address (mapping) of the first page. @@ -67,7 +86,7 @@ static void *pci_iommu_alloc_coherent(st dma_addr_t *dma_handle, gfp_t flag) { return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle, - flag); + device_to_mask(hwdev), flag); } static void pci_iommu_free_coherent(struct device *hwdev, size_t size, @@ -85,7 +104,8 @@ static void pci_iommu_free_coherent(stru static dma_addr_t pci_iommu_map_single(struct device *hwdev, void *vaddr, size_t size, enum dma_data_direction direction) { - return iommu_map_single(devnode_table(hwdev), vaddr, size, direction); + return iommu_map_single(devnode_table(hwdev), vaddr, size, + device_to_mask(hwdev), direction); } @@ -100,7 +120,7 @@ static int pci_iommu_map_sg(struct devic int nelems, enum dma_data_direction direction) { return iommu_map_sg(pdev, devnode_table(pdev), sglist, - nelems, direction); + nelems, device_to_mask(pdev), direction); } static void pci_iommu_unmap_sg(struct device *pdev, struct scatterlist *sglist, @@ -112,7 +132,19 @@ static void pci_iommu_unmap_sg(struct de /* We support DMA to/from any memory page via the iommu */ static int pci_iommu_dma_supported(struct device *dev, u64 mask) { - return 1; + struct iommu_table *tbl = devnode_table(dev); + + if (!tbl || tbl->it_offset > mask) { + printk(KERN_INFO "Warning: IOMMU table offset too big for device mask\n"); + if (tbl) + printk(KERN_INFO "mask: 0x%08lx, table offset: 0x%08lx\n", + mask, tbl->it_offset); + else + printk(KERN_INFO "mask: 0x%08lx, table unavailable\n", + mask); + return 0; + } else + return 1; } void pci_iommu_init(void) diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index dfa5398..4b052ae 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c @@ -81,6 +81,7 @@ EXPORT_SYMBOL(strcat); EXPORT_SYMBOL(strlen); EXPORT_SYMBOL(strcmp); EXPORT_SYMBOL(strcasecmp); +EXPORT_SYMBOL(strncasecmp); EXPORT_SYMBOL(csum_partial); EXPORT_SYMBOL(csum_partial_copy_generic); diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 4336390..1cb69e8 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -62,7 +62,7 @@ static int __initdata dt_root_addr_cells static int __initdata dt_root_size_cells; #ifdef CONFIG_PPC64 -static int __initdata iommu_is_off; +int __initdata iommu_is_off; int __initdata iommu_force_on; unsigned long tce_alloc_start, tce_alloc_end; #endif diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index 73560ef..ed737ca 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c @@ -279,7 +279,7 @@ static void unregister_cpu_online(unsign } #endif /* CONFIG_HOTPLUG_CPU */ -static int __devinit sysfs_cpu_notify(struct notifier_block *self, +static int sysfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned int)(long)hcpu; @@ -297,7 +297,7 @@ static int __devinit sysfs_cpu_notify(st return NOTIFY_OK; } -static struct notifier_block __devinitdata sysfs_cpu_nb = { +static struct notifier_block sysfs_cpu_nb = { .notifier_call = sysfs_cpu_notify, }; diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S index a14c964..0b98eea 100644 --- a/arch/powerpc/kernel/systbl.S +++ b/arch/powerpc/kernel/systbl.S @@ -324,3 +324,9 @@ COMPAT_SYS(ppoll) SYSCALL(unshare) SYSCALL(splice) SYSCALL(tee) +SYSCALL(vmsplice) + +/* + * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c + * as well when appropriate. + */ diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index 13c655b..971020c 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c @@ -202,7 +202,7 @@ static dma_addr_t vio_map_single(struct size_t size, enum dma_data_direction direction) { return iommu_map_single(to_vio_dev(dev)->iommu_table, vaddr, size, - direction); + ~0ul, direction); } static void vio_unmap_single(struct device *dev, dma_addr_t dma_handle, @@ -216,7 +216,7 @@ static int vio_map_sg(struct device *dev int nelems, enum dma_data_direction direction) { return iommu_map_sg(dev, to_vio_dev(dev)->iommu_table, sglist, - nelems, direction); + nelems, ~0ul, direction); } static void vio_unmap_sg(struct device *dev, struct scatterlist *sglist, @@ -229,7 +229,7 @@ static void *vio_alloc_coherent(struct d dma_addr_t *dma_handle, gfp_t flag) { return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size, - dma_handle, flag); + dma_handle, ~0ul, flag); } static void vio_free_coherent(struct device *dev, size_t size, diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c index 6594bec..b283380 100644 --- a/arch/powerpc/platforms/cell/spu_callbacks.c +++ b/arch/powerpc/platforms/cell/spu_callbacks.c @@ -317,17 +317,17 @@ void *spu_syscall_table[] = { [__NR_ppoll] sys_ni_syscall, /* sys_ppoll */ [__NR_unshare] sys_unshare, [__NR_splice] sys_splice, + [__NR_tee] sys_tee, + [__NR_vmsplice] sys_vmsplice, }; long spu_sys_callback(struct spu_syscall_block *s) { long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6); - BUILD_BUG_ON(ARRAY_SIZE(spu_syscall_table) != __NR_syscalls); - syscall = spu_syscall_table[s->nr_ret]; - if (s->nr_ret >= __NR_syscalls) { + if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) { pr_debug("%s: invalid syscall #%ld", __FUNCTION__, s->nr_ret); return -ENOSYS; } diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c index e14f9ac..df2343e 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c @@ -231,6 +231,14 @@ static u8 kw_i2c_wait_interrupt(struct p return isr; } +static void kw_i2c_do_stop(struct pmac_i2c_host_kw *host, int result) +{ + kw_write_reg(reg_control, KW_I2C_CTL_STOP); + host->state = state_stop; + host->result = result; +} + + static void kw_i2c_handle_interrupt(struct pmac_i2c_host_kw *host, u8 isr) { u8 ack; @@ -246,42 +254,36 @@ static void kw_i2c_handle_interrupt(stru } if (isr == 0) { + printk(KERN_WARNING "low_i2c: Timeout in i2c transfer" + " on keywest !\n"); if (host->state != state_stop) { - DBG_LOW("KW: Timeout !\n"); - host->result = -EIO; - goto stop; - } - if (host->state == state_stop) { - ack = kw_read_reg(reg_status); - if (ack & KW_I2C_STAT_BUSY) - kw_write_reg(reg_status, 0); - host->state = state_idle; - kw_write_reg(reg_ier, 0x00); - if (!host->polled) - complete(&host->complete); + kw_i2c_do_stop(host, -EIO); + return; } + ack = kw_read_reg(reg_status); + if (ack & KW_I2C_STAT_BUSY) + kw_write_reg(reg_status, 0); + host->state = state_idle; + kw_write_reg(reg_ier, 0x00); + if (!host->polled) + complete(&host->complete); return; } if (isr & KW_I2C_IRQ_ADDR) { ack = kw_read_reg(reg_status); if (host->state != state_addr) { - kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR); WRONG_STATE("KW_I2C_IRQ_ADDR"); - host->result = -EIO; - goto stop; + kw_i2c_do_stop(host, -EIO); } if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { - host->result = -ENODEV; - DBG_LOW("KW: NAK on address\n"); + host->result = -ENXIO; host->state = state_stop; - return; + DBG_LOW("KW: NAK on address\n"); } else { - if (host->len == 0) { - kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR); - goto stop; - } - if (host->rw) { + if (host->len == 0) + kw_i2c_do_stop(host, 0); + else if (host->rw) { host->state = state_read; if (host->len > 1) kw_write_reg(reg_control, @@ -308,25 +310,19 @@ static void kw_i2c_handle_interrupt(stru ack = kw_read_reg(reg_status); if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { DBG_LOW("KW: nack on data write\n"); - host->result = -EIO; - goto stop; + host->result = -EFBIG; + host->state = state_stop; } else if (host->len) { kw_write_reg(reg_data, *(host->data++)); host->len--; - } else { - kw_write_reg(reg_control, KW_I2C_CTL_STOP); - host->state = state_stop; - host->result = 0; - } - kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); + } else + kw_i2c_do_stop(host, 0); } else { - kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); WRONG_STATE("KW_I2C_IRQ_DATA"); - if (host->state != state_stop) { - host->result = -EIO; - goto stop; - } + if (host->state != state_stop) + kw_i2c_do_stop(host, -EIO); } + kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); } if (isr & KW_I2C_IRQ_STOP) { @@ -340,14 +336,10 @@ static void kw_i2c_handle_interrupt(stru complete(&host->complete); } + /* Below should only happen in manual mode which we don't use ... */ if (isr & KW_I2C_IRQ_START) kw_write_reg(reg_isr, KW_I2C_IRQ_START); - return; - stop: - kw_write_reg(reg_control, KW_I2C_CTL_STOP); - host->state = state_stop; - return; } /* Interrupt handler */ @@ -544,11 +536,11 @@ static struct pmac_i2c_host_kw *__init k return NULL; } - /* Make sure IRA is disabled */ + /* Make sure IRQ is disabled */ kw_write_reg(reg_ier, 0); /* Request chip interrupt */ - if (request_irq(host->irq, kw_i2c_irq, SA_SHIRQ, "keywest i2c", host)) + if (request_irq(host->irq, kw_i2c_irq, 0, "keywest i2c", host)) host->irq = NO_IRQ; printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n", diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 61d3174..38087bd 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c @@ -49,6 +49,7 @@ #include "dart.h" +extern int iommu_is_off; extern int iommu_force_on; /* Physical base address and size of the DART table */ @@ -329,10 +330,17 @@ void iommu_init_early_dart(void) void __init alloc_dart_table(void) { - /* Only reserve DART space if machine has more than 2GB of RAM + /* Only reserve DART space if machine has more than 1GB of RAM * or if requested with iommu=on on cmdline. + * + * 1GB of RAM is picked as limit because some default devices + * (i.e. Airport Extreme) have 30 bit address range limits. */ - if (lmb_end_of_DRAM() <= 0x80000000ull && !iommu_force_on) + + if (iommu_is_off) + return; + + if (!iommu_force_on && lmb_end_of_DRAM() <= 0x40000000ull) return; /* 512 pages (2MB) is max DART tablesize. */ diff --git a/arch/ppc/kernel/asm-offsets.c b/arch/ppc/kernel/asm-offsets.c index 77e4dc7..cc7c4ae 100644 --- a/arch/ppc/kernel/asm-offsets.c +++ b/arch/ppc/kernel/asm-offsets.c @@ -134,6 +134,7 @@ main(void) DEFINE(TI_TASK, offsetof(struct thread_info, task)); DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); + DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, flags)); DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S index 5891ecb..1adc914 100644 --- a/arch/ppc/kernel/entry.S +++ b/arch/ppc/kernel/entry.S @@ -128,29 +128,26 @@ transfer_to_handler: stw r12,4(r11) #endif b 3f + 2: /* if from kernel, check interrupted DOZE/NAP mode and * check for stack overflow */ + lwz r9,THREAD_INFO-THREAD(r12) + cmplw r1,r9 /* if r1 <= current->thread_info */ + ble- stack_ovf /* then the kernel stack overflowed */ +5: #ifdef CONFIG_6xx - mfspr r11,SPRN_HID0 - mtcr r11 -BEGIN_FTR_SECTION - bt- 8,4f /* Check DOZE */ -END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE) -BEGIN_FTR_SECTION - bt- 9,4f /* Check NAP */ -END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP) + tophys(r9,r9) /* check local flags */ + lwz r12,TI_LOCAL_FLAGS(r9) + mtcrf 0x01,r12 + bt- 31-TLF_NAPPING,4f #endif /* CONFIG_6xx */ .globl transfer_to_handler_cont transfer_to_handler_cont: - lwz r11,THREAD_INFO-THREAD(r12) - cmplw r1,r11 /* if r1 <= current->thread_info */ - ble- stack_ovf /* then the kernel stack overflowed */ 3: mflr r9 lwz r11,0(r9) /* virtual address of handler */ lwz r9,4(r9) /* where to go when done */ - FIX_SRR1(r10,r12) mtspr SPRN_SRR0,r11 mtspr SPRN_SRR1,r10 mtlr r9 @@ -158,7 +155,9 @@ transfer_to_handler_cont: RFI /* jump to handler, enable MMU */ #ifdef CONFIG_6xx -4: b power_save_6xx_restore +4: rlwinm r12,r12,0,~_TLF_NAPPING + stw r12,TI_LOCAL_FLAGS(r9) + b power_save_6xx_restore #endif /* @@ -167,10 +166,10 @@ transfer_to_handler_cont: */ stack_ovf: /* sometimes we use a statically-allocated stack, which is OK. */ - lis r11,_end@h - ori r11,r11,_end@l - cmplw r1,r11 - ble 3b /* r1 <= &_end is OK */ + lis r12,_end@h + ori r12,r12,_end@l + cmplw r1,r12 + ble 5b /* r1 <= &_end is OK */ SAVE_NVGPRS(r11) addi r3,r1,STACK_FRAME_OVERHEAD lis r1,init_thread_union@ha diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index 865ba74..b250b1b 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c @@ -94,6 +94,7 @@ EXPORT_SYMBOL(strcat); EXPORT_SYMBOL(strlen); EXPORT_SYMBOL(strcmp); EXPORT_SYMBOL(strcasecmp); +EXPORT_SYMBOL(strncasecmp); EXPORT_SYMBOL(__div64_32); EXPORT_SYMBOL(csum_partial); diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c index 54d35c1..9a22434 100644 --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c @@ -652,7 +652,7 @@ appldata_cpu_notify(struct notifier_bloc return NOTIFY_OK; } -static struct notifier_block __devinitdata appldata_nb = { +static struct notifier_block appldata_nb = { .notifier_call = appldata_cpu_notify, }; diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c index ffc7309..2e1c824 100644 --- a/arch/sparc64/kernel/kprobes.c +++ b/arch/sparc64/kernel/kprobes.c @@ -63,7 +63,7 @@ void __kprobes arch_disarm_kprobe(struct flushi(p->addr); } -static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) +static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp = kprobe_running(); kcb->prev_kprobe.status = kcb->kprobe_status; @@ -71,7 +71,7 @@ static inline void save_previous_kprobe( kcb->prev_kprobe.orig_tstate_pil = kcb->kprobe_orig_tstate_pil; } -static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) +static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; kcb->kprobe_status = kcb->prev_kprobe.status; @@ -79,7 +79,7 @@ static inline void restore_previous_kpro kcb->kprobe_orig_tstate_pil = kcb->prev_kprobe.orig_tstate_pil; } -static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, +static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = p; @@ -87,7 +87,7 @@ static inline void set_current_kprobe(st kcb->kprobe_orig_tstate_pil = (regs->tstate & TSTATE_PIL); } -static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs, +static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { regs->tstate |= TSTATE_PIL; @@ -273,7 +273,7 @@ static void __kprobes resume_execution(s kcb->kprobe_orig_tstate_pil); } -static inline int post_kprobe_handler(struct pt_regs *regs) +static int __kprobes post_kprobe_handler(struct pt_regs *regs) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); @@ -300,7 +300,7 @@ out: return 1; } -static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) +static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) { struct kprobe *cur = kprobe_running(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c index 0ec4052..6ab852b 100644 --- a/arch/um/drivers/cow_user.c +++ b/arch/um/drivers/cow_user.c @@ -100,7 +100,7 @@ struct cow_header_v3_broken { __u32 alignment; __u32 cow_format; char backing_file[PATH_LEN_V3]; -}; +} __attribute__((packed)); /* COW format definitions - for now, we have only the usual COW bitmap */ #define COW_BITMAP 0 diff --git a/arch/um/include/longjmp.h b/arch/um/include/longjmp.h index 018b381..8e70530 100644 --- a/arch/um/include/longjmp.h +++ b/arch/um/include/longjmp.h @@ -4,11 +4,11 @@ #include #include "os.h" -#define UML_SIGLONGJMP(buf, val) do { \ +#define UML_LONGJMP(buf, val) do { \ longjmp(*buf, val); \ } while(0) -#define UML_SIGSETJMP(buf, enable) ({ \ +#define UML_SETJMP(buf, enable) ({ \ int n; \ enable = get_signals(); \ n = setjmp(*buf); \ diff --git a/arch/um/include/sysdep-i386/kernel-offsets.h b/arch/um/include/sysdep-i386/kernel-offsets.h index 82f96c5..2c13de3 100644 --- a/arch/um/include/sysdep-i386/kernel-offsets.h +++ b/arch/um/include/sysdep-i386/kernel-offsets.h @@ -1,6 +1,7 @@ #include #include #include +#include #define DEFINE(sym, val) \ asm volatile("\n->" #sym " %0 " #val : : "i" (val)) @@ -16,6 +17,7 @@ void foo(void) { OFFSET(HOST_TASK_DEBUGREGS, task_struct, thread.arch.debugregs); + DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); #ifdef CONFIG_MODE_TT OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); #endif diff --git a/arch/um/include/sysdep-x86_64/kernel-offsets.h b/arch/um/include/sysdep-x86_64/kernel-offsets.h index 5ce93ab..939cc47 100644 --- a/arch/um/include/sysdep-x86_64/kernel-offsets.h +++ b/arch/um/include/sysdep-x86_64/kernel-offsets.h @@ -4,6 +4,7 @@ #include #include #include +#include #define DEFINE(sym, val) \ asm volatile("\n->" #sym " %0 " #val : : "i" (val)) @@ -18,6 +19,7 @@ void foo(void) { + DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); #ifdef CONFIG_MODE_TT OFFSET(HOST_TASK_EXTERN_PID, task_struct, thread.mode.tt.extern_pid); #endif diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c index 71bb90a..c6432e7 100644 --- a/arch/um/os-Linux/mem.c +++ b/arch/um/os-Linux/mem.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "kern_util.h" #include "user.h" #include "user_util.h" @@ -19,6 +20,7 @@ #include +static char *default_tmpdir = "/tmp"; static char *tempdir = NULL; static void __init find_tempdir(void) @@ -34,7 +36,7 @@ static void __init find_tempdir(void) break; } if((dir == NULL) || (*dir == '\0')) - dir = "/tmp"; + dir = default_tmpdir; tempdir = malloc(strlen(dir) + 2); if(tempdir == NULL){ @@ -46,6 +48,96 @@ static void __init find_tempdir(void) strcat(tempdir, "/"); } +/* This will return 1, with the first character in buf being the + * character following the next instance of c in the file. This will + * read the file as needed. If there's an error, -errno is returned; + * if the end of the file is reached, 0 is returned. + */ +static int next(int fd, char *buf, int size, char c) +{ + int n; + char *ptr; + + while((ptr = strchr(buf, c)) == NULL){ + n = read(fd, buf, size - 1); + if(n == 0) + return 0; + else if(n < 0) + return -errno; + + buf[n] = '\0'; + } + + ptr++; + memmove(buf, ptr, strlen(ptr) + 1); + return 1; +} + +static int checked_tmpdir = 0; + +/* Look for a tmpfs mounted at /dev/shm. I couldn't find a cleaner + * way to do this than to parse /proc/mounts. statfs will return the + * same filesystem magic number and fs id for both /dev and /dev/shm + * when they are both tmpfs, so you can't tell if they are different + * filesystems. Also, there seems to be no other way of finding the + * mount point of a filesystem from within it. + * + * If a /dev/shm tmpfs entry is found, then we switch to using it. + * Otherwise, we stay with the default /tmp. + */ +static void which_tmpdir(void) +{ + int fd, found; + char buf[128] = { '\0' }; + + if(checked_tmpdir) + return; + + checked_tmpdir = 1; + + printf("Checking for tmpfs mount on /dev/shm..."); + + fd = open("/proc/mounts", O_RDONLY); + if(fd < 0){ + printf("failed to open /proc/mounts, errno = %d\n", errno); + return; + } + + while(1){ + found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), ' '); + if(found != 1) + break; + + if(!strncmp(buf, "/dev/shm", strlen("/dev/shm"))) + goto found; + + found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), '\n'); + if(found != 1) + break; + } + +err: + if(found == 0) + printf("nothing mounted on /dev/shm\n"); + else if(found < 0) + printf("read returned errno %d\n", -found); + + return; + +found: + found = next(fd, buf, sizeof(buf) / sizeof(buf[0]), ' '); + if(found != 1) + goto err; + + if(strncmp(buf, "tmpfs", strlen("tmpfs"))){ + printf("not tmpfs\n"); + return; + } + + printf("OK\n"); + default_tmpdir = "/dev/shm"; +} + /* * This proc still used in tt-mode * (file: kernel/tt/ptproxy/proxy.c, proc: start_debugger). @@ -56,6 +148,7 @@ int make_tempfile(const char *template, char *tempname; int fd; + which_tmpdir(); tempname = malloc(MAXPATHLEN); find_tempdir(); @@ -137,3 +230,26 @@ int create_mem_file(unsigned long long l } return(fd); } + + +void check_tmpexec(void) +{ + void *addr; + int err, fd = create_tmp_file(UM_KERN_PAGE_SIZE); + + addr = mmap(NULL, UM_KERN_PAGE_SIZE, + PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0); + printf("Checking PROT_EXEC mmap in %s...",tempdir); + fflush(stdout); + if(addr == MAP_FAILED){ + err = errno; + perror("failed"); + if(err == EPERM) + printf("%s must be not mounted noexec\n",tempdir); + exit(1); + } + printf("OK\n"); + munmap(addr, UM_KERN_PAGE_SIZE); + + close(fd); +} diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index 8176b0b..3505f44 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c @@ -190,7 +190,7 @@ int os_unmap_memory(void *addr, int len) } #ifndef MADV_REMOVE -#define MADV_REMOVE 0x5 /* remove these pages & resources */ +#define MADV_REMOVE KERNEL_MADV_REMOVE #endif int os_drop_memory(void *addr, int length) @@ -216,7 +216,7 @@ int can_drop_memory(void) } addr = mmap64(NULL, UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, - MAP_PRIVATE, fd, 0); + MAP_SHARED, fd, 0); if(addr == MAP_FAILED){ printk("Mapping test memory file failed, err = %d\n", -errno); return 0; @@ -266,11 +266,11 @@ void init_new_thread_signals(int altstac int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) { - sigjmp_buf buf; + jmp_buf buf; int n, enable; *jmp_ptr = &buf; - n = UML_SIGSETJMP(&buf, enable); + n = UML_SETJMP(&buf, enable); if(n != 0) return(n); (*fn)(arg); diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 045ae00..0776bc1 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c @@ -434,7 +434,7 @@ void new_thread(void *stack, void **swit void (*handler)(int)) { unsigned long flags; - sigjmp_buf switch_buf, fork_buf; + jmp_buf switch_buf, fork_buf; int enable; *switch_buf_ptr = &switch_buf; @@ -450,7 +450,7 @@ void new_thread(void *stack, void **swit */ flags = get_signals(); block_signals(); - if(UML_SIGSETJMP(&fork_buf, enable) == 0) + if(UML_SETJMP(&fork_buf, enable) == 0) new_thread_proc(stack, handler); remove_sigstack(); @@ -466,35 +466,35 @@ void new_thread(void *stack, void **swit void thread_wait(void *sw, void *fb) { - sigjmp_buf buf, **switch_buf = sw, *fork_buf; + jmp_buf buf, **switch_buf = sw, *fork_buf; int enable; *switch_buf = &buf; fork_buf = fb; - if(UML_SIGSETJMP(&buf, enable) == 0) + if(UML_SETJMP(&buf, enable) == 0) siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK); } void switch_threads(void *me, void *next) { - sigjmp_buf my_buf, **me_ptr = me, *next_buf = next; + jmp_buf my_buf, **me_ptr = me, *next_buf = next; int enable; *me_ptr = &my_buf; - if(UML_SIGSETJMP(&my_buf, enable) == 0) - UML_SIGLONGJMP(next_buf, 1); + if(UML_SETJMP(&my_buf, enable) == 0) + UML_LONGJMP(next_buf, 1); } -static sigjmp_buf initial_jmpbuf; +static jmp_buf initial_jmpbuf; /* XXX Make these percpu */ static void (*cb_proc)(void *arg); static void *cb_arg; -static sigjmp_buf *cb_back; +static jmp_buf *cb_back; int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) { - sigjmp_buf **switch_buf = switch_buf_ptr; + jmp_buf **switch_buf = switch_buf_ptr; int n, enable; set_handler(SIGWINCH, (__sighandler_t) sig_handler, @@ -502,7 +502,7 @@ int start_idle_thread(void *stack, void SIGVTALRM, -1); *fork_buf_ptr = &initial_jmpbuf; - n = UML_SIGSETJMP(&initial_jmpbuf, enable); + n = UML_SETJMP(&initial_jmpbuf, enable); switch(n){ case INIT_JMP_NEW_THREAD: new_thread_proc((void *) stack, new_thread_handler); @@ -512,7 +512,7 @@ int start_idle_thread(void *stack, void break; case INIT_JMP_CALLBACK: (*cb_proc)(cb_arg); - UML_SIGLONGJMP(cb_back, 1); + UML_LONGJMP(cb_back, 1); break; case INIT_JMP_HALT: kmalloc_ok = 0; @@ -523,12 +523,12 @@ int start_idle_thread(void *stack, void default: panic("Bad sigsetjmp return in start_idle_thread - %d\n", n); } - UML_SIGLONGJMP(*switch_buf, 1); + UML_LONGJMP(*switch_buf, 1); } void initial_thread_cb_skas(void (*proc)(void *), void *arg) { - sigjmp_buf here; + jmp_buf here; int enable; cb_proc = proc; @@ -536,8 +536,8 @@ void initial_thread_cb_skas(void (*proc) cb_back = &here; block_signals(); - if(UML_SIGSETJMP(&here, enable) == 0) - UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); + if(UML_SETJMP(&here, enable) == 0) + UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK); unblock_signals(); cb_proc = NULL; @@ -548,13 +548,13 @@ void initial_thread_cb_skas(void (*proc) void halt_skas(void) { block_signals(); - UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_HALT); + UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT); } void reboot_skas(void) { block_signals(); - UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); + UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); } void switch_mm_skas(struct mm_id *mm_idp) diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index 387e26a..5031485 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c @@ -296,29 +296,7 @@ static void __init check_ptrace(void) check_sysemu(); } -extern int create_tmp_file(unsigned long long len); - -static void check_tmpexec(void) -{ - void *addr; - int err, fd = create_tmp_file(UM_KERN_PAGE_SIZE); - - addr = mmap(NULL, UM_KERN_PAGE_SIZE, - PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0); - printf("Checking PROT_EXEC mmap in /tmp..."); - fflush(stdout); - if(addr == MAP_FAILED){ - err = errno; - perror("failed"); - if(err == EPERM) - printf("/tmp must be not mounted noexec\n"); - exit(1); - } - printf("OK\n"); - munmap(addr, UM_KERN_PAGE_SIZE); - - close(fd); -} +extern void check_tmpexec(void); void os_early_checks(void) { diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c index a9f6b26..90b29ae 100644 --- a/arch/um/os-Linux/trap.c +++ b/arch/um/os-Linux/trap.c @@ -35,7 +35,7 @@ void os_fill_handlinfo(struct kern_handl void do_longjmp(void *b, int val) { - sigjmp_buf *buf = b; + jmp_buf *buf = b; - UML_SIGLONGJMP(buf, val); + UML_LONGJMP(buf, val); } diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c index 166fb66..e523719 100644 --- a/arch/um/os-Linux/uaccess.c +++ b/arch/um/os-Linux/uaccess.c @@ -16,9 +16,9 @@ unsigned long __do_user_copy(void *to, c unsigned long *faddrp = (unsigned long *) fault_addr, ret; int enable; - sigjmp_buf jbuf; + jmp_buf jbuf; *fault_catcher = &jbuf; - if(UML_SIGSETJMP(&jbuf, enable) == 0){ + if(UML_SETJMP(&jbuf, enable) == 0){ (*op)(to, from, n); ret = 0; *faulted_out = 0; diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c index e32065e..c47a2a7 100644 --- a/arch/um/os-Linux/util.c +++ b/arch/um/os-Linux/util.c @@ -104,7 +104,7 @@ void setup_hostinfo(void) int setjmp_wrapper(void (*proc)(void *, void *), ...) { va_list args; - sigjmp_buf buf; + jmp_buf buf; int n; n = sigsetjmp(buf, 1); diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c index 618fd85..0709fc6 100644 --- a/arch/um/sys-i386/signal.c +++ b/arch/um/sys-i386/signal.c @@ -57,7 +57,7 @@ static int copy_sc_from_user_skas(struct return(0); } -int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate __user *to_fp, +int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *to_fp, struct pt_regs *regs, unsigned long sp) { struct sigcontext sc; @@ -132,7 +132,7 @@ int copy_sc_from_user_tt(struct sigconte return(err); } -int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate __user *fp, +int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp, struct sigcontext *from, int fpsize, unsigned long sp) { struct _fpstate __user *to_fp; @@ -167,7 +167,7 @@ static int copy_sc_from_user(struct pt_r return(ret); } -static int copy_sc_to_user(struct sigcontext *to, struct _fpstate __user *fp, +static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp, struct pt_regs *from, unsigned long sp) { return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c index a37f672..2355dc1 100644 --- a/arch/um/sys-i386/stub_segv.c +++ b/arch/um/sys-i386/stub_segv.c @@ -27,6 +27,6 @@ stub_segv_handler(int sig) * the stack in its original form when we do the sigreturn here, by * hand. */ - __asm__("mov %0,%%esp ; movl %1, %%eax ; " - "int $0x80" : : "a" (sc), "g" (__NR_sigreturn)); + __asm__ __volatile__("mov %0,%%esp ; movl %1, %%eax ; " + "int $0x80" : : "a" (sc), "g" (__NR_sigreturn)); } diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c index a270995..1c96702 100644 --- a/arch/um/sys-x86_64/stub_segv.c +++ b/arch/um/sys-x86_64/stub_segv.c @@ -33,7 +33,7 @@ stub_segv_handler(int sig) struct ucontext *uc; int pid; - __asm__("movq %%rdx, %0" : "=g" (uc) :); + __asm__ __volatile__("movq %%rdx, %0" : "=g" (uc) :); GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), &uc->uc_mcontext); @@ -44,8 +44,8 @@ stub_segv_handler(int sig) * the signal frame. So, we use the ucontext pointer, which we know * already, to get the signal frame pointer, and add 8 to that. */ - __asm__("movq %0, %%rsp; movq %1, %%rax ; syscall": : - "g" ((unsigned long) container_of(uc, struct rt_sigframe, - uc) + 8), - "g" (__NR_rt_sigreturn)); + __asm__ __volatile__("movq %0, %%rsp; movq %1, %%rax ; syscall": : + "g" ((unsigned long) + container_of(uc, struct rt_sigframe, uc) + 8), + "g" (__NR_rt_sigreturn)); } diff --git a/arch/x86_64/ia32/Makefile b/arch/x86_64/ia32/Makefile index 929e6b0..e9263b4 100644 --- a/arch/x86_64/ia32/Makefile +++ b/arch/x86_64/ia32/Makefile @@ -27,5 +27,5 @@ $(obj)/vsyscall-sysenter.so $(obj)/vsysc $(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE $(call if_changed,syscall) -AFLAGS_vsyscall-sysenter.o = -m32 -AFLAGS_vsyscall-syscall.o = -m32 +AFLAGS_vsyscall-sysenter.o = -m32 -Wa,-32 +AFLAGS_vsyscall-syscall.o = -m32 -Wa,-32 diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c index accbff3..1eaa5da 100644 --- a/arch/x86_64/kernel/kprobes.c +++ b/arch/x86_64/kernel/kprobes.c @@ -53,7 +53,7 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kpr /* * returns non-zero if opcode modifies the interrupt flag. */ -static inline int is_IF_modifier(kprobe_opcode_t *insn) +static __always_inline int is_IF_modifier(kprobe_opcode_t *insn) { switch (*insn) { case 0xfa: /* cli */ @@ -84,7 +84,7 @@ int __kprobes arch_prepare_kprobe(struct * If it does, return the address of the 32-bit displacement word. * If not, return null. */ -static inline s32 *is_riprel(u8 *insn) +static s32 __kprobes *is_riprel(u8 *insn) { #define W(row,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,ba,bb,bc,bd,be,bf) \ (((b0##UL << 0x0)|(b1##UL << 0x1)|(b2##UL << 0x2)|(b3##UL << 0x3) | \ @@ -229,7 +229,7 @@ void __kprobes arch_remove_kprobe(struct mutex_unlock(&kprobe_mutex); } -static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) +static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) { kcb->prev_kprobe.kp = kprobe_running(); kcb->prev_kprobe.status = kcb->kprobe_status; @@ -237,7 +237,7 @@ static inline void save_previous_kprobe( kcb->prev_kprobe.saved_rflags = kcb->kprobe_saved_rflags; } -static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb) +static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp; kcb->kprobe_status = kcb->prev_kprobe.status; @@ -245,7 +245,7 @@ static inline void restore_previous_kpro kcb->kprobe_saved_rflags = kcb->prev_kprobe.saved_rflags; } -static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, +static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { __get_cpu_var(current_kprobe) = p; diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c index 6f0790e..c69fc43 100644 --- a/arch/x86_64/kernel/mce.c +++ b/arch/x86_64/kernel/mce.c @@ -629,7 +629,7 @@ static __cpuinit void mce_remove_device( #endif /* Get notified when a cpu comes on/off. Be hotplug friendly. */ -static __cpuinit int +static int mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; diff --git a/arch/x86_64/kernel/mce_amd.c b/arch/x86_64/kernel/mce_amd.c index d3ad7d8..d13b241 100644 --- a/arch/x86_64/kernel/mce_amd.c +++ b/arch/x86_64/kernel/mce_amd.c @@ -482,7 +482,7 @@ static void threshold_remove_device(unsi #endif /* get notified when a cpu comes on/off */ -static __cpuinit int threshold_cpu_callback(struct notifier_block *nfb, +static int threshold_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { /* cpu was unsigned int to begin with */ diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index a6c01e1..9d3d76c 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c @@ -112,10 +112,6 @@ static unsigned long alloc_iommu(int siz static void free_iommu(unsigned long offset, int size) { unsigned long flags; - if (size == 1) { - clear_bit(offset, iommu_gart_bitmap); - return; - } spin_lock_irqsave(&iommu_bitmap_lock, flags); __clear_bit_string(iommu_gart_bitmap, offset, size); spin_unlock_irqrestore(&iommu_bitmap_lock, flags); diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 1c44b53..fb903e6 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c @@ -575,8 +575,10 @@ __switch_to(struct task_struct *prev_p, prev->userrsp = read_pda(oldrsp); write_pda(oldrsp, next->userrsp); write_pda(pcurrent, next_p); + /* This must be here to ensure both math_state_restore() and - kernel_fpu_begin() work consistently. */ + kernel_fpu_begin() work consistently. + And the AMD workaround requires it to be after DS reload. */ unlazy_fpu(prev_p); write_pda(kernelstack, task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET); diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index c50b067..759070c 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c @@ -930,6 +930,10 @@ static int __init init_amd(struct cpuinf if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)) set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); + /* Enable workaround for FXSAVE leak */ + if (c->x86 >= 6) + set_bit(X86_FEATURE_FXSAVE_LEAK, &c->x86_capability); + r = get_model_name(c); if (!r) { switch (c->x86) { diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c index cc02573..b2fac14 100644 --- a/arch/x86_64/mm/numa.c +++ b/arch/x86_64/mm/numa.c @@ -188,11 +188,13 @@ void __init setup_node_zones(int nodeid) memory. */ memmapsize = sizeof(struct page) * (end_pfn-start_pfn); limit = end_pfn << PAGE_SHIFT; +#ifdef CONFIG_FLAT_NODE_MEM_MAP NODE_DATA(nodeid)->node_mem_map = __alloc_bootmem_core(NODE_DATA(nodeid)->bdata, memmapsize, SMP_CACHE_BYTES, round_down(limit - memmapsize, PAGE_SIZE), limit); +#endif size_zones(zones, holes, start_pfn, end_pfn); free_area_init_node(nodeid, NODE_DATA(nodeid), zones, diff --git a/block/elevator.c b/block/elevator.c index 0d6be03..2982579 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -895,10 +895,8 @@ ssize_t elv_iosched_show(request_queue_t EXPORT_SYMBOL(elv_dispatch_sort); EXPORT_SYMBOL(elv_add_request); EXPORT_SYMBOL(__elv_add_request); -EXPORT_SYMBOL(elv_requeue_request); EXPORT_SYMBOL(elv_next_request); EXPORT_SYMBOL(elv_dequeue_request); EXPORT_SYMBOL(elv_queue_empty); -EXPORT_SYMBOL(elv_completed_request); EXPORT_SYMBOL(elevator_exit); EXPORT_SYMBOL(elevator_init); diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index e112d1a..e5041a0 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c @@ -1554,7 +1554,7 @@ void blk_plug_device(request_queue_t *q) * don't plug a stopped queue, it must be paired with blk_start_queue() * which will restart the queueing */ - if (test_bit(QUEUE_FLAG_STOPPED, &q->queue_flags)) + if (blk_queue_stopped(q)) return; if (!test_and_set_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags)) { @@ -1587,7 +1587,7 @@ EXPORT_SYMBOL(blk_remove_plug); */ void __generic_unplug_device(request_queue_t *q) { - if (unlikely(test_bit(QUEUE_FLAG_STOPPED, &q->queue_flags))) + if (unlikely(blk_queue_stopped(q))) return; if (!blk_remove_plug(q)) @@ -3385,7 +3385,7 @@ static int blk_cpu_notify(struct notifie } -static struct notifier_block __devinitdata blk_cpu_notifier = { +static struct notifier_block blk_cpu_notifier = { .notifier_call = blk_cpu_notify, }; diff --git a/drivers/base/topology.c b/drivers/base/topology.c index 915810f..8c52421 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c @@ -107,7 +107,7 @@ static int __cpuinit topology_remove_dev return 0; } -static int __cpuinit topology_cpu_callback(struct notifier_block *nfb, +static int topology_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; diff --git a/drivers/char/cs5535_gpio.c b/drivers/char/cs5535_gpio.c index 5d72f50..46d6603 100644 --- a/drivers/char/cs5535_gpio.c +++ b/drivers/char/cs5535_gpio.c @@ -241,9 +241,10 @@ static int __init cs5535_gpio_init(void) static void __exit cs5535_gpio_cleanup(void) { dev_t dev_id = MKDEV(major, 0); + + cdev_del(&cs5535_gpio_cdev); unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT); - if (gpio_base != 0) - release_region(gpio_base, CS5535_GPIO_SIZE); + release_region(gpio_base, CS5535_GPIO_SIZE); } module_init(cs5535_gpio_init); diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index e1aadae..cb76e5c 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -889,7 +889,6 @@ extern int drm_lock_free(drm_device_t * /* Buffer management support (drm_bufs.h) */ extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request); -extern int drm_addbufs_fb(drm_device_t *dev, drm_buf_desc_t *request); extern int drm_addmap(drm_device_t * dev, unsigned int offset, unsigned int size, drm_map_type_t type, drm_map_flags_t flags, drm_local_map_t ** map_ptr); diff --git a/drivers/char/drm/drm_agpsupport.c b/drivers/char/drm/drm_agpsupport.c index fabc930..40bfd9b 100644 --- a/drivers/char/drm/drm_agpsupport.c +++ b/drivers/char/drm/drm_agpsupport.c @@ -503,8 +503,6 @@ int drm_agp_bind_memory(DRM_AGP_MEM * ha return agp_bind_memory(handle, start); } -EXPORT_SYMBOL(drm_agp_bind_memory); - /** Calls agp_unbind_memory() */ int drm_agp_unbind_memory(DRM_AGP_MEM * handle) { diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c index 8a9cf12..006b06d 100644 --- a/drivers/char/drm/drm_bufs.c +++ b/drivers/char/drm/drm_bufs.c @@ -386,7 +386,6 @@ int drm_rmmap_locked(drm_device_t *dev, return 0; } -EXPORT_SYMBOL(drm_rmmap_locked); int drm_rmmap(drm_device_t *dev, drm_local_map_t *map) { @@ -398,7 +397,6 @@ int drm_rmmap(drm_device_t *dev, drm_loc return ret; } -EXPORT_SYMBOL(drm_rmmap); /* The rmmap ioctl appears to be unnecessary. All mappings are torn down on * the last close of the device, and this is necessary for cleanup when things @@ -1053,7 +1051,7 @@ static int drm_addbufs_sg(drm_device_t * return 0; } -int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) +static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) { drm_device_dma_t *dma = dev->dma; drm_buf_entry_t *entry; @@ -1212,7 +1210,6 @@ int drm_addbufs_fb(drm_device_t * dev, d atomic_dec(&dev->buf_alloc); return 0; } -EXPORT_SYMBOL(drm_addbufs_fb); /** diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c index 68073e1..9a842a3 100644 --- a/drivers/char/drm/drm_stub.c +++ b/drivers/char/drm/drm_stub.c @@ -229,8 +229,6 @@ int drm_get_dev(struct pci_dev *pdev, co return ret; } -EXPORT_SYMBOL(drm_get_dev); - /** * Put a device minor number. * diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c index b108c7f..26bdf2c 100644 --- a/drivers/char/drm/r300_cmdbuf.c +++ b/drivers/char/drm/r300_cmdbuf.c @@ -723,7 +723,7 @@ static int r300_scratch(drm_radeon_priva dev_priv->scratch_ages[header.scratch.reg]++; - ref_age_base = *(u32 **)cmdbuf->buf; + ref_age_base = (u32 *)(unsigned long)*((uint64_t *)cmdbuf->buf); cmdbuf->buf += sizeof(u64); cmdbuf->bufsz -= sizeof(u64); diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c index 58dcdee..0030cd8 100644 --- a/drivers/char/ipmi/ipmi_bt_sm.c +++ b/drivers/char/ipmi/ipmi_bt_sm.c @@ -165,7 +165,7 @@ static int bt_start_transaction(struct s { unsigned int i; - if ((size < 2) || (size > IPMI_MAX_MSG_LENGTH)) + if ((size < 2) || (size > (IPMI_MAX_MSG_LENGTH - 2))) return -1; if ((bt->state != BT_STATE_IDLE) && (bt->state != BT_STATE_HOSED)) diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index a86c0f2..b36eef0 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -2198,11 +2198,11 @@ static inline void wait_for_timer_and_th } } -static struct ipmi_default_vals +static __devinitdata struct ipmi_default_vals { int type; int port; -} __devinit ipmi_defaults[] = +} ipmi_defaults[] = { { .type = SI_KCS, .port = 0xca2 }, { .type = SI_SMIC, .port = 0xca9 }, diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 66719f9..1fa9fa1 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -578,6 +579,18 @@ static ssize_t write_null(struct file * return count; } +static int pipe_to_null(struct pipe_inode_info *info, struct pipe_buffer *buf, + struct splice_desc *sd) +{ + return sd->len; +} + +static ssize_t splice_write_null(struct pipe_inode_info *pipe,struct file *out, + loff_t *ppos, size_t len, unsigned int flags) +{ + return splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_null); +} + #ifdef CONFIG_MMU /* * For fun, we are using the MMU for this. @@ -785,6 +798,7 @@ static struct file_operations null_fops .llseek = null_lseek, .read = read_null, .write = write_null, + .splice_write = splice_write_null, }; #if defined(CONFIG_ISA) || !defined(__mc68000__) diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index b543821..56c8243 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c @@ -390,7 +390,8 @@ scdrv_init(void) format_module_id(devnamep, geo_module(geoid), MODULE_FORMAT_BRIEF); devnamep = devname + strlen(devname); - sprintf(devnamep, "#%d", geo_slab(geoid)); + sprintf(devnamep, "^%d#%d", geo_slot(geoid), + geo_slab(geoid)); /* allocate sysctl device data */ scd = kzalloc(sizeof (struct sysctl_data_s), diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index f8dd852..a90f5d9 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c @@ -1341,6 +1341,9 @@ static int __devinit sonypi_probe(struct else if ((pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, NULL))) sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE3; + else if ((pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_ICH7_1, NULL))) + sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE3; else sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE2; diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig index a6873bf..1efde3b 100644 --- a/drivers/char/tpm/Kconfig +++ b/drivers/char/tpm/Kconfig @@ -20,9 +20,18 @@ config TCG_TPM Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI and CONFIG_PNPACPI. +config TCG_TIS + tristate "TPM Interface Specification 1.2 Interface" + depends on TCG_TPM + ---help--- + If you have a TPM security chip that is compliant with the + TCG TIS 1.2 TPM specification say Yes and it will be accessible + from within Linux. To compile this driver as a module, choose + M here; the module will be called tpm_tis. + config TCG_NSC tristate "National Semiconductor TPM Interface" - depends on TCG_TPM + depends on TCG_TPM && PNPACPI ---help--- If you have a TPM security chip from National Semicondutor say Yes and it will be accessible from within Linux. To diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile index ba4582d..ea3a1e0 100644 --- a/drivers/char/tpm/Makefile +++ b/drivers/char/tpm/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_TCG_TPM) += tpm.o ifdef CONFIG_ACPI obj-$(CONFIG_TCG_TPM) += tpm_bios.o endif +obj-$(CONFIG_TCG_TIS) += tpm_tis.o obj-$(CONFIG_TCG_NSC) += tpm_nsc.o obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 5a38704..6889e7d 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c @@ -32,12 +32,291 @@ enum tpm_const { TPM_MINOR = 224, /* officially assigned */ TPM_BUFSIZE = 2048, TPM_NUM_DEVICES = 256, - TPM_NUM_MASK_ENTRIES = TPM_NUM_DEVICES / (8 * sizeof(int)) }; +enum tpm_duration { + TPM_SHORT = 0, + TPM_MEDIUM = 1, + TPM_LONG = 2, + TPM_UNDEFINED, +}; + +#define TPM_MAX_ORDINAL 243 +#define TPM_MAX_PROTECTED_ORDINAL 12 +#define TPM_PROTECTED_ORDINAL_MASK 0xFF + static LIST_HEAD(tpm_chip_list); static DEFINE_SPINLOCK(driver_lock); -static int dev_mask[TPM_NUM_MASK_ENTRIES]; +static DECLARE_BITMAP(dev_mask, TPM_NUM_DEVICES); + +/* + * Array with one entry per ordinal defining the maximum amount + * of time the chip could take to return the result. The ordinal + * designation of short, medium or long is defined in a table in + * TCG Specification TPM Main Part 2 TPM Structures Section 17. The + * values of the SHORT, MEDIUM, and LONG durations are retrieved + * from the chip during initialization with a call to tpm_get_timeouts. + */ +static const u8 tpm_protected_ordinal_duration[TPM_MAX_PROTECTED_ORDINAL] = { + TPM_UNDEFINED, /* 0 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, /* 5 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, /* 10 */ + TPM_SHORT, +}; + +static const u8 tpm_ordinal_duration[TPM_MAX_ORDINAL] = { + TPM_UNDEFINED, /* 0 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, /* 5 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, /* 10 */ + TPM_SHORT, + TPM_MEDIUM, + TPM_LONG, + TPM_LONG, + TPM_MEDIUM, /* 15 */ + TPM_SHORT, + TPM_SHORT, + TPM_MEDIUM, + TPM_LONG, + TPM_SHORT, /* 20 */ + TPM_SHORT, + TPM_MEDIUM, + TPM_MEDIUM, + TPM_MEDIUM, + TPM_SHORT, /* 25 */ + TPM_SHORT, + TPM_MEDIUM, + TPM_SHORT, + TPM_SHORT, + TPM_MEDIUM, /* 30 */ + TPM_LONG, + TPM_MEDIUM, + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, /* 35 */ + TPM_MEDIUM, + TPM_MEDIUM, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_MEDIUM, /* 40 */ + TPM_LONG, + TPM_MEDIUM, + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, /* 45 */ + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, + TPM_LONG, + TPM_MEDIUM, /* 50 */ + TPM_MEDIUM, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, /* 55 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_MEDIUM, /* 60 */ + TPM_MEDIUM, + TPM_MEDIUM, + TPM_SHORT, + TPM_SHORT, + TPM_MEDIUM, /* 65 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, /* 70 */ + TPM_SHORT, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, /* 75 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_LONG, /* 80 */ + TPM_UNDEFINED, + TPM_MEDIUM, + TPM_LONG, + TPM_SHORT, + TPM_UNDEFINED, /* 85 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, /* 90 */ + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, + TPM_UNDEFINED, /* 95 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_MEDIUM, /* 100 */ + TPM_SHORT, + TPM_SHORT, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, /* 105 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, /* 110 */ + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, /* 115 */ + TPM_SHORT, + TPM_SHORT, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_LONG, /* 120 */ + TPM_LONG, + TPM_MEDIUM, + TPM_UNDEFINED, + TPM_SHORT, + TPM_SHORT, /* 125 */ + TPM_SHORT, + TPM_LONG, + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, /* 130 */ + TPM_MEDIUM, + TPM_UNDEFINED, + TPM_SHORT, + TPM_MEDIUM, + TPM_UNDEFINED, /* 135 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, /* 140 */ + TPM_SHORT, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, /* 145 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, /* 150 */ + TPM_MEDIUM, + TPM_MEDIUM, + TPM_SHORT, + TPM_SHORT, + TPM_UNDEFINED, /* 155 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, /* 160 */ + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, + TPM_UNDEFINED, + TPM_UNDEFINED, /* 165 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_LONG, /* 170 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, /* 175 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_MEDIUM, /* 180 */ + TPM_SHORT, + TPM_MEDIUM, + TPM_MEDIUM, + TPM_MEDIUM, + TPM_MEDIUM, /* 185 */ + TPM_SHORT, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, /* 190 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, /* 195 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, /* 200 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, + TPM_SHORT, /* 205 */ + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, + TPM_MEDIUM, /* 210 */ + TPM_UNDEFINED, + TPM_MEDIUM, + TPM_MEDIUM, + TPM_MEDIUM, + TPM_UNDEFINED, /* 215 */ + TPM_MEDIUM, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, + TPM_SHORT, /* 220 */ + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, + TPM_SHORT, + TPM_UNDEFINED, /* 225 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, /* 230 */ + TPM_LONG, + TPM_MEDIUM, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, /* 235 */ + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_UNDEFINED, + TPM_SHORT, /* 240 */ + TPM_UNDEFINED, + TPM_MEDIUM, +}; static void user_reader_timeout(unsigned long ptr) { @@ -46,7 +325,7 @@ static void user_reader_timeout(unsigned schedule_work(&chip->work); } -static void timeout_work(void * ptr) +static void timeout_work(void *ptr) { struct tpm_chip *chip = ptr; @@ -57,17 +336,43 @@ static void timeout_work(void * ptr) } /* + * Returns max number of jiffies to wait + */ +unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, + u32 ordinal) +{ + int duration_idx = TPM_UNDEFINED; + int duration = 0; + + if (ordinal < TPM_MAX_ORDINAL) + duration_idx = tpm_ordinal_duration[ordinal]; + else if ((ordinal & TPM_PROTECTED_ORDINAL_MASK) < + TPM_MAX_PROTECTED_ORDINAL) + duration_idx = + tpm_protected_ordinal_duration[ordinal & + TPM_PROTECTED_ORDINAL_MASK]; + + if (duration_idx != TPM_UNDEFINED) + duration = chip->vendor.duration[duration_idx]; + if (duration <= 0) + return 2 * 60 * HZ; + else + return duration; +} +EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); + +/* * Internal kernel interface to transmit TPM commands */ static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, size_t bufsiz) { ssize_t rc; - u32 count; + u32 count, ordinal; unsigned long stop; count = be32_to_cpu(*((__be32 *) (buf + 2))); - + ordinal = be32_to_cpu(*((__be32 *) (buf + 6))); if (count == 0) return -ENODATA; if (count > bufsiz) { @@ -78,21 +383,23 @@ static ssize_t tpm_transmit(struct tpm_c down(&chip->tpm_mutex); - if ((rc = chip->vendor->send(chip, (u8 *) buf, count)) < 0) { + if ((rc = chip->vendor.send(chip, (u8 *) buf, count)) < 0) { dev_err(chip->dev, "tpm_transmit: tpm_send: error %zd\n", rc); goto out; } - stop = jiffies + 2 * 60 * HZ; + if (chip->vendor.irq) + goto out_recv; + + stop = jiffies + tpm_calc_ordinal_duration(chip, ordinal); do { - u8 status = chip->vendor->status(chip); - if ((status & chip->vendor->req_complete_mask) == - chip->vendor->req_complete_val) { + u8 status = chip->vendor.status(chip); + if ((status & chip->vendor.req_complete_mask) == + chip->vendor.req_complete_val) goto out_recv; - } - if ((status == chip->vendor->req_canceled)) { + if ((status == chip->vendor.req_canceled)) { dev_err(chip->dev, "Operation Canceled\n"); rc = -ECANCELED; goto out; @@ -102,14 +409,13 @@ static ssize_t tpm_transmit(struct tpm_c rmb(); } while (time_before(jiffies, stop)); - - chip->vendor->cancel(chip); + chip->vendor.cancel(chip); dev_err(chip->dev, "Operation Timed out\n"); rc = -ETIME; goto out; out_recv: - rc = chip->vendor->recv(chip, (u8 *) buf, bufsiz); + rc = chip->vendor.recv(chip, (u8 *) buf, bufsiz); if (rc < 0) dev_err(chip->dev, "tpm_transmit: tpm_recv: error %zd\n", rc); @@ -119,17 +425,247 @@ out: } #define TPM_DIGEST_SIZE 20 -#define CAP_PCR_RESULT_SIZE 18 -static const u8 cap_pcr[] = { +#define TPM_ERROR_SIZE 10 +#define TPM_RET_CODE_IDX 6 +#define TPM_GET_CAP_RET_SIZE_IDX 10 +#define TPM_GET_CAP_RET_UINT32_1_IDX 14 +#define TPM_GET_CAP_RET_UINT32_2_IDX 18 +#define TPM_GET_CAP_RET_UINT32_3_IDX 22 +#define TPM_GET_CAP_RET_UINT32_4_IDX 26 +#define TPM_GET_CAP_PERM_DISABLE_IDX 16 +#define TPM_GET_CAP_PERM_INACTIVE_IDX 18 +#define TPM_GET_CAP_RET_BOOL_1_IDX 14 +#define TPM_GET_CAP_TEMP_INACTIVE_IDX 16 + +#define TPM_CAP_IDX 13 +#define TPM_CAP_SUBCAP_IDX 21 + +enum tpm_capabilities { + TPM_CAP_FLAG = 4, + TPM_CAP_PROP = 5, +}; + +enum tpm_sub_capabilities { + TPM_CAP_PROP_PCR = 0x1, + TPM_CAP_PROP_MANUFACTURER = 0x3, + TPM_CAP_FLAG_PERM = 0x8, + TPM_CAP_FLAG_VOL = 0x9, + TPM_CAP_PROP_OWNER = 0x11, + TPM_CAP_PROP_TIS_TIMEOUT = 0x15, + TPM_CAP_PROP_TIS_DURATION = 0x20, +}; + +/* + * This is a semi generic GetCapability command for use + * with the capability type TPM_CAP_PROP or TPM_CAP_FLAG + * and their associated sub_capabilities. + */ + +static const u8 tpm_cap[] = { 0, 193, /* TPM_TAG_RQU_COMMAND */ 0, 0, 0, 22, /* length */ 0, 0, 0, 101, /* TPM_ORD_GetCapability */ - 0, 0, 0, 5, - 0, 0, 0, 4, - 0, 0, 1, 1 + 0, 0, 0, 0, /* TPM_CAP_ */ + 0, 0, 0, 4, /* TPM_CAP_SUB_ size */ + 0, 0, 1, 0 /* TPM_CAP_SUB_ */ }; -#define READ_PCR_RESULT_SIZE 30 +static ssize_t transmit_cmd(struct tpm_chip *chip, u8 *data, int len, + char *desc) +{ + int err; + + len = tpm_transmit(chip, data, len); + if (len < 0) + return len; + if (len == TPM_ERROR_SIZE) { + err = be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX))); + dev_dbg(chip->dev, "A TPM error (%d) occurred %s\n", err, desc); + return err; + } + return 0; +} + +void tpm_gen_interrupt(struct tpm_chip *chip) +{ + u8 data[max_t(int, ARRAY_SIZE(tpm_cap), 30)]; + ssize_t rc; + + memcpy(data, tpm_cap, sizeof(tpm_cap)); + data[TPM_CAP_IDX] = TPM_CAP_PROP; + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_TIS_TIMEOUT; + + rc = transmit_cmd(chip, data, sizeof(data), + "attempting to determine the timeouts"); +} +EXPORT_SYMBOL_GPL(tpm_gen_interrupt); + +void tpm_get_timeouts(struct tpm_chip *chip) +{ + u8 data[max_t(int, ARRAY_SIZE(tpm_cap), 30)]; + ssize_t rc; + u32 timeout; + + memcpy(data, tpm_cap, sizeof(tpm_cap)); + data[TPM_CAP_IDX] = TPM_CAP_PROP; + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_TIS_TIMEOUT; + + rc = transmit_cmd(chip, data, sizeof(data), + "attempting to determine the timeouts"); + if (rc) + goto duration; + + if (be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_SIZE_IDX))) + != 4 * sizeof(u32)) + goto duration; + + /* Don't overwrite default if value is 0 */ + timeout = + be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX))); + if (timeout) + chip->vendor.timeout_a = msecs_to_jiffies(timeout); + timeout = + be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_2_IDX))); + if (timeout) + chip->vendor.timeout_b = msecs_to_jiffies(timeout); + timeout = + be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_3_IDX))); + if (timeout) + chip->vendor.timeout_c = msecs_to_jiffies(timeout); + timeout = + be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_4_IDX))); + if (timeout) + chip->vendor.timeout_d = msecs_to_jiffies(timeout); + +duration: + memcpy(data, tpm_cap, sizeof(tpm_cap)); + data[TPM_CAP_IDX] = TPM_CAP_PROP; + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_TIS_DURATION; + + rc = transmit_cmd(chip, data, sizeof(data), + "attempting to determine the durations"); + if (rc) + return; + + if (be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_SIZE_IDX))) + != 3 * sizeof(u32)) + return; + + chip->vendor.duration[TPM_SHORT] = + msecs_to_jiffies(be32_to_cpu + (*((__be32 *) (data + + TPM_GET_CAP_RET_UINT32_1_IDX)))); + chip->vendor.duration[TPM_MEDIUM] = + msecs_to_jiffies(be32_to_cpu + (*((__be32 *) (data + + TPM_GET_CAP_RET_UINT32_2_IDX)))); + chip->vendor.duration[TPM_LONG] = + msecs_to_jiffies(be32_to_cpu + (*((__be32 *) (data + + TPM_GET_CAP_RET_UINT32_3_IDX)))); +} +EXPORT_SYMBOL_GPL(tpm_get_timeouts); + +void tpm_continue_selftest(struct tpm_chip *chip) +{ + u8 data[] = { + 0, 193, /* TPM_TAG_RQU_COMMAND */ + 0, 0, 0, 10, /* length */ + 0, 0, 0, 83, /* TPM_ORD_GetCapability */ + }; + + tpm_transmit(chip, data, sizeof(data)); +} +EXPORT_SYMBOL_GPL(tpm_continue_selftest); + +ssize_t tpm_show_enabled(struct device * dev, struct device_attribute * attr, + char *buf) +{ + u8 data[max_t(int, ARRAY_SIZE(tpm_cap), 35)]; + ssize_t rc; + + struct tpm_chip *chip = dev_get_drvdata(dev); + if (chip == NULL) + return -ENODEV; + + memcpy(data, tpm_cap, sizeof(tpm_cap)); + data[TPM_CAP_IDX] = TPM_CAP_FLAG; + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_PERM; + + rc = transmit_cmd(chip, data, sizeof(data), + "attemtping to determine the permanent state"); + if (rc) + return 0; + return sprintf(buf, "%d\n", !data[TPM_GET_CAP_PERM_DISABLE_IDX]); +} +EXPORT_SYMBOL_GPL(tpm_show_enabled); + +ssize_t tpm_show_active(struct device * dev, struct device_attribute * attr, + char *buf) +{ + u8 data[max_t(int, ARRAY_SIZE(tpm_cap), 35)]; + ssize_t rc; + + struct tpm_chip *chip = dev_get_drvdata(dev); + if (chip == NULL) + return -ENODEV; + + memcpy(data, tpm_cap, sizeof(tpm_cap)); + data[TPM_CAP_IDX] = TPM_CAP_FLAG; + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_PERM; + + rc = transmit_cmd(chip, data, sizeof(data), + "attemtping to determine the permanent state"); + if (rc) + return 0; + return sprintf(buf, "%d\n", !data[TPM_GET_CAP_PERM_INACTIVE_IDX]); +} +EXPORT_SYMBOL_GPL(tpm_show_active); + +ssize_t tpm_show_owned(struct device * dev, struct device_attribute * attr, + char *buf) +{ + u8 data[sizeof(tpm_cap)]; + ssize_t rc; + + struct tpm_chip *chip = dev_get_drvdata(dev); + if (chip == NULL) + return -ENODEV; + + memcpy(data, tpm_cap, sizeof(tpm_cap)); + data[TPM_CAP_IDX] = TPM_CAP_PROP; + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_OWNER; + + rc = transmit_cmd(chip, data, sizeof(data), + "attempting to determine the owner state"); + if (rc) + return 0; + return sprintf(buf, "%d\n", data[TPM_GET_CAP_RET_BOOL_1_IDX]); +} +EXPORT_SYMBOL_GPL(tpm_show_owned); + +ssize_t tpm_show_temp_deactivated(struct device * dev, + struct device_attribute * attr, char *buf) +{ + u8 data[sizeof(tpm_cap)]; + ssize_t rc; + + struct tpm_chip *chip = dev_get_drvdata(dev); + if (chip == NULL) + return -ENODEV; + + memcpy(data, tpm_cap, sizeof(tpm_cap)); + data[TPM_CAP_IDX] = TPM_CAP_FLAG; + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_VOL; + + rc = transmit_cmd(chip, data, sizeof(data), + "attempting to determine the temporary state"); + if (rc) + return 0; + return sprintf(buf, "%d\n", data[TPM_GET_CAP_TEMP_INACTIVE_IDX]); +} +EXPORT_SYMBOL_GPL(tpm_show_temp_deactivated); + static const u8 pcrread[] = { 0, 193, /* TPM_TAG_RQU_COMMAND */ 0, 0, 0, 14, /* length */ @@ -140,8 +676,8 @@ static const u8 pcrread[] = { ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr, char *buf) { - u8 data[READ_PCR_RESULT_SIZE]; - ssize_t len; + u8 data[max_t(int, max(ARRAY_SIZE(tpm_cap), ARRAY_SIZE(pcrread)), 30)]; + ssize_t rc; int i, j, num_pcrs; __be32 index; char *str = buf; @@ -150,29 +686,24 @@ ssize_t tpm_show_pcrs(struct device *dev if (chip == NULL) return -ENODEV; - memcpy(data, cap_pcr, sizeof(cap_pcr)); - if ((len = tpm_transmit(chip, data, sizeof(data))) - < CAP_PCR_RESULT_SIZE) { - dev_dbg(chip->dev, "A TPM error (%d) occurred " - "attempting to determine the number of PCRS\n", - be32_to_cpu(*((__be32 *) (data + 6)))); + memcpy(data, tpm_cap, sizeof(tpm_cap)); + data[TPM_CAP_IDX] = TPM_CAP_PROP; + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_PCR; + + rc = transmit_cmd(chip, data, sizeof(data), + "attempting to determine the number of PCRS"); + if (rc) return 0; - } num_pcrs = be32_to_cpu(*((__be32 *) (data + 14))); - for (i = 0; i < num_pcrs; i++) { memcpy(data, pcrread, sizeof(pcrread)); index = cpu_to_be32(i); memcpy(data + 10, &index, 4); - if ((len = tpm_transmit(chip, data, sizeof(data))) - < READ_PCR_RESULT_SIZE){ - dev_dbg(chip->dev, "A TPM error (%d) occurred" - " attempting to read PCR %d of %d\n", - be32_to_cpu(*((__be32 *) (data + 6))), - i, num_pcrs); + rc = transmit_cmd(chip, data, sizeof(data), + "attempting to read a PCR"); + if (rc) goto out; - } str += sprintf(str, "PCR-%02d: ", i); for (j = 0; j < TPM_DIGEST_SIZE; j++) str += sprintf(str, "%02X ", *(data + 10 + j)); @@ -194,7 +725,7 @@ ssize_t tpm_show_pubek(struct device *de char *buf) { u8 *data; - ssize_t len; + ssize_t err; int i, rc; char *str = buf; @@ -208,14 +739,10 @@ ssize_t tpm_show_pubek(struct device *de memcpy(data, readpubek, sizeof(readpubek)); - if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) < - READ_PUBEK_RESULT_SIZE) { - dev_dbg(chip->dev, "A TPM error (%d) occurred " - "attempting to read the PUBEK\n", - be32_to_cpu(*((__be32 *) (data + 6)))); - rc = 0; + err = transmit_cmd(chip, data, READ_PUBEK_RESULT_SIZE, + "attempting to read the PUBEK"); + if (err) goto out; - } /* ignore header 10 bytes @@ -245,36 +772,68 @@ ssize_t tpm_show_pubek(struct device *de if ((i + 1) % 16 == 0) str += sprintf(str, "\n"); } - rc = str - buf; out: + rc = str - buf; kfree(data); return rc; } EXPORT_SYMBOL_GPL(tpm_show_pubek); -#define CAP_VER_RESULT_SIZE 18 +#define CAP_VERSION_1_1 6 +#define CAP_VERSION_1_2 0x1A +#define CAP_VERSION_IDX 13 static const u8 cap_version[] = { 0, 193, /* TPM_TAG_RQU_COMMAND */ 0, 0, 0, 18, /* length */ 0, 0, 0, 101, /* TPM_ORD_GetCapability */ - 0, 0, 0, 6, + 0, 0, 0, 0, 0, 0, 0, 0 }; -#define CAP_MANUFACTURER_RESULT_SIZE 18 -static const u8 cap_manufacturer[] = { - 0, 193, /* TPM_TAG_RQU_COMMAND */ - 0, 0, 0, 22, /* length */ - 0, 0, 0, 101, /* TPM_ORD_GetCapability */ - 0, 0, 0, 5, - 0, 0, 0, 4, - 0, 0, 1, 3 -}; - ssize_t tpm_show_caps(struct device *dev, struct device_attribute *attr, char *buf) { - u8 data[sizeof(cap_manufacturer)]; + u8 data[max_t(int, max(ARRAY_SIZE(tpm_cap), ARRAY_SIZE(cap_version)), 30)]; + ssize_t rc; + char *str = buf; + + struct tpm_chip *chip = dev_get_drvdata(dev); + if (chip == NULL) + return -ENODEV; + + memcpy(data, tpm_cap, sizeof(tpm_cap)); + data[TPM_CAP_IDX] = TPM_CAP_PROP; + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_MANUFACTURER; + + rc = transmit_cmd(chip, data, sizeof(data), + "attempting to determine the manufacturer"); + if (rc) + return 0; + + str += sprintf(str, "Manufacturer: 0x%x\n", + be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX)))); + + memcpy(data, cap_version, sizeof(cap_version)); + data[CAP_VERSION_IDX] = CAP_VERSION_1_1; + rc = transmit_cmd(chip, data, sizeof(data), + "attempting to determine the 1.1 version"); + if (rc) + goto out; + + str += sprintf(str, + "TCG version: %d.%d\nFirmware version: %d.%d\n", + (int) data[14], (int) data[15], (int) data[16], + (int) data[17]); + +out: + return str - buf; +} +EXPORT_SYMBOL_GPL(tpm_show_caps); + +ssize_t tpm_show_caps_1_2(struct device * dev, + struct device_attribute * attr, char *buf) +{ + u8 data[max_t(int, max(ARRAY_SIZE(tpm_cap), ARRAY_SIZE(cap_version)), 30)]; ssize_t len; char *str = buf; @@ -282,29 +841,40 @@ ssize_t tpm_show_caps(struct device *dev if (chip == NULL) return -ENODEV; - memcpy(data, cap_manufacturer, sizeof(cap_manufacturer)); + memcpy(data, tpm_cap, sizeof(tpm_cap)); + data[TPM_CAP_IDX] = TPM_CAP_PROP; + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_MANUFACTURER; - if ((len = tpm_transmit(chip, data, sizeof(data))) < - CAP_MANUFACTURER_RESULT_SIZE) - return len; + if ((len = tpm_transmit(chip, data, sizeof(data))) <= + TPM_ERROR_SIZE) { + dev_dbg(chip->dev, "A TPM error (%d) occurred " + "attempting to determine the manufacturer\n", + be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX)))); + return 0; + } str += sprintf(str, "Manufacturer: 0x%x\n", - be32_to_cpu(*((__be32 *) (data + 14)))); + be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX)))); memcpy(data, cap_version, sizeof(cap_version)); + data[CAP_VERSION_IDX] = CAP_VERSION_1_2; - if ((len = tpm_transmit(chip, data, sizeof(data))) < - CAP_VER_RESULT_SIZE) - return len; - - str += - sprintf(str, "TCG version: %d.%d\nFirmware version: %d.%d\n", - (int) data[14], (int) data[15], (int) data[16], - (int) data[17]); + if ((len = tpm_transmit(chip, data, sizeof(data))) <= + TPM_ERROR_SIZE) { + dev_err(chip->dev, "A TPM error (%d) occurred " + "attempting to determine the 1.2 version\n", + be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX)))); + goto out; + } + str += sprintf(str, + "TCG version: %d.%d\nFirmware version: %d.%d\n", + (int) data[16], (int) data[17], (int) data[18], + (int) data[19]); +out: return str - buf; } -EXPORT_SYMBOL_GPL(tpm_show_caps); +EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) @@ -313,7 +883,7 @@ ssize_t tpm_store_cancel(struct device * if (chip == NULL) return 0; - chip->vendor->cancel(chip); + chip->vendor.cancel(chip); return count; } EXPORT_SYMBOL_GPL(tpm_store_cancel); @@ -329,7 +899,7 @@ int tpm_open(struct inode *inode, struct spin_lock(&driver_lock); list_for_each_entry(pos, &tpm_chip_list, list) { - if (pos->vendor->miscdev.minor == minor) { + if (pos->vendor.miscdev.minor == minor) { chip = pos; break; } @@ -387,7 +957,7 @@ int tpm_release(struct inode *inode, str EXPORT_SYMBOL_GPL(tpm_release); ssize_t tpm_write(struct file *file, const char __user *buf, - size_t size, loff_t * off) + size_t size, loff_t *off) { struct tpm_chip *chip = file->private_data; int in_size = size, out_size; @@ -419,11 +989,10 @@ ssize_t tpm_write(struct file *file, con return in_size; } - EXPORT_SYMBOL_GPL(tpm_write); -ssize_t tpm_read(struct file * file, char __user *buf, - size_t size, loff_t * off) +ssize_t tpm_read(struct file *file, char __user *buf, + size_t size, loff_t *off) { struct tpm_chip *chip = file->private_data; int ret_size; @@ -462,14 +1031,13 @@ void tpm_remove_hardware(struct device * spin_unlock(&driver_lock); dev_set_drvdata(dev, NULL); - misc_deregister(&chip->vendor->miscdev); - kfree(chip->vendor->miscdev.name); + misc_deregister(&chip->vendor.miscdev); + kfree(chip->vendor.miscdev.name); - sysfs_remove_group(&dev->kobj, chip->vendor->attr_group); + sysfs_remove_group(&dev->kobj, chip->vendor.attr_group); tpm_bios_log_teardown(chip->bios_dir); - dev_mask[chip->dev_num / TPM_NUM_MASK_ENTRIES ] &= - ~(1 << (chip->dev_num % TPM_NUM_MASK_ENTRIES)); + clear_bit(chip->dev_num, dev_mask); kfree(chip); @@ -520,18 +1088,18 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume); * upon errant exit from this function specific probe function should call * pci_disable_device */ -int tpm_register_hardware(struct device *dev, struct tpm_vendor_specific *entry) +struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vendor_specific + *entry) { #define DEVNAME_SIZE 7 char *devname; struct tpm_chip *chip; - int i, j; /* Driver specific per-device data */ chip = kzalloc(sizeof(*chip), GFP_KERNEL); if (chip == NULL) - return -ENOMEM; + return NULL; init_MUTEX(&chip->buffer_mutex); init_MUTEX(&chip->tpm_mutex); @@ -543,45 +1111,37 @@ int tpm_register_hardware(struct device chip->user_read_timer.function = user_reader_timeout; chip->user_read_timer.data = (unsigned long) chip; - chip->vendor = entry; - - chip->dev_num = -1; + memcpy(&chip->vendor, entry, sizeof(struct tpm_vendor_specific)); - for (i = 0; i < TPM_NUM_MASK_ENTRIES; i++) - for (j = 0; j < 8 * sizeof(int); j++) - if ((dev_mask[i] & (1 << j)) == 0) { - chip->dev_num = - i * TPM_NUM_MASK_ENTRIES + j; - dev_mask[i] |= 1 << j; - goto dev_num_search_complete; - } + chip->dev_num = find_first_zero_bit(dev_mask, TPM_NUM_DEVICES); -dev_num_search_complete: - if (chip->dev_num < 0) { + if (chip->dev_num >= TPM_NUM_DEVICES) { dev_err(dev, "No available tpm device numbers\n"); kfree(chip); - return -ENODEV; + return NULL; } else if (chip->dev_num == 0) - chip->vendor->miscdev.minor = TPM_MINOR; + chip->vendor.miscdev.minor = TPM_MINOR; else - chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR; + chip->vendor.miscdev.minor = MISC_DYNAMIC_MINOR; + + set_bit(chip->dev_num, dev_mask); devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL); scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); - chip->vendor->miscdev.name = devname; + chip->vendor.miscdev.name = devname; - chip->vendor->miscdev.dev = dev; + chip->vendor.miscdev.dev = dev; chip->dev = get_device(dev); - if (misc_register(&chip->vendor->miscdev)) { + if (misc_register(&chip->vendor.miscdev)) { dev_err(chip->dev, "unable to misc_register %s, minor %d\n", - chip->vendor->miscdev.name, - chip->vendor->miscdev.minor); + chip->vendor.miscdev.name, + chip->vendor.miscdev.minor); put_device(dev); + clear_bit(chip->dev_num, dev_mask); kfree(chip); - dev_mask[i] &= !(1 << j); - return -ENODEV; + return NULL; } spin_lock(&driver_lock); @@ -592,11 +1152,11 @@ dev_num_search_complete: spin_unlock(&driver_lock); - sysfs_create_group(&dev->kobj, chip->vendor->attr_group); + sysfs_create_group(&dev->kobj, chip->vendor.attr_group); chip->bios_dir = tpm_bios_log_setup(devname); - return 0; + return chip; } EXPORT_SYMBOL_GPL(tpm_register_hardware); diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index dec0224..54a4c80 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -42,18 +42,30 @@ extern ssize_t tpm_show_pcrs(struct devi char *); extern ssize_t tpm_show_caps(struct device *, struct device_attribute *attr, char *); +extern ssize_t tpm_show_caps_1_2(struct device *, struct device_attribute *attr, + char *); extern ssize_t tpm_store_cancel(struct device *, struct device_attribute *attr, const char *, size_t); +extern ssize_t tpm_show_enabled(struct device *, struct device_attribute *attr, + char *); +extern ssize_t tpm_show_active(struct device *, struct device_attribute *attr, + char *); +extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr, + char *); +extern ssize_t tpm_show_temp_deactivated(struct device *, + struct device_attribute *attr, char *); struct tpm_chip; struct tpm_vendor_specific { - u8 req_complete_mask; - u8 req_complete_val; - u8 req_canceled; + const u8 req_complete_mask; + const u8 req_complete_val; + const u8 req_canceled; void __iomem *iobase; /* ioremapped address */ unsigned long base; /* TPM base address */ + int irq; + int region_size; int have_region; @@ -63,6 +75,13 @@ struct tpm_vendor_specific { u8 (*status) (struct tpm_chip *); struct miscdevice miscdev; struct attribute_group *attr_group; + struct list_head list; + int locality; + unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */ + unsigned long duration[3]; /* jiffies */ + + wait_queue_head_t read_queue; + wait_queue_head_t int_queue; }; struct tpm_chip { @@ -81,13 +100,15 @@ struct tpm_chip { struct work_struct work; struct semaphore tpm_mutex; /* tpm is processing */ - struct tpm_vendor_specific *vendor; + struct tpm_vendor_specific vendor; struct dentry **bios_dir; struct list_head list; }; +#define to_tpm_chip(n) container_of(n, struct tpm_chip, vendor) + static inline int tpm_read_index(int base, int index) { outb(index, base); @@ -100,8 +121,12 @@ static inline void tpm_write_index(int b outb(value & 0xFF, base+1); } -extern int tpm_register_hardware(struct device *, - struct tpm_vendor_specific *); +extern void tpm_get_timeouts(struct tpm_chip *); +extern void tpm_gen_interrupt(struct tpm_chip *); +extern void tpm_continue_selftest(struct tpm_chip *); +extern unsigned long tpm_calc_ordinal_duration(struct tpm_chip *, u32); +extern struct tpm_chip* tpm_register_hardware(struct device *, + const struct tpm_vendor_specific *); extern int tpm_open(struct inode *, struct file *); extern int tpm_release(struct inode *, struct file *); extern ssize_t tpm_write(struct file *, const char __user *, size_t, diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index ff36549..58a258c 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c @@ -47,12 +47,12 @@ static int tpm_atml_recv(struct tpm_chip return -EIO; for (i = 0; i < 6; i++) { - status = ioread8(chip->vendor->iobase + 1); + status = ioread8(chip->vendor.iobase + 1); if ((status & ATML_STATUS_DATA_AVAIL) == 0) { dev_err(chip->dev, "error reading header\n"); return -EIO; } - *buf++ = ioread8(chip->vendor->iobase); + *buf++ = ioread8(chip->vendor.iobase); } /* size of the data received */ @@ -63,7 +63,7 @@ static int tpm_atml_recv(struct tpm_chip dev_err(chip->dev, "Recv size(%d) less than available space\n", size); for (; i < size; i++) { /* clear the waiting data anyway */ - status = ioread8(chip->vendor->iobase + 1); + status = ioread8(chip->vendor.iobase + 1); if ((status & ATML_STATUS_DATA_AVAIL) == 0) { dev_err(chip->dev, "error reading data\n"); return -EIO; @@ -74,16 +74,16 @@ static int tpm_atml_recv(struct tpm_chip /* read all the data available */ for (; i < size; i++) { - status = ioread8(chip->vendor->iobase + 1); + status = ioread8(chip->vendor.iobase + 1); if ((status & ATML_STATUS_DATA_AVAIL) == 0) { dev_err(chip->dev, "error reading data\n"); return -EIO; } - *buf++ = ioread8(chip->vendor->iobase); + *buf++ = ioread8(chip->vendor.iobase); } /* make sure data available is gone */ - status = ioread8(chip->vendor->iobase + 1); + status = ioread8(chip->vendor.iobase + 1); if (status & ATML_STATUS_DATA_AVAIL) { dev_err(chip->dev, "data available is stuck\n"); @@ -100,7 +100,7 @@ static int tpm_atml_send(struct tpm_chip dev_dbg(chip->dev, "tpm_atml_send:\n"); for (i = 0; i < count; i++) { dev_dbg(chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); - iowrite8(buf[i], chip->vendor->iobase); + iowrite8(buf[i], chip->vendor.iobase); } return count; @@ -108,12 +108,12 @@ static int tpm_atml_send(struct tpm_chip static void tpm_atml_cancel(struct tpm_chip *chip) { - iowrite8(ATML_STATUS_ABORT, chip->vendor->iobase + 1); + iowrite8(ATML_STATUS_ABORT, chip->vendor.iobase + 1); } static u8 tpm_atml_status(struct tpm_chip *chip) { - return ioread8(chip->vendor->iobase + 1); + return ioread8(chip->vendor.iobase + 1); } static struct file_operations atmel_ops = { @@ -140,7 +140,7 @@ static struct attribute* atmel_attrs[] = static struct attribute_group atmel_attr_grp = { .attrs = atmel_attrs }; -static struct tpm_vendor_specific tpm_atmel = { +static const struct tpm_vendor_specific tpm_atmel = { .recv = tpm_atml_recv, .send = tpm_atml_send, .cancel = tpm_atml_cancel, @@ -159,10 +159,10 @@ static void atml_plat_remove(void) struct tpm_chip *chip = dev_get_drvdata(&pdev->dev); if (chip) { - if (chip->vendor->have_region) - atmel_release_region(chip->vendor->base, - chip->vendor->region_size); - atmel_put_base_addr(chip->vendor); + if (chip->vendor.have_region) + atmel_release_region(chip->vendor.base, + chip->vendor.region_size); + atmel_put_base_addr(chip->vendor.iobase); tpm_remove_hardware(chip->dev); platform_device_unregister(pdev); } @@ -179,18 +179,22 @@ static struct device_driver atml_drv = { static int __init init_atmel(void) { int rc = 0; + void __iomem *iobase = NULL; + int have_region, region_size; + unsigned long base; + struct tpm_chip *chip; driver_register(&atml_drv); - if ((tpm_atmel.iobase = atmel_get_base_addr(&tpm_atmel)) == NULL) { + if ((iobase = atmel_get_base_addr(&base, ®ion_size)) == NULL) { rc = -ENODEV; goto err_unreg_drv; } - tpm_atmel.have_region = + have_region = (atmel_request_region - (tpm_atmel.base, tpm_atmel.region_size, - "tpm_atmel0") == NULL) ? 0 : 1; + (tpm_atmel.base, region_size, "tpm_atmel0") == NULL) ? 0 : 1; + if (IS_ERR (pdev = @@ -199,17 +203,25 @@ static int __init init_atmel(void) goto err_rel_reg; } - if ((rc = tpm_register_hardware(&pdev->dev, &tpm_atmel)) < 0) + if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_atmel))) { + rc = -ENODEV; goto err_unreg_dev; + } + + chip->vendor.iobase = iobase; + chip->vendor.base = base; + chip->vendor.have_region = have_region; + chip->vendor.region_size = region_size; + return 0; err_unreg_dev: platform_device_unregister(pdev); err_rel_reg: - atmel_put_base_addr(&tpm_atmel); - if (tpm_atmel.have_region) - atmel_release_region(tpm_atmel.base, - tpm_atmel.region_size); + atmel_put_base_addr(iobase); + if (have_region) + atmel_release_region(base, + region_size); err_unreg_drv: driver_unregister(&atml_drv); return rc; diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h index d3478aa..2e68eeb 100644 --- a/drivers/char/tpm/tpm_atmel.h +++ b/drivers/char/tpm/tpm_atmel.h @@ -28,13 +28,12 @@ #define atmel_request_region request_mem_region #define atmel_release_region release_mem_region -static inline void atmel_put_base_addr(struct tpm_vendor_specific - *vendor) +static inline void atmel_put_base_addr(void __iomem *iobase) { - iounmap(vendor->iobase); + iounmap(iobase); } -static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific *vendor) +static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size) { struct device_node *dn; unsigned long address, size; @@ -71,9 +70,9 @@ static void __iomem * atmel_get_base_add else size = reg[naddrc]; - vendor->base = address; - vendor->region_size = size; - return ioremap(vendor->base, vendor->region_size); + *base = address; + *region_size = size; + return ioremap(*base, *region_size); } #else #define atmel_getb(chip, offset) inb(chip->vendor->base + offset) @@ -106,14 +105,12 @@ static int atmel_verify_tpm11(void) return 0; } -static inline void atmel_put_base_addr(struct tpm_vendor_specific - *vendor) +static inline void atmel_put_base_addr(void __iomem *iobase) { } /* Determine where to talk to device */ -static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific - *vendor) +static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size) { int lo, hi; @@ -123,9 +120,9 @@ static void __iomem * atmel_get_base_add lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO); hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI); - vendor->base = (hi << 8) | lo; - vendor->region_size = 2; + *base = (hi << 8) | lo; + *region_size = 2; - return ioport_map(vendor->base, vendor->region_size); + return ioport_map(*base, *region_size); } #endif diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c index 537aa45..e45f0d3 100644 --- a/drivers/char/tpm/tpm_bios.c +++ b/drivers/char/tpm/tpm_bios.c @@ -29,6 +29,11 @@ #define MAX_TEXT_EVENT 1000 /* Max event string length */ #define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */ +enum bios_platform_class { + BIOS_CLIENT = 0x00, + BIOS_SERVER = 0x01, +}; + struct tpm_bios_log { void *bios_event_log; void *bios_event_log_end; @@ -36,9 +41,18 @@ struct tpm_bios_log { struct acpi_tcpa { struct acpi_table_header hdr; - u16 reserved; - u32 log_max_len __attribute__ ((packed)); - u32 log_start_addr __attribute__ ((packed)); + u16 platform_class; + union { + struct client_hdr { + u32 log_max_len __attribute__ ((packed)); + u64 log_start_addr __attribute__ ((packed)); + } client; + struct server_hdr { + u16 reserved; + u64 log_max_len __attribute__ ((packed)); + u64 log_start_addr __attribute__ ((packed)); + } server; + }; }; struct tcpa_event { @@ -120,6 +134,7 @@ static const char* tcpa_pc_event_id_stri "S-CRTM Version", "S-CRTM Contents", "S-CRTM POST Contents", + "POST Contents", }; /* returns pointer to start of pos. entry of tcg log */ @@ -306,6 +321,7 @@ static int tpm_binary_bios_measurements_ /* 5th: delimiter */ seq_putc(m, '\0'); + kfree(eventname); return 0; } @@ -353,6 +369,7 @@ static int tpm_ascii_bios_measurements_s /* 4th: eventname <= max + \'0' delimiter */ seq_printf(m, " %s\n", eventname); + kfree(eventname); return 0; } @@ -376,6 +393,7 @@ static int read_log(struct tpm_bios_log struct acpi_tcpa *buff; acpi_status status; struct acpi_table_header *virt; + u64 len, start; if (log->bios_event_log != NULL) { printk(KERN_ERR @@ -396,27 +414,37 @@ static int read_log(struct tpm_bios_log return -EIO; } - if (buff->log_max_len == 0) { + switch(buff->platform_class) { + case BIOS_SERVER: + len = buff->server.log_max_len; + start = buff->server.log_start_addr; + break; + case BIOS_CLIENT: + default: + len = buff->client.log_max_len; + start = buff->client.log_start_addr; + break; + } + if (!len) { printk(KERN_ERR "%s: ERROR - TCPA log area empty\n", __func__); return -EIO; } /* malloc EventLog space */ - log->bios_event_log = kmalloc(buff->log_max_len, GFP_KERNEL); + log->bios_event_log = kmalloc(len, GFP_KERNEL); if (!log->bios_event_log) { - printk - ("%s: ERROR - Not enough Memory for BIOS measurements\n", - __func__); + printk("%s: ERROR - Not enough Memory for BIOS measurements\n", + __func__); return -ENOMEM; } - log->bios_event_log_end = log->bios_event_log + buff->log_max_len; + log->bios_event_log_end = log->bios_event_log + len; - acpi_os_map_memory(buff->log_start_addr, buff->log_max_len, (void *) &virt); + acpi_os_map_memory(start, len, (void *) &virt); - memcpy(log->bios_event_log, virt, buff->log_max_len); + memcpy(log->bios_event_log, virt, len); - acpi_os_unmap_memory(virt, buff->log_max_len); + acpi_os_unmap_memory(virt, len); return 0; } diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c index 24095f6..adfff21 100644 --- a/drivers/char/tpm/tpm_infineon.c +++ b/drivers/char/tpm/tpm_infineon.c @@ -15,6 +15,7 @@ * License. */ +#include #include #include "tpm.h" @@ -104,7 +105,7 @@ static int empty_fifo(struct tpm_chip *c if (clear_wrfifo) { for (i = 0; i < 4096; i++) { - status = inb(chip->vendor->base + WRFIFO); + status = inb(chip->vendor.base + WRFIFO); if (status == 0xff) { if (check == 5) break; @@ -124,8 +125,8 @@ static int empty_fifo(struct tpm_chip *c */ i = 0; do { - status = inb(chip->vendor->base + RDFIFO); - status = inb(chip->vendor->base + STAT); + status = inb(chip->vendor.base + RDFIFO); + status = inb(chip->vendor.base + STAT); i++; if (i == TPM_MAX_TRIES) return -EIO; @@ -138,7 +139,7 @@ static int wait(struct tpm_chip *chip, i int status; int i; for (i = 0; i < TPM_MAX_TRIES; i++) { - status = inb(chip->vendor->base + STAT); + status = inb(chip->vendor.base + STAT); /* check the status-register if wait_for_bit is set */ if (status & 1 << wait_for_bit) break; @@ -157,7 +158,7 @@ static int wait(struct tpm_chip *chip, i static void wait_and_send(struct tpm_chip *chip, u8 sendbyte) { wait(chip, STAT_XFE); - outb(sendbyte, chip->vendor->base + WRFIFO); + outb(sendbyte, chip->vendor.base + WRFIFO); } /* Note: WTX means Waiting-Time-Extension. Whenever the TPM needs more @@ -204,7 +205,7 @@ recv_begin: ret = wait(chip, STAT_RDA); if (ret) return -EIO; - buf[i] = inb(chip->vendor->base + RDFIFO); + buf[i] = inb(chip->vendor.base + RDFIFO); } if (buf[0] != TPM_VL_VER) { @@ -219,7 +220,7 @@ recv_begin: for (i = 0; i < size; i++) { wait(chip, STAT_RDA); - buf[i] = inb(chip->vendor->base + RDFIFO); + buf[i] = inb(chip->vendor.base + RDFIFO); } if ((size == 0x6D00) && (buf[1] == 0x80)) { @@ -268,7 +269,7 @@ static int tpm_inf_send(struct tpm_chip u8 count_high, count_low, count_4, count_3, count_2, count_1; /* Disabling Reset, LP and IRQC */ - outb(RESET_LP_IRQC_DISABLE, chip->vendor->base + CMD); + outb(RESET_LP_IRQC_DISABLE, chip->vendor.base + CMD); ret = empty_fifo(chip, 1); if (ret) { @@ -319,7 +320,7 @@ static void tpm_inf_cancel(struct tpm_ch static u8 tpm_inf_status(struct tpm_chip *chip) { - return inb(chip->vendor->base + STAT); + return inb(chip->vendor.base + STAT); } static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL); @@ -346,7 +347,7 @@ static struct file_operations inf_ops = .release = tpm_release, }; -static struct tpm_vendor_specific tpm_inf = { +static const struct tpm_vendor_specific tpm_inf = { .recv = tpm_inf_recv, .send = tpm_inf_send, .cancel = tpm_inf_cancel, @@ -375,6 +376,7 @@ static int __devinit tpm_inf_pnp_probe(s int version[2]; int productid[2]; char chipname[20]; + struct tpm_chip *chip; /* read IO-ports through PnP */ if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && @@ -395,14 +397,13 @@ static int __devinit tpm_inf_pnp_probe(s goto err_last; } /* publish my base address and request region */ - tpm_inf.base = TPM_INF_BASE; if (request_region - (tpm_inf.base, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) { + (TPM_INF_BASE, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) { rc = -EINVAL; goto err_last; } - if (request_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN, - "tpm_infineon0") == NULL) { + if (request_region + (TPM_INF_ADDR, TPM_INF_ADDR_LEN, "tpm_infineon0") == NULL) { rc = -EINVAL; goto err_last; } @@ -442,9 +443,9 @@ static int __devinit tpm_inf_pnp_probe(s /* configure TPM with IO-ports */ outb(IOLIMH, TPM_INF_ADDR); - outb(((tpm_inf.base >> 8) & 0xff), TPM_INF_DATA); + outb(((TPM_INF_BASE >> 8) & 0xff), TPM_INF_DATA); outb(IOLIML, TPM_INF_ADDR); - outb((tpm_inf.base & 0xff), TPM_INF_DATA); + outb((TPM_INF_BASE & 0xff), TPM_INF_DATA); /* control if IO-ports are set correctly */ outb(IOLIMH, TPM_INF_ADDR); @@ -452,10 +453,10 @@ static int __devinit tpm_inf_pnp_probe(s outb(IOLIML, TPM_INF_ADDR); iol = inb(TPM_INF_DATA); - if ((ioh << 8 | iol) != tpm_inf.base) { + if ((ioh << 8 | iol) != TPM_INF_BASE) { dev_err(&dev->dev, - "Could not set IO-ports to 0x%lx\n", - tpm_inf.base); + "Could not set IO-ports to 0x%x\n", + TPM_INF_BASE); rc = -EIO; goto err_release_region; } @@ -466,15 +467,15 @@ static int __devinit tpm_inf_pnp_probe(s outb(DISABLE_REGISTER_PAIR, TPM_INF_ADDR); /* disable RESET, LP and IRQC */ - outb(RESET_LP_IRQC_DISABLE, tpm_inf.base + CMD); + outb(RESET_LP_IRQC_DISABLE, TPM_INF_BASE + CMD); /* Finally, we're done, print some infos */ dev_info(&dev->dev, "TPM found: " "config base 0x%x, " "io base 0x%x, " - "chip version %02x%02x, " - "vendor id %x%x (Infineon), " - "product id %02x%02x" + "chip version 0x%02x%02x, " + "vendor id 0x%x%x (Infineon), " + "product id 0x%02x%02x" "%s\n", TPM_INF_ADDR, TPM_INF_BASE, @@ -482,11 +483,10 @@ static int __devinit tpm_inf_pnp_probe(s vendorid[0], vendorid[1], productid[0], productid[1], chipname); - rc = tpm_register_hardware(&dev->dev, &tpm_inf); - if (rc < 0) { - rc = -ENODEV; + if (!(chip = tpm_register_hardware(&dev->dev, &tpm_inf))) { goto err_release_region; } + chip->vendor.base = TPM_INF_BASE; return 0; } else { rc = -ENODEV; @@ -494,7 +494,7 @@ static int __devinit tpm_inf_pnp_probe(s } err_release_region: - release_region(tpm_inf.base, TPM_INF_PORT_LEN); + release_region(TPM_INF_BASE, TPM_INF_PORT_LEN); release_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN); err_last: @@ -506,7 +506,8 @@ static __devexit void tpm_inf_pnp_remove struct tpm_chip *chip = pnp_get_drvdata(dev); if (chip) { - release_region(chip->vendor->base, TPM_INF_PORT_LEN); + release_region(TPM_INF_BASE, TPM_INF_PORT_LEN); + release_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN); tpm_remove_hardware(chip->dev); } } @@ -520,7 +521,7 @@ static struct pnp_driver tpm_inf_pnp = { }, .id_table = tpm_pnp_tbl, .probe = tpm_inf_pnp_probe, - .remove = tpm_inf_pnp_remove, + .remove = __devexit_p(tpm_inf_pnp_remove), }; static int __init init_inf(void) @@ -538,5 +539,5 @@ module_exit(cleanup_inf); MODULE_AUTHOR("Marcel Selhorst "); MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2"); -MODULE_VERSION("1.7"); +MODULE_VERSION("1.8"); MODULE_LICENSE("GPL"); diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c index 680a8e3..4c8bc06 100644 --- a/drivers/char/tpm/tpm_nsc.c +++ b/drivers/char/tpm/tpm_nsc.c @@ -71,7 +71,7 @@ static int wait_for_stat(struct tpm_chip unsigned long stop; /* status immediately available check */ - *data = inb(chip->vendor->base + NSC_STATUS); + *data = inb(chip->vendor.base + NSC_STATUS); if ((*data & mask) == val) return 0; @@ -79,7 +79,7 @@ static int wait_for_stat(struct tpm_chip stop = jiffies + 10 * HZ; do { msleep(TPM_TIMEOUT); - *data = inb(chip->vendor->base + 1); + *data = inb(chip->vendor.base + 1); if ((*data & mask) == val) return 0; } @@ -94,9 +94,9 @@ static int nsc_wait_for_ready(struct tpm unsigned long stop; /* status immediately available check */ - status = inb(chip->vendor->base + NSC_STATUS); + status = inb(chip->vendor.base + NSC_STATUS); if (status & NSC_STATUS_OBF) - status = inb(chip->vendor->base + NSC_DATA); + status = inb(chip->vendor.base + NSC_DATA); if (status & NSC_STATUS_RDY) return 0; @@ -104,9 +104,9 @@ static int nsc_wait_for_ready(struct tpm stop = jiffies + 100; do { msleep(TPM_TIMEOUT); - status = inb(chip->vendor->base + NSC_STATUS); + status = inb(chip->vendor.base + NSC_STATUS); if (status & NSC_STATUS_OBF) - status = inb(chip->vendor->base + NSC_DATA); + status = inb(chip->vendor.base + NSC_DATA); if (status & NSC_STATUS_RDY) return 0; } @@ -132,7 +132,7 @@ static int tpm_nsc_recv(struct tpm_chip return -EIO; } if ((data = - inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_NORMAL) { + inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_NORMAL) { dev_err(chip->dev, "not in normal mode (0x%x)\n", data); return -EIO; @@ -148,7 +148,7 @@ static int tpm_nsc_recv(struct tpm_chip } if (data & NSC_STATUS_F0) break; - *p = inb(chip->vendor->base + NSC_DATA); + *p = inb(chip->vendor.base + NSC_DATA); } if ((data & NSC_STATUS_F0) == 0 && @@ -156,7 +156,7 @@ static int tpm_nsc_recv(struct tpm_chip dev_err(chip->dev, "F0 not set\n"); return -EIO; } - if ((data = inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_EOC) { + if ((data = inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_EOC) { dev_err(chip->dev, "expected end of command(0x%x)\n", data); return -EIO; @@ -182,7 +182,7 @@ static int tpm_nsc_send(struct tpm_chip * fix it. Not sure why this is needed, we followed the flow * chart in the manual to the letter. */ - outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND); + outb(NSC_COMMAND_CANCEL, chip->vendor.base + NSC_COMMAND); if (nsc_wait_for_ready(chip) != 0) return -EIO; @@ -192,7 +192,7 @@ static int tpm_nsc_send(struct tpm_chip return -EIO; } - outb(NSC_COMMAND_NORMAL, chip->vendor->base + NSC_COMMAND); + outb(NSC_COMMAND_NORMAL, chip->vendor.base + NSC_COMMAND); if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) { dev_err(chip->dev, "IBR timeout\n"); return -EIO; @@ -204,26 +204,26 @@ static int tpm_nsc_send(struct tpm_chip "IBF timeout (while writing data)\n"); return -EIO; } - outb(buf[i], chip->vendor->base + NSC_DATA); + outb(buf[i], chip->vendor.base + NSC_DATA); } if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { dev_err(chip->dev, "IBF timeout\n"); return -EIO; } - outb(NSC_COMMAND_EOC, chip->vendor->base + NSC_COMMAND); + outb(NSC_COMMAND_EOC, chip->vendor.base + NSC_COMMAND); return count; } static void tpm_nsc_cancel(struct tpm_chip *chip) { - outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND); + outb(NSC_COMMAND_CANCEL, chip->vendor.base + NSC_COMMAND); } static u8 tpm_nsc_status(struct tpm_chip *chip) { - return inb(chip->vendor->base + NSC_STATUS); + return inb(chip->vendor.base + NSC_STATUS); } static struct file_operations nsc_ops = { @@ -250,7 +250,7 @@ static struct attribute * nsc_attrs[] = static struct attribute_group nsc_attr_grp = { .attrs = nsc_attrs }; -static struct tpm_vendor_specific tpm_nsc = { +static const struct tpm_vendor_specific tpm_nsc = { .recv = tpm_nsc_recv, .send = tpm_nsc_send, .cancel = tpm_nsc_cancel, @@ -268,7 +268,7 @@ static void __devexit tpm_nsc_remove(str { struct tpm_chip *chip = dev_get_drvdata(dev); if ( chip ) { - release_region(chip->vendor->base, 2); + release_region(chip->vendor.base, 2); tpm_remove_hardware(chip->dev); } } @@ -286,7 +286,8 @@ static int __init init_nsc(void) int rc = 0; int lo, hi; int nscAddrBase = TPM_ADDR; - + struct tpm_chip *chip; + unsigned long base; /* verify that it is a National part (SID) */ if (tpm_read_index(TPM_ADDR, NSC_SID_INDEX) != 0xEF) { @@ -300,7 +301,7 @@ static int __init init_nsc(void) hi = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_HI); lo = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_LO); - tpm_nsc.base = (hi<<8) | lo; + base = (hi<<8) | lo; /* enable the DPM module */ tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01); @@ -320,13 +321,15 @@ static int __init init_nsc(void) if ((rc = platform_device_register(pdev)) < 0) goto err_free_dev; - if (request_region(tpm_nsc.base, 2, "tpm_nsc0") == NULL ) { + if (request_region(base, 2, "tpm_nsc0") == NULL ) { rc = -EBUSY; goto err_unreg_dev; } - if ((rc = tpm_register_hardware(&pdev->dev, &tpm_nsc)) < 0) + if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_nsc))) { + rc = -ENODEV; goto err_rel_reg; + } dev_dbg(&pdev->dev, "NSC TPM detected\n"); dev_dbg(&pdev->dev, @@ -361,10 +364,12 @@ static int __init init_nsc(void) "NSC TPM revision %d\n", tpm_read_index(nscAddrBase, 0x27) & 0x1F); + chip->vendor.base = base; + return 0; err_rel_reg: - release_region(tpm_nsc.base, 2); + release_region(base, 2); err_unreg_dev: platform_device_unregister(pdev); err_free_dev: diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c new file mode 100644 index 0000000..b9cae9a --- /dev/null +++ b/drivers/char/tpm/tpm_tis.c @@ -0,0 +1,669 @@ +/* + * Copyright (C) 2005, 2006 IBM Corporation + * + * Authors: + * Leendert van Doorn + * Kylene Hall + * + * Device driver for TCG/TCPA TPM (trusted platform module). + * Specifications at www.trustedcomputinggroup.org + * + * This device driver implements the TPM interface as defined in + * the TCG TPM Interface Spec version 1.2, revision 1.0. + * + * 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, version 2 of the + * License. + */ +#include +#include +#include +#include +#include +#include +#include "tpm.h" + +#define TPM_HEADER_SIZE 10 + +enum tis_access { + TPM_ACCESS_VALID = 0x80, + TPM_ACCESS_ACTIVE_LOCALITY = 0x20, + TPM_ACCESS_REQUEST_PENDING = 0x04, + TPM_ACCESS_REQUEST_USE = 0x02, +}; + +enum tis_status { + TPM_STS_VALID = 0x80, + TPM_STS_COMMAND_READY = 0x40, + TPM_STS_GO = 0x20, + TPM_STS_DATA_AVAIL = 0x10, + TPM_STS_DATA_EXPECT = 0x08, +}; + +enum tis_int_flags { + TPM_GLOBAL_INT_ENABLE = 0x80000000, + TPM_INTF_BURST_COUNT_STATIC = 0x100, + TPM_INTF_CMD_READY_INT = 0x080, + TPM_INTF_INT_EDGE_FALLING = 0x040, + TPM_INTF_INT_EDGE_RISING = 0x020, + TPM_INTF_INT_LEVEL_LOW = 0x010, + TPM_INTF_INT_LEVEL_HIGH = 0x008, + TPM_INTF_LOCALITY_CHANGE_INT = 0x004, + TPM_INTF_STS_VALID_INT = 0x002, + TPM_INTF_DATA_AVAIL_INT = 0x001, +}; + +enum tis_defaults { + TIS_MEM_BASE = 0xFED4000, + TIS_MEM_LEN = 0x5000, + TIS_SHORT_TIMEOUT = 750, /* ms */ + TIS_LONG_TIMEOUT = 2000, /* 2 sec */ +}; + +#define TPM_ACCESS(l) (0x0000 | ((l) << 12)) +#define TPM_INT_ENABLE(l) (0x0008 | ((l) << 12)) +#define TPM_INT_VECTOR(l) (0x000C | ((l) << 12)) +#define TPM_INT_STATUS(l) (0x0010 | ((l) << 12)) +#define TPM_INTF_CAPS(l) (0x0014 | ((l) << 12)) +#define TPM_STS(l) (0x0018 | ((l) << 12)) +#define TPM_DATA_FIFO(l) (0x0024 | ((l) << 12)) + +#define TPM_DID_VID(l) (0x0F00 | ((l) << 12)) +#define TPM_RID(l) (0x0F04 | ((l) << 12)) + +static LIST_HEAD(tis_chips); +static DEFINE_SPINLOCK(tis_lock); + +static int check_locality(struct tpm_chip *chip, int l) +{ + if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & + (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) == + (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) + return chip->vendor.locality = l; + + return -1; +} + +static void release_locality(struct tpm_chip *chip, int l, int force) +{ + if (force || (ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & + (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) == + (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) + iowrite8(TPM_ACCESS_ACTIVE_LOCALITY, + chip->vendor.iobase + TPM_ACCESS(l)); +} + +static int request_locality(struct tpm_chip *chip, int l) +{ + unsigned long stop; + long rc; + + if (check_locality(chip, l) >= 0) + return l; + + iowrite8(TPM_ACCESS_REQUEST_USE, + chip->vendor.iobase + TPM_ACCESS(l)); + + if (chip->vendor.irq) { + rc = wait_event_interruptible_timeout(chip->vendor.int_queue, + (check_locality + (chip, l) >= 0), + chip->vendor.timeout_a); + if (rc > 0) + return l; + + } else { + /* wait for burstcount */ + stop = jiffies + chip->vendor.timeout_a; + do { + if (check_locality(chip, l) >= 0) + return l; + msleep(TPM_TIMEOUT); + } + while (time_before(jiffies, stop)); + } + return -1; +} + +static u8 tpm_tis_status(struct tpm_chip *chip) +{ + return ioread8(chip->vendor.iobase + + TPM_STS(chip->vendor.locality)); +} + +static void tpm_tis_ready(struct tpm_chip *chip) +{ + /* this causes the current command to be aborted */ + iowrite8(TPM_STS_COMMAND_READY, + chip->vendor.iobase + TPM_STS(chip->vendor.locality)); +} + +static int get_burstcount(struct tpm_chip *chip) +{ + unsigned long stop; + int burstcnt; + + /* wait for burstcount */ + /* which timeout value, spec has 2 answers (c & d) */ + stop = jiffies + chip->vendor.timeout_d; + do { + burstcnt = ioread8(chip->vendor.iobase + + TPM_STS(chip->vendor.locality) + 1); + burstcnt += ioread8(chip->vendor.iobase + + TPM_STS(chip->vendor.locality) + + 2) << 8; + if (burstcnt) + return burstcnt; + msleep(TPM_TIMEOUT); + } while (time_before(jiffies, stop)); + return -EBUSY; +} + +static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout, + wait_queue_head_t *queue) +{ + unsigned long stop; + long rc; + u8 status; + + /* check current status */ + status = tpm_tis_status(chip); + if ((status & mask) == mask) + return 0; + + if (chip->vendor.irq) { + rc = wait_event_interruptible_timeout(*queue, + ((tpm_tis_status + (chip) & mask) == + mask), timeout); + if (rc > 0) + return 0; + } else { + stop = jiffies + timeout; + do { + msleep(TPM_TIMEOUT); + status = tpm_tis_status(chip); + if ((status & mask) == mask) + return 0; + } while (time_before(jiffies, stop)); + } + return -ETIME; +} + +static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) +{ + int size = 0, burstcnt; + while (size < count && + wait_for_stat(chip, + TPM_STS_DATA_AVAIL | TPM_STS_VALID, + chip->vendor.timeout_c, + &chip->vendor.read_queue) + == 0) { + burstcnt = get_burstcount(chip); + for (; burstcnt > 0 && size < count; burstcnt--) + buf[size++] = ioread8(chip->vendor.iobase + + TPM_DATA_FIFO(chip->vendor. + locality)); + } + return size; +} + +static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count) +{ + int size = 0; + int expected, status; + + if (count < TPM_HEADER_SIZE) { + size = -EIO; + goto out; + } + + /* read first 10 bytes, including tag, paramsize, and result */ + if ((size = + recv_data(chip, buf, TPM_HEADER_SIZE)) < TPM_HEADER_SIZE) { + dev_err(chip->dev, "Unable to read header\n"); + goto out; + } + + expected = be32_to_cpu(*(__be32 *) (buf + 2)); + if (expected > count) { + size = -EIO; + goto out; + } + + if ((size += + recv_data(chip, &buf[TPM_HEADER_SIZE], + expected - TPM_HEADER_SIZE)) < expected) { + dev_err(chip->dev, "Unable to read remainder of result\n"); + size = -ETIME; + goto out; + } + + wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, + &chip->vendor.int_queue); + status = tpm_tis_status(chip); + if (status & TPM_STS_DATA_AVAIL) { /* retry? */ + dev_err(chip->dev, "Error left over data\n"); + size = -EIO; + goto out; + } + +out: + tpm_tis_ready(chip); + release_locality(chip, chip->vendor.locality, 0); + return size; +} + +/* + * If interrupts are used (signaled by an irq set in the vendor structure) + * tpm.c can skip polling for the data to be available as the interrupt is + * waited for here + */ +static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) +{ + int rc, status, burstcnt; + size_t count = 0; + u32 ordinal; + + if (request_locality(chip, 0) < 0) + return -EBUSY; + + status = tpm_tis_status(chip); + if ((status & TPM_STS_COMMAND_READY) == 0) { + tpm_tis_ready(chip); + if (wait_for_stat + (chip, TPM_STS_COMMAND_READY, chip->vendor.timeout_b, + &chip->vendor.int_queue) < 0) { + rc = -ETIME; + goto out_err; + } + } + + while (count < len - 1) { + burstcnt = get_burstcount(chip); + for (; burstcnt > 0 && count < len - 1; burstcnt--) { + iowrite8(buf[count], chip->vendor.iobase + + TPM_DATA_FIFO(chip->vendor.locality)); + count++; + } + + wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, + &chip->vendor.int_queue); + status = tpm_tis_status(chip); + if ((status & TPM_STS_DATA_EXPECT) == 0) { + rc = -EIO; + goto out_err; + } + } + + /* write last byte */ + iowrite8(buf[count], + chip->vendor.iobase + + TPM_DATA_FIFO(chip->vendor.locality)); + wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, + &chip->vendor.int_queue); + status = tpm_tis_status(chip); + if ((status & TPM_STS_DATA_EXPECT) != 0) { + rc = -EIO; + goto out_err; + } + + /* go and do it */ + iowrite8(TPM_STS_GO, + chip->vendor.iobase + TPM_STS(chip->vendor.locality)); + + if (chip->vendor.irq) { + ordinal = be32_to_cpu(*((__be32 *) (buf + 6))); + if (wait_for_stat + (chip, TPM_STS_DATA_AVAIL | TPM_STS_VALID, + tpm_calc_ordinal_duration(chip, ordinal), + &chip->vendor.read_queue) < 0) { + rc = -ETIME; + goto out_err; + } + } + return len; +out_err: + tpm_tis_ready(chip); + release_locality(chip, chip->vendor.locality, 0); + return rc; +} + +static struct file_operations tis_ops = { + .owner = THIS_MODULE, + .llseek = no_llseek, + .open = tpm_open, + .read = tpm_read, + .write = tpm_write, + .release = tpm_release, +}; + +static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL); +static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL); +static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL); +static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL); +static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL); +static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, + NULL); +static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); +static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); + +static struct attribute *tis_attrs[] = { + &dev_attr_pubek.attr, + &dev_attr_pcrs.attr, + &dev_attr_enabled.attr, + &dev_attr_active.attr, + &dev_attr_owned.attr, + &dev_attr_temp_deactivated.attr, + &dev_attr_caps.attr, + &dev_attr_cancel.attr, NULL, +}; + +static struct attribute_group tis_attr_grp = { + .attrs = tis_attrs +}; + +static struct tpm_vendor_specific tpm_tis = { + .status = tpm_tis_status, + .recv = tpm_tis_recv, + .send = tpm_tis_send, + .cancel = tpm_tis_ready, + .req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID, + .req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID, + .req_canceled = TPM_STS_COMMAND_READY, + .attr_group = &tis_attr_grp, + .miscdev = { + .fops = &tis_ops,}, +}; + +static irqreturn_t tis_int_probe(int irq, void *dev_id, struct pt_regs *regs) +{ + struct tpm_chip *chip = (struct tpm_chip *) dev_id; + u32 interrupt; + + interrupt = ioread32(chip->vendor.iobase + + TPM_INT_STATUS(chip->vendor.locality)); + + if (interrupt == 0) + return IRQ_NONE; + + chip->vendor.irq = irq; + + /* Clear interrupts handled with TPM_EOI */ + iowrite32(interrupt, + chip->vendor.iobase + + TPM_INT_STATUS(chip->vendor.locality)); + return IRQ_HANDLED; +} + +static irqreturn_t tis_int_handler(int irq, void *dev_id, struct pt_regs *regs) +{ + struct tpm_chip *chip = (struct tpm_chip *) dev_id; + u32 interrupt; + int i; + + interrupt = ioread32(chip->vendor.iobase + + TPM_INT_STATUS(chip->vendor.locality)); + + if (interrupt == 0) + return IRQ_NONE; + + if (interrupt & TPM_INTF_DATA_AVAIL_INT) + wake_up_interruptible(&chip->vendor.read_queue); + if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT) + for (i = 0; i < 5; i++) + if (check_locality(chip, i) >= 0) + break; + if (interrupt & + (TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_STS_VALID_INT | + TPM_INTF_CMD_READY_INT)) + wake_up_interruptible(&chip->vendor.int_queue); + + /* Clear interrupts handled with TPM_EOI */ + iowrite32(interrupt, + chip->vendor.iobase + + TPM_INT_STATUS(chip->vendor.locality)); + return IRQ_HANDLED; +} + +static int interrupts = 1; +module_param(interrupts, bool, 0444); +MODULE_PARM_DESC(interrupts, "Enable interrupts"); + +static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, + const struct pnp_device_id *pnp_id) +{ + u32 vendor, intfcaps, intmask; + int rc, i; + unsigned long start, len; + struct tpm_chip *chip; + + start = pnp_mem_start(pnp_dev, 0); + len = pnp_mem_len(pnp_dev, 0); + + if (!start) + start = TIS_MEM_BASE; + if (!len) + len = TIS_MEM_LEN; + + if (!(chip = tpm_register_hardware(&pnp_dev->dev, &tpm_tis))) + return -ENODEV; + + chip->vendor.iobase = ioremap(start, len); + if (!chip->vendor.iobase) { + rc = -EIO; + goto out_err; + } + + vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); + if ((vendor & 0xFFFF) == 0xFFFF) { + rc = -ENODEV; + goto out_err; + } + + /* Default timeouts */ + chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT); + chip->vendor.timeout_b = msecs_to_jiffies(TIS_LONG_TIMEOUT); + chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT); + chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT); + + dev_info(&pnp_dev->dev, + "1.2 TPM (device-id 0x%X, rev-id %d)\n", + vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); + + /* Figure out the capabilities */ + intfcaps = + ioread32(chip->vendor.iobase + + TPM_INTF_CAPS(chip->vendor.locality)); + dev_dbg(&pnp_dev->dev, "TPM interface capabilities (0x%x):\n", + intfcaps); + if (intfcaps & TPM_INTF_BURST_COUNT_STATIC) + dev_dbg(&pnp_dev->dev, "\tBurst Count Static\n"); + if (intfcaps & TPM_INTF_CMD_READY_INT) + dev_dbg(&pnp_dev->dev, "\tCommand Ready Int Support\n"); + if (intfcaps & TPM_INTF_INT_EDGE_FALLING) + dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Falling\n"); + if (intfcaps & TPM_INTF_INT_EDGE_RISING) + dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Rising\n"); + if (intfcaps & TPM_INTF_INT_LEVEL_LOW) + dev_dbg(&pnp_dev->dev, "\tInterrupt Level Low\n"); + if (intfcaps & TPM_INTF_INT_LEVEL_HIGH) + dev_dbg(&pnp_dev->dev, "\tInterrupt Level High\n"); + if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT) + dev_dbg(&pnp_dev->dev, "\tLocality Change Int Support\n"); + if (intfcaps & TPM_INTF_STS_VALID_INT) + dev_dbg(&pnp_dev->dev, "\tSts Valid Int Support\n"); + if (intfcaps & TPM_INTF_DATA_AVAIL_INT) + dev_dbg(&pnp_dev->dev, "\tData Avail Int Support\n"); + + if (request_locality(chip, 0) != 0) { + rc = -ENODEV; + goto out_err; + } + + /* INTERRUPT Setup */ + init_waitqueue_head(&chip->vendor.read_queue); + init_waitqueue_head(&chip->vendor.int_queue); + + intmask = + ioread32(chip->vendor.iobase + + TPM_INT_ENABLE(chip->vendor.locality)); + + intmask |= TPM_INTF_CMD_READY_INT + | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT + | TPM_INTF_STS_VALID_INT; + + iowrite32(intmask, + chip->vendor.iobase + + TPM_INT_ENABLE(chip->vendor.locality)); + if (interrupts) { + chip->vendor.irq = + ioread8(chip->vendor.iobase + + TPM_INT_VECTOR(chip->vendor.locality)); + + for (i = 3; i < 16 && chip->vendor.irq == 0; i++) { + iowrite8(i, chip->vendor.iobase + + TPM_INT_VECTOR(chip->vendor.locality)); + if (request_irq + (i, tis_int_probe, SA_SHIRQ, + chip->vendor.miscdev.name, chip) != 0) { + dev_info(chip->dev, + "Unable to request irq: %d for probe\n", + i); + continue; + } + + /* Clear all existing */ + iowrite32(ioread32 + (chip->vendor.iobase + + TPM_INT_STATUS(chip->vendor.locality)), + chip->vendor.iobase + + TPM_INT_STATUS(chip->vendor.locality)); + + /* Turn on */ + iowrite32(intmask | TPM_GLOBAL_INT_ENABLE, + chip->vendor.iobase + + TPM_INT_ENABLE(chip->vendor.locality)); + + /* Generate Interrupts */ + tpm_gen_interrupt(chip); + + /* Turn off */ + iowrite32(intmask, + chip->vendor.iobase + + TPM_INT_ENABLE(chip->vendor.locality)); + free_irq(i, chip); + } + } + if (chip->vendor.irq) { + iowrite8(chip->vendor.irq, + chip->vendor.iobase + + TPM_INT_VECTOR(chip->vendor.locality)); + if (request_irq + (chip->vendor.irq, tis_int_handler, SA_SHIRQ, + chip->vendor.miscdev.name, chip) != 0) { + dev_info(chip->dev, + "Unable to request irq: %d for use\n", + chip->vendor.irq); + chip->vendor.irq = 0; + } else { + /* Clear all existing */ + iowrite32(ioread32 + (chip->vendor.iobase + + TPM_INT_STATUS(chip->vendor.locality)), + chip->vendor.iobase + + TPM_INT_STATUS(chip->vendor.locality)); + + /* Turn on */ + iowrite32(intmask | TPM_GLOBAL_INT_ENABLE, + chip->vendor.iobase + + TPM_INT_ENABLE(chip->vendor.locality)); + } + } + + INIT_LIST_HEAD(&chip->vendor.list); + spin_lock(&tis_lock); + list_add(&chip->vendor.list, &tis_chips); + spin_unlock(&tis_lock); + + tpm_get_timeouts(chip); + tpm_continue_selftest(chip); + + return 0; +out_err: + if (chip->vendor.iobase) + iounmap(chip->vendor.iobase); + tpm_remove_hardware(chip->dev); + return rc; +} + +static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) +{ + return tpm_pm_suspend(&dev->dev, msg); +} + +static int tpm_tis_pnp_resume(struct pnp_dev *dev) +{ + return tpm_pm_resume(&dev->dev); +} + +static struct pnp_device_id tpm_pnp_tbl[] __devinitdata = { + {"PNP0C31", 0}, /* TPM */ + {"ATM1200", 0}, /* Atmel */ + {"IFX0102", 0}, /* Infineon */ + {"BCM0101", 0}, /* Broadcom */ + {"NSC1200", 0}, /* National */ + /* Add new here */ + {"", 0}, /* User Specified */ + {"", 0} /* Terminator */ +}; + +static struct pnp_driver tis_pnp_driver = { + .name = "tpm_tis", + .id_table = tpm_pnp_tbl, + .probe = tpm_tis_pnp_init, + .suspend = tpm_tis_pnp_suspend, + .resume = tpm_tis_pnp_resume, +}; + +#define TIS_HID_USR_IDX sizeof(tpm_pnp_tbl)/sizeof(struct pnp_device_id) -2 +module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id, + sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); +MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); + +static int __init init_tis(void) +{ + return pnp_register_driver(&tis_pnp_driver); +} + +static void __exit cleanup_tis(void) +{ + struct tpm_vendor_specific *i, *j; + struct tpm_chip *chip; + spin_lock(&tis_lock); + list_for_each_entry_safe(i, j, &tis_chips, list) { + chip = to_tpm_chip(i); + iowrite32(~TPM_GLOBAL_INT_ENABLE & + ioread32(chip->vendor.iobase + + TPM_INT_ENABLE(chip->vendor. + locality)), + chip->vendor.iobase + + TPM_INT_ENABLE(chip->vendor.locality)); + release_locality(chip, chip->vendor.locality, 1); + if (chip->vendor.irq) + free_irq(chip->vendor.irq, chip); + iounmap(i->iobase); + list_del(&i->list); + tpm_remove_hardware(chip->dev); + } + spin_unlock(&tis_lock); + pnp_unregister_driver(&tis_pnp_driver); +} + +module_init(init_tis); +module_exit(cleanup_tis); +MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)"); +MODULE_DESCRIPTION("TPM Driver"); +MODULE_VERSION("2.0"); +MODULE_LICENSE("GPL"); diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 841f0bd..f07637a 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -2723,7 +2723,11 @@ static void __do_SAK(void *arg) } task_lock(p); if (p->files) { - rcu_read_lock(); + /* + * We don't take a ref to the file, so we must + * hold ->file_lock instead. + */ + spin_lock(&p->files->file_lock); fdt = files_fdtable(p->files); for (i=0; i < fdt->max_fds; i++) { filp = fcheck_files(p->files, i); @@ -2738,7 +2742,7 @@ static void __do_SAK(void *arg) break; } } - rcu_read_unlock(); + spin_unlock(&p->files->file_lock); } task_unlock(p); } while_each_thread(g, p); diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 9759d05..29b2fa5 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1497,7 +1497,7 @@ int cpufreq_update_policy(unsigned int c } EXPORT_SYMBOL(cpufreq_update_policy); -static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, +static int cpufreq_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 8e0f315..dfca749 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -478,6 +478,11 @@ static s32 i801_access(struct i2c_adapte ret = i801_transaction(); } + /* Some BIOSes don't like it when PEC is enabled at reboot or resume + time, so we forcibly disable it after every transaction. */ + if (hwpec) + outb_p(0, SMBAUXCTL); + if(block) return ret; if(ret) diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c index 27fc9ff..99ab4ec 100644 --- a/drivers/i2c/chips/m41t00.c +++ b/drivers/i2c/chips/m41t00.c @@ -131,13 +131,13 @@ m41t00_set(void *arg) if ((i2c_smbus_write_byte_data(save_client, 0, tm.tm_sec & 0x7f) < 0) || (i2c_smbus_write_byte_data(save_client, 1, tm.tm_min & 0x7f) < 0) - || (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x7f) + || (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x3f) < 0) - || (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x7f) + || (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x3f) < 0) - || (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x7f) + || (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x1f) < 0) - || (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0x7f) + || (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0xff) < 0)) dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n"); diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index cf84350..8b24b4f 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -731,6 +731,8 @@ static unsigned int __devinit ata66_ali1 if(m5229_revision <= 0x20) tmpbyte = (tmpbyte & (~0x02)) | 0x01; + else if (m5229_revision == 0xc7) + tmpbyte |= 0x03; else tmpbyte |= 0x01; diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index df9ee9a..900efd1 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c @@ -348,6 +348,7 @@ static struct pci_device_id atiixp_pci_t { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP200_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, }; MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl); diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 6f8f864..7ce5bf7 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -798,7 +798,6 @@ static ide_pci_device_t pdc202xx_chipset .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, - .flags = IDEPCI_FLAG_FORCE_PDC, },{ /* 2 */ .name = "PDC20263", .init_setup = init_setup_pdc202ata4, @@ -819,7 +818,6 @@ static ide_pci_device_t pdc202xx_chipset .autodma = AUTODMA, .bootable = OFF_BOARD, .extra = 48, - .flags = IDEPCI_FLAG_FORCE_PDC, },{ /* 4 */ .name = "PDC20267", .init_setup = init_setup_pdc202xx, diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 7ebf992..462ed30 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -580,7 +580,6 @@ void ide_pci_setup_ports(struct pci_dev int port; int at_least_one_hwif_enabled = 0; ide_hwif_t *hwif, *mate = NULL; - static int secondpdc = 0; u8 tmp; index->all = 0xf0f0; @@ -592,21 +591,9 @@ void ide_pci_setup_ports(struct pci_dev for (port = 0; port <= 1; ++port) { ide_pci_enablebit_t *e = &(d->enablebits[port]); - /* - * If this is a Promise FakeRaid controller, - * the 2nd controller will be marked as - * disabled while it is actually there and enabled - * by the bios for raid purposes. - * Skip the normal "is it enabled" test for those. - */ - if ((d->flags & IDEPCI_FLAG_FORCE_PDC) && - (secondpdc++==1) && (port==1)) - goto controller_ok; - if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || (tmp & e->mask) != e->val)) continue; /* port not enabled */ -controller_ok: if (d->channels <= port) break; diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 3a702da..469b692 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -228,10 +228,7 @@ struct ib_mad_agent *ib_register_mad_age goto error1; } /* Make sure class supplied is consistent with RMPP */ - if (ib_is_mad_class_rmpp(mad_reg_req->mgmt_class)) { - if (!rmpp_version) - goto error1; - } else { + if (!ib_is_mad_class_rmpp(mad_reg_req->mgmt_class)) { if (rmpp_version) goto error1; } diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c index cd533cf..7d3fb69 100644 --- a/drivers/infiniband/hw/ipath/ipath_diag.c +++ b/drivers/infiniband/hw/ipath/ipath_diag.c @@ -365,15 +365,3 @@ static ssize_t ipath_diag_write(struct f bail: return ret; } - -void ipath_diag_bringup_link(struct ipath_devdata *dd) -{ - if (diag_set_link || (dd->ipath_flags & IPATH_LINKACTIVE)) - return; - - diag_set_link = 1; - ipath_cdbg(VERBOSE, "Trying to set to set link active for " - "diag pkt\n"); - ipath_layer_set_linkstate(dd, IPATH_IB_LINKARM); - ipath_layer_set_linkstate(dd, IPATH_IB_LINKACTIVE); -} diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index 58a94ef..e7617c3 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c @@ -1729,7 +1729,7 @@ void ipath_free_pddata(struct ipath_devd } } -int __init infinipath_init(void) +static int __init infinipath_init(void) { int ret; diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c index 60f5f41..0bcb428 100644 --- a/drivers/infiniband/hw/ipath/ipath_intr.c +++ b/drivers/infiniband/hw/ipath/ipath_intr.c @@ -172,8 +172,8 @@ static void handle_e_ibstatuschanged(str "was %s\n", dd->ipath_unit, ib_linkstate(lstate), ib_linkstate((unsigned) - dd->ipath_lastibcstat - & IPATH_IBSTATE_MASK)); + dd->ipath_lastibcstat + & IPATH_IBSTATE_MASK)); } else { lstate = dd->ipath_lastibcstat & IPATH_IBSTATE_MASK; diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index 159d0ae..0ce5f19 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h @@ -528,7 +528,6 @@ extern spinlock_t ipath_devs_lock; extern struct ipath_devdata *ipath_lookup(int unit); extern u16 ipath_layer_rcv_opcode; -extern int ipath_verbs_registered; extern int __ipath_layer_intr(struct ipath_devdata *, u32); extern int ipath_layer_intr(struct ipath_devdata *, u32); extern int __ipath_layer_rcv(struct ipath_devdata *, void *, diff --git a/drivers/infiniband/hw/ipath/ipath_layer.c b/drivers/infiniband/hw/ipath/ipath_layer.c index 2cabf63..69ed110 100644 --- a/drivers/infiniband/hw/ipath/ipath_layer.c +++ b/drivers/infiniband/hw/ipath/ipath_layer.c @@ -52,7 +52,7 @@ static int (*layer_rcv)(void *, void *, static int (*layer_rcv_lid)(void *, void *); static int (*verbs_piobufavail)(void *); static void (*verbs_rcv)(void *, void *, void *, u32); -int ipath_verbs_registered; +static int ipath_verbs_registered; static void *(*layer_add_one)(int, struct ipath_devdata *); static void (*layer_remove_one)(void *); diff --git a/drivers/infiniband/hw/ipath/ipath_pe800.c b/drivers/infiniband/hw/ipath/ipath_pe800.c index e693a7a..e1dc4f7 100644 --- a/drivers/infiniband/hw/ipath/ipath_pe800.c +++ b/drivers/infiniband/hw/ipath/ipath_pe800.c @@ -305,8 +305,8 @@ static const struct ipath_cregs ipath_pe * we'll print them and continue. We reuse the same message buffer as * ipath_handle_errors() to avoid excessive stack usage. */ -void ipath_pe_handle_hwerrors(struct ipath_devdata *dd, char *msg, - size_t msgl) +static void ipath_pe_handle_hwerrors(struct ipath_devdata *dd, char *msg, + size_t msgl) { ipath_err_t hwerrs; u32 bits, ctrl; @@ -552,7 +552,7 @@ static int ipath_pe_boardname(struct ipa * freeze mode), and enable hardware errors as errors (along with * everything else) in errormask */ -void ipath_pe_init_hwerrors(struct ipath_devdata *dd) +static void ipath_pe_init_hwerrors(struct ipath_devdata *dd) { ipath_err_t val; u64 extsval; @@ -577,7 +577,7 @@ void ipath_pe_init_hwerrors(struct ipath * ipath_pe_bringup_serdes - bring up the serdes * @dd: the infinipath device */ -int ipath_pe_bringup_serdes(struct ipath_devdata *dd) +static int ipath_pe_bringup_serdes(struct ipath_devdata *dd) { u64 val, tmp, config1; int ret = 0, change = 0; @@ -694,7 +694,7 @@ int ipath_pe_bringup_serdes(struct ipath * @dd: the infinipath device * Called when driver is being unloaded */ -void ipath_pe_quiet_serdes(struct ipath_devdata *dd) +static void ipath_pe_quiet_serdes(struct ipath_devdata *dd) { u64 val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_serdesconfig0); diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c index 6058d70..1889071 100644 --- a/drivers/infiniband/hw/ipath/ipath_qp.c +++ b/drivers/infiniband/hw/ipath/ipath_qp.c @@ -188,8 +188,8 @@ static void free_qpn(struct ipath_qp_tab * Allocate the next available QPN and put the QP into the hash table. * The hash table holds a reference to the QP. */ -int ipath_alloc_qpn(struct ipath_qp_table *qpt, struct ipath_qp *qp, - enum ib_qp_type type) +static int ipath_alloc_qpn(struct ipath_qp_table *qpt, struct ipath_qp *qp, + enum ib_qp_type type) { unsigned long flags; u32 qpn; @@ -232,7 +232,7 @@ bail: * Remove the QP from the table so it can't be found asynchronously by * the receive interrupt routine. */ -void ipath_free_qp(struct ipath_qp_table *qpt, struct ipath_qp *qp) +static void ipath_free_qp(struct ipath_qp_table *qpt, struct ipath_qp *qp) { struct ipath_qp *q, **qpp; unsigned long flags; @@ -358,6 +358,65 @@ static void ipath_reset_qp(struct ipath_ } /** + * ipath_error_qp - put a QP into an error state + * @qp: the QP to put into an error state + * + * Flushes both send and receive work queues. + * QP r_rq.lock and s_lock should be held. + */ + +static void ipath_error_qp(struct ipath_qp *qp) +{ + struct ipath_ibdev *dev = to_idev(qp->ibqp.device); + struct ib_wc wc; + + _VERBS_INFO("QP%d/%d in error state\n", + qp->ibqp.qp_num, qp->remote_qpn); + + spin_lock(&dev->pending_lock); + /* XXX What if its already removed by the timeout code? */ + if (qp->timerwait.next != LIST_POISON1) + list_del(&qp->timerwait); + if (qp->piowait.next != LIST_POISON1) + list_del(&qp->piowait); + spin_unlock(&dev->pending_lock); + + wc.status = IB_WC_WR_FLUSH_ERR; + wc.vendor_err = 0; + wc.byte_len = 0; + wc.imm_data = 0; + wc.qp_num = qp->ibqp.qp_num; + wc.src_qp = 0; + wc.wc_flags = 0; + wc.pkey_index = 0; + wc.slid = 0; + wc.sl = 0; + wc.dlid_path_bits = 0; + wc.port_num = 0; + + while (qp->s_last != qp->s_head) { + struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last); + + wc.wr_id = wqe->wr.wr_id; + wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; + if (++qp->s_last >= qp->s_size) + qp->s_last = 0; + ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 1); + } + qp->s_cur = qp->s_tail = qp->s_head; + qp->s_hdrwords = 0; + qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE; + + wc.opcode = IB_WC_RECV; + while (qp->r_rq.tail != qp->r_rq.head) { + wc.wr_id = get_rwqe_ptr(&qp->r_rq, qp->r_rq.tail)->wr_id; + if (++qp->r_rq.tail >= qp->r_rq.size) + qp->r_rq.tail = 0; + ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1); + } +} + +/** * ipath_modify_qp - modify the attributes of a queue pair * @ibqp: the queue pair who's attributes we're modifying * @attr: the new attributes @@ -821,65 +880,6 @@ void ipath_sqerror_qp(struct ipath_qp *q } /** - * ipath_error_qp - put a QP into an error state - * @qp: the QP to put into an error state - * - * Flushes both send and receive work queues. - * QP r_rq.lock and s_lock should be held. - */ - -void ipath_error_qp(struct ipath_qp *qp) -{ - struct ipath_ibdev *dev = to_idev(qp->ibqp.device); - struct ib_wc wc; - - _VERBS_INFO("QP%d/%d in error state\n", - qp->ibqp.qp_num, qp->remote_qpn); - - spin_lock(&dev->pending_lock); - /* XXX What if its already removed by the timeout code? */ - if (qp->timerwait.next != LIST_POISON1) - list_del(&qp->timerwait); - if (qp->piowait.next != LIST_POISON1) - list_del(&qp->piowait); - spin_unlock(&dev->pending_lock); - - wc.status = IB_WC_WR_FLUSH_ERR; - wc.vendor_err = 0; - wc.byte_len = 0; - wc.imm_data = 0; - wc.qp_num = qp->ibqp.qp_num; - wc.src_qp = 0; - wc.wc_flags = 0; - wc.pkey_index = 0; - wc.slid = 0; - wc.sl = 0; - wc.dlid_path_bits = 0; - wc.port_num = 0; - - while (qp->s_last != qp->s_head) { - struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last); - - wc.wr_id = wqe->wr.wr_id; - wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; - if (++qp->s_last >= qp->s_size) - qp->s_last = 0; - ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 1); - } - qp->s_cur = qp->s_tail = qp->s_head; - qp->s_hdrwords = 0; - qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE; - - wc.opcode = IB_WC_RECV; - while (qp->r_rq.tail != qp->r_rq.head) { - wc.wr_id = get_rwqe_ptr(&qp->r_rq, qp->r_rq.tail)->wr_id; - if (++qp->r_rq.tail >= qp->r_rq.size) - qp->r_rq.tail = 0; - ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1); - } -} - -/** * ipath_get_credit - flush the send work queue of a QP * @qp: the qp who's send work queue to flush * @aeth: the Acknowledge Extended Transport Header diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c index 5ff3de6..01cfb30 100644 --- a/drivers/infiniband/hw/ipath/ipath_ud.c +++ b/drivers/infiniband/hw/ipath/ipath_ud.c @@ -46,8 +46,8 @@ * This is called from ipath_post_ud_send() to forward a WQE addressed * to the same HCA. */ -void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_sge_state *ss, - u32 length, struct ib_send_wr *wr, struct ib_wc *wc) +static void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_sge_state *ss, + u32 length, struct ib_send_wr *wr, struct ib_wc *wc) { struct ipath_ibdev *dev = to_idev(sqp->ibqp.device); struct ipath_qp *qp; diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 9f27fd3..8d2558a 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c @@ -41,7 +41,7 @@ /* Not static, because we don't want the compiler removing it */ const char ipath_verbs_version[] = "ipath_verbs " IPATH_IDSTR; -unsigned int ib_ipath_qp_table_size = 251; +static unsigned int ib_ipath_qp_table_size = 251; module_param_named(qp_table_size, ib_ipath_qp_table_size, uint, S_IRUGO); MODULE_PARM_DESC(qp_table_size, "QP table size"); @@ -87,7 +87,7 @@ const enum ib_wc_opcode ib_ipath_wc_opco /* * System image GUID. */ -__be64 sys_image_guid; +static __be64 sys_image_guid; /** * ipath_copy_sge - copy data to SGE memory @@ -1110,7 +1110,7 @@ static void ipath_unregister_ib_device(v ib_dealloc_device(ibdev); } -int __init ipath_verbs_init(void) +static int __init ipath_verbs_init(void) { return ipath_verbs_register(ipath_register_ib_device, ipath_unregister_ib_device, @@ -1118,33 +1118,33 @@ int __init ipath_verbs_init(void) ipath_ib_timer); } -void __exit ipath_verbs_cleanup(void) +static void __exit ipath_verbs_cleanup(void) { ipath_verbs_unregister(); } static ssize_t show_rev(struct class_device *cdev, char *buf) { - struct ipath_ibdev *dev = - container_of(cdev, struct ipath_ibdev, ibdev.class_dev); - int vendor, boardrev, majrev, minrev; - - ipath_layer_query_device(dev->dd, &vendor, &boardrev, - &majrev, &minrev); - return sprintf(buf, "%d.%d\n", majrev, minrev); + struct ipath_ibdev *dev = + container_of(cdev, struct ipath_ibdev, ibdev.class_dev); + int vendor, boardrev, majrev, minrev; + + ipath_layer_query_device(dev->dd, &vendor, &boardrev, + &majrev, &minrev); + return sprintf(buf, "%d.%d\n", majrev, minrev); } static ssize_t show_hca(struct class_device *cdev, char *buf) { - struct ipath_ibdev *dev = - container_of(cdev, struct ipath_ibdev, ibdev.class_dev); - int ret; - - ret = ipath_layer_get_boardname(dev->dd, buf, 128); - if (ret < 0) - goto bail; - strcat(buf, "\n"); - ret = strlen(buf); + struct ipath_ibdev *dev = + container_of(cdev, struct ipath_ibdev, ibdev.class_dev); + int ret; + + ret = ipath_layer_get_boardname(dev->dd, buf, 128); + if (ret < 0) + goto bail; + strcat(buf, "\n"); + ret = strlen(buf); bail: return ret; @@ -1152,40 +1152,40 @@ bail: static ssize_t show_stats(struct class_device *cdev, char *buf) { - struct ipath_ibdev *dev = - container_of(cdev, struct ipath_ibdev, ibdev.class_dev); - int i; - int len; - - len = sprintf(buf, - "RC resends %d\n" - "RC QACKs %d\n" - "RC ACKs %d\n" - "RC SEQ NAKs %d\n" - "RC RDMA seq %d\n" - "RC RNR NAKs %d\n" - "RC OTH NAKs %d\n" - "RC timeouts %d\n" - "RC RDMA dup %d\n" - "piobuf wait %d\n" - "no piobuf %d\n" - "PKT drops %d\n" - "WQE errs %d\n", - dev->n_rc_resends, dev->n_rc_qacks, dev->n_rc_acks, - dev->n_seq_naks, dev->n_rdma_seq, dev->n_rnr_naks, - dev->n_other_naks, dev->n_timeouts, - dev->n_rdma_dup_busy, dev->n_piowait, - dev->n_no_piobuf, dev->n_pkt_drops, dev->n_wqe_errs); - for (i = 0; i < ARRAY_SIZE(dev->opstats); i++) { + struct ipath_ibdev *dev = + container_of(cdev, struct ipath_ibdev, ibdev.class_dev); + int i; + int len; + + len = sprintf(buf, + "RC resends %d\n" + "RC QACKs %d\n" + "RC ACKs %d\n" + "RC SEQ NAKs %d\n" + "RC RDMA seq %d\n" + "RC RNR NAKs %d\n" + "RC OTH NAKs %d\n" + "RC timeouts %d\n" + "RC RDMA dup %d\n" + "piobuf wait %d\n" + "no piobuf %d\n" + "PKT drops %d\n" + "WQE errs %d\n", + dev->n_rc_resends, dev->n_rc_qacks, dev->n_rc_acks, + dev->n_seq_naks, dev->n_rdma_seq, dev->n_rnr_naks, + dev->n_other_naks, dev->n_timeouts, + dev->n_rdma_dup_busy, dev->n_piowait, + dev->n_no_piobuf, dev->n_pkt_drops, dev->n_wqe_errs); + for (i = 0; i < ARRAY_SIZE(dev->opstats); i++) { const struct ipath_opcode_stats *si = &dev->opstats[i]; - if (!si->n_packets && !si->n_bytes) - continue; - len += sprintf(buf + len, "%02x %llu/%llu\n", i, + if (!si->n_packets && !si->n_bytes) + continue; + len += sprintf(buf + len, "%02x %llu/%llu\n", i, (unsigned long long) si->n_packets, - (unsigned long long) si->n_bytes); - } - return len; + (unsigned long long) si->n_bytes); + } + return len; } static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); @@ -1194,25 +1194,25 @@ static CLASS_DEVICE_ATTR(board_id, S_IRU static CLASS_DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); static struct class_device_attribute *ipath_class_attributes[] = { - &class_device_attr_hw_rev, - &class_device_attr_hca_type, - &class_device_attr_board_id, - &class_device_attr_stats + &class_device_attr_hw_rev, + &class_device_attr_hca_type, + &class_device_attr_board_id, + &class_device_attr_stats }; static int ipath_verbs_register_sysfs(struct ib_device *dev) { - int i; + int i; int ret; - for (i = 0; i < ARRAY_SIZE(ipath_class_attributes); ++i) - if (class_device_create_file(&dev->class_dev, - ipath_class_attributes[i])) { - ret = 1; + for (i = 0; i < ARRAY_SIZE(ipath_class_attributes); ++i) + if (class_device_create_file(&dev->class_dev, + ipath_class_attributes[i])) { + ret = 1; goto bail; } - ret = 0; + ret = 0; bail: return ret; diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.h b/drivers/infiniband/hw/ipath/ipath_verbs.h index b824632..fcafbc7 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.h +++ b/drivers/infiniband/hw/ipath/ipath_verbs.h @@ -577,8 +577,6 @@ int ipath_init_qp_table(struct ipath_ibd void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc); -void ipath_error_qp(struct ipath_qp *qp); - void ipath_get_credit(struct ipath_qp *qp, u32 aeth); void ipath_do_rc_send(unsigned long data); @@ -607,9 +605,6 @@ void ipath_rc_rcv(struct ipath_ibdev *de void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc); -void ipath_ud_loopback(struct ipath_qp *sqp, struct ipath_sge_state *ss, - u32 length, struct ib_send_wr *wr, struct ib_wc *wc); - int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr); void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, diff --git a/drivers/infiniband/hw/mthca/mthca_mad.c b/drivers/infiniband/hw/mthca/mthca_mad.c index f235c7e..4730863 100644 --- a/drivers/infiniband/hw/mthca/mthca_mad.c +++ b/drivers/infiniband/hw/mthca/mthca_mad.c @@ -49,7 +49,7 @@ enum { MTHCA_VENDOR_CLASS2 = 0xa }; -int mthca_update_rate(struct mthca_dev *dev, u8 port_num) +static int mthca_update_rate(struct mthca_dev *dev, u8 port_num) { struct ib_port_attr *tprops = NULL; int ret; diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 5f2b3f6..5bb5574 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -617,6 +617,14 @@ static void srp_unmap_data(struct scsi_c scmnd->sc_data_direction); } +static void srp_remove_req(struct srp_target_port *target, struct srp_request *req, + int index) +{ + list_del(&req->list); + req->next = target->req_head; + target->req_head = index; +} + static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp) { struct srp_request *req; @@ -664,9 +672,7 @@ static void srp_process_rsp(struct srp_t scmnd->host_scribble = (void *) -1L; scmnd->scsi_done(scmnd); - list_del(&req->list); - req->next = target->req_head; - target->req_head = rsp->tag & ~SRP_TAG_TSK_MGMT; + srp_remove_req(target, req, rsp->tag & ~SRP_TAG_TSK_MGMT); } else req->cmd_done = 1; } @@ -1188,12 +1194,10 @@ static int srp_send_tsk_mgmt(struct scsi spin_lock_irq(target->scsi_host->host_lock); if (req->cmd_done) { - list_del(&req->list); - req->next = target->req_head; - target->req_head = req_index; - + srp_remove_req(target, req, req_index); scmnd->scsi_done(scmnd); } else if (!req->tsk_status) { + srp_remove_req(target, req, req_index); scmnd->result = DID_ABORT << 16; ret = SUCCESS; } diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c index 1dca3cf..2e4abdc 100644 --- a/drivers/input/keyboard/hil_kbd.c +++ b/drivers/input/keyboard/hil_kbd.c @@ -350,11 +350,11 @@ static int hil_kbd_connect(struct serio return 0; bail2: serio_close(serio); + serio_set_drvdata(serio, NULL); bail1: input_free_device(kbd->dev); bail0: kfree(kbd); - serio_set_drvdata(serio, NULL); return -EIO; } diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index f86ed6a..eb41aba 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c @@ -5,8 +5,6 @@ * Tilman Schmidt , * Stefan Eilers. * - * Based on usb-gigaset.c. - * * ===================================================================== * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -46,19 +44,20 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode" #define GIGASET_DEVFSNAME "gig/bas/" #define GIGASET_DEVNAME "ttyGB" -#define IF_WRITEBUF 256 //FIXME +/* length limit according to Siemens 3070usb-protokoll.doc ch. 2.1 */ +#define IF_WRITEBUF 264 /* Values for the Gigaset 307x */ #define USB_GIGA_VENDOR_ID 0x0681 -#define USB_GIGA_PRODUCT_ID 0x0001 -#define USB_4175_PRODUCT_ID 0x0002 +#define USB_3070_PRODUCT_ID 0x0001 +#define USB_3075_PRODUCT_ID 0x0002 #define USB_SX303_PRODUCT_ID 0x0021 #define USB_SX353_PRODUCT_ID 0x0022 /* table of devices that work with this driver */ static struct usb_device_id gigaset_table [] = { - { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_GIGA_PRODUCT_ID) }, - { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_4175_PRODUCT_ID) }, + { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) }, + { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) }, { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) }, { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX353_PRODUCT_ID) }, { } /* Terminating entry */ @@ -77,6 +76,10 @@ static int gigaset_probe(struct usb_inte /* Function will be called if the device is unplugged */ static void gigaset_disconnect(struct usb_interface *interface); +static void read_ctrl_callback(struct urb *, struct pt_regs *); +static void stopurbs(struct bas_bc_state *); +static int atwrite_submit(struct cardstate *, unsigned char *, int); +static int start_cbsend(struct cardstate *); /*==============================================================================*/ @@ -111,12 +114,14 @@ struct bas_cardstate { }; /* status of direct USB connection to 307x base (bits in basstate) */ -#define BS_ATOPEN 0x001 -#define BS_B1OPEN 0x002 -#define BS_B2OPEN 0x004 -#define BS_ATREADY 0x008 -#define BS_INIT 0x010 -#define BS_ATTIMER 0x020 +#define BS_ATOPEN 0x001 /* AT channel open */ +#define BS_B1OPEN 0x002 /* B channel 1 open */ +#define BS_B2OPEN 0x004 /* B channel 2 open */ +#define BS_ATREADY 0x008 /* base ready for AT command */ +#define BS_INIT 0x010 /* base has signalled INIT_OK */ +#define BS_ATTIMER 0x020 /* waiting for HD_READY_SEND_ATDATA */ +#define BS_ATRDPEND 0x040 /* urb_cmd_in in use */ +#define BS_ATWRPEND 0x080 /* urb_cmd_out in use */ static struct gigaset_driver *driver = NULL; @@ -130,6 +135,47 @@ static struct usb_driver gigaset_usb_dri .id_table = gigaset_table, }; +/* get message text for usb_submit_urb return code + */ +static char *get_usb_rcmsg(int rc) +{ + static char unkmsg[28]; + + switch (rc) { + case 0: + return "success"; + case -ENOMEM: + return "out of memory"; + case -ENODEV: + return "device not present"; + case -ENOENT: + return "endpoint not present"; + case -ENXIO: + return "URB type not supported"; + case -EINVAL: + return "invalid argument"; + case -EAGAIN: + return "start frame too early or too much scheduled"; + case -EFBIG: + return "too many isochronous frames requested"; + case -EPIPE: + return "endpoint stalled"; + case -EMSGSIZE: + return "invalid packet size"; + case -ENOSPC: + return "would overcommit USB bandwidth"; + case -ESHUTDOWN: + return "device shut down"; + case -EPERM: + return "reject flag set"; + case -EHOSTUNREACH: + return "device suspended"; + default: + snprintf(unkmsg, sizeof(unkmsg), "unknown error %d", rc); + return unkmsg; + } +} + /* get message text for USB status code */ static char *get_usb_statmsg(int status) @@ -140,43 +186,37 @@ static char *get_usb_statmsg(int status) case 0: return "success"; case -ENOENT: - return "canceled"; - case -ECONNRESET: - return "canceled (async)"; + return "unlinked (sync)"; case -EINPROGRESS: return "pending"; case -EPROTO: - return "bit stuffing or unknown USB error"; + return "bit stuffing error, timeout, or unknown USB error"; case -EILSEQ: - return "Illegal byte sequence (CRC mismatch)"; - case -EPIPE: - return "babble detect or endpoint stalled"; - case -ENOSR: - return "buffer error"; + return "CRC mismatch, timeout, or unknown USB error"; case -ETIMEDOUT: return "timed out"; - case -ENODEV: - return "device not present"; + case -EPIPE: + return "endpoint stalled"; + case -ECOMM: + return "IN buffer overrun"; + case -ENOSR: + return "OUT buffer underrun"; + case -EOVERFLOW: + return "too much data"; case -EREMOTEIO: return "short packet detected"; + case -ENODEV: + return "device removed"; case -EXDEV: return "partial isochronous transfer"; case -EINVAL: return "invalid argument"; - case -ENXIO: - return "URB already queued"; - case -EAGAIN: - return "isochronous start frame too early or too much scheduled"; - case -EFBIG: - return "too many isochronous frames requested"; - case -EMSGSIZE: - return "endpoint message size zero"; + case -ECONNRESET: + return "unlinked (async)"; case -ESHUTDOWN: - return "endpoint shutdown"; - case -EBUSY: - return "another request pending"; + return "device shut down"; default: - snprintf(unkmsg, sizeof(unkmsg), "unknown error %d", status); + snprintf(unkmsg, sizeof(unkmsg), "unknown status %d", status); return unkmsg; } } @@ -277,18 +317,17 @@ static inline void error_hangup(struct b gig_dbg(DEBUG_ANY, "%s: scheduling HUP for channel %d", __func__, bcs->channel); - if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) { - //FIXME what should we do? - return; - } + if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) + dev_err(cs->dev, "event queue full\n"); gigaset_schedule_event(cs); } /* error_reset * reset Gigaset device because of an unrecoverable error - * This function may be called from any context and takes care of scheduling - * the necessary actions for execution outside of interrupt context. + * This function may be called from any context, and should take care of + * scheduling the necessary actions for execution outside of interrupt context. + * Right now, it just generates a kernel message calling for help. * argument: * controller state structure */ @@ -364,36 +403,38 @@ static void cmd_in_timeout(unsigned long { struct cardstate *cs = (struct cardstate *) data; struct bas_cardstate *ucs = cs->hw.bas; - unsigned long flags; - spin_lock_irqsave(&cs->lock, flags); - if (unlikely(!cs->connected)) { - gig_dbg(DEBUG_USBREQ, "%s: disconnected", __func__); - spin_unlock_irqrestore(&cs->lock, flags); - return; - } if (!ucs->rcvbuf_size) { gig_dbg(DEBUG_USBREQ, "%s: no receive in progress", __func__); - spin_unlock_irqrestore(&cs->lock, flags); return; } - spin_unlock_irqrestore(&cs->lock, flags); dev_err(cs->dev, "timeout reading AT response\n"); error_reset(cs); //FIXME retry? } +/* set/clear bits in base connection state, return previous state + */ +inline static int update_basstate(struct bas_cardstate *ucs, + int set, int clear) +{ + unsigned long flags; + int state; -static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs); + spin_lock_irqsave(&ucs->lock, flags); + state = atomic_read(&ucs->basstate); + atomic_set(&ucs->basstate, (state & ~clear) | set); + spin_unlock_irqrestore(&ucs->lock, flags); + return state; +} /* atread_submit - * submit an HD_READ_ATMESSAGE command URB + * submit an HD_READ_ATMESSAGE command URB and optionally start a timeout * parameters: * cs controller state structure * timeout timeout in 1/10 sec., 0: none * return value: * 0 on success - * -EINVAL if a NULL pointer is encountered somewhere * -EBUSY if another request is pending * any URB submission error code */ @@ -405,7 +446,7 @@ static int atread_submit(struct cardstat gig_dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)", ucs->rcvbuf_size); - if (ucs->urb_cmd_in->status == -EINPROGRESS) { + if (update_basstate(ucs, BS_ATRDPEND, 0) & BS_ATRDPEND) { dev_err(cs->dev, "could not submit HD_READ_ATMESSAGE: URB busy\n"); return -EBUSY; @@ -423,6 +464,7 @@ static int atread_submit(struct cardstat read_ctrl_callback, cs->inbuf); if ((ret = usb_submit_urb(ucs->urb_cmd_in, SLAB_ATOMIC)) != 0) { + update_basstate(ucs, 0, BS_ATRDPEND); dev_err(cs->dev, "could not submit HD_READ_ATMESSAGE: %s\n", get_usb_statmsg(ret)); return ret; @@ -438,26 +480,6 @@ static int atread_submit(struct cardstat return 0; } -static void stopurbs(struct bas_bc_state *); -static int start_cbsend(struct cardstate *); - -/* set/clear bits in base connection state - */ -inline static void update_basstate(struct bas_cardstate *ucs, - int set, int clear) -{ - unsigned long flags; - int state; - - spin_lock_irqsave(&ucs->lock, flags); - state = atomic_read(&ucs->basstate); - state &= ~clear; - state |= set; - atomic_set(&ucs->basstate, state); - spin_unlock_irqrestore(&ucs->lock, flags); -} - - /* read_int_callback * USB completion handler for interrupt pipe input * called by the USB subsystem in interrupt context @@ -471,20 +493,25 @@ static void read_int_callback(struct urb struct bas_cardstate *ucs = cs->hw.bas; struct bc_state *bcs; unsigned long flags; - int status; + int rc; unsigned l; int channel; switch (urb->status) { case 0: /* success */ break; - case -ENOENT: /* canceled */ - case -ECONNRESET: /* canceled (async) */ + case -ENOENT: /* cancelled */ + case -ECONNRESET: /* cancelled (async) */ case -EINPROGRESS: /* pending */ /* ignore silently */ gig_dbg(DEBUG_USBREQ, "%s: %s", __func__, get_usb_statmsg(urb->status)); return; + case -ENODEV: /* device removed */ + case -ESHUTDOWN: /* device shut down */ + //FIXME use this as disconnect indicator? + gig_dbg(DEBUG_USBREQ, "%s: device disconnected", __func__); + return; default: /* severe trouble */ dev_warn(cs->dev, "interrupt read: %s\n", get_usb_statmsg(urb->status)); @@ -492,6 +519,13 @@ static void read_int_callback(struct urb goto resubmit; } + /* drop incomplete packets even if the missing bytes wouldn't matter */ + if (unlikely(urb->actual_length < 3)) { + dev_warn(cs->dev, "incomplete interrupt packet (%d bytes)\n", + urb->actual_length); + goto resubmit; + } + l = (unsigned) ucs->int_in_buf[1] + (((unsigned) ucs->int_in_buf[2]) << 8); @@ -558,25 +592,28 @@ static void read_int_callback(struct urb } spin_lock_irqsave(&cs->lock, flags); if (ucs->rcvbuf_size) { - spin_unlock_irqrestore(&cs->lock, flags); + /* throw away previous buffer - we have no queue */ dev_err(cs->dev, - "receive AT data overrun, %d bytes lost\n", l); - error_reset(cs); //FIXME reschedule - break; + "receive AT data overrun, %d bytes lost\n", + ucs->rcvbuf_size); + kfree(ucs->rcvbuf); + ucs->rcvbuf_size = 0; } if ((ucs->rcvbuf = kmalloc(l, GFP_ATOMIC)) == NULL) { spin_unlock_irqrestore(&cs->lock, flags); - dev_err(cs->dev, "out of memory, %d bytes lost\n", l); - error_reset(cs); //FIXME reschedule + dev_err(cs->dev, "out of memory receiving AT data\n"); + error_reset(cs); break; } ucs->rcvbuf_size = l; ucs->retry_cmd_in = 0; - if ((status = atread_submit(cs, BAS_TIMEOUT)) < 0) { + if ((rc = atread_submit(cs, BAS_TIMEOUT)) < 0) { kfree(ucs->rcvbuf); ucs->rcvbuf = NULL; ucs->rcvbuf_size = 0; - error_reset(cs); //FIXME reschedule + if (rc != -ENODEV) + //FIXME corrective action? + error_reset(cs); } spin_unlock_irqrestore(&cs->lock, flags); break; @@ -598,12 +635,10 @@ static void read_int_callback(struct urb check_pending(ucs); resubmit: - spin_lock_irqsave(&cs->lock, flags); - status = cs->connected ? usb_submit_urb(urb, SLAB_ATOMIC) : -ENODEV; - spin_unlock_irqrestore(&cs->lock, flags); - if (unlikely(status)) { + rc = usb_submit_urb(urb, SLAB_ATOMIC); + if (unlikely(rc != 0 && rc != -ENODEV)) { dev_err(cs->dev, "could not resubmit interrupt URB: %s\n", - get_usb_statmsg(status)); + get_usb_rcmsg(rc)); error_reset(cs); } } @@ -622,18 +657,12 @@ static void read_ctrl_callback(struct ur struct bas_cardstate *ucs = cs->hw.bas; int have_data = 0; unsigned numbytes; - unsigned long flags; + int rc; - spin_lock_irqsave(&cs->lock, flags); - if (unlikely(!cs->connected)) { - warn("%s: disconnected", __func__); - spin_unlock_irqrestore(&cs->lock, flags); - return; - } + update_basstate(ucs, 0, BS_ATRDPEND); if (!ucs->rcvbuf_size) { dev_warn(cs->dev, "%s: no receive in progress\n", __func__); - spin_unlock_irqrestore(&cs->lock, flags); return; } @@ -666,9 +695,11 @@ static void read_ctrl_callback(struct ur } break; - case -ENOENT: /* canceled */ - case -ECONNRESET: /* canceled (async) */ + case -ENOENT: /* cancelled */ + case -ECONNRESET: /* cancelled (async) */ case -EINPROGRESS: /* pending */ + case -ENODEV: /* device removed */ + case -ESHUTDOWN: /* device shut down */ /* no action necessary */ gig_dbg(DEBUG_USBREQ, "%s: %s", __func__, get_usb_statmsg(urb->status)); @@ -681,11 +712,11 @@ static void read_ctrl_callback(struct ur if (ucs->retry_cmd_in++ < BAS_RETRY) { dev_notice(cs->dev, "control read: retry %d\n", ucs->retry_cmd_in); - if (atread_submit(cs, BAS_TIMEOUT) >= 0) { - /* resubmitted - bypass regular exit block */ - spin_unlock_irqrestore(&cs->lock, flags); + rc = atread_submit(cs, BAS_TIMEOUT); + if (rc >= 0 || rc == -ENODEV) + /* resubmitted or disconnected */ + /* - bypass regular exit block */ return; - } } else { dev_err(cs->dev, "control read: giving up after %d tries\n", @@ -697,7 +728,6 @@ static void read_ctrl_callback(struct ur kfree(ucs->rcvbuf); ucs->rcvbuf = NULL; ucs->rcvbuf_size = 0; - spin_unlock_irqrestore(&cs->lock, flags); if (have_data) { gig_dbg(DEBUG_INTR, "%s-->BH", __func__); gigaset_schedule_event(cs); @@ -719,8 +749,11 @@ static void read_iso_callback(struct urb int i, rc; /* status codes not worth bothering the tasklet with */ - if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || - urb->status == -EINPROGRESS)) { + if (unlikely(urb->status == -ENOENT || + urb->status == -ECONNRESET || + urb->status == -EINPROGRESS || + urb->status == -ENODEV || + urb->status == -ESHUTDOWN)) { gig_dbg(DEBUG_ISO, "%s: %s", __func__, get_usb_statmsg(urb->status)); return; @@ -740,9 +773,9 @@ static void read_iso_callback(struct urb for (i = 0; i < BAS_NUMFRAMES; i++) { ubc->isoinlost += urb->iso_frame_desc[i].actual_length; if (unlikely(urb->iso_frame_desc[i].status != 0 && - urb->iso_frame_desc[i].status != -EINPROGRESS)) { + urb->iso_frame_desc[i].status != + -EINPROGRESS)) ubc->loststatus = urb->iso_frame_desc[i].status; - } urb->iso_frame_desc[i].status = 0; urb->iso_frame_desc[i].actual_length = 0; } @@ -754,10 +787,10 @@ static void read_iso_callback(struct urb gig_dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit", __func__); rc = usb_submit_urb(urb, SLAB_ATOMIC); - if (unlikely(rc != 0)) { + if (unlikely(rc != 0 && rc != -ENODEV)) { dev_err(bcs->cs->dev, "could not resubmit isochronous read " - "URB: %s\n", get_usb_statmsg(rc)); + "URB: %s\n", get_usb_rcmsg(rc)); dump_urb(DEBUG_ISO, "isoc read", urb); error_hangup(bcs); } @@ -780,8 +813,11 @@ static void write_iso_callback(struct ur unsigned long flags; /* status codes not worth bothering the tasklet with */ - if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || - urb->status == -EINPROGRESS)) { + if (unlikely(urb->status == -ENOENT || + urb->status == -ECONNRESET || + urb->status == -EINPROGRESS || + urb->status == -ENODEV || + urb->status == -ESHUTDOWN)) { gig_dbg(DEBUG_ISO, "%s: %s", __func__, get_usb_statmsg(urb->status)); return; @@ -822,7 +858,6 @@ static int starturbs(struct bc_state *bc for (k = 0; k < BAS_INURBS; k++) { urb = ubc->isoinurbs[k]; if (!urb) { - dev_err(bcs->cs->dev, "isoinurbs[%d]==NULL\n", k); rc = -EFAULT; goto error; } @@ -844,12 +879,8 @@ static int starturbs(struct bc_state *bc } dump_urb(DEBUG_ISO, "Initial isoc read", urb); - if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { - dev_err(bcs->cs->dev, - "could not submit isochronous read URB %d: %s\n", - k, get_usb_statmsg(rc)); + if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) goto error; - } } /* initialize L2 transmission */ @@ -859,7 +890,6 @@ static int starturbs(struct bc_state *bc for (k = 0; k < BAS_OUTURBS; ++k) { urb = ubc->isoouturbs[k].urb; if (!urb) { - dev_err(bcs->cs->dev, "isoouturbs[%d].urb==NULL\n", k); rc = -EFAULT; goto error; } @@ -885,12 +915,8 @@ static int starturbs(struct bc_state *bc for (k = 0; k < 2; ++k) { dump_urb(DEBUG_ISO, "Initial isoc write", urb); rc = usb_submit_urb(ubc->isoouturbs[k].urb, SLAB_ATOMIC); - if (rc != 0) { - dev_err(bcs->cs->dev, - "could not submit isochronous write URB %d: %s\n", - k, get_usb_statmsg(rc)); + if (rc != 0) goto error; - } } dump_urb(DEBUG_ISO, "Initial isoc write (free)", urb); ubc->isooutfree = &ubc->isoouturbs[2]; @@ -916,15 +942,15 @@ static void stopurbs(struct bas_bc_state for (k = 0; k < BAS_INURBS; ++k) { rc = usb_unlink_urb(ubc->isoinurbs[k]); gig_dbg(DEBUG_ISO, - "%s: isoc input URB %d unlinked, result = %d", - __func__, k, rc); + "%s: isoc input URB %d unlinked, result = %s", + __func__, k, get_usb_rcmsg(rc)); } for (k = 0; k < BAS_OUTURBS; ++k) { rc = usb_unlink_urb(ubc->isoouturbs[k].urb); gig_dbg(DEBUG_ISO, - "%s: isoc output URB %d unlinked, result = %d", - __func__, k, rc); + "%s: isoc output URB %d unlinked, result = %s", + __func__, k, get_usb_rcmsg(rc)); } } @@ -934,7 +960,7 @@ static void stopurbs(struct bas_bc_state /* submit_iso_write_urb * fill and submit the next isochronous write URB * parameters: - * bcs B channel state structure + * ucx context structure containing URB * return value: * number of frames submitted in URB * 0 if URB not submitted because no data available (isooutbuf busy) @@ -946,7 +972,6 @@ static int submit_iso_write_urb(struct i struct bas_bc_state *ubc = ucx->bcs->hw.bas; struct usb_iso_packet_descriptor *ifd; int corrbytes, nframe, rc; - unsigned long flags; /* urb->dev is clobbered by USB subsystem */ urb->dev = ucx->bcs->cs->hw.bas->udev; @@ -992,20 +1017,22 @@ static int submit_iso_write_urb(struct i ifd->status = 0; ifd->actual_length = 0; } - if ((urb->number_of_packets = nframe) > 0) { - spin_lock_irqsave(&ucx->bcs->cs->lock, flags); - rc = ucx->bcs->cs->connected ? usb_submit_urb(urb, SLAB_ATOMIC) : -ENODEV; - spin_unlock_irqrestore(&ucx->bcs->cs->lock, flags); - - if (rc) { + if (unlikely(nframe == 0)) + return 0; /* no data to send */ + urb->number_of_packets = nframe; + + rc = usb_submit_urb(urb, SLAB_ATOMIC); + if (unlikely(rc)) { + if (rc == -ENODEV) + /* device removed - give up silently */ + gig_dbg(DEBUG_ISO, "%s: disconnected", __func__); + else dev_err(ucx->bcs->cs->dev, "could not submit isochronous write URB: %s\n", - get_usb_statmsg(rc)); - dump_urb(DEBUG_ISO, "isoc write", urb); - return rc; - } - ++ubc->numsub; + get_usb_rcmsg(rc)); + return rc; } + ++ubc->numsub; return nframe; } @@ -1028,6 +1055,7 @@ static void write_iso_tasklet(unsigned l int i; struct sk_buff *skb; int len; + int rc; /* loop while completed URBs arrive in time */ for (;;) { @@ -1057,7 +1085,8 @@ static void write_iso_tasklet(unsigned l ubc->isooutfree = NULL; spin_unlock_irqrestore(&ubc->isooutlock, flags); if (next) { - if (submit_iso_write_urb(next) <= 0) { + rc = submit_iso_write_urb(next); + if (unlikely(rc <= 0 && rc != -ENODEV)) { /* could not submit URB, put it back */ spin_lock_irqsave(&ubc->isooutlock, flags); if (ubc->isooutfree == NULL) { @@ -1077,17 +1106,18 @@ static void write_iso_tasklet(unsigned l /* process completed URB */ urb = done->urb; switch (urb->status) { + case -EXDEV: /* partial completion */ + gig_dbg(DEBUG_ISO, "%s: URB partially completed", + __func__); + /* fall through - what's the difference anyway? */ case 0: /* normal completion */ - break; - case -EXDEV: /* inspect individual frames */ - /* assumptions (for lack of documentation): - * - actual_length bytes of the frame in error are + /* inspect individual frames + * assumptions (for lack of documentation): + * - actual_length bytes of first frame in error are * successfully sent * - all following frames are not sent at all */ - gig_dbg(DEBUG_ISO, "%s: URB partially completed", - __func__); - offset = done->limit; /* just in case */ + offset = done->limit; /* default (no error) */ for (i = 0; i < BAS_NUMFRAMES; i++) { ifd = &urb->iso_frame_desc[i]; if (ifd->status || @@ -1122,7 +1152,7 @@ static void write_iso_tasklet(unsigned l } #endif break; - case -EPIPE: //FIXME is this the code for "underrun"? + case -EPIPE: /* stall - probably underrun */ dev_err(cs->dev, "isochronous write stalled\n"); error_hangup(bcs); break; @@ -1142,7 +1172,8 @@ static void write_iso_tasklet(unsigned l spin_unlock_irqrestore(&ubc->isooutlock, flags); if (next) { /* only one URB still active - resubmit one */ - if (submit_iso_write_urb(next) <= 0) { + rc = submit_iso_write_urb(next); + if (unlikely(rc <= 0 && rc != -ENODEV)) { /* couldn't submit */ error_hangup(bcs); } @@ -1222,10 +1253,9 @@ static void read_iso_tasklet(unsigned lo break; case -ENOENT: case -ECONNRESET: - gig_dbg(DEBUG_ISO, "%s: URB canceled", __func__); - continue; /* -> skip */ - case -EINPROGRESS: /* huh? */ - gig_dbg(DEBUG_ISO, "%s: URB still pending", __func__); + case -EINPROGRESS: + gig_dbg(DEBUG_ISO, "%s: %s", + __func__, get_usb_statmsg(urb->status)); continue; /* -> skip */ case -EPIPE: dev_err(cs->dev, "isochronous read stalled\n"); @@ -1290,13 +1320,11 @@ static void read_iso_tasklet(unsigned lo urb->dev = bcs->cs->hw.bas->udev; urb->transfer_flags = URB_ISO_ASAP; urb->number_of_packets = BAS_NUMFRAMES; - spin_lock_irqsave(&cs->lock, flags); - rc = cs->connected ? usb_submit_urb(urb, SLAB_ATOMIC) : -ENODEV; - spin_unlock_irqrestore(&cs->lock, flags); - if (rc) { + rc = usb_submit_urb(urb, SLAB_ATOMIC); + if (unlikely(rc != 0 && rc != -ENODEV)) { dev_err(cs->dev, "could not resubmit isochronous read URB: %s\n", - get_usb_statmsg(rc)); + get_usb_rcmsg(rc)); dump_urb(DEBUG_ISO, "resubmit iso read", urb); error_hangup(bcs); } @@ -1397,7 +1425,6 @@ static void write_ctrl_callback(struct u * timeout timeout in seconds (0: no timeout) * return value: * 0 on success - * -EINVAL if a NULL pointer is encountered somewhere * -EBUSY if another request is pending * any URB submission error code */ @@ -1418,12 +1445,6 @@ static int req_submit(struct bc_state *b req, ucs->pending); return -EBUSY; } - if (ucs->urb_ctrl->status == -EINPROGRESS) { - spin_unlock_irqrestore(&ucs->lock, flags); - dev_err(bcs->cs->dev, - "could not submit request 0x%02x: URB busy\n", req); - return -EBUSY; - } ucs->dr_ctrl.bRequestType = OUT_VENDOR_REQ; ucs->dr_ctrl.bRequest = req; @@ -1465,22 +1486,36 @@ static int req_submit(struct bc_state *b static int gigaset_init_bchannel(struct bc_state *bcs) { int req, ret; + unsigned long flags; + + spin_lock_irqsave(&bcs->cs->lock, flags); + if (unlikely(!bcs->cs->connected)) { + gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); + spin_unlock_irqrestore(&bcs->cs->lock, flags); + return -ENODEV; + } if ((ret = starturbs(bcs)) < 0) { dev_err(bcs->cs->dev, - "could not start isochronous I/O for channel %d\n", - bcs->channel + 1); - error_hangup(bcs); + "could not start isochronous I/O for channel B%d: %s\n", + bcs->channel + 1, + ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); + if (ret != -ENODEV) + error_hangup(bcs); + spin_unlock_irqrestore(&bcs->cs->lock, flags); return ret; } req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL; if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) { - dev_err(bcs->cs->dev, "could not open channel %d: %s\n", - bcs->channel + 1, get_usb_statmsg(ret)); + dev_err(bcs->cs->dev, "could not open channel B%d\n", + bcs->channel + 1); stopurbs(bcs->hw.bas); - error_hangup(bcs); + if (ret != -ENODEV) + error_hangup(bcs); } + + spin_unlock_irqrestore(&bcs->cs->lock, flags); return ret; } @@ -1497,19 +1532,30 @@ static int gigaset_init_bchannel(struct static int gigaset_close_bchannel(struct bc_state *bcs) { int req, ret; + unsigned long flags; + + spin_lock_irqsave(&bcs->cs->lock, flags); + if (unlikely(!bcs->cs->connected)) { + spin_unlock_irqrestore(&bcs->cs->lock, flags); + gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); + return -ENODEV; + } if (!(atomic_read(&bcs->cs->hw.bas->basstate) & (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) { /* channel not running: just signal common.c */ + spin_unlock_irqrestore(&bcs->cs->lock, flags); gigaset_bchannel_down(bcs); return 0; } + /* channel running: tell device to close it */ req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL; if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) - dev_err(bcs->cs->dev, - "could not submit HD_CLOSE_BxCHANNEL request: %s\n", - get_usb_statmsg(ret)); + dev_err(bcs->cs->dev, "closing channel B%d failed\n", + bcs->channel + 1); + + spin_unlock_irqrestore(&bcs->cs->lock, flags); return ret; } @@ -1545,8 +1591,6 @@ static void complete_cb(struct cardstate kfree(cb); } -static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len); - /* write_command_callback * USB completion handler for AT command transmission * called by the USB subsystem in interrupt context @@ -1560,13 +1604,17 @@ static void write_command_callback(struc struct bas_cardstate *ucs = cs->hw.bas; unsigned long flags; + update_basstate(ucs, 0, BS_ATWRPEND); + /* check status */ switch (urb->status) { case 0: /* normal completion */ break; - case -ENOENT: /* canceled */ - case -ECONNRESET: /* canceled (async) */ + case -ENOENT: /* cancelled */ + case -ECONNRESET: /* cancelled (async) */ case -EINPROGRESS: /* pending */ + case -ENODEV: /* device removed */ + case -ESHUTDOWN: /* device shut down */ /* ignore silently */ gig_dbg(DEBUG_USBREQ, "%s: %s", __func__, get_usb_statmsg(urb->status)); @@ -1627,19 +1675,17 @@ static void atrdy_timeout(unsigned long * len length of command to send * return value: * 0 on success - * -EFAULT if a NULL pointer is encountered somewhere * -EBUSY if another request is pending * any URB submission error code */ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) { struct bas_cardstate *ucs = cs->hw.bas; - unsigned long flags; - int ret; + int rc; gig_dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len); - if (ucs->urb_cmd_out->status == -EINPROGRESS) { + if (update_basstate(ucs, BS_ATWRPEND, 0) & BS_ATWRPEND) { dev_err(cs->dev, "could not submit HD_WRITE_ATMESSAGE: URB busy\n"); return -EBUSY; @@ -1654,29 +1700,22 @@ static int atwrite_submit(struct cardsta usb_sndctrlpipe(ucs->udev, 0), (unsigned char*) &ucs->dr_cmd_out, buf, len, write_command_callback, cs); - - spin_lock_irqsave(&cs->lock, flags); - ret = cs->connected ? usb_submit_urb(ucs->urb_cmd_out, SLAB_ATOMIC) : -ENODEV; - spin_unlock_irqrestore(&cs->lock, flags); - - if (ret) { + rc = usb_submit_urb(ucs->urb_cmd_out, SLAB_ATOMIC); + if (unlikely(rc)) { + update_basstate(ucs, 0, BS_ATWRPEND); dev_err(cs->dev, "could not submit HD_WRITE_ATMESSAGE: %s\n", - get_usb_statmsg(ret)); - return ret; + get_usb_rcmsg(rc)); + return rc; } - /* submitted successfully */ - update_basstate(ucs, 0, BS_ATREADY); - - /* start timeout if necessary */ - if (!(atomic_read(&ucs->basstate) & BS_ATTIMER)) { + /* submitted successfully, start timeout if necessary */ + if (!(update_basstate(ucs, BS_ATTIMER, BS_ATREADY) & BS_ATTIMER)) { gig_dbg(DEBUG_OUTPUT, "setting ATREADY timeout of %d/10 secs", ATRDY_TIMEOUT); ucs->timer_atrdy.expires = jiffies + ATRDY_TIMEOUT * HZ / 10; ucs->timer_atrdy.data = (unsigned long) cs; ucs->timer_atrdy.function = atrdy_timeout; add_timer(&ucs->timer_atrdy); - update_basstate(ucs, BS_ATTIMER, 0); } return 0; } @@ -1702,7 +1741,6 @@ static int start_cbsend(struct cardstate gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open"); rc = req_submit(cs->bcs, HD_OPEN_ATCHANNEL, 0, BAS_TIMEOUT); if (rc < 0) { - dev_err(cs->dev, "could not open AT channel\n"); /* flush command queue */ spin_lock_irqsave(&cs->cmdlock, flags); while (cs->cmdbuf != NULL) @@ -1786,8 +1824,14 @@ static int gigaset_write_cmd(struct card cs->lastcmdbuf = cb; spin_unlock_irqrestore(&cs->cmdlock, flags); + spin_lock_irqsave(&cs->lock, flags); + if (unlikely(!cs->connected)) { + spin_unlock_irqrestore(&cs->lock, flags); + gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); + return -ENODEV; + } status = start_cbsend(cs); - + spin_unlock_irqrestore(&cs->lock, flags); return status < 0 ? status : len; } @@ -1849,12 +1893,32 @@ static int gigaset_brkchars(struct cards */ static int gigaset_freebcshw(struct bc_state *bcs) { - if (!bcs->hw.bas) + struct bas_bc_state *ubc = bcs->hw.bas; + int i; + + if (!ubc) return 0; - if (bcs->hw.bas->isooutbuf) - kfree(bcs->hw.bas->isooutbuf); - kfree(bcs->hw.bas); + /* kill URBs and tasklets before freeing - better safe than sorry */ + atomic_set(&ubc->running, 0); + for (i = 0; i < BAS_OUTURBS; ++i) + if (ubc->isoouturbs[i].urb) { + gig_dbg(DEBUG_INIT, "%s: killing iso out URB %d", + __func__, i); + usb_kill_urb(ubc->isoouturbs[i].urb); + usb_free_urb(ubc->isoouturbs[i].urb); + } + for (i = 0; i < BAS_INURBS; ++i) + if (ubc->isoinurbs[i]) { + gig_dbg(DEBUG_INIT, "%s: killing iso in URB %d", + __func__, i); + usb_kill_urb(ubc->isoinurbs[i]); + usb_free_urb(ubc->isoinurbs[i]); + } + tasklet_kill(&ubc->sent_tasklet); + tasklet_kill(&ubc->rcvd_tasklet); + kfree(ubc->isooutbuf); + kfree(ubc); bcs->hw.bas = NULL; return 1; } @@ -1931,13 +1995,9 @@ static void gigaset_reinitbcshw(struct b static void gigaset_freecshw(struct cardstate *cs) { - struct bas_cardstate *ucs = cs->hw.bas; - - del_timer(&ucs->timer_ctrl); - del_timer(&ucs->timer_atrdy); - del_timer(&ucs->timer_cmd_in); - + /* timers, URBs and rcvbuf are disposed of in disconnect */ kfree(cs->hw.bas); + cs->hw.bas = NULL; } static int gigaset_initcshw(struct cardstate *cs) @@ -2041,23 +2101,13 @@ static int gigaset_probe(struct usb_inte struct bas_bc_state *ubc; struct usb_endpoint_descriptor *endpoint; int i, j; - int ret; + int rc; gig_dbg(DEBUG_ANY, "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", __func__, le16_to_cpu(udev->descriptor.idVendor), le16_to_cpu(udev->descriptor.idProduct)); - /* See if the device offered us matches what we can accept */ - if ((le16_to_cpu(udev->descriptor.idVendor) != USB_GIGA_VENDOR_ID) || - (le16_to_cpu(udev->descriptor.idProduct) != USB_GIGA_PRODUCT_ID && - le16_to_cpu(udev->descriptor.idProduct) != USB_4175_PRODUCT_ID && - le16_to_cpu(udev->descriptor.idProduct) != USB_SX303_PRODUCT_ID && - le16_to_cpu(udev->descriptor.idProduct) != USB_SX353_PRODUCT_ID)) { - gig_dbg(DEBUG_ANY, "%s: unmatched ID - exiting", __func__); - return -ENODEV; - } - /* set required alternate setting */ hostif = interface->cur_altsetting; if (hostif->desc.bAlternateSetting != 3) { @@ -2105,45 +2155,22 @@ static int gigaset_probe(struct usb_inte * - three for the different uses of the default control pipe * - three for each isochronous pipe */ - ucs->urb_int_in = usb_alloc_urb(0, SLAB_KERNEL); - if (!ucs->urb_int_in) { - dev_err(cs->dev, "no free urbs available\n"); - goto error; - } - ucs->urb_cmd_in = usb_alloc_urb(0, SLAB_KERNEL); - if (!ucs->urb_cmd_in) { - dev_err(cs->dev, "no free urbs available\n"); - goto error; - } - ucs->urb_cmd_out = usb_alloc_urb(0, SLAB_KERNEL); - if (!ucs->urb_cmd_out) { - dev_err(cs->dev, "no free urbs available\n"); - goto error; - } - ucs->urb_ctrl = usb_alloc_urb(0, SLAB_KERNEL); - if (!ucs->urb_ctrl) { - dev_err(cs->dev, "no free urbs available\n"); - goto error; - } + if (!(ucs->urb_int_in = usb_alloc_urb(0, SLAB_KERNEL)) || + !(ucs->urb_cmd_in = usb_alloc_urb(0, SLAB_KERNEL)) || + !(ucs->urb_cmd_out = usb_alloc_urb(0, SLAB_KERNEL)) || + !(ucs->urb_ctrl = usb_alloc_urb(0, SLAB_KERNEL))) + goto allocerr; for (j = 0; j < 2; ++j) { ubc = cs->bcs[j].hw.bas; - for (i = 0; i < BAS_OUTURBS; ++i) { - ubc->isoouturbs[i].urb = - usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL); - if (!ubc->isoouturbs[i].urb) { - dev_err(cs->dev, "no free urbs available\n"); - goto error; - } - } - for (i = 0; i < BAS_INURBS; ++i) { - ubc->isoinurbs[i] = - usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL); - if (!ubc->isoinurbs[i]) { - dev_err(cs->dev, "no free urbs available\n"); - goto error; - } - } + for (i = 0; i < BAS_OUTURBS; ++i) + if (!(ubc->isoouturbs[i].urb = + usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL))) + goto allocerr; + for (i = 0; i < BAS_INURBS; ++i) + if (!(ubc->isoinurbs[i] = + usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL))) + goto allocerr; } ucs->rcvbuf = NULL; @@ -2156,15 +2183,14 @@ static int gigaset_probe(struct usb_inte (endpoint->bEndpointAddress) & 0x0f), ucs->int_in_buf, 3, read_int_callback, cs, endpoint->bInterval); - ret = usb_submit_urb(ucs->urb_int_in, SLAB_KERNEL); - if (ret) { + if ((rc = usb_submit_urb(ucs->urb_int_in, SLAB_KERNEL)) != 0) { dev_err(cs->dev, "could not submit interrupt URB: %s\n", - get_usb_statmsg(ret)); + get_usb_rcmsg(rc)); goto error; } /* tell the device that the driver is ready */ - if ((ret = req_submit(cs->bcs, HD_DEVICE_INIT_ACK, 0, 0)) != 0) + if ((rc = req_submit(cs->bcs, HD_DEVICE_INIT_ACK, 0, 0)) != 0) goto error; /* tell common part that the device is ready */ @@ -2179,6 +2205,8 @@ static int gigaset_probe(struct usb_inte return 0; +allocerr: + dev_err(cs->dev, "could not allocate URBs\n"); error: freeurbs(cs); usb_set_intfdata(interface, NULL); @@ -2193,19 +2221,34 @@ static void gigaset_disconnect(struct us { struct cardstate *cs; struct bas_cardstate *ucs; + int j; cs = usb_get_intfdata(interface); ucs = cs->hw.bas; dev_info(cs->dev, "disconnecting Gigaset base\n"); + + /* mark base as not ready, all channels disconnected */ + atomic_set(&ucs->basstate, 0); + + /* tell LL all channels are down */ + //FIXME shouldn't gigaset_stop() do this? + for (j = 0; j < 2; ++j) + gigaset_bchannel_down(cs->bcs + j); + + /* stop driver (common part) */ gigaset_stop(cs); + + /* stop timers and URBs, free ressources */ + del_timer_sync(&ucs->timer_ctrl); + del_timer_sync(&ucs->timer_atrdy); + del_timer_sync(&ucs->timer_cmd_in); freeurbs(cs); usb_set_intfdata(interface, NULL); kfree(ucs->rcvbuf); ucs->rcvbuf = NULL; ucs->rcvbuf_size = 0; - atomic_set(&ucs->basstate, 0); usb_put_dev(ucs->udev); ucs->interface = NULL; ucs->udev = NULL; @@ -2277,6 +2320,8 @@ error: if (cardstate) */ static void __exit bas_gigaset_exit(void) { + struct bas_cardstate *ucs = cardstate->hw.bas; + gigaset_blockdriver(driver); /* => probe will fail * => no gigaset_start any more */ @@ -2284,14 +2329,26 @@ static void __exit bas_gigaset_exit(void gigaset_shutdown(cardstate); /* from now on, no isdn callback should be possible */ - if (atomic_read(&cardstate->hw.bas->basstate) & BS_ATOPEN) { - gig_dbg(DEBUG_ANY, "closing AT channel"); - if (req_submit(cardstate->bcs, - HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT) >= 0) { - /* successfully submitted */ - //FIXME wait for completion? - } + /* close all still open channels */ + if (atomic_read(&ucs->basstate) & BS_B1OPEN) { + gig_dbg(DEBUG_INIT, "closing B1 channel"); + usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0), + HD_CLOSE_B1CHANNEL, OUT_VENDOR_REQ, 0, 0, + NULL, 0, BAS_TIMEOUT); + } + if (atomic_read(&ucs->basstate) & BS_B2OPEN) { + gig_dbg(DEBUG_INIT, "closing B2 channel"); + usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0), + HD_CLOSE_B2CHANNEL, OUT_VENDOR_REQ, 0, 0, + NULL, 0, BAS_TIMEOUT); + } + if (atomic_read(&ucs->basstate) & BS_ATOPEN) { + gig_dbg(DEBUG_INIT, "closing AT channel"); + usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0), + HD_CLOSE_ATCHANNEL, OUT_VENDOR_REQ, 0, 0, + NULL, 0, BAS_TIMEOUT); } + atomic_set(&ucs->basstate, 0); /* deregister this driver with the USB subsystem */ usb_deregister(&gigaset_usb_driver); diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index 749b3da..e55767b 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c @@ -781,8 +781,7 @@ error: if (cs) } EXPORT_SYMBOL_GPL(gigaset_initcs); -/* ReInitialize the b-channel structure */ -/* e.g. called on hangup, disconnect */ +/* ReInitialize the b-channel structure on hangup */ void gigaset_bcs_reinit(struct bc_state *bcs) { struct sk_buff *skb; diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c index 1ba3424..18e05c0 100644 --- a/drivers/isdn/gigaset/ev-layer.c +++ b/drivers/isdn/gigaset/ev-layer.c @@ -373,6 +373,9 @@ struct reply_t gigaset_tab_cid_m10x[] = {EV_TIMEOUT, 750,750, -1, 0, 0, {ACT_CONNTIMEOUT}}, + /* B channel closed (general case) */ + {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME + /* misc. */ {EV_PROTO_L2, -1, -1, -1, -1,-1, {ACT_PROTO_L2}}, //FIXME diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index 9d21ba8..22b9693 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h @@ -75,7 +75,7 @@ extern int gigaset_debuglevel; /* "needs * e.g. 'insmod usb_gigaset.o debug=0x2c' will set DEBUG_OPEN, DEBUG_CMD and * DEBUG_INTR. */ -enum debuglevel { /* up to 24 bits (atomic_t) */ +enum debuglevel { DEBUG_REG = 0x0002, /* serial port I/O register operations */ DEBUG_OPEN = 0x0004, /* open/close serial port */ DEBUG_INTR = 0x0008, /* interrupt processing */ @@ -141,7 +141,7 @@ enum debuglevel { /* up to 24 bits (atom printk(KERN_DEBUG KBUILD_MODNAME ": " format "\n", \ ## arg); \ } while (0) -#define DEBUG_DEFAULT (DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ) +#define DEBUG_DEFAULT (DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ) #else @@ -627,8 +627,7 @@ struct gigaset_ops { /* Called by gigaset_freecs() for freeing bcs->hw.xxx */ int (*freebcshw)(struct bc_state *bcs); - /* Called by gigaset_stop() or gigaset_bchannel_down() for resetting - bcs->hw.xxx */ + /* Called by gigaset_bchannel_down() for resetting bcs->hw.xxx */ void (*reinitbcshw)(struct bc_state *bcs); /* Called by gigaset_initcs() for setting up cs->hw.xxx */ diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c index 0815dbf..1654fa4 100644 --- a/drivers/isdn/gigaset/i4l.c +++ b/drivers/isdn/gigaset/i4l.c @@ -73,7 +73,7 @@ static int writebuf_from_LL(int driverID len, skblen, (unsigned) skb->head[0], (unsigned) skb->head[1]); /* pass to device-specific module */ - return cs->ops->send_skb(bcs, skb); //FIXME cs->ops->send_skb() must handle !cs->connected correctly + return cs->ops->send_skb(bcs, skb); } void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb) diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index 45f017e..8667daa 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c @@ -992,14 +992,18 @@ int gigaset_isoc_send_skb(struct bc_stat int len = skb->len; unsigned long flags; + spin_lock_irqsave(&bcs->cs->lock, flags); + if (!bcs->cs->connected) { + spin_unlock_irqrestore(&bcs->cs->lock, flags); + return -ENODEV; + } + skb_queue_tail(&bcs->squeue, skb); gig_dbg(DEBUG_ISO, "%s: skb queued, qlen=%d", __func__, skb_queue_len(&bcs->squeue)); /* tasklet submits URB if necessary */ - spin_lock_irqsave(&bcs->cs->lock, flags); - if (bcs->cs->connected) - tasklet_schedule(&bcs->hw.bas->sent_tasklet); + tasklet_schedule(&bcs->hw.bas->sent_tasklet); spin_unlock_irqrestore(&bcs->cs->lock, flags); return len; /* ok so far */ diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 5ebfd1d..5282fec 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c @@ -627,8 +627,8 @@ thermostat_init(void) if(therm_type == ADT7460) device_create_file(&of_dev->dev, &dev_attr_sensor2_fan_speed); -#ifndef CONFIG_I2C_KEYWEST - request_module("i2c-keywest"); +#ifndef CONFIG_I2C_POWERMAC + request_module("i2c-powermac"); #endif return i2c_add_driver(&thermostat_driver); diff --git a/drivers/md/md.c b/drivers/md/md.c index 434ca39..d7316b8 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -279,11 +279,6 @@ static inline int mddev_lock(mddev_t * m return mutex_lock_interruptible(&mddev->reconfig_mutex); } -static inline void mddev_lock_uninterruptible(mddev_t * mddev) -{ - mutex_lock(&mddev->reconfig_mutex); -} - static inline int mddev_trylock(mddev_t * mddev) { return mutex_trylock(&mddev->reconfig_mutex); @@ -2458,9 +2453,11 @@ md_attr_show(struct kobject *kobj, struc if (!entry->show) return -EIO; - mddev_lock(mddev); - rv = entry->show(mddev, page); - mddev_unlock(mddev); + rv = mddev_lock(mddev); + if (!rv) { + rv = entry->show(mddev, page); + mddev_unlock(mddev); + } return rv; } @@ -2474,9 +2471,11 @@ md_attr_store(struct kobject *kobj, stru if (!entry->store) return -EIO; - mddev_lock(mddev); - rv = entry->store(mddev, page, length); - mddev_unlock(mddev); + rv = mddev_lock(mddev); + if (!rv) { + rv = entry->store(mddev, page, length); + mddev_unlock(mddev); + } return rv; } @@ -4341,8 +4340,9 @@ static int md_seq_show(struct seq_file * return 0; } - if (mddev_lock(mddev)!=0) + if (mddev_lock(mddev) < 0) return -EINTR; + if (mddev->pers || mddev->raid_disks || !list_empty(&mddev->disks)) { seq_printf(seq, "%s : %sactive", mdname(mddev), mddev->pers ? "" : "in"); diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index add8dc4..c99e878 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -3768,6 +3768,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapt ps_page->ps_page[j] = NULL; skb->len += length; skb->data_len += length; + skb->truesize += length; } copydone: diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 7627a75..9788b1e 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c @@ -105,6 +105,7 @@ * 0.50: 20 Jan 2006: Add 8021pq tagging support. * 0.51: 20 Jan 2006: Add 64bit consistent memory allocation for rings. * 0.52: 20 Jan 2006: Add MSI/MSIX support. + * 0.53: 19 Mar 2006: Fix init from low power mode and add hw reset. * * Known bugs: * We suspect that on some hardware no TX done interrupts are generated. @@ -116,7 +117,7 @@ * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few * superfluous timer interrupts from the nic. */ -#define FORCEDETH_VERSION "0.52" +#define FORCEDETH_VERSION "0.53" #define DRV_NAME "forcedeth" #include @@ -160,6 +161,7 @@ #define DEV_HAS_VLAN 0x0020 /* device supports vlan tagging and striping */ #define DEV_HAS_MSI 0x0040 /* device supports MSI */ #define DEV_HAS_MSI_X 0x0080 /* device supports MSI-X */ +#define DEV_HAS_POWER_CNTRL 0x0100 /* device supports power savings */ enum { NvRegIrqStatus = 0x000, @@ -203,6 +205,8 @@ enum { #define NVREG_MISC1_HD 0x02 #define NVREG_MISC1_FORCE 0x3b0f3c + NvRegMacReset = 0x3c, +#define NVREG_MAC_RESET_ASSERT 0x0F3 NvRegTransmitterControl = 0x084, #define NVREG_XMITCTL_START 0x01 NvRegTransmitterStatus = 0x088, @@ -326,6 +330,10 @@ enum { NvRegMSIXMap0 = 0x3e0, NvRegMSIXMap1 = 0x3e4, NvRegMSIXIrqStatus = 0x3f0, + + NvRegPowerState2 = 0x600, +#define NVREG_POWERSTATE2_POWERUP_MASK 0x0F11 +#define NVREG_POWERSTATE2_POWERUP_REV_A3 0x0001 }; /* Big endian: should work, but is untested */ @@ -414,7 +422,8 @@ typedef union _ring_type { #define NV_RX3_VLAN_TAG_MASK (0x0000FFFF) /* Miscelaneous hardware related defines: */ -#define NV_PCI_REGSZ 0x270 +#define NV_PCI_REGSZ_VER1 0x270 +#define NV_PCI_REGSZ_VER2 0x604 /* various timeout delays: all in usec */ #define NV_TXRX_RESET_DELAY 4 @@ -431,6 +440,7 @@ typedef union _ring_type { #define NV_MIIBUSY_DELAY 50 #define NV_MIIPHY_DELAY 10 #define NV_MIIPHY_DELAYMAX 10000 +#define NV_MAC_RESET_DELAY 64 #define NV_WAKEUPPATTERNS 5 #define NV_WAKEUPMASKENTRIES 4 @@ -552,6 +562,8 @@ struct fe_priv { u32 desc_ver; u32 txrxctl_bits; u32 vlanctl_bits; + u32 driver_data; + u32 register_size; void __iomem *base; @@ -919,6 +931,24 @@ static void nv_txrx_reset(struct net_dev pci_push(base); } +static void nv_mac_reset(struct net_device *dev) +{ + struct fe_priv *np = netdev_priv(dev); + u8 __iomem *base = get_hwbase(dev); + + dprintk(KERN_DEBUG "%s: nv_mac_reset\n", dev->name); + writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET | np->txrxctl_bits, base + NvRegTxRxControl); + pci_push(base); + writel(NVREG_MAC_RESET_ASSERT, base + NvRegMacReset); + pci_push(base); + udelay(NV_MAC_RESET_DELAY); + writel(0, base + NvRegMacReset); + pci_push(base); + udelay(NV_MAC_RESET_DELAY); + writel(NVREG_TXRXCTL_BIT2 | np->txrxctl_bits, base + NvRegTxRxControl); + pci_push(base); +} + /* * nv_get_stats: dev->get_stats function * Get latest stats value from the nic. @@ -1331,7 +1361,7 @@ static void nv_tx_timeout(struct net_dev dev->name, (unsigned long)np->ring_addr, np->next_tx, np->nic_tx); printk(KERN_INFO "%s: Dumping tx registers\n", dev->name); - for (i=0;i<0x400;i+= 32) { + for (i=0;i<=np->register_size;i+= 32) { printk(KERN_INFO "%3x: %08x %08x %08x %08x %08x %08x %08x %08x\n", i, readl(base + i + 0), readl(base + i + 4), @@ -2488,11 +2518,11 @@ static int nv_set_settings(struct net_de } #define FORCEDETH_REGS_VER 1 -#define FORCEDETH_REGS_SIZE 0x400 /* 256 32-bit registers */ static int nv_get_regs_len(struct net_device *dev) { - return FORCEDETH_REGS_SIZE; + struct fe_priv *np = netdev_priv(dev); + return np->register_size; } static void nv_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *buf) @@ -2504,7 +2534,7 @@ static void nv_get_regs(struct net_devic regs->version = FORCEDETH_REGS_VER; spin_lock_irq(&np->lock); - for (i=0;iregister_size/sizeof(u32); i++) rbuf[i] = readl(base + i*sizeof(u32)); spin_unlock_irq(&np->lock); } @@ -2608,6 +2638,8 @@ static int nv_open(struct net_device *de dprintk(KERN_DEBUG "nv_open: begin\n"); /* 1) erase previous misconfiguration */ + if (np->driver_data & DEV_HAS_POWER_CNTRL) + nv_mac_reset(dev); /* 4.1-1: stop adapter: ignored, 4.3 seems to be overkill */ writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); writel(0, base + NvRegMulticastAddrB); @@ -2878,6 +2910,7 @@ static int __devinit nv_probe(struct pci unsigned long addr; u8 __iomem *base; int err, i; + u32 powerstate; dev = alloc_etherdev(sizeof(struct fe_priv)); err = -ENOMEM; @@ -2910,6 +2943,11 @@ static int __devinit nv_probe(struct pci if (err < 0) goto out_disable; + if (id->driver_data & (DEV_HAS_VLAN|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL)) + np->register_size = NV_PCI_REGSZ_VER2; + else + np->register_size = NV_PCI_REGSZ_VER1; + err = -EINVAL; addr = 0; for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { @@ -2918,7 +2956,7 @@ static int __devinit nv_probe(struct pci pci_resource_len(pci_dev, i), pci_resource_flags(pci_dev, i)); if (pci_resource_flags(pci_dev, i) & IORESOURCE_MEM && - pci_resource_len(pci_dev, i) >= NV_PCI_REGSZ) { + pci_resource_len(pci_dev, i) >= np->register_size) { addr = pci_resource_start(pci_dev, i); break; } @@ -2929,6 +2967,9 @@ static int __devinit nv_probe(struct pci goto out_relreg; } + /* copy of driver data */ + np->driver_data = id->driver_data; + /* handle different descriptor versions */ if (id->driver_data & DEV_HAS_HIGH_DMA) { /* packet format 3: supports 40-bit addressing */ @@ -2986,7 +3027,7 @@ static int __devinit nv_probe(struct pci } err = -ENOMEM; - np->base = ioremap(addr, NV_PCI_REGSZ); + np->base = ioremap(addr, np->register_size); if (!np->base) goto out_relreg; dev->base_addr = (unsigned long)np->base; @@ -3062,6 +3103,20 @@ static int __devinit nv_probe(struct pci writel(0, base + NvRegWakeUpFlags); np->wolenabled = 0; + if (id->driver_data & DEV_HAS_POWER_CNTRL) { + u8 revision_id; + pci_read_config_byte(pci_dev, PCI_REVISION_ID, &revision_id); + + /* take phy and nic out of low power mode */ + powerstate = readl(base + NvRegPowerState2); + powerstate &= ~NVREG_POWERSTATE2_POWERUP_MASK; + if ((id->device == PCI_DEVICE_ID_NVIDIA_NVENET_12 || + id->device == PCI_DEVICE_ID_NVIDIA_NVENET_13) && + revision_id >= 0xA3) + powerstate |= NVREG_POWERSTATE2_POWERUP_REV_A3; + writel(powerstate, base + NvRegPowerState2); + } + if (np->desc_ver == DESC_VER_1) { np->tx_flags = NV_TX_VALID; } else { @@ -3223,19 +3278,19 @@ static struct pci_device_id pci_tbl[] = }, { /* MCP51 Ethernet Controller */ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), - .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA, + .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL, }, { /* MCP51 Ethernet Controller */ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_13), - .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA, + .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL, }, { /* MCP55 Ethernet Controller */ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), - .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X, + .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL, }, { /* MCP55 Ethernet Controller */ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), - .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X, + .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL, }, {0,}, }; diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 771e25d..218d317 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -210,7 +210,8 @@ static int gfar_probe(struct platform_de goto regs_fail; } - spin_lock_init(&priv->lock); + spin_lock_init(&priv->txlock); + spin_lock_init(&priv->rxlock); platform_set_drvdata(pdev, dev); @@ -515,11 +516,13 @@ void stop_gfar(struct net_device *dev) phy_stop(priv->phydev); /* Lock it down */ - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->txlock, flags); + spin_lock(&priv->rxlock); gfar_halt(dev); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock(&priv->rxlock); + spin_unlock_irqrestore(&priv->txlock, flags); /* Free the IRQs */ if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) { @@ -605,14 +608,15 @@ void gfar_start(struct net_device *dev) tempval |= DMACTRL_INIT_SETTINGS; gfar_write(&priv->regs->dmactrl, tempval); - /* Clear THLT, so that the DMA starts polling now */ - gfar_write(®s->tstat, TSTAT_CLEAR_THALT); - /* Make sure we aren't stopped */ tempval = gfar_read(&priv->regs->dmactrl); tempval &= ~(DMACTRL_GRS | DMACTRL_GTS); gfar_write(&priv->regs->dmactrl, tempval); + /* Clear THLT/RHLT, so that the DMA starts polling now */ + gfar_write(®s->tstat, TSTAT_CLEAR_THALT); + gfar_write(®s->rstat, RSTAT_CLEAR_RHALT); + /* Unmask the interrupts we look for */ gfar_write(®s->imask, IMASK_DEFAULT); } @@ -928,12 +932,13 @@ static int gfar_start_xmit(struct sk_buf struct txfcb *fcb = NULL; struct txbd8 *txbdp; u16 status; + unsigned long flags; /* Update transmit stats */ priv->stats.tx_bytes += skb->len; /* Lock priv now */ - spin_lock_irq(&priv->lock); + spin_lock_irqsave(&priv->txlock, flags); /* Point at the first free tx descriptor */ txbdp = priv->cur_tx; @@ -1004,7 +1009,7 @@ static int gfar_start_xmit(struct sk_buf gfar_write(&priv->regs->tstat, TSTAT_CLEAR_THALT); /* Unlock priv */ - spin_unlock_irq(&priv->lock); + spin_unlock_irqrestore(&priv->txlock, flags); return 0; } @@ -1049,7 +1054,7 @@ static void gfar_vlan_rx_register(struct unsigned long flags; u32 tempval; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->rxlock, flags); priv->vlgrp = grp; @@ -1076,7 +1081,7 @@ static void gfar_vlan_rx_register(struct gfar_write(&priv->regs->rctrl, tempval); } - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&priv->rxlock, flags); } @@ -1085,12 +1090,12 @@ static void gfar_vlan_rx_kill_vid(struct struct gfar_private *priv = netdev_priv(dev); unsigned long flags; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->rxlock, flags); if (priv->vlgrp) priv->vlgrp->vlan_devices[vid] = NULL; - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&priv->rxlock, flags); } @@ -1179,7 +1184,7 @@ static irqreturn_t gfar_transmit(int irq gfar_write(&priv->regs->ievent, IEVENT_TX_MASK); /* Lock priv */ - spin_lock(&priv->lock); + spin_lock(&priv->txlock); bdp = priv->dirty_tx; while ((bdp->status & TXBD_READY) == 0) { /* If dirty_tx and cur_tx are the same, then either the */ @@ -1224,7 +1229,7 @@ static irqreturn_t gfar_transmit(int irq else gfar_write(&priv->regs->txic, 0); - spin_unlock(&priv->lock); + spin_unlock(&priv->txlock); return IRQ_HANDLED; } @@ -1305,9 +1310,10 @@ irqreturn_t gfar_receive(int irq, void * { struct net_device *dev = (struct net_device *) dev_id; struct gfar_private *priv = netdev_priv(dev); - #ifdef CONFIG_GFAR_NAPI u32 tempval; +#else + unsigned long flags; #endif /* Clear IEVENT, so rx interrupt isn't called again @@ -1330,7 +1336,7 @@ irqreturn_t gfar_receive(int irq, void * } #else - spin_lock(&priv->lock); + spin_lock_irqsave(&priv->rxlock, flags); gfar_clean_rx_ring(dev, priv->rx_ring_size); /* If we are coalescing interrupts, update the timer */ @@ -1341,7 +1347,7 @@ irqreturn_t gfar_receive(int irq, void * else gfar_write(&priv->regs->rxic, 0); - spin_unlock(&priv->lock); + spin_unlock_irqrestore(&priv->rxlock, flags); #endif return IRQ_HANDLED; @@ -1490,13 +1496,6 @@ int gfar_clean_rx_ring(struct net_device /* Update the current rxbd pointer to be the next one */ priv->cur_rx = bdp; - /* If no packets have arrived since the - * last one we processed, clear the IEVENT RX and - * BSY bits so that another interrupt won't be - * generated when we set IMASK */ - if (bdp->status & RXBD_EMPTY) - gfar_write(&priv->regs->ievent, IEVENT_RX_MASK); - return howmany; } @@ -1516,7 +1515,7 @@ static int gfar_poll(struct net_device * rx_work_limit -= howmany; *budget -= howmany; - if (rx_work_limit >= 0) { + if (rx_work_limit > 0) { netif_rx_complete(dev); /* Clear the halt bit in RSTAT */ @@ -1533,7 +1532,8 @@ static int gfar_poll(struct net_device * gfar_write(&priv->regs->rxic, 0); } - return (rx_work_limit < 0) ? 1 : 0; + /* Return 1 if there's more work to do */ + return (rx_work_limit > 0) ? 0 : 1; } #endif @@ -1629,7 +1629,7 @@ static void adjust_link(struct net_devic struct phy_device *phydev = priv->phydev; int new_state = 0; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->txlock, flags); if (phydev->link) { u32 tempval = gfar_read(®s->maccfg2); u32 ecntrl = gfar_read(®s->ecntrl); @@ -1694,7 +1694,7 @@ static void adjust_link(struct net_devic if (new_state && netif_msg_link(priv)) phy_print_status(phydev); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&priv->txlock, flags); } /* Update the hash table based on the current list of multicast diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index d37d540..127c98c 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h @@ -656,43 +656,62 @@ struct gfar { * the buffer descriptor determines the actual condition. */ struct gfar_private { - /* pointers to arrays of skbuffs for tx and rx */ + /* Fields controlled by TX lock */ + spinlock_t txlock; + + /* Pointer to the array of skbuffs */ struct sk_buff ** tx_skbuff; - struct sk_buff ** rx_skbuff; - /* indices pointing to the next free sbk in skb arrays */ + /* next free skb in the array */ u16 skb_curtx; - u16 skb_currx; - /* index of the first skb which hasn't been transmitted - * yet. */ + /* First skb in line to be transmitted */ u16 skb_dirtytx; /* Configuration info for the coalescing features */ unsigned char txcoalescing; unsigned short txcount; unsigned short txtime; + + /* Buffer descriptor pointers */ + struct txbd8 *tx_bd_base; /* First tx buffer descriptor */ + struct txbd8 *cur_tx; /* Next free ring entry */ + struct txbd8 *dirty_tx; /* First buffer in line + to be transmitted */ + unsigned int tx_ring_size; + + /* RX Locked fields */ + spinlock_t rxlock; + + /* skb array and index */ + struct sk_buff ** rx_skbuff; + u16 skb_currx; + + /* RX Coalescing values */ unsigned char rxcoalescing; unsigned short rxcount; unsigned short rxtime; - /* GFAR addresses */ - struct rxbd8 *rx_bd_base; /* Base addresses of Rx and Tx Buffers */ - struct txbd8 *tx_bd_base; + struct rxbd8 *rx_bd_base; /* First Rx buffers */ struct rxbd8 *cur_rx; /* Next free rx ring entry */ - struct txbd8 *cur_tx; /* Next free ring entry */ - struct txbd8 *dirty_tx; /* The Ring entry to be freed. */ - struct gfar __iomem *regs; /* Pointer to the GFAR memory mapped Registers */ - u32 __iomem *hash_regs[16]; - int hash_width; - struct net_device_stats stats; /* linux network statistics */ - struct gfar_extra_stats extra_stats; - spinlock_t lock; + + /* RX parameters */ + unsigned int rx_ring_size; unsigned int rx_buffer_size; unsigned int rx_stash_size; unsigned int rx_stash_index; - unsigned int tx_ring_size; - unsigned int rx_ring_size; + + struct vlan_group *vlgrp; + + /* Unprotected fields */ + /* Pointer to the GFAR memory mapped Registers */ + struct gfar __iomem *regs; + + /* Hash registers and their width */ + u32 __iomem *hash_regs[16]; + int hash_width; + + /* global parameters */ unsigned int fifo_threshold; unsigned int fifo_starve; unsigned int fifo_starve_off; @@ -702,13 +721,15 @@ struct gfar_private { extended_hash:1, bd_stash_en:1; unsigned short padding; - struct vlan_group *vlgrp; - /* Info structure initialized by board setup code */ + unsigned int interruptTransmit; unsigned int interruptReceive; unsigned int interruptError; + + /* info structure initialized by platform code */ struct gianfar_platform_data *einfo; + /* PHY stuff */ struct phy_device *phydev; struct mii_bus *mii_bus; int oldspeed; @@ -716,6 +737,10 @@ struct gfar_private { int oldlink; uint32_t msg_enable; + + /* Network Statistics */ + struct net_device_stats stats; + struct gfar_extra_stats extra_stats; }; static inline u32 gfar_read(volatile unsigned __iomem *addr) diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index 5de7b2e..d69698c 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c @@ -455,10 +455,14 @@ static int gfar_sringparam(struct net_de /* Halt TX and RX, and process the frames which * have already been received */ - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->txlock, flags); + spin_lock(&priv->rxlock); + gfar_halt(dev); gfar_clean_rx_ring(dev, priv->rx_ring_size); - spin_unlock_irqrestore(&priv->lock, flags); + + spin_unlock(&priv->rxlock); + spin_unlock_irqrestore(&priv->txlock, flags); /* Now we take down the rings to rebuild them */ stop_gfar(dev); @@ -488,10 +492,14 @@ static int gfar_set_rx_csum(struct net_d /* Halt TX and RX, and process the frames which * have already been received */ - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->txlock, flags); + spin_lock(&priv->rxlock); + gfar_halt(dev); gfar_clean_rx_ring(dev, priv->rx_ring_size); - spin_unlock_irqrestore(&priv->lock, flags); + + spin_unlock(&priv->rxlock); + spin_unlock_irqrestore(&priv->txlock, flags); /* Now we take down the rings to rebuild them */ stop_gfar(dev); @@ -523,7 +531,7 @@ static int gfar_set_tx_csum(struct net_d if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_CSUM)) return -EOPNOTSUPP; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->txlock, flags); gfar_halt(dev); if (data) @@ -532,7 +540,7 @@ static int gfar_set_tx_csum(struct net_d dev->features &= ~NETIF_F_IP_CSUM; gfar_start(dev); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&priv->txlock, flags); return 0; } diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c index 51ef181..a6d5c43 100644 --- a/drivers/net/gianfar_sysfs.c +++ b/drivers/net/gianfar_sysfs.c @@ -82,7 +82,7 @@ static ssize_t gfar_set_bd_stash(struct else return count; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->rxlock, flags); /* Set the new stashing value */ priv->bd_stash_en = new_setting; @@ -96,7 +96,7 @@ static ssize_t gfar_set_bd_stash(struct gfar_write(&priv->regs->attr, temp); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&priv->rxlock, flags); return count; } @@ -118,7 +118,7 @@ static ssize_t gfar_set_rx_stash_size(st u32 temp; unsigned long flags; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->rxlock, flags); if (length > priv->rx_buffer_size) return count; @@ -142,7 +142,7 @@ static ssize_t gfar_set_rx_stash_size(st gfar_write(&priv->regs->attr, temp); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&priv->rxlock, flags); return count; } @@ -166,7 +166,7 @@ static ssize_t gfar_set_rx_stash_index(s u32 temp; unsigned long flags; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->rxlock, flags); if (index > priv->rx_stash_size) return count; @@ -180,7 +180,7 @@ static ssize_t gfar_set_rx_stash_index(s temp |= ATTRELI_EI(index); gfar_write(&priv->regs->attreli, flags); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&priv->rxlock, flags); return count; } @@ -205,7 +205,7 @@ static ssize_t gfar_set_fifo_threshold(s if (length > GFAR_MAX_FIFO_THRESHOLD) return count; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->txlock, flags); priv->fifo_threshold = length; @@ -214,7 +214,7 @@ static ssize_t gfar_set_fifo_threshold(s temp |= length; gfar_write(&priv->regs->fifo_tx_thr, temp); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&priv->txlock, flags); return count; } @@ -240,7 +240,7 @@ static ssize_t gfar_set_fifo_starve(stru if (num > GFAR_MAX_FIFO_STARVE) return count; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->txlock, flags); priv->fifo_starve = num; @@ -249,7 +249,7 @@ static ssize_t gfar_set_fifo_starve(stru temp |= num; gfar_write(&priv->regs->fifo_tx_starve, temp); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&priv->txlock, flags); return count; } @@ -274,7 +274,7 @@ static ssize_t gfar_set_fifo_starve_off( if (num > GFAR_MAX_FIFO_STARVE_OFF) return count; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&priv->txlock, flags); priv->fifo_starve_off = num; @@ -283,7 +283,7 @@ static ssize_t gfar_set_fifo_starve_off( temp |= num; gfar_write(&priv->regs->fifo_tx_starve_shutoff, temp); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&priv->txlock, flags); return count; } diff --git a/drivers/net/ne.c b/drivers/net/ne.c index 08b218c..93c494b 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c @@ -226,7 +226,7 @@ struct net_device * __init ne_probe(int netdev_boot_setup_check(dev); #ifdef CONFIG_TOSHIBA_RBTX4938 - dev->base_addr = 0x07f20280; + dev->base_addr = RBTX4938_RTL_8019_BASE; dev->irq = RBTX4938_RTL_8019_IRQ; #endif err = do_ne_probe(dev); diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 506e777..d090df4 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -1639,6 +1639,7 @@ static struct pcmcia_device_id pcnet_ids PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2), PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd), + PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d), PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa), PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9), diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 67b0eab..227df98 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -51,7 +51,7 @@ #include "sky2.h" #define DRV_NAME "sky2" -#define DRV_VERSION "1.1" +#define DRV_VERSION "1.2" #define PFX DRV_NAME " " /* @@ -925,8 +925,7 @@ static inline struct sk_buff *sky2_alloc skb = alloc_skb(size + RX_SKB_ALIGN, gfp_mask); if (likely(skb)) { unsigned long p = (unsigned long) skb->data; - skb_reserve(skb, - ((p + RX_SKB_ALIGN - 1) & ~(RX_SKB_ALIGN - 1)) - p); + skb_reserve(skb, ALIGN(p, RX_SKB_ALIGN) - p); } return skb; @@ -1686,13 +1685,12 @@ static void sky2_tx_timeout(struct net_d } -#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* Want receive buffer size to be multiple of 64 bits * and incl room for vlan and truncation */ static inline unsigned sky2_buf_size(int mtu) { - return roundup(mtu + ETH_HLEN + VLAN_HLEN, 8) + 8; + return ALIGN(mtu + ETH_HLEN + VLAN_HLEN, 8) + 8; } static int sky2_change_mtu(struct net_device *dev, int new_mtu) @@ -2086,6 +2084,20 @@ static void sky2_descriptor_error(struct } } +/* If idle then force a fake soft NAPI poll once a second + * to work around cases where sharing an edge triggered interrupt. + */ +static void sky2_idle(unsigned long arg) +{ + struct net_device *dev = (struct net_device *) arg; + + local_irq_disable(); + if (__netif_rx_schedule_prep(dev)) + __netif_rx_schedule(dev); + local_irq_enable(); +} + + static int sky2_poll(struct net_device *dev0, int *budget) { struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw; @@ -2093,6 +2105,7 @@ static int sky2_poll(struct net_device * int work_done = 0; u32 status = sky2_read32(hw, B0_Y2_SP_EISR); + restart_poll: if (unlikely(status & ~Y2_IS_STAT_BMU)) { if (status & Y2_IS_HW_ERR) sky2_hw_intr(hw); @@ -2123,7 +2136,7 @@ static int sky2_poll(struct net_device * } if (status & Y2_IS_STAT_BMU) { - work_done = sky2_status_intr(hw, work_limit); + work_done += sky2_status_intr(hw, work_limit - work_done); *budget -= work_done; dev0->quota -= work_done; @@ -2133,9 +2146,24 @@ static int sky2_poll(struct net_device * sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); } - netif_rx_complete(dev0); + mod_timer(&hw->idle_timer, jiffies + HZ); + + local_irq_disable(); + __netif_rx_complete(dev0); status = sky2_read32(hw, B0_Y2_SP_LISR); + + if (unlikely(status)) { + /* More work pending, try and keep going */ + if (__netif_rx_schedule_prep(dev0)) { + __netif_rx_reschedule(dev0, work_done); + status = sky2_read32(hw, B0_Y2_SP_EISR); + local_irq_enable(); + goto restart_poll; + } + } + + local_irq_enable(); return 0; } @@ -2153,8 +2181,6 @@ static irqreturn_t sky2_intr(int irq, vo prefetch(&hw->st_le[hw->st_idx]); if (likely(__netif_rx_schedule_prep(dev0))) __netif_rx_schedule(dev0); - else - printk(KERN_DEBUG PFX "irq race detected\n"); return IRQ_HANDLED; } @@ -2193,7 +2219,7 @@ static inline u32 sky2_clk2us(const stru } -static int sky2_reset(struct sky2_hw *hw) +static int __devinit sky2_reset(struct sky2_hw *hw) { u16 status; u8 t8, pmd_type; @@ -3276,6 +3302,8 @@ static int __devinit sky2_probe(struct p sky2_write32(hw, B0_IMSK, Y2_IS_BASE); + setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) dev); + pci_set_drvdata(pdev, hw); return 0; @@ -3311,13 +3339,15 @@ static void __devexit sky2_remove(struct if (!hw) return; + del_timer_sync(&hw->idle_timer); + + sky2_write32(hw, B0_IMSK, 0); dev0 = hw->dev[0]; dev1 = hw->dev[1]; if (dev1) unregister_netdev(dev1); unregister_netdev(dev0); - sky2_write32(hw, B0_IMSK, 0); sky2_set_power_state(hw, PCI_D3hot); sky2_write16(hw, B0_Y2LED, LED_STAT_OFF); sky2_write8(hw, B0_CTST, CS_RST_SET); diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 89dd18c..b026f56 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h @@ -1880,6 +1880,8 @@ struct sky2_hw { struct sky2_status_le *st_le; u32 st_idx; dma_addr_t st_dma; + + struct timer_list idle_timer; int msi_detected; wait_queue_head_t msi_wait; }; diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c index cb0aba9..046371e 100644 --- a/drivers/net/sungem_phy.c +++ b/drivers/net/sungem_phy.c @@ -275,7 +275,7 @@ static int bcm5411_init(struct mii_phy* return 0; } -static int bcm5411_suspend(struct mii_phy* phy) +static int generic_suspend(struct mii_phy* phy) { phy_write(phy, MII_BMCR, BMCR_PDOWN); @@ -738,7 +738,7 @@ static struct mii_phy_def bcm5401_phy_de /* Broadcom BCM 5411 */ static struct mii_phy_ops bcm5411_phy_ops = { .init = bcm5411_init, - .suspend = bcm5411_suspend, + .suspend = generic_suspend, .setup_aneg = bcm54xx_setup_aneg, .setup_forced = bcm54xx_setup_forced, .poll_link = genmii_poll_link, @@ -757,7 +757,7 @@ static struct mii_phy_def bcm5411_phy_de /* Broadcom BCM 5421 */ static struct mii_phy_ops bcm5421_phy_ops = { .init = bcm5421_init, - .suspend = bcm5411_suspend, + .suspend = generic_suspend, .setup_aneg = bcm54xx_setup_aneg, .setup_forced = bcm54xx_setup_forced, .poll_link = genmii_poll_link, @@ -776,7 +776,7 @@ static struct mii_phy_def bcm5421_phy_de /* Broadcom BCM 5421 built-in K2 */ static struct mii_phy_ops bcm5421k2_phy_ops = { .init = bcm5421_init, - .suspend = bcm5411_suspend, + .suspend = generic_suspend, .setup_aneg = bcm54xx_setup_aneg, .setup_forced = bcm54xx_setup_forced, .poll_link = genmii_poll_link, @@ -795,7 +795,7 @@ static struct mii_phy_def bcm5421k2_phy_ /* Broadcom BCM 5462 built-in Vesta */ static struct mii_phy_ops bcm5462V_phy_ops = { .init = bcm5421_init, - .suspend = bcm5411_suspend, + .suspend = generic_suspend, .setup_aneg = bcm54xx_setup_aneg, .setup_forced = bcm54xx_setup_forced, .poll_link = genmii_poll_link, @@ -816,6 +816,7 @@ static struct mii_phy_def bcm5462V_phy_d * would be useful here) --BenH. */ static struct mii_phy_ops marvell_phy_ops = { + .suspend = generic_suspend, .setup_aneg = marvell_setup_aneg, .setup_forced = marvell_setup_forced, .poll_link = genmii_poll_link, diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index bad09eb..e0874cb 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig @@ -6,7 +6,7 @@ menu "Wireless LAN (non-hamradio)" depends on NETDEVICES config NET_RADIO - bool "Wireless LAN drivers (non-hamradio)" + bool "Wireless LAN drivers (non-hamradio) & Wireless Extensions" select WIRELESS_EXT ---help--- Support for wireless LANs and everything having to do with radio, diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 108d9fe..00764dd 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -3139,6 +3139,7 @@ static irqreturn_t airo_interrupt ( int } if ( status & EV_LINK ) { union iwreq_data wrqu; + int scan_forceloss = 0; /* The link status has changed, if you want to put a monitor hook in, do it here. (Remember that interrupts are still disabled!) @@ -3157,7 +3158,8 @@ static irqreturn_t airo_interrupt ( int code) */ #define AUTHFAIL 0x0300 /* Authentication failure (low byte is reason code) */ -#define ASSOCIATED 0x0400 /* Assocatied */ +#define ASSOCIATED 0x0400 /* Associated */ +#define REASSOCIATED 0x0600 /* Reassociated? Only on firmware >= 5.30.17 */ #define RC_RESERVED 0 /* Reserved return code */ #define RC_NOREASON 1 /* Unspecified reason */ #define RC_AUTHINV 2 /* Previous authentication invalid */ @@ -3174,44 +3176,30 @@ static irqreturn_t airo_interrupt ( int leaving BSS */ #define RC_NOAUTH 9 /* Station requesting (Re)Association is not Authenticated with the responding station */ - if (newStatus != ASSOCIATED) { - if (auto_wep && !apriv->expires) { - apriv->expires = RUN_AT(3*HZ); - wake_up_interruptible(&apriv->thr_wait); - } - } else { - struct task_struct *task = apriv->task; + if (newStatus == FORCELOSS && apriv->scan_timeout > 0) + scan_forceloss = 1; + if(newStatus == ASSOCIATED || newStatus == REASSOCIATED) { if (auto_wep) apriv->expires = 0; - if (task) - wake_up_process (task); + if (apriv->task) + wake_up_process (apriv->task); set_bit(FLAG_UPDATE_UNI, &apriv->flags); set_bit(FLAG_UPDATE_MULTI, &apriv->flags); - } - /* Question : is ASSOCIATED the only status - * that is valid ? We want to catch handover - * and reassociations as valid status - * Jean II */ - if(newStatus == ASSOCIATED) { -#if 0 - /* FIXME: Grabbing scan results here - * seems to be too early??? Just wait for - * timeout instead. */ - if (apriv->scan_timeout > 0) { - set_bit(JOB_SCAN_RESULTS, &apriv->flags); - wake_up_interruptible(&apriv->thr_wait); - } -#endif + if (down_trylock(&apriv->sem) != 0) { set_bit(JOB_EVENT, &apriv->flags); wake_up_interruptible(&apriv->thr_wait); } else airo_send_event(dev); - } else { - memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; + } else if (!scan_forceloss) { + if (auto_wep && !apriv->expires) { + apriv->expires = RUN_AT(3*HZ); + wake_up_interruptible(&apriv->thr_wait); + } /* Send event to user space */ + memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; wireless_send_event(dev, SIOCGIWAP, &wrqu,NULL); } } @@ -7136,10 +7124,10 @@ static int airo_set_scan(struct net_devi goto out; /* Initiate a scan command */ + ai->scan_timeout = RUN_AT(3*HZ); memset(&cmd, 0, sizeof(cmd)); cmd.cmd=CMD_LISTBSS; issuecommand(ai, &cmd, &rsp); - ai->scan_timeout = RUN_AT(3*HZ); wake = 1; out: diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 87afa68..8606c88 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c @@ -3463,6 +3463,7 @@ static void atmel_command_irq(struct atm u8 status = atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_STATUS_OFFSET)); u8 command = atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_COMMAND_OFFSET)); int fast_scan; + union iwreq_data wrqu; if (status == CMD_STATUS_IDLE || status == CMD_STATUS_IN_PROGRESS) @@ -3487,6 +3488,7 @@ static void atmel_command_irq(struct atm atmel_scan(priv, 1); } else { int bss_index = retrieve_bss(priv); + int notify_scan_complete = 1; if (bss_index != -1) { atmel_join_bss(priv, bss_index); } else if (priv->operating_mode == IW_MODE_ADHOC && @@ -3495,8 +3497,14 @@ static void atmel_command_irq(struct atm } else { priv->fast_scan = !fast_scan; atmel_scan(priv, 1); + notify_scan_complete = 0; } priv->site_survey_state = SITE_SURVEY_COMPLETED; + if (notify_scan_complete) { + wrqu.data.length = 0; + wrqu.data.flags = 0; + wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); + } } break; @@ -3509,6 +3517,9 @@ static void atmel_command_irq(struct atm priv->site_survey_state = SITE_SURVEY_COMPLETED; if (priv->station_is_associated) { atmel_enter_state(priv, STATION_STATE_READY); + wrqu.data.length = 0; + wrqu.data.flags = 0; + wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); } else { atmel_scan(priv, 1); } diff --git a/drivers/net/wireless/bcm43xx/Kconfig b/drivers/net/wireless/bcm43xx/Kconfig index 4184656..25ea474 100644 --- a/drivers/net/wireless/bcm43xx/Kconfig +++ b/drivers/net/wireless/bcm43xx/Kconfig @@ -17,8 +17,11 @@ config BCM43XX_DEBUG config BCM43XX_DMA bool + depends on BCM43XX + config BCM43XX_PIO bool + depends on BCM43XX choice prompt "BCM43xx data transfer mode" diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h index dcadd29..2e83083 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx.h @@ -15,7 +15,6 @@ #include "bcm43xx_debugfs.h" #include "bcm43xx_leds.h" -#include "bcm43xx_sysfs.h" #define PFX KBUILD_MODNAME ": " @@ -638,8 +637,6 @@ struct bcm43xx_key { }; struct bcm43xx_private { - struct bcm43xx_sysfs sysfs; - struct ieee80211_device *ieee; struct ieee80211softmac_device *softmac; @@ -772,6 +769,20 @@ struct bcm43xx_private * bcm43xx_priv(st return ieee80211softmac_priv(dev); } +struct device; + +static inline +struct bcm43xx_private * dev_to_bcm(struct device *dev) +{ + struct net_device *net_dev; + struct bcm43xx_private *bcm; + + net_dev = dev_get_drvdata(dev); + bcm = bcm43xx_priv(net_dev); + + return bcm; +} + /* Helper function, which returns a boolean. * TRUE, if PIO is used; FALSE, if DMA is used. diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c index d2c3401..35a4fcb 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c @@ -452,12 +452,12 @@ void bcm43xx_printk_dump(const char *dat size_t i; char c; - printk(KERN_INFO PFX "Data dump (%s, %u bytes):", + printk(KERN_INFO PFX "Data dump (%s, %zd bytes):", description, size); for (i = 0; i < size; i++) { c = data[i]; if (i % 8 == 0) - printk("\n" KERN_INFO PFX "0x%08x: 0x%02x, ", i, c & 0xff); + printk("\n" KERN_INFO PFX "0x%08zx: 0x%02x, ", i, c & 0xff); else printk("0x%02x, ", c & 0xff); } @@ -472,12 +472,12 @@ void bcm43xx_printk_bitdump(const unsign int j; const unsigned char *d; - printk(KERN_INFO PFX "*** Bitdump (%s, %u bytes, %s) ***", + printk(KERN_INFO PFX "*** Bitdump (%s, %zd bytes, %s) ***", description, bytes, msb_to_lsb ? "MSB to LSB" : "LSB to MSB"); for (i = 0; i < bytes; i++) { d = data + i; if (i % 8 == 0) - printk("\n" KERN_INFO PFX "0x%08x: ", i); + printk("\n" KERN_INFO PFX "0x%08zx: ", i); if (msb_to_lsb) { for (j = 7; j >= 0; j--) { if (*d & (1 << j)) diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c index c3681b8..bbecba0 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c @@ -196,8 +196,9 @@ static int alloc_ringmemory(struct bcm43 } if (ring->dmabase + BCM43xx_DMA_RINGMEMSIZE > BCM43xx_DMA_BUSADDRMAX) { printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RINGMEMORY >1G " - "(0x%08x, len: %lu)\n", - ring->dmabase, BCM43xx_DMA_RINGMEMSIZE); + "(0x%llx, len: %lu)\n", + (unsigned long long)ring->dmabase, + BCM43xx_DMA_RINGMEMSIZE); dma_free_coherent(dev, BCM43xx_DMA_RINGMEMSIZE, ring->vbase, ring->dmabase); return -ENOMEM; @@ -307,8 +308,8 @@ static int setup_rx_descbuffer(struct bc unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); dev_kfree_skb_any(skb); printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RX SKB >1G " - "(0x%08x, len: %u)\n", - dmaaddr, ring->rx_buffersize); + "(0x%llx, len: %u)\n", + (unsigned long long)dmaaddr, ring->rx_buffersize); return -ENOMEM; } meta->skb = skb; @@ -729,8 +730,8 @@ static int dma_tx_fragment(struct bcm43x if (unlikely(meta->dmaaddr + skb->len > BCM43xx_DMA_BUSADDRMAX)) { return_slot(ring, slot); printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA TX SKB >1G " - "(0x%08x, len: %u)\n", - meta->dmaaddr, skb->len); + "(0x%llx, len: %u)\n", + (unsigned long long)meta->dmaaddr, skb->len); return -ENOMEM; } diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.h b/drivers/net/wireless/bcm43xx/bcm43xx_dma.h index 2d520e4..b7d7763 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.h @@ -213,6 +213,14 @@ static inline void bcm43xx_dma_rx(struct bcm43xx_dmaring *ring) { } +static inline +void bcm43xx_dma_tx_suspend(struct bcm43xx_dmaring *ring) +{ +} +static inline +void bcm43xx_dma_tx_resume(struct bcm43xx_dmaring *ring) +{ +} #endif /* CONFIG_BCM43XX_DMA */ #endif /* BCM43xx_DMA_H_ */ diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index c37371f..9a06e61 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c @@ -52,6 +52,7 @@ #include "bcm43xx_wx.h" #include "bcm43xx_ethtool.h" #include "bcm43xx_xmit.h" +#include "bcm43xx_sysfs.h" MODULE_DESCRIPTION("Broadcom BCM43xx wireless driver"); @@ -3522,6 +3523,7 @@ static inline int bcm43xx_tx(struct bcm4 err = bcm43xx_pio_tx(bcm, txb); else err = bcm43xx_dma_tx(bcm, txb); + bcm->net_dev->trans_start = jiffies; return err; } diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index 0a66f43..3313716 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c @@ -2151,6 +2151,7 @@ int bcm43xx_phy_init_tssi2dbm_table(stru phy->tssi2dbm = NULL; printk(KERN_ERR PFX "Could not generate " "tssi2dBm table\n"); + kfree(dyn_tssi2dbm); return -ENODEV; } phy->tssi2dbm = dyn_tssi2dbm; diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_pio.c b/drivers/net/wireless/bcm43xx/bcm43xx_pio.c index c59ddd4..0aa1bd2 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_pio.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_pio.c @@ -27,6 +27,7 @@ #include "bcm43xx_pio.h" #include "bcm43xx_main.h" #include "bcm43xx_xmit.h" +#include "bcm43xx_power.h" #include @@ -44,10 +45,10 @@ static void tx_octet(struct bcm43xx_pioq bcm43xx_pio_write(queue, BCM43xx_PIO_TXDATA, octet); bcm43xx_pio_write(queue, BCM43xx_PIO_TXCTL, - BCM43xx_PIO_TXCTL_WRITEHI); + BCM43xx_PIO_TXCTL_WRITELO); } else { bcm43xx_pio_write(queue, BCM43xx_PIO_TXCTL, - BCM43xx_PIO_TXCTL_WRITEHI); + BCM43xx_PIO_TXCTL_WRITELO); bcm43xx_pio_write(queue, BCM43xx_PIO_TXDATA, octet); } @@ -103,7 +104,7 @@ static void tx_complete(struct bcm43xx_p bcm43xx_pio_write(queue, BCM43xx_PIO_TXDATA, skb->data[skb->len - 1]); bcm43xx_pio_write(queue, BCM43xx_PIO_TXCTL, - BCM43xx_PIO_TXCTL_WRITEHI | + BCM43xx_PIO_TXCTL_WRITELO | BCM43xx_PIO_TXCTL_COMPLETE); } else { bcm43xx_pio_write(queue, BCM43xx_PIO_TXCTL, @@ -112,9 +113,10 @@ static void tx_complete(struct bcm43xx_p } static u16 generate_cookie(struct bcm43xx_pioqueue *queue, - int packetindex) + struct bcm43xx_pio_txpacket *packet) { u16 cookie = 0x0000; + int packetindex; /* We use the upper 4 bits for the PIO * controller ID and the lower 12 bits @@ -135,6 +137,7 @@ static u16 generate_cookie(struct bcm43x default: assert(0); } + packetindex = pio_txpacket_getindex(packet); assert(((u16)packetindex & 0xF000) == 0x0000); cookie |= (u16)packetindex; @@ -184,7 +187,7 @@ static void pio_tx_write_fragment(struct bcm43xx_generate_txhdr(queue->bcm, &txhdr, skb->data, skb->len, (packet->xmitted_frags == 0), - generate_cookie(queue, pio_txpacket_getindex(packet))); + generate_cookie(queue, packet)); tx_start(queue); octets = skb->len + sizeof(txhdr); @@ -241,7 +244,7 @@ static int pio_tx_packet(struct bcm43xx_ queue->tx_devq_packets++; queue->tx_devq_used += octets; - assert(packet->xmitted_frags <= packet->txb->nr_frags); + assert(packet->xmitted_frags < packet->txb->nr_frags); packet->xmitted_frags++; packet->xmitted_octets += octets; } @@ -257,8 +260,14 @@ static void tx_tasklet(unsigned long d) unsigned long flags; struct bcm43xx_pio_txpacket *packet, *tmp_packet; int err; + u16 txctl; bcm43xx_lock_mmio(bcm, flags); + + txctl = bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL); + if (txctl & BCM43xx_PIO_TXCTL_SUSPEND) + goto out_unlock; + list_for_each_entry_safe(packet, tmp_packet, &queue->txqueue, list) { assert(packet->xmitted_frags < packet->txb->nr_frags); if (packet->xmitted_frags == 0) { @@ -288,6 +297,7 @@ static void tx_tasklet(unsigned long d) next_packet: continue; } +out_unlock: bcm43xx_unlock_mmio(bcm, flags); } @@ -330,12 +340,19 @@ struct bcm43xx_pioqueue * bcm43xx_setup_ (unsigned long)queue); value = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); - value |= BCM43xx_SBF_XFER_REG_BYTESWAP; + value &= ~BCM43xx_SBF_XFER_REG_BYTESWAP; bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, value); qsize = bcm43xx_read16(bcm, queue->mmio_base + BCM43xx_PIO_TXQBUFSIZE); + if (qsize == 0) { + printk(KERN_ERR PFX "ERROR: This card does not support PIO " + "operation mode. Please use DMA mode " + "(module parameter pio=0).\n"); + goto err_freequeue; + } if (qsize <= BCM43xx_PIO_TXQADJUST) { - printk(KERN_ERR PFX "PIO tx device-queue too small (%u)\n", qsize); + printk(KERN_ERR PFX "PIO tx device-queue too small (%u)\n", + qsize); goto err_freequeue; } qsize -= BCM43xx_PIO_TXQADJUST; @@ -444,15 +461,10 @@ int bcm43xx_pio_tx(struct bcm43xx_privat { struct bcm43xx_pioqueue *queue = bcm43xx_current_pio(bcm)->queue1; struct bcm43xx_pio_txpacket *packet; - u16 tmp; assert(!queue->tx_suspended); assert(!list_empty(&queue->txfree)); - tmp = bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL); - if (tmp & BCM43xx_PIO_TXCTL_SUSPEND) - return -EBUSY; - packet = list_entry(queue->txfree.next, struct bcm43xx_pio_txpacket, list); packet->txb = txb; packet->xmitted_frags = 0; @@ -462,7 +474,7 @@ int bcm43xx_pio_tx(struct bcm43xx_privat assert(queue->nr_txfree < BCM43xx_PIO_MAXTXPACKETS); /* Suspend TX, if we are out of packets in the "free" queue. */ - if (unlikely(list_empty(&queue->txfree))) { + if (list_empty(&queue->txfree)) { netif_stop_queue(queue->bcm->net_dev); queue->tx_suspended = 1; } @@ -480,15 +492,15 @@ void bcm43xx_pio_handle_xmitstatus(struc queue = parse_cookie(bcm, status->cookie, &packet); assert(queue); -//TODO -if (!queue) -return; + free_txpacket(packet, 1); - if (unlikely(queue->tx_suspended)) { + if (queue->tx_suspended) { queue->tx_suspended = 0; netif_wake_queue(queue->bcm->net_dev); } - /* If there are packets on the txqueue, poke the tasklet. */ + /* If there are packets on the txqueue, poke the tasklet + * to transmit them. + */ if (!list_empty(&queue->txqueue)) tasklet_schedule(&queue->txtask); } @@ -519,12 +531,9 @@ void bcm43xx_pio_rx(struct bcm43xx_pioqu int i, preamble_readwords; struct sk_buff *skb; -return; tmp = bcm43xx_pio_read(queue, BCM43xx_PIO_RXCTL); - if (!(tmp & BCM43xx_PIO_RXCTL_DATAAVAILABLE)) { - dprintkl(KERN_ERR PFX "PIO RX: No data available\n");//TODO: remove this printk. + if (!(tmp & BCM43xx_PIO_RXCTL_DATAAVAILABLE)) return; - } bcm43xx_pio_write(queue, BCM43xx_PIO_RXCTL, BCM43xx_PIO_RXCTL_DATAAVAILABLE); @@ -538,8 +547,7 @@ return; return; data_ready: -//FIXME: endianess in this function. - len = le16_to_cpu(bcm43xx_pio_read(queue, BCM43xx_PIO_RXDATA)); + len = bcm43xx_pio_read(queue, BCM43xx_PIO_RXDATA); if (unlikely(len > 0x700)) { pio_rx_error(queue, 0, "len > 0x700"); return; @@ -555,7 +563,7 @@ data_ready: preamble_readwords = 18 / sizeof(u16); for (i = 0; i < preamble_readwords; i++) { tmp = bcm43xx_pio_read(queue, BCM43xx_PIO_RXDATA); - preamble[i + 1] = cpu_to_be16(tmp);//FIXME? + preamble[i + 1] = cpu_to_le16(tmp); } rxhdr = (struct bcm43xx_rxhdr *)preamble; rxflags2 = le16_to_cpu(rxhdr->flags2); @@ -591,16 +599,40 @@ data_ready: } skb_put(skb, len); for (i = 0; i < len - 1; i += 2) { - tmp = cpu_to_be16(bcm43xx_pio_read(queue, BCM43xx_PIO_RXDATA)); - *((u16 *)(skb->data + i)) = tmp; + tmp = bcm43xx_pio_read(queue, BCM43xx_PIO_RXDATA); + *((u16 *)(skb->data + i)) = cpu_to_le16(tmp); } if (len % 2) { tmp = bcm43xx_pio_read(queue, BCM43xx_PIO_RXDATA); skb->data[len - 1] = (tmp & 0x00FF); +/* The specs say the following is required, but + * it is wrong and corrupts the PLCP. If we don't do + * this, the PLCP seems to be correct. So ifdef it out for now. + */ +#if 0 if (rxflags2 & BCM43xx_RXHDR_FLAGS2_TYPE2FRAME) - skb->data[0x20] = (tmp & 0xFF00) >> 8; + skb->data[2] = (tmp & 0xFF00) >> 8; else - skb->data[0x1E] = (tmp & 0xFF00) >> 8; + skb->data[0] = (tmp & 0xFF00) >> 8; +#endif } + skb_trim(skb, len - IEEE80211_FCS_LEN); bcm43xx_rx(queue->bcm, skb, rxhdr); } + +void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue) +{ + bcm43xx_power_saving_ctl_bits(queue->bcm, -1, 1); + bcm43xx_pio_write(queue, BCM43xx_PIO_TXCTL, + bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL) + | BCM43xx_PIO_TXCTL_SUSPEND); +} + +void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue) +{ + bcm43xx_pio_write(queue, BCM43xx_PIO_TXCTL, + bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL) + & ~BCM43xx_PIO_TXCTL_SUSPEND); + bcm43xx_power_saving_ctl_bits(queue->bcm, -1, -1); + tasklet_schedule(&queue->txtask); +} diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_pio.h b/drivers/net/wireless/bcm43xx/bcm43xx_pio.h index 970627b..dfc7820 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_pio.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx_pio.h @@ -14,8 +14,8 @@ #define BCM43xx_PIO_RXCTL 0x08 #define BCM43xx_PIO_RXDATA 0x0A -#define BCM43xx_PIO_TXCTL_WRITEHI (1 << 0) -#define BCM43xx_PIO_TXCTL_WRITELO (1 << 1) +#define BCM43xx_PIO_TXCTL_WRITELO (1 << 0) +#define BCM43xx_PIO_TXCTL_WRITEHI (1 << 1) #define BCM43xx_PIO_TXCTL_COMPLETE (1 << 2) #define BCM43xx_PIO_TXCTL_INIT (1 << 3) #define BCM43xx_PIO_TXCTL_SUSPEND (1 << 7) @@ -95,6 +95,7 @@ void bcm43xx_pio_write(struct bcm43xx_pi u16 offset, u16 value) { bcm43xx_write16(queue->bcm, queue->mmio_base + offset, value); + mmiowb(); } @@ -107,6 +108,9 @@ void bcm43xx_pio_handle_xmitstatus(struc struct bcm43xx_xmitstatus *status); void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue); +void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue); +void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue); + #else /* CONFIG_BCM43XX_PIO */ static inline @@ -133,6 +137,14 @@ static inline void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue) { } +static inline +void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue) +{ +} +static inline +void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue) +{ +} #endif /* CONFIG_BCM43XX_PIO */ #endif /* BCM43xx_PIO_H_ */ diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_power.c b/drivers/net/wireless/bcm43xx/bcm43xx_power.c index 3c92b62..6569da3 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_power.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_power.c @@ -35,77 +35,101 @@ #include "bcm43xx_main.h" +/* Get the Slow Clock Source */ +static int bcm43xx_pctl_get_slowclksrc(struct bcm43xx_private *bcm) +{ + u32 tmp; + int err; + + assert(bcm->current_core == &bcm->core_chipcommon); + if (bcm->current_core->rev < 6) { + if (bcm->bustype == BCM43xx_BUSTYPE_PCMCIA || + bcm->bustype == BCM43xx_BUSTYPE_SB) + return BCM43xx_PCTL_CLKSRC_XTALOS; + if (bcm->bustype == BCM43xx_BUSTYPE_PCI) { + err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCTL_OUT, &tmp); + assert(!err); + if (tmp & 0x10) + return BCM43xx_PCTL_CLKSRC_PCI; + return BCM43xx_PCTL_CLKSRC_XTALOS; + } + } + if (bcm->current_core->rev < 10) { + tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SLOWCLKCTL); + tmp &= 0x7; + if (tmp == 0) + return BCM43xx_PCTL_CLKSRC_LOPWROS; + if (tmp == 1) + return BCM43xx_PCTL_CLKSRC_XTALOS; + if (tmp == 2) + return BCM43xx_PCTL_CLKSRC_PCI; + } + + return BCM43xx_PCTL_CLKSRC_XTALOS; +} + /* Get max/min slowclock frequency * as described in http://bcm-specs.sipsolutions.net/PowerControl */ static int bcm43xx_pctl_clockfreqlimit(struct bcm43xx_private *bcm, int get_max) { - int limit = 0; + int limit; + int clocksrc; int divisor; - int selection; - int err; u32 tmp; - struct bcm43xx_coreinfo *old_core; - if (!(bcm->chipcommon_capabilities & BCM43xx_CAPABILITIES_PCTL)) - goto out; - old_core = bcm->current_core; - err = bcm43xx_switch_core(bcm, &bcm->core_chipcommon); - if (err) - goto out; + assert(bcm->chipcommon_capabilities & BCM43xx_CAPABILITIES_PCTL); + assert(bcm->current_core == &bcm->core_chipcommon); + clocksrc = bcm43xx_pctl_get_slowclksrc(bcm); if (bcm->current_core->rev < 6) { - if ((bcm->bustype == BCM43xx_BUSTYPE_PCMCIA) || - (bcm->bustype == BCM43xx_BUSTYPE_SB)) { - selection = 1; + switch (clocksrc) { + case BCM43xx_PCTL_CLKSRC_PCI: + divisor = 64; + break; + case BCM43xx_PCTL_CLKSRC_XTALOS: divisor = 32; - } else { - err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCTL_OUT, &tmp); - if (err) { - printk(KERN_ERR PFX "clockfreqlimit pcicfg read failure\n"); - goto out_switchback; - } - if (tmp & 0x10) { - /* PCI */ - selection = 2; - divisor = 64; - } else { - /* XTAL */ - selection = 1; - divisor = 32; - } + break; + default: + assert(0); + divisor = 1; } } else if (bcm->current_core->rev < 10) { - selection = (tmp & 0x07); - if (selection) { + switch (clocksrc) { + case BCM43xx_PCTL_CLKSRC_LOPWROS: + divisor = 1; + break; + case BCM43xx_PCTL_CLKSRC_XTALOS: + case BCM43xx_PCTL_CLKSRC_PCI: tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SLOWCLKCTL); - divisor = 4 * (1 + ((tmp & 0xFFFF0000) >> 16)); - } else + divisor = ((tmp & 0xFFFF0000) >> 16) + 1; + divisor *= 4; + break; + default: + assert(0); divisor = 1; + } } else { tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SYSCLKCTL); - divisor = 4 * (1 + ((tmp & 0xFFFF0000) >> 16)); - selection = 1; + divisor = ((tmp & 0xFFFF0000) >> 16) + 1; + divisor *= 4; } - - switch (selection) { - case 0: - /* LPO */ + + switch (clocksrc) { + case BCM43xx_PCTL_CLKSRC_LOPWROS: if (get_max) limit = 43000; else limit = 25000; break; - case 1: - /* XTAL */ + case BCM43xx_PCTL_CLKSRC_XTALOS: if (get_max) limit = 20200000; else limit = 19800000; break; - case 2: - /* PCI */ + case BCM43xx_PCTL_CLKSRC_PCI: if (get_max) limit = 34000000; else @@ -113,17 +137,14 @@ static int bcm43xx_pctl_clockfreqlimit(s break; default: assert(0); + limit = 0; } limit /= divisor; -out_switchback: - err = bcm43xx_switch_core(bcm, old_core); - assert(err == 0); - -out: return limit; } + /* init power control * as described in http://bcm-specs.sipsolutions.net/PowerControl */ diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_power.h b/drivers/net/wireless/bcm43xx/bcm43xx_power.h index 5f63640..c966ab3 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_power.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx_power.h @@ -33,6 +33,15 @@ #include +/* Clock sources */ +enum { + /* PCI clock */ + BCM43xx_PCTL_CLKSRC_PCI, + /* Crystal slow clock oscillator */ + BCM43xx_PCTL_CLKSRC_XTALOS, + /* Low power oscillator */ + BCM43xx_PCTL_CLKSRC_LOPWROS, +}; struct bcm43xx_private; diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c index c44d890..b438f48 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c @@ -71,14 +71,46 @@ static int get_boolean(const char *buf, return -EINVAL; } +static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len) +{ + int i, pos = 0; + + for (i = 0; i < BCM43xx_SPROM_SIZE; i++) { + pos += snprintf(buf + pos, buf_len - pos - 1, + "%04X", swab16(sprom[i]) & 0xFFFF); + } + pos += snprintf(buf + pos, buf_len - pos - 1, "\n"); + + return pos + 1; +} + +static int hex2sprom(u16 *sprom, const char *dump, size_t len) +{ + char tmp[5] = { 0 }; + int cnt = 0; + unsigned long parsed; + + if (len < BCM43xx_SPROM_SIZE * sizeof(u16) * 2) + return -EINVAL; + + while (cnt < BCM43xx_SPROM_SIZE) { + memcpy(tmp, dump, 4); + dump += 4; + parsed = simple_strtoul(tmp, NULL, 16); + sprom[cnt++] = swab16((u16)parsed); + } + + return 0; +} + static ssize_t bcm43xx_attr_sprom_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom); + struct bcm43xx_private *bcm = dev_to_bcm(dev); u16 *sprom; unsigned long flags; - int i, err; + int err; if (!capable(CAP_NET_ADMIN)) return -EPERM; @@ -91,55 +123,53 @@ static ssize_t bcm43xx_attr_sprom_show(s bcm43xx_lock_mmio(bcm, flags); assert(bcm->initialized); err = bcm43xx_sprom_read(bcm, sprom); - if (!err) { - for (i = 0; i < BCM43xx_SPROM_SIZE; i++) { - buf[i * 2] = sprom[i] & 0x00FF; - buf[i * 2 + 1] = (sprom[i] & 0xFF00) >> 8; - } - } + if (!err) + err = sprom2hex(sprom, buf, PAGE_SIZE); bcm43xx_unlock_mmio(bcm, flags); kfree(sprom); - return err ? err : BCM43xx_SPROM_SIZE * sizeof(u16); + return err; } static ssize_t bcm43xx_attr_sprom_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom); + struct bcm43xx_private *bcm = dev_to_bcm(dev); u16 *sprom; unsigned long flags; - int i, err; + int err; if (!capable(CAP_NET_ADMIN)) return -EPERM; - if (count != BCM43xx_SPROM_SIZE * sizeof(u16)) - return -EINVAL; sprom = kmalloc(BCM43xx_SPROM_SIZE * sizeof(*sprom), GFP_KERNEL); if (!sprom) return -ENOMEM; - for (i = 0; i < BCM43xx_SPROM_SIZE; i++) { - sprom[i] = buf[i * 2] & 0xFF; - sprom[i] |= ((u16)(buf[i * 2 + 1] & 0xFF)) << 8; - } + err = hex2sprom(sprom, buf, count); + if (err) + goto out_kfree; bcm43xx_lock_mmio(bcm, flags); assert(bcm->initialized); err = bcm43xx_sprom_write(bcm, sprom); bcm43xx_unlock_mmio(bcm, flags); +out_kfree: kfree(sprom); return err ? err : count; } +static DEVICE_ATTR(sprom, 0600, + bcm43xx_attr_sprom_show, + bcm43xx_attr_sprom_store); + static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_interfmode); + struct bcm43xx_private *bcm = dev_to_bcm(dev); unsigned long flags; int err; ssize_t count = 0; @@ -175,7 +205,7 @@ static ssize_t bcm43xx_attr_interfmode_s struct device_attribute *attr, const char *buf, size_t count) { - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_interfmode); + struct bcm43xx_private *bcm = dev_to_bcm(dev); unsigned long flags; int err; int mode; @@ -215,11 +245,15 @@ static ssize_t bcm43xx_attr_interfmode_s return err ? err : count; } +static DEVICE_ATTR(interference, 0644, + bcm43xx_attr_interfmode_show, + bcm43xx_attr_interfmode_store); + static ssize_t bcm43xx_attr_preamble_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_preamble); + struct bcm43xx_private *bcm = dev_to_bcm(dev); unsigned long flags; int err; ssize_t count; @@ -245,7 +279,7 @@ static ssize_t bcm43xx_attr_preamble_sto struct device_attribute *attr, const char *buf, size_t count) { - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_preamble); + struct bcm43xx_private *bcm = dev_to_bcm(dev); unsigned long flags; int err; int value; @@ -267,56 +301,41 @@ static ssize_t bcm43xx_attr_preamble_sto return err ? err : count; } +static DEVICE_ATTR(shortpreamble, 0644, + bcm43xx_attr_preamble_show, + bcm43xx_attr_preamble_store); + int bcm43xx_sysfs_register(struct bcm43xx_private *bcm) { struct device *dev = &bcm->pci_dev->dev; - struct bcm43xx_sysfs *sysfs = &bcm->sysfs; int err; assert(bcm->initialized); - sysfs->attr_sprom.attr.name = "sprom"; - sysfs->attr_sprom.attr.owner = THIS_MODULE; - sysfs->attr_sprom.attr.mode = 0600; - sysfs->attr_sprom.show = bcm43xx_attr_sprom_show; - sysfs->attr_sprom.store = bcm43xx_attr_sprom_store; - err = device_create_file(dev, &sysfs->attr_sprom); + err = device_create_file(dev, &dev_attr_sprom); if (err) goto out; - - sysfs->attr_interfmode.attr.name = "interference"; - sysfs->attr_interfmode.attr.owner = THIS_MODULE; - sysfs->attr_interfmode.attr.mode = 0600; - sysfs->attr_interfmode.show = bcm43xx_attr_interfmode_show; - sysfs->attr_interfmode.store = bcm43xx_attr_interfmode_store; - err = device_create_file(dev, &sysfs->attr_interfmode); + err = device_create_file(dev, &dev_attr_interference); if (err) goto err_remove_sprom; - - sysfs->attr_preamble.attr.name = "shortpreamble"; - sysfs->attr_preamble.attr.owner = THIS_MODULE; - sysfs->attr_preamble.attr.mode = 0600; - sysfs->attr_preamble.show = bcm43xx_attr_preamble_show; - sysfs->attr_preamble.store = bcm43xx_attr_preamble_store; - err = device_create_file(dev, &sysfs->attr_preamble); + err = device_create_file(dev, &dev_attr_shortpreamble); if (err) goto err_remove_interfmode; out: return err; err_remove_interfmode: - device_remove_file(dev, &sysfs->attr_interfmode); + device_remove_file(dev, &dev_attr_interference); err_remove_sprom: - device_remove_file(dev, &sysfs->attr_sprom); + device_remove_file(dev, &dev_attr_sprom); goto out; } void bcm43xx_sysfs_unregister(struct bcm43xx_private *bcm) { struct device *dev = &bcm->pci_dev->dev; - struct bcm43xx_sysfs *sysfs = &bcm->sysfs; - device_remove_file(dev, &sysfs->attr_preamble); - device_remove_file(dev, &sysfs->attr_interfmode); - device_remove_file(dev, &sysfs->attr_sprom); + device_remove_file(dev, &dev_attr_shortpreamble); + device_remove_file(dev, &dev_attr_interference); + device_remove_file(dev, &dev_attr_sprom); } diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h index 57f1451..cc701df 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h @@ -1,22 +1,6 @@ #ifndef BCM43xx_SYSFS_H_ #define BCM43xx_SYSFS_H_ -#include - - -struct bcm43xx_sysfs { - struct device_attribute attr_sprom; - struct device_attribute attr_interfmode; - struct device_attribute attr_preamble; -}; - -#define devattr_to_bcm(attr, attr_name) ({ \ - struct bcm43xx_sysfs *__s; struct bcm43xx_private *__p; \ - __s = container_of((attr), struct bcm43xx_sysfs, attr_name); \ - __p = container_of(__s, struct bcm43xx_private, sysfs); \ - __p; \ - }) - struct bcm43xx_private; int bcm43xx_sysfs_register(struct bcm43xx_private *bcm); diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c index 3daee82..3edbb48 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c @@ -962,22 +962,22 @@ static const struct iw_priv_args bcm43xx { .cmd = PRIV_WX_SET_SHORTPREAMBLE, .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - .name = "set_shortpreambl", + .name = "set_shortpreamb", }, { .cmd = PRIV_WX_GET_SHORTPREAMBLE, .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - .name = "get_shortpreambl", + .name = "get_shortpreamb", }, { .cmd = PRIV_WX_SET_SWENCRYPTION, .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - .name = "set_swencryption", + .name = "set_swencrypt", }, { .cmd = PRIV_WX_GET_SWENCRYPTION, .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - .name = "get_swencryption", + .name = "get_swencrypt", }, { .cmd = PRIV_WX_SPROM_WRITE, diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index 8b37e82..8399de5 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c @@ -1860,7 +1860,7 @@ static char * __prism2_translate_scan(lo memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWFREQ; if (scan) { - chan = scan->chid; + chan = le16_to_cpu(scan->chid); } else if (bss) { chan = bss->chan; } else { @@ -1868,7 +1868,7 @@ static char * __prism2_translate_scan(lo } if (chan > 0) { - iwe.u.freq.m = freq_list[le16_to_cpu(chan - 1)] * 100000; + iwe.u.freq.m = freq_list[chan - 1] * 100000; iwe.u.freq.e = 1; current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 8dfdfbd..06523e2 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c @@ -390,7 +390,7 @@ static struct iw_statistics *orinoco_get } } else { struct { - __le16 qual, signal, noise; + __le16 qual, signal, noise, unused; } __attribute__ ((packed)) cq; err = HERMES_READ_RECORD(hw, USER_BAP, diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 4e53be9..bbeabe3 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -535,7 +535,7 @@ pdcs_auto_read(struct subsystem *entry, { char *out = buf; struct pdcspath_entry *pathentry; - + if (!entry || !buf) return -EINVAL; diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index 42b32ff..278f325 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c @@ -178,6 +178,11 @@ extern struct proc_dir_entry * proc_mcki #define ROPE6_CTL 0x230 #define ROPE7_CTL 0x238 +#define IOC_ROPE0_CFG 0x500 /* pluto only */ +#define IOC_ROPE_AO 0x10 /* Allow "Relaxed Ordering" */ + + + #define HF_ENABLE 0x40 @@ -1759,19 +1764,33 @@ printk("sba_hw_init(): mem_boot 0x%x 0x% sba_dev->num_ioc = num_ioc; for (i = 0; i < num_ioc; i++) { - /* - ** Make sure the box crashes if we get any errors on a rope. - */ - WRITE_REG(HF_ENABLE, sba_dev->ioc[i].ioc_hpa + ROPE0_CTL); - WRITE_REG(HF_ENABLE, sba_dev->ioc[i].ioc_hpa + ROPE1_CTL); - WRITE_REG(HF_ENABLE, sba_dev->ioc[i].ioc_hpa + ROPE2_CTL); - WRITE_REG(HF_ENABLE, sba_dev->ioc[i].ioc_hpa + ROPE3_CTL); - WRITE_REG(HF_ENABLE, sba_dev->ioc[i].ioc_hpa + ROPE4_CTL); - WRITE_REG(HF_ENABLE, sba_dev->ioc[i].ioc_hpa + ROPE5_CTL); - WRITE_REG(HF_ENABLE, sba_dev->ioc[i].ioc_hpa + ROPE6_CTL); - WRITE_REG(HF_ENABLE, sba_dev->ioc[i].ioc_hpa + ROPE7_CTL); + unsigned long ioc_hpa = sba_dev->ioc[i].ioc_hpa; + unsigned int j; + + for (j=0; j < sizeof(u64) * ROPES_PER_IOC; j+=sizeof(u64)) { + + /* + * Clear ROPE(N)_CONFIG AO bit. + * Disables "NT Ordering" (~= !"Relaxed Ordering") + * Overrides bit 1 in DMA Hint Sets. + * Improves netperf UDP_STREAM by ~10% for bcm5701. + */ + if (IS_PLUTO(sba_dev->iodc)) { + unsigned long rope_cfg, cfg_val; + + rope_cfg = ioc_hpa + IOC_ROPE0_CFG + j; + cfg_val = READ_REG(rope_cfg); + cfg_val &= ~IOC_ROPE_AO; + WRITE_REG(cfg_val, rope_cfg); + } + + /* + ** Make sure the box crashes on rope errors. + */ + WRITE_REG(HF_ENABLE, ioc_hpa + ROPE0_CTL + j); + } - /* flush out the writes */ + /* flush out the last writes */ READ_REG(sba_dev->ioc[i].ioc_hpa + ROPE7_CTL); DBG_INIT(" ioc[%d] ROPE_CFG 0x%Lx ROPE_DBG 0x%Lx\n", diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index 719b863..828eb45 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c @@ -155,7 +155,7 @@ superio_init(struct pci_dev *pcidev) struct pci_dev *pdev = sio->lio_pdev; u16 word; - if (sio->suckyio_irq_enabled) + if (sio->suckyio_irq_enabled) return; BUG_ON(!pdev); @@ -194,7 +194,7 @@ superio_init(struct pci_dev *pcidev) request_region (sio->acpi_base, 0x1f, "acpi"); /* Enable the legacy I/O function */ - pci_read_config_word (pdev, PCI_COMMAND, &word); + pci_read_config_word (pdev, PCI_COMMAND, &word); word |= PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_IO; pci_write_config_word (pdev, PCI_COMMAND, word); diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index d589002..48bbf32 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -97,7 +97,7 @@ static struct superio_struct { /* For Su int io; int irq; int dma; -} superios[NR_SUPERIOS] __devinitdata = { {0,},}; +} superios[NR_SUPERIOS] = { {0,},}; static int user_specified; #if defined(CONFIG_PARPORT_PC_SUPERIO) || \ @@ -1557,7 +1557,7 @@ static int __devinit get_superio_dma (st return PARPORT_DMA_NONE; } -static int __devinit get_superio_irq (struct parport *p) +static int get_superio_irq (struct parport *p) { int i=0; while( (superios[i].io != p->base) && (iprivate_data; unsigned char r = 0xc; @@ -1712,7 +1712,7 @@ static int __devinit parport_ECR_present * be misdetected here is rather academic. */ -static int __devinit parport_PS2_supported(struct parport *pb) +static int parport_PS2_supported(struct parport *pb) { int ok = 0; @@ -1868,7 +1868,7 @@ static int __devinit parport_ECP_support } #endif -static int __devinit parport_ECPPS2_supported(struct parport *pb) +static int parport_ECPPS2_supported(struct parport *pb) { const struct parport_pc_private *priv = pb->private_data; int result; @@ -1886,7 +1886,7 @@ static int __devinit parport_ECPPS2_supp /* EPP mode detection */ -static int __devinit parport_EPP_supported(struct parport *pb) +static int parport_EPP_supported(struct parport *pb) { const struct parport_pc_private *priv = pb->private_data; @@ -1931,7 +1931,7 @@ static int __devinit parport_EPP_support return 1; } -static int __devinit parport_ECPEPP_supported(struct parport *pb) +static int parport_ECPEPP_supported(struct parport *pb) { struct parport_pc_private *priv = pb->private_data; int result; @@ -2073,7 +2073,7 @@ static int __devinit irq_probe_SPP(struc * When ECP is available we can autoprobe for IRQs. * NOTE: If we can autoprobe it, we can register the IRQ. */ -static int __devinit parport_irq_probe(struct parport *pb) +static int parport_irq_probe(struct parport *pb) { struct parport_pc_private *priv = pb->private_data; @@ -2779,7 +2779,7 @@ static struct parport_pc_pci { /* If set, this is called after probing for ports. If 'failed' * is non-zero we couldn't use any of the ports. */ void (*postinit_hook) (struct pci_dev *pdev, int failed); -} cards[] __devinitdata = { +} cards[] = { /* siig_1p_10x */ { 1, { { 2, 3 }, } }, /* siig_2p_10x */ { 2, { { 2, 3 }, { 4, 5 }, } }, /* siig_1p_20x */ { 1, { { 0, 1 }, } }, diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 827550d..c42ae2c 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -865,6 +865,35 @@ static void __init quirk_eisa_bridge(str DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82375, quirk_eisa_bridge ); /* + * On the MSI-K8T-Neo2Fir Board, the internal Soundcard is disabled + * when a PCI-Soundcard is added. The BIOS only gives Options + * "Disabled" and "AUTO". This Quirk Sets the corresponding + * Register-Value to enable the Soundcard. + */ +static void __init k8t_sound_hostbridge(struct pci_dev *dev) +{ + unsigned char val; + + printk(KERN_INFO "PCI: Quirk-MSI-K8T Soundcard On\n"); + pci_read_config_byte(dev, 0x50, &val); + if (val == 0x88 || val == 0xc8) { + pci_write_config_byte(dev, 0x50, val & (~0x40)); + + /* Verify the Change for Status output */ + pci_read_config_byte(dev, 0x50, &val); + if (val & 0x40) + printk(KERN_INFO "PCI: MSI-K8T soundcard still off\n"); + else + printk(KERN_INFO "PCI: MSI-K8T soundcard on\n"); + } else { + printk(KERN_INFO "PCI: Unexpected Value in PCI-Register: " + "no Change!\n"); + } + +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge); + +/* * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge * is not activated. The myth is that Asus said that they do not want the * users to be irritated by just another PCI Device in the Win98 device diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index cba6c9e..61cb4b2 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig @@ -250,7 +250,7 @@ config M32R_CFC_NUM config PCMCIA_VRC4171 tristate "NEC VRC4171 Card Controllers support" - depends on VRC4171 && PCMCIA + depends on CPU_VR41XX && ISA && PCMCIA config PCMCIA_VRC4173 tristate "NEC VRC4173 CARDU support" diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index ae10d1e..48d3b3d 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -236,11 +236,11 @@ static void pcmcia_check_driver(struct p /** * pcmcia_load_firmware - load CIS from userspace if device-provided is broken * @dev - the pcmcia device which needs a CIS override - * @filename - requested filename in /lib/firmware/cis/ + * @filename - requested filename in /lib/firmware/ * * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if * the one provided by the card is broken. The firmware files reside in - * /lib/firmware/cis/ in userspace. + * /lib/firmware/ in userspace. */ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) { @@ -298,9 +298,6 @@ static inline int pcmcia_load_firmware(s * * Registers a PCMCIA driver with the PCMCIA bus core. */ -static int pcmcia_device_probe(struct device *dev); -static int pcmcia_device_remove(struct device * dev); - int pcmcia_register_driver(struct pcmcia_driver *driver) { if (!driver) @@ -400,7 +397,7 @@ static int pcmcia_device_probe(struct de * call which will then check whether there are two * pseudo devices, and if not, add the second one. */ - did = (struct pcmcia_device_id *) p_dev->dev.driver_data; + did = p_dev->dev.driver_data; if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) pcmcia_add_pseudo_device(p_dev->socket); @@ -448,7 +445,6 @@ static void pcmcia_card_remove(struct pc return; } - static int pcmcia_device_remove(struct device * dev) { struct pcmcia_device *p_dev; @@ -463,7 +459,7 @@ static int pcmcia_device_remove(struct d * pseudo multi-function card, we need to unbind * all devices */ - did = (struct pcmcia_device_id *) p_dev->dev.driver_data; + did = p_dev->dev.driver_data; if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && (p_dev->socket->device_count != 0) && (p_dev->device_no == 0)) @@ -476,6 +472,8 @@ static int pcmcia_device_remove(struct d if (p_drv->remove) p_drv->remove(p_dev); + p_dev->dev_node = NULL; + /* check for proper unloading */ if (p_dev->_irq || p_dev->_io || p_dev->_locked) printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", @@ -628,7 +626,7 @@ struct pcmcia_device * pcmcia_device_add } /* Add to the list in pcmcia_bus_socket */ - list_add_tail(&p_dev->socket_device_list, &s->devices_list); + list_add(&p_dev->socket_device_list, &s->devices_list); spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 45063b4..3131bb0 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -88,7 +88,6 @@ static int alloc_io_space(struct pcmcia_ } if ((s->features & SS_CAP_STATIC_MAP) && s->io_offset) { *base = s->io_offset | (*base & 0x0fff); - s->io[0].res->flags = (s->io[0].res->flags & ~IORESOURCE_BITS) | (attr & IORESOURCE_BITS); return 0; } /* Check for an already-allocated window that must conflict with @@ -209,7 +208,6 @@ int pccard_get_configuration_info(struct if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; - config->Function = p_dev->func; #ifdef CONFIG_CARDBUS if (s->state & SOCKET_CARDBUS) { @@ -223,14 +221,22 @@ int pccard_get_configuration_info(struct config->AssignedIRQ = s->irq.AssignedIRQ; if (config->AssignedIRQ) config->Attributes |= CONF_ENABLE_IRQ; - config->BasePort1 = s->io[0].res->start; - config->NumPorts1 = s->io[0].res->end - config->BasePort1 + 1; + if (s->io[0].res) { + config->BasePort1 = s->io[0].res->start; + config->NumPorts1 = s->io[0].res->end - config->BasePort1 + 1; + } } return CS_SUCCESS; } #endif - c = (p_dev) ? p_dev->function_config : NULL; + if (p_dev) { + c = p_dev->function_config; + config->Function = p_dev->func; + } else { + c = NULL; + config->Function = 0; + } if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { config->Attributes = 0; @@ -947,7 +953,5 @@ void pcmcia_disable_device(struct pcmcia pcmcia_release_irq(p_dev, &p_dev->irq); if (&p_dev->win) pcmcia_release_window(p_dev->win); - - p_dev->dev_node = NULL; } EXPORT_SYMBOL(pcmcia_disable_device); diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index c4256aa..6fff109 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c @@ -479,7 +479,7 @@ int pnp_auto_config_dev(struct pnp_dev * int pnp_start_dev(struct pnp_dev *dev) { if (!pnp_can_write(dev)) { - pnp_info("Device %s does not supported activation.", dev->dev.bus_id); + pnp_info("Device %s does not support activation.", dev->dev.bus_id); return -EINVAL; } @@ -503,7 +503,7 @@ int pnp_start_dev(struct pnp_dev *dev) int pnp_stop_dev(struct pnp_dev *dev) { if (!pnp_can_disable(dev)) { - pnp_info("Device %s does not supported disabling.", dev->dev.bus_id); + pnp_info("Device %s does not support disabling.", dev->dev.bus_id); return -EINVAL; } if (dev->protocol->disable(dev)<0) { diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c index e9c10c0..321a40f 100644 --- a/drivers/serial/m32r_sio.c +++ b/drivers/serial/m32r_sio.c @@ -1057,7 +1057,6 @@ static void m32r_sio_console_write(struc { struct uart_sio_port *up = &m32r_sio_ports[co->index]; unsigned int ier; - int i; /* * First save the UER then disable the interrupts diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 42b4570..0eb010a 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c @@ -1614,6 +1614,7 @@ static int activate_ep_files (struct dev data, &ep_config_operations, &data->dentry); if (!data->inode) { + usb_ep_free_request(ep, data->req); kfree (data); goto enomem; } diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 9a6b5b3..387a18a 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c @@ -2265,7 +2265,7 @@ static struct bin_attribute edid2_attr = }; -static int radeonfb_pci_register (struct pci_dev *pdev, +static int __devinit radeonfb_pci_register (struct pci_dev *pdev, const struct pci_device_id *ent) { struct fb_info *info; diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 8d8eadb..372aa17 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -674,13 +674,19 @@ fb_write(struct file *file, const char _ total_size = info->fix.smem_len; if (p > total_size) - return 0; + return -EFBIG; - if (count >= total_size) + if (count > total_size) { + err = -EFBIG; count = total_size; + } + + if (count + p > total_size) { + if (!err) + err = -ENOSPC; - if (count + p > total_size) count = total_size - p; + } buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL); @@ -722,7 +728,7 @@ fb_write(struct file *file, const char _ kfree(buffer); - return (err) ? err : cnt; + return (cnt) ? cnt : err; } #ifdef CONFIG_KMOD diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c index 5fe1979..4e96393 100644 --- a/drivers/video/pm2fb.c +++ b/drivers/video/pm2fb.c @@ -73,8 +73,8 @@ static char *mode __devinitdata = NULL; * these flags allow the user to specify that requests for +ve sync * should be silently turned in -ve sync. */ -static int lowhsync __devinitdata = 0; -static int lowvsync __devinitdata = 0; +static int lowhsync; +static int lowvsync; /* * The hardware state of the graphics card that isn't part of the diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 10e6b3a..0da624e 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c @@ -73,7 +73,7 @@ /* --------------------------------------------------------------------- */ -static char *mode_option __initdata = NULL; +static char *mode_option __devinitdata = NULL; #ifdef MODULE @@ -1545,7 +1545,7 @@ static int __devinit savage_map_mmio (st return 0; } -static void __devinit savage_unmap_mmio (struct fb_info *info) +static void savage_unmap_mmio (struct fb_info *info) { struct savagefb_par *par = info->par; DBG ("savage_unmap_mmio"); @@ -1597,7 +1597,7 @@ static int __devinit savage_map_video (s return 0; } -static void __devinit savage_unmap_video (struct fb_info *info) +static void savage_unmap_video (struct fb_info *info) { struct savagefb_par *par = info->par; @@ -1614,7 +1614,7 @@ static void __devinit savage_unmap_video } } -static int __devinit savage_init_hw (struct savagefb_par *par) +static int savage_init_hw (struct savagefb_par *par) { unsigned char config1, m, n, n1, n2, sr8, cr3f, cr66 = 0, tmp; diff --git a/fs/Kconfig b/fs/Kconfig index 2524629..f9b5842 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -842,6 +842,12 @@ config TMPFS config HUGETLBFS bool "HugeTLB file system support" depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || BROKEN + help + hugetlbfs is a filesystem backing for HugeTLB pages, based on + ramfs. For architectures that support it, say Y here and read + for details. + + If unsure, say N. config HUGETLB_PAGE def_bool HUGETLBFS diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 8a2de03..1a27ecb 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES @@ -1,7 +1,11 @@ Version 1.42 ------------ Fix slow oplock break when mounted to different servers at the same time and -the tids match and we try to find matching fid on wrong server. +the tids match and we try to find matching fid on wrong server. Fix read +looping when signing required by server (2.6.16 kernel only). Fix readdir +vs. rename race which could cause each to hang. Return . and .. even +if server does not. Allow searches to skip first three entries and +begin at any location. Fix oops in find_writeable_file. Version 1.41 ------------ diff --git a/fs/cifs/README b/fs/cifs/README index b2b4d08..0355003 100644 --- a/fs/cifs/README +++ b/fs/cifs/README @@ -511,6 +511,14 @@ LinuxExtensionsEnabled If set to one the support and want to map the uid and gid fields to values supplied at mount (rather than the actual values, then set this to zero. (default 1) +Experimental When set to 1 used to enable certain experimental + features (currently enables multipage writes + when signing is enabled, the multipage write + performance enhancement was disabled when + signing turned on in case buffer was modified + just before it was sent, also this flag will + be used to use the new experimental sessionsetup + code). These experimental features and tracing can be enabled by changing flags in /proc/fs/cifs (after the cifs module has been installed or built into the diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index d4b713e..c262d88 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "cifsfs.h" #include "cifspdu.h" #define DECLARE_GLOBALS_HERE @@ -75,9 +76,6 @@ unsigned int cifs_max_pending = CIFS_MAX module_param(cifs_max_pending, int, 0); MODULE_PARM_DESC(cifs_max_pending,"Simultaneous requests to server. Default: 50 Range: 2 to 256"); -static DECLARE_COMPLETION(cifs_oplock_exited); -static DECLARE_COMPLETION(cifs_dnotify_exited); - extern mempool_t *cifs_sm_req_poolp; extern mempool_t *cifs_req_poolp; extern mempool_t *cifs_mid_poolp; @@ -841,10 +839,6 @@ static int cifs_oplock_thread(void * dum __u16 netfid; int rc; - daemonize("cifsoplockd"); - allow_signal(SIGTERM); - - oplockThread = current; do { if (try_to_freeze()) continue; @@ -900,9 +894,9 @@ static int cifs_oplock_thread(void * dum set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); /* yield in case q were corrupt */ } - } while(!signal_pending(current)); - oplockThread = NULL; - complete_and_exit (&cifs_oplock_exited, 0); + } while (!kthread_should_stop()); + + return 0; } static int cifs_dnotify_thread(void * dummyarg) @@ -910,10 +904,6 @@ static int cifs_dnotify_thread(void * du struct list_head *tmp; struct cifsSesInfo *ses; - daemonize("cifsdnotifyd"); - allow_signal(SIGTERM); - - dnotifyThread = current; do { if(try_to_freeze()) continue; @@ -931,8 +921,9 @@ static int cifs_dnotify_thread(void * du wake_up_all(&ses->server->response_q); } read_unlock(&GlobalSMBSeslock); - } while(!signal_pending(current)); - complete_and_exit (&cifs_dnotify_exited, 0); + } while (!kthread_should_stop()); + + return 0; } static int __init @@ -982,32 +973,48 @@ init_cifs(void) } rc = cifs_init_inodecache(); - if (!rc) { - rc = cifs_init_mids(); - if (!rc) { - rc = cifs_init_request_bufs(); - if (!rc) { - rc = register_filesystem(&cifs_fs_type); - if (!rc) { - rc = (int)kernel_thread(cifs_oplock_thread, NULL, - CLONE_FS | CLONE_FILES | CLONE_VM); - if(rc > 0) { - rc = (int)kernel_thread(cifs_dnotify_thread, NULL, - CLONE_FS | CLONE_FILES | CLONE_VM); - if(rc > 0) - return 0; - else - cERROR(1,("error %d create dnotify thread", rc)); - } else { - cERROR(1,("error %d create oplock thread",rc)); - } - } - cifs_destroy_request_bufs(); - } - cifs_destroy_mids(); - } - cifs_destroy_inodecache(); + if (rc) + goto out_clean_proc; + + rc = cifs_init_mids(); + if (rc) + goto out_destroy_inodecache; + + rc = cifs_init_request_bufs(); + if (rc) + goto out_destroy_mids; + + rc = register_filesystem(&cifs_fs_type); + if (rc) + goto out_destroy_request_bufs; + + oplockThread = kthread_run(cifs_oplock_thread, NULL, "cifsoplockd"); + if (IS_ERR(oplockThread)) { + rc = PTR_ERR(oplockThread); + cERROR(1,("error %d create oplock thread", rc)); + goto out_unregister_filesystem; + } + + dnotifyThread = kthread_run(cifs_dnotify_thread, NULL, "cifsdnotifyd"); + if (IS_ERR(dnotifyThread)) { + rc = PTR_ERR(dnotifyThread); + cERROR(1,("error %d create dnotify thread", rc)); + goto out_stop_oplock_thread; } + + return 0; + + out_stop_oplock_thread: + kthread_stop(oplockThread); + out_unregister_filesystem: + unregister_filesystem(&cifs_fs_type); + out_destroy_request_bufs: + cifs_destroy_request_bufs(); + out_destroy_mids: + cifs_destroy_mids(); + out_destroy_inodecache: + cifs_destroy_inodecache(); + out_clean_proc: #ifdef CONFIG_PROC_FS cifs_proc_clean(); #endif @@ -1025,14 +1032,8 @@ exit_cifs(void) cifs_destroy_inodecache(); cifs_destroy_mids(); cifs_destroy_request_bufs(); - if(oplockThread) { - send_sig(SIGTERM, oplockThread, 1); - wait_for_completion(&cifs_oplock_exited); - } - if(dnotifyThread) { - send_sig(SIGTERM, dnotifyThread, 1); - wait_for_completion(&cifs_dnotify_exited); - } + kthread_stop(oplockThread); + kthread_stop(dnotifyThread); } MODULE_AUTHOR("Steve French "); diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index d705500..fd36892 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -3119,7 +3119,7 @@ findFirstRetry: psrch_inf->endOfSearch = FALSE; psrch_inf->entries_in_buffer = le16_to_cpu(parms->SearchCount); - psrch_inf->index_of_last_entry = + psrch_inf->index_of_last_entry = 2 /* skip . and .. */ + psrch_inf->entries_in_buffer; *pnetfid = parms->SearchHandle; } else { diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 0b86d5c..d2ec806 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3447,6 +3447,12 @@ int cifs_setup_session(unsigned int xid, pSesInfo->server->secMode, pSesInfo->server->capabilities, pSesInfo->server->timeZone)); +#ifdef CONFIG_CIFS_EXPERIMENTAL + if(experimEnabled > 1) + rc = CIFS_SessSetup(xid, pSesInfo, CIFS_NTLM /* type */, + &ntlmv2_flag, nls_info); + else +#endif if (extended_security && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY) && (pSesInfo->server->secType == NTLMSSP)) { diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 1d0ca3e..82315ed 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -139,9 +139,7 @@ cifs_create(struct inode *inode, struct cifs_sb = CIFS_SB(inode->i_sb); pTcon = cifs_sb->tcon; - mutex_lock(&direntry->d_sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(direntry); - mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex); if(full_path == NULL) { FreeXid(xid); return -ENOMEM; @@ -316,9 +314,7 @@ int cifs_mknod(struct inode *inode, stru cifs_sb = CIFS_SB(inode->i_sb); pTcon = cifs_sb->tcon; - mutex_lock(&direntry->d_sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(direntry); - mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex); if(full_path == NULL) rc = -ENOMEM; else if (pTcon->ses->capabilities & CAP_UNIX) { @@ -440,6 +436,20 @@ cifs_lookup(struct inode *parent_dir_ino cifs_sb = CIFS_SB(parent_dir_inode->i_sb); pTcon = cifs_sb->tcon; + /* + * Don't allow the separator character in a path component. + * The VFS will not allow "/", but "\" is allowed by posix. + */ + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)) { + int i; + for (i = 0; i < direntry->d_name.len; i++) + if (direntry->d_name.name[i] == '\\') { + cFYI(1, ("Invalid file name")); + FreeXid(xid); + return ERR_PTR(-EINVAL); + } + } + /* can not grab the rename sem here since it would deadlock in the cases (beginning of sys_rename itself) in which we already have the sb rename sem */ diff --git a/fs/cifs/fcntl.c b/fs/cifs/fcntl.c index ec4dfe9..633a938 100644 --- a/fs/cifs/fcntl.c +++ b/fs/cifs/fcntl.c @@ -86,9 +86,7 @@ int cifs_dir_notify(struct file * file, cifs_sb = CIFS_SB(file->f_dentry->d_sb); pTcon = cifs_sb->tcon; - mutex_lock(&file->f_dentry->d_sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(file->f_dentry); - mutex_unlock(&file->f_dentry->d_sb->s_vfs_rename_mutex); if(full_path == NULL) { rc = -ENOMEM; diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 5c497c5..e152bf6 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -203,9 +203,7 @@ int cifs_open(struct inode *inode, struc } } - mutex_lock(&inode->i_sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(file->f_dentry); - mutex_unlock(&inode->i_sb->s_vfs_rename_mutex); if (full_path == NULL) { FreeXid(xid); return -ENOMEM; @@ -906,8 +904,7 @@ static ssize_t cifs_write(struct file *f if (rc != 0) break; } - /* BB FIXME We can not sign across two buffers yet */ - if((pTcon->ses->server->secMode & + if(experimEnabled || (pTcon->ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) == 0) { struct kvec iov[2]; unsigned int len; @@ -923,13 +920,13 @@ static ssize_t cifs_write(struct file *f *poffset, &bytes_written, iov, 1, long_op); } else - /* BB FIXME fixup indentation of line below */ - rc = CIFSSMBWrite(xid, pTcon, - open_file->netfid, - min_t(const int, cifs_sb->wsize, - write_size - total_written), - *poffset, &bytes_written, - write_data + total_written, NULL, long_op); + rc = CIFSSMBWrite(xid, pTcon, + open_file->netfid, + min_t(const int, cifs_sb->wsize, + write_size - total_written), + *poffset, &bytes_written, + write_data + total_written, + NULL, long_op); } if (rc || (bytes_written == 0)) { if (total_written) @@ -968,6 +965,16 @@ struct cifsFileInfo *find_writable_file( struct cifsFileInfo *open_file; int rc; + /* Having a null inode here (because mapping->host was set to zero by + the VFS or MM) should not happen but we had reports of on oops (due to + it being zero) during stress testcases so we need to check for it */ + + if(cifs_inode == NULL) { + cERROR(1,("Null inode passed to cifs_writeable_file")); + dump_stack(); + return NULL; + } + read_lock(&GlobalSMBSeslock); list_for_each_entry(open_file, &cifs_inode->openFileList, flist) { if (open_file->closePend) @@ -1093,12 +1100,11 @@ static int cifs_writepages(struct addres if (cifs_sb->wsize < PAGE_CACHE_SIZE) return generic_writepages(mapping, wbc); - /* BB FIXME we do not have code to sign across multiple buffers yet, - so go to older writepage style write which we can sign if needed */ if((cifs_sb->tcon->ses) && (cifs_sb->tcon->ses->server)) if(cifs_sb->tcon->ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) - return generic_writepages(mapping, wbc); + if(!experimEnabled) + return generic_writepages(mapping, wbc); /* * BB: Is this meaningful for a non-block-device file system? diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 957ddd1..4093764 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -722,9 +722,7 @@ int cifs_mkdir(struct inode *inode, stru cifs_sb = CIFS_SB(inode->i_sb); pTcon = cifs_sb->tcon; - mutex_lock(&inode->i_sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(direntry); - mutex_unlock(&inode->i_sb->s_vfs_rename_mutex); if (full_path == NULL) { FreeXid(xid); return -ENOMEM; @@ -807,9 +805,7 @@ int cifs_rmdir(struct inode *inode, stru cifs_sb = CIFS_SB(inode->i_sb); pTcon = cifs_sb->tcon; - mutex_lock(&inode->i_sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(direntry); - mutex_unlock(&inode->i_sb->s_vfs_rename_mutex); if (full_path == NULL) { FreeXid(xid); return -ENOMEM; @@ -1141,9 +1137,7 @@ int cifs_setattr(struct dentry *direntry rc = 0; } - mutex_lock(&direntry->d_sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(direntry); - mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex); if (full_path == NULL) { FreeXid(xid); return -ENOMEM; diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 9562f5b..2ec99f8 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c @@ -48,10 +48,8 @@ cifs_hardlink(struct dentry *old_file, s /* No need to check for cross device links since server will do that BB note DFS case in future though (when we may have to check) */ - mutex_lock(&inode->i_sb->s_vfs_rename_mutex); fromName = build_path_from_dentry(old_file); toName = build_path_from_dentry(direntry); - mutex_unlock(&inode->i_sb->s_vfs_rename_mutex); if((fromName == NULL) || (toName == NULL)) { rc = -ENOMEM; goto cifs_hl_exit; @@ -103,9 +101,7 @@ cifs_follow_link(struct dentry *direntry xid = GetXid(); - mutex_lock(&direntry->d_sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(direntry); - mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex); if (!full_path) goto out_no_free; @@ -164,9 +160,7 @@ cifs_symlink(struct inode *inode, struct cifs_sb = CIFS_SB(inode->i_sb); pTcon = cifs_sb->tcon; - mutex_lock(&inode->i_sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(direntry); - mutex_unlock(&inode->i_sb->s_vfs_rename_mutex); if(full_path == NULL) { FreeXid(xid); diff --git a/fs/cifs/ntlmssp.c b/fs/cifs/ntlmssp.c index 78866f9..115359c 100644 --- a/fs/cifs/ntlmssp.c +++ b/fs/cifs/ntlmssp.c @@ -121,6 +121,20 @@ CIFS_SessSetup(unsigned int xid, struct } + /* copy session key */ + + /* if Unicode, align strings to two byte boundary */ + + /* copy user name */ /* BB Do we need to special case null user name? */ + + /* copy domain name */ + + /* copy Linux version */ + + /* copy network operating system name */ + + /* update bcc and smb buffer length */ + /* rc = SendReceive2(xid, ses, iov, num_iovecs, &resp_buf_type, 0); */ /* SMB request buf freed in SendReceive2 */ diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 2f6e282..b689c50 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c @@ -404,9 +404,7 @@ static int initiate_cifs_search(const in if(pTcon == NULL) return -EINVAL; - mutex_lock(&file->f_dentry->d_sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(file->f_dentry); - mutex_unlock(&file->f_dentry->d_sb->s_vfs_rename_mutex); if(full_path == NULL) { return -ENOMEM; @@ -592,6 +590,13 @@ static int find_cifs_entry(const int xid first_entry_in_buffer = cifsFile->srch_inf.index_of_last_entry - cifsFile->srch_inf.entries_in_buffer; + + /* if first entry in buf is zero then is first buffer + in search response data which means it is likely . and .. + will be in this buffer, although some servers do not return + . and .. for the root of a drive and for those we need + to start two entries earlier */ + /* dump_cifs_file_struct(file, "In fce ");*/ if(((index_to_find < cifsFile->srch_inf.index_of_last_entry) && is_dir_changed(file)) || @@ -634,23 +639,14 @@ static int find_cifs_entry(const int xid char * end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + smbCalcSize((struct smb_hdr *) cifsFile->srch_inf.ntwrk_buf_start); + + current_entry = cifsFile->srch_inf.srch_entries_start; first_entry_in_buffer = cifsFile->srch_inf.index_of_last_entry - cifsFile->srch_inf.entries_in_buffer; pos_in_buf = index_to_find - first_entry_in_buffer; cFYI(1,("found entry - pos_in_buf %d",pos_in_buf)); - current_entry = cifsFile->srch_inf.srch_entries_start; for(i=0;(i<(pos_in_buf)) && (current_entry != NULL);i++) { /* go entry by entry figuring out which is first */ - /* if( . or ..) - skip */ - rc = cifs_entry_is_dot(current_entry,cifsFile); - if(rc == 1) /* is . or .. so skip */ { - cFYI(1,("Entry is .")); /* BB removeme BB */ - /* continue; */ - } else if (rc == 2 ) { - cFYI(1,("Entry is ..")); /* BB removeme BB */ - /* continue; */ - } current_entry = nxt_dir_entry(current_entry,end_of_smb); } if((current_entry == NULL) && (i < pos_in_buf)) { @@ -770,6 +766,11 @@ static int cifs_filldir(char *pfindEntry if(file->f_dentry == NULL) return -ENOENT; + rc = cifs_entry_is_dot(pfindEntry,pCifsF); + /* skip . and .. since we added them first */ + if(rc != 0) + return 0; + cifs_sb = CIFS_SB(file->f_dentry->d_sb); qstring.name = scratch_buf; @@ -898,22 +899,22 @@ int cifs_readdir(struct file *file, void switch ((int) file->f_pos) { case 0: - /*if (filldir(direntry, ".", 1, file->f_pos, + if (filldir(direntry, ".", 1, file->f_pos, file->f_dentry->d_inode->i_ino, DT_DIR) < 0) { - cERROR(1, ("Filldir for current dir failed ")); + cERROR(1, ("Filldir for current dir failed")); rc = -ENOMEM; break; } - file->f_pos++; */ + file->f_pos++; case 1: - /* if (filldir(direntry, "..", 2, file->f_pos, + if (filldir(direntry, "..", 2, file->f_pos, file->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) { cERROR(1, ("Filldir for parent dir failed ")); rc = -ENOMEM; break; } - file->f_pos++; */ - case 2: + file->f_pos++; + default: /* 1) If search is active, is in current search buffer? if it before then restart search @@ -927,7 +928,6 @@ int cifs_readdir(struct file *file, void return rc; } } - default: if(file->private_data == NULL) { rc = -EINVAL; FreeXid(xid); @@ -947,8 +947,6 @@ int cifs_readdir(struct file *file, void kfree(cifsFile->search_resume_name); cifsFile->search_resume_name = NULL; */ - /* BB account for . and .. in f_pos as special case */ - rc = find_cifs_entry(xid,pTcon, file, ¤t_entry,&num_to_fill); if(rc) { @@ -977,7 +975,8 @@ int cifs_readdir(struct file *file, void num_to_fill, i)); break; } - + /* if buggy server returns . and .. late do + we want to check for that here? */ rc = cifs_filldir(current_entry, file, filldir, direntry,tmp_buf); file->f_pos++; diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 3938444..7754d64 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c @@ -62,9 +62,7 @@ int cifs_removexattr(struct dentry * dir cifs_sb = CIFS_SB(sb); pTcon = cifs_sb->tcon; - mutex_lock(&sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(direntry); - mutex_unlock(&sb->s_vfs_rename_mutex); if(full_path == NULL) { FreeXid(xid); return -ENOMEM; @@ -116,9 +114,7 @@ int cifs_setxattr(struct dentry * dirent cifs_sb = CIFS_SB(sb); pTcon = cifs_sb->tcon; - mutex_lock(&sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(direntry); - mutex_unlock(&sb->s_vfs_rename_mutex); if(full_path == NULL) { FreeXid(xid); return -ENOMEM; @@ -223,9 +219,7 @@ ssize_t cifs_getxattr(struct dentry * di cifs_sb = CIFS_SB(sb); pTcon = cifs_sb->tcon; - mutex_lock(&sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(direntry); - mutex_unlock(&sb->s_vfs_rename_mutex); if(full_path == NULL) { FreeXid(xid); return -ENOMEM; @@ -341,9 +335,7 @@ ssize_t cifs_listxattr(struct dentry * d cifs_sb = CIFS_SB(sb); pTcon = cifs_sb->tcon; - mutex_lock(&sb->s_vfs_rename_mutex); full_path = build_path_from_dentry(direntry); - mutex_unlock(&sb->s_vfs_rename_mutex); if(full_path == NULL) { FreeXid(xid); return -ENOMEM; diff --git a/fs/compat.c b/fs/compat.c index 7f8e26e..2e32bd3 100644 --- a/fs/compat.c +++ b/fs/compat.c @@ -1217,6 +1217,10 @@ static ssize_t compat_do_readv_writev(in if (ret < 0) goto out; + ret = security_file_permission(file, type == READ ? MAY_READ:MAY_WRITE); + if (ret) + goto out; + fnv = NULL; if (type == READ) { fn = file->f_op->read; diff --git a/fs/exec.c b/fs/exec.c index 4121bb5..3a79d97 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -712,7 +712,7 @@ static int de_thread(struct task_struct attach_pid(current, PIDTYPE_PID, current->pid); attach_pid(current, PIDTYPE_PGID, current->signal->pgrp); attach_pid(current, PIDTYPE_SID, current->signal->session); - list_add_tail(¤t->tasks, &init_task.tasks); + list_add_tail_rcu(¤t->tasks, &init_task.tasks); current->group_leader = current; leader->group_leader = current; diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index aaf1da1..8c22aa9 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c @@ -48,6 +48,7 @@ int ext3_ioctl (struct inode * inode, st if (!S_ISDIR(inode->i_mode)) flags &= ~EXT3_DIRSYNC_FL; + mutex_lock(&inode->i_mutex); oldflags = ei->i_flags; /* The JOURNAL_DATA flag is modifiable only by root */ @@ -60,8 +61,10 @@ int ext3_ioctl (struct inode * inode, st * This test looks nicer. Thanks to Pauline Middelink */ if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) { - if (!capable(CAP_LINUX_IMMUTABLE)) + if (!capable(CAP_LINUX_IMMUTABLE)) { + mutex_unlock(&inode->i_mutex); return -EPERM; + } } /* @@ -69,14 +72,18 @@ int ext3_ioctl (struct inode * inode, st * the relevant capability. */ if ((jflag ^ oldflags) & (EXT3_JOURNAL_DATA_FL)) { - if (!capable(CAP_SYS_RESOURCE)) + if (!capable(CAP_SYS_RESOURCE)) { + mutex_unlock(&inode->i_mutex); return -EPERM; + } } handle = ext3_journal_start(inode, 1); - if (IS_ERR(handle)) + if (IS_ERR(handle)) { + mutex_unlock(&inode->i_mutex); return PTR_ERR(handle); + } if (IS_SYNC(inode)) handle->h_sync = 1; err = ext3_reserve_inode_write(handle, inode, &iloc); @@ -93,11 +100,14 @@ int ext3_ioctl (struct inode * inode, st err = ext3_mark_iloc_dirty(handle, inode, &iloc); flags_err: ext3_journal_stop(handle); - if (err) + if (err) { + mutex_unlock(&inode->i_mutex); return err; + } if ((jflag ^ oldflags) & (EXT3_JOURNAL_DATA_FL)) err = ext3_change_inode_journal_flag(inode, jflag); + mutex_unlock(&inode->i_mutex); return err; } case EXT3_IOC_GETVERSION: diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index c5ffa85..8aac533 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c @@ -213,7 +213,7 @@ static int setup_new_group_blocks(struct goto exit_bh; } lock_buffer(bh); - memcpy(gdb->b_data, sbi->s_group_desc[i], bh->b_size); + memcpy(gdb->b_data, sbi->s_group_desc[i]->b_data, bh->b_size); set_buffer_uptodate(gdb); unlock_buffer(bh); ext3_journal_dirty_metadata(handle, gdb); diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index cc750c6..104a62d 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -128,14 +128,24 @@ void fuse_put_request(struct fuse_conn * } } -void fuse_remove_background(struct fuse_conn *fc, struct fuse_req *req) +/* + * Called with sbput_sem held for read (request_end) or write + * (fuse_put_super). By the time fuse_put_super() is finished, all + * inodes belonging to background requests must be released, so the + * iputs have to be done within the locked region. + */ +void fuse_release_background(struct fuse_conn *fc, struct fuse_req *req) { - list_del_init(&req->bg_entry); + iput(req->inode); + iput(req->inode2); + spin_lock(&fc->lock); + list_del(&req->bg_entry); if (fc->num_background == FUSE_MAX_BACKGROUND) { fc->blocked = 0; wake_up_all(&fc->blocked_waitq); } fc->num_background--; + spin_unlock(&fc->lock); } /* @@ -165,27 +175,22 @@ static void request_end(struct fuse_conn wake_up(&req->waitq); fuse_put_request(fc, req); } else { - struct inode *inode = req->inode; - struct inode *inode2 = req->inode2; - struct file *file = req->file; void (*end) (struct fuse_conn *, struct fuse_req *) = req->end; req->end = NULL; - req->inode = NULL; - req->inode2 = NULL; - req->file = NULL; - if (!list_empty(&req->bg_entry)) - fuse_remove_background(fc, req); spin_unlock(&fc->lock); + down_read(&fc->sbput_sem); + if (fc->mounted) + fuse_release_background(fc, req); + up_read(&fc->sbput_sem); + + /* fput must go outside sbput_sem, otherwise it can deadlock */ + if (req->file) + fput(req->file); if (end) end(fc, req); else fuse_put_request(fc, req); - - if (file) - fput(file); - iput(inode); - iput(inode2); } } diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 59661c4..0474202 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -258,9 +258,15 @@ struct fuse_conn { /** waitq for blocked connection */ wait_queue_head_t blocked_waitq; + /** RW semaphore for exclusion with fuse_put_super() */ + struct rw_semaphore sbput_sem; + /** The next unique request id */ u64 reqctr; + /** Mount is active */ + unsigned mounted; + /** Connection established, cleared on umount, connection abort and device release */ unsigned connected; @@ -471,11 +477,11 @@ void request_send_noreply(struct fuse_co void request_send_background(struct fuse_conn *fc, struct fuse_req *req); /** - * Remove request from the the background list + * Release inodes and file associated with background request */ -void fuse_remove_background(struct fuse_conn *fc, struct fuse_req *req); +void fuse_release_background(struct fuse_conn *fc, struct fuse_req *req); -/** Abort all requests */ +/* Abort all requests */ void fuse_abort_conn(struct fuse_conn *fc); /** diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 43a6fc0..7627022 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -204,26 +204,17 @@ static void fuse_put_super(struct super_ { struct fuse_conn *fc = get_fuse_conn_super(sb); + down_write(&fc->sbput_sem); + while (!list_empty(&fc->background)) + fuse_release_background(fc, + list_entry(fc->background.next, + struct fuse_req, bg_entry)); + spin_lock(&fc->lock); + fc->mounted = 0; fc->connected = 0; - while (!list_empty(&fc->background)) { - struct fuse_req *req = list_entry(fc->background.next, - struct fuse_req, bg_entry); - struct inode *inode = req->inode; - struct inode *inode2 = req->inode2; - - /* File would hold a reference to vfsmount */ - BUG_ON(req->file); - req->inode = NULL; - req->inode2 = NULL; - fuse_remove_background(fc, req); - - spin_unlock(&fc->lock); - iput(inode); - iput(inode2); - spin_lock(&fc->lock); - } spin_unlock(&fc->lock); + up_write(&fc->sbput_sem); /* Flush all readers on this fs */ kill_fasync(&fc->fasync, SIGIO, POLL_IN); wake_up_all(&fc->waitq); @@ -395,6 +386,7 @@ static struct fuse_conn *new_conn(void) INIT_LIST_HEAD(&fc->processing); INIT_LIST_HEAD(&fc->io); INIT_LIST_HEAD(&fc->background); + init_rwsem(&fc->sbput_sem); kobj_set_kset_s(fc, connections_subsys); kobject_init(&fc->kobj); atomic_set(&fc->num_waiting, 0); @@ -508,11 +500,6 @@ static int fuse_fill_super(struct super_ if (file->f_op != &fuse_dev_operations) return -EINVAL; - /* Setting file->private_data can't race with other mount() - instances, since BKL is held for ->get_sb() */ - if (file->private_data) - return -EINVAL; - fc = new_conn(); if (!fc) return -ENOMEM; @@ -548,7 +535,14 @@ static int fuse_fill_super(struct super_ if (err) goto err_free_req; + /* Setting file->private_data can't race with other mount() + instances, since BKL is held for ->get_sb() */ + err = -EINVAL; + if (file->private_data) + goto err_kobject_del; + sb->s_root = root_dentry; + fc->mounted = 1; fc->connected = 1; kobject_get(&fc->kobj); file->private_data = fc; @@ -563,6 +557,8 @@ static int fuse_fill_super(struct super_ return 0; + err_kobject_del: + kobject_del(&fc->kobj); err_free_req: fuse_request_free(init_req); err_put_root: diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index d2b66ba..3ef7391 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c @@ -650,7 +650,7 @@ static void nlmsvc_grant_callback(struct svc_wake_up(block->b_daemon); } -void nlmsvc_grant_release(void *data) +static void nlmsvc_grant_release(void *data) { struct nlm_rqst *call = data; diff --git a/fs/locks.c b/fs/locks.c index dda83d6..efad798 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -2230,7 +2230,12 @@ void steal_locks(fl_owner_t from) lock_kernel(); j = 0; - rcu_read_lock(); + + /* + * We are not taking a ref to the file structures, so + * we need to acquire ->file_lock. + */ + spin_lock(&files->file_lock); fdt = files_fdtable(files); for (;;) { unsigned long set; @@ -2248,7 +2253,7 @@ void steal_locks(fl_owner_t from) set >>= 1; } } - rcu_read_unlock(); + spin_unlock(&files->file_lock); unlock_kernel(); } EXPORT_SYMBOL(steal_locks); diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index a23f348..cae74dd 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -128,15 +128,14 @@ struct inode_operations nfs4_dir_inode_o static int nfs_opendir(struct inode *inode, struct file *filp) { - int res = 0; + int res; dfprintk(VFS, "NFS: opendir(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino); lock_kernel(); /* Call generic open code in order to cache credentials */ - if (!res) - res = nfs_open(inode, filp); + res = nfs_open(inode, filp); unlock_kernel(); return res; } diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 0f583cb..3c72b0c 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -112,10 +112,9 @@ static void nfs_direct_write_complete(st */ ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs) { - struct dentry *dentry = iocb->ki_filp->f_dentry; - dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n", - dentry->d_name.name, (long long) pos, nr_segs); + iocb->ki_filp->f_dentry->d_name.name, + (long long) pos, nr_segs); return -EINVAL; } @@ -468,7 +467,6 @@ static const struct rpc_call_ops nfs_com static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) { struct nfs_write_data *data = dreq->commit_data; - struct rpc_task *task = &data->task; data->inode = dreq->inode; data->cred = dreq->ctx->cred; @@ -489,7 +487,7 @@ static void nfs_direct_commit_schedule(s /* Note: task.tk_ops->rpc_release will free dreq->commit_data */ dreq->commit_data = NULL; - dprintk("NFS: %5u initiated commit call\n", task->tk_pid); + dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid); lock_kernel(); rpc_execute(&data->task); diff --git a/fs/nfs/file.c b/fs/nfs/file.c index f1df2c8..fade02c 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -534,10 +534,9 @@ static int nfs_lock(struct file *filp, i */ static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl) { - struct inode * inode = filp->f_mapping->host; - dprintk("NFS: nfs_flock(f=%s/%ld, t=%x, fl=%x)\n", - inode->i_sb->s_id, inode->i_ino, + filp->f_dentry->d_inode->i_sb->s_id, + filp->f_dentry->d_inode->i_ino, fl->fl_type, fl->fl_flags); /* diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 2f7656b..d0b991a 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -700,12 +700,9 @@ static int nfs_show_stats(struct seq_fil /* * Display superblock I/O counters */ - for (cpu = 0; cpu < NR_CPUS; cpu++) { + for_each_possible_cpu(cpu) { struct nfs_iostats *stats; - if (!cpu_possible(cpu)) - continue; - preempt_disable(); stats = per_cpu_ptr(nfss->io_stats, cpu); diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 47ece1d..d86c0db 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1218,7 +1218,7 @@ out: return status; } -static void nfs4_intent_set_file(struct nameidata *nd, struct dentry *dentry, struct nfs4_state *state) +static int nfs4_intent_set_file(struct nameidata *nd, struct dentry *dentry, struct nfs4_state *state) { struct file *filp; @@ -1227,8 +1227,10 @@ static void nfs4_intent_set_file(struct struct nfs_open_context *ctx; ctx = (struct nfs_open_context *)filp->private_data; ctx->state = state; - } else - nfs4_close_state(state, nd->intent.open.flags); + return 0; + } + nfs4_close_state(state, nd->intent.open.flags); + return PTR_ERR(filp); } struct dentry * @@ -1835,7 +1837,7 @@ nfs4_proc_create(struct inode *dir, stru nfs_setattr_update_inode(state->inode, sattr); } if (status == 0 && nd != NULL && (nd->flags & LOOKUP_OPEN)) - nfs4_intent_set_file(nd, dentry, state); + status = nfs4_intent_set_file(nd, dentry, state); else nfs4_close_state(state, flags); out: diff --git a/fs/proc/base.c b/fs/proc/base.c index a3a3eec..6cc77dc 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -297,16 +297,20 @@ static int proc_fd_link(struct inode *in files = get_files_struct(task); if (files) { - rcu_read_lock(); + /* + * We are not taking a ref to the file structure, so we must + * hold ->file_lock. + */ + spin_lock(&files->file_lock); file = fcheck_files(files, fd); if (file) { *mnt = mntget(file->f_vfsmnt); *dentry = dget(file->f_dentry); - rcu_read_unlock(); + spin_unlock(&files->file_lock); put_files_struct(files); return 0; } - rcu_read_unlock(); + spin_unlock(&files->file_lock); put_files_struct(files); } return -ENOENT; @@ -1523,7 +1527,12 @@ static struct dentry *proc_lookupfd(stru if (!files) goto out_unlock; inode->i_mode = S_IFLNK; - rcu_read_lock(); + + /* + * We are not taking a ref to the file structure, so we must + * hold ->file_lock. + */ + spin_lock(&files->file_lock); file = fcheck_files(files, fd); if (!file) goto out_unlock2; @@ -1531,7 +1540,7 @@ static struct dentry *proc_lookupfd(stru inode->i_mode |= S_IRUSR | S_IXUSR; if (file->f_mode & 2) inode->i_mode |= S_IWUSR | S_IXUSR; - rcu_read_unlock(); + spin_unlock(&files->file_lock); put_files_struct(files); inode->i_op = &proc_pid_link_inode_operations; inode->i_size = 64; @@ -1541,7 +1550,7 @@ static struct dentry *proc_lookupfd(stru return NULL; out_unlock2: - rcu_read_unlock(); + spin_unlock(&files->file_lock); put_files_struct(files); out_unlock: iput(inode); diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index 58c418f..97ae1b9 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c @@ -408,8 +408,9 @@ int reiserfs_cache_default_acl(struct in acl = reiserfs_get_acl(inode, ACL_TYPE_DEFAULT); reiserfs_read_unlock_xattrs(inode->i_sb); reiserfs_read_unlock_xattr_i(inode); - ret = acl ? 1 : 0; - posix_acl_release(acl); + ret = (acl && !IS_ERR(acl)); + if (ret) + posix_acl_release(acl); } return ret; diff --git a/fs/splice.c b/fs/splice.c index 8d57e89..447ebc0 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -27,15 +27,22 @@ #include #include #include +#include + +struct partial_page { + unsigned int offset; + unsigned int len; +}; /* - * Passed to the actors + * Passed to splice_to_pipe */ -struct splice_desc { - unsigned int len, total_len; /* current and remaining length */ +struct splice_pipe_desc { + struct page **pages; /* page map */ + struct partial_page *partial; /* pages[] may not be contig */ + int nr_pages; /* number of pages in map */ unsigned int flags; /* splice flags */ - struct file *file; /* file to read/write */ - loff_t pos; /* file position */ + struct pipe_buf_operations *ops;/* ops associated with output pipe */ }; /* @@ -50,7 +57,8 @@ static int page_cache_pipe_buf_steal(str struct page *page = buf->page; struct address_space *mapping = page_mapping(page); - WARN_ON(!PageLocked(page)); + lock_page(page); + WARN_ON(!PageUptodate(page)); /* @@ -65,8 +73,10 @@ static int page_cache_pipe_buf_steal(str if (PagePrivate(page)) try_to_release_page(page, mapping_gfp_mask(mapping)); - if (!remove_mapping(mapping, page)) + if (!remove_mapping(mapping, page)) { + unlock_page(page); return 1; + } buf->flags |= PIPE_BUF_FLAG_STOLEN | PIPE_BUF_FLAG_LRU; return 0; @@ -125,6 +135,19 @@ static void page_cache_pipe_buf_unmap(st kunmap(buf->page); } +static void *user_page_pipe_buf_map(struct file *file, + struct pipe_inode_info *pipe, + struct pipe_buffer *buf) +{ + return kmap(buf->page); +} + +static void user_page_pipe_buf_unmap(struct pipe_inode_info *pipe, + struct pipe_buffer *buf) +{ + kunmap(buf->page); +} + static void page_cache_pipe_buf_get(struct pipe_inode_info *info, struct pipe_buffer *buf) { @@ -140,19 +163,33 @@ static struct pipe_buf_operations page_c .get = page_cache_pipe_buf_get, }; +static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe, + struct pipe_buffer *buf) +{ + return 1; +} + +static struct pipe_buf_operations user_page_pipe_buf_ops = { + .can_merge = 0, + .map = user_page_pipe_buf_map, + .unmap = user_page_pipe_buf_unmap, + .release = page_cache_pipe_buf_release, + .steal = user_page_pipe_buf_steal, + .get = page_cache_pipe_buf_get, +}; + /* * Pipe output worker. This sets up our pipe format with the page cache * pipe buffer operations. Otherwise very similar to the regular pipe_writev(). */ -static ssize_t move_to_pipe(struct pipe_inode_info *pipe, struct page **pages, - int nr_pages, unsigned long offset, - unsigned long len, unsigned int flags) +static ssize_t splice_to_pipe(struct pipe_inode_info *pipe, + struct splice_pipe_desc *spd) { - int ret, do_wakeup, i; + int ret, do_wakeup, page_nr; ret = 0; do_wakeup = 0; - i = 0; + page_nr = 0; if (pipe->inode) mutex_lock(&pipe->inode->i_mutex); @@ -168,27 +205,19 @@ static ssize_t move_to_pipe(struct pipe_ if (pipe->nrbufs < PIPE_BUFFERS) { int newbuf = (pipe->curbuf + pipe->nrbufs) & (PIPE_BUFFERS - 1); struct pipe_buffer *buf = pipe->bufs + newbuf; - struct page *page = pages[i++]; - unsigned long this_len; - this_len = PAGE_CACHE_SIZE - offset; - if (this_len > len) - this_len = len; - - buf->page = page; - buf->offset = offset; - buf->len = this_len; - buf->ops = &page_cache_pipe_buf_ops; + buf->page = spd->pages[page_nr]; + buf->offset = spd->partial[page_nr].offset; + buf->len = spd->partial[page_nr].len; + buf->ops = spd->ops; pipe->nrbufs++; + page_nr++; + ret += buf->len; + if (pipe->inode) do_wakeup = 1; - ret += this_len; - len -= this_len; - offset = 0; - if (!--nr_pages) - break; - if (!len) + if (!--spd->nr_pages) break; if (pipe->nrbufs < PIPE_BUFFERS) continue; @@ -196,7 +225,7 @@ static ssize_t move_to_pipe(struct pipe_ break; } - if (flags & SPLICE_F_NONBLOCK) { + if (spd->flags & SPLICE_F_NONBLOCK) { if (!ret) ret = -EAGAIN; break; @@ -231,8 +260,8 @@ static ssize_t move_to_pipe(struct pipe_ kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); } - while (i < nr_pages) - page_cache_release(pages[i++]); + while (page_nr < spd->nr_pages) + page_cache_release(spd->pages[page_nr++]); return ret; } @@ -243,15 +272,24 @@ __generic_file_splice_read(struct file * unsigned int flags) { struct address_space *mapping = in->f_mapping; - unsigned int offset, nr_pages; + unsigned int loff, nr_pages; struct page *pages[PIPE_BUFFERS]; + struct partial_page partial[PIPE_BUFFERS]; struct page *page; - pgoff_t index; - int i, error; + pgoff_t index, end_index; + loff_t isize; + size_t total_len; + int error; + struct splice_pipe_desc spd = { + .pages = pages, + .partial = partial, + .flags = flags, + .ops = &page_cache_pipe_buf_ops, + }; index = *ppos >> PAGE_CACHE_SHIFT; - offset = *ppos & ~PAGE_CACHE_MASK; - nr_pages = (len + offset + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; + loff = *ppos & ~PAGE_CACHE_MASK; + nr_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; if (nr_pages > PIPE_BUFFERS) nr_pages = PIPE_BUFFERS; @@ -261,14 +299,24 @@ __generic_file_splice_read(struct file * * read-ahead if this is a non-zero offset (we are likely doing small * chunk splice and the page is already there) for a single page. */ - if (!offset || nr_pages > 1) - do_page_cache_readahead(mapping, in, index, nr_pages); + if (!loff || spd.nr_pages > 1) + do_page_cache_readahead(mapping, in, index, spd.nr_pages); /* * Now fill in the holes: */ error = 0; - for (i = 0; i < nr_pages; i++, index++) { + total_len = 0; + for (spd.nr_pages = 0; spd.nr_pages < nr_pages; spd.nr_pages++, index++) { + unsigned int this_len; + + if (!len) + break; + + /* + * this_len is the max we'll use from this page + */ + this_len = min_t(unsigned long, len, PAGE_CACHE_SIZE - loff); find_page: /* * lookup the page for this index @@ -276,14 +324,6 @@ find_page: page = find_get_page(mapping, index); if (!page) { /* - * If in nonblock mode then dont block on - * readpage (we've kicked readahead so there - * will be asynchronous progress): - */ - if (flags & SPLICE_F_NONBLOCK) - break; - - /* * page didn't exist, allocate one */ page = page_cache_alloc_cold(mapping); @@ -304,6 +344,13 @@ find_page: * If the page isn't uptodate, we may need to start io on it */ if (!PageUptodate(page)) { + /* + * If in nonblock mode then dont block on waiting + * for an in-flight io page + */ + if (flags & SPLICE_F_NONBLOCK) + break; + lock_page(page); /* @@ -336,13 +383,46 @@ readpage: goto find_page; break; } + + /* + * i_size must be checked after ->readpage(). + */ + isize = i_size_read(mapping->host); + end_index = (isize - 1) >> PAGE_CACHE_SHIFT; + if (unlikely(!isize || index > end_index)) { + page_cache_release(page); + break; + } + + /* + * if this is the last page, see if we need to shrink + * the length and stop + */ + if (end_index == index) { + loff = PAGE_CACHE_SIZE - (isize & ~PAGE_CACHE_MASK); + if (total_len + loff > isize) { + page_cache_release(page); + break; + } + /* + * force quit after adding this page + */ + nr_pages = spd.nr_pages; + this_len = min(this_len, loff); + loff = 0; + } } fill_it: - pages[i] = page; + pages[spd.nr_pages] = page; + partial[spd.nr_pages].offset = loff; + partial[spd.nr_pages].len = this_len; + len -= this_len; + total_len += this_len; + loff = 0; } - if (i) - return move_to_pipe(pipe, pages, i, offset, len, flags); + if (spd.nr_pages) + return splice_to_pipe(pipe, &spd); return error; } @@ -369,17 +449,20 @@ ssize_t generic_file_splice_read(struct while (len) { ret = __generic_file_splice_read(in, ppos, pipe, len, flags); - if (ret <= 0) + if (ret < 0) break; + else if (!ret) { + if (spliced) + break; + if (flags & SPLICE_F_NONBLOCK) { + ret = -EAGAIN; + break; + } + } *ppos += ret; len -= ret; spliced += ret; - - if (!(flags & SPLICE_F_NONBLOCK)) - continue; - ret = -EAGAIN; - break; } if (spliced) @@ -392,14 +475,13 @@ EXPORT_SYMBOL(generic_file_splice_read); /* * Send 'sd->len' bytes to socket from 'sd->file' at position 'sd->pos' - * using sendpage(). + * using sendpage(). Return the number of bytes sent. */ static int pipe_to_sendpage(struct pipe_inode_info *info, struct pipe_buffer *buf, struct splice_desc *sd) { struct file *file = sd->file; loff_t pos = sd->pos; - unsigned int offset; ssize_t ret; void *ptr; int more; @@ -414,16 +496,13 @@ static int pipe_to_sendpage(struct pipe_ if (IS_ERR(ptr)) return PTR_ERR(ptr); - offset = pos & ~PAGE_CACHE_MASK; more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len; - ret = file->f_op->sendpage(file, buf->page, offset, sd->len, &pos,more); + ret = file->f_op->sendpage(file, buf->page, buf->offset, sd->len, + &pos, more); buf->ops->unmap(info, buf); - if (ret == sd->len) - return 0; - - return -EIO; + return ret; } /* @@ -452,7 +531,7 @@ static int pipe_to_file(struct pipe_inod struct file *file = sd->file; struct address_space *mapping = file->f_mapping; gfp_t gfp_mask = mapping_gfp_mask(mapping); - unsigned int offset; + unsigned int offset, this_len; struct page *page; pgoff_t index; char *src; @@ -468,20 +547,22 @@ static int pipe_to_file(struct pipe_inod index = sd->pos >> PAGE_CACHE_SHIFT; offset = sd->pos & ~PAGE_CACHE_MASK; + this_len = sd->len; + if (this_len + offset > PAGE_CACHE_SIZE) + this_len = PAGE_CACHE_SIZE - offset; + /* * Reuse buf page, if SPLICE_F_MOVE is set. */ if (sd->flags & SPLICE_F_MOVE) { /* * If steal succeeds, buf->page is now pruned from the vm - * side (LRU and page cache) and we can reuse it. + * side (LRU and page cache) and we can reuse it. The page + * will also be looked on successful return. */ if (buf->ops->steal(info, buf)) goto find_page; - /* - * this will also set the page locked - */ page = buf->page; if (add_to_page_cache(page, mapping, index, gfp_mask)) goto find_page; @@ -490,18 +571,30 @@ static int pipe_to_file(struct pipe_inod lru_cache_add(page); } else { find_page: - ret = -ENOMEM; - page = find_or_create_page(mapping, index, gfp_mask); - if (!page) - goto out_nomem; + page = find_lock_page(mapping, index); + if (!page) { + ret = -ENOMEM; + page = page_cache_alloc_cold(mapping); + if (unlikely(!page)) + goto out_nomem; + + /* + * This will also lock the page + */ + ret = add_to_page_cache_lru(page, mapping, index, + gfp_mask); + if (unlikely(ret)) + goto out; + } /* - * If the page is uptodate, it is also locked. If it isn't - * uptodate, we can mark it uptodate if we are filling the - * full page. Otherwise we need to read it in first... + * We get here with the page locked. If the page is also + * uptodate, we don't need to do more. If it isn't, we + * may need to bring it in if we are not going to overwrite + * the full page. */ if (!PageUptodate(page)) { - if (sd->len < PAGE_CACHE_SIZE) { + if (this_len < PAGE_CACHE_SIZE) { ret = mapping->a_ops->readpage(file, page); if (unlikely(ret)) goto out; @@ -520,14 +613,12 @@ find_page: ret = -EIO; goto out; } - } else { - WARN_ON(!PageLocked(page)); + } else SetPageUptodate(page); - } } } - ret = mapping->a_ops->prepare_write(file, page, 0, sd->len); + ret = mapping->a_ops->prepare_write(file, page, offset, offset+this_len); if (ret == AOP_TRUNCATED_PAGE) { page_cache_release(page); goto find_page; @@ -537,41 +628,42 @@ find_page: if (!(buf->flags & PIPE_BUF_FLAG_STOLEN)) { char *dst = kmap_atomic(page, KM_USER0); - memcpy(dst + offset, src + buf->offset, sd->len); + memcpy(dst + offset, src + buf->offset, this_len); flush_dcache_page(page); kunmap_atomic(dst, KM_USER0); } - ret = mapping->a_ops->commit_write(file, page, 0, sd->len); + ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len); if (ret == AOP_TRUNCATED_PAGE) { page_cache_release(page); goto find_page; } else if (ret) goto out; + /* + * Return the number of bytes written. + */ + ret = this_len; mark_page_accessed(page); balance_dirty_pages_ratelimited(mapping); out: - if (!(buf->flags & PIPE_BUF_FLAG_STOLEN)) { + if (!(buf->flags & PIPE_BUF_FLAG_STOLEN)) page_cache_release(page); - unlock_page(page); - } + + unlock_page(page); out_nomem: buf->ops->unmap(info, buf); return ret; } -typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *, - struct splice_desc *); - /* * Pipe input worker. Most of this logic works like a regular pipe, the * key here is the 'actor' worker passed in that actually moves the data * to the wanted destination. See pipe_to_file/pipe_to_sendpage above. */ -static ssize_t move_from_pipe(struct pipe_inode_info *pipe, struct file *out, - loff_t *ppos, size_t len, unsigned int flags, - splice_actor *actor) +ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out, + loff_t *ppos, size_t len, unsigned int flags, + splice_actor *actor) { int ret, do_wakeup, err; struct splice_desc sd; @@ -597,16 +689,22 @@ static ssize_t move_from_pipe(struct pip sd.len = sd.total_len; err = actor(pipe, buf, &sd); - if (err) { + if (err <= 0) { if (!ret && err != -ENODATA) ret = err; break; } - ret += sd.len; - buf->offset += sd.len; - buf->len -= sd.len; + ret += err; + buf->offset += err; + buf->len -= err; + + sd.len -= err; + sd.pos += err; + sd.total_len -= err; + if (sd.len) + continue; if (!buf->len) { buf->ops = NULL; @@ -617,8 +715,6 @@ static ssize_t move_from_pipe(struct pip do_wakeup = 1; } - sd.pos += sd.len; - sd.total_len -= sd.len; if (!sd.total_len) break; } @@ -686,23 +782,27 @@ generic_file_splice_write(struct pipe_in struct address_space *mapping = out->f_mapping; ssize_t ret; - ret = move_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); - - /* - * If file or inode is SYNC and we actually wrote some data, sync it. - */ - if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(mapping->host)) - && ret > 0) { + ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); + if (ret > 0) { struct inode *inode = mapping->host; - int err; - mutex_lock(&inode->i_mutex); - err = generic_osync_inode(mapping->host, mapping, - OSYNC_METADATA|OSYNC_DATA); - mutex_unlock(&inode->i_mutex); + *ppos += ret; + + /* + * If file or inode is SYNC and we actually wrote some data, + * sync it. + */ + if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { + int err; + + mutex_lock(&inode->i_mutex); + err = generic_osync_inode(inode, mapping, + OSYNC_METADATA|OSYNC_DATA); + mutex_unlock(&inode->i_mutex); - if (err) - ret = err; + if (err) + ret = err; + } } return ret; @@ -724,7 +824,7 @@ EXPORT_SYMBOL(generic_file_splice_write) ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, struct file *out, loff_t *ppos, size_t len, unsigned int flags) { - return move_from_pipe(pipe, out, ppos, len, flags, pipe_to_sendpage); + return splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_sendpage); } EXPORT_SYMBOL(generic_splice_sendpage); @@ -811,7 +911,7 @@ long do_splice_direct(struct file *in, l /* * We don't have an immediate reader, but we'll read the stuff - * out of the pipe right after the move_to_pipe(). So set + * out of the pipe right after the splice_to_pipe(). So set * PIPE_READERS appropriately. */ pipe->readers = 1; @@ -904,6 +1004,7 @@ static long do_splice(struct file *in, l { struct pipe_inode_info *pipe; loff_t offset, *off; + long ret; pipe = in->f_dentry->d_inode->i_pipe; if (pipe) { @@ -918,7 +1019,12 @@ static long do_splice(struct file *in, l } else off = &out->f_pos; - return do_splice_from(pipe, out, off, len, flags); + ret = do_splice_from(pipe, out, off, len, flags); + + if (off_out && copy_to_user(off_out, off, sizeof(loff_t))) + ret = -EFAULT; + + return ret; } pipe = out->f_dentry->d_inode->i_pipe; @@ -934,12 +1040,185 @@ static long do_splice(struct file *in, l } else off = &in->f_pos; - return do_splice_to(in, off, pipe, len, flags); + ret = do_splice_to(in, off, pipe, len, flags); + + if (off_in && copy_to_user(off_in, off, sizeof(loff_t))) + ret = -EFAULT; + + return ret; } return -EINVAL; } +/* + * Map an iov into an array of pages and offset/length tupples. With the + * partial_page structure, we can map several non-contiguous ranges into + * our ones pages[] map instead of splitting that operation into pieces. + * Could easily be exported as a generic helper for other users, in which + * case one would probably want to add a 'max_nr_pages' parameter as well. + */ +static int get_iovec_page_array(const struct iovec __user *iov, + unsigned int nr_vecs, struct page **pages, + struct partial_page *partial) +{ + int buffers = 0, error = 0; + + /* + * It's ok to take the mmap_sem for reading, even + * across a "get_user()". + */ + down_read(¤t->mm->mmap_sem); + + while (nr_vecs) { + unsigned long off, npages; + void __user *base; + size_t len; + int i; + + /* + * Get user address base and length for this iovec. + */ + error = get_user(base, &iov->iov_base); + if (unlikely(error)) + break; + error = get_user(len, &iov->iov_len); + if (unlikely(error)) + break; + + /* + * Sanity check this iovec. 0 read succeeds. + */ + if (unlikely(!len)) + break; + error = -EFAULT; + if (unlikely(!base)) + break; + + /* + * Get this base offset and number of pages, then map + * in the user pages. + */ + off = (unsigned long) base & ~PAGE_MASK; + npages = (off + len + PAGE_SIZE - 1) >> PAGE_SHIFT; + if (npages > PIPE_BUFFERS - buffers) + npages = PIPE_BUFFERS - buffers; + + error = get_user_pages(current, current->mm, + (unsigned long) base, npages, 0, 0, + &pages[buffers], NULL); + + if (unlikely(error <= 0)) + break; + + /* + * Fill this contiguous range into the partial page map. + */ + for (i = 0; i < error; i++) { + const int plen = min_t(size_t, len, PAGE_SIZE) - off; + + partial[buffers].offset = off; + partial[buffers].len = plen; + + off = 0; + len -= plen; + buffers++; + } + + /* + * We didn't complete this iov, stop here since it probably + * means we have to move some of this into a pipe to + * be able to continue. + */ + if (len) + break; + + /* + * Don't continue if we mapped fewer pages than we asked for, + * or if we mapped the max number of pages that we have + * room for. + */ + if (error < npages || buffers == PIPE_BUFFERS) + break; + + nr_vecs--; + iov++; + } + + up_read(¤t->mm->mmap_sem); + + if (buffers) + return buffers; + + return error; +} + +/* + * vmsplice splices a user address range into a pipe. It can be thought of + * as splice-from-memory, where the regular splice is splice-from-file (or + * to file). In both cases the output is a pipe, naturally. + * + * Note that vmsplice only supports splicing _from_ user memory to a pipe, + * not the other way around. Splicing from user memory is a simple operation + * that can be supported without any funky alignment restrictions or nasty + * vm tricks. We simply map in the user memory and fill them into a pipe. + * The reverse isn't quite as easy, though. There are two possible solutions + * for that: + * + * - memcpy() the data internally, at which point we might as well just + * do a regular read() on the buffer anyway. + * - Lots of nasty vm tricks, that are neither fast nor flexible (it + * has restriction limitations on both ends of the pipe). + * + * Alas, it isn't here. + * + */ +static long do_vmsplice(struct file *file, const struct iovec __user *iov, + unsigned long nr_segs, unsigned int flags) +{ + struct pipe_inode_info *pipe = file->f_dentry->d_inode->i_pipe; + struct page *pages[PIPE_BUFFERS]; + struct partial_page partial[PIPE_BUFFERS]; + struct splice_pipe_desc spd = { + .pages = pages, + .partial = partial, + .flags = flags, + .ops = &user_page_pipe_buf_ops, + }; + + if (unlikely(!pipe)) + return -EBADF; + if (unlikely(nr_segs > UIO_MAXIOV)) + return -EINVAL; + else if (unlikely(!nr_segs)) + return 0; + + spd.nr_pages = get_iovec_page_array(iov, nr_segs, pages, partial); + if (spd.nr_pages <= 0) + return spd.nr_pages; + + return splice_to_pipe(pipe, &spd); +} + +asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov, + unsigned long nr_segs, unsigned int flags) +{ + struct file *file; + long error; + int fput; + + error = -EBADF; + file = fget_light(fd, &fput); + if (file) { + if (file->f_mode & FMODE_WRITE) + error = do_vmsplice(file, iov, nr_segs, flags); + + fput_light(file, fput); + } + + return error; +} + asmlinkage long sys_splice(int fd_in, loff_t __user *off_in, int fd_out, loff_t __user *off_out, size_t len, unsigned int flags) @@ -979,7 +1258,9 @@ static int link_pipe(struct pipe_inode_i size_t len, unsigned int flags) { struct pipe_buffer *ibuf, *obuf; - int ret = 0, do_wakeup = 0, i; + int ret, do_wakeup, i, ipipe_first; + + ret = do_wakeup = ipipe_first = 0; /* * Potential ABBA deadlock, work around it by ordering lock @@ -987,6 +1268,7 @@ static int link_pipe(struct pipe_inode_i * could deadlock (one doing tee from A -> B, the other from B -> A). */ if (ipipe->inode < opipe->inode) { + ipipe_first = 1; mutex_lock(&ipipe->inode->i_mutex); mutex_lock(&opipe->inode->i_mutex); } else { @@ -1035,9 +1317,11 @@ static int link_pipe(struct pipe_inode_i /* * We have input available, but no output room. - * If we already copied data, return that. + * If we already copied data, return that. If we + * need to drop the opipe lock, it must be ordered + * last to avoid deadlocks. */ - if (flags & SPLICE_F_NONBLOCK) { + if ((flags & SPLICE_F_NONBLOCK) || !ipipe_first) { if (!ret) ret = -EAGAIN; break; @@ -1071,7 +1355,12 @@ static int link_pipe(struct pipe_inode_i if (ret) break; } - if (flags & SPLICE_F_NONBLOCK) { + /* + * pipe_wait() drops the ipipe mutex. To avoid deadlocks + * with another process, we can only safely do that if + * the ipipe lock is ordered last. + */ + if ((flags & SPLICE_F_NONBLOCK) || ipipe_first) { if (!ret) ret = -EAGAIN; break; diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h index 22d80ec..4ddce52 100644 --- a/include/asm-i386/atomic.h +++ b/include/asm-i386/atomic.h @@ -183,6 +183,7 @@ static __inline__ int atomic_add_return( { int __i; #ifdef CONFIG_M386 + unsigned long flags; if(unlikely(boot_cpu_data.x86==3)) goto no_xadd; #endif @@ -196,10 +197,10 @@ static __inline__ int atomic_add_return( #ifdef CONFIG_M386 no_xadd: /* Legacy 386 processor */ - local_irq_disable(); + local_irq_save(flags); __i = atomic_read(v); atomic_set(v, i + __i); - local_irq_enable(); + local_irq_restore(flags); return i + __i; #endif } diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h index 5c0b587..b44bfc6 100644 --- a/include/asm-i386/cpufeature.h +++ b/include/asm-i386/cpufeature.h @@ -71,6 +71,7 @@ #define X86_FEATURE_P4 (3*32+ 7) /* P4 */ #define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */ #define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */ +#define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* FXSAVE leaks FOP/FIP/FOP */ /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ #define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ diff --git a/include/asm-i386/i387.h b/include/asm-i386/i387.h index 152d0ba..7b1f011 100644 --- a/include/asm-i386/i387.h +++ b/include/asm-i386/i387.h @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -38,17 +39,38 @@ extern void init_fpu(struct task_struct extern void kernel_fpu_begin(void); #define kernel_fpu_end() do { stts(); preempt_enable(); } while(0) +/* We need a safe address that is cheap to find and that is already + in L1 during context switch. The best choices are unfortunately + different for UP and SMP */ +#ifdef CONFIG_SMP +#define safe_address (__per_cpu_offset[0]) +#else +#define safe_address (kstat_cpu(0).cpustat.user) +#endif + /* * These must be called with preempt disabled */ static inline void __save_init_fpu( struct task_struct *tsk ) { + /* Use more nops than strictly needed in case the compiler + varies code */ alternative_input( - "fnsave %1 ; fwait ;" GENERIC_NOP2, - "fxsave %1 ; fnclex", + "fnsave %[fx] ;fwait;" GENERIC_NOP8 GENERIC_NOP4, + "fxsave %[fx]\n" + "bt $7,%[fsw] ; jc 1f ; fnclex\n1:", X86_FEATURE_FXSR, - "m" (tsk->thread.i387.fxsave) - :"memory"); + [fx] "m" (tsk->thread.i387.fxsave), + [fsw] "m" (tsk->thread.i387.fxsave.swd) : "memory"); + /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception + is pending. Clear the x87 state here by setting it to fixed + values. __per_cpu_offset[0] is a random variable that should be in L1 */ + alternative_input( + GENERIC_NOP8 GENERIC_NOP2, + "emms\n\t" /* clear stack tags */ + "fildl %[addr]", /* set F?P to defined value */ + X86_FEATURE_FXSAVE_LEAK, + [addr] "m" (safe_address)); task_thread_info(tsk)->status &= ~TS_USEDFPU; } diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index d81d6cf..eb4b152 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -321,8 +321,9 @@ #define __NR_splice 313 #define __NR_sync_file_range 314 #define __NR_tee 315 +#define __NR_vmsplice 316 -#define NR_syscalls 316 +#define NR_syscalls 317 /* * user-visible error numbers are in the range -1 - -128: see diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h index a40ebec..7107763 100644 --- a/include/asm-ia64/unistd.h +++ b/include/asm-ia64/unistd.h @@ -290,12 +290,13 @@ #define __NR_get_robust_list 1299 #define __NR_sync_file_range 1300 #define __NR_tee 1301 +#define __NR_vmsplice 1302 #ifdef __KERNEL__ #include -#define NR_syscalls 278 /* length of syscall table */ +#define NR_syscalls 279 /* length of syscall table */ #define __ARCH_WANT_SYS_RT_SIGACTION diff --git a/include/asm-m32r/assembler.h b/include/asm-m32r/assembler.h index b7f4d8a..1a1aa17 100644 --- a/include/asm-m32r/assembler.h +++ b/include/asm-m32r/assembler.h @@ -109,6 +109,9 @@ push r13 mvfachi r13 push r13 + ldi r13, #0 + push r13 ; dummy push acc1h + push r13 ; dummy push acc1l #else #error unknown isa configuration #endif @@ -156,6 +159,8 @@ pop r13 mvtaclo r13, a1 #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) + pop r13 ; dummy pop acc1h + pop r13 ; dummy pop acc1l pop r13 mvtachi r13 pop r13 diff --git a/include/asm-m32r/mappi3/mappi3_pld.h b/include/asm-m32r/mappi3/mappi3_pld.h index 1d3c25d..031369a 100644 --- a/include/asm-m32r/mappi3/mappi3_pld.h +++ b/include/asm-m32r/mappi3/mappi3_pld.h @@ -53,16 +53,14 @@ /* Power Control of MMC and CF */ #define PLD_CPCR __reg16(PLD_BASE + 0x14000) - -/*==== ICU ====*/ -#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */ -#define M32R_IRQ_I2C (28) /* I2C-BUS */ -#define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */ -#define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert */ -#define PLD_IRQ_IDEIREQ (8) /* INT7 IDE Interrupt */ -#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ -#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */ - +/* ICU */ +#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */ +#define M32R_IRQ_I2C (28) /* I2C-BUS */ +#define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */ +#define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert & Eject */ +#define PLD_IRQ_IDEIREQ (8) /* INT7 IDE Interrupt */ +#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ +#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */ #if 0 /* LED Control @@ -97,7 +95,6 @@ #define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) #define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) - #if 0 /* RTC */ #define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) @@ -140,4 +137,7 @@ #endif +/* Reset Control */ +#define PLD_REBOOT __reg16(PLD_BASE + 0x38000) + #endif /* _MAPPI3_PLD.H */ diff --git a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h index 0d058b2..53c7924 100644 --- a/include/asm-m32r/ptrace.h +++ b/include/asm-m32r/ptrace.h @@ -43,6 +43,14 @@ #define PT_ACC1L 18 #define PT_ACCH PT_ACC0H #define PT_ACCL PT_ACC0L +#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) +#define PT_ACCH 15 +#define PT_ACCL 16 +#define PT_DUMMY_ACC1H 17 +#define PT_DUMMY_ACC1L 18 +#else +#error unknown isa conifiguration +#endif #define PT_PSW 19 #define PT_BPC 20 #define PT_BBPSW 21 @@ -52,21 +60,6 @@ #define PT_LR 25 #define PT_SPI 26 #define PT_ORIGR0 27 -#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) -#define PT_ACCH 15 -#define PT_ACCL 16 -#define PT_PSW 17 -#define PT_BPC 18 -#define PT_BBPSW 19 -#define PT_BBPC 20 -#define PT_SPU 21 -#define PT_FP 22 -#define PT_LR 23 -#define PT_SPI 24 -#define PT_ORIGR0 25 -#else -#error unknown isa conifiguration -#endif /* virtual pt_reg entry for gdb */ #define PT_PC 30 @@ -121,6 +114,8 @@ struct pt_regs { #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) unsigned long acch; unsigned long accl; + unsigned long dummy_acc1h; + unsigned long dummy_acc1l; #else #error unknown isa configuration #endif diff --git a/include/asm-m32r/semaphore.h b/include/asm-m32r/semaphore.h index bf447c5..81750ed 100644 --- a/include/asm-m32r/semaphore.h +++ b/include/asm-m32r/semaphore.h @@ -9,7 +9,7 @@ * SMP- and interrupt-safe semaphores.. * * Copyright (C) 1996 Linus Torvalds - * Copyright (C) 2004 Hirokazu Takata + * Copyright (C) 2004, 2006 Hirokazu Takata */ #include @@ -77,27 +77,8 @@ asmlinkage void __up(struct semaphore * */ static inline void down(struct semaphore * sem) { - unsigned long flags; - long count; - might_sleep(); - local_irq_save(flags); - __asm__ __volatile__ ( - "# down \n\t" - DCACHE_CLEAR("%0", "r4", "%1") - M32R_LOCK" %0, @%1; \n\t" - "addi %0, #-1; \n\t" - M32R_UNLOCK" %0, @%1; \n\t" - : "=&r" (count) - : "r" (&sem->count) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r4" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); - - if (unlikely(count < 0)) + if (unlikely(atomic_dec_return(&sem->count) < 0)) __down(sem); } @@ -107,28 +88,10 @@ static inline void down(struct semaphore */ static inline int down_interruptible(struct semaphore * sem) { - unsigned long flags; - long count; int result = 0; might_sleep(); - local_irq_save(flags); - __asm__ __volatile__ ( - "# down_interruptible \n\t" - DCACHE_CLEAR("%0", "r4", "%1") - M32R_LOCK" %0, @%1; \n\t" - "addi %0, #-1; \n\t" - M32R_UNLOCK" %0, @%1; \n\t" - : "=&r" (count) - : "r" (&sem->count) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r4" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); - - if (unlikely(count < 0)) + if (unlikely(atomic_dec_return(&sem->count) < 0)) result = __down_interruptible(sem); return result; @@ -174,26 +137,7 @@ static inline int down_trylock(struct se */ static inline void up(struct semaphore * sem) { - unsigned long flags; - long count; - - local_irq_save(flags); - __asm__ __volatile__ ( - "# up \n\t" - DCACHE_CLEAR("%0", "r4", "%1") - M32R_LOCK" %0, @%1; \n\t" - "addi %0, #1; \n\t" - M32R_UNLOCK" %0, @%1; \n\t" - : "=&r" (count) - : "r" (&sem->count) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r4" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); - - if (unlikely(count <= 0)) + if (unlikely(atomic_inc_return(&sem->count) <= 0)) __up(sem); } diff --git a/include/asm-m32r/sigcontext.h b/include/asm-m32r/sigcontext.h index c233e2d..942b8a3 100644 --- a/include/asm-m32r/sigcontext.h +++ b/include/asm-m32r/sigcontext.h @@ -32,6 +32,8 @@ struct sigcontext { #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) unsigned long sc_acch; unsigned long sc_accl; + unsigned long sc_dummy_acc1h; + unsigned long sc_dummy_acc1l; #else #error unknown isa configuration #endif diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h index c5ab5da..e55013f 100644 --- a/include/asm-m32r/system.h +++ b/include/asm-m32r/system.h @@ -6,8 +6,8 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 2001 by Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto - * Copyright (C) 2004 Hirokazu Takata + * Copyright (C) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto + * Copyright (C) 2004, 2006 Hirokazu Takata */ #include @@ -19,49 +19,28 @@ * switch_to(prev, next) should switch from task `prev' to `next' * `prev' will never be the same as `next'. * - * `next' and `prev' should be struct task_struct, but it isn't always defined + * `next' and `prev' should be task_t, but it isn't always defined */ #define switch_to(prev, next, last) do { \ - register unsigned long arg0 __asm__ ("r0") = (unsigned long)prev; \ - register unsigned long arg1 __asm__ ("r1") = (unsigned long)next; \ - register unsigned long *oldsp __asm__ ("r2") = &(prev->thread.sp); \ - register unsigned long *newsp __asm__ ("r3") = &(next->thread.sp); \ - register unsigned long *oldlr __asm__ ("r4") = &(prev->thread.lr); \ - register unsigned long *newlr __asm__ ("r5") = &(next->thread.lr); \ - register struct task_struct *__last __asm__ ("r6"); \ __asm__ __volatile__ ( \ - "st r8, @-r15 \n\t" \ - "st r9, @-r15 \n\t" \ - "st r10, @-r15 \n\t" \ - "st r11, @-r15 \n\t" \ - "st r12, @-r15 \n\t" \ - "st r13, @-r15 \n\t" \ - "st r14, @-r15 \n\t" \ - "seth r14, #high(1f) \n\t" \ - "or3 r14, r14, #low(1f) \n\t" \ - "st r14, @r4 ; store old LR \n\t" \ - "st r15, @r2 ; store old SP \n\t" \ - "ld r15, @r3 ; load new SP \n\t" \ - "st r0, @-r15 ; store 'prev' onto new stack \n\t" \ - "ld r14, @r5 ; load new LR \n\t" \ - "jmp r14 \n\t" \ - ".fillinsn \n " \ - "1: \n\t" \ - "ld r6, @r15+ ; load 'prev' from new stack \n\t" \ - "ld r14, @r15+ \n\t" \ - "ld r13, @r15+ \n\t" \ - "ld r12, @r15+ \n\t" \ - "ld r11, @r15+ \n\t" \ - "ld r10, @r15+ \n\t" \ - "ld r9, @r15+ \n\t" \ - "ld r8, @r15+ \n\t" \ - : "=&r" (__last) \ - : "r" (arg0), "r" (arg1), "r" (oldsp), "r" (newsp), \ - "r" (oldlr), "r" (newlr) \ - : "memory" \ + " seth lr, #high(1f) \n" \ + " or3 lr, lr, #low(1f) \n" \ + " st lr, @%4 ; store old LR \n" \ + " ld lr, @%5 ; load new LR \n" \ + " st sp, @%2 ; store old SP \n" \ + " ld sp, @%3 ; load new SP \n" \ + " push %1 ; store `prev' on new stack \n" \ + " jmp lr \n" \ + " .fillinsn \n" \ + "1: \n" \ + " pop %0 ; restore `__last' from new stack \n" \ + : "=r" (last) \ + : "0" (prev), \ + "r" (&(prev->thread.sp)), "r" (&(next->thread.sp)), \ + "r" (&(prev->thread.lr)), "r" (&(next->thread.lr)) \ + : "memory", "lr" \ ); \ - last = __last; \ } while(0) /* @@ -167,8 +146,8 @@ extern void __xchg_called_with_bad_poin #define DCACHE_CLEAR(reg0, reg1, addr) #endif /* CONFIG_CHIP_M32700_TS1 */ -static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr, - int size) +static inline unsigned long +__xchg(unsigned long x, volatile void * ptr, int size) { unsigned long flags; unsigned long tmp = 0; @@ -220,7 +199,7 @@ static __inline__ unsigned long __xchg(u #define __HAVE_ARCH_CMPXCHG 1 -static __inline__ unsigned long +static inline unsigned long __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new) { unsigned long flags; @@ -254,7 +233,7 @@ __cmpxchg_u32(volatile unsigned int *p, if something tries to do an invalid cmpxchg(). */ extern void __cmpxchg_called_with_bad_pointer(void); -static __inline__ unsigned long +static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) { switch (size) { diff --git a/include/asm-parisc/io.h b/include/asm-parisc/io.h index 29da311..244f6b8 100644 --- a/include/asm-parisc/io.h +++ b/include/asm-parisc/io.h @@ -126,24 +126,17 @@ static inline void gsc_writeq(unsigned l extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); -extern inline void __iomem * ioremap(unsigned long offset, unsigned long size) -{ - return __ioremap(offset, size, 0); -} - -/* - * This one maps high address device memory and turns off caching for that area. - * it's useful if some control registers are in such an area and write combining - * or read caching is not desirable: +/* Most machines react poorly to I/O-space being cacheable... Instead let's + * define ioremap() in terms of ioremap_nocache(). */ -extern inline void * ioremap_nocache(unsigned long offset, unsigned long size) +extern inline void __iomem * ioremap(unsigned long offset, unsigned long size) { - return __ioremap(offset, size, _PAGE_NO_CACHE /* _PAGE_PCD */); + return __ioremap(offset, size, _PAGE_NO_CACHE); } +#define ioremap_nocache(off, sz) ioremap((off), (sz)) extern void iounmap(void __iomem *addr); - static inline unsigned char __raw_readb(const volatile void __iomem *addr) { return (*(volatile unsigned char __force *) (addr)); diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h index 45e02aa..c0dd461 100644 --- a/include/asm-parisc/page.h +++ b/include/asm-parisc/page.h @@ -1,13 +1,30 @@ #ifndef _PARISC_PAGE_H #define _PARISC_PAGE_H -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT 12 -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#if !defined(__KERNEL__) +/* this is for userspace applications (4k page size) */ +# define PAGE_SHIFT 12 /* 4k */ +# define PAGE_SIZE (1UL << PAGE_SHIFT) +# define PAGE_MASK (~(PAGE_SIZE-1)) +#endif + #ifdef __KERNEL__ #include + +#if defined(CONFIG_PARISC_PAGE_SIZE_4KB) +# define PAGE_SHIFT 12 /* 4k */ +#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB) +# define PAGE_SHIFT 14 /* 16k */ +#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB) +# define PAGE_SHIFT 16 /* 64k */ +#else +# error "unknown default kernel page size" +#endif +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + + #ifndef __ASSEMBLY__ #include diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h index 4e34c6b..aec089e 100644 --- a/include/asm-parisc/pgtable.h +++ b/include/asm-parisc/pgtable.h @@ -59,16 +59,15 @@ #define ISTACK_SIZE 32768 /* Interrupt Stack Size */ #define ISTACK_ORDER 3 -/* This is the size of the initially mapped kernel memory (i.e. currently - * 0 to 1<<23 == 8MB */ +/* This is the size of the initially mapped kernel memory */ #ifdef CONFIG_64BIT -#define KERNEL_INITIAL_ORDER 24 +#define KERNEL_INITIAL_ORDER 24 /* 0 to 1<<24 = 16MB */ #else -#define KERNEL_INITIAL_ORDER 23 +#define KERNEL_INITIAL_ORDER 23 /* 0 to 1<<23 = 8MB */ #endif #define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER) -#ifdef CONFIG_64BIT +#if defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB) #define PT_NLEVELS 3 #define PGD_ORDER 1 /* Number of pages per pgd */ #define PMD_ORDER 1 /* Number of pages per pmd */ @@ -111,11 +110,15 @@ #define MAX_ADDRBITS (PGDIR_SHIFT + BITS_PER_PGD) #define MAX_ADDRESS (1UL << MAX_ADDRBITS) -#define SPACEID_SHIFT (MAX_ADDRBITS - 32) +#define SPACEID_SHIFT (MAX_ADDRBITS - 32) /* This calculates the number of initial pages we need for the initial * page tables */ -#define PT_INITIAL (1 << (KERNEL_INITIAL_ORDER - PMD_SHIFT)) +#if (KERNEL_INITIAL_ORDER) >= (PMD_SHIFT) +# define PT_INITIAL (1 << (KERNEL_INITIAL_ORDER - PMD_SHIFT)) +#else +# define PT_INITIAL (1) /* all initial PTEs fit into one page */ +#endif /* * pgd entries used up by user/kernel: @@ -160,6 +163,10 @@ extern void *vmalloc_start; * to zero */ #define PTE_SHIFT xlate_pabit(_PAGE_USER_BIT) +/* PFN_PTE_SHIFT defines the shift of a PTE value to access the PFN field */ +#define PFN_PTE_SHIFT 12 + + /* this is how many bits may be used by the file functions */ #define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_SHIFT) @@ -188,7 +195,8 @@ extern void *vmalloc_start; /* The pgd/pmd contains a ptr (in phys addr space); since all pgds/pmds * are page-aligned, we don't care about the PAGE_OFFSET bits, except * for a few meta-information bits, so we shift the address to be - * able to effectively address 40-bits of physical address space. */ + * able to effectively address 40/42/44-bits of physical address space + * depending on 4k/16k/64k PAGE_SIZE */ #define _PxD_PRESENT_BIT 31 #define _PxD_ATTACHED_BIT 30 #define _PxD_VALID_BIT 29 @@ -198,7 +206,7 @@ extern void *vmalloc_start; #define PxD_FLAG_VALID (1 << xlate_pabit(_PxD_VALID_BIT)) #define PxD_FLAG_MASK (0xf) #define PxD_FLAG_SHIFT (4) -#define PxD_VALUE_SHIFT (8) +#define PxD_VALUE_SHIFT (8) /* (PAGE_SHIFT-PxD_FLAG_SHIFT) */ #ifndef __ASSEMBLY__ @@ -246,6 +254,7 @@ extern void *vmalloc_start; #define __S110 PAGE_RWX #define __S111 PAGE_RWX + extern pgd_t swapper_pg_dir[]; /* declared in init_task.c */ /* initial page tables for 0-8MB for kernel */ @@ -272,7 +281,7 @@ extern unsigned long *empty_zero_page; #define pgd_flag(x) (pgd_val(x) & PxD_FLAG_MASK) #define pgd_address(x) ((unsigned long)(pgd_val(x) &~ PxD_FLAG_MASK) << PxD_VALUE_SHIFT) -#ifdef CONFIG_64BIT +#if PT_NLEVELS == 3 /* The first entry of the permanent pmd is not there if it contains * the gateway marker */ #define pmd_none(x) (!pmd_val(x) || pmd_flag(x) == PxD_FLAG_ATTACHED) @@ -282,7 +291,7 @@ extern unsigned long *empty_zero_page; #define pmd_bad(x) (!(pmd_flag(x) & PxD_FLAG_VALID)) #define pmd_present(x) (pmd_flag(x) & PxD_FLAG_PRESENT) static inline void pmd_clear(pmd_t *pmd) { -#ifdef CONFIG_64BIT +#if PT_NLEVELS == 3 if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) /* This is the entry pointing to the permanent pmd * attached to the pgd; cannot clear it */ @@ -303,7 +312,7 @@ static inline void pmd_clear(pmd_t *pmd) #define pgd_bad(x) (!(pgd_flag(x) & PxD_FLAG_VALID)) #define pgd_present(x) (pgd_flag(x) & PxD_FLAG_PRESENT) static inline void pgd_clear(pgd_t *pgd) { -#ifdef CONFIG_64BIT +#if PT_NLEVELS == 3 if(pgd_flag(*pgd) & PxD_FLAG_ATTACHED) /* This is the permanent pmd attached to the pgd; cannot * free it */ @@ -351,7 +360,7 @@ extern inline pte_t pte_mkwrite(pte_t pt ({ \ pte_t __pte; \ \ - pte_val(__pte) = ((addr)+pgprot_val(pgprot)); \ + pte_val(__pte) = ((((addr)>>PAGE_SHIFT)<> PAGE_SHIFT) +#define pte_pfn(x) (pte_val(x) >> PFN_PTE_SHIFT) #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) @@ -499,6 +504,26 @@ static inline void ptep_set_wrprotect(st #endif /* !__ASSEMBLY__ */ + +/* TLB page size encoding - see table 3-1 in parisc20.pdf */ +#define _PAGE_SIZE_ENCODING_4K 0 +#define _PAGE_SIZE_ENCODING_16K 1 +#define _PAGE_SIZE_ENCODING_64K 2 +#define _PAGE_SIZE_ENCODING_256K 3 +#define _PAGE_SIZE_ENCODING_1M 4 +#define _PAGE_SIZE_ENCODING_4M 5 +#define _PAGE_SIZE_ENCODING_16M 6 +#define _PAGE_SIZE_ENCODING_64M 7 + +#if defined(CONFIG_PARISC_PAGE_SIZE_4KB) +# define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_4K +#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB) +# define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_16K +#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB) +# define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_64K +#endif + + #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ remap_pfn_range(vma, vaddr, pfn, size, prot) diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h index c56fccb..0e1a30b 100644 --- a/include/asm-parisc/unistd.h +++ b/include/asm-parisc/unistd.h @@ -780,8 +780,14 @@ #define __NR_readlinkat (__NR_Linux + 285) #define __NR_fchmodat (__NR_Linux + 286) #define __NR_faccessat (__NR_Linux + 287) +#define __NR_unshare (__NR_Linux + 288) +#define __NR_set_robust_list (__NR_Linux + 289) +#define __NR_get_robust_list (__NR_Linux + 290) +#define __NR_splice (__NR_Linux + 291) +#define __NR_sync_file_range (__NR_Linux + 292) +#define __NR_tee (__NR_Linux + 293) -#define __NR_Linux_syscalls 288 +#define __NR_Linux_syscalls 294 #define HPUX_GATEWAY_ADDR 0xC0000004 #define LINUX_GATEWAY_ADDR 0x100 diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h index d5677cb..18ca29e 100644 --- a/include/asm-powerpc/iommu.h +++ b/include/asm-powerpc/iommu.h @@ -70,17 +70,18 @@ extern void iommu_free_table(struct devi extern struct iommu_table *iommu_init_table(struct iommu_table * tbl); extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl, - struct scatterlist *sglist, int nelems, + struct scatterlist *sglist, int nelems, unsigned long mask, enum dma_data_direction direction); extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, int nelems, enum dma_data_direction direction); extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, - dma_addr_t *dma_handle, gfp_t flag); + dma_addr_t *dma_handle, unsigned long mask, gfp_t flag); extern void iommu_free_coherent(struct iommu_table *tbl, size_t size, void *vaddr, dma_addr_t dma_handle); extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, - size_t size, enum dma_data_direction direction); + size_t size, unsigned long mask, + enum dma_data_direction direction); extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, size_t size, enum dma_data_direction direction); diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h index 5ed8476..0f9254c 100644 --- a/include/asm-powerpc/machdep.h +++ b/include/asm-powerpc/machdep.h @@ -253,7 +253,11 @@ extern struct machdep_calls *machine_id; #define __machine_desc __attribute__ ((__section__ (".machine.desc"))) -#define define_machine(name) struct machdep_calls mach_##name __machine_desc = +#define define_machine(name) \ + extern struct machdep_calls mach_##name; \ + EXPORT_SYMBOL(mach_##name); \ + struct machdep_calls mach_##name __machine_desc = + #define machine_is(name) \ ({ \ extern struct machdep_calls mach_##name \ diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h index c612f1a..34325e2 100644 --- a/include/asm-powerpc/unistd.h +++ b/include/asm-powerpc/unistd.h @@ -303,8 +303,9 @@ #define __NR_unshare 282 #define __NR_splice 283 #define __NR_tee 284 +#define __NR_vmsplice 285 -#define __NR_syscalls 285 +#define __NR_syscalls 286 #ifdef __KERNEL__ #define __NR__exit __NR_exit diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h index 2a911aa..32a48f6 100644 --- a/include/asm-sparc/unistd.h +++ b/include/asm-sparc/unistd.h @@ -248,7 +248,7 @@ #define __NR_setfsgid 229 /* Linux Specific */ #define __NR__newselect 230 /* Linux Specific */ #define __NR_time 231 /* Linux Specific */ -#define __NR_sys_splice 232 /* Linux Specific */ +#define __NR_splice 232 /* Linux Specific */ #define __NR_stime 233 /* Linux Specific */ #define __NR_statfs64 234 /* Linux Specific */ #define __NR_fstatfs64 235 /* Linux Specific */ @@ -271,7 +271,7 @@ #define __NR_getsid 252 #define __NR_fdatasync 253 #define __NR_nfsservctl 254 -#define __NR_sys_sync_file_range 255 +#define __NR_sync_file_range 255 #define __NR_clock_settime 256 #define __NR_clock_gettime 257 #define __NR_clock_getres 258 diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h index 6ada6a8..ca80e8a 100644 --- a/include/asm-sparc64/unistd.h +++ b/include/asm-sparc64/unistd.h @@ -250,7 +250,7 @@ #ifdef __KERNEL__ #define __NR_time 231 /* Linux sparc32 */ #endif -#define __NR_sys_splice 232 /* Linux Specific */ +#define __NR_splice 232 /* Linux Specific */ #define __NR_stime 233 /* Linux Specific */ #define __NR_statfs64 234 /* Linux Specific */ #define __NR_fstatfs64 235 /* Linux Specific */ @@ -273,7 +273,7 @@ #define __NR_getsid 252 #define __NR_fdatasync 253 #define __NR_nfsservctl 254 -#define __NR_sys_sync_file_range 255 +#define __NR_sync_file_range 255 #define __NR_clock_settime 256 #define __NR_clock_gettime 257 #define __NR_clock_getres 258 diff --git a/include/asm-x86_64/cache.h b/include/asm-x86_64/cache.h index c8043a1..f8dff1c 100644 --- a/include/asm-x86_64/cache.h +++ b/include/asm-x86_64/cache.h @@ -20,8 +20,8 @@ __attribute__((__section__(".data.page_aligned"))) #endif -#define __read_mostly __attribute__((__section__(".data.read_mostly"))) - #endif +#define __read_mostly __attribute__((__section__(".data.read_mostly"))) + #endif diff --git a/include/asm-x86_64/cpufeature.h b/include/asm-x86_64/cpufeature.h index 76bb619..662964b 100644 --- a/include/asm-x86_64/cpufeature.h +++ b/include/asm-x86_64/cpufeature.h @@ -64,6 +64,7 @@ #define X86_FEATURE_REP_GOOD (3*32+ 4) /* rep microcode works well on this CPU */ #define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */ #define X86_FEATURE_SYNC_RDTSC (3*32+6) /* RDTSC syncs CPU core */ +#define X86_FEATURE_FXSAVE_LEAK (3*32+7) /* FIP/FOP/FDP leaks through FXSAVE */ /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ #define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h index 876eb9a..cba8a3b 100644 --- a/include/asm-x86_64/i387.h +++ b/include/asm-x86_64/i387.h @@ -72,6 +72,23 @@ extern int set_fpregs(struct task_struct #define set_fpu_swd(t,val) ((t)->thread.i387.fxsave.swd = (val)) #define set_fpu_fxsr_twd(t,val) ((t)->thread.i387.fxsave.twd = (val)) +#define X87_FSW_ES (1 << 7) /* Exception Summary */ + +/* AMD CPUs don't save/restore FDP/FIP/FOP unless an exception + is pending. Clear the x87 state here by setting it to fixed + values. The kernel data segment can be sometimes 0 and sometimes + new user value. Both should be ok. + Use the PDA as safe address because it should be already in L1. */ +static inline void clear_fpu_state(struct i387_fxsave_struct *fx) +{ + if (unlikely(fx->swd & X87_FSW_ES)) + asm volatile("fnclex"); + alternative_input(ASM_NOP8 ASM_NOP2, + " emms\n" /* clear stack tags */ + " fildl %%gs:0", /* load to clear state */ + X86_FEATURE_FXSAVE_LEAK); +} + static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) { int err; @@ -119,6 +136,7 @@ static inline int save_i387_checking(str #endif if (unlikely(err)) __clear_user(fx, sizeof(struct i387_fxsave_struct)); + /* No need to clear here because the caller clears USED_MATH */ return err; } @@ -149,7 +167,7 @@ static inline void __fxsave_clear(struct "i" (offsetof(__typeof__(*tsk), thread.i387.fxsave))); #endif - __asm__ __volatile__("fnclex"); + clear_fpu_state(&tsk->thread.i387.fxsave); } static inline void kernel_fpu_begin(void) diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h index 4405b4a..7f33aaf 100644 --- a/include/asm-x86_64/percpu.h +++ b/include/asm-x86_64/percpu.h @@ -26,7 +26,7 @@ #define percpu_modcopy(pcpudst, src, size) \ do { \ unsigned int __i; \ - for_each_cpu(__i) \ + for_each_possible_cpu(__i) \ memcpy((pcpudst)+__per_cpu_offset(__i), \ (src), (size)); \ } while (0) diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index 98c36ea..feb77cb 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h @@ -615,8 +615,10 @@ __SYSCALL(__NR_splice, sys_splice) __SYSCALL(__NR_tee, sys_tee) #define __NR_sync_file_range 277 __SYSCALL(__NR_sync_file_range, sys_sync_file_range) +#define __NR_vmsplice 278 +__SYSCALL(__NR_vmsplice, sys_vmsplice) -#define __NR_syscall_max __NR_sync_file_range +#define __NR_syscall_max __NR_vmsplice #ifndef __NO_STUBS diff --git a/include/asm-xtensa/ioctls.h b/include/asm-xtensa/ioctls.h index 10c4434..3b89a77 100644 --- a/include/asm-xtensa/ioctls.h +++ b/include/asm-xtensa/ioctls.h @@ -107,6 +107,6 @@ #define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* Set multiport config */ #define TIOCMIWAIT _IO('T', 92) /* wait for a change on serial input line(s) */ -#define TIOCGICOUNT _IOR('T', 93, struct async_icount) /* read serial port inline interrupt counts */ +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ #endif /* _XTENSA_IOCTLS_H */ diff --git a/include/linux/ide.h b/include/linux/ide.h index 8d2db41..a8bef1d 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1220,7 +1220,6 @@ typedef struct ide_pci_enablebit_s { enum { /* Uses ISA control ports not PCI ones. */ IDEPCI_FLAG_ISA_PORTS = (1 << 0), - IDEPCI_FLAG_FORCE_PDC = (1 << 1), }; typedef struct ide_pci_device_s { diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 4ca3e6a..9112063 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -99,10 +99,7 @@ static inline int __remove_pages(struct return -ENOSYS; } -#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \ - || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE) extern int add_memory(u64 start, u64 size); extern int remove_memory(u64 start, u64 size); -#endif #endif /* __LINUX_MEMORY_HOTPLUG_H */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 40ccf8c..01db7b8 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -829,19 +829,21 @@ static inline void netif_rx_schedule(str __netif_rx_schedule(dev); } -/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). - * Do not inline this? - */ + +static inline void __netif_rx_reschedule(struct net_device *dev, int undo) +{ + dev->quota += undo; + list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list); + __raise_softirq_irqoff(NET_RX_SOFTIRQ); +} + +/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */ static inline int netif_rx_reschedule(struct net_device *dev, int undo) { if (netif_rx_schedule_prep(dev)) { unsigned long flags; - - dev->quota += undo; - local_irq_save(flags); - list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list); - __raise_softirq_irqoff(NET_RX_SOFTIRQ); + __netif_rx_reschedule(dev, undo); local_irq_restore(flags); return 1; } diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index f6bdef8..3870145 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h @@ -361,7 +361,11 @@ struct compat_xt_entry_target struct compat_xt_counters { +#if defined(CONFIG_X86_64) || defined(CONFIG_IA64) u_int32_t cnt[4]; +#else + u_int64_t cnt[2]; +#endif }; struct compat_xt_counters_info diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 8d03e10..d6fe048 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -356,6 +356,10 @@ #define PCI_DEVICE_ID_ATI_IXP300_SATA 0x436e #define PCI_DEVICE_ID_ATI_IXP400_IDE 0x4376 #define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379 +#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a +#define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380 +#define PCI_DEVICE_ID_ATI_IXP600_SRAID 0x4381 +#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c #define PCI_VENDOR_ID_VLSI 0x1004 #define PCI_DEVICE_ID_VLSI_82C592 0x0005 diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index ef7f33c..0008d4b 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h @@ -61,4 +61,21 @@ void __free_pipe_info(struct pipe_inode_ /* from/to, of course */ #define SPLICE_F_MORE (0x04) /* expect more data */ +/* + * Passed to the actors + */ +struct splice_desc { + unsigned int len, total_len; /* current and remaining length */ + unsigned int flags; /* splice flags */ + struct file *file; /* file to read/write */ + loff_t pos; /* file position */ +}; + +typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *, + struct splice_desc *); + +extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *, + loff_t *, size_t, unsigned int, + splice_actor *); + #endif diff --git a/include/linux/sched.h b/include/linux/sched.h index b7d31e2..29b7d4f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1192,8 +1192,7 @@ extern void wait_task_inactive(task_t * #define remove_parent(p) list_del_init(&(p)->sibling) #define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children) -#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) -#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) +#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks) #define for_each_process(p) \ for (p = &init_task ; (p = next_task(p)) != &init_task ; ) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index c4619a4..f8f2347 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -344,6 +344,13 @@ extern void skb_over_panic(struct void *here); extern void skb_under_panic(struct sk_buff *skb, int len, void *here); +extern void skb_truesize_bug(struct sk_buff *skb); + +static inline void skb_truesize_check(struct sk_buff *skb) +{ + if (unlikely((int)skb->truesize < sizeof(struct sk_buff) + skb->len)) + skb_truesize_bug(skb); +} extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb, int getfrag(void *from, char *to, int offset, diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h index 8f96e9d..77f78e5 100644 --- a/include/linux/sunrpc/metrics.h +++ b/include/linux/sunrpc/metrics.h @@ -69,9 +69,21 @@ struct rpc_clnt; /* * EXPORTed functions for managing rpc_iostats structures */ + +#ifdef CONFIG_PROC_FS + struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *); void rpc_count_iostats(struct rpc_task *); void rpc_print_iostats(struct seq_file *, struct rpc_clnt *); void rpc_free_iostats(struct rpc_iostats *); +#else /* CONFIG_PROC_FS */ + +static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; } +static inline void rpc_count_iostats(struct rpc_task *task) {} +static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {} +static inline void rpc_free_iostats(struct rpc_iostats *stats) {} + +#endif /* CONFIG_PROC_FS */ + #endif /* _LINUX_SUNRPC_METRICS_H */ diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 7eebbab..e8bbe81 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -53,6 +53,7 @@ struct rpc_timeout { struct rpc_task; struct rpc_xprt; +struct seq_file; /* * This describes a complete RPC request diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index d3ebc0e..3996960 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -574,6 +574,9 @@ asmlinkage long sys_splice(int fd_in, lo int fd_out, loff_t __user *off_out, size_t len, unsigned int flags); +asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov, + unsigned long nr_segs, unsigned int flags); + asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags); asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h index b971d8c..b1ebfba 100644 --- a/include/net/ieee80211softmac.h +++ b/include/net/ieee80211softmac.h @@ -96,10 +96,13 @@ struct ieee80211softmac_assoc_info { * * bssvalid is true if we found a matching network * and saved it's BSSID into the bssid above. + * + * bssfixed is used for SIOCSIWAP. */ u8 static_essid:1, associating:1, - bssvalid:1; + bssvalid:1, + bssfixed:1; /* Scan retries remaining */ int scan_retry; @@ -267,8 +270,9 @@ extern void ieee80211softmac_stop(struct #define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5 #define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6 #define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7 +#define IEEE80211SOFTMAC_EVENT_DISASSOCIATED 8 /* keep this updated! */ -#define IEEE80211SOFTMAC_EVENT_LAST 7 +#define IEEE80211SOFTMAC_EVENT_LAST 8 /* * If you want to be notified of certain events, you can call * ieee80211softmac_notify[_atomic] with diff --git a/include/net/sock.h b/include/net/sock.h index af2b054..ff8b0da 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -454,6 +454,7 @@ static inline void sk_stream_set_owner_r static inline void sk_stream_free_skb(struct sock *sk, struct sk_buff *skb) { + skb_truesize_check(skb); sock_set_flag(sk, SOCK_QUEUE_SHRUNK); sk->sk_wmem_queued -= skb->truesize; sk->sk_forward_alloc += skb->truesize; diff --git a/kernel/exit.c b/kernel/exit.c index 1a9787a..f86434d 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -56,7 +56,7 @@ static void __unhash_process(struct task detach_pid(p, PIDTYPE_PGID); detach_pid(p, PIDTYPE_SID); - list_del_init(&p->tasks); + list_del_rcu(&p->tasks); __get_cpu_var(process_counts)--; } list_del_rcu(&p->thread_group); diff --git a/kernel/fork.c b/kernel/fork.c index 54b15f8..d2fa57d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -180,6 +180,7 @@ static struct task_struct *dup_task_stru atomic_set(&tsk->usage,2); atomic_set(&tsk->fs_excl, 0); tsk->btrace_seq = 0; + tsk->splice_pipe = NULL; return tsk; } @@ -1204,7 +1205,7 @@ static task_t *copy_process(unsigned lon attach_pid(p, PIDTYPE_PGID, process_group(p)); attach_pid(p, PIDTYPE_SID, p->signal->session); - list_add_tail(&p->tasks, &init_task.tasks); + list_add_tail_rcu(&p->tasks, &init_task.tasks); __get_cpu_var(process_counts)++; } attach_pid(p, PIDTYPE_PID, p->pid); diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index d2a7296..b7f0388 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -836,7 +836,7 @@ static void migrate_hrtimers(int cpu) } #endif /* CONFIG_HOTPLUG_CPU */ -static int __devinit hrtimer_cpu_notify(struct notifier_block *self, +static int hrtimer_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) { long cpu = (long)hcpu; @@ -860,7 +860,7 @@ static int __devinit hrtimer_cpu_notify( return NOTIFY_OK; } -static struct notifier_block __devinitdata hrtimers_nb = { +static struct notifier_block hrtimers_nb = { .notifier_call = hrtimer_cpu_notify, }; diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 1156eb0..1fbf466 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -585,6 +585,9 @@ int __kprobes register_kretprobe(struct int i; rp->kp.pre_handler = pre_handler_kretprobe; + rp->kp.post_handler = NULL; + rp->kp.fault_handler = NULL; + rp->kp.break_handler = NULL; /* Pre-allocate memory for max kretprobe instances */ if (rp->maxactive <= 0) { diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index c5863d0..3eeedbb 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -240,14 +240,15 @@ static void copy_data_pages(struct pbe * * free_pagedir - free pages allocated with alloc_pagedir() */ -static void free_pagedir(struct pbe *pblist) +static void free_pagedir(struct pbe *pblist, int clear_nosave_free) { struct pbe *pbe; while (pblist) { pbe = (pblist + PB_PAGE_SKIP)->next; ClearPageNosave(virt_to_page(pblist)); - ClearPageNosaveFree(virt_to_page(pblist)); + if (clear_nosave_free) + ClearPageNosaveFree(virt_to_page(pblist)); free_page((unsigned long)pblist); pblist = pbe; } @@ -389,7 +390,7 @@ struct pbe *alloc_pagedir(unsigned int n pbe->next = alloc_image_page(gfp_mask, safe_needed); } if (!pbe) { /* get_zeroed_page() failed */ - free_pagedir(pblist); + free_pagedir(pblist, 1); pblist = NULL; } else create_pbe_list(pblist, nr_pages); @@ -736,7 +737,7 @@ static int create_image(struct snapshot_ pblist = alloc_pagedir(nr_copy_pages, GFP_ATOMIC, 1); if (pblist) copy_page_backup_list(pblist, p); - free_pagedir(p); + free_pagedir(p, 0); if (!pblist) error = -ENOMEM; } diff --git a/kernel/profile.c b/kernel/profile.c index 5a730fd..68afe12 100644 --- a/kernel/profile.c +++ b/kernel/profile.c @@ -299,7 +299,7 @@ out: } #ifdef CONFIG_HOTPLUG_CPU -static int __devinit profile_cpu_callback(struct notifier_block *info, +static int profile_cpu_callback(struct notifier_block *info, unsigned long action, void *__cpu) { int node, cpu = (unsigned long)__cpu; diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index 13458bb..6d32ff2 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c @@ -520,7 +520,7 @@ static void __devinit rcu_online_cpu(int tasklet_init(&per_cpu(rcu_tasklet, cpu), rcu_process_callbacks, 0UL); } -static int __devinit rcu_cpu_notify(struct notifier_block *self, +static int rcu_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) { long cpu = (long)hcpu; @@ -537,7 +537,7 @@ static int __devinit rcu_cpu_notify(stru return NOTIFY_OK; } -static struct notifier_block __devinitdata rcu_nb = { +static struct notifier_block rcu_nb = { .notifier_call = rcu_cpu_notify, }; diff --git a/kernel/sched.c b/kernel/sched.c index 365f0b9..4c64f85 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -4814,7 +4814,7 @@ static int migration_call(struct notifie /* Register at highest priority so that task migration (migrate_all_tasks) * happens before everything else. */ -static struct notifier_block __devinitdata migration_notifier = { +static struct notifier_block migration_notifier = { .notifier_call = migration_call, .priority = 10 }; diff --git a/kernel/softirq.c b/kernel/softirq.c index ec8fed4..336f92d 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -446,7 +446,7 @@ static void takeover_tasklets(unsigned i } #endif /* CONFIG_HOTPLUG_CPU */ -static int __devinit cpu_callback(struct notifier_block *nfb, +static int cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { @@ -484,7 +484,7 @@ static int __devinit cpu_callback(struct return NOTIFY_OK; } -static struct notifier_block __devinitdata cpu_nfb = { +static struct notifier_block cpu_nfb = { .notifier_call = cpu_callback }; diff --git a/kernel/softlockup.c b/kernel/softlockup.c index ced91e1..14c7faf 100644 --- a/kernel/softlockup.c +++ b/kernel/softlockup.c @@ -104,7 +104,7 @@ static int watchdog(void * __bind_cpu) /* * Create/destroy watchdog threads as CPUs come and go: */ -static int __devinit +static int cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { int hotcpu = (unsigned long)hcpu; @@ -140,7 +140,7 @@ cpu_callback(struct notifier_block *nfb, return NOTIFY_OK; } -static struct notifier_block __devinitdata cpu_nfb = { +static struct notifier_block cpu_nfb = { .notifier_call = cpu_callback }; diff --git a/kernel/timer.c b/kernel/timer.c index 8837737..67eaf0f 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -1314,7 +1314,7 @@ static void __devinit migrate_timers(int } #endif /* CONFIG_HOTPLUG_CPU */ -static int __devinit timer_cpu_notify(struct notifier_block *self, +static int timer_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) { long cpu = (long)hcpu; @@ -1334,7 +1334,7 @@ static int __devinit timer_cpu_notify(st return NOTIFY_OK; } -static struct notifier_block __devinitdata timers_nb = { +static struct notifier_block timers_nb = { .notifier_call = timer_cpu_notify, }; diff --git a/kernel/uid16.c b/kernel/uid16.c index aa25605..187e2a4 100644 --- a/kernel/uid16.c +++ b/kernel/uid16.c @@ -20,43 +20,67 @@ asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group) { - return sys_chown(filename, low2highuid(user), low2highgid(group)); + long ret = sys_chown(filename, low2highuid(user), low2highgid(group)); + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_gid_t group) { - return sys_lchown(filename, low2highuid(user), low2highgid(group)); + long ret = sys_lchown(filename, low2highuid(user), low2highgid(group)); + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group) { - return sys_fchown(fd, low2highuid(user), low2highgid(group)); + long ret = sys_fchown(fd, low2highuid(user), low2highgid(group)); + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid) { - return sys_setregid(low2highgid(rgid), low2highgid(egid)); + long ret = sys_setregid(low2highgid(rgid), low2highgid(egid)); + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } asmlinkage long sys_setgid16(old_gid_t gid) { - return sys_setgid(low2highgid(gid)); + long ret = sys_setgid(low2highgid(gid)); + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid) { - return sys_setreuid(low2highuid(ruid), low2highuid(euid)); + long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid)); + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } asmlinkage long sys_setuid16(old_uid_t uid) { - return sys_setuid(low2highuid(uid)); + long ret = sys_setuid(low2highuid(uid)); + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid) { - return sys_setresuid(low2highuid(ruid), low2highuid(euid), - low2highuid(suid)); + long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid), + low2highuid(suid)); + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid, old_uid_t __user *suid) @@ -72,8 +96,11 @@ asmlinkage long sys_getresuid16(old_uid_ asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid) { - return sys_setresgid(low2highgid(rgid), low2highgid(egid), - low2highgid(sgid)); + long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid), + low2highgid(sgid)); + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid, old_gid_t __user *sgid) @@ -89,12 +116,18 @@ asmlinkage long sys_getresgid16(old_gid_ asmlinkage long sys_setfsuid16(old_uid_t uid) { - return sys_setfsuid(low2highuid(uid)); + long ret = sys_setfsuid(low2highuid(uid)); + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } asmlinkage long sys_setfsgid16(old_gid_t gid) { - return sys_setfsgid(low2highgid(gid)); + long ret = sys_setfsgid(low2highgid(gid)); + /* avoid REGPARM breakage on x86: */ + prevent_tail_call(ret); + return ret; } static int groups16_to_user(old_gid_t __user *grouplist, diff --git a/kernel/workqueue.c b/kernel/workqueue.c index e9e464a..880fb41 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -547,7 +547,7 @@ static void take_over_work(struct workqu } /* We're holding the cpucontrol mutex here */ -static int __devinit workqueue_cpu_callback(struct notifier_block *nfb, +static int workqueue_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index d57fd91..6ecc180 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -101,7 +101,7 @@ config DEBUG_PREEMPT config DEBUG_MUTEXES bool "Mutex debugging, deadlock detection" - default y + default n depends on DEBUG_KERNEL help This allows mutex semantics violations and mutex related deadlocks diff --git a/mm/mempolicy.c b/mm/mempolicy.c index dec8249..8778f58 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1761,7 +1761,6 @@ static void gather_stats(struct page *pa md->mapcount_max = count; md->node[page_to_nid(page)]++; - cond_resched(); } #ifdef CONFIG_HUGETLB_PAGE diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 78747af..042e643 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -46,15 +46,25 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) { unsigned long points, cpu_time, run_time, s; - struct list_head *tsk; + struct mm_struct *mm; + struct task_struct *child; - if (!p->mm) + task_lock(p); + mm = p->mm; + if (!mm) { + task_unlock(p); return 0; + } /* * The memory size of the process is the basis for the badness. */ - points = p->mm->total_vm; + points = mm->total_vm; + + /* + * After this unlock we can no longer dereference local variable `mm' + */ + task_unlock(p); /* * Processes which fork a lot of child processes are likely @@ -64,11 +74,11 @@ unsigned long badness(struct task_struct * child is eating the vast majority of memory, adding only half * to the parents will make the child our kill candidate of choice. */ - list_for_each(tsk, &p->children) { - struct task_struct *chld; - chld = list_entry(tsk, struct task_struct, sibling); - if (chld->mm != p->mm && chld->mm) - points += chld->mm->total_vm/2 + 1; + list_for_each_entry(child, &p->children, sibling) { + task_lock(child); + if (child->mm != mm && child->mm) + points += child->mm->total_vm/2 + 1; + task_unlock(child); } /* @@ -244,17 +254,24 @@ static void __oom_kill_task(task_t *p, c force_sig(SIGKILL, p); } -static struct mm_struct *oom_kill_task(task_t *p, const char *message) +static int oom_kill_task(task_t *p, const char *message) { - struct mm_struct *mm = get_task_mm(p); + struct mm_struct *mm; task_t * g, * q; - if (!mm) - return NULL; - if (mm == &init_mm) { - mmput(mm); - return NULL; - } + mm = p->mm; + + /* WARNING: mm may not be dereferenced since we did not obtain its + * value from get_task_mm(p). This is OK since all we need to do is + * compare mm to q->mm below. + * + * Furthermore, even if mm contains a non-NULL value, p->mm may + * change to NULL at any time since we do not hold task_lock(p). + * However, this is of no concern to us. + */ + + if (mm == NULL || mm == &init_mm) + return 1; __oom_kill_task(p, message); /* @@ -266,13 +283,12 @@ static struct mm_struct *oom_kill_task(t __oom_kill_task(q, message); while_each_thread(g, q); - return mm; + return 0; } -static struct mm_struct *oom_kill_process(struct task_struct *p, - unsigned long points, const char *message) +static int oom_kill_process(struct task_struct *p, unsigned long points, + const char *message) { - struct mm_struct *mm; struct task_struct *c; struct list_head *tsk; @@ -283,9 +299,8 @@ static struct mm_struct *oom_kill_proces c = list_entry(tsk, struct task_struct, sibling); if (c->mm == p->mm) continue; - mm = oom_kill_task(c, message); - if (mm) - return mm; + if (!oom_kill_task(c, message)) + return 0; } return oom_kill_task(p, message); } @@ -300,7 +315,6 @@ static struct mm_struct *oom_kill_proces */ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order) { - struct mm_struct *mm = NULL; task_t *p; unsigned long points = 0; @@ -320,12 +334,12 @@ void out_of_memory(struct zonelist *zone */ switch (constrained_alloc(zonelist, gfp_mask)) { case CONSTRAINT_MEMORY_POLICY: - mm = oom_kill_process(current, points, + oom_kill_process(current, points, "No available memory (MPOL_BIND)"); break; case CONSTRAINT_CPUSET: - mm = oom_kill_process(current, points, + oom_kill_process(current, points, "No available memory in cpuset"); break; @@ -347,8 +361,7 @@ retry: panic("Out of memory and no killable processes...\n"); } - mm = oom_kill_process(p, points, "Out of memory"); - if (!mm) + if (oom_kill_process(p, points, "Out of memory")) goto retry; break; @@ -357,8 +370,6 @@ retry: out: read_unlock(&tasklist_lock); cpuset_unlock(); - if (mm) - mmput(mm); /* * Give "p" a good chance of killing itself before we diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 97d6827..ea77c99 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -232,11 +232,13 @@ static inline void prep_zero_page(struct * zone->lock is already acquired when we use these. * So, we don't need atomic page->flags operations here. */ -static inline unsigned long page_order(struct page *page) { +static inline unsigned long page_order(struct page *page) +{ return page_private(page); } -static inline void set_page_order(struct page *page, int order) { +static inline void set_page_order(struct page *page, int order) +{ set_page_private(page, order); __SetPageBuddy(page); } @@ -299,9 +301,9 @@ static inline int page_is_buddy(struct p if (PageBuddy(page) && page_order(page) == order) { BUG_ON(page_count(page) != 0); - return 1; + return 1; } - return 0; + return 0; } /* @@ -1960,7 +1962,7 @@ static inline void free_zone_pagesets(in } } -static int __cpuinit pageset_cpuup_callback(struct notifier_block *nfb, +static int pageset_cpuup_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { diff --git a/mm/shmem.c b/mm/shmem.c index 37eaf42..4c5e68e 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -46,6 +46,8 @@ #include #include #include +#include + #include #include #include @@ -2173,6 +2175,7 @@ static struct address_space_operations s .prepare_write = shmem_prepare_write, .commit_write = simple_commit_write, #endif + .migratepage = migrate_page, }; static struct file_operations shmem_file_operations = { diff --git a/mm/slab.c b/mm/slab.c index e6ef9bd..af5c523 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1036,7 +1036,7 @@ static inline void free_alien_cache(stru #endif -static int __devinit cpuup_callback(struct notifier_block *nfb, +static int cpuup_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { long cpu = (long)hcpu; diff --git a/mm/slob.c b/mm/slob.c index 9bcc7e2..a68255b 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -354,9 +354,7 @@ void *__alloc_percpu(size_t size) if (!pdata) return NULL; - for (i = 0; i < NR_CPUS; i++) { - if (!cpu_possible(i)) - continue; + for_each_possible_cpu(i) { pdata->ptrs[i] = kmalloc(size, GFP_KERNEL); if (!pdata->ptrs[i]) goto unwind_oom; @@ -383,11 +381,9 @@ free_percpu(const void *objp) int i; struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp); - for (i = 0; i < NR_CPUS; i++) { - if (!cpu_possible(i)) - continue; + for_each_possible_cpu(i) kfree(p->ptrs[i]); - } + kfree(p); } EXPORT_SYMBOL(free_percpu); diff --git a/mm/vmscan.c b/mm/vmscan.c index acdf001..4649a63 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1328,7 +1328,7 @@ repeat: not required for correctness. So if the last cpu in a node goes away, we get changed to run anywhere: as the first one comes back, restore their cpu bindings. */ -static int __devinit cpu_callback(struct notifier_block *nfb, +static int cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { pg_data_t *pgdat; diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 2d24fb4..56f3aa4 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "br_private.h" @@ -29,10 +30,15 @@ static inline int should_deliver(const s return 1; } +static inline unsigned packet_length(const struct sk_buff *skb) +{ + return skb->len - (skb->protocol == htons(ETH_P_8021Q) ? VLAN_HLEN : 0); +} + int br_dev_queue_push_xmit(struct sk_buff *skb) { /* drop mtu oversized packets except tso */ - if (skb->len > skb->dev->mtu && !skb_shinfo(skb)->tso_size) + if (packet_length(skb) > skb->dev->mtu && !skb_shinfo(skb)->tso_size) kfree_skb(skb); else { #ifdef CONFIG_BRIDGE_NETFILTER diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 84b9af7..3a13ed6 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -831,7 +831,7 @@ static int translate_table(struct ebt_re return -ENOMEM; for_each_possible_cpu(i) { newinfo->chainstack[i] = - vmalloc(udc_cnt * sizeof(struct ebt_chainstack)); + vmalloc(udc_cnt * sizeof(*(newinfo->chainstack[0]))); if (!newinfo->chainstack[i]) { while (i) vfree(newinfo->chainstack[--i]); @@ -841,8 +841,7 @@ static int translate_table(struct ebt_re } } - cl_s = (struct ebt_cl_stack *) - vmalloc(udc_cnt * sizeof(struct ebt_cl_stack)); + cl_s = vmalloc(udc_cnt * sizeof(*cl_s)); if (!cl_s) return -ENOMEM; i = 0; /* the i'th udc */ @@ -944,8 +943,7 @@ static int do_replace(void __user *user, countersize = COUNTER_OFFSET(tmp.nentries) * (highest_possible_processor_id()+1); - newinfo = (struct ebt_table_info *) - vmalloc(sizeof(struct ebt_table_info) + countersize); + newinfo = vmalloc(sizeof(*newinfo) + countersize); if (!newinfo) return -ENOMEM; @@ -967,8 +965,7 @@ static int do_replace(void __user *user, /* the user wants counters back the check on the size is done later, when we have the lock */ if (tmp.num_counters) { - counterstmp = (struct ebt_counter *) - vmalloc(tmp.num_counters * sizeof(struct ebt_counter)); + counterstmp = vmalloc(tmp.num_counters * sizeof(*counterstmp)); if (!counterstmp) { ret = -ENOMEM; goto free_entries; @@ -1148,8 +1145,7 @@ int ebt_register_table(struct ebt_table countersize = COUNTER_OFFSET(table->table->nentries) * (highest_possible_processor_id()+1); - newinfo = (struct ebt_table_info *) - vmalloc(sizeof(struct ebt_table_info) + countersize); + newinfo = vmalloc(sizeof(*newinfo) + countersize); ret = -ENOMEM; if (!newinfo) return -ENOMEM; @@ -1247,8 +1243,7 @@ static int update_counters(void __user * if (hlp.num_counters == 0) return -EINVAL; - if ( !(tmp = (struct ebt_counter *) - vmalloc(hlp.num_counters * sizeof(struct ebt_counter))) ){ + if (!(tmp = vmalloc(hlp.num_counters * sizeof(*tmp)))) { MEMPRINT("Update_counters && nomemory\n"); return -ENOMEM; } @@ -1377,8 +1372,7 @@ static int copy_everything_to_user(struc BUGPRINT("Num_counters wrong\n"); return -EINVAL; } - counterstmp = (struct ebt_counter *) - vmalloc(nentries * sizeof(struct ebt_counter)); + counterstmp = vmalloc(nentries * sizeof(*counterstmp)); if (!counterstmp) { MEMPRINT("Couldn't copy counters, out of memory\n"); return -ENOMEM; diff --git a/net/core/dev.c b/net/core/dev.c index 83231a2..3bad1af 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2698,7 +2698,8 @@ int dev_ioctl(unsigned int cmd, void __u /* If command is `set a parameter', or * `get the encoding parameters', check if * the user has the right to do it */ - if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE) { + if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE + || cmd == SIOCGIWENCODEEXT) { if (!capable(CAP_NET_ADMIN)) return -EPERM; } diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 09464fa..fb3770f 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -112,6 +112,14 @@ void skb_under_panic(struct sk_buff *skb BUG(); } +void skb_truesize_bug(struct sk_buff *skb) +{ + printk(KERN_ERR "SKB BUG: Invalid truesize (%u) " + "len=%u, sizeof(sk_buff)=%Zd\n", + skb->truesize, skb->len, sizeof(struct sk_buff)); +} +EXPORT_SYMBOL(skb_truesize_bug); + /* Allocate a new skbuff. We do this ourselves so we can fill in a few * 'private' fields and also do memory statistics to find all the * [BEEP] leaks. diff --git a/net/core/stream.c b/net/core/stream.c index 35e2525..e948969 100644 --- a/net/core/stream.c +++ b/net/core/stream.c @@ -176,6 +176,7 @@ void sk_stream_rfree(struct sk_buff *skb { struct sock *sk = skb->sk; + skb_truesize_check(skb); atomic_sub(skb->truesize, &sk->sk_rmem_alloc); sk->sk_forward_alloc += skb->truesize; } diff --git a/net/core/wireless.c b/net/core/wireless.c index 81d6995..d2bc72d 100644 --- a/net/core/wireless.c +++ b/net/core/wireless.c @@ -1726,6 +1726,14 @@ int wireless_rtnetlink_get(struct net_de if(!IW_IS_GET(request->cmd)) return -EOPNOTSUPP; + /* If command is `get the encoding parameters', check if + * the user has the right to do it */ + if (request->cmd == SIOCGIWENCODE || + request->cmd == SIOCGIWENCODEEXT) { + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + } + /* Special cases */ if(request->cmd == SIOCGIWSTATS) /* Get Wireless Stats */ diff --git a/net/ieee80211/softmac/Kconfig b/net/ieee80211/softmac/Kconfig index 6cd9f34..f2a27cc 100644 --- a/net/ieee80211/softmac/Kconfig +++ b/net/ieee80211/softmac/Kconfig @@ -1,6 +1,7 @@ config IEEE80211_SOFTMAC tristate "Software MAC add-on to the IEEE 802.11 networking stack" depends on IEEE80211 && EXPERIMENTAL + select WIRELESS_EXT ---help--- This option enables the hardware independent software MAC addon for the IEEE 802.11 networking stack. diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c index be61de7..fb79ce7 100644 --- a/net/ieee80211/softmac/ieee80211softmac_assoc.c +++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c @@ -101,6 +101,7 @@ ieee80211softmac_disassoc(struct ieee802 /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */ mac->associated = 0; mac->associnfo.associating = 0; + ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); spin_unlock_irqrestore(&mac->lock, flags); } @@ -143,6 +144,12 @@ network_matches_request(struct ieee80211 if (!we_support_all_basic_rates(mac, net->rates_ex, net->rates_ex_len)) return 0; + /* assume that users know what they're doing ... + * (note we don't let them select a net we're incompatible with) */ + if (mac->associnfo.bssfixed) { + return !memcmp(mac->associnfo.bssid, net->bssid, ETH_ALEN); + } + /* if 'ANY' network requested, take any that doesn't have privacy enabled */ if (mac->associnfo.req_essid.len == 0 && !(net->capability & WLAN_CAPABILITY_PRIVACY)) @@ -175,7 +182,7 @@ ieee80211softmac_assoc_work(void *d) ieee80211softmac_disassoc(mac, WLAN_REASON_DISASSOC_STA_HAS_LEFT); /* try to find the requested network in our list, if we found one already */ - if (mac->associnfo.bssvalid) + if (mac->associnfo.bssvalid || mac->associnfo.bssfixed) found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); /* Search the ieee80211 networks for this network if we didn't find it by bssid, @@ -240,19 +247,25 @@ ieee80211softmac_assoc_work(void *d) if (ieee80211softmac_start_scan(mac)) dprintk(KERN_INFO PFX "Associate: failed to initiate scan. Is device up?\n"); return; - } - else { + } else { spin_lock_irqsave(&mac->lock, flags); mac->associnfo.associating = 0; mac->associated = 0; spin_unlock_irqrestore(&mac->lock, flags); dprintk(KERN_INFO PFX "Unable to find matching network after scan!\n"); + /* reset the retry counter for the next user request since we + * break out and don't reschedule ourselves after this point. */ + mac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND, NULL); return; } } - + + /* reset the retry counter for the next user request since we + * now found a net and will try to associate to it, but not + * schedule this function again. */ + mac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; mac->associnfo.bssvalid = 1; memcpy(mac->associnfo.bssid, found->bssid, ETH_ALEN); /* copy the ESSID for displaying it */ @@ -373,6 +386,7 @@ ieee80211softmac_handle_disassoc(struct spin_lock_irqsave(&mac->lock, flags); mac->associnfo.bssvalid = 0; mac->associated = 0; + ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); schedule_work(&mac->associnfo.work); spin_unlock_irqrestore(&mac->lock, flags); @@ -391,6 +405,7 @@ ieee80211softmac_handle_reassoc_req(stru dprintkl(KERN_INFO PFX "reassoc request from unknown network\n"); return 0; } - ieee80211softmac_assoc(mac, network); + schedule_work(&mac->associnfo.work); + return 0; } diff --git a/net/ieee80211/softmac/ieee80211softmac_event.c b/net/ieee80211/softmac/ieee80211softmac_event.c index 0a52bbd..8cc8f3f 100644 --- a/net/ieee80211/softmac/ieee80211softmac_event.c +++ b/net/ieee80211/softmac/ieee80211softmac_event.c @@ -67,6 +67,7 @@ static char *event_descriptions[IEEE8021 "authenticating failed", "authenticating timed out", "associating failed because no suitable network was found", + "disassociated", }; @@ -128,13 +129,42 @@ void ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx) { struct ieee80211softmac_event *eventptr, *tmp; - union iwreq_data wrqu; - char *msg; + struct ieee80211softmac_network *network; if (event >= 0) { - msg = event_descriptions[event]; - wrqu.data.length = strlen(msg); - wireless_send_event(mac->dev, IWEVCUSTOM, &wrqu, msg); + union iwreq_data wrqu; + int we_event; + char *msg = NULL; + + switch(event) { + case IEEE80211SOFTMAC_EVENT_ASSOCIATED: + network = (struct ieee80211softmac_network *)event_ctx; + wrqu.data.length = 0; + wrqu.data.flags = 0; + memcpy(wrqu.ap_addr.sa_data, &network->bssid[0], ETH_ALEN); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + we_event = SIOCGIWAP; + break; + case IEEE80211SOFTMAC_EVENT_DISASSOCIATED: + wrqu.data.length = 0; + wrqu.data.flags = 0; + memset(&wrqu, '\0', sizeof (union iwreq_data)); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + we_event = SIOCGIWAP; + break; + case IEEE80211SOFTMAC_EVENT_SCAN_FINISHED: + wrqu.data.length = 0; + wrqu.data.flags = 0; + memset(&wrqu, '\0', sizeof (union iwreq_data)); + we_event = SIOCGIWSCAN; + break; + default: + msg = event_descriptions[event]; + wrqu.data.length = strlen(msg); + we_event = IWEVCUSTOM; + break; + } + wireless_send_event(mac->dev, we_event, &wrqu, msg); } if (!list_empty(&mac->events)) diff --git a/net/ieee80211/softmac/ieee80211softmac_io.c b/net/ieee80211/softmac/ieee80211softmac_io.c index febc51d..cc6cd56 100644 --- a/net/ieee80211/softmac/ieee80211softmac_io.c +++ b/net/ieee80211/softmac/ieee80211softmac_io.c @@ -180,9 +180,21 @@ ieee80211softmac_assoc_req(struct ieee80 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_ASSOC_REQ, net->bssid, net->bssid); /* Fill in capability Info */ - (*pkt)->capability = (mac->ieee->iw_mode == IW_MODE_MASTER) || (mac->ieee->iw_mode == IW_MODE_INFRA) ? - cpu_to_le16(WLAN_CAPABILITY_ESS) : - cpu_to_le16(WLAN_CAPABILITY_IBSS); + switch (mac->ieee->iw_mode) { + case IW_MODE_INFRA: + (*pkt)->capability = cpu_to_le16(WLAN_CAPABILITY_ESS); + break; + case IW_MODE_ADHOC: + (*pkt)->capability = cpu_to_le16(WLAN_CAPABILITY_IBSS); + break; + case IW_MODE_AUTO: + (*pkt)->capability = net->capabilities & (WLAN_CAPABILITY_ESS|WLAN_CAPABILITY_IBSS); + break; + default: + /* bleh. we don't ever go to these modes */ + printk(KERN_ERR PFX "invalid iw_mode!\n"); + break; + } /* Need to add this (*pkt)->capability |= mac->ieee->short_slot ? cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME) : 0; diff --git a/net/ieee80211/softmac/ieee80211softmac_module.c b/net/ieee80211/softmac/ieee80211softmac_module.c index 60f06a3..be83bdc 100644 --- a/net/ieee80211/softmac/ieee80211softmac_module.c +++ b/net/ieee80211/softmac/ieee80211softmac_module.c @@ -45,6 +45,8 @@ struct net_device *alloc_ieee80211softma softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc; softmac->scaninfo = NULL; + softmac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; + /* TODO: initialise all the other callbacks in the ieee struct * (once they're written) */ diff --git a/net/ieee80211/softmac/ieee80211softmac_scan.c b/net/ieee80211/softmac/ieee80211softmac_scan.c index bb9ab8b..2b9e7ed 100644 --- a/net/ieee80211/softmac/ieee80211softmac_scan.c +++ b/net/ieee80211/softmac/ieee80211softmac_scan.c @@ -47,6 +47,7 @@ ieee80211softmac_start_scan(struct ieee8 sm->scanning = 1; spin_unlock_irqrestore(&sm->lock, flags); + netif_tx_disable(sm->ieee->dev); ret = sm->start_scan(sm->dev); if (ret) { spin_lock_irqsave(&sm->lock, flags); @@ -239,6 +240,7 @@ void ieee80211softmac_scan_finished(stru if (net) sm->set_channel(sm->dev, net->channel); } + netif_wake_queue(sm->ieee->dev); ieee80211softmac_call_events(sm, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, NULL); } EXPORT_SYMBOL_GPL(ieee80211softmac_scan_finished); diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c index b559aa9..27edb2b 100644 --- a/net/ieee80211/softmac/ieee80211softmac_wx.c +++ b/net/ieee80211/softmac/ieee80211softmac_wx.c @@ -27,7 +27,8 @@ #include "ieee80211softmac_priv.h" #include - +/* for is_broadcast_ether_addr and is_zero_ether_addr */ +#include int ieee80211softmac_wx_trigger_scan(struct net_device *net_dev, @@ -41,13 +42,23 @@ ieee80211softmac_wx_trigger_scan(struct EXPORT_SYMBOL_GPL(ieee80211softmac_wx_trigger_scan); +/* if we're still scanning, return -EAGAIN so that userspace tools + * can get the complete scan results, otherwise return 0. */ int ieee80211softmac_wx_get_scan_results(struct net_device *net_dev, struct iw_request_info *info, union iwreq_data *data, char *extra) { + unsigned long flags; struct ieee80211softmac_device *sm = ieee80211_priv(net_dev); + + spin_lock_irqsave(&sm->lock, flags); + if (sm->scanning) { + spin_unlock_irqrestore(&sm->lock, flags); + return -EAGAIN; + } + spin_unlock_irqrestore(&sm->lock, flags); return ieee80211_wx_get_scan(sm->ieee, info, data, extra); } EXPORT_SYMBOL_GPL(ieee80211softmac_wx_get_scan_results); @@ -73,7 +84,6 @@ ieee80211softmac_wx_set_essid(struct net sm->associnfo.static_essid = 1; } } - sm->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; /* set our requested ESSID length. * If applicable, we have already copied the data in */ @@ -300,8 +310,6 @@ ieee80211softmac_wx_set_wap(struct net_d char *extra) { struct ieee80211softmac_device *mac = ieee80211_priv(net_dev); - static const unsigned char any[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - static const unsigned char off[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; unsigned long flags; /* sanity check */ @@ -310,10 +318,17 @@ ieee80211softmac_wx_set_wap(struct net_d } spin_lock_irqsave(&mac->lock, flags); - if (!memcmp(any, data->ap_addr.sa_data, ETH_ALEN) || - !memcmp(off, data->ap_addr.sa_data, ETH_ALEN)) { - schedule_work(&mac->associnfo.work); - goto out; + if (is_broadcast_ether_addr(data->ap_addr.sa_data)) { + /* the bssid we have is not to be fixed any longer, + * and we should reassociate to the best AP. */ + mac->associnfo.bssfixed = 0; + /* force reassociation */ + mac->associnfo.bssvalid = 0; + if (mac->associated) + schedule_work(&mac->associnfo.work); + } else if (is_zero_ether_addr(data->ap_addr.sa_data)) { + /* the bssid we have is no longer fixed */ + mac->associnfo.bssfixed = 0; } else { if (!memcmp(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN)) { if (mac->associnfo.associating || mac->associated) { @@ -323,12 +338,14 @@ ieee80211softmac_wx_set_wap(struct net_d } else { /* copy new value in data->ap_addr.sa_data to bssid */ memcpy(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN); - } + } + /* tell the other code that this bssid should be used no matter what */ + mac->associnfo.bssfixed = 1; /* queue associate if new bssid or (old one again and not associated) */ schedule_work(&mac->associnfo.work); } -out: + out: spin_unlock_irqrestore(&mac->lock, flags); return 0; } diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index c60fd5c..3d560de 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig @@ -345,7 +345,7 @@ config IP_NF_TARGET_LOG To compile it as a module, choose M here. If unsure, say N. config IP_NF_TARGET_ULOG - tristate "ULOG target support (OBSOLETE)" + tristate "ULOG target support" depends on IP_NF_IPTABLES ---help--- diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 44df1db..a28ae59 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -533,6 +533,7 @@ int tcp_fragment(struct sock *sk, struct struct tcp_sock *tp = tcp_sk(sk); struct sk_buff *buff; int nsize, old_factor; + int nlen; u16 flags; BUG_ON(len > skb->len); @@ -552,8 +553,10 @@ int tcp_fragment(struct sock *sk, struct if (buff == NULL) return -ENOMEM; /* We'll just try again later. */ - buff->truesize = skb->len - len; - skb->truesize -= buff->truesize; + sk_charge_skb(sk, buff); + nlen = skb->len - len - nsize; + buff->truesize += nlen; + skb->truesize -= nlen; /* Correct the sequence numbers. */ TCP_SKB_CB(buff)->seq = TCP_SKB_CB(skb)->seq + len; @@ -1039,7 +1042,8 @@ static int tso_fragment(struct sock *sk, if (unlikely(buff == NULL)) return -ENOMEM; - buff->truesize = nlen; + sk_charge_skb(sk, buff); + buff->truesize += nlen; skb->truesize -= nlen; /* Correct the sequence numbers. */ diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 642b4b1..0a67303 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c @@ -288,19 +288,6 @@ ip6t_do_table(struct sk_buff **pskb, table_base = (void *)private->entries[smp_processor_id()]; e = get_entry(table_base, private->hook_entry[hook]); -#ifdef CONFIG_NETFILTER_DEBUG - /* Check noone else using our table */ - if (((struct ip6t_entry *)table_base)->comefrom != 0xdead57ac - && ((struct ip6t_entry *)table_base)->comefrom != 0xeeeeeeec) { - printk("ASSERT: CPU #%u, %s comefrom(%p) = %X\n", - smp_processor_id(), - table->name, - &((struct ip6t_entry *)table_base)->comefrom, - ((struct ip6t_entry *)table_base)->comefrom); - } - ((struct ip6t_entry *)table_base)->comefrom = 0x57acc001; -#endif - /* For return from builtin chain */ back = get_entry(table_base, private->underflow[hook]); diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c index 8f3addf..d62e0f9 100644 --- a/net/llc/llc_input.c +++ b/net/llc/llc_input.c @@ -118,7 +118,8 @@ static inline int llc_fixup_skb(struct s u16 pdulen = eth_hdr(skb)->h_proto, data_size = ntohs(pdulen) - llc_len; - skb_trim(skb, data_size); + if (unlikely(pskb_trim_rcsum(skb, data_size))) + return 0; } return 1; } diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index e581190..f9b83f9 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -178,9 +178,6 @@ static struct { /* allocated slab cache + modules which uses this slab cache */ int use; - /* Initialization */ - int (*init_conntrack)(struct nf_conn *, u_int32_t); - } nf_ct_cache[NF_CT_F_NUM]; /* protect members of nf_ct_cache except of "use" */ @@ -208,10 +205,8 @@ nf_ct_proto_find_get(u_int16_t l3proto, preempt_disable(); p = __nf_ct_proto_find(l3proto, protocol); - if (p) { - if (!try_module_get(p->me)) - p = &nf_conntrack_generic_protocol; - } + if (!try_module_get(p->me)) + p = &nf_conntrack_generic_protocol; preempt_enable(); return p; @@ -229,10 +224,8 @@ nf_ct_l3proto_find_get(u_int16_t l3proto preempt_disable(); p = __nf_ct_l3proto_find(l3proto); - if (p) { - if (!try_module_get(p->me)) - p = &nf_conntrack_generic_l3proto; - } + if (!try_module_get(p->me)) + p = &nf_conntrack_generic_l3proto; preempt_enable(); return p; diff --git a/net/netfilter/nf_conntrack_l3proto_generic.c b/net/netfilter/nf_conntrack_l3proto_generic.c index 7de4f06..3fc58e4 100644 --- a/net/netfilter/nf_conntrack_l3proto_generic.c +++ b/net/netfilter/nf_conntrack_l3proto_generic.c @@ -94,5 +94,4 @@ struct nf_conntrack_l3proto nf_conntrack .print_conntrack = generic_print_conntrack, .prepare = generic_prepare, .get_features = generic_get_features, - .me = THIS_MODULE, }; diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 00cf0a4..17abf60 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -529,6 +529,7 @@ int xt_register_table(struct xt_table *t /* Simplifies replace_table code. */ table->private = bootstrap; + rwlock_init(&table->lock); if (!xt_replace_table(table, 0, newinfo, &ret)) goto unlock; @@ -538,7 +539,6 @@ int xt_register_table(struct xt_table *t /* save number of initial entries */ private->initial_entries = private->number; - rwlock_init(&table->lock); list_prepend(&xt[table->af].tables, table); ret = 0; diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 6056d20..37640c6 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c @@ -69,6 +69,11 @@ ipt_init_target(struct ipt_entry_target DPRINTK("ipt_init_target: found %s\n", target->name); t->u.kernel.target = target; + ret = xt_check_target(target, AF_INET, t->u.target_size - sizeof(*t), + table, hook, 0, 0); + if (ret) + return ret; + if (t->u.kernel.target->checkentry && !t->u.kernel.target->checkentry(table, NULL, t->u.kernel.target, t->data, diff --git a/net/socket.c b/net/socket.c index 23898f4..0ce12df 100644 --- a/net/socket.c +++ b/net/socket.c @@ -490,6 +490,7 @@ static struct socket *sockfd_lookup_ligh struct file *file; struct socket *sock; + *err = -EBADF; file = fget_light(fd, fput_needed); if (file) { sock = sock_from_file(file, err); diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 900ef31..519ebc1 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -794,7 +794,6 @@ gss_create_cred(struct rpc_auth *auth, s out_err: dprintk("RPC: gss_create_cred failed with error %d\n", err); - if (cred) gss_destroy_cred(&cred->gc_base); return ERR_PTR(err); } diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index 97c981f..76b969e 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c @@ -212,7 +212,6 @@ make_checksum(s32 cksumtype, char *heade char *cksumname; struct crypto_tfm *tfm = NULL; /* XXX add to ctx? */ struct scatterlist sg[1]; - u32 code = GSS_S_FAILURE; switch (cksumtype) { case CKSUMTYPE_RSA_MD5: @@ -221,13 +220,11 @@ make_checksum(s32 cksumtype, char *heade default: dprintk("RPC: krb5_make_checksum:" " unsupported checksum %d", cksumtype); - goto out; + return GSS_S_FAILURE; } if (!(tfm = crypto_alloc_tfm(cksumname, CRYPTO_TFM_REQ_MAY_SLEEP))) - goto out; + return GSS_S_FAILURE; cksum->len = crypto_tfm_alg_digestsize(tfm); - if ((cksum->data = kmalloc(cksum->len, GFP_KERNEL)) == NULL) - goto out; crypto_digest_init(tfm); sg_set_buf(sg, header, hdrlen); @@ -235,10 +232,8 @@ make_checksum(s32 cksumtype, char *heade process_xdr_buf(body, body_offset, body->len - body_offset, checksummer, tfm); crypto_digest_final(tfm, cksum->data); - code = 0; -out: crypto_free_tfm(tfm); - return code; + return 0; } EXPORT_SYMBOL(make_checksum); diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index dea5296..15c2db2 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c @@ -176,7 +176,8 @@ void rpc_count_iostats(struct rpc_task * op_metrics->om_execute += execute; } -void _print_name(struct seq_file *seq, unsigned int op, struct rpc_procinfo *procs) +static void _print_name(struct seq_file *seq, unsigned int op, + struct rpc_procinfo *procs) { if (procs[op].p_name) seq_printf(seq, "\t%12s: ", procs[op].p_name); diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index ae5ab98..8012d10 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -531,7 +532,7 @@ int main(int ac, char **av) break; case 'h': case '?': - printf("%s [-o|-s] config\n", av[0]); + fprintf(stderr, "See README for usage info\n"); exit(0); } } diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c index 640d0bf..84047f6 100644 --- a/security/selinux/ss/mls.c +++ b/security/selinux/ss/mls.c @@ -264,7 +264,7 @@ int mls_context_to_sid(char oldc, if (!selinux_mls_enabled) { if (def_sid != SECSID_NULL && oldc) - *scontext += strlen(*scontext); + *scontext += strlen(*scontext)+1; return 0; } diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index 8687ae3..b49a45c 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c @@ -183,7 +183,8 @@ static void snd_mpu401_uart_remove_timer */ -static void snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, int ack) +static int snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, + int ack) { unsigned long flags; int timeout, ok; @@ -218,9 +219,11 @@ static void snd_mpu401_uart_cmd(struct s ok = 1; } spin_unlock_irqrestore(&mpu->input_lock, flags); - if (! ok) + if (!ok) { snd_printk("cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)\n", cmd, mpu->port, mpu->read(mpu, MPU401C(mpu)), mpu->read(mpu, MPU401D(mpu))); - // snd_printk("cmd: 0x%x at 0x%lx (status = 0x%x, data = 0x%x)\n", cmd, mpu->port, mpu->read(mpu, MPU401C(mpu)), mpu->read(mpu, MPU401D(mpu))); + return 1; + } + return 0; } /* @@ -235,12 +238,19 @@ static int snd_mpu401_uart_input_open(st if (mpu->open_input && (err = mpu->open_input(mpu)) < 0) return err; if (! test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode)) { - snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1); - snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1); + if (snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1)) + goto error_out; + if (snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1)) + goto error_out; } mpu->substream_input = substream; set_bit(MPU401_MODE_BIT_INPUT, &mpu->mode); return 0; + +error_out: + if (mpu->open_input && mpu->close_input) + mpu->close_input(mpu); + return -EIO; } static int snd_mpu401_uart_output_open(struct snd_rawmidi_substream *substream) @@ -252,39 +262,52 @@ static int snd_mpu401_uart_output_open(s if (mpu->open_output && (err = mpu->open_output(mpu)) < 0) return err; if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) { - snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1); - snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1); + if (snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1)) + goto error_out; + if (snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1)) + goto error_out; } mpu->substream_output = substream; set_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode); return 0; + +error_out: + if (mpu->open_output && mpu->close_output) + mpu->close_output(mpu); + return -EIO; } static int snd_mpu401_uart_input_close(struct snd_rawmidi_substream *substream) { struct snd_mpu401 *mpu; + int err = 0; mpu = substream->rmidi->private_data; clear_bit(MPU401_MODE_BIT_INPUT, &mpu->mode); mpu->substream_input = NULL; if (! test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode)) - snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0); + err = snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0); if (mpu->close_input) mpu->close_input(mpu); + if (err) + return -EIO; return 0; } static int snd_mpu401_uart_output_close(struct snd_rawmidi_substream *substream) { struct snd_mpu401 *mpu; + int err = 0; mpu = substream->rmidi->private_data; clear_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode); mpu->substream_output = NULL; if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) - snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0); + err = snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0); if (mpu->close_output) mpu->close_output(mpu); + if (err) + return -EIO; return 0; } @@ -316,6 +339,7 @@ static void snd_mpu401_uart_input_trigge snd_mpu401_uart_remove_timer(mpu, 1); clear_bit(MPU401_MODE_BIT_INPUT_TRIGGER, &mpu->mode); } + } /* diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig index 88e52dc..6275266 100644 --- a/sound/oss/Kconfig +++ b/sound/oss/Kconfig @@ -5,23 +5,9 @@ # # Prompt user for primary drivers. -config OBSOLETE_OSS_DRIVER - bool "Obsolete OSS drivers" - depends on SOUND_PRIME - help - This option enables support for obsolete OSS drivers that - are scheduled for removal in the near future since there - are ALSA drivers for the same hardware. - - Please contact Adrian Bunk if you had to - say Y here because your soundcard is not properly supported - by ALSA. - - If unsure, say N. - config SOUND_BT878 tristate "BT878 audio dma" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER + depends on SOUND_PRIME && PCI ---help--- Audio DMA support for bt878 based grabber boards. As you might have already noticed, bt878 is listed with two functions in /proc/pci. @@ -35,48 +21,9 @@ config SOUND_BT878 To compile this driver as a module, choose M here: the module will be called btaudio. -config SOUND_CMPCI - tristate "C-Media PCI (CMI8338/8738)" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER - help - Say Y or M if you have a PCI sound card using the CMI8338 - or the CMI8738 chipset. Data on these chips are available at - . - - A userspace utility to control some internal registers of these - chips is available at - . - -config SOUND_CMPCI_FM - bool "Enable legacy FM" - depends on SOUND_CMPCI && X86 - help - Say Y here to enable the legacy FM (frequency-modulation) synthesizer - support on a card using the CMI8338 or CMI8378 chipset. Even it is - enabled, you need to set fmio as proper value to enable it. - Say N here if you don't need this. - -config SOUND_CMPCI_MIDI - bool "Enable legacy MPU-401" - depends on SOUND_CMPCI && X86 - help - Say Y here to enable the legacy MPU401 MIDI synthesizer support on a - card using the CMI8338 or CMI8378 chipset. Even it is enabled, - you need to set mpuio as proper value to enable it. - Say N here if you don't need this. - -config SOUND_CMPCI_JOYSTICK - bool "Enable joystick" - depends on SOUND_CMPCI && X86 && (GAMEPORT=y || SOUND_CMPCI=GAMEPORT) - help - Say Y here in order to enable the joystick port on a sound card using - the CMI8338 or the CMI8738 chipset. You need to config the - gameport support and set joystick parameter as 1 to use it. - Say N here if you don't need this. - config SOUND_EMU10K1 tristate "Creative SBLive! (EMU10K1)" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER + depends on SOUND_PRIME && PCI ---help--- Say Y or M if you have a PCI sound card using the EMU10K1 chipset, such as the Creative SBLive!, SB PCI512 or Emu-APS. @@ -108,13 +55,6 @@ config SOUND_FUSION series) when wired as native sound drivers with AC97 codecs. If this driver does not work try the CS4232 driver. -config SOUND_CS4281 - tristate "Crystal Sound CS4281" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER - help - Picture and feature list at - . - config SOUND_BCM_CS4297A tristate "Crystal Sound CS4297a (for Swarm)" depends on SOUND_PRIME && SIBYTE_SWARM @@ -125,22 +65,9 @@ config SOUND_BCM_CS4297A note that CONFIG_KGDB should not be enabled at the same time, since it also attempts to use this UART port. -config SOUND_ES1370 - tristate "Ensoniq AudioPCI (ES1370)" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER - help - Say Y or M if you have a PCI sound card utilizing the Ensoniq - ES1370 chipset, such as Ensoniq's AudioPCI (non-97). To find - out if your sound card uses an ES1370 without removing your - computer's cover, use lspci -n and look for the PCI ID - 1274:5000. Since Ensoniq was bought by Creative Labs, - Sound Blaster 64/PCI models are either ES1370 or ES1371 based. - This driver differs slightly from OSS/Free, so PLEASE READ - . - config SOUND_ES1371 tristate "Creative Ensoniq AudioPCI 97 (ES1371)" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER + depends on SOUND_PRIME && PCI help Say Y or M if you have a PCI sound card utilizing the Ensoniq ES1371 chipset, such as Ensoniq's AudioPCI97. To find out if @@ -151,33 +78,6 @@ config SOUND_ES1371 slightly from OSS/Free, so PLEASE READ . -config SOUND_ESSSOLO1 - tristate "ESS Technology Solo1" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER - help - Say Y or M if you have a PCI sound card utilizing the ESS Technology - Solo1 chip. To find out if your sound card uses a - Solo1 chip without removing your computer's cover, use - lspci -n and look for the PCI ID 125D:1969. This driver - differs slightly from OSS/Free, so PLEASE READ - . - -config SOUND_MAESTRO - tristate "ESS Maestro, Maestro2, Maestro2E driver" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER - help - Say Y or M if you have a sound system driven by ESS's Maestro line - of PCI sound chips. These include the Maestro 1, Maestro 2, and - Maestro 2E. See for more - details. - -config SOUND_MAESTRO3 - tristate "ESS Maestro3/Allegro driver (EXPERIMENTAL)" - depends on SOUND_PRIME && PCI && EXPERIMENTAL && OBSOLETE_OSS_DRIVER - help - Say Y or M if you have a sound system driven by ESS's Maestro 3 - PCI sound chip. - config SOUND_ICH tristate "Intel ICH (i8xx) audio support" depends on SOUND_PRIME && PCI @@ -185,24 +85,6 @@ config SOUND_ICH Support for integral audio in Intel's I/O Controller Hub (ICH) chipset, as used on the 810/820/840 motherboards. -config SOUND_HARMONY - tristate "PA Harmony audio driver" - depends on GSC_LASI && SOUND_PRIME && OBSOLETE_OSS_DRIVER - help - Say 'Y' or 'M' to include support for Harmony soundchip - on HP 712, 715/new and many other GSC based machines. - -config SOUND_SONICVIBES - tristate "S3 SonicVibes" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER - help - Say Y or M if you have a PCI sound card utilizing the S3 - SonicVibes chipset. To find out if your sound card uses a - SonicVibes chip without removing your computer's cover, use - lspci -n and look for the PCI ID 5333:CA00. This driver - differs slightly from OSS/Free, so PLEASE READ - . - config SOUND_VWSND tristate "SGI Visual Workstation Sound" depends on SOUND_PRIME && X86_VISWS @@ -231,10 +113,6 @@ config SOUND_VRC5477 integrated, multi-function controller chip for MIPS CPUs. Works with the AC97 codec. -config SOUND_AU1000 - tristate "Au1000 Sound" - depends on SOUND_PRIME && (SOC_AU1000 || SOC_AU1100 || SOC_AU1500) && OBSOLETE_OSS_DRIVER - config SOUND_AU1550_AC97 tristate "Au1550 AC97 Sound" depends on SOUND_PRIME && SOC_AU1550 @@ -507,7 +385,7 @@ config MSND_FIFOSIZE config SOUND_VIA82CXXX tristate "VIA 82C686 Audio Codec" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER + depends on SOUND_PRIME && PCI help Say Y here to include support for the audio codec found on VIA 82Cxxx-based chips. Typically these are built into a motherboard. @@ -576,18 +454,6 @@ config SOUND_AD1889 Say M here if you have a sound card based on the Analog Devices AD1889 chip. -config SOUND_SGALAXY - tristate "Aztech Sound Galaxy (non-PnP) cards" - depends on SOUND_OSS && OBSOLETE_OSS_DRIVER - help - This module initializes the older non Plug and Play sound galaxy - cards from Aztech. It supports the Waverider Pro 32 - 3D and the - Galaxy Washington 16. - - If you compile the driver into the kernel, you have to add - "sgalaxy=,,,," to the kernel command - line. - config SOUND_ADLIB tristate "Adlib Cards" depends on SOUND_OSS @@ -612,56 +478,6 @@ config SOUND_ACI_MIXER This driver is also available as a module and will be called aci. -config SOUND_CS4232 - tristate "Crystal CS4232 based (PnP) cards" - depends on SOUND_OSS && OBSOLETE_OSS_DRIVER - help - Say Y here if you have a card based on the Crystal CS4232 chip set, - which uses its own Plug and Play protocol. - - If you compile the driver into the kernel, you have to add - "cs4232=,,,,," to the kernel - command line. - - See for more information on - configuring this card. - -config SOUND_SSCAPE - tristate "Ensoniq SoundScape support" - depends on SOUND_OSS && OBSOLETE_OSS_DRIVER - help - Answer Y if you have a sound card based on the Ensoniq SoundScape - chipset. Such cards are being manufactured at least by Ensoniq, Spea - and Reveal (Reveal makes also other cards). - - If you compile the driver into the kernel, you have to add - "sscape=,,,," to the kernel command - line. - -config SOUND_GUS - tristate "Gravis Ultrasound support" - depends on SOUND_OSS && OBSOLETE_OSS_DRIVER - help - Say Y here for any type of Gravis Ultrasound card, including the GUS - or GUS MAX. See also for more - information on configuring this card with modules. - - If you compile the driver into the kernel, you have to add - "gus=,,," to the kernel command line. - -config SOUND_GUS16 - bool "16 bit sampling option of GUS (_NOT_ GUS MAX)" - depends on SOUND_GUS - help - Support for Gravis Ulstrasound (GUS) cards (other than the GUS), - sampling at 16-bit width. - -config SOUND_GUSMAX - bool "GUS MAX support" - depends on SOUND_GUS - help - Support for Gravis Ulstrasound MAX. - config SOUND_VMIDI tristate "Loopback MIDI device support" depends on SOUND_OSS @@ -742,7 +558,7 @@ config SOUND_MPU401 config SOUND_NM256 tristate "NM256AV/NM256ZX audio support" - depends on SOUND_OSS && OBSOLETE_OSS_DRIVER + depends on SOUND_OSS help Say M here to include audio support for the NeoMagic 256AV/256ZX chipsets. These are the audio chipsets found in the Sony @@ -752,35 +568,6 @@ config SOUND_NM256 See for further information. -config SOUND_MAD16 - tristate "OPTi MAD16 and/or Mozart based cards" - depends on SOUND_OSS && OBSOLETE_OSS_DRIVER - ---help--- - Answer Y if your card has a Mozart (OAK OTI-601) or MAD16 (OPTi - 82C928 or 82C929 or 82C931) audio interface chip. These chips are - quite common so it's possible that many no-name cards have one of - them. In addition the MAD16 chip is used in some cards made by known - manufacturers such as Turtle Beach (Tropez), Reveal (some models) - and Diamond (latest ones). Note however that the Tropez sound cards - have their own driver; if you have one of those, say N here and Y or - M to "Full support for Turtle Beach WaveFront", below. - - If you compile the driver into the kernel, you have to add - "mad16=,,,,," to the - kernel command line. - - See also and - for more information on setting - these cards up as modules. - -config MAD16_OLDCARD - bool "Support MIDI in older MAD16 based cards (requires SB)" - depends on SOUND_MAD16 - help - Answer Y (or M) if you have an older card based on the C928 or - Mozart chipset and you want to have MIDI support. If you enable this - option you also need to enable support for Sound Blaster. - config SOUND_PAS tristate "ProAudioSpectrum 16 support" depends on SOUND_OSS @@ -873,53 +660,9 @@ config SOUND_SB You can say M here to compile this driver as a module; the module is called sb. -config SOUND_AWE32_SYNTH - tristate "AWE32 synth" - depends on SOUND_OSS && OBSOLETE_OSS_DRIVER - help - Say Y here if you have a Sound Blaster SB32, AWE32-PnP, SB AWE64 or - similar sound card. See , - and the Soundblaster-AWE - mini-HOWTO, available from - for more info. - -config SOUND_WAVEFRONT - tristate "Full support for Turtle Beach WaveFront (Tropez Plus, Tropez, Maui) synth/soundcards" - depends on SOUND_OSS && m && OBSOLETE_OSS_DRIVER - help - Answer Y or M if you have a Tropez Plus, Tropez or Maui sound card - and read the files and - . - -config SOUND_MAUI - tristate "Limited support for Turtle Beach Wave Front (Maui, Tropez) synthesizers" - depends on SOUND_OSS && OBSOLETE_OSS_DRIVER - help - Say Y here if you have a Turtle Beach Wave Front, Maui, or Tropez - sound card. - - If you compile the driver into the kernel, you have to add - "maui=," to the kernel command line. - -config MAUI_HAVE_BOOT - bool "Have OSWF.MOT firmware file" - depends on SOUND_MAUI=y && !STANDALONE - help - Turtle Beach Maui and Tropez sound cards have a microcontroller - which needs to be initialized prior to use. OSWF.MOT is a file - distributed with the card's DOS/Windows drivers. Answer Y if you - have this file. - -config MAUI_BOOT_FILE - string "Full pathname of OSWF.MOT firmware file" - depends on MAUI_HAVE_BOOT - default "/etc/sound/oswf.mot" - help - Enter the full pathname of your OSWF.MOT file, starting from /. - config SOUND_YM3812 tristate "Yamaha FM synthesizer (YM3812/OPL-3) support" - depends on SOUND_OSS && OBSOLETE_OSS_DRIVER + depends on SOUND_OSS ---help--- Answer Y if your card has a FM chip made by Yamaha (OPL2/OPL3/OPL4). Answering Y is usually a safe and recommended choice, however some @@ -933,18 +676,6 @@ config SOUND_YM3812 If unsure, say Y. -config SOUND_OPL3SA1 - tristate "Yamaha OPL3-SA1 audio controller" - depends on SOUND_OSS && OBSOLETE_OSS_DRIVER - help - Say Y or M if you have a Yamaha OPL3-SA1 sound chip, which is - usually built into motherboards. Read - for details. - - If you compile the driver into the kernel, you have to add - "opl3sa=,,,,," to the kernel - command line. - config SOUND_OPL3SA2 tristate "Yamaha OPL3-SA2 and SA3 based PnP cards" depends on SOUND_OSS @@ -959,19 +690,6 @@ config SOUND_OPL3SA2 "opl3sa2=,,,,," to the kernel command line. -config SOUND_YMFPCI - tristate "Yamaha YMF7xx PCI audio (native mode)" - depends on SOUND_OSS && PCI && OBSOLETE_OSS_DRIVER - help - Support for Yamaha cards including the YMF711, YMF715, YMF718, - YMF719, YMF724, Waveforce 192XG, and Waveforce 192 Digital. - -config SOUND_YMFPCI_LEGACY - bool "Yamaha PCI legacy ports support" - depends on SOUND_YMFPCI - help - Support for YMF7xx PCI cards emulating an MP401. - config SOUND_UART6850 tristate "6850 UART support" depends on SOUND_OSS @@ -1101,30 +819,6 @@ config SOUND_KAHLUA tristate "XpressAudio Sound Blaster emulation" depends on SOUND_SB -config SOUND_ALI5455 - tristate "ALi5455 audio support" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER - -config SOUND_FORTE - tristate "ForteMedia FM801 driver" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER - help - Say Y or M if you want driver support for the ForteMedia FM801 PCI - audio controller (Abit AU10, Genius Sound Maker, HP Workstation - zx2000, and others). - -config SOUND_RME96XX - tristate "RME Hammerfall (RME96XX) support" - depends on SOUND_PRIME && PCI && OBSOLETE_OSS_DRIVER - help - Say Y or M if you have a Hammerfall or Hammerfall light - multichannel card from RME. If you want to access advanced - features of the card, read . - -config SOUND_AD1980 - tristate "AD1980 front/back switch plugin" - depends on SOUND_PRIME && OBSOLETE_OSS_DRIVER - config SOUND_SH_DAC_AUDIO tristate "SuperH DAC audio support" depends on SOUND_PRIME && CPU_SH3 diff --git a/sound/oss/ad1889.c b/sound/oss/ad1889.c index 54dabf8..a4ca756 100644 --- a/sound/oss/ad1889.c +++ b/sound/oss/ad1889.c @@ -75,7 +75,7 @@ static inline void ad1889_set_wav_rate(a DBG("Setting WAV rate to %d\n", rate); dev->state[AD_WAV_STATE].dmabuf.rate = rate; - AD1889_WRITEW(dev, AD_DSWAS, rate); + AD1889_WRITEW(dev, AD_DS_WAS, rate); /* Cycle the DAC to enable the new rate */ ac97_codec->codec_write(dev->ac97_codec, AC97_POWER_CONTROL, 0x0200); @@ -89,14 +89,14 @@ static inline void ad1889_set_wav_fmt(ad DBG("Setting WAV format to 0x%x\n", fmt); - tmp = AD1889_READW(ad1889_dev, AD_DSWSMC); + tmp = AD1889_READW(ad1889_dev, AD_DS_WSMC); if (fmt & AFMT_S16_LE) { //tmp |= 0x0100; /* set WA16 */ tmp |= 0x0300; /* set WA16 stereo */ } else if (fmt & AFMT_U8) { tmp &= ~0x0100; /* clear WA16 */ } - AD1889_WRITEW(ad1889_dev, AD_DSWSMC, tmp); + AD1889_WRITEW(ad1889_dev, AD_DS_WSMC, tmp); } static inline void ad1889_set_adc_fmt(ad1889_dev_t *dev, int fmt) @@ -105,13 +105,13 @@ static inline void ad1889_set_adc_fmt(ad DBG("Setting ADC format to 0x%x\n", fmt); - tmp = AD1889_READW(ad1889_dev, AD_DSRAMC); + tmp = AD1889_READW(ad1889_dev, AD_DS_RAMC); if (fmt & AFMT_S16_LE) { tmp |= 0x0100; /* set WA16 */ } else if (fmt & AFMT_U8) { tmp &= ~0x0100; /* clear WA16 */ } - AD1889_WRITEW(ad1889_dev, AD_DSRAMC, tmp); + AD1889_WRITEW(ad1889_dev, AD_DS_RAMC, tmp); } static void ad1889_start_wav(ad1889_state_t *state) @@ -145,21 +145,21 @@ static void ad1889_start_wav(ad1889_stat dmabuf->rd_ptr, dmabuf->dma_len); /* load up the current register set */ - AD1889_WRITEL(ad1889_dev, AD_DMAWAVCC, cnt); - AD1889_WRITEL(ad1889_dev, AD_DMAWAVICC, cnt); - AD1889_WRITEL(ad1889_dev, AD_DMAWAVCA, dmabuf->dma_handle); + AD1889_WRITEL(ad1889_dev, AD_DMA_WAVCC, cnt); + AD1889_WRITEL(ad1889_dev, AD_DMA_WAVICC, cnt); + AD1889_WRITEL(ad1889_dev, AD_DMA_WAVCA, dmabuf->dma_handle); /* TODO: for now we load the base registers with the same thing */ - AD1889_WRITEL(ad1889_dev, AD_DMAWAVBC, cnt); - AD1889_WRITEL(ad1889_dev, AD_DMAWAVIBC, cnt); - AD1889_WRITEL(ad1889_dev, AD_DMAWAVBA, dmabuf->dma_handle); + AD1889_WRITEL(ad1889_dev, AD_DMA_WAVBC, cnt); + AD1889_WRITEL(ad1889_dev, AD_DMA_WAVIBC, cnt); + AD1889_WRITEL(ad1889_dev, AD_DMA_WAVBA, dmabuf->dma_handle); /* and we're off to the races... */ - AD1889_WRITEL(ad1889_dev, AD_DMACHSS, 0x8); - tmp = AD1889_READW(ad1889_dev, AD_DSWSMC); + AD1889_WRITEL(ad1889_dev, AD_DMA_CHSS, 0x8); + tmp = AD1889_READW(ad1889_dev, AD_DS_WSMC); tmp |= 0x0400; /* set WAEN */ - AD1889_WRITEW(ad1889_dev, AD_DSWSMC, tmp); - (void) AD1889_READW(ad1889_dev, AD_DSWSMC); /* flush posted PCI write */ + AD1889_WRITEW(ad1889_dev, AD_DS_WSMC, tmp); + (void) AD1889_READW(ad1889_dev, AD_DS_WSMC); /* flush posted PCI write */ dmabuf->enable |= DAC_RUNNING; @@ -179,10 +179,10 @@ static void ad1889_stop_wav(ad1889_state u16 tmp; unsigned long cnt = dmabuf->dma_len; - tmp = AD1889_READW(ad1889_dev, AD_DSWSMC); + tmp = AD1889_READW(ad1889_dev, AD_DS_WSMC); tmp &= ~0x0400; /* clear WAEN */ - AD1889_WRITEW(ad1889_dev, AD_DSWSMC, tmp); - (void) AD1889_READW(ad1889_dev, AD_DSWSMC); /* flush posted PCI write */ + AD1889_WRITEW(ad1889_dev, AD_DS_WSMC, tmp); + (void) AD1889_READW(ad1889_dev, AD_DS_WSMC); /* flush posted PCI write */ pci_unmap_single(ad1889_dev->pci, dmabuf->dma_handle, cnt, PCI_DMA_TODEVICE); @@ -211,7 +211,7 @@ static void ad1889_startstop_adc(ad1889_ spin_lock_irqsave(&state->card->lock, flags); - tmp = AD1889_READW(ad1889_dev, AD_DSRAMC); + tmp = AD1889_READW(ad1889_dev, AD_DS_RAMC); if (start) { state->dmabuf.enable |= ADC_RUNNING; tmp |= 0x0004; /* set ADEN */ @@ -219,7 +219,7 @@ static void ad1889_startstop_adc(ad1889_ state->dmabuf.enable &= ~ADC_RUNNING; tmp &= ~0x0004; /* clear ADEN */ } - AD1889_WRITEW(ad1889_dev, AD_DSRAMC, tmp); + AD1889_WRITEW(ad1889_dev, AD_DS_RAMC, tmp); spin_unlock_irqrestore(&state->card->lock, flags); } @@ -301,53 +301,53 @@ static int ad1889_read_proc (char *page, int len, i; ad1889_dev_t *dev = data; ad1889_reg_t regs[] = { - { "WSMC", AD_DSWSMC, 16 }, - { "RAMC", AD_DSRAMC, 16 }, - { "WADA", AD_DSWADA, 16 }, - { "SYDA", AD_DSSYDA, 16 }, - { "WAS", AD_DSWAS, 16 }, - { "RES", AD_DSRES, 16 }, - { "CCS", AD_DSCCS, 16 }, - { "ADCBA", AD_DMAADCBA, 32 }, - { "ADCCA", AD_DMAADCCA, 32 }, - { "ADCBC", AD_DMAADCBC, 32 }, - { "ADCCC", AD_DMAADCCC, 32 }, - { "ADCIBC", AD_DMAADCIBC, 32 }, - { "ADCICC", AD_DMAADCICC, 32 }, - { "ADCCTRL", AD_DMAADCCTRL, 16 }, - { "WAVBA", AD_DMAWAVBA, 32 }, - { "WAVCA", AD_DMAWAVCA, 32 }, - { "WAVBC", AD_DMAWAVBC, 32 }, - { "WAVCC", AD_DMAWAVCC, 32 }, - { "WAVIBC", AD_DMAWAVIBC, 32 }, - { "WAVICC", AD_DMAWAVICC, 32 }, - { "WAVCTRL", AD_DMAWAVCTRL, 16 }, - { "DISR", AD_DMADISR, 32 }, - { "CHSS", AD_DMACHSS, 32 }, - { "IPC", AD_GPIOIPC, 16 }, - { "OP", AD_GPIOOP, 16 }, - { "IP", AD_GPIOIP, 16 }, - { "ACIC", AD_ACIC, 16 }, - { "AC97_RESET", 0x100 + AC97_RESET, 16 }, - { "AC97_MASTER_VOL_STEREO", 0x100 + AC97_MASTER_VOL_STEREO, 16 }, - { "AC97_HEADPHONE_VOL", 0x100 + AC97_HEADPHONE_VOL, 16 }, - { "AC97_MASTER_VOL_MONO", 0x100 + AC97_MASTER_VOL_MONO, 16 }, - { "AC97_MASTER_TONE", 0x100 + AC97_MASTER_TONE, 16 }, - { "AC97_PCBEEP_VOL", 0x100 + AC97_PCBEEP_VOL, 16 }, - { "AC97_PHONE_VOL", 0x100 + AC97_PHONE_VOL, 16 }, - { "AC97_MIC_VOL", 0x100 + AC97_MIC_VOL, 16 }, - { "AC97_LINEIN_VOL", 0x100 + AC97_LINEIN_VOL, 16 }, - { "AC97_CD_VOL", 0x100 + AC97_CD_VOL, 16 }, - { "AC97_VIDEO_VOL", 0x100 + AC97_VIDEO_VOL, 16 }, - { "AC97_AUX_VOL", 0x100 + AC97_AUX_VOL, 16 }, - { "AC97_PCMOUT_VOL", 0x100 + AC97_PCMOUT_VOL, 16 }, - { "AC97_RECORD_SELECT", 0x100 + AC97_RECORD_SELECT, 16 }, - { "AC97_RECORD_GAIN", 0x100 + AC97_RECORD_GAIN, 16 }, - { "AC97_RECORD_GAIN_MIC", 0x100 + AC97_RECORD_GAIN_MIC, 16 }, - { "AC97_GENERAL_PURPOSE", 0x100 + AC97_GENERAL_PURPOSE, 16 }, - { "AC97_3D_CONTROL", 0x100 + AC97_3D_CONTROL, 16 }, - { "AC97_MODEM_RATE", 0x100 + AC97_MODEM_RATE, 16 }, - { "AC97_POWER_CONTROL", 0x100 + AC97_POWER_CONTROL, 16 }, + { "WSMC", AD_DS_WSMC, 16 }, + { "RAMC", AD_DS_RAMC, 16 }, + { "WADA", AD_DS_WADA, 16 }, + { "SYDA", AD_DS_SYDA, 16 }, + { "WAS", AD_DS_WAS, 16 }, + { "RES", AD_DS_RES, 16 }, + { "CCS", AD_DS_CCS, 16 }, + { "ADCBA", AD_DMA_ADCBA, 32 }, + { "ADCCA", AD_DMA_ADCCA, 32 }, + { "ADCBC", AD_DMA_ADCBC, 32 }, + { "ADCCC", AD_DMA_ADCCC, 32 }, + { "ADCIBC", AD_DMA_ADCIBC, 32 }, + { "ADCICC", AD_DMA_ADCICC, 32 }, + { "ADCCTRL", AD_DMA_ADCCTRL, 16 }, + { "WAVBA", AD_DMA_WAVBA, 32 }, + { "WAVCA", AD_DMA_WAVCA, 32 }, + { "WAVBC", AD_DMA_WAVBC, 32 }, + { "WAVCC", AD_DMA_WAVCC, 32 }, + { "WAVIBC", AD_DMA_WAVIBC, 32 }, + { "WAVICC", AD_DMA_WAVICC, 32 }, + { "WAVCTRL", AD_DMA_WAVCTRL, 16 }, + { "DISR", AD_DMA_DISR, 32 }, + { "CHSS", AD_DMA_CHSS, 32 }, + { "IPC", AD_GPIO_IPC, 16 }, + { "OP", AD_GPIO_OP, 16 }, + { "IP", AD_GPIO_IP, 16 }, + { "ACIC", AD_AC97_ACIC, 16 }, + { "AC97_RESET", AD_AC97_BASE + AC97_RESET, 16 }, + { "AC97_MASTER_VOL_STEREO", AD_AC97_BASE + AC97_MASTER_VOL_STEREO, 16 }, + { "AC97_HEADPHONE_VOL", AD_AC97_BASE + AC97_HEADPHONE_VOL, 16 }, + { "AC97_MASTER_VOL_MONO", AD_AC97_BASE + AC97_MASTER_VOL_MONO, 16 }, + { "AC97_MASTER_TONE", AD_AC97_BASE + AC97_MASTER_TONE, 16 }, + { "AC97_PCBEEP_VOL", AD_AC97_BASE + AC97_PCBEEP_VOL, 16 }, + { "AC97_PHONE_VOL", AD_AC97_BASE + AC97_PHONE_VOL, 16 }, + { "AC97_MIC_VOL", AD_AC97_BASE + AC97_MIC_VOL, 16 }, + { "AC97_LINEIN_VOL", AD_AC97_BASE + AC97_LINEIN_VOL, 16 }, + { "AC97_CD_VOL", AD_AC97_BASE + AC97_CD_VOL, 16 }, + { "AC97_VIDEO_VOL", AD_AC97_BASE + AC97_VIDEO_VOL, 16 }, + { "AC97_AUX_VOL", AD_AC97_BASE + AC97_AUX_VOL, 16 }, + { "AC97_PCMOUT_VOL", AD_AC97_BASE + AC97_PCMOUT_VOL, 16 }, + { "AC97_RECORD_SELECT", AD_AC97_BASE + AC97_RECORD_SELECT, 16 }, + { "AC97_RECORD_GAIN", AD_AC97_BASE + AC97_RECORD_GAIN, 16 }, + { "AC97_RECORD_GAIN_MIC", AD_AC97_BASE + AC97_RECORD_GAIN_MIC, 16 }, + { "AC97_GENERAL_PURPOSE", AD_AC97_BASE + AC97_GENERAL_PURPOSE, 16 }, + { "AC97_3D_CONTROL", AD_AC97_BASE + AC97_3D_CONTROL, 16 }, + { "AC97_MODEM_RATE", AD_AC97_BASE + AC97_MODEM_RATE, 16 }, + { "AC97_POWER_CONTROL", AD_AC97_BASE + AC97_POWER_CONTROL, 16 }, { NULL } }; @@ -400,9 +400,9 @@ static inline unsigned long ad1889_get_d } if (dmabuf->enable & DAC_RUNNING) - offset = le32_to_cpu(AD1889_READL(state->card, AD_DMAWAVBA)); + offset = le32_to_cpu(AD1889_READL(state->card, AD_DMA_WAVBA)); else - offset = le32_to_cpu(AD1889_READL(state->card, AD_DMAADCBA)); + offset = le32_to_cpu(AD1889_READL(state->card, AD_DMA_ADCBA)); return (unsigned long)bus_to_virt((unsigned long)offset) - (unsigned long)dmabuf->rawbuf; } @@ -639,9 +639,9 @@ static int ad1889_ioctl(struct inode *in if (val > 5400 && val < 48000) { if (file->f_mode & FMODE_WRITE) - AD1889_WRITEW(ad1889_dev, AD_DSWAS, val); + AD1889_WRITEW(ad1889_dev, AD_DS_WAS, val); if (file->f_mode & FMODE_READ) - AD1889_WRITEW(ad1889_dev, AD_DSRES, val); + AD1889_WRITEW(ad1889_dev, AD_DS_RES, val); } return 0; @@ -649,22 +649,22 @@ static int ad1889_ioctl(struct inode *in if (get_user(val, p)) return -EFAULT; if (file->f_mode & FMODE_READ) { - val = AD1889_READW(ad1889_dev, AD_DSWSMC); + val = AD1889_READW(ad1889_dev, AD_DS_WSMC); if (val) { val |= 0x0200; /* set WAST */ } else { val &= ~0x0200; /* clear WAST */ } - AD1889_WRITEW(ad1889_dev, AD_DSWSMC, val); + AD1889_WRITEW(ad1889_dev, AD_DS_WSMC, val); } if (file->f_mode & FMODE_WRITE) { - val = AD1889_READW(ad1889_dev, AD_DSRAMC); + val = AD1889_READW(ad1889_dev, AD_DS_RAMC); if (val) { val |= 0x0002; /* set ADST */ } else { val &= ~0x0002; /* clear ADST */ } - AD1889_WRITEW(ad1889_dev, AD_DSRAMC, val); + AD1889_WRITEW(ad1889_dev, AD_DS_RAMC, val); } return 0; @@ -739,7 +739,7 @@ static int ad1889_ioctl(struct inode *in break; case SOUND_PCM_READ_RATE: - return put_user(AD1889_READW(ad1889_dev, AD_DSWAS), p); + return put_user(AD1889_READW(ad1889_dev, AD_DS_WAS), p); case SOUND_PCM_READ_CHANNELS: case SOUND_PCM_READ_BITS: @@ -769,7 +769,7 @@ static int ad1889_open(struct inode *ino ad1889_set_wav_rate(ad1889_dev, 48000); ad1889_set_wav_fmt(ad1889_dev, AFMT_S16_LE); - AD1889_WRITEW(ad1889_dev, AD_DSWADA, 0x0404); /* attenuation */ + AD1889_WRITEW(ad1889_dev, AD_DS_WADA, 0x0404); /* attenuation */ return nonseekable_open(inode, file); } @@ -826,15 +826,15 @@ static void ad1889_codec_write(struct ac { ad1889_dev_t *dev = ac97->private_data; - //DBG("Writing 0x%x to 0x%lx\n", val, dev->regbase + 0x100 + reg); - AD1889_WRITEW(dev, 0x100 + reg, val); + //DBG("Writing 0x%x to 0x%lx\n", val, dev->regbase + AD_AC97_BASE + reg); + AD1889_WRITEW(dev, AD_AC97_BASE + reg, val); } static u16 ad1889_codec_read(struct ac97_codec *ac97, u8 reg) { ad1889_dev_t *dev = ac97->private_data; - //DBG("Reading from 0x%lx\n", dev->regbase + 0x100 + reg); - return AD1889_READW(dev, 0x100 + reg); + //DBG("Reading from 0x%lx\n", dev->regbase + AD_AC97_BASE + reg); + return AD1889_READW(dev, AD_AC97_BASE + reg); } static int ad1889_ac97_init(ad1889_dev_t *dev, int id) @@ -883,24 +883,24 @@ static int ad1889_aclink_reset(struct pc int retry = 200; ad1889_dev_t *dev = pci_get_drvdata(pcidev); - AD1889_WRITEW(dev, AD_DSCCS, 0x8000); /* turn on clock */ - AD1889_READW(dev, AD_DSCCS); + AD1889_WRITEW(dev, AD_DS_CCS, 0x8000); /* turn on clock */ + AD1889_READW(dev, AD_DS_CCS); WAIT_10MS(); - stat = AD1889_READW(dev, AD_ACIC); + stat = AD1889_READW(dev, AD_AC97_ACIC); stat |= 0x0002; /* Reset Disable */ - AD1889_WRITEW(dev, AD_ACIC, stat); - (void) AD1889_READW(dev, AD_ACIC); /* flush posted write */ + AD1889_WRITEW(dev, AD_AC97_ACIC, stat); + (void) AD1889_READW(dev, AD_AC97_ACIC); /* flush posted write */ udelay(10); - stat = AD1889_READW(dev, AD_ACIC); + stat = AD1889_READW(dev, AD_AC97_ACIC); stat |= 0x0001; /* Interface Enable */ - AD1889_WRITEW(dev, AD_ACIC, stat); + AD1889_WRITEW(dev, AD_AC97_ACIC, stat); do { - if (AD1889_READW(dev, AD_ACIC) & 0x8000) /* Ready */ + if (AD1889_READW(dev, AD_AC97_ACIC) & 0x8000) /* Ready */ break; WAIT_10MS(); retry--; @@ -908,16 +908,16 @@ static int ad1889_aclink_reset(struct pc if (!retry) { printk(KERN_ERR "ad1889_aclink_reset: codec is not ready [0x%x]\n", - AD1889_READW(dev, AD_ACIC)); + AD1889_READW(dev, AD_AC97_ACIC)); return -EBUSY; } /* TODO reset AC97 codec */ /* TODO set wave/adc pci ctrl status */ - stat = AD1889_READW(dev, AD_ACIC); + stat = AD1889_READW(dev, AD_AC97_ACIC); stat |= 0x0004; /* Audio Stream Output Enable */ - AD1889_WRITEW(dev, AD_ACIC, stat); + AD1889_WRITEW(dev, AD_AC97_ACIC, stat); return 0; } @@ -935,10 +935,10 @@ static irqreturn_t ad1889_interrupt(int u32 stat; ad1889_dev_t *dev = (ad1889_dev_t *)dev_id; - stat = AD1889_READL(dev, AD_DMADISR); + stat = AD1889_READL(dev, AD_DMA_DISR); /* clear ISR */ - AD1889_WRITEL(dev, AD_DMADISR, stat); + AD1889_WRITEL(dev, AD_DMA_DISR, stat); if (stat & 0x8) { /* WAVI */ DBG("WAV interrupt\n"); @@ -964,15 +964,15 @@ static void ad1889_initcfg(ad1889_dev_t u32 tmp32; /* make sure the interrupt bits are setup the way we want */ - tmp32 = AD1889_READL(dev, AD_DMAWAVCTRL); + tmp32 = AD1889_READL(dev, AD_DMA_WAVCTRL); tmp32 &= ~0xff; /* flat dma, no sg, mask out the intr bits */ tmp32 |= 0x6; /* intr on count, loop */ - AD1889_WRITEL(dev, AD_DMAWAVCTRL, tmp32); + AD1889_WRITEL(dev, AD_DMA_WAVCTRL, tmp32); /* unmute... */ - tmp16 = AD1889_READW(dev, AD_DSWADA); + tmp16 = AD1889_READW(dev, AD_DS_WADA); tmp16 &= ~0x8080; - AD1889_WRITEW(dev, AD_DSWADA, tmp16); + AD1889_WRITEW(dev, AD_DS_WADA, tmp16); } static int __devinit ad1889_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) @@ -1005,7 +1005,7 @@ static int __devinit ad1889_probe(struct goto out1; } - dev->regbase = ioremap_nocache(bar, AD_DSIOMEMSIZE); + dev->regbase = ioremap_nocache(bar, AD_DS_IOMEMSIZE); if (!dev->regbase) { printk(KERN_ERR DEVNAME ": unable to remap iomem\n"); goto out2; diff --git a/sound/oss/ad1889.h b/sound/oss/ad1889.h index 861b321..0991376 100644 --- a/sound/oss/ad1889.h +++ b/sound/oss/ad1889.h @@ -1,57 +1,58 @@ #ifndef _AD1889_H_ #define _AD1889_H_ -#define AD_DSWSMC 0x00 /* DMA input wave/syn mixer control */ -#define AD_DSRAMC 0x02 /* DMA output resamp/ADC mixer control */ -#define AD_DSWADA 0x04 /* DMA input wave attenuation */ -#define AD_DSSYDA 0x06 /* DMA input syn attentuation */ -#define AD_DSWAS 0x08 /* wave input sample rate */ -#define AD_DSRES 0x0a /* resampler output sample rate */ -#define AD_DSCCS 0x0c /* chip control/status */ - -#define AD_DMARESBA 0x40 /* RES base addr */ -#define AD_DMARESCA 0x44 /* RES current addr */ -#define AD_DMARESBC 0x48 /* RES base cnt */ -#define AD_DMARESCC 0x4c /* RES current count */ -#define AD_DMAADCBA 0x50 /* ADC */ -#define AD_DMAADCCA 0x54 -#define AD_DMAADCBC 0x58 -#define AD_DMAADCCC 0x5c -#define AD_DMASYNBA 0x60 /* SYN */ -#define AD_DMASYNCA 0x64 -#define AD_DMASYNBC 0x68 -#define AD_DMASYNCC 0x6c -#define AD_DMAWAVBA 0x70 /* WAV */ -#define AD_DMAWAVCA 0x74 -#define AD_DMAWAVBC 0x78 -#define AD_DMAWAVCC 0x7c -#define AD_DMARESICC 0x80 /* RES interrupt current count */ -#define AD_DMARESIBC 0x84 /* RES interrupt base count */ -#define AD_DMAADCICC 0x88 /* ADC interrupt current count */ -#define AD_DMAADCIBC 0x8c /* ADC interrupt base count */ -#define AD_DMASYNICC 0x90 /* SYN interrupt current count */ -#define AD_DMASYNIBC 0x94 /* SYN interrupt base count */ -#define AD_DMAWAVICC 0x98 /* WAV interrupt current count */ -#define AD_DMAWAVIBC 0x9c /* WAV interrupt base count */ -#define AD_DMARESCTRL 0xa0 /* RES PCI control/status */ -#define AD_DMAADCCTRL 0xa8 /* ADC PCI control/status */ -#define AD_DMASYNCTRL 0xb0 /* SYN PCI control/status */ -#define AD_DMAWAVCTRL 0xb8 /* WAV PCI control/status */ -#define AD_DMADISR 0xc0 /* PCI DMA intr status */ -#define AD_DMACHSS 0xc4 /* PCI DMA channel stop status */ - -#define AD_GPIOIPC 0xc8 /* IO port ctrl */ -#define AD_GPIOOP 0xca /* IO output status */ -#define AD_GPIOIP 0xcc /* IO input status */ +#define AD_DS_WSMC 0x00 /* DMA input wave/syn mixer control */ +#define AD_DS_RAMC 0x02 /* DMA output resamp/ADC mixer control */ +#define AD_DS_WADA 0x04 /* DMA input wave attenuation */ +#define AD_DS_SYDA 0x06 /* DMA input syn attentuation */ +#define AD_DS_WAS 0x08 /* wave input sample rate */ +#define AD_DS_RES 0x0a /* resampler output sample rate */ +#define AD_DS_CCS 0x0c /* chip control/status */ + +#define AD_DMA_RESBA 0x40 /* RES base addr */ +#define AD_DMA_RESCA 0x44 /* RES current addr */ +#define AD_DMA_RESBC 0x48 /* RES base cnt */ +#define AD_DMA_RESCC 0x4c /* RES current count */ +#define AD_DMA_ADCBA 0x50 /* ADC */ +#define AD_DMA_ADCCA 0x54 +#define AD_DMA_ADCBC 0x58 +#define AD_DMA_ADCCC 0x5c +#define AD_DMA_SYNBA 0x60 /* SYN */ +#define AD_DMA_SYNCA 0x64 +#define AD_DMA_SYNBC 0x68 +#define AD_DMA_SYNCC 0x6c +#define AD_DMA_WAVBA 0x70 /* WAV */ +#define AD_DMA_WAVCA 0x74 +#define AD_DMA_WAVBC 0x78 +#define AD_DMA_WAVCC 0x7c +#define AD_DMA_RESICC 0x80 /* RES interrupt current count */ +#define AD_DMA_RESIBC 0x84 /* RES interrupt base count */ +#define AD_DMA_ADCICC 0x88 /* ADC interrupt current count */ +#define AD_DMA_ADCIBC 0x8c /* ADC interrupt base count */ +#define AD_DMA_SYNICC 0x90 /* SYN interrupt current count */ +#define AD_DMA_SYNIBC 0x94 /* SYN interrupt base count */ +#define AD_DMA_WAVICC 0x98 /* WAV interrupt current count */ +#define AD_DMA_WAVIBC 0x9c /* WAV interrupt base count */ +#define AD_DMA_RESCTRL 0xa0 /* RES PCI control/status */ +#define AD_DMA_ADCCTRL 0xa8 /* ADC PCI control/status */ +#define AD_DMA_SYNCTRL 0xb0 /* SYN PCI control/status */ +#define AD_DMA_WAVCTRL 0xb8 /* WAV PCI control/status */ +#define AD_DMA_DISR 0xc0 /* PCI DMA intr status */ +#define AD_DMA_CHSS 0xc4 /* PCI DMA channel stop status */ + +#define AD_GPIO_IPC 0xc8 /* IO port ctrl */ +#define AD_GPIO_OP 0xca /* IO output status */ +#define AD_GPIO_IP 0xcc /* IO input status */ /* AC97 registers, 0x100 - 0x17f; see ac97.h */ -#define AD_ACIC 0x180 /* AC Link interface ctrl */ +#define AD_AC97_BASE 0x100 /* ac97 base register */ +#define AD_AC97_ACIC 0x180 /* AC Link interface ctrl */ /* OPL3; BAR1 */ -#define AD_OPLM0AS 0x00 /* Music0 address/status */ -#define AD_OPLM0DATA 0x01 /* Music0 data */ -#define AD_OPLM1A 0x02 /* Music1 address */ -#define AD_OPLM1DATA 0x03 /* Music1 data */ +#define AD_OPL_M0AS 0x00 /* Music0 address/status */ +#define AD_OPL_M0DATA 0x01 /* Music0 data */ +#define AD_OPL_M1A 0x02 /* Music1 address */ +#define AD_OPL_M1DATA 0x03 /* Music1 data */ /* 0x04-0x0f reserved */ /* MIDI; BAR2 */ @@ -59,9 +60,9 @@ #define AD_MISC 0x01 /* MIDI status/cmd */ /* 0x02-0xff reserved */ -#define AD_DSIOMEMSIZE 512 -#define AD_OPLMEMSIZE 16 -#define AD_MIDIMEMSIZE 16 +#define AD_DS_IOMEMSIZE 512 +#define AD_OPL_MEMSIZE 16 +#define AD_MIDI_MEMSIZE 16 #define AD_WAV_STATE 0 #define AD_ADC_STATE 1 diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c index 8131599..882ae98 100644 --- a/sound/oss/dmasound/tas_common.c +++ b/sound/oss/dmasound/tas_common.c @@ -195,8 +195,8 @@ tas_init(int driver_id, const char *driv printk(KERN_INFO "tas driver [%s])\n", driver_name); -#ifndef CONFIG_I2C_KEYWEST - request_module("i2c-keywest"); +#ifndef CONFIG_I2C_POWERMAC + request_module("i2c-powermac"); #endif tas_node = find_devices("deq"); if (tas_node == NULL) diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c index aa09ebd..46eebf5 100644 --- a/sound/ppc/daca.c +++ b/sound/ppc/daca.c @@ -255,7 +255,7 @@ int __init snd_pmac_daca_init(struct snd #ifdef CONFIG_KMOD if (current->fs->root) - request_module("i2c-keywest"); + request_module("i2c-powermac"); #endif /* CONFIG_KMOD */ mix = kmalloc(sizeof(*mix), GFP_KERNEL); diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 1146dd8..70e4ebc 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -1313,7 +1313,7 @@ int __init snd_pmac_tumbler_init(struct #ifdef CONFIG_KMOD if (current->fs->root) - request_module("i2c-keywest"); + request_module("i2c-powermac"); #endif /* CONFIG_KMOD */ mix = kmalloc(sizeof(*mix), GFP_KERNEL); diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c index 33dbcbf..83acd6c 100644 --- a/usr/gen_init_cpio.c +++ b/usr/gen_init_cpio.c @@ -471,6 +471,7 @@ int main (int argc, char *argv[]) "ERROR: incorrect format, could not locate file type line %d: '%s'\n", line_nr, line); ec = -1; + break; } if ('\n' == *type) { @@ -506,7 +507,8 @@ int main (int argc, char *argv[]) line_nr, line); } } - cpio_trailer(); + if (ec == 0) + cpio_trailer(); exit(ec); }