http://linux.bkbits.net/linux-2.5 paulus@samba.org[torvalds]|ChangeSet|20050113170151|28874 paulus # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/01/13 09:01:51-08:00 paulus@samba.org # [PATCH] PPC64 Move thread_info flags to its own cache line # # This patch fixes a problem I have been seeing since all the preempt # changes went in, which is that ppc64 SMP systems would livelock # randomly if preempt was enabled. # # It turns out that what was happening was that one cpu was spinning in # spin_lock_irq (the version at line 215 of kernel/spinlock.c) madly # doing preempt_enable() and preempt_disable() calls. The other cpu had # the lock and was trying to set the TIF_NEED_RESCHED flag for the task # running on the first cpu. That is an atomic operation which has to be # retried if another cpu writes to the same cacheline between the load # and the store, which the other cpu was doing every time it did # preempt_enable() or preempt_disable(). # # I decided to move the thread_info flags field into the next cache # line, since it is the only field that would regularly be modified by # cpus other than the one running the task that owns the thread_info. # (OK possibly the `cpu' field would be on a rebalance; I don't know the # rebalancing code, but that should be pretty infrequent.) Thus, moving # the flags field seems like a good idea generally as well as solving the # immediate problem. # # For the record I am pretty unhappy with the code we use for spin_lock # et al. with preemption turned on (the BUILD_LOCK_OPS stuff in # spinlock.c). For a start we do the atomic op (_raw_spin_trylock) each # time around the loop. That is going to be generating a lot of # unnecessary bus (or fabric) traffic. Instead, after we fail to get # the lock we should poll it with simple loads until we see that it is # clear and then retry the atomic op. Assuming a reasonable cache # design, the loads won't generate any bus traffic until another cpu # writes to the cacheline containing the lock. # # Secondly we have lost the __spin_yield call that we had on ppc64, # which is an important optimization when we are running under the # hypervisor. I can't just put that in cpu_relax because I need to know # which (virtual) cpu is holding the lock, so that I can tell the # hypervisor which virtual cpu to give my time slice to. That # information is stored in the lock variable, which is why __spin_yield # needs the address of the lock. # # Signed-off-by: Paul Mackerras # Signed-off-by: Linus Torvalds # # include/asm-ppc64/thread_info.h # 2005/01/12 23:36:24-08:00 paulus@samba.org +4 -2 # PPC64 Move thread_info flags to its own cache line # # ChangeSet # 2005/01/13 09:01:37-08:00 paulus@samba.org # [PATCH] PPC64 Add PREEMPT_BKL option # # This patch adds the PREEMPT_BKL config option for PPC64, shamelessly # stolen from the i386 version. I have this turned on in the kernel on # my desktop G5 and it seems to be just fine. # # Signed-off-by: Paul Mackerras # Signed-off-by: Linus Torvalds # # arch/ppc64/Kconfig # 2005/01/12 01:25:17-08:00 paulus@samba.org +11 -0 # PPC64 Add PREEMPT_BKL option # # ChangeSet # 2005/01/13 09:01:24-08:00 paulus@samba.org # [PATCH] PPC64 can do preempt debug too # # This patch enables the DEBUG_PREEMPT config option for PPC64. I have # this turned on on my desktop G5 and it isn't finding any problems. # (It did find one problem, in flush_tlb_pending(), that I have just # sent a patch for.) # # BTW, do we really need to restrict which architectures the config # option is available on? # # Signed-off-by: Paul Mackerras # Signed-off-by: Linus Torvalds # # lib/Kconfig.debug # 2005/01/10 14:13:28-08:00 paulus@samba.org +1 -1 # PPC64 can do preempt debug too # # include/asm-ppc64/smp.h # 2005/01/10 00:49:03-08:00 paulus@samba.org +1 -1 # PPC64 can do preempt debug too # # ChangeSet # 2005/01/13 09:01:10-08:00 paulus@samba.org # [PATCH] PPC64 Call preempt_schedule on exception exit # # This patch mirrors the recent changes on x86 to call preempt_schedule # rather than schedule in the exception exit path, in the case where the # preempt_count is zero and the TIF_NEED_RESCHED bit is set. # # I'm a little concerned that this means that we have a window where # interrupts are enabled and we are on our way into preempt_schedule, # but preempt_count is still zero. Ingo's proposed preempt_schedule_irq # would fix this, and I think something like that should go in. # # Signed-off-by: Paul Mackerras # Signed-off-by: Linus Torvalds # # arch/ppc64/kernel/entry.S # 2005/01/13 01:48:36-08:00 paulus@samba.org +2 -5 # PPC64 Call preempt_schedule on exception exit # # ChangeSet # 2005/01/13 09:00:59-08:00 paulus@samba.org # [PATCH] PPC64 Disable preemption in flush_tlb_pending # # The preempt debug stuff found a place where we were using # smp_processor_id() without having preemption disabled, in # flush_tlb_pending. This patch fixes it by using get_cpu_var and # put_cpu_var instead of the __get_cpu_var variant. # # Signed-off-by: Paul Mackerras # Signed-off-by: Linus Torvalds # # include/asm-ppc64/tlbflush.h # 2005/01/13 00:35:37-08:00 paulus@samba.org +2 -1 # PPC64 Disable preemption in flush_tlb_pending # # ChangeSet # 2005/01/13 09:00:45-08:00 axboe@suse.de # [PATCH] possible rq starvation on oom # # I stumbled across this the other day. The block layer only uses a single # memory pool for request allocation, so it's very possible for eg writes # to have allocated them all at any point in time. If that is the case and # the machine is low on memory, a reader attempting to allocate a request # and failing in blk_alloc_request() can get stuck for a long time since # no one is there to wake it up. # # The solution is either to add the extra mempool so both reads and writes # have one, or attempt to handle the situation. I chose the latter, to # save the extra memory required for the additional mempool with # BLKDEV_MIN_RQ statically allocated requests per-queue. # # If a read allocation fails and we have no readers in flight for this # queue, mark us rq-starved so that the next write being freed will wake # up the sleeping reader(s). Same situation would happen for writes as # well of course, it's just a lot more unlikely. # # Signed-off-by: Jens Axboe # Signed-off-by: Linus Torvalds # # include/linux/blkdev.h # 2005/01/13 01:16:43-08:00 axboe@suse.de +1 -0 # possible rq starvation on oom # # drivers/block/ll_rw_blk.c # 2005/01/13 01:17:36-08:00 axboe@suse.de +40 -11 # possible rq starvation on oom # # ChangeSet # 2005/01/13 09:00:32-08:00 axboe@suse.de # [PATCH] Don't enable ata over eth by default # # "ATA over Ethernet support" should not default to 'm', it doesn't make # any sense for a special case driver to do so. # # Signed-off-by: Jens Axboe # Signed-off-by: Linus Torvalds # # drivers/block/Kconfig # 2005/01/13 00:50:17-08:00 axboe@suse.de +0 -1 # Don't enable ata over eth by default # # ChangeSet # 2005/01/12 20:04:56-08:00 akropel1@rochester.rr.com # [PATCH] contort getdents64 to pacify gcc-2.96 # # A recent trivial fixup in sys_getdents64 gives gcc-2.96 indigestion in # the form of an ICE. # # While upgrading to a sane gcc would be the preferred solution, rewriting # the change as follows eliminates the error for those who cannot do so. # # Signed-off-by: Adam Kropelin # Signed-off-by: Linus Torvalds # # fs/readdir.c # 2005/01/12 14:16:55-08:00 akropel1@rochester.rr.com +3 -2 # contort getdents64 to pacify gcc-2.96 # # ChangeSet # 2005/01/12 20:04:43-08:00 davej@redhat.com # [PATCH] matroxfb driver broken on non-x86. # # This broke since the recent MODULE_PARAM conversion on # architectures that don't have CONFIG_MTRR # # Signed-off-by: Dave Jones # Signed-off-by: Linus Torvalds # # drivers/video/matrox/matroxfb_base.c # 2005/01/12 13:48:54-08:00 davej@redhat.com +2 -0 # matroxfb driver broken on non-x86. # # ChangeSet # 2005/01/12 18:14:03-08:00 torvalds@ppc970.osdl.org # Merge bk://bk.arm.linux.org.uk/linux-2.6-rmk # into ppc970.osdl.org:/home/torvalds/v2.6/linux # # MAINTAINERS # 2005/01/12 18:13:58-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # CREDITS # 2005/01/12 18:13:58-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # ChangeSet # 2005/01/12 21:03:45+00:00 nico@org.rmk.(none) # [ARM PATCH] 2204/1: bring {read|write}sw up to date with current reality # # Patch from Nicolas Pitre # # This patch adds support for all alignments to both endianness. # # Signed-off-by: Nicolas Pitre # Signed-off-by: Russell King # # arch/arm/lib/io-writesw-armv4.S # 2004/11/04 20:44:47+00:00 nico@org.rmk.(none) +38 -24 # [PATCH] 2204/1: bring {read|write}sw up to date with current reality # # arch/arm/lib/io-readsw-armv4.S # 2004/11/04 20:40:10+00:00 nico@org.rmk.(none) +59 -28 # [PATCH] 2204/1: bring {read|write}sw up to date with current reality # # ChangeSet # 2005/01/12 20:55:37+00:00 nico@org.rmk.(none) # [ARM PATCH] 2391/1: remove obsolete help text # # Patch from Nicolas Pitre # # Now that MTD XIP support is merged this part is # not relevant anymore. # # Signed-off-by: Nicolas Pitre # Signed-off-by: Russell King # # arch/arm/Kconfig # 2005/01/12 00:00:00+00:00 nico@org.rmk.(none) +0 -14 # [PATCH] 2391/1: remove obsolete help text # # ChangeSet # 2005/01/12 19:52:49+00:00 rmk@flint.arm.linux.org.uk # [ARM] Add missing tlb_migrate_finish() # # Signed-off-by: Russell King # # include/asm-arm/tlb.h # 2005/01/12 19:49:31+00:00 rmk@flint.arm.linux.org.uk +2 -0 # Add missing tlb_migrate_finish() # # ChangeSet # 2005/01/12 10:08:53-08:00 torvalds@ppc970.osdl.org # Merge http://lia64.bkbits.net/linux-ia64-release-2.6.11 # into ppc970.osdl.org:/home/torvalds/v2.6/linux # # arch/ia64/pci/pci.c # 2005/01/12 10:08:48-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # ChangeSet # 2005/01/12 10:07:41-08:00 torvalds@ppc970.osdl.org # Merge bk://linux-scsi.bkbits.net/scsi-for-linus-2.6 # into ppc970.osdl.org:/home/torvalds/v2.6/linux # # include/linux/pci_ids.h # 2005/01/12 10:07:37-08:00 torvalds@ppc970.osdl.org +0 -1 # Auto merged # # drivers/scsi/gdth.c # 2005/01/12 10:07:37-08:00 torvalds@ppc970.osdl.org +0 -0 # Auto merged # # drivers/block/cciss.c # 2005/01/12 10:07:36-08:00 torvalds@ppc970.osdl.org +0 -7 # Auto merged # # Documentation/cciss.txt # 2005/01/12 10:07:36-08:00 torvalds@ppc970.osdl.org +0 -1 # Auto merged # # ChangeSet # 2005/01/12 09:14:26-08:00 davidm@hpl.hp.com # [IA64] add hpzx1_swiotlb machine-vector (new files) # # This is really part of the earlier changeset from David to add the # new machine vector to support certain limited range DMA cards on # zx1. I just forgot to run "bk new" before the commit, so the newly # added files weren't checked into BK. # # Signed-off-by: David Mosberger-Tang # Signed-off-by: Tony Luck # # include/asm-ia64/machvec_hpzx1_swiotlb.h # 2005/01/12 09:10:35-08:00 davidm@hpl.hp.com +43 -0 # # arch/ia64/hp/zx1/hpzx1_swiotlb_machvec.c # 2005/01/12 09:10:35-08:00 davidm@hpl.hp.com +3 -0 # # include/asm-ia64/machvec_hpzx1_swiotlb.h # 2005/01/12 09:10:35-08:00 davidm@hpl.hp.com +0 -0 # BitKeeper file /data/home/aegl/BK/linux-ia64-release-2.6.11/include/asm-ia64/machvec_hpzx1_swiotlb.h # # arch/ia64/hp/zx1/hpzx1_swiotlb_machvec.c # 2005/01/12 09:10:35-08:00 davidm@hpl.hp.com +0 -0 # BitKeeper file /data/home/aegl/BK/linux-ia64-release-2.6.11/arch/ia64/hp/zx1/hpzx1_swiotlb_machvec.c # # arch/ia64/hp/common/hwsw_iommu.c # 2005/01/12 09:10:34-08:00 davidm@hpl.hp.com +185 -0 # # arch/ia64/hp/common/hwsw_iommu.c # 2005/01/12 09:10:34-08:00 davidm@hpl.hp.com +0 -0 # BitKeeper file /data/home/aegl/BK/linux-ia64-release-2.6.11/arch/ia64/hp/common/hwsw_iommu.c # # ChangeSet # 2005/01/12 09:02:21-08:00 dwmw2@infradead.org # [PATCH] ppc: fix removed MMCR0_PMXE define # # In ChangeSet 1.2370, 2005/01/11 17:41:32-08:00, tglx@linutronix.de wrote: # > # > [PATCH] ppc: remove duplicate define # > # > The MMCR0_PMXE is already defined in reg.h... # # Er, no it's not. But perhaps it should be... # # include/asm-ppc/reg.h # 2005/01/12 07:21:20-08:00 dwmw2@infradead.org +1 -0 # ppc: fix removed MMCR0_PMXE define # # ChangeSet # 2005/01/12 08:50:53-08:00 paulus@samba.org # [PATCH] PPC64 had _raw_read_trylock already # # Ingo presumably didn't notice that ppc64 already had a functional # _raw_read_trylock when he added the #define to use the generic # version. This just removes the #define so we use the ppc64-specific # version again. # # Signed-off-by: Paul Mackerras # Signed-off-by: Linus Torvalds # # include/asm-ppc64/spinlock.h # 2005/01/09 14:44:16-08:00 paulus@samba.org +0 -2 # PPC64 had _raw_read_trylock already # # ChangeSet # 2005/01/12 08:50:39-08:00 axboe@suse.de # [PATCH] elevator: print default selection # # Currently we only print the default io scheduler if the kernel chooses, # not if the user/bootloader has specified one. This patch saves the extra # line in dmesg but always notified of the default choice by appending # (default) to that line: # # .. # io scheduler noop registered # io scheduler anticipatory registered # io scheduler deadline registered # io scheduler cfq registered (default) # .. # # Patch originally from Srihari Vijayaraghavan, modified by me. # # Signed-off-by: Jens Axboe # Signed-off-by: Linus Torvalds # # drivers/block/elevator.c # 2005/01/12 00:03:47-08:00 axboe@suse.de +4 -3 # elevator: print default selection # # ChangeSet # 2005/01/12 08:49:02-08:00 tony.luck@intel.com # [IA64] reorder functions to define ia64_pci_get_legacy_mem() before using it # # Signed-off-by: Tony Luck # # ChangeSet # 2005/01/12 08:49:02-08:00 axboe@suse.de # [PATCH] cfq-iosched: fix scsi requeue accounting # # The accounting can go bad in the requeue hook, it must check the # accounted flag to make sure it was previously considered in the driver. # # Signed-off-by: Jens Axboe # Signed-off-by: Linus Torvalds # # drivers/block/cfq-iosched.c # 2005/01/11 01:03:17-08:00 axboe@suse.de +4 -2 # cfq-iosched: fix scsi requeue accounting # # ChangeSet # 2005/01/12 08:48:49-08:00 kaos@sgi.com # [PATCH] ia64: export pcibios_resource_to_bus to match other architectures. # # Signed-off-by: Keith Owens # Signed-off-by: Linus Torvalds # # arch/ia64/pci/pci.c # 2005/01/11 23:04:12-08:00 kaos@sgi.com +1 -0 # ia64: export pcibios_resource_to_bus to match other architectures. # # ChangeSet # 2005/01/12 08:48:35-08:00 ink@jurassic.park.msu.ru # [PATCH] Alpha: typos in io_trivial.h # # This apparently explains some weird IO failures reported in last two months. # Only non-bwx (including generic) kernels were affected. # # Acked-by: Richard Henderson # Signed-off-by: Linus Torvalds # # include/asm-alpha/io_trivial.h # 2005/01/11 17:47:26-08:00 ink@jurassic.park.msu.ru +2 -2 # Alpha: typos in io_trivial.h # # arch/ia64/pci/pci.c # 2005/01/12 08:47:14-08:00 tony.luck@intel.com +17 -17 # reorder functions to define ia64_pci_get_legacy_mem() before using it # # ChangeSet # 2005/01/12 08:26:35-08:00 torvalds@ppc970.osdl.org # Make mm writelock testing less intrusive. # # This enables it only for debug kernels, and also makes sure # that if some external module is still broken, we don't leave # the mmap-sem locked after warning about it. # # mm/mmap.c # 2005/01/12 08:26:28-08:00 torvalds@ppc970.osdl.org +11 -1 # Make mm writelock testing less intrusive. # # This enables it only for debug kernels, and also makes sure # that if some external module is still broken, we don't leave # the mmap-sem locked after warning about it. # # ChangeSet # 2005/01/12 08:12:09-08:00 marcelo.tosatti@cyclades.com # [PATCH] do_brk() needs mmap_sem write-locked # # It seems to be general consensus that its safer to require all do_brk() callers # to grab mmap_sem, and have do_brk to warn otherwise. This is what the following # patch does. # # Similar version has been changed to in v2.4. # # Signed-off-by: Linus Torvalds # # mm/mmap.c # 2005/01/11 17:43:11-08:00 marcelo.tosatti@cyclades.com +6 -0 # do_brk() needs mmap_sem write-locked # # fs/binfmt_elf.c # 2005/01/11 18:07:01-08:00 marcelo.tosatti@cyclades.com +11 -1 # do_brk() needs mmap_sem write-locked # # fs/binfmt_aout.c # 2005/01/11 17:31:51-08:00 marcelo.tosatti@cyclades.com +14 -3 # do_brk() needs mmap_sem write-locked # # arch/x86_64/ia32/ia32_aout.c # 2005/01/11 17:34:26-08:00 marcelo.tosatti@cyclades.com +11 -1 # do_brk() needs mmap_sem write-locked # # arch/sparc64/kernel/binfmt_aout32.c # 2005/01/11 17:37:28-08:00 marcelo.tosatti@cyclades.com +12 -0 # do_brk() needs mmap_sem write-locked # # arch/mips/kernel/irixelf.c # 2005/01/11 17:35:36-08:00 marcelo.tosatti@cyclades.com +10 -1 # do_brk() needs mmap_sem write-locked # # ChangeSet # 2005/01/12 10:09:46-06:00 jejb@mulgrave.(none) # FC Transport updates - additional fc host attributes # # From: James.Smart@Emulex.Com # # This patch adds 5 more FC transport host attributes in support of HBAAPI. # # Signed-off-by: James Bottomley # # ChangeSet # 2005/01/12 08:09:20-08:00 torvalds@ppc970.osdl.org # Handle two threads both trying to expand their stack simultaneously. # # We had all the locking right, but we didn't check whether one of the # threads now no longer needed to expand, so we could incorrectly _shrink_ # the stack in the other thread instead (not only causing segfaults, but # since we didn't do a proper unmap, we'd possibly leak pages too). # # So re-check the need for expand after getting the lock. # # Noticed by Paul Starzetz. # # mm/mmap.c # 2005/01/12 08:09:12-08:00 torvalds@ppc970.osdl.org +25 -13 # Handle two threads both trying to expand their stack simultaneously. # # include/scsi/scsi_transport_fc.h # 2005/01/12 10:08:53-06:00 jejb@mulgrave.(none) +22 -0 # FC Transport updates - additional fc host attributes # # drivers/scsi/scsi_transport_fc.c # 2005/01/12 10:08:53-06:00 jejb@mulgrave.(none) +20 -0 # FC Transport updates - additional fc host attributes # # ChangeSet # 2005/01/12 10:06:41-06:00 jejb@mulgrave.(none) # SCSI: add starget_for_each_device # # From: James.Smart@Emulex.Com # # This patch deprecates the use of device_for_each_child() with stargets. # The reasoning behind this is due to issues regarding: # Semaphores that device_for_each_child() takes # Implicit assumptions that each child is an sdev device. # # The patch adds a new helper function, starget_for_each_device(), and # replaces all previous uses of device_for_each_child(). # # Signed-off-by: James Bottomley # # include/scsi/scsi_device.h # 2005/01/12 10:05:35-06:00 jejb@mulgrave.(none) +2 -0 # SCSI: add starget_for_each_device # # drivers/scsi/scsi_transport_fc.c # 2005/01/12 10:05:35-06:00 jejb@mulgrave.(none) +7 -9 # SCSI: add starget_for_each_device # # drivers/scsi/scsi_lib.c # 2005/01/12 10:05:35-06:00 jejb@mulgrave.(none) +8 -10 # SCSI: add starget_for_each_device # # drivers/scsi/scsi.c # 2005/01/12 10:05:35-06:00 jejb@mulgrave.(none) +22 -0 # SCSI: add starget_for_each_device # # ChangeSet # 2005/01/12 15:38:50+00:00 ben-linux@org.rmk.(none) # [ARM PATCH] 2390/1: Simtec Electronics MAINTAINERS file entries # # Patch from Ben Dooks # # MAINTAINERS entries for currently supported Simtec Electronics # development boards. # # Signed-off-by: Ben Dooks # Signed-off-by: Russell King # # ChangeSet # 2005/01/12 07:36:34-08:00 ak@suse.de # [PATCH] [4/4] Fix numa=off command line parsing # # Fix a long standing bug: numa=off only worked as last argument on # the command line. # # Signed-off-by: Andi Kleen # Signed-off-by: Linus Torvalds # # arch/x86_64/mm/numa.c # 2005/01/12 07:36:24-08:00 ak@suse.de +1 -1 # [4/4] Fix numa=off command line parsing # # ChangeSet # 2005/01/12 07:36:17-08:00 ak@suse.de # [PATCH] [3/4] x86_64: Fix NUMA hash setup # # Signed-off-by: Andi Kleen # Signed-off-by: Linus Torvalds # # include/asm-x86_64/numa.h # 2005/01/12 07:36:08-08:00 ak@suse.de +1 -1 # [3/4] x86_64: Fix NUMA hash setup # # arch/x86_64/mm/srat.c # 2005/01/12 07:36:08-08:00 ak@suse.de +1 -1 # [3/4] x86_64: Fix NUMA hash setup # # arch/x86_64/mm/numa.c # 2005/01/12 07:36:08-08:00 ak@suse.de +3 -5 # [3/4] x86_64: Fix NUMA hash setup # # arch/x86_64/mm/k8topology.c # 2005/01/12 07:36:08-08:00 ak@suse.de +1 -1 # [3/4] x86_64: Fix NUMA hash setup # # ChangeSet # 2005/01/12 07:36:02-08:00 ak@suse.de # [PATCH] x86_64: Fix K8 NUMA discovery # # Fix K8 node discovery after nodemask changes. # # Signed-off-by: Andi Kleen # Signed-off-by: Linus Torvalds # # arch/x86_64/mm/k8topology.c # 2005/01/12 07:35:53-08:00 ak@suse.de +13 -8 # x86_64: Fix K8 NUMA discovery # # ChangeSet # 2005/01/12 09:35:52-06:00 akpm@osdl.org # [PATCH] use mmiowb in qla1280.c # # From: Jesse Barnes # # There are a few spots in qla1280.c that don't need a full PCI write flush # to the device, but rather a simple write ordering guarantee. This patch # changes some of the PIO reads that cause write flushes into mmiowb calls # instead, which is a lighter weight way of ensuring ordering. # # Signed-off-by: Jeremy Higdon # Signed-off-by: Jesse Barnes # Signed-off-by: Andrew Morton # Signed-off-by: James Bottomley # # ChangeSet # 2005/01/12 07:35:48-08:00 ak@suse.de # [PATCH] x86_64: Fix ACPI SRAT NUMA parsing # # Fix fallout from the recent nodemask_t changes. The node ids assigned # in the SRAT parser were off by one. # # I added a new first_unset_node() function to nodemask.h to allocate # IDs sanely. # # Signed-off-by: Andi Kleen # Signed-off-by: Linus Torvalds # # include/linux/nodemask.h # 2005/01/12 07:35:38-08:00 ak@suse.de +9 -0 # x86_64: Fix ACPI SRAT NUMA parsing # # arch/x86_64/mm/srat.c # 2005/01/12 07:35:38-08:00 ak@suse.de +10 -7 # x86_64: Fix ACPI SRAT NUMA parsing # # drivers/scsi/qla1280.c # 2004/10/21 23:20:31-05:00 akpm@osdl.org +18 -4 # use mmiowb in qla1280.c # # ChangeSet # 2005/01/12 09:29:50-06:00 akpm@osdl.org # [PATCH] SCSI aic7xxx: kill kernel 2.2 #ifdef's # # From: Adrian Bunk # # The patch below kills kernel 2.2 #ifdef's from the SCSI aic7xxx driver. # # Signed-off-by: Adrian Bunk # Signed-off-by: Andrew Morton # Signed-off-by: James Bottomley # # drivers/scsi/aic7xxx/aic7xxx_pci.c # 2005/01/10 00:47:25-06:00 akpm@osdl.org +2 -2 # SCSI aic7xxx: kill kernel 2.2 #ifdef's # # drivers/scsi/aic7xxx/aic7xxx_osm_pci.c # 2005/01/10 00:47:25-06:00 akpm@osdl.org +0 -91 # SCSI aic7xxx: kill kernel 2.2 #ifdef's # # drivers/scsi/aic7xxx/aic7xxx_osm.h # 2005/01/10 00:47:25-06:00 akpm@osdl.org +0 -2 # SCSI aic7xxx: kill kernel 2.2 #ifdef's # # drivers/scsi/aic7xxx/aic7770_osm.c # 2005/01/10 00:47:25-06:00 akpm@osdl.org +0 -12 # SCSI aic7xxx: kill kernel 2.2 #ifdef's # # MAINTAINERS # 2005/01/11 16:57:33+00:00 ben-linux@org.rmk.(none) +14 -0 # [PATCH] 2390/1: Simtec Electronics MAINTAINERS file entries # # ChangeSet # 2005/01/12 15:19:25+00:00 catalin.marinas@com.rmk.(none) # [ARM PATCH] 2389/1: semaphore.c warning fixed # # Patch from Catalin Marinas # # The patch adds the "ax" attributes to the .sched.text section to # avoid a compiler warning. # # Signed-off-by: Catalin Marinas # Signed-off-by: Russell King # # arch/arm/kernel/semaphore.c # 2005/01/12 00:00:00+00:00 catalin.marinas@com.rmk.(none) +1 -1 # [PATCH] 2389/1: semaphore.c warning fixed # # ChangeSet # 2005/01/12 15:14:51+00:00 rpurdie@net.rmk.(none) # [ARM PATCH] 2388/1: Add SSP control code for Sharp SL-C7xx Series (Corgi) # # Patch from Richard Purdie # # The Sharp SL-C7xx Series (Corgi) has 3 devices connected to the SSP # interface each needing different configurations of the port. # This code provides the necessary access and locking so drivers can # access these components. It uses the functions provided by the PXA # SSP driver to access the port. # It also adds some machine specific GPIO definitions used by this # code and adds some comments to existing definitions. # # Signed-off-by: Richard Purdie # Signed-off-by: Russell King # # include/asm-arm/arch-pxa/corgi.h # 2005/01/12 00:00:00+00:00 rpurdie@net.rmk.(none) +12 -10 # [PATCH] 2388/1: Add SSP control code for Sharp SL-C7xx Series (Corgi) # # arch/arm/mach-pxa/corgi.c # 2005/01/12 00:00:00+00:00 rpurdie@net.rmk.(none) +6 -0 # [PATCH] 2388/1: Add SSP control code for Sharp SL-C7xx Series (Corgi) # # arch/arm/mach-pxa/Makefile # 2005/01/12 00:00:00+00:00 rpurdie@net.rmk.(none) +1 -1 # [PATCH] 2388/1: Add SSP control code for Sharp SL-C7xx Series (Corgi) # # arch/arm/mach-pxa/corgi_ssp.c # 2005/01/12 00:00:00+00:00 rpurdie@net.rmk.(none) +247 -0 # [PATCH] 2388/1: Add SSP control code for Sharp SL-C7xx Series (Corgi) # # arch/arm/mach-pxa/corgi_ssp.c # 2005/01/12 00:00:00+00:00 rpurdie@net.rmk.(none) +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/arch/arm/mach-pxa/corgi_ssp.c # # ChangeSet # 2005/01/12 14:01:58+00:00 rmk@flint.arm.linux.org.uk # [ARM] Remove include. # # asm/processor.h doesn't use atomic operations nor types, so # there's no need to include asm/atomic.h. # # Signed-off-by: Russell King # # include/asm-arm/processor.h # 2005/01/12 13:51:42+00:00 rmk@flint.arm.linux.org.uk +0 -1 # Remove include # # ChangeSet # 2005/01/12 13:49:34+00:00 rmk@flint.arm.linux.org.uk # [ARM] Don't use __init for function prototypes. # # include/asm-arm/smp.h # 2005/01/12 13:37:31+00:00 rmk@flint.arm.linux.org.uk +1 -1 # Don't use __init for function prototypes. # # ChangeSet # 2005/01/12 00:30:07-05:00 fli@ati.com # [libata sata_sil] support ATI IXP300/IXP400 SATA # # drivers/scsi/sata_sil.c # 2005/01/12 00:29:53-05:00 fli@ati.com +2 -0 # [libata sata_sil] support ATI IXP300/IXP400 SATA # # ChangeSet # 2005/01/12 00:21:23-05:00 akpm@osdl.org # [PATCH] 3c515 warning fix # # drivers/net/3c515.c: In function `__check_rx_copybreak': # drivers/net/3c515.c:406: warning: return discards qualifiers from pointer target type # drivers/net/3c515.c: At top level: # drivers/net/3c515.c:406: warning: initialization discards qualifiers from pointer target type # # Signed-off-by: Andrew Morton # # drivers/net/3c515.c # 2005/01/11 01:33:57-05:00 akpm@osdl.org +1 -1 # 3c515 warning fix # # ChangeSet # 2005/01/12 00:21:09-05:00 akpm@osdl.org # [PATCH] ixgb whitespace fix # # Signed-off-by: Andrew Morton # # drivers/net/ixgb/ixgb_hw.c # 2005/01/09 02:50:35-05:00 akpm@osdl.org +4 -6 # ixgb whitespace fix # # ChangeSet # 2005/01/12 00:20:57-05:00 akpm@osdl.org # [PATCH] eepro build fix # # drivers/net/eepro.c:1799: initializer element is not constant # drivers/net/eepro.c:1799: (near initialization for `__param_arr_io.num') # drivers/net/eepro.c:1800: initializer element is not constant # drivers/net/eepro.c:1800: (near initialization for `__param_arr_irq.num') # drivers/net/eepro.c:1801: initializer element is not constant # drivers/net/eepro.c:1801: (near initialization for `__param_arr_mem.num') # # Signed-off-by: Andrew Morton # # drivers/net/eepro.c # 2005/01/11 01:15:07-05:00 akpm@osdl.org +3 -3 # eepro build fix # # ChangeSet # 2005/01/12 00:18:52-05:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/linux-2.6 # into pobox.com:/garz/repo/net-drivers-2.6 # # drivers/net/wireless/wl3501_cs.c # 2005/01/12 00:18:47-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2005/01/12 00:34:00+00:00 rpurdie@net.rmk.(none) # [ARM PATCH] 2386/1: Tidy up Sharp SCOOP driver coding style # # Patch from Richard Purdie # # Tidy up a couple of coding style issues in the Sharp SCOOP Driver # # Signed-off-by: Richard Purdie # Signed-off-by: Russell King # # ChangeSet # 2005/01/11 16:31:29-08:00 rja@sgi.com # [IA64-SGI] Altix BTE error handling fix # # This patch fixes BTE off node error handling. # # Signed-off-by: Russ Anderson # Acked-by: Robin Holt # Signed-off-by: Tony Luck # # arch/arm/common/scoop.c # 2005/01/12 00:00:00+00:00 rpurdie@net.rmk.(none) +4 -2 # [PATCH] 2386/1: Tidy up Sharp SCOOP driver coding style # # arch/ia64/sn/kernel/bte_error.c # 2005/01/11 16:28:31-08:00 rja@sgi.com +10 -1 # Altix BTE error handling fix # # ChangeSet # 2005/01/12 00:23:30+00:00 dsaxena@net.rmk.(none) # [ARM PATCH] 2381/1: Add to IXP4xx source files # # Patch from Deepak Saxena # # We should be including to pick up various important # constants that might be needed by other include files. # # Signed-off-by: Deepak Saxena # Signed-off-by: Russell King # # ChangeSet # 2005/01/11 16:23:15-08:00 jbarnes@sgi.com # [IA64-SGI] io_init.c: gcc4 fixes for sn2 # # This patch is needed since "warning: use of cast expressions as lvalues is # deprecated" turned into an error in gcc4. We can use the convenience macros # for read access and explicit assignments for initialization. I thought about # using Alexandre's fixes, but this seemed a little simpler. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # arch/ia64/sn/kernel/io_init.c # 2005/01/11 16:22:08-08:00 jbarnes@sgi.com +3 -3 # gcc4 fixes for sn2 # # arch/arm/mach-ixp4xx/prpmc1100-setup.c # 2005/01/11 20:56:29+00:00 dsaxena@net.rmk.(none) +1 -0 # [PATCH] 2381/1: Add to IXP4xx source files # # arch/arm/mach-ixp4xx/prpmc1100-pci.c # 2005/01/11 20:56:24+00:00 dsaxena@net.rmk.(none) +1 -0 # [PATCH] 2381/1: Add to IXP4xx source files # # arch/arm/mach-ixp4xx/ixdpg425-pci.c # 2005/01/11 20:56:19+00:00 dsaxena@net.rmk.(none) +1 -0 # [PATCH] 2381/1: Add to IXP4xx source files # # arch/arm/mach-ixp4xx/ixdp425-setup.c # 2005/01/11 20:56:17+00:00 dsaxena@net.rmk.(none) +1 -0 # [PATCH] 2381/1: Add to IXP4xx source files # # arch/arm/mach-ixp4xx/ixdp425-pci.c # 2005/01/11 20:56:13+00:00 dsaxena@net.rmk.(none) +1 -0 # [PATCH] 2381/1: Add to IXP4xx source files # # arch/arm/mach-ixp4xx/coyote-setup.c # 2005/01/11 20:56:10+00:00 dsaxena@net.rmk.(none) +1 -0 # [PATCH] 2381/1: Add to IXP4xx source files # # arch/arm/mach-ixp4xx/coyote-pci.c # 2005/01/11 20:56:00+00:00 dsaxena@net.rmk.(none) +1 -0 # [PATCH] 2381/1: Add to IXP4xx source files # # ChangeSet # 2005/01/11 16:19:26-08:00 jbarnes@sgi.com # [IA64] pci.c: fix warning # # Fix a 'mixing code and declarations' warning in pci.c by creating a small # function that's a no-op if CONFIG_NUMA=n but otherwise includes the proper # extern. Similar patch also submitted by # # Signed-off-by: Jesse Barnes # # ChangeSet # 2005/01/12 00:17:44+00:00 dsaxena@net.rmk.(none) # [ARM PATCH] 2378/1: Trivial: Update my info in CREDITS file # # Patch from Deepak Saxena # # Signed-off-by: Deepak Saxena # Signed-off-by: Russell King # # arch/ia64/pci/pci.c # 2005/01/11 16:17:08-08:00 jbarnes@sgi.com +14 -5 # fix warning # # CREDITS # 2005/01/11 18:51:51+00:00 dsaxena@net.rmk.(none) +3 -3 # [PATCH] 2378/1: Trivial: Update my info in CREDITS file # # ChangeSet # 2005/01/11 16:13:38-08:00 hannal@us.ibm.com # [IA64] pci.c: pci_find_device is going away # # Ok. Here is the reroll of the original patch to us for_each_pci_dev: # # Signed-off-by: Hanna Linder # Signed-off-by: Tony Luck # # arch/ia64/pci/pci.c # 2005/01/11 16:12:44-08:00 hannal@us.ibm.com +1 -1 # pci_find_device is going away # # ChangeSet # 2005/01/12 00:12:19+00:00 ben-linux@org.rmk.(none) # [ARM PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # Patch from Ben Dooks # # This cleans up a few items in arch/arm/mach-s3c2410 # with naming of functions and a build problem. Items # which are general to s3c2410 and s3c2440 are now # named s3c24xx_ instead of s3c2410_, as well as # moving them to the correct headers. # The patch also fixes a problem where at least one # s3c2410 target had to be selected to allow an s3c2440 # target to build without error. # The following have been renamed: # s3c2410_init_irq -> s3c24xx_init_irq # s3c2410_timer -> s3c24xx_timer # # Signed-off-by: Ben Dooks # Signed-off-by: Russell King # # ChangeSet # 2005/01/11 16:11:40-08:00 hannal@us.ibm.com # [IA64] sba_iommu.c: pci_find_device is going away # # Here is the reroll of the sba_iommu.c patch to use for_each_pci_dev. # # Signed-off-by: Hanna Linder # Signed-off-by: Tony Luck # # arch/ia64/hp/common/sba_iommu.c # 2005/01/11 16:10:37-08:00 hannal@us.ibm.com +1 -1 # pci_find_device is going away # # ChangeSet # 2005/01/11 16:08:20-08:00 domen@coderock.org # [IA64] sn_hwperf.c: vfree() checking cleanups # # Signed-off by: James Lamanna # Signed-off-by: Domen Puncer # Signed-off-by: Tony Luck # # arch/arm/mach-s3c2410/time.c # 2005/01/11 10:04:01+00:00 ben-linux@org.rmk.(none) +1 -1 # [PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # arch/arm/mach-s3c2410/s3c2440.h # 2005/01/11 10:04:01+00:00 ben-linux@org.rmk.(none) +16 -5 # [PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # arch/arm/mach-s3c2410/s3c2440-dsc.c # 2005/01/11 10:04:01+00:00 ben-linux@org.rmk.(none) +3 -2 # [PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # arch/arm/mach-s3c2410/s3c2410.h # 2005/01/11 10:04:01+00:00 ben-linux@org.rmk.(none) +11 -5 # [PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # arch/arm/mach-s3c2410/mach-vr1000.c # 2005/01/11 10:04:01+00:00 ben-linux@org.rmk.(none) +4 -4 # [PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # arch/arm/mach-s3c2410/mach-smdk2410.c # 2005/01/11 10:04:01+00:00 ben-linux@org.rmk.(none) +2 -3 # [PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # arch/arm/mach-s3c2410/mach-rx3715.c # 2005/01/11 10:04:01+00:00 ben-linux@org.rmk.(none) +3 -4 # [PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # arch/arm/mach-s3c2410/mach-h1940.c # 2005/01/11 10:04:01+00:00 ben-linux@org.rmk.(none) +3 -3 # [PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # arch/arm/mach-s3c2410/mach-bast.c # 2005/01/11 10:04:01+00:00 ben-linux@org.rmk.(none) +4 -4 # [PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # arch/arm/mach-s3c2410/irq.c # 2005/01/11 10:04:01+00:00 ben-linux@org.rmk.(none) +2 -2 # [PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # arch/arm/mach-s3c2410/cpu.h # 2005/01/11 10:04:01+00:00 ben-linux@org.rmk.(none) +8 -18 # [PATCH] 2376/1: S3C2410 - cleanup 2410/2440 distinctions, fix build # # arch/ia64/sn/kernel/sn2/sn_hwperf.c # 2005/01/11 16:05:23-08:00 domen@coderock.org +2 -4 # vfree() checking cleanups # # ChangeSet # 2005/01/12 00:05:09+00:00 rmk@flint.arm.linux.org.uk # [ARM] Fix smp.c includes # # Remove asm/smp.h include, use linux/smp.h instead. # Add linux/cpu.h include. # # arch/arm/kernel/smp.c # 2005/01/12 00:01:43+00:00 rmk@flint.arm.linux.org.uk +4 -4 # Remove asm/smp.h include, use linux/smp.h instead. # Add linux/cpu.h include. # # ChangeSet # 2005/01/11 16:00:07-08:00 schwab@suse.de # [IA64] Fix PTRACE_GETEVENTMSG ia32 emulation # # This patch fixes PTRACE_GETEVENTMSG for the ia32 emulation. The parameter # is a pointer, thus needs to be converted. # # Signed-off-by: Andreas Schwab # Signed-off-by: Tony Luck # # arch/ia64/ia32/sys_ia32.c # 2005/01/11 15:58:41-08:00 schwab@suse.de +4 -0 # Fix PTRACE_GETEVENTMSG ia32 emulation # # ChangeSet # 2005/01/11 15:49:52-08:00 jbarnes@sgi.com # [IA64-SGI] fix bogus address dereference in sn/setup.c # # Some code in sn/setup.c was trying to dereference a physical address, which # usually doesn't work (esp. not with the region register init patch I posted). # This patch converts the function used to find the klconfig to return virtual # char * instead of a physical address and updates the caller to deal with it. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # include/asm-ia64/sn/sn_sal.h # 2005/01/11 15:49:02-08:00 jbarnes@sgi.com +2 -2 # fix bogus address dereference in sn/setup.c # # arch/ia64/sn/kernel/setup.c # 2005/01/11 15:48:43-08:00 jbarnes@sgi.com +4 -4 # fix bogus address dereference in sn/setup.c # # ChangeSet # 2005/01/11 15:47:04-08:00 jbarnes@sgi.com # [IA64] clear all region registers at boot # # If we initialize *all* of the region registers to be non-identity mapped we # can catch a few more bugs that might be covered up by whatever their previous # state was. This patch sets them all up to use VHPT (i.e. non alt-tlb) # address translation. It already helped me find one bug in the sn2 # initialization code. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # arch/ia64/kernel/head.S # 2005/01/11 15:45:50-08:00 jbarnes@sgi.com +22 -0 # clear all region registers at boot # # ChangeSet # 2005/01/11 15:43:41-08:00 bjorn.helgaas@hp.com # [IA64] reset console_loglevel so INIT output always goes to console # # Reset console_loglevel early in INIT handler. Otherwise, if # it has been turned down (i.e., with "dmesg -n1"), the user may # see no effect at all from issuing an INIT. We're never going # to run any more user code, so there won't be any opportunity for # anything to collect the output from the dmesg buffer. # # Signed-off-by: Bjorn Helgaas # Signed-off-by: Tony Luck # # arch/ia64/kernel/mca.c # 2005/01/11 15:42:37-08:00 bjorn.helgaas@hp.com +1 -0 # reset console_loglevel so INIT output always goes to console # # ChangeSet # 2005/01/11 15:39:35-08:00 jbarnes@sgi.com # [IA64] defconfig update # # This adds support for a few new modules (e.g. Infiniband, new ACPI stuff, # etc.) and also enables initrd support (required for Fedora for example--it's # really not that painful, I use the same initrd for most of my kernels). # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # ChangeSet # 2005/01/11 23:37:59+00:00 rmk@flint.arm.linux.org.uk # [ARM] Relocate ipi_count into ipi data structures. # # This removes ipi_count from the globally visible per-cpu cpu data # structure. # # arch/ia64/defconfig # 2005/01/11 15:37:50-08:00 jbarnes@sgi.com +43 -8 # update & include initrd support # # include/asm-arm/cpu.h # 2005/01/11 23:34:15+00:00 rmk@flint.arm.linux.org.uk +0 -1 # Remove ipi_count. # # arch/arm/kernel/smp.c # 2005/01/11 23:34:15+00:00 rmk@flint.arm.linux.org.uk +6 -6 # Move ipi_count to ipi_data structure rather than global per cpu data # structure. # # ChangeSet # 2005/01/11 23:26:57+00:00 rmk@flint.arm.linux.org.uk # [ARM] Add SMP IRQ affinity and routing support. # # Provide /proc/irq/*/smp_affinity support, and add necessary methods # to allow a machine to route the interrupt to the desired CPU. # # include/asm-arm/mach/irq.h # 2005/01/11 23:22:04+00:00 rmk@flint.arm.linux.org.uk +14 -0 # Add "set_cpu" method to route interrupts to a specific CPU. # # arch/arm/kernel/irq.c # 2005/01/11 23:22:04+00:00 rmk@flint.arm.linux.org.uk +98 -3 # Add basic SMP IRQ affinity support. # # ChangeSet # 2005/01/11 12:24:42-08:00 domen@coderock.org # [IA64] simeth.c: Remove unneeded casts of (void *) pointers. # # Signed-off-by: Domen Puncer # Signed-off-by: Tony Luck # # arch/ia64/hp/sim/simeth.c # 2005/01/11 12:23:41-08:00 domen@coderock.org +4 -4 # Remove unneeded casts of (void *) pointers. # # ChangeSet # 2005/01/11 11:58:15-08:00 jbarnes@sgi.com # [IA64] update sn2_defconfig (fix initrd, add IB support) # Don't know what happened to initrd support, but 'make sn2_defconfig' no longer # enables it. This patch should fix that, along with enabling modular IB # support. # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # arch/ia64/configs/sn2_defconfig # 2005/01/11 11:57:37-08:00 jbarnes@sgi.com +44 -7 # update sn2_defconfig (fix initrd, add IB support) # # ChangeSet # 2005/01/11 17:08:03+00:00 rmk@flint.arm.linux.org.uk # [ARM] Add synchronize_irq() support. # # arch/arm/kernel/irq.c # 2005/01/11 17:04:30+00:00 rmk@flint.arm.linux.org.uk +25 -0 # Add synchronize_irq() support. # # ChangeSet # 2005/01/11 16:59:26+00:00 rmk@flint.arm.linux.org.uk # [ARM] Add show_ipi_list() call. # # include/asm-arm/smp.h # 2005/01/11 16:56:31+00:00 rmk@flint.arm.linux.org.uk +7 -0 # Add show_ipi_list() prototype. # # arch/arm/kernel/irq.c # 2005/01/11 16:56:31+00:00 rmk@flint.arm.linux.org.uk +3 -0 # Add show_ipi_list() call. # # ChangeSet # 2005/01/11 00:03:27-05:00 jgarzik@pobox.com # e1000/ixgb net drivers: rename global symbol to fix 'make allyesconfig' # # drivers/net/ixgb/ixgb_main.c # 2005/01/11 00:03:21-05:00 jgarzik@pobox.com +2 -2 # e1000/ixgb net drivers: rename global symbol to fix 'make allyesconfig' # # drivers/net/ixgb/ixgb_ethtool.c # 2005/01/11 00:03:21-05:00 jgarzik@pobox.com +1 -1 # e1000/ixgb net drivers: rename global symbol to fix 'make allyesconfig' # # drivers/net/e1000/e1000_main.c # 2005/01/11 00:03:21-05:00 jgarzik@pobox.com +2 -2 # e1000/ixgb net drivers: rename global symbol to fix 'make allyesconfig' # # drivers/net/e1000/e1000_ethtool.c # 2005/01/11 00:03:21-05:00 jgarzik@pobox.com +1 -1 # e1000/ixgb net drivers: rename global symbol to fix 'make allyesconfig' # # ChangeSet # 2005/01/10 23:05:14-05:00 jgarzik@pobox.com # Merge pobox.com:/garz/repo/netdev-2.6/orinoco # into pobox.com:/garz/repo/net-drivers-2.6 # # drivers/net/wireless/orinoco.c # 2005/01/10 23:05:11-05:00 jgarzik@pobox.com +0 -0 # Auto merged # # ChangeSet # 2005/01/10 23:01:45-05:00 jgarzik@pobox.com # Manual ixgb merge. # # drivers/net/ixgb/ixgb_param.c # 2005/01/10 23:01:39-05:00 jgarzik@pobox.com +0 -2 # Manual ixgb merge. # # ChangeSet # 2005/01/10 22:58:17-05:00 hch@lst.de # [PATCH] mark arcdev_setup static # # It's only used in arcnet.c, and following the model of the other # link layers it doesn't make sense to use it outside alloc_arcdev() # either. # # include/linux/arcdevice.h # 2004/10/23 10:09:24-04:00 hch@lst.de +0 -1 # mark arcdev_setup static # # drivers/net/arcnet/arcnet.c # 2004/10/23 10:09:36-04:00 hch@lst.de +1 -2 # mark arcdev_setup static # # ChangeSet # 2005/01/10 22:58:06-05:00 penguin@muskoka.com # [PATCH] smc-ultra.c too-verbose driver # # drivers/net/smc-ultra.c # 2005/01/09 15:33:06-05:00 penguin@muskoka.com +0 -2 # smc-ultra.c too-verbose driver # # ChangeSet # 2005/01/10 22:57:56-05:00 ak@suse.de # [PATCH] Fix gcc4 compilation in s2io net driver # # Signed-off-by: Andi Kleen # # drivers/net/s2io.h # 2005/01/10 22:57:50-05:00 ak@suse.de +2 -2 # Fix gcc4 compilation in s2io net driver # # ChangeSet # 2005/01/10 22:57:45-05:00 rddunlap@osdl.org # [PATCH] wl3501: fix module_param types/warnings # # Fix gcc warning: # drivers/net/wireless/wl3501_cs.c:2282: warning: return from incompatible pointer type # # module_param() isn't happy about different types for irq_mask; # unsigned long vs. int. Make it uint consistently. # # Signed-off-by: Randy Dunlap # # drivers/net/wireless/wl3501_cs.c # 2005/01/10 15:40:44-05:00 rddunlap@osdl.org +2 -2 # wl3501: fix module_param types/warnings # # ChangeSet # 2005/01/10 14:23:32-08:00 jbarnes@sgi.com # [IA64] implements the features required for the HAVE_PCI_LEGACY code in sysfs # # This patch implements the features required for the HAVE_PCI_LEGACY code in # sysfs. It allows userspace applications to access legacy I/O ports an memory # space using files in sysfs on a per-bus basis. Tested on sn2, but it # *should* work on other ia64 platforms as well (though zx1 will probably need # machine vectors to do routing of non-base busses). # # Signed-off-by: Jesse Barnes # Signed-off-by: Tony Luck # # include/asm-ia64/sn/sn_sal.h # 2005/01/10 14:04:38-08:00 jbarnes@sgi.com +46 -0 # implements the features required for the HAVE_PCI_LEGACY code in sysfs # # include/asm-ia64/pci.h # 2005/01/10 14:04:31-08:00 jbarnes@sgi.com +14 -0 # implements the features required for the HAVE_PCI_LEGACY code in sysfs # # include/asm-ia64/machvec_sn2.h # 2005/01/10 14:04:23-08:00 jbarnes@sgi.com +6 -0 # implements the features required for the HAVE_PCI_LEGACY code in sysfs # # include/asm-ia64/machvec_init.h # 2005/01/10 14:04:16-08:00 jbarnes@sgi.com +3 -0 # implements the features required for the HAVE_PCI_LEGACY code in sysfs # # include/asm-ia64/machvec.h # 2005/01/10 14:04:10-08:00 jbarnes@sgi.com +24 -0 # implements the features required for the HAVE_PCI_LEGACY code in sysfs # # arch/ia64/sn/pci/pci_dma.c # 2005/01/10 14:04:02-08:00 jbarnes@sgi.com +64 -0 # implements the features required for the HAVE_PCI_LEGACY code in sysfs # # arch/ia64/pci/pci.c # 2005/01/10 14:03:12-08:00 jbarnes@sgi.com +113 -1 # implements the features required for the HAVE_PCI_LEGACY code in sysfs # # ChangeSet # 2005/01/10 13:55:37-08:00 tony.luck@intel.com # Merge intel.com:/data/home/aegl/BK/Linus # into intel.com:/data/home/aegl/BK/linux-ia64-release-2.6.11 # # arch/ia64/kernel/acpi.c # 2005/01/10 13:55:30-08:00 tony.luck@intel.com +0 -0 # Auto merged # # arch/ia64/Kconfig # 2005/01/10 13:55:30-08:00 tony.luck@intel.com +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2005/01/10 13:55:30-08:00 tony.luck@intel.com +0 -0 # Auto merged # # ChangeSet # 2005/01/10 10:56:57-06:00 mike.miller@hp.com # [PATCH] cciss update to version 2.6.4 # # This patch removes support for 2 controllers that were recently # cancelled and it adds support for the P600, a cciss based SAS # controller due to ship in late March/early April '05. # Neither of these controllers have made it to the field. # # Signed-off-by: Mike Miller # Signed-off-by: James Bottomley # # include/linux/pci_ids.h # 2005/01/07 11:54:25-06:00 mike.miller@hp.com +1 -1 # cciss update to version 2.6.4 # # drivers/block/cciss.c # 2005/01/07 11:50:43-06:00 mike.miller@hp.com +7 -10 # cciss update to version 2.6.4 # # Documentation/cciss.txt # 2005/01/07 11:51:16-06:00 mike.miller@hp.com +1 -2 # cciss update to version 2.6.4 # # ChangeSet # 2005/01/08 12:29:24-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: White space corrections # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_param.c # 2005/01/07 11:10:54-05:00 ganesh.venkatesan@intel.com +75 -82 # ixgb: White space corrections # # drivers/net/ixgb/ixgb_osdep.h # 2005/01/07 11:10:53-05:00 ganesh.venkatesan@intel.com +5 -5 # ixgb: White space corrections # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +236 -215 # ixgb: White space corrections # # drivers/net/ixgb/ixgb_ids.h # 2005/01/07 11:08:15-05:00 ganesh.venkatesan@intel.com +7 -13 # ixgb: White space corrections # # drivers/net/ixgb/ixgb_hw.h # 2005/01/07 11:08:13-05:00 ganesh.venkatesan@intel.com +29 -19 # ixgb: White space corrections # # drivers/net/ixgb/ixgb_hw.c # 2005/01/07 11:08:11-05:00 ganesh.venkatesan@intel.com +135 -91 # ixgb: White space corrections # # drivers/net/ixgb/ixgb_ethtool.c # 2005/01/07 11:08:08-05:00 ganesh.venkatesan@intel.com +12 -11 # ixgb: White space corrections # # drivers/net/ixgb/ixgb_ee.c # 2005/01/07 11:08:05-05:00 ganesh.venkatesan@intel.com +114 -78 # ixgb: White space corrections # # drivers/net/ixgb/ixgb.h # 2005/01/07 11:08:10-05:00 ganesh.venkatesan@intel.com +1 -1 # ixgb: White space corrections # # ChangeSet # 2005/01/08 12:28:58-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Driver version number update # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +15 -2 # ixgb: Driver version number update # # ChangeSet # 2005/01/08 12:28:45-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Support for 2.6.x style module parameters # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_param.c # 2005/01/07 11:10:54-05:00 ganesh.venkatesan@intel.com +80 -51 # ixgb: Support for 2.6.x style module parameters # # ChangeSet # 2005/01/08 12:28:33-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Fix Tx cleanup logic # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +21 -29 # ixgb: Fix Tx cleanup logic # # ChangeSet # 2005/01/08 12:28:21-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Shrink size and fix ordering of elements in ixgb_buffer # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb.h # 2005/01/07 11:08:10-05:00 ganesh.venkatesan@intel.com +2 -2 # ixgb: Shrink size and fix ordering of elements in ixgb_buffer # # ChangeSet # 2005/01/08 12:28:09-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: ethtool_ops support # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_param.c # 2005/01/07 11:10:54-05:00 ganesh.venkatesan@intel.com +0 -4 # ixgb: ethtool_ops support # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +17 -12 # ixgb: ethtool_ops support # # drivers/net/ixgb/ixgb_ethtool.c # 2005/01/07 11:08:08-05:00 ganesh.venkatesan@intel.com +320 -175 # ixgb: ethtool_ops support # # drivers/net/ixgb/ixgb.h # 2005/01/07 11:08:10-05:00 ganesh.venkatesan@intel.com +4 -0 # ixgb: ethtool_ops support # # ChangeSet # 2005/01/08 12:27:56-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Replace kmalloc with vmalloc (one time alloc) # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +6 -6 # ixgb: Replace kmalloc with vmalloc (one time alloc) # # drivers/net/ixgb/ixgb.h # 2005/01/07 11:08:10-05:00 ganesh.venkatesan@intel.com +1 -0 # ixgb: Replace kmalloc with vmalloc (one time alloc) # # ChangeSet # 2005/01/08 12:27:45-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Remove support for RAIDC interrupt mitigation # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_param.c # 2005/01/07 11:10:54-05:00 ganesh.venkatesan@intel.com +0 -21 # ixgb: Remove support for RAIDC interrupt mitigation # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +4 -54 # ixgb: Remove support for RAIDC interrupt mitigation # # drivers/net/ixgb/ixgb.h # 2005/01/07 11:08:10-05:00 ganesh.venkatesan@intel.com +0 -1 # ixgb: Remove support for RAIDC interrupt mitigation # # ChangeSet # 2005/01/08 12:27:32-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Limit Rx Address Filter Array entries to 3 # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_hw.h # 2005/01/07 11:08:13-05:00 ganesh.venkatesan@intel.com +1 -1 # ixgb: Limit Rx Address Filter Array entries to 3 # # ChangeSet # 2005/01/08 12:27:20-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Fix infinite loop trying to re-establish link # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +0 -2 # ixgb: Fix infinite loop trying to re-establish link # # ChangeSet # 2005/01/08 12:22:36-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Fix error in setting MFS register # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +2 -2 # ixgb: Fix error in setting MFS register # # ChangeSet # 2005/01/08 12:22:23-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Poll Routine cleanup # # Includes fixes for # (a) kernel panic when the interface is shutdown when Poll is active # (b) include tx workdone in deciding when to quit polling mode # (c) fix poll quit condition (from Robert Olsson) # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +14 -7 # ixgb: Poll Routine cleanup # # ChangeSet # 2005/01/08 12:22:11-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Fix memory leak in NAPI mode # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +6 -6 # ixgb: Fix memory leak in NAPI mode # # ChangeSet # 2005/01/08 12:21:58-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Fix VLAN filter setup errors (while running on PPC) # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +4 -6 # ixgb: Fix VLAN filter setup errors (while running on PPC) # # ChangeSet # 2005/01/08 12:21:47-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Add support for 10GbE LR device ID # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +6 -3 # ixgb: Add support for 10GbE LR device ID # # drivers/net/ixgb/ixgb_ids.h # 2005/01/07 11:08:15-05:00 ganesh.venkatesan@intel.com +1 -0 # ixgb: Add support for 10GbE LR device ID # # drivers/net/ixgb/ixgb_hw.c # 2005/01/07 11:08:11-05:00 ganesh.venkatesan@intel.com +5 -0 # ixgb: Add support for 10GbE LR device ID # # ChangeSet # 2005/01/08 12:21:35-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Enable Message Signalled Interrupts # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_main.c # 2005/01/07 11:10:49-05:00 ganesh.venkatesan@intel.com +26 -4 # ixgb: Enable Message Signalled Interrupts # # drivers/net/ixgb/ixgb.h # 2005/01/07 11:08:10-05:00 ganesh.venkatesan@intel.com +3 -0 # ixgb: Enable Message Signalled Interrupts # # ChangeSet # 2005/01/08 12:21:23-05:00 ganesh.venkatesan@intel.com # [PATCH] ixgb: Limit number of Rx Descriptors to 512 # # Workaround for a Si Erratum. When more that 512 Rx descriptors are used, # there may be Rx data corruption. # # Signed-off-by: Ganesh Venkatesan # # drivers/net/ixgb/ixgb_param.c # 2005/01/07 11:10:54-05:00 ganesh.venkatesan@intel.com +0 -3 # ixgb: Limit number of Rx Descriptors to 512 # # drivers/net/ixgb/ixgb.h # 2005/01/07 11:08:10-05:00 ganesh.venkatesan@intel.com +10 -0 # ixgb: Limit number of Rx Descriptors to 512 # # ChangeSet # 2005/01/07 16:17:45-08:00 davidm@hpl.hp.com # [IA64] add hpzx1_swiotlb machine-vector # # I was in need of a 3.3V/dual-voltage-capable PCI sound-card and, as # luck would have it, the only card of that sort in the local computer # store was one that _still_ has a DMA engine that cannot even DMA to # all 32 bits (it's limited to 28 bits). Hard to believe, but true (the # card in question is a "SoundBlaster Live! 24-bit" with a CA0106 chip; # stay away from that one if you can...). # # Anyhow, since I don't like it when PCI cards don't work in my machine, # I created the attached patch which adds a new machine-vector to enable # support of such broken cards. # # With the patch applied, you can either configure the kernel for # "HP-zx1/sx1000+swiotlb" or configure for "generic" and boot with # option "machvec=hpzx1_swiotlb" to enable support for broken PCI # devices. # # The patch works as follows: the new machvec implements a I/O MMU which # will use the hardware I/O MMU whenever possible but fall back on the # software I/O TLB when encountering a device that can't be supported by # the hardware I/O MMU. Fortunately, we don't have to mess with # MAX_DMA_ADDRESS or create a new zone: the software I/O TLB allocates # its memory as low as possible and early in the boot-process, so on any # machine with low memory, we're pretty much guaranteed that we'll get a # reasonable amount of low memory, which is all we need to properly support # broken PCI cards. # # Note that I made a small change to swiotlb.c: I added a # swiotlb_init_with_default_size() function to let the new I/O MMU # initialize the software I/O TLB with less than 64MB (which is way too # much for the limited uses we'll see for the broken PCI devices; for # example, the CA0106 chip allocates only coherent buffers of about # 128KB). # # The patch has been tested on a zx1 machine in the generic, hpzx1, and # hpzx1_swiotlb configuration. # # Thanks to Alex Williamson for the suggestion of doing this via a # completely separate machvec. # # Signed-off-by: David Mosberger-Tang # Signed-off-by: Tony Luck # # include/asm-ia64/numnodes.h # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +1 -1 # add hpzx1_swiotlb machine-vector # # include/asm-ia64/machvec.h # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +2 -0 # add hpzx1_swiotlb machine-vector # # drivers/char/agp/Kconfig # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +1 -1 # add hpzx1_swiotlb machine-vector # # arch/ia64/lib/swiotlb.c # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +13 -3 # add hpzx1_swiotlb machine-vector # # arch/ia64/kernel/setup.c # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +23 -2 # add hpzx1_swiotlb machine-vector # # arch/ia64/kernel/acpi.c # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +2 -0 # add hpzx1_swiotlb machine-vector # # arch/ia64/kernel/Makefile # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +1 -0 # add hpzx1_swiotlb machine-vector # # arch/ia64/hp/zx1/Makefile # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +1 -1 # add hpzx1_swiotlb machine-vector # # arch/ia64/hp/common/Makefile # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +2 -0 # add hpzx1_swiotlb machine-vector # # arch/ia64/Makefile # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +2 -0 # add hpzx1_swiotlb machine-vector # # arch/ia64/Kconfig # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +17 -7 # add hpzx1_swiotlb machine-vector # # arch/ia64/Kconfig.debug # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +1 -1 # add hpzx1_swiotlb machine-vector # # Documentation/kernel-parameters.txt # 2005/01/07 16:15:52-08:00 davidm@hpl.hp.com +5 -1 # add hpzx1_swiotlb machine-vector # # ChangeSet # 2005/01/07 16:38:51-05:00 jejb@mulgrave.(none) # Fix exploitable hole in sg_scsi_ioctl # # in_len and out_len are signed quantites copied from # user space but are only checked to see if they're > # PAGE_SIZE. The exploit would be to pass in a negative # quantity which would pass the check. # # Fix by making them unsigned. # # Signed-off-by: James Bottomley # # drivers/block/scsi_ioctl.c # 2005/01/07 16:36:05-05:00 jejb@mulgrave.(none) +2 -1 # Fix exploitable hole in sg_scsi_ioctl # # ChangeSet # 2005/01/07 13:24:14-05:00 aris@cathedrallabs.org # [PATCH] eepro: fix auto-detection option # # eepro: fix auto-detection option # # Signed-off-by: Aristeu Sergio Rozanski Filho # Signed-off-by: Jeff Garzik # # drivers/net/eepro.c # 2004/10/05 20:44:23-04:00 aris@cathedrallabs.org +8 -4 # eepro: fix auto-detection option # # ChangeSet # 2005/01/07 13:24:03-05:00 aris@cathedrallabs.org # [PATCH] eepro: fix return value in init_module() # # eepro: fix return value in init_module() # # Signed-off-by: Aristeu Sergio Rozanski Filho # Signed-off-by: Jeff Garzik # # drivers/net/eepro.c # 2004/10/05 21:27:00-04:00 aris@cathedrallabs.org +1 -1 # eepro: fix return value in init_module() # # ChangeSet # 2005/01/07 13:23:52-05:00 aris@cathedrallabs.org # [PATCH] eepro: basic ethtool support # # eepro: basic ethtool support # # Signed-off-by: Aristeu Sergio Rozanski Filho # Signed-off-by: Jeff Garzik # # drivers/net/eepro.c # 2005/01/07 06:04:40-05:00 aris@cathedrallabs.org +68 -7 # eepro: basic ethtool support # # ChangeSet # 2005/01/07 13:23:39-05:00 aris@cathedrallabs.org # [PATCH] eepro: use module_param macros # # eepro: use module_param macros # # Signed-off-by: Aristeu Sergio Rozanski Filho # Signed-off-by: Jeff Garzik # # drivers/net/eepro.c # 2005/01/07 06:01:12-05:00 aris@cathedrallabs.org +5 -4 # eepro: use module_param macros # # ChangeSet # 2005/01/07 13:23:28-05:00 aris@cathedrallabs.org # [PATCH] eepro: cache EEPROM values # # eepro: cache EEPROM values # # Signed-off-by: Aristeu Sergio Rozanski Filho # Signed-off-by: Jeff Garzik # # drivers/net/eepro.c # 2004/09/14 12:46:15-04:00 aris@cathedrallabs.org +29 -17 # eepro: cache EEPROM values # # ChangeSet # 2005/01/06 23:04:58-05:00 hermes@gibson.dropbear.id.au # [PATCH] Another trivial orinoco update # # Jeff/Andrew please apply: # # This patch alters the convention with which orinoco_lock() is invoked # in the orinoco driver. This should cause no behavioural change, but # reduces meaningless diffs between the mainline and CVS version of the # driver. Another small step towards a merge. # # Signed-off-by: David Gibson # Signed-off-by: Jeff Garzik # # drivers/net/wireless/orinoco.c # 2004/11/02 21:34:38-05:00 hermes@gibson.dropbear.id.au +77 -126 # Another trivial orinoco update # # ChangeSet # 2005/01/06 22:53:05-05:00 raghavendra.koushik@s2io.com # [PATCH] S2io: fixes in free_shared_mem function # # Hello All, # As per KK's review comment received on Nov 8 about the free_shared_mem function, Iam sending the following patch. # # The change log includes: # # 1. Break from the main 'for loop' if ba[i] is NULL. # # 2. In the second level 'for loop', if ba[i][j] is NULL, instead of # continuing as was done previously, we now free the ba[i] pointer and # break from the main 'for loop'. # # 3. In the 'while loop' inside the second tier 'for loop', if any of the # three pointers (ba or ba->ba_0_org or ba->ba_1_org) is found to be NULL, # then ba[i], ba[i][j] and the non NULL buffer pointer if any # (ba_0_org or ba_1_org) is freed and break from the main 'for loop'. # # Signed-off-by: Koushik # Signed-off-by: Ravi # Signed-off-by: Jeff Garzik # # drivers/net/s2io.c # 2004/11/18 13:07:48-05:00 raghavendra.koushik@s2io.com +18 -4 # S2io: fixes in free_shared_mem function # # ChangeSet # 2005/01/06 22:03:59-05:00 mporter@kernel.crashing.org # [PATCH] Add netpoll support # # Add netpoll support to the EMAC driver. # # Signed-off-by: Matt Porter # Signed-off-by: Jeff Garzik # # drivers/net/ibm_emac/ibm_emac_core.c # 2004/12/07 12:06:23-05:00 mporter@kernel.crashing.org +12 -0 # Add netpoll support # # ChangeSet # 2005/01/06 22:03:48-05:00 mporter@kernel.crashing.org # [PATCH] allow rx of the maximum sized VLAN tagged packets # # Patch enables EMAC to receive maximum sized VLAN tagged packets. # # Signed-off-by: Eugene Surovegin # Signed-off-by: Matt Porter # Signed-off-by: Jeff Garzik # # drivers/net/ibm_emac/ibm_emac_core.c # 2004/08/24 15:18:27-04:00 mporter@kernel.crashing.org +3 -0 # allow rx of the maximum sized VLAN tagged packets # # drivers/net/ibm_emac/ibm_emac.h # 2004/08/24 15:19:41-04:00 mporter@kernel.crashing.org +1 -1 # allow rx of the maximum sized VLAN tagged packets # # ChangeSet # 2005/01/06 21:59:14-05:00 akpm@osdl.org # [PATCH] EMAC: fix ibm_emac autonegotiation result parsing # # From: Matt Porter # # Fix aneg result parsing in ibm_emac driver. # # Signed-off-by: Eugene Surovegin # Signed-off-by: Matt Porter # Signed-off-by: Andrew Morton # Signed-off-by: Jeff Garzik # # drivers/net/ibm_emac/ibm_emac_phy.c # 2005/01/05 00:57:37-05:00 akpm@osdl.org +10 -9 # EMAC: fix ibm_emac autonegotiation result parsing # # ChangeSet # 2005/01/06 19:44:33-05:00 takata@linux-m32r.org # [PATCH] net: netconsole support for smc91x # # Signed-off-by: Hayato Fujiwara # Signed-off-by: Hirokazu Takata # Signed-off-by: Jeff Garzik # # drivers/net/smc91x.c # 2005/01/06 05:40:56-05:00 takata@linux-m32r.org +16 -0 # net: netconsole support for smc91x # # ChangeSet # 2005/01/06 15:57:16-05:00 michaelc@cs.wisc.edu # [PATCH] export print_sense_internal # # Currently, we have scsi_print_sense and scsi_print_req_sense, but the # linux-iscsi driver receives async messages from a target that may # contain SCSI sense data and these messages are not tied to any # specific command. So that we can use the scsi-ml sense printing # capabilities the attached patch exports exports print_sense_internal # and renames it to __scsi_print_sense. # # Signed-off-by: Mike Christie # Signed-off-by: James Bottomley # # include/scsi/scsi_dbg.h # 2005/01/05 06:11:58-05:00 michaelc@cs.wisc.edu +3 -0 # export print_sense_internal # # drivers/scsi/constants.c # 2005/01/05 06:25:05-05:00 michaelc@cs.wisc.edu +14 -10 # export print_sense_internal # # ChangeSet # 2005/01/06 15:48:50-05:00 tonyb@cybernetics.com # [PATCH] fix read capacity for large disks when CONFIG_LBD=n # # We shouldn't configure an device that requires LBD if the kernel # doesn't suppoprt it (because we won't be able to see most of it), so # set the capacity to zero in this case. # # Signed-off-by: James Bottomley # # drivers/scsi/sd.c # 2005/01/04 08:03:59-05:00 tonyb@cybernetics.com +5 -2 # fix read capacity for large disks when CONFIG_LBD=n # # ChangeSet # 2005/01/06 09:58:37-05:00 juhl-lkml@dif.dk # [PATCH] clean out old cruft from FD MCS driver # # - Remove the unused macro DEBUG_DETECT # - Remove code inside DO_DETECT conditional that's broken # - Remove superfluous header # # Signed-off-by: Jesper Juhl # Signed-off-by: James Bottomley # # drivers/scsi/fd_mcs.c # 2005/01/03 17:39:27-05:00 juhl-lkml@dif.dk +1 -57 # clean out old cruft from FD MCS driver # # BitKeeper/deleted/.del-fd_mcs.h~10e8a7cb2d178aa1 # 2005/01/06 09:55:11-05:00 juhl-lkml@dif.dk +0 -0 # Delete: drivers/scsi/fd_mcs.h # # ChangeSet # 2005/01/03 15:22:39-06:00 coughlan@redhat.com # [PATCH] aacraid: remove aac_handle_aif # # When aac_command_thread detects an adapter event (AifCmdDriverNotify or # AifCmdEventNotify) it calls aac_handle_aif. This routine sets a flag, # calls fib_adapter_complete, and returns. The bad news is that after the # return, aac_command_thread continues to process the command and calls # fib_adapter_complete again. # # Under some circumstances this causes the driver to take the device # offline. In my case, it happens with a Dell CERC SATA with a RAID 5 in # the "building" state: # # aacraid: Host adapter reset request. SCSI hang ? # aacraid: Host adapter appears dead # scsi: Device offlined - not ready after error recovery: host 0 channel 0 # id 0 lun 0 # SCSI error : <0 0 0 0> return code = 0x6000000 # end_request: I/O error, dev sda, sector 976537592 # # Mark Salyzyn says the intent is for aac_handle_aif to perform some # plug-n-play actions based on the adapter event, and return, leaving the # command completion to the caller. # # The attached patch solves the problem by removing aac_handle_aif # entirely, since it is wrong, and there is currently no code in the # driver to actually do anything with these events. # # Signed-off-by: James Bottomley # # drivers/scsi/aacraid/commsup.c # 2005/01/02 18:00:00-06:00 coughlan@redhat.com +0 -27 # aacraid: remove aac_handle_aif # # ChangeSet # 2005/01/03 11:01:25-06:00 hch@lst.de # [PATCH] gdth: cleanup compat clutter # # This patch # # - removes support for 2.2.x and 2.4.x without the full dma API # (<= 2.4.13 or 2.4.9rh) # - makes sure we don't acquire or release unessecary locks around # ->scsi_done - it's a small BH/softirq that doesn't care about # the callers lock state # - cleans up the 2.4 vs 2.6 compat code a little # # Signed-off-by: James Bottomley # # drivers/scsi/gdth_proc.h # 2005/01/03 10:49:16-06:00 hch@lst.de +1 -5 # gdth: cleanup compat clutter # # drivers/scsi/gdth_proc.c # 2005/01/03 10:50:30-06:00 hch@lst.de +31 -123 # gdth: cleanup compat clutter # # drivers/scsi/gdth_kcompat.h # 2005/01/03 10:49:17-06:00 hch@lst.de +21 -0 # gdth: cleanup compat clutter # # drivers/scsi/gdth.c # 2005/01/03 10:53:29-06:00 hch@lst.de +111 -645 # gdth: cleanup compat clutter # # drivers/scsi/gdth_kcompat.h # 2005/01/03 10:49:17-06:00 hch@lst.de +0 -0 # BitKeeper file /home/jejb/BK/scsi-misc-2.6/drivers/scsi/gdth_kcompat.h # # ChangeSet # 2005/01/03 10:13:30-06:00 rddunlap@osdl.org # [PATCH] gdth: reduce large on-stack locals # # gdth is the fourth-highest stack user (for a single function) # in 2.6.10-rc3-bk-recent (sizes on x86-32). # # Reduce stack usage in gdth driver: # reduce ioc_rescan() from 1564 to 52 bytes; # reduce ioc_hdrlist() from 1528 to 24 bytes; # reduce gdth_get_info() from 1076 to 300 bytes; # # Signed-off-by: Randy Dunlap # Signed-off-by: James Bottomley # # drivers/scsi/gdth_proc.c # 2004/12/20 14:51:08-06:00 rddunlap@osdl.org +78 -67 # gdth: reduce large on-stack locals # # drivers/scsi/gdth.c # 2004/12/20 12:15:33-06:00 rddunlap@osdl.org +111 -83 # gdth: reduce large on-stack locals # # ChangeSet # 2005/01/03 10:07:16-06:00 axboe@suse.de # [PATCH] gdth buggy page mapping # # Just tripped over a bug report for the SUSE kernel where gdth would # crash on a 32G opteron, turned out that the gdth_internal_copy() sg # handling was really buggy. After fixing this I wanted to do the same for # mainline, but I can see that a vain attempt was already made to fix it. # Unfortunately it wasn't complete, and on top of that there's room for # improvement. # # The current code is buggy on highmem, as page_address() will not yield a # valid kernel address causing a NULL pointer dereference. The current # code also doesn't unmap the sg list if it sees a NULL sl->page. In fact, # the whole sg mapping looks really strange, why on earth would you be # mapping the sglist for dma when you are only going to copy from it? # # This patch corrects both errors - correctly maps in the page, and kills # the pci_map_sg/pci_unmap_sg calls completely. If someone could test # this, that would be great. # # Signed-off-by: Jens Axboe # Signed-off-by: James Bottomley # # drivers/scsi/gdth.c # 2004/11/23 13:13:04-06:00 axboe@suse.de +9 -9 # gdth buggy page mapping # # ChangeSet # 2005/01/01 21:07:52-06:00 jejb@mulgrave.(none) # osst: add sysfs support # # From: Willem Riede # # adds sysfs support to osst. This enables hotplug and udev to manage # the osst /dev nodes, which is a real necessity on installations that # use a dynamic /dev, such as Fedora Core 3. # # signed-off-by: Willem Riede # Signed-off-by: James Bottomley # # drivers/scsi/osst.c # 2005/01/01 21:04:08-06:00 jejb@mulgrave.(none) +167 -7 # osst: add sysfs support # # ChangeSet # 2005/01/01 20:51:14-06:00 jejb@mulgrave.(none) # osst: error handling updates # # From: Willem Riede # # important error handling improvements that I've made as the result of # problem reports. # # signed-off-by: Willem Riede # Signed-off-by: James Bottomley # # drivers/scsi/osst.h # 2005/01/01 20:49:34-06:00 jejb@mulgrave.(none) +2 -1 # osst: error handling updates # # drivers/scsi/osst.c # 2005/01/01 20:49:34-06:00 jejb@mulgrave.(none) +131 -53 # osst: error handling updates # # ChangeSet # 2005/01/01 20:40:31-06:00 osst@riede.org # [PATCH] osst: remove typedefs # # Make style changes that are the equivalent of recent changes to st, # such as using 'struct osst_tape' where we used to have 'OS_Scsi_Tape' # as a typedef. Osst behavior is not affected by this patch. # # signed-off-by: Willem Riede # Signed-off-by: James Bottomley # # drivers/scsi/osst.h # 2005/01/01 18:05:27-06:00 osst@riede.org +6 -6 # osst: remove typedefs # # drivers/scsi/osst.c # 2005/01/01 18:11:25-06:00 osst@riede.org +247 -246 # osst: remove typedefs # # ChangeSet # 2004/12/31 14:54:38-06:00 sleddog@us.ibm.com # [PATCH] ibmvscsi: fix abort and reset error path # # Description: Fix error paths to handle SCSI targets # that reject SCSI aborts and resets and subsequently # complete SCSI commands. There are targets in the field # that currently exhibit this behaviour, particularly in # the case of bad media (a CD drive got stuck for a LOOONG # time on a read op.) We previously ignore the status # on aborts and resets under the mistaken belief that # whether they worked or not, the command response was # never going to show up. # # Signed-off-by: Dave Boutcher # Signed-off-by: James Bottomley # # drivers/scsi/ibmvscsi/ibmvscsi.h # 2004/12/21 14:47:44-06:00 sleddog@us.ibm.com +1 -0 # ibmvscsi: fix abort and reset error path # # drivers/scsi/ibmvscsi/ibmvscsi.c # 2004/12/21 14:47:43-06:00 sleddog@us.ibm.com +79 -4 # ibmvscsi: fix abort and reset error path # # ChangeSet # 2004/12/31 13:33:47-06:00 sleddog@us.ibm.com # [PATCH] ibmvscsi: fix dangling pointer reference # # This code has been problematic for a while and still contained a leg # where free_event_struct was called....followed by a reference to the # event_struct. Restructure to make the code cleaner and fix the # dangling pointer reference. # # Signed-off-by: Dave Boutcher # Signed-off-by: James Bottomley # # drivers/scsi/ibmvscsi/ibmvscsi.c # 2004/12/31 09:59:46-06:00 sleddog@us.ibm.com +24 -25 # ibmvscsi: fix dangling pointer reference # # ChangeSet # 2004/12/31 13:29:49-06:00 sleddog@us.ibm.com # [PATCH] ibmvscsi: fix loop exit condition # # Fix a bug where we could fall out of our delay loop and then forget to # scan for drives. # # Signed-off-by: Dave Boutcher # Signed-off-by: James Bottomley # # drivers/scsi/ibmvscsi/ibmvscsi.c # 2004/12/31 09:59:39-06:00 sleddog@us.ibm.com +2 -2 # ibmvscsi: fix loop exit condition # # ChangeSet # 2004/12/31 12:19:50-06:00 sleddog@us.ibm.com # [PATCH] ibmvscsi: limit size of I/O requests, updated # # Description: Limit the size of I/O requests sent by the # ibmvscsi adapter. With better I/O scheduling (and thus larger # requests) we were breaking some servers. # # Updated based on comments from Jens Axboe and James # Bottomley to not specify max I/O sectors as a module # parameter, and subsequently not needlessly store # the value as a static variable. # # Signed-off-by: Dave Boutcher # Signed-off-by: James Bottomley # # drivers/scsi/ibmvscsi/ibmvscsi.c # 2004/12/31 10:42:38-06:00 sleddog@us.ibm.com +9 -3 # ibmvscsi: limit size of I/O requests, updated # # ChangeSet # 2004/12/31 11:35:21-06:00 James.Bottomley@steeleye.com # [PATCH] fix SPI transport class to do DV for broken Western Digital drives # # There's been a problem reported where a WD Ultra3 drive reports that it # has an echo buffer of length 255 and then returns ILLEGAL REQUEST when # anyone tries to use it. This causes DV to treat this as a retraining # error and eventually drop back to async. # # The attached fix makes the DV code identify the ILLEGAL REQUEST # condition and configure the drive using the read only DV tests instead. # # Signed-off-by: James Bottomley # # drivers/scsi/scsi_transport_spi.c # 2004/12/30 14:55:59-06:00 James.Bottomley@steeleye.com +63 -28 # fix SPI transport class to do DV for broken Western Digital drives # # ChangeSet # 2004/12/31 11:30:15-06:00 matthew@wil.cx # [PATCH] Misc zalon fixes # # Some miscellaneous cleanups for the Zalon driver: # # - Remove unused definitions of sync_scsi_data_for_cpu and # sync_scsi_data_for_device # - Fill in dev->irq in the zalon driver # - Request the interrupt in the name of the driver, not the bus address # - Change the driver name to look better in sysfs # - Call ncr53c8xx_exit() in zalon7xx_exit() # # Signed-off-by: Matthew Wilcox # Signed-off-by: James Bottomley # # drivers/scsi/zalon.c # 2004/12/24 17:40:00-06:00 matthew@wil.cx +10 -11 # Misc zalon fixes # # drivers/scsi/sym53c8xx_comm.h # 2004/12/24 17:40:00-06:00 matthew@wil.cx +0 -2 # Misc zalon fixes # # ChangeSet # 2004/12/31 11:26:43-06:00 matthew@wil.cx # [PATCH] Remove lasi700.h # # Inline lasi700.h into lasi700.c to cut down on the size of the # drivers/scsi directory. # # Signed-off-by: James Bottomley # # drivers/scsi/lasi700.c # 2004/12/24 17:39:59-06:00 matthew@wil.cx +21 -1 # Remove lasi700.h # # BitKeeper/deleted/.del-lasi700.h~7b65d6523b8b75b # 2004/12/31 11:25:37-06:00 matthew@wil.cx +0 -0 # Delete: drivers/scsi/lasi700.h # # ChangeSet # 2004/12/31 11:21:01-06:00 matthew@wil.cx # [PATCH] sym2 version 2.1.18n # # sym2 version 2.1.18n: # - Prevent querying for DT clocking on a single ended bus # - Check the U3EN bit instead of the ULTRA3 bit # - Only use PPR if SDTR is incapable of negotiating the desired options or # speed # - minsync bugfix (James Bottomley) # - Always calculate what negotiation to perform inside sym_prepare_nego() # - Delete unused SYM_OPT_HANDLE_IO_TIMEOUT and SYM_CONF_TIMEOUT_ORDER_MAX # code (Christoph Hellwig) # - Use SCSI-3 message names instead of SCSI-2 names # - Remove private definitions of PCI IDs # - Reorganise DMA mask setup # - Fix comment tpyo # - Make some needlessly global code static (Adrian Bunk) # - Reorder some functions to eliminate predeclaration # - Use memset instead of bzero # - Consolidate and abstract SPARC's special IRQ printing # - Convert hcb_p to struct sym_hcb * # - Remove cam_ccb_p and cam_scsiio_p typedefs # - Treat PA-RISC firmware as if it were a type of NVRAM # # Signed-off-by: Matthew Wilcox # Signed-off-by: James Bottomley # # drivers/scsi/sym53c8xx_2/sym_nvram.h # 2004/12/24 17:40:03-06:00 matthew@wil.cx +6 -0 # sym2 version 2.1.18n # # drivers/scsi/sym53c8xx_2/sym_nvram.c # 2004/12/24 17:40:03-06:00 matthew@wil.cx +38 -1 # sym2 version 2.1.18n # # drivers/scsi/sym53c8xx_2/sym_misc.c # 2004/12/24 17:40:03-06:00 matthew@wil.cx +1 -97 # sym2 version 2.1.18n # # drivers/scsi/sym53c8xx_2/sym_malloc.c # 2004/12/24 17:40:03-06:00 matthew@wil.cx +1 -1 # sym2 version 2.1.18n # # drivers/scsi/sym53c8xx_2/sym_hipd.h # 2004/12/24 17:40:03-06:00 matthew@wil.cx +22 -50 # sym2 version 2.1.18n # # drivers/scsi/sym53c8xx_2/sym_hipd.c # 2004/12/29 13:40:39-06:00 matthew@wil.cx +193 -276 # sym2 version 2.1.18n # # drivers/scsi/sym53c8xx_2/sym_glue.h # 2004/12/24 17:40:02-06:00 matthew@wil.cx +9 -25 # sym2 version 2.1.18n # # drivers/scsi/sym53c8xx_2/sym_glue.c # 2004/12/24 17:40:02-06:00 matthew@wil.cx +30 -53 # sym2 version 2.1.18n # # drivers/scsi/sym53c8xx_2/sym_fw.c # 2004/12/24 17:40:02-06:00 matthew@wil.cx +2 -2 # sym2 version 2.1.18n # # drivers/scsi/sym53c8xx_2/sym_defs.h # 2004/12/29 13:42:34-06:00 matthew@wil.cx +7 -27 # sym2 version 2.1.18n # # drivers/scsi/sym53c8xx_2/sym_conf.h # 2004/12/24 17:40:02-06:00 matthew@wil.cx +0 -8 # sym2 version 2.1.18n # # ChangeSet # 2004/12/31 11:17:57-06:00 jejb@mulgrave.(none) # SCSI: update ipr to use the change_queue_depth API # # Instead of doing an attribute override. # # Ack'd by: Brian King # Signed-off-by: James Bottomley # # drivers/scsi/ipr.c # 2004/12/31 11:16:52-06:00 jejb@mulgrave.(none) +7 -21 # SCSI: update ipr to use the change_queue_depth API # diff -Nru a/CREDITS b/CREDITS --- a/CREDITS 2005-01-13 16:25:56 -08:00 +++ b/CREDITS 2005-01-13 16:25:56 -08:00 @@ -2936,10 +2936,10 @@ S: Finland N: Deepak Saxena -E: deepak@csociety.purdue.edu +E: dsaxena@plexity.net D: I2O kernel layer (config, block, core, pci, net). I2O disk support for LILO -D: XScale(IOP310) porting -S: Tempe, Arizona +D: XScale(IOP, IXP) porting and other random ARM bits +S: Portland, OR N: Eric Schenk E: Eric.Schenk@dna.lth.se diff -Nru a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt --- a/Documentation/kernel-parameters.txt 2005-01-13 16:25:56 -08:00 +++ b/Documentation/kernel-parameters.txt 2005-01-13 16:25:56 -08:00 @@ -673,7 +673,11 @@ mac53c9x= [HW,SCSI] Format: ,,,,,,, - + + machvec= [IA64] + Force the use of a particular machine-vector (machvec) in a generic + kernel. Example: machvec=hpzx1_swiotlb + mad16= [HW,OSS] Format: ,,,,,, diff -Nru a/MAINTAINERS b/MAINTAINERS --- a/MAINTAINERS 2005-01-13 16:25:56 -08:00 +++ b/MAINTAINERS 2005-01-13 16:25:56 -08:00 @@ -1988,6 +1988,20 @@ W: http://linux-visws.sf.net S: Maintained for 2.6. +SIMTEC EB110ATX (Chalice CATS) +P: Ben Dooks +P: Vincent Sanders +M: support@simtec.co.uk +W: http://www.simtec.co.uk/products/EB110ATX/ +S: Supported + +SIMTEC EB2410ITX (BAST) +P: Ben Dooks +P: Vincent Sanders +M: support@simtec.co.uk +W: http://www.simtec.co.uk/products/EB2410ITX/ +S: Supported + SIS 5513 IDE CONTROLLER DRIVER P: Lionel Bouton M: Lionel.Bouton@inet6.fr diff -Nru a/arch/arm/Kconfig b/arch/arm/Kconfig --- a/arch/arm/Kconfig 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/Kconfig 2005-01-13 16:25:56 -08:00 @@ -418,20 +418,6 @@ be linked for and stored to. This address is dependent on your own flash usage. - Please note that, if you're using MTD, you must use a flash chip - that is NOT handled by MTD or the flash will be turned into non - data mode for status and query purposes which will instantaneously - crash the kernel. - - MTD can however be used with a XIP kernel on the same flash chip - but only if the flash memory supports multiple partitions in - hardware, like with the Intel K3 flash parts, and only if the - kernel is not stored within the firrst hardware partition of the - chip. - - In any case, make sure that MTD support is configured out for - the first attempt. - if (ARCH_SA1100 || ARCH_INTEGRATOR) source "drivers/cpufreq/Kconfig" diff -Nru a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c --- a/arch/arm/common/scoop.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/common/scoop.c 2005-01-13 16:25:56 -08:00 @@ -100,11 +100,13 @@ struct platform_device *pdev = to_platform_device(dev); struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem) return -EINVAL; + if (!mem) + return -EINVAL; inf = dev->platform_data; scoop_io_base = ioremap(mem->start, 0x1000); - if (!scoop_io_base) return -ENOMEM; + if (!scoop_io_base) + return -ENOMEM; SCOOP_REG(SCOOP_MCR) = 0x0140; diff -Nru a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c --- a/arch/arm/kernel/irq.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/kernel/irq.c 2005-01-13 16:25:56 -08:00 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -85,6 +86,23 @@ .disable_depth = 1, }; +#ifdef CONFIG_SMP +void synchronize_irq(unsigned int irq) +{ + struct irqdesc *desc = irq_desc + irq; + + while (desc->running) + barrier(); +} +EXPORT_SYMBOL(synchronize_irq); + +#define smp_set_running(desc) do { desc->running = 1; } while (0) +#define smp_clear_running(desc) do { desc->running = 0; } while (0) +#else +#define smp_set_running(desc) do { } while (0) +#define smp_clear_running(desc) do { } while (0) +#endif + /** * disable_irq_nosync - disable an irq without waiting * @irq: Interrupt to disable @@ -232,6 +250,9 @@ #ifdef CONFIG_ARCH_ACORN show_fiq_list(p, v); #endif +#ifdef CONFIG_SMP + show_ipi_list(p); +#endif seq_printf(p, "Err: %10lu\n", irq_err_count); } return 0; @@ -329,18 +350,22 @@ do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) { struct irqaction *action; - const int cpu = smp_processor_id(); + const unsigned int cpu = smp_processor_id(); desc->triggered = 1; kstat_cpu(cpu).irqs[irq]++; + smp_set_running(desc); + action = desc->action; if (action) { int ret = __do_irq(irq, action, regs); if (ret != IRQ_HANDLED) report_bad_irq(irq, regs, desc, ret); } + + smp_clear_running(desc); } /* @@ -350,7 +375,7 @@ void do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) { - const int cpu = smp_processor_id(); + const unsigned int cpu = smp_processor_id(); desc->triggered = 1; @@ -414,7 +439,7 @@ do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) { struct irqaction *action; - const int cpu = smp_processor_id(); + const unsigned int cpu = smp_processor_id(); desc->triggered = 1; @@ -426,6 +451,8 @@ if (likely(!desc->disable_depth)) { kstat_cpu(cpu).irqs[irq]++; + smp_set_running(desc); + /* * Return with this interrupt masked if no action */ @@ -440,6 +467,8 @@ !check_irq_lock(desc, irq, regs))) desc->chip->unmask(irq); } + + smp_clear_running(desc); } } @@ -878,8 +907,97 @@ EXPORT_SYMBOL(probe_irq_off); +#ifdef CONFIG_SMP +static void route_irq(struct irqdesc *desc, unsigned int irq, unsigned int cpu) +{ + pr_debug("IRQ%u: moving from cpu%u to cpu%u\n", irq, desc->cpu, cpu); + + spin_lock_irq(&irq_controller_lock); + desc->cpu = cpu; + desc->chip->set_cpu(desc, irq, cpu); + spin_unlock_irq(&irq_controller_lock); +} + +#ifdef CONFIG_PROC_FS +static int +irq_affinity_read_proc(char *page, char **start, off_t off, int count, + int *eof, void *data) +{ + struct irqdesc *desc = irq_desc + ((int)data); + int len = cpumask_scnprintf(page, count, desc->affinity); + + if (count - len < 2) + return -EINVAL; + page[len++] = '\n'; + page[len] = '\0'; + + return len; +} + +static int +irq_affinity_write_proc(struct file *file, const char __user *buffer, + unsigned long count, void *data) +{ + unsigned int irq = (unsigned int)data; + struct irqdesc *desc = irq_desc + irq; + cpumask_t affinity, tmp; + int ret = -EIO; + + if (!desc->chip->set_cpu) + goto out; + + ret = cpumask_parse(buffer, count, affinity); + if (ret) + goto out; + + cpus_and(tmp, affinity, cpu_online_map); + if (cpus_empty(tmp)) { + ret = -EINVAL; + goto out; + } + + desc->affinity = affinity; + route_irq(desc, irq, first_cpu(tmp)); + ret = count; + + out: + return ret; +} +#endif +#endif + void __init init_irq_proc(void) { +#if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS) + struct proc_dir_entry *dir; + int irq; + + dir = proc_mkdir("irq", 0); + if (!dir) + return; + + for (irq = 0; irq < NR_IRQS; irq++) { + struct proc_dir_entry *entry; + struct irqdesc *desc; + char name[16]; + + desc = irq_desc + irq; + memset(name, 0, sizeof(name)); + snprintf(name, sizeof(name) - 1, "%u", irq); + + desc->procdir = proc_mkdir(name, dir); + if (!desc->procdir) + continue; + + entry = create_proc_entry("smp_affinity", 0600, desc->procdir); + if (entry) { + entry->nlink = 1; + entry->data = (void *)irq; + entry->read_proc = irq_affinity_read_proc; + entry->write_proc = irq_affinity_write_proc; + } + } +#endif } void __init init_IRQ(void) @@ -887,6 +1005,11 @@ struct irqdesc *desc; extern void init_dma(void); int irq; + +#ifdef CONFIG_SMP + bad_irq_desc.affinity = CPU_MASK_ALL; + bad_irq_desc.cpu = smp_processor_id(); +#endif for (irq = 0, desc = irq_desc; irq < NR_IRQS; irq++, desc++) { *desc = bad_irq_desc; diff -Nru a/arch/arm/kernel/semaphore.c b/arch/arm/kernel/semaphore.c --- a/arch/arm/kernel/semaphore.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/kernel/semaphore.c 2005-01-13 16:25:56 -08:00 @@ -178,7 +178,7 @@ * registers (r0 to r3 and lr), but not ip, as we use it as a return * value in some cases.. */ -asm(" .section .sched.text \n\ +asm(" .section .sched.text,\"ax\" \n\ .align 5 \n\ .globl __down_failed \n\ __down_failed: \n\ diff -Nru a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c --- a/arch/arm/kernel/smp.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/kernel/smp.c 2005-01-13 16:25:56 -08:00 @@ -17,16 +17,16 @@ #include #include #include +#include +#include #include #include +#include #include #include -#include -#include - -#include #include +#include /* * bitmask of present and online CPUs. @@ -42,6 +42,7 @@ */ struct ipi_data { spinlock_t lock; + unsigned long ipi_count; unsigned long bits; }; @@ -242,12 +243,12 @@ void show_ipi_list(struct seq_file *p) { - int cpu; + unsigned int cpu; - seq_printf(p, "IPI: "); + seq_puts(p, "IPI:"); for_each_online_cpu(cpu) - seq_printf(p, "%10lu ", per_cpu(cpu_data, cpu).ipi_count); + seq_printf(p, " %10lu", per_cpu(ipi_data, cpu).ipi_count); seq_putc(p, '\n'); } @@ -316,12 +317,11 @@ void do_IPI(unsigned int ipimask, struct pt_regs *regs) { unsigned int cpu = smp_processor_id(); + struct ipi_data *ipi = &per_cpu(ipi_data, cpu); - per_cpu(cpu_data, cpu).ipi_count++; + ipi->ipi_count++; if (ipimask & (1 << 0)) { - struct ipi_data *ipi = &per_cpu(ipi_data, cpu); - for (;;) { unsigned long msgs; diff -Nru a/arch/arm/lib/io-readsw-armv4.S b/arch/arm/lib/io-readsw-armv4.S --- a/arch/arm/lib/io-readsw-armv4.S 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/lib/io-readsw-armv4.S 2005-01-13 16:25:56 -08:00 @@ -18,25 +18,14 @@ #endif .endm -.insw_bad_alignment: - adr r0, .insw_bad_align_msg - mov r2, lr - b panic -.insw_bad_align_msg: - .asciz "insw: bad buffer alignment (0x%p, lr=0x%08lX)\n" - .align - -.insw_align: tst r1, #1 - bne .insw_bad_alignment - - ldrh r3, [r0] - strh r3, [r1], #2 - - subs r2, r2, #1 - RETINSTR(moveq, pc, lr) +.insw_align: movs ip, r1, lsl #31 + bne .insw_noalign + ldrh ip, [r0] + sub r2, r2, #1 + strh ip, [r1], #2 ENTRY(__raw_readsw) - teq r2, #0 @ do we have to check for the zero len? + teq r2, #0 moveq pc, lr tst r1, #3 bne .insw_align @@ -62,14 +51,10 @@ ldrh lr, [r0] pack ip, ip, lr - stmia r1!, {r3 - r5, ip} - subs r2, r2, #8 + stmia r1!, {r3 - r5, ip} bpl .insw_8_lp - tst r2, #7 - LOADREGS(eqfd, sp!, {r4, r5, pc}) - .no_insw_8: tst r2, #4 beq .no_insw_4 @@ -83,17 +68,63 @@ stmia r1!, {r3, r4} -.no_insw_4: tst r2, #2 - beq .no_insw_2 +.no_insw_4: movs r2, r2, lsl #31 + bcc .no_insw_2 ldrh r3, [r0] ldrh ip, [r0] pack r3, r3, ip - str r3, [r1], #4 -.no_insw_2: tst r2, #1 - ldrneh r3, [r0] +.no_insw_2: ldrneh r3, [r0] strneh r3, [r1] - LOADREGS(fd, sp!, {r4, r5, pc}) + ldmfd sp!, {r4, r5, pc} + +#ifdef __ARMEB__ +#define _BE_ONLY_(code...) code +#define _LE_ONLY_(code...) +#define push_hbyte0 lsr #8 +#define pull_hbyte1 lsl #24 +#else +#define _BE_ONLY_(code...) +#define _LE_ONLY_(code...) code +#define push_hbyte0 lsl #24 +#define pull_hbyte1 lsr #8 +#endif + +.insw_noalign: stmfd sp!, {r4, lr} + ldrccb ip, [r1, #-1]! + bcc 1f + + ldrh ip, [r0] + sub r2, r2, #1 + _BE_ONLY_( mov ip, ip, ror #8 ) + strb ip, [r1], #1 + _LE_ONLY_( mov ip, ip, lsr #8 ) + _BE_ONLY_( mov ip, ip, lsr #24 ) + +1: subs r2, r2, #2 + bmi 3f + _BE_ONLY_( mov ip, ip, lsl #24 ) + +2: ldrh r3, [r0] + ldrh r4, [r0] + subs r2, r2, #2 + orr ip, ip, r3, lsl #8 + orr ip, ip, r4, push_hbyte0 + str ip, [r1], #4 + mov ip, r4, pull_hbyte1 + bpl 2b + + _BE_ONLY_( mov ip, ip, lsr #24 ) + +3: tst r2, #1 + strb ip, [r1], #1 + ldrneh ip, [r0] + _BE_ONLY_( movne ip, ip, ror #8 ) + strneb ip, [r1], #1 + _LE_ONLY_( movne ip, ip, lsr #8 ) + _BE_ONLY_( movne ip, ip, lsr #24 ) + strneb ip, [r1] + ldmfd sp!, {r4, pc} diff -Nru a/arch/arm/lib/io-writesw-armv4.S b/arch/arm/lib/io-writesw-armv4.S --- a/arch/arm/lib/io-writesw-armv4.S 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/lib/io-writesw-armv4.S 2005-01-13 16:25:56 -08:00 @@ -22,27 +22,17 @@ #endif .endm -.outsw_bad_alignment: - adr r0, .outsw_bad_align_msg - mov r2, lr - b panic -.outsw_bad_align_msg: - .asciz "outsw: bad buffer alignment (0x%p, lr=0x%08lX)\n" - .align - -.outsw_align: tst r1, #1 - bne .outsw_bad_alignment +.outsw_align: movs ip, r1, lsl #31 + bne .outsw_noalign ldrh r3, [r1], #2 + sub r2, r2, #1 strh r3, [r0] - subs r2, r2, #1 - RETINSTR(moveq, pc, lr) - ENTRY(__raw_writesw) - teq r2, #0 @ do we have to check for the zero len? + teq r2, #0 moveq pc, lr - tst r1, #3 + ands r3, r1, #3 bne .outsw_align stmfd sp!, {r4, r5, lr} @@ -51,16 +41,13 @@ bmi .no_outsw_8 .outsw_8_lp: ldmia r1!, {r3, r4, r5, ip} + subs r2, r2, #8 outword r3 outword r4 outword r5 outword ip - subs r2, r2, #8 bpl .outsw_8_lp - tst r2, #7 - LOADREGS(eqfd, sp!, {r4, r5, pc}) - .no_outsw_8: tst r2, #4 beq .no_outsw_4 @@ -68,14 +55,41 @@ outword r3 outword ip -.no_outsw_4: tst r2, #2 - beq .no_outsw_2 +.no_outsw_4: movs r2, r2, lsl #31 + bcc .no_outsw_2 ldr r3, [r1], #4 outword r3 -.no_outsw_2: tst r2, #1 - ldrneh r3, [r1] +.no_outsw_2: ldrneh r3, [r1] strneh r3, [r0] - LOADREGS(fd, sp!, {r4, r5, pc}) + ldmfd sp!, {r4, r5, pc} + +#ifdef __ARMEB__ +#define pull_hbyte0 lsl #8 +#define push_hbyte1 lsr #24 +#else +#define pull_hbyte0 lsr #24 +#define push_hbyte1 lsl #8 +#endif + +.outsw_noalign: ldr r3, [r1, -r3]! + subcs r2, r2, #1 + bcs 2f + subs r2, r2, #2 + bmi 3f + +1: mov ip, r3, lsr #8 + strh ip, [r0] +2: mov ip, r3, pull_hbyte0 + ldr r3, [r1, #4]! + subs r2, r2, #2 + orr ip, ip, r3, push_hbyte1 + strh ip, [r0] + bpl 2b + +3: tst r2, #1 +2: movne ip, r3, lsr #8 + strneh ip, [r0] + mov pc, lr diff -Nru a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c --- a/arch/arm/mach-ixp4xx/coyote-pci.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-ixp4xx/coyote-pci.c 2005-01-13 16:25:56 -08:00 @@ -14,6 +14,7 @@ * */ +#include #include #include diff -Nru a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c --- a/arch/arm/mach-ixp4xx/coyote-setup.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-ixp4xx/coyote-setup.c 2005-01-13 16:25:56 -08:00 @@ -8,6 +8,7 @@ * Author: Deepak Saxena */ +#include #include #include #include diff -Nru a/arch/arm/mach-ixp4xx/ixdp425-pci.c b/arch/arm/mach-ixp4xx/ixdp425-pci.c --- a/arch/arm/mach-ixp4xx/ixdp425-pci.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c 2005-01-13 16:25:56 -08:00 @@ -14,6 +14,7 @@ * */ +#include #include #include #include diff -Nru a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c --- a/arch/arm/mach-ixp4xx/ixdp425-setup.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c 2005-01-13 16:25:56 -08:00 @@ -8,6 +8,7 @@ * Author: Deepak Saxena */ +#include #include #include #include diff -Nru a/arch/arm/mach-ixp4xx/ixdpg425-pci.c b/arch/arm/mach-ixp4xx/ixdpg425-pci.c --- a/arch/arm/mach-ixp4xx/ixdpg425-pci.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-ixp4xx/ixdpg425-pci.c 2005-01-13 16:25:56 -08:00 @@ -13,6 +13,7 @@ * */ +#include #include #include diff -Nru a/arch/arm/mach-ixp4xx/prpmc1100-pci.c b/arch/arm/mach-ixp4xx/prpmc1100-pci.c --- a/arch/arm/mach-ixp4xx/prpmc1100-pci.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-ixp4xx/prpmc1100-pci.c 2005-01-13 16:25:56 -08:00 @@ -19,6 +19,7 @@ * */ +#include #include #include #include diff -Nru a/arch/arm/mach-ixp4xx/prpmc1100-setup.c b/arch/arm/mach-ixp4xx/prpmc1100-setup.c --- a/arch/arm/mach-ixp4xx/prpmc1100-setup.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-ixp4xx/prpmc1100-setup.c 2005-01-13 16:25:56 -08:00 @@ -8,6 +8,7 @@ * Author: Deepak Saxena */ +#include #include #include #include diff -Nru a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile --- a/arch/arm/mach-pxa/Makefile 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-pxa/Makefile 2005-01-13 16:25:56 -08:00 @@ -11,7 +11,7 @@ obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o obj-$(CONFIG_ARCH_PXA_IDP) += idp.o -obj-$(CONFIG_PXA_SHARPSL) += corgi.o +obj-$(CONFIG_PXA_SHARPSL) += corgi.o corgi_ssp.o ssp.o # Support for blinky lights led-y := leds.o diff -Nru a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c --- a/arch/arm/mach-pxa/corgi.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-pxa/corgi.c 2005-01-13 16:25:56 -08:00 @@ -68,8 +68,14 @@ .resource = corgi_scoop_resources, }; +static struct platform_device corgissp_device = { + .name = "corgi-ssp", + .id = -1, +}; + static struct platform_device *devices[] __initdata = { &corgiscoop_device, + &corgissp_device, }; static struct sharpsl_flash_param_info sharpsl_flash_param; diff -Nru a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/arm/mach-pxa/corgi_ssp.c 2005-01-13 16:25:56 -08:00 @@ -0,0 +1,247 @@ +/* + * SSP control code for Sharp Corgi devices + * + * Copyright (c) 2004 Richard Purdie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +static spinlock_t corgi_ssp_lock = SPIN_LOCK_UNLOCKED; +static struct ssp_dev corgi_ssp_dev; +static struct ssp_state corgi_ssp_state; + +/* + * There are three devices connected to the SSP interface: + * 1. A touchscreen controller (TI ADS7846 compatible) + * 2. An LCD contoller (with some Backlight functionality) + * 3. A battery moinitoring IC (Maxim MAX1111) + * + * Each device uses a different speed/mode of communication. + * + * The touchscreen is very sensitive and the most frequently used + * so the port is left configured for this. + * + * Devices are selected using Chip Selects on GPIOs. + */ + +/* + * ADS7846 Routines + */ +unsigned long corgi_ssp_ads7846_putget(ulong data) +{ + unsigned long ret,flag; + + spin_lock_irqsave(&corgi_ssp_lock, flag); + GPCR0 = GPIO_bit(CORGI_GPIO_ADS7846_CS); + + ssp_write_word(&corgi_ssp_dev,data); + ret = ssp_read_word(&corgi_ssp_dev); + + GPSR0 = GPIO_bit(CORGI_GPIO_ADS7846_CS); + spin_unlock_irqrestore(&corgi_ssp_lock, flag); + + return ret; +} + +/* + * NOTE: These functions should always be called in interrupt context + * and use the _lock and _unlock functions. They are very time sensitive. + */ +void corgi_ssp_ads7846_lock(void) +{ + spin_lock(&corgi_ssp_lock); + GPCR0 = GPIO_bit(CORGI_GPIO_ADS7846_CS); +} + +void corgi_ssp_ads7846_unlock(void) +{ + GPSR0 = GPIO_bit(CORGI_GPIO_ADS7846_CS); + spin_unlock(&corgi_ssp_lock); +} + +void corgi_ssp_ads7846_put(ulong data) +{ + ssp_write_word(&corgi_ssp_dev,data); +} + +unsigned long corgi_ssp_ads7846_get(void) +{ + return ssp_read_word(&corgi_ssp_dev); +} + +EXPORT_SYMBOL(corgi_ssp_ads7846_putget); +EXPORT_SYMBOL(corgi_ssp_ads7846_lock); +EXPORT_SYMBOL(corgi_ssp_ads7846_unlock); +EXPORT_SYMBOL(corgi_ssp_ads7846_put); +EXPORT_SYMBOL(corgi_ssp_ads7846_get); + + +/* + * LCD/Backlight Routines + */ +unsigned long corgi_ssp_dac_put(ulong data) +{ + unsigned long flag; + + spin_lock_irqsave(&corgi_ssp_lock, flag); + GPCR0 = GPIO_bit(CORGI_GPIO_LCDCON_CS); + + ssp_disable(&corgi_ssp_dev); + ssp_config(&corgi_ssp_dev, (SSCR0_Motorola | (SSCR0_DSS & 0x07 )), SSCR1_SPH, 0, SSCR0_SerClkDiv(76)); + ssp_enable(&corgi_ssp_dev); + + ssp_write_word(&corgi_ssp_dev,data); + /* Read null data back from device to prevent SSP overflow */ + ssp_read_word(&corgi_ssp_dev); + + ssp_disable(&corgi_ssp_dev); + ssp_config(&corgi_ssp_dev, (SSCR0_National | (SSCR0_DSS & 0x0b )), 0, 0, SSCR0_SerClkDiv(2)); + ssp_enable(&corgi_ssp_dev); + GPSR0 = GPIO_bit(CORGI_GPIO_LCDCON_CS); + spin_unlock_irqrestore(&corgi_ssp_lock, flag); + + return 0; +} + +void corgi_ssp_lcdtg_send(u8 adrs, u8 data) +{ + corgi_ssp_dac_put(((adrs & 0x07) << 5) | (data & 0x1f)); +} + +void corgi_ssp_blduty_set(int duty) +{ + corgi_ssp_lcdtg_send(0x02,duty); +} + +EXPORT_SYMBOL(corgi_ssp_lcdtg_send); +EXPORT_SYMBOL(corgi_ssp_blduty_set); + +/* + * Max1111 Routines + */ +int corgi_ssp_max1111_get(ulong data) +{ + unsigned long flag; + int voltage,voltage1,voltage2; + + spin_lock_irqsave(&corgi_ssp_lock, flag); + GPCR0 = GPIO_bit(CORGI_GPIO_MAX1111_CS); + ssp_disable(&corgi_ssp_dev); + ssp_config(&corgi_ssp_dev, (SSCR0_Motorola | (SSCR0_DSS & 0x07 )), 0, 0, SSCR0_SerClkDiv(8)); + ssp_enable(&corgi_ssp_dev); + + udelay(1); + + /* TB1/RB1 */ + ssp_write_word(&corgi_ssp_dev,data); + ssp_read_word(&corgi_ssp_dev); /* null read */ + + /* TB12/RB2 */ + ssp_write_word(&corgi_ssp_dev,0); + voltage1=ssp_read_word(&corgi_ssp_dev); + + /* TB13/RB3*/ + ssp_write_word(&corgi_ssp_dev,0); + voltage2=ssp_read_word(&corgi_ssp_dev); + + ssp_disable(&corgi_ssp_dev); + ssp_config(&corgi_ssp_dev, (SSCR0_National | (SSCR0_DSS & 0x0b )), 0, 0, SSCR0_SerClkDiv(2)); + ssp_enable(&corgi_ssp_dev); + GPSR0 = GPIO_bit(CORGI_GPIO_MAX1111_CS); + spin_unlock_irqrestore(&corgi_ssp_lock, flag); + + if (voltage1 & 0xc0 || voltage2 & 0x3f) + voltage = -1; + else + voltage = ((voltage1 << 2) & 0xfc) | ((voltage2 >> 6) & 0x03); + + return voltage; +} + +EXPORT_SYMBOL(corgi_ssp_max1111_get); + +/* + * Support Routines + */ +int __init corgi_ssp_probe(struct device *dev) +{ + int ret; + + /* Chip Select - Disable All */ + GPDR0 |= GPIO_bit(CORGI_GPIO_LCDCON_CS); /* output */ + GPSR0 = GPIO_bit(CORGI_GPIO_LCDCON_CS); /* High - Disable LCD Control/Timing Gen */ + GPDR0 |= GPIO_bit(CORGI_GPIO_MAX1111_CS); /* output */ + GPSR0 = GPIO_bit(CORGI_GPIO_MAX1111_CS); /* High - Disable MAX1111*/ + GPDR0 |= GPIO_bit(CORGI_GPIO_ADS7846_CS); /* output */ + GPSR0 = GPIO_bit(CORGI_GPIO_ADS7846_CS); /* High - Disable ADS7846*/ + + ret=ssp_init(&corgi_ssp_dev,1); + + if (ret) + printk(KERN_ERR "Unable to register SSP handler!\n"); + else { + ssp_disable(&corgi_ssp_dev); + ssp_config(&corgi_ssp_dev, (SSCR0_National | (SSCR0_DSS & 0x0b )), 0, 0, SSCR0_SerClkDiv(2)); + ssp_enable(&corgi_ssp_dev); + } + + return ret; +} + +static int corgi_ssp_remove(struct device *dev) +{ + ssp_exit(&corgi_ssp_dev); + return 0; +} + +static int corgi_ssp_suspend(struct device *dev, u32 state, u32 level) +{ + if (level == SUSPEND_POWER_DOWN) { + ssp_save_state(&corgi_ssp_dev,&corgi_ssp_state); + } + return 0; +} + +static int corgi_ssp_resume(struct device *dev, u32 level) +{ + if (level == RESUME_POWER_ON) { + GPSR0 = GPIO_bit(CORGI_GPIO_LCDCON_CS); /* High - Disable LCD Control/Timing Gen */ + GPSR0 = GPIO_bit(CORGI_GPIO_MAX1111_CS); /* High - Disable MAX1111*/ + GPSR0 = GPIO_bit(CORGI_GPIO_ADS7846_CS); /* High - Disable ADS7846*/ + ssp_restore_state(&corgi_ssp_dev,&corgi_ssp_state); + ssp_enable(&corgi_ssp_dev); + } + return 0; +} + +static struct device_driver corgissp_driver = { + .name = "corgi-ssp", + .bus = &platform_bus_type, + .probe = corgi_ssp_probe, + .remove = corgi_ssp_remove, + .suspend = corgi_ssp_suspend, + .resume = corgi_ssp_resume, +}; + +int __init corgi_ssp_init(void) +{ + return driver_register(&corgissp_driver); +} + +arch_initcall(corgi_ssp_init); diff -Nru a/arch/arm/mach-s3c2410/cpu.h b/arch/arm/mach-s3c2410/cpu.h --- a/arch/arm/mach-s3c2410/cpu.h 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-s3c2410/cpu.h 2005-01-13 16:25:56 -08:00 @@ -13,6 +13,7 @@ * 24-Aug-2004 BJD Start of generic S3C24XX support * 18-Oct-2004 BJD Moved board struct into this file * 04-Jan-2005 BJD New uart initialisation + * 10-Jan-2005 BJD Moved generic init here, specific to cpu headers */ #define IODESC_ENT(x) { S3C2410_VA_##x, S3C2410_PA_##x, S3C2410_SZ_##x, MT_DEVICE } @@ -26,25 +27,9 @@ /* forward declaration */ struct s3c2410_uartcfg; -#ifdef CONFIG_CPU_S3C2410 -extern int s3c2410_init(void); -extern void s3c2410_map_io(struct map_desc *mach_desc, int size); -extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); -#else -#define s3c2410_init_uarts NULL -#define s3c2410_map_io NULL -#define s3c2410_init NULL -#endif +/* core initialisation functions */ -#ifdef CONFIG_CPU_S3C2440 -extern int s3c2440_init(void); -extern void s3c2440_map_io(struct map_desc *mach_desc, int size); -extern void s3c2440_init_uarts(struct s3c2410_uartcfg *cfg, int no); -#else -#define s3c2440_init_uarts NULL -#define s3c2440_map_io NULL -#define s3c2440_init NULL -#endif +extern void s3c24xx_init_irq(void); extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); @@ -65,3 +50,8 @@ }; extern void s3c24xx_set_board(struct s3c24xx_board *board); + +/* timer for 2410/2440 */ + +struct sys_timer; +extern struct sys_timer s3c24xx_timer; diff -Nru a/arch/arm/mach-s3c2410/irq.c b/arch/arm/mach-s3c2410/irq.c --- a/arch/arm/mach-s3c2410/irq.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-s3c2410/irq.c 2005-01-13 16:25:56 -08:00 @@ -628,12 +628,12 @@ s3c_irq_demux_uart(IRQ_S3CUART_RX2, regs); } -/* s3c2410_init_irq +/* s3c24xx_init_irq * * Initialise S3C2410 IRQ system */ -void __init s3c2410_init_irq(void) +void __init s3c24xx_init_irq(void) { unsigned long pend; unsigned long last; diff -Nru a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c --- a/arch/arm/mach-s3c2410/mach-bast.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-s3c2410/mach-bast.c 2005-01-13 16:25:56 -08:00 @@ -20,7 +20,8 @@ * 18-Jan-2003 BJD Added serial port configuration * 05-Oct-2004 BJD Power management code * 04-Nov-2004 BJD Updated serial port clocks - * 04-Jan-2004 BJD New uart init call + * 04-Jan-2006 BJD New uart init call + * 10-Jan-2005 BJD Removed include of s3c2410.h */ #include @@ -48,7 +49,6 @@ #include #include -#include "s3c2410.h" #include "clock.h" #include "devs.h" #include "cpu.h" @@ -270,7 +270,7 @@ void __init bast_init_irq(void) { - s3c2410_init_irq(); + s3c24xx_init_irq(); } #ifdef CONFIG_PM @@ -307,5 +307,5 @@ MAPIO(bast_map_io) INITIRQ(bast_init_irq) .init_machine = bast_init_machine, - .timer = &s3c2410_timer, + .timer = &s3c24xx_timer, MACHINE_END diff -Nru a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c --- a/arch/arm/mach-s3c2410/mach-h1940.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-s3c2410/mach-h1940.c 2005-01-13 16:25:56 -08:00 @@ -21,6 +21,7 @@ * 18-Oct-2004 BJD Updated new board structure name * 04-Nov-2004 BJD Change for new serial clock * 04-Jan-2005 BJD Updated uart init call + * 10-Jan-2005 BJD Removed include of s3c2410.h */ #include @@ -45,7 +46,6 @@ #include -#include "s3c2410.h" #include "clock.h" #include "devs.h" #include "cpu.h" @@ -109,7 +109,7 @@ void __init h1940_init_irq(void) { - s3c2410_init_irq(); + s3c24xx_init_irq(); } @@ -119,5 +119,5 @@ BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) MAPIO(h1940_map_io) INITIRQ(h1940_init_irq) - .timer = &s3c2410_timer, + .timer = &s3c24xx_timer, MACHINE_END diff -Nru a/arch/arm/mach-s3c2410/mach-rx3715.c b/arch/arm/mach-s3c2410/mach-rx3715.c --- a/arch/arm/mach-s3c2410/mach-rx3715.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-s3c2410/mach-rx3715.c 2005-01-13 16:25:56 -08:00 @@ -12,6 +12,7 @@ * Modifications: * 16-Sep-2004 BJD Copied from mach-h1940.c * 25-Oct-2004 BJD Updates for 2.6.10-rc1 + * 10-Jan-2005 BJD Removed include of s3c2410.h s3c2440.h */ #include @@ -38,8 +39,6 @@ #include #include -#include "s3c2410.h" -#include "s3c2440.h" #include "clock.h" #include "devs.h" #include "cpu.h" @@ -101,7 +100,7 @@ void __init rx3715_init_irq(void) { - s3c2410_init_irq(); + s3c24xx_init_irq(); } #ifdef CONFIG_PM @@ -120,5 +119,5 @@ MAPIO(rx3715_map_io) INITIRQ(rx3715_init_irq) INIT_MACHINE(rx3715_init_machine) - .timer = &s3c2410_timer, + .timer = &s3c24xx_timer, MACHINE_END diff -Nru a/arch/arm/mach-s3c2410/mach-smdk2410.c b/arch/arm/mach-s3c2410/mach-smdk2410.c --- a/arch/arm/mach-s3c2410/mach-smdk2410.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-s3c2410/mach-smdk2410.c 2005-01-13 16:25:56 -08:00 @@ -46,7 +46,6 @@ #include -#include "s3c2410.h" #include "devs.h" #include "cpu.h" @@ -104,7 +103,7 @@ void __init smdk2410_init_irq(void) { - s3c2410_init_irq(); + s3c24xx_init_irq(); } MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch @@ -114,7 +113,7 @@ BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) MAPIO(smdk2410_map_io) INITIRQ(smdk2410_init_irq) - .timer = &s3c2410_timer, + .timer = &s3c24xx_timer, MACHINE_END diff -Nru a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c --- a/arch/arm/mach-s3c2410/mach-vr1000.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-s3c2410/mach-vr1000.c 2005-01-13 16:25:56 -08:00 @@ -18,7 +18,8 @@ * 05-Apr-2004 BJD Copied to make mach-vr1000.c * 18-Oct-2004 BJD Updated board struct * 04-Nov-2004 BJD Clock and serial configuration update - * 04-Jan-2004 BJD Updated uart init call + * 04-Jan-2005 BJD Updated uart init call + * 10-Jan-2005 BJD Removed include of s3c2410.h */ #include @@ -43,7 +44,6 @@ //#include #include -#include "s3c2410.h" #include "clock.h" #include "devs.h" #include "cpu.h" @@ -212,7 +212,7 @@ void __init vr1000_init_irq(void) { - s3c2410_init_irq(); + s3c24xx_init_irq(); } MACHINE_START(VR1000, "Thorcom-VR1000") @@ -221,5 +221,5 @@ BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) MAPIO(vr1000_map_io) INITIRQ(vr1000_init_irq) - .timer = &s3c2410_timer, + .timer = &s3c24xx_timer, MACHINE_END diff -Nru a/arch/arm/mach-s3c2410/s3c2410.h b/arch/arm/mach-s3c2410/s3c2410.h --- a/arch/arm/mach-s3c2410/s3c2410.h 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-s3c2410/s3c2410.h 2005-01-13 16:25:56 -08:00 @@ -1,7 +1,7 @@ /* arch/arm/mach-s3c2410/s3c2410.h * * Copyright (c) 2004 Simtec Electronics - * Ben Dooks + * Ben Dooks * * Header file for s3c2410 machine directory * @@ -15,13 +15,19 @@ * 04-Sep-2004 BJD Added s3c2410_init_uarts() call * 17-Oct-2004 BJD Moved board out to cpu * 04-Jan-2005 BJD Changed uart init + * 10-Jan-2005 BJD Removed timer to cpu.h, moved 2410 specific bits here */ -extern void s3c2410_map_io(struct map_desc *, int count); +#ifdef CONFIG_CPU_S3C2410 -extern void s3c2410_init_irq(void); +extern int s3c2410_init(void); -struct sys_timer; -extern struct sys_timer s3c2410_timer; +extern void s3c2410_map_io(struct map_desc *mach_desc, int size); +extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); +#else +#define s3c2410_init_uarts NULL +#define s3c2410_map_io NULL +#define s3c2410_init NULL +#endif diff -Nru a/arch/arm/mach-s3c2410/s3c2440-dsc.c b/arch/arm/mach-s3c2410/s3c2440-dsc.c --- a/arch/arm/mach-s3c2410/s3c2440-dsc.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-s3c2410/s3c2440-dsc.c 2005-01-13 16:25:56 -08:00 @@ -1,6 +1,6 @@ /* linux/arch/arm/mach-s3c2410/s3c2440-dsc.c * - * Copyright (c) 2004 Simtec Electronics + * Copyright (c) 2004-2005 Simtec Electronics * Ben Dooks * * Samsung S3C2440 Drive Strength Control support @@ -12,6 +12,7 @@ * Modifications: * 29-Aug-2004 BJD Start of drive-strength control * 09-Nov-2004 BJD Added symbol export + * 11-Jan-2005 BJD Include fix */ #include @@ -31,8 +32,8 @@ #include #include -#include "s3c2440.h" #include "cpu.h" +#include "s3c2440.h" int s3c2440_set_dsc(unsigned int pin, unsigned int value) { diff -Nru a/arch/arm/mach-s3c2410/s3c2440.h b/arch/arm/mach-s3c2410/s3c2440.h --- a/arch/arm/mach-s3c2410/s3c2440.h 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-s3c2410/s3c2440.h 2005-01-13 16:25:56 -08:00 @@ -1,7 +1,7 @@ /* arch/arm/mach-s3c2410/s3c2440.h * - * Copyright (c) 2004 Simtec Electronics - * Ben Dooks + * Copyright (c) 2004-2005 Simtec Electronics + * Ben Dooks * * Header file for s3c2440 cpu support * @@ -12,9 +12,20 @@ * Modifications: * 24-Aug-2004 BJD Start of S3C2440 CPU support * 04-Nov-2004 BJD Added s3c2440_init_uarts() - * 04-Jan-2004 BJD Moved uart init to cpu code + * 04-Jan-2005 BJD Moved uart init to cpu code + * 10-Jan-2005 BJD Moved 2440 specific init here */ -extern void s3c2440_init_irq(void); +#ifdef CONFIG_CPU_S3C2440 -extern void s3c2440_init_time(void); +extern int s3c2440_init(void); + +extern void s3c2440_map_io(struct map_desc *mach_desc, int size); + +extern void s3c2440_init_uarts(struct s3c2410_uartcfg *cfg, int no); + +#else +#define s3c2440_init_uarts NULL +#define s3c2440_map_io NULL +#define s3c2440_init NULL +#endif diff -Nru a/arch/arm/mach-s3c2410/time.c b/arch/arm/mach-s3c2410/time.c --- a/arch/arm/mach-s3c2410/time.c 2005-01-13 16:25:56 -08:00 +++ b/arch/arm/mach-s3c2410/time.c 2005-01-13 16:25:56 -08:00 @@ -232,7 +232,7 @@ setup_irq(IRQ_TIMER4, &s3c2410_timer_irq); } -struct sys_timer s3c2410_timer = { +struct sys_timer s3c24xx_timer = { .init = s3c2410_timer_init, .offset = s3c2410_gettimeoffset, .resume = s3c2410_timer_setup diff -Nru a/arch/ia64/Kconfig b/arch/ia64/Kconfig --- a/arch/ia64/Kconfig 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/Kconfig 2005-01-13 16:25:56 -08:00 @@ -61,11 +61,12 @@ will run on any supported IA-64 system. However, if you configure a kernel for your specific system, it will be faster and smaller. - generic For any supported IA-64 system - DIG-compliant For DIG ("Developer's Interface Guide") compliant systems - HP-zx1/sx1000 For HP systems - SGI-SN2 For SGI Altix systems - Ski-simulator For the HP simulator + generic For any supported IA-64 system + DIG-compliant For DIG ("Developer's Interface Guide") compliant systems + HP-zx1/sx1000 For HP systems + HP-zx1/sx1000+swiotlb For HP systems with (broken) DMA-constrained devices. + SGI-SN2 For SGI Altix systems + Ski-simulator For the HP simulator If you don't know what to do, choose "generic". @@ -78,6 +79,15 @@ Build a kernel that runs on HP zx1 and sx1000 systems. This adds support for the HP I/O MMU. +config IA64_HP_ZX1_SWIOTLB + bool "HP-zx1/sx1000 with software I/O TLB" + help + Build a kernel that runs on HP zx1 and sx1000 systems even when they + have broken PCI devices which cannot DMA to full 32 bits. Apart + from support for the HP I/O MMU, this includes support for the software + I/O TLB, which allows supporting the broken devices at the expense of + wasting some kernel memory (about 2MB by default). + config IA64_SGI_SN2 bool "SGI-SN2" help @@ -188,7 +198,7 @@ config DISCONTIGMEM bool "Discontiguous memory support" - depends on (IA64_DIG || IA64_SGI_SN2 || IA64_GENERIC || IA64_HP_ZX1) && NUMA && VIRTUAL_MEM_MAP + depends on (IA64_DIG || IA64_SGI_SN2 || IA64_GENERIC || IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB) && NUMA && VIRTUAL_MEM_MAP default y if (IA64_SGI_SN2 || IA64_GENERIC) && NUMA help Say Y to support efficient handling of discontiguous physical memory, @@ -326,7 +336,7 @@ config PM bool "Power Management support" - depends on IA64_GENERIC || IA64_DIG || IA64_HP_ZX1 + depends on IA64_GENERIC || IA64_DIG || IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB default y help "Power Management" means that parts of your computer are shut diff -Nru a/arch/ia64/Kconfig.debug b/arch/ia64/Kconfig.debug --- a/arch/ia64/Kconfig.debug 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/Kconfig.debug 2005-01-13 16:25:56 -08:00 @@ -16,7 +16,7 @@ config IA64_GRANULE_64MB bool "64MB" - depends on !(IA64_GENERIC || IA64_HP_ZX1 || IA64_SGI_SN2) + depends on !(IA64_GENERIC || IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB || IA64_SGI_SN2) endchoice diff -Nru a/arch/ia64/Makefile b/arch/ia64/Makefile --- a/arch/ia64/Makefile 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/Makefile 2005-01-13 16:25:56 -08:00 @@ -57,11 +57,13 @@ core-$(CONFIG_IA64_DIG) += arch/ia64/dig/ core-$(CONFIG_IA64_GENERIC) += arch/ia64/dig/ core-$(CONFIG_IA64_HP_ZX1) += arch/ia64/dig/ +core-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/dig/ core-$(CONFIG_IA64_SGI_SN2) += arch/ia64/sn/ drivers-$(CONFIG_PCI) += arch/ia64/pci/ drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/ drivers-$(CONFIG_IA64_HP_ZX1) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ +drivers-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ arch/ia64/sn/ drivers-$(CONFIG_OPROFILE) += arch/ia64/oprofile/ diff -Nru a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig --- a/arch/ia64/configs/sn2_defconfig 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/configs/sn2_defconfig 2005-01-13 16:25:56 -08:00 @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.10-rc1 -# Mon Nov 1 14:35:44 2004 +# Linux kernel version: 2.6.10 +# Mon Jan 10 13:57:35 2005 # # @@ -58,6 +58,7 @@ CONFIG_64BIT=y CONFIG_MMU=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_TIME_INTERPOLATION=y CONFIG_EFI=y CONFIG_GENERIC_IOMAP=y @@ -75,6 +76,7 @@ CONFIG_IA64_L1_CACHE_SHIFT=7 CONFIG_NUMA=y CONFIG_VIRTUAL_MEM_MAP=y +CONFIG_HOLES_IN_ZONE=y CONFIG_DISCONTIGMEM=y # CONFIG_IA64_CYCLONE is not set CONFIG_IOSAPIC=y @@ -90,6 +92,7 @@ CONFIG_IA64_MCA_RECOVERY=y CONFIG_PERFMON=y CONFIG_IA64_PALINFO=y +CONFIG_ACPI_DEALLOCATE_IRQ=y # # Firmware Drivers @@ -110,6 +113,7 @@ CONFIG_ACPI_BOOT=y CONFIG_ACPI_INTERPRETER=y # CONFIG_ACPI_BUTTON is not set +CONFIG_ACPI_VIDEO=m # CONFIG_ACPI_FAN is not set # CONFIG_ACPI_PROCESSOR is not set CONFIG_ACPI_NUMA=y @@ -119,6 +123,7 @@ CONFIG_ACPI_POWER=y CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y +# CONFIG_ACPI_CONTAINER is not set # # Bus options (PCI, PCMCIA) @@ -174,6 +179,7 @@ # # Plug and Play support # +# CONFIG_PNP is not set # # Block devices @@ -188,6 +194,7 @@ # CONFIG_BLK_DEV_SX8 is not set # 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_INITRD=y CONFIG_INITRAMFS_SOURCE="" @@ -200,6 +207,7 @@ CONFIG_IOSCHED_AS=y CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y +CONFIG_ATA_OVER_ETH=m # # ATA/ATAPI/MFM/RLL support @@ -287,6 +295,7 @@ # CONFIG_SCSI_SPI_ATTRS=y CONFIG_SCSI_FC_ATTRS=y +# CONFIG_SCSI_ISCSI_ATTRS is not set # # SCSI low-level drivers @@ -333,7 +342,6 @@ CONFIG_SCSI_QLA2300=y CONFIG_SCSI_QLA2322=y # CONFIG_SCSI_QLA6312 is not set -# CONFIG_SCSI_QLA6322 is not set # CONFIG_SCSI_DC395x is not set # CONFIG_SCSI_DC390T is not set # CONFIG_SCSI_DEBUG is not set @@ -350,6 +358,7 @@ CONFIG_MD_RAID5=y # CONFIG_MD_RAID6 is not set CONFIG_MD_MULTIPATH=y +# CONFIG_MD_FAULTY is not set CONFIG_BLK_DEV_DM=y CONFIG_DM_CRYPT=m CONFIG_DM_SNAPSHOT=m @@ -399,6 +408,8 @@ # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set # CONFIG_INET_TUNNEL is not set +CONFIG_IP_TCPDIAG=y +# CONFIG_IP_TCPDIAG_IPV6 is not set CONFIG_IPV6=m # CONFIG_IPV6_PRIVACY is not set # CONFIG_INET6_AH is not set @@ -478,6 +489,7 @@ # CONFIG_IXGB is not set CONFIG_S2IO=m # CONFIG_S2IO_NAPI is not set +# CONFIG_2BUFF_MODE is not set # # Token Ring devices @@ -554,6 +566,8 @@ CONFIG_SERIAL_NONSTANDARD=y # CONFIG_ROCKETPORT is not set # CONFIG_CYCLADES is not set +# CONFIG_MOXA_SMARTIO is not set +# CONFIG_ISI is not set # CONFIG_SYNCLINK is not set # CONFIG_SYNCLINKMP is not set # CONFIG_N_HDLC is not set @@ -664,6 +678,7 @@ # CONFIG_USB_EHCI_ROOT_HUB_TT is not set CONFIG_USB_OHCI_HCD=m CONFIG_USB_UHCI_HCD=m +# CONFIG_USB_SL811_HCD is not set # # USB Device Class drivers @@ -671,6 +686,10 @@ # CONFIG_USB_BLUETOOTH_TTY is not set # CONFIG_USB_ACM is not set # CONFIG_USB_PRINTER is not set + +# +# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information +# # CONFIG_USB_STORAGE is not set # @@ -700,7 +719,6 @@ # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USB_HPUSBSCSI is not set # # USB Multimedia devices @@ -712,7 +730,7 @@ # # -# USB Network adaptors +# USB Network Adapters # # CONFIG_USB_CATC is not set # CONFIG_USB_KAWETH is not set @@ -734,7 +752,6 @@ # # CONFIG_USB_EMI62 is not set # CONFIG_USB_EMI26 is not set -# CONFIG_USB_TIGL is not set # CONFIG_USB_AUERSWALD is not set # CONFIG_USB_RIO500 is not set # CONFIG_USB_LEGOTOWER is not set @@ -754,6 +771,20 @@ # CONFIG_USB_GADGET is not set # +# MMC/SD Card support +# +# CONFIG_MMC is not set + +# +# InfiniBand support +# +CONFIG_INFINIBAND=m +CONFIG_INFINIBAND_MTHCA=m +# CONFIG_INFINIBAND_MTHCA_DEBUG is not set +CONFIG_INFINIBAND_IPOIB=m +# CONFIG_INFINIBAND_IPOIB_DEBUG is not set + +# # File systems # CONFIG_EXT2_FS=y @@ -864,7 +895,7 @@ CONFIG_CIFS=m # CONFIG_CIFS_STATS is not set # CONFIG_CIFS_XATTR is not set -# CONFIG_CIFS_POSIX 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 @@ -958,6 +989,7 @@ # CONFIG_DEBUG_SPINLOCK_SLEEP is not set # CONFIG_DEBUG_KOBJECT is not set CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_FS is not set CONFIG_IA64_GRANULE_16MB=y # CONFIG_IA64_GRANULE_64MB is not set # CONFIG_IA64_PRINT_HAZARDS is not set @@ -994,7 +1026,12 @@ # 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=m # CONFIG_CRYPTO_MICHAEL_MIC is not set # CONFIG_CRYPTO_CRC32C is not set # CONFIG_CRYPTO_TEST is not set + +# +# Hardware crypto devices +# diff -Nru a/arch/ia64/defconfig b/arch/ia64/defconfig --- a/arch/ia64/defconfig 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/defconfig 2005-01-13 16:25:56 -08:00 @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.10-rc1 -# Tue Nov 2 11:47:56 2004 +# Linux kernel version: 2.6.10 +# Thu Jan 6 11:13:13 2005 # # @@ -59,6 +59,7 @@ CONFIG_64BIT=y CONFIG_MMU=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_TIME_INTERPOLATION=y CONFIG_EFI=y CONFIG_GENERIC_IOMAP=y @@ -90,6 +91,7 @@ CONFIG_IA64_MCA_RECOVERY=y CONFIG_PERFMON=y CONFIG_IA64_PALINFO=y +CONFIG_ACPI_DEALLOCATE_IRQ=y # # Firmware Drivers @@ -111,8 +113,10 @@ CONFIG_ACPI_BOOT=y CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_BUTTON=m +CONFIG_ACPI_VIDEO=m CONFIG_ACPI_FAN=m CONFIG_ACPI_PROCESSOR=m +CONFIG_ACPI_HOTPLUG_CPU=y CONFIG_ACPI_THERMAL=m CONFIG_ACPI_NUMA=y CONFIG_ACPI_BLACKLIST_YEAR=0 @@ -121,6 +125,7 @@ CONFIG_ACPI_POWER=y CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y +CONFIG_ACPI_CONTAINER=m # # Bus options (PCI, PCMCIA) @@ -176,6 +181,7 @@ # # Plug and Play support # +# CONFIG_PNP is not set # # Block devices @@ -189,8 +195,10 @@ CONFIG_BLK_DEV_NBD=m # CONFIG_BLK_DEV_SX8 is not set # CONFIG_BLK_DEV_UB is not set -CONFIG_BLK_DEV_RAM=m +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE="" # CONFIG_CDROM_PKTCDVD is not set @@ -288,6 +296,7 @@ # CONFIG_SCSI_SPI_ATTRS=y CONFIG_SCSI_FC_ATTRS=y +# CONFIG_SCSI_ISCSI_ATTRS is not set # # SCSI low-level drivers @@ -328,7 +337,6 @@ CONFIG_SCSI_QLA2300=m CONFIG_SCSI_QLA2322=m # CONFIG_SCSI_QLA6312 is not set -# CONFIG_SCSI_QLA6322 is not set # CONFIG_SCSI_DC395x is not set # CONFIG_SCSI_DC390T is not set # CONFIG_SCSI_DEBUG is not set @@ -345,6 +353,7 @@ CONFIG_MD_RAID5=m CONFIG_MD_RAID6=m CONFIG_MD_MULTIPATH=m +# CONFIG_MD_FAULTY is not set CONFIG_BLK_DEV_DM=m CONFIG_DM_CRYPT=m CONFIG_DM_SNAPSHOT=m @@ -395,6 +404,7 @@ # CONFIG_INET_IPCOMP is not set # CONFIG_INET_TUNNEL is not set CONFIG_IP_TCPDIAG=y +# CONFIG_IP_TCPDIAG_IPV6 is not set # CONFIG_IPV6 is not set # CONFIG_NETFILTER is not set @@ -573,6 +583,7 @@ # CONFIG_SERIO_SERPORT is not set # CONFIG_SERIO_CT82C710 is not set # CONFIG_SERIO_PCIPS2 is not set +CONFIG_SERIO_LIBPS2=y # CONFIG_SERIO_RAW is not set # @@ -601,6 +612,7 @@ CONFIG_SERIAL_NONSTANDARD=y # CONFIG_ROCKETPORT is not set # CONFIG_CYCLADES is not set +# CONFIG_MOXA_SMARTIO is not set # CONFIG_SYNCLINK is not set # CONFIG_SYNCLINKMP is not set # CONFIG_N_HDLC is not set @@ -651,7 +663,7 @@ CONFIG_AGP=m CONFIG_AGP_I460=m CONFIG_AGP_HP_ZX1=m -CONFIG_DRM=y +CONFIG_DRM=m CONFIG_DRM_TDFX=m CONFIG_DRM_R128=m CONFIG_DRM_RADEON=m @@ -810,6 +822,7 @@ # CONFIG_USB_EHCI_ROOT_HUB_TT is not set CONFIG_USB_OHCI_HCD=m CONFIG_USB_UHCI_HCD=m +# CONFIG_USB_SL811_HCD is not set # # USB Device Class drivers @@ -819,6 +832,10 @@ # CONFIG_USB_MIDI is not set # CONFIG_USB_ACM is not set # CONFIG_USB_PRINTER is not set + +# +# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information +# CONFIG_USB_STORAGE=m # CONFIG_USB_STORAGE_DEBUG is not set # CONFIG_USB_STORAGE_RW_DETECT is not set @@ -858,7 +875,6 @@ # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USB_HPUSBSCSI is not set # # USB Multimedia devices @@ -870,7 +886,7 @@ # # -# USB Network adaptors +# USB Network Adapters # # CONFIG_USB_CATC is not set # CONFIG_USB_KAWETH is not set @@ -913,6 +929,20 @@ # CONFIG_USB_GADGET is not set # +# MMC/SD Card support +# +# CONFIG_MMC is not set + +# +# InfiniBand support +# +CONFIG_INFINIBAND=m +CONFIG_INFINIBAND_MTHCA=m +# CONFIG_INFINIBAND_MTHCA_DEBUG is not set +CONFIG_INFINIBAND_IPOIB=m +# CONFIG_INFINIBAND_IPOIB_DEBUG is not set + +# # File systems # CONFIG_EXT2_FS=y @@ -1023,7 +1053,7 @@ CONFIG_CIFS=m # CONFIG_CIFS_STATS is not set # CONFIG_CIFS_XATTR is not set -# CONFIG_CIFS_POSIX 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 @@ -1158,7 +1188,12 @@ # 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 + +# +# Hardware crypto devices +# diff -Nru a/arch/ia64/hp/common/Makefile b/arch/ia64/hp/common/Makefile --- a/arch/ia64/hp/common/Makefile 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/hp/common/Makefile 2005-01-13 16:25:56 -08:00 @@ -6,3 +6,5 @@ # obj-y := sba_iommu.o +obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += hwsw_iommu.o +obj-$(CONFIG_IA64_GENERIC) += hwsw_iommu.o diff -Nru a/arch/ia64/hp/common/hwsw_iommu.c b/arch/ia64/hp/common/hwsw_iommu.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/ia64/hp/common/hwsw_iommu.c 2005-01-13 16:25:56 -08:00 @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. + * Contributed by David Mosberger-Tang + * + * This is a pseudo I/O MMU which dispatches to the hardware I/O MMU + * whenever possible. We assume that the hardware I/O MMU requires + * full 32-bit addressability, as is the case, e.g., for HP zx1-based + * systems (there, the I/O MMU window is mapped at 3-4GB). If a + * device doesn't provide full 32-bit addressability, we fall back on + * the sw I/O TLB. This is good enough to let us support broken + * hardware such as soundcards which have a DMA engine that can + * address only 28 bits. + */ + +#include + +#include + +/* swiotlb declarations & definitions: */ +extern void swiotlb_init_with_default_size (size_t size); +extern ia64_mv_dma_alloc_coherent swiotlb_alloc_coherent; +extern ia64_mv_dma_free_coherent swiotlb_free_coherent; +extern ia64_mv_dma_map_single swiotlb_map_single; +extern ia64_mv_dma_unmap_single swiotlb_unmap_single; +extern ia64_mv_dma_map_sg swiotlb_map_sg; +extern ia64_mv_dma_unmap_sg swiotlb_unmap_sg; +extern ia64_mv_dma_supported swiotlb_dma_supported; +extern ia64_mv_dma_mapping_error swiotlb_dma_mapping_error; + +/* hwiommu declarations & definitions: */ + +extern ia64_mv_dma_alloc_coherent sba_alloc_coherent; +extern ia64_mv_dma_free_coherent sba_free_coherent; +extern ia64_mv_dma_map_single sba_map_single; +extern ia64_mv_dma_unmap_single sba_unmap_single; +extern ia64_mv_dma_map_sg sba_map_sg; +extern ia64_mv_dma_unmap_sg sba_unmap_sg; +extern ia64_mv_dma_supported sba_dma_supported; +extern ia64_mv_dma_mapping_error sba_dma_mapping_error; + +#define hwiommu_alloc_coherent sba_alloc_coherent +#define hwiommu_free_coherent sba_free_coherent +#define hwiommu_map_single sba_map_single +#define hwiommu_unmap_single sba_unmap_single +#define hwiommu_map_sg sba_map_sg +#define hwiommu_unmap_sg sba_unmap_sg +#define hwiommu_dma_supported sba_dma_supported +#define hwiommu_dma_mapping_error sba_dma_mapping_error +#define hwiommu_sync_single_for_cpu machvec_dma_sync_single +#define hwiommu_sync_sg_for_cpu machvec_dma_sync_sg +#define hwiommu_sync_single_for_device machvec_dma_sync_single +#define hwiommu_sync_sg_for_device machvec_dma_sync_sg + + +/* + * Note: we need to make the determination of whether or not to use + * the sw I/O TLB based purely on the device structure. Anything else + * would be unreliable or would be too intrusive. + */ +static inline int +use_swiotlb (struct device *dev) +{ + return dev && dev->dma_mask && !hwiommu_dma_supported(dev, *dev->dma_mask); +} + +void +hwsw_init (void) +{ + /* default to a smallish 2MB sw I/O TLB */ + swiotlb_init_with_default_size (2 * (1<<20)); +} + +void * +hwsw_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, int flags) +{ + if (use_swiotlb(dev)) + return swiotlb_alloc_coherent(dev, size, dma_handle, flags); + else + return hwiommu_alloc_coherent(dev, size, dma_handle, flags); +} + +void +hwsw_free_coherent (struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle) +{ + if (use_swiotlb(dev)) + swiotlb_free_coherent(dev, size, vaddr, dma_handle); + else + hwiommu_free_coherent(dev, size, vaddr, dma_handle); +} + +dma_addr_t +hwsw_map_single (struct device *dev, void *addr, size_t size, int dir) +{ + if (use_swiotlb(dev)) + return swiotlb_map_single(dev, addr, size, dir); + else + return hwiommu_map_single(dev, addr, size, dir); +} + +void +hwsw_unmap_single (struct device *dev, dma_addr_t iova, size_t size, int dir) +{ + if (use_swiotlb(dev)) + return swiotlb_unmap_single(dev, iova, size, dir); + else + return hwiommu_unmap_single(dev, iova, size, dir); +} + + +int +hwsw_map_sg (struct device *dev, struct scatterlist *sglist, int nents, int dir) +{ + if (use_swiotlb(dev)) + return swiotlb_map_sg(dev, sglist, nents, dir); + else + return hwiommu_map_sg(dev, sglist, nents, dir); +} + +void +hwsw_unmap_sg (struct device *dev, struct scatterlist *sglist, int nents, int dir) +{ + if (use_swiotlb(dev)) + return swiotlb_unmap_sg(dev, sglist, nents, dir); + else + return hwiommu_unmap_sg(dev, sglist, nents, dir); +} + +void +hwsw_sync_single_for_cpu (struct device *dev, dma_addr_t addr, size_t size, int dir) +{ + if (use_swiotlb(dev)) + swiotlb_sync_single_for_cpu(dev, addr, size, dir); + else + hwiommu_sync_single_for_cpu(dev, addr, size, dir); +} + +void +hwsw_sync_sg_for_cpu (struct device *dev, struct scatterlist *sg, int nelems, int dir) +{ + if (use_swiotlb(dev)) + swiotlb_sync_sg_for_cpu(dev, sg, nelems, dir); + else + hwiommu_sync_sg_for_cpu(dev, sg, nelems, dir); +} + +void +hwsw_sync_single_for_device (struct device *dev, dma_addr_t addr, size_t size, int dir) +{ + if (use_swiotlb(dev)) + swiotlb_sync_single_for_device(dev, addr, size, dir); + else + hwiommu_sync_single_for_device(dev, addr, size, dir); +} + +void +hwsw_sync_sg_for_device (struct device *dev, struct scatterlist *sg, int nelems, int dir) +{ + if (use_swiotlb(dev)) + swiotlb_sync_sg_for_device(dev, sg, nelems, dir); + else + hwiommu_sync_sg_for_device(dev, sg, nelems, dir); +} + +int +hwsw_dma_supported (struct device *dev, u64 mask) +{ + if (hwiommu_dma_supported(dev, mask)) + return 1; + return swiotlb_dma_supported(dev, mask); +} + +int +hwsw_dma_mapping_error (dma_addr_t dma_addr) +{ + return hwiommu_dma_mapping_error (dma_addr) || swiotlb_dma_mapping_error(dma_addr); +} + +EXPORT_SYMBOL(hwsw_dma_mapping_error); +EXPORT_SYMBOL(hwsw_map_single); +EXPORT_SYMBOL(hwsw_unmap_single); +EXPORT_SYMBOL(hwsw_map_sg); +EXPORT_SYMBOL(hwsw_unmap_sg); +EXPORT_SYMBOL(hwsw_dma_supported); +EXPORT_SYMBOL(hwsw_alloc_coherent); +EXPORT_SYMBOL(hwsw_free_coherent); diff -Nru a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c --- a/arch/ia64/hp/common/sba_iommu.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/hp/common/sba_iommu.c 2005-01-13 16:25:56 -08:00 @@ -1557,7 +1557,7 @@ ** We program the next pdir index after we stop w/ a key for ** the GART code to handshake on. */ - while ((device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, device)) != NULL) + for_each_pci_dev(device) agp_found |= pci_find_capability(device, PCI_CAP_ID_AGP); if (agp_found && reserve_sba_gart) { diff -Nru a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c --- a/arch/ia64/hp/sim/simeth.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/hp/sim/simeth.c 2005-01-13 16:25:56 -08:00 @@ -286,7 +286,7 @@ static int simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr) { - struct net_device *dev = (struct net_device *)ptr; + struct net_device *dev = ptr; struct simeth_local *local; struct in_device *in_dev; struct in_ifaddr **ifap = NULL; @@ -382,7 +382,7 @@ static int simeth_tx(struct sk_buff *skb, struct net_device *dev) { - struct simeth_local *local = (struct simeth_local *)dev->priv; + struct simeth_local *local = dev->priv; #if 0 /* ensure we have at least ETH_ZLEN bytes (min frame size) */ @@ -446,7 +446,7 @@ int len; int rcv_count = SIMETH_RECV_MAX; - local = (struct simeth_local *)dev->priv; + local = dev->priv; /* * the loop concept has been borrowed from other drivers * looks to me like it's a throttling thing to avoid pushing to many @@ -515,7 +515,7 @@ static struct net_device_stats * simeth_get_stats(struct net_device *dev) { - struct simeth_local *local = (struct simeth_local *) dev->priv; + struct simeth_local *local = dev->priv; return &local->stats; } diff -Nru a/arch/ia64/hp/zx1/Makefile b/arch/ia64/hp/zx1/Makefile --- a/arch/ia64/hp/zx1/Makefile 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/hp/zx1/Makefile 2005-01-13 16:25:56 -08:00 @@ -5,4 +5,4 @@ # Copyright (C) Alex Williamson (alex_williamson@hp.com) # -obj-$(CONFIG_IA64_GENERIC) += hpzx1_machvec.o +obj-$(CONFIG_IA64_GENERIC) += hpzx1_machvec.o hpzx1_swiotlb_machvec.o diff -Nru a/arch/ia64/hp/zx1/hpzx1_swiotlb_machvec.c b/arch/ia64/hp/zx1/hpzx1_swiotlb_machvec.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/arch/ia64/hp/zx1/hpzx1_swiotlb_machvec.c 2005-01-13 16:25:56 -08:00 @@ -0,0 +1,3 @@ +#define MACHVEC_PLATFORM_NAME hpzx1_swiotlb +#define MACHVEC_PLATFORM_HEADER +#include diff -Nru a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c --- a/arch/ia64/ia32/sys_ia32.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/ia32/sys_ia32.c 2005-01-13 16:25:56 -08:00 @@ -1873,6 +1873,10 @@ compat_ptr(data)); break; + case PTRACE_GETEVENTMSG: + ret = put_user(child->ptrace_message, (unsigned int __user *) compat_ptr(data)); + break; + case PTRACE_SYSCALL: /* continue, stop after next syscall */ case PTRACE_CONT: /* restart after signal. */ case PTRACE_KILL: diff -Nru a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile --- a/arch/ia64/kernel/Makefile 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/kernel/Makefile 2005-01-13 16:25:56 -08:00 @@ -12,6 +12,7 @@ obj-$(CONFIG_IA64_BRL_EMU) += brl_emu.o obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o +obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o obj-$(CONFIG_IA64_PALINFO) += palinfo.o obj-$(CONFIG_IOSAPIC) += iosapic.o obj-$(CONFIG_MODULES) += module.o diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c --- a/arch/ia64/kernel/acpi.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/kernel/acpi.c 2005-01-13 16:25:56 -08:00 @@ -113,6 +113,8 @@ return "hpsim"; # elif defined (CONFIG_IA64_HP_ZX1) return "hpzx1"; +# elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB) + return "hpzx1_swiotlb"; # elif defined (CONFIG_IA64_SGI_SN2) return "sn2"; # elif defined (CONFIG_IA64_DIG) diff -Nru a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S --- a/arch/ia64/kernel/head.S 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/kernel/head.S 2005-01-13 16:25:56 -08:00 @@ -65,10 +65,27 @@ ;; /* * Initialize kernel region registers: + * rr[0]: VHPT enabled, page size = PAGE_SHIFT + * rr[1]: VHPT enabled, page size = PAGE_SHIFT + * rr[2]: VHPT enabled, page size = PAGE_SHIFT + * rr[3]: VHPT enabled, page size = PAGE_SHIFT + * rr[4]: VHPT enabled, page size = PAGE_SHIFT * rr[5]: VHPT enabled, page size = PAGE_SHIFT * rr[6]: VHPT disabled, page size = IA64_GRANULE_SHIFT * rr[7]: VHPT disabled, page size = IA64_GRANULE_SHIFT + * We initialize all of them to prevent inadvertently assuming + * something about the state of address translation early in boot. */ + mov r6=((ia64_rid(IA64_REGION_ID_KERNEL, (0<<61)) << 8) | (PAGE_SHIFT << 2) | 1) + movl r7=(0<<61) + mov r8=((ia64_rid(IA64_REGION_ID_KERNEL, (1<<61)) << 8) | (PAGE_SHIFT << 2) | 1) + movl r9=(1<<61) + mov r10=((ia64_rid(IA64_REGION_ID_KERNEL, (2<<61)) << 8) | (PAGE_SHIFT << 2) | 1) + movl r11=(2<<61) + mov r12=((ia64_rid(IA64_REGION_ID_KERNEL, (3<<61)) << 8) | (PAGE_SHIFT << 2) | 1) + movl r13=(3<<61) + mov r14=((ia64_rid(IA64_REGION_ID_KERNEL, (4<<61)) << 8) | (PAGE_SHIFT << 2) | 1) + movl r15=(4<<61) mov r16=((ia64_rid(IA64_REGION_ID_KERNEL, (5<<61)) << 8) | (PAGE_SHIFT << 2) | 1) movl r17=(5<<61) mov r18=((ia64_rid(IA64_REGION_ID_KERNEL, (6<<61)) << 8) | (IA64_GRANULE_SHIFT << 2)) @@ -76,6 +93,11 @@ mov r20=((ia64_rid(IA64_REGION_ID_KERNEL, (7<<61)) << 8) | (IA64_GRANULE_SHIFT << 2)) movl r21=(7<<61) ;; + mov rr[r7]=r6 + mov rr[r9]=r8 + mov rr[r11]=r10 + mov rr[r13]=r12 + mov rr[r15]=r14 mov rr[r17]=r16 mov rr[r19]=r18 mov rr[r21]=r20 diff -Nru a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c --- a/arch/ia64/kernel/mca.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/kernel/mca.c 2005-01-13 16:25:56 -08:00 @@ -1133,6 +1133,7 @@ pal_min_state_area_t *ms; oops_in_progress = 1; /* avoid deadlock in printk, but it makes recovery dodgy */ + console_loglevel = 15; /* make sure printks make it to console */ printk(KERN_INFO "Entered OS INIT handler. PSP=%lx\n", ia64_sal_to_os_handoff_state.proc_state_param); diff -Nru a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c --- a/arch/ia64/kernel/setup.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/kernel/setup.c 2005-01-13 16:25:56 -08:00 @@ -1,7 +1,7 @@ /* * Architecture-specific setup. * - * Copyright (C) 1998-2001, 2003 Hewlett-Packard Co + * Copyright (C) 1998-2001, 2003-2004 Hewlett-Packard Co * David Mosberger-Tang * Stephane Eranian * Copyright (C) 2000, Rohit Seth @@ -312,7 +312,28 @@ io_port_init(); #ifdef CONFIG_IA64_GENERIC - machvec_init(acpi_get_sysname()); + { + const char *mvec_name = strstr (*cmdline_p, "machvec="); + char str[64]; + + if (mvec_name) { + const char *end; + size_t len; + + mvec_name += 8; + end = strchr (mvec_name, ' '); + if (end) + len = end - mvec_name; + else + len = strlen (mvec_name); + len = min(len, sizeof (str) - 1); + strncpy (str, mvec_name, len); + str[len] = '\0'; + mvec_name = str; + } else + mvec_name = acpi_get_sysname(); + machvec_init(mvec_name); + } #endif if (early_console_setup(*cmdline_p) == 0) diff -Nru a/arch/ia64/lib/swiotlb.c b/arch/ia64/lib/swiotlb.c --- a/arch/ia64/lib/swiotlb.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/lib/swiotlb.c 2005-01-13 16:25:56 -08:00 @@ -61,9 +61,8 @@ /* * The number of IO TLB blocks (in groups of 64) betweeen io_tlb_start and * io_tlb_end. This is command line adjustable via setup_io_tlb_npages. - * Default to 64MB. */ -static unsigned long io_tlb_nslabs = 32768; +static unsigned long io_tlb_nslabs; /* * When the IOMMU overflows we return a fallback buffer. This sets the size. @@ -113,10 +112,15 @@ * structures for the software IO TLB used to implement the PCI DMA API. */ void -swiotlb_init(void) +swiotlb_init_with_default_size (size_t default_size) { unsigned long i; + if (!io_tlb_nslabs) { + io_tlb_nslabs = (default_size >> PAGE_SHIFT); + io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE); + } + /* * Get IO TLB memory from the low pages */ @@ -143,6 +147,12 @@ io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow); printk(KERN_INFO "Placing software IO TLB between 0x%lx - 0x%lx\n", virt_to_phys(io_tlb_start), virt_to_phys(io_tlb_end)); +} + +void +swiotlb_init (void) +{ + swiotlb_init_with_default_size(64 * (1<<20)); /* default to 64MB */ } static inline int diff -Nru a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c --- a/arch/ia64/pci/pci.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/pci/pci.c 2005-01-13 16:25:56 -08:00 @@ -6,6 +6,7 @@ * Copyright (C) 2002 Hewlett-Packard Co * David Mosberger-Tang * Bjorn Helgaas + * Copyright (C) 2004 Silicon Graphics, Inc. * * Note: Above list of copyright holders is incomplete... */ @@ -131,6 +132,19 @@ .write = pci_write, }; +#ifdef CONFIG_NUMA +extern acpi_status acpi_map_iosapic(acpi_handle, u32, void *, void **); +static void acpi_map_iosapics(void) +{ + acpi_get_devices(NULL, acpi_map_iosapic, NULL, NULL); +} +#else +static void acpi_map_iosapics(void) +{ + return; +} +#endif /* CONFIG_NUMA */ + static int __init pci_acpi_init (void) { @@ -138,11 +152,7 @@ printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n"); -#ifdef CONFIG_NUMA -extern acpi_status acpi_map_iosapic (acpi_handle, u32, void*, void**); - - acpi_get_devices(NULL, acpi_map_iosapic, NULL, NULL); -#endif + acpi_map_iosapics(); if (pci_routeirq) { /* @@ -154,7 +164,7 @@ printk(KERN_INFO "** was specified. If this was required to make a driver work,\n"); printk(KERN_INFO "** please email the output of \"lspci\" to bjorn.helgaas@hp.com\n"); printk(KERN_INFO "** so I can fix the driver.\n"); - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) + for_each_pci_dev(dev) acpi_pci_irq_enable(dev); } else { printk(KERN_INFO "** PCI interrupts are no longer routed automatically. If this\n"); @@ -367,6 +377,7 @@ region->start = res->start - offset; region->end = res->end - offset; } +EXPORT_SYMBOL(pcibios_resource_to_bus); void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region) @@ -526,7 +537,7 @@ * Leave vm_pgoff as-is, the PCI space address is the physical * address on this platform. */ - vma->vm_flags |= (VM_SHM | VM_LOCKED | VM_IO); + vma->vm_flags |= (VM_SHM | VM_RESERVED | VM_IO); if (write_combine) vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); @@ -538,6 +549,117 @@ return -EAGAIN; return 0; +} + +/** + * ia64_pci_get_legacy_mem - generic legacy mem routine + * @bus: bus to get legacy memory base address for + * + * Find the base of legacy memory for @bus. This is typically the first + * megabyte of bus address space for @bus or is simply 0 on platforms whose + * chipsets support legacy I/O and memory routing. Returns the base address + * or an error pointer if an error occurred. + * + * This is the ia64 generic version of this routine. Other platforms + * are free to override it with a machine vector. + */ +char *ia64_pci_get_legacy_mem(struct pci_bus *bus) +{ + return (char *)__IA64_UNCACHED_OFFSET; +} + +/** + * pci_mmap_legacy_page_range - map legacy memory space to userland + * @bus: bus whose legacy space we're mapping + * @vma: vma passed in by mmap + * + * Map legacy memory space for this device back to userspace using a machine + * vector to get the base address. + */ +int +pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma) +{ + char *addr; + + addr = pci_get_legacy_mem(bus); + if (IS_ERR(addr)) + return PTR_ERR(addr); + + vma->vm_pgoff += (unsigned long)addr >> PAGE_SHIFT; + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + vma->vm_flags |= (VM_SHM | VM_RESERVED | VM_IO); + + if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, + vma->vm_end - vma->vm_start, vma->vm_page_prot)) + return -EAGAIN; + + return 0; +} + +/** + * ia64_pci_legacy_read - read from legacy I/O space + * @bus: bus to read + * @port: legacy port value + * @val: caller allocated storage for returned value + * @size: number of bytes to read + * + * Simply reads @size bytes from @port and puts the result in @val. + * + * Again, this (and the write routine) are generic versions that can be + * overridden by the platform. This is necessary on platforms that don't + * support legacy I/O routing or that hard fail on legacy I/O timeouts. + */ +int ia64_pci_legacy_read(struct pci_bus *bus, u16 port, u32 *val, u8 size) +{ + int ret = size; + + switch (size) { + case 1: + *val = inb(port); + break; + case 2: + *val = inw(port); + break; + case 4: + *val = inl(port); + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + +/** + * ia64_pci_legacy_write - perform a legacy I/O write + * @bus: bus pointer + * @port: port to write + * @val: value to write + * @size: number of bytes to write from @val + * + * Simply writes @size bytes of @val to @port. + */ +int ia64_pci_legacy_write(struct pci_dev *bus, u16 port, u32 val, u8 size) +{ + int ret = 0; + + switch (size) { + case 1: + outb(val, port); + break; + case 2: + outw(val, port); + break; + case 4: + outl(val, port); + break; + default: + ret = -EINVAL; + break; + } + + return ret; } /** diff -Nru a/arch/ia64/sn/kernel/bte_error.c b/arch/ia64/sn/kernel/bte_error.c --- a/arch/ia64/sn/kernel/bte_error.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/sn/kernel/bte_error.c 2005-01-13 16:25:56 -08:00 @@ -47,6 +47,7 @@ ii_icrb0_d_u_t icrbd; /* II CRB Register D */ ii_ibcr_u_t ibcr; ii_icmr_u_t icmr; + ii_ieclr_u_t ieclr; BTE_PRINTK(("bte_error_handler(%p) - %d\n", err_nodepda, smp_processor_id())); @@ -131,6 +132,14 @@ imem.ii_imem_fld_s.i_b0_esd = imem.ii_imem_fld_s.i_b1_esd = 1; REMOTE_HUB_S(nasid, IIO_IMEM, imem.ii_imem_regval); + /* Clear BTE0/1 error bits */ + ieclr.ii_ieclr_regval = 0; + if (err_nodepda->bte_if[0].bh_error != BTE_SUCCESS) + ieclr.ii_ieclr_fld_s.i_e_bte_0 = 1; + if (err_nodepda->bte_if[1].bh_error != BTE_SUCCESS) + ieclr.ii_ieclr_fld_s.i_e_bte_1 = 1; + REMOTE_HUB_S(nasid, IIO_IECLR, ieclr.ii_ieclr_regval); + /* Reinitialize both BTE state machines. */ ibcr.ii_ibcr_regval = REMOTE_HUB_L(nasid, IIO_IBCR); ibcr.ii_ibcr_fld_s.i_soft_reset = 1; @@ -152,7 +161,7 @@ err_nodepda->bte_if[i].cleanup_active = 0; BTE_PRINTK(("eh:%p:%d Unlocked %d\n", err_nodepda, smp_processor_id(), i)); - spin_unlock(&pda->cpu_bte_if[i]->spinlock); + spin_unlock(&err_nodepda->bte_if[i].spinlock); } del_timer(recovery_timer); diff -Nru a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c --- a/arch/ia64/sn/kernel/io_init.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/sn/kernel/io_init.c 2005-01-13 16:25:56 -08:00 @@ -202,7 +202,7 @@ struct pci_dev *host_pci_dev; int status = 0; - SN_PCIDEV_INFO(dev) = kmalloc(sizeof(struct pcidev_info), GFP_KERNEL); + dev->sysdata = kmalloc(sizeof(struct pcidev_info), GFP_KERNEL); if (SN_PCIDEV_INFO(dev) <= 0) BUG(); /* Cannot afford to run out of memory */ memset(SN_PCIDEV_INFO(dev), 0, sizeof(struct pcidev_info)); @@ -310,8 +310,8 @@ * after this point. */ - PCI_CONTROLLER(bus) = controller; - SN_PCIBUS_BUSSOFT(bus) = provider_soft; + bus->sysdata = controller; + PCI_CONTROLLER(bus)->platform_data = provider_soft; nasid = NASID_GET(SN_PCIBUS_BUSSOFT(bus)->bs_base); cnode = nasid_to_cnodeid(nasid); diff -Nru a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c --- a/arch/ia64/sn/kernel/setup.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/sn/kernel/setup.c 2005-01-13 16:25:56 -08:00 @@ -505,15 +505,15 @@ /* Setup ionodes with memory */ for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) { - u64 klgraph_header; + char *klgraph_header; cnodeid_t cnodeid; if (physical_node_map[nasid] == -1) continue; - klgraph_header = cnodeid = -1; - klgraph_header = ia64_sn_get_klconfig_addr(nasid); - if (klgraph_header <= 0) { + cnodeid = -1; + klgraph_header = __va(ia64_sn_get_klconfig_addr(nasid)); + if (!klgraph_header) { if (IS_RUNNING_ON_SIMULATOR()) continue; BUG(); /* All nodes must have klconfig tables! */ diff -Nru a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c --- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c 2005-01-13 16:25:56 -08:00 @@ -530,8 +530,7 @@ } error: - if (p) - vfree(p); + vfree(p); lock_kernel(); return r; @@ -642,7 +641,6 @@ { struct seq_file *seq = file->private_data; - if (seq->private) - vfree(seq->private); + vfree(seq->private); return seq_release(inode, file); } diff -Nru a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c --- a/arch/ia64/sn/pci/pci_dma.c 2005-01-13 16:25:56 -08:00 +++ b/arch/ia64/sn/pci/pci_dma.c 2005-01-13 16:25:56 -08:00 @@ -475,3 +475,67 @@ EXPORT_SYMBOL(sn_pci_free_consistent); EXPORT_SYMBOL(sn_pci_dma_supported); EXPORT_SYMBOL(sn_dma_mapping_error); + +char *sn_pci_get_legacy_mem(struct pci_bus *bus) +{ + if (!SN_PCIBUS_BUSSOFT(bus)) + return ERR_PTR(-ENODEV); + + return (char *)(SN_PCIBUS_BUSSOFT(bus)->bs_legacy_mem | __IA64_UNCACHED_OFFSET); +} + +int sn_pci_legacy_read(struct pci_bus *bus, u16 port, u32 *val, u8 size) +{ + unsigned long addr; + int ret; + + if (!SN_PCIBUS_BUSSOFT(bus)) + return -ENODEV; + + addr = SN_PCIBUS_BUSSOFT(bus)->bs_legacy_io | __IA64_UNCACHED_OFFSET; + addr += port; + + ret = ia64_sn_probe_mem(addr, (long)size, (void *)val); + + if (ret == 2) + return -EINVAL; + + if (ret == 1) + *val = -1; + + return size; +} + +int sn_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size) +{ + int ret = size; + unsigned long paddr; + unsigned long *addr; + + if (!SN_PCIBUS_BUSSOFT(bus)) { + ret = -ENODEV; + goto out; + } + + /* Put the phys addr in uncached space */ + paddr = SN_PCIBUS_BUSSOFT(bus)->bs_legacy_io | __IA64_UNCACHED_OFFSET; + paddr += port; + addr = (unsigned long *)paddr; + + switch (size) { + case 1: + *(volatile u8 *)(addr) = (u8)(val); + break; + case 2: + *(volatile u16 *)(addr) = (u16)(val); + break; + case 4: + *(volatile u32 *)(addr) = (u32)(val); + break; + default: + ret = -EINVAL; + break; + } + out: + return ret; +} diff -Nru a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c --- a/arch/mips/kernel/irixelf.c 2005-01-13 16:25:56 -08:00 +++ b/arch/mips/kernel/irixelf.c 2005-01-13 16:25:56 -08:00 @@ -127,7 +127,9 @@ end = PAGE_ALIGN(end); if (end <= start) return; + down_write(¤t->mm->mmap_sem); do_brk(start, end - start); + up_write(¤t->mm->mmap_sem); } @@ -375,7 +377,9 @@ /* Map the last of the bss segment */ if (last_bss > len) { + down_write(¤t->mm->mmap_sem); do_brk(len, (last_bss - len)); + up_write(¤t->mm->mmap_sem); } kfree(elf_phdata); @@ -562,7 +566,9 @@ unsigned long v; struct prda *pp; + down_write(¤t->mm->mmap_sem); v = do_brk (PRDA_ADDRESS, PAGE_SIZE); + up_write(¤t->mm->mmap_sem); if (v < 0) return; @@ -852,8 +858,11 @@ len = (elf_phdata->p_filesz + elf_phdata->p_vaddr+ 0xfff) & 0xfffff000; bss = elf_phdata->p_memsz + elf_phdata->p_vaddr; - if (bss > len) + if (bss > len) { + down_write(¤t->mm->mmap_sem); do_brk(len, bss-len); + up_write(¤t->mm->mmap_sem); + } kfree(elf_phdata); return 0; } diff -Nru a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig --- a/arch/ppc64/Kconfig 2005-01-13 16:25:56 -08:00 +++ b/arch/ppc64/Kconfig 2005-01-13 16:25:56 -08:00 @@ -231,6 +231,17 @@ Say Y here if you are building a kernel for a desktop, embedded or real-time system. Say N if you are unsure. +config PREEMPT_BKL + bool "Preempt The Big Kernel Lock" + depends on PREEMPT + default y + help + This option reduces the latency of the kernel by making the + big kernel lock preemptible. + + Say Y here if you are building a kernel for a desktop system. + Say N if you are unsure. + # # Use the generic interrupt handling code in kernel/irq/: # diff -Nru a/arch/ppc64/kernel/entry.S b/arch/ppc64/kernel/entry.S --- a/arch/ppc64/kernel/entry.S 2005-01-13 16:25:56 -08:00 +++ b/arch/ppc64/kernel/entry.S 2005-01-13 16:25:56 -08:00 @@ -574,25 +574,22 @@ crandc eq,cr1*4+eq,eq bne restore /* here we are preempting the current task */ -1: lis r0,PREEMPT_ACTIVE@h - stw r0,TI_PREEMPT(r9) +1: #ifdef CONFIG_PPC_ISERIES li r0,1 stb r0,PACAPROCENABLED(r13) #endif ori r10,r10,MSR_EE mtmsrd r10,1 /* reenable interrupts */ - bl .schedule + bl .preempt_schedule mfmsr r10 clrrdi r9,r1,THREAD_SHIFT rldicl r10,r10,48,1 /* disable interrupts again */ - li r0,0 rotldi r10,r10,16 mtmsrd r10,1 ld r4,TI_FLAGS(r9) andi. r0,r4,_TIF_NEED_RESCHED bne 1b - stw r0,TI_PREEMPT(r9) b restore user_work: diff -Nru a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c --- a/arch/sparc64/kernel/binfmt_aout32.c 2005-01-13 16:25:56 -08:00 +++ b/arch/sparc64/kernel/binfmt_aout32.c 2005-01-13 16:25:56 -08:00 @@ -49,7 +49,9 @@ end = PAGE_ALIGN(end); if (end <= start) return; + down_write(¤t->mm->mmap_sem); do_brk(start, end - start); + up_write(¤t->mm->mmap_sem); } /* @@ -246,10 +248,14 @@ if (N_MAGIC(ex) == NMAGIC) { loff_t pos = fd_offset; /* Fuck me plenty... */ + down_write(¤t->mm->mmap_sem); error = do_brk(N_TXTADDR(ex), ex.a_text); + up_write(¤t->mm->mmap_sem); bprm->file->f_op->read(bprm->file, (char __user *)N_TXTADDR(ex), ex.a_text, &pos); + down_write(¤t->mm->mmap_sem); error = do_brk(N_DATADDR(ex), ex.a_data); + up_write(¤t->mm->mmap_sem); bprm->file->f_op->read(bprm->file, (char __user *)N_DATADDR(ex), ex.a_data, &pos); goto beyond_if; @@ -257,8 +263,10 @@ if (N_MAGIC(ex) == OMAGIC) { loff_t pos = fd_offset; + down_write(¤t->mm->mmap_sem); do_brk(N_TXTADDR(ex) & PAGE_MASK, ex.a_text+ex.a_data + PAGE_SIZE - 1); + up_write(¤t->mm->mmap_sem); bprm->file->f_op->read(bprm->file, (char __user *)N_TXTADDR(ex), ex.a_text+ex.a_data, &pos); } else { @@ -272,7 +280,9 @@ if (!bprm->file->f_op->mmap) { loff_t pos = fd_offset; + down_write(¤t->mm->mmap_sem); do_brk(0, ex.a_text+ex.a_data); + up_write(¤t->mm->mmap_sem); bprm->file->f_op->read(bprm->file, (char __user *)N_TXTADDR(ex), ex.a_text+ex.a_data, &pos); @@ -389,7 +399,9 @@ len = PAGE_ALIGN(ex.a_text + ex.a_data); bss = ex.a_text + ex.a_data + ex.a_bss; if (bss > len) { + down_write(¤t->mm->mmap_sem); error = do_brk(start_addr + len, bss - len); + up_write(¤t->mm->mmap_sem); retval = error; if (error != start_addr + len) goto out; diff -Nru a/arch/x86_64/ia32/ia32_aout.c b/arch/x86_64/ia32/ia32_aout.c --- a/arch/x86_64/ia32/ia32_aout.c 2005-01-13 16:25:56 -08:00 +++ b/arch/x86_64/ia32/ia32_aout.c 2005-01-13 16:25:56 -08:00 @@ -115,7 +115,9 @@ end = PAGE_ALIGN(end); if (end <= start) return; + down_write(¤t->mm->mmap_sem); do_brk(start, end - start); + up_write(¤t->mm->mmap_sem); } #if CORE_DUMP @@ -325,7 +327,10 @@ pos = 32; map_size = ex.a_text+ex.a_data; + down_write(¤t->mm->mmap_sem); error = do_brk(text_addr & PAGE_MASK, map_size); + up_write(¤t->mm->mmap_sem); + if (error != (text_addr & PAGE_MASK)) { send_sig(SIGKILL, current, 0); return error; @@ -361,7 +366,9 @@ if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { loff_t pos = fd_offset; + down_write(¤t->mm->mmap_sem); do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); + up_write(¤t->mm->mmap_sem); bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex), ex.a_text+ex.a_data, &pos); flush_icache_range((unsigned long) N_TXTADDR(ex), @@ -469,8 +476,9 @@ error_time = jiffies; } #endif - + down_write(¤t->mm->mmap_sem); do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); + up_write(¤t->mm->mmap_sem); file->f_op->read(file, (char *)start_addr, ex.a_text + ex.a_data, &pos); @@ -494,7 +502,9 @@ len = PAGE_ALIGN(ex.a_text + ex.a_data); bss = ex.a_text + ex.a_data + ex.a_bss; if (bss > len) { + down_write(¤t->mm->mmap_sem); error = do_brk(start_addr + len, bss - len); + up_write(¤t->mm->mmap_sem); retval = error; if (error != start_addr + len) goto out; diff -Nru a/arch/x86_64/mm/k8topology.c b/arch/x86_64/mm/k8topology.c --- a/arch/x86_64/mm/k8topology.c 2005-01-13 16:25:56 -08:00 +++ b/arch/x86_64/mm/k8topology.c 2005-01-13 16:25:56 -08:00 @@ -47,6 +47,10 @@ int nodeid, i, nb; int found = 0; u32 reg; + unsigned numnodes; + nodemask_t nodes_parsed; + + nodes_clear(nodes_parsed); nb = find_northbridge(); if (nb < 0) @@ -55,10 +59,9 @@ printk(KERN_INFO "Scanning NUMA topology in Northbridge %d\n", nb); reg = read_pci_config(0, nb, 0, 0x60); - for (i = 0; i <= ((reg >> 4) & 7); i++) - node_set_online(i); + numnodes = ((reg >> 4) & 7) + 1; - printk(KERN_INFO "Number of nodes %d (%x)\n", num_online_nodes(), reg); + printk(KERN_INFO "Number of nodes %d\n", numnodes); memset(&nodes,0,sizeof(nodes)); prevbase = 0; @@ -70,11 +73,11 @@ nodeid = limit & 7; if ((base & 3) == 0) { - if (i < num_online_nodes()) + if (i < numnodes) printk("Skipping disabled node %d\n", i); continue; } - if (nodeid >= num_online_nodes()) { + if (nodeid >= numnodes) { printk("Ignoring excess node %d (%lx:%lx)\n", nodeid, base, limit); continue; @@ -90,7 +93,7 @@ nodeid, (base>>8)&3, (limit>>8) & 3); return -1; } - if (node_online(nodeid)) { + if (node_isset(nodeid, nodes_parsed)) { printk(KERN_INFO "Node %d already present. Skipping\n", nodeid); continue; @@ -138,12 +141,14 @@ nodes[nodeid].end = limit; prevbase = base; + + node_set(nodeid, nodes_parsed); } if (!found) return -1; - memnode_shift = compute_hash_shift(nodes); + memnode_shift = compute_hash_shift(nodes, numnodes); if (memnode_shift < 0) { printk(KERN_ERR "No NUMA node hash function found. Contact maintainer\n"); return -1; @@ -154,8 +159,8 @@ if (nodes[i].start != nodes[i].end) { /* assume 1:1 NODE:CPU */ cpu_to_node[i] = i; - setup_node_bootmem(i, nodes[i].start, nodes[i].end); - } + setup_node_bootmem(i, nodes[i].start, nodes[i].end); + } } numa_init_array(); diff -Nru a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c --- a/arch/x86_64/mm/numa.c 2005-01-13 16:25:56 -08:00 +++ b/arch/x86_64/mm/numa.c 2005-01-13 16:25:56 -08:00 @@ -34,9 +34,7 @@ int numa_off __initdata; -unsigned long nodes_present; - -int __init compute_hash_shift(struct node *nodes) +int __init compute_hash_shift(struct node *nodes, int numnodes) { int i; int shift = 24; @@ -45,7 +43,7 @@ /* When in doubt use brute force. */ while (shift < 48) { memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE); - for_each_online_node(i) { + for (i = 0; i < numnodes; i++) { if (nodes[i].start == nodes[i].end) continue; for (addr = nodes[i].start; @@ -197,7 +195,7 @@ (nodes[i].end - nodes[i].start) >> 20); node_set_online(i); } - memnode_shift = compute_hash_shift(nodes); + memnode_shift = compute_hash_shift(nodes, numa_fake); if (memnode_shift < 0) { memnode_shift = 0; printk(KERN_ERR "No NUMA hash function found. Emulation disabled.\n"); @@ -274,7 +272,7 @@ /* [numa=off] */ __init int numa_setup(char *opt) { - if (!strcmp(opt,"off")) + if (!strncmp(opt,"off",3)) numa_off = 1; #ifdef CONFIG_NUMA_EMU if(!strncmp(opt, "fake=", 5)) { diff -Nru a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c --- a/arch/x86_64/mm/srat.c 2005-01-13 16:25:56 -08:00 +++ b/arch/x86_64/mm/srat.c 2005-01-13 16:25:56 -08:00 @@ -20,17 +20,20 @@ static struct acpi_table_slit *acpi_slit; -static DECLARE_BITMAP(nodes_parsed, MAX_NUMNODES) __initdata; +static nodemask_t nodes_parsed __initdata; +static nodemask_t nodes_found __initdata; static struct node nodes[MAX_NUMNODES] __initdata; static __u8 pxm2node[256] __initdata = { [0 ... 255] = 0xff }; static __init int setup_node(int pxm) { - if (pxm2node[pxm] == 0xff) { - if (num_online_nodes() >= MAX_NUMNODES) + unsigned node = pxm2node[pxm]; + if (node == 0xff) { + if (nodes_weight(nodes_found) >= MAX_NUMNODES) return -1; - pxm2node[pxm] = num_online_nodes(); - node_set_online(num_online_nodes()); + node = first_unset_node(nodes_found); + node_set(node, nodes_found); + pxm2node[pxm] = node; } return pxm2node[pxm]; } @@ -140,7 +143,7 @@ return; } nd = &nodes[node]; - if (!test_and_set_bit(node, &nodes_parsed)) { + if (!node_test_and_set(node, nodes_parsed)) { nd->start = start; nd->end = end; } else { @@ -163,7 +166,7 @@ int i; if (acpi_numa <= 0) return -1; - memnode_shift = compute_hash_shift(nodes); + memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed)); if (memnode_shift < 0) { printk(KERN_ERR "SRAT: No NUMA node hash function found. Contact maintainer\n"); @@ -171,7 +174,7 @@ return -1; } for (i = 0; i < MAX_NUMNODES; i++) { - if (!test_bit(i, &nodes_parsed)) + if (!node_isset(i, nodes_parsed)) continue; cutoff_node(i, start, end); if (nodes[i].start == nodes[i].end) diff -Nru a/drivers/block/Kconfig b/drivers/block/Kconfig --- a/drivers/block/Kconfig 2005-01-13 16:25:56 -08:00 +++ b/drivers/block/Kconfig 2005-01-13 16:25:56 -08:00 @@ -449,7 +449,6 @@ config ATA_OVER_ETH tristate "ATA over Ethernet support" depends on NET - default m help This driver provides Support for ATA over Ethernet block devices like the Coraid EtherDrive (R) Storage Blade. diff -Nru a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c --- a/drivers/block/cfq-iosched.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/block/cfq-iosched.c 2005-01-13 16:25:56 -08:00 @@ -622,8 +622,10 @@ cfq_sort_rr_list(cfqq, 0); } - crq->accounted = 0; - cfqq->cfqd->rq_in_driver--; + if (crq->accounted) { + crq->accounted = 0; + cfqq->cfqd->rq_in_driver--; + } } list_add(&rq->queuelist, &q->queue_head); } diff -Nru a/drivers/block/elevator.c b/drivers/block/elevator.c --- a/drivers/block/elevator.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/block/elevator.c 2005-01-13 16:25:56 -08:00 @@ -170,8 +170,6 @@ #else #error "You must build at least 1 IO scheduler into the kernel" #endif - printk(KERN_INFO "elevator: using %s as default io scheduler\n", - chosen_elevator); } static int __init elevator_setup(char *str) @@ -515,7 +513,10 @@ list_add_tail(&e->list, &elv_list); spin_unlock_irq(&elv_list_lock); - printk(KERN_INFO "io scheduler %s registered\n", e->elevator_name); + printk(KERN_INFO "io scheduler %s registered", e->elevator_name); + if (!strcmp(e->elevator_name, chosen_elevator)) + printk(" (default)"); + printk("\n"); return 0; } EXPORT_SYMBOL_GPL(elv_register); diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c --- a/drivers/block/ll_rw_blk.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/block/ll_rw_blk.c 2005-01-13 16:25:56 -08:00 @@ -1438,6 +1438,7 @@ struct request_list *rl = &q->rq; rl->count[READ] = rl->count[WRITE] = 0; + rl->starved[READ] = rl->starved[WRITE] = 0; init_waitqueue_head(&rl->wait[READ]); init_waitqueue_head(&rl->wait[WRITE]); init_waitqueue_head(&rl->drain); @@ -1618,6 +1619,22 @@ ioc->last_waited = jiffies; } +static void __freed_request(request_queue_t *q, int rw) +{ + struct request_list *rl = &q->rq; + + if (rl->count[rw] < queue_congestion_off_threshold(q)) + clear_queue_congested(q, rw); + + if (rl->count[rw] + 1 <= q->nr_requests) { + smp_mb(); + if (waitqueue_active(&rl->wait[rw])) + wake_up(&rl->wait[rw]); + + blk_clear_queue_full(q, rw); + } +} + /* * A request has just been released. Account for it, update the full and * congestion status, wake up any waiters. Called under q->queue_lock. @@ -1627,17 +1644,17 @@ struct request_list *rl = &q->rq; rl->count[rw]--; - if (rl->count[rw] < queue_congestion_off_threshold(q)) - clear_queue_congested(q, rw); - if (rl->count[rw]+1 <= q->nr_requests) { + + __freed_request(q, rw); + + if (unlikely(rl->starved[rw ^ 1])) + __freed_request(q, rw ^ 1); + + if (!rl->count[READ] && !rl->count[WRITE]) { smp_mb(); - if (waitqueue_active(&rl->wait[rw])) - wake_up(&rl->wait[rw]); - blk_clear_queue_full(q, rw); + if (unlikely(waitqueue_active(&rl->drain))) + wake_up(&rl->drain); } - if (unlikely(waitqueue_active(&rl->drain)) && - !rl->count[READ] && !rl->count[WRITE]) - wake_up(&rl->drain); } #define blkdev_free_rq(list) list_entry((list)->next, struct request, queuelist) @@ -1669,8 +1686,7 @@ switch (elv_may_queue(q, rw)) { case ELV_MQUEUE_NO: - spin_unlock_irq(q->queue_lock); - goto out; + goto rq_starved; case ELV_MQUEUE_MAY: break; case ELV_MQUEUE_MUST: @@ -1688,6 +1704,7 @@ get_rq: rl->count[rw]++; + rl->starved[rw] = 0; if (rl->count[rw] >= queue_congestion_on_threshold(q)) set_queue_congested(q, rw); spin_unlock_irq(q->queue_lock); @@ -1703,6 +1720,18 @@ */ spin_lock_irq(q->queue_lock); freed_request(q, rw); + + /* + * in the very unlikely event that allocation failed and no + * requests for this direction was pending, mark us starved + * so that freeing of a request in the other direction will + * notice us. another possible fix would be to split the + * rq mempool into READ and WRITE + */ +rq_starved: + if (unlikely(rl->count[rw] == 0)) + rl->starved[rw] = 1; + spin_unlock_irq(q->queue_lock); goto out; } diff -Nru a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c --- a/drivers/block/scsi_ioctl.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/block/scsi_ioctl.c 2005-01-13 16:25:56 -08:00 @@ -339,7 +339,8 @@ struct gendisk *bd_disk, Scsi_Ioctl_Command __user *sic) { struct request *rq; - int err, in_len, out_len, bytes, opcode, cmdlen; + int err; + unsigned int in_len, out_len, bytes, opcode, cmdlen; char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE]; /* diff -Nru a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig --- a/drivers/char/agp/Kconfig 2005-01-13 16:25:56 -08:00 +++ b/drivers/char/agp/Kconfig 2005-01-13 16:25:56 -08:00 @@ -144,7 +144,7 @@ config AGP_HP_ZX1 tristate "HP ZX1 chipset AGP support" - depends on AGP && (IA64_HP_ZX1 || IA64_GENERIC) + depends on AGP && (IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB || IA64_GENERIC) help This option gives you AGP GART support for the HP ZX1 chipset for IA64 processors. diff -Nru a/drivers/net/3c515.c b/drivers/net/3c515.c --- a/drivers/net/3c515.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/3c515.c 2005-01-13 16:25:56 -08:00 @@ -34,7 +34,7 @@ /* "Knobs" that adjust features and parameters. */ /* Set the copy breakpoint for the copy-only-tiny-frames scheme. Setting to > 1512 effectively disables this feature. */ -static const int rx_copybreak = 200; +static int rx_copybreak = 200; /* Allow setting MTU to a larger size, bypassing the normal ethernet setup. */ static const int mtu = 1500; diff -Nru a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c --- a/drivers/net/arcnet/arcnet.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/arcnet/arcnet.c 2005-01-13 16:25:56 -08:00 @@ -93,7 +93,6 @@ EXPORT_SYMBOL(arc_proto_null); EXPORT_SYMBOL(arcnet_unregister_proto); EXPORT_SYMBOL(arcnet_debug); -EXPORT_SYMBOL(arcdev_setup); EXPORT_SYMBOL(alloc_arcdev); EXPORT_SYMBOL(arcnet_interrupt); @@ -317,7 +316,7 @@ /* Setup a struct device for ARCnet. */ -void arcdev_setup(struct net_device *dev) +static void arcdev_setup(struct net_device *dev) { dev->type = ARPHRD_ARCNET; dev->hard_header_len = sizeof(struct archdr); diff -Nru a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c --- a/drivers/net/e1000/e1000_ethtool.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/e1000/e1000_ethtool.c 2005-01-13 16:25:56 -08:00 @@ -1666,7 +1666,7 @@ .get_ethtool_stats = e1000_get_ethtool_stats, }; -void set_ethtool_ops(struct net_device *netdev) +void e1000_set_ethtool_ops(struct net_device *netdev) { SET_ETHTOOL_OPS(netdev, &e1000_ethtool_ops); } diff -Nru a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c --- a/drivers/net/e1000/e1000_main.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/e1000/e1000_main.c 2005-01-13 16:25:56 -08:00 @@ -151,7 +151,7 @@ static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); -void set_ethtool_ops(struct net_device *netdev); +void e1000_set_ethtool_ops(struct net_device *netdev); static void e1000_enter_82542_rst(struct e1000_adapter *adapter); static void e1000_leave_82542_rst(struct e1000_adapter *adapter); static void e1000_tx_timeout(struct net_device *dev); @@ -475,7 +475,7 @@ netdev->set_mac_address = &e1000_set_mac; netdev->change_mtu = &e1000_change_mtu; netdev->do_ioctl = &e1000_ioctl; - set_ethtool_ops(netdev); + e1000_set_ethtool_ops(netdev); netdev->tx_timeout = &e1000_tx_timeout; netdev->watchdog_timeo = 5 * HZ; #ifdef CONFIG_E1000_NAPI diff -Nru a/drivers/net/eepro.c b/drivers/net/eepro.c --- a/drivers/net/eepro.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/eepro.c 2005-01-13 16:25:56 -08:00 @@ -23,6 +23,7 @@ This is a compatibility hardware problem. Versions: + 0.13b basic ethtool support (aris, 09/13/2004) 0.13a in memory shortage, drop packets also in board (Michael Westermann , 07/30/2002) 0.13 irq sharing, rewrote probe function, fixed a nasty bug in @@ -104,7 +105,7 @@ */ static const char version[] = - "eepro.c: v0.13 11/08/2001 aris@cathedrallabs.org\n"; + "eepro.c: v0.13b 09/13/2004 aris@cathedrallabs.org\n"; #include @@ -146,19 +147,21 @@ #include #include #include +#include #include #include #include #define DRV_NAME "eepro" +#define DRV_VERSION "0.13b" #define compat_dev_kfree_skb( skb, mode ) dev_kfree_skb( (skb) ) /* I had reports of looong delays with SLOW_DOWN defined as udelay(2) */ #define SLOW_DOWN inb(0x80) /* udelay(2) */ #define compat_init_data __initdata - +enum iftype { AUI=0, BNC=1, TPE=2 }; /* First, a few definitions that the brave might change. */ /* A zero-terminated list of I/O addresses to be probed. */ @@ -214,6 +217,7 @@ short rcv_lower_limit; short rcv_upper_limit; unsigned char eeprom_reg; + unsigned short word[8]; }; /* The station (ethernet) address prefix, used for IDing the board. */ @@ -608,16 +612,22 @@ } #endif -static void __init printEEPROMInfo(short ioaddr, struct net_device *dev) +static void __init printEEPROMInfo(struct net_device *dev) { + struct eepro_local *lp = (struct eepro_local *)dev->priv; + int ioaddr = dev->base_addr; unsigned short Word; int i,j; - for (i=0, j=ee_Checksum; iword[i]; + for ( ; i < ee_SIZE; i++) + j += read_eeprom(ioaddr, i, dev); + printk(KERN_DEBUG "Checksum: %#x\n",j&0xffff); - Word=read_eeprom(ioaddr, 0, dev); + Word = lp->word[0]; printk(KERN_DEBUG "Word0:\n"); printk(KERN_DEBUG " Plug 'n Pray: %d\n",GetBit(Word,ee_PnP)); printk(KERN_DEBUG " Buswidth: %d\n",(GetBit(Word,ee_BusWidth)+1)*8 ); @@ -625,7 +635,7 @@ printk(KERN_DEBUG " IO Address: %#x\n", (Word>>ee_IO0)<<4); if (net_debug>4) { - Word=read_eeprom(ioaddr, 1, dev); + Word = lp->word[1]; printk(KERN_DEBUG "Word1:\n"); printk(KERN_DEBUG " INT: %d\n", Word & ee_IntMask); printk(KERN_DEBUG " LI: %d\n", GetBit(Word,ee_LI)); @@ -636,7 +646,7 @@ printk(KERN_DEBUG " Duplex: %d\n", GetBit(Word,ee_Duplex)); } - Word=read_eeprom(ioaddr, 5, dev); + Word = lp->word[5]; printk(KERN_DEBUG "Word5:\n"); printk(KERN_DEBUG " BNC: %d\n",GetBit(Word,ee_BNC_TPE)); printk(KERN_DEBUG " NumConnectors: %d\n",GetBit(Word,ee_NumConn)); @@ -646,12 +656,12 @@ if (GetBit(Word,ee_PortAUI)) printk(KERN_DEBUG "AUI "); printk(KERN_DEBUG "port(s) \n"); - Word=read_eeprom(ioaddr, 6, dev); + Word = lp->word[6]; printk(KERN_DEBUG "Word6:\n"); printk(KERN_DEBUG " Stepping: %d\n",Word & ee_StepMask); printk(KERN_DEBUG " BoardID: %d\n",Word>>ee_BoardID); - Word=read_eeprom(ioaddr, 7, dev); + Word = lp->word[7]; printk(KERN_DEBUG "Word7:\n"); printk(KERN_DEBUG " INT to IRQ:\n"); @@ -725,7 +735,7 @@ printk(", %s.\n", ifmap[dev->if_port]); if (net_debug > 3) { - i = read_eeprom(dev->base_addr, 5, dev); + i = lp->word[5]; if (i & 0x2000) /* bit 13 of EEPROM word 5 */ printk(KERN_DEBUG "%s: Concurrent Processing is " "enabled but not used!\n", dev->name); @@ -733,19 +743,20 @@ /* Check the station address for the manufacturer's code */ if (net_debug>3) - printEEPROMInfo(dev->base_addr, dev); + printEEPROMInfo(dev); } +static struct ethtool_ops eepro_ethtool_ops; + /* This is the real probe routine. Linux has a history of friendly device probes on the ISA bus. A good device probe avoids doing writes, and verifies that the correct device exists and functions. */ static int __init eepro_probe1(struct net_device *dev, int autoprobe) { - unsigned short station_addr[6], id, counter; + unsigned short station_addr[3], id, counter; int i; struct eepro_local *lp; - enum iftype { AUI=0, BNC=1, TPE=2 }; int ioaddr = dev->base_addr; /* Grab the region so we can find another board if autoIRQ fails. */ @@ -796,11 +807,16 @@ lp->xmt_bar = XMT_BAR_10; station_addr[0] = read_eeprom(ioaddr, 2, dev); } - station_addr[1] = read_eeprom(ioaddr, 3, dev); - station_addr[2] = read_eeprom(ioaddr, 4, dev); + + /* get all words at once. will be used here and for ethtool */ + for (i = 0; i < 8; i++) { + lp->word[i] = read_eeprom(ioaddr, i, dev); + } + station_addr[1] = lp->word[3]; + station_addr[2] = lp->word[4]; if (!lp->eepro) { - if (read_eeprom(ioaddr,7,dev)== ee_FX_INT2IRQ) + if (lp->word[7] == ee_FX_INT2IRQ) lp->eepro = 2; else if (station_addr[2] == SA_ADDR1) lp->eepro = 1; @@ -817,15 +833,15 @@ /* calculate {xmt,rcv}_{lower,upper}_limit */ eepro_recalc(dev); - if (GetBit( read_eeprom(ioaddr, 5, dev),ee_BNC_TPE)) + if (GetBit(lp->word[5], ee_BNC_TPE)) dev->if_port = BNC; else dev->if_port = TPE; if (dev->irq < 2 && lp->eepro != 0) { /* Mask off INT number */ - int count = read_eeprom(ioaddr, 1, dev) & 7; - unsigned irqMask = read_eeprom(ioaddr, 7, dev); + int count = lp->word[1] & 7; + unsigned irqMask = lp->word[7]; while (count--) irqMask &= irqMask - 1; @@ -850,6 +866,7 @@ dev->set_multicast_list = &set_multicast_list; dev->tx_timeout = eepro_tx_timeout; dev->watchdog_timeo = TX_TIMEOUT; + dev->ethtool_ops = &eepro_ethtool_ops; /* print boot time info */ eepro_print_info(dev); @@ -941,7 +958,7 @@ if (net_debug > 3) printk(KERN_DEBUG "%s: entering eepro_open routine.\n", dev->name); - irqMask = read_eeprom(ioaddr,7,dev); + irqMask = lp->word[7]; if (lp->eepro == LAN595FX_10ISA) { if (net_debug > 3) printk(KERN_DEBUG "p->eepro = 3;\n"); @@ -1070,8 +1087,6 @@ old9 = inb(ioaddr + 9); if (irqMask==ee_FX_INT2IRQ) { - enum iftype { AUI=0, BNC=1, TPE=2 }; - if (net_debug > 3) { printk(KERN_DEBUG "IrqMask: %#x\n",irqMask); printk(KERN_DEBUG "i82595FX detected!\n"); @@ -1701,12 +1716,72 @@ } } +static int eepro_ethtool_get_settings(struct net_device *dev, + struct ethtool_cmd *cmd) +{ + struct eepro_local *lp = (struct eepro_local *)dev->priv; + + cmd->supported = SUPPORTED_10baseT_Half | + SUPPORTED_10baseT_Full | + SUPPORTED_Autoneg; + cmd->advertising = ADVERTISED_10baseT_Half | + ADVERTISED_10baseT_Full | + ADVERTISED_Autoneg; + + if (GetBit(lp->word[5], ee_PortTPE)) { + cmd->supported |= SUPPORTED_TP; + cmd->advertising |= ADVERTISED_TP; + } + if (GetBit(lp->word[5], ee_PortBNC)) { + cmd->supported |= SUPPORTED_BNC; + cmd->advertising |= ADVERTISED_BNC; + } + if (GetBit(lp->word[5], ee_PortAUI)) { + cmd->supported |= SUPPORTED_AUI; + cmd->advertising |= ADVERTISED_AUI; + } + + cmd->speed = SPEED_10; + + if (dev->if_port == TPE && lp->word[1] & ee_Duplex) { + cmd->duplex = DUPLEX_FULL; + } + else { + cmd->duplex = DUPLEX_HALF; + } + + cmd->port = dev->if_port; + cmd->phy_address = dev->base_addr; + cmd->transceiver = XCVR_INTERNAL; + + if (lp->word[0] & ee_AutoNeg) { + cmd->autoneg = 1; + } + + return 0; +} + +static void eepro_ethtool_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *drvinfo) +{ + strcpy(drvinfo->driver, DRV_NAME); + strcpy(drvinfo->version, DRV_VERSION); + sprintf(drvinfo->bus_info, "ISA 0x%lx", dev->base_addr); +} + +static struct ethtool_ops eepro_ethtool_ops = { + .get_settings = eepro_ethtool_get_settings, + .get_drvinfo = eepro_ethtool_get_drvinfo, +}; + #ifdef MODULE #define MAX_EEPRO 8 static struct net_device *dev_eepro[MAX_EEPRO]; -static int io[MAX_EEPRO]; +static int io[MAX_EEPRO] = { + [0 ... MAX_EEPRO-1] = -1 +}; static int irq[MAX_EEPRO]; static int mem[MAX_EEPRO] = { /* Size of the rx buffer in KB */ [0 ... MAX_EEPRO-1] = RCV_DEFAULT_RAM/1024 @@ -1716,14 +1791,15 @@ static int n_eepro; /* For linux 2.1.xx */ -MODULE_AUTHOR("Pascal Dupuis, and aris@cathedrallabs.org"); +MODULE_AUTHOR("Pascal Dupuis and others"); MODULE_DESCRIPTION("Intel i82595 ISA EtherExpressPro10/10+ driver"); MODULE_LICENSE("GPL"); -MODULE_PARM(io, "1-" __MODULE_STRING(MAX_EEPRO) "i"); -MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_EEPRO) "i"); -MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_EEPRO) "i"); -MODULE_PARM(autodetect, "1-" __MODULE_STRING(1) "i"); +static int num_params; +module_param_array(io, int, &num_params, 0); +module_param_array(irq, int, &num_params, 0); +module_param_array(mem, int, &num_params, 0); +module_param(autodetect, int, 0); MODULE_PARM_DESC(io, "EtherExpress Pro/10 I/O base addres(es)"); MODULE_PARM_DESC(irq, "EtherExpress Pro/10 IRQ number(s)"); MODULE_PARM_DESC(mem, "EtherExpress Pro/10 Rx buffer size(es) in kB (3-29)"); @@ -1734,19 +1810,21 @@ { struct net_device *dev; int i; - if (io[0] == 0 && autodetect == 0) { + if (io[0] == -1 && autodetect == 0) { printk(KERN_WARNING "eepro_init_module: Probe is very dangerous in ISA boards!\n"); printk(KERN_WARNING "eepro_init_module: Please add \"autodetect=1\" to force probe\n"); - return 1; + return -ENODEV; } else if (autodetect) { /* if autodetect is set then we must force detection */ - io[0] = 0; + for (i = 0; i < MAX_EEPRO; i++) { + io[i] = 0; + } printk(KERN_INFO "eepro_init_module: Auto-detecting boards (May God protect us...)\n"); } - for (i = 0; i < MAX_EEPRO; i++) { + for (i = 0; io[i] != -1 && i < MAX_EEPRO; i++) { dev = alloc_etherdev(sizeof(struct eepro_local)); if (!dev) break; diff -Nru a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h --- a/drivers/net/ibm_emac/ibm_emac.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ibm_emac/ibm_emac.h 2005-01-13 16:25:56 -08:00 @@ -98,7 +98,7 @@ #endif /* CONFIG_IBM_EMAC4 */ #define EMAC_M1_BASE (EMAC_M1_TX_FIFO_2K | \ EMAC_M1_APP | \ - EMAC_M1_TR) + EMAC_M1_TR | EMAC_M1_VLE) /* Transmit Mode Register 0 */ #define EMAC_TMR0_GNP0 0x80000000 diff -Nru a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c --- a/drivers/net/ibm_emac/ibm_emac_core.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ibm_emac/ibm_emac_core.c 2005-01-13 16:25:56 -08:00 @@ -1363,6 +1363,9 @@ /* set frame gap */ out_be32(&emacp->em0ipgvr, CONFIG_IBM_EMAC_FGAP); + + /* set VLAN Tag Protocol Identifier */ + out_be32(&emacp->em0vtpid, 0x8100); /* Init ring buffers */ emac_init_rings(fep->ndev); @@ -1700,6 +1703,15 @@ .rxde = &emac_rxde_dev, }; +#ifdef CONFIG_NET_POLL_CONTROLLER +static int emac_netpoll(struct net_device *ndev) +{ + emac_rxeob_dev((void *)ndev, 0); + emac_txeob_dev((void *)ndev, 0); + return 0; +} +#endif + static int emac_init_device(struct ocp_device *ocpdev, struct ibm_ocp_mal *mal) { int deferred_init = 0; @@ -1882,6 +1894,9 @@ SET_ETHTOOL_OPS(ndev, &emac_ethtool_ops); if (emacdata->tah_idx >= 0) ndev->features = NETIF_F_IP_CSUM | NETIF_F_SG; +#ifdef CONFIG_NET_POLL_CONTROLLER + ndev->poll_controller = emac_netpoll; +#endif SET_MODULE_OWNER(ndev); diff -Nru a/drivers/net/ibm_emac/ibm_emac_phy.c b/drivers/net/ibm_emac/ibm_emac_phy.c --- a/drivers/net/ibm_emac/ibm_emac_phy.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ibm_emac/ibm_emac_phy.c 2005-01-13 16:25:56 -08:00 @@ -191,17 +191,18 @@ u16 lpa; if (phy->autoneg) { - lpa = phy_read(phy, MII_LPA); + lpa = phy_read(phy, MII_LPA) & phy_read(phy, MII_ADVERTISE); - if (lpa & (LPA_10FULL | LPA_100FULL)) - phy->duplex = DUPLEX_FULL; - else - phy->duplex = DUPLEX_HALF; - if (lpa & (LPA_100FULL | LPA_100HALF)) - phy->speed = SPEED_100; - else - phy->speed = SPEED_10; + phy->speed = SPEED_10; + phy->duplex = DUPLEX_HALF; phy->pause = 0; + + if (lpa & (LPA_100FULL | LPA_100HALF)) { + phy->speed = SPEED_100; + if (lpa & LPA_100FULL) + phy->duplex = DUPLEX_FULL; + } else if (lpa & LPA_10FULL) + phy->duplex = DUPLEX_FULL; } /* On non-aneg, we assume what we put in BMCR is the speed, * though magic-aneg shouldn't prevent this case from occurring diff -Nru a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h --- a/drivers/net/ixgb/ixgb.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ixgb/ixgb.h 2005-01-13 16:25:56 -08:00 @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -85,6 +86,20 @@ #define IXGB_ERR(args...) printk(KERN_ERR "ixgb: " args) +/* TX/RX descriptor defines */ +#define DEFAULT_TXD 256 +#define MAX_TXD 4096 +#define MIN_TXD 64 + +/* hardware cannot reliably support more than 512 descriptors owned by + * hardware descrioptor cache otherwise an unreliable ring under heavy + * recieve load may result */ +/* #define DEFAULT_RXD 1024 */ +/* #define MAX_RXD 4096 */ +#define DEFAULT_RXD 512 +#define MAX_RXD 512 +#define MIN_RXD 64 + /* Supported Rx Buffer Sizes */ #define IXGB_RXBUFFER_2048 2048 #define IXGB_RXBUFFER_4096 4096 @@ -105,9 +120,9 @@ struct ixgb_buffer { struct sk_buff *skb; uint64_t dma; - unsigned long length; unsigned long time_stamp; - unsigned int next_to_watch; + uint16_t length; + uint16_t next_to_watch; }; struct ixgb_desc_ring { @@ -167,7 +182,6 @@ uint64_t hw_csum_rx_error; uint64_t hw_csum_rx_good; uint32_t rx_int_delay; - boolean_t raidc; boolean_t rx_csum; /* OS defined structs */ @@ -178,5 +192,8 @@ /* structs defined in ixgb_hw.h */ struct ixgb_hw hw; struct ixgb_hw_stats stats; +#ifdef CONFIG_PCI_MSI + boolean_t have_msi; +#endif }; -#endif /* _IXGB_H_ */ +#endif /* _IXGB_H_ */ diff -Nru a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c --- a/drivers/net/ixgb/ixgb_ee.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ixgb/ixgb_ee.c 2005-01-13 16:25:56 -08:00 @@ -32,7 +32,8 @@ static uint16_t ixgb_shift_in_bits(struct ixgb_hw *hw); static void ixgb_shift_out_bits(struct ixgb_hw *hw, - uint16_t data, uint16_t count); + uint16_t data, + uint16_t count); static void ixgb_standby_eeprom(struct ixgb_hw *hw); static boolean_t ixgb_wait_eeprom_command(struct ixgb_hw *hw); @@ -45,7 +46,9 @@ * hw - Struct containing variables accessed by shared code * eecd_reg - EECD's current value *****************************************************************************/ -static void ixgb_raise_clock(struct ixgb_hw *hw, uint32_t * eecd_reg) +static void +ixgb_raise_clock(struct ixgb_hw *hw, + uint32_t *eecd_reg) { /* Raise the clock input to the EEPROM (by setting the SK bit), and then * wait 50 microseconds. @@ -62,7 +65,9 @@ * hw - Struct containing variables accessed by shared code * eecd_reg - EECD's current value *****************************************************************************/ -static void ixgb_lower_clock(struct ixgb_hw *hw, uint32_t * eecd_reg) +static void +ixgb_lower_clock(struct ixgb_hw *hw, + uint32_t *eecd_reg) { /* Lower the clock input to the EEPROM (by clearing the SK bit), and then * wait 50 microseconds. @@ -81,7 +86,9 @@ * count - number of bits to shift out *****************************************************************************/ static void -ixgb_shift_out_bits(struct ixgb_hw *hw, uint16_t data, uint16_t count) +ixgb_shift_out_bits(struct ixgb_hw *hw, + uint16_t data, + uint16_t count) { uint32_t eecd_reg; uint32_t mask; @@ -101,7 +108,7 @@ */ eecd_reg &= ~IXGB_EECD_DI; - if (data & mask) + if(data & mask) eecd_reg |= IXGB_EECD_DI; IXGB_WRITE_REG(hw, EECD, eecd_reg); @@ -113,7 +120,7 @@ mask = mask >> 1; - } while (mask); + } while(mask); /* We leave the "DI" bit set to "0" when we leave this routine. */ eecd_reg &= ~IXGB_EECD_DI; @@ -126,7 +133,8 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -static uint16_t ixgb_shift_in_bits(struct ixgb_hw *hw) +static uint16_t +ixgb_shift_in_bits(struct ixgb_hw *hw) { uint32_t eecd_reg; uint32_t i; @@ -144,14 +152,14 @@ eecd_reg &= ~(IXGB_EECD_DO | IXGB_EECD_DI); data = 0; - for (i = 0; i < 16; i++) { + for(i = 0; i < 16; i++) { data = data << 1; ixgb_raise_clock(hw, &eecd_reg); eecd_reg = IXGB_READ_REG(hw, EECD); eecd_reg &= ~(IXGB_EECD_DI); - if (eecd_reg & IXGB_EECD_DO) + if(eecd_reg & IXGB_EECD_DO) data |= 1; ixgb_lower_clock(hw, &eecd_reg); @@ -168,7 +176,8 @@ * Lowers EEPROM clock. Clears input pin. Sets the chip select pin. This * function should be called before issuing a command to the EEPROM. *****************************************************************************/ -static void ixgb_setup_eeprom(struct ixgb_hw *hw) +static void +ixgb_setup_eeprom(struct ixgb_hw *hw) { uint32_t eecd_reg; @@ -189,7 +198,8 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -static void ixgb_standby_eeprom(struct ixgb_hw *hw) +static void +ixgb_standby_eeprom(struct ixgb_hw *hw) { uint32_t eecd_reg; @@ -222,7 +232,8 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -static void ixgb_clock_eeprom(struct ixgb_hw *hw) +static void +ixgb_clock_eeprom(struct ixgb_hw *hw) { uint32_t eecd_reg; @@ -245,7 +256,8 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -static void ixgb_cleanup_eeprom(struct ixgb_hw *hw) +static void +ixgb_cleanup_eeprom(struct ixgb_hw *hw) { uint32_t eecd_reg; @@ -270,7 +282,8 @@ * TRUE: EEPROM data pin is high before timeout. * FALSE: Time expired. *****************************************************************************/ -static boolean_t ixgb_wait_eeprom_command(struct ixgb_hw *hw) +static boolean_t +ixgb_wait_eeprom_command(struct ixgb_hw *hw) { uint32_t eecd_reg; uint32_t i; @@ -284,10 +297,10 @@ * signal that the command has been completed by raising the DO signal. * If DO does not go high in 10 milliseconds, then error out. */ - for (i = 0; i < 200; i++) { + for(i = 0; i < 200; i++) { eecd_reg = IXGB_READ_REG(hw, EECD); - if (eecd_reg & IXGB_EECD_DO) + if(eecd_reg & IXGB_EECD_DO) return (TRUE); udelay(50); @@ -309,15 +322,16 @@ * TRUE: Checksum is valid * FALSE: Checksum is not valid. *****************************************************************************/ -boolean_t ixgb_validate_eeprom_checksum(struct ixgb_hw * hw) +boolean_t +ixgb_validate_eeprom_checksum(struct ixgb_hw *hw) { uint16_t checksum = 0; uint16_t i; - for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) + for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) checksum += ixgb_read_eeprom(hw, i); - if (checksum == (uint16_t) EEPROM_SUM) + if(checksum == (uint16_t) EEPROM_SUM) return (TRUE); else return (FALSE); @@ -331,12 +345,13 @@ * Sums the first 63 16 bit words of the EEPROM. Subtracts the sum from 0xBABA. * Writes the difference to word offset 63 of the EEPROM. *****************************************************************************/ -void ixgb_update_eeprom_checksum(struct ixgb_hw *hw) +void +ixgb_update_eeprom_checksum(struct ixgb_hw *hw) { uint16_t checksum = 0; uint16_t i; - for (i = 0; i < EEPROM_CHECKSUM_REG; i++) + for(i = 0; i < EEPROM_CHECKSUM_REG; i++) checksum += ixgb_read_eeprom(hw, i); checksum = (uint16_t) EEPROM_SUM - checksum; @@ -356,7 +371,10 @@ * EEPROM will most likely contain an invalid checksum. * *****************************************************************************/ -void ixgb_write_eeprom(struct ixgb_hw *hw, uint16_t offset, uint16_t data) +void +ixgb_write_eeprom(struct ixgb_hw *hw, + uint16_t offset, + uint16_t data) { /* Prepare the EEPROM for writing */ ixgb_setup_eeprom(hw); @@ -404,7 +422,9 @@ * Returns: * The 16-bit value read from the eeprom *****************************************************************************/ -uint16_t ixgb_read_eeprom(struct ixgb_hw * hw, uint16_t offset) +uint16_t +ixgb_read_eeprom(struct ixgb_hw *hw, + uint16_t offset) { uint16_t data; @@ -437,7 +457,8 @@ * TRUE: if eeprom read is successful * FALSE: otherwise. *****************************************************************************/ -boolean_t ixgb_get_eeprom_data(struct ixgb_hw * hw) +boolean_t +ixgb_get_eeprom_data(struct ixgb_hw *hw) { uint16_t i; uint16_t checksum = 0; @@ -448,7 +469,7 @@ ee_map = (struct ixgb_ee_map_type *)hw->eeprom; DEBUGOUT("ixgb_ee: Reading eeprom data\n"); - for (i = 0; i < IXGB_EEPROM_SIZE; i++) { + for(i = 0; i < IXGB_EEPROM_SIZE ; i++) { uint16_t ee_data; ee_data = ixgb_read_eeprom(hw, i); checksum += ee_data; @@ -461,12 +482,12 @@ } if ((ee_map->init_ctrl_reg_1 & le16_to_cpu(EEPROM_ICW1_SIGNATURE_MASK)) - != le16_to_cpu(EEPROM_ICW1_SIGNATURE_VALID)) { + != le16_to_cpu(EEPROM_ICW1_SIGNATURE_VALID)) { DEBUGOUT("ixgb_ee: Signature invalid.\n"); - return (FALSE); + return(FALSE); } - return (TRUE); + return(TRUE); } /****************************************************************************** @@ -479,7 +500,8 @@ * TRUE: eeprom signature was good and the eeprom read was successful * FALSE: otherwise. ******************************************************************************/ -static boolean_t ixgb_check_and_get_eeprom_data(struct ixgb_hw *hw) +static boolean_t +ixgb_check_and_get_eeprom_data (struct ixgb_hw* hw) { struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; @@ -500,15 +522,16 @@ * Returns: * Word at indexed offset in eeprom, if valid, 0 otherwise. ******************************************************************************/ -uint16_t ixgb_get_eeprom_word(struct ixgb_hw * hw, uint16_t index) +uint16_t +ixgb_get_eeprom_word(struct ixgb_hw *hw, uint16_t index) { if ((index < IXGB_EEPROM_SIZE) && - (ixgb_check_and_get_eeprom_data(hw) == TRUE)) { - return (hw->eeprom[index]); + (ixgb_check_and_get_eeprom_data(hw) == TRUE)) { + return(hw->eeprom[index]); } - return (0); + return(0); } /****************************************************************************** @@ -519,7 +542,9 @@ * * Returns: None. ******************************************************************************/ -void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, uint8_t * mac_addr) +void +ixgb_get_ee_mac_addr(struct ixgb_hw *hw, + uint8_t *mac_addr) { int i; struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; @@ -542,14 +567,15 @@ * Returns: * compatibility flags if EEPROM contents are valid, 0 otherwise ******************************************************************************/ -uint16_t ixgb_get_ee_compatibility(struct ixgb_hw *hw) +uint16_t +ixgb_get_ee_compatibility(struct ixgb_hw *hw) { struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) - return (ee_map->compatibility); + if(ixgb_check_and_get_eeprom_data(hw) == TRUE) + return(ee_map->compatibility); - return (0); + return(0); } /****************************************************************************** @@ -560,13 +586,14 @@ * Returns: * PBA number if EEPROM contents are valid, 0 otherwise ******************************************************************************/ -uint32_t ixgb_get_ee_pba_number(struct ixgb_hw * hw) +uint32_t +ixgb_get_ee_pba_number(struct ixgb_hw *hw) { - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) + if(ixgb_check_and_get_eeprom_data(hw) == TRUE) return (le16_to_cpu(hw->eeprom[EEPROM_PBA_1_2_REG]) - | (le16_to_cpu(hw->eeprom[EEPROM_PBA_3_4_REG]) << 16)); + | (le16_to_cpu(hw->eeprom[EEPROM_PBA_3_4_REG])<<16)); - return (0); + return(0); } /****************************************************************************** @@ -577,14 +604,15 @@ * Returns: * Initialization Control Word 1 if EEPROM contents are valid, 0 otherwise ******************************************************************************/ -uint16_t ixgb_get_ee_init_ctrl_reg_1(struct ixgb_hw * hw) +uint16_t +ixgb_get_ee_init_ctrl_reg_1(struct ixgb_hw *hw) { struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) - return (ee_map->init_ctrl_reg_1); + if(ixgb_check_and_get_eeprom_data(hw) == TRUE) + return(ee_map->init_ctrl_reg_1); - return (0); + return(0); } /****************************************************************************** @@ -595,14 +623,15 @@ * Returns: * Initialization Control Word 2 if EEPROM contents are valid, 0 otherwise ******************************************************************************/ -uint16_t ixgb_get_ee_init_ctrl_reg_2(struct ixgb_hw * hw) +uint16_t +ixgb_get_ee_init_ctrl_reg_2(struct ixgb_hw *hw) { struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) - return (ee_map->init_ctrl_reg_2); + if(ixgb_check_and_get_eeprom_data(hw) == TRUE) + return(ee_map->init_ctrl_reg_2); - return (0); + return(0); } /****************************************************************************** @@ -613,14 +642,15 @@ * Returns: * Subsystem Id if EEPROM contents are valid, 0 otherwise ******************************************************************************/ -uint16_t ixgb_get_ee_subsystem_id(struct ixgb_hw * hw) +uint16_t +ixgb_get_ee_subsystem_id(struct ixgb_hw *hw) { struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) - return (ee_map->subsystem_id); + if(ixgb_check_and_get_eeprom_data(hw) == TRUE) + return(ee_map->subsystem_id); - return (0); + return(0); } /****************************************************************************** @@ -631,14 +661,15 @@ * Returns: * Sub Vendor Id if EEPROM contents are valid, 0 otherwise ******************************************************************************/ -uint16_t ixgb_get_ee_subvendor_id(struct ixgb_hw * hw) +uint16_t +ixgb_get_ee_subvendor_id(struct ixgb_hw *hw) { struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) - return (ee_map->subvendor_id); + if(ixgb_check_and_get_eeprom_data(hw) == TRUE) + return(ee_map->subvendor_id); - return (0); + return(0); } /****************************************************************************** @@ -649,14 +680,15 @@ * Returns: * Device Id if EEPROM contents are valid, 0 otherwise ******************************************************************************/ -uint16_t ixgb_get_ee_device_id(struct ixgb_hw * hw) +uint16_t +ixgb_get_ee_device_id(struct ixgb_hw *hw) { struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) - return (ee_map->device_id); + if(ixgb_check_and_get_eeprom_data(hw) == TRUE) + return(ee_map->device_id); - return (0); + return(0); } /****************************************************************************** @@ -667,14 +699,15 @@ * Returns: * Device Id if EEPROM contents are valid, 0 otherwise ******************************************************************************/ -uint16_t ixgb_get_ee_vendor_id(struct ixgb_hw * hw) +uint16_t +ixgb_get_ee_vendor_id(struct ixgb_hw *hw) { struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) - return (ee_map->vendor_id); + if(ixgb_check_and_get_eeprom_data(hw) == TRUE) + return(ee_map->vendor_id); - return (0); + return(0); } /****************************************************************************** @@ -685,14 +718,15 @@ * Returns: * SDP Register if EEPROM contents are valid, 0 otherwise ******************************************************************************/ -uint16_t ixgb_get_ee_swdpins_reg(struct ixgb_hw * hw) +uint16_t +ixgb_get_ee_swdpins_reg(struct ixgb_hw *hw) { struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) - return (ee_map->swdpins_reg); + if(ixgb_check_and_get_eeprom_data(hw) == TRUE) + return(ee_map->swdpins_reg); - return (0); + return(0); } /****************************************************************************** @@ -703,14 +737,15 @@ * Returns: * D3 Power Management Bits if EEPROM contents are valid, 0 otherwise ******************************************************************************/ -uint8_t ixgb_get_ee_d3_power(struct ixgb_hw * hw) +uint8_t +ixgb_get_ee_d3_power(struct ixgb_hw *hw) { struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) - return (ee_map->d3_power); + if(ixgb_check_and_get_eeprom_data(hw) == TRUE) + return(ee_map->d3_power); - return (0); + return(0); } /****************************************************************************** @@ -721,12 +756,13 @@ * Returns: * D0 Power Management Bits if EEPROM contents are valid, 0 otherwise ******************************************************************************/ -uint8_t ixgb_get_ee_d0_power(struct ixgb_hw * hw) +uint8_t +ixgb_get_ee_d0_power(struct ixgb_hw *hw) { struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) - return (ee_map->d0_power); + if(ixgb_check_and_get_eeprom_data(hw) == TRUE) + return(ee_map->d0_power); - return (0); + return(0); } diff -Nru a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c --- a/drivers/net/ixgb/ixgb_ethtool.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ixgb/ixgb_ethtool.c 2005-01-13 16:25:56 -08:00 @@ -37,6 +37,12 @@ extern int ixgb_up(struct ixgb_adapter *adapter); extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog); +extern void ixgb_reset(struct ixgb_adapter *adapter); +extern int ixgb_setup_rx_resources(struct ixgb_adapter *adapter); +extern int ixgb_setup_tx_resources(struct ixgb_adapter *adapter); +extern void ixgb_free_rx_resources(struct ixgb_adapter *adapter); +extern void ixgb_free_tx_resources(struct ixgb_adapter *adapter); +extern void ixgb_update_stats(struct ixgb_adapter *adapter); struct ixgb_stats { char stat_string[ETH_GSTRING_LEN]; @@ -89,7 +95,7 @@ sizeof(ixgb_gstrings_stats) / sizeof(struct ixgb_stats) static int -ixgb_ethtool_gset(struct net_device *netdev, struct ethtool_cmd *ecmd) +ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) { struct ixgb_adapter *adapter = netdev->priv; ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); @@ -97,7 +103,7 @@ ecmd->port = PORT_FIBRE; ecmd->transceiver = XCVR_EXTERNAL; - if (netif_carrier_ok(adapter->netdev)) { + if(netif_carrier_ok(adapter->netdev)) { ecmd->speed = SPEED_10000; ecmd->duplex = DUPLEX_FULL; } else { @@ -110,86 +116,140 @@ } static int -ixgb_ethtool_sset(struct net_device *netdev, struct ethtool_cmd *ecmd) +ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) { struct ixgb_adapter *adapter = netdev->priv; - if (ecmd->autoneg == AUTONEG_ENABLE || - ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL) + if(ecmd->autoneg == AUTONEG_ENABLE || + ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL) return -EINVAL; - else { + + if(netif_running(adapter->netdev)) { ixgb_down(adapter, TRUE); + ixgb_reset(adapter); ixgb_up(adapter); - } + } else + ixgb_reset(adapter); + return 0; } static void -ixgb_ethtool_gpause(struct net_device *dev, - struct ethtool_pauseparam *epause) +ixgb_get_pauseparam(struct net_device *netdev, + struct ethtool_pauseparam *pause) { - struct ixgb_adapter *adapter = dev->priv; + struct ixgb_adapter *adapter = netdev->priv; struct ixgb_hw *hw = &adapter->hw; - - epause->autoneg = AUTONEG_DISABLE; - - if (hw->fc.type == ixgb_fc_rx_pause) - epause->rx_pause = 1; - else if (hw->fc.type == ixgb_fc_tx_pause) - epause->tx_pause = 1; - else if (hw->fc.type == ixgb_fc_full) { - epause->rx_pause = 1; - epause->tx_pause = 1; + + pause->autoneg = AUTONEG_DISABLE; + + if(hw->fc.type == ixgb_fc_rx_pause) + pause->rx_pause = 1; + else if(hw->fc.type == ixgb_fc_tx_pause) + pause->tx_pause = 1; + else if(hw->fc.type == ixgb_fc_full) { + pause->rx_pause = 1; + pause->tx_pause = 1; } } static int -ixgb_ethtool_spause(struct net_device *dev, - struct ethtool_pauseparam *epause) +ixgb_set_pauseparam(struct net_device *netdev, + struct ethtool_pauseparam *pause) { - struct ixgb_adapter *adapter = dev->priv; + struct ixgb_adapter *adapter = netdev->priv; struct ixgb_hw *hw = &adapter->hw; - - if (epause->autoneg == AUTONEG_ENABLE) + + if(pause->autoneg == AUTONEG_ENABLE) return -EINVAL; - if (epause->rx_pause && epause->tx_pause) + if(pause->rx_pause && pause->tx_pause) hw->fc.type = ixgb_fc_full; - else if (epause->rx_pause && !epause->tx_pause) + else if(pause->rx_pause && !pause->tx_pause) hw->fc.type = ixgb_fc_rx_pause; - else if (!epause->rx_pause && epause->tx_pause) + else if(!pause->rx_pause && pause->tx_pause) hw->fc.type = ixgb_fc_tx_pause; - else if (!epause->rx_pause && !epause->tx_pause) + else if(!pause->rx_pause && !pause->tx_pause) hw->fc.type = ixgb_fc_none; - ixgb_down(adapter, TRUE); - ixgb_up(adapter); - + if(netif_running(adapter->netdev)) { + ixgb_down(adapter, TRUE); + ixgb_up(adapter); + } else + ixgb_reset(adapter); + return 0; } -static void -ixgb_ethtool_gdrvinfo(struct net_device *netdev, - struct ethtool_drvinfo *drvinfo) +static uint32_t +ixgb_get_rx_csum(struct net_device *netdev) { struct ixgb_adapter *adapter = netdev->priv; - strncpy(drvinfo->driver, ixgb_driver_name, 32); - strncpy(drvinfo->version, ixgb_driver_version, 32); - strncpy(drvinfo->fw_version, "N/A", 32); - strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); + return adapter->rx_csum; } +static int +ixgb_set_rx_csum(struct net_device *netdev, uint32_t data) +{ + struct ixgb_adapter *adapter = netdev->priv; + adapter->rx_csum = data; + + if(netif_running(netdev)) { + ixgb_down(adapter,TRUE); + ixgb_up(adapter); + } else + ixgb_reset(adapter); + return 0; +} + +static uint32_t +ixgb_get_tx_csum(struct net_device *netdev) +{ + return (netdev->features & NETIF_F_HW_CSUM) != 0; +} + +static int +ixgb_set_tx_csum(struct net_device *netdev, uint32_t data) +{ + if (data) + netdev->features |= NETIF_F_HW_CSUM; + else + netdev->features &= ~NETIF_F_HW_CSUM; + + return 0; +} + +#ifdef NETIF_F_TSO +static int +ixgb_set_tso(struct net_device *netdev, uint32_t data) +{ + if(data) + netdev->features |= NETIF_F_TSO; + else + netdev->features &= ~NETIF_F_TSO; + return 0; +} +#endif /* NETIF_F_TSO */ + #define IXGB_GET_STAT(_A_, _R_) _A_->stats._R_ + +static int +ixgb_get_regs_len(struct net_device *netdev) +{ +#define IXGB_REG_DUMP_LEN 136*sizeof(uint32_t) + return IXGB_REG_DUMP_LEN; +} + static void -ixgb_ethtool_gregs(struct net_device *dev, struct ethtool_regs *regs, void *buf) +ixgb_get_regs(struct net_device *netdev, + struct ethtool_regs *regs, void *p) { - struct ixgb_adapter *adapter = dev->priv; + struct ixgb_adapter *adapter = netdev->priv; struct ixgb_hw *hw = &adapter->hw; - uint32_t *reg = buf; + uint32_t *reg = p; uint32_t *reg_start = reg; uint8_t i; - regs->version = - (adapter->hw.device_id << 16) | adapter->hw.subsystem_id; + regs->version = (adapter->hw.device_id << 16) | adapter->hw.subsystem_id; /* General Registers */ *reg++ = IXGB_READ_REG(hw, CTRL0); /* 0 */ @@ -219,8 +279,8 @@ *reg++ = IXGB_READ_REG(hw, RXCSUM); /* 20 */ for (i = 0; i < IXGB_RAR_ENTRIES; i++) { - *reg++ = IXGB_READ_REG_ARRAY(hw, RAL, (i << 1)); /*21,...,51 */ - *reg++ = IXGB_READ_REG_ARRAY(hw, RAH, (i << 1)); /*22,...,52 */ + *reg++ = IXGB_READ_REG_ARRAY(hw, RAL, (i << 1)); /*21,...,51 */ + *reg++ = IXGB_READ_REG_ARRAY(hw, RAH, (i << 1)); /*22,...,52 */ } /* Transmit */ @@ -316,73 +376,222 @@ } static int -ixgb_ethtool_geeprom(struct net_device *dev, - struct ethtool_eeprom *eeprom, u8 *data) +ixgb_get_eeprom_len(struct net_device *netdev) { - struct ixgb_adapter *adapter = dev->priv; + /* return size in bytes */ + return (IXGB_EEPROM_SIZE << 1); +} + +static int +ixgb_get_eeprom(struct net_device *netdev, + struct ethtool_eeprom *eeprom, uint8_t *bytes) +{ + struct ixgb_adapter *adapter = netdev->priv; struct ixgb_hw *hw = &adapter->hw; + uint16_t *eeprom_buff; + int i, max_len, first_word, last_word; + int ret_val = 0; + + if(eeprom->len == 0) { + ret_val = -EINVAL; + goto geeprom_error; + } eeprom->magic = hw->vendor_id | (hw->device_id << 16); - /* use our function to read the eeprom and update our cache */ - ixgb_get_eeprom_data(hw); - memcpy(data, (char *)hw->eeprom + eeprom->offset, eeprom->len); - return 0; + max_len = ixgb_get_eeprom_len(netdev); + + if(eeprom->offset > eeprom->offset + eeprom->len) { + ret_val = -EINVAL; + goto geeprom_error; + } + + if((eeprom->offset + eeprom->len) > max_len) + eeprom->len = (max_len - eeprom->offset); + + first_word = eeprom->offset >> 1; + last_word = (eeprom->offset + eeprom->len - 1) >> 1; + + eeprom_buff = kmalloc(sizeof(uint16_t) * + (last_word - first_word + 1), GFP_KERNEL); + if(!eeprom_buff) + return -ENOMEM; + + /* note the eeprom was good because the driver loaded */ + for(i = 0; i <= (last_word - first_word); i++) { + eeprom_buff[i] = ixgb_get_eeprom_word(hw, (first_word + i)); + } + + memcpy(bytes, (uint8_t *)eeprom_buff + (eeprom->offset & 1), + eeprom->len); + kfree(eeprom_buff); + +geeprom_error: + return ret_val; } static int -ixgb_ethtool_seeprom(struct net_device *dev, - struct ethtool_eeprom *eeprom, u8 *data) +ixgb_set_eeprom(struct net_device *netdev, + struct ethtool_eeprom *eeprom, uint8_t *bytes) { - struct ixgb_adapter *adapter = dev->priv; + struct ixgb_adapter *adapter = netdev->priv; struct ixgb_hw *hw = &adapter->hw; - /* We are under rtnl, so static is OK */ - static uint16_t eeprom_buff[IXGB_EEPROM_SIZE]; - int i, first_word, last_word; - char *ptr; + uint16_t *eeprom_buff; + void *ptr; + int max_len, first_word, last_word; + uint16_t i; + + if(eeprom->len == 0) + return -EINVAL; - if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) + if(eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) return -EFAULT; + max_len = ixgb_get_eeprom_len(netdev); + + if(eeprom->offset > eeprom->offset + eeprom->len) + return -EINVAL; + + if((eeprom->offset + eeprom->len) > max_len) + eeprom->len = (max_len - eeprom->offset); + first_word = eeprom->offset >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1; - ptr = (char *)eeprom_buff; + eeprom_buff = kmalloc(max_len, GFP_KERNEL); + if(!eeprom_buff) + return -ENOMEM; + + ptr = (void *)eeprom_buff; - if (eeprom->offset & 1) { + if(eeprom->offset & 1) { /* need read/modify/write of first changed EEPROM word */ /* only the second byte of the word is being modified */ eeprom_buff[0] = ixgb_read_eeprom(hw, first_word); ptr++; } - if ((eeprom->offset + eeprom->len) & 1) { + if((eeprom->offset + eeprom->len) & 1) { /* need read/modify/write of last changed EEPROM word */ /* only the first byte of the word is being modified */ - eeprom_buff[last_word - first_word] - = ixgb_read_eeprom(hw, last_word); + eeprom_buff[last_word - first_word] + = ixgb_read_eeprom(hw, last_word); } - memcpy(ptr, data, eeprom->len); - for (i = 0; i <= (last_word - first_word); i++) + memcpy(ptr, bytes, eeprom->len); + for(i = 0; i <= (last_word - first_word); i++) ixgb_write_eeprom(hw, first_word + i, eeprom_buff[i]); /* Update the checksum over the first part of the EEPROM if needed */ - if (first_word <= EEPROM_CHECKSUM_REG) + if(first_word <= EEPROM_CHECKSUM_REG) ixgb_update_eeprom_checksum(hw); + kfree(eeprom_buff); return 0; } +static void +ixgb_get_drvinfo(struct net_device *netdev, + struct ethtool_drvinfo *drvinfo) +{ + struct ixgb_adapter *adapter = netdev->priv; + + strncpy(drvinfo->driver, ixgb_driver_name, 32); + strncpy(drvinfo->version, ixgb_driver_version, 32); + strncpy(drvinfo->fw_version, "N/A", 32); + strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); + drvinfo->n_stats = IXGB_STATS_LEN; + drvinfo->regdump_len = ixgb_get_regs_len(netdev); + drvinfo->eedump_len = ixgb_get_eeprom_len(netdev); +} + +static void +ixgb_get_ringparam(struct net_device *netdev, + struct ethtool_ringparam *ring) +{ + struct ixgb_adapter *adapter = netdev->priv; + struct ixgb_desc_ring *txdr = &adapter->tx_ring; + struct ixgb_desc_ring *rxdr = &adapter->rx_ring; + + ring->rx_max_pending = MAX_RXD; + ring->tx_max_pending = MAX_TXD; + ring->rx_mini_max_pending = 0; + ring->rx_jumbo_max_pending = 0; + ring->rx_pending = rxdr->count; + ring->tx_pending = txdr->count; + ring->rx_mini_pending = 0; + ring->rx_jumbo_pending = 0; +} + +static int +ixgb_set_ringparam(struct net_device *netdev, + struct ethtool_ringparam *ring) +{ + struct ixgb_adapter *adapter = netdev->priv; + struct ixgb_desc_ring *txdr = &adapter->tx_ring; + struct ixgb_desc_ring *rxdr = &adapter->rx_ring; + struct ixgb_desc_ring tx_old, tx_new, rx_old, rx_new; + int err; + + tx_old = adapter->tx_ring; + rx_old = adapter->rx_ring; + + if((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) + return -EINVAL; + + if(netif_running(adapter->netdev)) + ixgb_down(adapter,TRUE); + + rxdr->count = max(ring->rx_pending,(uint32_t)MIN_RXD); + rxdr->count = min(rxdr->count,(uint32_t)MAX_RXD); + IXGB_ROUNDUP(rxdr->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); + + txdr->count = max(ring->tx_pending,(uint32_t)MIN_TXD); + txdr->count = min(txdr->count,(uint32_t)MAX_TXD); + IXGB_ROUNDUP(txdr->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); + + if(netif_running(adapter->netdev)) { + /* Try to get new resources before deleting old */ + if((err = ixgb_setup_rx_resources(adapter))) + goto err_setup_rx; + if((err = ixgb_setup_tx_resources(adapter))) + goto err_setup_tx; + + /* save the new, restore the old in order to free it, + * then restore the new back again */ + + rx_new = adapter->rx_ring; + tx_new = adapter->tx_ring; + adapter->rx_ring = rx_old; + adapter->tx_ring = tx_old; + ixgb_free_rx_resources(adapter); + ixgb_free_tx_resources(adapter); + adapter->rx_ring = rx_new; + adapter->tx_ring = tx_new; + if((err = ixgb_up(adapter))) + return err; + } + + return 0; +err_setup_tx: + ixgb_free_rx_resources(adapter); +err_setup_rx: + adapter->rx_ring = rx_old; + adapter->tx_ring = tx_old; + ixgb_up(adapter); + return err; +} + /* toggle LED 4 times per second = 2 "blinks" per second */ #define IXGB_ID_INTERVAL (HZ/4) /* bit defines for adapter->led_status */ #define IXGB_LED_ON 0 -static void ixgb_led_blink_callback(unsigned long data) +static void +ixgb_led_blink_callback(unsigned long data) { struct ixgb_adapter *adapter = (struct ixgb_adapter *)data; - if (test_and_change_bit(IXGB_LED_ON, &adapter->led_status)) + if(test_and_change_bit(IXGB_LED_ON, &adapter->led_status)) ixgb_led_off(&adapter->hw); else ixgb_led_on(&adapter->hw); @@ -391,10 +600,14 @@ } static int -ixgb_ethtool_led_blink(struct net_device *netdev, u32 data) +ixgb_phys_id(struct net_device *netdev, uint32_t data) { struct ixgb_adapter *adapter = netdev->priv; - if (!adapter->blink_timer.function) { + + if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) + data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); + + if(!adapter->blink_timer.function) { init_timer(&adapter->blink_timer); adapter->blink_timer.function = ixgb_led_blink_callback; adapter->blink_timer.data = (unsigned long)adapter; @@ -403,7 +616,7 @@ mod_timer(&adapter->blink_timer, jiffies); set_current_state(TASK_INTERRUPTIBLE); - if (data) + if(data) schedule_timeout(data * HZ); else schedule_timeout(MAX_SCHEDULE_TIMEOUT); @@ -415,141 +628,74 @@ return 0; } -static int ixgb_nway_reset(struct net_device *netdev) -{ - if (netif_running(netdev)) { - struct ixgb_adapter *adapter = netdev->priv; - ixgb_down(adapter, TRUE); - ixgb_up(adapter); - } - return 0; -} - -static int ixgb_get_stats_count(struct net_device *dev) +static int +ixgb_get_stats_count(struct net_device *netdev) { return IXGB_STATS_LEN; } -static void ixgb_get_strings(struct net_device *dev, u32 stringset, u8 *data) +static void +ixgb_get_ethtool_stats(struct net_device *netdev, + struct ethtool_stats *stats, uint64_t *data) { + struct ixgb_adapter *adapter = netdev->priv; int i; - for (i = 0; i < IXGB_STATS_LEN; i++) { - memcpy(data + i * ETH_GSTRING_LEN, - ixgb_gstrings_stats[i].stat_string, - ETH_GSTRING_LEN); - } -} - -static int ixgb_get_regs_len(struct net_device *dev) -{ - return 136*sizeof(uint32_t); -} -static int ixgb_get_eeprom_len(struct net_device *dev) -{ - /* return size in bytes */ - return (IXGB_EEPROM_SIZE << 1); + ixgb_update_stats(adapter); + for(i = 0; i < IXGB_STATS_LEN; i++) { + char *p = (char *)adapter+ixgb_gstrings_stats[i].stat_offset; + data[i] = (ixgb_gstrings_stats[i].sizeof_stat == + sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; + } } -static void get_ethtool_stats(struct net_device *dev, - struct ethtool_stats *stats, u64 *data) +static void +ixgb_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) { - struct ixgb_adapter *adapter = dev->priv; int i; - for (i = 0; i < IXGB_STATS_LEN; i++) { - void *p = (char *)adapter + ixgb_gstrings_stats[i].stat_offset; - stats->data[i] = - (ixgb_gstrings_stats[i].sizeof_stat == sizeof(uint64_t)) - ? *(uint64_t *) p - : *(uint32_t *) p; + switch(stringset) { + case ETH_SS_STATS: + for(i=0; i < IXGB_STATS_LEN; i++) { + memcpy(data + i * ETH_GSTRING_LEN, + ixgb_gstrings_stats[i].stat_string, + ETH_GSTRING_LEN); + } + break; } } -static u32 ixgb_get_rx_csum(struct net_device *dev) -{ - struct ixgb_adapter *adapter = dev->priv; - return adapter->rx_csum; -} - -static int ixgb_set_rx_csum(struct net_device *dev, u32 sum) -{ - struct ixgb_adapter *adapter = dev->priv; - adapter->rx_csum = sum; - ixgb_down(adapter, TRUE); - ixgb_up(adapter); - return 0; -} - -static u32 ixgb_get_tx_csum(struct net_device *dev) -{ - return (dev->features & NETIF_F_HW_CSUM) != 0; -} - -static int ixgb_set_tx_csum(struct net_device *dev, u32 sum) -{ - if (sum) - dev->features |= NETIF_F_HW_CSUM; - else - dev->features &= ~NETIF_F_HW_CSUM; - return 0; -} - -static u32 ixgb_get_sg(struct net_device *dev) -{ - return (dev->features & NETIF_F_SG) != 0; -} - -static int ixgb_set_sg(struct net_device *dev, u32 sum) -{ - if (sum) - dev->features |= NETIF_F_SG; - else - dev->features &= ~NETIF_F_SG; - return 0; -} - -#ifdef NETIF_F_TSO -static u32 ixgb_get_tso(struct net_device *dev) -{ - return (dev->features & NETIF_F_TSO) != 0; -} - -static int ixgb_set_tso(struct net_device *dev, u32 sum) -{ - if (sum) - dev->features |= NETIF_F_TSO; - else - dev->features &= ~NETIF_F_TSO; - return 0; -} -#endif - struct ethtool_ops ixgb_ethtool_ops = { - .get_settings = ixgb_ethtool_gset, - .set_settings = ixgb_ethtool_sset, - .get_drvinfo = ixgb_ethtool_gdrvinfo, - .nway_reset = ixgb_nway_reset, - .get_link = ethtool_op_get_link, - .phys_id = ixgb_ethtool_led_blink, - .get_strings = ixgb_get_strings, - .get_stats_count = ixgb_get_stats_count, - .get_regs = ixgb_ethtool_gregs, + .get_settings = ixgb_get_settings, + .set_settings = ixgb_set_settings, + .get_drvinfo = ixgb_get_drvinfo, .get_regs_len = ixgb_get_regs_len, + .get_regs = ixgb_get_regs, + .get_link = ethtool_op_get_link, .get_eeprom_len = ixgb_get_eeprom_len, - .get_eeprom = ixgb_ethtool_geeprom, - .set_eeprom = ixgb_ethtool_seeprom, - .get_pauseparam = ixgb_ethtool_gpause, - .set_pauseparam = ixgb_ethtool_spause, - .get_ethtool_stats = get_ethtool_stats, + .get_eeprom = ixgb_get_eeprom, + .set_eeprom = ixgb_set_eeprom, + .get_ringparam = ixgb_get_ringparam, + .set_ringparam = ixgb_set_ringparam, + .get_pauseparam = ixgb_get_pauseparam, + .set_pauseparam = ixgb_set_pauseparam, .get_rx_csum = ixgb_get_rx_csum, .set_rx_csum = ixgb_set_rx_csum, .get_tx_csum = ixgb_get_tx_csum, .set_tx_csum = ixgb_set_tx_csum, - .get_sg = ixgb_get_sg, - .set_sg = ixgb_set_sg, + .get_sg = ethtool_op_get_sg, + .set_sg = ethtool_op_set_sg, #ifdef NETIF_F_TSO - .get_tso = ixgb_get_tso, + .get_tso = ethtool_op_get_tso, .set_tso = ixgb_set_tso, #endif + .get_strings = ixgb_get_strings, + .phys_id = ixgb_phys_id, + .get_stats_count = ixgb_get_stats_count, + .get_ethtool_stats = ixgb_get_ethtool_stats, }; + +void ixgb_set_ethtool_ops(struct net_device *netdev) +{ + SET_ETHTOOL_OPS(netdev, &ixgb_ethtool_ops); +} diff -Nru a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c --- a/drivers/net/ixgb/ixgb_hw.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ixgb/ixgb_hw.c 2005-01-13 16:25:56 -08:00 @@ -53,9 +53,14 @@ { uint32_t ctrl_reg; - ctrl_reg = IXGB_CTRL0_RST | IXGB_CTRL0_SDP3_DIR | /* All pins are Output=1 */ - IXGB_CTRL0_SDP2_DIR | IXGB_CTRL0_SDP1_DIR | IXGB_CTRL0_SDP0_DIR | IXGB_CTRL0_SDP3 | /* Initial value 1101 */ - IXGB_CTRL0_SDP2 | IXGB_CTRL0_SDP0; + ctrl_reg = IXGB_CTRL0_RST | + IXGB_CTRL0_SDP3_DIR | /* All pins are Output=1 */ + IXGB_CTRL0_SDP2_DIR | + IXGB_CTRL0_SDP1_DIR | + IXGB_CTRL0_SDP0_DIR | + IXGB_CTRL0_SDP3 | /* Initial value 1101 */ + IXGB_CTRL0_SDP2 | + IXGB_CTRL0_SDP0; #ifdef HP_ZX1 /* Workaround for 82597EX reset errata */ @@ -84,7 +89,8 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -boolean_t ixgb_adapter_stop(struct ixgb_hw * hw) +boolean_t +ixgb_adapter_stop(struct ixgb_hw *hw) { uint32_t ctrl_reg; uint32_t icr_reg; @@ -94,7 +100,7 @@ /* If we are stopped or resetting exit gracefully and wait to be * started again before accessing the hardware. */ - if (hw->adapter_stopped) { + if(hw->adapter_stopped) { DEBUGOUT("Exiting because the adapter is already stopped!!!\n"); return FALSE; } @@ -135,6 +141,7 @@ return (ctrl_reg & IXGB_CTRL0_RST); } + /****************************************************************************** * Identifies the vendor of the optics module on the adapter. The SR adapters * support two different types of XPAK optics, so it is necessary to determine @@ -144,7 +151,8 @@ * * Returns: the vendor of the XPAK optics module. *****************************************************************************/ -static ixgb_xpak_vendor ixgb_identify_xpak_vendor(struct ixgb_hw *hw) +static ixgb_xpak_vendor +ixgb_identify_xpak_vendor(struct ixgb_hw *hw) { uint32_t i; uint16_t vendor_name[5]; @@ -183,7 +191,8 @@ * * Returns: the phy type of the adapter. *****************************************************************************/ -static ixgb_phy_type ixgb_identify_phy(struct ixgb_hw *hw) +static ixgb_phy_type +ixgb_identify_phy(struct ixgb_hw *hw) { ixgb_phy_type phy_type; ixgb_xpak_vendor xpak_vendor; @@ -210,7 +219,10 @@ phy_type = ixgb_phy_type_g6005; } break; - + case IXGB_DEVICE_ID_82597EX_LR: + DEBUGOUT("Identified G6104 optics\n"); + phy_type = ixgb_phy_type_g6104; + break; default: DEBUGOUT("Unknown physical layer module\n"); phy_type = ixgb_phy_type_unknown; @@ -237,7 +249,8 @@ * TRUE if successful, * FALSE if unrecoverable problems were encountered. *****************************************************************************/ -boolean_t ixgb_init_hw(struct ixgb_hw * hw) +boolean_t +ixgb_init_hw(struct ixgb_hw *hw) { uint32_t i; uint32_t ctrl_reg; @@ -266,7 +279,7 @@ msec_delay(IXGB_DELAY_AFTER_EE_RESET); if (ixgb_get_eeprom_data(hw) == FALSE) { - return (FALSE); + return(FALSE); } /* Use the device id to determine the type of phy/transceiver. */ @@ -284,7 +297,7 @@ */ if (!mac_addr_valid(hw->curr_mac_addr)) { DEBUGOUT("MAC address invalid after ixgb_init_rx_addrs\n"); - return (FALSE); + return(FALSE); } /* tell the routines in this file they can access hardware again */ @@ -295,7 +308,7 @@ /* Zero out the Multicast HASH table */ DEBUGOUT("Zeroing the MTA\n"); - for (i = 0; i < IXGB_MC_TBL_SIZE; i++) + for(i = 0; i < IXGB_MC_TBL_SIZE; i++) IXGB_WRITE_REG_ARRAY(hw, MTA, i, 0); /* Zero out the VLAN Filter Table Array */ @@ -322,7 +335,8 @@ * of the receive addresss registers. Clears the multicast table. Assumes * the receiver is in reset when the routine is called. *****************************************************************************/ -void ixgb_init_rx_addrs(struct ixgb_hw *hw) +void +ixgb_init_rx_addrs(struct ixgb_hw *hw) { uint32_t i; @@ -360,7 +374,7 @@ /* Zero out the other 15 receive addresses. */ DEBUGOUT("Clearing RAR[1-15]\n"); - for (i = 1; i < IXGB_RAR_ENTRIES; i++) { + for(i = 1; i < IXGB_RAR_ENTRIES; i++) { IXGB_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); IXGB_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); } @@ -383,12 +397,13 @@ *****************************************************************************/ void ixgb_mc_addr_list_update(struct ixgb_hw *hw, - uint8_t * mc_addr_list, - uint32_t mc_addr_count, uint32_t pad) + uint8_t *mc_addr_list, + uint32_t mc_addr_count, + uint32_t pad) { uint32_t hash_value; uint32_t i; - uint32_t rar_used_count = 1; /* RAR[0] is used for our MAC address */ + uint32_t rar_used_count = 1; /* RAR[0] is used for our MAC address */ DEBUGFUNC("ixgb_mc_addr_list_update"); @@ -397,19 +412,19 @@ /* Clear RAR[1-15] */ DEBUGOUT(" Clearing RAR[1-15]\n"); - for (i = rar_used_count; i < IXGB_RAR_ENTRIES; i++) { + for(i = rar_used_count; i < IXGB_RAR_ENTRIES; i++) { IXGB_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); IXGB_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); } /* Clear the MTA */ DEBUGOUT(" Clearing MTA\n"); - for (i = 0; i < IXGB_MC_TBL_SIZE; i++) { + for(i = 0; i < IXGB_MC_TBL_SIZE; i++) { IXGB_WRITE_REG_ARRAY(hw, MTA, i, 0); } /* Add the new addresses */ - for (i = 0; i < mc_addr_count; i++) { + for(i = 0; i < mc_addr_count; i++) { DEBUGOUT(" Adding the multicast addresses:\n"); DEBUGOUT7(" MC Addr #%d =%.2X %.2X %.2X %.2X %.2X %.2X\n", i, mc_addr_list[i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad)], @@ -427,7 +442,7 @@ /* Place this multicast address in the RAR if there is room, * * else put it in the MTA */ - if (rar_used_count < IXGB_RAR_ENTRIES) { + if(rar_used_count < IXGB_RAR_ENTRIES) { ixgb_rar_set(hw, mc_addr_list + (i * (IXGB_ETH_LENGTH_OF_ADDRESS + pad)), @@ -460,7 +475,9 @@ * Returns: * The hash value *****************************************************************************/ -static uint32_t ixgb_hash_mc_addr(struct ixgb_hw *hw, uint8_t * mc_addr) +static uint32_t +ixgb_hash_mc_addr(struct ixgb_hw *hw, + uint8_t *mc_addr) { uint32_t hash_value = 0; @@ -506,7 +523,9 @@ * hw - Struct containing variables accessed by shared code * hash_value - Multicast address hash value *****************************************************************************/ -static void ixgb_mta_set(struct ixgb_hw *hw, uint32_t hash_value) +static void +ixgb_mta_set(struct ixgb_hw *hw, + uint32_t hash_value) { uint32_t hash_bit, hash_reg; uint32_t mta_reg; @@ -538,7 +557,10 @@ * addr - Address to put into receive address register * index - Receive address register to write *****************************************************************************/ -void ixgb_rar_set(struct ixgb_hw *hw, uint8_t * addr, uint32_t index) +void +ixgb_rar_set(struct ixgb_hw *hw, + uint8_t *addr, + uint32_t index) { uint32_t rar_low, rar_high; @@ -548,11 +570,13 @@ * from network order (big endian) to little endian */ rar_low = ((uint32_t) addr[0] | - ((uint32_t) addr[1] << 8) | - ((uint32_t) addr[2] << 16) | ((uint32_t) addr[3] << 24)); + ((uint32_t)addr[1] << 8) | + ((uint32_t)addr[2] << 16) | + ((uint32_t)addr[3] << 24)); rar_high = ((uint32_t) addr[4] | - ((uint32_t) addr[5] << 8) | IXGB_RAH_AV); + ((uint32_t)addr[5] << 8) | + IXGB_RAH_AV); IXGB_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low); IXGB_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high); @@ -566,7 +590,10 @@ * offset - Offset in VLAN filer table to write * value - Value to write into VLAN filter table *****************************************************************************/ -void ixgb_write_vfta(struct ixgb_hw *hw, uint32_t offset, uint32_t value) +void +ixgb_write_vfta(struct ixgb_hw *hw, + uint32_t offset, + uint32_t value) { IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, value); return; @@ -577,11 +604,12 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -void ixgb_clear_vfta(struct ixgb_hw *hw) +void +ixgb_clear_vfta(struct ixgb_hw *hw) { uint32_t offset; - for (offset = 0; offset < IXGB_VLAN_FILTER_TBL_SIZE; offset++) + for(offset = 0; offset < IXGB_VLAN_FILTER_TBL_SIZE; offset++) IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, 0); return; } @@ -592,10 +620,11 @@ * hw - Struct containing variables accessed by shared code *****************************************************************************/ -boolean_t ixgb_setup_fc(struct ixgb_hw * hw) +boolean_t +ixgb_setup_fc(struct ixgb_hw *hw) { uint32_t ctrl_reg; - uint32_t pap_reg = 0; /* by default, assume no pause time */ + uint32_t pap_reg = 0; /* by default, assume no pause time */ boolean_t status = TRUE; DEBUGFUNC("ixgb_setup_fc"); @@ -660,16 +689,16 @@ * ability to transmit pause frames in not enabled, then these * registers will be set to 0. */ - if (!(hw->fc.type & ixgb_fc_tx_pause)) { + if(!(hw->fc.type & ixgb_fc_tx_pause)) { IXGB_WRITE_REG(hw, FCRTL, 0); IXGB_WRITE_REG(hw, FCRTH, 0); } else { - /* We need to set up the Receive Threshold high and low water - * marks as well as (optionally) enabling the transmission of XON frames. - */ - if (hw->fc.send_xon) { + /* We need to set up the Receive Threshold high and low water + * marks as well as (optionally) enabling the transmission of XON + * frames. */ + if(hw->fc.send_xon) { IXGB_WRITE_REG(hw, FCRTL, - (hw->fc.low_water | IXGB_FCRTL_XONE)); + (hw->fc.low_water | IXGB_FCRTL_XONE)); } else { IXGB_WRITE_REG(hw, FCRTL, hw->fc.low_water); } @@ -694,9 +723,10 @@ * read command. *****************************************************************************/ uint16_t -ixgb_read_phy_reg(struct ixgb_hw * hw, - uint32_t reg_address, - uint32_t phy_address, uint32_t device_type) +ixgb_read_phy_reg(struct ixgb_hw *hw, + uint32_t reg_address, + uint32_t phy_address, + uint32_t device_type) { uint32_t i; uint32_t data; @@ -721,7 +751,8 @@ ** from the CPU Write to the Ready bit assertion. **************************************************************/ - for (i = 0; i < 10; i++) { + for(i = 0; i < 10; i++) + { udelay(10); command = IXGB_READ_REG(hw, MSCA); @@ -747,7 +778,8 @@ ** from the CPU Write to the Ready bit assertion. **************************************************************/ - for (i = 0; i < 10; i++) { + for(i = 0; i < 10; i++) + { udelay(10); command = IXGB_READ_REG(hw, MSCA); @@ -763,7 +795,7 @@ */ data = IXGB_READ_REG(hw, MSRWD); data >>= IXGB_MSRWD_READ_DATA_SHIFT; - return ((uint16_t) data); + return((uint16_t) data); } /****************************************************************************** @@ -785,8 +817,10 @@ *****************************************************************************/ void ixgb_write_phy_reg(struct ixgb_hw *hw, - uint32_t reg_address, - uint32_t phy_address, uint32_t device_type, uint16_t data) + uint32_t reg_address, + uint32_t phy_address, + uint32_t device_type, + uint16_t data) { uint32_t i; uint32_t command = 0; @@ -796,24 +830,25 @@ ASSERT(device_type <= IXGB_MAX_PHY_DEV_TYPE); /* Put the data in the MDIO Read/Write Data register */ - IXGB_WRITE_REG(hw, MSRWD, (uint32_t) data); + IXGB_WRITE_REG(hw, MSRWD, (uint32_t)data); /* Setup and write the address cycle command */ - command = ((reg_address << IXGB_MSCA_NP_ADDR_SHIFT) | - (device_type << IXGB_MSCA_DEV_TYPE_SHIFT) | - (phy_address << IXGB_MSCA_PHY_ADDR_SHIFT) | - (IXGB_MSCA_ADDR_CYCLE | IXGB_MSCA_MDI_COMMAND)); + command = ((reg_address << IXGB_MSCA_NP_ADDR_SHIFT) | + (device_type << IXGB_MSCA_DEV_TYPE_SHIFT) | + (phy_address << IXGB_MSCA_PHY_ADDR_SHIFT) | + (IXGB_MSCA_ADDR_CYCLE | IXGB_MSCA_MDI_COMMAND)); IXGB_WRITE_REG(hw, MSCA, command); - /************************************************************** - ** Check every 10 usec to see if the address cycle completed - ** The COMMAND bit will clear when the operation is complete. - ** This may take as long as 64 usecs (we'll wait 100 usecs max) - ** from the CPU Write to the Ready bit assertion. - **************************************************************/ + /************************************************************** + ** Check every 10 usec to see if the address cycle completed + ** The COMMAND bit will clear when the operation is complete. + ** This may take as long as 64 usecs (we'll wait 100 usecs max) + ** from the CPU Write to the Ready bit assertion. + **************************************************************/ - for (i = 0; i < 10; i++) { + for(i = 0; i < 10; i++) + { udelay(10); command = IXGB_READ_REG(hw, MSCA); @@ -825,21 +860,22 @@ ASSERT((command & IXGB_MSCA_MDI_COMMAND) == 0); /* Address cycle complete, setup and write the write command */ - command = ((reg_address << IXGB_MSCA_NP_ADDR_SHIFT) | - (device_type << IXGB_MSCA_DEV_TYPE_SHIFT) | - (phy_address << IXGB_MSCA_PHY_ADDR_SHIFT) | - (IXGB_MSCA_WRITE | IXGB_MSCA_MDI_COMMAND)); + command = ((reg_address << IXGB_MSCA_NP_ADDR_SHIFT) | + (device_type << IXGB_MSCA_DEV_TYPE_SHIFT) | + (phy_address << IXGB_MSCA_PHY_ADDR_SHIFT) | + (IXGB_MSCA_WRITE | IXGB_MSCA_MDI_COMMAND)); IXGB_WRITE_REG(hw, MSCA, command); - /************************************************************** - ** Check every 10 usec to see if the read command completed - ** The COMMAND bit will clear when the operation is complete. - ** The write may take as long as 64 usecs (we'll wait 100 usecs max) - ** from the CPU Write to the Ready bit assertion. - **************************************************************/ + /************************************************************** + ** Check every 10 usec to see if the read command completed + ** The COMMAND bit will clear when the operation is complete. + ** The write may take as long as 64 usecs (we'll wait 100 usecs max) + ** from the CPU Write to the Ready bit assertion. + **************************************************************/ - for (i = 0; i < 10; i++) { + for(i = 0; i < 10; i++) + { udelay(10); command = IXGB_READ_REG(hw, MSCA); @@ -860,7 +896,8 @@ * * Called by any function that needs to check the link status of the adapter. *****************************************************************************/ -void ixgb_check_for_link(struct ixgb_hw *hw) +void +ixgb_check_for_link(struct ixgb_hw *hw) { uint32_t status_reg; uint32_t xpcss_reg; @@ -922,14 +959,15 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -void ixgb_clear_hw_cntrs(struct ixgb_hw *hw) +void +ixgb_clear_hw_cntrs(struct ixgb_hw *hw) { volatile uint32_t temp_reg; DEBUGFUNC("ixgb_clear_hw_cntrs"); /* if we are stopped or resetting exit gracefully */ - if (hw->adapter_stopped) { + if(hw->adapter_stopped) { DEBUGOUT("Exiting because the adapter is stopped!!!\n"); return; } @@ -1002,7 +1040,8 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -void ixgb_led_on(struct ixgb_hw *hw) +void +ixgb_led_on(struct ixgb_hw *hw) { uint32_t ctrl0_reg = IXGB_READ_REG(hw, CTRL0); @@ -1017,7 +1056,8 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -void ixgb_led_off(struct ixgb_hw *hw) +void +ixgb_led_off(struct ixgb_hw *hw) { uint32_t ctrl0_reg = IXGB_READ_REG(hw, CTRL0); @@ -1032,18 +1072,19 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -static void ixgb_get_bus_info(struct ixgb_hw *hw) +static void +ixgb_get_bus_info(struct ixgb_hw *hw) { uint32_t status_reg; status_reg = IXGB_READ_REG(hw, STATUS); hw->bus.type = (status_reg & IXGB_STATUS_PCIX_MODE) ? - ixgb_bus_type_pcix : ixgb_bus_type_pci; + ixgb_bus_type_pcix : ixgb_bus_type_pci; if (hw->bus.type == ixgb_bus_type_pci) { hw->bus.speed = (status_reg & IXGB_STATUS_PCI_SPD) ? - ixgb_bus_speed_66 : ixgb_bus_speed_33; + ixgb_bus_speed_66 : ixgb_bus_speed_33; } else { switch (status_reg & IXGB_STATUS_PCIX_SPD_MASK) { case IXGB_STATUS_PCIX_SPD_66: @@ -1062,7 +1103,7 @@ } hw->bus.width = (status_reg & IXGB_STATUS_BUS64) ? - ixgb_bus_width_64 : ixgb_bus_width_32; + ixgb_bus_width_64 : ixgb_bus_width_32; return; } @@ -1073,7 +1114,8 @@ * mac_addr - pointer to MAC address. * *****************************************************************************/ -boolean_t mac_addr_valid(uint8_t * mac_addr) +boolean_t +mac_addr_valid(uint8_t *mac_addr) { boolean_t is_valid = TRUE; DEBUGFUNC("mac_addr_valid"); @@ -1090,9 +1132,11 @@ } /* Reject the zero address */ else if (mac_addr[0] == 0 && - mac_addr[1] == 0 && - mac_addr[2] == 0 && - mac_addr[3] == 0 && mac_addr[4] == 0 && mac_addr[5] == 0) { + mac_addr[1] == 0 && + mac_addr[2] == 0 && + mac_addr[3] == 0 && + mac_addr[4] == 0 && + mac_addr[5] == 0) { DEBUGOUT("MAC address is all zeros\n"); is_valid = FALSE; } @@ -1105,7 +1149,8 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -boolean_t ixgb_link_reset(struct ixgb_hw * hw) +boolean_t +ixgb_link_reset(struct ixgb_hw *hw) { boolean_t link_status = FALSE; uint8_t wait_retries = MAX_RESET_ITERATIONS; @@ -1135,20 +1180,22 @@ * * hw - Struct containing variables accessed by shared code *****************************************************************************/ -void ixgb_optics_reset(struct ixgb_hw *hw) +void +ixgb_optics_reset(struct ixgb_hw *hw) { if (hw->phy_type == ixgb_phy_type_txn17401) { uint16_t mdio_reg; ixgb_write_phy_reg(hw, - MDIO_PMA_PMD_CR1, - IXGB_PHY_ADDRESS, - MDIO_PMA_PMD_DID, MDIO_PMA_PMD_CR1_RESET); - - mdio_reg = ixgb_read_phy_reg(hw, - MDIO_PMA_PMD_CR1, - IXGB_PHY_ADDRESS, - MDIO_PMA_PMD_DID); + MDIO_PMA_PMD_CR1, + IXGB_PHY_ADDRESS, + MDIO_PMA_PMD_DID, + MDIO_PMA_PMD_CR1_RESET); + + mdio_reg = ixgb_read_phy_reg( hw, + MDIO_PMA_PMD_CR1, + IXGB_PHY_ADDRESS, + MDIO_PMA_PMD_DID); } return; diff -Nru a/drivers/net/ixgb/ixgb_hw.h b/drivers/net/ixgb/ixgb_hw.h --- a/drivers/net/ixgb/ixgb_hw.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ixgb/ixgb_hw.h 2005-01-13 16:25:56 -08:00 @@ -616,17 +616,17 @@ #define IXGB_CONTEXT_DESC_STATUS_DD 0x01 /* Filters */ -#define IXGB_RAR_ENTRIES 16 /* Number of entries in Rx Address array */ #define IXGB_MC_TBL_SIZE 128 /* Multicast Filter Table (4096 bits) */ #define IXGB_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */ +#define IXGB_RAR_ENTRIES 3 /* Number of entries in Rx Address array */ #define IXGB_MEMORY_REGISTER_BASE_ADDRESS 0 -#define ENET_HEADER_SIZE 14 -#define ENET_FCS_LENGTH 4 -#define IXGB_MAX_NUM_MULTICAST_ADDRESSES 128 -#define IXGB_MIN_ENET_FRAME_SIZE_WITHOUT_FCS 60 -#define IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS 1514 -#define IXGB_MAX_JUMBO_FRAME_SIZE 0x3F00 +#define ENET_HEADER_SIZE 14 +#define ENET_FCS_LENGTH 4 +#define IXGB_MAX_NUM_MULTICAST_ADDRESSES 128 +#define IXGB_MIN_ENET_FRAME_SIZE_WITHOUT_FCS 60 +#define IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS 1514 +#define IXGB_MAX_JUMBO_FRAME_SIZE 0x3F00 /* Phy Addresses */ #define IXGB_OPTICAL_PHY_ADDR 0x0 /* Optical Module phy address */ @@ -789,32 +789,39 @@ extern boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw); extern boolean_t ixgb_setup_fc(struct ixgb_hw *hw); extern void ixgb_clear_hw_cntrs(struct ixgb_hw *hw); -extern boolean_t mac_addr_valid(uint8_t * mac_addr); +extern boolean_t mac_addr_valid(uint8_t *mac_addr); extern uint16_t ixgb_read_phy_reg(struct ixgb_hw *hw, - uint32_t reg_addr, - uint32_t phy_addr, uint32_t device_type); + uint32_t reg_addr, + uint32_t phy_addr, + uint32_t device_type); extern void ixgb_write_phy_reg(struct ixgb_hw *hw, - uint32_t reg_addr, - uint32_t phy_addr, - uint32_t device_type, uint16_t data); + uint32_t reg_addr, + uint32_t phy_addr, + uint32_t device_type, + uint16_t data); + +extern void ixgb_rar_set(struct ixgb_hw *hw, + uint8_t *addr, + uint32_t index); -extern void ixgb_rar_set(struct ixgb_hw *hw, uint8_t * addr, uint32_t index); /* Filters (multicast, vlan, receive) */ extern void ixgb_mc_addr_list_update(struct ixgb_hw *hw, - uint8_t * mc_addr_list, - uint32_t mc_addr_count, uint32_t pad); + uint8_t *mc_addr_list, + uint32_t mc_addr_count, + uint32_t pad); /* Vfta functions */ extern void ixgb_write_vfta(struct ixgb_hw *hw, - uint32_t offset, uint32_t value); + uint32_t offset, + uint32_t value); extern void ixgb_clear_vfta(struct ixgb_hw *hw); /* Access functions to eeprom data */ -void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, uint8_t * mac_addr); +void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, uint8_t *mac_addr); uint16_t ixgb_get_ee_compatibility(struct ixgb_hw *hw); uint32_t ixgb_get_ee_pba_number(struct ixgb_hw *hw); uint16_t ixgb_get_ee_init_ctrl_reg_1(struct ixgb_hw *hw); @@ -832,6 +839,9 @@ /* Everything else */ void ixgb_led_on(struct ixgb_hw *hw); void ixgb_led_off(struct ixgb_hw *hw); -void ixgb_write_pci_cfg(struct ixgb_hw *hw, uint32_t reg, uint16_t * value); +void ixgb_write_pci_cfg(struct ixgb_hw *hw, + uint32_t reg, + uint16_t * value); -#endif /* _IXGB_HW_H_ */ + +#endif /* _IXGB_HW_H_ */ diff -Nru a/drivers/net/ixgb/ixgb_ids.h b/drivers/net/ixgb/ixgb_ids.h --- a/drivers/net/ixgb/ixgb_ids.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ixgb/ixgb_ids.h 2005-01-13 16:25:56 -08:00 @@ -33,21 +33,16 @@ ** The Device and Vendor IDs for 10 Gigabit MACs **********************************************************************/ -#define INTEL_VENDOR_ID 0x8086 -#define INTEL_SUBVENDOR_ID 0x8086 +#define INTEL_VENDOR_ID 0x8086 +#define INTEL_SUBVENDOR_ID 0x8086 -#define IXGB_DEVICE_ID_82597EX 0x1048 -#define IXGB_DEVICE_ID_82597EX_SR 0x1A48 -#define IXGB_SUBDEVICE_ID_A11F 0xA11F -#define IXGB_SUBDEVICE_ID_A01F 0xA01F +#define IXGB_DEVICE_ID_82597EX 0x1048 +#define IXGB_DEVICE_ID_82597EX_SR 0x1A48 +#define IXGB_DEVICE_ID_82597EX_LR 0x1B48 +#define IXGB_SUBDEVICE_ID_A11F 0xA11F +#define IXGB_SUBDEVICE_ID_A01F 0xA01F -#define IXGB_SUBDEVICE_ID_A15F 0xA15F -#define IXGB_SUBDEVICE_ID_A05F 0xA05F - -#define IXGB_SUBDEVICE_ID_A12F 0xA12F -#define IXGB_SUBDEVICE_ID_A02F 0xA02F - -#endif /* #ifndef _IXGB_IDS_H_ */ +#endif /* #ifndef _IXGB_IDS_H_ */ /* End of File */ diff -Nru a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c --- a/drivers/net/ixgb/ixgb_main.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ixgb/ixgb_main.c 2005-01-13 16:25:56 -08:00 @@ -28,10 +28,23 @@ #include "ixgb.h" +/* Change Log + * 1.0.84 10/26/04 + * - reset buffer_info->dma in Tx resource cleanup logic + * 1.0.83 10/12/04 + * - sparse cleanup - shemminger@osdl.org + * - fix tx resource cleanup logic + */ + char ixgb_driver_name[] = "ixgb"; char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver"; -char ixgb_driver_version[] = "1.0.66-k2"; -char ixgb_copyright[] = "Copyright (c) 2001-2004 Intel Corporation."; +#ifndef CONFIG_IXGB_NAPI +#define DRIVERNAPI +#else +#define DRIVERNAPI "-NAPI" +#endif +char ixgb_driver_version[] = "1.0.87-k2"DRIVERNAPI; +char ixgb_copyright[] = "Copyright (c) 1999-2004 Intel Corporation."; /* ixgb_pci_tbl - PCI Device ID Table * @@ -46,6 +59,8 @@ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX_SR, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX_LR, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* required last entry */ {0,} @@ -55,11 +70,14 @@ /* Local Function Prototypes */ -static inline void ixgb_irq_disable(struct ixgb_adapter *adapter); -static inline void ixgb_irq_enable(struct ixgb_adapter *adapter); int ixgb_up(struct ixgb_adapter *adapter); void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog); void ixgb_reset(struct ixgb_adapter *adapter); +int ixgb_setup_tx_resources(struct ixgb_adapter *adapter); +int ixgb_setup_rx_resources(struct ixgb_adapter *adapter); +void ixgb_free_tx_resources(struct ixgb_adapter *adapter); +void ixgb_free_rx_resources(struct ixgb_adapter *adapter); +void ixgb_update_stats(struct ixgb_adapter *adapter); static int ixgb_init_module(void); static void ixgb_exit_module(void); @@ -68,27 +86,19 @@ static int ixgb_sw_init(struct ixgb_adapter *adapter); static int ixgb_open(struct net_device *netdev); static int ixgb_close(struct net_device *netdev); -static int ixgb_setup_tx_resources(struct ixgb_adapter *adapter); -static int ixgb_setup_rx_resources(struct ixgb_adapter *adapter); static void ixgb_configure_tx(struct ixgb_adapter *adapter); static void ixgb_configure_rx(struct ixgb_adapter *adapter); static void ixgb_setup_rctl(struct ixgb_adapter *adapter); static void ixgb_clean_tx_ring(struct ixgb_adapter *adapter); static void ixgb_clean_rx_ring(struct ixgb_adapter *adapter); -static void ixgb_free_tx_resources(struct ixgb_adapter *adapter); -static void ixgb_free_rx_resources(struct ixgb_adapter *adapter); static void ixgb_set_multi(struct net_device *netdev); static void ixgb_watchdog(unsigned long data); static int ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev); static struct net_device_stats *ixgb_get_stats(struct net_device *netdev); static int ixgb_change_mtu(struct net_device *netdev, int new_mtu); static int ixgb_set_mac(struct net_device *netdev, void *p); -static void ixgb_update_stats(struct ixgb_adapter *adapter); static irqreturn_t ixgb_intr(int irq, void *data, struct pt_regs *regs); static boolean_t ixgb_clean_tx_irq(struct ixgb_adapter *adapter); -static inline void ixgb_rx_checksum(struct ixgb_adapter *adapter, - struct ixgb_rx_desc *rx_desc, - struct sk_buff *skb); #ifdef CONFIG_IXGB_NAPI static int ixgb_clean(struct net_device *netdev, int *budget); static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter, @@ -97,6 +107,7 @@ static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter); #endif static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter); +void ixgb_set_ethtool_ops(struct net_device *netdev); static void ixgb_tx_timeout(struct net_device *dev); static void ixgb_tx_timeout_task(struct net_device *dev); static void ixgb_vlan_rx_register(struct net_device *netdev, @@ -123,7 +134,6 @@ /* Exported from other modules */ extern void ixgb_check_options(struct ixgb_adapter *adapter); -extern struct ethtool_ops ixgb_ethtool_ops; static struct pci_driver ixgb_driver = { .name = ixgb_driver_name, @@ -152,7 +162,8 @@ * loaded. All it does is register with the PCI subsystem. **/ -static int __init ixgb_init_module(void) +static int __init +ixgb_init_module(void) { int ret; printk(KERN_INFO "%s - version %s\n", @@ -161,7 +172,7 @@ printk(KERN_INFO "%s\n", ixgb_copyright); ret = pci_module_init(&ixgb_driver); - if (ret >= 0) { + if(ret >= 0) { register_reboot_notifier(&ixgb_notifier_reboot); } return ret; @@ -176,7 +187,8 @@ * from memory. **/ -static void __exit ixgb_exit_module(void) +static void __exit +ixgb_exit_module(void) { unregister_reboot_notifier(&ixgb_notifier_reboot); pci_unregister_driver(&ixgb_driver); @@ -189,7 +201,8 @@ * @adapter: board private structure **/ -static inline void ixgb_irq_disable(struct ixgb_adapter *adapter) +static inline void +ixgb_irq_disable(struct ixgb_adapter *adapter) { atomic_inc(&adapter->irq_sem); IXGB_WRITE_REG(&adapter->hw, IMC, ~0); @@ -202,17 +215,19 @@ * @adapter: board private structure **/ -static inline void ixgb_irq_enable(struct ixgb_adapter *adapter) +static inline void +ixgb_irq_enable(struct ixgb_adapter *adapter) { - if (atomic_dec_and_test(&adapter->irq_sem)) { + if(atomic_dec_and_test(&adapter->irq_sem)) { IXGB_WRITE_REG(&adapter->hw, IMS, - IXGB_INT_RXT0 | IXGB_INT_RXDMT0 | IXGB_INT_TXDW | - IXGB_INT_RXO | IXGB_INT_LSC); + IXGB_INT_RXT0 | IXGB_INT_RXDMT0 | IXGB_INT_TXDW | + IXGB_INT_RXO | IXGB_INT_LSC); IXGB_WRITE_FLUSH(&adapter->hw); } } -int ixgb_up(struct ixgb_adapter *adapter) +int +ixgb_up(struct ixgb_adapter *adapter) { struct net_device *netdev = adapter->netdev; int err; @@ -230,27 +245,44 @@ ixgb_configure_rx(adapter); ixgb_alloc_rx_buffers(adapter); - if ((err = request_irq(adapter->pdev->irq, &ixgb_intr, - SA_SHIRQ | SA_SAMPLE_RANDOM, - netdev->name, netdev))) +#ifdef CONFIG_PCI_MSI + { + boolean_t pcix = (IXGB_READ_REG(&adapter->hw, STATUS) & + IXGB_STATUS_PCIX_MODE) ? TRUE : FALSE; + adapter->have_msi = TRUE; + + if (!pcix) + adapter->have_msi = FALSE; + else if((err = pci_enable_msi(adapter->pdev))) { + printk (KERN_ERR + "Unable to allocate MSI interrupt Error: %d\n", err); + adapter->have_msi = FALSE; + /* proceed to try to request regular interrupt */ + } + } + +#endif + if((err = request_irq(adapter->pdev->irq, &ixgb_intr, + SA_SHIRQ | SA_SAMPLE_RANDOM, + netdev->name, netdev))) return err; /* disable interrupts and get the hardware into a known state */ IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff); - if ((hw->max_frame_size != max_frame) || - (hw->max_frame_size != - (IXGB_READ_REG(hw, MFS) >> IXGB_MFS_SHIFT))) { + if((hw->max_frame_size != max_frame) || + (hw->max_frame_size != + (IXGB_READ_REG(hw, MFS) >> IXGB_MFS_SHIFT))) { hw->max_frame_size = max_frame; IXGB_WRITE_REG(hw, MFS, hw->max_frame_size << IXGB_MFS_SHIFT); - if (hw->max_frame_size > - IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) { + if(hw->max_frame_size > + IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) { uint32_t ctrl0 = IXGB_READ_REG(hw, CTRL0); - if (!(ctrl0 & IXGB_CTRL0_JFE)) { + if(!(ctrl0 & IXGB_CTRL0_JFE)) { ctrl0 |= IXGB_CTRL0_JFE; IXGB_WRITE_REG(hw, CTRL0, ctrl0); } @@ -263,13 +295,19 @@ return 0; } -void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog) +void +ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog) { struct net_device *netdev = adapter->netdev; ixgb_irq_disable(adapter); free_irq(adapter->pdev->irq, netdev); - if (kill_watchdog) +#ifdef CONFIG_PCI_MSI + if(adapter->have_msi == TRUE) + pci_disable_msi(adapter->pdev); + +#endif + if(kill_watchdog) del_timer_sync(&adapter->watchdog_timer); adapter->link_speed = 0; adapter->link_duplex = 0; @@ -281,11 +319,12 @@ ixgb_clean_rx_ring(adapter); } -void ixgb_reset(struct ixgb_adapter *adapter) +void +ixgb_reset(struct ixgb_adapter *adapter) { ixgb_adapter_stop(&adapter->hw); - if (!ixgb_init_hw(&adapter->hw)) + if(!ixgb_init_hw(&adapter->hw)) IXGB_DBG("ixgb_init_hw failed.\n"); } @@ -302,7 +341,8 @@ **/ static int __devinit -ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) +ixgb_probe(struct pci_dev *pdev, + const struct pci_device_id *ent) { struct net_device *netdev = NULL; struct ixgb_adapter *adapter; @@ -313,26 +353,26 @@ int i; int err; - if ((err = pci_enable_device(pdev))) + if((err = pci_enable_device(pdev))) return err; - if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) { + if(!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) { pci_using_dac = 1; } else { - if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { + if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { IXGB_ERR("No usable DMA configuration, aborting\n"); return err; } pci_using_dac = 0; } - if ((err = pci_request_regions(pdev, ixgb_driver_name))) + if((err = pci_request_regions(pdev, ixgb_driver_name))) return err; pci_set_master(pdev); netdev = alloc_etherdev(sizeof(struct ixgb_adapter)); - if (!netdev) { + if(!netdev) { err = -ENOMEM; goto err_alloc_etherdev; } @@ -350,15 +390,15 @@ mmio_len = pci_resource_len(pdev, BAR_0); adapter->hw.hw_addr = ioremap(mmio_start, mmio_len); - if (!adapter->hw.hw_addr) { + if(!adapter->hw.hw_addr) { err = -EIO; goto err_ioremap; } - for (i = BAR_1; i <= BAR_5; i++) { - if (pci_resource_len(pdev, i) == 0) + for(i = BAR_1; i <= BAR_5; i++) { + if(pci_resource_len(pdev, i) == 0) continue; - if (pci_resource_flags(pdev, i) & IORESOURCE_IO) { + if(pci_resource_flags(pdev, i) & IORESOURCE_IO) { adapter->hw.io_base = pci_resource_start(pdev, i); break; } @@ -371,9 +411,9 @@ netdev->set_multicast_list = &ixgb_set_multi; netdev->set_mac_address = &ixgb_set_mac; netdev->change_mtu = &ixgb_change_mtu; + ixgb_set_ethtool_ops(netdev); netdev->tx_timeout = &ixgb_tx_timeout; netdev->watchdog_timeo = HZ; - SET_ETHTOOL_OPS(netdev, &ixgb_ethtool_ops); #ifdef CONFIG_IXGB_NAPI netdev->poll = &ixgb_clean; netdev->weight = 64; @@ -395,22 +435,24 @@ /* setup the private structure */ - if ((err = ixgb_sw_init(adapter))) + if((err = ixgb_sw_init(adapter))) goto err_sw_init; netdev->features = NETIF_F_SG | - NETIF_F_HW_CSUM | - NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; + NETIF_F_HW_CSUM | + NETIF_F_HW_VLAN_TX | + NETIF_F_HW_VLAN_RX | + NETIF_F_HW_VLAN_FILTER; #ifdef NETIF_F_TSO netdev->features |= NETIF_F_TSO; #endif - if (pci_using_dac) + if(pci_using_dac) netdev->features |= NETIF_F_HIGHDMA; /* make sure the EEPROM is good */ - if (!ixgb_validate_eeprom_checksum(&adapter->hw)) { + if(!ixgb_validate_eeprom_checksum(&adapter->hw)) { printk(KERN_ERR "The EEPROM Checksum Is Not Valid\n"); err = -EIO; goto err_eeprom; @@ -418,7 +460,7 @@ ixgb_get_ee_mac_addr(&adapter->hw, netdev->dev_addr); - if (!is_valid_ether_addr(netdev->dev_addr)) { + if(!is_valid_ether_addr(netdev->dev_addr)) { err = -EIO; goto err_eeprom; } @@ -432,7 +474,7 @@ INIT_WORK(&adapter->tx_timeout_task, (void (*)(void *))ixgb_tx_timeout_task, netdev); - if ((err = register_netdev(netdev))) + if((err = register_netdev(netdev))) goto err_register; /* we're going to reset, so assume we have no link for now */ @@ -441,7 +483,7 @@ netif_stop_queue(netdev); printk(KERN_INFO "%s: Intel(R) PRO/10GbE Network Connection\n", - netdev->name); + netdev->name); ixgb_check_options(adapter); /* reset the hardware with the new settings */ @@ -450,13 +492,13 @@ cards_found++; return 0; - err_register: - err_sw_init: - err_eeprom: +err_register: +err_sw_init: +err_eeprom: iounmap(adapter->hw.hw_addr); - err_ioremap: +err_ioremap: free_netdev(netdev); - err_alloc_etherdev: +err_alloc_etherdev: pci_release_regions(pdev); return err; } @@ -471,7 +513,8 @@ * memory. **/ -static void __devexit ixgb_remove(struct pci_dev *pdev) +static void __devexit +ixgb_remove(struct pci_dev *pdev) { struct net_device *netdev = pci_get_drvdata(pdev); struct ixgb_adapter *adapter = netdev->priv; @@ -493,7 +536,8 @@ * OS network device settings (MTU size). **/ -static int __devinit ixgb_sw_init(struct ixgb_adapter *adapter) +static int __devinit +ixgb_sw_init(struct ixgb_adapter *adapter) { struct ixgb_hw *hw = &adapter->hw; struct net_device *netdev = adapter->netdev; @@ -510,9 +554,10 @@ hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH; - if ((hw->device_id == IXGB_DEVICE_ID_82597EX) - || (hw->device_id == IXGB_DEVICE_ID_82597EX_SR)) - hw->mac_type = ixgb_82597; + if((hw->device_id == IXGB_DEVICE_ID_82597EX) + ||(hw->device_id == IXGB_DEVICE_ID_82597EX_LR) + ||(hw->device_id == IXGB_DEVICE_ID_82597EX_SR)) + hw->mac_type = ixgb_82597; else { /* should never have loaded on this device */ printk(KERN_ERR "ixgb: unsupported device id\n"); @@ -540,31 +585,32 @@ * and the stack is notified that the interface is ready. **/ -static int ixgb_open(struct net_device *netdev) +static int +ixgb_open(struct net_device *netdev) { struct ixgb_adapter *adapter = netdev->priv; int err; /* allocate transmit descriptors */ - if ((err = ixgb_setup_tx_resources(adapter))) + if((err = ixgb_setup_tx_resources(adapter))) goto err_setup_tx; /* allocate receive descriptors */ - if ((err = ixgb_setup_rx_resources(adapter))) + if((err = ixgb_setup_rx_resources(adapter))) goto err_setup_rx; - if ((err = ixgb_up(adapter))) + if((err = ixgb_up(adapter))) goto err_up; return 0; - err_up: +err_up: ixgb_free_rx_resources(adapter); - err_setup_rx: +err_setup_rx: ixgb_free_tx_resources(adapter); - err_setup_tx: +err_setup_tx: ixgb_reset(adapter); return err; @@ -582,7 +628,8 @@ * hardware, and all transmit and receive resources are freed. **/ -static int ixgb_close(struct net_device *netdev) +static int +ixgb_close(struct net_device *netdev) { struct ixgb_adapter *adapter = netdev->priv; @@ -601,15 +648,16 @@ * Return 0 on success, negative on failure **/ -static int ixgb_setup_tx_resources(struct ixgb_adapter *adapter) +int +ixgb_setup_tx_resources(struct ixgb_adapter *adapter) { struct ixgb_desc_ring *txdr = &adapter->tx_ring; struct pci_dev *pdev = adapter->pdev; int size; size = sizeof(struct ixgb_buffer) * txdr->count; - txdr->buffer_info = kmalloc(size, GFP_KERNEL); - if (!txdr->buffer_info) { + txdr->buffer_info = vmalloc(size); + if(!txdr->buffer_info) { return -ENOMEM; } memset(txdr->buffer_info, 0, size); @@ -620,8 +668,8 @@ IXGB_ROUNDUP(txdr->size, 4096); txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); - if (!txdr->desc) { - kfree(txdr->buffer_info); + if(!txdr->desc) { + vfree(txdr->buffer_info); return -ENOMEM; } memset(txdr->desc, 0, txdr->size); @@ -639,7 +687,8 @@ * Configure the Tx unit of the MAC after a reset. **/ -static void ixgb_configure_tx(struct ixgb_adapter *adapter) +static void +ixgb_configure_tx(struct ixgb_adapter *adapter) { uint64_t tdba = adapter->tx_ring.dma; uint32_t tdlen = adapter->tx_ring.count * sizeof(struct ixgb_tx_desc); @@ -679,8 +728,8 @@ /* Setup Transmit Descriptor Settings for this adapter */ adapter->tx_cmd_type = - IXGB_TX_DESC_TYPE - | (adapter->tx_int_delay_enable ? IXGB_TX_DESC_CMD_IDE : 0); + IXGB_TX_DESC_TYPE + | (adapter->tx_int_delay_enable ? IXGB_TX_DESC_CMD_IDE : 0); } /** @@ -690,15 +739,16 @@ * Returns 0 on success, negative on failure **/ -static int ixgb_setup_rx_resources(struct ixgb_adapter *adapter) +int +ixgb_setup_rx_resources(struct ixgb_adapter *adapter) { struct ixgb_desc_ring *rxdr = &adapter->rx_ring; struct pci_dev *pdev = adapter->pdev; int size; size = sizeof(struct ixgb_buffer) * rxdr->count; - rxdr->buffer_info = kmalloc(size, GFP_KERNEL); - if (!rxdr->buffer_info) { + rxdr->buffer_info = vmalloc(size); + if(!rxdr->buffer_info) { return -ENOMEM; } memset(rxdr->buffer_info, 0, size); @@ -710,8 +760,8 @@ rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); - if (!rxdr->desc) { - kfree(rxdr->buffer_info); + if(!rxdr->desc) { + vfree(rxdr->buffer_info); return -ENOMEM; } memset(rxdr->desc, 0, rxdr->size); @@ -727,7 +777,8 @@ * @adapter: Board private structure **/ -static void ixgb_setup_rctl(struct ixgb_adapter *adapter) +static void +ixgb_setup_rctl(struct ixgb_adapter *adapter) { uint32_t rctl; @@ -736,9 +787,9 @@ rctl &= ~(3 << IXGB_RCTL_MO_SHIFT); rctl |= - IXGB_RCTL_BAM | IXGB_RCTL_RDMTS_1_2 | - IXGB_RCTL_RXEN | IXGB_RCTL_CFF | - (adapter->hw.mc_filter_type << IXGB_RCTL_MO_SHIFT); + IXGB_RCTL_BAM | IXGB_RCTL_RDMTS_1_2 | + IXGB_RCTL_RXEN | IXGB_RCTL_CFF | + (adapter->hw.mc_filter_type << IXGB_RCTL_MO_SHIFT); rctl |= IXGB_RCTL_SECRC; @@ -768,7 +819,8 @@ * Configure the Rx unit of the MAC after a reset. **/ -static void ixgb_configure_rx(struct ixgb_adapter *adapter) +static void +ixgb_configure_rx(struct ixgb_adapter *adapter) { uint64_t rdba = adapter->rx_ring.dma; uint32_t rdlen = adapter->rx_ring.count * sizeof(struct ixgb_rx_desc); @@ -797,51 +849,14 @@ IXGB_WRITE_REG(hw, RDH, 0); IXGB_WRITE_REG(hw, RDT, 0); - /* burst 16 or burst when RXT0 */ - rxdctl = RXDCTL_WTHRESH_DEFAULT << IXGB_RXDCTL_WTHRESH_SHIFT - | RXDCTL_HTHRESH_DEFAULT << IXGB_RXDCTL_HTHRESH_SHIFT - | RXDCTL_PTHRESH_DEFAULT << IXGB_RXDCTL_PTHRESH_SHIFT; + /* burst 16 or burst when RXT0*/ + rxdctl = RXDCTL_WTHRESH_DEFAULT << IXGB_RXDCTL_WTHRESH_SHIFT + | RXDCTL_HTHRESH_DEFAULT << IXGB_RXDCTL_HTHRESH_SHIFT + | RXDCTL_PTHRESH_DEFAULT << IXGB_RXDCTL_PTHRESH_SHIFT; IXGB_WRITE_REG(hw, RXDCTL, rxdctl); - if (adapter->raidc) { - uint32_t raidc; - uint8_t poll_threshold; - - /* Poll every rx_int_delay period, if RBD exists - * Receive Backlog Detection is set to - * Rx Descriptors - * max is 0x3F == set to poll when 504 RxDesc left - * min is 0 */ - - /* polling times are 1 == 0.8192us - 2 == 1.6384us - 3 == 3.2768us etc - ... - 511 == 418 us - */ -#define IXGB_RAIDC_POLL_DEFAULT 122 /* set to poll every ~100 us under load - also known as 10000 interrupts / sec */ - - /* divide this by 2^3 (8) to get a register size count */ - poll_threshold = ((adapter->rx_ring.count - 1) >> 3); - /* poll at half of that size */ - poll_threshold >>= 1; - /* make sure its not bigger than our max */ - poll_threshold &= 0x3F; - - raidc = IXGB_RAIDC_EN | /* turn on raidc style moderation */ - IXGB_RAIDC_RXT_GATE | /* don't interrupt with rxt0 while - in RBD mode (polling) */ - (IXGB_RAIDC_POLL_DEFAULT << IXGB_RAIDC_POLL_SHIFT) | - /* this sets the regular "min interrupt delay" */ - (adapter->rx_int_delay << IXGB_RAIDC_DELAY_SHIFT) | - poll_threshold; - - IXGB_WRITE_REG(hw, RAIDC, raidc); - } - /* Enable Receive Checksum Offload for TCP and UDP */ - if (adapter->rx_csum == TRUE) { + if(adapter->rx_csum == TRUE) { rxcsum = IXGB_READ_REG(hw, RXCSUM); rxcsum |= IXGB_RXCSUM_TUOFL; IXGB_WRITE_REG(hw, RXCSUM, rxcsum); @@ -859,13 +874,14 @@ * Free all transmit software resources **/ -static void ixgb_free_tx_resources(struct ixgb_adapter *adapter) +void +ixgb_free_tx_resources(struct ixgb_adapter *adapter) { struct pci_dev *pdev = adapter->pdev; ixgb_clean_tx_ring(adapter); - kfree(adapter->tx_ring.buffer_info); + vfree(adapter->tx_ring.buffer_info); adapter->tx_ring.buffer_info = NULL; pci_free_consistent(pdev, adapter->tx_ring.size, @@ -874,33 +890,42 @@ adapter->tx_ring.desc = NULL; } +static inline void +ixgb_unmap_and_free_tx_resource(struct ixgb_adapter *adapter, + struct ixgb_buffer *buffer_info) +{ + struct pci_dev *pdev = adapter->pdev; + if(buffer_info->dma) { + pci_unmap_page(pdev, + buffer_info->dma, + buffer_info->length, + PCI_DMA_TODEVICE); + buffer_info->dma = 0; + } + if(buffer_info->skb) { + dev_kfree_skb_any(buffer_info->skb); + buffer_info->skb = NULL; + } +} + /** * ixgb_clean_tx_ring - Free Tx Buffers * @adapter: board private structure **/ -static void ixgb_clean_tx_ring(struct ixgb_adapter *adapter) +static void +ixgb_clean_tx_ring(struct ixgb_adapter *adapter) { struct ixgb_desc_ring *tx_ring = &adapter->tx_ring; struct ixgb_buffer *buffer_info; - struct pci_dev *pdev = adapter->pdev; unsigned long size; unsigned int i; /* Free all the Tx ring sk_buffs */ - for (i = 0; i < tx_ring->count; i++) { + for(i = 0; i < tx_ring->count; i++) { buffer_info = &tx_ring->buffer_info[i]; - if (buffer_info->skb) { - - pci_unmap_page(pdev, - buffer_info->dma, - buffer_info->length, PCI_DMA_TODEVICE); - - dev_kfree_skb(buffer_info->skb); - - buffer_info->skb = NULL; - } + ixgb_unmap_and_free_tx_resource(adapter, buffer_info); } size = sizeof(struct ixgb_buffer) * tx_ring->count; @@ -924,14 +949,15 @@ * Free all receive software resources **/ -static void ixgb_free_rx_resources(struct ixgb_adapter *adapter) +void +ixgb_free_rx_resources(struct ixgb_adapter *adapter) { struct ixgb_desc_ring *rx_ring = &adapter->rx_ring; struct pci_dev *pdev = adapter->pdev; ixgb_clean_rx_ring(adapter); - kfree(rx_ring->buffer_info); + vfree(rx_ring->buffer_info); rx_ring->buffer_info = NULL; pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma); @@ -944,7 +970,8 @@ * @adapter: board private structure **/ -static void ixgb_clean_rx_ring(struct ixgb_adapter *adapter) +static void +ixgb_clean_rx_ring(struct ixgb_adapter *adapter) { struct ixgb_desc_ring *rx_ring = &adapter->rx_ring; struct ixgb_buffer *buffer_info; @@ -954,9 +981,9 @@ /* Free all the Rx ring sk_buffs */ - for (i = 0; i < rx_ring->count; i++) { + for(i = 0; i < rx_ring->count; i++) { buffer_info = &rx_ring->buffer_info[i]; - if (buffer_info->skb) { + if(buffer_info->skb) { pci_unmap_single(pdev, buffer_info->dma, @@ -991,12 +1018,13 @@ * Returns 0 on success, negative on failure **/ -static int ixgb_set_mac(struct net_device *netdev, void *p) +static int +ixgb_set_mac(struct net_device *netdev, void *p) { struct ixgb_adapter *adapter = netdev->priv; struct sockaddr *addr = p; - if (!is_valid_ether_addr(addr->sa_data)) + if(!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); @@ -1016,7 +1044,8 @@ * promiscuous mode, and all-multi behavior. **/ -static void ixgb_set_multi(struct net_device *netdev) +static void +ixgb_set_multi(struct net_device *netdev) { struct ixgb_adapter *adapter = netdev->priv; struct ixgb_hw *hw = &adapter->hw; @@ -1028,16 +1057,16 @@ rctl = IXGB_READ_REG(hw, RCTL); - if (netdev->flags & IFF_PROMISC) { + if(netdev->flags & IFF_PROMISC) { rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE); - } else if (netdev->flags & IFF_ALLMULTI) { + } else if(netdev->flags & IFF_ALLMULTI) { rctl |= IXGB_RCTL_MPE; rctl &= ~IXGB_RCTL_UPE; } else { rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE); } - if (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES) { + if(netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES) { rctl |= IXGB_RCTL_MPE; IXGB_WRITE_REG(hw, RCTL, rctl); } else { @@ -1045,10 +1074,10 @@ IXGB_WRITE_REG(hw, RCTL, rctl); - for (i = 0, mc_ptr = netdev->mc_list; mc_ptr; - i++, mc_ptr = mc_ptr->next) + for(i = 0, mc_ptr = netdev->mc_list; mc_ptr; + i++, mc_ptr = mc_ptr->next) memcpy(&mta[i * IXGB_ETH_LENGTH_OF_ADDRESS], - mc_ptr->dmi_addr, IXGB_ETH_LENGTH_OF_ADDRESS); + mc_ptr->dmi_addr, IXGB_ETH_LENGTH_OF_ADDRESS); ixgb_mc_addr_list_update(hw, mta, netdev->mc_count, 0); } @@ -1059,7 +1088,8 @@ * @data: pointer to netdev cast into an unsigned long **/ -static void ixgb_watchdog(unsigned long data) +static void +ixgb_watchdog(unsigned long data) { struct ixgb_adapter *adapter = (struct ixgb_adapter *)data; struct net_device *netdev = adapter->netdev; @@ -1073,21 +1103,22 @@ netif_stop_queue(netdev); } - if (adapter->hw.link_up) { - if (!netif_carrier_ok(netdev)) { + if(adapter->hw.link_up) { + if(!netif_carrier_ok(netdev)) { printk(KERN_INFO "ixgb: %s NIC Link is Up %d Mbps %s\n", - netdev->name, 10000, "Full Duplex"); + netdev->name, 10000, "Full Duplex"); adapter->link_speed = 10000; adapter->link_duplex = FULL_DUPLEX; netif_carrier_on(netdev); netif_wake_queue(netdev); } } else { - if (netif_carrier_ok(netdev)) { + if(netif_carrier_ok(netdev)) { adapter->link_speed = 0; adapter->link_duplex = 0; printk(KERN_INFO - "ixgb: %s NIC Link is Down\n", netdev->name); + "ixgb: %s NIC Link is Down\n", + netdev->name); netif_carrier_off(netdev); netif_stop_queue(netdev); @@ -1096,8 +1127,8 @@ ixgb_update_stats(adapter); - if (!netif_carrier_ok(netdev)) { - if (IXGB_DESC_UNUSED(txdr) + 1 < txdr->count) { + if(!netif_carrier_ok(netdev)) { + if(IXGB_DESC_UNUSED(txdr) + 1 < txdr->count) { /* We've lost link, so the controller stops DMA, * but we've got queued Tx work that's never going * to get done, so reset controller to flush Tx. @@ -1108,9 +1139,9 @@ /* Early detection of hung controller */ i = txdr->next_to_clean; - if (txdr->buffer_info[i].dma && - time_after(jiffies, txdr->buffer_info[i].time_stamp + HZ) && - !(IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_TXOFF)) + if(txdr->buffer_info[i].dma && + time_after(jiffies, txdr->buffer_info[i].time_stamp + HZ) && + !(IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_TXOFF)) netif_stop_queue(netdev); /* generate an interrupt to force clean up of any stragglers */ @@ -1133,7 +1164,7 @@ uint8_t ipcss, ipcso, tucss, tucso, hdr_len; uint16_t ipcse, tucse, mss; - if (likely(skb_shinfo(skb)->tso_size)) { + if(likely(skb_shinfo(skb)->tso_size)) { hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); mss = skb_shinfo(skb)->tso_size; skb->nh.iph->tot_len = 0; @@ -1160,22 +1191,16 @@ context_desc->mss = cpu_to_le16(mss); context_desc->hdr_len = hdr_len; context_desc->status = 0; - context_desc->cmd_type_len = cpu_to_le32(IXGB_CONTEXT_DESC_TYPE - | - IXGB_CONTEXT_DESC_CMD_TSE - | - IXGB_CONTEXT_DESC_CMD_IP - | - IXGB_CONTEXT_DESC_CMD_TCP - | - IXGB_CONTEXT_DESC_CMD_RS - | - IXGB_CONTEXT_DESC_CMD_IDE - | (skb->len - - (hdr_len))); + context_desc->cmd_type_len = cpu_to_le32( + IXGB_CONTEXT_DESC_TYPE + | IXGB_CONTEXT_DESC_CMD_TSE + | IXGB_CONTEXT_DESC_CMD_IP + | IXGB_CONTEXT_DESC_CMD_TCP + | IXGB_CONTEXT_DESC_CMD_RS + | IXGB_CONTEXT_DESC_CMD_IDE + | (skb->len - (hdr_len))); - if (++i == adapter->tx_ring.count) - i = 0; + if(++i == adapter->tx_ring.count) i = 0; adapter->tx_ring.next_to_use = i; return TRUE; @@ -1192,7 +1217,7 @@ unsigned int i; uint8_t css, cso; - if (likely(skb->ip_summed == CHECKSUM_HW)) { + if(likely(skb->ip_summed == CHECKSUM_HW)) { css = skb->h.raw - skb->data; cso = (skb->h.raw + skb->csum) - skb->data; @@ -1203,16 +1228,16 @@ context_desc->tucso = cso; context_desc->tucse = 0; /* zero out any previously existing data in one instruction */ - *(uint32_t *) & (context_desc->ipcss) = 0; + *(uint32_t *)&(context_desc->ipcss) = 0; context_desc->status = 0; context_desc->hdr_len = 0; context_desc->mss = 0; context_desc->cmd_type_len = - cpu_to_le32(IXGB_CONTEXT_DESC_TYPE - | IXGB_TX_DESC_CMD_RS | IXGB_TX_DESC_CMD_IDE); + cpu_to_le32(IXGB_CONTEXT_DESC_TYPE + | IXGB_TX_DESC_CMD_RS + | IXGB_TX_DESC_CMD_IDE); - if (++i == adapter->tx_ring.count) - i = 0; + if(++i == adapter->tx_ring.count) i = 0; adapter->tx_ring.next_to_use = i; return TRUE; @@ -1239,45 +1264,46 @@ i = tx_ring->next_to_use; - while (len) { + while(len) { buffer_info = &tx_ring->buffer_info[i]; size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE); buffer_info->length = size; buffer_info->dma = - pci_map_single(adapter->pdev, - skb->data + offset, size, PCI_DMA_TODEVICE); + pci_map_single(adapter->pdev, + skb->data + offset, + size, + PCI_DMA_TODEVICE); buffer_info->time_stamp = jiffies; len -= size; offset += size; count++; - if (++i == tx_ring->count) - i = 0; + if(++i == tx_ring->count) i = 0; } - for (f = 0; f < nr_frags; f++) { + for(f = 0; f < nr_frags; f++) { struct skb_frag_struct *frag; frag = &skb_shinfo(skb)->frags[f]; len = frag->size; offset = 0; - while (len) { + while(len) { buffer_info = &tx_ring->buffer_info[i]; size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE); buffer_info->length = size; buffer_info->dma = - pci_map_page(adapter->pdev, - frag->page, - frag->page_offset + offset, - size, PCI_DMA_TODEVICE); + pci_map_page(adapter->pdev, + frag->page, + frag->page_offset + offset, + size, + PCI_DMA_TODEVICE); buffer_info->time_stamp = jiffies; len -= size; offset += size; count++; - if (++i == tx_ring->count) - i = 0; + if(++i == tx_ring->count) i = 0; } } i = (i == 0) ? tx_ring->count - 1 : i - 1; @@ -1288,8 +1314,7 @@ } static inline void -ixgb_tx_queue(struct ixgb_adapter *adapter, int count, int vlan_id, - int tx_flags) +ixgb_tx_queue(struct ixgb_adapter *adapter, int count, int vlan_id,int tx_flags) { struct ixgb_desc_ring *tx_ring = &adapter->tx_ring; struct ixgb_tx_desc *tx_desc = NULL; @@ -1299,36 +1324,35 @@ uint8_t popts = 0; unsigned int i; - if (tx_flags & IXGB_TX_FLAGS_TSO) { + if(tx_flags & IXGB_TX_FLAGS_TSO) { cmd_type_len |= IXGB_TX_DESC_CMD_TSE; popts |= (IXGB_TX_DESC_POPTS_IXSM | IXGB_TX_DESC_POPTS_TXSM); } - if (tx_flags & IXGB_TX_FLAGS_CSUM) + if(tx_flags & IXGB_TX_FLAGS_CSUM) popts |= IXGB_TX_DESC_POPTS_TXSM; - if (tx_flags & IXGB_TX_FLAGS_VLAN) { + if(tx_flags & IXGB_TX_FLAGS_VLAN) { cmd_type_len |= IXGB_TX_DESC_CMD_VLE; } i = tx_ring->next_to_use; - while (count--) { + while(count--) { buffer_info = &tx_ring->buffer_info[i]; tx_desc = IXGB_TX_DESC(*tx_ring, i); tx_desc->buff_addr = cpu_to_le64(buffer_info->dma); tx_desc->cmd_type_len = - cpu_to_le32(cmd_type_len | buffer_info->length); + cpu_to_le32(cmd_type_len | buffer_info->length); tx_desc->status = status; tx_desc->popts = popts; tx_desc->vlan = cpu_to_le16(vlan_id); - if (++i == tx_ring->count) - i = 0; + if(++i == tx_ring->count) i = 0; } - tx_desc->cmd_type_len |= cpu_to_le32(IXGB_TX_DESC_CMD_EOP - | IXGB_TX_DESC_CMD_RS); + tx_desc->cmd_type_len |= cpu_to_le32(IXGB_TX_DESC_CMD_EOP + | IXGB_TX_DESC_CMD_RS ); /* Force memory writes to complete before letting h/w * know there are new descriptors to fetch. (Only @@ -1346,7 +1370,8 @@ #define DESC_NEEDED TXD_USE_COUNT(IXGB_MAX_DATA_PER_TXD) + \ MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1 -static int ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev) +static int +ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev) { struct ixgb_adapter *adapter = netdev->priv; unsigned int first; @@ -1354,33 +1379,33 @@ unsigned long flags; int vlan_id = 0; - if (skb->len <= 0) { + if(skb->len <= 0) { dev_kfree_skb_any(skb); return 0; } spin_lock_irqsave(&adapter->tx_lock, flags); - if (unlikely(IXGB_DESC_UNUSED(&adapter->tx_ring) < DESC_NEEDED)) { + if(unlikely(IXGB_DESC_UNUSED(&adapter->tx_ring) < DESC_NEEDED)) { netif_stop_queue(netdev); spin_unlock_irqrestore(&adapter->tx_lock, flags); return 1; } spin_unlock_irqrestore(&adapter->tx_lock, flags); - if (adapter->vlgrp && vlan_tx_tag_present(skb)) { + if(adapter->vlgrp && vlan_tx_tag_present(skb)) { tx_flags |= IXGB_TX_FLAGS_VLAN; vlan_id = vlan_tx_tag_get(skb); } first = adapter->tx_ring.next_to_use; - - if (ixgb_tso(adapter, skb)) + + if(ixgb_tso(adapter, skb)) tx_flags |= IXGB_TX_FLAGS_TSO; - else if (ixgb_tx_csum(adapter, skb)) + else if(ixgb_tx_csum(adapter, skb)) tx_flags |= IXGB_TX_FLAGS_CSUM; ixgb_tx_queue(adapter, ixgb_tx_map(adapter, skb, first), vlan_id, - tx_flags); + tx_flags); netdev->trans_start = jiffies; @@ -1392,7 +1417,8 @@ * @netdev: network interface device structure **/ -static void ixgb_tx_timeout(struct net_device *netdev) +static void +ixgb_tx_timeout(struct net_device *netdev) { struct ixgb_adapter *adapter = netdev->priv; @@ -1400,14 +1426,13 @@ schedule_work(&adapter->tx_timeout_task); } -static void ixgb_tx_timeout_task(struct net_device *netdev) +static void +ixgb_tx_timeout_task(struct net_device *netdev) { struct ixgb_adapter *adapter = netdev->priv; - netif_device_detach(netdev); ixgb_down(adapter, TRUE); ixgb_up(adapter); - netif_device_attach(netdev); } /** @@ -1418,7 +1443,8 @@ * The statistics are actually updated from the timer callback. **/ -static struct net_device_stats *ixgb_get_stats(struct net_device *netdev) +static struct net_device_stats * +ixgb_get_stats(struct net_device *netdev) { struct ixgb_adapter *adapter = netdev->priv; @@ -1433,27 +1459,28 @@ * Returns 0 on success, negative on failure **/ -static int ixgb_change_mtu(struct net_device *netdev, int new_mtu) +static int +ixgb_change_mtu(struct net_device *netdev, int new_mtu) { struct ixgb_adapter *adapter = netdev->priv; - uint32_t old_mtu = adapter->rx_buffer_len; int max_frame = new_mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH; + int old_max_frame = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH; + - if ((max_frame < IXGB_MIN_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) - || (max_frame > IXGB_MAX_JUMBO_FRAME_SIZE + ENET_FCS_LENGTH)) { + if((max_frame < IXGB_MIN_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) + || (max_frame > IXGB_MAX_JUMBO_FRAME_SIZE + ENET_FCS_LENGTH)) { IXGB_ERR("Invalid MTU setting\n"); return -EINVAL; } - if ((max_frame <= - IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) - || (max_frame <= IXGB_RXBUFFER_2048)) { + if((max_frame <= IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) + || (max_frame <= IXGB_RXBUFFER_2048)) { adapter->rx_buffer_len = IXGB_RXBUFFER_2048; - } else if (max_frame <= IXGB_RXBUFFER_4096) { + } else if(max_frame <= IXGB_RXBUFFER_4096) { adapter->rx_buffer_len = IXGB_RXBUFFER_4096; - } else if (max_frame <= IXGB_RXBUFFER_8192) { + } else if(max_frame <= IXGB_RXBUFFER_8192) { adapter->rx_buffer_len = IXGB_RXBUFFER_8192; } else { @@ -1462,7 +1489,7 @@ netdev->mtu = new_mtu; - if (old_mtu != adapter->rx_buffer_len && netif_running(netdev)) { + if(old_max_frame != max_frame && netif_running(netdev)) { ixgb_down(adapter, TRUE); ixgb_up(adapter); @@ -1476,7 +1503,8 @@ * @adapter: board private structure **/ -static void ixgb_update_stats(struct ixgb_adapter *adapter) +void +ixgb_update_stats(struct ixgb_adapter *adapter) { adapter->stats.tprl += IXGB_READ_REG(&adapter->hw, TPRL); adapter->stats.tprh += IXGB_READ_REG(&adapter->hw, TPRH); @@ -1585,31 +1613,33 @@ * @pt_regs: CPU registers structure **/ -static irqreturn_t ixgb_intr(int irq, void *data, struct pt_regs *regs) +static irqreturn_t +ixgb_intr(int irq, void *data, struct pt_regs *regs) { struct net_device *netdev = data; struct ixgb_adapter *adapter = netdev->priv; struct ixgb_hw *hw = &adapter->hw; - uint32_t icr = IXGB_READ_REG(&adapter->hw, ICR); + uint32_t icr = IXGB_READ_REG(hw, ICR); #ifndef CONFIG_IXGB_NAPI unsigned int i; #endif - if (unlikely(!icr)) - return IRQ_NONE; /* Not our interrupt */ + if(unlikely(!icr)) + return IRQ_NONE; /* Not our interrupt */ - if (unlikely(icr & (IXGB_INT_RXSEQ | IXGB_INT_LSC))) { + if(unlikely(icr & (IXGB_INT_RXSEQ | IXGB_INT_LSC))) { mod_timer(&adapter->watchdog_timer, jiffies); } + #ifdef CONFIG_IXGB_NAPI - if (netif_rx_schedule_prep(netdev)) { + if(netif_rx_schedule_prep(netdev)) { /* Disable interrupts and register for poll. The flush - of the posted write is intentionally left out. - */ + of the posted write is intentionally left out. + */ atomic_inc(&adapter->irq_sem); - IXGB_WRITE_REG(hw, IMC, ~0); + IXGB_WRITE_REG(&adapter->hw, IMC, ~0); __netif_rx_schedule(netdev); } #else @@ -1621,16 +1651,7 @@ if(!ixgb_clean_rx_irq(adapter) & !ixgb_clean_tx_irq(adapter)) break; - /* if RAIDC:EN == 1 and ICR:RXDMT0 == 1, we need to - * set IMS:RXDMT0 to 1 to restart the RBD timer (POLL) - */ - if ((icr & IXGB_INT_RXDMT0) && adapter->raidc) { - /* ready the timer by writing the clear reg */ - IXGB_WRITE_REG(hw, IMC, IXGB_INT_RXDMT0); - /* now restart it, h/w will decide if its necessary */ - IXGB_WRITE_REG(hw, IMS, IXGB_INT_RXDMT0); - } -#endif +#endif return IRQ_HANDLED; } @@ -1640,25 +1661,32 @@ * @adapter: board private structure **/ -static int ixgb_clean(struct net_device *netdev, int *budget) +static int +ixgb_clean(struct net_device *netdev, int *budget) { struct ixgb_adapter *adapter = netdev->priv; int work_to_do = min(*budget, netdev->quota); + int tx_cleaned; int work_done = 0; + + if (!netif_carrier_ok(netdev)) + goto quit_polling; - ixgb_clean_tx_irq(adapter); + tx_cleaned = ixgb_clean_tx_irq(adapter); ixgb_clean_rx_irq(adapter, &work_done, work_to_do); *budget -= work_done; netdev->quota -= work_done; - - if (work_done < work_to_do || !netif_running(netdev)) { - netif_rx_complete(netdev); - /* RAIDC will be automatically restarted by irq_enable */ + + /* if no Tx cleanup and not enough Rx work done, exit the polling mode */ + if((!tx_cleaned && (work_done < work_to_do)) || + !netif_running(netdev)) { +quit_polling: netif_rx_complete(netdev); ixgb_irq_enable(adapter); + return 0; } - return (work_done >= work_to_do); + return 1; } #endif @@ -1667,11 +1695,11 @@ * @adapter: board private structure **/ -static boolean_t ixgb_clean_tx_irq(struct ixgb_adapter *adapter) +static boolean_t +ixgb_clean_tx_irq(struct ixgb_adapter *adapter) { struct ixgb_desc_ring *tx_ring = &adapter->tx_ring; struct net_device *netdev = adapter->netdev; - struct pci_dev *pdev = adapter->pdev; struct ixgb_tx_desc *tx_desc, *eop_desc; struct ixgb_buffer *buffer_info; unsigned int i, eop; @@ -1681,9 +1709,9 @@ eop = tx_ring->buffer_info[i].next_to_watch; eop_desc = IXGB_TX_DESC(*tx_ring, eop); - while (eop_desc->status & IXGB_TX_DESC_STATUS_DD) { + while(eop_desc->status & IXGB_TX_DESC_STATUS_DD) { - for (cleaned = FALSE; !cleaned;) { + for(cleaned = FALSE; !cleaned; ) { tx_desc = IXGB_TX_DESC(*tx_ring, i); buffer_info = &tx_ring->buffer_info[i]; @@ -1692,28 +1720,12 @@ IXGB_TX_DESC_POPTS_IXSM)) adapter->hw_csum_tx_good++; - if (buffer_info->dma) { - - pci_unmap_page(pdev, - buffer_info->dma, - buffer_info->length, - PCI_DMA_TODEVICE); - - buffer_info->dma = 0; - } - - if (buffer_info->skb) { - - dev_kfree_skb_any(buffer_info->skb); + ixgb_unmap_and_free_tx_resource(adapter, buffer_info); - buffer_info->skb = NULL; - } - - *(uint32_t *) & (tx_desc->status) = 0; + *(uint32_t *)&(tx_desc->status) = 0; cleaned = (i == eop); - if (++i == tx_ring->count) - i = 0; + if(++i == tx_ring->count) i = 0; } eop = tx_ring->buffer_info[i].next_to_watch; @@ -1723,8 +1735,8 @@ tx_ring->next_to_clean = i; spin_lock(&adapter->tx_lock); - if (cleaned && netif_queue_stopped(netdev) && netif_carrier_ok(netdev) - && (IXGB_DESC_UNUSED(tx_ring) > IXGB_TX_QUEUE_WAKE)) { + if(cleaned && netif_queue_stopped(netdev) && netif_carrier_ok(netdev) && + (IXGB_DESC_UNUSED(tx_ring) > IXGB_TX_QUEUE_WAKE)) { netif_wake_queue(netdev); } @@ -1742,20 +1754,21 @@ static inline void ixgb_rx_checksum(struct ixgb_adapter *adapter, - struct ixgb_rx_desc *rx_desc, struct sk_buff *skb) + struct ixgb_rx_desc *rx_desc, + struct sk_buff *skb) { /* Ignore Checksum bit is set OR * TCP Checksum has not been calculated */ - if ((rx_desc->status & IXGB_RX_DESC_STATUS_IXSM) || - (!(rx_desc->status & IXGB_RX_DESC_STATUS_TCPCS))) { + if((rx_desc->status & IXGB_RX_DESC_STATUS_IXSM) || + (!(rx_desc->status & IXGB_RX_DESC_STATUS_TCPCS))) { skb->ip_summed = CHECKSUM_NONE; return; } /* At this point we know the hardware did the TCP checksum */ /* now look at the TCP checksum error bit */ - if (rx_desc->errors & IXGB_RX_DESC_ERRORS_TCPE) { + if(rx_desc->errors & IXGB_RX_DESC_ERRORS_TCPE) { /* let the stack verify checksum errors */ skb->ip_summed = CHECKSUM_NONE; adapter->hw_csum_rx_error++; @@ -1792,18 +1805,22 @@ rx_desc = IXGB_RX_DESC(*rx_ring, i); buffer_info = &rx_ring->buffer_info[i]; - while (rx_desc->status & IXGB_RX_DESC_STATUS_DD) { + while(rx_desc->status & IXGB_RX_DESC_STATUS_DD) { +#ifdef CONFIG_IXGB_NAPI + if(*work_done >= work_to_do) + break; + + (*work_done)++; +#endif skb = buffer_info->skb; prefetch(skb->data); - if (++i == rx_ring->count) - i = 0; + if(++i == rx_ring->count) i = 0; next_rxd = IXGB_RX_DESC(*rx_ring, i); prefetch(next_rxd); - if ((j = i + 1) == rx_ring->count) - j = 0; + if((j = i + 1) == rx_ring->count) j = 0; next2_buffer = &rx_ring->buffer_info[j]; prefetch(next2_buffer); @@ -1811,27 +1828,22 @@ next_skb = next_buffer->skb; prefetch(next_skb); -#ifdef CONFIG_IXGB_NAPI - if (*work_done >= work_to_do) - break; - - (*work_done)++; -#endif cleaned = TRUE; pci_unmap_single(pdev, buffer_info->dma, - buffer_info->length, PCI_DMA_FROMDEVICE); + buffer_info->length, + PCI_DMA_FROMDEVICE); length = le16_to_cpu(rx_desc->length); - if (unlikely(!(rx_desc->status & IXGB_RX_DESC_STATUS_EOP))) { + if(unlikely(!(rx_desc->status & IXGB_RX_DESC_STATUS_EOP))) { /* All receives must fit into a single buffer */ IXGB_DBG("Receive packet consumed multiple buffers " - "length<%x>\n", length); + "length<%x>\n", length); dev_kfree_skb_irq(skb); rx_desc->status = 0; @@ -1864,26 +1876,22 @@ skb->protocol = eth_type_trans(skb, netdev); #ifdef CONFIG_IXGB_NAPI - if (adapter->vlgrp - && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) { + if(adapter->vlgrp && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) { vlan_hwaccel_receive_skb(skb, adapter->vlgrp, - le16_to_cpu(rx_desc-> - special & - IXGB_RX_DESC_SPECIAL_VLAN_MASK)); + le16_to_cpu(rx_desc->special) & + IXGB_RX_DESC_SPECIAL_VLAN_MASK); } else { netif_receive_skb(skb); } -#else /* CONFIG_IXGB_NAPI */ - if (adapter->vlgrp - && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) { +#else /* CONFIG_IXGB_NAPI */ + if(adapter->vlgrp && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) { vlan_hwaccel_rx(skb, adapter->vlgrp, - le16_to_cpu(rx_desc-> - special & - IXGB_RX_DESC_SPECIAL_VLAN_MASK)); + le16_to_cpu(rx_desc->special) & + IXGB_RX_DESC_SPECIAL_VLAN_MASK); } else { netif_rx(skb); } -#endif /* CONFIG_IXGB_NAPI */ +#endif /* CONFIG_IXGB_NAPI */ netdev->last_rx = jiffies; rx_desc->status = 0; @@ -1905,7 +1913,8 @@ * @adapter: address of board private structure **/ -static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter) +static void +ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter) { struct ixgb_desc_ring *rx_ring = &adapter->rx_ring; struct net_device *netdev = adapter->netdev; @@ -1921,19 +1930,15 @@ buffer_info = &rx_ring->buffer_info[i]; cleancount = IXGB_DESC_UNUSED(rx_ring); - /* lessen this to 4 if we're - * in the midst of raidc and rbd is occuring - * because we don't want to delay returning buffers when low - */ - num_group_tail_writes = adapter->raidc ? 4 : IXGB_RX_BUFFER_WRITE; + num_group_tail_writes = IXGB_RX_BUFFER_WRITE; /* leave one descriptor unused */ - while (--cleancount > 0) { + while(--cleancount > 0) { rx_desc = IXGB_RX_DESC(*rx_ring, i); skb = dev_alloc_skb(adapter->rx_buffer_len + NET_IP_ALIGN); - if (unlikely(!skb)) { + if(unlikely(!skb)) { /* Better luck next round */ break; } @@ -1949,13 +1954,14 @@ buffer_info->skb = skb; buffer_info->length = adapter->rx_buffer_len; buffer_info->dma = - pci_map_single(pdev, + pci_map_single(pdev, skb->data, - adapter->rx_buffer_len, PCI_DMA_FROMDEVICE); + adapter->rx_buffer_len, + PCI_DMA_FROMDEVICE); rx_desc->buff_addr = cpu_to_le64(buffer_info->dma); - if ((i & ~(num_group_tail_writes - 1)) == i) { + if((i & ~(num_group_tail_writes- 1)) == i) { /* Force memory writes to complete before letting h/w * know there are new descriptors to fetch. (Only * applicable for weak-ordered memory model archs, @@ -1965,8 +1971,7 @@ IXGB_WRITE_REG(&adapter->hw, RDT, i); } - if (++i == rx_ring->count) - i = 0; + if(++i == rx_ring->count) i = 0; buffer_info = &rx_ring->buffer_info[i]; } @@ -1988,7 +1993,7 @@ ixgb_irq_disable(adapter); adapter->vlgrp = grp; - if (grp) { + if(grp) { /* enable VLAN tag insert/strip */ ctrl = IXGB_READ_REG(&adapter->hw, CTRL0); ctrl |= IXGB_CTRL0_VME; @@ -2017,7 +2022,8 @@ ixgb_irq_enable(adapter); } -static void ixgb_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid) +static void +ixgb_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid) { struct ixgb_adapter *adapter = netdev->priv; uint32_t vfta, index; @@ -2030,19 +2036,20 @@ ixgb_write_vfta(&adapter->hw, index, vfta); } -static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid) +static void +ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid) { struct ixgb_adapter *adapter = netdev->priv; uint32_t vfta, index; ixgb_irq_disable(adapter); - if (adapter->vlgrp) + if(adapter->vlgrp) adapter->vlgrp->vlan_devices[vid] = NULL; ixgb_irq_enable(adapter); - /* remove VID from filter table */ + /* remove VID from filter table*/ index = (vid >> 5) & 0x7F; vfta = IXGB_READ_REG_ARRAY(&adapter->hw, VFTA, index); @@ -2050,14 +2057,15 @@ ixgb_write_vfta(&adapter->hw, index, vfta); } -static void ixgb_restore_vlan(struct ixgb_adapter *adapter) +static void +ixgb_restore_vlan(struct ixgb_adapter *adapter) { ixgb_vlan_rx_register(adapter->netdev, adapter->vlgrp); - if (adapter->vlgrp) { + if(adapter->vlgrp) { uint16_t vid; - for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { - if (!adapter->vlgrp->vlan_devices[vid]) + for(vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { + if(!adapter->vlgrp->vlan_devices[vid]) continue; ixgb_vlan_rx_add_vid(adapter->netdev, vid); } @@ -2075,7 +2083,7 @@ { struct pci_dev *pdev = NULL; - switch (event) { + switch(event) { case SYS_DOWN: case SYS_HALT: case SYS_POWER_OFF: @@ -2092,14 +2100,15 @@ * @param pdev pci driver structure used for passing to * @param state power state to enter **/ -static int ixgb_suspend(struct pci_dev *pdev, uint32_t state) +static int +ixgb_suspend(struct pci_dev *pdev, uint32_t state) { struct net_device *netdev = pci_get_drvdata(pdev); struct ixgb_adapter *adapter = netdev->priv; netif_device_detach(netdev); - if (netif_running(netdev)) + if(netif_running(netdev)) ixgb_down(adapter, TRUE); pci_save_state(pdev); diff -Nru a/drivers/net/ixgb/ixgb_osdep.h b/drivers/net/ixgb/ixgb_osdep.h --- a/drivers/net/ixgb/ixgb_osdep.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ixgb/ixgb_osdep.h 2005-01-13 16:25:56 -08:00 @@ -78,19 +78,19 @@ #define DEBUGOUT7 DEBUGOUT3 #define IXGB_WRITE_REG(a, reg, value) ( \ - writel((value), ((a)->hw_addr + IXGB_##reg))) + writel((value), ((a)->hw_addr + IXGB_##reg))) #define IXGB_READ_REG(a, reg) ( \ - readl((a)->hw_addr + IXGB_##reg)) + readl((a)->hw_addr + IXGB_##reg)) #define IXGB_WRITE_REG_ARRAY(a, reg, offset, value) ( \ - writel((value), ((a)->hw_addr + IXGB_##reg + ((offset) << 2)))) + writel((value), ((a)->hw_addr + IXGB_##reg + ((offset) << 2)))) #define IXGB_READ_REG_ARRAY(a, reg, offset) ( \ - readl((a)->hw_addr + IXGB_##reg + ((offset) << 2))) + readl((a)->hw_addr + IXGB_##reg + ((offset) << 2))) #define IXGB_WRITE_FLUSH(a) IXGB_READ_REG(a, STATUS) #define IXGB_MEMCPY memcpy -#endif /* _IXGB_OSDEP_H_ */ +#endif /* _IXGB_OSDEP_H_ */ diff -Nru a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c --- a/drivers/net/ixgb/ixgb_param.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/ixgb/ixgb_param.c 2005-01-13 16:25:56 -08:00 @@ -34,31 +34,21 @@ #define IXGB_MAX_NIC 8 -#define OPTION_UNSET -1 +#define OPTION_UNSET -1 #define OPTION_DISABLED 0 #define OPTION_ENABLED 1 -/* Module Parameters are always initialized to -1, so that the driver - * can tell the difference between no user specified value or the - * user asking for the default value. - * The true default values are loaded in when ixgb_check_options is called. - * - * This is a GCC extension to ANSI C. - * See the item "Labeled Elements in Initializers" in the section - * "Extensions to the C Language Family" of the GCC documentation. - */ - -#define IXGB_PARAM_INIT { [0 ... IXGB_MAX_NIC] = OPTION_UNSET } - /* All parameters are treated the same, as an integer array of values. * This macro just reduces the need to repeat the same declaration code * over and over (plus this helps to avoid typo bugs). */ -#define IXGB_PARAM(X, S) \ -static int __devinitdata X[IXGB_MAX_NIC + 1] = IXGB_PARAM_INIT; \ -module_param_array(X, int, NULL, 0); \ -MODULE_PARM_DESC(X, S); +#define IXGB_PARAM_INIT { [0 ... IXGB_MAX_NIC] = OPTION_UNSET } +#define IXGB_PARAM(X, desc) \ + static int __devinitdata X[IXGB_MAX_NIC+1] = IXGB_PARAM_INIT; \ + static int num_##X = 0; \ + module_param_array_named(X, X, int, &num_##X, 0); \ + MODULE_PARM_DESC(X, desc); /* Transmit Descriptor Count * @@ -121,15 +111,6 @@ IXGB_PARAM(RxIntDelay, "Receive Interrupt Delay"); -/* Receive Interrupt Moderation enable (uses RxIntDelay too) - * - * Valid Range: 0,1 - * - * Default Value: 1 - */ - -IXGB_PARAM(RAIDC, "Disable or enable Receive Interrupt Moderation"); - /* Receive Flow control high threshold (when we send a pause frame) * (FCRTH) * @@ -173,13 +154,6 @@ IXGB_PARAM(IntDelayEnable, "Transmit Interrupt Delay Enable"); -#define DEFAULT_TXD 256 -#define MAX_TXD 4096 -#define MIN_TXD 64 - -#define DEFAULT_RXD 1024 -#define MAX_RXD 4096 -#define MIN_RXD 64 #define DEFAULT_TIDV 32 #define MAX_TIDV 0xFFFF @@ -224,9 +198,10 @@ } arg; }; -static int __devinit ixgb_validate_option(int *value, struct ixgb_option *opt) +static int __devinit +ixgb_validate_option(int *value, struct ixgb_option *opt) { - if (*value == OPTION_UNSET) { + if(*value == OPTION_UNSET) { *value = opt->def; return 0; } @@ -243,32 +218,31 @@ } break; case range_option: - if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { + if(*value >= opt->arg.r.min && *value <= opt->arg.r.max) { printk(KERN_INFO "%s set to %i\n", opt->name, *value); return 0; } break; - case list_option:{ - int i; - struct ixgb_opt_list *ent; - - for (i = 0; i < opt->arg.l.nr; i++) { - ent = &opt->arg.l.p[i]; - if (*value == ent->i) { - if (ent->str[0] != '\0') - printk(KERN_INFO "%s\n", - ent->str); - return 0; - } + case list_option: { + int i; + struct ixgb_opt_list *ent; + + for(i = 0; i < opt->arg.l.nr; i++) { + ent = &opt->arg.l.p[i]; + if(*value == ent->i) { + if(ent->str[0] != '\0') + printk(KERN_INFO "%s\n", ent->str); + return 0; } } + } break; default: BUG(); } printk(KERN_INFO "Invalid %s specified (%i) %s\n", - opt->name, *value, opt->err); + opt->name, *value, opt->err); *value = opt->def; return -1; } @@ -285,198 +259,218 @@ * in a variable in the adapter structure. **/ -void __devinit ixgb_check_options(struct ixgb_adapter *adapter) +void __devinit +ixgb_check_options(struct ixgb_adapter *adapter) { int bd = adapter->bd_number; - if (bd >= IXGB_MAX_NIC) { + if(bd >= IXGB_MAX_NIC) { printk(KERN_NOTICE - "Warning: no configuration for board #%i\n", bd); + "Warning: no configuration for board #%i\n", bd); printk(KERN_NOTICE "Using defaults for all values\n"); - bd = IXGB_MAX_NIC; } - { /* Transmit Descriptor Count */ + { /* Transmit Descriptor Count */ struct ixgb_option opt = { .type = range_option, .name = "Transmit Descriptors", - .err = "using default of " __MODULE_STRING(DEFAULT_TXD), - .def = DEFAULT_TXD, - .arg = {.r = {.min = MIN_TXD, - .max = MAX_TXD}} + .err = "using default of " __MODULE_STRING(DEFAULT_TXD), + .def = DEFAULT_TXD, + .arg = { .r = { .min = MIN_TXD, + .max = MAX_TXD}} }; struct ixgb_desc_ring *tx_ring = &adapter->tx_ring; - tx_ring->count = TxDescriptors[bd]; - ixgb_validate_option(&tx_ring->count, &opt); + if(num_TxDescriptors > bd) { + tx_ring->count = TxDescriptors[bd]; + ixgb_validate_option(&tx_ring->count, &opt); + } else { + tx_ring->count = opt.def; + } IXGB_ROUNDUP(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); } - { /* Receive Descriptor Count */ + { /* Receive Descriptor Count */ struct ixgb_option opt = { .type = range_option, .name = "Receive Descriptors", - .err = "using default of " __MODULE_STRING(DEFAULT_RXD), - .def = DEFAULT_RXD, - .arg = {.r = {.min = MIN_RXD, - .max = MAX_RXD}} + .err = "using default of " __MODULE_STRING(DEFAULT_RXD), + .def = DEFAULT_RXD, + .arg = { .r = { .min = MIN_RXD, + .max = MAX_RXD}} }; struct ixgb_desc_ring *rx_ring = &adapter->rx_ring; - rx_ring->count = RxDescriptors[bd]; - ixgb_validate_option(&rx_ring->count, &opt); + if(num_RxDescriptors > bd) { + rx_ring->count = RxDescriptors[bd]; + ixgb_validate_option(&rx_ring->count, &opt); + } else { + rx_ring->count = opt.def; + } IXGB_ROUNDUP(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); } - { /* Receive Checksum Offload Enable */ + { /* Receive Checksum Offload Enable */ struct ixgb_option opt = { .type = enable_option, .name = "Receive Checksum Offload", - .err = "defaulting to Enabled", - .def = OPTION_ENABLED + .err = "defaulting to Enabled", + .def = OPTION_ENABLED }; - int rx_csum = XsumRX[bd]; - ixgb_validate_option(&rx_csum, &opt); - adapter->rx_csum = rx_csum; + if(num_XsumRX > bd) { + int rx_csum = XsumRX[bd]; + ixgb_validate_option(&rx_csum, &opt); + adapter->rx_csum = rx_csum; + } else { + adapter->rx_csum = opt.def; + } } - { /* Flow Control */ + { /* Flow Control */ struct ixgb_opt_list fc_list[] = - { {ixgb_fc_none, "Flow Control Disabled"}, - {ixgb_fc_rx_pause, "Flow Control Receive Only"}, - {ixgb_fc_tx_pause, "Flow Control Transmit Only"}, - {ixgb_fc_full, "Flow Control Enabled"}, - {ixgb_fc_default, "Flow Control Hardware Default"} - }; + {{ ixgb_fc_none, "Flow Control Disabled" }, + { ixgb_fc_rx_pause,"Flow Control Receive Only" }, + { ixgb_fc_tx_pause,"Flow Control Transmit Only" }, + { ixgb_fc_full, "Flow Control Enabled" }, + { ixgb_fc_default, "Flow Control Hardware Default" }}; struct ixgb_option opt = { .type = list_option, .name = "Flow Control", - .err = "reading default settings from EEPROM", - .def = ixgb_fc_full, - .arg = {.l = {.nr = LIST_LEN(fc_list), - .p = fc_list}} + .err = "reading default settings from EEPROM", + .def = ixgb_fc_full, + .arg = { .l = { .nr = LIST_LEN(fc_list), + .p = fc_list }} }; - int fc = FlowControl[bd]; - ixgb_validate_option(&fc, &opt); - adapter->hw.fc.type = fc; + if(num_FlowControl > bd) { + int fc = FlowControl[bd]; + ixgb_validate_option(&fc, &opt); + adapter->hw.fc.type = fc; + } else { + adapter->hw.fc.type = opt.def; + } } - { /* Receive Flow Control High Threshold */ + { /* Receive Flow Control High Threshold */ struct ixgb_option opt = { .type = range_option, .name = "Rx Flow Control High Threshold", - .err = - "using default of " __MODULE_STRING(DEFAULT_FCRTH), - .def = DEFAULT_FCRTH, - .arg = {.r = {.min = MIN_FCRTH, - .max = MAX_FCRTH}} + .err = "using default of " __MODULE_STRING(DEFAULT_FCRTH), + .def = DEFAULT_FCRTH, + .arg = { .r = { .min = MIN_FCRTH, + .max = MAX_FCRTH}} }; - adapter->hw.fc.high_water = RxFCHighThresh[bd]; - ixgb_validate_option(&adapter->hw.fc.high_water, &opt); - if (!(adapter->hw.fc.type & ixgb_fc_rx_pause)) - printk(KERN_INFO - "Ignoring RxFCHighThresh when no RxFC\n"); + if(num_RxFCHighThresh > bd) { + adapter->hw.fc.high_water = RxFCHighThresh[bd]; + ixgb_validate_option(&adapter->hw.fc.high_water, &opt); + } else { + adapter->hw.fc.high_water = opt.def; + } + if(!(adapter->hw.fc.type & ixgb_fc_rx_pause) ) + printk (KERN_INFO + "Ignoring RxFCHighThresh when no RxFC\n"); } - { /* Receive Flow Control Low Threshold */ + { /* Receive Flow Control Low Threshold */ struct ixgb_option opt = { .type = range_option, .name = "Rx Flow Control Low Threshold", - .err = - "using default of " __MODULE_STRING(DEFAULT_FCRTL), - .def = DEFAULT_FCRTL, - .arg = {.r = {.min = MIN_FCRTL, - .max = MAX_FCRTL}} + .err = "using default of " __MODULE_STRING(DEFAULT_FCRTL), + .def = DEFAULT_FCRTL, + .arg = { .r = { .min = MIN_FCRTL, + .max = MAX_FCRTL}} }; - adapter->hw.fc.low_water = RxFCLowThresh[bd]; - ixgb_validate_option(&adapter->hw.fc.low_water, &opt); - if (!(adapter->hw.fc.type & ixgb_fc_rx_pause)) - printk(KERN_INFO - "Ignoring RxFCLowThresh when no RxFC\n"); + if(num_RxFCLowThresh > bd) { + adapter->hw.fc.low_water = RxFCLowThresh[bd]; + ixgb_validate_option(&adapter->hw.fc.low_water, &opt); + } else { + adapter->hw.fc.low_water = opt.def; + } + if(!(adapter->hw.fc.type & ixgb_fc_rx_pause) ) + printk (KERN_INFO + "Ignoring RxFCLowThresh when no RxFC\n"); } - { /* Flow Control Pause Time Request */ + { /* Flow Control Pause Time Request*/ struct ixgb_option opt = { .type = range_option, .name = "Flow Control Pause Time Request", - .err = - "using default of " - __MODULE_STRING(DEFAULT_FCPAUSE), - .def = DEFAULT_FCPAUSE, - .arg = {.r = {.min = MIN_FCPAUSE, - .max = MAX_FCPAUSE}} + .err = "using default of "__MODULE_STRING(DEFAULT_FCPAUSE), + .def = DEFAULT_FCPAUSE, + .arg = { .r = { .min = MIN_FCPAUSE, + .max = MAX_FCPAUSE}} }; - int pause_time = FCReqTimeout[bd]; - - ixgb_validate_option(&pause_time, &opt); - if (!(adapter->hw.fc.type & ixgb_fc_rx_pause)) - printk(KERN_INFO - "Ignoring FCReqTimeout when no RxFC\n"); - adapter->hw.fc.pause_time = pause_time; + if(num_FCReqTimeout > bd) { + int pause_time = FCReqTimeout[bd]; + ixgb_validate_option(&pause_time, &opt); + adapter->hw.fc.pause_time = pause_time; + } else { + adapter->hw.fc.pause_time = opt.def; + } + if(!(adapter->hw.fc.type & ixgb_fc_rx_pause) ) + printk (KERN_INFO + "Ignoring FCReqTimeout when no RxFC\n"); } /* high low and spacing check for rx flow control thresholds */ if (adapter->hw.fc.type & ixgb_fc_rx_pause) { /* high must be greater than low */ if (adapter->hw.fc.high_water < (adapter->hw.fc.low_water + 8)) { /* set defaults */ - printk(KERN_INFO - "RxFCHighThresh must be >= (RxFCLowThresh + 8), " - "Using Defaults\n"); + printk (KERN_INFO + "RxFCHighThresh must be >= (RxFCLowThresh + 8), " + "Using Defaults\n"); adapter->hw.fc.high_water = DEFAULT_FCRTH; - adapter->hw.fc.low_water = DEFAULT_FCRTL; + adapter->hw.fc.low_water = DEFAULT_FCRTL; } } - { /* Receive Interrupt Delay */ + { /* Receive Interrupt Delay */ struct ixgb_option opt = { .type = range_option, .name = "Receive Interrupt Delay", - .err = - "using default of " __MODULE_STRING(DEFAULT_RDTR), - .def = DEFAULT_RDTR, - .arg = {.r = {.min = MIN_RDTR, - .max = MAX_RDTR}} - }; - - adapter->rx_int_delay = RxIntDelay[bd]; - ixgb_validate_option(&adapter->rx_int_delay, &opt); - } - { /* Receive Interrupt Moderation */ - struct ixgb_option opt = { - .type = enable_option, - .name = "Advanced Receive Interrupt Moderation", - .err = "defaulting to Enabled", - .def = OPTION_ENABLED + .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), + .def = DEFAULT_RDTR, + .arg = { .r = { .min = MIN_RDTR, + .max = MAX_RDTR}} }; - int raidc = RAIDC[bd]; - ixgb_validate_option(&raidc, &opt); - adapter->raidc = raidc; + if(num_RxIntDelay > bd) { + adapter->rx_int_delay = RxIntDelay[bd]; + ixgb_validate_option(&adapter->rx_int_delay, &opt); + } else { + adapter->rx_int_delay = opt.def; + } } - { /* Transmit Interrupt Delay */ + { /* Transmit Interrupt Delay */ struct ixgb_option opt = { .type = range_option, .name = "Transmit Interrupt Delay", - .err = - "using default of " __MODULE_STRING(DEFAULT_TIDV), - .def = DEFAULT_TIDV, - .arg = {.r = {.min = MIN_TIDV, - .max = MAX_TIDV}} + .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), + .def = DEFAULT_TIDV, + .arg = { .r = { .min = MIN_TIDV, + .max = MAX_TIDV}} }; - adapter->tx_int_delay = TxIntDelay[bd]; - ixgb_validate_option(&adapter->tx_int_delay, &opt); + if(num_TxIntDelay > bd) { + adapter->tx_int_delay = TxIntDelay[bd]; + ixgb_validate_option(&adapter->tx_int_delay, &opt); + } else { + adapter->tx_int_delay = opt.def; + } } - { /* Transmit Interrupt Delay Enable */ + { /* Transmit Interrupt Delay Enable */ struct ixgb_option opt = { .type = enable_option, .name = "Tx Interrupt Delay Enable", - .err = "defaulting to Enabled", - .def = OPTION_ENABLED + .err = "defaulting to Enabled", + .def = OPTION_ENABLED }; - int ide = IntDelayEnable[bd]; - ixgb_validate_option(&ide, &opt); - adapter->tx_int_delay_enable = ide; + if(num_IntDelayEnable > bd) { + int ide = IntDelayEnable[bd]; + ixgb_validate_option(&ide, &opt); + adapter->tx_int_delay_enable = ide; + } else { + adapter->tx_int_delay_enable = opt.def; + } } } diff -Nru a/drivers/net/s2io.c b/drivers/net/s2io.c --- a/drivers/net/s2io.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/s2io.c 2005-01-13 16:25:56 -08:00 @@ -560,21 +560,35 @@ for (i = 0; i < config->rx_ring_num; i++) { blk_cnt = config->rx_cfg[i].num_rxd / (MAX_RXDS_PER_BLOCK + 1); + if (!nic->ba[i]) + goto end_free; for (j = 0; j < blk_cnt; j++) { int k = 0; - if (!nic->ba[i][j]) - continue; + if (!nic->ba[i][j]) { + kfree(nic->ba[i]); + goto end_free; + } while (k != MAX_RXDS_PER_BLOCK) { buffAdd_t *ba = &nic->ba[i][j][k]; + if (!ba || !ba->ba_0_org || !ba->ba_1_org) + { + kfree(nic->ba[i]); + kfree(nic->ba[i][j]); + if(ba->ba_0_org) + kfree(ba->ba_0_org); + if(ba->ba_1_org) + kfree(ba->ba_1_org); + goto end_free; + } kfree(ba->ba_0_org); kfree(ba->ba_1_org); k++; } kfree(nic->ba[i][j]); } - if (nic->ba[i]) - kfree(nic->ba[i]); + kfree(nic->ba[i]); } +end_free: #endif if (mac_control->stats_mem) { diff -Nru a/drivers/net/s2io.h b/drivers/net/s2io.h --- a/drivers/net/s2io.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/s2io.h 2005-01-13 16:25:56 -08:00 @@ -740,8 +740,8 @@ { u64 ret = 0; ret = readl(addr + 4); - (u64) ret <<= 32; - (u64) ret |= readl(addr); + ret <<= 32; + ret |= readl(addr); return ret; } diff -Nru a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c --- a/drivers/net/smc-ultra.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/smc-ultra.c 2005-01-13 16:25:56 -08:00 @@ -156,8 +156,6 @@ /* Look for any installed ISAPnP cards */ if (isapnp_present() && (ultra_probe_isapnp(dev) == 0)) return 0; - - printk(KERN_NOTICE "smc-ultra.c: No ISAPnP cards found, trying standard ones...\n"); #endif for (i = 0; ultra_portlist[i]; i++) { diff -Nru a/drivers/net/smc91x.c b/drivers/net/smc91x.c --- a/drivers/net/smc91x.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/smc91x.c 2005-01-13 16:25:56 -08:00 @@ -1333,6 +1333,19 @@ return IRQ_HANDLED; } +#ifdef CONFIG_NET_POLL_CONTROLLER +/* + * Polling receive - used by netconsole and other diagnostic tools + * to allow network i/o with interrupts disabled. + */ +static void smc_poll_controller(struct net_device *dev) +{ + disable_irq(dev->irq); + smc_interrupt(dev->irq, dev, NULL); + enable_irq(dev->irq); +} +#endif + /* Our watchdog timed out. Called by the networking layer */ static void smc_timeout(struct net_device *dev) { @@ -1912,6 +1925,9 @@ dev->get_stats = smc_query_statistics; dev->set_multicast_list = smc_set_multicast_list; dev->ethtool_ops = &smc_ethtool_ops; +#ifdef CONFIG_NET_POLL_CONTROLLER + dev->poll_controller = smc_poll_controller; +#endif tasklet_init(&lp->tx_task, smc_hardware_send_pkt, (unsigned long)dev); INIT_WORK(&lp->phy_configure, smc_phy_configure, dev); diff -Nru a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c --- a/drivers/net/wireless/orinoco.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/wireless/orinoco.c 2005-01-13 16:25:56 -08:00 @@ -617,9 +617,8 @@ unsigned long flags; int err; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; err = __orinoco_up(dev); @@ -671,10 +670,9 @@ return NULL; /* FIXME: Can we do better than this? */ } - err = orinoco_lock(priv, &flags); - if (err) - return NULL; /* FIXME: Erg, we've been signalled, how - * do we propagate this back up? */ + if (orinoco_lock(priv, &flags) != 0) + return NULL; /* FIXME: Erg, we've been signalled, how + * do we propagate this back up? */ if (priv->iw_mode == IW_MODE_ADHOC) { memset(&wstats->qual, 0, sizeof(wstats->qual)); @@ -1819,10 +1817,8 @@ return 0; } - err = orinoco_lock(priv, &flags); - if (err) - return err; - + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; err = hermes_disable_port(hw, 0); if (err) { @@ -1864,11 +1860,10 @@ { struct orinoco_private *priv = netdev_priv(dev); struct hermes *hw = &priv->hw; - int err; + int err = 0; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) + if (orinoco_lock(priv, &flags) != 0) /* When the hardware becomes available again, whatever * detects that is responsible for re-initializing * it. So no need for anything further */ @@ -2411,9 +2406,8 @@ int err = 0; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID, ETH_ALEN, NULL, buf); @@ -2433,9 +2427,8 @@ int len; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; if (strlen(priv->desired_essid) > 0) { /* We read the desired SSID from the hardware rather @@ -2486,9 +2479,8 @@ long freq = 0; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CURRENTCHANNEL, &channel); if (err) @@ -2528,9 +2520,8 @@ int i; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_SUPPORTEDDATARATES, sizeof(list), NULL, &list); @@ -2568,9 +2559,8 @@ rrq->length = sizeof(range); - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; mode = priv->iw_mode; orinoco_unlock(priv, &flags); @@ -2639,9 +2629,8 @@ range.min_frag = 256; range.max_frag = 2346; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; if (priv->has_wep) { range.max_encoding_tokens = ORINOCO_MAX_KEYS; @@ -2706,10 +2695,9 @@ if (copy_from_user(keybuf, erq->pointer, erq->length)) return -EFAULT; } - - err = orinoco_lock(priv, &flags); - if (err) - return err; + + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; if (erq->pointer) { if (erq->length > ORINOCO_MAX_KEY_SIZE) { @@ -2788,12 +2776,10 @@ int index = (erq->flags & IW_ENCODE_INDEX) - 1; u16 xlen = 0; char keybuf[ORINOCO_MAX_KEY_SIZE]; - int err; unsigned long flags; - - err = orinoco_lock(priv, &flags); - if (err) - return err; + + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; if ((index < 0) || (index >= ORINOCO_MAX_KEYS)) index = priv->tx_key; @@ -2833,7 +2819,6 @@ { struct orinoco_private *priv = netdev_priv(dev); char essidbuf[IW_ESSID_MAX_SIZE+1]; - int err; unsigned long flags; /* Note : ESSID is ignored in Ad-Hoc demo mode, but we can set it @@ -2851,9 +2836,8 @@ essidbuf[erq->length] = '\0'; } - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; memcpy(priv->desired_essid, essidbuf, sizeof(priv->desired_essid)); @@ -2877,9 +2861,8 @@ if (err) return err; } else { - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; memcpy(essidbuf, priv->desired_essid, sizeof(essidbuf)); orinoco_unlock(priv, &flags); } @@ -2899,7 +2882,6 @@ { struct orinoco_private *priv = netdev_priv(dev); char nickbuf[IW_ESSID_MAX_SIZE+1]; - int err; unsigned long flags; if (nrq->length > IW_ESSID_MAX_SIZE) @@ -2912,9 +2894,8 @@ nickbuf[nrq->length] = '\0'; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; memcpy(priv->nick, nickbuf, sizeof(priv->nick)); @@ -2927,12 +2908,10 @@ { struct orinoco_private *priv = netdev_priv(dev); char nickbuf[IW_ESSID_MAX_SIZE+1]; - int err; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; memcpy(nickbuf, priv->nick, IW_ESSID_MAX_SIZE+1); orinoco_unlock(priv, &flags); @@ -2949,7 +2928,6 @@ { struct orinoco_private *priv = netdev_priv(dev); int chan = -1; - int err; unsigned long flags; /* We can only use this in Ad-Hoc demo mode to set the operating @@ -2978,9 +2956,8 @@ ! (priv->channel_mask & (1 << (chan-1)) ) ) return -EINVAL; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; priv->channel = chan; orinoco_unlock(priv, &flags); @@ -2998,9 +2975,8 @@ if (!priv->has_sensitivity) return -EOPNOTSUPP; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFSYSTEMSCALE, &val); orinoco_unlock(priv, &flags); @@ -3018,7 +2994,6 @@ { struct orinoco_private *priv = netdev_priv(dev); int val = srq->value; - int err; unsigned long flags; if (!priv->has_sensitivity) @@ -3027,9 +3002,8 @@ if ((val < 1) || (val > 3)) return -EINVAL; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; priv->ap_density = val; orinoco_unlock(priv, &flags); @@ -3040,7 +3014,6 @@ { struct orinoco_private *priv = netdev_priv(dev); int val = rrq->value; - int err; unsigned long flags; if (rrq->disabled) @@ -3049,9 +3022,8 @@ if ( (val < 0) || (val > 2347) ) return -EINVAL; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; priv->rts_thresh = val; orinoco_unlock(priv, &flags); @@ -3065,9 +3037,8 @@ int err = 0; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; if (priv->has_mwo) { if (frq->disabled) @@ -3102,9 +3073,8 @@ u16 val; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; if (priv->has_mwo) { err = hermes_read_wordrec(hw, USER_BAP, @@ -3166,9 +3136,8 @@ if (ratemode == -1) return -EINVAL; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; priv->bitratemode = ratemode; orinoco_unlock(priv, &flags); @@ -3185,9 +3154,8 @@ u16 val; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; ratemode = priv->bitratemode; @@ -3247,9 +3215,8 @@ int err = 0; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; if (prq->disabled) { priv->pm_on = 0; @@ -3302,9 +3269,8 @@ u16 enable, period, timeout, mcast; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFPMENABLED, &enable); if (err) @@ -3351,9 +3317,8 @@ u16 short_limit, long_limit, lifetime; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORTRETRYLIMIT, &short_limit); @@ -3399,12 +3364,10 @@ { struct orinoco_private *priv = netdev_priv(dev); int val = *( (int *) wrq->u.name ); - int err; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; priv->ibss_port = val ; @@ -3419,12 +3382,10 @@ { struct orinoco_private *priv = netdev_priv(dev); int *val = (int *)wrq->u.name; - int err; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; *val = priv->ibss_port; orinoco_unlock(priv, &flags); @@ -3439,9 +3400,8 @@ int err = 0; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; switch (val) { case 0: /* Try to do IEEE ad-hoc mode */ @@ -3478,12 +3438,10 @@ { struct orinoco_private *priv = netdev_priv(dev); int *val = (int *)wrq->u.name; - int err; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; *val = priv->prefer_port3; orinoco_unlock(priv, &flags); @@ -3513,9 +3471,8 @@ } /* Make sure nobody mess with the structure while we do */ - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; /* orinoco_lock() doesn't disable interrupts, so make sure the * interrupt rx path don't get confused while we copy */ @@ -3546,12 +3503,10 @@ struct iw_quality spy_stat[IW_MAX_SPY]; int number; int i; - int err; unsigned long flags; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; number = priv->spy_number; if ((number > 0) && (srq->pointer)) { @@ -3621,9 +3576,8 @@ break; case SIOCSIWMODE: - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; switch (wrq->u.mode) { case IW_MODE_ADHOC: if (! (priv->has_ibss || priv->has_port3) ) @@ -3648,9 +3602,8 @@ break; case SIOCGIWMODE: - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; wrq->u.mode = priv->iw_mode; orinoco_unlock(priv, &flags); break; @@ -3865,9 +3818,8 @@ if(priv->has_preamble) { int val = *( (int *) wrq->u.name ); - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; if (val) priv->preamble = 1; else @@ -3882,9 +3834,8 @@ if(priv->has_preamble) { int *val = (int *)wrq->u.name; - err = orinoco_lock(priv, &flags); - if (err) - return err; + if (orinoco_lock(priv, &flags) != 0) + return -EBUSY; *val = priv->preamble; orinoco_unlock(priv, &flags); } else diff -Nru a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c --- a/drivers/net/wireless/wl3501_cs.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/net/wireless/wl3501_cs.c 2005-01-13 16:25:56 -08:00 @@ -100,7 +100,7 @@ /* Parameters that can be set with 'insmod' */ /* Bit map of interrupts to choose from */ /* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */ -static unsigned long wl3501_irq_mask = 0xdeb8; +static unsigned int wl3501_irq_mask = 0xdeb8; static int wl3501_irq_list[4] = { -1 }; /* @@ -2273,7 +2273,7 @@ module_init(wl3501_init_module); module_exit(wl3501_exit_module); -module_param(wl3501_irq_mask, int, 0); +module_param(wl3501_irq_mask, uint, 0); module_param_array(wl3501_irq_list, int, NULL, 0); MODULE_AUTHOR("Fox Chen , " "Arnaldo Carvalho de Melo ," diff -Nru a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c --- a/drivers/scsi/aacraid/commsup.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/aacraid/commsup.c 2005-01-13 16:25:56 -08:00 @@ -768,28 +768,6 @@ memset(cp, 0, 256); } - -/** - * aac_handle_aif - Handle a message from the firmware - * @dev: Which adapter this fib is from - * @fibptr: Pointer to fibptr from adapter - * - * This routine handles a driver notify fib from the adapter and - * dispatches it to the appropriate routine for handling. - */ - -static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) -{ - struct hw_fib * hw_fib = fibptr->hw_fib; - /* - * Set the status of this FIB to be Invalid parameter. - * - * *(u32 *)fib->data = ST_INVAL; - */ - *(u32 *)hw_fib->data = cpu_to_le32(ST_OK); - fib_adapter_complete(fibptr, sizeof(u32)); -} - /** * aac_command_thread - command processing thread * @dev: Adapter to monitor @@ -859,7 +837,6 @@ aifcmd = (struct aac_aifcmd *) hw_fib->data; if (aifcmd->command == cpu_to_le32(AifCmdDriverNotify)) { /* Handle Driver Notify Events */ - aac_handle_aif(dev, fib); *(u32 *)hw_fib->data = cpu_to_le32(ST_OK); fib_adapter_complete(fib, sizeof(u32)); } else { @@ -869,10 +846,6 @@ u32 time_now, time_last; unsigned long flagv; - - /* Sniff events */ - if (aifcmd->command == cpu_to_le32(AifCmdEventNotify)) - aac_handle_aif(dev, fib); time_now = jiffies/HZ; diff -Nru a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c --- a/drivers/scsi/aic7xxx/aic7770_osm.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/aic7xxx/aic7770_osm.c 2005-01-13 16:25:56 -08:00 @@ -125,14 +125,8 @@ uint32_t eisa_id; size_t id_size; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) - if (check_region(eisaBase, AHC_EISA_IOSIZE) != 0) - continue; - request_region(eisaBase, AHC_EISA_IOSIZE, "aic7xxx"); -#else if (request_region(eisaBase, AHC_EISA_IOSIZE, "aic7xxx") == 0) continue; -#endif eisa_id = 0; id_size = sizeof(eisa_id); @@ -207,14 +201,8 @@ /* * Lock out other contenders for our i/o space. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) - if (check_region(port, AHC_EISA_IOSIZE) != 0) - return (ENOMEM); - request_region(port, AHC_EISA_IOSIZE, "aic7xxx"); -#else if (request_region(port, AHC_EISA_IOSIZE, "aic7xxx") == 0) return (ENOMEM); -#endif ahc->tag = BUS_SPACE_PIO; ahc->bsh.ioport = port; return (0); diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h 2005-01-13 16:25:56 -08:00 @@ -831,8 +831,6 @@ /******************************* PCI Routines *********************************/ #ifdef CONFIG_PCI -void ahc_power_state_change(struct ahc_softc *ahc, - ahc_power_state new_state); int ahc_linux_pci_init(void); void ahc_linux_pci_exit(void); int ahc_pci_map_registers(struct ahc_softc *ahc); diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c 2005-01-13 16:25:56 -08:00 @@ -42,12 +42,6 @@ #include "aic7xxx_osm.h" #include "aic7xxx_pci.h" -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) -struct pci_device_id -{ -}; -#endif - static int ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent); static int ahc_linux_pci_reserve_io_region(struct ahc_softc *ahc, @@ -55,7 +49,6 @@ static int ahc_linux_pci_reserve_mem_region(struct ahc_softc *ahc, u_long *bus_addr, uint8_t __iomem **maddr); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) static void ahc_linux_pci_dev_remove(struct pci_dev *pdev); /* Define the macro locally since it's different for different class of chips. @@ -169,7 +162,6 @@ } else ahc_list_unlock(&l); } -#endif /* !LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) */ static int ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) @@ -219,7 +211,6 @@ ahc = ahc_alloc(NULL, name); if (ahc == NULL) return (-ENOMEM); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) if (pci_enable_device(pdev)) { ahc_free(ahc); return (-ENODEV); @@ -238,14 +229,12 @@ } ahc->platform_data->hw_dma_mask = DMA_32BIT_MASK; } -#endif ahc->dev_softc = pci; error = ahc_pci_config(ahc, entry); if (error != 0) { ahc_free(ahc); return (-error); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) pci_set_drvdata(pdev, ahc); if (aic7xxx_detect_complete) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) @@ -256,39 +245,14 @@ return (-ENODEV); #endif } -#endif return (0); } int ahc_linux_pci_init(void) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) /* Translate error or zero return into zero or one */ return pci_module_init(&aic7xxx_pci_driver) ? 0 : 1; -#else - struct pci_dev *pdev; - u_int class; - int found; - - /* If we don't have a PCI bus, we can't find any adapters. */ - if (pci_present() == 0) - return (0); - - found = 0; - pdev = NULL; - class = PCI_CLASS_STORAGE_SCSI << 8; - while ((pdev = pci_find_class(class, pdev)) != NULL) { - ahc_dev_softc_t pci; - int error; - - pci = pdev; - error = ahc_linux_pci_dev_probe(pdev, /*pci_devid*/NULL); - if (error == 0) - found++; - } - return (found); -#endif } void @@ -303,22 +267,11 @@ if (aic7xxx_allow_memio == 0) return (ENOMEM); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) *base = pci_resource_start(ahc->dev_softc, 0); -#else - *base = ahc_pci_read_config(ahc->dev_softc, PCIR_MAPS, 4); - *base &= PCI_BASE_ADDRESS_IO_MASK; -#endif if (*base == 0) return (ENOMEM); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) - if (check_region(*base, 256) != 0) - return (ENOMEM); - request_region(*base, 256, "aic7xxx"); -#else if (request_region(*base, 256, "aic7xxx") == 0) return (ENOMEM); -#endif return (0); } @@ -334,17 +287,13 @@ start = pci_resource_start(ahc->dev_softc, 1); if (start != 0) { *bus_addr = start; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) if (request_mem_region(start, 0x1000, "aic7xxx") == 0) error = ENOMEM; -#endif if (error == 0) { *maddr = ioremap_nocache(start, 256); if (*maddr == NULL) { error = ENOMEM; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) release_mem_region(start, 0x1000); -#endif } } } else @@ -387,10 +336,8 @@ ahc_get_pci_slot(ahc->dev_softc), ahc_get_pci_function(ahc->dev_softc)); iounmap(maddr); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) release_mem_region(ahc->platform_data->mem_busaddr, 0x1000); -#endif ahc->bsh.maddr = NULL; maddr = NULL; } else @@ -440,41 +387,3 @@ return (-error); } -void -ahc_power_state_change(struct ahc_softc *ahc, ahc_power_state new_state) -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - pci_set_power_state(ahc->dev_softc, new_state); -#else - uint32_t cap; - u_int cap_offset; - - /* - * Traverse the capability list looking for - * the power management capability. - */ - cap = 0; - cap_offset = ahc_pci_read_config(ahc->dev_softc, - PCIR_CAP_PTR, /*bytes*/1); - while (cap_offset != 0) { - - cap = ahc_pci_read_config(ahc->dev_softc, - cap_offset, /*bytes*/4); - if ((cap & 0xFF) == 1 - && ((cap >> 16) & 0x3) > 0) { - uint32_t pm_control; - - pm_control = ahc_pci_read_config(ahc->dev_softc, - cap_offset + 4, - /*bytes*/4); - pm_control &= ~0x3; - pm_control |= new_state; - ahc_pci_write_config(ahc->dev_softc, - cap_offset + 4, - pm_control, /*bytes*/2); - break; - } - cap_offset = (cap >> 8) & 0xFF; - } -#endif -} diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_pci.c b/drivers/scsi/aic7xxx/aic7xxx_pci.c --- a/drivers/scsi/aic7xxx/aic7xxx_pci.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/aic7xxx/aic7xxx_pci.c 2005-01-13 16:25:56 -08:00 @@ -721,7 +721,7 @@ ahc->chip |= AHC_PCI; ahc->description = entry->name; - ahc_power_state_change(ahc, AHC_POWER_STATE_D0); + pci_set_power_state(ahc->dev_softc, AHC_POWER_STATE_D0); error = ahc_pci_map_registers(ahc); if (error != 0) @@ -2016,7 +2016,7 @@ ahc_pci_resume(struct ahc_softc *ahc) { - ahc_power_state_change(ahc, AHC_POWER_STATE_D0); + pci_set_power_state(ahc->dev_softc, AHC_POWER_STATE_D0); /* * We assume that the OS has restored our register diff -Nru a/drivers/scsi/constants.c b/drivers/scsi/constants.c --- a/drivers/scsi/constants.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/constants.c 2005-01-13 16:25:56 -08:00 @@ -1156,17 +1156,14 @@ } /* Print sense information */ -static void -print_sense_internal(const char *devclass, - const unsigned char *sense_buffer, - int sense_len, - struct request *req) +void +__scsi_print_sense(const char *name, const unsigned char *sense_buffer, + int sense_len) { int k, num, res; unsigned int info; const char *error; const char *sense_txt; - const char *name = req->rq_disk ? req->rq_disk->disk_name : devclass; struct scsi_sense_hdr ssh; res = scsi_normalize_sense(sense_buffer, sense_len, &ssh); @@ -1254,18 +1251,25 @@ printk("\n"); } } +EXPORT_SYMBOL(__scsi_print_sense); void scsi_print_sense(const char *devclass, struct scsi_cmnd *cmd) { - print_sense_internal(devclass, cmd->sense_buffer, - SCSI_SENSE_BUFFERSIZE, cmd->request); + const char *name = devclass; + + if (cmd->request->rq_disk) + name = cmd->request->rq_disk->disk_name; + __scsi_print_sense(name, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); } EXPORT_SYMBOL(scsi_print_sense); void scsi_print_req_sense(const char *devclass, struct scsi_request *sreq) { - print_sense_internal(devclass, sreq->sr_sense_buffer, - SCSI_SENSE_BUFFERSIZE, sreq->sr_request); + const char *name = devclass; + + if (sreq->sr_request->rq_disk) + name = sreq->sr_request->rq_disk->disk_name; + __scsi_print_sense(name, sreq->sr_sense_buffer, SCSI_SENSE_BUFFERSIZE); } EXPORT_SYMBOL(scsi_print_req_sense); diff -Nru a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c --- a/drivers/scsi/fd_mcs.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/fd_mcs.c 2005-01-13 16:25:56 -08:00 @@ -96,7 +96,6 @@ #include "scsi.h" #include -#include "fd_mcs.h" #define DRIVER_VERSION "v0.2 by ZP Gu" @@ -104,14 +103,12 @@ #define DEBUG 0 /* Enable debugging output */ #define ENABLE_PARITY 1 /* Enable SCSI Parity */ -#define DO_DETECT 0 /* Do device detection here (see scsi.c) */ /* END OF USER DEFINABLE OPTIONS */ #if DEBUG #define EVERY_ACCESS 0 /* Write a line on every scsi access */ #define ERRORS_ONLY 1 /* Only write a line if there is an error */ -#define DEBUG_DETECT 1 /* Debug fd_mcs_detect() */ #define DEBUG_MESSAGES 1 /* Debug MESSAGE IN phase */ #define DEBUG_ABORT 1 /* Debug abort() routine */ #define DEBUG_RESET 1 /* Debug reset() routine */ @@ -119,7 +116,6 @@ #else #define EVERY_ACCESS 0 /* LEAVE THESE ALONE--CHANGE THE ONES ABOVE */ #define ERRORS_ONLY 0 -#define DEBUG_DETECT 0 #define DEBUG_MESSAGES 0 #define DEBUG_ABORT 0 #define DEBUG_RESET 0 @@ -432,6 +428,7 @@ FIFO_COUNT = user_fifo_count ? user_fifo_count : fd_mcs_adapters[loop].fifo_count; FIFO_Size = user_fifo_size ? user_fifo_size : fd_mcs_adapters[loop].fifo_size; +/* FIXME: Do we need to keep this bit of code inside NOT_USED around at all? */ #ifdef NOT_USED /* *************************************************** */ /* Try to toggle 32-bit mode. This only @@ -510,59 +507,6 @@ outb(0, SCSI_Mode_Cntl_port); outb(PARITY_MASK, TMC_Cntl_port); /* done reset */ - -#if DO_DETECT - /* scan devices attached */ - { - const int buflen = 255; - int i, j, retcode; - Scsi_Cmnd SCinit; - unsigned char do_inquiry[] = { INQUIRY, 0, 0, 0, buflen, 0 }; - unsigned char do_request_sense[] = { REQUEST_SENSE, - 0, 0, 0, buflen, 0 - }; - unsigned char do_read_capacity[] = { READ_CAPACITY, - 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - unsigned char buf[buflen]; - - SCinit.request_buffer = SCinit.buffer = buf; - SCinit.request_bufflen = SCinit.bufflen = sizeof(buf) - 1; - SCinit.use_sg = 0; - SCinit.lun = 0; - SCinit.host = shpnt; - - printk("fd_mcs: detection routine scanning for devices:\n"); - for (i = 0; i < 8; i++) { - if (i == shpnt->this_id) /* Skip host adapter */ - continue; - SCinit.target = i; - memcpy(SCinit.cmnd, do_request_sense, sizeof(do_request_sense)); - retcode = fd_mcs_command(&SCinit); - if (!retcode) { - memcpy(SCinit.cmnd, do_inquiry, sizeof(do_inquiry)); - retcode = fd_mcs_command(&SCinit); - if (!retcode) { - printk(" SCSI ID %d: ", i); - for (j = 8; j < (buf[4] < 32 ? buf[4] : 32); j++) - printk("%c", buf[j] >= 20 ? buf[j] : ' '); - memcpy(SCinit.cmnd, do_read_capacity, sizeof(do_read_capacity)); - retcode = fd_mcs_command(&SCinit); - if (!retcode) { - unsigned long blocks, size, capacity; - - blocks = (buf[0] << 24) | (buf[1] << 16) - | (buf[2] << 8) | buf[3]; - size = (buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7]; - capacity = +(+(blocks / 1024L) * +(size * 10L)) / 1024L; - - printk("%lu MB (%lu byte blocks)\n", ((capacity + 5L) / 10L), size); - } - } - } - } - } -#endif } } diff -Nru a/drivers/scsi/fd_mcs.h b/drivers/scsi/fd_mcs.h --- a/drivers/scsi/fd_mcs.h 2005-01-13 16:25:56 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,37 +0,0 @@ -/* fd_mcs.h -- Header for Future Domain MCS 600/700 (or IBM OEM) driver - * - * fd_mcs.h v0.2 03/11/1998 ZP Gu (zpg@castle.net) - * - - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. - - */ - -#ifndef _FD_MCS_H -#define _FD_MCS_H - -static int fd_mcs_detect(Scsi_Host_Template *); -static int fd_mcs_release(struct Scsi_Host *); -static int fd_mcs_command(Scsi_Cmnd *); -static int fd_mcs_abort(Scsi_Cmnd *); -static int fd_mcs_bus_reset(Scsi_Cmnd *); -static int fd_mcs_device_reset(Scsi_Cmnd *); -static int fd_mcs_host_reset(Scsi_Cmnd *); -static int fd_mcs_queue(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *)); -static int fd_mcs_biosparam(struct scsi_device *, struct block_device *, - sector_t, int *); -static const char *fd_mcs_info(struct Scsi_Host *); - -#endif /* _FD_MCS_H */ diff -Nru a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c --- a/drivers/scsi/gdth.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/gdth.c 2005-01-13 16:25:56 -08:00 @@ -397,11 +397,7 @@ #include #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #include -#else -#include -#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) #include #else @@ -412,14 +408,11 @@ #include "scsi.h" #include #include "gdth.h" +#include "gdth_kcompat.h" static void gdth_delay(int milliseconds); static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) static irqreturn_t gdth_interrupt(int irq, void *dev_id, struct pt_regs *regs); -#else -static void gdth_interrupt(int irq, void *dev_id, struct pt_regs *regs); -#endif static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp); static int gdth_async_event(int hanum); static void gdth_log_event(gdth_evt_data *dvr, char *buffer); @@ -617,32 +610,6 @@ DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN }; -/* __initfunc, __initdata macros */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) -#define GDTH_INITFUNC(type, func) type __init func -#include -#else -#define GDTH_INITFUNC(type, func) __initfunc(type func) -#include -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -#define GDTH_INIT_LOCK_HA(ha) spin_lock_init(&(ha)->smp_lock) -#define GDTH_LOCK_HA(ha,flags) spin_lock_irqsave(&(ha)->smp_lock,flags) -#define GDTH_UNLOCK_HA(ha,flags) spin_unlock_irqrestore(&(ha)->smp_lock,flags) - -#define GDTH_LOCK_SCSI_DONE(dev, flags) spin_lock_irqsave(dev->host_lock,flags) -#define GDTH_UNLOCK_SCSI_DONE(dev, flags) spin_unlock_irqrestore(dev->host_lock,flags) - -#else -#define GDTH_INIT_LOCK_HA(ha) spin_lock_init(&(ha)->smp_lock) -#define GDTH_LOCK_HA(ha,flags) spin_lock_irqsave(&(ha)->smp_lock,flags) -#define GDTH_UNLOCK_HA(ha,flags) spin_unlock_irqrestore(&(ha)->smp_lock,flags) - -#define GDTH_LOCK_SCSI_DONE(flags) spin_lock_irqsave(&io_request_lock,flags) -#define GDTH_UNLOCK_SCSI_DONE(flags) spin_unlock_irqrestore(&io_request_lock,flags) -#endif - /* LILO and modprobe/insmod parameters */ /* IRQ list for GDT3000/3020 EISA controllers */ static int irq[MAXHA] __initdata = @@ -674,7 +641,6 @@ /* 64 bit DMA mode, support for drives > 2 TB, if force_dma32 = 0 */ static int force_dma32 = 0; -#ifdef MODULE /* parameters for modprobe/insmod */ module_param(irq, int, 0); module_param(disable, int, 0); @@ -689,33 +655,15 @@ module_param(probe_eisa_isa, int, 0); module_param(force_dma32, int, 0); MODULE_AUTHOR("Achim Leubner"); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,11) MODULE_LICENSE("GPL"); -#endif -#endif /* ioctl interface */ static struct file_operations gdth_fops = { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) .ioctl = gdth_ioctl, .open = gdth_open, .release = gdth_close, -#else - ioctl:gdth_ioctl, - open:gdth_open, - release:gdth_close, -#endif }; -/* /proc support */ -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) -struct proc_dir_entry proc_scsi_gdth = { - PROC_SCSI_GDTH, 4, "gdth", - S_IFDIR | S_IRUGO | S_IXUGO, 2 -}; -#endif - #include "gdth_proc.h" #include "gdth_proc.c" @@ -755,7 +703,7 @@ /* controller search and initialization functions */ -GDTH_INITFUNC(static int, gdth_search_eisa(ushort eisa_adr)) +static int __init gdth_search_eisa(ushort eisa_adr) { ulong32 id; @@ -773,7 +721,7 @@ } -GDTH_INITFUNC(static int, gdth_search_isa(ulong32 bios_adr)) +static int __init gdth_search_isa(ulong32 bios_adr) { void __iomem *addr; ulong32 id; @@ -789,7 +737,7 @@ } -GDTH_INITFUNC(static int, gdth_search_pci(gdth_pci_str *pcistr)) +static int __init gdth_search_pci(gdth_pci_str *pcistr) { ushort device, cnt; @@ -812,21 +760,19 @@ return cnt; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) /* Vortex only makes RAID controllers. * We do not really want to specify all 550 ids here, so wildcard match. */ -static struct pci_device_id gdthtable[] __devinitdata = { +static struct pci_device_id gdthtable[] __attribute_used__ = { {PCI_VENDOR_ID_VORTEX,PCI_ANY_ID,PCI_ANY_ID, PCI_ANY_ID}, {PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID_INTEL_SRC,PCI_ANY_ID,PCI_ANY_ID}, {PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID_INTEL_SRC_XSCALE,PCI_ANY_ID,PCI_ANY_ID}, {0} }; MODULE_DEVICE_TABLE(pci,gdthtable); -#endif -GDTH_INITFUNC(static void, gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt, - ushort vendor, ushort device)) +static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt, + ushort vendor, ushort device) { ulong base0, base1, base2; struct pci_dev *pdev; @@ -834,7 +780,6 @@ TRACE(("gdth_search_dev() cnt %d vendor %x device %x\n", *cnt, vendor, device)); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) pdev = NULL; while ((pdev = pci_find_device(vendor, device, pdev)) != NULL) { @@ -872,52 +817,10 @@ pcistr[*cnt].irq, pcistr[*cnt].dpmem)); (*cnt)++; } -#else - pdev = NULL; - while ((pdev = pci_find_device(vendor, device, pdev)) - != NULL) { - if (*cnt >= MAXHA) - return; - /* GDT PCI controller found, resources are already in pdev */ - pcistr[*cnt].pdev = pdev; - pcistr[*cnt].vendor_id = vendor; - pcistr[*cnt].device_id = device; - pcistr[*cnt].bus = pdev->bus->number; - pcistr[*cnt].device_fn = pdev->devfn; - pcibios_read_config_word(pcistr[*cnt].bus, pcistr[*cnt].device_fn, - PCI_SUBSYSTEM_ID, &pcistr[*cnt].subdevice_id); - pcistr[*cnt].irq = pdev->irq; - base0 = pdev->base_address[0]; - base1 = pdev->base_address[1]; - base2 = pdev->base_address[2]; - if (device <= PCI_DEVICE_ID_VORTEX_GDT6000B || /* GDT6000/B */ - device >= PCI_DEVICE_ID_VORTEX_GDT6x17RP) { /* MPR */ - if ((base0 & PCI_BASE_ADDRESS_SPACE) != - PCI_BASE_ADDRESS_SPACE_MEMORY) - continue; - pcistr[*cnt].dpmem = base0 & PCI_BASE_ADDRESS_MEM_MASK; - } else { /* GDT6110, GDT6120, .. */ - if ((base0 & PCI_BASE_ADDRESS_SPACE) != - PCI_BASE_ADDRESS_SPACE_MEMORY || - (base2 & PCI_BASE_ADDRESS_SPACE) != - PCI_BASE_ADDRESS_SPACE_MEMORY || - (base1 & PCI_BASE_ADDRESS_SPACE) != - PCI_BASE_ADDRESS_SPACE_IO) - continue; - pcistr[*cnt].dpmem = base2 & PCI_BASE_ADDRESS_MEM_MASK; - pcistr[*cnt].io_mm = base0 & PCI_BASE_ADDRESS_MEM_MASK; - pcistr[*cnt].io = base1 & PCI_BASE_ADDRESS_IO_MASK; - } - TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n", - pcistr[*cnt].bus, PCI_SLOT(pcistr[*cnt].device_fn), - pcistr[*cnt].irq, pcistr[*cnt].dpmem)); - (*cnt)++; - } -#endif } -GDTH_INITFUNC(static void, gdth_sort_pci(gdth_pci_str *pcistr, int cnt)) +static void __init gdth_sort_pci(gdth_pci_str *pcistr, int cnt) { gdth_pci_str temp; int i, changed; @@ -955,7 +858,7 @@ } -GDTH_INITFUNC(static int, gdth_init_eisa(ushort eisa_adr,gdth_ha_str *ha)) +static int __init gdth_init_eisa(ushort eisa_adr,gdth_ha_str *ha) { ulong32 retries,id; unchar prot_ver,eisacf,i,irq_found; @@ -1048,7 +951,7 @@ } -GDTH_INITFUNC(static int, gdth_init_isa(ulong32 bios_adr,gdth_ha_str *ha)) +static int __init gdth_init_isa(ulong32 bios_adr,gdth_ha_str *ha) { register gdt2_dpram_str __iomem *dp2_ptr; int i; @@ -1148,7 +1051,7 @@ } -GDTH_INITFUNC(static int, gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)) +static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha) { register gdt6_dpram_str __iomem *dp6_ptr; register gdt6c_dpram_str __iomem *dp6c_ptr; @@ -1168,9 +1071,7 @@ ha->stype = (ulong32)pcistr->device_id; ha->subdevice_id = pcistr->subdevice_id; ha->irq = pcistr->irq; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) ha->pdev = pcistr->pdev; -#endif if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */ TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq)); @@ -1401,7 +1302,6 @@ } /* manipulate config. space to enable DPMEM, start RP controller */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) pci_read_config_word(pcistr->pdev, PCI_COMMAND, &command); command |= 6; pci_write_config_word(pcistr->pdev, PCI_COMMAND, command); @@ -1412,18 +1312,6 @@ gdth_delay(1); pci_write_config_dword(pcistr->pdev, PCI_ROM_ADDRESS, pci_resource_start(pcistr->pdev, 8)); -#else - pci_read_config_word(pcistr->pdev, PCI_COMMAND, &command); - command |= 6; - pci_write_config_word(pcistr->pdev, PCI_COMMAND, command); - if (pcistr->pdev->rom_address == 1UL) - pcistr->pdev->rom_address = 0UL; - i = 0xFEFF0001UL; - pci_write_config_dword(pcistr->pdev, PCI_ROM_ADDRESS, i); - gdth_delay(1); - pci_write_config_dword(pcistr->pdev, PCI_ROM_ADDRESS, - pcistr->pdev->rom_address); -#endif dp6m_ptr = ha->brd; @@ -1550,7 +1438,7 @@ /* controller protocol functions */ -GDTH_INITFUNC(static void, gdth_enable_int(int hanum)) +static void __init gdth_enable_int(int hanum) { gdth_ha_str *ha; ulong flags; @@ -1560,7 +1448,7 @@ TRACE(("gdth_enable_int() hanum %d\n",hanum)); ha = HADATA(gdth_ctr_tab[hanum]); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); if (ha->type == GDT_EISA) { outb(0xff, ha->bmic + EDOORREG); @@ -1585,7 +1473,7 @@ gdth_writeb(gdth_readb(&dp6m_ptr->i960r.edoor_en_reg) & ~4, &dp6m_ptr->i960r.edoor_en_reg); } - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); } @@ -1897,7 +1785,7 @@ /* search for devices */ -GDTH_INITFUNC(static int, gdth_search_drives(int hanum)) +static int __init gdth_search_drives(int hanum) { register gdth_ha_str *ha; ushort cdev_cnt, i; @@ -2357,16 +2245,11 @@ TRACE(("gdth_putq() priority %d\n",priority)); ha = HADATA(gdth_ctr_tab[hanum]); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); scp->SCp.this_residual = (int)priority; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; t = scp->device->id; -#else - b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel; - t = scp->target; -#endif if (priority >= DEFAULT_PRI) { if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) || (b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock)) { @@ -2389,7 +2272,7 @@ pscp->SCp.ptr = (char *)scp; scp->SCp.ptr = (char *)nscp; } - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); #ifdef GDTH_STATISTICS flags = 0; @@ -2415,7 +2298,7 @@ TRACE(("gdth_next() hanum %d\n",hanum)); ha = HADATA(gdth_ctr_tab[hanum]); if (!gdth_polling) - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); ha->cmd_cnt = ha->cmd_offs_dpmem = 0; this_cmd = firsttime = TRUE; @@ -2425,15 +2308,9 @@ for (nscp = pscp = ha->req_first; nscp; nscp = (Scsi_Cmnd *)nscp->SCp.ptr) { if (nscp != pscp && nscp != (Scsi_Cmnd *)pscp->SCp.ptr) pscp = (Scsi_Cmnd *)pscp->SCp.ptr; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) b = virt_ctr ? NUMDATA(nscp->device->host)->busnum : nscp->device->channel; t = nscp->device->id; l = nscp->device->lun; -#else - b = virt_ctr ? NUMDATA(nscp->host)->busnum : nscp->channel; - t = nscp->target; - l = nscp->lun; -#endif if (nscp->SCp.this_residual >= DEFAULT_PRI) { if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) || (b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock)) @@ -2444,7 +2321,7 @@ if (gdth_test_busy(hanum)) { /* controller busy ? */ TRACE(("gdth_next() controller %d busy !\n",hanum)); if (!gdth_polling) { - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); return; } while (gdth_test_busy(hanum)) @@ -2513,14 +2390,8 @@ nscp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); if (!nscp->SCp.have_data_in) nscp->SCp.have_data_in++; - else { - if (!gdth_polling) - GDTH_UNLOCK_HA(ha,flags); - /* io_request_lock already active ! */ + else nscp->scsi_done(nscp); - if (!gdth_polling) - GDTH_LOCK_HA(ha,flags); - } } } else if (nscp->done == gdth_scsi_done && nscp->cmnd[0] == 0xff) { if (!(cmd_index=gdth_special_cmd(hanum,nscp))) @@ -2538,14 +2409,8 @@ nscp->result = DID_BAD_TARGET << 16; if (!nscp->SCp.have_data_in) nscp->SCp.have_data_in++; - else { - if (!gdth_polling) - GDTH_UNLOCK_HA(ha,flags); - /* io_request_lock already active ! */ + else nscp->scsi_done(nscp); - if (!gdth_polling) - GDTH_LOCK_HA(ha,flags); - } } else { switch (nscp->cmnd[0]) { case TEST_UNIT_READY: @@ -2555,9 +2420,7 @@ case VERIFY: case START_STOP: case MODE_SENSE: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) case SERVICE_ACTION_IN: -#endif TRACE(("cache cmd %x/%x/%x/%x/%x/%x\n",nscp->cmnd[0], nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], nscp->cmnd[4],nscp->cmnd[5])); @@ -2572,22 +2435,10 @@ nscp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); if (!nscp->SCp.have_data_in) nscp->SCp.have_data_in++; - else { - if (!gdth_polling) - GDTH_UNLOCK_HA(ha,flags); - /* io_request_lock already active ! */ + else nscp->scsi_done(nscp); - if (!gdth_polling) - GDTH_LOCK_HA(ha,flags); - } - } else if (gdth_internal_cache_cmd(hanum,nscp)) { - if (!gdth_polling) - GDTH_UNLOCK_HA(ha,flags); - /* io_request_lock already active ! */ + } else if (gdth_internal_cache_cmd(hanum,nscp)) nscp->scsi_done(nscp); - if (!gdth_polling) - GDTH_LOCK_HA(ha,flags); - } break; case ALLOW_MEDIUM_REMOVAL: @@ -2600,14 +2451,8 @@ nscp->sense_buffer[0] = 0; if (!nscp->SCp.have_data_in) nscp->SCp.have_data_in++; - else { - if (!gdth_polling) - GDTH_UNLOCK_HA(ha,flags); - /* io_request_lock already active ! */ + else nscp->scsi_done(nscp); - if (!gdth_polling) - GDTH_LOCK_HA(ha,flags); - } } else { nscp->cmnd[3] = (ha->hdr[t].devtype&1) ? 1:0; TRACE(("Prevent/allow r. %d rem. drive %d\n", @@ -2629,10 +2474,8 @@ case WRITE_6: case READ_10: case WRITE_10: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) case READ_16: case WRITE_16: -#endif if (ha->hdr[t].media_changed) { /* return UNIT_ATTENTION */ TRACE2(("cmd 0x%x target %d: UNIT_ATTENTION\n", @@ -2644,14 +2487,8 @@ nscp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); if (!nscp->SCp.have_data_in) nscp->SCp.have_data_in++; - else { - if (!gdth_polling) - GDTH_UNLOCK_HA(ha,flags); - /* io_request_lock already active ! */ + else nscp->scsi_done(nscp); - if (!gdth_polling) - GDTH_LOCK_HA(ha,flags); - } } else if (!(cmd_index=gdth_fill_cache_cmd(hanum,nscp,t))) this_cmd = FALSE; break; @@ -2665,14 +2502,8 @@ nscp->result = DID_ABORT << 16; if (!nscp->SCp.have_data_in) nscp->SCp.have_data_in++; - else { - if (!gdth_polling) - GDTH_UNLOCK_HA(ha,flags); - /* io_request_lock already active ! */ + else nscp->scsi_done(nscp); - if (!gdth_polling) - GDTH_LOCK_HA(ha,flags); - } break; } } @@ -2692,7 +2523,7 @@ } if (!gdth_polling) - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); if (gdth_polling && ha->cmd_cnt > 0) { if (!gdth_wait(hanum,cmd_index,POLL_TIMEOUT)) @@ -2708,7 +2539,6 @@ ushort cpsum,cpnow; struct scatterlist *sl; gdth_ha_str *ha; - int sgcnt; char *address; cpcount = count<=(ushort)scp->bufflen ? count:(ushort)scp->bufflen; @@ -2716,10 +2546,9 @@ if (scp->use_sg) { sl = (struct scatterlist *)scp->request_buffer; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) - sgcnt = pci_map_sg(ha->pdev,sl,scp->use_sg,PCI_DMA_FROMDEVICE); - for (i=0,cpsum=0; iuse_sg; ++i,++sl) { + unsigned long flags; + cpnow = (ushort)sl->length; TRACE(("copy_internal() now %d sum %d count %d %d\n", cpnow,cpsum,cpcount,(ushort)scp->bufflen)); if (cpsum+cpnow > cpcount) @@ -2730,30 +2559,16 @@ hanum); return; } - address = (char *)(page_address(sl->page) + sl->offset); - memcpy(address,buffer,cpnow); - if (cpsum == cpcount) - break; - buffer += cpnow; - } - pci_unmap_sg(ha->pdev,scp->request_buffer, - scp->use_sg,PCI_DMA_FROMDEVICE); -#else - sgcnt = scp->use_sg; - for (i=0,cpsum=0; ilength; - TRACE(("copy_internal() now %d sum %d count %d %d\n", - cpnow,cpsum,cpcount,(ushort)scp->bufflen)); - if (cpsum+cpnow > cpcount) - cpnow = cpcount - cpsum; - cpsum += cpnow; - address = (char *)sl->address; + local_irq_save(flags); + address = kmap_atomic(sl->page, KM_BIO_SRC_IRQ) + sl->offset; memcpy(address,buffer,cpnow); + flush_dcache_page(sl->page); + kunmap_atomic(address, KM_BIO_SRC_IRQ); + local_irq_restore(flags); if (cpsum == cpcount) break; buffer += cpnow; } -#endif } else { TRACE(("copy_internal() count %d\n",cpcount)); memcpy((char*)scp->request_buffer,buffer,cpcount); @@ -2770,11 +2585,7 @@ gdth_modep_data mpd; ha = HADATA(gdth_ctr_tab[hanum]); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) t = scp->device->id; -#else - t = scp->target; -#endif TRACE(("gdth_internal_cache_cmd() cmd 0x%x hdrive %d\n", scp->cmnd[0],t)); @@ -2839,7 +2650,6 @@ gdth_copy_internal_data(hanum,scp,(char*)&rdc,sizeof(gdth_rdcap_data)); break; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) case SERVICE_ACTION_IN: if ((scp->cmnd[1] & 0x1f) == SAI_READ_CAPACITY_16 && (ha->cache_feat & GDT_64BIT)) { @@ -2853,7 +2663,6 @@ scp->result = DID_ABORT << 16; } break; -#endif default: TRACE2(("Internal cache cmd 0x%x unknown\n",scp->cmnd[0])); @@ -2877,10 +2686,8 @@ ulong64 no, blockno; dma_addr_t phys_addr; int i, cmd_index, read_write, sgcnt, mode64; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) struct page *page; ulong offset; -#endif ha = HADATA(gdth_ctr_tab[hanum]); cmdp = ha->pccb; @@ -2922,10 +2729,7 @@ else cmdp->OpCode = GDT_FLUSH; } else if (scp->cmnd[0] == WRITE_6 || scp->cmnd[0] == WRITE_10 || - scp->cmnd[0] == WRITE_12 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - || scp->cmnd[0] == WRITE_16 -#endif + scp->cmnd[0] == WRITE_12 || scp->cmnd[0] == WRITE_16 ) { read_write = 1; if (gdth_write_through || ((ha->hdr[hdrive].rw_attribs & 1) && @@ -2976,7 +2780,6 @@ if (scp->use_sg) { sl = (struct scatterlist *)scp->request_buffer; sgcnt = scp->use_sg; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) scp->SCp.Status = GDTH_MAP_SG; scp->SCp.Message = (read_write == 1 ? PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); @@ -3005,23 +2808,6 @@ cmdp->u.cache.sg_lst[i].sg_len = sg_dma_len(sl); } } -#else - if (mode64) { - cmdp->u.cache64.DestAddr= (ulong64)-1; - cmdp->u.cache64.sg_canz = sgcnt; - for (i=0; iu.cache64.sg_lst[i].sg_ptr = virt_to_bus(sl->address); - cmdp->u.cache64.sg_lst[i].sg_len = (ulong32)sl->length; - } - } else { - cmdp->u.cache.DestAddr= 0xffffffff; - cmdp->u.cache.sg_canz = sgcnt; - for (i=0; iu.cache.sg_lst[i].sg_ptr = virt_to_bus(sl->address); - cmdp->u.cache.sg_lst[i].sg_len = (ulong32)sl->length; - } - } -#endif #ifdef GDTH_STATISTICS if (max_sg < (ulong32)sgcnt) { @@ -3031,7 +2817,6 @@ #endif } else { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) scp->SCp.Status = GDTH_MAP_SINGLE; scp->SCp.Message = (read_write == 1 ? PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); @@ -3040,9 +2825,6 @@ phys_addr = pci_map_page(ha->pdev,page,offset, scp->request_bufflen,scp->SCp.Message); scp->SCp.dma_handle = phys_addr; -#else - phys_addr = virt_to_bus(scp->request_buffer); -#endif if (mode64) { if (ha->cache_feat & SCATTER_GATHER) { cmdp->u.cache64.DestAddr = (ulong64)-1; @@ -3114,19 +2896,12 @@ dma_addr_t phys_addr, sense_paddr; int cmd_index, sgcnt, mode64; unchar t,l; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) struct page *page; ulong offset; -#endif ha = HADATA(gdth_ctr_tab[hanum]); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) t = scp->device->id; l = scp->device->lun; -#else - t = scp->target; - l = scp->lun; -#endif cmdp = ha->pccb; TRACE(("gdth_fill_raw_cmd() cmd 0x%x bus %d ID %d LUN %d\n", scp->cmnd[0],b,t,l)); @@ -3166,7 +2941,6 @@ } } else { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) page = virt_to_page(scp->sense_buffer); offset = (ulong)scp->sense_buffer & ~PAGE_MASK; sense_paddr = pci_map_page(ha->pdev,page,offset, @@ -3174,9 +2948,6 @@ scp->SCp.buffer = (struct scatterlist *)((ulong32)sense_paddr); /* high part, if 64bit */ scp->host_scribble = (char *)(ulong32)((ulong64)sense_paddr >> 32); -#else - sense_paddr = virt_to_bus(scp->sense_buffer); -#endif cmdp->OpCode = GDT_WRITE; /* always */ cmdp->BoardNode = LOCALBOARD; if (mode64) { @@ -3215,7 +2986,6 @@ if (scp->use_sg) { sl = (struct scatterlist *)scp->request_buffer; sgcnt = scp->use_sg; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) scp->SCp.Status = GDTH_MAP_SG; scp->SCp.Message = PCI_DMA_BIDIRECTIONAL; sgcnt = pci_map_sg(ha->pdev,sl,scp->use_sg,scp->SCp.Message); @@ -3243,23 +3013,6 @@ cmdp->u.raw.sg_lst[i].sg_len = sg_dma_len(sl); } } -#else - if (mode64) { - cmdp->u.raw64.sdata = (ulong64)-1; - cmdp->u.raw64.sg_ranz = sgcnt; - for (i=0; iu.raw64.sg_lst[i].sg_ptr = virt_to_bus(sl->address); - cmdp->u.raw64.sg_lst[i].sg_len = (ulong32)sl->length; - } - } else { - cmdp->u.raw.sdata = 0xffffffff; - cmdp->u.raw.sg_ranz = sgcnt; - for (i=0; iu.raw.sg_lst[i].sg_ptr = virt_to_bus(sl->address); - cmdp->u.raw.sg_lst[i].sg_len = (ulong32)sl->length; - } - } -#endif #ifdef GDTH_STATISTICS if (max_sg < sgcnt) { @@ -3269,7 +3022,6 @@ #endif } else { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) scp->SCp.Status = GDTH_MAP_SINGLE; scp->SCp.Message = PCI_DMA_BIDIRECTIONAL; page = virt_to_page(scp->request_buffer); @@ -3277,9 +3029,7 @@ phys_addr = pci_map_page(ha->pdev,page,offset, scp->request_bufflen,scp->SCp.Message); scp->SCp.dma_handle = phys_addr; -#else - phys_addr = virt_to_bus(scp->request_buffer); -#endif + if (mode64) { if (ha->raw_feat & SCATTER_GATHER) { cmdp->u.raw64.sdata = (ulong64)-1; @@ -3461,7 +3211,7 @@ ulong flags; TRACE2(("gdth_read_event() handle %d\n", handle)); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); if (handle == -1) eindex = eoldidx; else @@ -3469,7 +3219,7 @@ estr->event_source = 0; if (eindex >= MAX_EVENTS) { - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); return eindex; } e = &ebuffer[eindex]; @@ -3482,7 +3232,7 @@ } memcpy(estr, e, sizeof(gdth_evt_str)); } - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); return eindex; } @@ -3495,7 +3245,7 @@ unchar found = FALSE; TRACE2(("gdth_readapp_event() app. %d\n", application)); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); eindex = eoldidx; for (;;) { e = &ebuffer[eindex]; @@ -3515,7 +3265,7 @@ memcpy(estr, e, sizeof(gdth_evt_str)); else estr->event_source = 0; - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); } static void gdth_clear_events(void) @@ -3529,12 +3279,9 @@ /* SCSI interface functions */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) static irqreturn_t gdth_interrupt(int irq,void *dev_id,struct pt_regs *regs) -#else -static void gdth_interrupt(int irq,void *dev_id,struct pt_regs *regs) -#endif { + gdth_ha_str *ha2 = (gdth_ha_str *)dev_id; register gdth_ha_str *ha; gdt6m_dpram_str __iomem *dp6m_ptr = NULL; gdt6_dpram_str __iomem *dp6_ptr; @@ -3556,28 +3303,20 @@ /* if polling and not from gdth_wait() -> return */ if (gdth_polling) { if (!gdth_from_wait) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) return IRQ_HANDLED; -#else - return; -#endif } } if (!gdth_polling) - GDTH_LOCK_HA((gdth_ha_str *)dev_id,flags); + spin_lock_irqsave(&ha2->smp_lock, flags); wait_index = 0; /* search controller */ if ((hanum = gdth_get_status(&IStatus,irq)) == -1) { /* spurious interrupt */ if (!gdth_polling) - GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + spin_unlock_irqrestore(&ha2->smp_lock, flags); return IRQ_HANDLED; -#else - return; -#endif } ha = HADATA(gdth_ctr_tab[hanum]); @@ -3711,12 +3450,8 @@ } else { TRACE2(("gdth_interrupt() unknown controller type\n")); if (!gdth_polling) - GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + spin_unlock_irqrestore(&ha2->smp_lock, flags); return IRQ_HANDLED; -#else - return; -#endif } TRACE(("gdth_interrupt() index %d stat %d info %d\n", @@ -3731,13 +3466,9 @@ TRACE2(("gdth_interrupt() async. event\n")); gdth_async_event(hanum); if (!gdth_polling) - GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags); + spin_unlock_irqrestore(&ha2->smp_lock, flags); gdth_next(hanum); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) return IRQ_HANDLED; -#else - return; -#endif } if (IStatus == SPEZINDEX) { @@ -3746,12 +3477,8 @@ ha->dvr.eu.driver.ionode = hanum; gdth_store_event(ha, ES_DRIVER, 4, &ha->dvr); if (!gdth_polling) - GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + spin_unlock_irqrestore(&ha2->smp_lock, flags); return IRQ_HANDLED; -#else - return; -#endif } scp = ha->cmd_tab[IStatus-2].cmnd; Service = ha->cmd_tab[IStatus-2].service; @@ -3763,40 +3490,24 @@ ha->dvr.eu.driver.index = IStatus; gdth_store_event(ha, ES_DRIVER, 1, &ha->dvr); if (!gdth_polling) - GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + spin_unlock_irqrestore(&ha2->smp_lock, flags); return IRQ_HANDLED; -#else - return; -#endif } if (scp == INTERNAL_CMND) { TRACE(("gdth_interrupt() answer to internal command\n")); if (!gdth_polling) - GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + spin_unlock_irqrestore(&ha2->smp_lock, flags); return IRQ_HANDLED; -#else - return; -#endif } TRACE(("gdth_interrupt() sync. status\n")); rval = gdth_sync_event(hanum,Service,IStatus,scp); if (!gdth_polling) - GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags); + spin_unlock_irqrestore(&ha2->smp_lock, flags); if (rval == 2) { gdth_putq(hanum,scp,scp->SCp.this_residual); } else if (rval == 1) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - GDTH_LOCK_SCSI_DONE(scp->device->host, flags); - scp->scsi_done(scp); - GDTH_UNLOCK_SCSI_DONE(scp->device->host, flags); -#else - GDTH_LOCK_SCSI_DONE(flags); scp->scsi_done(scp); - GDTH_UNLOCK_SCSI_DONE(flags); -#endif } #ifdef INT_COAL @@ -3825,9 +3536,7 @@ #endif gdth_next(hanum); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) return IRQ_HANDLED; -#endif } static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp) @@ -3911,13 +3620,8 @@ printk("\n"); } else { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; t = scp->device->id; -#else - b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel; - t = scp->target; -#endif if (scp->SCp.sent_command == -1 && b != ha->virt_bus) { ha->raw[BUS_L2P(ha,b)].io_cnt[t]--; } @@ -3929,7 +3633,6 @@ /* retry */ return 2; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13) if (scp->SCp.Status == GDTH_MAP_SG) pci_unmap_sg(ha->pdev,scp->request_buffer, scp->use_sg,scp->SCp.Message); @@ -3943,7 +3646,7 @@ addr += (dma_addr_t)((ulong64)(ulong32)scp->host_scribble << 32); pci_unmap_page(ha->pdev,addr,16,PCI_DMA_FROMDEVICE); } -#endif + if (ha->status == S_OK) { scp->SCp.Status = S_OK; scp->SCp.Message = ha->info; @@ -4340,7 +4043,7 @@ int hanum = 0; ha = HADATA(gdth_ctr_tab[hanum]); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); for (act_stats=0,i=0; icmd_tab[i].cmnd != UNUSED_CMND) @@ -4355,11 +4058,11 @@ gdth_timer.expires = jiffies + 30 * HZ; add_timer(&gdth_timer); - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); } #endif -GDTH_INITFUNC(void, internal_setup(char *str,int *ints)) +void __init internal_setup(char *str,int *ints) { int i, argc; char *cur_str, *argv; @@ -4432,7 +4135,7 @@ } } -GDTH_INITFUNC(int, option_setup(char *str)) +int __init option_setup(char *str) { int ints[MAXHA]; char *cur = str; @@ -4450,7 +4153,7 @@ return 1; } -GDTH_INITFUNC(int, gdth_detect(Scsi_Host_Template *shtp)) +int __init gdth_detect(Scsi_Host_Template *shtp) { struct Scsi_Host *shp; gdth_pci_str pcistr[MAXHA]; @@ -4540,7 +4243,6 @@ ha->pccb = CMDDATA(shp); ha->ccb_phys = 0L; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) ha->pdev = NULL; ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, &scratch_dma_handle); @@ -4554,21 +4256,7 @@ MAXOFFSETS, &scratch_dma_handle); ha->coal_stat_phys = scratch_dma_handle; #endif -#else - ha->pscratch = scsi_init_malloc(GDTH_SCRATCH, GFP_ATOMIC | GFP_DMA); - if (ha->pscratch) - ha->scratch_phys = virt_to_bus(ha->pscratch); - ha->pmsg = scsi_init_malloc(sizeof(gdth_msg_str), GFP_ATOMIC | GFP_DMA); - if (ha->pmsg) - ha->msg_phys = virt_to_bus(ha->pmsg); -#ifdef INT_COAL - ha->coal_stat = - scsi_init_malloc(sizeof(gdth_coal_status) * MAXOFFSETS, - GFP_ATOMIC | GFP_DMA); - if (ha->coal_stat) - ha->coal_stat_phys = virt_to_bus(ha->coal_stat); -#endif -#endif + ha->scratch_busy = FALSE; ha->req_first = NULL; ha->tid_cnt = MAX_HDRIVES; @@ -4583,7 +4271,7 @@ printk("GDT-ISA: Error during device scan\n"); --gdth_ctr_count; --gdth_ctr_vcount; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) + #ifdef INT_COAL if (ha->coal_stat) pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * @@ -4596,17 +4284,7 @@ if (ha->pmsg) pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), ha->pmsg, ha->msg_phys); -#else -#ifdef INT_COAL - if (ha->coal_stat) - scsi_init_free((void *)ha->coal_stat, - sizeof(gdth_coal_status) * MAXOFFSETS); -#endif - if (ha->pscratch) - scsi_init_free((void *)ha->pscratch, GDTH_SCRATCH); - if (ha->pmsg) - scsi_init_free((void *)ha->pmsg, sizeof(gdth_msg_str)); -#endif + free_irq(ha->irq,ha); scsi_unregister(shp); continue; @@ -4615,14 +4293,13 @@ hdr_channel = ha->bus_cnt; ha->virt_bus = hdr_channel; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) && \ LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) shp->highmem_io = 0; #endif if (ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) shp->max_cmd_len = 16; -#endif + shp->max_id = ha->tid_cnt; shp->max_lun = MAXLUN; shp->max_channel = virt_ctr ? 0 : ha->bus_cnt; @@ -4640,7 +4317,7 @@ } } - GDTH_INIT_LOCK_HA(ha); + spin_lock_init(&ha->smp_lock); gdth_enable_int(hanum); #endif /* !__ia64__ */ } @@ -4686,7 +4363,7 @@ ha->pccb = CMDDATA(shp); ha->ccb_phys = 0L; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) + ha->pdev = NULL; ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, &scratch_dma_handle); @@ -4703,22 +4380,6 @@ ha->ccb_phys = pci_map_single(ha->pdev,ha->pccb, sizeof(gdth_cmd_str),PCI_DMA_BIDIRECTIONAL); -#else - ha->pscratch = scsi_init_malloc(GDTH_SCRATCH, GFP_ATOMIC | GFP_DMA); - if (ha->pscratch) - ha->scratch_phys = virt_to_bus(ha->pscratch); - ha->pmsg = scsi_init_malloc(sizeof(gdth_msg_str), GFP_ATOMIC | GFP_DMA); - if (ha->pmsg) - ha->msg_phys = virt_to_bus(ha->pmsg); -#ifdef INT_COAL - ha->coal_stat = - scsi_init_malloc(sizeof(gdth_coal_status) * MAXOFFSETS, - GFP_ATOMIC | GFP_DMA); - if (ha->coal_stat) - ha->coal_stat_phys = virt_to_bus(ha->coal_stat); -#endif - ha->ccb_phys = virt_to_bus(ha->pccb); -#endif ha->scratch_busy = FALSE; ha->req_first = NULL; ha->tid_cnt = MAX_HDRIVES; @@ -4733,7 +4394,6 @@ printk("GDT-EISA: Error during device scan\n"); --gdth_ctr_count; --gdth_ctr_vcount; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #ifdef INT_COAL if (ha->coal_stat) pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * @@ -4749,17 +4409,6 @@ if (ha->ccb_phys) pci_unmap_single(ha->pdev,ha->ccb_phys, sizeof(gdth_cmd_str),PCI_DMA_BIDIRECTIONAL); -#else -#ifdef INT_COAL - if (ha->coal_stat) - scsi_init_free((void *)ha->coal_stat, - sizeof(gdth_coal_status) * MAXOFFSETS); -#endif - if (ha->pscratch) - scsi_init_free((void *)ha->pscratch, GDTH_SCRATCH); - if (ha->pmsg) - scsi_init_free((void *)ha->pmsg, sizeof(gdth_msg_str)); -#endif free_irq(ha->irq,ha); scsi_unregister(shp); continue; @@ -4768,14 +4417,13 @@ hdr_channel = ha->bus_cnt; ha->virt_bus = hdr_channel; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) && \ LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) shp->highmem_io = 0; #endif if (ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) shp->max_cmd_len = 16; -#endif + shp->max_id = ha->tid_cnt; shp->max_lun = MAXLUN; shp->max_channel = virt_ctr ? 0 : ha->bus_cnt; @@ -4793,7 +4441,7 @@ } } - GDTH_INIT_LOCK_HA(ha); + spin_lock_init(&ha->smp_lock); gdth_enable_int(hanum); } } @@ -4841,7 +4489,7 @@ ha->pccb = CMDDATA(shp); ha->ccb_phys = 0L; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) + ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, &scratch_dma_handle); ha->scratch_phys = scratch_dma_handle; @@ -4854,21 +4502,6 @@ MAXOFFSETS, &scratch_dma_handle); ha->coal_stat_phys = scratch_dma_handle; #endif -#else - ha->pscratch = scsi_init_malloc(GDTH_SCRATCH, GFP_ATOMIC | GFP_DMA); - if (ha->pscratch) - ha->scratch_phys = virt_to_bus(ha->pscratch); - ha->pmsg = scsi_init_malloc(sizeof(gdth_msg_str), GFP_ATOMIC | GFP_DMA); - if (ha->pmsg) - ha->msg_phys = virt_to_bus(ha->pmsg); -#ifdef INT_COAL - ha->coal_stat = - scsi_init_malloc(sizeof(gdth_coal_status) * MAXOFFSETS, - GFP_ATOMIC | GFP_DMA); - if (ha->coal_stat) - ha->coal_stat_phys = virt_to_bus(ha->coal_stat); -#endif -#endif ha->scratch_busy = FALSE; ha->req_first = NULL; ha->tid_cnt = pcistr[ctr].device_id >= 0x200 ? MAXID : MAX_HDRIVES; @@ -4887,7 +4520,7 @@ hdr_channel = ha->bus_cnt; ha->virt_bus = hdr_channel; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) scsi_set_device(shp, &pcistr[ctr].pdev->dev); #else @@ -4909,14 +4542,12 @@ err = TRUE; } } -#endif } if (err) { printk("GDT-PCI %d: Error during device scan\n", hanum); --gdth_ctr_count; --gdth_ctr_vcount; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #ifdef INT_COAL if (ha->coal_stat) pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * @@ -4929,17 +4560,6 @@ if (ha->pmsg) pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), ha->pmsg, ha->msg_phys); -#else -#ifdef INT_COAL - if (ha->coal_stat) - scsi_init_free((void *)ha->coal_stat, - sizeof(gdth_coal_status) * MAXOFFSETS); -#endif - if (ha->pscratch) - scsi_init_free((void *)ha->pscratch, GDTH_SCRATCH); - if (ha->pmsg) - scsi_init_free((void *)ha->pmsg, sizeof(gdth_msg_str)); -#endif free_irq(ha->irq,ha); scsi_unregister(shp); continue; @@ -4962,8 +4582,7 @@ } } - - GDTH_INIT_LOCK_HA(ha); + spin_lock_init(&ha->smp_lock); gdth_enable_int(hanum); } @@ -4994,12 +4613,10 @@ if (NUMDATA(shp)->busnum == 0) { hanum = NUMDATA(shp)->hanum; ha = HADATA(gdth_ctr_tab[hanum]); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) if (ha->sdev) { scsi_free_host_dev(ha->sdev); ha->sdev = NULL; } -#endif gdth_flush(hanum); if (shp->irq) { @@ -5010,7 +4627,6 @@ free_dma(shp->dma_channel); } #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #ifdef INT_COAL if (ha->coal_stat) pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * @@ -5025,17 +4641,6 @@ if (ha->ccb_phys) pci_unmap_single(ha->pdev,ha->ccb_phys, sizeof(gdth_cmd_str),PCI_DMA_BIDIRECTIONAL); -#else -#ifdef INT_COAL - if (ha->coal_stat) - scsi_init_free((void *)ha->coal_stat, - sizeof(gdth_coal_status) * MAXOFFSETS); -#endif - if (ha->pscratch) - scsi_init_free((void *)ha->pscratch, GDTH_SCRATCH); - if (ha->pmsg) - scsi_init_free((void *)ha->pmsg, sizeof(gdth_msg_str)); -#endif gdth_ctr_released++; TRACE2(("gdth_release(): HA %d of %d\n", gdth_ctr_released, gdth_ctr_count)); @@ -5098,21 +4703,6 @@ return ((const char *)ha->binfo.type_string); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) -/* old error handling */ -int gdth_abort(Scsi_Cmnd *scp) -{ - TRACE2(("gdth_abort() reason %d\n",scp->abort_reason)); - return SCSI_ABORT_SNOOZE; -} - -int gdth_reset(Scsi_Cmnd *scp, unsigned int reset_flags) -{ - TRACE2(("gdth_reset()\n")); - return SCSI_RESET_PUNT; -} -#endif - /* new error handling */ int gdth_eh_abort(Scsi_Cmnd *scp) { @@ -5135,33 +4725,25 @@ unchar b; TRACE2(("gdth_eh_bus_reset()\n")); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + hanum = NUMDATA(scp->device->host)->hanum; b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; -#else - hanum = NUMDATA(scp->host)->hanum; - b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel; -#endif ha = HADATA(gdth_ctr_tab[hanum]); /* clear command tab */ - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); for (i = 0; i < GDTH_MAXCMDS; ++i) { cmnd = ha->cmd_tab[i].cmnd; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) if (!SPECIAL_SCP(cmnd) && cmnd->device->channel == b) -#else - if (!SPECIAL_SCP(cmnd) && cmnd->channel == b) -#endif ha->cmd_tab[i].cmnd = UNUSED_CMND; } - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); if (b == ha->virt_bus) { /* host drives */ for (i = 0; i < MAX_HDRIVES; ++i) { if (ha->hdr[i].present) { - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); gdth_polling = TRUE; while (gdth_test_busy(hanum)) gdth_delay(0); @@ -5169,12 +4751,12 @@ GDT_CLUST_RESET, i, 0, 0)) ha->hdr[i].cluster_type &= ~CLUSTER_RESERVED; gdth_polling = FALSE; - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); } } } else { /* raw devices */ - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); for (i = 0; i < MAXID; ++i) ha->raw[BUS_L2P(ha,b)].io_cnt[i] = 0; gdth_polling = TRUE; @@ -5183,7 +4765,7 @@ gdth_internal_cmd(hanum, SCSIRAWSERVICE, GDT_RESET_BUS, BUS_L2P(ha,b), 0, 0); gdth_polling = FALSE; - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); } return SUCCESS; } @@ -5249,11 +4831,8 @@ scp->SCp.sent_command = -1; scp->SCp.Status = GDTH_MAP_NONE; scp->SCp.buffer = (struct scatterlist *)NULL; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + hanum = NUMDATA(scp->device->host)->hanum; -#else - hanum = NUMDATA(scp->host)->hanum; -#endif #ifdef GDTH_STATISTICS ++act_ios; #endif @@ -5270,7 +4849,6 @@ static int gdth_open(struct inode *inode, struct file *filep) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) gdth_ha_str *ha; int i; @@ -5279,7 +4857,6 @@ if (!ha->sdev) ha->sdev = scsi_get_host_dev(gdth_ctr_tab[i]); } -#endif TRACE(("gdth_open()\n")); return 0; @@ -5311,10 +4888,10 @@ evt.event.event_data.size=sizeof(evt.event.event_data.eu.sync); else evt.event.event_data.size=sizeof(evt.event.event_data.eu.async); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); gdth_store_event(ha, evt.event.event_source, evt.event.event_idx, &evt.event.event_data); - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); } else if (evt.erase == 0xfe) { gdth_clear_events(); } else if (evt.erase == 0) { @@ -5344,15 +4921,15 @@ if (j >= MAX_HDRIVES || !ha->hdr[j].present) continue; if (ldrv.lock) { - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); ha->hdr[j].lock = 1; - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); gdth_wait_completion(ldrv.ionode, ha->bus_cnt, j); gdth_stop_timeout(ldrv.ionode, ha->bus_cnt, j); } else { - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); ha->hdr[j].lock = 0; - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); gdth_start_timeout(ldrv.ionode, ha->bus_cnt, j); gdth_next(ldrv.ionode); } @@ -5367,11 +4944,9 @@ int hanum; gdth_ha_str *ha; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - Scsi_Request *srp; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - Scsi_Cmnd *scp; + Scsi_Request *srp; #else - Scsi_Cmnd scp; + Scsi_Cmnd *scp; #endif if (copy_from_user(&res, arg, sizeof(gdth_ioctl_reset)) || @@ -5398,7 +4973,7 @@ gdth_do_req(srp, &cmd, cmnd, 30); res.status = (ushort)srp->sr_command->SCp.Status; scsi_release_request(srp); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else scp = scsi_allocate_device(ha->sdev, 1, FALSE); if (!scp) return -ENOMEM; @@ -5407,15 +4982,8 @@ gdth_do_cmd(scp, &cmd, cmnd, 30); res.status = (ushort)scp->SCp.Status; scsi_release_command(scp); -#else - memset(&ha->sdev,0,sizeof(Scsi_Device)); - memset(&scp, 0,sizeof(Scsi_Cmnd)); - ha->sdev.host = scp.host = gdth_ctr_tab[hanum]; - ha->sdev.id = scp.target = ha->sdev.host->this_id; - scp.device = &ha->sdev; - gdth_do_cmd(&scp, &cmd, cmnd, 30); - res.status = (ushort)scp.SCp.Status; #endif + if (copy_to_user(arg, &res, sizeof(gdth_ioctl_reset))) return -EFAULT; return 0; @@ -5430,10 +4998,8 @@ gdth_ha_str *ha; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) Scsi_Request *srp; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - Scsi_Cmnd *scp; #else - Scsi_Cmnd scp; + Scsi_Cmnd *scp; #endif if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general)) || @@ -5536,7 +5102,7 @@ gen.status = srp->sr_command->SCp.Status; gen.info = srp->sr_command->SCp.Message; scsi_release_request(srp); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else scp = scsi_allocate_device(ha->sdev, 1, FALSE); if (!scp) return -ENOMEM; @@ -5546,15 +5112,6 @@ gen.status = scp->SCp.Status; gen.info = scp->SCp.Message; scsi_release_command(scp); -#else - memset(&ha->sdev,0,sizeof(Scsi_Device)); - memset(&scp, 0,sizeof(Scsi_Cmnd)); - ha->sdev.host = scp.host = gdth_ctr_tab[hanum]; - ha->sdev.id = scp.target = ha->sdev.host->this_id; - scp.device = &ha->sdev; - gdth_do_cmd(&scp, &gen.command, cmnd, gen.timeout); - gen.status = scp.SCp.Status; - gen.info = scp.SCp.Message; #endif if (copy_to_user(arg + sizeof(gdth_ioctl_general), buf, @@ -5573,185 +5130,183 @@ static int ioc_hdrlist(void __user *arg, char *cmnd) { - gdth_ioctl_rescan rsc; - gdth_cmd_str cmd; + gdth_ioctl_rescan *rsc; + gdth_cmd_str *cmd; gdth_ha_str *ha; unchar i; - int hanum; + int hanum, rc = -ENOMEM; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) Scsi_Request *srp; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - Scsi_Cmnd *scp; #else - Scsi_Cmnd scp; + Scsi_Cmnd *scp; #endif - if (copy_from_user(&rsc, arg, sizeof(gdth_ioctl_rescan)) || - rsc.ionode >= gdth_ctr_count) - return -EFAULT; - hanum = rsc.ionode; + rsc = kmalloc(sizeof(*rsc), GFP_KERNEL); + cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); + if (!rsc || !cmd) + goto free_fail; + + if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) || + rsc->ionode >= gdth_ctr_count) { + rc = -EFAULT; + goto free_fail; + } + hanum = rsc->ionode; ha = HADATA(gdth_ctr_tab[hanum]); - memset(&cmd, 0, sizeof(gdth_cmd_str)); + memset(cmd, 0, sizeof(gdth_cmd_str)); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) srp = scsi_allocate_request(ha->sdev, GFP_KERNEL); if (!srp) - return -ENOMEM; + goto free_fail; srp->sr_cmd_len = 12; srp->sr_use_sg = 0; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else scp = scsi_allocate_device(ha->sdev, 1, FALSE); if (!scp) - return -ENOMEM; + goto free_fail; scp->cmd_len = 12; scp->use_sg = 0; -#else - memset(&ha->sdev,0,sizeof(Scsi_Device)); - memset(&scp, 0,sizeof(Scsi_Cmnd)); - ha->sdev.host = scp.host = gdth_ctr_tab[hanum]; - ha->sdev.id = scp.target = ha->sdev.host->this_id; - scp.device = &ha->sdev; #endif for (i = 0; i < MAX_HDRIVES; ++i) { if (!ha->hdr[i].present) { - rsc.hdr_list[i].bus = 0xff; + rsc->hdr_list[i].bus = 0xff; continue; } - rsc.hdr_list[i].bus = ha->virt_bus; - rsc.hdr_list[i].target = i; - rsc.hdr_list[i].lun = 0; - rsc.hdr_list[i].cluster_type = ha->hdr[i].cluster_type; + rsc->hdr_list[i].bus = ha->virt_bus; + rsc->hdr_list[i].target = i; + rsc->hdr_list[i].lun = 0; + rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type; if (ha->hdr[i].cluster_type & CLUSTER_DRIVE) { - cmd.Service = CACHESERVICE; - cmd.OpCode = GDT_CLUST_INFO; + cmd->Service = CACHESERVICE; + cmd->OpCode = GDT_CLUST_INFO; if (ha->cache_feat & GDT_64BIT) - cmd.u.cache64.DeviceNo = i; + cmd->u.cache64.DeviceNo = i; else - cmd.u.cache.DeviceNo = i; + cmd->u.cache.DeviceNo = i; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(srp, &cmd, cmnd, 30); + gdth_do_req(srp, cmd, cmnd, 30); if (srp->sr_command->SCp.Status == S_OK) - rsc.hdr_list[i].cluster_type = srp->sr_command->SCp.Message; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &cmd, cmnd, 30); - if (scp->SCp.Status == S_OK) - rsc.hdr_list[i].cluster_type = scp->SCp.Message; + rsc->hdr_list[i].cluster_type = srp->sr_command->SCp.Message; #else - gdth_do_cmd(&scp, &cmd, cmnd, 30); - if (scp.SCp.Status == S_OK) - rsc.hdr_list[i].cluster_type = scp.SCp.Message; + gdth_do_cmd(scp, cmd, cmnd, 30); + if (scp->SCp.Status == S_OK) + rsc->hdr_list[i].cluster_type = scp->SCp.Message; #endif } } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) scsi_release_request(srp); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else scsi_release_command(scp); #endif - if (copy_to_user(arg, &rsc, sizeof(gdth_ioctl_rescan))) - return -EFAULT; - return 0; + if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan))) + rc = -EFAULT; + else + rc = 0; + +free_fail: + kfree(rsc); + kfree(cmd); + return rc; } static int ioc_rescan(void __user *arg, char *cmnd) { - gdth_ioctl_rescan rsc; - gdth_cmd_str cmd; + gdth_ioctl_rescan *rsc; + gdth_cmd_str *cmd; ushort i, status, hdr_cnt; ulong32 info; int hanum, cyls, hds, secs; + int rc = -ENOMEM; ulong flags; gdth_ha_str *ha; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) Scsi_Request *srp; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - Scsi_Cmnd *scp; #else - Scsi_Cmnd scp; + Scsi_Cmnd *scp; #endif - - if (copy_from_user(&rsc, arg, sizeof(gdth_ioctl_rescan)) || - rsc.ionode >= gdth_ctr_count) - return -EFAULT; - hanum = rsc.ionode; + + rsc = kmalloc(sizeof(*rsc), GFP_KERNEL); + cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); + if (!cmd || !rsc) + goto free_fail; + + if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) || + rsc->ionode >= gdth_ctr_count) { + rc = -EFAULT; + goto free_fail; + } + hanum = rsc->ionode; ha = HADATA(gdth_ctr_tab[hanum]); - memset(&cmd, 0, sizeof(gdth_cmd_str)); + memset(cmd, 0, sizeof(gdth_cmd_str)); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) srp = scsi_allocate_request(ha->sdev, GFP_KERNEL); if (!srp) - return -ENOMEM; + goto free_fail; srp->sr_cmd_len = 12; srp->sr_use_sg = 0; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else scp = scsi_allocate_device(ha->sdev, 1, FALSE); if (!scp) - return -ENOMEM; + goto free_fail; scp->cmd_len = 12; scp->use_sg = 0; -#else - memset(&ha->sdev,0,sizeof(Scsi_Device)); - memset(&scp, 0,sizeof(Scsi_Cmnd)); - ha->sdev.host = scp.host = gdth_ctr_tab[hanum]; - ha->sdev.id = scp.target = ha->sdev.host->this_id; - scp.device = &ha->sdev; #endif - if (rsc.flag == 0) { + if (rsc->flag == 0) { /* old method: re-init. cache service */ - cmd.Service = CACHESERVICE; + cmd->Service = CACHESERVICE; if (ha->cache_feat & GDT_64BIT) { - cmd.OpCode = GDT_X_INIT_HOST; - cmd.u.cache64.DeviceNo = LINUX_OS; + cmd->OpCode = GDT_X_INIT_HOST; + cmd->u.cache64.DeviceNo = LINUX_OS; } else { - cmd.OpCode = GDT_INIT; - cmd.u.cache.DeviceNo = LINUX_OS; + cmd->OpCode = GDT_INIT; + cmd->u.cache.DeviceNo = LINUX_OS; } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(srp, &cmd, cmnd, 30); + gdth_do_req(srp, cmd, cmnd, 30); status = (ushort)srp->sr_command->SCp.Status; info = (ulong32)srp->sr_command->SCp.Message; #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &cmd, cmnd, 30); + gdth_do_cmd(scp, cmd, cmnd, 30); status = (ushort)scp->SCp.Status; info = (ulong32)scp->SCp.Message; #else - gdth_do_cmd(&scp, &cmd, cmnd, 30); + gdth_do_cmd(&scp, cmd, cmnd, 30); status = (ushort)scp.SCp.Status; info = (ulong32)scp.SCp.Message; #endif i = 0; hdr_cnt = (status == S_OK ? (ushort)info : 0); } else { - i = rsc.hdr_no; + i = rsc->hdr_no; hdr_cnt = i + 1; } + for (; i < hdr_cnt && i < MAX_HDRIVES; ++i) { - cmd.Service = CACHESERVICE; - cmd.OpCode = GDT_INFO; + cmd->Service = CACHESERVICE; + cmd->OpCode = GDT_INFO; if (ha->cache_feat & GDT_64BIT) - cmd.u.cache64.DeviceNo = i; + cmd->u.cache64.DeviceNo = i; else - cmd.u.cache.DeviceNo = i; + cmd->u.cache.DeviceNo = i; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(srp, &cmd, cmnd, 30); + gdth_do_req(srp, cmd, cmnd, 30); status = (ushort)srp->sr_command->SCp.Status; info = (ulong32)srp->sr_command->SCp.Message; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &cmd, cmnd, 30); +#else + gdth_do_cmd(scp, cmd, cmnd, 30); status = (ushort)scp->SCp.Status; info = (ulong32)scp->SCp.Message; -#else - gdth_do_cmd(&scp, &cmd, cmnd, 30); - status = (ushort)scp.SCp.Status; - info = (ulong32)scp.SCp.Message; #endif - GDTH_LOCK_HA(ha, flags); - rsc.hdr_list[i].bus = ha->virt_bus; - rsc.hdr_list[i].target = i; - rsc.hdr_list[i].lun = 0; + spin_lock_irqsave(&ha->smp_lock, flags); + rsc->hdr_list[i].bus = ha->virt_bus; + rsc->hdr_list[i].target = i; + rsc->hdr_list[i].lun = 0; if (status != S_OK) { ha->hdr[i].present = FALSE; } else { @@ -5765,7 +5320,7 @@ /* round size */ ha->hdr[i].size = cyls * hds * secs; } - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); if (status != S_OK) continue; @@ -5773,99 +5328,87 @@ /* but we need ha->info2, not yet stored in scp->SCp */ /* devtype, cluster info, R/W attribs */ - cmd.Service = CACHESERVICE; - cmd.OpCode = GDT_DEVTYPE; + cmd->Service = CACHESERVICE; + cmd->OpCode = GDT_DEVTYPE; if (ha->cache_feat & GDT_64BIT) - cmd.u.cache64.DeviceNo = i; + cmd->u.cache64.DeviceNo = i; else - cmd.u.cache.DeviceNo = i; + cmd->u.cache.DeviceNo = i; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(srp, &cmd, cmnd, 30); + gdth_do_req(srp, cmd, cmnd, 30); status = (ushort)srp->sr_command->SCp.Status; info = (ulong32)srp->sr_command->SCp.Message; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &cmd, cmnd, 30); +#else + gdth_do_cmd(scp, cmd, cmnd, 30); status = (ushort)scp->SCp.Status; info = (ulong32)scp->SCp.Message; -#else - gdth_do_cmd(&scp, &cmd, cmnd, 30); - status = (ushort)scp.SCp.Status; - info = (ulong32)scp.SCp.Message; #endif - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); ha->hdr[i].devtype = (status == S_OK ? (ushort)info : 0); - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); - cmd.Service = CACHESERVICE; - cmd.OpCode = GDT_CLUST_INFO; + cmd->Service = CACHESERVICE; + cmd->OpCode = GDT_CLUST_INFO; if (ha->cache_feat & GDT_64BIT) - cmd.u.cache64.DeviceNo = i; + cmd->u.cache64.DeviceNo = i; else - cmd.u.cache.DeviceNo = i; + cmd->u.cache.DeviceNo = i; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(srp, &cmd, cmnd, 30); + gdth_do_req(srp, cmd, cmnd, 30); status = (ushort)srp->sr_command->SCp.Status; info = (ulong32)srp->sr_command->SCp.Message; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &cmd, cmnd, 30); +#else + gdth_do_cmd(scp, cmd, cmnd, 30); status = (ushort)scp->SCp.Status; info = (ulong32)scp->SCp.Message; -#else - gdth_do_cmd(&scp, &cmd, cmnd, 30); - status = (ushort)scp.SCp.Status; - info = (ulong32)scp.SCp.Message; #endif - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); ha->hdr[i].cluster_type = ((status == S_OK && !shared_access) ? (ushort)info : 0); - GDTH_UNLOCK_HA(ha, flags); - rsc.hdr_list[i].cluster_type = ha->hdr[i].cluster_type; + spin_unlock_irqrestore(&ha->smp_lock, flags); + rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type; - cmd.Service = CACHESERVICE; - cmd.OpCode = GDT_RW_ATTRIBS; + cmd->Service = CACHESERVICE; + cmd->OpCode = GDT_RW_ATTRIBS; if (ha->cache_feat & GDT_64BIT) - cmd.u.cache64.DeviceNo = i; + cmd->u.cache64.DeviceNo = i; else - cmd.u.cache.DeviceNo = i; + cmd->u.cache.DeviceNo = i; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(srp, &cmd, cmnd, 30); + gdth_do_req(srp, cmd, cmnd, 30); status = (ushort)srp->sr_command->SCp.Status; info = (ulong32)srp->sr_command->SCp.Message; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &cmd, cmnd, 30); +#else + gdth_do_cmd(scp, cmd, cmnd, 30); status = (ushort)scp->SCp.Status; info = (ulong32)scp->SCp.Message; -#else - gdth_do_cmd(&scp, &cmd, cmnd, 30); - status = (ushort)scp.SCp.Status; - info = (ulong32)scp.SCp.Message; #endif - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); ha->hdr[i].rw_attribs = (status == S_OK ? (ushort)info : 0); - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) scsi_release_request(srp); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else scsi_release_command(scp); #endif - if (copy_to_user(arg, &rsc, sizeof(gdth_ioctl_rescan))) - return -EFAULT; - return 0; + if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan))) + rc = -EFAULT; + else + rc = 0; + +free_fail: + kfree(rsc); + kfree(cmd); + return rc; } static int gdth_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, unsigned long arg) { gdth_ha_str *ha; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - Scsi_Cmnd *scp; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) Scsi_Cmnd *scp; -#else - Scsi_Cmnd scp; -#endif ulong flags; char cmnd[MAX_COMMAND_SIZE]; void __user *argp = (void __user *)arg; @@ -5956,17 +5499,17 @@ i = lchn.channel; if (i < ha->bus_cnt) { if (lchn.lock) { - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); ha->raw[i].lock = 1; - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); for (j = 0; j < ha->tid_cnt; ++j) { gdth_wait_completion(lchn.ionode, i, j); gdth_stop_timeout(lchn.ionode, i, j); } } else { - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); ha->raw[i].lock = 0; - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); for (j = 0; j < ha->tid_cnt; ++j) { gdth_start_timeout(lchn.ionode, i, j); gdth_next(lchn.ionode); @@ -6004,7 +5547,7 @@ rval = gdth_eh_bus_reset(scp); res.status = (rval == SUCCESS ? S_OK : S_GENERR); scsi_put_command(scp); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else scp = scsi_allocate_device(ha->sdev, 1, FALSE); if (!scp) return -ENOMEM; @@ -6014,15 +5557,6 @@ rval = gdth_eh_bus_reset(scp); res.status = (rval == SUCCESS ? S_OK : S_GENERR); scsi_release_command(scp); -#else - memset(&ha->sdev,0,sizeof(Scsi_Device)); - memset(&scp, 0,sizeof(Scsi_Cmnd)); - ha->sdev.host = scp.host = gdth_ctr_tab[hanum]; - ha->sdev.id = scp.target = ha->sdev.host->this_id; - scp.device = &ha->sdev; - scp.channel = virt_ctr ? 0 : res.number; - rval = gdth_eh_bus_reset(&scp); - res.status = (rval == SUCCESS ? S_OK : S_GENERR); #endif if (copy_to_user(argp, &res, sizeof(gdth_ioctl_reset))) return -EFAULT; @@ -6047,14 +5581,10 @@ gdth_cmd_str gdtcmd; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) Scsi_Request *srp; - Scsi_Device *sdev; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - Scsi_Cmnd *scp; - Scsi_Device *sdev; #else - Scsi_Cmnd scp; - Scsi_Device sdev; + Scsi_Cmnd *scp; #endif + Scsi_Device *sdev; char cmnd[MAX_COMMAND_SIZE]; memset(cmnd, 0xff, MAX_COMMAND_SIZE); @@ -6068,19 +5598,13 @@ return; srp->sr_cmd_len = 12; srp->sr_use_sg = 0; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]); scp = scsi_allocate_device(sdev, 1, FALSE); if (!scp) return; scp->cmd_len = 12; scp->use_sg = 0; -#else - memset(&sdev,0,sizeof(Scsi_Device)); - memset(&scp, 0,sizeof(Scsi_Cmnd)); - sdev.host = scp.host = gdth_ctr_tab[hanum]; - sdev.id = scp.target = sdev.host->this_id; - scp.device = &sdev; #endif for (i = 0; i < MAX_HDRIVES; ++i) { @@ -6100,17 +5624,15 @@ TRACE2(("gdth_flush(): flush ha %d drive %d\n", hanum, i)); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) gdth_do_req(srp, &gdtcmd, cmnd, 30); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &gdtcmd, cmnd, 30); #else - gdth_do_cmd(&scp, &gdtcmd, cmnd, 30); + gdth_do_cmd(scp, &gdtcmd, cmnd, 30); #endif } } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) scsi_release_request(srp); scsi_free_host_dev(sdev); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else scsi_release_command(scp); scsi_free_host_dev(sdev); #endif @@ -6125,12 +5647,9 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) Scsi_Request *srp; Scsi_Device *sdev; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else Scsi_Cmnd *scp; Scsi_Device *sdev; -#else - Scsi_Cmnd scp; - Scsi_Device sdev; #endif char cmnd[MAX_COMMAND_SIZE]; #endif @@ -6162,7 +5681,7 @@ gdth_do_req(srp, &gdtcmd, cmnd, 10); scsi_release_request(srp); scsi_free_host_dev(sdev); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]); scp = scsi_allocate_device(sdev, 1, FALSE); if (!scp) { @@ -6174,13 +5693,6 @@ gdth_do_cmd(scp, &gdtcmd, cmnd, 10); scsi_release_command(scp); scsi_free_host_dev(sdev); -#else - memset(&sdev,0,sizeof(Scsi_Device)); - memset(&scp, 0,sizeof(Scsi_Cmnd)); - sdev.host = scp.host = gdth_ctr_tab[hanum]; - sdev.id = scp.target = sdev.host->this_id; - scp.device = &sdev; - gdth_do_cmd(&scp, &gdtcmd, cmnd, 10); #endif #endif } @@ -6193,19 +5705,6 @@ return NOTIFY_OK; } - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) && !defined(MODULE) - -GDTH_INITFUNC(void, gdth_setup(char *str,int *ints)) -{ - TRACE2(("gdth_setup() str %s ints[0] %d\n", - str ? str:"NULL", ints ? ints[0]:0)); - internal_setup(str, ints); -} - -#else - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) static Scsi_Host_Template driver_template = { .proc_name = "gdth", .proc_info = gdth_proc_info, @@ -6232,13 +5731,8 @@ #endif #endif }; -#else -static Scsi_Host_Template driver_template = GDTH; -#endif #include "scsi_module.c" #ifndef MODULE __setup("gdth=", option_setup); -#endif - #endif diff -Nru a/drivers/scsi/gdth_kcompat.h b/drivers/scsi/gdth_kcompat.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/scsi/gdth_kcompat.h 2005-01-13 16:25:56 -08:00 @@ -0,0 +1,21 @@ + + +#ifndef IRQ_HANDLED +typedef void irqreturn_t; +#define IRQ_NONE +#define IRQ_HANDLED +#endif + +#ifndef MODULE_LICENSE +#define MODULE_LICENSE(x) +#endif + +#ifndef SERVICE_ACTION_IN +#define SERVICE_ACTION_IN 0x9e +#endif +#ifndef READ_16 +#define READ_16 0x88 +#endif +#ifndef WRITE_16 +#define WRITE_16 0x8a +#endif diff -Nru a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c --- a/drivers/scsi/gdth_proc.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/gdth_proc.c 2005-01-13 16:25:56 -08:00 @@ -2,9 +2,7 @@ * $Id: gdth_proc.c,v 1.42 2004/03/05 15:50:20 achim Exp $ */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7) #include -#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) int gdth_proc_info(struct Scsi_Host *host, char *buffer,char **start,off_t offset,int length, @@ -57,12 +55,9 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) Scsi_Request *scp; Scsi_Device *sdev; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else Scsi_Cmnd *scp; Scsi_Device *sdev; -#else - Scsi_Cmnd scp; - Scsi_Device sdev; #endif TRACE2(("gdth_set_info() ha %d bus %d\n",hanum,busnum)); @@ -73,19 +68,13 @@ return -ENOMEM; scp->sr_cmd_len = 12; scp->sr_use_sg = 0; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else sdev = scsi_get_host_dev(host); scp = scsi_allocate_device(sdev, 1, FALSE); if (!scp) return -ENOMEM; scp->cmd_len = 12; scp->use_sg = 0; -#else - memset(&sdev,0,sizeof(Scsi_Device)); - memset(&scp, 0,sizeof(Scsi_Cmnd)); - sdev.host = scp.host = host; - sdev.id = scp.target = sdev.host->this_id; - scp.device = &sdev; #endif if (length >= 4) { @@ -98,7 +87,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) scsi_release_request(scp); scsi_free_host_dev(sdev); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else scsi_release_command(scp); scsi_free_host_dev(sdev); #endif @@ -107,10 +96,8 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Request *scp) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) -static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp) #else -static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd scp) +static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp) #endif { int orig_length, drive, wb_mode; @@ -161,10 +148,8 @@ } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) gdth_do_req(scp, &gdtcmd, cmnd, 30); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &gdtcmd, cmnd, 30); #else - gdth_do_cmd(&scp, &gdtcmd, cmnd, 30); + gdth_do_cmd(scp, &gdtcmd, cmnd, 30); #endif } } @@ -219,10 +204,8 @@ pcpar->write_back = wb_mode==1 ? 0:1; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) gdth_do_req(scp, &gdtcmd, cmnd, 30); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &gdtcmd, cmnd, 30); #else - gdth_do_cmd(&scp, &gdtcmd, cmnd, 30); + gdth_do_cmd(scp, &gdtcmd, cmnd, 30); #endif gdth_ioctl_free(hanum, GDTH_SCRATCH, ha->pscratch, paddr); printk("Done.\n"); @@ -243,18 +226,16 @@ int no_mdrv = 0, drv_no, is_mirr; ulong32 cnt; ulong64 paddr; + int rc = -ENOMEM; - gdth_cmd_str gdtcmd; - gdth_evt_str estr; + gdth_cmd_str *gdtcmd; + gdth_evt_str *estr; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) Scsi_Request *scp; Scsi_Device *sdev; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else Scsi_Cmnd *scp; Scsi_Device *sdev; -#else - Scsi_Cmnd scp; - Scsi_Device sdev; #endif char hrec[161]; struct timeval tv; @@ -266,10 +247,15 @@ gdth_defcnt_str *pdef; gdth_cdrinfo_str *pcdi; gdth_hget_str *phg; - char cmnd[MAX_COMMAND_SIZE]; + + gdtcmd = kmalloc(sizeof(*gdtcmd), GFP_KERNEL); + estr = kmalloc(sizeof(*estr), GFP_KERNEL); + if (!gdtcmd || !estr) + goto free_fail; + memset(cmnd, 0xff, 12); - memset(&gdtcmd, 0, sizeof(gdth_cmd_str)); + memset(gdtcmd, 0, sizeof(gdth_cmd_str)); TRACE2(("gdth_get_info() ha %d bus %d\n",hanum,busnum)); ha = HADATA(gdth_ctr_tab[hanum]); @@ -278,14 +264,14 @@ sdev = scsi_get_host_dev(host); scp = scsi_allocate_request(sdev, GFP_KERNEL); if (!scp) - return -ENOMEM; + goto free_fail; scp->sr_cmd_len = 12; scp->sr_use_sg = 0; #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) sdev = scsi_get_host_dev(host); scp = scsi_allocate_device(sdev, 1, FALSE); if (!scp) - return -ENOMEM; + goto free_fail; scp->cmd_len = 12; scp->use_sg = 0; #else @@ -387,12 +373,12 @@ /* 2.a statistics (and retries/reassigns) */ TRACE2(("pdr_statistics() chn %d\n",i)); pds = (gdth_dskstat_str *)(buf + GDTH_SCRATCH/4); - gdtcmd.Service = CACHESERVICE; - gdtcmd.OpCode = GDT_IOCTL; - gdtcmd.u.ioctl.p_param = paddr + GDTH_SCRATCH/4; - gdtcmd.u.ioctl.param_size = 3*GDTH_SCRATCH/4; - gdtcmd.u.ioctl.subfunc = DSK_STATISTICS | L_CTRL_PATTERN; - gdtcmd.u.ioctl.channel = ha->raw[i].address | INVALID_CHANNEL; + gdtcmd->Service = CACHESERVICE; + gdtcmd->OpCode = GDT_IOCTL; + gdtcmd->u.ioctl.p_param = paddr + GDTH_SCRATCH/4; + gdtcmd->u.ioctl.param_size = 3*GDTH_SCRATCH/4; + gdtcmd->u.ioctl.subfunc = DSK_STATISTICS | L_CTRL_PATTERN; + gdtcmd->u.ioctl.channel = ha->raw[i].address | INVALID_CHANNEL; pds->bid = ha->raw[i].local_no; pds->first = 0; pds->entries = ha->raw[i].pdev_cnt; @@ -401,14 +387,11 @@ if (pds->entries > cnt) pds->entries = cnt; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(scp, &gdtcmd, cmnd, 30); + gdth_do_req(scp, gdtcmd, cmnd, 30); if (scp->sr_command->SCp.Status != S_OK) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &gdtcmd, cmnd, 30); - if (scp->SCp.Status != S_OK) #else - gdth_do_cmd(&scp, &gdtcmd, cmnd, 30); - if (scp.SCp.Status != S_OK) + gdth_do_cmd(scp, gdtcmd, cmnd, 30); + if (scp->SCp.Status != S_OK) #endif { pds->count = 0; @@ -420,22 +403,19 @@ TRACE2(("scsi_drv_info() chn %d dev %d\n", i, ha->raw[i].id_list[j])); pdi = (gdth_diskinfo_str *)buf; - gdtcmd.Service = CACHESERVICE; - gdtcmd.OpCode = GDT_IOCTL; - gdtcmd.u.ioctl.p_param = paddr; - gdtcmd.u.ioctl.param_size = sizeof(gdth_diskinfo_str); - gdtcmd.u.ioctl.subfunc = SCSI_DR_INFO | L_CTRL_PATTERN; - gdtcmd.u.ioctl.channel = + gdtcmd->Service = CACHESERVICE; + gdtcmd->OpCode = GDT_IOCTL; + gdtcmd->u.ioctl.p_param = paddr; + gdtcmd->u.ioctl.param_size = sizeof(gdth_diskinfo_str); + gdtcmd->u.ioctl.subfunc = SCSI_DR_INFO | L_CTRL_PATTERN; + gdtcmd->u.ioctl.channel = ha->raw[i].address | ha->raw[i].id_list[j]; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(scp, &gdtcmd, cmnd, 30); + gdth_do_req(scp, gdtcmd, cmnd, 30); if (scp->sr_command->SCp.Status == S_OK) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &gdtcmd, cmnd, 30); - if (scp->SCp.Status == S_OK) #else - gdth_do_cmd(&scp, &gdtcmd, cmnd, 30); - if (scp.SCp.Status == S_OK) + gdth_do_cmd(scp, gdtcmd, cmnd, 30); + if (scp->SCp.Status == S_OK) #endif { strncpy(hrec,pdi->vendor,8); @@ -478,23 +458,20 @@ TRACE2(("scsi_drv_defcnt() chn %d dev %d\n", i, ha->raw[i].id_list[j])); pdef = (gdth_defcnt_str *)buf; - gdtcmd.Service = CACHESERVICE; - gdtcmd.OpCode = GDT_IOCTL; - gdtcmd.u.ioctl.p_param = paddr; - gdtcmd.u.ioctl.param_size = sizeof(gdth_defcnt_str); - gdtcmd.u.ioctl.subfunc = SCSI_DEF_CNT | L_CTRL_PATTERN; - gdtcmd.u.ioctl.channel = + gdtcmd->Service = CACHESERVICE; + gdtcmd->OpCode = GDT_IOCTL; + gdtcmd->u.ioctl.p_param = paddr; + gdtcmd->u.ioctl.param_size = sizeof(gdth_defcnt_str); + gdtcmd->u.ioctl.subfunc = SCSI_DEF_CNT | L_CTRL_PATTERN; + gdtcmd->u.ioctl.channel = ha->raw[i].address | ha->raw[i].id_list[j]; pdef->sddc_type = 0x08; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(scp, &gdtcmd, cmnd, 30); + gdth_do_req(scp, gdtcmd, cmnd, 30); if (scp->sr_command->SCp.Status == S_OK) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &gdtcmd, cmnd, 30); - if (scp->SCp.Status == S_OK) #else - gdth_do_cmd(&scp, &gdtcmd, cmnd, 30); - if (scp.SCp.Status == S_OK) + gdth_do_cmd(scp, gdtcmd, cmnd, 30); + if (scp->SCp.Status == S_OK) #endif { size = sprintf(buffer+len, @@ -536,21 +513,18 @@ /* 3.a log. drive info */ TRACE2(("cache_drv_info() drive no %d\n",drv_no)); pcdi = (gdth_cdrinfo_str *)buf; - gdtcmd.Service = CACHESERVICE; - gdtcmd.OpCode = GDT_IOCTL; - gdtcmd.u.ioctl.p_param = paddr; - gdtcmd.u.ioctl.param_size = sizeof(gdth_cdrinfo_str); - gdtcmd.u.ioctl.subfunc = CACHE_DRV_INFO; - gdtcmd.u.ioctl.channel = drv_no; + gdtcmd->Service = CACHESERVICE; + gdtcmd->OpCode = GDT_IOCTL; + gdtcmd->u.ioctl.p_param = paddr; + gdtcmd->u.ioctl.param_size = sizeof(gdth_cdrinfo_str); + gdtcmd->u.ioctl.subfunc = CACHE_DRV_INFO; + gdtcmd->u.ioctl.channel = drv_no; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(scp, &gdtcmd, cmnd, 30); + gdth_do_req(scp, gdtcmd, cmnd, 30); if (scp->sr_command->SCp.Status != S_OK) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &gdtcmd, cmnd, 30); - if (scp->SCp.Status != S_OK) #else - gdth_do_cmd(&scp, &gdtcmd, cmnd, 30); - if (scp.SCp.Status != S_OK) + gdth_do_cmd(scp, gdtcmd, cmnd, 30); + if (scp->SCp.Status != S_OK) #endif { break; @@ -649,21 +623,18 @@ /* 4.a array drive info */ TRACE2(("array_info() drive no %d\n",i)); pai = (gdth_arrayinf_str *)buf; - gdtcmd.Service = CACHESERVICE; - gdtcmd.OpCode = GDT_IOCTL; - gdtcmd.u.ioctl.p_param = paddr; - gdtcmd.u.ioctl.param_size = sizeof(gdth_arrayinf_str); - gdtcmd.u.ioctl.subfunc = ARRAY_INFO | LA_CTRL_PATTERN; - gdtcmd.u.ioctl.channel = i; + gdtcmd->Service = CACHESERVICE; + gdtcmd->OpCode = GDT_IOCTL; + gdtcmd->u.ioctl.p_param = paddr; + gdtcmd->u.ioctl.param_size = sizeof(gdth_arrayinf_str); + gdtcmd->u.ioctl.subfunc = ARRAY_INFO | LA_CTRL_PATTERN; + gdtcmd->u.ioctl.channel = i; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(scp, &gdtcmd, cmnd, 30); + gdth_do_req(scp, gdtcmd, cmnd, 30); if (scp->sr_command->SCp.Status == S_OK) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &gdtcmd, cmnd, 30); - if (scp->SCp.Status == S_OK) #else - gdth_do_cmd(&scp, &gdtcmd, cmnd, 30); - if (scp.SCp.Status == S_OK) + gdth_do_cmd(scp, gdtcmd, cmnd, 30); + if (scp->SCp.Status == S_OK) #endif { if (pai->ai_state == 0) @@ -731,23 +702,20 @@ /* 5.a get host drive list */ TRACE2(("host_get() drv_no %d\n",i)); phg = (gdth_hget_str *)buf; - gdtcmd.Service = CACHESERVICE; - gdtcmd.OpCode = GDT_IOCTL; - gdtcmd.u.ioctl.p_param = paddr; - gdtcmd.u.ioctl.param_size = sizeof(gdth_hget_str); - gdtcmd.u.ioctl.subfunc = HOST_GET | LA_CTRL_PATTERN; - gdtcmd.u.ioctl.channel = i; + gdtcmd->Service = CACHESERVICE; + gdtcmd->OpCode = GDT_IOCTL; + gdtcmd->u.ioctl.p_param = paddr; + gdtcmd->u.ioctl.param_size = sizeof(gdth_hget_str); + gdtcmd->u.ioctl.subfunc = HOST_GET | LA_CTRL_PATTERN; + gdtcmd->u.ioctl.channel = i; phg->entries = MAX_HDRIVES; phg->offset = GDTOFFSOF(gdth_hget_str, entry[0]); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - gdth_do_req(scp, &gdtcmd, cmnd, 30); + gdth_do_req(scp, gdtcmd, cmnd, 30); if (scp->sr_command->SCp.Status != S_OK) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - gdth_do_cmd(scp, &gdtcmd, cmnd, 30); - if (scp->SCp.Status != S_OK) #else - gdth_do_cmd(&scp, &gdtcmd, cmnd, 30); - if (scp.SCp.Status != S_OK) + gdth_do_cmd(scp, gdtcmd, cmnd, 30); + if (scp->SCp.Status != S_OK) #endif { ha->hdr[i].ldr_no = i; @@ -799,14 +767,14 @@ len += size; pos = begin + len; for (id = -1;;) { - id = gdth_read_event(ha, id, &estr); - if (estr.event_source == 0) + id = gdth_read_event(ha, id, estr); + if (estr->event_source == 0) break; - if (estr.event_data.eu.driver.ionode == hanum && - estr.event_source == ES_ASYNC) { - gdth_log_event(&estr.event_data, hrec); + if (estr->event_data.eu.driver.ionode == hanum && + estr->event_source == ES_ASYNC) { + gdth_log_event(&estr->event_data, hrec); do_gettimeofday(&tv); - sec = (int)(tv.tv_sec - estr.first_stamp); + sec = (int)(tv.tv_sec - estr->first_stamp); if (sec < 0) sec = 0; size = sprintf(buffer+len," date- %02d:%02d:%02d\t%s\n", sec/3600, sec%3600/60, sec%60, hrec); @@ -826,7 +794,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) scsi_release_request(scp); scsi_free_host_dev(sdev); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else scsi_release_command(scp); scsi_free_host_dev(sdev); #endif @@ -836,7 +804,12 @@ len = length; TRACE2(("get_info() len %d pos %d begin %d offset %d length %d size %d\n", len,(int)pos,(int)begin,(int)offset,length,size)); - return(len); + rc = len; + +free_fail: + kfree(gdtcmd); + kfree(estr); + return rc; } @@ -864,13 +837,7 @@ char *cmnd, int timeout) { unsigned bufflen; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7) DECLARE_COMPLETION(wait); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - DECLARE_MUTEX_LOCKED(sem); -#else - struct semaphore sem = MUTEX_LOCKED; -#endif TRACE2(("gdth_do_cmd()\n")); if (gdtcmd != NULL) { @@ -880,22 +847,11 @@ scp->SCp.this_residual = DEFAULT_PRI; bufflen = 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7) + scp->request.rq_status = RQ_SCSI_BUSY; scp->request.waiting = &wait; scsi_do_cmd(scp, cmnd, gdtcmd, bufflen, gdth_scsi_done, timeout*HZ, 1); wait_for_completion(&wait); -#else - scp->request.sem = &sem; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - scsi_do_cmd(scp, cmnd, gdtcmd, bufflen, gdth_scsi_done, timeout*HZ, 1); -#else - spin_lock_irq(&io_request_lock); - scsi_do_cmd(scp, cmnd, gdtcmd, bufflen, gdth_scsi_done, timeout*HZ, 1); - spin_unlock_irq(&io_request_lock); -#endif - down(&sem); -#endif } #endif @@ -907,14 +863,10 @@ scp->request->rq_status = RQ_SCSI_DONE; if (scp->request->waiting != NULL) complete(scp->request->waiting); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7) +#else scp->request.rq_status = RQ_SCSI_DONE; if (scp->request.waiting != NULL) complete(scp->request.waiting); -#else - scp->request.rq_status = RQ_SCSI_DONE; - if (scp->request.sem != NULL) - up(scp->request.sem); #endif } @@ -929,7 +881,7 @@ return NULL; ha = HADATA(gdth_ctr_tab[hanum]); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); if (!ha->scratch_busy && size <= GDTH_SCRATCH) { ha->scratch_busy = TRUE; @@ -938,19 +890,13 @@ } else if (scratch) { ret_val = NULL; } else { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) dma_addr_t dma_addr; ret_val = pci_alloc_consistent(ha->pdev, size, &dma_addr); *paddr = dma_addr; -#else - ret_val = scsi_init_malloc(size, GFP_ATOMIC | GFP_DMA); - if (ret_val) - *paddr = virt_to_bus(ret_val); -#endif } - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); return ret_val; } @@ -960,19 +906,15 @@ ulong flags; ha = HADATA(gdth_ctr_tab[hanum]); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); if (buf == ha->pscratch) { ha->scratch_busy = FALSE; } else { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) pci_free_consistent(ha->pdev, size, buf, paddr); -#else - scsi_init_free((void *)buf, size); -#endif } - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); } #ifdef GDTH_IOCTL_PROC @@ -983,14 +925,14 @@ int ret_val; ha = HADATA(gdth_ctr_tab[hanum]); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); ret_val = FALSE; if (ha->scratch_busy) { if (((gdth_iord_str *)ha->pscratch)->size == (ulong32)size) ret_val = TRUE; } - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); return ret_val; } #endif @@ -1004,36 +946,23 @@ unchar b, t; ha = HADATA(gdth_ctr_tab[hanum]); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); for (i = 0; i < GDTH_MAXCMDS; ++i) { scp = ha->cmd_tab[i].cmnd; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; t = scp->device->id; -#else - b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel; - t = scp->target; -#endif if (!SPECIAL_SCP(scp) && t == (unchar)id && b == (unchar)busnum) { scp->SCp.have_data_in = 0; - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); while (!scp->SCp.have_data_in) barrier(); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - GDTH_LOCK_SCSI_DONE(scp->device->host, flags); - scp->scsi_done(scp); - GDTH_UNLOCK_SCSI_DONE(scp->device->host, flags); -#else - GDTH_LOCK_SCSI_DONE(flags); - scp->scsi_done(scp); - GDTH_UNLOCK_SCSI_DONE(flags); -#endif - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); } } - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); } static void gdth_stop_timeout(int hanum, int busnum, int id) @@ -1044,22 +973,17 @@ unchar b, t; ha = HADATA(gdth_ctr_tab[hanum]); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; t = scp->device->id; -#else - b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel; - t = scp->target; -#endif if (t == (unchar)id && b == (unchar)busnum) { TRACE2(("gdth_stop_timeout(): update_timeout()\n")); scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0); } } - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); } static void gdth_start_timeout(int hanum, int busnum, int id) @@ -1070,22 +994,17 @@ unchar b, t; ha = HADATA(gdth_ctr_tab[hanum]); - GDTH_LOCK_HA(ha, flags); + spin_lock_irqsave(&ha->smp_lock, flags); for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; t = scp->device->id; -#else - b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel; - t = scp->target; -#endif if (t == (unchar)id && b == (unchar)busnum) { TRACE2(("gdth_start_timeout(): update_timeout()\n")); gdth_update_timeout(hanum, scp, scp->SCp.buffers_residual); } } - GDTH_UNLOCK_HA(ha, flags); + spin_unlock_irqrestore(&ha->smp_lock, flags); } static int gdth_update_timeout(int hanum, Scsi_Cmnd *scp, int timeout) diff -Nru a/drivers/scsi/gdth_proc.h b/drivers/scsi/gdth_proc.h --- a/drivers/scsi/gdth_proc.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/gdth_proc.h 2005-01-13 16:25:56 -08:00 @@ -14,14 +14,10 @@ static void gdth_do_req(Scsi_Request *srp, gdth_cmd_str *cmd, char *cmnd, int timeout); static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Request *scp); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#else static void gdth_do_cmd(Scsi_Cmnd *scp, gdth_cmd_str *cmd, char *cmnd, int timeout); static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp); -#else -static void gdth_do_cmd(Scsi_Cmnd *scp, gdth_cmd_str *cmd, - char *cmnd, int timeout); -static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd scp); #endif static char *gdth_ioctl_alloc(int hanum, int size, int scratch, diff -Nru a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c --- a/drivers/scsi/ibmvscsi/ibmvscsi.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c 2005-01-13 16:25:56 -08:00 @@ -87,7 +87,7 @@ static int init_timeout = 5; static int max_requests = 50; -#define IBMVSCSI_VERSION "1.5.1" +#define IBMVSCSI_VERSION "1.5.5" MODULE_DESCRIPTION("IBM Virtual SCSI"); MODULE_AUTHOR("Dave Boutcher"); @@ -256,6 +256,7 @@ { evt_struct->cmnd = NULL; evt_struct->cmnd_done = NULL; + evt_struct->sync_srp = NULL; evt_struct->crq.format = format; evt_struct->crq.timeout = timeout; evt_struct->done = done; @@ -467,7 +468,7 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, struct ibmvscsi_host_data *hostdata) { - struct scsi_cmnd *cmnd = evt_struct->cmnd; + struct scsi_cmnd *cmnd; u64 *crq_as_u64 = (u64 *) &evt_struct->crq; int rc; @@ -479,22 +480,15 @@ if ((evt_struct->crq.format == VIOSRP_SRP_FORMAT) && (atomic_dec_if_positive(&hostdata->request_limit) < 0)) { /* See if the adapter is disabled */ - if (atomic_read(&hostdata->request_limit) < 0) { - if (cmnd) - cmnd->result = DID_ERROR << 16; - if (evt_struct->cmnd_done) - evt_struct->cmnd_done(cmnd); - unmap_cmd_data(&evt_struct->iu.srp.cmd, - hostdata->dev); - free_event_struct(&hostdata->pool, evt_struct); - return 0; - } else { - printk("ibmvscsi: Warning, request_limit exceeded\n"); - unmap_cmd_data(&evt_struct->iu.srp.cmd, - hostdata->dev); - free_event_struct(&hostdata->pool, evt_struct); - return SCSI_MLQUEUE_HOST_BUSY; - } + if (atomic_read(&hostdata->request_limit) < 0) + goto send_error; + + printk(KERN_WARNING + "ibmvscsi: Warning, request_limit exceeded\n"); + unmap_cmd_data(&evt_struct->iu.srp.cmd, + hostdata->dev); + free_event_struct(&hostdata->pool, evt_struct); + return SCSI_MLQUEUE_HOST_BUSY; } /* Copy the IU into the transfer area */ @@ -511,18 +505,24 @@ ibmvscsi_send_crq(hostdata, crq_as_u64[0], crq_as_u64[1])) != 0) { list_del(&evt_struct->list); - cmnd = evt_struct->cmnd; printk(KERN_ERR "ibmvscsi: failed to send event struct rc %d\n", rc); - unmap_cmd_data(&evt_struct->iu.srp.cmd, hostdata->dev); - free_event_struct(&hostdata->pool, evt_struct); - if (cmnd) - cmnd->result = DID_ERROR << 16; - if (evt_struct->cmnd_done) - evt_struct->cmnd_done(cmnd); + goto send_error; } return 0; + + send_error: + unmap_cmd_data(&evt_struct->iu.srp.cmd, hostdata->dev); + + if ((cmnd = evt_struct->cmnd) != NULL) { + cmnd->result = DID_ERROR << 16; + evt_struct->cmnd_done(cmnd); + } else if (evt_struct->done) + evt_struct->done(evt_struct); + + free_event_struct(&hostdata->pool, evt_struct); + return 0; } /** @@ -537,6 +537,13 @@ struct srp_rsp *rsp = &evt_struct->xfer_iu->srp.rsp; struct scsi_cmnd *cmnd = evt_struct->cmnd; + if (unlikely(rsp->type != SRP_RSP_TYPE)) { + if (printk_ratelimit()) + printk(KERN_WARNING + "ibmvscsi: bad SRP RSP type %d\n", + rsp->type); + } + if (cmnd) { cmnd->result = rsp->status; if (((cmnd->result >> 1) & 0x1f) == CHECK_CONDITION) @@ -641,11 +648,16 @@ evt_struct->xfer_iu->mad.adapter_info.common.status); } else { printk("ibmvscsi: host srp version: %s, " - "host partition %s (%d), OS %d\n", + "host partition %s (%d), OS %d, max io %u\n", hostdata->madapter_info.srp_version, hostdata->madapter_info.partition_name, hostdata->madapter_info.partition_number, - hostdata->madapter_info.os_type); + hostdata->madapter_info.os_type, + hostdata->madapter_info.port_max_txu[0]); + + if (hostdata->madapter_info.port_max_txu[0]) + hostdata->host->max_sectors = + hostdata->madapter_info.port_max_txu[0] >> 9; } } @@ -796,6 +808,10 @@ */ static void sync_completion(struct srp_event_struct *evt_struct) { + /* copy the response back */ + if (evt_struct->sync_srp) + *evt_struct->sync_srp = *evt_struct->xfer_iu; + complete(&evt_struct->comp); } @@ -810,6 +826,8 @@ struct srp_tsk_mgmt *tsk_mgmt; struct srp_event_struct *evt; struct srp_event_struct *tmp_evt, *found_evt; + union viosrp_iu srp_rsp; + int rsp_rc; u16 lun = lun_from_dev(cmd->device); /* First, find this command in our sent list so we can figure @@ -849,6 +867,7 @@ printk(KERN_INFO "ibmvscsi: aborting command. lun 0x%lx, tag 0x%lx\n", tsk_mgmt->lun, tsk_mgmt->managed_task_tag); + evt->sync_srp = &srp_rsp; init_completion(&evt->comp); if (ibmvscsi_send_srp_event(evt, hostdata) != 0) { printk(KERN_ERR "ibmvscsi: failed to send abort() event\n"); @@ -859,6 +878,29 @@ wait_for_completion(&evt->comp); spin_lock_irq(hostdata->host->host_lock); + /* make sure we got a good response */ + if (unlikely(srp_rsp.srp.generic.type != SRP_RSP_TYPE)) { + if (printk_ratelimit()) + printk(KERN_WARNING + "ibmvscsi: abort bad SRP RSP type %d\n", + srp_rsp.srp.generic.type); + return FAILED; + } + + if (srp_rsp.srp.rsp.rspvalid) + rsp_rc = *((int *)srp_rsp.srp.rsp.sense_and_response_data); + else + rsp_rc = srp_rsp.srp.rsp.status; + + if (rsp_rc) { + if (printk_ratelimit()) + printk(KERN_WARNING + "ibmvscsi: abort code %d for task tag 0x%lx\n", + rsp_rc, + tsk_mgmt->managed_task_tag); + return FAILED; + } + /* Because we dropped the spinlock above, it's possible * The event is no longer in our list. Make sure it didn't * complete while we were aborting @@ -871,13 +913,17 @@ } } + if (found_evt == NULL) { + printk(KERN_INFO + "ibmvscsi: aborted task tag 0x%lx completed\n", + tsk_mgmt->managed_task_tag); + return SUCCESS; + } + printk(KERN_INFO "ibmvscsi: successfully aborted task tag 0x%lx\n", tsk_mgmt->managed_task_tag); - if (found_evt == NULL) - return SUCCESS; - cmd->result = (DID_ABORT << 16); list_del(&found_evt->list); unmap_cmd_data(&found_evt->iu.srp.cmd, found_evt->hostdata->dev); @@ -899,6 +945,8 @@ struct srp_tsk_mgmt *tsk_mgmt; struct srp_event_struct *evt; struct srp_event_struct *tmp_evt, *pos; + union viosrp_iu srp_rsp; + int rsp_rc; u16 lun = lun_from_dev(cmd->device); evt = get_event_struct(&hostdata->pool); @@ -923,6 +971,7 @@ printk(KERN_INFO "ibmvscsi: resetting device. lun 0x%lx\n", tsk_mgmt->lun); + evt->sync_srp = &srp_rsp; init_completion(&evt->comp); if (ibmvscsi_send_srp_event(evt, hostdata) != 0) { printk(KERN_ERR "ibmvscsi: failed to send reset event\n"); @@ -933,6 +982,29 @@ wait_for_completion(&evt->comp); spin_lock_irq(hostdata->host->host_lock); + /* make sure we got a good response */ + if (unlikely(srp_rsp.srp.generic.type != SRP_RSP_TYPE)) { + if (printk_ratelimit()) + printk(KERN_WARNING + "ibmvscsi: reset bad SRP RSP type %d\n", + srp_rsp.srp.generic.type); + return FAILED; + } + + if (srp_rsp.srp.rsp.rspvalid) + rsp_rc = *((int *)srp_rsp.srp.rsp.sense_and_response_data); + else + rsp_rc = srp_rsp.srp.rsp.status; + + if (rsp_rc) { + if (printk_ratelimit()) + printk(KERN_WARNING + "ibmvscsi: reset code %d for task tag 0x%lx\n", + rsp_rc, + tsk_mgmt->managed_task_tag); + return FAILED; + } + /* We need to find all commands for this LUN that have not yet been * responded to, and fail them with DID_RESET */ @@ -1048,6 +1120,13 @@ return; } + if (atomic_read(&evt_struct->free)) { + printk(KERN_ERR + "ibmvscsi: received duplicate correlation_token 0x%p!\n", + (void *)crq->IU_data_ptr); + return; + } + if (crq->format == VIOSRP_SRP_FORMAT) atomic_add(evt_struct->xfer_iu->srp.rsp.request_limit_delta, &hostdata->request_limit); @@ -1295,6 +1374,7 @@ hostdata->host = host; hostdata->dev = dev; atomic_set(&hostdata->request_limit, -1); + hostdata->host->max_sectors = 32 * 8; /* default max I/O 32 pages */ if (ibmvscsi_init_crq_queue(&hostdata->queue, hostdata, max_requests) != 0) { @@ -1326,7 +1406,7 @@ */ for (wait_switch = jiffies + (init_timeout * HZ); time_before(jiffies, wait_switch) && - atomic_read(&hostdata->request_limit) < 0;) { + atomic_read(&hostdata->request_limit) < 2;) { msleep(10); } diff -Nru a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h --- a/drivers/scsi/ibmvscsi/ibmvscsi.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/ibmvscsi/ibmvscsi.h 2005-01-13 16:25:56 -08:00 @@ -67,6 +67,7 @@ union viosrp_iu iu; void (*cmnd_done) (struct scsi_cmnd *); struct completion comp; + union viosrp_iu *sync_srp; }; /* a pool of event structs for use */ diff -Nru a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c --- a/drivers/scsi/ipr.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/ipr.c 2005-01-13 16:25:56 -08:00 @@ -2610,23 +2610,19 @@ #endif /** - * ipr_store_queue_depth - Change the device's queue depth - * @dev: device struct - * @buf: buffer + * ipr_change_queue_depth - Change the device's queue depth + * @sdev: scsi device struct + * @qdepth: depth to set * * Return value: - * number of bytes printed to buffer + * actual depth set **/ -static ssize_t ipr_store_queue_depth(struct device *dev, - const char *buf, size_t count) +static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth) { - struct scsi_device *sdev = to_scsi_device(dev); struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata; struct ipr_resource_entry *res; - int qdepth = simple_strtoul(buf, NULL, 10); int tagged = 0; unsigned long lock_flags = 0; - ssize_t len = -ENXIO; spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); res = (struct ipr_resource_entry *)sdev->hostdata; @@ -2635,23 +2631,13 @@ if (ipr_is_gscsi(res) && res->tcq_active) tagged = MSG_ORDERED_TAG; - - len = strlen(buf); } spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); scsi_adjust_queue_depth(sdev, tagged, qdepth); - return len; + return qdepth; } -static struct device_attribute ipr_queue_depth_attr = { - .attr = { - .name = "queue_depth", - .mode = S_IRUSR | S_IWUSR, - }, - .store = ipr_store_queue_depth -}; - /** * ipr_show_tcq_enable - Show if the device is enabled for tcqing * @dev: device struct @@ -2760,7 +2746,6 @@ }; static struct device_attribute *ipr_dev_attrs[] = { - &ipr_queue_depth_attr, &ipr_tcqing_attr, &ipr_adapter_handle_attr, NULL, @@ -3961,6 +3946,7 @@ .slave_alloc = ipr_slave_alloc, .slave_configure = ipr_slave_configure, .slave_destroy = ipr_slave_destroy, + .change_queue_depth = ipr_change_queue_depth, .bios_param = ipr_biosparam, .can_queue = IPR_MAX_COMMANDS, .this_id = -1, diff -Nru a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c --- a/drivers/scsi/lasi700.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/lasi700.c 2005-01-13 16:25:56 -08:00 @@ -54,12 +54,32 @@ #include #include -#include "lasi700.h" #include "53c700.h" MODULE_AUTHOR("James Bottomley"); MODULE_DESCRIPTION("lasi700 SCSI Driver"); MODULE_LICENSE("GPL"); + +#define LASI_700_SVERSION 0x00071 +#define LASI_710_SVERSION 0x00082 + +#define LASI700_ID_TABLE { \ + .hw_type = HPHW_FIO, \ + .sversion = LASI_700_SVERSION, \ + .hversion = HVERSION_ANY_ID, \ + .hversion_rev = HVERSION_REV_ANY_ID, \ +} + +#define LASI710_ID_TABLE { \ + .hw_type = HPHW_FIO, \ + .sversion = LASI_710_SVERSION, \ + .hversion = HVERSION_ANY_ID, \ + .hversion_rev = HVERSION_REV_ANY_ID, \ +} + +#define LASI700_CLOCK 25 +#define LASI710_CLOCK 40 +#define LASI_SCSI_CORE_OFFSET 0x100 static struct parisc_device_id lasi700_ids[] = { LASI700_ID_TABLE, diff -Nru a/drivers/scsi/lasi700.h b/drivers/scsi/lasi700.h --- a/drivers/scsi/lasi700.h 2005-01-13 16:25:56 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,49 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8 -*- */ - -/* PARISC LASI driver for the 53c700 chip - * - * Copyright (C) 2001 by James.Bottomley@HansenPartnership.com -**----------------------------------------------------------------------------- -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation; either version 2 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -**----------------------------------------------------------------------------- - */ - -#ifndef _LASI700_H -#define _LASI700_H - -#define LASI_710_SVERSION 0x082 -#define LASI_700_SVERSION 0x071 - -#define LASI700_ID_TABLE { \ - .hw_type = HPHW_FIO, \ - .sversion = LASI_700_SVERSION, \ - .hversion = HVERSION_ANY_ID, \ - .hversion_rev = HVERSION_REV_ANY_ID, \ -} - -#define LASI710_ID_TABLE { \ - .hw_type = HPHW_FIO, \ - .sversion = LASI_710_SVERSION, \ - .hversion = HVERSION_ANY_ID, \ - .hversion_rev = HVERSION_REV_ANY_ID, \ -} - -#define LASI700_CLOCK 25 -#define LASI710_CLOCK 40 -#define LASI_SCSI_CORE_OFFSET 0x100 - -#endif diff -Nru a/drivers/scsi/osst.c b/drivers/scsi/osst.c --- a/drivers/scsi/osst.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/osst.c 2005-01-13 16:25:56 -08:00 @@ -13,18 +13,18 @@ order) Klaus Ehrenfried, Wolfgang Denk, Steve Hirsch, Andreas Koppenh"ofer, Michael Leodolter, Eyal Lebedinsky, J"org Weule, and Eric Youngdale. - Copyright 1992 - 2002 Kai Makisara / Willem Riede - email Kai.Makisara@metla.fi / osst@riede.org + Copyright 1992 - 2002 Kai Makisara / 2000 - 2004 Willem Riede + email osst@riede.org - $Header: /cvsroot/osst/Driver/osst.c,v 1.70 2003/12/23 14:22:12 wriede Exp $ + $Header: /cvsroot/osst/Driver/osst.c,v 1.73 2005/01/01 21:13:34 wriede Exp $ Microscopic alterations - Rik Ling, 2000/12/21 Last st.c sync: Tue Oct 15 22:01:04 2002 by makisara Some small formal changes - aeb, 950809 */ -static const char * cvsid = "$Id: osst.c,v 1.70 2003/12/23 14:22:12 wriede Exp $"; -const char * osst_version = "0.99.1"; +static const char * cvsid = "$Id: osst.c,v 1.73 2005/01/01 21:13:34 wriede Exp $"; +const char * osst_version = "0.99.3"; /* The "failure to reconnect" firmware bug */ #define OSST_FW_NEED_POLL_MIN 10601 /*(107A)*/ @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -82,13 +84,13 @@ MODULE_DESCRIPTION("OnStream {DI-|FW-|SC-|USB}{30|50} Tape Driver"); MODULE_LICENSE("GPL"); -module_param(max_dev, int, 0); +module_param(max_dev, int, 0444); MODULE_PARM_DESC(max_dev, "Maximum number of OnStream Tape Drives to attach (4)"); -module_param(write_threshold_kbs, int, 0); +module_param(write_threshold_kbs, int, 0644); MODULE_PARM_DESC(write_threshold_kbs, "Asynchronous write threshold (KB; 32)"); -module_param(max_sg_segs, int, 0); +module_param(max_sg_segs, int, 0644); MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (9)"); #else static struct osst_dev_parm { @@ -119,10 +121,10 @@ // #define OSST_INJECT_ERRORS 1 #endif -#define MAX_RETRIES 2 -#define MAX_READ_RETRIES 0 -#define MAX_WRITE_RETRIES 0 -#define MAX_READY_RETRIES 0 +/* Do not retry! The drive firmware already retries when appropriate, + and when it tries to tell us something, we had better listen... */ +#define MAX_RETRIES 0 + #define NO_TAPE NOT_READY #define OSST_WAIT_POSITION_COMPLETE (HZ > 200 ? HZ / 200 : 1) @@ -147,19 +149,19 @@ static int osst_max_dev = OSST_MAX_TAPES; static int osst_nr_dev; -static OS_Scsi_Tape **os_scsi_tapes = NULL; -static rwlock_t os_scsi_tapes_lock = RW_LOCK_UNLOCKED; +static struct osst_tape **os_scsi_tapes = NULL; +static rwlock_t os_scsi_tapes_lock = RW_LOCK_UNLOCKED; static int modes_defined = FALSE; -static OSST_buffer *new_tape_buffer(int, int, int); -static int enlarge_buffer(OSST_buffer *, int); -static void normalize_buffer(OSST_buffer *); -static int append_to_buffer(const char __user *, OSST_buffer *, int); -static int from_buffer(OSST_buffer *, char __user *, int); -static int osst_zero_buffer_tail(OSST_buffer *); -static int osst_copy_to_buffer(OSST_buffer *, unsigned char *); -static int osst_copy_from_buffer(OSST_buffer *, unsigned char *); +static struct osst_buffer *new_tape_buffer(int, int, int); +static int enlarge_buffer(struct osst_buffer *, int); +static void normalize_buffer(struct osst_buffer *); +static int append_to_buffer(const char __user *, struct osst_buffer *, int); +static int from_buffer(struct osst_buffer *, char __user *, int); +static int osst_zero_buffer_tail(struct osst_buffer *); +static int osst_copy_to_buffer(struct osst_buffer *, unsigned char *); +static int osst_copy_from_buffer(struct osst_buffer *, unsigned char *); static int osst_probe(struct device *); static int osst_remove(struct device *); @@ -173,17 +175,18 @@ } }; -static int osst_int_ioctl(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, unsigned int cmd_in,unsigned long arg); +static int osst_int_ioctl(struct osst_tape *STp, struct scsi_request ** aSRpnt, + unsigned int cmd_in, unsigned long arg); -static int osst_set_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, int frame, int skip); +static int osst_set_frame_position(struct osst_tape *STp, struct scsi_request ** aSRpnt, int frame, int skip); -static int osst_get_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt); +static int osst_get_frame_position(struct osst_tape *STp, struct scsi_request ** aSRpnt); -static int osst_flush_write_buffer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt); +static int osst_flush_write_buffer(struct osst_tape *STp, struct scsi_request ** aSRpnt); -static int osst_write_error_recovery(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int pending); +static int osst_write_error_recovery(struct osst_tape * STp, struct scsi_request ** aSRpnt, int pending); -static inline char *tape_name(OS_Scsi_Tape *tape) +static inline char *tape_name(struct osst_tape *tape) { return tape->drive->disk_name; } @@ -191,7 +194,7 @@ /* Routines that handle the interaction with mid-layer SCSI routines */ /* Convert the result to success code */ -static int osst_chk_result(OS_Scsi_Tape * STp, Scsi_Request * SRpnt) +static int osst_chk_result(struct osst_tape * STp, struct scsi_request * SRpnt) { char *name = tape_name(STp); int result = SRpnt->sr_result; @@ -222,7 +225,7 @@ if (driver_byte(result) & DRIVER_SENSE) print_req_sense("osst ", SRpnt); } -// else + else #endif if (!(driver_byte(result) & DRIVER_SENSE) || ((sense[0] & 0x70) == 0x70 && @@ -234,7 +237,7 @@ SRpnt->sr_cmnd[0] != MODE_SENSE && SRpnt->sr_cmnd[0] != TEST_UNIT_READY)) { /* Abnormal conditions for tape */ if (driver_byte(result) & DRIVER_SENSE) { - printk(KERN_WARNING "%s:W: Command with sense data: ", name); + printk(KERN_WARNING "%s:W: Command with sense data:\n", name); print_req_sense("osst:", SRpnt); } else { @@ -281,7 +284,7 @@ /* Wakeup from interrupt */ static void osst_sleep_done (Scsi_Cmnd * SCpnt) { - OS_Scsi_Tape * STp = container_of(SCpnt->request->rq_disk->private_data, OS_Scsi_Tape, driver); + struct osst_tape * STp = container_of(SCpnt->request->rq_disk->private_data, struct osst_tape, driver); if ((STp->buffer)->writing && (SCpnt->sense_buffer[0] & 0x70) == 0x70 && @@ -307,7 +310,7 @@ /* Do the scsi command. Waits until command performed if do_wait is true. Otherwise osst_write_behind_check() is used to check that the command has finished. */ -static Scsi_Request * osst_do_scsi(Scsi_Request *SRpnt, OS_Scsi_Tape *STp, +static struct scsi_request * osst_do_scsi(struct scsi_request *SRpnt, struct osst_tape *STp, unsigned char *cmd, int bytes, int direction, int timeout, int retries, int do_wait) { unsigned char *bp; @@ -366,9 +369,9 @@ /* Handle the write-behind checking (downs the semaphore) */ -static void osst_write_behind_check(OS_Scsi_Tape *STp) +static void osst_write_behind_check(struct osst_tape *STp) { - OSST_buffer * STbuffer; + struct osst_buffer * STbuffer; STbuffer = STp->buffer; @@ -406,7 +409,7 @@ /* * Initialize the OnStream AUX */ -static void osst_init_aux(OS_Scsi_Tape * STp, int frame_type, int frame_seq_number, +static void osst_init_aux(struct osst_tape * STp, int frame_type, int frame_seq_number, int logical_blk_num, int blk_sz, int blk_cnt) { os_aux_t *aux = STp->buffer->aux; @@ -468,13 +471,13 @@ /* * Verify that we have the correct tape frame */ -static int osst_verify_frame(OS_Scsi_Tape * STp, int frame_seq_number, int quiet) +static int osst_verify_frame(struct osst_tape * STp, int frame_seq_number, int quiet) { - char * name = tape_name(STp); - os_aux_t * aux = STp->buffer->aux; - os_partition_t * par = &(aux->partition); - struct st_partstat * STps = &(STp->ps[STp->partition]); - int blk_cnt, blk_sz, i; + char * name = tape_name(STp); + os_aux_t * aux = STp->buffer->aux; + os_partition_t * par = &(aux->partition); + struct st_partstat * STps = &(STp->ps[STp->partition]); + int blk_cnt, blk_sz, i; if (STp->raw) { if (STp->buffer->syscall_result) { @@ -602,14 +605,15 @@ /* * Wait for the unit to become Ready */ -static int osst_wait_ready(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned timeout, int initial_delay) +static int osst_wait_ready(struct osst_tape * STp, struct scsi_request ** aSRpnt, + unsigned timeout, int initial_delay) { - unsigned char cmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt; - unsigned long startwait = jiffies; + unsigned char cmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt; + unsigned long startwait = jiffies; #if DEBUG - int dbg = debugging; - char * name = tape_name(STp); + int dbg = debugging; + char * name = tape_name(STp); printk(OSST_DEB_MSG "%s:D: Reached onstream wait ready\n", name); #endif @@ -620,7 +624,7 @@ memset(cmd, 0, MAX_COMMAND_SIZE); cmd[0] = TEST_UNIT_READY; - SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_READY_RETRIES, TRUE); + SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_RETRIES, TRUE); *aSRpnt = SRpnt; if (!SRpnt) return (-EBUSY); @@ -641,7 +645,7 @@ memset(cmd, 0, MAX_COMMAND_SIZE); cmd[0] = TEST_UNIT_READY; - SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_READY_RETRIES, TRUE); + SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_RETRIES, TRUE); } *aSRpnt = SRpnt; #if DEBUG @@ -666,14 +670,14 @@ /* * Wait for a tape to be inserted in the unit */ -static int osst_wait_for_medium(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned timeout) +static int osst_wait_for_medium(struct osst_tape * STp, struct scsi_request ** aSRpnt, unsigned timeout) { - unsigned char cmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt; - unsigned long startwait = jiffies; + unsigned char cmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt; + unsigned long startwait = jiffies; #if DEBUG - int dbg = debugging; - char * name = tape_name(STp); + int dbg = debugging; + char * name = tape_name(STp); printk(OSST_DEB_MSG "%s:D: Reached onstream wait for medium\n", name); #endif @@ -681,7 +685,7 @@ memset(cmd, 0, MAX_COMMAND_SIZE); cmd[0] = TEST_UNIT_READY; - SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_READY_RETRIES, TRUE); + SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_RETRIES, TRUE); *aSRpnt = SRpnt; if (!SRpnt) return (-EBUSY); @@ -700,7 +704,7 @@ memset(cmd, 0, MAX_COMMAND_SIZE); cmd[0] = TEST_UNIT_READY; - SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_READY_RETRIES, TRUE); + SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_RETRIES, TRUE); } *aSRpnt = SRpnt; #if DEBUG @@ -722,7 +726,7 @@ return 1; } -static int osst_position_tape_and_confirm(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int frame) +static int osst_position_tape_and_confirm(struct osst_tape * STp, struct scsi_request ** aSRpnt, int frame) { int retval; @@ -736,15 +740,14 @@ /* * Wait for write(s) to complete */ -static int osst_flush_drive_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) +static int osst_flush_drive_buffer(struct osst_tape * STp, struct scsi_request ** aSRpnt) { - unsigned char cmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt; - - int result = 0; - int delay = OSST_WAIT_WRITE_COMPLETE; + unsigned char cmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt; + int result = 0; + int delay = OSST_WAIT_WRITE_COMPLETE; #if DEBUG - char * name = tape_name(STp); + char * name = tape_name(STp); printk(OSST_DEB_MSG "%s:D: Reached onstream flush drive buffer (write filemark)\n", name); #endif @@ -753,7 +756,7 @@ cmd[0] = WRITE_FILEMARKS; cmd[1] = 1; - SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_WRITE_RETRIES, TRUE); + SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_RETRIES, TRUE); *aSRpnt = SRpnt; if (!SRpnt) return (-EBUSY); if (STp->buffer->syscall_result) { @@ -771,12 +774,12 @@ } #define OSST_POLL_PER_SEC 10 -static int osst_wait_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int curr, int minlast, int to) +static int osst_wait_frame(struct osst_tape * STp, struct scsi_request ** aSRpnt, int curr, int minlast, int to) { - unsigned long startwait = jiffies; - char * name = tape_name(STp); + unsigned long startwait = jiffies; + char * name = tape_name(STp); #if DEBUG - char notyetprinted = 1; + char notyetprinted = 1; #endif if (minlast >= 0 && STp->ps[STp->partition].rw != ST_READING) printk(KERN_ERR "%s:A: Waiting for frame without having initialized read!\n", name); @@ -784,7 +787,7 @@ while (time_before (jiffies, startwait + to*HZ)) { int result; - result = osst_get_frame_position (STp, aSRpnt); + result = osst_get_frame_position(STp, aSRpnt); if (result == -EIO) if ((result = osst_write_error_recovery(STp, aSRpnt, 0)) == 0) return 0; /* successful recovery leaves drive ready for frame */ @@ -826,23 +829,79 @@ return -EBUSY; } +static int osst_recover_wait_frame(struct osst_tape * STp, struct scsi_request ** aSRpnt, int writing) +{ + struct scsi_request * SRpnt; + unsigned char cmd[MAX_COMMAND_SIZE]; + unsigned long startwait = jiffies; + int retval = 1; + char * name = tape_name(STp); + + if (writing) { + char mybuf[24]; + char * olddata = STp->buffer->b_data; + int oldsize = STp->buffer->buffer_size; + + /* write zero fm then read pos - if shows write error, try to recover - if no progress, wait */ + + memset(cmd, 0, MAX_COMMAND_SIZE); + cmd[0] = WRITE_FILEMARKS; + cmd[1] = 1; + SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, + MAX_RETRIES, TRUE); + + while (retval && time_before (jiffies, startwait + 5*60*HZ)) { + + if (STp->buffer->syscall_result && (SRpnt->sr_sense_buffer[2] & 0x0f) != 2) { + + /* some failure - not just not-ready */ + retval = osst_write_error_recovery(STp, aSRpnt, 0); + break; + } + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout (HZ / OSST_POLL_PER_SEC); + + STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24; + memset(cmd, 0, MAX_COMMAND_SIZE); + cmd[0] = READ_POSITION; + + SRpnt = osst_do_scsi(SRpnt, STp, cmd, 20, SCSI_DATA_READ, STp->timeout, + MAX_RETRIES, TRUE); + + retval = ( STp->buffer->syscall_result || (STp->buffer)->b_data[15] > 25 ); + STp->buffer->b_data = olddata; STp->buffer->buffer_size = oldsize; + } + if (retval) + printk(KERN_ERR "%s:E: Device did not succeed to write buffered data\n", name); + } else + /* TODO - figure out which error conditions can be handled */ + if (STp->buffer->syscall_result) + printk(KERN_WARNING + "%s:W: Recover_wait_frame(read) cannot handle %02x:%02x:%02x\n", name, + (*aSRpnt)->sr_sense_buffer[ 2] & 0x0f, + (*aSRpnt)->sr_sense_buffer[12], + (*aSRpnt)->sr_sense_buffer[13]); + + return retval; +} + /* * Read the next OnStream tape frame at the current location */ -static int osst_read_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int timeout) +static int osst_read_frame(struct osst_tape * STp, struct scsi_request ** aSRpnt, int timeout) { - unsigned char cmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt; - int retval = 0; + unsigned char cmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt; + int retval = 0; #if DEBUG - os_aux_t * aux = STp->buffer->aux; - char * name = tape_name(STp); + os_aux_t * aux = STp->buffer->aux; + char * name = tape_name(STp); #endif - /* TODO: Error handling */ if (STp->poll) - retval = osst_wait_frame (STp, aSRpnt, STp->first_frame_position, 0, timeout); - + if (osst_wait_frame (STp, aSRpnt, STp->first_frame_position, 0, timeout)) + retval = osst_recover_wait_frame(STp, aSRpnt, 0); + memset(cmd, 0, MAX_COMMAND_SIZE); cmd[0] = READ_6; cmd[1] = 1; @@ -850,13 +909,13 @@ #if DEBUG if (debugging) - printk(OSST_DEB_MSG "%s:D: Reading frame from OnStream tape\n", name); + printk(OSST_DEB_MSG "%s:D: Reading frame from OnStream tape\n", name); #endif SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, OS_FRAME_SIZE, SCSI_DATA_READ, - STp->timeout, MAX_READ_RETRIES, TRUE); + STp->timeout, MAX_RETRIES, TRUE); *aSRpnt = SRpnt; if (!SRpnt) - return (-EBUSY); + return (-EBUSY); if ((STp->buffer)->syscall_result) { retval = 1; @@ -900,15 +959,13 @@ return (retval); } -static int osst_initiate_read(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) +static int osst_initiate_read(struct osst_tape * STp, struct scsi_request ** aSRpnt) { - struct st_partstat * STps = &(STp->ps[STp->partition]); - Scsi_Request * SRpnt ; - unsigned char cmd[MAX_COMMAND_SIZE]; - int retval = 0; -#if DEBUG - char * name = tape_name(STp); -#endif + struct st_partstat * STps = &(STp->ps[STp->partition]); + struct scsi_request * SRpnt ; + unsigned char cmd[MAX_COMMAND_SIZE]; + int retval = 0; + char * name = tape_name(STp); if (STps->rw != ST_READING) { /* Initialize read operation */ if (STps->rw == ST_WRITING || STp->dirty) { @@ -930,23 +987,25 @@ #if DEBUG printk(OSST_DEB_MSG "%s:D: Start Read Ahead on OnStream tape\n", name); #endif - SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_READ_RETRIES, TRUE); + SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_RETRIES, TRUE); *aSRpnt = SRpnt; - retval = STp->buffer->syscall_result; + if ((retval = STp->buffer->syscall_result)) + printk(KERN_WARNING "%s:W: Error starting read ahead\n", name); } return retval; } -static int osst_get_logical_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int frame_seq_number, int quiet) +static int osst_get_logical_frame(struct osst_tape * STp, struct scsi_request ** aSRpnt, + int frame_seq_number, int quiet) { struct st_partstat * STps = &(STp->ps[STp->partition]); - char * name = tape_name(STp); - int cnt = 0, - bad = 0, - past = 0, - x, - position; + char * name = tape_name(STp); + int cnt = 0, + bad = 0, + past = 0, + x, + position; /* * If we want just any frame (-1) and there is a frame in the buffer, return it @@ -971,6 +1030,7 @@ name, STp->read_error_frame); #endif STp->read_error_frame = 0; + STp->abort_count++; } return (-EIO); } @@ -988,10 +1048,11 @@ position = 0xbb8; else if (position > STp->eod_frame_ppos || ++bad == 10) { position = STp->read_error_frame - 1; + bad = 0; } else { - position += 39; - cnt += 20; + position += 29; + cnt += 19; } #if DEBUG printk(OSST_DEB_MSG "%s:D: Bad frame detected, positioning tape to block %d\n", @@ -1064,10 +1125,10 @@ return (STps->eof); } -static int osst_seek_logical_blk(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int logical_blk_num) +static int osst_seek_logical_blk(struct osst_tape * STp, struct scsi_request ** aSRpnt, int logical_blk_num) { struct st_partstat * STps = &(STp->ps[STp->partition]); - char * name = tape_name(STp); + char * name = tape_name(STp); int retries = 0; int frame_seq_estimate, ppos_estimate, move; @@ -1173,7 +1234,7 @@ #define OSST_SECTOR_SHIFT 9 #define OSST_SECTOR_MASK 0x03F -static int osst_get_sector(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) +static int osst_get_sector(struct osst_tape * STp, struct scsi_request ** aSRpnt) { int sector; #if DEBUG @@ -1203,12 +1264,12 @@ return sector; } -static int osst_seek_sector(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int sector) +static int osst_seek_sector(struct osst_tape * STp, struct scsi_request ** aSRpnt, int sector) { - struct st_partstat * STps = &(STp->ps[STp->partition]); - int frame = sector >> OSST_FRAME_SHIFT, - offset = (sector & OSST_SECTOR_MASK) << OSST_SECTOR_SHIFT, - r; + struct st_partstat * STps = &(STp->ps[STp->partition]); + int frame = sector >> OSST_FRAME_SHIFT, + offset = (sector & OSST_SECTOR_MASK) << OSST_SECTOR_SHIFT, + r; #if DEBUG char * name = tape_name(STp); @@ -1266,23 +1327,23 @@ * Precondition for this function to work: all frames in the * drive's buffer must be of one type (DATA, MARK or EOD)! */ -static int osst_read_back_buffer_and_rewrite(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, - unsigned int frame, unsigned int skip, int pending) +static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi_request ** aSRpnt, + unsigned int frame, unsigned int skip, int pending) { - Scsi_Request * SRpnt = * aSRpnt; - unsigned char * buffer, * p; - unsigned char cmd[MAX_COMMAND_SIZE]; - int flag, new_frame, i; - int nframes = STp->cur_frames; - int blks_per_frame = ntohs(STp->buffer->aux->dat.dat_list[0].blk_cnt); - int frame_seq_number = ntohl(STp->buffer->aux->frame_seq_num) + struct scsi_request * SRpnt = * aSRpnt; + unsigned char * buffer, * p; + unsigned char cmd[MAX_COMMAND_SIZE]; + int flag, new_frame, i; + int nframes = STp->cur_frames; + int blks_per_frame = ntohs(STp->buffer->aux->dat.dat_list[0].blk_cnt); + int frame_seq_number = ntohl(STp->buffer->aux->frame_seq_num) - (nframes + pending - 1); - int logical_blk_num = ntohl(STp->buffer->aux->logical_blk_num) + int logical_blk_num = ntohl(STp->buffer->aux->logical_blk_num) - (nframes + pending - 1) * blks_per_frame; - char * name = tape_name(STp); - unsigned long startwait = jiffies; + char * name = tape_name(STp); + unsigned long startwait = jiffies; #if DEBUG - int dbg = debugging; + int dbg = debugging; #endif if ((buffer = (unsigned char *)vmalloc((nframes + 1) * OS_DATA_SIZE)) == NULL) @@ -1308,7 +1369,7 @@ cmd[8] = 32768 & 0xff; SRpnt = osst_do_scsi(SRpnt, STp, cmd, OS_FRAME_SIZE, SCSI_DATA_READ, - STp->timeout, MAX_READ_RETRIES, TRUE); + STp->timeout, MAX_RETRIES, TRUE); if ((STp->buffer)->syscall_result || !SRpnt) { printk(KERN_ERR "%s:E: Failed to read frame back from OnStream buffer\n", name); @@ -1357,8 +1418,8 @@ vfree((void *)buffer); return (-EIO); } - flag = 0; if ( i >= nframes + pending ) break; + flag = 0; } osst_copy_to_buffer(STp->buffer, p); /* @@ -1380,7 +1441,7 @@ p[0], p[1], p[2], p[3]); #endif SRpnt = osst_do_scsi(SRpnt, STp, cmd, OS_FRAME_SIZE, SCSI_DATA_WRITE, - STp->timeout, MAX_WRITE_RETRIES, TRUE); + STp->timeout, MAX_RETRIES, TRUE); if (STp->buffer->syscall_result) flag = 1; @@ -1396,7 +1457,7 @@ cmd[0] = WRITE_FILEMARKS; cmd[1] = 1; SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, SCSI_DATA_NONE, - STp->timeout, MAX_WRITE_RETRIES, TRUE); + STp->timeout, MAX_RETRIES, TRUE); #if DEBUG if (debugging) { printk(OSST_DEB_MSG "%s:D: Sleeping in re-write wait ready\n", name); @@ -1411,7 +1472,7 @@ cmd[0] = TEST_UNIT_READY; SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, - MAX_READY_RETRIES, TRUE); + MAX_RETRIES, TRUE); if (SRpnt->sr_sense_buffer[2] == 2 && SRpnt->sr_sense_buffer[12] == 4 && (SRpnt->sr_sense_buffer[13] == 1 || SRpnt->sr_sense_buffer[13] == 8)) { @@ -1448,29 +1509,34 @@ #endif osst_get_frame_position(STp, aSRpnt); #if DEBUG - printk(OSST_DEB_MSG "%s:D: reported frame positions: host = %d, tape = %d\n", - name, STp->first_frame_position, STp->last_frame_position); + printk(OSST_DEB_MSG "%s:D: reported frame positions: host = %d, tape = %d, buffer = %d\n", + name, STp->first_frame_position, STp->last_frame_position, STp->cur_frames); #endif } - } + } + if (flag) { + /* error recovery did not successfully complete */ + printk(KERN_ERR "%s:D: Write error recovery failed in %s\n", name, + STp->write_type == OS_WRITE_HEADER?"header":"body"); + } if (!pending) osst_copy_to_buffer(STp->buffer, p); /* so buffer content == at entry in all cases */ vfree((void *)buffer); return 0; } -static int osst_reposition_and_retry(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, +static int osst_reposition_and_retry(struct osst_tape * STp, struct scsi_request ** aSRpnt, unsigned int frame, unsigned int skip, int pending) { - unsigned char cmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt; - char * name = tape_name(STp); - int expected = 0; - int attempts = 1000 / skip; - int flag = 1; - unsigned long startwait = jiffies; + unsigned char cmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt; + char * name = tape_name(STp); + int expected = 0; + int attempts = 1000 / skip; + int flag = 1; + unsigned long startwait = jiffies; #if DEBUG - int dbg = debugging; + int dbg = debugging; #endif while (attempts && time_before(jiffies, startwait + 60*HZ)) { @@ -1512,7 +1578,7 @@ name, STp->frame_seq_number-1, STp->first_frame_position); #endif SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, OS_FRAME_SIZE, SCSI_DATA_WRITE, - STp->timeout, MAX_WRITE_RETRIES, TRUE); + STp->timeout, MAX_RETRIES, TRUE); *aSRpnt = SRpnt; if (STp->buffer->syscall_result) { /* additional write error */ @@ -1550,6 +1616,7 @@ debugging = 0; } #endif + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ / 10); } printk(KERN_ERR "%s:E: Failed to find valid tape media\n", name); @@ -1563,14 +1630,14 @@ * Error recovery algorithm for the OnStream tape. */ -static int osst_write_error_recovery(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int pending) +static int osst_write_error_recovery(struct osst_tape * STp, struct scsi_request ** aSRpnt, int pending) { - Scsi_Request * SRpnt = * aSRpnt; + struct scsi_request * SRpnt = * aSRpnt; struct st_partstat * STps = & STp->ps[STp->partition]; - char * name = tape_name(STp); - int retval = 0; - int rw_state; - unsigned int frame, skip; + char * name = tape_name(STp); + int retval = 0; + int rw_state; + unsigned int frame, skip; rw_state = STps->rw; @@ -1635,12 +1702,14 @@ if (retval == 0) { STp->recover_count++; STp->recover_erreg++; - } + } else + STp->abort_count++; + STps->rw = rw_state; return retval; } -static int osst_space_over_filemarks_backward(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, +static int osst_space_over_filemarks_backward(struct osst_tape * STp, struct scsi_request ** aSRpnt, int mt_op, int mt_count) { char * name = tape_name(STp); @@ -1739,7 +1808,7 @@ * * Just scans for the filemark sequentially. */ -static int osst_space_over_filemarks_forward_slow(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, +static int osst_space_over_filemarks_forward_slow(struct osst_tape * STp, struct scsi_request ** aSRpnt, int mt_op, int mt_count) { int cnt = 0; @@ -1793,7 +1862,7 @@ /* * Fast linux specific version of OnStream FSF */ -static int osst_space_over_filemarks_forward_fast(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, +static int osst_space_over_filemarks_forward_fast(struct osst_tape * STp, struct scsi_request ** aSRpnt, int mt_op, int mt_count) { char * name = tape_name(STp); @@ -1944,11 +2013,11 @@ * to test the error recovery mechanism. */ #if DEBUG -static void osst_set_retries(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int retries) +static void osst_set_retries(struct osst_tape * STp, struct scsi_request ** aSRpnt, int retries) { - unsigned char cmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt = * aSRpnt; - char * name = tape_name(STp); + unsigned char cmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt = * aSRpnt; + char * name = tape_name(STp); memset(cmd, 0, MAX_COMMAND_SIZE); cmd[0] = MODE_SELECT; @@ -1976,7 +2045,7 @@ #endif -static int osst_write_filemark(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) +static int osst_write_filemark(struct osst_tape * STp, struct scsi_request ** aSRpnt) { int result; int this_mark_ppos = STp->first_frame_position; @@ -2004,7 +2073,7 @@ return result; } -static int osst_write_eod(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) +static int osst_write_eod(struct osst_tape * STp, struct scsi_request ** aSRpnt) { int result; #if DEBUG @@ -2027,7 +2096,7 @@ return result; } -static int osst_write_filler(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int where, int count) +static int osst_write_filler(struct osst_tape * STp, struct scsi_request ** aSRpnt, int where, int count) { char * name = tape_name(STp); @@ -2052,7 +2121,7 @@ return osst_flush_drive_buffer(STp, aSRpnt); } -static int __osst_write_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int where, int count) +static int __osst_write_header(struct osst_tape * STp, struct scsi_request ** aSRpnt, int where, int count) { char * name = tape_name(STp); int result; @@ -2079,7 +2148,7 @@ return result; } -static int osst_write_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int locate_eod) +static int osst_write_header(struct osst_tape * STp, struct scsi_request ** aSRpnt, int locate_eod) { os_header_t * header; int result; @@ -2153,7 +2222,7 @@ return result; } -static int osst_reset_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) +static int osst_reset_header(struct osst_tape * STp, struct scsi_request ** aSRpnt) { if (STp->header_cache != NULL) memset(STp->header_cache, 0, sizeof(os_header_t)); @@ -2166,7 +2235,7 @@ return osst_write_header(STp, aSRpnt, 1); } -static int __osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int ppos) +static int __osst_analyze_headers(struct osst_tape * STp, struct scsi_request ** aSRpnt, int ppos) { char * name = tape_name(STp); os_header_t * header; @@ -2343,7 +2412,7 @@ return 1; } -static int osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) +static int osst_analyze_headers(struct osst_tape * STp, struct scsi_request ** aSRpnt) { int position, ppos; int first, last; @@ -2398,7 +2467,7 @@ return 1; } -static int osst_verify_position(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt) +static int osst_verify_position(struct osst_tape * STp, struct scsi_request ** aSRpnt) { int frame_position = STp->first_frame_position; int frame_seq_numbr = STp->frame_seq_number; @@ -2474,11 +2543,11 @@ /* * Configure the OnStream SCII tape drive for default operation */ -static int osst_configure_onstream(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt) +static int osst_configure_onstream(struct osst_tape *STp, struct scsi_request ** aSRpnt) { unsigned char cmd[MAX_COMMAND_SIZE]; char * name = tape_name(STp); - Scsi_Request * SRpnt = * aSRpnt; + struct scsi_request * SRpnt = * aSRpnt; osst_mode_parameter_header_t * header; osst_block_size_page_t * bs; osst_capabilities_page_t * cp; @@ -2645,7 +2714,7 @@ /* Step over EOF if it has been inadvertently crossed (ioctl not used because it messes up the block number). */ -static int cross_eof(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, int forward) +static int cross_eof(struct osst_tape *STp, struct scsi_request ** aSRpnt, int forward) { int result; char * name = tape_name(STp); @@ -2674,18 +2743,18 @@ /* Get the tape position. */ -static int osst_get_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt) +static int osst_get_frame_position(struct osst_tape *STp, struct scsi_request ** aSRpnt) { - unsigned char scmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt; - int result = 0; + unsigned char scmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt; + int result = 0; + char * name = tape_name(STp); /* KG: We want to be able to use it for checking Write Buffer availability * and thus don't want to risk to overwrite anything. Exchange buffers ... */ char mybuf[24]; char * olddata = STp->buffer->b_data; int oldsize = STp->buffer->buffer_size; - char * name = tape_name(STp); if (STp->ready != ST_READY) return (-EIO); @@ -2702,13 +2771,12 @@ *aSRpnt = SRpnt; if (STp->buffer->syscall_result) - result = ((SRpnt->sr_sense_buffer[2] & 0x0f) == 3) ? -EIO : -EINVAL; + result = ((SRpnt->sr_sense_buffer[2] & 0x0f) == 3) ? -EIO : -EINVAL; /* 3: Write Error */ if (result == -EINVAL) printk(KERN_ERR "%s:E: Can't read tape position.\n", name); else { - - if (result == -EIO) { /* re-read position */ + if (result == -EIO) { /* re-read position - this needs to preserve media errors */ unsigned char mysense[16]; memcpy (mysense, SRpnt->sr_sense_buffer, 16); memset (scmd, 0, MAX_COMMAND_SIZE); @@ -2716,8 +2784,15 @@ STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24; SRpnt = osst_do_scsi(SRpnt, STp, scmd, 20, SCSI_DATA_READ, STp->timeout, MAX_RETRIES, TRUE); +#if DEBUG + printk(OSST_DEB_MSG "%s:D: Reread position, reason=[%02x:%02x:%02x], result=[%s%02x:%02x:%02x]\n", + name, mysense[2], mysense[12], mysense[13], STp->buffer->syscall_result?"":"ok:", + SRpnt->sr_sense_buffer[2],SRpnt->sr_sense_buffer[12],SRpnt->sr_sense_buffer[13]); +#endif if (!STp->buffer->syscall_result) memcpy (SRpnt->sr_sense_buffer, mysense, 16); + else + printk(KERN_WARNING "%s:W: Double error in get position\n", name); } STp->first_frame_position = ((STp->buffer)->b_data[4] << 24) + ((STp->buffer)->b_data[5] << 16) @@ -2739,7 +2814,7 @@ #endif if (STp->cur_frames == 0 && STp->first_frame_position != STp->last_frame_position) { #if DEBUG - printk(KERN_WARNING "%s:D: Correcting read position %d, %d, %d\n", name, + printk(OSST_DEB_MSG "%s:D: Correcting read position %d, %d, %d\n", name, STp->first_frame_position, STp->last_frame_position, STp->cur_frames); #endif STp->first_frame_position = STp->last_frame_position; @@ -2752,14 +2827,14 @@ /* Set the tape block */ -static int osst_set_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, int ppos, int skip) +static int osst_set_frame_position(struct osst_tape *STp, struct scsi_request ** aSRpnt, int ppos, int skip) { - unsigned char scmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt; - struct st_partstat * STps; - int result = 0; - int pp = (ppos == 3000 && !skip)? 0 : ppos; - char * name = tape_name(STp); + unsigned char scmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt; + struct st_partstat * STps; + int result = 0; + int pp = (ppos == 3000 && !skip)? 0 : ppos; + char * name = tape_name(STp); if (STp->ready != ST_READY) return (-EIO); @@ -2810,7 +2885,7 @@ return result; } -static int osst_write_trailer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, int leave_at_EOT) +static int osst_write_trailer(struct osst_tape *STp, struct scsi_request ** aSRpnt, int leave_at_EOT) { struct st_partstat * STps = &(STp->ps[STp->partition]); int result = 0; @@ -2837,26 +2912,26 @@ /* osst versions of st functions - augmented and stripped to suit OnStream only */ /* Flush the write buffer (never need to write if variable blocksize). */ -static int osst_flush_write_buffer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt) +static int osst_flush_write_buffer(struct osst_tape *STp, struct scsi_request ** aSRpnt) { - int offset, transfer, blks = 0; - int result = 0; - unsigned char cmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt = *aSRpnt; - struct st_partstat * STps; - char * name = tape_name(STp); + int offset, transfer, blks = 0; + int result = 0; + unsigned char cmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt = *aSRpnt; + struct st_partstat * STps; + char * name = tape_name(STp); if ((STp->buffer)->writing) { if (SRpnt == (STp->buffer)->last_SRpnt) #if DEBUG { printk(OSST_DEB_MSG - "%s:D: aSRpnt points to Scsi_Request that write_behind_check will release -- cleared\n", name); + "%s:D: aSRpnt points to scsi_request that write_behind_check will release -- cleared\n", name); #endif *aSRpnt = SRpnt = NULL; #if DEBUG } else if (SRpnt) printk(OSST_DEB_MSG - "%s:D: aSRpnt does not point to Scsi_Request that write_behind_check will release -- strange\n", name); + "%s:D: aSRpnt does not point to scsi_request that write_behind_check will release -- strange\n", name); #endif osst_write_behind_check(STp); if ((STp->buffer)->syscall_result) { @@ -2884,9 +2959,9 @@ if (offset < OS_DATA_SIZE) osst_zero_buffer_tail(STp->buffer); - /* TODO: Error handling! */ if (STp->poll) - result = osst_wait_frame (STp, aSRpnt, STp->first_frame_position, -50, 120); + if (osst_wait_frame (STp, aSRpnt, STp->first_frame_position, -50, 120)) + result = osst_recover_wait_frame(STp, aSRpnt, 1); memset(cmd, 0, MAX_COMMAND_SIZE); cmd[0] = WRITE_6; @@ -2925,7 +3000,7 @@ #endif SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, transfer, SCSI_DATA_WRITE, - STp->timeout, MAX_WRITE_RETRIES, TRUE); + STp->timeout, MAX_RETRIES, TRUE); *aSRpnt = SRpnt; if (!SRpnt) return (-EBUSY); @@ -2967,12 +3042,12 @@ /* Flush the tape buffer. The tape will be positioned correctly unless seek_next is true. */ -static int osst_flush_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int seek_next) +static int osst_flush_buffer(struct osst_tape * STp, struct scsi_request ** aSRpnt, int seek_next) { struct st_partstat * STps; - int backspace = 0, result = 0; + int backspace = 0, result = 0; #if DEBUG - char * name = tape_name(STp); + char * name = tape_name(STp); #endif /* @@ -3029,13 +3104,13 @@ return result; } -static int osst_write_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int synchronous) +static int osst_write_frame(struct osst_tape * STp, struct scsi_request ** aSRpnt, int synchronous) { - unsigned char cmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt; - int blks; + unsigned char cmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt; + int blks; #if DEBUG - char * name = tape_name(STp); + char * name = tape_name(STp); #endif if ((!STp-> raw) && (STp->first_frame_position == 0xbae)) { /* _must_ preserve buffer! */ @@ -3055,8 +3130,9 @@ } if (STp->poll) - osst_wait_frame (STp, aSRpnt, STp->first_frame_position, -50, 60); - /* TODO: Check for an error ! */ + if (osst_wait_frame (STp, aSRpnt, STp->first_frame_position, -48, 120)) + if (osst_recover_wait_frame(STp, aSRpnt, 1)) + return (-EIO); // osst_build_stats(STp, &SRpnt); @@ -3081,7 +3157,7 @@ STp->write_pending = 1; #endif SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, OS_FRAME_SIZE, SCSI_DATA_WRITE, STp->timeout, - MAX_WRITE_RETRIES, synchronous); + MAX_RETRIES, synchronous); if (!SRpnt) return (-EBUSY); *aSRpnt = SRpnt; @@ -3111,8 +3187,8 @@ return 0; } -/* Lock or unlock the drive door. Don't use when Scsi_Request allocated. */ -static int do_door_lock(OS_Scsi_Tape * STp, int do_lock) +/* Lock or unlock the drive door. Don't use when struct scsi_request allocated. */ +static int do_door_lock(struct osst_tape * STp, int do_lock) { int retval, cmd; @@ -3131,7 +3207,7 @@ } /* Set the internal state after reset */ -static void reset_state(OS_Scsi_Tape *STp) +static void reset_state(struct osst_tape *STp) { int i; struct st_partstat *STps; @@ -3154,16 +3230,16 @@ /* Write command */ static ssize_t osst_write(struct file * filp, const char __user * buf, size_t count, loff_t *ppos) { - ssize_t total, retval = 0; - ssize_t i, do_count, blks, transfer; - int write_threshold; - int doing_write = 0; + ssize_t total, retval = 0; + ssize_t i, do_count, blks, transfer; + int write_threshold; + int doing_write = 0; const char __user * b_point; - Scsi_Request * SRpnt = NULL; + struct scsi_request * SRpnt = NULL; struct st_modedef * STm; struct st_partstat * STps; - OS_Scsi_Tape * STp = filp->private_data; - char * name = tape_name(STp); + struct osst_tape * STp = filp->private_data; + char * name = tape_name(STp); if (down_interruptible(&STp->lock)) @@ -3477,14 +3553,14 @@ /* Read command */ static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, loff_t *ppos) { - ssize_t total, retval = 0; - ssize_t i, transfer; - int special; - struct st_modedef * STm; + ssize_t total, retval = 0; + ssize_t i, transfer; + int special; + struct st_modedef * STm; struct st_partstat * STps; - Scsi_Request * SRpnt = NULL; - OS_Scsi_Tape * STp = filp->private_data; - char * name = tape_name(STp); + struct scsi_request * SRpnt = NULL; + struct osst_tape * STp = filp->private_data; + char * name = tape_name(STp); if (down_interruptible(&STp->lock)) @@ -3660,8 +3736,7 @@ /* Set the driver options */ -static void osst_log_options(OS_Scsi_Tape *STp, struct st_modedef *STm, - char *name) +static void osst_log_options(struct osst_tape *STp, struct st_modedef *STm, char *name) { printk(KERN_INFO "%s:I: Mode %d options: buffer writes: %d, async writes: %d, read ahead: %d\n", @@ -3684,12 +3759,12 @@ } -static int osst_set_options(OS_Scsi_Tape *STp, long options) +static int osst_set_options(struct osst_tape *STp, long options) { - int value; - long code; + int value; + long code; struct st_modedef * STm; - char * name = tape_name(STp); + char * name = tape_name(STp); STm = &(STp->modes[STp->current_mode]); if (!STm->defined) { @@ -3840,18 +3915,19 @@ /* Internal ioctl function */ -static int osst_int_ioctl(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned int cmd_in, unsigned long arg) +static int osst_int_ioctl(struct osst_tape * STp, struct scsi_request ** aSRpnt, + unsigned int cmd_in, unsigned long arg) { - int timeout; - long ltmp; - int i, ioctl_result; - int chg_eof = TRUE; - unsigned char cmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt = * aSRpnt; - struct st_partstat * STps; - int fileno, blkno, at_sm, frame_seq_numbr, logical_blk_num; - int datalen = 0, direction = SCSI_DATA_NONE; - char * name = tape_name(STp); + int timeout; + long ltmp; + int i, ioctl_result; + int chg_eof = TRUE; + unsigned char cmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt = * aSRpnt; + struct st_partstat * STps; + int fileno, blkno, at_sm, frame_seq_numbr, logical_blk_num; + int datalen = 0, direction = SCSI_DATA_NONE; + char * name = tape_name(STp); if (STp->ready != ST_READY && cmd_in != MTLOAD) { if (STp->ready == ST_NO_TAPE) @@ -4227,16 +4303,16 @@ /* Open the device */ static int os_scsi_tape_open(struct inode * inode, struct file * filp) { - unsigned short flags; - int i, b_size, new_session = FALSE, retval = 0; - unsigned char cmd[MAX_COMMAND_SIZE]; - Scsi_Request * SRpnt = NULL; - OS_Scsi_Tape * STp; - struct st_modedef * STm; + unsigned short flags; + int i, b_size, new_session = FALSE, retval = 0; + unsigned char cmd[MAX_COMMAND_SIZE]; + struct scsi_request * SRpnt = NULL; + struct osst_tape * STp; + struct st_modedef * STm; struct st_partstat * STps; - char * name; - int dev = TAPE_NR(inode); - int mode = TAPE_MODE(inode); + char * name; + int dev = TAPE_NR(inode); + int mode = TAPE_MODE(inode); nonseekable_open(inode, filp); write_lock(&os_scsi_tapes_lock); @@ -4327,9 +4403,9 @@ memset (cmd, 0, MAX_COMMAND_SIZE); cmd[0] = TEST_UNIT_READY; - SRpnt = osst_do_scsi(NULL, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_READY_RETRIES, TRUE); + SRpnt = osst_do_scsi(NULL, STp, cmd, 0, SCSI_DATA_NONE, STp->timeout, MAX_RETRIES, TRUE); if (!SRpnt) { - retval = (STp->buffer)->syscall_result; + retval = (STp->buffer)->syscall_result; /* FIXME - valid? */ goto err_out; } if ((SRpnt->sr_sense_buffer[0] & 0x70) == 0x70 && @@ -4348,7 +4424,7 @@ cmd[1] = 1; cmd[4] = 1; SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, SCSI_DATA_NONE, - STp->timeout, MAX_READY_RETRIES, TRUE); + STp->timeout, MAX_RETRIES, TRUE); } osst_wait_ready(STp, &SRpnt, (SRpnt->sr_sense_buffer[13]==1?15:3) * 60, 0); } @@ -4365,7 +4441,7 @@ cmd[0] = TEST_UNIT_READY; SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, SCSI_DATA_NONE, - STp->timeout, MAX_READY_RETRIES, TRUE); + STp->timeout, MAX_RETRIES, TRUE); if ((SRpnt->sr_sense_buffer[0] & 0x70) != 0x70 || (SRpnt->sr_sense_buffer[2] & 0x0f) != UNIT_ATTENTION) break; @@ -4386,6 +4462,7 @@ } new_session = TRUE; STp->recover_count = 0; + STp->abort_count = 0; } /* * if we have valid headers from before, and the drive/tape seem untouched, @@ -4473,7 +4550,7 @@ cmd[0] = TEST_UNIT_READY; SRpnt = osst_do_scsi(SRpnt, STp, cmd, 0, SCSI_DATA_NONE, - STp->timeout, MAX_READY_RETRIES, TRUE); + STp->timeout, MAX_RETRIES, TRUE); if ((SRpnt->sr_sense_buffer[0] & 0x70) != 0x70 || (SRpnt->sr_sense_buffer[2] & 0x0f) == NOT_READY) break; @@ -4588,12 +4665,12 @@ /* Flush the tape buffer before close */ static int os_scsi_tape_flush(struct file * filp) { - int result = 0, result2; - OS_Scsi_Tape * STp = filp->private_data; - struct st_modedef * STm = &(STp->modes[STp->current_mode]); - struct st_partstat * STps = &(STp->ps[STp->partition]); - Scsi_Request * SRpnt = NULL; - char * name = tape_name(STp); + int result = 0, result2; + struct osst_tape * STp = filp->private_data; + struct st_modedef * STm = &(STp->modes[STp->current_mode]); + struct st_partstat * STps = &(STp->ps[STp->partition]); + struct scsi_request * SRpnt = NULL; + char * name = tape_name(STp); if (file_count(filp) > 1) return 0; @@ -4657,14 +4734,19 @@ } if (SRpnt) scsi_release_request(SRpnt); - if (STp->recover_count) { - printk(KERN_INFO "%s:I: %d recovered errors in", name, STp->recover_count); + if (STp->abort_count || STp->recover_count) { + printk(KERN_INFO "%s:I:", name); + if (STp->abort_count) + printk(" %d unrecovered errors", STp->abort_count); + if (STp->recover_count) + printk(" %d recovered errors", STp->recover_count); if (STp->write_count) - printk(" %d frames written", STp->write_count); + printk(" in %d frames written", STp->write_count); if (STp->read_count) - printk(" %d frames read", STp->read_count); + printk(" in %d frames read", STp->read_count); printk("\n"); STp->recover_count = 0; + STp->abort_count = 0; } STp->write_count = 0; STp->read_count = 0; @@ -4676,9 +4758,9 @@ /* Close the device and release it */ static int os_scsi_tape_close(struct inode * inode, struct file * filp) { - int result = 0; - OS_Scsi_Tape * STp = filp->private_data; - Scsi_Request * SRpnt = NULL; + int result = 0; + struct osst_tape * STp = filp->private_data; + struct scsi_request * SRpnt = NULL; if (SRpnt) scsi_release_request(SRpnt); @@ -4703,14 +4785,14 @@ static int osst_ioctl(struct inode * inode,struct file * file, unsigned int cmd_in, unsigned long arg) { - int i, cmd_nr, cmd_type, retval = 0; - unsigned int blk; - struct st_modedef * STm; + int i, cmd_nr, cmd_type, retval = 0; + unsigned int blk; + struct st_modedef * STm; struct st_partstat * STps; - Scsi_Request * SRpnt = NULL; - OS_Scsi_Tape * STp = file->private_data; - char * name = tape_name(STp); - void __user *p = (void __user *)arg; + struct scsi_request * SRpnt = NULL; + struct osst_tape * STp = file->private_data; + char * name = tape_name(STp); + void __user * p = (void __user *)arg; if (down_interruptible(&STp->lock)) return -ERESTARTSYS; @@ -5039,18 +5121,18 @@ /* Memory handling routines */ /* Try to allocate a new tape buffer skeleton. Caller must not hold os_scsi_tapes_lock */ -static OSST_buffer * new_tape_buffer( int from_initialization, int need_dma, int max_sg ) +static struct osst_buffer * new_tape_buffer( int from_initialization, int need_dma, int max_sg ) { int i, priority; - OSST_buffer *tb; + struct osst_buffer *tb; if (from_initialization) priority = GFP_ATOMIC; else priority = GFP_KERNEL; - i = sizeof(OSST_buffer) + (osst_max_sg_segs - 1) * sizeof(struct scatterlist); - tb = (OSST_buffer *)kmalloc(i, priority); + i = sizeof(struct osst_buffer) + (osst_max_sg_segs - 1) * sizeof(struct scatterlist); + tb = (struct osst_buffer *)kmalloc(i, priority); if (!tb) { printk(KERN_NOTICE "osst :I: Can't allocate new tape buffer.\n"); return NULL; @@ -5071,7 +5153,7 @@ } /* Try to allocate a temporary (while a user has the device open) enlarged tape buffer */ -static int enlarge_buffer(OSST_buffer *STbuffer, int need_dma) +static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma) { int segs, nbr, max_segs, b_size, priority, order, got; @@ -5087,12 +5169,10 @@ if (nbr <= 2) return FALSE; - priority = GFP_KERNEL; + priority = GFP_KERNEL /* | __GFP_NOWARN */; if (need_dma) priority |= GFP_DMA; - priority |= __GFP_NOWARN; - /* Try to allocate the first segment up to OS_DATA_SIZE and the others big enough to reach the goal (code assumes no segments in place) */ for (b_size = OS_DATA_SIZE, order = OSST_FIRST_ORDER; b_size >= PAGE_SIZE; order--, b_size /= 2) { @@ -5150,7 +5230,7 @@ /* Release the segments */ -static void normalize_buffer(OSST_buffer *STbuffer) +static void normalize_buffer(struct osst_buffer *STbuffer) { int i, order, b_size; @@ -5174,7 +5254,7 @@ /* Move data from the user buffer to the tape buffer. Returns zero (success) or negative error code. */ -static int append_to_buffer(const char __user *ubp, OSST_buffer *st_bp, int do_count) +static int append_to_buffer(const char __user *ubp, struct osst_buffer *st_bp, int do_count) { int i, cnt, res, offset; @@ -5207,7 +5287,7 @@ /* Move data from the tape buffer to the user buffer. Returns zero (success) or negative error code. */ -static int from_buffer(OSST_buffer *st_bp, char __user *ubp, int do_count) +static int from_buffer(struct osst_buffer *st_bp, char __user *ubp, int do_count) { int i, cnt, res, offset; @@ -5239,7 +5319,7 @@ /* Sets the tail of the buffer after fill point to zero. Returns zero (success) or negative error code. */ -static int osst_zero_buffer_tail(OSST_buffer *st_bp) +static int osst_zero_buffer_tail(struct osst_buffer *st_bp) { int i, offset, do_count, cnt; @@ -5267,7 +5347,7 @@ /* Copy a osst 32K chunk of memory into the buffer. Returns zero (success) or negative error code. */ -static int osst_copy_to_buffer(OSST_buffer *st_bp, unsigned char *ptr) +static int osst_copy_to_buffer(struct osst_buffer *st_bp, unsigned char *ptr) { int i, cnt, do_count = OS_DATA_SIZE; @@ -5288,7 +5368,7 @@ /* Copy a osst 32K chunk of memory from the buffer. Returns zero (success) or negative error code. */ -static int osst_copy_from_buffer(OSST_buffer *st_bp, unsigned char *ptr) +static int osst_copy_from_buffer(struct osst_buffer *st_bp, unsigned char *ptr) { int i, cnt, do_count = OS_DATA_SIZE; @@ -5406,18 +5486,163 @@ } /* + * sysfs support for osst driver parameter information + */ + +static ssize_t osst_version_show(struct device_driver *ddd, char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%s\n", osst_version); +} + +static DRIVER_ATTR(version, S_IRUGO, osst_version_show, NULL); + +static void osst_create_driverfs_files(struct device_driver *driverfs) +{ + driver_create_file(driverfs, &driver_attr_version); +} + +static void osst_remove_driverfs_files(struct device_driver *driverfs) +{ + driver_remove_file(driverfs, &driver_attr_version); +} + +/* + * sysfs support for accessing ADR header information + */ + +static ssize_t osst_adr_rev_show(struct class_device *class_dev, char *buf) +{ + struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); + ssize_t l = 0; + + if (STp && STp->header_ok && STp->linux_media) + l = snprintf(buf, PAGE_SIZE, "%d.%d\n", STp->header_cache->major_rev, STp->header_cache->minor_rev); + return l; +} + +CLASS_DEVICE_ATTR(ADR_rev, S_IRUGO, osst_adr_rev_show, NULL); + +static ssize_t osst_linux_media_version_show(struct class_device *class_dev, char *buf) +{ + struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); + ssize_t l = 0; + + if (STp && STp->header_ok && STp->linux_media) + l = snprintf(buf, PAGE_SIZE, "LIN%d\n", STp->linux_media_version); + return l; +} + +CLASS_DEVICE_ATTR(media_version, S_IRUGO, osst_linux_media_version_show, NULL); + +static ssize_t osst_capacity_show(struct class_device *class_dev, char *buf) +{ + struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); + ssize_t l = 0; + + if (STp && STp->header_ok && STp->linux_media) + l = snprintf(buf, PAGE_SIZE, "%d\n", STp->capacity); + return l; +} + +CLASS_DEVICE_ATTR(capacity, S_IRUGO, osst_capacity_show, NULL); + +static ssize_t osst_first_data_ppos_show(struct class_device *class_dev, char *buf) +{ + struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); + ssize_t l = 0; + + if (STp && STp->header_ok && STp->linux_media) + l = snprintf(buf, PAGE_SIZE, "%d\n", STp->first_data_ppos); + return l; +} + +CLASS_DEVICE_ATTR(BOT_frame, S_IRUGO, osst_first_data_ppos_show, NULL); + +static ssize_t osst_eod_frame_ppos_show(struct class_device *class_dev, char *buf) +{ + struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); + ssize_t l = 0; + + if (STp && STp->header_ok && STp->linux_media) + l = snprintf(buf, PAGE_SIZE, "%d\n", STp->eod_frame_ppos); + return l; +} + +CLASS_DEVICE_ATTR(EOD_frame, S_IRUGO, osst_eod_frame_ppos_show, NULL); + +static ssize_t osst_filemark_cnt_show(struct class_device *class_dev, char *buf) +{ + struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); + ssize_t l = 0; + + if (STp && STp->header_ok && STp->linux_media) + l = snprintf(buf, PAGE_SIZE, "%d\n", STp->filemark_cnt); + return l; +} + +CLASS_DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL); + +static struct class_simple * osst_sysfs_class; + +static int osst_sysfs_valid = 0; + +static void osst_sysfs_init(void) +{ + osst_sysfs_class = class_simple_create(THIS_MODULE, "onstream_tape"); + if ( IS_ERR(osst_sysfs_class) ) + printk(KERN_WARNING "osst :W: Unable to register sysfs class\n"); + else + osst_sysfs_valid = TRUE; +} + +static void osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * STp, char * name) +{ + struct class_device *osst_class_member; + + if (!osst_sysfs_valid) return; + + osst_class_member = class_simple_device_add(osst_sysfs_class, dev, device, "%s", name); + if (IS_ERR(osst_class_member)) { + printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); + return; + } + class_set_devdata(osst_class_member, STp); + class_device_create_file(osst_class_member, &class_device_attr_ADR_rev); + class_device_create_file(osst_class_member, &class_device_attr_media_version); + class_device_create_file(osst_class_member, &class_device_attr_capacity); + class_device_create_file(osst_class_member, &class_device_attr_BOT_frame); + class_device_create_file(osst_class_member, &class_device_attr_EOD_frame); + class_device_create_file(osst_class_member, &class_device_attr_file_count); +} + +static void osst_sysfs_destroy(dev_t dev) +{ + if (!osst_sysfs_valid) return; + + class_simple_device_remove(dev); +} + +static void osst_sysfs_cleanup(void) +{ + if (osst_sysfs_valid) { + class_simple_destroy(osst_sysfs_class); + osst_sysfs_valid = 0; + } +} + +/* * osst startup / cleanup code */ static int osst_probe(struct device *dev) { - Scsi_Device * SDp = to_scsi_device(dev); - OS_Scsi_Tape * tpnt; - struct st_modedef * STm; - struct st_partstat * STps; - OSST_buffer * buffer; - struct gendisk * drive; - int i, mode, dev_num; + Scsi_Device * SDp = to_scsi_device(dev); + struct osst_tape * tpnt; + struct st_modedef * STm; + struct st_partstat * STps; + struct osst_buffer * buffer; + struct gendisk * drive; + int i, mode, dev_num; if (SDp->type != TYPE_TAPE || !osst_supports(SDp)) return -ENODEV; @@ -5432,7 +5657,7 @@ write_lock(&os_scsi_tapes_lock); if (os_scsi_tapes == NULL) { os_scsi_tapes = - (OS_Scsi_Tape **)kmalloc(osst_max_dev * sizeof(OS_Scsi_Tape *), + (struct osst_tape **)kmalloc(osst_max_dev * sizeof(struct osst_tape *), GFP_ATOMIC); if (os_scsi_tapes == NULL) { write_unlock(&os_scsi_tapes_lock); @@ -5453,14 +5678,14 @@ if(i >= osst_max_dev) panic ("Scsi_devices corrupt (osst)"); dev_num = i; - /* allocate a OS_Scsi_Tape for this device */ - tpnt = (OS_Scsi_Tape *)kmalloc(sizeof(OS_Scsi_Tape), GFP_ATOMIC); + /* allocate a struct osst_tape for this device */ + tpnt = (struct osst_tape *)kmalloc(sizeof(struct osst_tape), GFP_ATOMIC); if (tpnt == NULL) { write_unlock(&os_scsi_tapes_lock); printk(KERN_ERR "osst :E: Can't allocate device descriptor, device not attached.\n"); goto out_put_disk; } - memset(tpnt, 0, sizeof(OS_Scsi_Tape)); + memset(tpnt, 0, sizeof(struct osst_tape)); /* allocate a buffer for this device */ i = SDp->host->sg_tablesize; @@ -5545,7 +5770,14 @@ init_MUTEX(&tpnt->lock); osst_nr_dev++; write_unlock(&os_scsi_tapes_lock); - + { + char name[8]; + /* Rewind entry */ + osst_sysfs_add(MKDEV(OSST_MAJOR, dev_num), dev, tpnt, tape_name(tpnt)); + /* No-rewind entry */ + snprintf(name, 8, "%s%s", "n", tape_name(tpnt)); + osst_sysfs_add(MKDEV(OSST_MAJOR, dev_num + 128), dev, tpnt, name); + } for (mode = 0; mode < ST_NBR_MODES; ++mode) { /* Rewind entry */ devfs_mk_cdev(MKDEV(OSST_MAJOR, dev_num + (mode << 5)), @@ -5572,8 +5804,8 @@ static int osst_remove(struct device *dev) { - Scsi_Device * SDp = to_scsi_device(dev); - OS_Scsi_Tape * tpnt; + Scsi_Device * SDp = to_scsi_device(dev); + struct osst_tape * tpnt; int i, mode; if ((SDp->type != TYPE_TAPE) || (osst_nr_dev <= 0)) @@ -5582,6 +5814,8 @@ write_lock(&os_scsi_tapes_lock); for(i=0; i < osst_max_dev; i++) { if((tpnt = os_scsi_tapes[i]) && (tpnt->device == SDp)) { + osst_sysfs_destroy(MKDEV(OSST_MAJOR, i)); + osst_sysfs_destroy(MKDEV(OSST_MAJOR, i+128)); tpnt->device = NULL; for (mode = 0; mode < ST_NBR_MODES; ++mode) { devfs_remove("%s/ot%s", SDp->devfs_name, osst_formats[mode]); @@ -5610,11 +5844,14 @@ printk(KERN_INFO "osst :I: Tape driver with OnStream support version %s\nosst :I: %s\n", osst_version, cvsid); validate_options(); - + osst_sysfs_init(); + if ((register_chrdev(OSST_MAJOR,"osst", &osst_fops) < 0) || scsi_register_driver(&osst_template.gendrv)) { printk(KERN_ERR "osst :E: Unable to register major %d for OnStream tapes\n", OSST_MAJOR); + osst_sysfs_cleanup(); return 1; } + osst_create_driverfs_files(&osst_template.gendrv); return 0; } @@ -5622,10 +5859,12 @@ static void __exit exit_osst (void) { int i; - OS_Scsi_Tape * STp; + struct osst_tape * STp; + osst_remove_driverfs_files(&osst_template.gendrv); scsi_unregister_driver(&osst_template.gendrv); unregister_chrdev(OSST_MAJOR, "osst"); + osst_sysfs_cleanup(); if (os_scsi_tapes) { for (i=0; i < osst_max_dev; ++i) { diff -Nru a/drivers/scsi/osst.h b/drivers/scsi/osst.h --- a/drivers/scsi/osst.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/osst.h 2005-01-13 16:25:56 -08:00 @@ -1,5 +1,5 @@ /* - * $Header: /cvsroot/osst/Driver/osst.h,v 1.14 2003/12/14 14:34:38 wriede Exp $ + * $Header: /cvsroot/osst/Driver/osst.h,v 1.16 2005/01/01 21:13:35 wriede Exp $ */ #include @@ -70,7 +70,7 @@ #define BLOCK_SIZE_PAGE_LENGTH 4 #define BUFFER_FILLING_PAGE 0x33 -#define BUFFER_FILLING_PAGE_LENGTH +#define BUFFER_FILLING_PAGE_LENGTH 4 #define VENDOR_IDENT_PAGE 0x36 #define VENDOR_IDENT_PAGE_LENGTH 8 @@ -508,7 +508,7 @@ //#define OSST_MAX_SG 2 /* The OnStream tape buffer descriptor. */ -typedef struct { +struct osst_buffer { unsigned char in_use; unsigned char dma; /* DMA-able buffer */ int buffer_size; @@ -525,16 +525,16 @@ unsigned short sg_segs; /* number of segments in s/g list */ unsigned short orig_sg_segs; /* number of segments allocated at first try */ struct scatterlist sg[1]; /* MUST BE last item */ -} OSST_buffer; +} ; /* The OnStream tape drive descriptor */ -typedef struct { +struct osst_tape { struct scsi_driver *driver; unsigned capacity; Scsi_Device* device; struct semaphore lock; /* for serialization */ struct completion wait; /* for SCSI commands */ - OSST_buffer * buffer; + struct osst_buffer * buffer; /* Drive characteristics */ unsigned char omit_blklims; @@ -577,6 +577,7 @@ int min_block; int max_block; int recover_count; /* from tape opening */ + int abort_count; int write_count; int read_count; int recover_erreg; /* from last status call */ @@ -623,7 +624,7 @@ unsigned char last_sense[16]; #endif struct gendisk *drive; -} OS_Scsi_Tape; +} ; /* Values of write_type */ #define OS_WRITE_DATA 0 diff -Nru a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c --- a/drivers/scsi/qla1280.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/qla1280.c 2005-01-13 16:25:56 -08:00 @@ -3400,7 +3400,8 @@ sp->flags |= SRB_SENT; ha->actthreads++; WRT_REG_WORD(®->mailbox4, ha->req_ring_index); - (void) RD_REG_WORD(®->mailbox4); /* PCI posted write flush */ + /* Enforce mmio write ordering; see comment in qla1280_isp_cmd(). */ + mmiowb(); out: if (status) @@ -3668,7 +3669,8 @@ sp->flags |= SRB_SENT; ha->actthreads++; WRT_REG_WORD(®->mailbox4, ha->req_ring_index); - (void) RD_REG_WORD(®->mailbox4); /* PCI posted write flush */ + /* Enforce mmio write ordering; see comment in qla1280_isp_cmd(). */ + mmiowb(); out: if (status) @@ -3778,9 +3780,21 @@ } else ha->request_ring_ptr++; - /* Set chip new ring index. */ + /* + * Update request index to mailbox4 (Request Queue In). + * The mmiowb() ensures that this write is ordered with writes by other + * CPUs. Without the mmiowb(), it is possible for the following: + * CPUA posts write of index 5 to mailbox4 + * CPUA releases host lock + * CPUB acquires host lock + * CPUB posts write of index 6 to mailbox4 + * On PCI bus, order reverses and write of 6 posts, then index 5, + * causing chip to issue full queue of stale commands + * The mmiowb() prevents future writes from crossing the barrier. + * See Documentation/DocBook/deviceiobook.tmpl for more information. + */ WRT_REG_WORD(®->mailbox4, ha->req_ring_index); - (void) RD_REG_WORD(®->mailbox4); /* PCI posted write flush */ + mmiowb(); LEAVE("qla1280_isp_cmd"); } diff -Nru a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c --- a/drivers/scsi/sata_sil.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sata_sil.c 2005-01-13 16:25:56 -08:00 @@ -71,6 +71,8 @@ { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 }, + { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, + { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, { } /* terminate list */ }; diff -Nru a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c --- a/drivers/scsi/scsi.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/scsi.c 2005-01-13 16:25:56 -08:00 @@ -1083,6 +1083,28 @@ EXPORT_SYMBOL(__scsi_iterate_devices); /** + * starget_for_each_device - helper to walk all devices of a target + * @starget: target whose devices we want to iterate over. + * + * This traverses over each devices of @shost. The devices have + * a reference that must be released by scsi_host_put when breaking + * out of the loop. + */ +void starget_for_each_device(struct scsi_target *starget, void * data, + void (*fn)(struct scsi_device *, void *)) +{ + struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); + struct scsi_device *sdev; + + shost_for_each_device(sdev, shost) { + if ((sdev->channel == starget->channel) && + (sdev->id == starget->id)) + fn(sdev, data); + } +} +EXPORT_SYMBOL(starget_for_each_device); + +/** * scsi_device_lookup - find a device given the host (UNLOCKED) * @shost: SCSI host pointer * @channel: SCSI channel (zero if only one channel) diff -Nru a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c --- a/drivers/scsi/scsi_lib.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/scsi_lib.c 2005-01-13 16:25:56 -08:00 @@ -1782,31 +1782,29 @@ } EXPORT_SYMBOL(scsi_device_resume); -static int -device_quiesce_fn(struct device *dev, void *data) +static void +device_quiesce_fn(struct scsi_device *sdev, void *data) { - scsi_device_quiesce(to_scsi_device(dev)); - return 0; + scsi_device_quiesce(sdev); } void scsi_target_quiesce(struct scsi_target *starget) { - device_for_each_child(&starget->dev, NULL, device_quiesce_fn); + starget_for_each_device(starget, NULL, device_quiesce_fn); } EXPORT_SYMBOL(scsi_target_quiesce); -static int -device_resume_fn(struct device *dev, void *data) +static void +device_resume_fn(struct scsi_device *sdev, void *data) { - scsi_device_resume(to_scsi_device(dev)); - return 0; + scsi_device_resume(sdev); } void scsi_target_resume(struct scsi_target *starget) { - device_for_each_child(&starget->dev, NULL, device_resume_fn); + starget_for_each_device(starget, NULL, device_resume_fn); } EXPORT_SYMBOL(scsi_target_resume); diff -Nru a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c --- a/drivers/scsi/scsi_transport_fc.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/scsi_transport_fc.c 2005-01-13 16:25:56 -08:00 @@ -270,6 +270,16 @@ sizeof(fc_host_symbolic_name(shost))); fc_host_supported_speeds(shost) = FC_PORTSPEED_UNKNOWN; fc_host_maxframe_size(shost) = -1; + memset(fc_host_hardware_version(shost), 0, + sizeof(fc_host_hardware_version(shost))); + memset(fc_host_firmware_version(shost), 0, + sizeof(fc_host_firmware_version(shost))); + memset(fc_host_serial_number(shost), 0, + sizeof(fc_host_serial_number(shost))); + memset(fc_host_opt_rom_version(shost), 0, + sizeof(fc_host_opt_rom_version(shost))); + memset(fc_host_driver_version(shost), 0, + sizeof(fc_host_driver_version(shost))); fc_host_port_id(shost) = -1; fc_host_port_type(shost) = FC_PORTTYPE_UNKNOWN; @@ -536,6 +546,11 @@ fc_private_host_rd_attr_cast(port_name, "0x%llx\n", 20, unsigned long long); fc_private_host_rd_attr(symbolic_name, "%s\n", (FC_SYMBOLIC_NAME_SIZE +1)); fc_private_host_rd_attr(maxframe_size, "%u bytes\n", 20); +fc_private_host_rd_attr(hardware_version, "%s\n", (FC_VERSION_STRING_SIZE +1)); +fc_private_host_rd_attr(firmware_version, "%s\n", (FC_VERSION_STRING_SIZE +1)); +fc_private_host_rd_attr(serial_number, "%s\n", (FC_SERIAL_NUMBER_SIZE +1)); +fc_private_host_rd_attr(opt_rom_version, "%s\n", (FC_VERSION_STRING_SIZE +1)); +fc_private_host_rd_attr(driver_version, "%s\n", (FC_VERSION_STRING_SIZE +1)); /* Dynamic Host Attributes */ @@ -772,6 +787,11 @@ SETUP_HOST_ATTRIBUTE_RD(symbolic_name); SETUP_HOST_ATTRIBUTE_RD(supported_speeds); SETUP_HOST_ATTRIBUTE_RD(maxframe_size); + SETUP_HOST_ATTRIBUTE_RD(hardware_version); + SETUP_HOST_ATTRIBUTE_RD(firmware_version); + SETUP_HOST_ATTRIBUTE_RD(serial_number); + SETUP_HOST_ATTRIBUTE_RD(opt_rom_version); + SETUP_HOST_ATTRIBUTE_RD(driver_version); SETUP_HOST_ATTRIBUTE_RD(port_id); SETUP_HOST_ATTRIBUTE_RD(port_type); @@ -808,10 +828,9 @@ * @dev: scsi device * @data: unused **/ -static int fc_device_block(struct device *dev, void *data) +static void fc_device_block(struct scsi_device *sdev, void *data) { - scsi_internal_device_block(to_scsi_device(dev)); - return 0; + scsi_internal_device_block(sdev); } /** @@ -819,10 +838,9 @@ * @dev: scsi device * @data: unused **/ -static int fc_device_unblock(struct device *dev, void *data) +static void fc_device_unblock(struct scsi_device *sdev, void *data) { - scsi_internal_device_unblock(to_scsi_device(dev)); - return 0; + scsi_internal_device_unblock(sdev); } /** @@ -842,7 +860,7 @@ * unblock this device, then IO errors will probably * result if the host still isn't ready. */ - device_for_each_child(&starget->dev, NULL, fc_device_unblock); + starget_for_each_device(starget, NULL, fc_device_unblock); } /** @@ -870,7 +888,7 @@ if (timeout < 0 || timeout > SCSI_DEVICE_BLOCK_MAX_TIMEOUT) return -EINVAL; - device_for_each_child(&starget->dev, NULL, fc_device_block); + starget_for_each_device(starget, NULL, fc_device_block); /* The scsi lld blocks this target for the timeout period only. */ schedule_delayed_work(work, timeout * HZ); @@ -901,7 +919,7 @@ if (cancel_delayed_work(&fc_starget_dev_loss_work(starget))) flush_scheduled_work(); - device_for_each_child(&starget->dev, NULL, fc_device_unblock); + starget_for_each_device(starget, NULL, fc_device_unblock); } EXPORT_SYMBOL(fc_target_unblock); diff -Nru a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c --- a/drivers/scsi/scsi_transport_spi.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/scsi_transport_spi.c 2005-01-13 16:25:56 -08:00 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -378,10 +379,16 @@ #define DV_RETRIES 3 /* should only need at most * two cc/ua clears */ +enum spi_compare_returns { + SPI_COMPARE_SUCCESS, + SPI_COMPARE_FAILURE, + SPI_COMPARE_SKIP_TEST, +}; + /* This is for read/write Domain Validation: If the device supports * an echo buffer, we do read/write tests to it */ -static int +static enum spi_compare_returns spi_dv_device_echo_buffer(struct scsi_request *sreq, u8 *buffer, u8 *ptr, const int retries) { @@ -438,9 +445,23 @@ scsi_wait_req(sreq, spi_write_buffer, buffer, len, DV_TIMEOUT, DV_RETRIES); if(sreq->sr_result || !scsi_device_online(sdev)) { + struct scsi_sense_hdr sshdr; + scsi_device_set_state(sdev, SDEV_QUIESCE); + if (scsi_request_normalize_sense(sreq, &sshdr) + && sshdr.sense_key == ILLEGAL_REQUEST + /* INVALID FIELD IN CDB */ + && sshdr.asc == 0x24 && sshdr.ascq == 0x00) + /* This would mean that the drive lied + * to us about supporting an echo + * buffer (unfortunately some Western + * Digital drives do precisely this) + */ + return SPI_COMPARE_SKIP_TEST; + + SPI_PRINTK(sdev->sdev_target, KERN_ERR, "Write Buffer failure %x\n", sreq->sr_result); - return 0; + return SPI_COMPARE_FAILURE; } memset(ptr, 0, len); @@ -451,14 +472,14 @@ scsi_device_set_state(sdev, SDEV_QUIESCE); if (memcmp(buffer, ptr, len) != 0) - return 0; + return SPI_COMPARE_FAILURE; } - return 1; + return SPI_COMPARE_SUCCESS; } /* This is for the simplest form of Domain Validation: a read test * on the inquiry data from the device */ -static int +static enum spi_compare_returns spi_dv_device_compare_inquiry(struct scsi_request *sreq, u8 *buffer, u8 *ptr, const int retries) { @@ -480,7 +501,7 @@ if(sreq->sr_result || !scsi_device_online(sdev)) { scsi_device_set_state(sdev, SDEV_QUIESCE); - return 0; + return SPI_COMPARE_FAILURE; } /* If we don't have the inquiry data already, the @@ -493,24 +514,28 @@ if (memcmp(buffer, ptr, len) != 0) /* failure */ - return 0; + return SPI_COMPARE_FAILURE; } - return 1; + return SPI_COMPARE_SUCCESS; } -static int +static enum spi_compare_returns spi_dv_retrain(struct scsi_request *sreq, u8 *buffer, u8 *ptr, - int (*compare_fn)(struct scsi_request *, u8 *, u8 *, int)) + enum spi_compare_returns + (*compare_fn)(struct scsi_request *, u8 *, u8 *, int)) { struct spi_internal *i = to_spi_internal(sreq->sr_host->transportt); struct scsi_device *sdev = sreq->sr_device; int period = 0, prevperiod = 0; + enum spi_compare_returns retval; for (;;) { int newperiod; - if (compare_fn(sreq, buffer, ptr, DV_LOOPS)) - /* Successful DV */ + retval = compare_fn(sreq, buffer, ptr, DV_LOOPS); + + if (retval == SPI_COMPARE_SUCCESS + || retval == SPI_COMPARE_SKIP_TEST) break; /* OK, retrain, fallback */ @@ -527,13 +552,13 @@ /* Total failure; set to async and return */ SPI_PRINTK(sdev->sdev_target, KERN_ERR, "Domain Validation Failure, dropping back to Asynchronous\n"); DV_SET(offset, 0); - return 0; + return SPI_COMPARE_FAILURE; } SPI_PRINTK(sdev->sdev_target, KERN_ERR, "Domain Validation detected failure, dropping back\n"); DV_SET(period, period); prevperiod = period; } - return 1; + return retval; } static int @@ -599,7 +624,8 @@ DV_SET(offset, 0); DV_SET(width, 0); - if (!spi_dv_device_compare_inquiry(sreq, buffer, buffer, DV_LOOPS)) { + if (spi_dv_device_compare_inquiry(sreq, buffer, buffer, DV_LOOPS) + != SPI_COMPARE_SUCCESS) { SPI_PRINTK(sdev->sdev_target, KERN_ERR, "Domain Validation Initial Inquiry Failed\n"); /* FIXME: should probably offline the device here? */ return; @@ -609,9 +635,10 @@ if (i->f->set_width && sdev->wdtr) { i->f->set_width(sdev->sdev_target, 1); - if (!spi_dv_device_compare_inquiry(sreq, buffer, + if (spi_dv_device_compare_inquiry(sreq, buffer, buffer + len, - DV_LOOPS)) { + DV_LOOPS) + != SPI_COMPARE_SUCCESS) { SPI_PRINTK(sdev->sdev_target, KERN_ERR, "Wide Transfers Fail\n"); i->f->set_width(sdev->sdev_target, 0); } @@ -624,31 +651,39 @@ if(!sdev->ppr && !sdev->sdtr) return; - /* now set up to the maximum */ - DV_SET(offset, 255); - DV_SET(period, 1); - if (!spi_dv_retrain(sreq, buffer, buffer + len, - spi_dv_device_compare_inquiry)) - return; - - /* OK, now we have our initial speed set by the read only inquiry - * test, now try an echo buffer test (if the device allows it) */ + /* see if the device has an echo buffer. If it does we can + * do the SPI pattern write tests */ len = 0; if (sdev->ppr) len = spi_dv_device_get_echo_buffer(sreq, buffer); + retry: + + /* now set up to the maximum */ + DV_SET(offset, 255); + DV_SET(period, 1); + if (len == 0) { SPI_PRINTK(sdev->sdev_target, KERN_INFO, "Domain Validation skipping write tests\n"); + spi_dv_retrain(sreq, buffer, buffer + len, + spi_dv_device_compare_inquiry); return; } + if (len > SPI_MAX_ECHO_BUFFER_SIZE) { SPI_PRINTK(sdev->sdev_target, KERN_WARNING, "Echo buffer size %d is too big, trimming to %d\n", len, SPI_MAX_ECHO_BUFFER_SIZE); len = SPI_MAX_ECHO_BUFFER_SIZE; } - spi_dv_retrain(sreq, buffer, buffer + len, - spi_dv_device_echo_buffer); + if (spi_dv_retrain(sreq, buffer, buffer + len, + spi_dv_device_echo_buffer) + == SPI_COMPARE_SKIP_TEST) { + /* OK, the stupid drive can't do a write echo buffer + * test after all, fall back to the read tests */ + len = 0; + goto retry; + } } diff -Nru a/drivers/scsi/sd.c b/drivers/scsi/sd.c --- a/drivers/scsi/sd.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sd.c 2005-01-13 16:25:56 -08:00 @@ -1082,9 +1082,12 @@ " READ CAPACITY(16).\n", diskname); longrc = 1; goto repeat; - } else { - printk(KERN_ERR "%s: too big for kernel. Assuming maximum 2Tb\n", diskname); } + printk(KERN_ERR "%s: too big for this kernel. Use a " + "kernel compiled with support for large block " + "devices.\n", diskname); + sdkp->capacity = 0; + goto got_data; } sdkp->capacity = 1 + (((sector_t)buffer[0] << 24) | (buffer[1] << 16) | diff -Nru a/drivers/scsi/sym53c8xx_2/sym_conf.h b/drivers/scsi/sym53c8xx_2/sym_conf.h --- a/drivers/scsi/sym53c8xx_2/sym_conf.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_2/sym_conf.h 2005-01-13 16:25:56 -08:00 @@ -79,14 +79,6 @@ /* #define SYM_CONF_IARB_SUPPORT */ /* - * Number of lists for the optimization of the IO timeout handling. - * Not used under FreeBSD and Linux. - */ -#ifndef SYM_CONF_TIMEOUT_ORDER_MAX -#define SYM_CONF_TIMEOUT_ORDER_MAX (8) -#endif - -/* * Only relevant if IARB support configured. * - Max number of successive settings of IARB hints. * - Set IARB on arbitration lost. diff -Nru a/drivers/scsi/sym53c8xx_2/sym_defs.h b/drivers/scsi/sym53c8xx_2/sym_defs.h --- a/drivers/scsi/sym53c8xx_2/sym_defs.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_2/sym_defs.h 2005-01-13 16:25:56 -08:00 @@ -40,30 +40,10 @@ #ifndef SYM_DEFS_H #define SYM_DEFS_H -#define SYM_VERSION "2.1.18m" +#define SYM_VERSION "2.1.18n" #define SYM_DRIVER_NAME "sym-" SYM_VERSION /* - * PCI device identifier of SYMBIOS chips. - */ -#define PCI_ID_SYM53C810 PCI_DEVICE_ID_NCR_53C810 -#define PCI_ID_SYM53C810AP PCI_DEVICE_ID_LSI_53C810AP -#define PCI_ID_SYM53C815 PCI_DEVICE_ID_NCR_53C815 -#define PCI_ID_SYM53C820 PCI_DEVICE_ID_NCR_53C820 -#define PCI_ID_SYM53C825 PCI_DEVICE_ID_NCR_53C825 -#define PCI_ID_SYM53C860 PCI_DEVICE_ID_NCR_53C860 -#define PCI_ID_SYM53C875 PCI_DEVICE_ID_NCR_53C875 -#define PCI_ID_SYM53C875_2 PCI_DEVICE_ID_NCR_53C875J -#define PCI_ID_SYM53C885 PCI_DEVICE_ID_NCR_53C885 -#define PCI_ID_SYM53C895 PCI_DEVICE_ID_NCR_53C895 -#define PCI_ID_SYM53C896 PCI_DEVICE_ID_NCR_53C896 -#define PCI_ID_SYM53C895A PCI_DEVICE_ID_LSI_53C895A -#define PCI_ID_SYM53C875A PCI_DEVICE_ID_LSI_53C875A -#define PCI_ID_LSI53C1010_33 PCI_DEVICE_ID_LSI_53C1010_33 -#define PCI_ID_LSI53C1010_66 PCI_DEVICE_ID_LSI_53C1010_66 -#define PCI_ID_LSI53C1510D PCI_DEVICE_ID_LSI_53C1510 - -/* * SYM53C8XX device features descriptor. */ struct sym_pci_chip { @@ -764,27 +744,27 @@ #define M_RESTORE_DP RESTORE_POINTERS #define M_DISCONNECT DISCONNECT #define M_ID_ERROR INITIATOR_ERROR -#define M_ABORT ABORT +#define M_ABORT ABORT_TASK_SET #define M_REJECT MESSAGE_REJECT #define M_NOOP NOP #define M_PARITY MSG_PARITY_ERROR #define M_LCOMPLETE LINKED_CMD_COMPLETE #define M_FCOMPLETE LINKED_FLG_CMD_COMPLETE -#define M_RESET BUS_DEVICE_RESET -#define M_ABORT_TAG (0x0d) -#define M_CLEAR_QUEUE (0x0e) +#define M_RESET TARGET_RESET +#define M_ABORT_TAG ABORT_TASK +#define M_CLEAR_QUEUE CLEAR_TASK_SET #define M_INIT_REC INITIATE_RECOVERY #define M_REL_REC RELEASE_RECOVERY #define M_TERMINATE (0x11) #define M_SIMPLE_TAG SIMPLE_QUEUE_TAG #define M_HEAD_TAG HEAD_OF_QUEUE_TAG #define M_ORDERED_TAG ORDERED_QUEUE_TAG -#define M_IGN_RESIDUE (0x23) +#define M_IGN_RESIDUE IGNORE_WIDE_RESIDUE #define M_X_MODIFY_DP EXTENDED_MODIFY_DATA_POINTER #define M_X_SYNC_REQ EXTENDED_SDTR #define M_X_WIDE_REQ EXTENDED_WDTR -#define M_X_PPR_REQ (0x04) +#define M_X_PPR_REQ EXTENDED_PPR /* * PPR protocol options diff -Nru a/drivers/scsi/sym53c8xx_2/sym_fw.c b/drivers/scsi/sym53c8xx_2/sym_fw.c --- a/drivers/scsi/sym53c8xx_2/sym_fw.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_2/sym_fw.c 2005-01-13 16:25:56 -08:00 @@ -223,13 +223,13 @@ * Remove a couple of work-arounds specific to C1010 if * they are not desirable. See `sym_fw2.h' for more details. */ - if (!(np->device_id == PCI_ID_LSI53C1010_66 && + if (!(np->device_id == PCI_DEVICE_ID_LSI_53C1010_66 && np->revision_id < 0x1 && np->pciclk_khz < 60000)) { scripta0->datao_phase[0] = cpu_to_scr(SCR_NO_OP); scripta0->datao_phase[1] = cpu_to_scr(0); } - if (!(np->device_id == PCI_ID_LSI53C1010_33 && + if (!(np->device_id == PCI_DEVICE_ID_LSI_53C1010_33 && /* np->revision_id < 0xff */ 1)) { scripta0->sel_done[0] = cpu_to_scr(SCR_NO_OP); scripta0->sel_done[1] = cpu_to_scr(0); diff -Nru a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c --- a/drivers/scsi/sym53c8xx_2/sym_glue.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c 2005-01-13 16:25:56 -08:00 @@ -55,6 +55,15 @@ #define NAME53C "sym53c" #define NAME53C8XX "sym53c8xx" +/* SPARC just has to be different ... */ +#ifdef __sparc__ +#define IRQ_FMT "%s" +#define IRQ_PRM(x) __irq_itoa(x) +#else +#define IRQ_FMT "%d" +#define IRQ_PRM(x) (x) +#endif + struct sym_driver_setup sym_driver_setup = SYM_LINUX_DRIVER_SETUP; unsigned int sym_debug_flags = 0; @@ -147,7 +156,7 @@ } /* This lock protects only the memory allocation/free. */ -spinlock_t sym53c8xx_lock = SPIN_LOCK_UNLOCKED; +static spinlock_t sym53c8xx_lock = SPIN_LOCK_UNLOCKED; static struct scsi_transport_template *sym2_transport_template = NULL; @@ -285,7 +294,7 @@ ccb->scsi_done(ccb); } -void sym_xpt_done2(struct sym_hcb *np, struct scsi_cmnd *ccb, int cam_status) +static void sym_xpt_done2(struct sym_hcb *np, struct scsi_cmnd *ccb, int cam_status) { sym_set_cam_status(ccb, cam_status); sym_xpt_done(np, ccb); @@ -379,7 +388,7 @@ /* * Bounce back the sense data to user. */ - bzero(&csio->sense_buffer, sizeof(csio->sense_buffer)); + memset(&csio->sense_buffer, 0, sizeof(csio->sense_buffer)); memcpy(csio->sense_buffer, cp->sns_bbuf, min(sizeof(csio->sense_buffer), (size_t)SYM_SNS_BBUF_LEN)); @@ -513,7 +522,7 @@ } /* - * Retreive the target descriptor. + * Retrieve the target descriptor. */ tp = &np->target[ccb->device->id]; @@ -1277,7 +1286,7 @@ int arg_len; u_long target; - bzero(uc, sizeof(*uc)); + memset(uc, 0, sizeof(*uc)); if (len > 0 && ptr[len-1] == '\n') --len; @@ -1467,18 +1476,8 @@ copy_info(&info, "Chip " NAME53C "%s, device id 0x%x, " "revision id 0x%x\n", np->s.chip_name, np->device_id, np->revision_id); - copy_info(&info, "At PCI address %s, " -#ifdef __sparc__ - "IRQ %s\n", -#else - "IRQ %d\n", -#endif - pci_name(np->s.device), -#ifdef __sparc__ - __irq_itoa(np->s.irq)); -#else - (int) np->s.irq); -#endif + copy_info(&info, "At PCI address %s, IRQ " IRQ_FMT "\n", + pci_name(np->s.device), IRQ_PRM(np->s.irq)); copy_info(&info, "Min. period factor %d, %s SCSI BUS%s\n", (int) (np->minsync_dt ? np->minsync_dt : np->minsync), np->maxwide ? "Wide" : "Narrow", @@ -1558,32 +1557,23 @@ */ static int sym_setup_bus_dma_mask(struct sym_hcb *np) { -#if SYM_CONF_DMA_ADDRESSING_MODE == 0 - if (pci_set_dma_mask(np->s.device, 0xffffffffUL)) - goto out_err32; -#else +#if SYM_CONF_DMA_ADDRESSING_MODE > 0 #if SYM_CONF_DMA_ADDRESSING_MODE == 1 -#define PciDmaMask 0xffffffffffULL +#define DMA_DAC_MASK 0x000000ffffffffffULL /* 40-bit */ #elif SYM_CONF_DMA_ADDRESSING_MODE == 2 -#define PciDmaMask 0xffffffffffffffffULL +#define DMA_DAC_MASK DMA_64BIT_MASK #endif - if (np->features & FE_DAC) { - if (!pci_set_dma_mask(np->s.device, PciDmaMask)) { - np->use_dac = 1; - printf_info("%s: using 64 bit DMA addressing\n", - sym_name(np)); - } else { - if (pci_set_dma_mask(np->s.device, 0xffffffffUL)) - goto out_err32; - } + if ((np->features & FE_DAC) && + !pci_set_dma_mask(np->s.device, DMA_DAC_MASK)) { + np->use_dac = 1; + return 0; } -#undef PciDmaMask #endif - return 0; -out_err32: - printf_warning("%s: 32 BIT DMA ADDRESSING NOT SUPPORTED\n", - sym_name(np)); + if (!pci_set_dma_mask(np->s.device, DMA_32BIT_MASK)) + return 0; + + printf_warning("%s: No suitable DMA available\n", sym_name(np)); return -1; } @@ -1606,19 +1596,9 @@ struct sym_fw *fw; printk(KERN_INFO - "sym%d: <%s> rev 0x%x at pci %s " -#ifdef __sparc__ - "irq %s\n", -#else - "irq %d\n", -#endif + "sym%d: <%s> rev 0x%x at pci %s irq " IRQ_FMT "\n", unit, dev->chip.name, dev->chip.revision_id, - pci_name(dev->pdev), -#ifdef __sparc__ - __irq_itoa(dev->s.irq)); -#else - dev->s.irq); -#endif + pci_name(dev->pdev), IRQ_PRM(dev->s.irq)); /* * Get the firmware for this chip. @@ -1672,9 +1652,6 @@ strlcpy(np->s.chip_name, dev->chip.name, sizeof(np->s.chip_name)); sprintf(np->s.inst_name, "sym%d", np->s.unit); - /* - * Ask/tell the system about DMA addressing. - */ if (sym_setup_bus_dma_mask(np)) goto attach_failed; @@ -2010,7 +1987,7 @@ * the preset SCSI ID (which may be zero) must be read in from * a special configuration space register of the 875. */ -void sym_config_pqs(struct pci_dev *pdev, struct sym_device *sym_dev) +static void sym_config_pqs(struct pci_dev *pdev, struct sym_device *sym_dev) { int slot; u8 tmp; diff -Nru a/drivers/scsi/sym53c8xx_2/sym_glue.h b/drivers/scsi/sym53c8xx_2/sym_glue.h --- a/drivers/scsi/sym53c8xx_2/sym_glue.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_2/sym_glue.h 2005-01-13 16:25:56 -08:00 @@ -58,13 +58,6 @@ #include #include -#ifndef bzero -#define bzero(d, n) memset((d), 0, (n)) -#endif - -/* - * General driver includes. - */ #include "sym_conf.h" #include "sym_defs.h" #include "sym_misc.h" @@ -123,14 +116,6 @@ typedef struct sym_tcb *tcb_p; typedef struct sym_lcb *lcb_p; typedef struct sym_ccb *ccb_p; -typedef struct sym_hcb *hcb_p; - -/* - * Define a reference to the O/S dependent IO request. - */ -typedef struct scsi_cmnd *cam_ccb_p; /* Generic */ -typedef struct scsi_cmnd *cam_scsiio_p;/* SCSI I/O */ - /* * IO functions definition for big/little endian CPU support. @@ -525,7 +510,7 @@ /* * Async handler for negotiations. */ -void sym_xpt_async_nego_wide(hcb_p np, int target); +void sym_xpt_async_nego_wide(struct sym_hcb *np, int target); #define sym_xpt_async_nego_sync(np, target) \ sym_announce_transfer_rate(np, target) #define sym_xpt_async_nego_ppr(np, target) \ @@ -534,14 +519,14 @@ /* * Build CAM result for a successful IO and for a failed IO. */ -static __inline void sym_set_cam_result_ok(hcb_p np, ccb_p cp, int resid) +static __inline void sym_set_cam_result_ok(struct sym_hcb *np, ccb_p cp, int resid) { struct scsi_cmnd *cmd = cp->cam_ccb; cmd->resid = resid; cmd->result = (((DID_OK) << 16) + ((cp->ssss_status) & 0x7f)); } -void sym_set_cam_result_error(hcb_p np, ccb_p cp, int resid); +void sym_set_cam_result_error(struct sym_hcb *np, ccb_p cp, int resid); /* * Other O/S specific methods. @@ -549,13 +534,12 @@ #define sym_cam_target_id(ccb) (ccb)->target #define sym_cam_target_lun(ccb) (ccb)->lun #define sym_freeze_cam_ccb(ccb) do { ; } while (0) -void sym_xpt_done(hcb_p np, cam_ccb_p ccb); -void sym_xpt_done2(hcb_p np, cam_ccb_p ccb, int cam_status); +void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *ccb); void sym_print_addr (ccb_p cp); -void sym_xpt_async_bus_reset(hcb_p np); -void sym_xpt_async_sent_bdr(hcb_p np, int target); -int sym_setup_data_and_start (hcb_p np, cam_scsiio_p csio, ccb_p cp); -void sym_log_bus_error(hcb_p np); -void sym_sniff_inquiry(hcb_p np, struct scsi_cmnd *cmd, int resid); +void sym_xpt_async_bus_reset(struct sym_hcb *np); +void sym_xpt_async_sent_bdr(struct sym_hcb *np, int target); +int sym_setup_data_and_start (struct sym_hcb *np, struct scsi_cmnd *csio, ccb_p cp); +void sym_log_bus_error(struct sym_hcb *np); +void sym_sniff_inquiry(struct sym_hcb *np, struct scsi_cmnd *cmd, int resid); #endif /* SYM_GLUE_H */ diff -Nru a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c 2005-01-13 16:25:56 -08:00 @@ -47,14 +47,14 @@ /* * Needed function prototypes. */ -static void sym_int_ma (hcb_p np); -static void sym_int_sir (hcb_p np); -static ccb_p sym_alloc_ccb(hcb_p np); -static ccb_p sym_ccb_from_dsa(hcb_p np, u32 dsa); -static void sym_alloc_lcb_tags (hcb_p np, u_char tn, u_char ln); -static void sym_complete_error (hcb_p np, ccb_p cp); -static void sym_complete_ok (hcb_p np, ccb_p cp); -static int sym_compute_residual(hcb_p np, ccb_p cp); +static void sym_int_ma (struct sym_hcb *np); +static void sym_int_sir (struct sym_hcb *np); +static ccb_p sym_alloc_ccb(struct sym_hcb *np); +static ccb_p sym_ccb_from_dsa(struct sym_hcb *np, u32 dsa); +static void sym_alloc_lcb_tags (struct sym_hcb *np, u_char tn, u_char ln); +static void sym_complete_error (struct sym_hcb *np, ccb_p cp); +static void sym_complete_ok (struct sym_hcb *np, ccb_p cp); +static int sym_compute_residual(struct sym_hcb *np, ccb_p cp); /* * Returns the name of this driver. @@ -86,12 +86,12 @@ * Print something which allows to retrieve the controler type, * unit, target, lun concerned by a kernel message. */ -static void sym_print_target (hcb_p np, int target) +static void sym_print_target (struct sym_hcb *np, int target) { printf ("%s:%d:", sym_name(np), target); } -static void sym_print_lun(hcb_p np, int target, int lun) +static void sym_print_lun(struct sym_hcb *np, int target, int lun) { printf ("%s:%d:%d:", sym_name(np), target, lun); } @@ -126,7 +126,7 @@ printf (".\n"); } -static void sym_print_nego_msg (hcb_p np, int target, char *label, u_char *msg) +static void sym_print_nego_msg (struct sym_hcb *np, int target, char *label, u_char *msg) { PRINT_TARGET(np, target); if (label) @@ -184,7 +184,7 @@ * On the other hand, LVD devices need some delay * to settle and report actual BUS mode in STEST4. */ -static void sym_chip_reset (hcb_p np) +static void sym_chip_reset (struct sym_hcb *np) { OUTB (nc_istat, SRST); UDELAY (10); @@ -201,7 +201,7 @@ * So, we need to abort the current operation prior to * soft resetting the chip. */ -static void sym_soft_reset (hcb_p np) +static void sym_soft_reset (struct sym_hcb *np) { u_char istat = 0; int i; @@ -234,12 +234,12 @@ * * The interrupt handler will reinitialize the chip. */ -static void sym_start_reset(hcb_p np) +static void sym_start_reset(struct sym_hcb *np) { (void) sym_reset_scsi_bus(np, 1); } -int sym_reset_scsi_bus(hcb_p np, int enab_int) +int sym_reset_scsi_bus(struct sym_hcb *np, int enab_int) { u32 term; int retv = 0; @@ -293,7 +293,7 @@ /* * Select SCSI clock frequency */ -static void sym_selectclock(hcb_p np, u_char scntl3) +static void sym_selectclock(struct sym_hcb *np, u_char scntl3) { /* * If multiplier not present or not selected, leave here. @@ -348,7 +348,7 @@ /* * calculate SCSI clock frequency (in KHz) */ -static unsigned getfreq (hcb_p np, int gen) +static unsigned getfreq (struct sym_hcb *np, int gen) { unsigned int ms = 0; unsigned int f; @@ -420,7 +420,7 @@ return f; } -static unsigned sym_getfreq (hcb_p np) +static unsigned sym_getfreq (struct sym_hcb *np) { u_int f1, f2; int gen = 8; @@ -435,7 +435,7 @@ /* * Get/probe chip SCSI clock frequency */ -static void sym_getclock (hcb_p np, int mult) +static void sym_getclock (struct sym_hcb *np, int mult) { unsigned char scntl3 = np->sv_scntl3; unsigned char stest1 = np->sv_stest1; @@ -492,7 +492,7 @@ /* * Get/probe PCI clock frequency */ -static int sym_getpciclock (hcb_p np) +static int sym_getpciclock (struct sym_hcb *np) { int f = 0; @@ -528,7 +528,7 @@ * synchronous factor period. */ static int -sym_getsync(hcb_p np, u_char dt, u_char sfac, u_char *divp, u_char *fakp) +sym_getsync(struct sym_hcb *np, u_char dt, u_char sfac, u_char *divp, u_char *fakp) { u32 clk = np->clock_khz; /* SCSI clock frequency in kHz */ int div = np->clock_divn; /* Number of divisors supported */ @@ -648,7 +648,7 @@ /* * Set initial io register bits from burst code. */ -static __inline void sym_init_burst(hcb_p np, u_char bc) +static __inline void sym_init_burst(struct sym_hcb *np, u_char bc) { np->rv_ctest4 &= ~0x80; np->rv_dmode &= ~(0x3 << 6); @@ -668,7 +668,7 @@ /* * Print out the list of targets that have some flag disabled by user. */ -static void sym_print_targets_flag(hcb_p np, int mask, char *msg) +static void sym_print_targets_flag(struct sym_hcb *np, int mask, char *msg) { int cnt; int i; @@ -696,7 +696,7 @@ * is not safe on paper, but it seems to work quite * well. :) */ -static void sym_save_initial_setting (hcb_p np) +static void sym_save_initial_setting (struct sym_hcb *np) { np->sv_scntl0 = INB(nc_scntl0) & 0x0a; np->sv_scntl3 = INB(nc_scntl3) & 0x07; @@ -716,44 +716,11 @@ np->sv_ctest5 = INB(nc_ctest5) & 0x24; } -#ifdef CONFIG_PARISC -static u32 parisc_setup_hcb(hcb_p np, u32 period) -{ - unsigned long pdc_period; - char scsi_mode; - struct hardware_path hwpath; - - /* Host firmware (PDC) keeps a table for crippling SCSI capabilities. - * Many newer machines export one channel of 53c896 chip - * as SE, 50-pin HD. Also used for Multi-initiator SCSI clusters - * to set the SCSI Initiator ID. - */ - get_pci_node_path(np->s.device, &hwpath); - if (!pdc_get_initiator(&hwpath, &np->myaddr, &pdc_period, - &np->maxwide, &scsi_mode)) - return period; - - if (scsi_mode >= 0) { - /* C3000 PDC reports period/mode */ - SYM_SETUP_SCSI_DIFF = 0; - switch(scsi_mode) { - case 0: np->scsi_mode = SMODE_SE; break; - case 1: np->scsi_mode = SMODE_HVD; break; - case 2: np->scsi_mode = SMODE_LVD; break; - default: break; - } - } - - return (u32) pdc_period; -} -#else -static inline int parisc_setup_hcb(hcb_p np, u32 period) { return period; } -#endif /* * Prepare io register values used by sym_start_up() * according to selected and supported features. */ -static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram) +static int sym_prepare_setting(struct sym_hcb *np, struct sym_nvram *nvram) { u_char burst_max; u32 period; @@ -816,8 +783,6 @@ */ period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz; - period = parisc_setup_hcb(np, period); - if (period <= 250) np->minsync = 10; else if (period <= 303) np->minsync = 11; else if (period <= 500) np->minsync = 12; @@ -880,7 +845,7 @@ * In dual channel mode, contention occurs if internal cycles * are used. Disable internal cycles. */ - if (np->device_id == PCI_ID_LSI53C1010_33 && + if (np->device_id == PCI_DEVICE_ID_LSI_53C1010_33 && np->revision_id < 0x1) np->rv_ccntl0 |= DILS; @@ -904,9 +869,9 @@ * this driver. The generic ncr driver that does not use * LOAD/STORE instructions does not need this work-around. */ - if ((np->device_id == PCI_ID_SYM53C810 && + if ((np->device_id == PCI_DEVICE_ID_NCR_53C810 && np->revision_id >= 0x10 && np->revision_id <= 0x11) || - (np->device_id == PCI_ID_SYM53C860 && + (np->device_id == PCI_DEVICE_ID_NCR_53C860 && np->revision_id <= 0x1)) np->features &= ~(FE_WRIE|FE_ERL|FE_ERMP); @@ -1000,7 +965,7 @@ if ((SYM_SETUP_SCSI_LED || (nvram->type == SYM_SYMBIOS_NVRAM || (nvram->type == SYM_TEKRAM_NVRAM && - np->device_id == PCI_ID_SYM53C895))) && + np->device_id == PCI_DEVICE_ID_NCR_53C895))) && !(np->features & FE_LEDC) && !(np->sv_gpcntl & 0x01)) np->features |= FE_LED0; @@ -1091,7 +1056,7 @@ * Has to be called with interrupts disabled. */ #ifndef SYM_CONF_IOMAPPED -static int sym_regtest (hcb_p np) +static int sym_regtest (struct sym_hcb *np) { register volatile u32 data; /* @@ -1115,7 +1080,7 @@ } #endif -static int sym_snooptest (hcb_p np) +static int sym_snooptest (struct sym_hcb *np) { u32 sym_rd, sym_wr, sym_bk, host_rd, host_wr, pc, dstat; int i, err=0; @@ -1241,7 +1206,7 @@ * First 24 register of the chip: * r0..rf */ -static void sym_log_hard_error(hcb_p np, u_short sist, u_char dstat) +static void sym_log_hard_error(struct sym_hcb *np, u_short sist, u_char dstat) { u32 dsp; int script_ofs; @@ -1299,85 +1264,85 @@ } static struct sym_pci_chip sym_pci_dev_table[] = { - {PCI_ID_SYM53C810, 0x0f, "810", 4, 8, 4, 64, + {PCI_DEVICE_ID_NCR_53C810, 0x0f, "810", 4, 8, 4, 64, FE_ERL} , #ifdef SYM_DEBUG_GENERIC_SUPPORT - {PCI_ID_SYM53C810, 0xff, "810a", 4, 8, 4, 1, + {PCI_DEVICE_ID_NCR_53C810, 0xff, "810a", 4, 8, 4, 1, FE_BOF} , #else - {PCI_ID_SYM53C810, 0xff, "810a", 4, 8, 4, 1, + {PCI_DEVICE_ID_NCR_53C810, 0xff, "810a", 4, 8, 4, 1, FE_CACHE_SET|FE_LDSTR|FE_PFEN|FE_BOF} , #endif - {PCI_ID_SYM53C815, 0xff, "815", 4, 8, 4, 64, + {PCI_DEVICE_ID_NCR_53C815, 0xff, "815", 4, 8, 4, 64, FE_BOF|FE_ERL} , - {PCI_ID_SYM53C825, 0x0f, "825", 6, 8, 4, 64, + {PCI_DEVICE_ID_NCR_53C825, 0x0f, "825", 6, 8, 4, 64, FE_WIDE|FE_BOF|FE_ERL|FE_DIFF} , - {PCI_ID_SYM53C825, 0xff, "825a", 6, 8, 4, 2, + {PCI_DEVICE_ID_NCR_53C825, 0xff, "825a", 6, 8, 4, 2, FE_WIDE|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM|FE_DIFF} , - {PCI_ID_SYM53C860, 0xff, "860", 4, 8, 5, 1, + {PCI_DEVICE_ID_NCR_53C860, 0xff, "860", 4, 8, 5, 1, FE_ULTRA|FE_CACHE_SET|FE_BOF|FE_LDSTR|FE_PFEN} , - {PCI_ID_SYM53C875, 0x01, "875", 6, 16, 5, 2, + {PCI_DEVICE_ID_NCR_53C875, 0x01, "875", 6, 16, 5, 2, FE_WIDE|FE_ULTRA|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| FE_RAM|FE_DIFF|FE_VARCLK} , - {PCI_ID_SYM53C875, 0xff, "875", 6, 16, 5, 2, + {PCI_DEVICE_ID_NCR_53C875, 0xff, "875", 6, 16, 5, 2, FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| FE_RAM|FE_DIFF|FE_VARCLK} , - {PCI_ID_SYM53C875_2, 0xff, "875", 6, 16, 5, 2, + {PCI_DEVICE_ID_NCR_53C875J, 0xff, "875J", 6, 16, 5, 2, FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| FE_RAM|FE_DIFF|FE_VARCLK} , - {PCI_ID_SYM53C885, 0xff, "885", 6, 16, 5, 2, + {PCI_DEVICE_ID_NCR_53C885, 0xff, "885", 6, 16, 5, 2, FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| FE_RAM|FE_DIFF|FE_VARCLK} , #ifdef SYM_DEBUG_GENERIC_SUPPORT - {PCI_ID_SYM53C895, 0xff, "895", 6, 31, 7, 2, + {PCI_DEVICE_ID_NCR_53C895, 0xff, "895", 6, 31, 7, 2, FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS| FE_RAM|FE_LCKFRQ} , #else - {PCI_ID_SYM53C895, 0xff, "895", 6, 31, 7, 2, + {PCI_DEVICE_ID_NCR_53C895, 0xff, "895", 6, 31, 7, 2, FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| FE_RAM|FE_LCKFRQ} , #endif - {PCI_ID_SYM53C896, 0xff, "896", 6, 31, 7, 4, + {PCI_DEVICE_ID_NCR_53C896, 0xff, "896", 6, 31, 7, 4, FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_LCKFRQ} , - {PCI_ID_SYM53C895A, 0xff, "895a", 6, 31, 7, 4, + {PCI_DEVICE_ID_LSI_53C895A, 0xff, "895a", 6, 31, 7, 4, FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| FE_RAM|FE_RAM8K|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_LCKFRQ} , - {PCI_ID_SYM53C875A, 0xff, "875a", 6, 31, 7, 4, + {PCI_DEVICE_ID_LSI_53C875A, 0xff, "875a", 6, 31, 7, 4, FE_WIDE|FE_ULTRA|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| FE_RAM|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_LCKFRQ} , - {PCI_ID_LSI53C1010_33, 0x00, "1010-33", 6, 31, 7, 8, + {PCI_DEVICE_ID_LSI_53C1010_33, 0x00, "1010-33", 6, 31, 7, 8, FE_WIDE|FE_ULTRA3|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFBC|FE_LDSTR|FE_PFEN| FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_CRC| FE_C10} , - {PCI_ID_LSI53C1010_33, 0xff, "1010-33", 6, 31, 7, 8, + {PCI_DEVICE_ID_LSI_53C1010_33, 0xff, "1010-33", 6, 31, 7, 8, FE_WIDE|FE_ULTRA3|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFBC|FE_LDSTR|FE_PFEN| FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_CRC| FE_C10|FE_U3EN} , - {PCI_ID_LSI53C1010_66, 0xff, "1010-66", 6, 31, 7, 8, + {PCI_DEVICE_ID_LSI_53C1010_66, 0xff, "1010-66", 6, 31, 7, 8, FE_WIDE|FE_ULTRA3|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFBC|FE_LDSTR|FE_PFEN| FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_66MHZ|FE_CRC| FE_C10|FE_U3EN} , - {PCI_ID_LSI53C1510D, 0xff, "1510d", 6, 31, 7, 4, + {PCI_DEVICE_ID_LSI_53C1510, 0xff, "1510d", 6, 31, 7, 4, FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| FE_RAM|FE_IO256|FE_LEDC} }; @@ -1415,7 +1380,7 @@ * This is only used if the direct mapping * has been unsuccessful. */ -int sym_lookup_dmap(hcb_p np, u32 h, int s) +int sym_lookup_dmap(struct sym_hcb *np, u32 h, int s) { int i; @@ -1448,7 +1413,7 @@ * Update IO registers scratch C..R so they will be * in sync. with queued CCB expectations. */ -static void sym_update_dmap_regs(hcb_p np) +static void sym_update_dmap_regs(struct sym_hcb *np) { int o, i; @@ -1463,13 +1428,12 @@ } #endif +/* Enforce all the fiddly SPI rules and the chip limitations */ static void sym_check_goals(struct scsi_device *sdev) { struct sym_hcb *np = ((struct host_data *)sdev->host->hostdata)->ncb; struct sym_trans *st = &np->target[sdev->id].tinfo.goal; - /* here we enforce all the fiddly SPI rules */ - if (!scsi_device_wide(sdev)) st->width = 0; @@ -1479,7 +1443,7 @@ st->offset = 0; return; } - + if (scsi_device_dt(sdev)) { if (scsi_device_dt_only(sdev)) st->options |= PPR_OPT_DT; @@ -1490,7 +1454,8 @@ st->options &= ~PPR_OPT_DT; } - if (!(np->features & FE_ULTRA3)) + /* Some targets fail to properly negotiate DT in SE mode */ + if ((np->scsi_mode != SMODE_LVD) || !(np->features & FE_U3EN)) st->options &= ~PPR_OPT_DT; if (st->options & PPR_OPT_DT) { @@ -1520,38 +1485,31 @@ * negotiation and the nego_status field of the CCB. * Returns the size of the message in bytes. */ -static int sym_prepare_nego(hcb_p np, ccb_p cp, int nego, u_char *msgptr) +static int sym_prepare_nego(struct sym_hcb *np, ccb_p cp, u_char *msgptr) { tcb_p tp = &np->target[cp->target]; - int msglen = 0; struct scsi_device *sdev = tp->sdev; + struct sym_trans *goal = &tp->tinfo.goal; + struct sym_trans *curr = &tp->tinfo.curr; + int msglen = 0; + int nego; if (likely(sdev)) sym_check_goals(sdev); /* - * Early C1010 chips need a work-around for DT - * data transfer to work. + * Many devices implement PPR in a buggy way, so only use it if we + * really want to. */ - if (!(np->features & FE_U3EN)) - tp->tinfo.goal.options = 0; - /* - * negotiate using PPR ? - */ - if (scsi_device_dt(sdev)) { + if ((goal->options & PPR_OPT_MASK) || (goal->period < 0xa)) { nego = NS_PPR; + } else if (curr->width != goal->width) { + nego = NS_WIDE; + } else if (curr->period != goal->period || + curr->offset != goal->offset) { + nego = NS_SYNC; } else { - /* - * negotiate wide transfers ? - */ - if (tp->tinfo.curr.width != tp->tinfo.goal.width) - nego = NS_WIDE; - /* - * negotiate synchronous transfers? - */ - else if (tp->tinfo.curr.period != tp->tinfo.goal.period || - tp->tinfo.curr.offset != tp->tinfo.goal.offset) - nego = NS_SYNC; + nego = 0; } switch (nego) { @@ -1559,24 +1517,24 @@ msgptr[msglen++] = M_EXTENDED; msgptr[msglen++] = 3; msgptr[msglen++] = M_X_SYNC_REQ; - msgptr[msglen++] = tp->tinfo.goal.period; - msgptr[msglen++] = tp->tinfo.goal.offset; + msgptr[msglen++] = goal->period; + msgptr[msglen++] = goal->offset; break; case NS_WIDE: msgptr[msglen++] = M_EXTENDED; msgptr[msglen++] = 2; msgptr[msglen++] = M_X_WIDE_REQ; - msgptr[msglen++] = tp->tinfo.goal.width; + msgptr[msglen++] = goal->width; break; case NS_PPR: msgptr[msglen++] = M_EXTENDED; msgptr[msglen++] = 6; msgptr[msglen++] = M_X_PPR_REQ; - msgptr[msglen++] = tp->tinfo.goal.period; + msgptr[msglen++] = goal->period; msgptr[msglen++] = 0; - msgptr[msglen++] = tp->tinfo.goal.offset; - msgptr[msglen++] = tp->tinfo.goal.width; - msgptr[msglen++] = tp->tinfo.goal.options & PPR_OPT_MASK; + msgptr[msglen++] = goal->offset; + msgptr[msglen++] = goal->width; + msgptr[msglen++] = goal->options & PPR_OPT_MASK; break; }; @@ -1598,7 +1556,7 @@ /* * Insert a job into the start queue. */ -void sym_put_start_queue(hcb_p np, ccb_p cp) +void sym_put_start_queue(struct sym_hcb *np, ccb_p cp) { u_short qidx; @@ -1630,13 +1588,6 @@ #endif /* - * Optionnaly, set the IO timeout condition. - */ -#ifdef SYM_OPT_HANDLE_IO_TIMEOUT - sym_timeout_ccb(np, cp, sym_cam_timeout(cp->cam_ccb)); -#endif - - /* * Insert first the idle task and then our job. * The MBs should ensure proper ordering. */ @@ -1664,7 +1615,7 @@ /* * Start next ready-to-start CCBs. */ -void sym_start_next_ccbs(hcb_p np, lcb_p lp, int maxn) +void sym_start_next_ccbs(struct sym_hcb *np, lcb_p lp, int maxn) { SYM_QUEHEAD *qp; ccb_p cp; @@ -1718,7 +1669,7 @@ * prevent out of order LOADs by the CPU from having * prefetched stale data prior to DMA having occurred. */ -static int sym_wakeup_done (hcb_p np) +static int sym_wakeup_done (struct sym_hcb *np) { ccb_p cp; int i, n; @@ -1752,10 +1703,64 @@ } /* + * Complete all CCBs queued to the COMP queue. + * + * These CCBs are assumed: + * - Not to be referenced either by devices or + * SCRIPTS-related queues and datas. + * - To have to be completed with an error condition + * or requeued. + * + * The device queue freeze count is incremented + * for each CCB that does not prevent this. + * This function is called when all CCBs involved + * in error handling/recovery have been reaped. + */ +static void sym_flush_comp_queue(struct sym_hcb *np, int cam_status) +{ + SYM_QUEHEAD *qp; + ccb_p cp; + + while ((qp = sym_remque_head(&np->comp_ccbq)) != 0) { + struct scsi_cmnd *ccb; + cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); + sym_insque_tail(&cp->link_ccbq, &np->busy_ccbq); + /* Leave quiet CCBs waiting for resources */ + if (cp->host_status == HS_WAIT) + continue; + ccb = cp->cam_ccb; + if (cam_status) + sym_set_cam_status(ccb, cam_status); +#ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING + if (sym_get_cam_status(ccb) == CAM_REQUEUE_REQ) { + tcb_p tp = &np->target[cp->target]; + lcb_p lp = sym_lp(np, tp, cp->lun); + if (lp) { + sym_remque(&cp->link2_ccbq); + sym_insque_tail(&cp->link2_ccbq, + &lp->waiting_ccbq); + if (cp->started) { + if (cp->tag != NO_TAG) + --lp->started_tags; + else + --lp->started_no_tag; + } + } + cp->started = 0; + continue; + } +#endif + sym_free_ccb(np, cp); + sym_freeze_cam_ccb(ccb); + sym_xpt_done(np, ccb); + } +} + +/* * Complete all active CCBs with error. * Used on CHIP/SCSI RESET. */ -static void sym_flush_busy_queue (hcb_p np, int cam_status) +static void sym_flush_busy_queue (struct sym_hcb *np, int cam_status) { /* * Move all active CCBs to the COMP queue @@ -1774,7 +1779,7 @@ * 1: SCSI BUS RESET delivered or received. * 2: SCSI BUS MODE changed. */ -void sym_start_up (hcb_p np, int reason) +void sym_start_up (struct sym_hcb *np, int reason) { int i; u32 phys; @@ -1865,7 +1870,7 @@ /* * For now, disable AIP generation on C1010-66. */ - if (np->device_id == PCI_ID_LSI53C1010_66) + if (np->device_id == PCI_DEVICE_ID_LSI_53C1010_66) OUTB (nc_aipcntl1, DISAIP); /* @@ -1875,7 +1880,7 @@ * that from SCRIPTS for each selection/reselection, but * I just don't want. :) */ - if (np->device_id == PCI_ID_LSI53C1010_33 && + if (np->device_id == PCI_DEVICE_ID_LSI_53C1010_33 && np->revision_id < 1) OUTB (nc_stest1, INB(nc_stest1) | 0x30); @@ -1884,9 +1889,9 @@ * Disable overlapped arbitration for some dual function devices, * regardless revision id (kind of post-chip-design feature. ;-)) */ - if (np->device_id == PCI_ID_SYM53C875) + if (np->device_id == PCI_DEVICE_ID_NCR_53C875) OUTB (nc_ctest0, (1<<5)); - else if (np->device_id == PCI_ID_SYM53C896) + else if (np->device_id == PCI_DEVICE_ID_NCR_53C896) np->rv_ccntl0 |= DPR; /* @@ -2010,7 +2015,7 @@ /* * Switch trans mode for current job and it's target. */ -static void sym_settrans(hcb_p np, int target, u_char opts, u_char ofs, +static void sym_settrans(struct sym_hcb *np, int target, u_char opts, u_char ofs, u_char per, u_char wide, u_char div, u_char fak) { SYM_QUEHEAD *qp; @@ -2119,7 +2124,7 @@ * We received a WDTR. * Let everything be aware of the changes. */ -static void sym_setwide(hcb_p np, int target, u_char wide) +static void sym_setwide(struct sym_hcb *np, int target, u_char wide) { tcb_p tp = &np->target[target]; @@ -2138,7 +2143,7 @@ * Let everything be aware of the changes. */ static void -sym_setsync(hcb_p np, int target, +sym_setsync(struct sym_hcb *np, int target, u_char ofs, u_char per, u_char div, u_char fak) { tcb_p tp = &np->target[target]; @@ -2164,7 +2169,7 @@ * Let everything be aware of the changes. */ static void -sym_setpprot(hcb_p np, int target, u_char opts, u_char ofs, +sym_setpprot(struct sym_hcb *np, int target, u_char opts, u_char ofs, u_char per, u_char wide, u_char div, u_char fak) { tcb_p tp = &np->target[target]; @@ -2205,7 +2210,7 @@ * pushes a DSA into a queue, we can trust it when it * points to a CCB. */ -static void sym_recover_scsi_int (hcb_p np, u_char hsts) +static void sym_recover_scsi_int (struct sym_hcb *np, u_char hsts) { u32 dsp = INL (nc_dsp); u32 dsa = INL (nc_dsa); @@ -2256,7 +2261,7 @@ /* * chip exception handler for selection timeout */ -static void sym_int_sto (hcb_p np) +static void sym_int_sto (struct sym_hcb *np) { u32 dsp = INL (nc_dsp); @@ -2271,7 +2276,7 @@ /* * chip exception handler for unexpected disconnect */ -static void sym_int_udc (hcb_p np) +static void sym_int_udc (struct sym_hcb *np) { printf ("%s: unexpected disconnect\n", sym_name(np)); sym_recover_scsi_int(np, HS_UNEXPECTED); @@ -2287,7 +2292,7 @@ * mode to eight bit asynchronous, etc... * So, just reinitializing all except chip should be enough. */ -static void sym_int_sbmc (hcb_p np) +static void sym_int_sbmc (struct sym_hcb *np) { u_char scsi_mode = INB (nc_stest4) & SMODE; @@ -2328,7 +2333,7 @@ * The chip will load the DSP with the phase mismatch * JUMP address and interrupt the host processor. */ -static void sym_int_par (hcb_p np, u_short sist) +static void sym_int_par (struct sym_hcb *np, u_short sist) { u_char hsts = INB (HS_PRT); u32 dsp = INL (nc_dsp); @@ -2416,7 +2421,7 @@ * We have to construct a new transfer descriptor, * to transfer the rest of the current block. */ -static void sym_int_ma (hcb_p np) +static void sym_int_ma (struct sym_hcb *np) { u32 dbc; u32 rest; @@ -2826,7 +2831,7 @@ * Use at your own decision and risk. */ -void sym_interrupt (hcb_p np) +void sym_interrupt (struct sym_hcb *np) { u_char istat, istatc; u_char dstat; @@ -2981,7 +2986,7 @@ * It is called with SCRIPTS not running. */ static int -sym_dequeue_from_squeue(hcb_p np, int i, int target, int lun, int task) +sym_dequeue_from_squeue(struct sym_hcb *np, int i, int target, int lun, int task) { int j; ccb_p cp; @@ -3025,60 +3030,6 @@ } /* - * Complete all CCBs queued to the COMP queue. - * - * These CCBs are assumed: - * - Not to be referenced either by devices or - * SCRIPTS-related queues and datas. - * - To have to be completed with an error condition - * or requeued. - * - * The device queue freeze count is incremented - * for each CCB that does not prevent this. - * This function is called when all CCBs involved - * in error handling/recovery have been reaped. - */ -void sym_flush_comp_queue(hcb_p np, int cam_status) -{ - SYM_QUEHEAD *qp; - ccb_p cp; - - while ((qp = sym_remque_head(&np->comp_ccbq)) != 0) { - cam_ccb_p ccb; - cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); - sym_insque_tail(&cp->link_ccbq, &np->busy_ccbq); - /* Leave quiet CCBs waiting for resources */ - if (cp->host_status == HS_WAIT) - continue; - ccb = cp->cam_ccb; - if (cam_status) - sym_set_cam_status(ccb, cam_status); -#ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING - if (sym_get_cam_status(ccb) == CAM_REQUEUE_REQ) { - tcb_p tp = &np->target[cp->target]; - lcb_p lp = sym_lp(np, tp, cp->lun); - if (lp) { - sym_remque(&cp->link2_ccbq); - sym_insque_tail(&cp->link2_ccbq, - &lp->waiting_ccbq); - if (cp->started) { - if (cp->tag != NO_TAG) - --lp->started_tags; - else - --lp->started_no_tag; - } - } - cp->started = 0; - continue; - } -#endif - sym_free_ccb(np, cp); - sym_freeze_cam_ccb(ccb); - sym_xpt_done(np, ccb); - } -} - -/* * chip handler for bad SCSI status condition * * In case of bad SCSI status, we unqueue all the tasks @@ -3096,14 +3047,13 @@ * SCRATCHA is assumed to have been loaded with STARTPOS * before the SCRIPTS called the C code. */ -static void sym_sir_bad_scsi_status(hcb_p np, int num, ccb_p cp) +static void sym_sir_bad_scsi_status(struct sym_hcb *np, int num, ccb_p cp) { tcb_p tp = &np->target[cp->target]; u32 startp; u_char s_status = cp->ssss_status; u_char h_flags = cp->host_flags; int msglen; - int nego; int i; /* @@ -3178,16 +3128,7 @@ * cp->nego_status is filled by sym_prepare_nego(). */ cp->nego_status = 0; - nego = 0; - if (tp->tinfo.curr.options & PPR_OPT_MASK) - nego = NS_PPR; - else if (tp->tinfo.curr.width != BUS_8_BIT) - nego = NS_WIDE; - else if (tp->tinfo.curr.offset != 0) - nego = NS_SYNC; - if (nego) - msglen += - sym_prepare_nego (np,cp, nego, &cp->scsi_smsg2[msglen]); + msglen += sym_prepare_nego(np, cp, &cp->scsi_smsg2[msglen]); /* * Message table indirect structure. */ @@ -3213,7 +3154,7 @@ /* * sense data */ - bzero(cp->sns_bbuf, SYM_SNS_BBUF_LEN); + memset(cp->sns_bbuf, 0, SYM_SNS_BBUF_LEN); cp->phys.sense.addr = cpu_to_scr(vtobus(cp->sns_bbuf)); cp->phys.sense.size = cpu_to_scr(SYM_SNS_BBUF_LEN); @@ -3263,7 +3204,7 @@ * - lun=-1 means any logical UNIT otherwise a given one. * - task=-1 means any task, otherwise a given one. */ -int sym_clear_tasks(hcb_p np, int cam_status, int target, int lun, int task) +int sym_clear_tasks(struct sym_hcb *np, int cam_status, int target, int lun, int task) { SYM_QUEHEAD qtmp, *qp; int i = 0; @@ -3282,7 +3223,7 @@ * the BUSY queue. */ while ((qp = sym_remque_head(&qtmp)) != 0) { - cam_ccb_p ccb; + struct scsi_cmnd *ccb; cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); ccb = cp->cam_ccb; if (cp->host_status != HS_DISCONNECT || @@ -3346,7 +3287,7 @@ * all the CCBs that should have been aborted by the * target according to our message. */ -static void sym_sir_task_recovery(hcb_p np, int num) +static void sym_sir_task_recovery(struct sym_hcb *np, int num) { SYM_QUEHEAD *qp; ccb_p cp; @@ -3698,7 +3639,7 @@ * the corresponding values of dp_sg and dp_ofs. */ -static int sym_evaluate_dp(hcb_p np, ccb_p cp, u32 scr, int *ofs) +static int sym_evaluate_dp(struct sym_hcb *np, ccb_p cp, u32 scr, int *ofs) { u32 dp_scr; int dp_ofs, dp_sg, dp_sgmin; @@ -3816,7 +3757,7 @@ * is equivalent to a MODIFY DATA POINTER (offset=-1). */ -static void sym_modify_dp(hcb_p np, tcb_p tp, ccb_p cp, int ofs) +static void sym_modify_dp(struct sym_hcb *np, tcb_p tp, ccb_p cp, int ofs) { int dp_ofs = ofs; u32 dp_scr = sym_get_script_dp (np, cp); @@ -3915,7 +3856,7 @@ * a relevant information. :) */ -int sym_compute_residual(hcb_p np, ccb_p cp) +int sym_compute_residual(struct sym_hcb *np, ccb_p cp) { int dp_sg, dp_sgmin, resid = 0; int dp_ofs = 0; @@ -4015,7 +3956,7 @@ * chip handler for SYNCHRONOUS DATA TRANSFER REQUEST (SDTR) message. */ static int -sym_sync_nego_check(hcb_p np, int req, int target) +sym_sync_nego_check(struct sym_hcb *np, int req, int target) { u_char chg, ofs, per, fak, div; @@ -4096,7 +4037,7 @@ return -1; } -static void sym_sync_nego(hcb_p np, tcb_p tp, ccb_p cp) +static void sym_sync_nego(struct sym_hcb *np, tcb_p tp, ccb_p cp) { int req = 1; int result; @@ -4133,7 +4074,7 @@ * chip handler for PARALLEL PROTOCOL REQUEST (PPR) message. */ static int -sym_ppr_nego_check(hcb_p np, int req, int target) +sym_ppr_nego_check(struct sym_hcb *np, int req, int target) { tcb_p tp = &np->target[target]; unsigned char fak, div; @@ -4176,7 +4117,7 @@ if (ofs) { unsigned char minsync = dt ? np->minsync_dt : np->minsync; - if (per < np->minsync_dt) { + if (per < minsync) { chg = 1; per = minsync; } @@ -4242,7 +4183,7 @@ return -1; } -static void sym_ppr_nego(hcb_p np, tcb_p tp, ccb_p cp) +static void sym_ppr_nego(struct sym_hcb *np, tcb_p tp, ccb_p cp) { int req = 1; int result; @@ -4279,7 +4220,7 @@ * chip handler for WIDE DATA TRANSFER REQUEST (WDTR) message. */ static int -sym_wide_nego_check(hcb_p np, int req, int target) +sym_wide_nego_check(struct sym_hcb *np, int req, int target) { u_char chg, wide; @@ -4344,7 +4285,7 @@ return -1; } -static void sym_wide_nego(hcb_p np, tcb_p tp, ccb_p cp) +static void sym_wide_nego(struct sym_hcb *np, tcb_p tp, ccb_p cp) { int req = 1; int result; @@ -4413,7 +4354,7 @@ * So, if a PPR makes problems, we may just want to * try a legacy negotiation later. */ -static void sym_nego_default(hcb_p np, tcb_p tp, ccb_p cp) +static void sym_nego_default(struct sym_hcb *np, tcb_p tp, ccb_p cp) { switch (cp->nego_status) { case NS_PPR: @@ -4443,7 +4384,7 @@ * chip handler for MESSAGE REJECT received in response to * PPR, WIDE or SYNCHRONOUS negotiation. */ -static void sym_nego_rejected(hcb_p np, tcb_p tp, ccb_p cp) +static void sym_nego_rejected(struct sym_hcb *np, tcb_p tp, ccb_p cp) { sym_nego_default(np, tp, cp); OUTB (HS_PRT, HS_BUSY); @@ -4452,7 +4393,7 @@ /* * chip exception handler for programmed interrupts. */ -static void sym_int_sir (hcb_p np) +static void sym_int_sir (struct sym_hcb *np) { u_char num = INB (nc_dsps); u32 dsa = INL (nc_dsa); @@ -4726,7 +4667,7 @@ /* * Acquire a control block */ -ccb_p sym_get_ccb (hcb_p np, u_char tn, u_char ln, u_char tag_order) +ccb_p sym_get_ccb (struct sym_hcb *np, u_char tn, u_char ln, u_char tag_order) { tcb_p tp = &np->target[tn]; lcb_p lp = sym_lp(np, tp, ln); @@ -4875,7 +4816,7 @@ /* * Release one control block */ -void sym_free_ccb (hcb_p np, ccb_p cp) +void sym_free_ccb (struct sym_hcb *np, ccb_p cp) { tcb_p tp = &np->target[cp->target]; lcb_p lp = sym_lp(np, tp, cp->lun); @@ -4960,13 +4901,6 @@ sym_remque(&cp->link_ccbq); sym_insque_head(&cp->link_ccbq, &np->free_ccbq); -#ifdef SYM_OPT_HANDLE_IO_TIMEOUT - /* - * Cancel any pending timeout condition. - */ - sym_untimeout_ccb(np, cp); -#endif - #ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING if (lp) { sym_remque(&cp->link2_ccbq); @@ -4985,7 +4919,7 @@ /* * Allocate a CCB from memory and initialize its fixed part. */ -static ccb_p sym_alloc_ccb(hcb_p np) +static ccb_p sym_alloc_ccb(struct sym_hcb *np) { ccb_p cp = NULL; int hcode; @@ -5053,9 +4987,6 @@ /* * Chain into optionnal lists. */ -#ifdef SYM_OPT_HANDLE_IO_TIMEOUT - sym_insque_head(&cp->tmo_linkq, &np->tmo0_ccbq); -#endif #ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING sym_insque_head(&cp->link2_ccbq, &np->dummy_ccbq); #endif @@ -5072,7 +5003,7 @@ /* * Look up a CCB from a DSA value. */ -static ccb_p sym_ccb_from_dsa(hcb_p np, u32 dsa) +static ccb_p sym_ccb_from_dsa(struct sym_hcb *np, u32 dsa) { int hcode; ccb_p cp; @@ -5092,7 +5023,7 @@ * Target control block initialisation. * Nothing important to do at the moment. */ -static void sym_init_tcb (hcb_p np, u_char tn) +static void sym_init_tcb (struct sym_hcb *np, u_char tn) { #if 0 /* Hmmm... this checking looks paranoid. */ /* @@ -5108,7 +5039,7 @@ /* * Lun control block allocation and initialization. */ -lcb_p sym_alloc_lcb (hcb_p np, u_char tn, u_char ln) +lcb_p sym_alloc_lcb (struct sym_hcb *np, u_char tn, u_char ln) { tcb_p tp = &np->target[tn]; lcb_p lp = sym_lp(np, tp, ln); @@ -5210,7 +5141,7 @@ /* * Allocate LCB resources for tagged command queuing. */ -static void sym_alloc_lcb_tags (hcb_p np, u_char tn, u_char ln) +static void sym_alloc_lcb_tags (struct sym_hcb *np, u_char tn, u_char ln) { tcb_p tp = &np->target[tn]; lcb_p lp = sym_lp(np, tp, ln); @@ -5262,7 +5193,7 @@ /* * Queue a SCSI IO to the controller. */ -int sym_queue_scsiio(hcb_p np, cam_scsiio_p csio, ccb_p cp) +int sym_queue_scsiio(struct sym_hcb *np, struct scsi_cmnd *csio, ccb_p cp) { tcb_p tp; lcb_p lp; @@ -5273,7 +5204,7 @@ /* * Keep track of the IO in our CCB. */ - cp->cam_ccb = (cam_ccb_p) csio; + cp->cam_ccb = csio; /* * Retrieve the target descriptor. @@ -5351,7 +5282,7 @@ tp->tinfo.curr.offset != tp->tinfo.goal.offset || tp->tinfo.curr.options != tp->tinfo.goal.options) { if (!tp->nego_cp && lp) - msglen += sym_prepare_nego(np, cp, 0, msgptr + msglen); + msglen += sym_prepare_nego(np, cp, msgptr + msglen); } /* @@ -5401,7 +5332,7 @@ /* * Reset a SCSI target (all LUNs of this target). */ -int sym_reset_scsi_target(hcb_p np, int target) +int sym_reset_scsi_target(struct sym_hcb *np, int target) { tcb_p tp; @@ -5420,7 +5351,7 @@ /* * Abort a SCSI IO. */ -int sym_abort_ccb(hcb_p np, ccb_p cp, int timed_out) +int sym_abort_ccb(struct sym_hcb *np, ccb_p cp, int timed_out) { /* * Check that the IO is active. @@ -5450,7 +5381,7 @@ return 0; } -int sym_abort_scsiio(hcb_p np, cam_ccb_p ccb, int timed_out) +int sym_abort_scsiio(struct sym_hcb *np, struct scsi_cmnd *ccb, int timed_out) { ccb_p cp; SYM_QUEHEAD *qp; @@ -5480,7 +5411,7 @@ * SCRATCHA is assumed to have been loaded with STARTPOS * before the SCRIPTS called the C code. */ -void sym_complete_error (hcb_p np, ccb_p cp) +void sym_complete_error (struct sym_hcb *np, ccb_p cp) { tcb_p tp; lcb_p lp; @@ -5614,11 +5545,11 @@ * The SCRIPTS processor is running while we are * completing successful commands. */ -void sym_complete_ok (hcb_p np, ccb_p cp) +void sym_complete_ok (struct sym_hcb *np, ccb_p cp) { tcb_p tp; lcb_p lp; - cam_ccb_p ccb; + struct scsi_cmnd *ccb; int resid; /* @@ -5724,7 +5655,7 @@ /* * Soft-attach the controller. */ -int sym_hcb_attach(hcb_p np, struct sym_fw *fw, struct sym_nvram *nvram) +int sym_hcb_attach(struct sym_hcb *np, struct sym_fw *fw, struct sym_nvram *nvram) { int i; @@ -5815,17 +5746,9 @@ sym_que_init(&np->comp_ccbq); /* - * Initializations for optional handling - * of IO timeouts and device queueing. + * Initialization for optional handling + * of device queueing. */ -#ifdef SYM_OPT_HANDLE_IO_TIMEOUT - sym_que_init(&np->tmo0_ccbq); - np->tmo_ccbq = - sym_calloc(2*SYM_CONF_TIMEOUT_ORDER_MAX*sizeof(SYM_QUEHEAD), - "TMO_CCBQ"); - for (i = 0 ; i < 2*SYM_CONF_TIMEOUT_ORDER_MAX ; i++) - sym_que_init(&np->tmo_ccbq[i]); -#endif #ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING sym_que_init(&np->dummy_ccbq); #endif @@ -5957,7 +5880,7 @@ /* * Free everything that has been allocated for this device. */ -void sym_hcb_free(hcb_p np) +void sym_hcb_free(struct sym_hcb *np) { SYM_QUEHEAD *qp; ccb_p cp; @@ -5971,12 +5894,6 @@ sym_mfree_dma(np->scriptb0, np->scriptb_sz, "SCRIPTB0"); if (np->scripta0) sym_mfree_dma(np->scripta0, np->scripta_sz, "SCRIPTA0"); -#ifdef SYM_OPT_HANDLE_IO_TIMEOUT - if (np->tmo_ccbq) - sym_mfree(np->tmo_ccbq, - 2*SYM_CONF_TIMEOUT_ORDER_MAX*sizeof(SYM_QUEHEAD), - "TMO_CCBQ"); -#endif if (np->squeue) sym_mfree_dma(np->squeue, sizeof(u32)*(MAX_QUEUE*2), "SQUEUE"); if (np->dqueue) diff -Nru a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h 2005-01-13 16:25:56 -08:00 @@ -749,7 +749,7 @@ /* * Pointer to CAM ccb and related stuff. */ - cam_ccb_p cam_ccb; /* CAM scsiio ccb */ + struct scsi_cmnd *cam_ccb; /* CAM scsiio ccb */ u8 cdb_buf[16]; /* Copy of CDB */ u8 *sns_bbuf; /* Bounce buffer for sense data */ #ifndef SYM_SNS_BBUF_LEN @@ -796,10 +796,6 @@ /* * Other fields. */ -#ifdef SYM_OPT_HANDLE_IO_TIMEOUT - SYM_QUEHEAD tmo_linkq; /* Optional timeout handling */ - u_int tmo_clock; /* (link and dealine value) */ -#endif u32 ccb_ba; /* BUS address of this CCB */ u_short tag; /* Tag for this transfer */ /* NO_TAG means no tag */ @@ -946,8 +942,8 @@ struct sym_fwa_ba fwa_bas; /* Useful SCRIPTA bus addresses */ struct sym_fwb_ba fwb_bas; /* Useful SCRIPTB bus addresses */ struct sym_fwz_ba fwz_bas; /* Useful SCRIPTZ bus addresses */ - void (*fw_setup)(hcb_p np, struct sym_fw *fw); - void (*fw_patch)(hcb_p np); + void (*fw_setup)(struct sym_hcb *np, struct sym_fw *fw); + void (*fw_patch)(struct sym_hcb *np); char *fw_name; /* @@ -1025,15 +1021,6 @@ #ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING SYM_QUEHEAD dummy_ccbq; #endif - /* - * Optional handling of IO timeouts. - */ -#ifdef SYM_OPT_HANDLE_IO_TIMEOUT - SYM_QUEHEAD tmo0_ccbq; - SYM_QUEHEAD *tmo_ccbq; /* [2*SYM_TIMEOUT_ORDER_MAX] */ - u_int tmo_clock; - u_int tmo_actq; -#endif /* * IMMEDIATE ARBITRATION (IARB) control. @@ -1082,54 +1069,39 @@ * FIRMWARES (sym_fw.c) */ struct sym_fw * sym_find_firmware(struct sym_pci_chip *chip); -void sym_fw_bind_script (hcb_p np, u32 *start, int len); +void sym_fw_bind_script (struct sym_hcb *np, u32 *start, int len); /* * Driver methods called from O/S specific code. */ char *sym_driver_name(void); void sym_print_xerr(ccb_p cp, int x_status); -int sym_reset_scsi_bus(hcb_p np, int enab_int); +int sym_reset_scsi_bus(struct sym_hcb *np, int enab_int); struct sym_pci_chip * sym_lookup_pci_chip_table (u_short device_id, u_char revision); -void sym_put_start_queue(hcb_p np, ccb_p cp); +void sym_put_start_queue(struct sym_hcb *np, ccb_p cp); #ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING -void sym_start_next_ccbs(hcb_p np, lcb_p lp, int maxn); +void sym_start_next_ccbs(struct sym_hcb *np, lcb_p lp, int maxn); #endif -void sym_start_up (hcb_p np, int reason); -void sym_interrupt (hcb_p np); -void sym_flush_comp_queue(hcb_p np, int cam_status); -int sym_clear_tasks(hcb_p np, int cam_status, int target, int lun, int task); -ccb_p sym_get_ccb (hcb_p np, u_char tn, u_char ln, u_char tag_order); -void sym_free_ccb (hcb_p np, ccb_p cp); -lcb_p sym_alloc_lcb (hcb_p np, u_char tn, u_char ln); -int sym_queue_scsiio(hcb_p np, cam_scsiio_p csio, ccb_p cp); -int sym_abort_scsiio(hcb_p np, cam_ccb_p ccb, int timed_out); -int sym_abort_ccb(hcb_p np, ccb_p cp, int timed_out); -int sym_reset_scsi_target(hcb_p np, int target); -void sym_hcb_free(hcb_p np); -int sym_hcb_attach(hcb_p np, struct sym_fw *fw, struct sym_nvram *nvram); - -/* - * Optionnaly, the driver may handle IO timeouts. - */ -#ifdef SYM_OPT_HANDLE_IO_TIMEOUT -int sym_abort_ccb(hcb_p np, ccb_p cp, int timed_out); -void sym_timeout_ccb(hcb_p np, ccb_p cp, u_int ticks); -static void __inline sym_untimeout_ccb(hcb_p np, ccb_p cp) -{ - sym_remque(&cp->tmo_linkq); - sym_insque_head(&cp->tmo_linkq, &np->tmo0_ccbq); -} -void sym_clock(hcb_p np); -#endif /* SYM_OPT_HANDLE_IO_TIMEOUT */ +void sym_start_up (struct sym_hcb *np, int reason); +void sym_interrupt (struct sym_hcb *np); +int sym_clear_tasks(struct sym_hcb *np, int cam_status, int target, int lun, int task); +ccb_p sym_get_ccb (struct sym_hcb *np, u_char tn, u_char ln, u_char tag_order); +void sym_free_ccb (struct sym_hcb *np, ccb_p cp); +lcb_p sym_alloc_lcb (struct sym_hcb *np, u_char tn, u_char ln); +int sym_queue_scsiio(struct sym_hcb *np, struct scsi_cmnd *csio, ccb_p cp); +int sym_abort_scsiio(struct sym_hcb *np, struct scsi_cmnd *ccb, int timed_out); +int sym_abort_ccb(struct sym_hcb *np, ccb_p cp, int timed_out); +int sym_reset_scsi_target(struct sym_hcb *np, int target); +void sym_hcb_free(struct sym_hcb *np); +int sym_hcb_attach(struct sym_hcb *np, struct sym_fw *fw, struct sym_nvram *nvram); /* * Optionnaly, the driver may provide a function * to announce transfer rate changes. */ #ifdef SYM_OPT_ANNOUNCE_TRANSFER_RATE -void sym_announce_transfer_rate(hcb_p np, int target); +void sym_announce_transfer_rate(struct sym_hcb *np, int target); #endif /* @@ -1153,9 +1125,9 @@ (data)->size = cpu_to_scr((((badd) >> 8) & 0xff000000) + len); \ } while (0) #elif SYM_CONF_DMA_ADDRESSING_MODE == 2 -int sym_lookup_dmap(hcb_p np, u32 h, int s); +int sym_lookup_dmap(struct sym_hcb *np, u32 h, int s); static __inline void -sym_build_sge(hcb_p np, struct sym_tblmove *data, u64 badd, int len) +sym_build_sge(struct sym_hcb *np, struct sym_tblmove *data, u64 badd, int len) { u32 h = (badd>>32); int s = (h&SYM_DMAP_MASK); diff -Nru a/drivers/scsi/sym53c8xx_2/sym_malloc.c b/drivers/scsi/sym53c8xx_2/sym_malloc.c --- a/drivers/scsi/sym53c8xx_2/sym_malloc.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_2/sym_malloc.c 2005-01-13 16:25:56 -08:00 @@ -170,7 +170,7 @@ } if (p) - bzero(p, size); + memset(p, 0, size); else if (uflags & SYM_MEM_WARN) printf ("__sym_calloc2: failed to allocate %s[%d]\n", name, size); return p; diff -Nru a/drivers/scsi/sym53c8xx_2/sym_misc.c b/drivers/scsi/sym53c8xx_2/sym_misc.c --- a/drivers/scsi/sym53c8xx_2/sym_misc.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_2/sym_misc.c 2005-01-13 16:25:56 -08:00 @@ -37,109 +37,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __FreeBSD__ -#include -#else #include "sym_glue.h" -#endif - -#ifdef SYM_OPT_HANDLE_IO_TIMEOUT -/* - * Optional CCB timeout handling. - * - * This code is useful for O/Ses that allow or expect - * SIMs (low-level drivers) to handle SCSI IO timeouts. - * It uses a power-of-two based algorithm of my own:) - * that avoids scanning of lists, provided that: - * - * - The IO does complete in less than half the associated - * timeout value. - * - The greatest delay between the queuing of the IO and - * its completion is less than - * (1<<(SYM_CONF_TIMEOUT_ORDER_MAX-1))/2 ticks. - * - * For example, if tick is 1 second and the max order is 8, - * any IO that is completed within less than 64 seconds will - * just be put into some list at queuing and be removed - * at completion without any additionnal overhead. - */ - -/* - * Set a timeout condition on a CCB. - */ -void sym_timeout_ccb(hcb_p np, ccb_p cp, u_int ticks) -{ - sym_remque(&cp->tmo_linkq); - cp->tmo_clock = np->tmo_clock + ticks; - if (!ticks) { - sym_insque_head(&cp->tmo_linkq, &np->tmo0_ccbq); - } - else { - int i = SYM_CONF_TIMEOUT_ORDER_MAX - 1; - while (i > 0) { - if (ticks >= (1<<(i+1))) - break; - --i; - } - if (!(np->tmo_actq & (1<tmo_linkq, &np->tmo_ccbq[i]); - } -} - -/* - * Walk a list of CCB and handle timeout conditions. - * Should never be called in normal situations. - */ -static void sym_walk_ccb_tmo_list(hcb_p np, SYM_QUEHEAD *tmoq) -{ - SYM_QUEHEAD qtmp, *qp; - ccb_p cp; - - sym_que_move(tmoq, &qtmp); - while ((qp = sym_remque_head(&qtmp)) != 0) { - sym_insque_head(qp, &np->tmo0_ccbq); - cp = sym_que_entry(qp, struct sym_ccb, tmo_linkq); - if (cp->tmo_clock != np->tmo_clock && - cp->tmo_clock + 1 != np->tmo_clock) - sym_timeout_ccb(np, cp, cp->tmo_clock - np->tmo_clock); - else - sym_abort_ccb(np, cp, 1); - } -} - -/* - * Our clock handler called from the O/S specific side. - */ -void sym_clock(hcb_p np) -{ - int i, j; - u_int tmp; - - tmp = np->tmo_clock; - tmp ^= (++np->tmo_clock); - - for (i = 0; i < SYM_CONF_TIMEOUT_ORDER_MAX; i++, tmp >>= 1) { - if (!(tmp & 1)) - continue; - j = i; - if (np->tmo_actq & (1<tmo_ccbq[j])) { - sym_walk_ccb_tmo_list(np, &np->tmo_ccbq[j]); - } - np->tmo_actq ^= (1<target[target]; diff -Nru a/drivers/scsi/sym53c8xx_2/sym_nvram.c b/drivers/scsi/sym53c8xx_2/sym_nvram.c --- a/drivers/scsi/sym53c8xx_2/sym_nvram.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_2/sym_nvram.c 2005-01-13 16:25:56 -08:00 @@ -68,6 +68,21 @@ case SYM_TEKRAM_NVRAM: np->myaddr = nvram->data.Tekram.host_id & 0x0f; break; +#ifdef CONFIG_PARISC + case SYM_PARISC_PDC: + if (nvram->data.parisc.host_id != -1) + np->myaddr = nvram->data.parisc.host_id; + if (nvram->data.parisc.factor != -1) + np->minsync = nvram->data.parisc.factor; + if (nvram->data.parisc.width != -1) + np->maxwide = nvram->data.parisc.width; + switch (nvram->data.parisc.mode) { + case 0: np->scsi_mode = SMODE_SE; break; + case 1: np->scsi_mode = SMODE_HVD; break; + case 2: np->scsi_mode = SMODE_LVD; break; + default: break; + } +#endif default: break; } @@ -702,6 +717,28 @@ return 0; } +#ifdef CONFIG_PARISC +/* + * Host firmware (PDC) keeps a table for altering SCSI capabilities. + * Many newer machines export one channel of 53c896 chip as SE, 50-pin HD. + * Also used for Multi-initiator SCSI clusters to set the SCSI Initiator ID. + */ +static int sym_read_parisc_pdc(struct sym_device *np, struct pdc_initiator *pdc) +{ + struct hardware_path hwpath; + get_pci_node_path(np->pdev, &hwpath); + if (!pdc_get_initiator(&hwpath, pdc)) + return 0; + + return SYM_PARISC_PDC; +} +#else +static int sym_read_parisc_pdc(struct sym_device *np, struct pdc_initiator *x) +{ + return 0; +} +#endif + /* * Try reading Symbios or Tekram NVRAM */ @@ -714,7 +751,7 @@ nvp->type = SYM_TEKRAM_NVRAM; sym_display_Tekram_nvram(np, &nvp->data.Tekram); } else { - nvp->type = 0; + nvp->type = sym_read_parisc_pdc(np, &nvp->data.parisc); } return nvp->type; } diff -Nru a/drivers/scsi/sym53c8xx_2/sym_nvram.h b/drivers/scsi/sym53c8xx_2/sym_nvram.h --- a/drivers/scsi/sym53c8xx_2/sym_nvram.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_2/sym_nvram.h 2005-01-13 16:25:56 -08:00 @@ -171,6 +171,10 @@ typedef struct Tekram_nvram Tekram_nvram; typedef struct Tekram_target Tekram_target; +#ifndef CONFIG_PARISC +struct pdc_initiator { int dummy; }; +#endif + /* * Union of supported NVRAM formats. */ @@ -178,10 +182,12 @@ int type; #define SYM_SYMBIOS_NVRAM (1) #define SYM_TEKRAM_NVRAM (2) +#define SYM_PARISC_PDC (3) #if SYM_CONF_NVRAM_SUPPORT union { Symbios_nvram Symbios; Tekram_nvram Tekram; + struct pdc_initiator parisc; } data; #endif }; diff -Nru a/drivers/scsi/sym53c8xx_comm.h b/drivers/scsi/sym53c8xx_comm.h --- a/drivers/scsi/sym53c8xx_comm.h 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/sym53c8xx_comm.h 2005-01-13 16:25:56 -08:00 @@ -505,8 +505,6 @@ #define unmap_scsi_data(np, cmd) __unmap_scsi_data(np->dev, cmd) #define map_scsi_single_data(np, cmd) __map_scsi_single_data(np->dev, cmd) #define map_scsi_sg_data(np, cmd) __map_scsi_sg_data(np->dev, cmd) -#define sync_scsi_data_for_cpu(np, cmd) __sync_scsi_data_for_cpu(np->dev, cmd) -#define sync_scsi_data_for_device(np, cmd) __sync_scsi_data_for_device(np->dev, cmd) /*========================================================== ** diff -Nru a/drivers/scsi/zalon.c b/drivers/scsi/zalon.c --- a/drivers/scsi/zalon.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/scsi/zalon.c 2005-01-13 16:25:56 -08:00 @@ -87,7 +87,7 @@ { struct gsc_irq gsc_irq; u32 zalon_vers; - int irq, error = -ENODEV; + int error = -ENODEV; unsigned long zalon = dev->hpa; unsigned long io_port = zalon + GSC_SCSI_ZALON_OFFSET; static int unit = 0; @@ -107,10 +107,10 @@ /* Setup the interrupts first. ** Later on request_irq() will register the handler. */ - irq = gsc_alloc_irq(&gsc_irq); + dev->irq = gsc_alloc_irq(&gsc_irq); printk("%s: Zalon vers field is 0x%x, IRQ %d\n", __FUNCTION__, - zalon_vers, irq); + zalon_vers, dev->irq); __raw_writel(gsc_irq.txn_addr | gsc_irq.txn_data, dev->hpa + IO_MODULE_EIM); @@ -130,16 +130,16 @@ device.dev = &dev->dev; device.slot.base = (u_long)io_port; device.slot.base_c = (u_long)io_port; - device.slot.irq = irq; + device.slot.irq = dev->irq; device.differential = 2; host = ncr_attach(&zalon7xx_template, unit, &device); if (!host) goto fail; - if (request_irq(irq, ncr53c8xx_intr, SA_SHIRQ, dev->dev.bus_id, host)) { + if (request_irq(dev->irq, ncr53c8xx_intr, SA_SHIRQ, "zalon", host)) { printk(KERN_ERR "%s: irq problem with %d, detaching\n ", - dev->dev.bus_id, irq); + dev->dev.bus_id, dev->irq); goto fail; } @@ -155,7 +155,7 @@ return 0; fail_free_irq: - free_irq(irq, host); + free_irq(dev->irq, host); fail: ncr53c8xx_release(host); return error; @@ -171,18 +171,16 @@ static int __exit zalon_remove(struct parisc_device *dev) { struct Scsi_Host *host = dev_get_drvdata(&dev->dev); - int irq = host->irq; scsi_remove_host(host); ncr53c8xx_release(host); - free_irq(irq, host); + free_irq(dev->irq, host); return 0; } - static struct parisc_driver zalon_driver = { - .name = "GSC SCSI (Zalon)", + .name = "zalon", .id_table = zalon_tbl, .probe = zalon_probe, .remove = __devexit_p(zalon_remove), @@ -201,6 +199,7 @@ static void __exit zalon7xx_exit(void) { unregister_parisc_driver(&zalon_driver); + ncr53c8xx_exit(); } module_init(zalon7xx_init); diff -Nru a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c --- a/drivers/video/matrox/matroxfb_base.c 2005-01-13 16:25:56 -08:00 +++ b/drivers/video/matrox/matroxfb_base.c 2005-01-13 16:25:56 -08:00 @@ -2477,8 +2477,10 @@ MODULE_PARM_DESC(noinit, "Disables W/SG/SD-RAM and bus interface initialization (0 or 1=do not initialize) (default=0)"); module_param(memtype, int, 0); MODULE_PARM_DESC(memtype, "Memory type for G200/G400 (see Documentation/fb/matroxfb.txt for explanation) (default=3 for G200, 0 for G400)"); +#ifdef CONFIG_MTRR module_param(mtrr, int, 0); MODULE_PARM_DESC(mtrr, "This speeds up video memory accesses (0=disabled or 1) (default=1)"); +#endif module_param(sgram, int, 0); MODULE_PARM_DESC(sgram, "Indicates that G100/G200/G400 has SGRAM memory (0=SDRAM, 1=SGRAM) (default=0)"); module_param(inv24, int, 0); diff -Nru a/fs/binfmt_aout.c b/fs/binfmt_aout.c --- a/fs/binfmt_aout.c 2005-01-13 16:25:56 -08:00 +++ b/fs/binfmt_aout.c 2005-01-13 16:25:56 -08:00 @@ -50,7 +50,10 @@ start = PAGE_ALIGN(start); end = PAGE_ALIGN(end); if (end > start) { - unsigned long addr = do_brk(start, end - start); + unsigned long addr; + down_write(¤t->mm->mmap_sem); + addr = do_brk(start, end - start); + up_write(¤t->mm->mmap_sem); if (BAD_ADDR(addr)) return addr; } @@ -323,10 +326,14 @@ loff_t pos = fd_offset; /* Fuck me plenty... */ /* */ + down_write(¤t->mm->mmap_sem); error = do_brk(N_TXTADDR(ex), ex.a_text); + up_write(¤t->mm->mmap_sem); bprm->file->f_op->read(bprm->file, (char *) N_TXTADDR(ex), ex.a_text, &pos); + down_write(¤t->mm->mmap_sem); error = do_brk(N_DATADDR(ex), ex.a_data); + up_write(¤t->mm->mmap_sem); bprm->file->f_op->read(bprm->file, (char *) N_DATADDR(ex), ex.a_data, &pos); goto beyond_if; @@ -346,8 +353,9 @@ pos = 32; map_size = ex.a_text+ex.a_data; #endif - + down_write(¤t->mm->mmap_sem); error = do_brk(text_addr & PAGE_MASK, map_size); + up_write(¤t->mm->mmap_sem); if (error != (text_addr & PAGE_MASK)) { send_sig(SIGKILL, current, 0); return error; @@ -382,7 +390,9 @@ if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { loff_t pos = fd_offset; + down_write(¤t->mm->mmap_sem); do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); + up_write(¤t->mm->mmap_sem); bprm->file->f_op->read(bprm->file, (char __user *)N_TXTADDR(ex), ex.a_text+ex.a_data, &pos); @@ -487,8 +497,9 @@ file->f_dentry->d_name.name); error_time = jiffies; } - + down_write(¤t->mm->mmap_sem); do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); + up_write(¤t->mm->mmap_sem); file->f_op->read(file, (char __user *)start_addr, ex.a_text + ex.a_data, &pos); diff -Nru a/fs/binfmt_elf.c b/fs/binfmt_elf.c --- a/fs/binfmt_elf.c 2005-01-13 16:25:56 -08:00 +++ b/fs/binfmt_elf.c 2005-01-13 16:25:56 -08:00 @@ -88,7 +88,10 @@ start = ELF_PAGEALIGN(start); end = ELF_PAGEALIGN(end); if (end > start) { - unsigned long addr = do_brk(start, end - start); + unsigned long addr; + down_write(¤t->mm->mmap_sem); + addr = do_brk(start, end - start); + up_write(¤t->mm->mmap_sem); if (BAD_ADDR(addr)) return addr; } @@ -409,7 +412,9 @@ /* Map the last of the bss segment */ if (last_bss > elf_bss) { + down_write(¤t->mm->mmap_sem); error = do_brk(elf_bss, last_bss - elf_bss); + up_write(¤t->mm->mmap_sem); if (BAD_ADDR(error)) goto out_close; } @@ -449,7 +454,9 @@ goto out; } + down_write(¤t->mm->mmap_sem); do_brk(0, text_data); + up_write(¤t->mm->mmap_sem); if (!interpreter->f_op || !interpreter->f_op->read) goto out; if (interpreter->f_op->read(interpreter, addr, text_data, &offset) < 0) @@ -457,8 +464,11 @@ flush_icache_range((unsigned long)addr, (unsigned long)addr + text_data); + + down_write(¤t->mm->mmap_sem); do_brk(ELF_PAGESTART(text_data + ELF_MIN_ALIGN - 1), interp_ex->a_bss); + up_write(¤t->mm->mmap_sem); elf_entry = interp_ex->a_entry; out: diff -Nru a/fs/readdir.c b/fs/readdir.c --- a/fs/readdir.c 2005-01-13 16:25:56 -08:00 +++ b/fs/readdir.c 2005-01-13 16:25:56 -08:00 @@ -287,9 +287,10 @@ lastdirent = buf.previous; if (lastdirent) { typeof(lastdirent->d_off) d_off = file->f_pos; - error = count - buf.count; + error = -EFAULT; if (__put_user(d_off, &lastdirent->d_off)) - error = -EFAULT; + goto out_putf; + error = count - buf.count; } out_putf: diff -Nru a/include/asm-alpha/io_trivial.h b/include/asm-alpha/io_trivial.h --- a/include/asm-alpha/io_trivial.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-alpha/io_trivial.h 2005-01-13 16:25:56 -08:00 @@ -26,7 +26,7 @@ __EXTERN_INLINE void IO_CONCAT(__IO_PREFIX,iowrite16)(u16 b, void __iomem *a) { - __kernel_stb(b, *(volatile u16 __force *)a); + __kernel_stw(b, *(volatile u16 __force *)a); } #endif @@ -66,7 +66,7 @@ __EXTERN_INLINE void IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a) { - __kernel_stb(b, *(volatile u16 __force *)a); + __kernel_stw(b, *(volatile u16 __force *)a); } #elif IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 2 __EXTERN_INLINE u8 diff -Nru a/include/asm-arm/arch-pxa/corgi.h b/include/asm-arm/arch-pxa/corgi.h --- a/include/asm-arm/arch-pxa/corgi.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-arm/arch-pxa/corgi.h 2005-01-13 16:25:56 -08:00 @@ -15,29 +15,31 @@ /* - * Corgi GPIO definitions + * Corgi (Non Standard) GPIO Definitions */ -#define CORGI_GPIO_KEY_INT (0) /* key interrupt */ +#define CORGI_GPIO_KEY_INT (0) /* Keyboard Interrupt */ #define CORGI_GPIO_AC_IN (1) #define CORGI_GPIO_WAKEUP (3) -#define CORGI_GPIO_AK_INT (4) // Remote Controller -#define CORGI_GPIO_TP_INT (5) /* Touch Panel interrupt */ -#define CORGI_GPIO_nSD_CLK (6) +#define CORGI_GPIO_AK_INT (4) /* IR Controller Interrupt */ +#define CORGI_GPIO_TP_INT (5) /* Touch Panel Interrupt */ #define CORGI_GPIO_nSD_WP (7) -#define CORGI_GPIO_nSD_DETECT (9) +#define CORGI_GPIO_nSD_DETECT (9) /* MMC/SD Card Detect */ #define CORGI_GPIO_nSD_INT (10) #define CORGI_GPIO_MAIN_BAT_LOW (11) #define CORGI_GPIO_BAT_COVER (11) #define CORGI_GPIO_LED_ORANGE (13) -#define CORGI_GPIO_CF_CD (14) +#define CORGI_GPIO_CF_CD (14) /* Compact Flash Card Detect */ #define CORGI_GPIO_CHRG_FULL (16) -#define CORGI_GPIO_CF_IRQ (17) +#define CORGI_GPIO_CF_IRQ (17) /* Compact Flash Interrupt */ +#define CORGI_GPIO_LCDCON_CS (19) /* LCD Control Chip Select */ +#define CORGI_GPIO_MAX1111_CS (20) /* MAX111 Chip Select */ #define CORGI_GPIO_ADC_TEMP_ON (21) #define CORGI_GPIO_IR_ON (22) -#define CORGI_GPIO_SD_PWR (33) +#define CORGI_GPIO_ADS7846_CS (24) /* ADS7846 Chip Select */ +#define CORGI_GPIO_SD_PWR (33) /* MMC/SD Power */ #define CORGI_GPIO_CHRG_ON (38) #define CORGI_GPIO_DISCHARGE_ON (42) -#define CORGI_GPIO_HSYNC (44) +#define CORGI_GPIO_HSYNC (44) /* LCD HSync Pulse */ #define CORGI_GPIO_USB_PULLUP (45) diff -Nru a/include/asm-arm/cpu.h b/include/asm-arm/cpu.h --- a/include/asm-arm/cpu.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-arm/cpu.h 2005-01-13 16:25:56 -08:00 @@ -17,7 +17,6 @@ struct cpu cpu; #ifdef CONFIG_SMP unsigned int loops_per_jiffy; - unsigned long ipi_count; #endif }; diff -Nru a/include/asm-arm/mach/irq.h b/include/asm-arm/mach/irq.h --- a/include/asm-arm/mach/irq.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-arm/mach/irq.h 2005-01-13 16:25:56 -08:00 @@ -47,6 +47,13 @@ * Set wakeup-enable on the selected IRQ */ int (*wake)(unsigned int, unsigned int); + +#ifdef CONFIG_SMP + /* + * Route an interrupt to a CPU + */ + void (*set_cpu)(struct irqdesc *desc, unsigned int irq, unsigned int cpu); +#endif }; struct irqdesc { @@ -66,6 +73,13 @@ unsigned int valid : 1; /* IRQ claimable */ unsigned int noautoenable : 1; /* don't automatically enable IRQ */ unsigned int unused :25; + + struct proc_dir_entry *procdir; + +#ifdef CONFIG_SMP + cpumask_t affinity; + unsigned int cpu; +#endif /* * IRQ lock detection diff -Nru a/include/asm-arm/processor.h b/include/asm-arm/processor.h --- a/include/asm-arm/processor.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-arm/processor.h 2005-01-13 16:25:56 -08:00 @@ -19,7 +19,6 @@ #ifdef __KERNEL__ -#include #include #include #include diff -Nru a/include/asm-arm/smp.h b/include/asm-arm/smp.h --- a/include/asm-arm/smp.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-arm/smp.h 2005-01-13 16:25:56 -08:00 @@ -32,6 +32,13 @@ */ #define PROC_CHANGE_PENALTY 15 +struct seq_file; + +/* + * generate IPI list text + */ +extern void show_ipi_list(struct seq_file *p); + /* * Move global data into per-processor storage. */ @@ -46,6 +53,6 @@ * Boot a secondary CPU, and assign it the specified idle task. * This also gives us the initial stack to use for this CPU. */ -extern int __init boot_secondary(unsigned int cpu, struct task_struct *); +extern int boot_secondary(unsigned int cpu, struct task_struct *); #endif /* ifndef __ASM_ARM_SMP_H */ diff -Nru a/include/asm-arm/tlb.h b/include/asm-arm/tlb.h --- a/include/asm-arm/tlb.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-arm/tlb.h 2005-01-13 16:25:56 -08:00 @@ -91,4 +91,6 @@ #define pte_free_tlb(tlb,ptep) pte_free(ptep) #define pmd_free_tlb(tlb,pmdp) pmd_free(pmdp) +#define tlb_migrate_finish(mm) do { } while (0) + #endif diff -Nru a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h --- a/include/asm-ia64/machvec.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-ia64/machvec.h 2005-01-13 16:25:56 -08:00 @@ -20,6 +20,7 @@ struct irq_desc; struct page; struct mm_struct; +struct pci_bus; typedef void ia64_mv_setup_t (char **); typedef void ia64_mv_cpu_init_t (void); @@ -31,6 +32,11 @@ typedef struct irq_desc *ia64_mv_irq_desc (unsigned int); typedef u8 ia64_mv_irq_to_vector (unsigned int); typedef unsigned int ia64_mv_local_vector_to_irq (u8); +typedef char *ia64_mv_pci_get_legacy_mem_t (struct pci_bus *); +typedef int ia64_mv_pci_legacy_read_t (struct pci_bus *, u16 port, u32 *val, + u8 size); +typedef int ia64_mv_pci_legacy_write_t (struct pci_bus *, u16 port, u32 val, + u8 size); /* DMA-mapping interface: */ typedef void ia64_mv_dma_init (void); @@ -94,6 +100,8 @@ # include # elif defined (CONFIG_IA64_HP_ZX1) # include +# elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB) +# include # elif defined (CONFIG_IA64_SGI_SN2) # include # elif defined (CONFIG_IA64_GENERIC) @@ -125,6 +133,9 @@ # define platform_irq_desc ia64_mv.irq_desc # define platform_irq_to_vector ia64_mv.irq_to_vector # define platform_local_vector_to_irq ia64_mv.local_vector_to_irq +# define platform_pci_get_legacy_mem ia64_mv.pci_get_legacy_mem +# define platform_pci_legacy_read ia64_mv.pci_legacy_read +# define platform_pci_legacy_write ia64_mv.pci_legacy_write # define platform_inb ia64_mv.inb # define platform_inw ia64_mv.inw # define platform_inl ia64_mv.inl @@ -172,6 +183,9 @@ ia64_mv_irq_desc *irq_desc; ia64_mv_irq_to_vector *irq_to_vector; ia64_mv_local_vector_to_irq *local_vector_to_irq; + ia64_mv_pci_get_legacy_mem_t *pci_get_legacy_mem; + ia64_mv_pci_legacy_read_t *pci_legacy_read; + ia64_mv_pci_legacy_write_t *pci_legacy_write; ia64_mv_inb_t *inb; ia64_mv_inw_t *inw; ia64_mv_inl_t *inl; @@ -215,6 +229,9 @@ platform_irq_desc, \ platform_irq_to_vector, \ platform_local_vector_to_irq, \ + platform_pci_get_legacy_mem, \ + platform_pci_legacy_read, \ + platform_pci_legacy_write, \ platform_inb, \ platform_inw, \ platform_inl, \ @@ -329,6 +346,15 @@ #endif #ifndef platform_local_vector_to_irq # define platform_local_vector_to_irq __ia64_local_vector_to_irq +#endif +#ifndef platform_pci_get_legacy_mem +# define platform_pci_get_legacy_mem ia64_pci_get_legacy_mem +#endif +#ifndef platform_pci_legacy_read +# define platform_pci_legacy_read ia64_pci_legacy_read +#endif +#ifndef platform_pci_legacy_write +# define platform_pci_legacy_write ia64_pci_legacy_write #endif #ifndef platform_inb # define platform_inb __ia64_inb diff -Nru a/include/asm-ia64/machvec_hpzx1_swiotlb.h b/include/asm-ia64/machvec_hpzx1_swiotlb.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-ia64/machvec_hpzx1_swiotlb.h 2005-01-13 16:25:56 -08:00 @@ -0,0 +1,43 @@ +#ifndef _ASM_IA64_MACHVEC_HPZX1_SWIOTLB_h +#define _ASM_IA64_MACHVEC_HPZX1_SWIOTLB_h + +extern ia64_mv_setup_t dig_setup; +extern ia64_mv_dma_init hwsw_init; +extern ia64_mv_dma_alloc_coherent hwsw_alloc_coherent; +extern ia64_mv_dma_free_coherent hwsw_free_coherent; +extern ia64_mv_dma_map_single hwsw_map_single; +extern ia64_mv_dma_unmap_single hwsw_unmap_single; +extern ia64_mv_dma_map_sg hwsw_map_sg; +extern ia64_mv_dma_unmap_sg hwsw_unmap_sg; +extern ia64_mv_dma_supported hwsw_dma_supported; +extern ia64_mv_dma_mapping_error hwsw_dma_mapping_error; +extern ia64_mv_dma_sync_single_for_cpu hwsw_sync_single_for_cpu; +extern ia64_mv_dma_sync_sg_for_cpu hwsw_sync_sg_for_cpu; +extern ia64_mv_dma_sync_single_for_device hwsw_sync_single_for_device; +extern ia64_mv_dma_sync_sg_for_device hwsw_sync_sg_for_device; + +/* + * This stuff has dual use! + * + * For a generic kernel, the macros are used to initialize the + * platform's machvec structure. When compiling a non-generic kernel, + * the macros are used directly. + */ +#define platform_name "hpzx1_swiotlb" + +#define platform_setup dig_setup +#define platform_dma_init hwsw_init +#define platform_dma_alloc_coherent hwsw_alloc_coherent +#define platform_dma_free_coherent hwsw_free_coherent +#define platform_dma_map_single hwsw_map_single +#define platform_dma_unmap_single hwsw_unmap_single +#define platform_dma_map_sg hwsw_map_sg +#define platform_dma_unmap_sg hwsw_unmap_sg +#define platform_dma_supported hwsw_dma_supported +#define platform_dma_mapping_error hwsw_dma_mapping_error +#define platform_dma_sync_single_for_cpu hwsw_sync_single_for_cpu +#define platform_dma_sync_sg_for_cpu hwsw_sync_sg_for_cpu +#define platform_dma_sync_single_for_device hwsw_sync_single_for_device +#define platform_dma_sync_sg_for_device hwsw_sync_sg_for_device + +#endif /* _ASM_IA64_MACHVEC_HPZX1_SWIOTLB_h */ diff -Nru a/include/asm-ia64/machvec_init.h b/include/asm-ia64/machvec_init.h --- a/include/asm-ia64/machvec_init.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-ia64/machvec_init.h 2005-01-13 16:25:56 -08:00 @@ -5,6 +5,9 @@ extern ia64_mv_irq_desc __ia64_irq_desc; extern ia64_mv_irq_to_vector __ia64_irq_to_vector; extern ia64_mv_local_vector_to_irq __ia64_local_vector_to_irq; +extern ia64_mv_pci_get_legacy_mem_t ia64_pci_get_legacy_mem; +extern ia64_mv_pci_legacy_read_t ia64_pci_legacy_read; +extern ia64_mv_pci_legacy_write_t ia64_pci_legacy_write; extern ia64_mv_inb_t __ia64_inb; extern ia64_mv_inw_t __ia64_inw; diff -Nru a/include/asm-ia64/machvec_sn2.h b/include/asm-ia64/machvec_sn2.h --- a/include/asm-ia64/machvec_sn2.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-ia64/machvec_sn2.h 2005-01-13 16:25:56 -08:00 @@ -43,6 +43,9 @@ extern ia64_mv_irq_desc sn_irq_desc; extern ia64_mv_irq_to_vector sn_irq_to_vector; extern ia64_mv_local_vector_to_irq sn_local_vector_to_irq; +extern ia64_mv_pci_get_legacy_mem_t sn_pci_get_legacy_mem; +extern ia64_mv_pci_legacy_read_t sn_pci_legacy_read; +extern ia64_mv_pci_legacy_write_t sn_pci_legacy_write; extern ia64_mv_inb_t __sn_inb; extern ia64_mv_inw_t __sn_inw; extern ia64_mv_inl_t __sn_inl; @@ -105,6 +108,9 @@ #define platform_irq_desc sn_irq_desc #define platform_irq_to_vector sn_irq_to_vector #define platform_local_vector_to_irq sn_local_vector_to_irq +#define platform_pci_get_legacy_mem sn_pci_get_legacy_mem +#define platform_pci_legacy_read sn_pci_legacy_read +#define platform_pci_legacy_write sn_pci_legacy_write #define platform_dma_init machvec_noop #define platform_dma_alloc_coherent sn_dma_alloc_coherent #define platform_dma_free_coherent sn_dma_free_coherent diff -Nru a/include/asm-ia64/numnodes.h b/include/asm-ia64/numnodes.h --- a/include/asm-ia64/numnodes.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-ia64/numnodes.h 2005-01-13 16:25:56 -08:00 @@ -4,7 +4,7 @@ #ifdef CONFIG_IA64_DIG /* Max 8 Nodes */ #define NODES_SHIFT 3 -#elif defined(CONFIG_IA64_HP_ZX1) +#elif defined(CONFIG_IA64_HP_ZX1) || defined(CONFIG_IA64_HP_ZX1_SWIOTLB) /* Max 32 Nodes */ #define NODES_SHIFT 5 #elif defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC) diff -Nru a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h --- a/include/asm-ia64/pci.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-ia64/pci.h 2005-01-13 16:25:56 -08:00 @@ -85,6 +85,20 @@ #define HAVE_PCI_MMAP extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma, enum pci_mmap_state mmap_state, int write_combine); +#define HAVE_PCI_LEGACY +extern int pci_mmap_legacy_page_range(struct pci_bus *bus, + struct vm_area_struct *vma); +extern ssize_t pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off, + size_t count); +extern ssize_t pci_write_legacy_io(struct kobject *kobj, char *buf, loff_t off, + size_t count); +extern int pci_mmap_legacy_mem(struct kobject *kobj, + struct bin_attribute *attr, + struct vm_area_struct *vma); + +#define pci_get_legacy_mem platform_pci_get_legacy_mem +#define pci_legacy_read platform_pci_legacy_read +#define pci_legacy_write platform_pci_legacy_write struct pci_window { struct resource resource; diff -Nru a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h --- a/include/asm-ia64/sn/sn_sal.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-ia64/sn/sn_sal.h 2005-01-13 16:25:56 -08:00 @@ -203,7 +203,7 @@ return ret_stuff.v0; } -static inline u64 +static inline char * ia64_sn_get_klconfig_addr(nasid_t nasid) { struct ia64_sal_retval ret_stuff; @@ -223,7 +223,7 @@ if (ret_stuff.status != 0) { panic("ia64_sn_get_klconfig_addr: Returned error %lx\n", ret_stuff.status); } - return(ret_stuff.v0); + return ret_stuff.v0 ? __va(ret_stuff.v0) : NULL; } /* @@ -472,6 +472,52 @@ if (isrv.status) return 0; return isrv.v0; +} + +/** + * ia64_sn_probe_mem - read from memory safely + * @addr: address to probe + * @size: number bytes to read (1,2,4,8) + * @data_ptr: address to store value read by probe (-1 returned if probe fails) + * + * Call into the SAL to do a memory read. If the read generates a machine + * check, this routine will recover gracefully and return -1 to the caller. + * @addr is usually a kernel virtual address in uncached space (i.e. the + * address starts with 0xc), but if called in physical mode, @addr should + * be a physical address. + * + * Return values: + * 0 - probe successful + * 1 - probe failed (generated MCA) + * 2 - Bad arg + * <0 - PAL error + */ +static inline u64 +ia64_sn_probe_mem(long addr, long size, void *data_ptr) +{ + struct ia64_sal_retval isrv; + + SAL_CALL(isrv, SN_SAL_PROBE, addr, size, 0, 0, 0, 0, 0); + + if (data_ptr) { + switch (size) { + case 1: + *((u8*)data_ptr) = (u8)isrv.v0; + break; + case 2: + *((u16*)data_ptr) = (u16)isrv.v0; + break; + case 4: + *((u32*)data_ptr) = (u32)isrv.v0; + break; + case 8: + *((u64*)data_ptr) = (u64)isrv.v0; + break; + default: + isrv.status = 2; + } + } + return isrv.status; } /* diff -Nru a/include/asm-ppc/reg.h b/include/asm-ppc/reg.h --- a/include/asm-ppc/reg.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-ppc/reg.h 2005-01-13 16:25:56 -08:00 @@ -329,6 +329,7 @@ #define MMCR0_PMC2_CYCLES 0x1 #define MMCR0_PMC2_ITLB 0x7 #define MMCR0_PMC2_LOADMISSTIME 0x5 +#define MMCR0_PMXE (1 << 26) /* Short-hand versions for a number of the above SPRNs */ #define CTR SPRN_CTR /* Counter Register */ diff -Nru a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h --- a/include/asm-ppc64/smp.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-ppc64/smp.h 2005-01-13 16:25:56 -08:00 @@ -38,7 +38,7 @@ extern void smp_message_recv(int, struct pt_regs *); -#define smp_processor_id() (get_paca()->paca_index) +#define __smp_processor_id() (get_paca()->paca_index) #define hard_smp_processor_id() (get_paca()->hw_cpu_id) extern cpumask_t cpu_sibling_map[NR_CPUS]; diff -Nru a/include/asm-ppc64/spinlock.h b/include/asm-ppc64/spinlock.h --- a/include/asm-ppc64/spinlock.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-ppc64/spinlock.h 2005-01-13 16:25:56 -08:00 @@ -222,8 +222,6 @@ : "cr0", "memory"); } -#define _raw_read_trylock(lock) generic_raw_read_trylock(lock) - /* * This returns the old value in the lock, * so we got the write lock if the return value is 0. diff -Nru a/include/asm-ppc64/thread_info.h b/include/asm-ppc64/thread_info.h --- a/include/asm-ppc64/thread_info.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-ppc64/thread_info.h 2005-01-13 16:25:56 -08:00 @@ -12,6 +12,7 @@ #ifndef __ASSEMBLY__ #include +#include #include #include #include @@ -22,12 +23,13 @@ struct thread_info { struct task_struct *task; /* main task structure */ struct exec_domain *exec_domain; /* execution domain */ - unsigned long flags; /* low level flags */ int cpu; /* cpu we're on */ int preempt_count; struct restart_block restart_block; /* set by force_successful_syscall_return */ unsigned char syscall_noerror; + /* low level flags - has atomic operations done on it */ + unsigned long flags ____cacheline_aligned_in_smp; }; /* @@ -39,12 +41,12 @@ { \ .task = &tsk, \ .exec_domain = &default_exec_domain, \ - .flags = 0, \ .cpu = 0, \ .preempt_count = 1, \ .restart_block = { \ .fn = do_no_restart_syscall, \ }, \ + .flags = 0, \ } #define init_thread_info (init_thread_union.thread_info) diff -Nru a/include/asm-ppc64/tlbflush.h b/include/asm-ppc64/tlbflush.h --- a/include/asm-ppc64/tlbflush.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-ppc64/tlbflush.h 2005-01-13 16:25:56 -08:00 @@ -32,10 +32,11 @@ static inline void flush_tlb_pending(void) { - struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); + struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch); if (batch->index) __flush_tlb_pending(batch); + put_cpu_var(ppc64_tlb_batch); } #define flush_tlb_mm(mm) flush_tlb_pending() diff -Nru a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h --- a/include/asm-x86_64/numa.h 2005-01-13 16:25:56 -08:00 +++ b/include/asm-x86_64/numa.h 2005-01-13 16:25:56 -08:00 @@ -8,7 +8,7 @@ u64 start,end; }; -extern int compute_hash_shift(struct node *nodes); +extern int compute_hash_shift(struct node *nodes, int numnodes); #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) diff -Nru a/include/linux/arcdevice.h b/include/linux/arcdevice.h --- a/include/linux/arcdevice.h 2005-01-13 16:25:56 -08:00 +++ b/include/linux/arcdevice.h 2005-01-13 16:25:56 -08:00 @@ -343,7 +343,6 @@ void arcnet_unregister_proto(struct ArcProto *proto); irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs); -void arcdev_setup(struct net_device *dev); struct net_device *alloc_arcdev(char *name); void arcnet_rx(struct net_device *dev, int bufnum); diff -Nru a/include/linux/blkdev.h b/include/linux/blkdev.h --- a/include/linux/blkdev.h 2005-01-13 16:25:56 -08:00 +++ b/include/linux/blkdev.h 2005-01-13 16:25:56 -08:00 @@ -95,6 +95,7 @@ struct request_list { int count[2]; + int starved[2]; mempool_t *rq_pool; wait_queue_head_t wait[2]; wait_queue_head_t drain; diff -Nru a/include/linux/nodemask.h b/include/linux/nodemask.h --- a/include/linux/nodemask.h 2005-01-13 16:25:56 -08:00 +++ b/include/linux/nodemask.h 2005-01-13 16:25:56 -08:00 @@ -38,6 +38,8 @@ * * int first_node(mask) Number lowest set bit, or MAX_NUMNODES * int next_node(node, mask) Next node past 'node', or MAX_NUMNODES + * int first_unset_node(mask) First node not set in mask, or + * MAX_NUMNODES. * * nodemask_t nodemask_of_node(node) Return nodemask with bit 'node' set * NODE_MASK_ALL Initializer - all bits set @@ -234,6 +236,13 @@ } \ m; \ }) + +#define first_unset_node(mask) __first_unset_node(&(mask)) +static inline int __first_unset_node(const nodemask_t *maskp) +{ + return min_t(int,MAX_NUMNODES, + find_first_zero_bit(maskp->bits, MAX_NUMNODES)); +} #define NODE_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(MAX_NUMNODES) diff -Nru a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h --- a/include/scsi/scsi_dbg.h 2005-01-13 16:25:56 -08:00 +++ b/include/scsi/scsi_dbg.h 2005-01-13 16:25:56 -08:00 @@ -8,6 +8,9 @@ extern void __scsi_print_command(unsigned char *); extern void scsi_print_sense(const char *, struct scsi_cmnd *); extern void scsi_print_req_sense(const char *, struct scsi_request *); +extern void __scsi_print_sense(const char *name, + const unsigned char *sense_buffer, + int sense_len); extern void scsi_print_driverbyte(int); extern void scsi_print_hostbyte(int); extern void scsi_print_status(unsigned char); diff -Nru a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h --- a/include/scsi/scsi_device.h 2005-01-13 16:25:56 -08:00 +++ b/include/scsi/scsi_device.h 2005-01-13 16:25:56 -08:00 @@ -172,6 +172,8 @@ uint, uint, uint); extern struct scsi_device *__scsi_device_lookup(struct Scsi_Host *, uint, uint, uint); +extern void starget_for_each_device(struct scsi_target *, void *, + void (*fn)(struct scsi_device *, void *)); /* only exposed to implement shost_for_each_device */ extern struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *, diff -Nru a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h --- a/include/scsi/scsi_transport_fc.h 2005-01-13 16:25:56 -08:00 +++ b/include/scsi/scsi_transport_fc.h 2005-01-13 16:25:56 -08:00 @@ -185,6 +185,8 @@ #define FC_FC4_LIST_SIZE 32 #define FC_SYMBOLIC_NAME_SIZE 256 +#define FC_VERSION_STRING_SIZE 64 +#define FC_SERIAL_NUMBER_SIZE 80 struct fc_host_attrs { /* Fixed Attributes */ @@ -195,6 +197,11 @@ char symbolic_name[FC_SYMBOLIC_NAME_SIZE]; u32 supported_speeds; u32 maxframe_size; + char hardware_version[FC_VERSION_STRING_SIZE]; + char firmware_version[FC_VERSION_STRING_SIZE]; + char serial_number[FC_SERIAL_NUMBER_SIZE]; + char opt_rom_version[FC_VERSION_STRING_SIZE]; + char driver_version[FC_VERSION_STRING_SIZE]; /* Dynamic Attributes */ u32 port_id; @@ -226,6 +233,16 @@ (((struct fc_host_attrs *)(x)->shost_data)->supported_speeds) #define fc_host_maxframe_size(x) \ (((struct fc_host_attrs *)(x)->shost_data)->maxframe_size) +#define fc_host_hardware_version(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->hardware_version) +#define fc_host_firmware_version(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->firmware_version) +#define fc_host_serial_number(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->serial_number) +#define fc_host_opt_rom_version(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->opt_rom_version) +#define fc_host_driver_version(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->driver_version) #define fc_host_port_id(x) \ (((struct fc_host_attrs *)(x)->shost_data)->port_id) #define fc_host_port_type(x) \ @@ -285,6 +302,11 @@ unsigned long show_host_symbolic_name:1; unsigned long show_host_supported_speeds:1; unsigned long show_host_maxframe_size:1; + unsigned long show_host_hardware_version:1; + unsigned long show_host_firmware_version:1; + unsigned long show_host_serial_number:1; + unsigned long show_host_opt_rom_version:1; + unsigned long show_host_driver_version:1; /* host dynamic attributes */ unsigned long show_host_port_id:1; unsigned long show_host_port_type:1; diff -Nru a/lib/Kconfig.debug b/lib/Kconfig.debug --- a/lib/Kconfig.debug 2005-01-13 16:25:56 -08:00 +++ b/lib/Kconfig.debug 2005-01-13 16:25:56 -08:00 @@ -50,7 +50,7 @@ config DEBUG_PREEMPT bool "Debug preemptible kernel" - depends on PREEMPT && X86 + depends on PREEMPT && (X86 || PPC64) default y help If you say Y here then the kernel will use a debug variant of the diff -Nru a/mm/mmap.c b/mm/mmap.c --- a/mm/mmap.c 2005-01-13 16:25:56 -08:00 +++ b/mm/mmap.c 2005-01-13 16:25:56 -08:00 @@ -1475,7 +1475,6 @@ int expand_stack(struct vm_area_struct * vma, unsigned long address) { int error; - unsigned long size, grow; if (!(vma->vm_flags & VM_GROWSUP)) return -EFAULT; @@ -1495,12 +1494,19 @@ */ address += 4 + PAGE_SIZE - 1; address &= PAGE_MASK; - size = address - vma->vm_start; - grow = (address - vma->vm_end) >> PAGE_SHIFT; + error = 0; - error = acct_stack_growth(vma, size, grow); - if (!error) - vma->vm_end = address; + /* Somebody else might have raced and expanded it already */ + if (address > vma->vm_end) { + unsigned long size, grow; + + size = address - vma->vm_start; + grow = (address - vma->vm_end) >> PAGE_SHIFT; + + error = acct_stack_growth(vma, size, grow); + if (!error) + vma->vm_end = address; + } anon_vma_unlock(vma); return error; } @@ -1528,7 +1534,6 @@ int expand_stack(struct vm_area_struct *vma, unsigned long address) { int error; - unsigned long size, grow; /* * We must make sure the anon_vma is allocated @@ -1544,13 +1549,20 @@ * anon_vma lock to serialize against concurrent expand_stacks. */ address &= PAGE_MASK; - size = vma->vm_end - address; - grow = (vma->vm_start - address) >> PAGE_SHIFT; + error = 0; - error = acct_stack_growth(vma, size, grow); - if (!error) { - vma->vm_start = address; - vma->vm_pgoff -= grow; + /* Somebody else might have raced and expanded it already */ + if (address < vma->vm_start) { + unsigned long size, grow; + + size = vma->vm_end - address; + grow = (vma->vm_start - address) >> PAGE_SHIFT; + + error = acct_stack_growth(vma, size, grow); + if (!error) { + vma->vm_start = address; + vma->vm_pgoff -= grow; + } } anon_vma_unlock(vma); return error; @@ -1858,6 +1870,16 @@ return ret; } +static inline void verify_mm_writelocked(struct mm_struct *mm) +{ +#ifdef CONFIG_DEBUG_KERNEL + if (unlikely(down_read_trylock(&mm->mmap_sem))) { + WARN_ON(1); + up_read(&mm->mmap_sem); + } +#endif +} + /* * this is really a simplified "do_mmap". it only handles * anonymous maps. eventually we may be able to do some @@ -1889,6 +1911,12 @@ if (locked > lock_limit && !capable(CAP_IPC_LOCK)) return -EAGAIN; } + + /* + * mm->mmap_sem is required to protect against another thread + * changing the mappings in case we sleep. + */ + verify_mm_writelocked(mm); /* * Clear old maps. this also does some error checking for us